Skip to content

Commit 65e58ee

Browse files
yoshi-automationbusunkim96
authored andcommitted
Add routing header to method metadata (via synth). (#7598)
1 parent 108694a commit 65e58ee

File tree

4 files changed

+230
-6
lines changed

4 files changed

+230
-6
lines changed

logging/google/cloud/logging_v2/gapic/config_service_v2_client.py

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import google.api_core.gapic_v1.client_info
2424
import google.api_core.gapic_v1.config
2525
import google.api_core.gapic_v1.method
26+
import google.api_core.gapic_v1.routing_header
2627
import google.api_core.grpc_helpers
2728
import google.api_core.page_iterator
2829
import google.api_core.path_template
@@ -280,6 +281,19 @@ def list_sinks(
280281
request = logging_config_pb2.ListSinksRequest(
281282
parent=parent, page_size=page_size
282283
)
284+
if metadata is None:
285+
metadata = []
286+
metadata = list(metadata)
287+
try:
288+
routing_header = [("parent", parent)]
289+
except AttributeError:
290+
pass
291+
else:
292+
routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
293+
routing_header
294+
)
295+
metadata.append(routing_metadata)
296+
283297
iterator = google.api_core.page_iterator.GRPCIterator(
284298
client=None,
285299
method=functools.partial(
@@ -356,6 +370,19 @@ def get_sink(
356370
)
357371

358372
request = logging_config_pb2.GetSinkRequest(sink_name=sink_name)
373+
if metadata is None:
374+
metadata = []
375+
metadata = list(metadata)
376+
try:
377+
routing_header = [("sink_name", sink_name)]
378+
except AttributeError:
379+
pass
380+
else:
381+
routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
382+
routing_header
383+
)
384+
metadata.append(routing_metadata)
385+
359386
return self._inner_api_calls["get_sink"](
360387
request, retry=retry, timeout=timeout, metadata=metadata
361388
)
@@ -448,6 +475,19 @@ def create_sink(
448475
request = logging_config_pb2.CreateSinkRequest(
449476
parent=parent, sink=sink, unique_writer_identity=unique_writer_identity
450477
)
478+
if metadata is None:
479+
metadata = []
480+
metadata = list(metadata)
481+
try:
482+
routing_header = [("parent", parent)]
483+
except AttributeError:
484+
pass
485+
else:
486+
routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
487+
routing_header
488+
)
489+
metadata.append(routing_metadata)
490+
451491
return self._inner_api_calls["create_sink"](
452492
request, retry=retry, timeout=timeout, metadata=metadata
453493
)
@@ -561,6 +601,19 @@ def update_sink(
561601
unique_writer_identity=unique_writer_identity,
562602
update_mask=update_mask,
563603
)
604+
if metadata is None:
605+
metadata = []
606+
metadata = list(metadata)
607+
try:
608+
routing_header = [("sink_name", sink_name)]
609+
except AttributeError:
610+
pass
611+
else:
612+
routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
613+
routing_header
614+
)
615+
metadata.append(routing_metadata)
616+
564617
return self._inner_api_calls["update_sink"](
565618
request, retry=retry, timeout=timeout, metadata=metadata
566619
)
@@ -625,6 +678,19 @@ def delete_sink(
625678
)
626679

627680
request = logging_config_pb2.DeleteSinkRequest(sink_name=sink_name)
681+
if metadata is None:
682+
metadata = []
683+
metadata = list(metadata)
684+
try:
685+
routing_header = [("sink_name", sink_name)]
686+
except AttributeError:
687+
pass
688+
else:
689+
routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
690+
routing_header
691+
)
692+
metadata.append(routing_metadata)
693+
628694
self._inner_api_calls["delete_sink"](
629695
request, retry=retry, timeout=timeout, metadata=metadata
630696
)
@@ -711,6 +777,19 @@ def list_exclusions(
711777
request = logging_config_pb2.ListExclusionsRequest(
712778
parent=parent, page_size=page_size
713779
)
780+
if metadata is None:
781+
metadata = []
782+
metadata = list(metadata)
783+
try:
784+
routing_header = [("parent", parent)]
785+
except AttributeError:
786+
pass
787+
else:
788+
routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
789+
routing_header
790+
)
791+
metadata.append(routing_metadata)
792+
714793
iterator = google.api_core.page_iterator.GRPCIterator(
715794
client=None,
716795
method=functools.partial(
@@ -787,6 +866,19 @@ def get_exclusion(
787866
)
788867

789868
request = logging_config_pb2.GetExclusionRequest(name=name)
869+
if metadata is None:
870+
metadata = []
871+
metadata = list(metadata)
872+
try:
873+
routing_header = [("name", name)]
874+
except AttributeError:
875+
pass
876+
else:
877+
routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
878+
routing_header
879+
)
880+
metadata.append(routing_metadata)
881+
790882
return self._inner_api_calls["get_exclusion"](
791883
request, retry=retry, timeout=timeout, metadata=metadata
792884
)
@@ -866,6 +958,19 @@ def create_exclusion(
866958
request = logging_config_pb2.CreateExclusionRequest(
867959
parent=parent, exclusion=exclusion
868960
)
961+
if metadata is None:
962+
metadata = []
963+
metadata = list(metadata)
964+
try:
965+
routing_header = [("parent", parent)]
966+
except AttributeError:
967+
pass
968+
else:
969+
routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
970+
routing_header
971+
)
972+
metadata.append(routing_metadata)
973+
869974
return self._inner_api_calls["create_exclusion"](
870975
request, retry=retry, timeout=timeout, metadata=metadata
871976
)
@@ -956,6 +1061,19 @@ def update_exclusion(
9561061
request = logging_config_pb2.UpdateExclusionRequest(
9571062
name=name, exclusion=exclusion, update_mask=update_mask
9581063
)
1064+
if metadata is None:
1065+
metadata = []
1066+
metadata = list(metadata)
1067+
try:
1068+
routing_header = [("name", name)]
1069+
except AttributeError:
1070+
pass
1071+
else:
1072+
routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
1073+
routing_header
1074+
)
1075+
metadata.append(routing_metadata)
1076+
9591077
return self._inner_api_calls["update_exclusion"](
9601078
request, retry=retry, timeout=timeout, metadata=metadata
9611079
)
@@ -1018,6 +1136,19 @@ def delete_exclusion(
10181136
)
10191137

10201138
request = logging_config_pb2.DeleteExclusionRequest(name=name)
1139+
if metadata is None:
1140+
metadata = []
1141+
metadata = list(metadata)
1142+
try:
1143+
routing_header = [("name", name)]
1144+
except AttributeError:
1145+
pass
1146+
else:
1147+
routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
1148+
routing_header
1149+
)
1150+
metadata.append(routing_metadata)
1151+
10211152
self._inner_api_calls["delete_exclusion"](
10221153
request, retry=retry, timeout=timeout, metadata=metadata
10231154
)

