1 /* 2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"). 5 * You may not use this file except in compliance with the License. 6 * A copy of the License is located at 7 * 8 * http://aws.amazon.com/apache2.0 9 * 10 * or in the "license" file accompanying this file. This file is distributed 11 * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 12 * express or implied. See the License for the specific language governing 13 * permissions and limitations under the License. 14 */ 15 16 package software.amazon.awssdk.services.neptune.internal; 17 18 import java.time.Clock; 19 import software.amazon.awssdk.annotations.SdkInternalApi; 20 import software.amazon.awssdk.annotations.SdkTestInternalApi; 21 import software.amazon.awssdk.http.SdkHttpFullRequest; 22 import software.amazon.awssdk.services.neptune.model.CopyDbClusterSnapshotRequest; 23 import software.amazon.awssdk.services.neptune.transform.CopyDbClusterSnapshotRequestMarshaller; 24 25 /** 26 * Handler for pre-signing {@link CopyDbClusterSnapshotRequest}. 27 */ 28 @SdkInternalApi 29 public final class CopyDbClusterSnapshotPresignInterceptor extends RdsPresignInterceptor<CopyDbClusterSnapshotRequest> { 30 31 public static final CopyDbClusterSnapshotRequestMarshaller MARSHALLER = 32 new CopyDbClusterSnapshotRequestMarshaller(PROTOCOL_FACTORY); 33 CopyDbClusterSnapshotPresignInterceptor()34 public CopyDbClusterSnapshotPresignInterceptor() { 35 super(CopyDbClusterSnapshotRequest.class); 36 } 37 38 @SdkTestInternalApi CopyDbClusterSnapshotPresignInterceptor(Clock signingDateOverride)39 CopyDbClusterSnapshotPresignInterceptor(Clock signingDateOverride) { 40 super(CopyDbClusterSnapshotRequest.class, signingDateOverride); 41 } 42 43 @Override adaptRequest(final CopyDbClusterSnapshotRequest originalRequest)44 protected PresignableRequest adaptRequest(final CopyDbClusterSnapshotRequest originalRequest) { 45 return new PresignableRequest() { 46 @Override 47 public String getSourceRegion() { 48 return originalRequest.sourceRegion(); 49 } 50 51 @Override 52 public SdkHttpFullRequest marshall() { 53 return MARSHALLER.marshall(originalRequest); 54 } 55 }; 56 } 57 } 58