pulumi/pkg/codegen
Zaid Ajaj ebf838e02e
[go] Allow output-versioned invokes to resolve and maintain secrets (#17132)
Partially addressing #12710

### Description

This PR extends Go SDK-gen, specifically for output-versioned invokes
such that they no longer rely on the plain invokes for their function
body.

We do this by implementing and using a sdk function `InvokePackageRaw`
which is similar to `InvokePackage` except that it doesn't fail on
secrets and actually returns a boolean indicating whether the invoke
response contained any secrets. This way, the generated output-versioned
invokes can immediately wrap the response as a secret if necessary and
more importantly, not failing immediately if the response contained
secrets.

The sdk-gen test `output-funcs` actually do a runtime test for the newly
generated function body and it passes. ~~However, I don't think it
covers the _if secret then wrap as secret_ path~~ but maybe that's
acceptable because it's a simple one liner
```go
// <invoke function body ommited here>
if secret {
  return pulumi.ToSecret(output).(FuncResultOutput), nil
}
```
Follow-up PRs with less priority:
 - [x] A proper test for invokes with secrets in their response
 - [ ] A conformance test
- [ ] Doing the same for _generic_ output-versioned invokes to let them
maintain secretness

### EDIT
Updated the test in output-funcs such that it now returns a response for
an invoke containing secrets
2024-09-09 12:57:43 +00:00
..
cgstrings Enable goheader rule and add missing license headers (#15473) 2024-09-09 12:05:45 +00:00
convert Normalize plugin.Provider methods to (Context, Request) -> (Response, error) (#16302) 2024-06-07 19:47:49 +00:00
docs Enable goheader rule and add missing license headers (#15473) 2024-09-09 12:05:45 +00:00
dotnet Enable goheader rule and add missing license headers (#15473) 2024-09-09 12:05:45 +00:00
gen_program_test all: Reformat with gofumpt 2023-03-03 09:00:24 -08:00
go [go] Allow output-versioned invokes to resolve and maintain secrets (#17132) 2024-09-09 12:57:43 +00:00
hcl2 Enable goheader rule and add missing license headers (#15473) 2024-09-09 12:05:45 +00:00
nodejs Enable goheader rule and add missing license headers (#15473) 2024-09-09 12:05:45 +00:00
pcl Enable goheader rule and add missing license headers (#15473) 2024-09-09 12:05:45 +00:00
python Enable goheader rule and add missing license headers (#15473) 2024-09-09 12:05:45 +00:00
report Enable goheader rule and add missing license headers (#15473) 2024-09-09 12:05:45 +00:00
schema Enable goheader rule and add missing license headers (#15473) 2024-09-09 12:05:45 +00:00
testing Enable goheader rule and add missing license headers (#15473) 2024-09-09 12:05:45 +00:00
README.md Document code generation concepts (#17162) 2024-09-05 13:12:59 +00:00
docs.go Support "lifting" single-valued method returns to their return type (#8111) 2021-10-01 11:33:02 -07:00
docs_test.go ci: radical idea - what if slow tests & no stdout makes GH consider runner dead? 2022-03-06 14:52:13 -08:00
programs.md Document code generation concepts (#17162) 2024-09-05 13:12:59 +00:00
sdks.md Document code generation concepts (#17162) 2024-09-05 13:12:59 +00:00
utilities.go Use slice.Prealloc instead of make([]T, 0, ...) 2023-06-29 11:27:50 +01:00
utilities_test.go ci: radical idea - what if slow tests & no stdout makes GH consider runner dead? 2022-03-06 14:52:13 -08:00
utilities_types.go Enable goheader rule and add missing license headers (#15473) 2024-09-09 12:05:45 +00:00

README.md

(codegen)= (crosscode)=

Code generation

Code generation is essential to Pulumi's ability to support both a variety of programming languages and a variety of cloud providers. This package defines the core components of Pulumi's code generation functionality (known as Pulumi CrossCode). At a high level, code generation is used to manage three categories of output: SDKs, programs, and documentation. At a lower level, these all make use of a number of shared concepts such as schema and Pulumi Configuration Language (PCL).

:::{toctree} :maxdepth: 1 :titlesonly:

/pkg/codegen/sdks.md /pkg/codegen/programs.md /pkg/codegen/docs/README /pkg/codegen/schema/README /pkg/codegen/pcl/README :::