qontract-reconcile 0.10.1rc801__py3-none-any.whl → 0.10.1rc803__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. {qontract_reconcile-0.10.1rc801.dist-info → qontract_reconcile-0.10.1rc803.dist-info}/METADATA +1 -1
  2. {qontract_reconcile-0.10.1rc801.dist-info → qontract_reconcile-0.10.1rc803.dist-info}/RECORD +25 -12
  3. reconcile/gql_definitions/cost_report/cost_namespaces.py +84 -0
  4. reconcile/statuspage/__init__.py +0 -0
  5. reconcile/statuspage/atlassian.py +425 -0
  6. reconcile/statuspage/integration.py +22 -0
  7. reconcile/statuspage/integrations/__init__.py +0 -0
  8. reconcile/statuspage/integrations/components.py +77 -0
  9. reconcile/statuspage/integrations/maintenances.py +73 -0
  10. reconcile/statuspage/page.py +114 -0
  11. reconcile/statuspage/state.py +47 -0
  12. reconcile/statuspage/status.py +97 -0
  13. reconcile/typed_queries/cost_report/cost_namespaces.py +40 -0
  14. tools/cli_commands/cost_report/{command.py → aws.py} +53 -75
  15. tools/cli_commands/cost_report/cost_management_api.py +28 -4
  16. tools/cli_commands/cost_report/model.py +7 -8
  17. tools/cli_commands/cost_report/openshift.py +179 -0
  18. tools/cli_commands/cost_report/response.py +25 -4
  19. tools/cli_commands/cost_report/util.py +59 -0
  20. tools/cli_commands/cost_report/view.py +121 -56
  21. tools/qontract_cli.py +10 -2
  22. tools/test/test_qontract_cli.py +32 -6
  23. {qontract_reconcile-0.10.1rc801.dist-info → qontract_reconcile-0.10.1rc803.dist-info}/WHEEL +0 -0
  24. {qontract_reconcile-0.10.1rc801.dist-info → qontract_reconcile-0.10.1rc803.dist-info}/entry_points.txt +0 -0
  25. {qontract_reconcile-0.10.1rc801.dist-info → qontract_reconcile-0.10.1rc803.dist-info}/top_level.txt +0 -0
tools/qontract_cli.py CHANGED
@@ -136,7 +136,8 @@ from reconcile.utils.secret_reader import (
136
136
  from reconcile.utils.semver_helper import parse_semver
137
137
  from reconcile.utils.state import init_state
138
138
  from reconcile.utils.terraform_client import TerraformClient as Terraform
139
- from tools.cli_commands.cost_report.command import CostReportCommand
139
+ from tools.cli_commands.cost_report.aws import AwsCostReportCommand
140
+ from tools.cli_commands.cost_report.openshift import OpenShiftCostReportCommand
140
141
  from tools.cli_commands.gpg_encrypt import (
141
142
  GPGEncryptCommand,
142
143
  GPGEncryptCommandData,
@@ -2538,7 +2539,14 @@ def alerts(ctx, file_path):
2538
2539
  @get.command()
2539
2540
  @click.pass_context
2540
2541
  def aws_cost_report(ctx):
2541
- command = CostReportCommand.create()
2542
+ command = AwsCostReportCommand.create()
2543
+ print(command.execute())
2544
+
2545
+
2546
+ @get.command()
2547
+ @click.pass_context
2548
+ def openshift_cost_report(ctx):
2549
+ command = OpenShiftCostReportCommand.create()
2542
2550
  print(command.execute())
2543
2551
 
2544
2552
 
@@ -128,12 +128,14 @@ def test_early_exit_cache_delete(env_vars, mock_queries, mock_early_exit_cache):
128
128
 
129
129
 
130
130
  @pytest.fixture
131
- def mock_cost_report_command(mocker):
132
- return mocker.patch("tools.qontract_cli.CostReportCommand", autospec=True)
131
+ def mock_aws_cost_report_command(mocker):
132
+ return mocker.patch("tools.qontract_cli.AwsCostReportCommand", autospec=True)
133
133
 
134
134
 
135
- def test_get_aws_cost_report(env_vars, mock_queries, mock_cost_report_command):
136
- mock_cost_report_command.create.return_value.execute.return_value = "some report"
135
+ def test_get_aws_cost_report(env_vars, mock_queries, mock_aws_cost_report_command):
136
+ mock_aws_cost_report_command.create.return_value.execute.return_value = (
137
+ "some report"
138
+ )
137
139
  runner = CliRunner()
138
140
  result = runner.invoke(
139
141
  qontract_cli.get,
@@ -143,5 +145,29 @@ def test_get_aws_cost_report(env_vars, mock_queries, mock_cost_report_command):
143
145
 
144
146
  assert result.exit_code == 0
145
147
  assert result.output == "some report\n"
146
- mock_cost_report_command.create.assert_called_once_with()
147
- mock_cost_report_command.create.return_value.execute.assert_called_once_with()
148
+ mock_aws_cost_report_command.create.assert_called_once_with()
149
+ mock_aws_cost_report_command.create.return_value.execute.assert_called_once_with()
150
+
151
+
152
+ @pytest.fixture
153
+ def mock_openshift_cost_report_command(mocker):
154
+ return mocker.patch("tools.qontract_cli.OpenShiftCostReportCommand", autospec=True)
155
+
156
+
157
+ def test_get_openshift_cost_report(
158
+ env_vars, mock_queries, mock_openshift_cost_report_command
159
+ ):
160
+ mock_openshift_cost_report_command.create.return_value.execute.return_value = (
161
+ "some report"
162
+ )
163
+ runner = CliRunner()
164
+ result = runner.invoke(
165
+ qontract_cli.get,
166
+ "openshift-cost-report",
167
+ obj={},
168
+ )
169
+
170
+ assert result.exit_code == 0
171
+ assert result.output == "some report\n"
172
+ mock_openshift_cost_report_command.create.assert_called_once_with()
173
+ mock_openshift_cost_report_command.create.return_value.execute.assert_called_once_with()