kbendick commented on a change in pull request #4037:
URL: https://github.com/apache/iceberg/pull/4037#discussion_r811439128



##########
File path: 
core/src/main/java/org/apache/iceberg/rest/responses/UpdateNamespacePropertiesResponse.java
##########
@@ -0,0 +1,141 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iceberg.rest.responses;
+
+import java.util.Collection;
+import java.util.List;
+import org.apache.iceberg.relocated.com.google.common.base.MoreObjects;
+import org.apache.iceberg.relocated.com.google.common.base.Preconditions;
+import org.apache.iceberg.relocated.com.google.common.collect.ImmutableList;
+import org.apache.iceberg.relocated.com.google.common.collect.ImmutableSet;
+
+/**
+ * A REST response to a request to set and/or remove properties on a namespace.
+ */
+public class UpdateNamespacePropertiesResponse {
+
+  // List of namespace property keys that were removed
+  private List<String> removed;
+  // List of namespace property keys that were added or updated
+  private List<String> updated;
+  // List of properties that were requested for removal that were not found in 
the namespace's properties
+  private List<String> missing;
+
+  public UpdateNamespacePropertiesResponse() {
+    // Required for Jackson deserialization
+  }
+
+  private UpdateNamespacePropertiesResponse(List<String> removed, List<String> 
updated, List<String> missing) {
+    this.removed = removed;
+    this.updated = updated;
+    this.missing = missing;
+    validate();
+  }
+
+  UpdateNamespacePropertiesResponse validate() {
+    Preconditions.checkArgument(removed != null || updated != null  || missing 
!= null,
+        "Cannot create a response to update namespace properties if all fields 
are missing");
+    return this;
+  }
+
+  public List<String> removed() {
+    return removed != null ? removed : ImmutableList.of();
+  }
+
+  public List<String> updated() {
+    return updated != null ? updated : ImmutableList.of();
+  }
+
+  public List<String> missing() {
+    return missing != null ? missing : ImmutableList.of();
+  }
+
+  @Override
+  public String toString() {
+    return MoreObjects.toStringHelper(this)
+        .add("removed", removed)
+        .add("updates", updated)
+        .add("missing", missing)
+        .toString();
+  }
+
+  public static Builder builder() {
+    return new Builder();
+  }
+
+  public static class Builder {
+    private final ImmutableSet.Builder<String> removedBuilder = 
ImmutableSet.builder();
+    private final ImmutableSet.Builder<String> updatedBuilder = 
ImmutableSet.builder();
+    private final ImmutableSet.Builder<String> missingBuilder = 
ImmutableSet.builder();
+
+    private Builder() {
+    }
+
+    public Builder addMissing(String key) {
+      Preconditions.checkNotNull(key, "Invalid property to add to missing 
properties: null");

Review comment:
       Fixed!

##########
File path: 
core/src/main/java/org/apache/iceberg/rest/responses/UpdateNamespacePropertiesResponse.java
##########
@@ -0,0 +1,141 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iceberg.rest.responses;
+
+import java.util.Collection;
+import java.util.List;
+import org.apache.iceberg.relocated.com.google.common.base.MoreObjects;
+import org.apache.iceberg.relocated.com.google.common.base.Preconditions;
+import org.apache.iceberg.relocated.com.google.common.collect.ImmutableList;
+import org.apache.iceberg.relocated.com.google.common.collect.ImmutableSet;
+
+/**
+ * A REST response to a request to set and/or remove properties on a namespace.
+ */
+public class UpdateNamespacePropertiesResponse {
+
+  // List of namespace property keys that were removed
+  private List<String> removed;
+  // List of namespace property keys that were added or updated
+  private List<String> updated;
+  // List of properties that were requested for removal that were not found in 
the namespace's properties
+  private List<String> missing;
+
+  public UpdateNamespacePropertiesResponse() {
+    // Required for Jackson deserialization
+  }
+
+  private UpdateNamespacePropertiesResponse(List<String> removed, List<String> 
updated, List<String> missing) {
+    this.removed = removed;
+    this.updated = updated;
+    this.missing = missing;
+    validate();
+  }
+
+  UpdateNamespacePropertiesResponse validate() {
+    Preconditions.checkArgument(removed != null || updated != null  || missing 
!= null,
+        "Cannot create a response to update namespace properties if all fields 
are missing");

Review comment:
       Agreed and fixed.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to