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

Add installation docs #114

Merged
merged 6 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .ci-mgmt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ actions:
run: |
cd provider && go test -v -json -count=1 -cover -timeout 2h -tags=${{ matrix.language }} -parallel 4 . 2>&1 | tee /tmp/gotest.log | gotestfmt
pulumiConvert: 1
registryDocs: true

4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,10 @@ build_python: .make/build_python
@touch $@
.PHONY: generate_python build_python

# Run the bridge's registry-docs command to generated the content of the installation docs/ folder at provider repo root
build_registry_docs:
$(WORKING_DIR)/bin/$(TFGEN) registry-docs --out $(WORKING_DIR)/docs

clean:
rm -rf sdk/{dotnet,nodejs,go,python}
rm -rf bin/*
Expand Down
132 changes: 128 additions & 4 deletions docs/_index.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,132 @@
---
title: Cisco Catalyst SD-WAN
meta_desc: Provides an overview of the Cisco Catalyst SD-WAN Provider for Pulumi.
layout: overview
# *** WARNING: This file was auto-generated. Do not edit by hand unless you're certain you know what you are doing! ***
title: Cisco Catalyst SD-WAN Provider
meta_desc: Provides an overview on how to configure the Pulumi Cisco Catalyst SD-WAN provider.
layout: package
---
## Installation

A Pulumi package for resources to interact with a Cisco Catalyst SD-WAN environment.
The Cisco Catalyst SD-WAN provider is available as a package in all Pulumi languages:

* JavaScript/TypeScript: [`@pulumi/sdwan`](https://www.npmjs.com/package/@pulumi/sdwan)
* Python: [`pulumi-sdwan`](https://pypi.org/project/pulumi-sdwan/)
* Go: [`github.com/pulumi/pulumi-sdwan/sdk/go/sdwan`](https://github.com/pulumi/pulumi-sdwan)
* .NET: [`Pulumi.Sdwan`](https://www.nuget.org/packages/Pulumi.Sdwan)
* Java: [`com.pulumi/sdwan`](https://central.sonatype.com/artifact/com.pulumi/sdwan)
## Overview

The SDWAN provider provides resources to interact with a Cisco Catalyst SD-WAN environment. It communicates with the SD-WAN Manager via the REST API.

All resources and functions have been tested with the following releases.

| Platform | Version |
|-----------------|---------|
| Catalyst SD-WAN | 20.9 |
| Catalyst SD-WAN | 20.12 |
## Example Usage

{{< chooser language "typescript,python,go,csharp,java,yaml" >}}
{{% choosable language typescript %}}
```yaml
# Pulumi.yaml provider configuration file
name: configuration-example
runtime: nodejs
config:
sdwan:password:
value: password
sdwan:url:
value: https://10.1.1.1
sdwan:username:
value: admin

```

{{% /choosable %}}
{{% choosable language python %}}
```yaml
# Pulumi.yaml provider configuration file
name: configuration-example
runtime: python
config:
sdwan:password:
value: password
sdwan:url:
value: https://10.1.1.1
sdwan:username:
value: admin

```

{{% /choosable %}}
{{% choosable language csharp %}}
```yaml
# Pulumi.yaml provider configuration file
name: configuration-example
runtime: dotnet
config:
sdwan:password:
value: password
sdwan:url:
value: https://10.1.1.1
sdwan:username:
value: admin

```

{{% /choosable %}}
{{% choosable language go %}}
```yaml
# Pulumi.yaml provider configuration file
name: configuration-example
runtime: go
config:
sdwan:password:
value: password
sdwan:url:
value: https://10.1.1.1
sdwan:username:
value: admin

```

{{% /choosable %}}
{{% choosable language yaml %}}
```yaml
# Pulumi.yaml provider configuration file
name: configuration-example
runtime: yaml
config:
sdwan:password:
value: password
sdwan:url:
value: https://10.1.1.1
sdwan:username:
value: admin

```

{{% /choosable %}}
{{% choosable language java %}}
```yaml
# Pulumi.yaml provider configuration file
name: configuration-example
runtime: java
config:
sdwan:password:
value: password
sdwan:url:
value: https://10.1.1.1
sdwan:username:
value: admin

```

{{% /choosable %}}
{{< /chooser >}}
## Configuration Reference

- `insecure` (Boolean) Allow insecure HTTPS client. This can also be set as the `SDWAN_INSECURE` environment variable. Defaults to `true`.
- `password` (String, Sensitive) Password for the SD-WAN Manager account. This can also be set as the `SDWAN_PASSWORD` environment variable.
- `retries` (Number) Number of retries for REST API calls. This can also be set as the `SDWAN_RETRIES` environment variable. Defaults to `3`.
- `url` (String) URL of the Cisco SD-WAN Manager device. This can also be set as the `SDWAN_URL` environment variable.
- `username` (String) Username for the SD-WAN Manager account. This can also be set as the `SDWAN_USERNAME` environment variable.
29 changes: 29 additions & 0 deletions provider/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package provider

import (
"bytes"
"context"
"fmt"
"path/filepath"
Expand All @@ -27,6 +28,7 @@ import (
pf "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/pf/tfbridge"
"github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge"
tfbridgetokens "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge/tokens"
"github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen"
"github.com/pulumi/pulumi/sdk/v3/go/common/resource"

"github.com/pulumi/pulumi-sdwan/provider/pkg/version"
Expand Down Expand Up @@ -83,6 +85,7 @@ func Provider() tfbridge.ProviderInfo {
TFProviderVersion: "0.4.1",
Version: version.Version,
Config: map[string]*tfbridge.SchemaInfo{},
DocRules: &tfbridge.DocRuleInfo{EditRules: docEditRules},
Resources: map[string]*tfbridge.ResourceInfo{
"sdwan_activate_centralized_policy": {ComputeID: StaticID("sdwan:activateCentralizedPolicy")},
"sdwan_attach_feature_device_template": {ComputeID: StaticID("sdwan:attachFeatureDeviceTemplate")},
Expand Down Expand Up @@ -140,3 +143,29 @@ func Provider() tfbridge.ProviderInfo {

return prov
}

func docEditRules(defaults []tfbridge.DocsEdit) []tfbridge.DocsEdit {
return append(
defaults,
trimWhitespace,
skipGettingStartedSection,
)
}

// Removes a blank line at the beginning of the doc
var trimWhitespace = tfbridge.DocsEdit{
Path: "index.md",
Edit: func(_ string, content []byte) ([]byte, error) {
return bytes.TrimSpace(content), nil
},
}

// Strips an upstream Getting Started section
var skipGettingStartedSection = tfbridge.DocsEdit{
Path: "index.md",
Edit: func(_ string, content []byte) ([]byte, error) {
return tfgen.SkipSectionByHeaderContent(content, func(headerText string) bool {
return headerText == "Getting Started"
})
},
}
Loading