Move invoice generation to billing bucket and improve emailing

This moves the new pipeline's invoice generation to the billing bucket, under the 'invoices/yyyy-MM' subdirectory.

This also changes the invoice e-mail to use a multipart message that attaches the invoice to the e-mail, to guarantee the correct MIME type and download.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=181746191
This commit is contained in:
larryruili 2018-01-12 08:18:49 -08:00 committed by Ben McIlwain
parent 5726f1dc4e
commit a42f18798e
16 changed files with 477 additions and 133 deletions

View file

@ -464,14 +464,50 @@ public final class RegistryConfig {
}
/**
* Returns the Google Cloud Storage bucket for storing Beam templates and results.
* Returns the name of the GCS bucket for storing Beam templates and results.
*
* @see google.registry.billing.GenerateInvoicesAction
*/
@Provides
@Config("apacheBeamBucket")
public static String provideApacheBeamBucket(@Config("projectId") String projectId) {
return projectId + "-beam";
}
/**
* Returns the URL of the GCS location for storing Apache Beam related objects.
*
* @see google.registry.billing.GenerateInvoicesAction
*/
@Provides
@Config("apacheBeamBucketUrl")
public static String provideApacheBeamBucketUrl(@Config("projectId") String projectId) {
return String.format("gs://%s-beam", projectId);
public static String provideApacheBeamBucketUrl(@Config("apacheBeamBucket") String beamBucket) {
return "gs://" + beamBucket;
}
/**
* Returns the URL of the GCS location for storing the monthly invoicing Beam template.
*
* @see google.registry.billing.GenerateInvoicesAction
* @see google.registry.beam.InvoicingPipeline
*/
@Provides
@Config("invoiceTemplateUrl")
public static String provideInvoiceTemplateUrl(
@Config("apacheBeamBucketUrl") String beamBucketUrl) {
return beamBucketUrl + "/templates/invoicing";
}
/**
* Returns the URL of the GCS location we store jar dependencies for the invoicing pipeline.
*
* @see google.registry.beam.InvoicingPipeline
*/
@Provides
@Config("invoiceStagingUrl")
public static String provideInvoiceStagingUrl(
@Config("apacheBeamBucketUrl") String beamBucketUrl) {
return beamBucketUrl + "/staging";
}
/**
@ -508,6 +544,28 @@ public final class RegistryConfig {
return config.icannReporting.icannActivityReportingUploadUrl;
}
/**
* Returns name of the GCS bucket we store invoices and detail reports in.
*
* @see google.registry.billing
*/
@Provides
@Config("billingBucket")
public static String provideBillingBucket(@Config("projectId") String projectId) {
return projectId + "-billing";
}
/**
* Returns the URL of the GCS bucket we store invoices and detail reports in.
*
* @see google.registry.billing
*/
@Provides
@Config("billingBucketUrl")
public static String provideBillingBucketUrl(@Config("billingBucket") String billingBucket) {
return "gs://" + billingBucket;
}
/**
* Returns the list of addresses that receive monthly invoicing emails.
*