-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Exclude code choosers in SDKs (#1887)
Right now, we generate code blocks for the schema that look like this: <!--Start PulumiCodeChooser --> ```typescript // TS Code ``` ```python # Python Code ``` ... <!--End PulumiCodeChooser --> That works great in the registry. For SDKs, we generate code that looks like this: ```python # <!--Start PulumiCodeChooser --> # ```python # # Python Code # ``` # <!--End PulumiCodeChooser --> ``` This is not good, since our users see our PulumiCodeChooser directives directly. This PR changes the bridge's behavior to only emit the PulumiCodeChooser directives when we are targeting the schema.
- Loading branch information
Showing
4 changed files
with
482 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
275 changes: 275 additions & 0 deletions
275
pkg/tfgen/test_data/convertExamples/golang_wavefront_dashboard_json.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,275 @@ | ||
Provides a Wavefront Dashboard JSON resource. This allows dashboards to be created, updated, and deleted. | ||
|
||
## Example Usage | ||
|
||
```hcl | ||
resource "wavefront_dashboard_json" "test_dashboard_json" { | ||
dashboard_json = <<-EOF | ||
{ | ||
"acl": { | ||
"canModify": [ | ||
"group-uuid", | ||
"role-uuid" | ||
], | ||
"canView": [ | ||
"group-uuid", | ||
"role-uuid" | ||
] | ||
}, | ||
"name": "Terraform Test Dashboard Json", | ||
"description": "a", | ||
"eventFilterType": "BYCHART", | ||
"eventQuery": "", | ||
"defaultTimeWindow": "", | ||
"url": "tftestimport", | ||
"displayDescription": false, | ||
"displaySectionTableOfContents": true, | ||
"displayQueryParameters": false, | ||
"sections": [ | ||
{ | ||
"name": "section 1", | ||
"rows": [ | ||
{ | ||
"charts": [ | ||
{ | ||
"name": "chart 1", | ||
"sources": [ | ||
{ | ||
"name": "source 1", | ||
"query": "ts()", | ||
"scatterPlotSource": "Y", | ||
"querybuilderEnabled": false, | ||
"sourceDescription": "" | ||
} | ||
], | ||
"units": "someunit", | ||
"base": 0, | ||
"noDefaultEvents": false, | ||
"interpolatePoints": false, | ||
"includeObsoleteMetrics": false, | ||
"description": "This is chart 1, showing something", | ||
"chartSettings": { | ||
"type": "markdown-widget", | ||
"max": 100, | ||
"expectedDataSpacing": 120, | ||
"windowing": "full", | ||
"windowSize": 10, | ||
"autoColumnTags": false, | ||
"columnTags": "deprecated", | ||
"tagMode": "all", | ||
"numTags": 2, | ||
"customTags": [ | ||
"tag1", | ||
"tag2" | ||
], | ||
"groupBySource": true, | ||
"y1Max": 100, | ||
"y1Units": "units", | ||
"y0ScaleSIBy1024": true, | ||
"y1ScaleSIBy1024": true, | ||
"y0UnitAutoscaling": true, | ||
"y1UnitAutoscaling": true, | ||
"fixedLegendEnabled": true, | ||
"fixedLegendUseRawStats": true, | ||
"fixedLegendPosition": "RIGHT", | ||
"fixedLegendDisplayStats": [ | ||
"stat1", | ||
"stat2" | ||
], | ||
"fixedLegendFilterSort": "TOP", | ||
"fixedLegendFilterLimit": 1, | ||
"fixedLegendFilterField": "CURRENT", | ||
"plainMarkdownContent": "markdown content" | ||
}, | ||
"chartAttributes": { | ||
"dashboardLinks": { | ||
"*": { | ||
"variables": { | ||
"xxx": "xxx" | ||
}, | ||
"destination": "/dashboards/xxxx" | ||
} | ||
} | ||
}, | ||
"summarization": "MEAN" | ||
} | ||
], | ||
"heightFactor": 50 | ||
} | ||
] | ||
} | ||
], | ||
"parameterDetails": { | ||
"param": { | ||
"hideFromView": false, | ||
"description": null, | ||
"allowAll": null, | ||
"tagKey": null, | ||
"queryValue": null, | ||
"dynamicFieldType": null, | ||
"reverseDynSort": null, | ||
"parameterType": "SIMPLE", | ||
"label": "test", | ||
"defaultValue": "Label", | ||
"valuesToReadableStrings": { | ||
"Label": "test" | ||
}, | ||
"selectedLabel": "Label", | ||
"value": "test" | ||
} | ||
}, | ||
"tags": { | ||
"customerTags": [ | ||
"terraform" | ||
] | ||
} | ||
} | ||
EOF | ||
} | ||
``` | ||
|
||
* | ||
*Note: | ||
** If there are dynamic variables in the Wavefront dashboard json, then these variables must be present in a separate file as mentioned in the section below. | ||
|
||
## Reading from an External File | ||
|
||
Below is the example dashboard with sections and parameters from an external file. | ||
|
||
```hcl | ||
resource "wavefront_dashboard_json" "test_dashboard_json" { | ||
dashboard_json = templatefile("./<dashboard_file_path>.txt", | ||
{ | ||
section1 = file("<path>/section1.json"), | ||
section2 = file("<path>/section2.json"), | ||
parameters = file("<path>/params.json") | ||
} | ||
) | ||
} | ||
``` | ||
|
||
The sample files are listed below. | ||
|
||
* dashboard_file.txt | ||
|
||
```hcl | ||
{ | ||
"name": "Terraform Test Dashboard JSON", | ||
"description": "a", | ||
"eventFilterType": "BYCHART", | ||
"eventQuery": "", | ||
"defaultTimeWindow": "", | ||
"url": "tftestimport", | ||
"displayDescription": false, | ||
"displaySectionTableOfContents": true, | ||
"displayQueryParameters": false, | ||
"sections": [ | ||
${section1}, | ||
${section2} | ||
], | ||
"parameterDetails": ${parameters}, | ||
"tags": { | ||
"customerTags": ["terraform"] | ||
} | ||
} | ||
``` | ||
|
||
* section1.json | ||
|
||
```json | ||
{ | ||
"name": "section 1", | ||
"rows": [ | ||
{ | ||
"charts": [ | ||
{ | ||
"name": "chart 1", | ||
"sources": [ | ||
{ | ||
"name": "source 1", | ||
"query": "ts()", | ||
"scatterPlotSource": "Y", | ||
"querybuilderEnabled": false, | ||
"sourceDescription": "" | ||
} | ||
], | ||
"units": "someunit", | ||
"base": 0, | ||
"noDefaultEvents": false, | ||
"interpolatePoints": false, | ||
"includeObsoleteMetrics": false, | ||
"description": "This is chart 1, showing something", | ||
"chartSettings": { | ||
"type": "markdown-widget", | ||
"max": 100, | ||
"expectedDataSpacing": 120, | ||
"windowing": "full", | ||
"windowSize": 10, | ||
"autoColumnTags": false, | ||
"columnTags": "deprecated", | ||
"tagMode": "all", | ||
"numTags": 2, | ||
"customTags": [ | ||
"tag1", | ||
"tag2" | ||
], | ||
"groupBySource": true, | ||
"y1Max": 100, | ||
"y1Units": "units", | ||
"y0ScaleSIBy1024": true, | ||
"y1ScaleSIBy1024": true, | ||
"y0UnitAutoscaling": true, | ||
"y1UnitAutoscaling": true, | ||
"fixedLegendEnabled": true, | ||
"fixedLegendUseRawStats": true, | ||
"fixedLegendPosition": "RIGHT", | ||
"fixedLegendDisplayStats": [ | ||
"stat1", | ||
"stat2" | ||
], | ||
"fixedLegendFilterSort": "TOP", | ||
"fixedLegendFilterLimit": 1, | ||
"fixedLegendFilterField": "CURRENT", | ||
"plainMarkdownContent": "markdown content" | ||
}, | ||
"summarization": "MEAN" | ||
} | ||
], | ||
"heightFactor": 50 | ||
} | ||
] | ||
} | ||
``` | ||
|
||
* parameters.json | ||
|
||
```json | ||
{ | ||
"param": { | ||
"hideFromView": false, | ||
"description": null, | ||
"allowAll": null, | ||
"tagKey": null, | ||
"queryValue": null, | ||
"dynamicFieldType": null, | ||
"reverseDynSort": null, | ||
"parameterType": "SIMPLE", | ||
"label": "test", | ||
"defaultValue": "Label", | ||
"valuesToReadableStrings": { | ||
"Label": "test" | ||
}, | ||
"selectedLabel": "Label", | ||
"value": "test" | ||
} | ||
} | ||
``` | ||
|
||
## Import | ||
|
||
Dashboard JSON can be imported by using the `id`, e.g.: | ||
|
||
```sh | ||
$ pulumi import wavefront:index/dashboardJson:DashboardJson dashboard_json tftestimport | ||
``` |
Oops, something went wrong.