Skip to content
This repository was archived by the owner on Dec 31, 2023. It is now read-only.

Commit 757f4ce

Browse files
chore: update gapic-generator-python to 0.50.5
https://github.com/googleapis/gapic-generator-python/blob/master/CHANGELOG.md#0505-2021-07-22 Needed to fix failing generated unit tests in #91 Source-Author: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com> Source-Date: Thu Aug 5 16:21:09 2021 -0600 Source-Repo: googleapis/googleapis-discovery Source-Sha: ac663f7f0afb13e3a8cfd04160d1677655c5c613 Source-Link: googleapis/googleapis-discovery@ac663f7
1 parent b348c2d commit 757f4ce

157 files changed

Lines changed: 4218 additions & 6534 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

google/cloud/compute_v1/services/accelerator_types/transports/rest.py

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ def __init__(
5353
client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None,
5454
quota_project_id: Optional[str] = None,
5555
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
56+
always_use_jwt_access: Optional[bool] = False,
5657
) -> None:
5758
"""Instantiate the transport.
5859
@@ -86,7 +87,10 @@ def __init__(
8687
# TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the
8788
# credentials object
8889
super().__init__(
89-
host=host, credentials=credentials, client_info=client_info,
90+
host=host,
91+
credentials=credentials,
92+
client_info=client_info,
93+
always_use_jwt_access=always_use_jwt_access,
9094
)
9195
self._session = AuthorizedSession(
9296
self._credentials, default_host=self.DEFAULT_HOST
@@ -142,16 +146,10 @@ def aggregated_list(
142146
):
143147
query_params["returnPartialSuccess"] = request.return_partial_success
144148

145-
# TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here
146-
# discards default values
147-
# TODO(yon-mg): add test for proper url encoded strings
148-
query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()]
149-
url += "?{}".format("&".join(query_params)).replace(" ", "+")
150-
151149
# Send the request
152150
headers = dict(metadata)
153151
headers["Content-Type"] = "application/json"
154-
response = self._session.get(url, headers=headers,)
152+
response = self._session.get(url, headers=headers, params=query_params,)
155153

156154
# In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
157155
# subclass.
@@ -206,16 +204,10 @@ def get(
206204
# not required for GCE
207205
query_params = {}
208206

209-
# TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here
210-
# discards default values
211-
# TODO(yon-mg): add test for proper url encoded strings
212-
query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()]
213-
url += "?{}".format("&".join(query_params)).replace(" ", "+")
214-
215207
# Send the request
216208
headers = dict(metadata)
217209
headers["Content-Type"] = "application/json"
218-
response = self._session.get(url, headers=headers,)
210+
response = self._session.get(url, headers=headers, params=query_params,)
219211

220212
# In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
221213
# subclass.
@@ -269,16 +261,10 @@ def list(
269261
if compute.ListAcceleratorTypesRequest.return_partial_success in request:
270262
query_params["returnPartialSuccess"] = request.return_partial_success
271263

272-
# TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here
273-
# discards default values
274-
# TODO(yon-mg): add test for proper url encoded strings
275-
query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()]
276-
url += "?{}".format("&".join(query_params)).replace(" ", "+")
277-
278264
# Send the request
279265
headers = dict(metadata)
280266
headers["Content-Type"] = "application/json"
281-
response = self._session.get(url, headers=headers,)
267+
response = self._session.get(url, headers=headers, params=query_params,)
282268

283269
# In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
284270
# subclass.

google/cloud/compute_v1/services/addresses/transports/rest.py

Lines changed: 12 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ def __init__(
5252
client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None,
5353
quota_project_id: Optional[str] = None,
5454
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
55+
always_use_jwt_access: Optional[bool] = False,
5556
) -> None:
5657
"""Instantiate the transport.
5758
@@ -85,7 +86,10 @@ def __init__(
8586
# TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the
8687
# credentials object
8788
super().__init__(
88-
host=host, credentials=credentials, client_info=client_info,
89+
host=host,
90+
credentials=credentials,
91+
client_info=client_info,
92+
always_use_jwt_access=always_use_jwt_access,
8993
)
9094
self._session = AuthorizedSession(
9195
self._credentials, default_host=self.DEFAULT_HOST
@@ -138,16 +142,10 @@ def aggregated_list(
138142
if compute.AggregatedListAddressesRequest.return_partial_success in request:
139143
query_params["returnPartialSuccess"] = request.return_partial_success
140144

141-
# TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here
142-
# discards default values
143-
# TODO(yon-mg): add test for proper url encoded strings
144-
query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()]
145-
url += "?{}".format("&".join(query_params)).replace(" ", "+")
146-
147145
# Send the request
148146
headers = dict(metadata)
149147
headers["Content-Type"] = "application/json"
150-
response = self._session.get(url, headers=headers,)
148+
response = self._session.get(url, headers=headers, params=query_params,)
151149

152150
# In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
153151
# subclass.
@@ -224,16 +222,10 @@ def delete(
224222
if compute.DeleteAddressRequest.request_id in request:
225223
query_params["requestId"] = request.request_id
226224

227-
# TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here
228-
# discards default values
229-
# TODO(yon-mg): add test for proper url encoded strings
230-
query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()]
231-
url += "?{}".format("&".join(query_params)).replace(" ", "+")
232-
233225
# Send the request
234226
headers = dict(metadata)
235227
headers["Content-Type"] = "application/json"
236-
response = self._session.delete(url, headers=headers,)
228+
response = self._session.delete(url, headers=headers, params=query_params,)
237229

238230
# In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
239231
# subclass.
@@ -305,16 +297,10 @@ def get(
305297
# not required for GCE
306298
query_params = {}
307299

308-
# TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here
309-
# discards default values
310-
# TODO(yon-mg): add test for proper url encoded strings
311-
query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()]
312-
url += "?{}".format("&".join(query_params)).replace(" ", "+")
313-
314300
# Send the request
315301
headers = dict(metadata)
316302
headers["Content-Type"] = "application/json"
317-
response = self._session.get(url, headers=headers,)
303+
response = self._session.get(url, headers=headers, params=query_params,)
318304

319305
# In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
320306
# subclass.
@@ -393,16 +379,12 @@ def insert(
393379
if compute.InsertAddressRequest.request_id in request:
394380
query_params["requestId"] = request.request_id
395381

396-
# TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here
397-
# discards default values
398-
# TODO(yon-mg): add test for proper url encoded strings
399-
query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()]
400-
url += "?{}".format("&".join(query_params)).replace(" ", "+")
401-
402382
# Send the request
403383
headers = dict(metadata)
404384
headers["Content-Type"] = "application/json"
405-
response = self._session.post(url, headers=headers, data=body,)
385+
response = self._session.post(
386+
url, headers=headers, params=query_params, data=body,
387+
)
406388

407389
# In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
408390
# subclass.
@@ -453,16 +435,10 @@ def list(
453435
if compute.ListAddressesRequest.return_partial_success in request:
454436
query_params["returnPartialSuccess"] = request.return_partial_success
455437

456-
# TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here
457-
# discards default values
458-
# TODO(yon-mg): add test for proper url encoded strings
459-
query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()]
460-
url += "?{}".format("&".join(query_params)).replace(" ", "+")
461-
462438
# Send the request
463439
headers = dict(metadata)
464440
headers["Content-Type"] = "application/json"
465-
response = self._session.get(url, headers=headers,)
441+
response = self._session.get(url, headers=headers, params=query_params,)
466442

467443
# In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
468444
# subclass.

google/cloud/compute_v1/services/autoscalers/transports/rest.py

Lines changed: 18 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ def __init__(
5252
client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None,
5353
quota_project_id: Optional[str] = None,
5454
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
55+
always_use_jwt_access: Optional[bool] = False,
5556
) -> None:
5657
"""Instantiate the transport.
5758
@@ -85,7 +86,10 @@ def __init__(
8586
# TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the
8687
# credentials object
8788
super().__init__(
88-
host=host, credentials=credentials, client_info=client_info,
89+
host=host,
90+
credentials=credentials,
91+
client_info=client_info,
92+
always_use_jwt_access=always_use_jwt_access,
8993
)
9094
self._session = AuthorizedSession(
9195
self._credentials, default_host=self.DEFAULT_HOST
@@ -138,16 +142,10 @@ def aggregated_list(
138142
if compute.AggregatedListAutoscalersRequest.return_partial_success in request:
139143
query_params["returnPartialSuccess"] = request.return_partial_success
140144

141-
# TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here
142-
# discards default values
143-
# TODO(yon-mg): add test for proper url encoded strings
144-
query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()]
145-
url += "?{}".format("&".join(query_params)).replace(" ", "+")
146-
147145
# Send the request
148146
headers = dict(metadata)
149147
headers["Content-Type"] = "application/json"
150-
response = self._session.get(url, headers=headers,)
148+
response = self._session.get(url, headers=headers, params=query_params,)
151149

152150
# In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
153151
# subclass.
@@ -224,16 +222,10 @@ def delete(
224222
if compute.DeleteAutoscalerRequest.request_id in request:
225223
query_params["requestId"] = request.request_id
226224

227-
# TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here
228-
# discards default values
229-
# TODO(yon-mg): add test for proper url encoded strings
230-
query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()]
231-
url += "?{}".format("&".join(query_params)).replace(" ", "+")
232-
233225
# Send the request
234226
headers = dict(metadata)
235227
headers["Content-Type"] = "application/json"
236-
response = self._session.delete(url, headers=headers,)
228+
response = self._session.delete(url, headers=headers, params=query_params,)
237229

238230
# In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
239231
# subclass.
@@ -298,16 +290,10 @@ def get(
298290
# not required for GCE
299291
query_params = {}
300292

301-
# TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here
302-
# discards default values
303-
# TODO(yon-mg): add test for proper url encoded strings
304-
query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()]
305-
url += "?{}".format("&".join(query_params)).replace(" ", "+")
306-
307293
# Send the request
308294
headers = dict(metadata)
309295
headers["Content-Type"] = "application/json"
310-
response = self._session.get(url, headers=headers,)
296+
response = self._session.get(url, headers=headers, params=query_params,)
311297

312298
# In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
313299
# subclass.
@@ -388,16 +374,12 @@ def insert(
388374
if compute.InsertAutoscalerRequest.request_id in request:
389375
query_params["requestId"] = request.request_id
390376

391-
# TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here
392-
# discards default values
393-
# TODO(yon-mg): add test for proper url encoded strings
394-
query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()]
395-
url += "?{}".format("&".join(query_params)).replace(" ", "+")
396-
397377
# Send the request
398378
headers = dict(metadata)
399379
headers["Content-Type"] = "application/json"
400-
response = self._session.post(url, headers=headers, data=body,)
380+
response = self._session.post(
381+
url, headers=headers, params=query_params, data=body,
382+
)
401383

402384
# In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
403385
# subclass.
@@ -451,16 +433,10 @@ def list(
451433
if compute.ListAutoscalersRequest.return_partial_success in request:
452434
query_params["returnPartialSuccess"] = request.return_partial_success
453435

454-
# TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here
455-
# discards default values
456-
# TODO(yon-mg): add test for proper url encoded strings
457-
query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()]
458-
url += "?{}".format("&".join(query_params)).replace(" ", "+")
459-
460436
# Send the request
461437
headers = dict(metadata)
462438
headers["Content-Type"] = "application/json"
463-
response = self._session.get(url, headers=headers,)
439+
response = self._session.get(url, headers=headers, params=query_params,)
464440

465441
# In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
466442
# subclass.
@@ -543,16 +519,12 @@ def patch(
543519
if compute.PatchAutoscalerRequest.request_id in request:
544520
query_params["requestId"] = request.request_id
545521

546-
# TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here
547-
# discards default values
548-
# TODO(yon-mg): add test for proper url encoded strings
549-
query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()]
550-
url += "?{}".format("&".join(query_params)).replace(" ", "+")
551-
552522
# Send the request
553523
headers = dict(metadata)
554524
headers["Content-Type"] = "application/json"
555-
response = self._session.patch(url, headers=headers, data=body,)
525+
response = self._session.patch(
526+
url, headers=headers, params=query_params, data=body,
527+
)
556528

557529
# In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
558530
# subclass.
@@ -633,16 +605,12 @@ def update(
633605
if compute.UpdateAutoscalerRequest.request_id in request:
634606
query_params["requestId"] = request.request_id
635607

636-
# TODO(yon-mg): further discussion needed whether 'python truthiness' is appropriate here
637-
# discards default values
638-
# TODO(yon-mg): add test for proper url encoded strings
639-
query_params = ["{k}={v}".format(k=k, v=v) for k, v in query_params.items()]
640-
url += "?{}".format("&".join(query_params)).replace(" ", "+")
641-
642608
# Send the request
643609
headers = dict(metadata)
644610
headers["Content-Type"] = "application/json"
645-
response = self._session.put(url, headers=headers, data=body,)
611+
response = self._session.put(
612+
url, headers=headers, params=query_params, data=body,
613+
)
646614

647615
# In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
648616
# subclass.

0 commit comments

Comments
 (0)