(ctx context.Context, cl *cloudquery_api.ClientWithResponses, tenant cloudquery_api.PlatformTenantSummary)
| 518 | } |
| 519 | |
| 520 | func mintSession(ctx context.Context, cl *cloudquery_api.ClientWithResponses, tenant cloudquery_api.PlatformTenantSummary) (session *cloudquery_api.CreatePlatformDestinationSession201Response, pluginVersion string, err error) { |
| 521 | ctx, cancel := context.WithTimeout(ctx, requestTimeout) |
| 522 | defer cancel() |
| 523 | |
| 524 | resp, err := cl.CreatePlatformDestinationSessionWithResponse(ctx, cloudquery_api.CreatePlatformDestinationSessionRequest{TenantId: tenant.TenantId}) |
| 525 | if err != nil { |
| 526 | return nil, "", err |
| 527 | } |
| 528 | if resp.JSON201 == nil { |
| 529 | return nil, "", fmt.Errorf("unexpected status %d minting platform destination session: %s", resp.StatusCode(), strings.TrimSpace(string(resp.Body))) |
| 530 | } |
| 531 | if resp.JSON201.Token == "" || resp.JSON201.ApiUrl == "" { |
| 532 | return nil, "", errors.New("platform destination session response missing token or api_url") |
| 533 | } |
| 534 | // plugin_version lets the platform pin the destination plugin version without |
| 535 | // a CLI release. Optional: nil/empty → caller falls back to the CLI default. |
| 536 | if resp.JSON201.PluginVersion != nil { |
| 537 | pluginVersion = *resp.JSON201.PluginVersion |
| 538 | } |
| 539 | return resp.JSON201, pluginVersion, nil |
| 540 | } |
| 541 | |
| 542 | // IsInjectedDestination reports whether a destination spec name is the |
| 543 | // auto-injected platform destination (a reserved name). |
no test coverage detected