mirror of
https://github.com/google/nomulus.git
synced 2025-05-12 22:38:16 +02:00
Export registered domains to drive folder
The export happens in a reducer, whois instance fields all need to be serializable. The DriveConnection is therefore installed as a class variable that can be replaced with a mock during test. Class variables are not serialized. Only fields related to a particular instance are. Note that DriveConnection is a misnomer. It is not a connection at all. It is just a thin wrapper class around the Drive service class, which provides convenient methods to write into Drive. Regardless, it cannot be serialized. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=194596695
This commit is contained in:
parent
c242a4d08f
commit
ebce333d5b
4 changed files with 127 additions and 28 deletions
|
@ -19,11 +19,19 @@ import com.google.api.client.http.HttpTransport;
|
|||
import com.google.api.client.json.JsonFactory;
|
||||
import com.google.api.services.drive.Drive;
|
||||
import com.google.api.services.drive.DriveScopes;
|
||||
import dagger.Component;
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
import google.registry.config.RegistryConfig.Config;
|
||||
import google.registry.config.RegistryConfig.ConfigModule;
|
||||
import google.registry.request.Modules.AppIdentityCredentialModule;
|
||||
import google.registry.request.Modules.Jackson2Module;
|
||||
import google.registry.request.Modules.UrlFetchTransportModule;
|
||||
import google.registry.request.Modules.UseAppIdentityCredentialForGoogleApisModule;
|
||||
import google.registry.storage.drive.DriveConnection;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
/** Dagger module for Google {@link Drive} service connection objects. */
|
||||
@Module
|
||||
|
@ -39,4 +47,18 @@ public final class DriveModule {
|
|||
.setApplicationName(projectId)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Singleton
|
||||
@Component(
|
||||
modules = {
|
||||
DriveModule.class,
|
||||
UrlFetchTransportModule.class,
|
||||
Jackson2Module.class,
|
||||
AppIdentityCredentialModule.class,
|
||||
UseAppIdentityCredentialForGoogleApisModule.class,
|
||||
ConfigModule.class
|
||||
})
|
||||
interface DriveComponent {
|
||||
DriveConnection driveConnection();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue