/** * * * <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 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; }
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; }
@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())); }