Files
VPNaaS-Migrator/ipsec_migrator/__pycache__/neutron_client.cpython-311.pyc
T

39 lines
7.5 KiB
Plaintext
Raw Normal View History

2026-07-21 15:05:52 +03:00
§
i_jÚãó„dZddlmZddlZddlmZddlZGdd¦«Zdd
Zdd Z dd Z
dd
Z ddZ ddZ
ddZdS)REST client for the Neutron API, replacing the `openstack` CLI subprocess
wrapper (`openstack_client.py`, removed).
Mirrors `SprutClient`'s shape: a single `requests.Session`, token/base URL
fixed at construction, `.get()`/`.post()` raising a clear error and exiting
on a non-2xx response.
Every list function below does exactly one GET and returns the collection
unwrapped -- no per-item `show` call. Unlike the `openstack` CLI's table
output (which truncates to a handful of display columns unless `--long` is
given), Neutron's list endpoints return the full attribute set for every
item by default, so the per-item `show` calls the CLI-based version needed
are redundant here.
é)Ú annotationsN)ÚAnycó:eZdZdddZdddZddZddZddZdS)Ú
NeutronClientç>@Úbase_urlÚstrÚtokenÚtimeoutÚfloatcóº| d¦«|_||_tj¦«|_|jj d|i¦«dS)/z X-Auth-Token)Úrstriprr ÚrequestsÚSessionÚ_sessionÚheadersÚupdate)Úselfrr
r s ú5/root/vkcloud/vpnaas/ipsec_migrator/neutron_client.pyÚ__init__zNeutronClient.__init__sPØ Ÿš¨ÑŒ
؈Œ Ý ÔŒ
Ø Œ
Ô×$ n°eÐ%<ÑmethodÚpathÚdataú dict | NoneÚreturnrc ó>|j|} |j ||||nd|j¬¦«}nY#tjj$rB}td|d|d|tj ¬¦«tj
d¦«Yd}~nd}~wwxYwd|j cxkrdksbntd|d|d |j tj ¬¦«td
|j tj ¬¦«tj
d¦«|j siS| 
¦«S) N)Újsonr zError: Neutron API ú ú failed: ©ÚfileééÈé,ú returned HTTP ú
Response: )rrÚrequestr rÚ
exceptionsÚRequestExceptionÚprintÚsysÚstderrÚexitÚ status_codeÚtextr)rrrrÚurlÚresponseÚexcs rÚcallzNeutronClient.callsXØÐ& Ð&ˆð Ø”}ט¨$Ð*: $ $ÀÈdÌlðôˆHˆHøõÔ ð ð Ý ÐÐÐD¸sÐDÍ3Ì:Ð ŒHQ‰KŒKˆKˆKˆKˆKˆKˆKøøøøð øøøð0¨SÒ ÐÐÐ[ÀXÔEYÐ[ÕbeÔblÐ Ð.˜xœ}Ð.µS´ZÐ ŒHQ‰KŒKˆKàŒ}ð ØˆIØ}Š}‰ŒÐs'5µB Á 8BÂB có.| d|¦«S)GET)r5)rrs rÚgetzNeutronClient.get1sØyŠy˜ Ñ%rr2có |j ||j¬¦«}nV#tjj$r?}t
d|d|tj¬¦«tj d¦«Yd}~nd}~wwxYwd|j
cxkrdks_nt
d|d |j
tj¬¦«t
d
|j tj¬¦«tj d¦«|j r|  ¦«niS) z…Like get(), but for an already-absolute URL (pagination "next"
links come back as full URLs, not paths relative to base_url).)r zError: Neutron API GET r!r"r$Nr%r&r'r()
rr8r rr*r+r,r-r.r/r0r1r)rr2r3r4s rÚ get_absolutezNeutronClient.get_absolute4sð Ø”}×°d´lÐCˆHˆHøÝÔ ð ð Ý Ð?¨CÐ?¸#Ð?ÅcÄjÐ ŒHQ‰KŒKˆKˆKˆKˆKˆKˆKøøøøð øøøð0¨SÒ ÐV¨CÐÔ@TÐVÕ]`Ô]gÐ Ð.˜xœ}Ð.µS´ZÐ ŒHQ‰KŒKˆKà"*¤-Ð7ˆx}Š}‰Œˆ°RÐ7s!$¤A7¸5A2Á2A7Úcollection_keyú
list[dict]cóg}| |¦«} | | |g¦«¦«| |dg¦«}td|D¦«d¦«}|s|S| |¦«}Œv)aGETs a collection and follows Neutron's pagination "next" links