CreateAndFetchApplication creates an application (with region retry) and generates an API key for it. It returns the region the application was actually created in, which may differ from the requested one.
( io *iostreams.IOStreams, client *dashboard.Client, accessToken, region, appName string, tracker *telemetry.FlowTracker, )
| 111 | // generates an API key for it. It returns the region the application was |
| 112 | // actually created in, which may differ from the requested one. |
| 113 | func CreateAndFetchApplication( |
| 114 | io *iostreams.IOStreams, |
| 115 | client *dashboard.Client, |
| 116 | accessToken, region, appName string, |
| 117 | tracker *telemetry.FlowTracker, |
| 118 | ) (*dashboard.Application, string, error) { |
| 119 | app, createdRegion, err := CreateApplicationWithRetry(io, client, accessToken, region, appName, tracker) |
| 120 | if err != nil { |
| 121 | return nil, "", err |
| 122 | } |
| 123 | |
| 124 | tracker.SetStep(telemetry.StepAPIKey) |
| 125 | if err := EnsureAPIKey(io, client, accessToken, app); err != nil { |
| 126 | return nil, "", err |
| 127 | } |
| 128 | |
| 129 | return app, createdRegion, nil |
| 130 | } |
| 131 | |
| 132 | // EnsureAPIKey generates a write API key for the application. |
| 133 | // Callers should skip this if the local profile already has a key. |
no test coverage detected