If the CAS server can be reached and reports readiness
(ctx context.Context)
| 162 | |
| 163 | // If the CAS server can be reached and reports readiness |
| 164 | func (uc *CASClientUseCase) IsReady(ctx context.Context) (bool, error) { |
| 165 | ctx, span := otelx.Start(ctx, casClientTracer, "CASClientUseCase.IsReady") |
| 166 | defer span.End() |
| 167 | |
| 168 | if uc.casServerConf == nil { |
| 169 | return false, errors.New("missing CAS server configuration") |
| 170 | } |
| 171 | |
| 172 | if err := protovalidate.Validate(uc.casServerConf); err != nil { |
| 173 | return false, fmt.Errorf("invalid CAS client configuration: %w", err) |
| 174 | } |
| 175 | |
| 176 | c, closeFn, err := uc.casClientFactory(uc.casServerConf, "") |
| 177 | if err != nil { |
| 178 | return false, fmt.Errorf("failed to create CAS client: %w", err) |
| 179 | } |
| 180 | defer closeFn() |
| 181 | |
| 182 | return c.IsReady(ctx) |
| 183 | } |