Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update some names for registry #11506

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
41 changes: 25 additions & 16 deletions pkg/codegen/docs/gen.go
Expand Up @@ -43,6 +43,7 @@ import (
"github.com/pulumi/pulumi/pkg/v3/codegen/nodejs"
"github.com/pulumi/pulumi/pkg/v3/codegen/python"
"github.com/pulumi/pulumi/pkg/v3/codegen/schema"
"github.com/pulumi/pulumi/sdk/v3/go/common/util/contract"
)

//go:embed templates/*.tmpl
Expand All @@ -61,6 +62,7 @@ func titleLookup(shortName string) (string, bool) {
"alicloud": "Alibaba Cloud",
"auth0": "Auth0",
"aws": "AWS Classic",
"awsx": "AWSx (Pulumi Crosswalk for AWS)",
"aws-apigateway": "AWS API Gateway",
"aws-miniflux": "Miniflux",
"aws-native": "AWS Native",
Expand All @@ -71,20 +73,21 @@ func titleLookup(shortName string) (string, bool) {
"aws-quickstart-vpc": "AWS QuickStart VPC",
"aws-s3-replicated-bucket": "AWS S3 Replicated Bucket",
"azure": "Azure Classic",
"azure-justrun": "Azure Justrun",
"azure-native": "Azure Native",
"azure-quickstart-acr-geo-replication": "Azure QuickStart ACR Geo Replication",
"azure-quickstart-aks": "Azure QuickStart AKS",
"azure-quickstart-compute": "Azure QuickStart Compute",
"azure-quickstart-sql": "Azure QuickStart SQL",
"azuread": "Azure Active Directory",
"azuread": "Azure Active Directory (Azure AD)",
"azuredevops": "Azure DevOps",
"azuresel": "Azure",
"civo": "Civo",
"cloudamqp": "CloudAMQP",
"cloudflare": "Cloudflare",
"cloudinit": "cloud-init",
"confluent": "Confluent Cloud",
"consul": "Consul",
"consul": "HashiCorp Consul",
"coredns-helm": "CoreDNS (Helm)",
"datadog": "Datadog",
"digitalocean": "DigitalOcean",
Expand All @@ -95,7 +98,7 @@ func titleLookup(shortName string) (string, bool) {
"equinix-metal": "Equinix Metal",
"f5bigip": "f5 BIG-IP",
"fastly": "Fastly",
"gcp": "Google Cloud Classic",
"gcp": "Google Cloud (GCP) Classic",
"gcp-global-cloudrun": "Google Global Cloud Run",
"gcp-project-scaffold": "Google Project Scaffolding",
"google-native": "Google Cloud Native",
Expand All @@ -119,7 +122,7 @@ func titleLookup(shortName string) (string, bool) {
"kubernetes-ingress-nginx": "NGINX Ingress Controller (Helm)",
"kubernetes-coredns": "CoreDNS (Helm)",
"kubernetes-cert-manager": "Jetstack Cert Manager (Helm)",
"nomad": "Nomad",
"nomad": "HashiCorp Nomad",
"ns1": "NS1",
"okta": "Okta",
"openstack": "OpenStack",
Expand Down Expand Up @@ -1558,14 +1561,12 @@ func (mod *modContext) genResource(r *schema.Resource) resourceDocArgs {
filteredOutputProps = filterOutputProperties(r.InputProperties, r.Properties)
}

// All custom resources have an implicit `id` output property, that we must inject into the docs.
if !r.IsComponent {
filteredOutputProps = append(filteredOutputProps, &schema.Property{
Name: "id",
Comment: "The provider-assigned unique ID for this managed resource.",
Type: schema.StringType,
})
}
// All resources have an implicit `id` output property, that we must inject into the docs.
filteredOutputProps = append(filteredOutputProps, &schema.Property{
Name: "id",
Comment: "The provider-assigned unique ID for this managed resource.",
Type: schema.StringType,
})
Comment on lines -1561 to +1569
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change needs to be removed from this PR. We should not be including the id property for components. I just recently fixed this in #11469


for _, lang := range dctx.supportedLanguages {
inputProps[lang] = mod.getProperties(r.InputProperties, lang, true, false, r.IsProvider)
Expand Down Expand Up @@ -1691,6 +1692,14 @@ func (mod *modContext) getTypes(member interface{}, types nestedTypeUsageInfo) {
}
}

type fs map[string][]byte

func (fs fs) add(path string, contents []byte) {
_, has := fs[path]
contract.Assertf(!has, "duplicate file: %s", path)
fs[path] = contents
}

Comment on lines +1695 to +1702
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, all the rest of the changes related to fs (including the need to import the contract package at the top of the file) should be removed from this PR. This was a deliberate change in #11312 that shouldn't be reverted.

Copy link
Contributor Author

@susanev susanev Dec 3, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@justinvp I could use your help on Monday. all of these came from what I thought was the right gen command to run, which was obviously wrong.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well nevermind, i started over and its clean, going to close this in favor of #11525

// getModuleFileName returns the file name to use for a module.
func (mod *modContext) getModuleFileName() string {
dctx := mod.docGenContext
Expand All @@ -1706,13 +1715,13 @@ func (mod *modContext) getModuleFileName() string {
return mod.mod
}

func (mod *modContext) gen(fs codegen.Fs) error {
func (mod *modContext) gen(fs fs) error {
dctx := mod.docGenContext
modName := mod.getModuleFileName()

addFile := func(name, contents string) {
p := path.Join(modName, name, "_index.md")
fs.Add(p, []byte(contents))
fs.add(p, []byte(contents))
}

// Resources
Expand Down Expand Up @@ -1751,7 +1760,7 @@ func (mod *modContext) gen(fs codegen.Fs) error {
return err
}

fs.Add(path.Join(modName, "_index.md"), buffer.Bytes())
fs.add(path.Join(modName, "_index.md"), buffer.Bytes())
return nil
}

Expand Down Expand Up @@ -2083,7 +2092,7 @@ func (dctx *docGenContext) generatePackage(tool string, pkg *schema.Package) (ma
defer glog.Flush()

glog.V(3).Infoln("generating package docs now...")
files := codegen.Fs{}
files := fs{}
modules := []string{}
modMap := dctx.modules()
for k := range modMap {
Expand Down
Expand Up @@ -310,37 +310,91 @@ All [input](#inputs) properties are implicitly available as output properties. A

<div>
<pulumi-choosable type="language" values="csharp">
<dl class="resources-properties"></dl>
<dl class="resources-properties"><dt class="property-"
title="">
<span id="id_csharp">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#id_csharp" style="color: inherit; text-decoration: inherit;">Id</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd><p>The provider-assigned unique ID for this managed resource.</p>
</dd></dl>
</pulumi-choosable>
</div>

<div>
<pulumi-choosable type="language" values="go">
<dl class="resources-properties"></dl>
<dl class="resources-properties"><dt class="property-"
title="">
<span id="id_go">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#id_go" style="color: inherit; text-decoration: inherit;">Id</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd><p>The provider-assigned unique ID for this managed resource.</p>
</dd></dl>
</pulumi-choosable>
</div>

<div>
<pulumi-choosable type="language" values="java">
<dl class="resources-properties"></dl>
<dl class="resources-properties"><dt class="property-"
title="">
<span id="id_java">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#id_java" style="color: inherit; text-decoration: inherit;">id</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">String</span>
</dt>
<dd><p>The provider-assigned unique ID for this managed resource.</p>
</dd></dl>
</pulumi-choosable>
</div>

<div>
<pulumi-choosable type="language" values="javascript,typescript">
<dl class="resources-properties"></dl>
<dl class="resources-properties"><dt class="property-"
title="">
<span id="id_nodejs">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#id_nodejs" style="color: inherit; text-decoration: inherit;">id</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd><p>The provider-assigned unique ID for this managed resource.</p>
</dd></dl>
</pulumi-choosable>
</div>

<div>
<pulumi-choosable type="language" values="python">
<dl class="resources-properties"></dl>
<dl class="resources-properties"><dt class="property-"
title="">
<span id="id_python">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#id_python" style="color: inherit; text-decoration: inherit;">id</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">str</span>
</dt>
<dd><p>The provider-assigned unique ID for this managed resource.</p>
</dd></dl>
</pulumi-choosable>
</div>

<div>
<pulumi-choosable type="language" values="yaml">
<dl class="resources-properties"></dl>
<dl class="resources-properties"><dt class="property-"
title="">
<span id="id_yaml">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#id_yaml" style="color: inherit; text-decoration: inherit;">id</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">String</span>
</dt>
<dd><p>The provider-assigned unique ID for this managed resource.</p>
</dd></dl>
</pulumi-choosable>
</div>

Expand Down
Expand Up @@ -325,6 +325,15 @@ All [input](#inputs) properties are implicitly available as output properties. A
<span class="property-type">string</span>
</dt>
<dd><p>The login server url</p>
</dd><dt class="property-"
title="">
<span id="id_csharp">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#id_csharp" style="color: inherit; text-decoration: inherit;">Id</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd><p>The provider-assigned unique ID for this managed resource.</p>
</dd><dt class="property-"
title="">
<span id="registry_csharp">
Expand Down Expand Up @@ -358,6 +367,15 @@ All [input](#inputs) properties are implicitly available as output properties. A
<span class="property-type">string</span>
</dt>
<dd><p>The login server url</p>
</dd><dt class="property-"
title="">
<span id="id_go">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#id_go" style="color: inherit; text-decoration: inherit;">Id</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd><p>The provider-assigned unique ID for this managed resource.</p>
</dd><dt class="property-"
title="">
<span id="registry_go">
Expand Down Expand Up @@ -391,6 +409,15 @@ All [input](#inputs) properties are implicitly available as output properties. A
<span class="property-type">String</span>
</dt>
<dd><p>The login server url</p>
</dd><dt class="property-"
title="">
<span id="id_java">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#id_java" style="color: inherit; text-decoration: inherit;">id</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">String</span>
</dt>
<dd><p>The provider-assigned unique ID for this managed resource.</p>
</dd><dt class="property-"
title="">
<span id="registry_java">
Expand Down Expand Up @@ -424,6 +451,15 @@ All [input](#inputs) properties are implicitly available as output properties. A
<span class="property-type">string</span>
</dt>
<dd><p>The login server url</p>
</dd><dt class="property-"
title="">
<span id="id_nodejs">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#id_nodejs" style="color: inherit; text-decoration: inherit;">id</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">string</span>
</dt>
<dd><p>The provider-assigned unique ID for this managed resource.</p>
</dd><dt class="property-"
title="">
<span id="registry_nodejs">
Expand Down Expand Up @@ -457,6 +493,15 @@ All [input](#inputs) properties are implicitly available as output properties. A
<span class="property-type">str</span>
</dt>
<dd><p>The login server url</p>
</dd><dt class="property-"
title="">
<span id="id_python">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#id_python" style="color: inherit; text-decoration: inherit;">id</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">str</span>
</dt>
<dd><p>The provider-assigned unique ID for this managed resource.</p>
</dd><dt class="property-"
title="">
<span id="registry_python">
Expand Down Expand Up @@ -490,6 +535,15 @@ All [input](#inputs) properties are implicitly available as output properties. A
<span class="property-type">String</span>
</dt>
<dd><p>The login server url</p>
</dd><dt class="property-"
title="">
<span id="id_yaml">
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="#id_yaml" style="color: inherit; text-decoration: inherit;">id</a>
</span>
<span class="property-indicator"></span>
<span class="property-type">String</span>
</dt>
<dd><p>The provider-assigned unique ID for this managed resource.</p>
</dd><dt class="property-"
title="">
<span id="registry_yaml">
Expand Down