

package software.amazon.awssdk.services.rds.internal;

import java.time.Clock;
import software.amazon.awssdk.annotations.SdkInternalApi;
import software.amazon.awssdk.annotations.SdkTestInternalApi;
import software.amazon.awssdk.http.SdkHttpFullRequest;
import software.amazon.awssdk.services.rds.model.CopyDbSnapshotRequest;
import software.amazon.awssdk.services.rds.transform.CopyDbSnapshotRequestMarshaller;

/**
 * Handler for pre-signing {@link CopyDbSnapshotRequest}.
 */
@SdkInternalApi
public final class CopyDbSnapshotPresignInterceptor extends RdsPresignInterceptor<CopyDbSnapshotRequest> {

    public static final CopyDbSnapshotRequestMarshaller MARSHALLER = new CopyDbSnapshotRequestMarshaller(PROTOCOL_FACTORY);

    public CopyDbSnapshotPresignInterceptor() {
        super(CopyDbSnapshotRequest.class);
    }

    @SdkTestInternalApi
    CopyDbSnapshotPresignInterceptor(Clock signingDateOverride) {
        super(CopyDbSnapshotRequest.class, signingDateOverride);
    }

    @Override
    protected PresignableRequest adaptRequest(final CopyDbSnapshotRequest originalRequest) {
        return new PresignableRequest() {
            @Override
            public String getSourceRegion() {
                return originalRequest.sourceRegion();
            }

            @Override
            public SdkHttpFullRequest marshall() {
                return MARSHALLER.marshall(originalRequest);
            }
        };
    }
}
