Skip to content
This repository has been archived by the owner on Sep 16, 2023. It is now read-only.

Commit

Permalink
feat: add isRequired to TagTemplateField (#49)
Browse files Browse the repository at this point in the history
* [CHANGE ME] Re-generated  to pick up changes in the API or client library generator.

* chore: fix allow proto interface changes

Co-authored-by: Jeff Ching <chingor@google.com>
  • Loading branch information
yoshi-automation and chingor13 committed Dec 20, 2019
1 parent 2a4e568 commit f6f2480
Show file tree
Hide file tree
Showing 12 changed files with 1,248 additions and 238 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1727,13 +1727,13 @@ public final TagTemplateField createTagTemplateField(CreateTagTemplateFieldReque
* <p>&#42;
* projects/{project_id}/locations/{location}/tagTemplates/{tag_template_id}/fields/{tag_template_field_id}
* @param tagTemplateField Required. The template to update.
* @param updateMask The field mask specifies the parts of the template to be updated. Allowed
* fields:
* <p>&#42; `display_name` &#42; `type.enum_type`
* @param updateMask Optional. The field mask specifies the parts of the template to be updated.
* Allowed fields:
* <p>&#42; `display_name` &#42; `type.enum_type` &#42; `is_required`
* <p>If `update_mask` is not set or empty, all of the allowed fields above will be updated.
* <p>When updating an enum type, the provided values will be merged with the existing values.
* Therefore, enum values can only be added, existing enum values cannot be deleted nor
* renamed.
* renamed. Updating a template field from optional to required is NOT allowed.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final TagTemplateField updateTagTemplateField(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -667,8 +667,13 @@ public void deleteTagTemplateExceptionTest() throws Exception {
public void createTagTemplateFieldTest() {
String name = "name3373707";
String displayName = "displayName1615086568";
boolean isRequired = true;
TagTemplateField expectedResponse =
TagTemplateField.newBuilder().setName(name).setDisplayName(displayName).build();
TagTemplateField.newBuilder()
.setName(name)
.setDisplayName(displayName)
.setIsRequired(isRequired)
.build();
mockDataCatalog.addResponse(expectedResponse);

String formattedParent =
Expand Down Expand Up @@ -718,8 +723,13 @@ public void createTagTemplateFieldExceptionTest() throws Exception {
public void updateTagTemplateFieldTest() {
String name2 = "name2-1052831874";
String displayName = "displayName1615086568";
boolean isRequired = true;
TagTemplateField expectedResponse =
TagTemplateField.newBuilder().setName(name2).setDisplayName(displayName).build();
TagTemplateField.newBuilder()
.setName(name2)
.setDisplayName(displayName)
.setIsRequired(isRequired)
.build();
mockDataCatalog.addResponse(expectedResponse);

String formattedName =
Expand Down Expand Up @@ -769,8 +779,13 @@ public void updateTagTemplateFieldExceptionTest() throws Exception {
public void renameTagTemplateFieldTest() {
String name2 = "name2-1052831874";
String displayName = "displayName1615086568";
boolean isRequired = true;
TagTemplateField expectedResponse =
TagTemplateField.newBuilder().setName(name2).setDisplayName(displayName).build();
TagTemplateField.newBuilder()
.setName(name2)
.setDisplayName(displayName)
.setIsRequired(isRequired)
.build();
mockDataCatalog.addResponse(expectedResponse);

String formattedName =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,20 @@
<differenceType>8001</differenceType>
<className>com/google/cloud/datacatalog/*</className>
</difference>
<difference>
<differenceType>7012</differenceType>
<className>com/google/cloud/datacatalog/v1beta1/*OrBuilder</className>
<method>* get*(*)</method>
</difference>
<difference>
<differenceType>7012</differenceType>
<className>com/google/cloud/datacatalog/v1beta1/*OrBuilder</className>
<method>boolean contains*(*)</method>
</difference>
<difference>
<differenceType>7012</differenceType>
<className>com/google/cloud/datacatalog/v1beta1/*OrBuilder</className>
<method>boolean has*(*)</method>
</difference>

</differences>

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ private TagTemplateField(
type_ = subBuilder.buildPartial();
}

break;
}
case 24:
{
isRequired_ = input.readBool();
break;
}
case 50:
Expand Down Expand Up @@ -286,6 +291,23 @@ public com.google.cloud.datacatalog.v1beta1.FieldTypeOrBuilder getTypeOrBuilder(
return getType();
}

public static final int IS_REQUIRED_FIELD_NUMBER = 3;
private boolean isRequired_;
/**
*
*
* <pre>
* Whether this is a required field. Defaults to false.
* </pre>
*
* <code>bool is_required = 3;</code>
*
* @return The isRequired.
*/
public boolean getIsRequired() {
return isRequired_;
}

private byte memoizedIsInitialized = -1;

@java.lang.Override
Expand All @@ -306,6 +328,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io
if (type_ != null) {
output.writeMessage(2, getType());
}
if (isRequired_ != false) {
output.writeBool(3, isRequired_);
}
if (!getNameBytes().isEmpty()) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 6, name_);
}
Expand All @@ -324,6 +349,9 @@ public int getSerializedSize() {
if (type_ != null) {
size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getType());
}
if (isRequired_ != false) {
size += com.google.protobuf.CodedOutputStream.computeBoolSize(3, isRequired_);
}
if (!getNameBytes().isEmpty()) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(6, name_);
}
Expand All @@ -349,6 +377,7 @@ public boolean equals(final java.lang.Object obj) {
if (hasType()) {
if (!getType().equals(other.getType())) return false;
}
if (getIsRequired() != other.getIsRequired()) return false;
if (!unknownFields.equals(other.unknownFields)) return false;
return true;
}
Expand All @@ -368,6 +397,8 @@ public int hashCode() {
hash = (37 * hash) + TYPE_FIELD_NUMBER;
hash = (53 * hash) + getType().hashCode();
}
hash = (37 * hash) + IS_REQUIRED_FIELD_NUMBER;
hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getIsRequired());
hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash;
return hash;
Expand Down Expand Up @@ -524,6 +555,8 @@ public Builder clear() {
type_ = null;
typeBuilder_ = null;
}
isRequired_ = false;

return this;
}

Expand Down Expand Up @@ -558,6 +591,7 @@ public com.google.cloud.datacatalog.v1beta1.TagTemplateField buildPartial() {
} else {
result.type_ = typeBuilder_.build();
}
result.isRequired_ = isRequired_;
onBuilt();
return result;
}
Expand Down Expand Up @@ -619,6 +653,9 @@ public Builder mergeFrom(com.google.cloud.datacatalog.v1beta1.TagTemplateField o
if (other.hasType()) {
mergeType(other.getType());
}
if (other.getIsRequired() != false) {
setIsRequired(other.getIsRequired());
}
this.mergeUnknownFields(other.unknownFields);
onChanged();
return this;
Expand Down Expand Up @@ -1079,6 +1116,57 @@ public com.google.cloud.datacatalog.v1beta1.FieldTypeOrBuilder getTypeOrBuilder(
return typeBuilder_;
}

private boolean isRequired_;
/**
*
*
* <pre>
* Whether this is a required field. Defaults to false.
* </pre>
*
* <code>bool is_required = 3;</code>
*
* @return The isRequired.
*/
public boolean getIsRequired() {
return isRequired_;
}
/**
*
*
* <pre>
* Whether this is a required field. Defaults to false.
* </pre>
*
* <code>bool is_required = 3;</code>
*
* @param value The isRequired to set.
* @return This builder for chaining.
*/
public Builder setIsRequired(boolean value) {

isRequired_ = value;
onChanged();
return this;
}
/**
*
*
* <pre>
* Whether this is a required field. Defaults to false.
* </pre>
*
* <code>bool is_required = 3;</code>
*
* @return This builder for chaining.
*/
public Builder clearIsRequired() {

isRequired_ = false;
onChanged();
return this;
}

@java.lang.Override
public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.setUnknownFields(unknownFields);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,17 @@ public interface TagTemplateFieldOrBuilder
* </code>
*/
com.google.cloud.datacatalog.v1beta1.FieldTypeOrBuilder getTypeOrBuilder();

/**
*
*
* <pre>
* Whether this is a required field. Defaults to false.
* </pre>
*
* <code>bool is_required = 3;</code>
*
* @return The isRequired.
*/
boolean getIsRequired();
}
Original file line number Diff line number Diff line change
Expand Up @@ -106,27 +106,28 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() {
+ "eField:\0028\001:p\352Am\n&datacatalog.googleapis."
+ "com/TagTemplate\022Cprojects/{project}/loca"
+ "tions/{location}/tagTemplates/{tag_templ"
+ "ate}\"\203\002\n\020TagTemplateField\022\021\n\004name\030\006 \001(\tB"
+ "ate}\"\230\002\n\020TagTemplateField\022\021\n\004name\030\006 \001(\tB"
+ "\003\340A\003\022\024\n\014display_name\030\001 \001(\t\022>\n\004type\030\002 \001(\013"
+ "2+.google.cloud.datacatalog.v1beta1.Fiel"
+ "dTypeB\003\340A\002:\205\001\352A\201\001\n+datacatalog.googleapi"
+ "s.com/TagTemplateField\022Rprojects/{projec"
+ "t}/locations/{location}/tagTemplates/{ta"
+ "g_template}/fields/{field}\"\247\003\n\tFieldType"
+ "\022S\n\016primitive_type\030\001 \001(\01629.google.cloud."
+ "datacatalog.v1beta1.FieldType.PrimitiveT"
+ "ypeH\000\022I\n\tenum_type\030\002 \001(\01324.google.cloud."
+ "datacatalog.v1beta1.FieldType.EnumTypeH\000"
+ "\032\212\001\n\010EnumType\022V\n\016allowed_values\030\001 \003(\0132>."
+ "google.cloud.datacatalog.v1beta1.FieldTy"
+ "pe.EnumType.EnumValue\032&\n\tEnumValue\022\031\n\014di"
+ "splay_name\030\001 \001(\tB\003\340A\002\"`\n\rPrimitiveType\022\036"
+ "\n\032PRIMITIVE_TYPE_UNSPECIFIED\020\000\022\n\n\006DOUBLE"
+ "\020\001\022\n\n\006STRING\020\002\022\010\n\004BOOL\020\003\022\r\n\tTIMESTAMP\020\004B"
+ "\013\n\ttype_declBx\n$com.google.cloud.datacat"
+ "alog.v1beta1P\001ZKgoogle.golang.org/genpro"
+ "to/googleapis/cloud/datacatalog/v1beta1;"
+ "datacatalog\370\001\001b\006proto3"
+ "dTypeB\003\340A\002\022\023\n\013is_required\030\003 \001(\010:\205\001\352A\201\001\n+"
+ "datacatalog.googleapis.com/TagTemplateFi"
+ "eld\022Rprojects/{project}/locations/{locat"
+ "ion}/tagTemplates/{tag_template}/fields/"
+ "{field}\"\247\003\n\tFieldType\022S\n\016primitive_type\030"
+ "\001 \001(\01629.google.cloud.datacatalog.v1beta1"
+ ".FieldType.PrimitiveTypeH\000\022I\n\tenum_type\030"
+ "\002 \001(\01324.google.cloud.datacatalog.v1beta1"
+ ".FieldType.EnumTypeH\000\032\212\001\n\010EnumType\022V\n\016al"
+ "lowed_values\030\001 \003(\0132>.google.cloud.dataca"
+ "talog.v1beta1.FieldType.EnumType.EnumVal"
+ "ue\032&\n\tEnumValue\022\031\n\014display_name\030\001 \001(\tB\003\340"
+ "A\002\"`\n\rPrimitiveType\022\036\n\032PRIMITIVE_TYPE_UN"
+ "SPECIFIED\020\000\022\n\n\006DOUBLE\020\001\022\n\n\006STRING\020\002\022\010\n\004B"
+ "OOL\020\003\022\r\n\tTIMESTAMP\020\004B\013\n\ttype_declBx\n$com"
+ ".google.cloud.datacatalog.v1beta1P\001ZKgoo"
+ "gle.golang.org/genproto/googleapis/cloud"
+ "/datacatalog/v1beta1;datacatalog\370\001\001b\006pro"
+ "to3"
};
descriptor =
com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom(
Expand Down Expand Up @@ -200,7 +201,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() {
new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_google_cloud_datacatalog_v1beta1_TagTemplateField_descriptor,
new java.lang.String[] {
"Name", "DisplayName", "Type",
"Name", "DisplayName", "Type", "IsRequired",
});
internal_static_google_cloud_datacatalog_v1beta1_FieldType_descriptor =
getDescriptor().getMessageTypes().get(4);
Expand Down
Loading

0 comments on commit f6f2480

Please sign in to comment.