Skip to content

Commit 77e3a84

Browse files
Using api_endpoint as the URL path (#421)
1 parent 78574da commit 77e3a84

File tree

1 file changed

+12
-18
lines changed

1 file changed

+12
-18
lines changed

linode_api4/objects/object_storage.py

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,9 @@ def access_modify(
9696
}
9797

9898
resp = self._client.post(
99-
"/object-storage/buckets/{}/{}/access".format(
100-
parse.quote(str(self.cluster)), parse.quote(str(self.id))
101-
),
99+
f"{self.api_endpoint}/access",
102100
data=drop_null_keys(params),
101+
model=self,
103102
)
104103

105104
if "errors" in resp:
@@ -138,10 +137,9 @@ def access_update(
138137
}
139138

140139
resp = self._client.put(
141-
"/object-storage/buckets/{}/{}/access".format(
142-
parse.quote(str(self.cluster)), parse.quote(str(self.id))
143-
),
140+
f"{self.api_endpoint}/access",
144141
data=drop_null_keys(params),
142+
model=self,
145143
)
146144

147145
if "errors" in resp:
@@ -163,9 +161,8 @@ def ssl_cert_delete(self):
163161
"""
164162

165163
resp = self._client.delete(
166-
"/object-storage/buckets/{}/{}/ssl".format(
167-
parse.quote(str(self.cluster)), parse.quote(str(self.id))
168-
)
164+
f"{self.api_endpoint}/ssl",
165+
model=self,
169166
)
170167

171168
if "error" in resp:
@@ -188,9 +185,8 @@ def ssl_cert(self):
188185
:rtype: MappedObject
189186
"""
190187
result = self._client.get(
191-
"/object-storage/buckets/{}/{}/ssl".format(
192-
parse.quote(str(self.cluster)), parse.quote(str(self.id))
193-
)
188+
f"{self.api_endpoint}/ssl",
189+
model=self,
194190
)
195191

196192
if not "ssl" in result:
@@ -231,10 +227,9 @@ def ssl_cert_upload(self, certificate, private_key):
231227
"private_key": private_key,
232228
}
233229
result = self._client.post(
234-
"/object-storage/buckets/{}/{}/ssl".format(
235-
parse.quote(str(self.cluster)), parse.quote(str(self.id))
236-
),
230+
f"{self.api_endpoint}/ssl",
237231
data=params,
232+
model=self,
238233
)
239234

240235
if not "ssl" in result:
@@ -298,10 +293,9 @@ def contents(
298293
"page_size": page_size,
299294
}
300295
result = self._client.get(
301-
"/object-storage/buckets/{}/{}/object-list".format(
302-
parse.quote(str(self.cluster)), parse.quote(str(self.id))
303-
),
296+
f"{self.api_endpoint}/object-list",
304297
data=drop_null_keys(params),
298+
model=self,
305299
)
306300

307301
if not "data" in result:

0 commit comments

Comments
 (0)