Class DatastoreAdmin

  • public class DatastoreAdmin
    • Method Detail

      • export

        public DatastoreAdmin.Export export​(java.lang.String outputUrlPrefix,
                                            java.util.Collection<java.lang.String> kinds)
        Returns an DatastoreAdmin.Export request that starts exporting all Cloud Datastore databases owned by the GCP project identified by projectId.

        Typical usage is:

             Export export = datastoreAdmin.export(parameters ...);
             Operation operation = export.execute();
             while (!operation.isSuccessful()) { ...}

        Please see the API specification of the export method for details.

        The following undocumented behaviors with regard to outputUrlPrefix have been observed:

        • If outputUrlPrefix refers to a GCS bucket, exported data will be nested deeper in the bucket with a timestamped path. This is useful when periodical backups are desired
        • If outputUrlPrefix is a already a nested path in a GCS bucket, exported data will be put under this path. This means that a nested path is not reusable, since the export process by default would not overwrite existing files.
        outputUrlPrefix - the full resource URL of the external storage location
        kinds - the datastore 'kinds' to be exported. If empty, all kinds will be exported
      • importBackup

        public DatastoreAdmin.Import importBackup​(java.lang.String backupUrl)
        Imports the entire backup specified by backupUrl back to Cloud Datastore.

        A successful backup restores deleted entities and reverts updates to existing entities since the backup time. However, it does not affect newly added entities.

      • importBackup

        public DatastoreAdmin.Import importBackup​(java.lang.String backupUrl,
                                                  java.util.Collection<java.lang.String> kinds)
        Imports the backup specified by backupUrl back to Cloud Datastore. Only entities whose types are included in kinds are imported.
        See Also:
      • get

        public DatastoreAdmin.Get get​(java.lang.String operationName)
        Returns a DatastoreAdmin.Get request that retrieves the details of an export or import Operation.
        operationName - name of the Operation as returned by an export or import request
      • list

        public DatastoreAdmin.ListOperations list​(java.lang.String filter)
        Returns a DatastoreAdmin.ListOperations request that retrieves all export or import operations matching filter.

        Sample usage: find all operations started after 2018-10-31 00:00:00 UTC and has stopped:

             String filter = "metadata.common.startTime>\"2018-10-31T0:0:0Z\" AND done=true";
             List<Operation> operations = datastoreAdmin.list(filter);

        Please refer to Operation for how to reference operation properties.