github.com/cdmixer/woolloomooloo@v0.1.0/pkg/codegen/docs/templates/resource.tmpl (about) 1 {{ template "header" .Header }} 2 3 {{ htmlSafe "<!-- WARNING: this file was generated by" }} {{ .Tool }}. {{ htmlSafe "-->" }} 4 {{ htmlSafe "<!-- Do not edit by hand unless you're certain you know what you are doing! -->" }} 5 6 {{- if .DeprecationMessage }} 7 <p class="resource-deprecated">Deprecated: {{ print "{{% md %}}" -}}{{- .DeprecationMessage -}}{{- print "{{% /md %}}" -}}</p> 8 {{- end }} 9 10 {{ htmlSafe .Comment }} 11 {{- if ne (len .ExamplesSection) 0 }} 12 {{ template "examples" .ExamplesSection }} 13 {{- end }} 14 15 <!-- Create resource --> 16 ## Create a {{ .Header.Title }} Resource {#create} 17 18 {{- if eq .LangChooserLanguages "" }} 19 {{ htmlSafe "{{< chooser language \"typescript,python,go,csharp\" / >}}" }} 20 {{- else }} 21 {{ htmlSafe "{{< chooser language \"" }}{{ .LangChooserLanguages }}{{ htmlSafe "\" / >}}" }} 22 {{- end }} 23 24 {{/* 25 Render the specific snippet to construct the resource, e.g. 26 "new Bucket(name: string, args?: BucketArgs, opts?: pulumi.ResourceOptions);" 27 "def Bucket(resource_name, opts=None, acceleration_status=None, ..." 28 */}} 29 {{ htmlSafe "{{% choosable language nodejs %}}" }} 30 <div class="highlight"><pre class="chroma"><code class="language-typescript" data-lang="typescript"><span class="k">new </span>{{ template "linkify_param" .ConstructorResource.nodejs }}<span class="p">(</span>{{ htmlSafe .ConstructorParams.nodejs }}<span class="p">);</span></code></pre></div> 31 {{ htmlSafe "{{% /choosable %}}" }} 32 33 {{ htmlSafe "{{% choosable language python %}}" }} 34 <div class="highlight"><pre class="chroma"><code class="language-python" data-lang="python"><span class="k">def </span>{{ template "linkify_param" .ConstructorResource.python }}<span class="p">(</span><span class="nx">resource_name</span><span class="p">:</span> <span class="nx">str</span><span class="p">, </span>{{ htmlSafe .ConstructorParams.python }}<span class="p">)</span></code></pre></div> 35 {{ htmlSafe "{{% /choosable %}}" }} 36 37 {{ htmlSafe "{{% choosable language go %}}" }} 38 <div class="highlight"><pre class="chroma"><code class="language-go" data-lang="go"><span class="k">func </span>{{ template "linkify_go_param" .ConstructorResource.go }}<span class="p">(</span>{{ htmlSafe .ConstructorParams.go }}<span class="p">) (*{{ template "linkify_param" .ConstructorResource.go }}, error)</span></code></pre></div> 39 {{ htmlSafe "{{% /choosable %}}" }} 40 41 {{ htmlSafe "{{% choosable language csharp %}}" }} 42 <div class="highlight"><pre class="chroma"><code class="language-csharp" data-lang="csharp"><span class="k">public </span>{{ template "linkify_param" .ConstructorResource.csharp }}<span class="p">(</span>{{ htmlSafe .ConstructorParams.csharp }}<span class="p">)</span></code></pre></div> 43 {{ htmlSafe "{{% /choosable %}}" }} 44 45 {{ htmlSafe "{{% choosable language nodejs %}}" }} 46 {{ template "constructor_args" .ConstructorParamsTyped.nodejs }} 47 {{ htmlSafe "{{% /choosable %}}" }} 48 49 {{ htmlSafe "{{% choosable language python %}}" }} 50 {{/* 51 Constructing resources in python uses a different approach, which is why 52 we don't use the "constructor_args" and just hard-code two params here. 53 */}} 54 <dl class="resources-properties"> 55 <dt class="property-required" title="Required"> 56 <span>resource_name</span> 57 <span class="property-indicator"></span> 58 <span class="property-type">str</span> 59 </dt> 60 <dd>The unique name of the resource.</dd> 61 <dt class="property-optional" title="Optional"> 62 <span>opts</span> 63 <span class="property-indicator"></span> 64 <span class="property-type"> 65 <a href="/docs/reference/pkg/python/pulumi/#pulumi.ResourceOptions">ResourceOptions</a> 66 </span> 67 </dt> 68 <dd>A bag of options that control this resource's behavior.</dd> 69 </dl> 70 {{ htmlSafe "{{% /choosable %}}" }} 71 72 {{ htmlSafe "{{% choosable language go %}}" }} 73 {{ template "constructor_args" .ConstructorParamsTyped.go }} 74 {{ htmlSafe "{{% /choosable %}}" }} 75 76 {{ htmlSafe "{{% choosable language csharp %}}" }} 77 {{ template "constructor_args" .ConstructorParamsTyped.csharp }} 78 {{ htmlSafe "{{% /choosable %}}" }} 79 80 ## {{ .Header.Title }} Resource Properties {#properties} 81 82 To learn more about resource properties and how to use them, see [Inputs and Outputs]({{ htmlSafe "{{< relref \"/docs/intro/concepts/programming-model#outputs\" >}}" }}) in the Programming Model docs. 83 84 ### Inputs 85 86 The {{ .Header.Title }} resource accepts the following [input]({{ htmlSafe "{{< relref \"/docs/intro/concepts/programming-model#outputs\" >}}" }}) properties: 87 88 {{ template "properties" .InputProperties }} 89 90 <!-- Output properties --> 91 ### Outputs 92 93 All [input](#inputs) properties are implicitly available as output properties. Additionally, the {{ .Header.Title }} resource produces the following output properties: 94 95 {{ template "properties" .OutputProperties }} 96 97 <!-- Read resource --> 98 {{ if ne (len .StateInputs) 0 }} 99 ## Look up an Existing {{.Header.Title}} Resource {#look-up} 100 101 Get an existing {{.Header.Title}} resource's state with the given name, ID, and optional extra properties used to qualify the lookup. 102 103 {{- if eq .LangChooserLanguages "" }} 104 {{ htmlSafe "{{< chooser language \"typescript,python,go,csharp\" / >}}" }} 105 {{- else }} 106 {{ htmlSafe "{{< chooser language \"" }}{{ .LangChooserLanguages }}{{ htmlSafe "\" / >}}" }} 107 {{- end }} 108 109 {{ htmlSafe "{{% choosable language nodejs %}}" }} 110 <div class="highlight"><pre class="chroma"><code class="language-typescript" data-lang="typescript"><span class="k">public static </span><span class="nf">get</span><span class="p">(</span>{{ htmlSafe .LookupParams.nodejs }}<span class="p">): </span>{{ template "linkify_param" .ConstructorResource.nodejs }}</code></pre></div> 111 {{ htmlSafe "{{% /choosable %}}" }} 112 113 {{ htmlSafe "{{% choosable language python %}}" }} 114 <div class="highlight"><pre class="chroma"><code class="language-python" data-lang="python"><span class=nd>@staticmethod</span> 115 <span class="k">def </span><span class="nf">get</span><span class="p">(</span><span class="nx">resource_name</span><span class="p">:</span> <span class="nx">str</span><span class="p">, </span><span class="nx">id</span><span class="p">:</span> <span class="nx">str</span><span class="p">, </span><span class="nx">opts</span><span class="p">:</span> <span class="nx"><a href="/docs/reference/pkg/python/pulumi/#pulumi.ResourceOptions">Optional[ResourceOptions]</a></span> = None<span class="p">, </span>{{ htmlSafe .LookupParams.python }}<span class="p">) -></span> {{ .ConstructorResource.python.Name }}</code></pre></div> 116 {{ htmlSafe "{{% /choosable %}}" }} 117 118 {{ htmlSafe "{{% choosable language go %}}" }} 119 <div class="highlight"><pre class="chroma"><code class="language-go" data-lang="go"><span class="k">func </span>Get{{ .Header.Title }}<span class="p">(</span>{{ htmlSafe .LookupParams.go }}<span class="p">) (*{{ template "linkify_param" .ConstructorResource.go }}, error)</span></code></pre></div> 120 {{ htmlSafe "{{% /choosable %}}" }} 121 122 {{ htmlSafe "{{% choosable language csharp %}}" }} 123 <div class="highlight"><pre class="chroma"><code class="language-csharp" data-lang="csharp"><span class="k">public static </span>{{ template "linkify_param" .ConstructorResource.csharp }}<span class="nf"> Get</span><span class="p">(</span>{{ htmlSafe .LookupParams.csharp }}<span class="p">)</span></code></pre></div> 124 {{ htmlSafe "{{% /choosable %}}" }} 125 126 {{ htmlSafe "{{% choosable language nodejs %}}" }} 127 {{ template "read_inputs" }} 128 {{ htmlSafe "{{% /choosable %}}" }} 129 130 {{ htmlSafe "{{% choosable language python %}}" }} 131 <dl class="resources-properties"> 132 <dt class="property-required" title="Required"> 133 <span>resource_name</span> 134 <span class="property-indicator"></span> 135 </dt> 136 <dd>The unique name of the resulting resource.</dd> 137 <dt class="property-required" title="Optional"> 138 <span>id</span> 139 <span class="property-indicator"></span> 140 </dt> 141 <dd>The <em>unique</em> provider ID of the resource to lookup.</dd> 142 </dl> 143 {{ htmlSafe "{{% /choosable %}}" }} 144 145 {{ htmlSafe "{{% choosable language go %}}" }} 146 {{ template "read_inputs" }} 147 {{ htmlSafe "{{% /choosable %}}" }} 148 149 {{ htmlSafe "{{% choosable language csharp %}}" }} 150 {{ template "read_inputs" }} 151 {{ htmlSafe "{{% /choosable %}}" }} 152 153 The following state arguments are supported: 154 {{ template "properties" .StateInputs }} 155 156 {{ end }} 157 158 <!-- Supporting types --> 159 {{ if ne (len .NestedTypes) 0 }} 160 161 ## Supporting Types 162 163 {{ range .NestedTypes }} 164 <h4 id="{{ .AnchorID }}">{{ htmlSafe .Name }}</h4> 165 {{ if (hasDocLinksForLang .APIDocLinks "nodejs") -}} 166 {{ htmlSafe "{{% choosable language nodejs %}}" }} 167 > See the {{ if ne .APIDocLinks.nodejs.InputType "" }}<a href="{{ .APIDocLinks.nodejs.InputType }}">input</a>{{ end }} {{ if and (ne .APIDocLinks.nodejs.InputType "") (ne .APIDocLinks.nodejs.OutputType "") }}and{{ end }} {{ if ne .APIDocLinks.nodejs.OutputType "" }}<a href="{{ .APIDocLinks.nodejs.OutputType }}">output</a>{{ end }} API doc for this type. 168 {{ htmlSafe "{{% /choosable %}}" }} 169 {{- end }} 170 171 {{ if (hasDocLinksForLang .APIDocLinks "go") -}} 172 {{ htmlSafe "{{% choosable language go %}}" }} 173 > See the {{ if ne .APIDocLinks.go.InputType "" }}<a href="{{ .APIDocLinks.go.InputType }}">input</a>{{ end }} {{ if and (ne .APIDocLinks.go.InputType "") (ne .APIDocLinks.go.OutputType "") }}and{{ end }} {{ if ne .APIDocLinks.go.OutputType "" }}<a href="{{ .APIDocLinks.go.OutputType }}">output</a>{{ end }} API doc for this type. 174 {{ htmlSafe "{{% /choosable %}}" }} 175 {{- end }} 176 177 {{- if (hasDocLinksForLang .APIDocLinks "csharp") }} 178 {{ htmlSafe "{{% choosable language csharp %}}" }} 179 > See the {{ if ne .APIDocLinks.csharp.InputType "" }}<a href="{{ .APIDocLinks.csharp.InputType }}">input</a>{{ end }} {{ if and (ne .APIDocLinks.csharp.InputType "") (ne .APIDocLinks.csharp.OutputType "") }}and{{ end }} {{ if ne .APIDocLinks.csharp.OutputType "" }}<a href="{{ .APIDocLinks.csharp.OutputType }}">output</a>{{ end }} API doc for this type. 180 {{ htmlSafe "{{% /choosable %}}" }} 181 {{- end }} 182 183 {{ template "properties" .Properties }} 184 {{ end }} 185 186 {{ end }} 187 188 {{ if .ImportDocs }} 189 ## Import 190 {{ htmlSafe .ImportDocs }} 191 {{ end }} 192 193 {{ template "package_details" .PackageDetails }}