/** * * * <pre> * Required. The new exclusion, whose `name` parameter is an exclusion name * that is not already used in the parent resource. * </pre> * * <code>.google.logging.v2.LogExclusion exclusion = 2;</code> */ public com.google.logging.v2.LogExclusionOrBuilder getExclusionOrBuilder() { return getExclusion(); }
@java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (!getParentBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); } if (exclusion_ != null) { output.writeMessage(2, getExclusion()); } unknownFields.writeTo(output); }
@java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; if (!getParentBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); } if (exclusion_ != null) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getExclusion()); } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.logging.v2.CreateExclusionRequest)) { return super.equals(obj); } com.google.logging.v2.CreateExclusionRequest other = (com.google.logging.v2.CreateExclusionRequest) obj; boolean result = true; result = result && getParent().equals(other.getParent()); result = result && (hasExclusion() == other.hasExclusion()); if (hasExclusion()) { result = result && getExclusion().equals(other.getExclusion()); } result = result && unknownFields.equals(other.unknownFields); return result; }
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + PARENT_FIELD_NUMBER; hash = (53 * hash) + getParent().hashCode(); if (hasExclusion()) { hash = (37 * hash) + EXCLUSION_FIELD_NUMBER; hash = (53 * hash) + getExclusion().hashCode(); } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
public Builder mergeFrom(com.google.logging.v2.CreateExclusionRequest other) { if (other == com.google.logging.v2.CreateExclusionRequest.getDefaultInstance()) return this; if (!other.getParent().isEmpty()) { parent_ = other.parent_; onChanged(); } if (other.hasExclusion()) { mergeExclusion(other.getExclusion()); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }
@Test @SuppressWarnings("all") public void createExclusionTest() { String name = "name3373707"; String description = "description-1724546052"; String filter = "filter-1274492040"; boolean disabled = true; LogExclusion expectedResponse = LogExclusion.newBuilder() .setName(name) .setDescription(description) .setFilter(filter) .setDisabled(disabled) .build(); mockConfigServiceV2.addResponse(expectedResponse); ParentName parent = ProjectName.of("[PROJECT]"); LogExclusion exclusion = LogExclusion.newBuilder().build(); LogExclusion actualResponse = client.createExclusion(parent, exclusion); Assert.assertEquals(expectedResponse, actualResponse); List<GeneratedMessageV3> actualRequests = mockConfigServiceV2.getRequests(); Assert.assertEquals(1, actualRequests.size()); CreateExclusionRequest actualRequest = (CreateExclusionRequest) actualRequests.get(0); Assert.assertEquals(parent, ParentNames.parse(actualRequest.getParent())); Assert.assertEquals(exclusion, actualRequest.getExclusion()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }