agilicus 1.258.12__py3-none-any.whl → 1.259.2__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.258.12/python'
80
+ self.user_agent = 'OpenAPI-Generator/1.259.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.06.07\n"\
390
- "SDK Package Version: 1.258.12".\
390
+ "SDK Package Version: 1.259.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.06.07
7
- - Package version: 1.258.12
7
+ - Package version: 1.259.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/output/json.py CHANGED
@@ -8,6 +8,14 @@ def jsonify(ctx, entry):
8
8
 
9
9
 
10
10
  def json_output_default(o):
11
+ try:
12
+ # The classes in our API do not serialise.
13
+ # attempt a to_dict. If that passes, use it,
14
+ # else continue to check for date
15
+ o = o.to_dict()
16
+ return o
17
+ except AttributeError:
18
+ pass
11
19
  if isinstance(o, (datetime.date, datetime.datetime)):
12
20
  return o.isoformat()
13
21
  return None
@@ -1,5 +1,7 @@
1
+ import copy
1
2
  from ..input_helpers import (
2
3
  get_org_from_input_or_ctx,
4
+ model_from_dict,
3
5
  strip_none,
4
6
  )
5
7
 
@@ -16,6 +18,8 @@ from agilicus import (
16
18
  SimpleResourcePolicyTemplateStructure,
17
19
  SimpleResourcePolicyTemplate,
18
20
  StandaloneRuleName,
21
+ RuleCondition,
22
+ HttpRuleCondition,
19
23
  EmptiableObjectType,
20
24
  )
21
25
 
@@ -227,7 +231,9 @@ def migrate_resource(ctx, resource):
227
231
  )
228
232
  )
229
233
  template = SimpleResourcePolicyTemplate(
230
- rules=resource.spec.config.rules_config.rules,
234
+ rules=[
235
+ _migrate_http_rule(rule) for rule in resource.spec.config.rules_config.rules
236
+ ],
231
237
  policy_structure=policy_structures,
232
238
  template_type="simple_resource",
233
239
  )
@@ -259,3 +265,37 @@ def migrate_resource(ctx, resource):
259
265
  to_dict=False,
260
266
  )
261
267
  return resp
268
+
269
+
270
+ def _migrate_http_rule(input_rule):
271
+ if input_rule.extended_condition is not None:
272
+ return input_rule
273
+
274
+ new_rule = copy.deepcopy(input_rule)
275
+ input_cond = new_rule.condition.to_dict()
276
+ input_cond["condition_type"] = "http_rule_condition"
277
+ cond = model_from_dict(HttpRuleCondition, input_cond)
278
+ new_rule.extended_condition = RuleCondition(
279
+ condition=cond,
280
+ negated=False,
281
+ )
282
+ del new_rule["condition"]
283
+ return new_rule
284
+
285
+
286
+ def create_policy_template(ctx, template_dict, **kwargs):
287
+ template_as_instance = model_from_dict(PolicyTemplateInstance, template_dict)
288
+ token = context.get_token(ctx)
289
+ apiclient = context.get_apiclient(ctx, token)
290
+ return apiclient.policy_templates_api.create_policy_template_instance(
291
+ template_as_instance
292
+ )
293
+
294
+
295
+ def replace_policy_template(ctx, instance_id, template_dict, **kwargs):
296
+ template_as_instance = model_from_dict(PolicyTemplateInstance, template_dict)
297
+ token = context.get_token(ctx)
298
+ apiclient = context.get_apiclient(ctx, token)
299
+ return apiclient.policy_templates_api.replace_policy_template_instance(
300
+ instance_id, policy_template_instance=template_as_instance
301
+ )
@@ -1,4 +1,5 @@
1
1
  import click
2
+ import click_extension
2
3
 
3
4
  from . import policies
4
5
  from ..output.table import output_entry
@@ -56,6 +57,31 @@ def cli_command_get_policy_template(ctx, **kwargs):
56
57
  output_entry(ctx, policies.get_policy_template(ctx, **kwargs).to_dict())
57
58
 
58
59
 
60
+ @click.command(name="create-policy-template")
61
+ @click.option("--template-json-file", required=True, type=click_extension.JSONFile("r"))
62
+ @click.pass_context
63
+ def cli_command_create_policy_template(ctx, template_json_file, **kwargs):
64
+ output_entry(
65
+ ctx,
66
+ policies.create_policy_template(
67
+ ctx, template_dict=template_json_file, **kwargs
68
+ ).to_dict(),
69
+ )
70
+
71
+
72
+ @click.command(name="replace-policy-template")
73
+ @click.option("--instance-id", required=True, type=str)
74
+ @click.option("--template-json-file", required=True, type=click_extension.JSONFile("r"))
75
+ @click.pass_context
76
+ def cli_command_replace_policy_template(ctx, template_json_file, **kwargs):
77
+ output_entry(
78
+ ctx,
79
+ policies.replace_policy_template(
80
+ ctx, template_dict=template_json_file, **kwargs
81
+ ).to_dict(),
82
+ )
83
+
84
+
59
85
  @click.command(name="delete-policy-template")
