agilicus 1.256.3__py3-none-any.whl → 1.256.4__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.
@@ -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.256.3/python'
80
+ self.user_agent = 'OpenAPI-Generator/1.256.4/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.05.06\n"\
390
- "SDK Package Version: 1.256.3".\
390
+ "SDK Package Version: 1.256.4".\
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.05.06
7
- - Package version: 1.256.3
7
+ - Package version: 1.256.4
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/main.py CHANGED
@@ -67,6 +67,7 @@ from .input_helpers import (
67
67
  SubObjectInt,
68
68
  SubObjectString,
69
69
  pop_item_if_none,
70
+ get_org_from_input_or_ctx,
70
71
  )
71
72
 
72
73
  from .trusted_certs import trusted_certs_main
@@ -2430,30 +2431,34 @@ def get_token(ctx, **kwargs):
2430
2431
 
2431
2432
 
2432
2433
  @cli.command(name="create-token")
2433
- @click.argument("user-id")
2434
- @click.argument("org-id", type=str)
2434
+ @click.option("--user-id", default=None, required=False)
2435
+ @click.option("--org-id", default=None, required=False)
2435
2436
  @click.option("--role", "-r", type=click.Tuple([str, str]), multiple=True)
2436
2437
  @click.option("--duration", type=int, default=3600)
2437
2438
  @click.option("--aud", type=str, multiple=True)
2438
2439
  @click.option("--scope", type=str, multiple=True)
2439
2440
  @click.option("--inherit-session", type=bool, default=False)
2441
+ @click.option("--create-refresh-token", is_flag=True)
2440
2442
  @click.pass_context
2441
- def create_token(ctx, user_id, org_id, role, duration, aud, scope, inherit_session):
2443
+ def create_token(
2444
+ ctx, user_id, org_id, role, duration, aud, scope, inherit_session, **kwargs
2445
+ ):
2446
+ if user_id is None:
2447
+ user_id = tokens.introspect_self(ctx).to_dict().get("sub")
2448
+ org_id = get_org_from_input_or_ctx(ctx, org_id)
2442
2449
  roles = {endpoint: role_name for endpoint, role_name in role}
2443
- token = tokens.create_token(
2450
+ result = tokens.create_token(
2444
2451
  ctx,
2445
2452
  user_id,
2446
2453
  roles,
2447
2454
  duration,
2448
- aud,
2455
+ list(aud),
2449
2456
  org_id=org_id,
2450
2457
  scopes=scope,
2451
2458
  inherit_session=inherit_session,
2459
+ **kwargs,
2452
2460
  )
2453
- if not token:
2454
- sys.exit(1)
2455
-
2456
- print(token)
2461
+ output_entry(ctx, result.to_dict())
2457
2462
 
2458
2463
 
2459
2464
  @cli.command(name="bulk-revoke-tokens")
agilicus/tokens.py CHANGED
@@ -44,34 +44,27 @@ def _create_token(
44
44
  org_id=None,
45
45
  scopes=None,
46
46
  inherit_session=False,
47
+ create_refresh_token=None,
47
48
  ):
48
- token = context.get_token(ctx)
49
-
50
- headers = {}
51
- headers["Authorization"] = "Bearer {}".format(token)
52
- headers["Content-type"] = "application/json"
53
-
54
- data = {}
55
- data["sub"] = user_id
56
- data["time_validity"] = {"duration": duration}
57
- data["audiences"] = aud
58
- data["inherit_session"] = inherit_session
49
+ obj = agilicus.CreateTokenRequest(
50
+ sub=user_id,
51
+ time_validity=agilicus.TimeValidity(duration=duration),
52
+ audiences=aud,
53
+ inherit_session=inherit_session,
54
+ org=org_id,
55
+ )
59
56
  if hosts:
60
- data["hosts"] = hosts
61
- if org_id:
62
- data["org"] = org_id
57
+ obj.hosts = hosts
63
58
  if roles:
64
- data["roles"] = roles
59
+ obj.roles = roles
65
60
  if scopes:
66
- data["scopes"] = scopes
61
+ obj.scopes = scopes
62
+ if create_refresh_token:
63
+ obj.create_refresh_token = create_refresh_token
67
64
 
68
- response = requests.post(
69
- context.get_api(ctx) + "/v1/tokens",
70
- headers=headers,
71
- data=json.dumps(data),
72
- verify=context.get_cacert(ctx),
73
- )
74
- return response
65
+ token = context.get_token(ctx)
66
+ apiclient = context.get_apiclient(ctx, token)
67
+ return apiclient.tokens_api.create_token(obj)
75
68
 
76
69
 
77
70
  def get_introspect(
@@ -133,13 +126,21 @@ def get_token(ctx, user_id, org_id, duration, hosts, aud):
133
126
  aud=aud,
134
127
  hosts=hosts,
135
128
  org_id=org_id,
136
- ).text
129
+ )
137
130
 
138
131
 
