zabel-elements 1.47.2__tar.gz → 1.48.0__tar.gz

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 (48) hide show
  1. {zabel_elements-1.47.2/zabel_elements.egg-info → zabel_elements-1.48.0}/PKG-INFO +1 -1
  2. {zabel_elements-1.47.2 → zabel_elements-1.48.0}/pyproject.toml +1 -1
  3. {zabel_elements-1.47.2 → zabel_elements-1.48.0}/zabel/elements/clients/base/confluence.py +36 -0
  4. {zabel_elements-1.47.2 → zabel_elements-1.48.0}/zabel/elements/clients/base/github.py +0 -2
  5. {zabel_elements-1.47.2 → zabel_elements-1.48.0}/zabel/elements/clients/base/githubcloud.py +324 -5
  6. {zabel_elements-1.47.2 → zabel_elements-1.48.0/zabel_elements.egg-info}/PKG-INFO +1 -1
  7. {zabel_elements-1.47.2 → zabel_elements-1.48.0}/LICENSE.txt +0 -0
  8. {zabel_elements-1.47.2 → zabel_elements-1.48.0}/README.md +0 -0
  9. {zabel_elements-1.47.2 → zabel_elements-1.48.0}/setup.cfg +0 -0
  10. {zabel_elements-1.47.2 → zabel_elements-1.48.0}/zabel/elements/clients/__init__.py +0 -0
  11. {zabel_elements-1.47.2 → zabel_elements-1.48.0}/zabel/elements/clients/actito.py +0 -0
  12. {zabel_elements-1.47.2 → zabel_elements-1.48.0}/zabel/elements/clients/artifactory.py +0 -0
  13. {zabel_elements-1.47.2 → zabel_elements-1.48.0}/zabel/elements/clients/atlassian.py +0 -0
  14. {zabel_elements-1.47.2 → zabel_elements-1.48.0}/zabel/elements/clients/base/__init__.py +0 -0
  15. {zabel_elements-1.47.2 → zabel_elements-1.48.0}/zabel/elements/clients/base/actito.py +0 -0
  16. {zabel_elements-1.47.2 → zabel_elements-1.48.0}/zabel/elements/clients/base/artifactory.py +0 -0
  17. {zabel_elements-1.47.2 → zabel_elements-1.48.0}/zabel/elements/clients/base/atlassian.py +0 -0
  18. {zabel_elements-1.47.2 → zabel_elements-1.48.0}/zabel/elements/clients/base/confluencecloud.py +0 -0
  19. {zabel_elements-1.47.2 → zabel_elements-1.48.0}/zabel/elements/clients/base/gitlab.py +0 -0
  20. {zabel_elements-1.47.2 → zabel_elements-1.48.0}/zabel/elements/clients/base/jenkins.py +0 -0
  21. {zabel_elements-1.47.2 → zabel_elements-1.48.0}/zabel/elements/clients/base/jira.py +0 -0
  22. {zabel_elements-1.47.2 → zabel_elements-1.48.0}/zabel/elements/clients/base/jiracloud.py +0 -0
  23. {zabel_elements-1.47.2 → zabel_elements-1.48.0}/zabel/elements/clients/base/kubernetes.py +0 -0
  24. {zabel_elements-1.47.2 → zabel_elements-1.48.0}/zabel/elements/clients/base/okta.py +0 -0
  25. {zabel_elements-1.47.2 → zabel_elements-1.48.0}/zabel/elements/clients/base/sonarqube.py +0 -0
  26. {zabel_elements-1.47.2 → zabel_elements-1.48.0}/zabel/elements/clients/base/sonatypenexus.py +0 -0
  27. {zabel_elements-1.47.2 → zabel_elements-1.48.0}/zabel/elements/clients/base/squashtm.py +0 -0
  28. {zabel_elements-1.47.2 → zabel_elements-1.48.0}/zabel/elements/clients/confluence.py +0 -0
  29. {zabel_elements-1.47.2 → zabel_elements-1.48.0}/zabel/elements/clients/confluencecloud.py +0 -0
  30. {zabel_elements-1.47.2 → zabel_elements-1.48.0}/zabel/elements/clients/github.py +0 -0
  31. {zabel_elements-1.47.2 → zabel_elements-1.48.0}/zabel/elements/clients/githubcloud.py +0 -0
  32. {zabel_elements-1.47.2 → zabel_elements-1.48.0}/zabel/elements/clients/gitlab.py +0 -0
  33. {zabel_elements-1.47.2 → zabel_elements-1.48.0}/zabel/elements/clients/jenkins.py +0 -0
  34. {zabel_elements-1.47.2 → zabel_elements-1.48.0}/zabel/elements/clients/jira.py +0 -0
  35. {zabel_elements-1.47.2 → zabel_elements-1.48.0}/zabel/elements/clients/jiracloud.py +0 -0
  36. {zabel_elements-1.47.2 → zabel_elements-1.48.0}/zabel/elements/clients/kubehelpers.py +0 -0
  37. {zabel_elements-1.47.2 → zabel_elements-1.48.0}/zabel/elements/clients/kubernetes.py +0 -0
  38. {zabel_elements-1.47.2 → zabel_elements-1.48.0}/zabel/elements/clients/okta.py +0 -0
  39. {zabel_elements-1.47.2 → zabel_elements-1.48.0}/zabel/elements/clients/sonarqube.py +0 -0
  40. {zabel_elements-1.47.2 → zabel_elements-1.48.0}/zabel/elements/clients/sonatypenexus.py +0 -0
  41. {zabel_elements-1.47.2 → zabel_elements-1.48.0}/zabel/elements/clients/squashtm.py +0 -0
  42. {zabel_elements-1.47.2 → zabel_elements-1.48.0}/zabel/elements/images/__init__.py +0 -0
  43. {zabel_elements-1.47.2 → zabel_elements-1.48.0}/zabel/elements/images/managedserviceapp.py +0 -0
  44. {zabel_elements-1.47.2 → zabel_elements-1.48.0}/zabel/elements/images/utilityapp.py +0 -0
  45. {zabel_elements-1.47.2 → zabel_elements-1.48.0}/zabel_elements.egg-info/SOURCES.txt +0 -0
  46. {zabel_elements-1.47.2 → zabel_elements-1.48.0}/zabel_elements.egg-info/dependency_links.txt +0 -0
  47. {zabel_elements-1.47.2 → zabel_elements-1.48.0}/zabel_elements.egg-info/requires.txt +0 -0
  48. {zabel_elements-1.47.2 → zabel_elements-1.48.0}/zabel_elements.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: zabel-elements
