@java.lang.Override public Builder newBuilderForType() { return newBuilder(); }
/** * * * <pre> * The resource name of the metric to delete: * "projects/[PROJECT_ID]/metrics/[METRIC_ID]" * </pre> * * <code>string metric_name = 1;</code> */ public Builder clearMetricName() { metricName_ = getDefaultInstance().getMetricName(); onChanged(); return this; } /**
@java.lang.Override public com.google.logging.v2.DeleteLogMetricRequest buildPartial() { com.google.logging.v2.DeleteLogMetricRequest result = new com.google.logging.v2.DeleteLogMetricRequest(this); result.metricName_ = metricName_; 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) + METRIC_NAME_FIELD_NUMBER; hash = (53 * hash) + getMetricName().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.DeleteLogMetricRequest getDefaultInstanceForType() { return com.google.logging.v2.DeleteLogMetricRequest.getDefaultInstance(); }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.logging.v2.DeleteLogMetricRequest)) { return super.equals(obj); } com.google.logging.v2.DeleteLogMetricRequest other = (com.google.logging.v2.DeleteLogMetricRequest) obj; boolean result = true; result = result && getMetricName().equals(other.getMetricName()); result = result && unknownFields.equals(other.unknownFields); return result; }
@java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (!getMetricNameBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 1, metricName_); } unknownFields.writeTo(output); }
@java.lang.Override public com.google.logging.v2.DeleteLogMetricRequest build() { com.google.logging.v2.DeleteLogMetricRequest result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; }
.setRequestMarshaller( io.grpc.protobuf.ProtoUtils.marshaller( com.google.logging.v2.DeleteLogMetricRequest.getDefaultInstance())) .setResponseMarshaller( io.grpc.protobuf.ProtoUtils.marshaller(
@Test @SuppressWarnings("all") public void deleteLogMetricTest() { Empty expectedResponse = Empty.newBuilder().build(); mockMetricsServiceV2.addResponse(expectedResponse); MetricName metricName = ProjectMetricName.of("[PROJECT]", "[METRIC]"); client.deleteLogMetric(metricName); List<GeneratedMessageV3> actualRequests = mockMetricsServiceV2.getRequests(); Assert.assertEquals(1, actualRequests.size()); DeleteLogMetricRequest actualRequest = (DeleteLogMetricRequest) actualRequests.get(0); Assert.assertEquals(metricName, MetricNames.parse(actualRequest.getMetricName())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
@java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; if (!getMetricNameBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, metricName_); } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; }
/** * Deletes a logs-based metric. * * <p>Sample code: * * <pre><code> * try (MetricsClient metricsClient = MetricsClient.create()) { * MetricName metricName = ProjectMetricName.of("[PROJECT]", "[METRIC]"); * metricsClient.deleteLogMetric(metricName); * } * </code></pre> * * @param metricName The resource name of the metric to delete: * <p>"projects/[PROJECT_ID]/metrics/[METRIC_ID]" * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final void deleteLogMetric(MetricName metricName) { DeleteLogMetricRequest request = DeleteLogMetricRequest.newBuilder() .setMetricName(metricName == null ? null : metricName.toString()) .build(); deleteLogMetric(request); }
public Builder mergeFrom(com.google.logging.v2.DeleteLogMetricRequest other) { if (other == com.google.logging.v2.DeleteLogMetricRequest.getDefaultInstance()) return this; if (!other.getMetricName().isEmpty()) { metricName_ = other.metricName_; onChanged(); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }
.setRequestMarshaller( io.grpc.protobuf.ProtoUtils.marshaller( com.google.logging.v2.DeleteLogMetricRequest.getDefaultInstance())) .setResponseMarshaller( io.grpc.protobuf.ProtoUtils.marshaller(
/** * Deletes a logs-based metric. * * <p>Sample code: * * <pre><code> * try (MetricsClient metricsClient = MetricsClient.create()) { * MetricName metricName = ProjectMetricName.of("[PROJECT]", "[METRIC]"); * metricsClient.deleteLogMetric(metricName.toString()); * } * </code></pre> * * @param metricName The resource name of the metric to delete: * <p>"projects/[PROJECT_ID]/metrics/[METRIC_ID]" * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final void deleteLogMetric(String metricName) { DeleteLogMetricRequest request = DeleteLogMetricRequest.newBuilder().setMetricName(metricName).build(); deleteLogMetric(request); }
@Override public ApiFuture<Boolean> deleteMetricAsync(String metric) { DeleteLogMetricRequest request = DeleteLogMetricRequest.newBuilder() .setMetricName(ProjectMetricName.of(getOptions().getProjectId(), metric).toString()) .build(); return transform(rpc.delete(request), EMPTY_TO_BOOLEAN_FUNCTION); }
@Test public void testDeleteMetric_Null() { DeleteLogMetricRequest request = DeleteLogMetricRequest.newBuilder().setMetricName(METRIC_NAME_PB).build(); ApiFuture<Empty> response = ApiFutures.immediateFuture(null); EasyMock.expect(loggingRpcMock.delete(request)).andReturn(response); EasyMock.replay(rpcFactoryMock, loggingRpcMock); logging = options.getService(); assertFalse(logging.deleteMetric(METRIC_NAME)); }
@Test public void testDeleteMetric() { DeleteLogMetricRequest request = DeleteLogMetricRequest.newBuilder().setMetricName(METRIC_NAME_PB).build(); ApiFuture<Empty> response = ApiFutures.immediateFuture(Empty.getDefaultInstance()); EasyMock.expect(loggingRpcMock.delete(request)).andReturn(response); EasyMock.replay(rpcFactoryMock, loggingRpcMock); logging = options.getService(); assertTrue(logging.deleteMetric(METRIC_NAME)); }
@Test public void testDeleteMetricAsync_Null() throws ExecutionException, InterruptedException { DeleteLogMetricRequest request = DeleteLogMetricRequest.newBuilder().setMetricName(METRIC_NAME_PB).build(); ApiFuture<Empty> response = ApiFutures.immediateFuture(null); EasyMock.expect(loggingRpcMock.delete(request)).andReturn(response); EasyMock.replay(rpcFactoryMock, loggingRpcMock); logging = options.getService(); assertFalse(logging.deleteMetricAsync(METRIC_NAME).get()); }