1 // Copyright 2020 Google LLC 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package com.google.api.generator.gapic.model; 16 17 import com.google.auto.value.AutoValue; 18 import com.google.protobuf.Duration; 19 import io.grpc.serviceconfig.MethodConfig.RetryPolicy; 20 21 @AutoValue 22 public abstract class GapicRetrySettings { 23 public enum Kind { 24 NONE, // No retry policy and no timeout. 25 NO_RETRY, // No retry policy, timeout only. 26 FULL // Retry policy and timeout. 27 }; 28 timeout()29 public abstract Duration timeout(); 30 retryPolicy()31 public abstract RetryPolicy retryPolicy(); 32 kind()33 public abstract Kind kind(); 34 builder()35 public static Builder builder() { 36 return new AutoValue_GapicRetrySettings.Builder(); 37 } 38 39 @AutoValue.Builder 40 public abstract static class Builder { setTimeout(Duration timeout)41 public abstract Builder setTimeout(Duration timeout); 42 setRetryPolicy(RetryPolicy retryPolicy)43 public abstract Builder setRetryPolicy(RetryPolicy retryPolicy); 44 setKind(Kind kind)45 public abstract Builder setKind(Kind kind); 46 build()47 public abstract GapicRetrySettings build(); 48 } 49 } 50