-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add system tests to storagetransfer samples.
Removes the PowerMock dependency which was having some bad interactions with Mockito.
- Loading branch information
Showing
16 changed files
with
296 additions
and
338 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,18 +13,34 @@ These samples are used on the following documentation pages: | |
|
||
## Prerequisites | ||
|
||
1. Set up a project on Google Developers Console. | ||
1. Go to the [Developers Console](https://cloud.google.com/console) and create or select your project. | ||
You will need the project ID later. | ||
1. Set up a project on Google Cloud Console. | ||
1. Go to the [Google Cloud Console](https://console.cloud.google.com) and | ||
create or select your project. You will need the project ID later. | ||
1. Enable the [Google Storage Transfer API in the Google Cloud | ||
Console](https://console.cloud.google.com/apis/api/storagetransfer/overview). | ||
1. Within Developers Console, select APIs & auth > Credentials. | ||
1. Select Add credentials > Service account > JSON key. | ||
1. Set the environment variable GOOGLE_APPLICATION_CREDENTIALS to point to your JSON key. | ||
1. Add the Storage Transfer service account as an editor of your project | ||
storage-transfer-5031963314028297433@partnercontent.gserviceaccount.com | ||
1. Set the environment variable `GOOGLE_APPLICATION_CREDENTIALS` to point to | ||
your JSON key. | ||
1. Add the Storage Transfer service account as an editor of your project. | ||
1. To get the email address used for the service account, execute the | ||
[googleServiceAccounts.get REST | ||
method](https://cloud.google.com/storage/transfer/reference/rest/v1/googleServiceAccounts/get#try-it). | ||
There should be a "Try It" section on that page, otherwise execute it in | ||
the [APIs | ||
Explorer](https://developers.google.com/apis-explorer/#p/storagetransfer/v1/storagetransfer.googleServiceAccounts.get). | ||
|
||
It should output an email address like: | ||
|
||
``` | ||
[email protected] | ||
``` | ||
1. Add this as a member and select the Project -> Editor permission on the | ||
[Google Cloud Console IAM and Admin | ||
page](https://console.cloud.google.com/iam-admin/iam/project). | ||
1. Set up gcloud for application default credentials. | ||
1. `gcloud components update` | ||
1. `gcloud auth login` | ||
1. `gcloud config set project PROJECT_ID` | ||
1. `gcloud init` | ||
|
||
## Transfer from Amazon S3 to Google Cloud Storage | ||
|
||
|
@@ -35,9 +51,21 @@ Creating a one-time transfer from Amazon S3 to Google Cloud Storage. | |
1. Go to AWS Management Console and create a bucket. | ||
1. Under Security Credentials, create an IAM User with access to the bucket. | ||
1. Create an Access Key for the user. Note the Access Key ID and Secret Access Key. | ||
1. Set the `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` environment variables. | ||
1. In AwsRequester.java, fill in the user-provided constants. | ||
1. Run with `mvn compile` and | ||
`mvn exec:java -Dexec.mainClass="com.google.cloud.storage.storagetransfer.samples.AwsRequester"` | ||
1. Compile the package with | ||
``` | ||
mvn compile | ||
``` | ||
1. Run the transfer job with | ||
``` | ||
mvn exec:java \ | ||
-Dexec.mainClass="com.google.cloud.storage.storagetransfer.samples.AwsRequester" \ | ||
-DprojectId=your-google-cloud-project-id \ | ||
-DjobDescription="Sample transfer job from S3 to GCS." \ | ||
-DawsSourceBucket=your-s3-bucket-name \ | ||
-DgcsSinkBucket=your-gcs-bucket-name | ||
``` | ||
1. Note the job ID in the returned Transfer Job. | ||
|
||
## Transfer data from a standard Cloud Storage bucket to a Cloud Storage Nearline bucket | ||
|
@@ -59,3 +87,8 @@ bucket for files untouched for 30 days. | |
1. In RequestChecker.java, fill in the user-provided constants. Use the Job Name you recorded earlier. | ||
1. Run with `mvn compile` and | ||
`mvn exec:java -Dexec.mainClass="com.google.cloud.storage.storagetransfer.samples.RequestChecker"` | ||
|
||
## References | ||
|
||
- [Google Storage Transfer API Client | ||
Library](https://developers.google.com/api-client-library/java/apis/storagetransfer/v1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.