(model string, authSnapshot *Auth)
| 100 | } |
| 101 | |
| 102 | func errorEventModelStatusFrom(model string, authSnapshot *Auth) *errorEventModelStatus { |
| 103 | model = strings.TrimSpace(model) |
| 104 | if model == "" || authSnapshot == nil || authSnapshot.ModelStates == nil { |
| 105 | return nil |
| 106 | } |
| 107 | state := authSnapshot.ModelStates[model] |
| 108 | if state == nil { |
| 109 | return nil |
| 110 | } |
| 111 | return &errorEventModelStatus{ |
| 112 | Name: model, |
| 113 | Status: state.Status, |
| 114 | StatusMessage: strings.TrimSpace(state.StatusMessage), |
| 115 | Unavailable: state.Unavailable, |
| 116 | NextRetryAfter: timePtrIfSet(state.NextRetryAfter), |
| 117 | Quota: errorEventQuotaStatusFrom(state.Quota), |
| 118 | } |
| 119 | } |
| 120 | |
| 121 | func errorEventQuotaStatusFrom(quota QuotaState) *errorEventQuotaStatus { |
| 122 | if !quota.Exceeded && strings.TrimSpace(quota.Reason) == "" && quota.NextRecoverAt.IsZero() && quota.BackoffLevel == 0 { |
no test coverage detected