(preselectedLocation?: string)
| 137 | * @return A string representing the EventArc location. |
| 138 | */ |
| 139 | export async function askForEventArcLocation(preselectedLocation?: string): Promise<string> { |
| 140 | let valid = false; |
| 141 | let location = ""; |
| 142 | while (!valid) { |
| 143 | location = await select({ |
| 144 | default: preselectedLocation ?? EXTENSIONS_DEFAULT_EVENT_ARC_REGION, |
| 145 | message: |
| 146 | "Which location would you like the Eventarc channel to live in? We recommend using the default option. A channel location that differs from the extension's Cloud Functions location can incur egress cost.", |
| 147 | choices: ALLOWED_EVENT_ARC_REGIONS, |
| 148 | }); |
| 149 | valid = ALLOWED_EVENT_ARC_REGIONS.includes(location); |
| 150 | if (!valid) { |
| 151 | utils.logWarning( |
| 152 | `Unexpected EventArc region '${location}' was specified. Allowed regions: ${ALLOWED_EVENT_ARC_REGIONS.join( |
| 153 | ", ", |
| 154 | )}`, |
| 155 | ); |
| 156 | } |
| 157 | } |
| 158 | return location; |
| 159 | } |
no test coverage detected
searching dependent graphs…