60
86
  @click.option("--instance-id", default=None, required=True)
61
87
  @click.option("--org-id", default=None)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: agilicus
3
- Version: 1.258.12
3
+ Version: 1.259.2
4
4
  Summary: Agilicus SDK
5
5
  Home-page: https://www.agilicus.com/
6
6
  License: MIT
@@ -14,7 +14,7 @@ Classifier: Programming Language :: Python :: 3.9
14
14
  Classifier: Programming Language :: Python :: 3.10
15
15
  Classifier: Programming Language :: Python :: 3.11
16
16
  Provides-Extra: billing
17
- Requires-Dist: PyJWT (>=2.6.0,<3.0.0)
17
+ Requires-Dist: PyJWT (>=2.8.0,<3.0.0)
18
18
  Requires-Dist: appdirs (>=1.4.4,<2.0.0)
19
19
  Requires-Dist: babel (>=2.13.1,<3.0.0)
20
20
  Requires-Dist: certifi (>=14.05.14)
@@ -71,9 +71,9 @@ agilicus/agilicus_api/api/users_api.py,sha256=vB0sKWct34S8spWM5V_cIXNnJYymsxi6Hj
71
71
  agilicus/agilicus_api/api/users_api_mock.py,sha256=wA_xiqL3Pz3KjljKlsmf5NveLZS1FpbaKJHBp7QvarY,15411
72
72
  agilicus/agilicus_api/api/whoami_api.py,sha256=n8pLGSBrUCi188FvTqP_xnVOfZIeabOK8v-UYTvWlKg,7941
73
73
  agilicus/agilicus_api/api/whoami_api_mock.py,sha256=rlvZoWnMCqORMZBg7SOv6d3xp52kELdh6wXcCaIZ93w,346
74
- agilicus/agilicus_api/api_client.py,sha256=RdZCapwpP4ITy6PhlTqLeg3RQ7D0iXAXJWLPUrTLa3Q,38846
74
+ agilicus/agilicus_api/api_client.py,sha256=gi4KvwypTeyFhsso7xLlI4mE4ZtdwA0WQhc0klkvYPE,38845
75
75
  agilicus/agilicus_api/apis/__init__.py,sha256=aJZD7x-umdSni6ZBr4XxzpH8pwtU9hA5LlCDxcqa1Q8,2224
76
- agilicus/agilicus_api/configuration.py,sha256=1lFpt00bkNvMnIdrJKRkm9RgTMFcOqatpOxO34jGEns,18448
76
+ agilicus/agilicus_api/configuration.py,sha256=Us2ORRFgkTNGaOBAKBZeJb2tpewKj4PvsWNilHTfCVQ,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
@@ -2508,7 +2508,7 @@ agilicus/agilicus_api/test/test_x509_root_certificate.py,sha256=bg6sEfQxbFJV4g4E
2508
2508
  agilicus/agilicus_api/test/test_x509_root_certificate_spec.py,sha256=4DXwyUGi6wJhmjp2gUm9jBqA_j_rPjwOwEACfpZ1L_k,2832
2509
2509
  agilicus/agilicus_api/test/test_x509_root_certificate_status.py,sha256=5I8JM71Z_dR9ujggxPAgfv2ggO4P55y1FRViLXZiQTo,2846
2510
2510
  agilicus/agilicus_api/test/test_xss_settings.py,sha256=jm4mFfUvM6c1vQToM-97bhMoJIkCxaXTni-l-jLAtQg,2746
2511
- agilicus/agilicus_api_README.md,sha256=gK2wHsWaqGj2nM-7G4SG8psZFTCfwmyvRInKcS8UAAg,160943
2511
+ agilicus/agilicus_api_README.md,sha256=Fr03sFJHYq4hOvOstV8dRXBbBQ8-aLgYZLazuqHUr_0,160942
2512
2512
  agilicus/aliases.ini,sha256=MxqiVo2f2xdUDVF1YDkNW36AIqN8hrYjlTVfraEUZXY,455
2513
2513
  agilicus/amq.py,sha256=yxi-YTbJPVl10s78Hlr1dmrQR63iaSIoROGVILzFPmE,1775
2514
2514
  agilicus/apps.py,sha256=QMiV9ThED6lqS2l7Jr5Mei7fNBo8FEvPEtCae1NK3Pk,51814
@@ -2565,15 +2565,15 @@ agilicus/orgs.py,sha256=cj8UW2nG5D7mR_OUrwHB1P6BOHg-XGGiWX06PDhu7kI,14179
2565
2565
  agilicus/output/__init__.py,sha256=UKZbHS4t15vazJuN46FN-3HHqkxMXU0p3df2VcsSLcY,110