139
132
  def create_token(
140
- ctx, user_id, roles, duration, audiences, org_id, scopes=None, inherit_session=False
133
+ ctx,
134
+ user_id,
135
+ roles,
136
+ duration,
137
+ audiences,
138
+ org_id,
139
+ scopes=None,
140
+ inherit_session=False,
141
+ **kwargs,
141
142
  ):
142
- result = _create_token(
143
+ return _create_token(
143
144
  ctx,
144
145
  user_id,
145
146
  duration,
@@ -148,11 +149,8 @@ def create_token(
148
149
  org_id=org_id,
149
150
  scopes=scopes,
150
151
  inherit_session=inherit_session,
152
+ **kwargs,
151
153
  )
152
- if result.status_code != 200:
153
- print(f"Unable to retrieve token: {result.status_code} ({result.text})")
154
- return None
155
- return result.text
156
154
 
157
155
 
158
156
  def _get_service_access_token(auth_doc, expiry=None):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: agilicus
3
- Version: 1.256.3
3
+ Version: 1.256.4
4
4
  Summary: Agilicus SDK
5
5
  Home-page: https://www.agilicus.com/
6
6
  License: MIT
@@ -71,9 +71,9 @@ agilicus/agilicus_api/api/users_api.py,sha256=fkuQ5woRh2Z5cLqrsm-b8Ao-1P8kS2Tbu8
71
71
  agilicus/agilicus_api/api/users_api_mock.py,sha256=wA_xiqL3Pz3KjljKlsmf5NveLZS1FpbaKJHBp7QvarY,15411
72
72
  agilicus/agilicus_api/api/whoami_api.py,sha256=ixyg8j511oLFZDtpIp4ZcYeOK9YadcqzLal1HO9LiA0,7941
73
73
  agilicus/agilicus_api/api/whoami_api_mock.py,sha256=rlvZoWnMCqORMZBg7SOv6d3xp52kELdh6wXcCaIZ93w,346
74
- agilicus/agilicus_api/api_client.py,sha256=ZYpD6HQ59gw79q7XLCEknpE9J6x6vpCxP6DMRjA_DcI,38845
74
+ agilicus/agilicus_api/api_client.py,sha256=Pd5w6EHZnR6-XShDc1y3fM8ufpDY9-lkYsid9zOOehA,38845
75
75
  agilicus/agilicus_api/apis/__init__.py,sha256=aJZD7x-umdSni6ZBr4XxzpH8pwtU9hA5LlCDxcqa1Q8,2224
76
- agilicus/agilicus_api/configuration.py,sha256=b__nW1Hgnl6E6Gxbde2xQ_dyqHOSs5K51tA995dAQY0,18447
76
+ agilicus/agilicus_api/configuration.py,sha256=CQz6eIt6kQoRvmyq62VlfLx__rO0NbgI_ViG5LRPXog,18447
77
77
  agilicus/agilicus_api/docs/APIKey.md,sha256=4cKuz4_l9HcEDnUrLwYbEnn9C2WoDayrjfrY1Ixgaf4,1747
78
78
  agilicus/agilicus_api/docs/APIKeyIntrospect.md,sha256=nJ-zkuFm3JMbWFDYYN_vYyQk1snGBtBvIxtCQxamhAU,1019
79
79
  agilicus/agilicus_api/docs/APIKeyIntrospectAuthorizationInfo.md,sha256=7RApOOLjvWQs5sw2jb25g7i3Kta1BiEY-s8VRXfppH8,725
@@ -2478,7 +2478,7 @@ agilicus/agilicus_api/test/test_x509_root_certificate.py,sha256=stj9mAu5A0xg6aOy
2478
2478
  agilicus/agilicus_api/test/test_x509_root_certificate_spec.py,sha256=OXOKh1By2c0ZwPLJzuTyrQFHZKjipwxomyoe9RuBqC8,2832
2479
2479
  agilicus/agilicus_api/test/test_x509_root_certificate_status.py,sha256=huNzk-rZWsG9I-XsMAcH63i4i4Em89P__5LshhYSLUQ,2846
2480
2480
  agilicus/agilicus_api/test/test_xss_settings.py,sha256=Edqz6qOhRQuG5ayMljxVJSj9Q85yrl_qBV148rq9et0,2746
2481
- agilicus/agilicus_api_README.md,sha256=MqYgh9Wd8O7UtG49YOr1OrD_wpgz3ViMs-k503od6D0,159170
2481
+ agilicus/agilicus_api_README.md,sha256=DdVM1fMRVc8tKlflp643qG-I0oqJ1ak27PDorvg7deU,159170
2482
2482
  agilicus/aliases.ini,sha256=MxqiVo2f2xdUDVF1YDkNW36AIqN8hrYjlTVfraEUZXY,455
2483
2483
  agilicus/amq.py,sha256=yxi-YTbJPVl10s78Hlr1dmrQR63iaSIoROGVILzFPmE,1775
2484
2484
  agilicus/apps.py,sha256=cq_EDY49XLg4y3kxET_whzA0mOXVGinlo0rA9GLQDxM,51082
@@ -2528,7 +2528,7 @@ agilicus/labels/labels_main.py,sha256=ptJ34mf-iVaf8ezf3RWLcpeP2O0ntezS4tqJ0ks0el
2528
2528
  agilicus/launchers.py,sha256=XRW8cO_S7HHs-Cc6_baol9AOOsuGlMto7bLcsKYk6qA,11199
2529
2529
  agilicus/logs.py,sha256=tS8c_sdre1Dncrl59GVGQ0L3d2jtwlVjvIMl3SHJraY,766
2530
2530
  agilicus/lookups.py,sha256=MNmNsKpP7Fq_poLAnL9xo_iptFilKM9ziGLyIe8VKaw,669
2531
- agilicus/main.py,sha256=NukNGAMM1jQhwxW9qVnRZ9ig1Uj-bu99slTJpg-COB8,266072
2531
+ agilicus/main.py,sha256=a4hMEkKtiPp_x-gAGowYLLnF_-XTc09LHVYJQ1esQTo,266375
2532
2532
  agilicus/messages.py,sha256=Ydm-VhAsK23UnYdstv_HsOybBODfui5ubKc7F8R_dsw,5187
2533
2533
  agilicus/metrics.py,sha256=v4rwpvqDzeNG5GKNoZ7t34X5qUgly5IW2s-kXlS2vQM,2315
2534
2534
  agilicus/orgs.py,sha256=H_QdlUwIqZhBXt6mi8EblwkbzaUbsmYbUcwwgFO7-co,13473
@@ -2562,15 +2562,15 @@ agilicus/service_token.py,sha256=YDVFeBe9Yv0qYvfUenwnpGHuj2x1J06YUe5A_C8L6L4,716
2562
2562
  agilicus/ssh.py,sha256=mVqMlDM2zAcUphehyz9djXjrRPSIxR1qJr2Ehvl3Rvw,2925
2563
2563
  agilicus/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2564
2564
  agilicus/tests/keyring_test.py,sha256=Uwp2VS2_NffYBgHAS9bXuXnIxRoK0_VOWaaYCZKv0lg,1452
2565
- agilicus/tokens.py,sha256=qU_hL8ICcvR-yT0jQjf5sZLsmemSCh0gamyMnL7CHxM,18748
2565
+ agilicus/tokens.py,sha256=bcy-j7hnR9YlMC6VljpOuloeEoDrrqi_21JZLM086HA,18531
2566
2566
  agilicus/transfers.py,sha256=PYr_fW7dyXNUXzi5Wp5mUjZOvU7MbRzoN-D8Omo-YSQ,1523
2567
2567
  agilicus/trusted_certs/trusted_certs.py,sha256=HCAvYxOA3ooaee2_KbYJd6Yt_dxDEn8hjhy1upVJUYE,7951
2568
2568
  agilicus/trusted_certs/trusted_certs_main.py,sha256=6dHHWXvNIcUa_nA9ptigL4Vibe4nB2wnWFTTJ8AOgXo,5155
2569
2569
  agilicus/users.py,sha256=JT7TIiUOtSFXPOdxmIVFm7ygZTH1FjsIkD9j-vjLuMM,38474
2570
2570
  agilicus/version.py,sha256=G9OFdL1v_4dLDfk6I6taDNypM5bbO-JHAwilsu9LYgg,23
2571
2571
  agilicus/whoami.py,sha256=kqghtWMgZOd2rhKmfguDwCTm6A3gNS8Kj-S2IBxBtl0,206
2572
- agilicus-1.256.3.dist-info/LICENSE.txt,sha256=Zq4tqiCroC2CVrBB_PWjapRdvpae23nljdiaSkOzUho,1061
2573
- agilicus-1.256.3.dist-info/METADATA,sha256=rNQiEN4KBx1I0Lh83azd5DEHenWQf4ZWPLi3GwFblfQ,3822
2574
- agilicus-1.256.3.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
2575
- agilicus-1.256.3.dist-info/entry_points.txt,sha256=a66hGozzLkHu0IewFzIMbSAhMTNTddUaA2T3_16Gb_s,51
2576
- agilicus-1.256.3.dist-info/RECORD,,
2572
+ agilicus-1.256.4.dist-info/LICENSE.txt,sha256=Zq4tqiCroC2CVrBB_PWjapRdvpae23nljdiaSkOzUho,1061
2573
+ agilicus-1.256.4.dist-info/METADATA,sha256=jqOdzilFb2EAt520YarwWukmdn_szR3zM0wqpSolBcI,3822
2574
+ agilicus-1.256.4.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
2575
+ agilicus-1.256.4.dist-info/entry_points.txt,sha256=a66hGozzLkHu0IewFzIMbSAhMTNTddUaA2T3_16Gb_s,51
2576
+ agilicus-1.256.4.dist-info/RECORD,,