minos.plugins.kong.client

Classes

KongClient

Kong Client class.

class KongClient[source]

Bases: SetupMixin

Kong Client class.

__init__(protocol=None, host=None, port=None, token_expiration_sec=None, **kwargs)[source]
Parameters
async static register_service(discovery_route, service_name, microservice_host, microservice_port)[source]
Parameters
  • discovery_route (str) –

  • service_name (str) –

  • microservice_host (str) –

  • microservice_port (int) –

Return type

Response

async static delete_service(discovery_route, service_name)[source]

the delete of a service must be checking before if the service already have the routes if yes the DELETE routes must be called :param discovery_route: :param service_name: :return:

Parameters

discovery_route (str) –

Return type

Response

async static create_route(endpoint, protocols, methods, paths, service, regex_priority, strip_path=False)[source]
Parameters
async create_consumer(username, user, tags)[source]
Parameters
async add_basic_auth_to_consumer(username, password, consumer)[source]
Parameters
  • username (str) –

  • password (str) –

  • consumer (str) –

async add_jwt_to_consumer(consumer)[source]
Parameters

consumer (str) –

async add_acl_to_consumer(role, consumer)[source]
Parameters
  • role (str) –

  • consumer (str) –

async activate_acl_plugin_on_service(service_name, allow)[source]
Parameters
async activate_acl_plugin_on_route(route_id, allow)[source]
Parameters
async activate_basic_auth_plugin_on_service(service_name)[source]
Parameters

service_name (str) –

async activate_basic_auth_plugin_on_route(route_id)[source]
Parameters

route_id (str) –

async activate_jwt_plugin_on_route(route_id)[source]
Parameters

route_id (str) –

async generate_jwt_token(key, secret, algorithm='HS256', exp=None, nbf=None)[source]
Parameters
Return type

str

async static decode_token(token, algorithm='HS256')[source]
Parameters
  • token (str) –

  • algorithm (str) –

async get_jwt_by_id(id)[source]
Parameters

id (str) –

async get_consumer_jwts(consumer)[source]
Parameters

consumer (str) –

property already_destroyed: bool

Already Destroy getter.

Returns

A boolean value.

property already_setup: bool

Already Setup getter.

Returns

A boolean value.

async destroy()

Destroy miscellaneous repository things.

Returns

This method does not return anything.

Return type

None

classmethod from_config(config=None, **kwargs)

Build a new instance from config.

Parameters
  • config (Optional[Union[Config, Path]]) – Config instance. If None is provided, default config is chosen.

  • kwargs – Additional named arguments.

Returns

A instance of the called class.

Return type

S

async setup()

Setup miscellaneous repository things.

Returns

This method does not return anything.

Return type

None