@java.lang.Override public Builder newBuilderForType() { return newBuilder(); }
/** * * * <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; } /**
@java.lang.Override public com.google.logging.v2.GetSinkRequest buildPartial() { com.google.logging.v2.GetSinkRequest result = new com.google.logging.v2.GetSinkRequest(this); result.sinkName_ = sinkName_; onBuilt(); 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; }
if (!parseUnknownFieldProto3(input, unknownFields, extensionRegistry, tag)) { done = true; } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable();
@java.lang.Override public com.google.logging.v2.GetSinkRequest getDefaultInstanceForType() { return com.google.logging.v2.GetSinkRequest.getDefaultInstance(); }
@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 getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; if (!getSinkNameBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, sinkName_); } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; }
@java.lang.Override public com.google.logging.v2.GetSinkRequest build() { com.google.logging.v2.GetSinkRequest result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; }
private static io.grpc.MethodDescriptor< com.google.logging.v2.GetSinkRequest, com.google.logging.v2.LogSink> getGetSinkMethodHelper() { io.grpc.MethodDescriptor<com.google.logging.v2.GetSinkRequest, com.google.logging.v2.LogSink> getGetSinkMethod; if ((getGetSinkMethod = ConfigServiceV2Grpc.getGetSinkMethod) == null) { synchronized (ConfigServiceV2Grpc.class) { if ((getGetSinkMethod = ConfigServiceV2Grpc.getGetSinkMethod) == null) { ConfigServiceV2Grpc.getGetSinkMethod = getGetSinkMethod = io.grpc.MethodDescriptor .<com.google.logging.v2.GetSinkRequest, com.google.logging.v2.LogSink> newBuilder() .setType(io.grpc.MethodDescriptor.MethodType.UNARY) .setFullMethodName( generateFullMethodName("google.logging.v2.ConfigServiceV2", "GetSink")) .setSampledToLocalTracing(true) .setRequestMarshaller( io.grpc.protobuf.ProtoUtils.marshaller( com.google.logging.v2.GetSinkRequest.getDefaultInstance())) .setResponseMarshaller( io.grpc.protobuf.ProtoUtils.marshaller( com.google.logging.v2.LogSink.getDefaultInstance())) .setSchemaDescriptor(new ConfigServiceV2MethodDescriptorSupplier("GetSink")) .build(); } } } return getGetSinkMethod; }
@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())); }
@java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (!getSinkNameBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 1, sinkName_); } unknownFields.writeTo(output); }
/** * Gets a sink. * * <p>Sample code: * * <pre><code> * try (ConfigClient configClient = ConfigClient.create()) { * SinkName sinkName = ProjectSinkName.of("[PROJECT]", "[SINK]"); * LogSink response = configClient.getSink(sinkName); * } * </code></pre> * * @param sinkName Required. The resource name of the sink: * <p>"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]" * <p>Example: `"projects/my-project-id/sinks/my-sink-id"`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final LogSink getSink(SinkName sinkName) { GetSinkRequest request = GetSinkRequest.newBuilder() .setSinkName(sinkName == null ? null : sinkName.toString()) .build(); return getSink(request); }
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; }
private static io.grpc.MethodDescriptor< com.google.logging.v2.GetSinkRequest, com.google.logging.v2.LogSink> getGetSinkMethodHelper() { io.grpc.MethodDescriptor<com.google.logging.v2.GetSinkRequest, com.google.logging.v2.LogSink> getGetSinkMethod; if ((getGetSinkMethod = ConfigServiceV2Grpc.getGetSinkMethod) == null) { synchronized (ConfigServiceV2Grpc.class) { if ((getGetSinkMethod = ConfigServiceV2Grpc.getGetSinkMethod) == null) { ConfigServiceV2Grpc.getGetSinkMethod = getGetSinkMethod = io.grpc.MethodDescriptor .<com.google.logging.v2.GetSinkRequest, com.google.logging.v2.LogSink> newBuilder() .setType(io.grpc.MethodDescriptor.MethodType.UNARY) .setFullMethodName( generateFullMethodName("google.logging.v2.ConfigServiceV2", "GetSink")) .setSampledToLocalTracing(true) .setRequestMarshaller( io.grpc.protobuf.ProtoUtils.marshaller( com.google.logging.v2.GetSinkRequest.getDefaultInstance())) .setResponseMarshaller( io.grpc.protobuf.ProtoUtils.marshaller( com.google.logging.v2.LogSink.getDefaultInstance())) .setSchemaDescriptor(new ConfigServiceV2MethodDescriptorSupplier("GetSink")) .build(); } } } return getGetSinkMethod; }
/** * Gets a sink. * * <p>Sample code: * * <pre><code> * try (ConfigClient configClient = ConfigClient.create()) { * SinkName sinkName = ProjectSinkName.of("[PROJECT]", "[SINK]"); * LogSink response = configClient.getSink(sinkName.toString()); * } * </code></pre> * * @param sinkName Required. The resource name of the sink: * <p>"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]" * <p>Example: `"projects/my-project-id/sinks/my-sink-id"`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final LogSink getSink(String sinkName) { GetSinkRequest request = GetSinkRequest.newBuilder().setSinkName(sinkName).build(); return getSink(request); }
@Test public void testGetSink_Null() { ApiFuture<LogSink> response = ApiFutures.immediateFuture(null); GetSinkRequest request = GetSinkRequest.newBuilder().setSinkName(SINK_NAME_PB).build(); EasyMock.expect(loggingRpcMock.get(request)).andReturn(response); EasyMock.replay(rpcFactoryMock, loggingRpcMock); logging = options.getService(); assertNull(logging.getSink(SINK_NAME)); }
@Test public void testGetSinkAsync_Null() throws ExecutionException, InterruptedException { ApiFuture<LogSink> response = ApiFutures.immediateFuture(null); GetSinkRequest request = GetSinkRequest.newBuilder().setSinkName(SINK_NAME_PB).build(); EasyMock.expect(loggingRpcMock.get(request)).andReturn(response); EasyMock.replay(rpcFactoryMock, loggingRpcMock); logging = options.getService(); assertNull(logging.getSinkAsync(SINK_NAME).get()); }
@Override public ApiFuture<Sink> getSinkAsync(String sink) { GetSinkRequest request = GetSinkRequest.newBuilder() .setSinkName(ProjectSinkName.of(getOptions().getProjectId(), sink).toString()) .build(); return transform(rpc.get(request), Sink.fromPbFunction(this)); }
@Test public void testGetSink() { LogSink sinkPb = SINK_INFO.toPb(PROJECT); ApiFuture<LogSink> response = ApiFutures.immediateFuture(sinkPb); GetSinkRequest request = GetSinkRequest.newBuilder().setSinkName(SINK_NAME_PB).build(); EasyMock.expect(loggingRpcMock.get(request)).andReturn(response); EasyMock.replay(rpcFactoryMock, loggingRpcMock); logging = options.getService(); Sink sink = logging.getSink(SINK_NAME); assertEquals(new Sink(logging, new SinkInfo.BuilderImpl(SINK_INFO)), sink); }