@java.lang.Override public Builder newBuilderForType() { return newBuilder(); }
public Builder mergeFrom(com.google.logging.v2.CreateSinkRequest other) { if (other == com.google.logging.v2.CreateSinkRequest.getDefaultInstance()) return this; if (!other.getParent().isEmpty()) { parent_ = other.parent_; onChanged(); } if (other.hasSink()) { mergeSink(other.getSink()); } if (other.getUniqueWriterIdentity() != false) { setUniqueWriterIdentity(other.getUniqueWriterIdentity()); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }
@java.lang.Override public com.google.logging.v2.CreateSinkRequest buildPartial() { com.google.logging.v2.CreateSinkRequest result = new com.google.logging.v2.CreateSinkRequest(this); result.parent_ = parent_; if (sinkBuilder_ == null) { result.sink_ = sink_; } else { result.sink_ = sinkBuilder_.build(); } result.uniqueWriterIdentity_ = uniqueWriterIdentity_; onBuilt(); return result; }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.logging.v2.CreateSinkRequest)) { return super.equals(obj); } com.google.logging.v2.CreateSinkRequest other = (com.google.logging.v2.CreateSinkRequest) obj; boolean result = true; result = result && getParent().equals(other.getParent()); result = result && (hasSink() == other.hasSink()); if (hasSink()) { result = result && getSink().equals(other.getSink()); } result = result && (getUniqueWriterIdentity() == other.getUniqueWriterIdentity()); result = result && unknownFields.equals(other.unknownFields); return result; }
@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 (sink_ != null) { output.writeMessage(2, getSink()); } if (uniqueWriterIdentity_ != false) { output.writeBool(3, uniqueWriterIdentity_); } unknownFields.writeTo(output); }
/** * * * <pre> * Required. The resource in which to create the sink: * "projects/[PROJECT_ID]" * "organizations/[ORGANIZATION_ID]" * "billingAccounts/[BILLING_ACCOUNT_ID]" * "folders/[FOLDER_ID]" * Examples: `"projects/my-logging-project"`, `"organizations/123456789"`. * </pre> * * <code>string parent = 1;</code> */ public Builder clearParent() { parent_ = getDefaultInstance().getParent(); onChanged(); return this; } /**
@java.lang.Override public com.google.logging.v2.CreateSinkRequest getDefaultInstanceForType() { return com.google.logging.v2.CreateSinkRequest.getDefaultInstance(); }
/** * * * <pre> * Required. The new sink, whose `name` parameter is a sink identifier that * is not already in use. * </pre> * * <code>.google.logging.v2.LogSink sink = 2;</code> */ public com.google.logging.v2.LogSinkOrBuilder getSinkOrBuilder() { return getSink(); }
@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 (sink_ != null) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getSink()); } if (uniqueWriterIdentity_ != false) { size += com.google.protobuf.CodedOutputStream.computeBoolSize(3, uniqueWriterIdentity_); } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; }
.setRequestMarshaller( io.grpc.protobuf.ProtoUtils.marshaller( com.google.logging.v2.CreateSinkRequest.getDefaultInstance())) .setResponseMarshaller( io.grpc.protobuf.ProtoUtils.marshaller(
@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 (hasSink()) { hash = (37 * hash) + SINK_FIELD_NUMBER; hash = (53 * hash) + getSink().hashCode(); } hash = (37 * hash) + UNIQUE_WRITER_IDENTITY_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getUniqueWriterIdentity()); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
CreateSinkRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .setSink(sink)
.setRequestMarshaller( io.grpc.protobuf.ProtoUtils.marshaller( com.google.logging.v2.CreateSinkRequest.getDefaultInstance())) .setResponseMarshaller( io.grpc.protobuf.ProtoUtils.marshaller(
/** * Creates a sink that exports specified log entries to a destination. The export of * newly-ingested log entries begins immediately, unless the sink's `writer_identity` is not * permitted to write to the destination. A sink can export log entries only from the resource * owning the sink. * * <p>Sample code: * * <pre><code> * try (ConfigClient configClient = ConfigClient.create()) { * ParentName parent = ProjectName.of("[PROJECT]"); * LogSink sink = LogSink.newBuilder().build(); * LogSink response = configClient.createSink(parent.toString(), sink); * } * </code></pre> * * @param parent Required. The resource in which to create the sink: * <p>"projects/[PROJECT_ID]" "organizations/[ORGANIZATION_ID]" * "billingAccounts/[BILLING_ACCOUNT_ID]" "folders/[FOLDER_ID]" * <p>Examples: `"projects/my-logging-project"`, `"organizations/123456789"`. * @param sink Required. The new sink, whose `name` parameter is a sink identifier that is not * already in use. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final LogSink createSink(String parent, LogSink sink) { CreateSinkRequest request = CreateSinkRequest.newBuilder().setParent(parent).setSink(sink).build(); return createSink(request); }
@Test public void testCreateSink() { LogSink sinkPb = SINK_INFO.toPb(PROJECT); ApiFuture<LogSink> response = ApiFutures.immediateFuture(sinkPb); CreateSinkRequest request = CreateSinkRequest.newBuilder().setParent(PROJECT_PB).setSink(sinkPb).build(); EasyMock.expect(loggingRpcMock.create(request)).andReturn(response); EasyMock.replay(rpcFactoryMock, loggingRpcMock); logging = options.getService(); Sink sink = logging.create(SINK_INFO); assertEquals(new Sink(logging, new SinkInfo.BuilderImpl(SINK_INFO)), sink); }
@Override public ApiFuture<Sink> createAsync(SinkInfo sink) { CreateSinkRequest request = CreateSinkRequest.newBuilder() .setParent(ProjectName.of(getOptions().getProjectId()).toString()) .setSink(sink.toPb(getOptions().getProjectId())) .build(); return transform(rpc.create(request), Sink.fromPbFunction(this)); }
@Test public void testCreateSinkAsync() throws ExecutionException, InterruptedException { LogSink sinkPb = SINK_INFO.toPb(PROJECT); ApiFuture<LogSink> response = ApiFutures.immediateFuture(sinkPb); CreateSinkRequest request = CreateSinkRequest.newBuilder().setParent(PROJECT_PB).setSink(sinkPb).build(); EasyMock.expect(loggingRpcMock.create(request)).andReturn(response); EasyMock.replay(rpcFactoryMock, loggingRpcMock); logging = options.getService(); Sink sink = logging.createAsync(SINK_INFO).get(); assertEquals(new Sink(logging, new SinkInfo.BuilderImpl(SINK_INFO)), sink); }
CreateSinkRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .setSink(sink)
/** * Creates a sink that exports specified log entries to a destination. The export of * newly-ingested log entries begins immediately, unless the sink's `writer_identity` is not * permitted to write to the destination. A sink can export log entries only from the resource * owning the sink. * * <p>Sample code: * * <pre><code> * try (ConfigClient configClient = ConfigClient.create()) { * ParentName parent = ProjectName.of("[PROJECT]"); * LogSink sink = LogSink.newBuilder().build(); * LogSink response = configClient.createSink(parent.toString(), sink); * } * </code></pre> * * @param parent Required. The resource in which to create the sink: * <p>"projects/[PROJECT_ID]" "organizations/[ORGANIZATION_ID]" * "billingAccounts/[BILLING_ACCOUNT_ID]" "folders/[FOLDER_ID]" * <p>Examples: `"projects/my-logging-project"`, `"organizations/123456789"`. * @param sink Required. The new sink, whose `name` parameter is a sink identifier that is not * already in use. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final LogSink createSink(String parent, LogSink sink) { CreateSinkRequest request = CreateSinkRequest.newBuilder().setParent(parent).setSink(sink).build(); return createSink(request); }