3
- Version: 1.47.2
3
+ Version: 1.48.0
4
4
  Summary: TThe Zabel default clients and images
5
5
  Author-email: Martin Lafaix <martin.lafaix@external.engie.com>
6
6
  License-Expression: EPL-2.0
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "zabel-elements"
7
- version = "1.47.2"
7
+ version = "1.48.0"
8
8
  description = "TThe Zabel default clients and images"
9
9
  readme = "README.md"
10
10
  license = "EPL-2.0"
@@ -957,6 +957,8 @@ class Confluence:
957
957
  # list_space_permissionsets*
958
958
  # create_space
959
959
  # delete_space
960
+ # archive_space
961
+ # restore_space
960
962
  # add_space_label*
961
963
  # remove_space_permission*
962
964
  # add_space_permissions*
@@ -1262,6 +1264,40 @@ class Confluence:
1262
1264
  response = self._delete(f'/space/{space_key}')
1263
1265
  return response
1264
1266
 
1267
+ @api_call
1268
+ def archive_space(self, space_key: str) -> bool:
1269
+ """Archive a space.
1270
+
1271
+ # Required parameters
1272
+
1273
+ - space_key: a non-empty string
1274
+
1275
+ # Returned value
1276
+
1277
+ A boolean, True if successful
1278
+ """
1279
+ ensure_nonemptystring('space_key')
1280
+
1281
+ response = self._put(f'/space/{space_key}/archive')
1282
+ return response.status_code == 204
1283
+
1284
+ @api_call
1285
+ def restore_space(self, space_key: str) -> bool:
1286
+ """Restore a space.
1287
+
1288
+ # Required parameters
1289
+
1290
+ - space_key: a non-empty string
1291
+
1292
+ # Returned value
1293
+
1294
+ A boolean, True if successful
1295
+ """
1296
+ ensure_nonemptystring('space_key')
1297
+
1298
+ response = self._put(f'/space/{space_key}/restore')
1299
+ return response.status_code == 204
1300
+
1265
1301
  @api_call
