* Make `async:true` the default for `invoke` calls (#3750) * Switch away from native grpc impl. (#3728) * Remove usage of the 'deasync' library from @pulumi/pulumi. (#3752) * Only retry as long as we get unavailable back. Anything else continues. (#3769) * Handle all errors for now. (#3781) * Do not assume --yes was present when using pulumi in non-interactive mode (#3793) * Upgrade all paths for sdk and pkg to v2 * Backport C# invoke classes and other recent gen changes (#4288) Adjust C# generation * Replace IDeployment with a sealed class (#4318) Replace IDeployment with a sealed class * .NET: default to args subtype rather than Args.Empty (#4320) * Adding system namespace for Dotnet code gen This is required for using Obsolute attributes for deprecations ``` Iam/InstanceProfile.cs(142,10): error CS0246: The type or namespace name 'ObsoleteAttribute' could not be found (are you missing a using directive or an assembly reference?) [/Users/stack72/code/go/src/github.com/pulumi/pulumi-aws/sdk/dotnet/Pulumi.Aws.csproj] Iam/InstanceProfile.cs(142,10): error CS0246: The type or namespace name 'Obsolete' could not be found (are you missing a using directive or an assembly reference?) [/Users/stack72/code/go/src/github.com/pulumi/pulumi-aws/sdk/dotnet/Pulumi.Aws.csproj] ``` * Fix the nullability of config type properties in C# codegen (#4379) |
||
---|---|---|
.. | ||
templates | ||
.gitignore | ||
bundler.go | ||
gen.go | ||
gen_function.go | ||
gen_kubernetes.go | ||
gen_test.go | ||
README.md | ||
utils.go | ||
utils_test.go |
Docs generator
This generator generates resource-level docs by utilizing the Pulumi schema.
Crash course on templates
The templates use Go's built-in html/template
package to process templates with data. The driver for this doc generator (e.g. tfbridge for TF-based providers) then persists each file from memory onto the disk as .md
files.
Although we are using the html/template
package, it has the same exact interface as the text/template
package, except for some HTML specific things. Therefore, all of the functions available in the text/template
package are also available with the html/template
package.
- Data can be injected using
{{.PropertyName}}
. - Nested properties can be accessed using the dot notation, i.e.
{{.Property1.Property2}}
. - Templates can inject other templates using the
{{template "template_name"}}
directive.- For this to work, you will need to first define the named template using
{{define "template_name"}}
.
- For this to work, you will need to first define the named template using
- You can pass data to nested templates by simply passing an argument after the template's name.
- To remove whitespace from injected values, use the
-
in the template tags.- For example,
{{if .SomeBool}} some text {{- else}} some other text {{- end}}
. Note the use of-
to eliminate whitespace from the enclosing text. - Read more here.
- For example,
- To render un-encoded content use the custom global function
htmlSafe
.- Note: This should only be used if you know for sure you are not injecting any user-generated content, as it by-passes the HTML encoding.
- To print regular strings, that share the same syntax as the Go templating engine, use the built-in global function
print
function.- For example, if you need to render
{{% md %}}
, you will instead need to do{{print "{{% md %}}"}}
.
- For example, if you need to render
Learn more from here: https://curtisvermeeren.github.io/2017/09/14/Golang-Templates-Cheatsheet
bundler.go
This file contains a main
function and is part of the main
package. We run it using the go generate
command (see the Makefile
and the starting comment in pkg/codegen/gen.go
).
This file is ignored using a
+build ignore
comment at the top of the file, so it is not ignored during ago build ...
.
packaged.go
A file generated by bundler.go
that contains formatted byte strings, that represent the string templates from the ./templates/
folder. This file is also git-ignored as it is intended to only be generated by the docs
repo and is not used during runtime of the main Pulumi CLI. In fact, this whole package is not used during the runtime of the CLI itself.
go:generate
Read more here.
go:generate
is a special code comment that can be used to run custom commands by simply running go generate <package>
, which then scans for go:generate
comments in all sources in the package <package>
. It also serves as a way to document, that a certain file relies on a command to have been executed before it can be used.