Skip to content

Commit

Permalink
remove render from each struct and have the consumer method renderZen…
Browse files Browse the repository at this point in the history
…deskHTML figure out the right tempalte and right struct to use
  • Loading branch information
dikhan committed Jul 1, 2020
1 parent b681aa8 commit 5851a21
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 40 deletions.
Expand Up @@ -24,19 +24,19 @@ func (t TerraformProviderDocumentation) renderZendeskHTML(w io.Writer, tableOfCo
if err != nil {
return err
}
err = t.ProviderInstallation.Render(w, providerInstallationTemplate)
err = Render(w, "ProviderInstallation", providerInstallationTemplate, t.ProviderInstallation)
if err != nil {
return err
}
err = t.ProviderConfiguration.Render(w, providerConfigurationTemplate)
err = Render(w, "ProviderConfiguration", providerConfigurationTemplate, t.ProviderConfiguration)
if err != nil {
return err
}
err = t.ProviderResources.Render(w, providerResourcesConfiguration)
err = Render(w, "ProviderResources", providerResourcesConfiguration, t.ProviderResources)
if err != nil {
return err
}
err = t.DataSources.Render(w, providerDatSourcesTemplate)
err = Render(w, "DataSources", providerDatSourcesTemplate, t.DataSources)
if err != nil {
return err
}
Expand Down
@@ -1,9 +1,5 @@
package openapi_terraform_docs_generator

import (
"io"
)

// ProviderConfiguration defines the details needed to properly configure the Terraform provider
type ProviderConfiguration struct {
// ProviderName is the name of the provider
Expand All @@ -13,8 +9,3 @@ type ProviderConfiguration struct {
ExampleUsage []ExampleUsage
ArgumentsReference ArgumentsReference
}

// Render renders into the input writer the ProviderInstallation documentation formatted in HTML
func (t ProviderConfiguration) Render(w io.Writer, template string) error {
return Render(w, "ProviderConfiguration", template, t)
}
@@ -1,9 +1,5 @@
package openapi_terraform_docs_generator

import (
"io"
)

// DataSources defines the data sources and data source instances exposed by the Terraform provider
type DataSources struct {
// ProviderName is the name of the provider
Expand All @@ -12,11 +8,6 @@ type DataSources struct {
DataSourceInstances []DataSource
}

// Render renders into the input writer the DataSources documentation formatted in HTML
func (t DataSources) Render(w io.Writer, template string) error {
return Render(w, "DataSources", template, t)
}

// DataSource defines the attributes to generate documentation for a Terraform provider data source
type DataSource struct {
Name string
Expand Down
@@ -1,9 +1,5 @@
package openapi_terraform_docs_generator

import (
"io"
)

// ProviderInstallation includes details needed to install the Terraform provider plugin
type ProviderInstallation struct {
// ProviderName is the name of the provider
Expand All @@ -15,8 +11,3 @@ type ProviderInstallation struct {
// Other code/commands needed to install/run the provider
OtherCommand string
}

// Render renders into the input writer the ProviderInstallation documentation formatted in HTML
func (t ProviderInstallation) Render(w io.Writer, template string) error {
return Render(w, "ProviderInstallation", template, t)
}
@@ -1,21 +1,12 @@
package openapi_terraform_docs_generator

import (
"io"
)

// ProviderResources defines the resources exposed by the Terraform provider
type ProviderResources struct {
// ProviderName is the name of the provider
ProviderName string
Resources []Resource
}

// Render renders into the input writer the ProviderResources documentation formatted in HTML
func (t ProviderResources) Render(w io.Writer, template string) error {
return Render(w, "ProviderResources", template, t)
}

func (r ProviderResources) ContainsResourcesWithSecretProperties() bool {
for _, resource := range r.Resources {
for _, prop := range resource.Properties {
Expand Down

0 comments on commit 5851a21

Please sign in to comment.