@java.lang.Override public Builder newBuilderForType() { return newBuilder(); }
/** * * * <pre> * The project on which to execute the request. The format is * `"projects/{project_id_or_number}"`. * </pre> * * <code>string name = 3;</code> */ public Builder clearName() { name_ = getDefaultInstance().getName(); onChanged(); return this; } /**
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + NAME_FIELD_NUMBER; hash = (53 * hash) + getName().hashCode(); if (getTimeSeriesCount() > 0) { hash = (37 * hash) + TIME_SERIES_FIELD_NUMBER; hash = (53 * hash) + getTimeSeriesList().hashCode(); } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.monitoring.v3.CreateTimeSeriesRequest)) { return super.equals(obj); } com.google.monitoring.v3.CreateTimeSeriesRequest other = (com.google.monitoring.v3.CreateTimeSeriesRequest) obj; boolean result = true; result = result && getName().equals(other.getName()); result = result && getTimeSeriesList().equals(other.getTimeSeriesList()); 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) + getDescriptorForType().hashCode(); hash = (37 * hash) + NAME_FIELD_NUMBER; hash = (53 * hash) + getName().hashCode(); if (getTimeSeriesCount() > 0) { hash = (37 * hash) + TIME_SERIES_FIELD_NUMBER; hash = (53 * hash) + getTimeSeriesList().hashCode(); } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
@java.lang.Override public com.google.monitoring.v3.CreateTimeSeriesRequest getDefaultInstanceForType() { return com.google.monitoring.v3.CreateTimeSeriesRequest.getDefaultInstance(); }
@java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { for (int i = 0; i < timeSeries_.size(); i++) { output.writeMessage(2, timeSeries_.get(i)); } if (!getNameBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 3, name_); } unknownFields.writeTo(output); }
@java.lang.Override public com.google.monitoring.v3.CreateTimeSeriesRequest build() { com.google.monitoring.v3.CreateTimeSeriesRequest result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; }
@java.lang.Override public com.google.monitoring.v3.CreateTimeSeriesRequest buildPartial() { com.google.monitoring.v3.CreateTimeSeriesRequest result = new com.google.monitoring.v3.CreateTimeSeriesRequest(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; result.name_ = name_; if (timeSeriesBuilder_ == null) { if (((bitField0_ & 0x00000002) == 0x00000002)) { timeSeries_ = java.util.Collections.unmodifiableList(timeSeries_); bitField0_ = (bitField0_ & ~0x00000002); } result.timeSeries_ = timeSeries_; } else { result.timeSeries_ = timeSeriesBuilder_.build(); } result.bitField0_ = to_bitField0_; onBuilt(); return result; }
@Test @SuppressWarnings("all") public void createTimeSeriesTest() { Empty expectedResponse = Empty.newBuilder().build(); mockMetricService.addResponse(expectedResponse); ProjectName name = ProjectName.of("[PROJECT]"); List<TimeSeries> timeSeries = new ArrayList<>(); client.createTimeSeries(name, timeSeries); List<GeneratedMessageV3> actualRequests = mockMetricService.getRequests(); Assert.assertEquals(1, actualRequests.size()); CreateTimeSeriesRequest actualRequest = (CreateTimeSeriesRequest) actualRequests.get(0); Assert.assertEquals(name, ProjectName.parse(actualRequest.getName())); Assert.assertEquals(timeSeries, actualRequest.getTimeSeriesList()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
io.grpc.protobuf.ProtoUtils.marshaller( com.google.monitoring.v3.CreateTimeSeriesRequest .getDefaultInstance())) .setResponseMarshaller( io.grpc.protobuf.ProtoUtils.marshaller(
@java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; for (int i = 0; i < timeSeries_.size(); i++) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, timeSeries_.get(i)); } if (!getNameBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, name_); } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; }
public com.google.monitoring.v3.CreateTimeSeriesRequest build() { com.google.monitoring.v3.CreateTimeSeriesRequest result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; }
public com.google.monitoring.v3.CreateTimeSeriesRequest buildPartial() { com.google.monitoring.v3.CreateTimeSeriesRequest result = new com.google.monitoring.v3.CreateTimeSeriesRequest(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; result.name_ = name_; if (timeSeriesBuilder_ == null) { if (((bitField0_ & 0x00000002) == 0x00000002)) { timeSeries_ = java.util.Collections.unmodifiableList(timeSeries_); bitField0_ = (bitField0_ & ~0x00000002); } result.timeSeries_ = timeSeries_; } else { result.timeSeries_ = timeSeriesBuilder_.build(); } result.bitField0_ = to_bitField0_; onBuilt(); return result; }
/** * Creates or adds data to one or more time series. The response is empty if all time series in * the request were written. If any time series could not be written, a corresponding failure * message is included in the error response. * * <p>Sample code: * * <pre><code> * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) { * ProjectName name = ProjectName.of("[PROJECT]"); * List<TimeSeries> timeSeries = new ArrayList<>(); * metricServiceClient.createTimeSeries(name.toString(), timeSeries); * } * </code></pre> * * @param name The project on which to execute the request. The format is * `"projects/{project_id_or_number}"`. * @param timeSeries The new data to be added to a list of time series. Adds at most one data * point to each of several time series. The new data point must be more recent than any other * point in its time series. Each `TimeSeries` value must fully specify a unique time series * by supplying all label values for the metric and the monitored resource. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final void createTimeSeries(String name, List<TimeSeries> timeSeries) { CreateTimeSeriesRequest request = CreateTimeSeriesRequest.newBuilder().setName(name).addAllTimeSeries(timeSeries).build(); createTimeSeries(request); }
public Builder mergeFrom(com.google.monitoring.v3.CreateTimeSeriesRequest other) { if (other == com.google.monitoring.v3.CreateTimeSeriesRequest.getDefaultInstance()) return this; if (!other.getName().isEmpty()) { name_ = other.name_; onChanged();
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.monitoring.v3.CreateTimeSeriesRequest)) { return super.equals(obj); } com.google.monitoring.v3.CreateTimeSeriesRequest other = (com.google.monitoring.v3.CreateTimeSeriesRequest) obj; boolean result = true; result = result && getName() .equals(other.getName()); result = result && getTimeSeriesList() .equals(other.getTimeSeriesList()); return result; }
public com.google.monitoring.v3.CreateTimeSeriesRequest getDefaultInstanceForType() { return com.google.monitoring.v3.CreateTimeSeriesRequest.getDefaultInstance(); }
public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { for (int i = 0; i < timeSeries_.size(); i++) { output.writeMessage(2, timeSeries_.get(i)); } if (!getNameBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 3, name_); } }
CreateTimeSeriesRequest.newBuilder() .setName(name == null ? null : name.toString()) .addAllTimeSeries(timeSeries)