logging/google/cloud/logging_v2/gapic/logging_service_v2_client.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import google.api_core.gapic_v1.client_info
2424
import google.api_core.gapic_v1.config
2525
import google.api_core.gapic_v1.method
26+
import google.api_core.gapic_v1.routing_header
2627
import google.api_core.grpc_helpers
2728
import google.api_core.page_iterator
2829
import google.api_core.path_template
@@ -247,6 +248,19 @@ def delete_log(
247248
)
248249

249250
request = logging_pb2.DeleteLogRequest(log_name=log_name)
251+
if metadata is None:
252+
metadata = []
253+
metadata = list(metadata)
254+
try:
255+
routing_header = [("log_name", log_name)]
256+
except AttributeError:
257+
pass
258+
else:
259+
routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
260+
routing_header
261+
)
262+
metadata.append(routing_metadata)
263+
250264
self._inner_api_calls["delete_log"](
251265
request, retry=retry, timeout=timeout, metadata=metadata
252266
)
@@ -700,6 +714,19 @@ def list_logs(
700714
)
701715

702716
request = logging_pb2.ListLogsRequest(parent=parent, page_size=page_size)
717+
if metadata is None:
718+
metadata = []
719+
metadata = list(metadata)
720+
try:
721+
routing_header = [("parent", parent)]
722+
except AttributeError:
723+
pass
724+
else:
725+
routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
726+
routing_header
727+
)
728+
metadata.append(routing_metadata)
729+
703730
iterator = google.api_core.page_iterator.GRPCIterator(
704731
client=None,
705732
method=functools.partial(

logging/google/cloud/logging_v2/gapic/metrics_service_v2_client.py

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import google.api_core.gapic_v1.client_info
2424
import google.api_core.gapic_v1.config
2525
import google.api_core.gapic_v1.method
26+
import google.api_core.gapic_v1.routing_header
2627
import google.api_core.grpc_helpers
2728
import google.api_core.page_iterator
2829
import google.api_core.path_template
@@ -267,6 +268,19 @@ def list_log_metrics(
267268
request = logging_metrics_pb2.ListLogMetricsRequest(
268269
parent=parent, page_size=page_size
269270
)
271+
if metadata is None:
272+
metadata = []
273+
metadata = list(metadata)
274+
try:
275+
routing_header = [("parent", parent)]
276+
except AttributeError:
277+
pass
278+
else:
279+
routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
280+
routing_header
281+
)
282+
metadata.append(routing_metadata)
283+
270284
iterator = google.api_core.page_iterator.GRPCIterator(
271285
client=None,
272286
method=functools.partial(
@@ -338,6 +352,19 @@ def get_log_metric(
338352
)
339353

340354
request = logging_metrics_pb2.GetLogMetricRequest(metric_name=metric_name)
355+
if metadata is None:
356+
metadata = []
357+
metadata = list(metadata)
358+
try:
359+
routing_header = [("metric_name", metric_name)]
360+
except AttributeError:
361+
pass
362+
else:
363+
routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
364+
routing_header
365+
)
366+
metadata.append(routing_metadata)
367+
341368
return self._inner_api_calls["get_log_metric"](
342369
request, retry=retry, timeout=timeout, metadata=metadata
343370
)
@@ -411,6 +438,19 @@ def create_log_metric(
411438
request = logging_metrics_pb2.CreateLogMetricRequest(
412439
parent=parent, metric=metric
413440
)
441+
if metadata is None:
442+
metadata = []
443+
metadata = list(metadata)
444+
try:
445+
routing_header = [("parent", parent)]
446+
except AttributeError:
447+
pass
448+
else:
449+
routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
450+
routing_header
451+
)
452+
metadata.append(routing_metadata)
453+
414454
return self._inner_api_calls["create_log_metric"](
415455
request, retry=retry, timeout=timeout, metadata=metadata
416456
)
@@ -485,6 +525,19 @@ def update_log_metric(
485525
request = logging_metrics_pb2.UpdateLogMetricRequest(
486526
metric_name=metric_name, metric=metric
487527
)
528+
if metadata is None:
529+
metadata = []
530+
metadata = list(metadata)
531+
try:
532+
routing_header = [("metric_name", metric_name)]
533+
except AttributeError:
534+
pass
535+
else:
536+
routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
537+
routing_header
538+
)
539+
metadata.append(routing_metadata)
540+
488541
return self._inner_api_calls["update_log_metric"](
489542
request, retry=retry, timeout=timeout, metadata=metadata
490543
)
@@ -542,6 +595,19 @@ def delete_log_metric(
542595
)
543596

544597
request = logging_metrics_pb2.DeleteLogMetricRequest(metric_name=metric_name)
598+
if metadata is None:
599+
metadata = []
600+
metadata = list(metadata)
601+
try:
602+
routing_header = [("metric_name", metric_name)]
603+
except AttributeError:
604+
pass
605+
else:
606+
routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
607+
routing_header
608+
)
609+
metadata.append(routing_metadata)
610+
545611
self._inner_api_calls["delete_log_metric"](
546612
request, retry=retry, timeout=timeout, metadata=metadata
547613
)

logging/synth.metadata

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
{
2-
"updateTime": "2019-02-26T13:20:43.903128Z",
2+
"updateTime": "2019-03-28T12:19:01.156618Z",
33
"sources": [
44
{
55
"generator": {
66
"name": "artman",
7-
"version": "0.16.14",
8-
"dockerImage": "googleapis/artman@sha256:f3d61ae45abaeefb6be5f228cda22732c2f1b00fb687c79c4bd4f2c42bb1e1a7"
7+
"version": "0.16.20",
8+
"dockerImage": "googleapis/artman@sha256:e3c054a2fb85a12481c722af616c7fb6f1d02d862248385eecbec3e4240ebd1e"
99
}
1010
},
1111
{
1212
"git": {
1313
"name": "googleapis",
1414
"remote": "https://github.com/googleapis/googleapis.git",
15-
"sha": "29f098cb03a9983cc9cb15993de5da64419046f2",
16-
"internalRef": "235621085"
15+
"sha": "6a84b3267b0a95e922608b9891219075047eee29",
16+
"internalRef": "240640999"
1717
}
1818
},
1919
{
2020
"template": {
2121
"name": "python_library",
2222
"origin": "synthtool.gcp",
23-
"version": "2019.1.16"
23+
"version": "2019.2.26"
2424
}
2525
}
2626
],

0 commit comments

Comments
 (0)