pulumi/sdk/go/common/workspace
Simon 101a72ed7f
Adds support for Copilot templates to `pulumi new` (#16825)
Copilot templates require an access token to look up the conversation
data and extract the code

Here we try to download any template as usual, but then add the
following logic to the response checking:
- *If* a `403` is returned from what we identify as a pulumi-service
backend (via `X-Pulumi-Request-ID` header, which has been present for
the last 6 years)
- *Then* we re-request w/ the auth token. If there is no token present
then the login flow is automatically initiated.

This does result in always raising a 403 on the server every time we
request a copilot template.

If we want to avoid these 403s we could check the domain against known
pulumi backends in the CLI first, at the cost of intro'ing another code
path.

## To test

- Go through the Copilot flow, e.g "Create an s3 bucket please"
- Click "Deploy with Pulumi"
- Choose CLI, click next
- Check out this branch
- Copy most of the command but first: `cd ~/pulumi/pulumi/pkg` and then
`go run ./cmd/pulumi new $ARGS_FROM_PULUMI_CLOUD_UI`

It should succeed
2025-01-09 10:14:57 +00:00
..
config.go Enable goheader rule and add missing license headers (#15473) 2024-09-09 12:05:45 +00:00
creds.go Improve invalid credentials error message (#17541) 2024-10-11 19:23:35 +00:00
creds_test.go Enable goheader rule and add missing license headers (#15473) 2024-09-09 12:05:45 +00:00
loaders.go New deployment settings wizards and environment variables management comands (#16564) 2024-07-03 20:24:26 +00:00
loaders_test.go ignore unexpected types instead of erroring out (#14149) 2023-10-11 16:39:16 +00:00
paths.go Just use errors.Is instead of As and Is (#17250) 2024-09-12 23:52:26 +00:00
paths_test.go Don't search upwards for policy packs when determining required plugins (#16865) 2024-08-02 11:49:16 +00:00
plugins.go add NewPluginSpec helper function (#17798) 2025-01-02 11:38:44 +00:00
plugins_install_nodejs_test.go ci: Use reduced smoke testing on Windows & macOS targets 2022-09-21 09:55:06 -07:00
plugins_install_python_test.go ci: Use reduced smoke testing on Windows & macOS targets 2022-09-21 09:55:06 -07:00
plugins_install_test.go Refactor: move plugin kind to apitype (#15946) 2024-04-25 17:30:30 +00:00
plugins_test.go add NewPluginSpec helper function (#17798) 2025-01-02 11:38:44 +00:00
project.go Enable some more linting rules (#17456) 2024-10-03 17:37:13 +00:00
project.json [sdk] add optional display name and tag fields to project templates (#14587) 2023-11-18 19:04:13 +00:00
project_test.go Preserve ordering when editing stack config. (#17452) 2024-10-02 13:31:10 +00:00
settings.go move pkg/workspace -> sdk/go/common/workspace 2020-03-18 14:35:53 -07:00
templates.go Adds support for Copilot templates to `pulumi new` (#16825) 2025-01-09 10:14:57 +00:00
templates_test.go pass context to git clone utilities (#17799) 2024-11-18 16:51:24 +00:00
templates_zip.go Adds support for Copilot templates to `pulumi new` (#16825) 2025-01-09 10:14:57 +00:00
templates_zip_test.go Adds support for Copilot templates to `pulumi new` (#16825) 2025-01-09 10:14:57 +00:00
workspace.go all: Reformat with gofumpt 2023-03-03 09:00:24 -08:00