pulumi/sdk/go/common
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
..
apitype Move EscEnvironmentMetadata to apitype (#17720) 2024-11-08 14:32:13 +00:00
constant Enable goheader rule and add missing license headers (#15473) 2024-09-09 12:05:45 +00:00
diag allow InputPropertyErrors from Calls (#17567) 2024-11-07 09:56:04 +00:00
encoding all: Reformat with gofumpt 2023-03-03 09:00:24 -08:00
env Enable Copilot link by default (#17293) 2024-09-20 01:15:16 +00:00
promise Add tests to sdk/go/common/promise for coverage (#17197) 2024-09-08 21:07:08 +00:00
resource Fix nil access violation in plugin.Close (#18090) 2024-12-28 13:01:04 +00:00
slice Nit: Use slice.Prealloc in slice.Map and slice.MapError (#17631) 2024-10-29 15:35:55 +00:00
tail fix race condition in tail better (#18066) 2024-12-18 12:10:53 +00:00
testing Move `sdk/go/common/tools/path` to `pkg` (#17898) 2024-12-02 17:13:30 +00:00
tokens Enable some more linting rules (#17456) 2024-10-03 17:37:13 +00:00
util unflake unhandledInterrupt test (#18075) 2024-12-19 11:59:02 +00:00
version move pkg/version -> sdk/go/common/version 2020-03-18 15:25:25 -07:00
workspace Adds support for Copilot templates to `pulumi new` (#16825) 2025-01-09 10:14:57 +00:00