1266
1302
  def add_space_label(self, space_key: str, label: str) -> bool:
1267
1303
  """Add label to space.
@@ -4582,12 +4582,10 @@ class GitHub:
4582
4582
 
4583
4583
  remaining = response.headers.get('X-RateLimit-Remaining')
4584
4584
  retry_after = response.headers.get('Retry-After')
4585
- reset = response.headers.get('X-RateLimit-Reset')
4586
4585
  if (
4587
4586
  response.status_code == 403
4588
4587
  and remaining != '0'
4589
4588
  and retry_after is None
4590
- and reset is None
4591
4589
  ):
4592
4590
  return response
4593
4591
 
@@ -2190,7 +2190,10 @@ class GitHubCloud:
2190
2190
  - `report_id`: a string, the ID of the created report export.
2191
2191
  """
2192
2192
  ensure_nonemptystring('enterprise_name')
2193
- ensure_in('report_type', ('detailed', 'summarized', 'premium_request'))
2193
+ ensure_in(
2194
+ 'report_type',
2195
+ ('detailed', 'summarized', 'premium_request', 'ai_credit'),
2196
+ )
2194
2197
  ensure_nonemptystring('start_date')
2195
2198
  ensure_nonemptystring('end_date')
2196
2199
  ensure_instance('send_email', bool)
@@ -2447,6 +2450,316 @@ class GitHubCloud:
2447
2450
  response = self._post('graphql', json=json_data)
2448
2451
  return response.json()
2449
2452
 
