agilicus 1.240.1__py3-none-any.whl → 1.240.2__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -77,7 +77,7 @@ class ApiClient(object):
77
77
  self.default_headers[header_name] = header_value
78
78
  self.cookie = cookie
79
79
  # Set default User-Agent.
80
- self.user_agent = 'OpenAPI-Generator/1.240.1/python'
80
+ self.user_agent = 'OpenAPI-Generator/1.240.2/python'
81
81
 
82
82
  def __enter__(self):
83
83
  return self
@@ -387,7 +387,7 @@ class Configuration(object):
387
387
  "OS: {env}\n"\
388
388
  "Python Version: {pyversion}\n"\
389
389
  "Version of the API: 2024.02.06\n"\
390
- "SDK Package Version: 1.240.1".\
390
+ "SDK Package Version: 1.240.2".\
391
391
  format(env=sys.platform, pyversion=sys.version)
392
392
 
393
393
  def get_host_settings(self):
@@ -4,7 +4,7 @@ Agilicus is API-first. Modern software is controlled by other software, is open,
4
4
  The `agilicus_api` package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
5
5
 
6
6
  - API version: 2024.02.06
7
- - Package version: 1.240.1
7
+ - Package version: 1.240.2
8
8
  - Build package: org.openapitools.codegen.languages.PythonClientCodegen
