@java.lang.Override public Builder newBuilderForType() { return newBuilder(); }
public Builder mergeFrom(com.google.logging.v2.ListSinksRequest other) { if (other == com.google.logging.v2.ListSinksRequest.getDefaultInstance()) return this; if (!other.getParent().isEmpty()) { parent_ = other.parent_; onChanged(); } if (!other.getPageToken().isEmpty()) { pageToken_ = other.pageToken_; onChanged(); } if (other.getPageSize() != 0) { setPageSize(other.getPageSize()); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }
@java.lang.Override public com.google.logging.v2.ListSinksRequest buildPartial() { com.google.logging.v2.ListSinksRequest result = new com.google.logging.v2.ListSinksRequest(this); result.parent_ = parent_; result.pageToken_ = pageToken_; result.pageSize_ = pageSize_; 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.ListSinksRequest)) { return super.equals(obj); } com.google.logging.v2.ListSinksRequest other = (com.google.logging.v2.ListSinksRequest) obj; boolean result = true; result = result && getParent().equals(other.getParent()); result = result && getPageToken().equals(other.getPageToken()); result = result && (getPageSize() == other.getPageSize()); 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) + getDescriptor().hashCode(); hash = (37 * hash) + PARENT_FIELD_NUMBER; hash = (53 * hash) + getParent().hashCode(); hash = (37 * hash) + PAGE_TOKEN_FIELD_NUMBER; hash = (53 * hash) + getPageToken().hashCode(); hash = (37 * hash) + PAGE_SIZE_FIELD_NUMBER; hash = (53 * hash) + getPageSize(); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
@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 (!getPageTokenBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 2, pageToken_); } if (pageSize_ != 0) { output.writeInt32(3, pageSize_); } unknownFields.writeTo(output); }
/** * * * <pre> * Required. The parent resource whose sinks are to be listed: * "projects/[PROJECT_ID]" * "organizations/[ORGANIZATION_ID]" * "billingAccounts/[BILLING_ACCOUNT_ID]" * "folders/[FOLDER_ID]" * </pre> * * <code>string parent = 1;</code> */ public Builder clearParent() { parent_ = getDefaultInstance().getParent(); onChanged(); return this; } /**
/** * * * <pre> * Optional. If present, then retrieve the next batch of results from the * preceding call to this method. `pageToken` must be the value of * `nextPageToken` from the previous response. The values of other method * parameters should be identical to those in the previous call. * </pre> * * <code>string page_token = 2;</code> */ public Builder clearPageToken() { pageToken_ = getDefaultInstance().getPageToken(); onChanged(); return this; } /**
@java.lang.Override public com.google.logging.v2.ListSinksRequest getDefaultInstanceForType() { return com.google.logging.v2.ListSinksRequest.getDefaultInstance(); }
@Override public Integer extractPageSize(ListSinksRequest payload) { return payload.getPageSize(); }
@Test @SuppressWarnings("all") public void listSinksTest() { String nextPageToken = ""; LogSink sinksElement = LogSink.newBuilder().build(); List<LogSink> sinks = Arrays.asList(sinksElement); ListSinksResponse expectedResponse = ListSinksResponse.newBuilder().setNextPageToken(nextPageToken).addAllSinks(sinks).build(); mockConfigServiceV2.addResponse(expectedResponse); ParentName parent = ProjectName.of("[PROJECT]"); ListSinksPagedResponse pagedListResponse = client.listSinks(parent); List<LogSink> resources = Lists.newArrayList(pagedListResponse.iterateAll()); Assert.assertEquals(1, resources.size()); Assert.assertEquals(expectedResponse.getSinksList().get(0), resources.get(0)); List<GeneratedMessageV3> actualRequests = mockConfigServiceV2.getRequests(); Assert.assertEquals(1, actualRequests.size()); ListSinksRequest actualRequest = (ListSinksRequest) actualRequests.get(0); Assert.assertEquals(parent, ParentNames.parse(actualRequest.getParent())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
.setRequestMarshaller( io.grpc.protobuf.ProtoUtils.marshaller( com.google.logging.v2.ListSinksRequest.getDefaultInstance())) .setResponseMarshaller( io.grpc.protobuf.ProtoUtils.marshaller(
@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 (!getPageTokenBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, pageToken_); } if (pageSize_ != 0) { size += com.google.protobuf.CodedOutputStream.computeInt32Size(3, pageSize_); } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; }
@Override public Integer extractPageSize(ListSinksRequest payload) { return payload.getPageSize(); }
@Override public ListSinksRequest injectPageSize(ListSinksRequest payload, int pageSize) { return ListSinksRequest.newBuilder(payload).setPageSize(pageSize).build(); }
.setRequestMarshaller( io.grpc.protobuf.ProtoUtils.marshaller( com.google.logging.v2.ListSinksRequest.getDefaultInstance())) .setResponseMarshaller( io.grpc.protobuf.ProtoUtils.marshaller(
@Override public ListSinksRequest injectToken(ListSinksRequest payload, String token) { return ListSinksRequest.newBuilder(payload).setPageToken(token).build(); }
/** * Lists sinks. * * <p>Sample code: * * <pre><code> * try (ConfigClient configClient = ConfigClient.create()) { * ParentName parent = ProjectName.of("[PROJECT]"); * for (LogSink element : configClient.listSinks(parent).iterateAll()) { * // doThingsWith(element); * } * } * </code></pre> * * @param parent Required. The parent resource whose sinks are to be listed: * <p>"projects/[PROJECT_ID]" "organizations/[ORGANIZATION_ID]" * "billingAccounts/[BILLING_ACCOUNT_ID]" "folders/[FOLDER_ID]" * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ListSinksPagedResponse listSinks(ParentName parent) { ListSinksRequest request = ListSinksRequest.newBuilder().setParent(parent == null ? null : parent.toString()).build(); return listSinks(request); }
/** * Lists sinks. * * <p>Sample code: * * <pre><code> * try (ConfigClient configClient = ConfigClient.create()) { * ParentName parent = ProjectName.of("[PROJECT]"); * for (LogSink element : configClient.listSinks(parent.toString()).iterateAll()) { * // doThingsWith(element); * } * } * </code></pre> * * @param parent Required. The parent resource whose sinks are to be listed: * <p>"projects/[PROJECT_ID]" "organizations/[ORGANIZATION_ID]" * "billingAccounts/[BILLING_ACCOUNT_ID]" "folders/[FOLDER_ID]" * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ListSinksPagedResponse listSinks(String parent) { ListSinksRequest request = ListSinksRequest.newBuilder().setParent(parent).build(); return listSinks(request); }
private static ListSinksRequest listSinksRequest( LoggingOptions serviceOptions, Map<Option.OptionType, ?> options) { ListSinksRequest.Builder builder = ListSinksRequest.newBuilder(); builder.setParent(ProjectName.of(serviceOptions.getProjectId()).toString()); Integer pageSize = PAGE_SIZE.get(options); String pageToken = PAGE_TOKEN.get(options); if (pageSize != null) { builder.setPageSize(pageSize); } if (pageToken != null) { builder.setPageToken(pageToken); } return builder.build(); }