2525import com .amazonaws .AmazonWebServiceRequest ;
2626import com .amazonaws .ResponseMetadata ;
2727import com .amazonaws .regions .Region ;
28- import com .amazonaws .services .kms .AWSKMS ;
28+ import com .amazonaws .services .kms .AbstractAWSKMS ;
2929import com .amazonaws .services .kms .model .CancelKeyDeletionRequest ;
3030import com .amazonaws .services .kms .model .CancelKeyDeletionResult ;
3131import com .amazonaws .services .kms .model .CreateAliasRequest ;
7777import com .amazonaws .services .kms .model .UpdateAliasRequest ;
7878import com .amazonaws .services .kms .model .UpdateKeyDescriptionRequest ;
7979
80- public class FakeKMS implements AWSKMS {
80+ public class FakeKMS extends AbstractAWSKMS {
8181 private static final SecureRandom rnd = new SecureRandom ();
8282 private static final String ACCOUNT_ID = "01234567890" ;
8383 private final Map <DecryptMapKey , DecryptResult > results_ = new HashMap <>();
8484
85- @ Override
86- public void createAlias (CreateAliasRequest arg0 ) throws AmazonServiceException ,
87- AmazonClientException {
88- throw new UnsupportedOperationException ();
89- }
90-
91- @ Override
92- public CreateGrantResult createGrant (CreateGrantRequest arg0 ) throws AmazonServiceException ,
93- AmazonClientException {
94- throw new UnsupportedOperationException ();
95- }
96-
97- @ Override
98- public CreateKeyResult createKey () throws AmazonServiceException , AmazonClientException {
99- return createKey (new CreateKeyRequest ());
100- }
101-
10285 @ Override
10386 public CreateKeyResult createKey (CreateKeyRequest req ) throws AmazonServiceException ,
10487 AmazonClientException {
@@ -123,42 +106,6 @@ public DecryptResult decrypt(DecryptRequest req) throws AmazonServiceException,
123106 }
124107 }
125108
126- @ Override
127- public void deleteAlias (DeleteAliasRequest arg0 ) throws AmazonServiceException ,
128- AmazonClientException {
129- throw new UnsupportedOperationException ();
130- }
131-
132- @ Override
133- public DescribeKeyResult describeKey (DescribeKeyRequest arg0 ) throws AmazonServiceException ,
134- AmazonClientException {
135- throw new UnsupportedOperationException ();
136- }
137-
138- @ Override
139- public void disableKey (DisableKeyRequest arg0 ) throws AmazonServiceException ,
140- AmazonClientException {
141- throw new UnsupportedOperationException ();
142- }
143-
144- @ Override
145- public void disableKeyRotation (DisableKeyRotationRequest arg0 ) throws AmazonServiceException ,
146- AmazonClientException {
147- throw new UnsupportedOperationException ();
148- }
149-
150- @ Override
151- public void enableKey (EnableKeyRequest arg0 ) throws AmazonServiceException ,
152- AmazonClientException {
153- throw new UnsupportedOperationException ();
154- }
155-
156- @ Override
157- public void enableKeyRotation (EnableKeyRotationRequest arg0 ) throws AmazonServiceException ,
158- AmazonClientException {
159- throw new UnsupportedOperationException ();
160- }
161-
162109 @ Override
163110 public EncryptResult encrypt (EncryptRequest req ) throws AmazonServiceException ,
164111 AmazonClientException {
@@ -208,123 +155,6 @@ public GenerateDataKeyWithoutPlaintextResult generateDataKeyWithoutPlaintext(
208155 generateDataKey .getCiphertextBlob ()).withKeyId (req .getKeyId ());
209156 }
210157
211- @ Override
212- public GenerateRandomResult generateRandom () throws AmazonServiceException ,
213- AmazonClientException {
214- throw new UnsupportedOperationException ();
215- }
216-
217- @ Override
218- public GenerateRandomResult generateRandom (GenerateRandomRequest arg0 )
219- throws AmazonServiceException , AmazonClientException {
220- throw new UnsupportedOperationException ();
221- }
222-
223- @ Override
224- public ResponseMetadata getCachedResponseMetadata (AmazonWebServiceRequest arg0 ) {
225- throw new UnsupportedOperationException ();
226- }
227-
228- @ Override
229- public GetKeyPolicyResult getKeyPolicy (GetKeyPolicyRequest arg0 ) throws AmazonServiceException ,
230- AmazonClientException {
231- throw new UnsupportedOperationException ();
232- }
233-
234- @ Override
235- public GetKeyRotationStatusResult getKeyRotationStatus (GetKeyRotationStatusRequest arg0 )
236- throws AmazonServiceException , AmazonClientException {
237- throw new UnsupportedOperationException ();
238- }
239-
240- @ Override
241- public ListAliasesResult listAliases () throws AmazonServiceException , AmazonClientException {
242- throw new UnsupportedOperationException ();
243- }
244-
245- @ Override
246- public ListAliasesResult listAliases (ListAliasesRequest arg0 ) throws AmazonServiceException ,
247- AmazonClientException {
248- throw new UnsupportedOperationException ();
249- }
250-
251- @ Override
252- public ListGrantsResult listGrants (ListGrantsRequest arg0 ) throws AmazonServiceException ,
253- AmazonClientException {
254- throw new UnsupportedOperationException ();
255- }
256-
257- @ Override
258- public ListKeyPoliciesResult listKeyPolicies (ListKeyPoliciesRequest arg0 )
259- throws AmazonServiceException , AmazonClientException {
260- throw new UnsupportedOperationException ();
261- }
262-
263- @ Override
264- public ListKeysResult listKeys () throws AmazonServiceException , AmazonClientException {
265- throw new UnsupportedOperationException ();
266- }
267-
268- @ Override
269- public ListKeysResult listKeys (ListKeysRequest arg0 ) throws AmazonServiceException ,
270- AmazonClientException {
271- throw new UnsupportedOperationException ();
272- }
273-
274- @ Override
275- public void putKeyPolicy (PutKeyPolicyRequest arg0 ) throws AmazonServiceException ,
276- AmazonClientException {
277- throw new UnsupportedOperationException ();
278- }
279-
280- @ Override
281- public ReEncryptResult reEncrypt (ReEncryptRequest arg0 ) throws AmazonServiceException ,
282- AmazonClientException {
283- throw new UnsupportedOperationException ();
284- }
285-
286- @ Override
287- public void retireGrant () throws AmazonServiceException ,
288- AmazonClientException {
289- throw new UnsupportedOperationException ();
290- }
291-
292- @ Override
293- public void retireGrant (RetireGrantRequest arg0 ) throws AmazonServiceException ,
294- AmazonClientException {
295- throw new UnsupportedOperationException ();
296- }
297-
298- @ Override
299- public void revokeGrant (RevokeGrantRequest arg0 ) throws AmazonServiceException ,
300- AmazonClientException {
301- throw new UnsupportedOperationException ();
302- }
303-
304- @ Override
305- public void updateAlias (UpdateAliasRequest req ) throws AmazonServiceException ,
306- AmazonClientException {
307- throw new UnsupportedOperationException ();
308- }
309-
310- @ Override
311- public ScheduleKeyDeletionResult scheduleKeyDeletion (ScheduleKeyDeletionRequest scheduleKeyDeletionRequest )
312- throws AmazonServiceException , AmazonClientException {
313- throw new UnsupportedOperationException ();
314- }
315-
316- @ Override
317- public ListRetirableGrantsResult listRetirableGrants (ListRetirableGrantsRequest listRetirableGrantsRequest )
318- throws AmazonServiceException , AmazonClientException {
319- throw new UnsupportedOperationException ();
320- }
321-
322- @ Override
323- public CancelKeyDeletionResult cancelKeyDeletion (CancelKeyDeletionRequest cancelKeyDeletionRequest )
324- throws AmazonServiceException , AmazonClientException {
325- throw new UnsupportedOperationException ();
326- }
327-
328158 @ Override
329159 public void setEndpoint (String arg0 ) throws IllegalArgumentException {
330160 // Do nothing
@@ -340,12 +170,6 @@ public void shutdown() {
340170 // Do nothing
341171 }
342172
343- @ Override
344- public void updateKeyDescription (UpdateKeyDescriptionRequest arg0 )
345- throws AmazonServiceException , AmazonClientException {
346- throw new UnsupportedOperationException ();
347- }
348-
349173 public void dump () {
350174 System .out .println (results_ );
351175 }
0 commit comments