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

Commit 5af8c14

Browse files
fix: migrate to grpc_service_config (#110)
This PR was generated using Autosynth. 🌈 Synth log will be available here: https://source.cloud.google.com/results/invocations/064d885f-e246-4a73-93ae-61c4d27d9d17/targets - [ ] To automatically regenerate this PR, check this box. PiperOrigin-RevId: 319092903 Source-Link: googleapis/googleapis@98d6efc
1 parent ca328ff commit 5af8c14

4 files changed

Lines changed: 93 additions & 56 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ has instructions for running the samples.
100100
| Endpoints Delete | [source code](https://github.com/googleapis/java-servicedirectory/blob/master/samples/snippets/src/main/java/com/example/servicedirectory/EndpointsDelete.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-servicedirectory&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/servicedirectory/EndpointsDelete.java) |
101101
| Namespaces Create | [source code](https://github.com/googleapis/java-servicedirectory/blob/master/samples/snippets/src/main/java/com/example/servicedirectory/NamespacesCreate.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-servicedirectory&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/servicedirectory/NamespacesCreate.java) |
102102
| Namespaces Delete | [source code](https://github.com/googleapis/java-servicedirectory/blob/master/samples/snippets/src/main/java/com/example/servicedirectory/NamespacesDelete.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-servicedirectory&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/servicedirectory/NamespacesDelete.java) |
103+
| Quickstart | [source code](https://github.com/googleapis/java-servicedirectory/blob/master/samples/snippets/src/main/java/com/example/servicedirectory/Quickstart.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-servicedirectory&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/servicedirectory/Quickstart.java) |
103104
| Services Create | [source code](https://github.com/googleapis/java-servicedirectory/blob/master/samples/snippets/src/main/java/com/example/servicedirectory/ServicesCreate.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-servicedirectory&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/servicedirectory/ServicesCreate.java) |
104105
| Services Delete | [source code](https://github.com/googleapis/java-servicedirectory/blob/master/samples/snippets/src/main/java/com/example/servicedirectory/ServicesDelete.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-servicedirectory&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/servicedirectory/ServicesDelete.java) |
105106
| Services Resolve | [source code](https://github.com/googleapis/java-servicedirectory/blob/master/samples/snippets/src/main/java/com/example/servicedirectory/ServicesResolve.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-servicedirectory&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/servicedirectory/ServicesResolve.java) |

google-cloud-servicedirectory/src/main/java/com/google/cloud/servicedirectory/v1beta1/stub/LookupServiceStubSettings.java

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -174,11 +174,16 @@ public static class Builder extends StubSettings.Builder<LookupServiceStubSettin
174174
ImmutableMap.Builder<String, ImmutableSet<StatusCode.Code>> definitions =
175175
ImmutableMap.builder();
176176
definitions.put(
177-
"idempotent",
177+
"retry_policy_1_codes",
178178
ImmutableSet.copyOf(
179179
Lists.<StatusCode.Code>newArrayList(
180-
StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE)));
181-
definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.<StatusCode.Code>newArrayList()));
180+
StatusCode.Code.UNAVAILABLE, StatusCode.Code.UNKNOWN)));
181+
definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.<StatusCode.Code>newArrayList()));
182+
definitions.put(
183+
"retry_policy_2_codes",
184+
ImmutableSet.copyOf(
185+
Lists.<StatusCode.Code>newArrayList(
186+
StatusCode.Code.UNAVAILABLE, StatusCode.Code.UNKNOWN)));
182187
RETRYABLE_CODE_DEFINITIONS = definitions.build();
183188
}
184189

@@ -189,15 +194,28 @@ public static class Builder extends StubSettings.Builder<LookupServiceStubSettin
189194
RetrySettings settings = null;
190195
settings =
191196
RetrySettings.newBuilder()
192-
.setInitialRetryDelay(Duration.ofMillis(100L))
197+
.setInitialRetryDelay(Duration.ofMillis(1000L))
198+
.setRetryDelayMultiplier(1.3)
199+
.setMaxRetryDelay(Duration.ofMillis(60000L))
200+
.setInitialRpcTimeout(Duration.ofMillis(15000L))
201+
.setRpcTimeoutMultiplier(1.0)
202+
.setMaxRpcTimeout(Duration.ofMillis(15000L))
203+
.setTotalTimeout(Duration.ofMillis(15000L))
204+
.build();
205+
definitions.put("retry_policy_1_params", settings);
206+
settings =
207+
RetrySettings.newBuilder()
208+
.setInitialRetryDelay(Duration.ofMillis(1000L))
193209
.setRetryDelayMultiplier(1.3)
194210
.setMaxRetryDelay(Duration.ofMillis(60000L))
195-
.setInitialRpcTimeout(Duration.ofMillis(20000L))
211+
.setInitialRpcTimeout(Duration.ofMillis(15000L))
196212
.setRpcTimeoutMultiplier(1.0)
197-
.setMaxRpcTimeout(Duration.ofMillis(20000L))
198-
.setTotalTimeout(Duration.ofMillis(600000L))
213+
.setMaxRpcTimeout(Duration.ofMillis(15000L))
214+
.setTotalTimeout(Duration.ofMillis(15000L))
199215
.build();
200-
definitions.put("default", settings);
216+
definitions.put("retry_policy_2_params", settings);
217+
settings = RetrySettings.newBuilder().setRpcTimeoutMultiplier(1.0).build();
218+
definitions.put("no_retry_params", settings);
201219
RETRY_PARAM_DEFINITIONS = definitions.build();
202220
}
203221

@@ -229,8 +247,8 @@ private static Builder initDefaults(Builder builder) {
229247

230248
builder
231249
.resolveServiceSettings()
232-
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
233-
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
250+
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_2_codes"))
251+
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_2_params"));
234252

235253
return builder;
236254
}

