aio-kong 3.0.0__py3-none-any.whl → 3.3.1__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.
@@ -1,4 +1,4 @@
1
- Copyright (c) 2022 Quantmind
1
+ Copyright (c) 2023 Quantmind
2
2
 
3
3
  Redistribution and use in source and binary forms, with or without modification,
4
4
  are permitted provided that the following conditions are met:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: aio-kong
3
- Version: 3.0.0
3
+ Version: 3.3.1
4
4
  Summary: Asynchronous Kong Client
5
5
  License: BSD-3-Clause
6
6
  Author: Luca
@@ -17,9 +17,6 @@ Classifier: Programming Language :: Python
17
17
  Classifier: Programming Language :: Python :: 3
18
18
  Classifier: Programming Language :: Python :: 3.10
19
19
  Classifier: Programming Language :: Python :: 3.11
20
- Classifier: Programming Language :: Python :: 3
21
- Classifier: Programming Language :: Python :: 3.10
22
- Classifier: Programming Language :: Python :: 3.11
23
20
  Classifier: Topic :: Software Development
24
21
  Classifier: Topic :: Software Development :: Libraries
25
22
  Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
@@ -37,11 +34,11 @@ Description-Content-Type: text/markdown
37
34
  [![PyPI version](https://badge.fury.io/py/aio-kong.svg)](https://badge.fury.io/py/aio-kong)
38
35
  [![Python versions](https://img.shields.io/pypi/pyversions/aio-kong.svg)](https://pypi.org/project/aio-kong)
39
36
  [![Build](https://github.com/quantmind/aio-kong/workflows/build/badge.svg)](https://github.com/quantmind/aio-kong/actions?query=workflow%3Abuild)
40
- [![codecov](https://codecov.io/gh/quantmind/aio-kong/branch/master/graph/badge.svg)](https://codecov.io/gh/quantmind/aio-kong)
37
+ [![codecov](https://codecov.io/gh/quantmind/aio-kong/branch/main/graph/badge.svg?token=JF5L0PEkW6)](https://codecov.io/gh/quantmind/aio-kong)
41
38
  [![Downloads](https://img.shields.io/pypi/dd/aio-kong.svg)](https://pypi.org/project/aio-kong/)
42
39
 
43
40
 
44
- Tested with [kong][] v3.1
41
+ Tested with [kong][] v3.3
45
42
 
46
43
  ## Installation & Testing
47
44
 
@@ -0,0 +1,17 @@
1
+ kong/__init__.py,sha256=vdv-cfsgeGr34QVY6y3BSJQEdqEL73gXPn4si6yPkOc,54
2
+ kong/auths.py,sha256=QcY6pT_4Jf9R8KNafMoAHNV-ixjew5Nq63dlgo3wadc,2314
3
+ kong/certificates.py,sha256=MFRmFz7X2oqZN434VD7BzB7ozsUj-HD0Jv5anZZkYHw,278
4
+ kong/cli.py,sha256=OMTNQ50kEI6WqWjWlAA9HcBWRb5eqEFqgUmtUKvuVQM,1986
5
+ kong/client.py,sha256=JWky7Eu4b9ED0FQihy6jKLbV20XtXni3izro9davHVY,3783
6
+ kong/components.py,sha256=JrQrxkVSdq7ZsBvb_nG28TMEL8uFpNsdApODRr0T5o4,5342
7
+ kong/consumers.py,sha256=PRIa07WU8xNRfod5XmeK2V_f59wfTlOP6ZK8iR1iAkY,2720
8
+ kong/plugins.py,sha256=QlxPuWmui64iiauJ-pXTjZd84wrNARe45v1yIMGCPAU,2685
9
+ kong/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
+ kong/routes.py,sha256=GkNfaKZDuO9BDDhri3Ah3b2qy_VfAHcAmamRHlbOA0k,1482
11
+ kong/services.py,sha256=ForaPLtEKyITZb9GqVb-XJUf4iOvKYh26YZSfo1SY6k,2514
12
+ kong/snis.py,sha256=UfEVp_PAwXYVH9mK-ND7HCtf_H6T9RqUEoHU2sne_bY,665
13
+ kong/utils.py,sha256=j3KmyZ4dtszteIl5saaxJa0JJaNTSearIAHOZrw8O7M,931
14
+ aio_kong-3.3.1.dist-info/LICENSE,sha256=4S4Rfy2EEQkrBsn1cu8_EZkf2Q8XfOoxjabtI0BOhdQ,1461
15
+ aio_kong-3.3.1.dist-info/METADATA,sha256=Maz8MGtOZ86cDDkVGn-o9HOqG4yQpDuB0Sy2dfUnf_Q,3452
16
+ aio_kong-3.3.1.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
17
+ aio_kong-3.3.1.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 1.4.0
2
+ Generator: poetry-core 1.6.1
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
kong/__init__.py CHANGED
@@ -1,3 +1,3 @@
1
1
  """Asynchronous Kong client"""
2
2
 
3
- __version__ = "3.0.0"
3
+ __version__ = "3.3.1"
kong/auths.py CHANGED
@@ -15,7 +15,6 @@ def auth_factory(consumer: Consumer, auth_type: str) -> ConsumerAuth:
15
15
 
16
16
 
17
17
  class ConsumerAuth(CrudComponent):
18
-
19
18
  unique_field: str = ""
20
19
 
21
20
  @property
kong/client.py CHANGED
@@ -54,7 +54,7 @@ class Kong:
54
54
  __str__ = __repr__
55
55
 
56
56
  @property
57
- def cli(self) -> "Kong":
57
+ def cli(self) -> Kong:
58
58
  return self
59
59
 
60
60
  async def close(self) -> None:
kong/py.typed ADDED
File without changes
kong/routes.py CHANGED
@@ -1,4 +1,3 @@
1
- from itertools import zip_longest
2
1
  from typing import cast
3
2
 
4
3
  from .components import UUID, CrudComponent, JsonType
@@ -19,26 +18,27 @@ class Routes(CrudComponent):
19
18
  await route.plugins.delete_all()
20
19
  return await super().delete(id_)
21
20
 
22
- async def apply_json(self, data: JsonType, clear: bool = True) -> list:
21
+ async def apply_json(self, data: JsonType, clear: bool = True) -> list[dict]:
23
22
  if not isinstance(data, list):
24
23
  data = [data]
25
24
  routes = await self.get_list()
25
+ route_map = {r.name: r for r in routes}
26
26
  result = []
27
- for entry, route in zip_longest(data, routes):
28
- if not entry:
29
- if route and clear:
30
- await self.delete(route.id)
31
- continue
27
+ for entry in data:
28
+ name = entry.get("name")
29
+ route = route_map.pop(name, None) if name else None
32
30
  entry = entry.copy()
33
31
  plugins = entry.pop("plugins", [])
34
32
  as_list("hosts", entry)
35
33
  as_list("paths", entry)
36
34
  as_list("methods", entry)
37
- if not route:
38
- entity = await self.create(**entry)
39
- else:
40
- entity = await self.update(route.id, **entry)
35
+ if route:
36
+ await self.delete(route.id)
37
+ entity = await self.create(**entry)
41
38
  route = cast(KongEntityWithPlugins, entity)
42
39
  route.data["plugins"] = await route.plugins.apply_json(plugins)
43
40
  result.append(route.data)
41
+ if clear:
42
+ for route in route_map.values():
43
+ await self.delete(route.id)
44
44
  return result
@@ -1,16 +0,0 @@
1
- kong/__init__.py,sha256=5y4ePzpFZonyo2nkrdaBr9B4_ZL5nh1-0jtqmUbd-JU,54
2
- kong/auths.py,sha256=ANGfR6gxL9GWyUECW7EVu763qSbkOqhms1B9JbQd-V8,2315
3
- kong/certificates.py,sha256=MFRmFz7X2oqZN434VD7BzB7ozsUj-HD0Jv5anZZkYHw,278
4
- kong/cli.py,sha256=OMTNQ50kEI6WqWjWlAA9HcBWRb5eqEFqgUmtUKvuVQM,1986
5
- kong/client.py,sha256=QuhfctA9YSCoKwSarJJ4mh3TfcTaIqWxY6gG8htAQE8,3785
6
- kong/components.py,sha256=JrQrxkVSdq7ZsBvb_nG28TMEL8uFpNsdApODRr0T5o4,5342
7
- kong/consumers.py,sha256=PRIa07WU8xNRfod5XmeK2V_f59wfTlOP6ZK8iR1iAkY,2720
8
- kong/plugins.py,sha256=QlxPuWmui64iiauJ-pXTjZd84wrNARe45v1yIMGCPAU,2685
9
- kong/routes.py,sha256=9TrP2xS-pbUBKdPH6onuvEw3HI4A4PwpRhVz_k6Gd2o,1461
10
- kong/services.py,sha256=ForaPLtEKyITZb9GqVb-XJUf4iOvKYh26YZSfo1SY6k,2514
11
- kong/snis.py,sha256=UfEVp_PAwXYVH9mK-ND7HCtf_H6T9RqUEoHU2sne_bY,665
12
- kong/utils.py,sha256=j3KmyZ4dtszteIl5saaxJa0JJaNTSearIAHOZrw8O7M,931
13
- aio_kong-3.0.0.dist-info/METADATA,sha256=kQX1uoNpz7EEhLOoSEXJF50TF0c_KKRYJBcKjNR6XUE,3587
14
- aio_kong-3.0.0.dist-info/LICENSE,sha256=EoHxNd1ly7t_8uzEQiWVO2jSiheGTvKXCOIs9Yw2PEw,1461
15
- aio_kong-3.0.0.dist-info/WHEEL,sha256=vVCvjcmxuUltf8cYhJ0sJMRDLr1XsPuxEId8YDzbyCY,88
16
- aio_kong-3.0.0.dist-info/RECORD,,