( projectId, description, azureStorageAccount, azureSourceContainer, gcsSinkBucket, azureSASToken = process.env.AZURE_SAS_TOKEN )
| 17 | 'use strict'; |
| 18 | |
| 19 | async function main( |
| 20 | projectId, |
| 21 | description, |
| 22 | azureStorageAccount, |
| 23 | azureSourceContainer, |
| 24 | gcsSinkBucket, |
| 25 | azureSASToken = process.env.AZURE_SAS_TOKEN |
| 26 | ) { |
| 27 | // [START storagetransfer_transfer_from_azure] |
| 28 | |
| 29 | // Imports the Google Cloud client library |
| 30 | const { |
| 31 | StorageTransferServiceClient, |
| 32 | } = require('@google-cloud/storage-transfer'); |
| 33 | |
| 34 | /** |
| 35 | * TODO(developer): Uncomment the following lines before running the sample. |
| 36 | */ |
| 37 | // The ID of the Google Cloud Platform Project that owns the job |
| 38 | // projectId = 'my-project-id' |
| 39 | |
| 40 | // A useful description for your transfer job |
| 41 | // description = 'My transfer job' |
| 42 | |
| 43 | // Azure Storage Account name |
| 44 | // azureStorageAccount = 'accountname' |
| 45 | |
| 46 | // Azure Storage Account name |
| 47 | // azureSourceContainer = 'my-azure-source-bucket' |
| 48 | |
| 49 | // Azure Shared Access Signature token |
| 50 | // azureSASToken = '?sv=...' |
| 51 | |
| 52 | // Google Cloud Storage destination bucket name |
| 53 | // gcsSinkBucket = 'my-gcs-destination-bucket' |
| 54 | |
| 55 | // Creates a client |
| 56 | const client = new StorageTransferServiceClient(); |
| 57 | |
| 58 | /** |
| 59 | * Creates a one-time transfer job from Azure Blob Storage to Google Cloud Storage. |
| 60 | */ |
| 61 | async function transferFromBlobStorage() { |
| 62 | // Setting the start date and the end date as the same time creates a |
| 63 | // one-time transfer |
| 64 | const now = new Date(); |
| 65 | const oneTimeSchedule = { |
| 66 | day: now.getDate(), |
| 67 | month: now.getMonth() + 1, |
| 68 | year: now.getFullYear(), |
| 69 | }; |
| 70 | |
| 71 | // Runs the request and creates the job |
| 72 | const [transferJob] = await client.createTransferJob({ |
| 73 | transferJob: { |
| 74 | projectId, |
| 75 | description, |
| 76 | status: 'ENABLED', |
no test coverage detected