Skip to content

Commit c13aa11

Browse files
committed
Keep v2
1 parent d22f760 commit c13aa11

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

examples/python/ip-list.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def main():
3636

3737
print()
3838
print("ips with driver")
39-
with driver.api().ip() as client:
39+
with driver.apiv2().ip() as client:
4040
try:
4141
response = client.List(
4242
request=ip_pb2.IPServiceListRequest(project=project),
@@ -48,7 +48,7 @@ def main():
4848

4949
print()
5050
print("networks with admin driver")
51-
with driver.admin().network() as client:
51+
with driver.adminv2().network() as client:
5252
try:
5353
response = client.List(
5454
request=network_pb2.NetworkServiceListRequest(),

generate/python_client.tpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ class Driver:
1515
self.token = token
1616
self.timeout = timeout
1717
{{ range $name, $api := . }}
18-
def {{ $name | trimSuffix "v2" | lower }}(self):
19-
return {{ $name | trimSuffix "v2" | title }}Driver(baseurl=self.baseurl, token=self.token, timeout=self.timeout)
18+
def {{ $name | lower }}(self):
19+
return {{ $name | title }}(baseurl=self.baseurl, token=self.token, timeout=self.timeout)
2020
{{ end }}
2121

2222
{{ range $name, $api := . -}}
23-
class {{ $name | trimSuffix "v2" | title }}Driver:
23+
class {{ $name | title }}:
2424
def __init__(self, baseurl: str, token: str, timeout: int = 10):
2525
self.baseurl = baseurl
2626
self.token = token

python/metalstack/client/client.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,17 @@ def __init__(self, baseurl: str, token: str, timeout: int = 10):
3636
self.token = token
3737
self.timeout = timeout
3838

39-
def admin(self):
40-
return AdminDriver(baseurl=self.baseurl, token=self.token, timeout=self.timeout)
39+
def adminv2(self):
40+
return Adminv2(baseurl=self.baseurl, token=self.token, timeout=self.timeout)
4141

42-
def api(self):
43-
return ApiDriver(baseurl=self.baseurl, token=self.token, timeout=self.timeout)
42+
def apiv2(self):
43+
return Apiv2(baseurl=self.baseurl, token=self.token, timeout=self.timeout)
4444

45-
def infra(self):
46-
return InfraDriver(baseurl=self.baseurl, token=self.token, timeout=self.timeout)
45+
def infrav2(self):
46+
return Infrav2(baseurl=self.baseurl, token=self.token, timeout=self.timeout)
4747

4848

49-
class AdminDriver:
49+
class Adminv2:
5050
def __init__(self, baseurl: str, token: str, timeout: int = 10):
5151
self.baseurl = baseurl
5252
self.token = token
@@ -93,7 +93,7 @@ def token(self):
9393
with admin_token_connecpy.TokenServiceClient(self.baseurl, timeout=self.timeout) as client:
9494
yield ClientWrapper(client, self.token)
9595

96-
class ApiDriver:
96+
class Apiv2:
9797
def __init__(self, baseurl: str, token: str, timeout: int = 10):
9898
self.baseurl = baseurl
9999
self.token = token
@@ -165,7 +165,7 @@ def version(self):
165165
with api_version_connecpy.VersionServiceClient(self.baseurl, timeout=self.timeout) as client:
166166
yield ClientWrapper(client, self.token)
167167

168-
class InfraDriver:
168+
class Infrav2:
169169
def __init__(self, baseurl: str, token: str, timeout: int = 10):
170170
self.baseurl = baseurl
171171
self.token = token

0 commit comments

Comments
 (0)