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

CNNO-2264: Add status filter #1

Open
wants to merge 1 commit 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
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "microsoft_reports"
version = "1.5.3"
version = "1.5.4"
description = "Microsoft Reports"
authors = ["Cloublue"]
license = "Apache Software License 2.0"
Expand Down
25 changes: 25 additions & 0 deletions reports.json
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,31 @@
"description": "Provide the time period to create the report",
"required": true
},
{
"id": "status",
"type": "checkbox",
"name": "Subscription status",
"required": false,
"description": "Select the status of subscriptions to include in report",
"choices": [
{
"value": "active",
"label": "Active"
},
{
"value": "suspended",
"label": "Suspended"
},
{
"value": "terminated",
"label": "Terminated"
},
{
"value": "terminating",
"label": "Terminating"
}
]
},
{
"id": "connection_type",
"type": "checkbox",
Expand Down
1 change: 1 addition & 0 deletions reports/audit_tool/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ Please take into account the following:
You can configure the report according to the following:
- List of products to be selected (Only one can be selected, else the report will fail)
- Request creation date range (The range must be less than 2 months, anything else will fail the report)
- List of statuses of subscriptions (active, suspended, terminated, terminating. default all)
- List of transaction types (test, production. Only one can be selected, else the report will fail)
- List of marketplaces (Only one can be selected, else the report will fail)
7 changes: 6 additions & 1 deletion reports/audit_tool/entrypoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,12 @@ def obtain_url_for_service(client):

def _get_request_list(client, parameters):
query = R()
query &= R().status.eq('active')
all_statuses = ['active', 'suspended', 'terminated', 'terminating']

if parameters.get('status') and parameters['status']['all'] is False and parameters['status']['choices']:
query &= R().status.oneof(parameters['status']['choices'])
else:
query &= R().status.oneof(all_statuses)

if parameters.get('product') and parameters['product']['all'] is False:
query &= R().product.id.oneof(parameters['product']['choices'])
Expand Down
2 changes: 1 addition & 1 deletion tests/test_microsoft_reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ def mock_get_customer_susbcriptions_from_service(*args, **kwargs):
value=installation_list),
response_factory(count=3),
response_factory(
query='and(eq(status,active),'
query='and(in(status,(active,suspended,terminated,terminating)),'
'in(product.id,(PRD-183-233-565)),'
'eq(connection.type,test),'
'eq(marketplace.id,MP-123),'
Expand Down