2453
+ ####################################################################
2454
+ # GitHubCloud Budget
2455
+ #
2456
+ # list_budgets
2457
+ # create_budget
2458
+ # get_budget
2459
+ # update_budget
2460
+ # delete_budget
2461
+
2462
+ @api_call
2463
+ @require_pat_auth
2464
+ def list_budgets(self, enterprise_name: str) -> List[Dict[str, Any]]:
2465
+ """List all budgets for an enterprise.
2466
+
2467
+ !!! important
2468
+ This endpoint does not work with GitHub App user
2469
+ access tokens, GitHub App installation access
2470
+ tokens, or fine-grained personal access tokens.
2471
+
2472
+ # Required parameters
2473
+
2474
+ - enterprise_name: a non-empty string
2475
+
2476
+ # Returned value
2477
+
2478
+ A list of _budgets_. Each budget is a dictionary with the
2479
+ following entries:
2480
+
2481
+ - id: a string
2482
+ - budget_type: a string
2483
+ - budget_product_sku: a string
2484
+ - budget_scope: a string
2485
+ - budget_amount: an integer
2486
+ - prevent_further_usage: a boolean
2487
+ - budget_entity_name: a string
2488
+ - budget_alerting: a dictionary with the following entries:
2489
+
2490
+ * will_alert: a boolean
2491
+ * alert_recipients: a list of strings
2492
+
2493
+ - consumed_amount: a float
2494
+ - user: a string
2495
+ """
2496
+ ensure_nonemptystring('enterprise_name')
2497
+
2498
+ params = {'page': 1}
2499
+ session = self._get_session()
2500
+ api_url = join_url(
2501
+ self.url, f'enterprises/{enterprise_name}/settings/billing/budgets'
2502
+ )
2503
+ collected: List[Dict[str, Any]] = []
2504
+
2505
+ while True:
2506
+ response = session.get(api_url, params=params)
2507
+ if response.status_code // 100 != 2:
2508
+ raise ApiError(response.text)
2509
+ try:
2510
+ response_data = response.json()
2511
+ except Exception as exception:
2512
+ raise ApiError from exception
2513
+ if isinstance(response_data, dict):
2514
+ collected += response_data.get('budgets', [])
2515
+ has_next = response_data.get('has_next_page', False)
2516
+ elif isinstance(response_data, list):
2517
+ collected += response_data
2518
+ has_next = False
2519
+ else:
2520
+ raise ApiError(
2521
+ f'Unexpected response type: {type(response_data)!r}'
2522
+ )
2523
+ if not has_next:
2524
+ break
2525
+ params['page'] += 1
2526
+
2527
+ return collected
2528
+
2529
+ @api_call
2530
+ @require_pat_auth
2531
+ def create_budget(
2532
+ self,
2533
+ enterprise_name: str,
2534
+ budget_amount: int,
2535
+ prevent_further_usage: bool,
2536
+ budget_alerting: Dict[str, Any],
2537
+ budget_scope: str,
2538
+ budget_type: str,
2539
+ budget_entity_name: Optional[str] = None,
2540
+ budget_product_sku: Optional[str] = None,
2541
+ user: Optional[str] = None,
2542
+ ) -> Dict[str, Any]:
2543
+ """Create a budget for an enterprise.
2544
+
2545
+ !!! important
2546
+ This endpoint does not work with GitHub App user
2547
+ access tokens, GitHub App installation access
2548
+ tokens, or fine-grained personal access tokens.
2549
+
2550
+ # Required parameters
2551
+
2552
+ - enterprise_name: a non-empty string
2553
+ - budget_amount: an integer, the budget amount
2554
+ - prevent_further_usage: a boolean, whether to prevent further
2555
+ usage when the budget is exceeded
2556
+ - budget_alerting: a dictionary with alerting configuration
2557
+ - budget_scope: a non-empty string, one of `'enterprise'`,
2558
+ `'organization'`, `'repository'`, `'cost_center'`, or `'user'`
2559
+ - budget_type: a non-empty string, the type of budget
2560
+
2561
+ # Optional parameters
2562
+
2563
+ - budget_entity_name: a string or None (None by default), the
2564
+ name of the entity the budget applies to
2565
+ - budget_product_sku: a string or None (None by default), the
2566
+ product SKU the budget applies to
2567
+ - user: a string or None (None by default), the user the budget
2568
+ applies to
2569
+
2570
+ # Returned value
2571
+
2572
+ A _budget_. A budget is a dictionary.
2573
+ """
2574
+ ensure_nonemptystring('enterprise_name')
2575
+ ensure_instance('budget_amount', int)
2576
+ ensure_instance('prevent_further_usage', bool)
2577
+ ensure_instance('budget_alerting', dict)
2578
+ ensure_in(
2579
+ 'budget_scope',
2580
+ (
2581
+ 'enterprise',
2582
+ 'organization',
2583
+ 'repository',
2584
+ 'cost_center',
2585
+ 'user',
2586
+ ),
2587
+ )
2588
+ ensure_nonemptystring('budget_type')
2589
+ ensure_noneorinstance('budget_entity_name', str)
2590
+ ensure_noneorinstance('budget_product_sku', str)
2591
+ ensure_noneorinstance('user', str)
2592
+
2593
+ data: Dict[str, Any] = {
2594
+ 'budget_amount': budget_amount,
2595
+ 'prevent_further_usage': prevent_further_usage,
2596
+ 'budget_alerting': budget_alerting,
2597
+ 'budget_scope': budget_scope,
2598
+ 'budget_type': budget_type,
2599
+ }
2600
+ add_if_specified(data, 'budget_entity_name', budget_entity_name)
2601
+ add_if_specified(data, 'budget_product_sku', budget_product_sku)
2602
+ add_if_specified(data, 'user', user)
2603
+ return self._post(
2604
+ f'enterprises/{enterprise_name}/settings/billing/budgets',
2605
+ json=data,
2606
+ )
2607
+
2608
+ @api_call
2609
+ @require_pat_auth
2610
+ def get_budget(
2611
+ self,
2612
+ enterprise_name: str,
2613
+ budget_id: str,
2614
+ ) -> Dict[str, Any]:
2615
+ """Get a budget for an enterprise.
2616
+
2617
+ !!! important
2618
+ This endpoint does not work with GitHub App user
2619
+ access tokens, GitHub App installation access
2620
+ tokens, or fine-grained personal access tokens.
2621
+
2622
+ # Required parameters
2623
+
2624
+ - enterprise_name: a non-empty string
2625
+ - budget_id: a non-empty string
2626
+
2627
+ # Returned value
2628
+
2629
+ A _budget_. A budget is a dictionary with the following entries:
2630
+
2631
+ - id: a string
2632
+ - budget_type: a string
2633
+ - budget_product_sku: a string
2634
+ - budget_scope: a string
2635
+ - budget_amount: an integer
2636
+ - prevent_further_usage: a boolean
2637
+ - budget_entity_name: a string
2638
+ - budget_alerting: a dictionary with the following entries:
2639
+
2640
+ * will_alert: a boolean
2641
+ * alert_recipients: a list of strings
2642
+
2643
+ - consumed_amount: a float
2644
+ - user: a string
2645
+ """
2646
+ ensure_nonemptystring('enterprise_name')
2647
+ ensure_nonemptystring('budget_id')
2648
+
2649
+ return self._get(
2650
+ f'enterprises/{enterprise_name}/settings/billing/budgets/{budget_id}'
2651
+ )
2652
+
2653
+ @api_call
2654
+ @require_pat_auth
2655
+ def update_budget(
2656
+ self,
2657
+ enterprise_name: str,
2658
+ budget_id: str,
2659
+ budget_amount: Optional[int] = None,
2660
+ prevent_further_usage: Optional[bool] = None,
2661
+ budget_alerting: Optional[Dict[str, Any]] = None,
2662
+ budget_scope: Optional[str] = None,
2663
+ budget_type: Optional[str] = None,
2664
+ budget_entity_name: Optional[str] = None,
2665
+ budget_product_sku: Optional[str] = None,
2666
+ ) -> Dict[str, Any]:
2667
+ """Update a budget for an enterprise.
2668
+
2669
+ !!! important
2670
+ This endpoint does not work with GitHub App user
2671
+ access tokens, GitHub App installation access
2672
+ tokens, or fine-grained personal access tokens.
2673
+
2674
+ # Required parameters
2675
+
2676
+ - enterprise_name: a non-empty string
2677
+ - budget_id: a non-empty string
2678
+
2679
+ # Optional parameters
2680
+
2681
+ - budget_amount: an integer or None (None by default)
2682
+ - prevent_further_usage: a boolean or None (None by default)
2683
+ - budget_alerting: a dictionary or None (None by default)
2684
+ - budget_scope: a string or None, one of `'enterprise'`,
2685
+ `'organization'`, `'repository'`, `'cost_center'`, or `'user'`
2686
+ (None by default)
2687
+ - budget_type: a string or None (None by default)
2688
+ - budget_entity_name: a string or None (None by default)
2689
+ - budget_product_sku: a string or None (None by default)
2690
+
2691
+ # Returned value
2692
+
2693
+ A _budget_. A budget is a dictionary.
2694
+ """
2695
+ ensure_nonemptystring('enterprise_name')
2696
+ ensure_nonemptystring('budget_id')
2697
+ ensure_noneorinstance('budget_amount', int)
2698
+ ensure_noneorinstance('prevent_further_usage', bool)
2699
+ ensure_noneorinstance('budget_alerting', dict)
2700
+ if budget_scope is not None:
2701
+ ensure_in(
2702
+ 'budget_scope',
2703
+ (
2704
+ 'enterprise',
2705
+ 'organization',
2706
+ 'repository',
2707
+ 'cost_center',
2708
+ 'user',
2709
+ ),
2710
+ )
2711
+ ensure_noneorinstance('budget_type', str)
2712
+ ensure_noneorinstance('budget_entity_name', str)
2713
+ ensure_noneorinstance('budget_product_sku', str)
2714
+
2715
+ data: Dict[str, Any] = {}
2716
+ add_if_specified(data, 'budget_amount', budget_amount)
2717
+ add_if_specified(data, 'prevent_further_usage', prevent_further_usage)
2718
+ add_if_specified(data, 'budget_alerting', budget_alerting)
2719
+ add_if_specified(data, 'budget_scope', budget_scope)
2720
+ add_if_specified(data, 'budget_type', budget_type)
2721
+ add_if_specified(data, 'budget_entity_name', budget_entity_name)
2722
+ add_if_specified(data, 'budget_product_sku', budget_product_sku)
2723
+
2724
+ return self._patch(
2725
+ f'enterprises/{enterprise_name}/settings/billing/budgets/{budget_id}',
2726
+ json=data,
2727
+ )
2728
+
2729
+ @api_call
2730
+ @require_pat_auth
2731
+ def delete_budget(
2732
+ self,
2733
+ enterprise_name: str,
2734
+ budget_id: str,
2735
+ ) -> bool:
2736
+ """Delete a budget for an enterprise.
2737
+
2738
+ !!! important
2739
+ This endpoint does not work with GitHub App user
2740
+ access tokens, GitHub App installation access
2741
+ tokens, or fine-grained personal access tokens.
2742
+
2743
+ # Required parameters
2744
+
2745
+ - enterprise_name: a non-empty string
2746
+ - budget_id: a non-empty string
2747
+
2748
+ # Returned value
2749
+
2750
+ A boolean. True if the budget was deleted.
2751
+ """
2752
+ ensure_nonemptystring('enterprise_name')
2753
+ ensure_nonemptystring('budget_id')
2754
+
2755
+ return (
2756
+ self._delete(
2757
+ f'enterprises/{enterprise_name}/settings/billing/budgets/{budget_id}'
2758
+ ).status_code
2759
+ // 100
2760
+ == 2
2761
+ )
2762
+
2450
2763
  ####################################################################