9
9
  For more information, please visit [https://www.agilicus.com/api](https://www.agilicus.com/api)
10
10
 
agilicus/connectors.py CHANGED
@@ -3,6 +3,7 @@ from datetime import timedelta
3
3
  import agilicus
4
4
  from prettytable import PrettyTable
5
5
  from operator import attrgetter
6
+ from . import get_many_entries
6
7
 
7
8
  import agilicus_api.exceptions
8
9
  import dateutil.tz
@@ -63,19 +64,36 @@ def do_filter(ctx, no_down, connectors, not_version=None, sort_by=None, **kwargs
63
64
  return filtered_connectors
64
65
 
65
66
 
66
- def query(ctx, no_down=False, not_version=None, sort_by=None, **kwargs):
67
+ def query(
68
+ ctx,
69
+ no_down=False,
70
+ not_version=None,
71
+ sort_by=None,
72
+ page_at_id=None,
73
+ page_size=500,
74
+ **kwargs,
75
+ ):
67
76
  token = context.get_token(ctx)
68
77
  apiclient = context.get_apiclient(ctx, token)
69
78
  org_id = get_org_from_input_or_ctx(ctx, **kwargs)
70
79
 
71
80
  params = {}
72
81
  params["org_id"] = org_id
82
+ if page_at_id is None:
83
+ page_at_id = ""
73
84
  input_helpers.update_if_not_none(params, kwargs)
74
- query_results = apiclient.connectors_api.list_connector(**params)
85
+ query_results = get_many_entries(
86
+ apiclient.connectors_api.list_connector,
87
+ "connectors",
88
+ maximum=kwargs.get("limit", None),
89
+ page_size=page_size,
90
+ page_at_id=page_at_id,
91
+ **params,
92
+ )
75
93
  return do_filter(
76
94
  ctx,
77
95
  no_down,
78
- query_results.connectors,
96
+ query_results,
79
97
  not_version=not_version,
80
98
  sort_by=sort_by,
81
99
  **kwargs,
agilicus/main.py CHANGED
@@ -5007,10 +5007,11 @@ def show_api_key_introspection(ctx, email, api_key, include_suborgs=False, **kwa
5007
5007
  @cli.command(help="list all connectors")
5008
5008
  @click.option("--org-id", default=None)
5009
5009
  @click.option("--name", default=None)
5010
- @click.option("--limit", default=500)
5010
+ @click.option("--limit", default=None)
5011
5011
  @click.option("--show-stats", type=bool, default=True)
5012
5012
  @click.option("--no-down", is_flag=True, type=bool, default=False)
5013
5013
  @click.option("--page-at-id", default=None)
5014
+ @click.option("--page-size", default=500, type=int)
5014
5015
  @click.option(
5015
5016
  "--sort-by",
5016
5017
  type=click.Choice(["metadata.created", "status.operational_status.status"]),
@@ -7762,6 +7763,14 @@ def list_user_guids(ctx, type, **kwargs):
7762
7763
  print(format_table(ctx, results, columns))
7763
7764
 
7764
7765
 
7766
+ @cli.command()
7767
+ @click.pass_context
7768
+ @click.option("--org-id", default=None)
7769
+ @click.option("--n", default=10, type=int)
7770
+ def show_top_connectors(ctx, **kwargs):
7771
+ metrics.show_top_connectors(ctx, **kwargs)
7772
+
7773
+
7765
7774
  def main():
7766
7775
  trusted_certs_main.add_commands(cli)
7767
7776
  hosts_main.add_commands(cli)
agilicus/metrics.py CHANGED
@@ -1,5 +1,12 @@
1
1
  from agilicus.input_helpers import pop_item_if_none, strip_none
2
2
  from . import context
3
+ from . import connectors
4
+ from . import orgs
5
+ from .output.table import (
6
+ column,
7
+ format_table,
8
+ )
9
+ import operator
3
10
 
4
11
 
5
12
  def query_top(
@@ -67,3 +74,24 @@ def query_active(
67
74
  resp = apiclient.metrics_api.list_active_users(org_id, **params)
68
75
 
69
76
  return resp.active_users
77
+
78
+
79
+ def show_top_connectors(ctx, n=10, org_id=None):
80
+ by_org = {}
81
+ for connector in connectors.query(ctx, org_id=org_id):
82
+ conns = by_org.setdefault(connector.spec.org_id, [])
83
+ conns.append(connector)
84
+
85
+ org_by_id, _ = orgs.get_org_by_dictionary(ctx, org_id)
86
+ rows = []
87
+ for k, v in sorted(by_org.items(), key=lambda item: len(item[1]), reverse=True):
88
+ if len(rows) >= n:
89
+ break
90
+ org_name = org_by_id.get(k, {}).get("organisation", "unknown org")
91
+ rows.append({"org_id": k, "Organisation": org_name, "num_connectors": len(v)})
92
+ columns = [
93
+ column("org_id"),
94
+ column("Organisation"),
95
+ column("num_connectors"),
96
+ ]
97
+ print(format_table(ctx, rows, columns, getter=operator.itemgetter))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: agilicus
3
- Version: 1.240.1
3
+ Version: 1.240.2
4
4
  Summary: Agilicus SDK
5
5
  Home-page: https://www.agilicus.com/
6
6
  License: MIT
@@ -67,9 +67,9 @@ agilicus/agilicus_api/api/users_api.py,sha256=89UhVL1__kwMA6_e0g0Ugmse_kzKJ90M9z
67
67
  agilicus/agilicus_api/api/users_api_mock.py,sha256=wA_xiqL3Pz3KjljKlsmf5NveLZS1FpbaKJHBp7QvarY,15411
68
68
  agilicus/agilicus_api/api/whoami_api.py,sha256=_yxz_daDWiKYgIXqbVTEJmvOmrQXTgzRrXX04NmU3D8,7941
69
69
  agilicus/agilicus_api/api/whoami_api_mock.py,sha256=rlvZoWnMCqORMZBg7SOv6d3xp52kELdh6wXcCaIZ93w,346
70
- agilicus/agilicus_api/api_client.py,sha256=FTDU7ovcGPvAG7FyCIpOjb9fFtOqlc1tg0zbx54CyII,38845
70
+ agilicus/agilicus_api/api_client.py,sha256=LYp_mR3b2Y3ZkjIXdinRQQxWMoS-ZlXP1nsFsnUoM6U,38845
71
71
  agilicus/agilicus_api/apis/__init__.py,sha256=m_hg6OJsEsMp6mZ1mn9OlaTflLjrU3Jc-jvYD9gi_PA,2092
72
- agilicus/agilicus_api/configuration.py,sha256=3upyvDljb8YebHRSI4kLaSAs0waQIJ3nP___5GRYV0I,18447
72
+ agilicus/agilicus_api/configuration.py,sha256=xEH3dRTvYsK580z2LlzATLioN0BfboYN6iZzQIYYhos,18447
73
73
  agilicus/agilicus_api/docs/APIKey.md,sha256=4cKuz4_l9HcEDnUrLwYbEnn9C2WoDayrjfrY1Ixgaf4,1747
74
74
  agilicus/agilicus_api/docs/APIKeyIntrospect.md,sha256=nJ-zkuFm3JMbWFDYYN_vYyQk1snGBtBvIxtCQxamhAU,1019
75
75
  agilicus/agilicus_api/docs/APIKeyIntrospectAuthorizationInfo.md,sha256=7RApOOLjvWQs5sw2jb25g7i3Kta1BiEY-s8VRXfppH8,725
@@ -2365,7 +2365,7 @@ agilicus/agilicus_api/test/test_x509_root_certificate.py,sha256=Xb3ORbJEsORPpY70
2365
2365
  agilicus/agilicus_api/test/test_x509_root_certificate_spec.py,sha256=rnKpCqk4bLzbxBNuwrjybXv5us6p1C716aAVmOJb5CQ,2832
2366
2366
  agilicus/agilicus_api/test/test_x509_root_certificate_status.py,sha256=Fk1TUIqHuoV7rpCEjr6lXVm8QvVpTxQhYN-xbxaIYgg,2846
2367
2367
  agilicus/agilicus_api/test/test_xss_settings.py,sha256=d9HA_meX95wfylALAximKaTNiWIGTGqwUK9UF6NQsK4,2746
2368
- agilicus/agilicus_api_README.md,sha256=Ek3e6R6gi5gA2VyiS8fQWRzTaTiwF34SOnyxdMCI6LI,152562
2368
+ agilicus/agilicus_api_README.md,sha256=z7geOkXWrms0lUekkn_-hm3No_E9jv_xdIhg7PyAhZs,152562
2369
2369
  agilicus/aliases.ini,sha256=MxqiVo2f2xdUDVF1YDkNW36AIqN8hrYjlTVfraEUZXY,455
2370
2370
  agilicus/amq.py,sha256=yxi-YTbJPVl10s78Hlr1dmrQR63iaSIoROGVILzFPmE,1775
2371
2371
  agilicus/apps.py,sha256=P8Ak1c9Zlr_RFLR1s3WevxoyIPY8fd9BNmV-M-LoRRk,49060
@@ -2377,7 +2377,7 @@ agilicus/certificate.py,sha256=iXC4iT3EGISyEezrvMgfic_lSCx2_JMSWevTLyGekR8,2739
2377
2377
  agilicus/challenges.py,sha256=HRSogUKlATul58pK-yWfsQa75K4-Nu-xIi5Vm24RsDM,6870
2378
2378
  agilicus/click_extension.py,sha256=uE57TjMqJxO9VFPBJO5-bTo9UrQiHPjIdI_iwKSaw6Q,224
2379
2379
  agilicus/client_secrets.json,sha256=eyPFVzziH48RuwWl66cfi0JE4jpmoec0Vo_F2TzYOeI,414
2380
- agilicus/connectors.py,sha256=E_YuH5C3w7QzOooSi1syNT1uC2MVQH2Shf5-tnG-eLQ,39367
2380
+ agilicus/connectors.py,sha256=6Eop2T0QKAEfK25gaUSNIcFUdbq4Es5cs1_2Nld0o70,39667
2381
2381
  agilicus/context.py,sha256=ieod0sDR1kVMIWI9oaLT9ii2XirRyiZh8ea-pjxQmjo,7707
2382
2382
  agilicus/credentials.py,sha256=F3yPAwoMcziP1OLmzeJ8jIz1W-91-HXu4zcymyMp1E4,4730
2383
2383
  agilicus/credentials_commands/credentials.py,sha256=YduI2SJR8nJgFuAloNowy16_s-rdVLZLDkuQvk_YmAg,3574
@@ -2414,9 +2414,9 @@ agilicus/labels/labels_main.py,sha256=aXRNRT1CPiUc0x1Gh_VoCmzrbROzsC5e9ycrwPNT0q
2414
2414
  agilicus/launchers.py,sha256=Yy59dzHMCz9ZSs_mMjVGaTw3vdNX58WsmIfX56by69U,11077
2415
2415
  agilicus/logs.py,sha256=tS8c_sdre1Dncrl59GVGQ0L3d2jtwlVjvIMl3SHJraY,766
2416
2416
  agilicus/lookups.py,sha256=MNmNsKpP7Fq_poLAnL9xo_iptFilKM9ziGLyIe8VKaw,669
2417
- agilicus/main.py,sha256=-73eBPasFM__19sleOs5CTEscHZ-0YZLP_6xyzmwy1s,258662
2417
+ agilicus/main.py,sha256=DvjxE5sgElNep9nenzyVNJjLLthqB50OzlDkVMHeDHg,258922
2418
2418
  agilicus/messages.py,sha256=Ydm-VhAsK23UnYdstv_HsOybBODfui5ubKc7F8R_dsw,5187
2419
- agilicus/metrics.py,sha256=9l0T7ea4Gvcj7A1C4uC4mv6v26_S8HKnmIuxJjq3mQw,1424
2419
+ agilicus/metrics.py,sha256=v4rwpvqDzeNG5GKNoZ7t34X5qUgly5IW2s-kXlS2vQM,2315
2420
2420
  agilicus/orgs.py,sha256=hrKmF8RI4H1htQNWPiwFOzy2EPBLdgNpV4c9CMxYSiM,12701
2421
2421
  agilicus/output/__init__.py,sha256=UKZbHS4t15vazJuN46FN-3HHqkxMXU0p3df2VcsSLcY,110
2422
2422
  agilicus/output/column_builder.py,sha256=TWo4t8ygaTUv7qjD_moDroD1bKzzyTIao0FmLy5gs4o,4284
@@ -2451,8 +2451,8 @@ agilicus/trusted_certs/trusted_certs_main.py,sha256=6dHHWXvNIcUa_nA9ptigL4Vibe4n
2451
2451
  agilicus/users.py,sha256=9qTbS2yzV1D7DuTh1FopKT_K4Z1i0d-ZgpQtEEsnOyE,38377
2452
2452
  agilicus/version.py,sha256=G9OFdL1v_4dLDfk6I6taDNypM5bbO-JHAwilsu9LYgg,23
2453
2453
  agilicus/whoami.py,sha256=kqghtWMgZOd2rhKmfguDwCTm6A3gNS8Kj-S2IBxBtl0,206
2454
- agilicus-1.240.1.dist-info/LICENSE.txt,sha256=Zq4tqiCroC2CVrBB_PWjapRdvpae23nljdiaSkOzUho,1061
2455
- agilicus-1.240.1.dist-info/METADATA,sha256=4_-zhBExGPelRoBc5SHmZT3COvrInqDYWOYjn6W1I88,3742
2456
- agilicus-1.240.1.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
2457
- agilicus-1.240.1.dist-info/entry_points.txt,sha256=a66hGozzLkHu0IewFzIMbSAhMTNTddUaA2T3_16Gb_s,51
2458
- agilicus-1.240.1.dist-info/RECORD,,
2454
+ agilicus-1.240.2.dist-info/LICENSE.txt,sha256=Zq4tqiCroC2CVrBB_PWjapRdvpae23nljdiaSkOzUho,1061
2455
+ agilicus-1.240.2.dist-info/METADATA,sha256=PagmVkfKrgMGB9Ft2oassyCiML-VLeYDE8BcMf3EAQY,3742
2456
+ agilicus-1.240.2.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
2457
+ agilicus-1.240.2.dist-info/entry_points.txt,sha256=a66hGozzLkHu0IewFzIMbSAhMTNTddUaA2T3_16Gb_s,51
2458
+ agilicus-1.240.2.dist-info/RECORD,,