Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added digital team template code to email_body.jinja2 #20

Merged
merged 2 commits into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions billing-report-utility/BillingManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ def create_project_set_lookup(self):

@staticmethod
def format_project_set_info(project_set):
formatted_project_set = project_set[0]["Project"] + "\n"
formatted_project_set = project_set[0]["Project"] + "<br>"
for account in project_set:
# NOTE: "name" is the same as "license_plate"-"Environment"
formatted_project_set += (
" - " + account["id"] + " - " + account["name"] + "\n"
" - " + account["id"] + " - " + account["name"] + "<br>"
)
return formatted_project_set

Expand Down
231 changes: 190 additions & 41 deletions billing-report-utility/templates/email_body.jinja2
Original file line number Diff line number Diff line change
@@ -1,43 +1,192 @@
<!doctype html>
<html lang="en">
<head>
<title>Cloud Pathfinder Team Billing Report</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
color: #333;
}
.content {
padding: 20px;
}
h2, h3 {
color: #444;
}
p {
line-height: 1.5;
}
.highlight {
color: #0080ff;
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:o="urn:schemas-microsoft-com:office:office">
<head>
<meta charset="UTF-8">
<meta content="width=device-width, initial-scale=1" name="viewport">
<meta name="x-apple-disable-message-reformatting">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta content="telephone=no" name="format-detection">
<title>{subject}</title><!--[if (mso 16)]>
<style type="text/css">
a {text-decoration: none;}
</style>
</head>
<body>
<div class="content">
<h2>Hello {{billing_group_email}},</h2>

<p>Please find attached your billing report for the period <span class="highlight">{{ start_date.strftime('%Y-%m-%d') }}</span> to <span class="highlight">{{ end_date.strftime('%Y-%m-%d') }}</span>, Starting at $0 CAD on <span class="highlight">{{ start_date.strftime('%Y-%m-%d') }}</span> to $<span class="highlight">{{billing_group_total}}</span> on <span class="highlight">{{ end_date.strftime('%Y-%m-%d') }}</span>.</p>

<h3>Total Charges: ${{billing_group_total}} CAD</h3>

<p>Note: Total charges also include the baseline costs for running the Secure Environment Accelerator guardrail and logging services within each account. You will see service charges from CloudTrail, CloudWatch, Systems Manager, Secrets Manager, S3, Simple Queue Service, Simple Notification Service, AWS Config, Elastic Load Balancing, GuardDuty, Key Management Service, Lambda, Macie, Security Hub, NAT gateway.</p>

<h2>Projects:</h2>
<div style="white-space: pre-line;">{{ list_of_accounts | safe }}</div>

<p>Regards,</p>
<p>The Cloud Pathfinder Team</p>
</div>
</body>
<![endif]--><!--[if gte mso 9]><style>sup { font-size: 100% !important; }</style><![endif]--><!--[if gte mso 9]>
<xml>
<o:OfficeDocumentSettings>
<o:AllowPNG></o:AllowPNG>
<o:PixelsPerInch>96</o:PixelsPerInch>
</o:OfficeDocumentSettings>
</xml>
<![endif]-->
<style type="text/css">
#outlook a {
padding:0;
}
.es-button {
mso-style-priority:100!important;
text-decoration:none!important;
}
a[x-apple-data-detectors] {
color:inherit!important;
text-decoration:none!important;
font-size:inherit!important;
font-family:inherit!important;
font-weight:inherit!important;
line-height:inherit!important;
}
.es-desk-hidden {
display:none;
float:left;
overflow:hidden;
width:0;
max-height:0;
line-height:0;
mso-hide:all;
}
@media only screen and (max-width:600px) {p, ul li, ol li, a { line-height:150%!important } h1, h2, h3, h1 a, h2 a, h3 a { line-height:120%!important } h1 { font-size:30px!important; text-align:left } h2 { font-size:24px!important; text-align:left } h3 { font-size:20px!important; text-align:left } .es-header-body h1 a, .es-content-body h1 a, .es-footer-body h1 a { font-size:30px!important; text-align:left } .es-header-body h2 a, .es-content-body h2 a, .es-footer-body h2 a { font-size:24px!important; text-align:left } .es-header-body h3 a, .es-content-body h3 a, .es-footer-body h3 a { font-size:20px!important; text-align:left } .es-menu td a { font-size:14px!important } .es-header-body p, .es-header-body ul li, .es-header-body ol li, .es-header-body a { font-size:14px!important } .es-content-body p, .es-content-body ul li, .es-content-body ol li, .es-content-body a { font-size:14px!important } .es-footer-body p, .es-footer-body ul li, .es-footer-body ol li, .es-footer-body a { font-size:14px!important } .es-infoblock p, .es-infoblock ul li, .es-infoblock ol li, .es-infoblock a { font-size:12px!important } *[class="gmail-fix"] { display:none!important } .es-m-txt-c, .es-m-txt-c h1, .es-m-txt-c h2, .es-m-txt-c h3 { text-align:center!important } .es-m-txt-r, .es-m-txt-r h1, .es-m-txt-r h2, .es-m-txt-r h3 { text-align:right!important } .es-m-txt-l, .es-m-txt-l h1, .es-m-txt-l h2, .es-m-txt-l h3 { text-align:left!important } .es-m-txt-r img, .es-m-txt-c img, .es-m-txt-l img { display:inline!important } .es-button-border { display:inline-block!important } a.es-button, button.es-button { font-size:18px!important; display:inline-block!important } .es-adaptive table, .es-left, .es-right { width:100%!important } .es-content table, .es-header table, .es-footer table, .es-content, .es-footer, .es-header { width:100%!important; max-width:600px!important } .es-adapt-td { display:block!important; width:100%!important } .adapt-img { width:100%!important; height:auto!important } .es-m-p0 { padding:0px!important } .es-m-p0r { padding-right:0px!important } .es-m-p0l { padding-left:0px!important } .es-m-p0t { padding-top:0px!important } .es-m-p0b { padding-bottom:0!important } .es-m-p20b { padding-bottom:20px!important } .es-mobile-hidden, .es-hidden { display:none!important } tr.es-desk-hidden, td.es-desk-hidden, table.es-desk-hidden { width:auto!important; overflow:visible!important; float:none!important; max-height:inherit!important; line-height:inherit!important } tr.es-desk-hidden { display:table-row!important } table.es-desk-hidden { display:table!important } td.es-desk-menu-hidden { display:table-cell!important } .es-menu td { width:1%!important } table.es-table-not-adapt, .esd-block-html table { width:auto!important } table.es-social { display:inline-block!important } table.es-social td { display:inline-block!important } .es-desk-hidden { display:table-row!important; width:auto!important; overflow:visible!important; max-height:inherit!important } .h-auto { height:auto!important } }
</style>
</head>
<body style="width:100%;font-family:arial, 'helvetica neue', helvetica, sans-serif;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;padding:0;Margin:0">
<div class="es-wrapper-color" style="background-color:#EFEFEF"><!--[if gte mso 9]>
<v:background xmlns:v="urn:schemas-microsoft-com:vml" fill="t">
<v:fill type="tile" color="#efefef" origin="0.5, 0" position="0.5, 0"></v:fill>
</v:background>
<![endif]-->
<table class="es-wrapper" width="100%" cellspacing="0" cellpadding="0" style="mso-table-lspace:0pt;mso-table-rspace:0pt;border-collapse:collapse;border-spacing:0px;padding:0;Margin:0;width:100%;height:100%;background-repeat:repeat;background-position:center top;background-color:#EFEFEF">
<tr>
<td valign="top" style="padding:0;Margin:0">
<div data-section-wrapper="1">
<table class="es-header" cellspacing="0" cellpadding="0" align="center" style="mso-table-lspace:0pt;mso-table-rspace:0pt;border-collapse:collapse;border-spacing:0px;table-layout:fixed !important;width:100%;background-color:transparent;background-repeat:repeat;background-position:center top">
<tr>
<td align="center" bgcolor="#ffffff" style="padding:0;Margin:0;background-color:#ffffff">
<table data-section="1" class="es-header-body" cellspacing="0" cellpadding="0" bgcolor="#ffffff" align="center" style="mso-table-lspace:0pt;mso-table-rspace:0pt;border-collapse:collapse;border-spacing:0px;background-color:#ffffff;width:600px">
<tr>
<td align="left" style="padding:0;Margin:0;padding-top:20px;padding-left:20px;padding-right:20px">
<table cellspacing="0" cellpadding="0" width="100%" style="mso-table-lspace:0pt;mso-table-rspace:0pt;border-collapse:collapse;border-spacing:0px">
<tr>
<td data-slot-container="1" class="es-m-p0r" valign="top" align="center" style="padding:0;Margin:0;width:560px">
<div data-slot="text">
<table width="100%" cellspacing="0" cellpadding="0" role="presentation" style="mso-table-lspace:0pt;mso-table-rspace:0pt;border-collapse:collapse;border-spacing:0px">
<tr>
<td align="center" style="padding:0;Margin:0;padding-top:15px;font-size:0px"><img class="adapt-img" src="https://qlwyog.stripocdn.email/content/guids/CABINET_171a5188d195200fca35bb3ba3b1fe4533a7d3b2bd185dad59c6bbc7bcb7f186/images/devexchangelogo.png" alt style="display:block;border:0;outline:none;text-decoration:none;-ms-interpolation-mode:bicubic" height="40"></td>
</tr>
</table>
</div></td>
</tr>
</table></td>
</tr>
<tr>
<td align="left" style="padding:0;Margin:0;padding-left:20px;padding-right:20px">
<table cellpadding="0" cellspacing="0" width="100%" style="mso-table-lspace:0pt;mso-table-rspace:0pt;border-collapse:collapse;border-spacing:0px">
<tr>
<td data-slot-container="1" align="center" valign="top" style="padding:0;Margin:0;width:560px">
<div data-slot="text">
<table cellpadding="0" cellspacing="0" width="100%" role="presentation" style="mso-table-lspace:0pt;mso-table-rspace:0pt;border-collapse:collapse;border-spacing:0px">
<tr>
<td align="center" style="padding:0;Margin:0;padding-top:10px"><p style="Margin:0;-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;font-family:arial, 'helvetica neue', helvetica, sans-serif;line-height:42px;color:#234075;font-size:28px"><strong>Cloud Pathfinder Team Billing</strong></p></td>
</tr>
</table></div></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
</div>
<div data-section-wrapper="1">
<table class="es-content" cellspacing="0" cellpadding="0" align="center" style="mso-table-lspace:0pt;mso-table-rspace:0pt;border-collapse:collapse;border-spacing:0px;table-layout:fixed !important;width:100%">
<tr>
<td align="center" bgcolor="#ffffff" style="padding:0;Margin:0;background-color:#ffffff">
<table data-section="1" class="es-content-body" cellspacing="0" cellpadding="0" bgcolor="#ffffff" align="center" style="mso-table-lspace:0pt;mso-table-rspace:0pt;border-collapse:collapse;border-spacing:0px;background-color:#FFFFFF;width:600px">
<tr>
<td align="left" style="Margin:0;padding-left:10px;padding-right:10px;padding-top:30px;padding-bottom:30px">
<table width="100%" cellspacing="0" cellpadding="0" style="mso-table-lspace:0pt;mso-table-rspace:0pt;border-collapse:collapse;border-spacing:0px">
<tr>
<td data-slot-container="1" valign="top" align="center" style="padding:0;Margin:0;width:580px">
<div data-slot="text">
<table width="100%" cellspacing="0" cellpadding="0" role="presentation" style="mso-table-lspace:0pt;mso-table-rspace:0pt;border-collapse:collapse;border-spacing:0px">
<tr>
<td align="left" style="padding:0;Margin:0"><p style="Margin:0;-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;font-family:arial, 'helvetica neue', helvetica, sans-serif;line-height:21px;color:#333333;font-size:14px"><!doctype html>
<html lang="en">
<head>
<title>Cloud Pathfinder Team Billing Report</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
color: #333;
}
.content {
padding: 20px;
}
h2, h3 {
color: #444;
}
p {
line-height: 1.5;
}
.highlight {
color: #0080ff;
}
</style>
</head>
<body>
<div class="content">
<h2>Hello {{billing_group_email}},</h2>

<p>Please find attached your billing report for the period <span class="highlight">{{ start_date.strftime('%Y-%m-%d') }}</span> to <span class="highlight">{{ end_date.strftime('%Y-%m-%d') }}</span>, Starting at $0 CAD on <span class="highlight">{{ start_date.strftime('%Y-%m-%d') }}</span> to $<span class="highlight">{{billing_group_total}}</span> on <span class="highlight">{{ end_date.strftime('%Y-%m-%d') }}</span>.</p>

<h3>Total Charges: ${{billing_group_total}} CAD</h3>

<p>Note: Total charges also include the baseline costs for running the Secure Environment Accelerator guardrail and logging services within each account. You will see service charges from CloudTrail, CloudWatch, Systems Manager, Secrets Manager, S3, Simple Queue Service, Simple Notification Service, AWS Config, Elastic Load Balancing, GuardDuty, Key Management Service, Lambda, Macie, Security Hub, NAT gateway.</p>

<h2>Projects:</h2>
<div style="white-space: pre-line;">{{ list_of_accounts | safe }}</div>

<p>Regards,</p>
<p>The Cloud Pathfinder Team</p>
</div>
</body>
</html>
</table>
</div></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
</div>
<div data-section-wrapper="1">
<table class="es-footer" cellspacing="0" cellpadding="0" align="center" style="mso-table-lspace:0pt;mso-table-rspace:0pt;border-collapse:collapse;border-spacing:0px;table-layout:fixed !important;width:100%;background-color:transparent;background-repeat:repeat;background-position:center top">
<tr>
<td align="center" bgcolor="#ffffff" style="padding:0;Margin:0;background-color:#ffffff">
<table data-section="1" class="es-footer-body" cellspacing="0" cellpadding="0" bgcolor="#ffffff" align="center" style="mso-table-lspace:0pt;mso-table-rspace:0pt;border-collapse:collapse;border-spacing:0px;background-color:#FFFFFF;width:600px">
<tr>
<td align="left" style="Margin:0;padding-top:20px;padding-bottom:20px;padding-left:20px;padding-right:20px">
<table cellspacing="0" cellpadding="0" width="100%" style="mso-table-lspace:0pt;mso-table-rspace:0pt;border-collapse:collapse;border-spacing:0px">
<tr>
<td data-slot-container="1" align="left" style="padding:0;Margin:0;width:560px">
<div data-slot="text">
<table width="100%" cellspacing="0" cellpadding="0" role="presentation" style="mso-table-lspace:0pt;mso-table-rspace:0pt;border-collapse:collapse;border-spacing:0px">
<tr>

</tr>
<tr>
<td align="center" style="padding:0;Margin:0;font-size:0px"><img class="adapt-img" src="https://qlwyog.stripocdn.email/content/guids/CABINET_171a5188d195200fca35bb3ba3b1fe4533a7d3b2bd185dad59c6bbc7bcb7f186/images/footerimage.png" alt style="display:block;border:0;outline:none;text-decoration:none;-ms-interpolation-mode:bicubic" width="360"></td>
</tr>
</table>
</div></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
</div></td>
</tr>
</table>
</div>
</body>
</html>