google-cloud-servicedirectory/src/main/java/com/google/cloud/servicedirectory/v1beta1/stub/RegistrationServiceStubSettings.java

Lines changed: 62 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -526,11 +526,16 @@ public static class Builder
526526
ImmutableMap.Builder<String, ImmutableSet<StatusCode.Code>> definitions =
527527
ImmutableMap.builder();
528528
definitions.put(
529-
"idempotent",
529+
"retry_policy_1_codes",
530530
ImmutableSet.copyOf(
531531
Lists.<StatusCode.Code>newArrayList(
532-
StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE)));
533-
definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.<StatusCode.Code>newArrayList()));
532+
StatusCode.Code.UNAVAILABLE, StatusCode.Code.UNKNOWN)));
533+
definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.<StatusCode.Code>newArrayList()));
534+
definitions.put(
535+
"retry_policy_2_codes",
536+
ImmutableSet.copyOf(
537+
Lists.<StatusCode.Code>newArrayList(
538+
StatusCode.Code.UNAVAILABLE, StatusCode.Code.UNKNOWN)));
534539
RETRYABLE_CODE_DEFINITIONS = definitions.build();
535540
}
536541

@@ -541,15 +546,28 @@ public static class Builder
541546
RetrySettings settings = null;
542547
settings =
543548
RetrySettings.newBuilder()
544-
.setInitialRetryDelay(Duration.ofMillis(100L))
549+
.setInitialRetryDelay(Duration.ofMillis(1000L))
550+
.setRetryDelayMultiplier(1.3)
551+
.setMaxRetryDelay(Duration.ofMillis(60000L))
552+
.setInitialRpcTimeout(Duration.ofMillis(15000L))
553+
.setRpcTimeoutMultiplier(1.0)
554+
.setMaxRpcTimeout(Duration.ofMillis(15000L))
555+
.setTotalTimeout(Duration.ofMillis(15000L))
556+
.build();
557+
definitions.put("retry_policy_1_params", settings);
558+
settings =
559+
RetrySettings.newBuilder()
560+
.setInitialRetryDelay(Duration.ofMillis(1000L))
545561
.setRetryDelayMultiplier(1.3)
546562
.setMaxRetryDelay(Duration.ofMillis(60000L))
547-
.setInitialRpcTimeout(Duration.ofMillis(20000L))
563+
.setInitialRpcTimeout(Duration.ofMillis(15000L))
548564
.setRpcTimeoutMultiplier(1.0)
549-
.setMaxRpcTimeout(Duration.ofMillis(20000L))
550-
.setTotalTimeout(Duration.ofMillis(600000L))
565+
.setMaxRpcTimeout(Duration.ofMillis(15000L))
566+
.setTotalTimeout(Duration.ofMillis(15000L))
551567
.build();
552-
definitions.put("default", settings);
568+
definitions.put("retry_policy_2_params", settings);
569+
settings = RetrySettings.newBuilder().setRpcTimeoutMultiplier(1.0).build();
570+
definitions.put("no_retry_params", settings);
553571
RETRY_PARAM_DEFINITIONS = definitions.build();
554572
}
555573

@@ -633,93 +651,93 @@ private static Builder initDefaults(Builder builder) {
633651

634652
builder
635653
.createNamespaceSettings()
636-
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
637-
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
654+
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
655+
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
638656

639657
builder
640658
.listNamespacesSettings()
641-
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
642-
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
659+
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
660+
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
643661

644662
builder
645663
.getNamespaceSettings()
646-
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
647-
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
664+
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
665+
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
648666

649667
builder
650668
.updateNamespaceSettings()
651-
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
652-
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
669+
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
670+
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
653671

654672
builder
655673
.deleteNamespaceSettings()
656-
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
657-
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
674+
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
675+
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
658676

659677
builder
660678
.createServiceSettings()
661-
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
662-
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
679+
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
680+
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
663681

664682
builder
665683
.listServicesSettings()
666-
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
667-
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
684+
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
685+
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
668686

669687
builder
670688
.getServiceSettings()
671-
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
672-
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
689+
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
690+
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
673691

674692
builder
675693
.updateServiceSettings()
676-
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
677-
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
694+
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
695+
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
678696

679697
builder
680698
.deleteServiceSettings()
681-
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
682-
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
699+
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
700+
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
683701

684702
builder
685703
.createEndpointSettings()
686-
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
687-
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
704+
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
705+
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
688706

689707
builder
690708
.listEndpointsSettings()
691-
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
692-
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
709+
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
710+
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
693711

694712
builder
695713
.getEndpointSettings()
696-
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
697-
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
714+
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
715+
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
698716

699717
builder
700718
.updateEndpointSettings()
701-
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
702-
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
719+
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
720+
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
703721

704722
builder
705723
.deleteEndpointSettings()
706-
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
707-
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
724+
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
725+
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
708726

709727
builder
710728
.getIamPolicySettings()
711-
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
712-
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
729+
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
730+
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
713731

714732
builder
715733
.setIamPolicySettings()
716-
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
717-
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
734+
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
735+
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
718736

719737
builder
720738
.testIamPermissionsSettings()
721-
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
722-
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
739+
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
740+
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
723741

724742
return builder;
725743
}

synth.metadata

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
"git": {
1212
"name": "googleapis",
1313
"remote": "https://github.com/googleapis/googleapis.git",
14-
"sha": "c4e37010d74071851ff24121f522e802231ac86e",
15-
"internalRef": "313460921"
14+
"sha": "98d6efce2ba341bcb6e5319e082a9109b51555c7",
15+
"internalRef": "319092903"
1616
}
1717
},
1818
{

0 commit comments

Comments
 (0)