2566
2566
  agilicus/output/column_builder.py,sha256=TWo4t8ygaTUv7qjD_moDroD1bKzzyTIao0FmLy5gs4o,4284
2567
2567
  agilicus/output/console.py,sha256=xBURxlA7H1kmQ7zIKuifs_aQJq1cvmCJ5CtQVSo3_Ns,400
2568
- agilicus/output/json.py,sha256=5UU8Fm_b46y8iu3EPkg2eWwdbCyubgCxIdfecDTd4_Y,663
2568
+ agilicus/output/json.py,sha256=-5bX7ud1hIxux4l3P-K2gJXrE2gdZ0Ua1hfUOCX9MUM,899
2569
2569
  agilicus/output/table.py,sha256=slOLs30rybyZYFGNd_5bh4gVVz7tNafg3sey_20H1w8,7906
2570
2570
  agilicus/output/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2571
2571
  agilicus/output/tests/column_builder_test.py,sha256=fKP4V5sqXtmEIr-Q0gWVSFdBqCUtugZkP6G5gML_T7I,2130
2572
2572
  agilicus/pagination/pagination.py,sha256=hC7eLHxXKe4Iv7LdOZK3Dh8R_fKQIr9PPiWKJVyP4Nk,1672
2573
2573
  agilicus/patches.py,sha256=qTqLOgCAcFZPcPOkgfqMnK9bnqTXMvj_0ERsjRFcZug,1384
2574
2574
  agilicus/permissions.py,sha256=uB65yuDFICp1N10m0cdUjgizx9MQzAbLbAsBSTw1Rcc,2117
2575
- agilicus/policy/policies.py,sha256=dyIuBVpGDygI3HwtRZKfHgidjNsEdXOevWRB5jS0Zd0,7485
2576
- agilicus/policy/policy_main.py,sha256=0h8RAVuuNqNSg_ese82czdH4YUIKLRQJ9ZLsr87IJvc,2868
2575
+ agilicus/policy/policies.py,sha256=H4MKMJJuuQ7LsXRKH7d7TrcGLvzIkcuC5FmyO5OD1AE,8817
2576
+ agilicus/policy/policy_main.py,sha256=0fASWbzeWpaQEjwX5VOg90ZI-HZvOLCPJdrV3ahd4Hk,3732
2577
2577
  agilicus/policy/templates.py,sha256=EUvAhOhSjDuLAe2UKIFEzBp5pNpOT5y1r7uyV_GG6uI,5638
2578
2578
  agilicus/policy_config/policy_config.py,sha256=s1GwbBI5wuLINcViTKE8NdfcntLEegwpUEi7pqmdKkY,627
2579
2579
  agilicus/policy_config/policy_config_main.py,sha256=ReiOziCvPShjunCt3ohrEMGq0IaP0eNyIXEvEg_WD1M,788
@@ -2599,8 +2599,8 @@ agilicus/trusted_certs/trusted_certs_main.py,sha256=6dHHWXvNIcUa_nA9ptigL4Vibe4n
2599
2599
  agilicus/users.py,sha256=JT7TIiUOtSFXPOdxmIVFm7ygZTH1FjsIkD9j-vjLuMM,38474
2600
2600
  agilicus/version.py,sha256=G9OFdL1v_4dLDfk6I6taDNypM5bbO-JHAwilsu9LYgg,23
2601
2601
  agilicus/whoami.py,sha256=kqghtWMgZOd2rhKmfguDwCTm6A3gNS8Kj-S2IBxBtl0,206
2602
- agilicus-1.258.12.dist-info/LICENSE.txt,sha256=Zq4tqiCroC2CVrBB_PWjapRdvpae23nljdiaSkOzUho,1061
2603
- agilicus-1.258.12.dist-info/METADATA,sha256=FXJKwRZSA8JnvQ7dD2UzrAdMIZByZ1cZd7Vrt-UrZFA,3823
2604
- agilicus-1.258.12.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
2605
- agilicus-1.258.12.dist-info/entry_points.txt,sha256=a66hGozzLkHu0IewFzIMbSAhMTNTddUaA2T3_16Gb_s,51
2606
- agilicus-1.258.12.dist-info/RECORD,,
2602
+ agilicus-1.259.2.dist-info/LICENSE.txt,sha256=Zq4tqiCroC2CVrBB_PWjapRdvpae23nljdiaSkOzUho,1061
2603
+ agilicus-1.259.2.dist-info/METADATA,sha256=51RomgkReSYsdywA6igL3PHxLL4h5aYiR_4UqfZy25U,3822
2604
+ agilicus-1.259.2.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
2605
+ agilicus-1.259.2.dist-info/entry_points.txt,sha256=a66hGozzLkHu0IewFzIMbSAhMTNTddUaA2T3_16Gb_s,51
2606
+ agilicus-1.259.2.dist-info/RECORD,,