nevzheng commented on code in PR #12132: URL: https://github.com/apache/gravitino/pull/12132#discussion_r3646933085
########## common/src/main/java/org/apache/gravitino/encryption/kms/KmsClient.java: ########## @@ -0,0 +1,53 @@ +/* + * 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.gravitino.encryption.kms; + +import java.util.Optional; +import org.apache.gravitino.annotation.DeveloperApi; +import org.apache.gravitino.exceptions.ConnectionFailedException; + +/** + * Inspects keys managed by a configured KMS. + * + * <p>This is a server-side operation client, not a credential-vending API. Provider credentials + * authenticate calls made by the client and must never be returned to callers. This client does not + * perform cryptographic operations. + */ +@DeveloperApi +public interface KmsClient extends AutoCloseable { + + /** + * Reads the provider-reported properties of a key. + * + * <p>An empty result means the provider authoritatively reported that the key does not exist. + * Authentication, authorization, timeout, availability, and other indeterminate failures are + * reported as exceptions, never as an empty result. + * + * @param reference key to inspect + * @return normalized key properties, or empty when the key authoritatively does not exist; never + * null + * @throws IllegalArgumentException if the reference does not belong to this client + * @throws ConnectionFailedException if the provider cannot be queried Review Comment: Done in f4c0e16af. `KmsClient.getKeyProperties` now documents the non-null reference requirement and that null or a reference owned by another API/source produces `IllegalArgumentException`, matching the reusable contract tests. Common tests, Spotless, and Javadocs pass. -- 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]
