@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.logging.v2.GetSinkRequest)) { return super.equals(obj); } com.google.logging.v2.GetSinkRequest other = (com.google.logging.v2.GetSinkRequest) obj; boolean result = true; result = result && getSinkName().equals(other.getSinkName()); 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) + SINK_NAME_FIELD_NUMBER; hash = (53 * hash) + getSinkName().hashCode(); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
/** * * * <pre> * Required. The resource name of the sink: * "projects/[PROJECT_ID]/sinks/[SINK_ID]" * "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" * "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" * "folders/[FOLDER_ID]/sinks/[SINK_ID]" * Example: `"projects/my-project-id/sinks/my-sink-id"`. * </pre> * * <code>string sink_name = 1;</code> */ public Builder clearSinkName() { sinkName_ = getDefaultInstance().getSinkName(); onChanged(); return this; } /**
public Builder mergeFrom(com.google.logging.v2.GetSinkRequest other) { if (other == com.google.logging.v2.GetSinkRequest.getDefaultInstance()) return this; if (!other.getSinkName().isEmpty()) { sinkName_ = other.sinkName_; onChanged(); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }
@Test @SuppressWarnings("all") public void getSinkTest() { String name = "name3373707"; ResourceName destination = BillingName.of("[BILLING_ACCOUNT]"); String filter = "filter-1274492040"; String writerIdentity = "writerIdentity775638794"; boolean includeChildren = true; LogSink expectedResponse = LogSink.newBuilder() .setName(name) .setDestination(destination.toString()) .setFilter(filter) .setWriterIdentity(writerIdentity) .setIncludeChildren(includeChildren) .build(); mockConfigServiceV2.addResponse(expectedResponse); SinkName sinkName = ProjectSinkName.of("[PROJECT]", "[SINK]"); LogSink actualResponse = client.getSink(sinkName); Assert.assertEquals(expectedResponse, actualResponse); List<GeneratedMessageV3> actualRequests = mockConfigServiceV2.getRequests(); Assert.assertEquals(1, actualRequests.size()); GetSinkRequest actualRequest = (GetSinkRequest) actualRequests.get(0); Assert.assertEquals(sinkName, SinkNames.parse(actualRequest.getSinkName())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }