Skip to content
This repository has been archived by the owner on Dec 5, 2024. It is now read-only.

New report for TS vendors #5

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
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
310 changes: 6 additions & 304 deletions reports.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
"language":"python",
"reports":[
{
"name":"IM all Transactions report",
"readme_file":"reports/all_transactions/readme.md",
"template":"reports/all_transactions/template.xlsx",
"name":"TS Subscriptions",
"readme_file":"reports/TS_products/Readme.md",
"template":"reports/TS_products/template.xlsx",
"start_row":2,
"start_col":1,
"entrypoint":"reports.all_transactions.entrypoint.generate",
"entrypoint":"reports.TS_products.entrypoint.generate",
"audience":[
"provider"
],
Expand All @@ -22,313 +22,15 @@
"name":"Report period",
"description":"Provide the time period to create the report",
"required":true
}
]
},
{
"name":"IM all Microsoft Transactions report",
"readme_file":"reports/ms_products/readme.md",
"report_spec":"2",
"renderers":[
{
"id":"xlsx",
"type":"xlsx",
"default":false,
"description":"Export data in Microsoft Excel 2020 format.",
"template":"reports/ms_products/template.xlsx",
"args":{
"start_row":2,
"start_col":1
}
},
{
"id":"json",
"type":"json",
"default":false,
"description":"Export data as JSON"
},
{
"id":"csv",
"type":"csv",
"default":true,
"description":"Export data as CSV"
}
],
"entrypoint":"reports.ms_products.entrypoint.generate",
"audience":[
"provider"
],
"parameters":[
{
"id":"date",
"type":"date_range",
"name":"Report period",
"description":"Provide the time period to create the report",
"required":true
}
]
},
{
"name":"Billing requests report for syndication partners",
"readme_file":"reports/billing_requests/Readme.md",
"template":"reports/billing_requests/template.xlsx",
"start_row":2,
"start_col":1,
"entrypoint":"reports.billing_requests.entrypoint.generate",
"audience":[
"provider"
],
"report_spec":"1",
"parameters":[
{
"id":"date",
"type":"date_range",
"name":"Report period",
"description":"Provide the time period to create the report",
"required":true
},
{
"id":"product",
"type":"product",
"name":"Product list",
"required":true,
"description":"Select the products you want to include in report"
}
]
},
{
"name":"Billing requests report for syndication partners at line item level",
"readme_file":"reports/billing_requests_line_item/Readme.md",
"template":"reports/billing_requests_line_item/template.xlsx",
"start_row":2,
"start_col":1,
"entrypoint":"reports.billing_requests_line_item.entrypoint.generate",
"audience":[
"provider",
"vendor"
],
"report_spec":"1",
"parameters":[
{
"id":"date",
"type":"date_range",
"name":"Report period",
"description":"Provide the time period to create the report",
"required":true
},
{
"id":"product",
"type":"product",
"name":"Product list",
"required":true,
"description":"Select the products you want to include in report"
}
]
},
{
"name":"AWS Assets report",
"readme_file":"reports/aws_products/Readme.md",
"template":"reports/aws_products/template.xlsx",
"start_row":2,
"start_col":1,
"entrypoint":"reports.aws_products.entrypoint.generate",
"audience":[
"provider"
],
"report_spec":"1",
"parameters":[
{
"id":"date",
"type":"date_range",
"name":"Assets range",
"description":"Provide the time range of assets creation",
"required":true
},
{
"id":"products",
"type":"product",
"name":"Product list",
"required":true,
"description":"Select the products that represents AWS, ALL option is not valid"
}
]
},
{
"name":"SonicWall Subscriptions list report",
"readme_file":"reports/sonicwall_subscriptions/Readme.md",
"entrypoint":"reports.sonicwall_subscriptions.entrypoint.generate",
"audience":[
"provider",
"vendor"
],
"report_spec":"2",
"renderers":[
{
"id":"xlsx",
"type":"xlsx",
"default":true,
"description":"Export data in Microsoft Excel 2020 format.",
"template":"reports/sonicwall_subscriptions/templates/xlsx/template.xlsx",
"args":{
"start_row":2,
"start_col":1
}
},
{
"id":"json",
"type":"json",
"default":false,
"description":"Export data as JSON"
},
{
"id":"csv",
"type":"csv",
"default":false,
"description":"Export data as CSV"
"description":"Select the products that represents TS, ALL option is not valid"
}
],
"parameters":[
{
"id":"date",
"type":"date_range",
"name":"Subscription Creation",
"description":"Optional: in case that is desired, report can be limited to subscriptions created in the selected period of time"
},
{
"id":"product",
"type":"product",
"name":"Product list",
"required":true,
"description":"Select the products that represents SonicWall product that you want to include in report"
},
{
"id":"mkp",
"type":"marketplace",
"name":"Marketplaces",
"required":true,
"description":"Select the marketplaces you want to include in report"
},
{
"id":"period",
"type":"checkbox",
"name":"Billing Periods",
"required":true,
"description":"Specify the billing periods to include in report",
"choices":[
{
"value":"monthly",
"label":"1 Month"
},
{
"value":"yearly",
"label":"1 Year"
},
{
"value":"years_2",
"label":"2 Years"
},
{
"value":"years_3",
"label":"3 Years"
},
{
"value":"years_4",
"label":"4 Years"
},
{
"value":"years_5",
"label":"5 Years"
}
]
},
{
"id":"status",
"type":"checkbox",
"name":"Subscription status",
"required":true,
"description":"Specify the subscription status to include in report",
"choices":[
{
"value":"active",
"label":"Active"
},
{
"value":"processing",
"label":"Processing"
},
{
"value":"suspended",
"label":"Suspended"
},
{
"value":"terminating",
"label":"Terminating"
},
{
"value":"terminated",
"label":"Terminated"
}
]
}
]
},
{
"name":"Open Usage Files report",
"readme_file":"reports/usage_files_status/Readme.md",
"entrypoint":"reports.usage_files_status.entrypoint.generate",
"audience":[
"provider",
"vendor"
],
"report_spec":"2",
"renderers":[
{
"id":"xlsx",
"type":"xlsx",
"default":true,
"description":"Export data in Microsoft Excel 2020 format.",
"template":"reports/usage_files_status/templates/xlsx/template.xlsx",
"args":{
"start_row":2,
"start_col":1
}
},
{
"id":"json",
"type":"json",
"default":false,
"description":"Export data as JSON"
},
{
"id":"csv",
"type":"csv",
"default":false,
"description":"Export data as CSV"
}
],
"parameters":[

]
},
{
"name":"Syndication products for Dragon tool",
"readme_file":"reports/im_syndication_products_availability/Readme.md",
"entrypoint":"reports.im_syndication_products_availability.entrypoint.generate",
"audience":[
"provider"
],
"report_spec":"2",
"renderers":[
{
"id":"json",
"type":"json",
"default":true,
"description":"Export data as JSON"
}
],
"parameters":[

]
}
]
}
}
3 changes: 3 additions & 0 deletions reports/TS_products/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# TS Report

This report provides a list of assets for TS product and generates a report with specific information
33 changes: 33 additions & 0 deletions reports/TS_products/entrypoint.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
from connect.client import R
from reports.utils import (
convert_to_datetime,
get_asset_parameter,
get_value,
)




def generate(client, parameters, progress_callback):
subscriptions_rql = R()

if parameters.get("date"):
subscriptions_rql &= R().events.created.at.ge(parameters['date']['after'])
subscriptions_rql &= R().events.created.at.le(parameters['date']['before'])
subscriptions_rql &= R().product.id.oneof(parameters['products']['choices'])
subscriptions_rql &= R().status.ne('draft')
subscriptions = client.assets.filter(subscriptions_rql)
total_subscriptions = subscriptions.count()
progress = 0
for subscription in subscriptions:
yield (
subscription['id'],
subscription.get('external_id', "-"),
subscription['status'],
subscription['marketplace']['name'],
subscription['product']['id'],
convert_to_datetime(subscription['events']['created']['at']),
get_asset_parameter(subscription, "vendor_subscription_id")
)
progress += 1
progress_callback(progress, total_subscriptions)
Loading