/** * 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); }
@java.lang.Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { com.google.logging.v2.GetSinkRequest parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (com.google.logging.v2.GetSinkRequest) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } 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; }
/** * 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); }
/** * 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); }
@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)); }
/** * 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); }
/** * * * <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 setSinkNameBytes(com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } checkByteStringIsUtf8(value); sinkName_ = value; onChanged(); return this; }
/** * * * <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 setSinkName(java.lang.String value) { if (value == null) { throw new NullPointerException(); } sinkName_ = value; onChanged(); return this; } /**
/** * * * <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 static Builder newBuilder(com.google.logging.v2.GetSinkRequest prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); }
private Builder() { maybeForceBuilderInitialization(); }
private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); }
@java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof com.google.logging.v2.GetSinkRequest) { return mergeFrom((com.google.logging.v2.GetSinkRequest) other); } else { super.mergeFrom(other); 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; }
@Test public void testGetSinkAsync() throws ExecutionException, InterruptedException { 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.getSinkAsync(SINK_NAME).get(); assertEquals(new Sink(logging, new SinkInfo.BuilderImpl(SINK_INFO)), sink); }
@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); }
@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; }