2451
2764
  # GitHub helpers
2452
2765
  #
@@ -2486,6 +2799,16 @@ class GitHubCloud:
2486
2799
  api_url = join_url(self.url, api)
2487
2800
  return self._request('put', api_url, json=json, headers=headers)
2488
2801
 
2802
+ def _patch(
2803
+ self,
2804
+ api: str,
2805
+ json: Optional[Mapping[str, Any]] = None,
2806
+ headers: Optional[Mapping[str, str]] = None,
2807
+ ) -> requests.Response:
2808
+ """Return GitHub API PATCH call results, as Response."""
2809
+ api_url = join_url(self.url, api)
2810
+ return self._request('patch', api_url, json=json, headers=headers)
2811
+
2489
2812
  def _delete(
2490
2813
  self,
2491
2814
  api: str,
@@ -2522,18 +2845,15 @@ class GitHubCloud:
2522
2845
 
2523
2846
  while self._max_retries < 0 or attempt <= self._max_retries:
2524
2847
  response = session.request(method=method, url=url, **kwargs)
2525
-
2526
2848
  if response.status_code not in (403, 429):
2527
2849
  return response
2528
2850
 
2529
2851
  remaining = response.headers.get('X-RateLimit-Remaining')
2530
2852
  retry_after = response.headers.get('Retry-After')
2531
- reset = response.headers.get('X-RateLimit-Reset')
2532
2853
  if (
2533
2854
  response.status_code == 403
2534
2855
  and remaining != '0'
2535
2856
  and retry_after is None
2536
- and reset is None
2537
2857
  ):
2538
2858
  return response
2539
2859
 
@@ -2596,7 +2916,6 @@ class GitHubCloud:
2596
2916
  )
2597
2917
  except Exception as exception:
2598
2918
  raise ApiError from exception
2599
-
2600
2919
  if 'next' not in response.links:
2601
2920
  break
2602
2921
  api_url = response.links['next']['url']
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: zabel-elements
3
- Version: 1.47.2
3
+ Version: 1.48.0
4
4
  Summary: TThe Zabel default clients and images
5
5
  Author-email: Martin Lafaix <martin.lafaix@external.engie.com>
6
6
  License-Expression: EPL-2.0