public Builder mergeFrom(com.google.spanner.admin.instance.v1.ListInstancesRequest other) { if (other == com.google.spanner.admin.instance.v1.ListInstancesRequest.getDefaultInstance()) return this; if (!other.getParent().isEmpty()) { parent_ = other.parent_; onChanged(); } if (other.getPageSize() != 0) { setPageSize(other.getPageSize()); } if (!other.getPageToken().isEmpty()) { pageToken_ = other.pageToken_; onChanged(); } if (!other.getFilter().isEmpty()) { filter_ = other.filter_; onChanged(); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }
@java.lang.Override public Builder newBuilderForType() { return newBuilder(); }
@java.lang.Override public com.google.spanner.admin.instance.v1.ListInstancesRequest buildPartial() { com.google.spanner.admin.instance.v1.ListInstancesRequest result = new com.google.spanner.admin.instance.v1.ListInstancesRequest(this); result.parent_ = parent_; result.pageSize_ = pageSize_; result.pageToken_ = pageToken_; result.filter_ = filter_; onBuilt(); return result; }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.spanner.admin.instance.v1.ListInstancesRequest)) { return super.equals(obj); } com.google.spanner.admin.instance.v1.ListInstancesRequest other = (com.google.spanner.admin.instance.v1.ListInstancesRequest) obj; boolean result = true; result = result && getParent().equals(other.getParent()); result = result && (getPageSize() == other.getPageSize()); result = result && getPageToken().equals(other.getPageToken()); result = result && getFilter().equals(other.getFilter()); result = result && unknownFields.equals(other.unknownFields); return result; }
/** * * * <pre> * If non-empty, `page_token` should contain a * [next_page_token][google.spanner.admin.instance.v1.ListInstancesResponse.next_page_token] from a * previous [ListInstancesResponse][google.spanner.admin.instance.v1.ListInstancesResponse]. * </pre> * * <code>string page_token = 3;</code> */ public Builder clearPageToken() { pageToken_ = getDefaultInstance().getPageToken(); onChanged(); return this; } /**
/** * * * <pre> * Required. The name of the project for which a list of instances is * requested. Values are of the form `projects/<project>`. * </pre> * * <code>string parent = 1;</code> */ public Builder clearParent() { parent_ = getDefaultInstance().getParent(); onChanged(); return this; } /**
@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 (pageSize_ != 0) { output.writeInt32(2, pageSize_); } if (!getPageTokenBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 3, pageToken_); } if (!getFilterBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 4, filter_); } unknownFields.writeTo(output); }
/** * * * <pre> * An expression for filtering the results of the request. Filter rules are * case insensitive. The fields eligible for filtering are: * * `name` * * `display_name` * * `labels.key` where key is the name of a label * Some examples of using filters are: * * `name:*` --> The instance has a name. * * `name:Howl` --> The instance's name contains the string "howl". * * `name:HOWL` --> Equivalent to above. * * `NAME:howl` --> Equivalent to above. * * `labels.env:*` --> The instance has the label "env". * * `labels.env:dev` --> The instance has the label "env" and the value of * the label contains the string "dev". * * `name:howl labels.env:dev` --> The instance's name contains "howl" and * it has the label "env" with its value * containing "dev". * </pre> * * <code>string filter = 4;</code> */ public Builder clearFilter() { filter_ = getDefaultInstance().getFilter(); onChanged(); return this; } /**
@java.lang.Override public com.google.spanner.admin.instance.v1.ListInstancesRequest getDefaultInstanceForType() { return com.google.spanner.admin.instance.v1.ListInstancesRequest.getDefaultInstance(); }
@Override public Integer extractPageSize(ListInstancesRequest payload) { return payload.getPageSize(); }
@Test @SuppressWarnings("all") public void listInstancesTest() { String nextPageToken = ""; Instance instancesElement = Instance.newBuilder().build(); List<Instance> instances = Arrays.asList(instancesElement); ListInstancesResponse expectedResponse = ListInstancesResponse.newBuilder() .setNextPageToken(nextPageToken) .addAllInstances(instances) .build(); mockInstanceAdmin.addResponse(expectedResponse); ProjectName parent = ProjectName.of("[PROJECT]"); ListInstancesPagedResponse pagedListResponse = client.listInstances(parent); List<Instance> resources = Lists.newArrayList(pagedListResponse.iterateAll()); Assert.assertEquals(1, resources.size()); Assert.assertEquals(expectedResponse.getInstancesList().get(0), resources.get(0)); List<GeneratedMessageV3> actualRequests = mockInstanceAdmin.getRequests(); Assert.assertEquals(1, actualRequests.size()); ListInstancesRequest actualRequest = (ListInstancesRequest) actualRequests.get(0); Assert.assertEquals(parent, ProjectName.parse(actualRequest.getParent())); 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 (!getParentBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); } if (pageSize_ != 0) { size += com.google.protobuf.CodedOutputStream.computeInt32Size(2, pageSize_); } if (!getPageTokenBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, pageToken_); } if (!getFilterBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, filter_); } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; }
/** * * * <pre> * Required. The name of the project for which a list of instances is * requested. Values are of the form `projects/<project>`. * </pre> * * <code>string parent = 1;</code> */ public Builder clearParent() { parent_ = getDefaultInstance().getParent(); onChanged(); return this; } /**
/** * * * <pre> * If non-empty, `page_token` should contain a * [next_page_token][google.spanner.admin.instance.v1.ListInstancesResponse.next_page_token] from a * previous [ListInstancesResponse][google.spanner.admin.instance.v1.ListInstancesResponse]. * </pre> * * <code>string page_token = 3;</code> */ public Builder clearPageToken() { pageToken_ = getDefaultInstance().getPageToken(); onChanged(); return this; } /**
/** * * * <pre> * An expression for filtering the results of the request. Filter rules are * case insensitive. The fields eligible for filtering are: * * `name` * * `display_name` * * `labels.key` where key is the name of a label * Some examples of using filters are: * * `name:*` --> The instance has a name. * * `name:Howl` --> The instance's name contains the string "howl". * * `name:HOWL` --> Equivalent to above. * * `NAME:howl` --> Equivalent to above. * * `labels.env:*` --> The instance has the label "env". * * `labels.env:dev` --> The instance has the label "env" and the value of * the label contains the string "dev". * * `name:howl labels.env:dev` --> The instance's name contains "howl" and * it has the label "env" with its value * containing "dev". * </pre> * * <code>string filter = 4;</code> */ public Builder clearFilter() { filter_ = getDefaultInstance().getFilter(); onChanged(); return this; } /**
io.grpc.protobuf.ProtoUtils.marshaller( com.google.spanner.admin.instance.v1.ListInstancesRequest .getDefaultInstance())) .setResponseMarshaller( io.grpc.protobuf.ProtoUtils.marshaller(
@Override public Integer extractPageSize(ListInstancesRequest 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) + PARENT_FIELD_NUMBER; hash = (53 * hash) + getParent().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 = (37 * hash) + FILTER_FIELD_NUMBER; hash = (53 * hash) + getFilter().hashCode(); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
@Override public ListInstancesRequest injectToken(ListInstancesRequest payload, String token) { return ListInstancesRequest.newBuilder(payload).setPageToken(token).build(); }
@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 (pageSize_ != 0) { output.writeInt32(2, pageSize_); } if (!getPageTokenBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 3, pageToken_); } if (!getFilterBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 4, filter_); } unknownFields.writeTo(output); }