From ca8152000954e2299d85e17b6278a70ad1ae86ca Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 30 Aug 2023 18:36:25 +0000 Subject: [PATCH] feat: [bigquerydatapolicy] support using custom UDF in the data policy (#9759) - [ ] Regenerate this pull request now. PiperOrigin-RevId: 559480224 Source-Link: https://togithub.com/googleapis/googleapis/commit/4ffd6cd05599eb77af67f3235a4091ea9b20c571 Source-Link: https://togithub.com/googleapis/googleapis-gen/commit/2fa3b7496f92745b187d1bb5f9e65e5d036a5d07 Copy-Tag: eyJwIjoiamF2YS1iaWdxdWVyeWRhdGFwb2xpY3kvLk93bEJvdC55YW1sIiwiaCI6IjJmYTNiNzQ5NmY5Mjc0NWIxODdkMWJiNWY5ZTY1ZTVkMDM2YTVkMDcifQ== BEGIN_NESTED_COMMIT fix: [bigquerydatapolicy] sync the new PredefinedExpression types to the client library PiperOrigin-RevId: 555709495 Source-Link: https://togithub.com/googleapis/googleapis/commit/30ed2662a85403cbdeb9ea38df1e414a2a276b83 Source-Link: https://togithub.com/googleapis/googleapis-gen/commit/767a8c61834d7f6d305c93618a96cc3b6c4c3240 Copy-Tag: eyJwIjoiamF2YS1iaWdxdWVyeWRhdGFwb2xpY3kvLk93bEJvdC55YW1sIiwiaCI6Ijc2N2E4YzYxODM0ZDdmNmQzMDVjOTM2MThhOTZjYzNiNmM0YzMyNDAifQ== END_NESTED_COMMIT --- java-bigquerydatapolicy/README.md | 4 +- .../datapolicies/v1/DataMaskingPolicy.java | 412 +++++++++++++++++- .../v1/DataMaskingPolicyOrBuilder.java | 43 ++ .../datapolicies/v1/DataPolicyProto.java | 127 +++--- .../v1/ListDataPoliciesRequest.java | 49 ++- .../v1/ListDataPoliciesRequestOrBuilder.java | 14 +- .../bigquery/datapolicies/v1/datapolicy.proto | 62 ++- 7 files changed, 607 insertions(+), 104 deletions(-) diff --git a/java-bigquerydatapolicy/README.md b/java-bigquerydatapolicy/README.md index a40ad5ade577..1f1f4bcf88b1 100644 --- a/java-bigquerydatapolicy/README.md +++ b/java-bigquerydatapolicy/README.md @@ -23,7 +23,7 @@ If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file: com.google.cloud libraries-bom - 26.19.0 + 26.22.0 pom import @@ -201,7 +201,7 @@ Java is a registered trademark of Oracle and/or its affiliates. [kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java11.html [stability-image]: https://img.shields.io/badge/stability-preview-yellow [maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-bigquerydatapolicy.svg -[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-bigquerydatapolicy/0.18.0 +[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-bigquerydatapolicy/0.20.0 [authentication]: https://github.com/googleapis/google-cloud-java#authentication [auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes [predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles diff --git a/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/DataMaskingPolicy.java b/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/DataMaskingPolicy.java index b20728be9ea2..440e5911d887 100644 --- a/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/DataMaskingPolicy.java +++ b/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/DataMaskingPolicy.java @@ -116,10 +116,10 @@ public enum PredefinedExpression implements com.google.protobuf.ProtocolMessageE * * FLOAT: 0.0 * * NUMERIC: 0 * * BOOLEAN: FALSE - * * TIMESTAMP: 0001-01-01 00:00:00 UTC - * * DATE: 0001-01-01 + * * TIMESTAMP: 1970-01-01 00:00:00 UTC + * * DATE: 1970-01-01 * * TIME: 00:00:00 - * * DATETIME: 0001-01-01T00:00:00 + * * DATETIME: 1970-01-01T00:00:00 * * GEOGRAPHY: POINT(0 0) * * BIGNUMERIC: 0 * * ARRAY: [] @@ -130,6 +130,76 @@ public enum PredefinedExpression implements com.google.protobuf.ProtocolMessageE * DEFAULT_MASKING_VALUE = 7; */ DEFAULT_MASKING_VALUE(7), + /** + * + * + *
+     * Masking expression shows the last four characters of text.
+     * The masking behavior is as follows:
+     *
+     * * If text length > 4 characters: Replace text with XXXXX, append last
+     * four characters of original text.
+     * * If text length <= 4 characters: Apply SHA-256 hash.
+     * 
+ * + * LAST_FOUR_CHARACTERS = 9; + */ + LAST_FOUR_CHARACTERS(9), + /** + * + * + *
+     * Masking expression shows the first four characters of text.
+     * The masking behavior is as follows:
+     *
+     * * If text length > 4 characters: Replace text with XXXXX, prepend first
+     * four characters of original text.
+     * * If text length <= 4 characters: Apply SHA-256 hash.
+     * 
+ * + * FIRST_FOUR_CHARACTERS = 10; + */ + FIRST_FOUR_CHARACTERS(10), + /** + * + * + *
+     * Masking expression for email addresses.
+     * The masking behavior is as follows:
+     *
+     * * Syntax-valid email address: Replace username with XXXXX. For example,
+     * cloudysanfrancisco@gmail.com becomes XXXXX@gmail.com.
+     * * Syntax-invalid email address: Apply SHA-256 hash.
+     *
+     * For more information, see [Email
+     * mask](https://cloud.google.com/bigquery/docs/column-data-masking-intro#masking_options).
+     * 
+ * + * EMAIL_MASK = 12; + */ + EMAIL_MASK(12), + /** + * + * + *
+     * Masking expression to only show the year of `Date`,
+     * `DateTime` and `TimeStamp`. For example, with the
+     * year 2076:
+     *
+     * * DATE         :  2076-01-01
+     * * DATETIME     :  2076-01-01T00:00:00
+     * * TIMESTAMP    :  2076-01-01 00:00:00 UTC
+     *
+     * Truncation occurs according to the UTC time zone. To change this, adjust
+     * the default time zone using the `time_zone` system variable.
+     * For more information, see the <a
+     * href="https://cloud.google.com/bigquery/docs/reference/system-variables">System
+     * variables reference</a>.
+     * 
+ * + * DATE_YEAR_MASK = 13; + */ + DATE_YEAR_MASK(13), UNRECOGNIZED(-1), ; @@ -177,10 +247,10 @@ public enum PredefinedExpression implements com.google.protobuf.ProtocolMessageE * * FLOAT: 0.0 * * NUMERIC: 0 * * BOOLEAN: FALSE - * * TIMESTAMP: 0001-01-01 00:00:00 UTC - * * DATE: 0001-01-01 + * * TIMESTAMP: 1970-01-01 00:00:00 UTC + * * DATE: 1970-01-01 * * TIME: 00:00:00 - * * DATETIME: 0001-01-01T00:00:00 + * * DATETIME: 1970-01-01T00:00:00 * * GEOGRAPHY: POINT(0 0) * * BIGNUMERIC: 0 * * ARRAY: [] @@ -191,6 +261,76 @@ public enum PredefinedExpression implements com.google.protobuf.ProtocolMessageE * DEFAULT_MASKING_VALUE = 7; */ public static final int DEFAULT_MASKING_VALUE_VALUE = 7; + /** + * + * + *
+     * Masking expression shows the last four characters of text.
+     * The masking behavior is as follows:
+     *
+     * * If text length > 4 characters: Replace text with XXXXX, append last
+     * four characters of original text.
+     * * If text length <= 4 characters: Apply SHA-256 hash.
+     * 
+ * + * LAST_FOUR_CHARACTERS = 9; + */ + public static final int LAST_FOUR_CHARACTERS_VALUE = 9; + /** + * + * + *
+     * Masking expression shows the first four characters of text.
+     * The masking behavior is as follows:
+     *
+     * * If text length > 4 characters: Replace text with XXXXX, prepend first
+     * four characters of original text.
+     * * If text length <= 4 characters: Apply SHA-256 hash.
+     * 
+ * + * FIRST_FOUR_CHARACTERS = 10; + */ + public static final int FIRST_FOUR_CHARACTERS_VALUE = 10; + /** + * + * + *
+     * Masking expression for email addresses.
+     * The masking behavior is as follows:
+     *
+     * * Syntax-valid email address: Replace username with XXXXX. For example,
+     * cloudysanfrancisco@gmail.com becomes XXXXX@gmail.com.
+     * * Syntax-invalid email address: Apply SHA-256 hash.
+     *
+     * For more information, see [Email
+     * mask](https://cloud.google.com/bigquery/docs/column-data-masking-intro#masking_options).
+     * 
+ * + * EMAIL_MASK = 12; + */ + public static final int EMAIL_MASK_VALUE = 12; + /** + * + * + *
+     * Masking expression to only show the year of `Date`,
+     * `DateTime` and `TimeStamp`. For example, with the
+     * year 2076:
+     *
+     * * DATE         :  2076-01-01
+     * * DATETIME     :  2076-01-01T00:00:00
+     * * TIMESTAMP    :  2076-01-01 00:00:00 UTC
+     *
+     * Truncation occurs according to the UTC time zone. To change this, adjust
+     * the default time zone using the `time_zone` system variable.
+     * For more information, see the <a
+     * href="https://cloud.google.com/bigquery/docs/reference/system-variables">System
+     * variables reference</a>.
+     * 
+ * + * DATE_YEAR_MASK = 13; + */ + public static final int DATE_YEAR_MASK_VALUE = 13; public final int getNumber() { if (this == UNRECOGNIZED) { @@ -224,6 +364,14 @@ public static PredefinedExpression forNumber(int value) { return ALWAYS_NULL; case 7: return DEFAULT_MASKING_VALUE; + case 9: + return LAST_FOUR_CHARACTERS; + case 10: + return FIRST_FOUR_CHARACTERS; + case 12: + return EMAIL_MASK; + case 13: + return DATE_YEAR_MASK; default: return null; } @@ -292,6 +440,7 @@ public enum MaskingExpressionCase com.google.protobuf.Internal.EnumLite, com.google.protobuf.AbstractMessage.InternalOneOfEnum { PREDEFINED_EXPRESSION(1), + ROUTINE(3), MASKINGEXPRESSION_NOT_SET(0); private final int value; @@ -312,6 +461,8 @@ public static MaskingExpressionCase forNumber(int value) { switch (value) { case 1: return PREDEFINED_EXPRESSION; + case 3: + return ROUTINE; case 0: return MASKINGEXPRESSION_NOT_SET; default: @@ -392,6 +543,82 @@ public int getPredefinedExpressionValue() { .PREDEFINED_EXPRESSION_UNSPECIFIED; } + public static final int ROUTINE_FIELD_NUMBER = 3; + /** + * + * + *
+   * The name of the BigQuery routine that contains the custom masking
+   * routine, in the format of
+   * `projects/{project_number}/datasets/{dataset_id}/routines/{routine_id}`.
+   * 
+ * + * string routine = 3; + * + * @return Whether the routine field is set. + */ + public boolean hasRoutine() { + return maskingExpressionCase_ == 3; + } + /** + * + * + *
+   * The name of the BigQuery routine that contains the custom masking
+   * routine, in the format of
+   * `projects/{project_number}/datasets/{dataset_id}/routines/{routine_id}`.
+   * 
+ * + * string routine = 3; + * + * @return The routine. + */ + public java.lang.String getRoutine() { + java.lang.Object ref = ""; + if (maskingExpressionCase_ == 3) { + ref = maskingExpression_; + } + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (maskingExpressionCase_ == 3) { + maskingExpression_ = s; + } + return s; + } + } + /** + * + * + *
+   * The name of the BigQuery routine that contains the custom masking
+   * routine, in the format of
+   * `projects/{project_number}/datasets/{dataset_id}/routines/{routine_id}`.
+   * 
+ * + * string routine = 3; + * + * @return The bytes for routine. + */ + public com.google.protobuf.ByteString getRoutineBytes() { + java.lang.Object ref = ""; + if (maskingExpressionCase_ == 3) { + ref = maskingExpression_; + } + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + if (maskingExpressionCase_ == 3) { + maskingExpression_ = b; + } + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + private byte memoizedIsInitialized = -1; @java.lang.Override @@ -409,6 +636,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io if (maskingExpressionCase_ == 1) { output.writeEnum(1, ((java.lang.Integer) maskingExpression_)); } + if (maskingExpressionCase_ == 3) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, maskingExpression_); + } getUnknownFields().writeTo(output); } @@ -423,6 +653,9 @@ public int getSerializedSize() { com.google.protobuf.CodedOutputStream.computeEnumSize( 1, ((java.lang.Integer) maskingExpression_)); } + if (maskingExpressionCase_ == 3) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, maskingExpression_); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -444,6 +677,9 @@ public boolean equals(final java.lang.Object obj) { case 1: if (getPredefinedExpressionValue() != other.getPredefinedExpressionValue()) return false; break; + case 3: + if (!getRoutine().equals(other.getRoutine())) return false; + break; case 0: default: } @@ -463,6 +699,10 @@ public int hashCode() { hash = (37 * hash) + PREDEFINED_EXPRESSION_FIELD_NUMBER; hash = (53 * hash) + getPredefinedExpressionValue(); break; + case 3: + hash = (37 * hash) + ROUTINE_FIELD_NUMBER; + hash = (53 * hash) + getRoutine().hashCode(); + break; case 0: default: } @@ -705,6 +945,13 @@ public Builder mergeFrom(com.google.cloud.bigquery.datapolicies.v1.DataMaskingPo setPredefinedExpressionValue(other.getPredefinedExpressionValue()); break; } + case ROUTINE: + { + maskingExpressionCase_ = 3; + maskingExpression_ = other.maskingExpression_; + onChanged(); + break; + } case MASKINGEXPRESSION_NOT_SET: { break; @@ -743,6 +990,13 @@ public Builder mergeFrom( maskingExpression_ = rawValue; break; } // case 8 + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + maskingExpressionCase_ = 3; + maskingExpression_ = s; + break; + } // case 26 default: { if (!super.parseUnknownField(input, extensionRegistry, tag)) { @@ -907,6 +1161,152 @@ public Builder clearPredefinedExpression() { return this; } + /** + * + * + *
+     * The name of the BigQuery routine that contains the custom masking
+     * routine, in the format of
+     * `projects/{project_number}/datasets/{dataset_id}/routines/{routine_id}`.
+     * 
+ * + * string routine = 3; + * + * @return Whether the routine field is set. + */ + @java.lang.Override + public boolean hasRoutine() { + return maskingExpressionCase_ == 3; + } + /** + * + * + *
+     * The name of the BigQuery routine that contains the custom masking
+     * routine, in the format of
+     * `projects/{project_number}/datasets/{dataset_id}/routines/{routine_id}`.
+     * 
+ * + * string routine = 3; + * + * @return The routine. + */ + @java.lang.Override + public java.lang.String getRoutine() { + java.lang.Object ref = ""; + if (maskingExpressionCase_ == 3) { + ref = maskingExpression_; + } + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (maskingExpressionCase_ == 3) { + maskingExpression_ = s; + } + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The name of the BigQuery routine that contains the custom masking
+     * routine, in the format of
+     * `projects/{project_number}/datasets/{dataset_id}/routines/{routine_id}`.
+     * 
+ * + * string routine = 3; + * + * @return The bytes for routine. + */ + @java.lang.Override + public com.google.protobuf.ByteString getRoutineBytes() { + java.lang.Object ref = ""; + if (maskingExpressionCase_ == 3) { + ref = maskingExpression_; + } + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + if (maskingExpressionCase_ == 3) { + maskingExpression_ = b; + } + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The name of the BigQuery routine that contains the custom masking
+     * routine, in the format of
+     * `projects/{project_number}/datasets/{dataset_id}/routines/{routine_id}`.
+     * 
+ * + * string routine = 3; + * + * @param value The routine to set. + * @return This builder for chaining. + */ + public Builder setRoutine(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + maskingExpressionCase_ = 3; + maskingExpression_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The name of the BigQuery routine that contains the custom masking
+     * routine, in the format of
+     * `projects/{project_number}/datasets/{dataset_id}/routines/{routine_id}`.
+     * 
+ * + * string routine = 3; + * + * @return This builder for chaining. + */ + public Builder clearRoutine() { + if (maskingExpressionCase_ == 3) { + maskingExpressionCase_ = 0; + maskingExpression_ = null; + onChanged(); + } + return this; + } + /** + * + * + *
+     * The name of the BigQuery routine that contains the custom masking
+     * routine, in the format of
+     * `projects/{project_number}/datasets/{dataset_id}/routines/{routine_id}`.
+     * 
+ * + * string routine = 3; + * + * @param value The bytes for routine to set. + * @return This builder for chaining. + */ + public Builder setRoutineBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + maskingExpressionCase_ = 3; + maskingExpression_ = value; + onChanged(); + return this; + } + @java.lang.Override public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); diff --git a/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/DataMaskingPolicyOrBuilder.java b/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/DataMaskingPolicyOrBuilder.java index 5a6cf8ebc09e..cdd32ae84164 100644 --- a/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/DataMaskingPolicyOrBuilder.java +++ b/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/DataMaskingPolicyOrBuilder.java @@ -67,6 +67,49 @@ public interface DataMaskingPolicyOrBuilder com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy.PredefinedExpression getPredefinedExpression(); + /** + * + * + *
+   * The name of the BigQuery routine that contains the custom masking
+   * routine, in the format of
+   * `projects/{project_number}/datasets/{dataset_id}/routines/{routine_id}`.
+   * 
+ * + * string routine = 3; + * + * @return Whether the routine field is set. + */ + boolean hasRoutine(); + /** + * + * + *
+   * The name of the BigQuery routine that contains the custom masking
+   * routine, in the format of
+   * `projects/{project_number}/datasets/{dataset_id}/routines/{routine_id}`.
+   * 
+ * + * string routine = 3; + * + * @return The routine. + */ + java.lang.String getRoutine(); + /** + * + * + *
+   * The name of the BigQuery routine that contains the custom masking
+   * routine, in the format of
+   * `projects/{project_number}/datasets/{dataset_id}/routines/{routine_id}`.
+   * 
+ * + * string routine = 3; + * + * @return The bytes for routine. + */ + com.google.protobuf.ByteString getRoutineBytes(); + com.google.cloud.bigquery.datapolicies.v1.DataMaskingPolicy.MaskingExpressionCase getMaskingExpressionCase(); } diff --git a/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/DataPolicyProto.java b/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/DataPolicyProto.java index a357c9bd184f..9332f237b20a 100644 --- a/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/DataPolicyProto.java +++ b/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/DataPolicyProto.java @@ -115,69 +115,72 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "uerydatapolicy.googleapis.com/DataPolicy" + "\022Bprojects/{project}/locations/{location" + "}/dataPolicies/{data_policy}B\020\n\016matching" - + "_labelB\010\n\006policy\"\220\002\n\021DataMaskingPolicy\022n" + + "_labelB\010\n\006policy\"\375\002\n\021DataMaskingPolicy\022n" + "\n\025predefined_expression\030\001 \001(\0162M.google.c" + "loud.bigquery.datapolicies.v1.DataMaskin" - + "gPolicy.PredefinedExpressionH\000\"u\n\024Predef" - + "inedExpression\022%\n!PREDEFINED_EXPRESSION_" - + "UNSPECIFIED\020\000\022\n\n\006SHA256\020\003\022\017\n\013ALWAYS_NULL" - + "\020\005\022\031\n\025DEFAULT_MASKING_VALUE\020\007B\024\n\022masking" - + "_expression2\220\017\n\021DataPolicyService\022\341\001\n\020Cr" - + "eateDataPolicy\022>.google.cloud.bigquery.d" - + "atapolicies.v1.CreateDataPolicyRequest\0321" - + ".google.cloud.bigquery.datapolicies.v1.D" - + "ataPolicy\"Z\332A\022parent,data_policy\202\323\344\223\002?\"0" - + "/v1/{parent=projects/*/locations/*}/data" - + "Policies:\013data_policy\022\362\001\n\020UpdateDataPoli" - + "cy\022>.google.cloud.bigquery.datapolicies." - + "v1.UpdateDataPolicyRequest\0321.google.clou" - + "d.bigquery.datapolicies.v1.DataPolicy\"k\332" - + "A\027data_policy,update_mask\202\323\344\223\002K2.google.cloud.bigquery.datapoli" - + "cies.v1.RenameDataPolicyRequest\0321.google" - + ".cloud.bigquery.datapolicies.v1.DataPoli" - + "cy\"\\\332A\027name,new_data_policy_id\202\323\344\223\002<\"7/v" - + "1/{name=projects/*/locations/*/dataPolic" - + "ies/*}:rename:\001*\022\253\001\n\020DeleteDataPolicy\022>." - + "google.cloud.bigquery.datapolicies.v1.De" - + "leteDataPolicyRequest\032\026.google.protobuf." - + "Empty\"?\332A\004name\202\323\344\223\0022*0/v1/{name=projects" - + "/*/locations/*/dataPolicies/*}\022\300\001\n\rGetDa" - + "taPolicy\022;.google.cloud.bigquery.datapol" - + "icies.v1.GetDataPolicyRequest\0321.google.c" - + "loud.bigquery.datapolicies.v1.DataPolicy" - + "\"?\332A\004name\202\323\344\223\0022\0220/v1/{name=projects/*/lo" - + "cations/*/dataPolicies/*}\022\326\001\n\020ListDataPo" - + "licies\022>.google.cloud.bigquery.datapolic" - + "ies.v1.ListDataPoliciesRequest\032?.google." - + "cloud.bigquery.datapolicies.v1.ListDataP" - + "oliciesResponse\"A\332A\006parent\202\323\344\223\0022\0220/v1/{p" - + "arent=projects/*/locations/*}/dataPolici" - + "es\022\227\001\n\014GetIamPolicy\022\".google.iam.v1.GetI" - + "amPolicyRequest\032\025.google.iam.v1.Policy\"L" - + "\202\323\344\223\002F\"A/v1/{resource=projects/*/locatio" - + "ns/*/dataPolicies/*}:getIamPolicy:\001*\022\227\001\n" - + "\014SetIamPolicy\022\".google.iam.v1.SetIamPoli" - + "cyRequest\032\025.google.iam.v1.Policy\"L\202\323\344\223\002F" - + "\"A/v1/{resource=projects/*/locations/*/d" - + "ataPolicies/*}:setIamPolicy:\001*\022\275\001\n\022TestI" - + "amPermissions\022(.google.iam.v1.TestIamPer" - + "missionsRequest\032).google.iam.v1.TestIamP" - + "ermissionsResponse\"R\202\323\344\223\002L\"G/v1/{resourc" - + "e=projects/*/locations/*/dataPolicies/*}" - + ":testIamPermissions:\001*\032~\312A!bigquerydatap" - + "olicy.googleapis.com\322AWhttps://www.googl" - + "eapis.com/auth/bigquery,https://www.goog" - + "leapis.com/auth/cloud-platformB\211\002\n)com.g" - + "oogle.cloud.bigquery.datapolicies.v1B\017Da" - + "taPolicyProtoP\001ZMcloud.google.com/go/big" - + "query/datapolicies/apiv1/datapoliciespb;" - + "datapoliciespb\252\002%Google.Cloud.BigQuery.D" - + "ataPolicies.V1\312\002%Google\\Cloud\\BigQuery\\D" - + "ataPolicies\\V1\352\002)Google::Cloud::Bigquery" - + "::DataPolicies::V1b\006proto3" + + "gPolicy.PredefinedExpressionH\000\022\021\n\007routin" + + "e\030\003 \001(\tH\000\"\316\001\n\024PredefinedExpression\022%\n!PR" + + "EDEFINED_EXPRESSION_UNSPECIFIED\020\000\022\n\n\006SHA" + + "256\020\003\022\017\n\013ALWAYS_NULL\020\005\022\031\n\025DEFAULT_MASKIN" + + "G_VALUE\020\007\022\030\n\024LAST_FOUR_CHARACTERS\020\t\022\031\n\025F" + + "IRST_FOUR_CHARACTERS\020\n\022\016\n\nEMAIL_MASK\020\014\022\022" + + "\n\016DATE_YEAR_MASK\020\rB\024\n\022masking_expression" + + "2\220\017\n\021DataPolicyService\022\341\001\n\020CreateDataPol" + + "icy\022>.google.cloud.bigquery.datapolicies" + + ".v1.CreateDataPolicyRequest\0321.google.clo" + + "ud.bigquery.datapolicies.v1.DataPolicy\"Z" + + "\332A\022parent,data_policy\202\323\344\223\002?\"0/v1/{parent" + + "=projects/*/locations/*}/dataPolicies:\013d" + + "ata_policy\022\362\001\n\020UpdateDataPolicy\022>.google" + + ".cloud.bigquery.datapolicies.v1.UpdateDa" + + "taPolicyRequest\0321.google.cloud.bigquery." + + "datapolicies.v1.DataPolicy\"k\332A\027data_poli" + + "cy,update_mask\202\323\344\223\002K2.g" + + "oogle.cloud.bigquery.datapolicies.v1.Ren" + + "ameDataPolicyRequest\0321.google.cloud.bigq" + + "uery.datapolicies.v1.DataPolicy\"\\\332A\027name" + + ",new_data_policy_id\202\323\344\223\002<\"7/v1/{name=pro" + + "jects/*/locations/*/dataPolicies/*}:rena" + + "me:\001*\022\253\001\n\020DeleteDataPolicy\022>.google.clou" + + "d.bigquery.datapolicies.v1.DeleteDataPol" + + "icyRequest\032\026.google.protobuf.Empty\"?\332A\004n" + + "ame\202\323\344\223\0022*0/v1/{name=projects/*/location" + + "s/*/dataPolicies/*}\022\300\001\n\rGetDataPolicy\022;." + + "google.cloud.bigquery.datapolicies.v1.Ge" + + "tDataPolicyRequest\0321.google.cloud.bigque" + + "ry.datapolicies.v1.DataPolicy\"?\332A\004name\202\323" + + "\344\223\0022\0220/v1/{name=projects/*/locations/*/d" + + "ataPolicies/*}\022\326\001\n\020ListDataPolicies\022>.go" + + "ogle.cloud.bigquery.datapolicies.v1.List" + + "DataPoliciesRequest\032?.google.cloud.bigqu" + + "ery.datapolicies.v1.ListDataPoliciesResp" + + "onse\"A\332A\006parent\202\323\344\223\0022\0220/v1/{parent=proje" + + "cts/*/locations/*}/dataPolicies\022\227\001\n\014GetI" + + "amPolicy\022\".google.iam.v1.GetIamPolicyReq" + + "uest\032\025.google.iam.v1.Policy\"L\202\323\344\223\002F\"A/v1" + + "/{resource=projects/*/locations/*/dataPo" + + "licies/*}:getIamPolicy:\001*\022\227\001\n\014SetIamPoli" + + "cy\022\".google.iam.v1.SetIamPolicyRequest\032\025" + + ".google.iam.v1.Policy\"L\202\323\344\223\002F\"A/v1/{reso" + + "urce=projects/*/locations/*/dataPolicies" + + "/*}:setIamPolicy:\001*\022\275\001\n\022TestIamPermissio" + + "ns\022(.google.iam.v1.TestIamPermissionsReq" + + "uest\032).google.iam.v1.TestIamPermissionsR" + + "esponse\"R\202\323\344\223\002L\"G/v1/{resource=projects/" + + "*/locations/*/dataPolicies/*}:testIamPer" + + "missions:\001*\032~\312A!bigquerydatapolicy.googl" + + "eapis.com\322AWhttps://www.googleapis.com/a" + + "uth/bigquery,https://www.googleapis.com/" + + "auth/cloud-platformB\211\002\n)com.google.cloud" + + ".bigquery.datapolicies.v1B\017DataPolicyPro" + + "toP\001ZMcloud.google.com/go/bigquery/datap" + + "olicies/apiv1/datapoliciespb;datapolicie" + + "spb\252\002%Google.Cloud.BigQuery.DataPolicies" + + ".V1\312\002%Google\\Cloud\\BigQuery\\DataPolicies" + + "\\V1\352\002)Google::Cloud::Bigquery::DataPolic" + + "ies::V1b\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( @@ -268,7 +271,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_bigquery_datapolicies_v1_DataMaskingPolicy_descriptor, new java.lang.String[] { - "PredefinedExpression", "MaskingExpression", + "PredefinedExpression", "Routine", "MaskingExpression", }); com.google.protobuf.ExtensionRegistry registry = com.google.protobuf.ExtensionRegistry.newInstance(); diff --git a/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/ListDataPoliciesRequest.java b/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/ListDataPoliciesRequest.java index 53580b143dd7..c4df46163693 100644 --- a/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/ListDataPoliciesRequest.java +++ b/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/ListDataPoliciesRequest.java @@ -206,9 +206,10 @@ public com.google.protobuf.ByteString getPageTokenBytes() { * are associated with. Currently filter only supports * "policy<span></span>_tag" based filtering and OR based predicates. Sample * filter can be "policy<span></span>_tag: - * `'projects/1/locations/us/taxonomies/2/policyTags/3'`". You may use - * wildcard such as "policy<span></span>_tag: - * `'projects/1/locations/us/taxonomies/2/*'`". + * projects/1/locations/us/taxonomies/2/policyTags/3". + * You may also use wildcard such as "policy<span></span>_tag: + * projects/1/locations/us/taxonomies/2*". Please note that OR predicates + * cannot be used with wildcard filters. * * * string filter = 4; @@ -235,9 +236,10 @@ public java.lang.String getFilter() { * are associated with. Currently filter only supports * "policy<span></span>_tag" based filtering and OR based predicates. Sample * filter can be "policy<span></span>_tag: - * `'projects/1/locations/us/taxonomies/2/policyTags/3'`". You may use - * wildcard such as "policy<span></span>_tag: - * `'projects/1/locations/us/taxonomies/2/*'`". + * projects/1/locations/us/taxonomies/2/policyTags/3". + * You may also use wildcard such as "policy<span></span>_tag: + * projects/1/locations/us/taxonomies/2*". Please note that OR predicates + * cannot be used with wildcard filters. * * * string filter = 4; @@ -976,9 +978,10 @@ public Builder setPageTokenBytes(com.google.protobuf.ByteString value) { * are associated with. Currently filter only supports * "policy<span></span>_tag" based filtering and OR based predicates. Sample * filter can be "policy<span></span>_tag: - * `'projects/1/locations/us/taxonomies/2/policyTags/3'`". You may use - * wildcard such as "policy<span></span>_tag: - * `'projects/1/locations/us/taxonomies/2/*'`". + * projects/1/locations/us/taxonomies/2/policyTags/3". + * You may also use wildcard such as "policy<span></span>_tag: + * projects/1/locations/us/taxonomies/2*". Please note that OR predicates + * cannot be used with wildcard filters. * * * string filter = 4; @@ -1004,9 +1007,10 @@ public java.lang.String getFilter() { * are associated with. Currently filter only supports * "policy<span></span>_tag" based filtering and OR based predicates. Sample * filter can be "policy<span></span>_tag: - * `'projects/1/locations/us/taxonomies/2/policyTags/3'`". You may use - * wildcard such as "policy<span></span>_tag: - * `'projects/1/locations/us/taxonomies/2/*'`". + * projects/1/locations/us/taxonomies/2/policyTags/3". + * You may also use wildcard such as "policy<span></span>_tag: + * projects/1/locations/us/taxonomies/2*". Please note that OR predicates + * cannot be used with wildcard filters. * * * string filter = 4; @@ -1032,9 +1036,10 @@ public com.google.protobuf.ByteString getFilterBytes() { * are associated with. Currently filter only supports * "policy<span></span>_tag" based filtering and OR based predicates. Sample * filter can be "policy<span></span>_tag: - * `'projects/1/locations/us/taxonomies/2/policyTags/3'`". You may use - * wildcard such as "policy<span></span>_tag: - * `'projects/1/locations/us/taxonomies/2/*'`". + * projects/1/locations/us/taxonomies/2/policyTags/3". + * You may also use wildcard such as "policy<span></span>_tag: + * projects/1/locations/us/taxonomies/2*". Please note that OR predicates + * cannot be used with wildcard filters. * * * string filter = 4; @@ -1059,9 +1064,10 @@ public Builder setFilter(java.lang.String value) { * are associated with. Currently filter only supports * "policy<span></span>_tag" based filtering and OR based predicates. Sample * filter can be "policy<span></span>_tag: - * `'projects/1/locations/us/taxonomies/2/policyTags/3'`". You may use - * wildcard such as "policy<span></span>_tag: - * `'projects/1/locations/us/taxonomies/2/*'`". + * projects/1/locations/us/taxonomies/2/policyTags/3". + * You may also use wildcard such as "policy<span></span>_tag: + * projects/1/locations/us/taxonomies/2*". Please note that OR predicates + * cannot be used with wildcard filters. * * * string filter = 4; @@ -1082,9 +1088,10 @@ public Builder clearFilter() { * are associated with. Currently filter only supports * "policy<span></span>_tag" based filtering and OR based predicates. Sample * filter can be "policy<span></span>_tag: - * `'projects/1/locations/us/taxonomies/2/policyTags/3'`". You may use - * wildcard such as "policy<span></span>_tag: - * `'projects/1/locations/us/taxonomies/2/*'`". + * projects/1/locations/us/taxonomies/2/policyTags/3". + * You may also use wildcard such as "policy<span></span>_tag: + * projects/1/locations/us/taxonomies/2*". Please note that OR predicates + * cannot be used with wildcard filters. * * * string filter = 4; diff --git a/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/ListDataPoliciesRequestOrBuilder.java b/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/ListDataPoliciesRequestOrBuilder.java index 1ea091c176d8..d1db5190902d 100644 --- a/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/ListDataPoliciesRequestOrBuilder.java +++ b/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/java/com/google/cloud/bigquery/datapolicies/v1/ListDataPoliciesRequestOrBuilder.java @@ -104,9 +104,10 @@ public interface ListDataPoliciesRequestOrBuilder * are associated with. Currently filter only supports * "policy<span></span>_tag" based filtering and OR based predicates. Sample * filter can be "policy<span></span>_tag: - * `'projects/1/locations/us/taxonomies/2/policyTags/3'`". You may use - * wildcard such as "policy<span></span>_tag: - * `'projects/1/locations/us/taxonomies/2/*'`". + * projects/1/locations/us/taxonomies/2/policyTags/3". + * You may also use wildcard such as "policy<span></span>_tag: + * projects/1/locations/us/taxonomies/2*". Please note that OR predicates + * cannot be used with wildcard filters. * * * string filter = 4; @@ -122,9 +123,10 @@ public interface ListDataPoliciesRequestOrBuilder * are associated with. Currently filter only supports * "policy<span></span>_tag" based filtering and OR based predicates. Sample * filter can be "policy<span></span>_tag: - * `'projects/1/locations/us/taxonomies/2/policyTags/3'`". You may use - * wildcard such as "policy<span></span>_tag: - * `'projects/1/locations/us/taxonomies/2/*'`". + * projects/1/locations/us/taxonomies/2/policyTags/3". + * You may also use wildcard such as "policy<span></span>_tag: + * projects/1/locations/us/taxonomies/2*". Please note that OR predicates + * cannot be used with wildcard filters. * * * string filter = 4; diff --git a/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/proto/google/cloud/bigquery/datapolicies/v1/datapolicy.proto b/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/proto/google/cloud/bigquery/datapolicies/v1/datapolicy.proto index 1677e7eb7a41..0557bc810e91 100644 --- a/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/proto/google/cloud/bigquery/datapolicies/v1/datapolicy.proto +++ b/java-bigquerydatapolicy/proto-google-cloud-bigquerydatapolicy-v1/src/main/proto/google/cloud/bigquery/datapolicies/v1/datapolicy.proto @@ -1,4 +1,4 @@ -// Copyright 2022 Google LLC +// Copyright 2023 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -214,9 +214,10 @@ message ListDataPoliciesRequest { // are associated with. Currently filter only supports // "policy_tag" based filtering and OR based predicates. Sample // filter can be "policy_tag: - // `'projects/1/locations/us/taxonomies/2/policyTags/3'`". You may use - // wildcard such as "policy_tag: - // `'projects/1/locations/us/taxonomies/2/*'`". + // projects/1/locations/us/taxonomies/2/policyTags/3". + // You may also use wildcard such as "policy_tag: + // projects/1/locations/us/taxonomies/2*". Please note that OR predicates + // cannot be used with wildcard filters. string filter = 4; } @@ -300,21 +301,68 @@ message DataMaskingPolicy { // * FLOAT: 0.0 // * NUMERIC: 0 // * BOOLEAN: FALSE - // * TIMESTAMP: 0001-01-01 00:00:00 UTC - // * DATE: 0001-01-01 + // * TIMESTAMP: 1970-01-01 00:00:00 UTC + // * DATE: 1970-01-01 // * TIME: 00:00:00 - // * DATETIME: 0001-01-01T00:00:00 + // * DATETIME: 1970-01-01T00:00:00 // * GEOGRAPHY: POINT(0 0) // * BIGNUMERIC: 0 // * ARRAY: [] // * STRUCT: NOT_APPLICABLE // * JSON: NULL DEFAULT_MASKING_VALUE = 7; + + // Masking expression shows the last four characters of text. + // The masking behavior is as follows: + // + // * If text length > 4 characters: Replace text with XXXXX, append last + // four characters of original text. + // * If text length <= 4 characters: Apply SHA-256 hash. + LAST_FOUR_CHARACTERS = 9; + + // Masking expression shows the first four characters of text. + // The masking behavior is as follows: + // + // * If text length > 4 characters: Replace text with XXXXX, prepend first + // four characters of original text. + // * If text length <= 4 characters: Apply SHA-256 hash. + FIRST_FOUR_CHARACTERS = 10; + + // Masking expression for email addresses. + // The masking behavior is as follows: + // + // * Syntax-valid email address: Replace username with XXXXX. For example, + // cloudysanfrancisco@gmail.com becomes XXXXX@gmail.com. + // * Syntax-invalid email address: Apply SHA-256 hash. + // + // For more information, see [Email + // mask](https://cloud.google.com/bigquery/docs/column-data-masking-intro#masking_options). + EMAIL_MASK = 12; + + // Masking expression to only show the year of `Date`, + // `DateTime` and `TimeStamp`. For example, with the + // year 2076: + // + // * DATE : 2076-01-01 + // * DATETIME : 2076-01-01T00:00:00 + // * TIMESTAMP : 2076-01-01 00:00:00 UTC + // + // Truncation occurs according to the UTC time zone. To change this, adjust + // the default time zone using the `time_zone` system variable. + // For more information, see the System + // variables reference. + DATE_YEAR_MASK = 13; } // A masking expression to bind to the data masking rule. oneof masking_expression { // A predefined masking expression. PredefinedExpression predefined_expression = 1; + + // The name of the BigQuery routine that contains the custom masking + // routine, in the format of + // `projects/{project_number}/datasets/{dataset_id}/routines/{routine_id}`. + string routine = 3; } }