/** * * * <pre> * The project on which to execute the request. The format is * `projects/[PROJECT_ID]`. That is, this names the container * in which to look for the notification channels; it does not name a * specific channel. To query a specific channel by REST resource name, use * the * [`GetNotificationChannel`][google.monitoring.v3.NotificationChannelService.GetNotificationChannel] operation. * </pre> * * <code>string name = 5;</code> */ public Builder clearName() { name_ = getDefaultInstance().getName(); onChanged(); return this; } /**
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.monitoring.v3.ListNotificationChannelsRequest)) { return super.equals(obj); } com.google.monitoring.v3.ListNotificationChannelsRequest other = (com.google.monitoring.v3.ListNotificationChannelsRequest) obj; boolean result = true; result = result && getName().equals(other.getName()); result = result && getFilter().equals(other.getFilter()); result = result && getOrderBy().equals(other.getOrderBy()); result = result && (getPageSize() == other.getPageSize()); result = result && getPageToken().equals(other.getPageToken()); result = result && unknownFields.equals(other.unknownFields); return result; }
@java.lang.Override public Builder newBuilderForType() { return newBuilder(); }
/** * * * <pre> * If non-empty, `page_token` must contain a value returned as the * `next_page_token` in a previous response to request the next set * of results. * </pre> * * <code>string page_token = 4;</code> */ public Builder clearPageToken() { pageToken_ = getDefaultInstance().getPageToken(); onChanged(); return this; } /**
/** * * * <pre> * If provided, this field specifies the criteria that must be met by * notification channels to be included in the response. * For more details, see [sorting and * filtering](/monitoring/api/v3/sorting-and-filtering). * </pre> * * <code>string filter = 6;</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 (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_); } if (!getFilterBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(6, filter_); } if (!getOrderByBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(7, orderBy_); } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; }
/** * * * <pre> * A comma-separated list of fields by which to sort the result. Supports * the same set of fields as in `filter`. Entries can be prefixed with * a minus sign to sort in descending rather than ascending order. * For more details, see [sorting and * filtering](/monitoring/api/v3/sorting-and-filtering). * </pre> * * <code>string order_by = 7;</code> */ public Builder clearOrderBy() { orderBy_ = getDefaultInstance().getOrderBy(); onChanged(); return this; } /**
@java.lang.Override public com.google.monitoring.v3.ListNotificationChannelsRequest getDefaultInstanceForType() { return com.google.monitoring.v3.ListNotificationChannelsRequest.getDefaultInstance(); }
@Override public Integer extractPageSize(ListNotificationChannelsRequest payload) { return payload.getPageSize(); }
@Test @SuppressWarnings("all") public void listNotificationChannelsTest() { String nextPageToken = ""; NotificationChannel notificationChannelsElement = NotificationChannel.newBuilder().build(); List<NotificationChannel> notificationChannels = Arrays.asList(notificationChannelsElement); ListNotificationChannelsResponse expectedResponse = ListNotificationChannelsResponse.newBuilder() .setNextPageToken(nextPageToken) .addAllNotificationChannels(notificationChannels) .build(); mockNotificationChannelService.addResponse(expectedResponse); ProjectName name = ProjectName.of("[PROJECT]"); ListNotificationChannelsPagedResponse pagedListResponse = client.listNotificationChannels(name); List<NotificationChannel> resources = Lists.newArrayList(pagedListResponse.iterateAll()); Assert.assertEquals(1, resources.size()); Assert.assertEquals(expectedResponse.getNotificationChannelsList().get(0), resources.get(0)); List<GeneratedMessageV3> actualRequests = mockNotificationChannelService.getRequests(); Assert.assertEquals(1, actualRequests.size()); ListNotificationChannelsRequest actualRequest = (ListNotificationChannelsRequest) actualRequests.get(0); Assert.assertEquals(name, ProjectName.parse(actualRequest.getName())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
@java.lang.Override public com.google.monitoring.v3.ListNotificationChannelsRequest buildPartial() { com.google.monitoring.v3.ListNotificationChannelsRequest result = new com.google.monitoring.v3.ListNotificationChannelsRequest(this); result.name_ = name_; result.filter_ = filter_; result.orderBy_ = orderBy_; result.pageSize_ = pageSize_; result.pageToken_ = pageToken_; onBuilt(); return result; }
@java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { 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_); } if (!getFilterBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 6, filter_); } if (!getOrderByBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 7, orderBy_); } unknownFields.writeTo(output); }
io.grpc.protobuf.ProtoUtils.marshaller( com.google.monitoring.v3.ListNotificationChannelsRequest .getDefaultInstance())) .setResponseMarshaller( io.grpc.protobuf.ProtoUtils.marshaller(
@Override public Integer extractPageSize(ListNotificationChannelsRequest 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) + ORDER_BY_FIELD_NUMBER; hash = (53 * hash) + getOrderBy().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 ListNotificationChannelsRequest injectPageSize( ListNotificationChannelsRequest payload, int pageSize) { return ListNotificationChannelsRequest.newBuilder(payload) .setPageSize(pageSize) .build(); }
io.grpc.protobuf.ProtoUtils.marshaller( com.google.monitoring.v3.ListNotificationChannelsRequest .getDefaultInstance())) .setResponseMarshaller( io.grpc.protobuf.ProtoUtils.marshaller(
public Builder mergeFrom(com.google.monitoring.v3.ListNotificationChannelsRequest other) { if (other == com.google.monitoring.v3.ListNotificationChannelsRequest.getDefaultInstance()) return this; if (!other.getName().isEmpty()) { name_ = other.name_; onChanged(); } if (!other.getFilter().isEmpty()) { filter_ = other.filter_; onChanged(); } if (!other.getOrderBy().isEmpty()) { orderBy_ = other.orderBy_; onChanged(); } if (other.getPageSize() != 0) { setPageSize(other.getPageSize()); } if (!other.getPageToken().isEmpty()) { pageToken_ = other.pageToken_; onChanged(); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }
@Override public ListNotificationChannelsRequest injectToken( ListNotificationChannelsRequest payload, String token) { return ListNotificationChannelsRequest.newBuilder(payload) .setPageToken(token) .build(); }
/** * Lists the notification channels that have been created for the project. * * <p>Sample code: * * <pre><code> * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) { * ProjectName name = ProjectName.of("[PROJECT]"); * for (NotificationChannel element : notificationChannelServiceClient.listNotificationChannels(name.toString()).iterateAll()) { * // doThingsWith(element); * } * } * </code></pre> * * @param name The project on which to execute the request. The format is `projects/[PROJECT_ID]`. * That is, this names the container in which to look for the notification channels; it does * not name a specific channel. To query a specific channel by REST resource name, use the * [`GetNotificationChannel`][google.monitoring.v3.NotificationChannelService.GetNotificationChannel] * operation. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ListNotificationChannelsPagedResponse listNotificationChannels(String name) { ListNotificationChannelsRequest request = ListNotificationChannelsRequest.newBuilder().setName(name).build(); return listNotificationChannels(request); }