@java.lang.Override public Builder newBuilderForType() { return newBuilder(); }
public Builder mergeFrom(com.google.monitoring.v3.ListMetricDescriptorsRequest other) { if (other == com.google.monitoring.v3.ListMetricDescriptorsRequest.getDefaultInstance()) return this; if (!other.getName().isEmpty()) { name_ = other.name_; onChanged(); } if (!other.getFilter().isEmpty()) { filter_ = other.filter_; onChanged(); } if (other.getPageSize() != 0) { setPageSize(other.getPageSize()); } if (!other.getPageToken().isEmpty()) { pageToken_ = other.pageToken_; onChanged(); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }
@java.lang.Override public com.google.monitoring.v3.ListMetricDescriptorsRequest buildPartial() { com.google.monitoring.v3.ListMetricDescriptorsRequest result = new com.google.monitoring.v3.ListMetricDescriptorsRequest(this); result.name_ = name_; result.filter_ = filter_; result.pageSize_ = pageSize_; result.pageToken_ = pageToken_; onBuilt(); return result; }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.monitoring.v3.ListMetricDescriptorsRequest)) { return super.equals(obj); } com.google.monitoring.v3.ListMetricDescriptorsRequest other = (com.google.monitoring.v3.ListMetricDescriptorsRequest) obj; boolean result = true; result = result && getName().equals(other.getName()); result = result && getFilter().equals(other.getFilter()); result = result && (getPageSize() == other.getPageSize()); result = result && getPageToken().equals(other.getPageToken()); result = result && unknownFields.equals(other.unknownFields); return result; }
/** * * * <pre> * If this field is not empty then it must contain the `nextPageToken` value * returned by a previous call to this method. Using this field causes the * method to return additional results from the previous method call. * </pre> * * <code>string page_token = 4;</code> */ public Builder clearPageToken() { pageToken_ = getDefaultInstance().getPageToken(); onChanged(); return this; } /**
/** * * * <pre> * If this field is empty, all custom and * system-defined metric descriptors are returned. * Otherwise, the [filter](/monitoring/api/v3/filters) * specifies which metric descriptors are to be * returned. For example, the following filter matches all * [custom metrics](/monitoring/custom-metrics): * metric.type = starts_with("custom.googleapis.com/") * </pre> * * <code>string filter = 2;</code> */ public Builder clearFilter() { filter_ = getDefaultInstance().getFilter(); onChanged(); return this; } /**
@java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; if (!getFilterBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, filter_); } if (pageSize_ != 0) { size += com.google.protobuf.CodedOutputStream.computeInt32Size(3, pageSize_); } if (!getPageTokenBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, pageToken_); } if (!getNameBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(5, name_); } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; }
/** * * * <pre> * The project on which to execute the request. The format is * `"projects/{project_id_or_number}"`. * </pre> * * <code>string name = 5;</code> */ public Builder clearName() { name_ = getDefaultInstance().getName(); onChanged(); return this; } /**
@java.lang.Override public com.google.monitoring.v3.ListMetricDescriptorsRequest getDefaultInstanceForType() { return com.google.monitoring.v3.ListMetricDescriptorsRequest.getDefaultInstance(); }
@Override public Integer extractPageSize(ListMetricDescriptorsRequest payload) { return payload.getPageSize(); }
@Test @SuppressWarnings("all") public void listMetricDescriptorsTest() { String nextPageToken = ""; MetricDescriptor metricDescriptorsElement = MetricDescriptor.newBuilder().build(); List<MetricDescriptor> metricDescriptors = Arrays.asList(metricDescriptorsElement); ListMetricDescriptorsResponse expectedResponse = ListMetricDescriptorsResponse.newBuilder() .setNextPageToken(nextPageToken) .addAllMetricDescriptors(metricDescriptors) .build(); mockMetricService.addResponse(expectedResponse); ProjectName name = ProjectName.of("[PROJECT]"); ListMetricDescriptorsPagedResponse pagedListResponse = client.listMetricDescriptors(name); List<MetricDescriptor> resources = Lists.newArrayList(pagedListResponse.iterateAll()); Assert.assertEquals(1, resources.size()); Assert.assertEquals(expectedResponse.getMetricDescriptorsList().get(0), resources.get(0)); List<GeneratedMessageV3> actualRequests = mockMetricService.getRequests(); Assert.assertEquals(1, actualRequests.size()); ListMetricDescriptorsRequest actualRequest = (ListMetricDescriptorsRequest) actualRequests.get(0); Assert.assertEquals(name, ProjectName.parse(actualRequest.getName())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
@java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (!getFilterBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 2, filter_); } if (pageSize_ != 0) { output.writeInt32(3, pageSize_); } if (!getPageTokenBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 4, pageToken_); } if (!getNameBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 5, name_); } unknownFields.writeTo(output); }
/** * <pre> * The project on which to execute the request. The format is * `"projects/{project_id_or_number}"`. * </pre> * * <code>optional string name = 5;</code> */ public Builder clearName() { name_ = getDefaultInstance().getName(); onChanged(); return this; } /**
/** * <pre> * If this field is not empty then it must contain the `nextPageToken` value * returned by a previous call to this method. Using this field causes the * method to return additional results from the previous method call. * </pre> * * <code>optional string page_token = 4;</code> */ public Builder clearPageToken() { pageToken_ = getDefaultInstance().getPageToken(); onChanged(); return this; } /**
/** * <pre> * If this field is empty, all custom and * system-defined metric descriptors are returned. * Otherwise, the [filter](/monitoring/api/v3/filters) * specifies which metric descriptors are to be * returned. For example, the following filter matches all * [custom metrics](/monitoring/custom-metrics): * metric.type = starts_with("custom.googleapis.com/") * </pre> * * <code>optional string filter = 2;</code> */ public Builder clearFilter() { filter_ = getDefaultInstance().getFilter(); onChanged(); return this; } /**
io.grpc.protobuf.ProtoUtils.marshaller( com.google.monitoring.v3.ListMetricDescriptorsRequest .getDefaultInstance())) .setResponseMarshaller( io.grpc.protobuf.ProtoUtils.marshaller(
@Override public Integer extractPageSize(ListMetricDescriptorsRequest payload) { return payload.getPageSize(); }
@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(); hash = (37 * hash) + FILTER_FIELD_NUMBER; hash = (53 * hash) + getFilter().hashCode(); hash = (37 * hash) + PAGE_SIZE_FIELD_NUMBER; hash = (53 * hash) + getPageSize(); hash = (37 * hash) + PAGE_TOKEN_FIELD_NUMBER; hash = (53 * hash) + getPageToken().hashCode(); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
@Override public ListMetricDescriptorsRequest injectPageSize( ListMetricDescriptorsRequest payload, int pageSize) { return ListMetricDescriptorsRequest.newBuilder(payload).setPageSize(pageSize).build(); }
public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (!getFilterBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 2, filter_); } if (pageSize_ != 0) { output.writeInt32(3, pageSize_); } if (!getPageTokenBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 4, pageToken_); } if (!getNameBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 5, name_); } }