(state *State, identity Identity)
| 363 | } |
| 364 | |
| 365 | func ValidateIdentity(state *State, identity Identity) error { |
| 366 | switch { |
| 367 | case state.Service != identity.Service: |
| 368 | return fmt.Errorf("batch service is %s, not %s: %w", state.Service, identity.Service, ErrIdentityMismatch) |
| 369 | case state.DocumentID != identity.DocumentID: |
| 370 | return fmt.Errorf("batch targets doc %s, not %s: %w", state.DocumentID, identity.DocumentID, ErrIdentityMismatch) |
| 371 | case !strings.EqualFold(state.Account, identity.Account): |
| 372 | return fmt.Errorf("batch uses account %s, not %s: %w", state.Account, identity.Account, ErrIdentityMismatch) |
| 373 | case state.Client != identity.Client: |
| 374 | return fmt.Errorf("batch uses OAuth client %s, not %s: %w", state.Client, identity.Client, ErrIdentityMismatch) |
| 375 | default: |
| 376 | return nil |
| 377 | } |
| 378 | } |
| 379 | |
| 380 | func summarize(state *State) Summary { |
| 381 | return Summary{ |
no test coverage detected