Compare commits
10 Commits
feature/ad
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 95ab514e07 | |||
| b86137f0b8 | |||
| e26c78e2c2 | |||
| 467f1bf829 | |||
| f20f803fbe | |||
| 39c8cf0b58 | |||
| 5b1dd07063 | |||
| 7dba96409f | |||
| ef8fbd530b | |||
| 6b7430b67b |
@@ -1,21 +0,0 @@
|
|||||||
# NOTE: This file is for HashiCorp specific licensing automation and can be deleted after creating a new repo with this template.
|
|
||||||
schema_version = 1
|
|
||||||
|
|
||||||
project {
|
|
||||||
license = "MPL-2.0"
|
|
||||||
copyright_year = 2021
|
|
||||||
|
|
||||||
header_ignore = [
|
|
||||||
# examples used within documentation (prose)
|
|
||||||
"examples/**",
|
|
||||||
|
|
||||||
# GitHub issue template configuration
|
|
||||||
".github/ISSUE_TEMPLATE/*.yml",
|
|
||||||
|
|
||||||
# golangci-lint tooling configuration
|
|
||||||
".golangci.yml",
|
|
||||||
|
|
||||||
# GoReleaser tooling configuration
|
|
||||||
".goreleaser.yml",
|
|
||||||
]
|
|
||||||
}
|
|
||||||
33
.gitea/workflows/ci.yaml
Normal file
33
.gitea/workflows/ci.yaml
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
name: CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
pull_request:
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version-file: go.mod
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: go build -v ./...
|
||||||
|
|
||||||
|
- name: Lint
|
||||||
|
uses: golangci/golangci-lint-action@v6
|
||||||
|
with:
|
||||||
|
version: latest
|
||||||
|
|
||||||
|
- name: Test
|
||||||
|
run: go test -race -v ./internal/...
|
||||||
|
|
||||||
|
- name: Check go generate
|
||||||
|
run: |
|
||||||
|
go generate ./...
|
||||||
|
git diff --exit-code || (echo "go generate produced changes; please run 'go generate ./...' and commit" && exit 1)
|
||||||
22
.gitea/workflows/endpoint-sync.yaml
Normal file
22
.gitea/workflows/endpoint-sync.yaml
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
name: Endpoint Sync Check
|
||||||
|
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 9 * * 1'
|
||||||
|
push:
|
||||||
|
paths:
|
||||||
|
- 'openapi.yaml'
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
check-drift:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version-file: go.mod
|
||||||
|
|
||||||
|
- name: Check endpoint drift
|
||||||
|
run: go run ./scripts/check-endpoint-drift.go
|
||||||
46
.gitea/workflows/release.yaml
Normal file
46
.gitea/workflows/release.yaml
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
name: Release
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- 'v*'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version-file: go.mod
|
||||||
|
|
||||||
|
- name: Import GPG key
|
||||||
|
if: ${{ secrets.GPG_PRIVATE_KEY != '' }}
|
||||||
|
id: import_gpg
|
||||||
|
uses: crazy-max/ghaction-import-gpg@v6
|
||||||
|
with:
|
||||||
|
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
|
||||||
|
passphrase: ${{ secrets.PASSPHRASE }}
|
||||||
|
|
||||||
|
- name: Check endpoint drift
|
||||||
|
run: go run ./scripts/check-endpoint-drift.go
|
||||||
|
|
||||||
|
- name: Run GoReleaser (signed)
|
||||||
|
if: ${{ steps.import_gpg.outputs.fingerprint != '' }}
|
||||||
|
uses: goreleaser/goreleaser-action@v6
|
||||||
|
with:
|
||||||
|
args: release --clean
|
||||||
|
env:
|
||||||
|
GITEA_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
||||||
|
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
|
||||||
|
|
||||||
|
- name: Run GoReleaser (unsigned)
|
||||||
|
if: ${{ steps.import_gpg.outputs.fingerprint == '' }}
|
||||||
|
uses: goreleaser/goreleaser-action@v6
|
||||||
|
with:
|
||||||
|
args: release --clean --skip sign
|
||||||
|
env:
|
||||||
|
GITEA_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
||||||
25
.gitea/workflows/version-check.yaml
Normal file
25
.gitea/workflows/version-check.yaml
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
name: Version Check
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- 'main.go'
|
||||||
|
- 'internal/**'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
check-version:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Check version bump
|
||||||
|
run: |
|
||||||
|
BASE_VERSION=$(git show origin/${{ github.base_ref }}:main.go | grep -oP 'version string = "\K[^"]+')
|
||||||
|
HEAD_VERSION=$(grep -oP 'version string = "\K[^"]+' main.go)
|
||||||
|
if [ "$BASE_VERSION" = "$HEAD_VERSION" ]; then
|
||||||
|
echo "::warning::Version in main.go has not been bumped (still ${HEAD_VERSION}). Consider updating it for this release."
|
||||||
|
else
|
||||||
|
echo "Version bumped: ${BASE_VERSION} → ${HEAD_VERSION}"
|
||||||
|
fi
|
||||||
1
.github/CODEOWNERS
vendored
1
.github/CODEOWNERS
vendored
@@ -1 +0,0 @@
|
|||||||
* @hashicorp/terraform-devex
|
|
||||||
5
.github/CODE_OF_CONDUCT.md
vendored
5
.github/CODE_OF_CONDUCT.md
vendored
@@ -1,5 +0,0 @@
|
|||||||
# Code of Conduct
|
|
||||||
|
|
||||||
HashiCorp Community Guidelines apply to you when interacting with the community here on GitHub and contributing code.
|
|
||||||
|
|
||||||
Please read the full text at https://www.hashicorp.com/community-guidelines
|
|
||||||
38
.github/ISSUE_TEMPLATE/bug_report.md
vendored
38
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -1,38 +0,0 @@
|
|||||||
---
|
|
||||||
name: Bug report
|
|
||||||
about: Create a report to help us improve
|
|
||||||
title: ''
|
|
||||||
labels: ''
|
|
||||||
assignees: ''
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
**Describe the bug**
|
|
||||||
A clear and concise description of what the bug is.
|
|
||||||
|
|
||||||
**To Reproduce**
|
|
||||||
Steps to reproduce the behavior:
|
|
||||||
1. Go to '...'
|
|
||||||
2. Click on '....'
|
|
||||||
3. Scroll down to '....'
|
|
||||||
4. See error
|
|
||||||
|
|
||||||
**Expected behavior**
|
|
||||||
A clear and concise description of what you expected to happen.
|
|
||||||
|
|
||||||
**Screenshots**
|
|
||||||
If applicable, add screenshots to help explain your problem.
|
|
||||||
|
|
||||||
**Desktop (please complete the following information):**
|
|
||||||
- OS: [e.g. iOS]
|
|
||||||
- Browser [e.g. chrome, safari]
|
|
||||||
- Version [e.g. 22]
|
|
||||||
|
|
||||||
**Smartphone (please complete the following information):**
|
|
||||||
- Device: [e.g. iPhone6]
|
|
||||||
- OS: [e.g. iOS8.1]
|
|
||||||
- Browser [e.g. stock browser, safari]
|
|
||||||
- Version [e.g. 22]
|
|
||||||
|
|
||||||
**Additional context**
|
|
||||||
Add any other context about the problem here.
|
|
||||||
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
@@ -1,20 +0,0 @@
|
|||||||
---
|
|
||||||
name: Feature request
|
|
||||||
about: Suggest an idea for this project
|
|
||||||
title: ''
|
|
||||||
labels: ''
|
|
||||||
assignees: ''
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
**Is your feature request related to a problem? Please describe.**
|
|
||||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
|
||||||
|
|
||||||
**Describe the solution you'd like**
|
|
||||||
A clear and concise description of what you want to happen.
|
|
||||||
|
|
||||||
**Describe alternatives you've considered**
|
|
||||||
A clear and concise description of any alternative solutions or features you've considered.
|
|
||||||
|
|
||||||
**Additional context**
|
|
||||||
Add any other context or screenshots about the feature request here.
|
|
||||||
8
.github/dependabot.yml
vendored
8
.github/dependabot.yml
vendored
@@ -1,8 +0,0 @@
|
|||||||
# See GitHub's documentation for more information on this file:
|
|
||||||
# https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/configuration-options-for-dependency-updates
|
|
||||||
version: 2
|
|
||||||
updates:
|
|
||||||
- package-ecosystem: "gomod"
|
|
||||||
directory: "/"
|
|
||||||
schedule:
|
|
||||||
interval: "daily"
|
|
||||||
41
.github/workflows/release.yml
vendored
41
.github/workflows/release.yml
vendored
@@ -1,41 +0,0 @@
|
|||||||
# Terraform Provider release workflow.
|
|
||||||
name: Release
|
|
||||||
|
|
||||||
# This GitHub action creates a release when a tag that matches the pattern
|
|
||||||
# "v*" (e.g. v0.1.0) is created.
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- 'v*'
|
|
||||||
|
|
||||||
# Releases need permissions to read and write the repository contents.
|
|
||||||
# GitHub considers creating releases and uploading assets as writing contents.
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
goreleaser:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
|
|
||||||
with:
|
|
||||||
# Allow goreleaser to access older tag information.
|
|
||||||
fetch-depth: 0
|
|
||||||
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
|
|
||||||
with:
|
|
||||||
go-version-file: 'go.mod'
|
|
||||||
cache: true
|
|
||||||
- name: Import GPG key
|
|
||||||
uses: crazy-max/ghaction-import-gpg@72b6676b71ab476b77e676928516f6982eef7a41 # v5.3.0
|
|
||||||
id: import_gpg
|
|
||||||
with:
|
|
||||||
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
|
|
||||||
passphrase: ${{ secrets.PASSPHRASE }}
|
|
||||||
- name: Run GoReleaser
|
|
||||||
uses: goreleaser/goreleaser-action@336e29918d653399e599bfca99fadc1d7ffbc9f7 # v4.3.0
|
|
||||||
with:
|
|
||||||
args: release --clean
|
|
||||||
env:
|
|
||||||
# GitHub sets the GITHUB_TOKEN secret automatically.
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
|
|
||||||
81
.github/workflows/test.yml
vendored
81
.github/workflows/test.yml
vendored
@@ -1,81 +0,0 @@
|
|||||||
# Terraform Provider testing workflow.
|
|
||||||
name: Tests
|
|
||||||
|
|
||||||
# This GitHub action runs your tests for each pull request and push.
|
|
||||||
# Optionally, you can turn it on using a schedule for regular testing.
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
paths-ignore:
|
|
||||||
- 'README.md'
|
|
||||||
push:
|
|
||||||
paths-ignore:
|
|
||||||
- 'README.md'
|
|
||||||
|
|
||||||
# Testing only needs permissions to read the repository contents.
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
# Ensure project builds before running testing matrix
|
|
||||||
build:
|
|
||||||
name: Build
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
timeout-minutes: 5
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
|
|
||||||
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
|
|
||||||
with:
|
|
||||||
go-version-file: 'go.mod'
|
|
||||||
cache: true
|
|
||||||
- run: go mod download
|
|
||||||
- run: go build -v .
|
|
||||||
- name: Run linters
|
|
||||||
uses: golangci/golangci-lint-action@639cd343e1d3b897ff35927a75193d57cfcba299 # v3.6.0
|
|
||||||
with:
|
|
||||||
version: latest
|
|
||||||
|
|
||||||
generate:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
|
|
||||||
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
|
|
||||||
with:
|
|
||||||
go-version-file: 'go.mod'
|
|
||||||
cache: true
|
|
||||||
- run: go generate ./...
|
|
||||||
- name: git diff
|
|
||||||
run: |
|
|
||||||
git diff --compact-summary --exit-code || \
|
|
||||||
(echo; echo "Unexpected difference in directories after code generation. Run 'go generate ./...' command and commit."; exit 1)
|
|
||||||
|
|
||||||
# Run acceptance tests in a matrix with Terraform CLI versions
|
|
||||||
test:
|
|
||||||
name: Terraform Provider Acceptance Tests
|
|
||||||
needs: build
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
timeout-minutes: 15
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
# list whatever Terraform versions here you would like to support
|
|
||||||
terraform:
|
|
||||||
- '1.0.*'
|
|
||||||
- '1.1.*'
|
|
||||||
- '1.2.*'
|
|
||||||
- '1.3.*'
|
|
||||||
- '1.4.*'
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
|
|
||||||
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
|
|
||||||
with:
|
|
||||||
go-version-file: 'go.mod'
|
|
||||||
cache: true
|
|
||||||
- uses: hashicorp/setup-terraform@633666f66e0061ca3b725c73b2ec20cd13a8fdd1 # v2.0.3
|
|
||||||
with:
|
|
||||||
terraform_version: ${{ matrix.terraform }}
|
|
||||||
terraform_wrapper: false
|
|
||||||
- run: go mod download
|
|
||||||
- env:
|
|
||||||
TF_ACC: "1"
|
|
||||||
run: go test -v -cover ./internal/provider/
|
|
||||||
timeout-minutes: 10
|
|
||||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -31,5 +31,8 @@ website/vendor
|
|||||||
!command/test-fixtures/**/*.tfstate
|
!command/test-fixtures/**/*.tfstate
|
||||||
!command/test-fixtures/**/.terraform/
|
!command/test-fixtures/**/.terraform/
|
||||||
|
|
||||||
|
# Local test directory
|
||||||
|
test/
|
||||||
|
|
||||||
# Keep windows files with windows line endings
|
# Keep windows files with windows line endings
|
||||||
*.winfile eol=crlf
|
*.winfile eol=crlf
|
||||||
|
|||||||
@@ -1,27 +1,19 @@
|
|||||||
# Visit https://golangci-lint.run/ for usage documentation
|
|
||||||
# and information on other useful linters
|
|
||||||
issues:
|
|
||||||
max-per-linter: 0
|
|
||||||
max-same-issues: 0
|
|
||||||
|
|
||||||
linters:
|
linters:
|
||||||
disable-all: true
|
disable-all: true
|
||||||
enable:
|
enable:
|
||||||
- durationcheck
|
- durationcheck
|
||||||
- errcheck
|
- errcheck
|
||||||
- exportloopref
|
|
||||||
- forcetypeassert
|
- forcetypeassert
|
||||||
- godot
|
- godot
|
||||||
- gofmt
|
- gofmt
|
||||||
- gosimple
|
- gosimple
|
||||||
- ineffassign
|
- ineffassign
|
||||||
- makezero
|
|
||||||
- misspell
|
- misspell
|
||||||
- nilerr
|
- nilerr
|
||||||
- predeclared
|
- predeclared
|
||||||
- staticcheck
|
- staticcheck
|
||||||
- tenv
|
- usetesting
|
||||||
- unconvert
|
- unconvert
|
||||||
- unparam
|
- unparam
|
||||||
- unused
|
- unused
|
||||||
- vet
|
- govet
|
||||||
|
|||||||
@@ -1,60 +1,71 @@
|
|||||||
# Visit https://goreleaser.com for documentation on how to customize this
|
version: 2
|
||||||
# behavior.
|
|
||||||
before:
|
before:
|
||||||
hooks:
|
hooks:
|
||||||
# this is just an example and not a requirement for provider building/publishing
|
|
||||||
- go mod tidy
|
- go mod tidy
|
||||||
|
|
||||||
builds:
|
builds:
|
||||||
- env:
|
- env:
|
||||||
# goreleaser does not work with CGO, it could also complicate
|
- CGO_ENABLED=0
|
||||||
# usage by users in CI/CD systems like Terraform Cloud where
|
mod_timestamp: '{{ .CommitTimestamp }}'
|
||||||
# they are unable to install libraries.
|
flags:
|
||||||
- CGO_ENABLED=0
|
- -trimpath
|
||||||
mod_timestamp: '{{ .CommitTimestamp }}'
|
ldflags:
|
||||||
flags:
|
- '-s -w -X main.version={{.Version}} -X main.commit={{.Commit}}'
|
||||||
- -trimpath
|
goos:
|
||||||
ldflags:
|
- freebsd
|
||||||
- '-s -w -X main.version={{.Version}} -X main.commit={{.Commit}}'
|
- windows
|
||||||
goos:
|
- linux
|
||||||
- freebsd
|
- darwin
|
||||||
- windows
|
goarch:
|
||||||
- linux
|
- amd64
|
||||||
- darwin
|
- '386'
|
||||||
goarch:
|
- arm
|
||||||
- amd64
|
- arm64
|
||||||
- '386'
|
ignore:
|
||||||
- arm
|
- goos: darwin
|
||||||
- arm64
|
goarch: '386'
|
||||||
ignore:
|
binary: '{{ .ProjectName }}_v{{ .Version }}'
|
||||||
- goos: darwin
|
|
||||||
goarch: '386'
|
|
||||||
binary: '{{ .ProjectName }}_v{{ .Version }}'
|
|
||||||
archives:
|
archives:
|
||||||
- format: zip
|
- format: zip
|
||||||
name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}'
|
name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}'
|
||||||
|
|
||||||
checksum:
|
checksum:
|
||||||
extra_files:
|
extra_files:
|
||||||
- glob: 'terraform-registry-manifest.json'
|
- glob: 'terraform-registry-manifest.json'
|
||||||
name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json'
|
name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json'
|
||||||
name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS'
|
name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS'
|
||||||
algorithm: sha256
|
algorithm: sha256
|
||||||
|
|
||||||
signs:
|
signs:
|
||||||
- artifacts: checksum
|
- artifacts: checksum
|
||||||
args:
|
args:
|
||||||
# if you are using this in a GitHub action or some other automated pipeline, you
|
|
||||||
# need to pass the batch flag to indicate its not interactive.
|
|
||||||
- "--batch"
|
- "--batch"
|
||||||
- "--local-user"
|
- "--local-user"
|
||||||
- "{{ .Env.GPG_FINGERPRINT }}" # set this environment variable for your signing key
|
- "{{ .Env.GPG_FINGERPRINT }}"
|
||||||
- "--output"
|
- "--output"
|
||||||
- "${signature}"
|
- "${signature}"
|
||||||
- "--detach-sign"
|
- "--detach-sign"
|
||||||
- "${artifact}"
|
- "${artifact}"
|
||||||
|
|
||||||
release:
|
release:
|
||||||
|
gitea:
|
||||||
|
owner: EZSCALE
|
||||||
|
name: terraform-provider-virtfusion
|
||||||
extra_files:
|
extra_files:
|
||||||
- glob: 'terraform-registry-manifest.json'
|
- glob: 'terraform-registry-manifest.json'
|
||||||
name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json'
|
name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json'
|
||||||
# If you want to manually examine the release before its live, uncomment this line:
|
|
||||||
# draft: true
|
gitea_urls:
|
||||||
|
api: https://git.ezscale.cloud/api/v1/
|
||||||
|
download: https://git.ezscale.cloud
|
||||||
|
skip_tls_verify: false
|
||||||
|
|
||||||
changelog:
|
changelog:
|
||||||
skip: true
|
sort: asc
|
||||||
|
filters:
|
||||||
|
exclude:
|
||||||
|
- '^docs:'
|
||||||
|
- '^test:'
|
||||||
|
- '^ci:'
|
||||||
|
|||||||
29
CHANGELOG.md
29
CHANGELOG.md
@@ -1,3 +1,30 @@
|
|||||||
## 0.1.0 (Unreleased)
|
## 1.0.0 (2026-03-16)
|
||||||
|
|
||||||
|
Complete rewrite of the VirtFusion Terraform provider.
|
||||||
|
|
||||||
|
BREAKING CHANGES:
|
||||||
|
|
||||||
|
* Provider rewritten using Terraform Plugin Framework (previously SDKv2). State from v0.x is not compatible.
|
||||||
|
* `virtfusion_ssh` resource renamed to `virtfusion_ssh_key`.
|
||||||
|
* `virtfusion_build` resource renamed to `virtfusion_server_build`.
|
||||||
|
* Server data source schema changed: `user_id` replaced with `owner_id`, resource fields (cpu_cores, memory, storage) removed from list view (available on single server data source).
|
||||||
|
* IP block `type` attribute changed from string to int64 (4=IPv4, 6=IPv6). Gateway/netmask now sourced from nested IPv4 object.
|
||||||
|
|
||||||
FEATURES:
|
FEATURES:
|
||||||
|
|
||||||
|
* **20 managed resources**: server, server_build, server_firewall, server_ipv4, server_network_whitelist, server_traffic_block, server_power_action, server_password_reset, ssh_key, user, user_auth_token, user_server_auth_token, user_password_reset, ip_block_range, self_service_credit, self_service_resource_pack, self_service_hourly_group_profile, self_service_hourly_resource_pack, self_service_resource_group_profile, self_service_pack_servers_action.
|
||||||
|
* **30 data sources**: server, servers, servers_by_user, server_backups, server_firewall, server_templates, server_traffic, server_traffic_blocks, server_vnc, hypervisor, hypervisors, hypervisor_group, hypervisor_groups, hypervisor_group_resources, package, packages, package_templates, ip_block, ip_blocks, ssh_key, ssh_keys_by_user, user, dns_service, iso, queue_item, self_service_currencies, self_service_resource_pack, self_service_hourly_stats, self_service_report, self_service_usage.
|
||||||
|
* Automatic multipage pagination for all list data sources via `GetAllPages` client method.
|
||||||
|
* Configurable `results` attribute on all list data sources (default: 300).
|
||||||
|
* Provider endpoint accepts hostname, full URL, or URL with `/api/v1` path — normalizes automatically.
|
||||||
|
* Environment variable support: `VIRTFUSION_ENDPOINT` and `VIRTFUSION_API_TOKEN`.
|
||||||
|
|
||||||
|
SECURITY:
|
||||||
|
|
||||||
|
* URL path injection prevention: all user-supplied strings are escaped with `url.PathEscape` before URL interpolation.
|
||||||
|
* Sensitive attributes: `api_token`, auth token `token` and `url`, and password reset `password` fields are marked sensitive.
|
||||||
|
* API error response bodies truncated to 500 bytes to prevent leaking sensitive data.
|
||||||
|
|
||||||
|
## 0.0.3 (2023-06-16)
|
||||||
|
|
||||||
|
* Initial public release with basic server, build, and SSH key resources.
|
||||||
|
|||||||
90
CLAUDE.md
Normal file
90
CLAUDE.md
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
# CLAUDE.md — Project context for AI assistants
|
||||||
|
|
||||||
|
## Project Overview
|
||||||
|
|
||||||
|
Terraform provider for VirtFusion (virtualization management platform). Written in Go using the [Terraform Plugin Framework](https://developer.hashicorp.com/terraform/plugin/framework) (not the older SDKv2).
|
||||||
|
|
||||||
|
- **Registry address**: `registry.terraform.io/EZSCALE/virtfusion`
|
||||||
|
- **Git hosting**: `https://git.ezscale.cloud/EZSCALE/terraform-provider-virtfusion` (Gitea, not GitHub)
|
||||||
|
- **VirtFusion API**: Laravel-based REST API with Bearer token auth. API docs defined in `openapi.yaml`.
|
||||||
|
|
||||||
|
## Architecture
|
||||||
|
|
||||||
|
```
|
||||||
|
main.go # Entry point, provider server
|
||||||
|
internal/
|
||||||
|
client/
|
||||||
|
client.go # HTTP client constructor, endpoint normalization
|
||||||
|
request.go # HTTP methods (Get, Post, Put, Delete, GetAllPages)
|
||||||
|
types.go # API request/response struct definitions
|
||||||
|
errors.go # APIError type with status code helpers
|
||||||
|
provider/
|
||||||
|
provider.go # Provider config, resource/datasource registration,
|
||||||
|
# shared pagination helpers (resultsSchemaAttribute, resultsQueryParam)
|
||||||
|
resource_*.go # Managed resources (20 total)
|
||||||
|
data_source_*.go # Data sources (30 total)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Key Conventions
|
||||||
|
|
||||||
|
### API Client
|
||||||
|
|
||||||
|
- All HTTP methods return `(json.RawMessage, error)` — raw JSON to be unmarshalled by the caller.
|
||||||
|
- `GetAllPages(ctx, path)` handles Laravel-style pagination automatically: fetches all pages, merges `data` arrays, returns a synthetic `{"data": [...]}` response. Use this for all list endpoints.
|
||||||
|
- Query parameters must be appended to the path string (e.g., `/servers?results=300`). The client splits path from query before calling `url.JoinPath` to avoid `%3F` encoding.
|
||||||
|
- List endpoints use `?results=N` to set page size (default 300 via `defaultResultsPerPage`).
|
||||||
|
|
||||||
|
### Data Sources
|
||||||
|
|
||||||
|
- List data sources use `GetAllPages` and expose an optional `results` attribute (default 300).
|
||||||
|
- Single-item data sources use `Get` and take a required `id` attribute.
|
||||||
|
- Server list responses use a flat structure; single server GET returns nested objects (`cpu.cores`, `settings.resources.memory`, etc.).
|
||||||
|
|
||||||
|
### Resources
|
||||||
|
|
||||||
|
- Server creation uses `ServerCreateRequest` (POST `/servers`) then separate PUT/POST calls for update-only attributes (name, CPU throttle, VNC, suspend, etc.).
|
||||||
|
- User resources are keyed by `ext_relation_id` (external relation ID), not numeric ID.
|
||||||
|
- **Security**: All user-supplied strings interpolated into URL paths MUST be wrapped with `url.PathEscape()`.
|
||||||
|
- **Sensitive attributes**: `api_token`, `password`, `token`, and auth token `url` fields must be marked `Sensitive: true` in schemas.
|
||||||
|
|
||||||
|
### API Type Mappings (known quirks)
|
||||||
|
|
||||||
|
- `ServerData.Suspended` is `bool` (API returns `true`/`false`, not `0`/`1`).
|
||||||
|
- `ServerData` uses `ownerId` (not `userId`) and nests resources under `cpu.cores`, `settings.resources.*`.
|
||||||
|
- `PackageData` uses `primaryStorage`, `primaryNetworkSpeedIn`, `primaryNetworkSpeedOut` (not `storage`, `networkSpeedInbound`, etc.).
|
||||||
|
- `IPBlockData.Type` is `int64` (4=IPv4, 6=IPv6). Gateway/netmask are nested under `ipv4`.
|
||||||
|
- Hypervisor group resources returns a paginated array of per-hypervisor entries, not a single aggregate object.
|
||||||
|
- API error bodies are truncated to 500 bytes in error messages to prevent leaking sensitive data.
|
||||||
|
|
||||||
|
## Build & Test
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Build
|
||||||
|
go build ./...
|
||||||
|
|
||||||
|
# Install locally (goes to $GOPATH/bin)
|
||||||
|
go install .
|
||||||
|
|
||||||
|
# Lint
|
||||||
|
golangci-lint run
|
||||||
|
|
||||||
|
# Run against live VirtFusion (read-only test)
|
||||||
|
# Requires ~/.terraformrc with dev_overrides and test/main.tf (gitignored)
|
||||||
|
cd test && terraform apply -auto-approve
|
||||||
|
```
|
||||||
|
|
||||||
|
## Environment Variables
|
||||||
|
|
||||||
|
- `VIRTFUSION_ENDPOINT` — API base URL (e.g., `https://cp.example.com` or `https://cp.example.com/api/v1`)
|
||||||
|
- `VIRTFUSION_API_TOKEN` — API bearer token
|
||||||
|
|
||||||
|
## CI/CD
|
||||||
|
|
||||||
|
Uses Gitea Actions (`.gitea/workflows/`). GoReleaser for binary releases (`.goreleaser.yml`).
|
||||||
|
|
||||||
|
## Common Pitfalls
|
||||||
|
|
||||||
|
- `url.JoinPath` encodes `?` as `%3F` — never put query params in the path argument. The client handles this by splitting at `?` first.
|
||||||
|
- The VirtFusion `/servers` endpoint caps at 20 results per page regardless of the `results` parameter. `GetAllPages` handles this transparently by fetching all pages.
|
||||||
|
- Don't use `json:"storage"` for package storage — the API field is `json:"primaryStorage"`.
|
||||||
|
- Single server GET and list server responses have different shapes. `ServerData` type handles both via optional nested pointer fields.
|
||||||
23
GNUmakefile
23
GNUmakefile
@@ -1,6 +1,25 @@
|
|||||||
default: testacc
|
default: build
|
||||||
|
|
||||||
|
.PHONY: build
|
||||||
|
build:
|
||||||
|
go build -v ./...
|
||||||
|
|
||||||
|
.PHONY: test
|
||||||
|
test:
|
||||||
|
go test -race -v ./internal/...
|
||||||
|
|
||||||
# Run acceptance tests
|
|
||||||
.PHONY: testacc
|
.PHONY: testacc
|
||||||
testacc:
|
testacc:
|
||||||
TF_ACC=1 go test ./... -v $(TESTARGS) -timeout 120m
|
TF_ACC=1 go test ./... -v $(TESTARGS) -timeout 120m
|
||||||
|
|
||||||
|
.PHONY: lint
|
||||||
|
lint:
|
||||||
|
golangci-lint run
|
||||||
|
|
||||||
|
.PHONY: generate
|
||||||
|
generate:
|
||||||
|
go generate ./...
|
||||||
|
|
||||||
|
.PHONY: drift-check
|
||||||
|
drift-check:
|
||||||
|
go run ./scripts/check-endpoint-drift.go
|
||||||
|
|||||||
273
README.md
273
README.md
@@ -1,73 +1,246 @@
|
|||||||
# Virtfusion Terraform Provider
|
# Terraform Provider for VirtFusion
|
||||||
|
|
||||||
<p style="color: red">NOTE: This is a work in progress and is not yet ready for production use.</p>
|
A Terraform provider for managing [VirtFusion](https://virtfusion.com) virtualization platform resources. Automate server provisioning, user management, networking, and self-service billing through infrastructure as code.
|
||||||
|
|
||||||
|
## Quick Install
|
||||||
|
|
||||||
## Overview
|
### Linux (amd64)
|
||||||
|
|
||||||
This is a Terraform provider for the Virtfusion API. It allows you to manage your Virtfusion resources using Terraform.
|
```bash
|
||||||
|
VERSION=1.0.0
|
||||||
|
curl -Lo terraform-provider-virtfusion.zip \
|
||||||
|
https://git.ezscale.cloud/EZSCALE/terraform-provider-virtfusion/releases/download/v${VERSION}/terraform-provider-virtfusion_${VERSION}_linux_amd64.zip
|
||||||
|
unzip terraform-provider-virtfusion.zip -d ~/.terraform.d/plugins/registry.terraform.io/EZSCALE/virtfusion/${VERSION}/linux_amd64/
|
||||||
|
rm terraform-provider-virtfusion.zip
|
||||||
|
```
|
||||||
|
|
||||||
# What can I do with this provider?
|
### macOS (Apple Silicon)
|
||||||
|
|
||||||
Currently, you're able to manage the following resources:
|
```bash
|
||||||
* Create and delete virtual machines
|
VERSION=1.0.0
|
||||||
* Create and delete SSH keys
|
curl -Lo terraform-provider-virtfusion.zip \
|
||||||
|
https://git.ezscale.cloud/EZSCALE/terraform-provider-virtfusion/releases/download/v${VERSION}/terraform-provider-virtfusion_${VERSION}_darwin_arm64.zip
|
||||||
|
unzip terraform-provider-virtfusion.zip -d ~/.terraform.d/plugins/registry.terraform.io/EZSCALE/virtfusion/${VERSION}/darwin_arm64/
|
||||||
|
rm terraform-provider-virtfusion.zip
|
||||||
|
```
|
||||||
|
|
||||||
# How do I use this provider?
|
### macOS (Intel)
|
||||||
|
|
||||||
Below is an example of how to use this provider to create a virtual machine and an SSH key.
|
```bash
|
||||||
|
VERSION=1.0.0
|
||||||
|
curl -Lo terraform-provider-virtfusion.zip \
|
||||||
|
https://git.ezscale.cloud/EZSCALE/terraform-provider-virtfusion/releases/download/v${VERSION}/terraform-provider-virtfusion_${VERSION}_darwin_amd64.zip
|
||||||
|
unzip terraform-provider-virtfusion.zip -d ~/.terraform.d/plugins/registry.terraform.io/EZSCALE/virtfusion/${VERSION}/darwin_amd64/
|
||||||
|
rm terraform-provider-virtfusion.zip
|
||||||
|
```
|
||||||
|
|
||||||
|
### Windows (PowerShell)
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
$VERSION = "1.0.0"
|
||||||
|
Invoke-WebRequest -Uri "https://git.ezscale.cloud/EZSCALE/terraform-provider-virtfusion/releases/download/v$VERSION/terraform-provider-virtfusion_${VERSION}_windows_amd64.zip" -OutFile tf-vf.zip
|
||||||
|
Expand-Archive tf-vf.zip -DestinationPath "$env:APPDATA\terraform.d\plugins\registry.terraform.io\EZSCALE\virtfusion\$VERSION\windows_amd64\"
|
||||||
|
Remove-Item tf-vf.zip
|
||||||
|
```
|
||||||
|
|
||||||
|
### From Source
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone https://git.ezscale.cloud/EZSCALE/terraform-provider-virtfusion.git
|
||||||
|
cd terraform-provider-virtfusion && go install .
|
||||||
|
```
|
||||||
|
|
||||||
|
Then add dev_overrides to `~/.terraformrc`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cat >> ~/.terraformrc <<'EOF'
|
||||||
|
provider_installation {
|
||||||
|
dev_overrides {
|
||||||
|
"registry.terraform.io/EZSCALE/virtfusion" = "${GOPATH}/bin"
|
||||||
|
}
|
||||||
|
direct {}
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
```
|
||||||
|
|
||||||
|
## Quick Start
|
||||||
|
|
||||||
|
**1. Set your credentials:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export VIRTFUSION_ENDPOINT="https://cp.example.com"
|
||||||
|
export VIRTFUSION_API_TOKEN="your-api-token"
|
||||||
|
```
|
||||||
|
|
||||||
|
**2. Create `main.tf`:**
|
||||||
|
|
||||||
```hcl
|
```hcl
|
||||||
terraform {
|
terraform {
|
||||||
required_providers {
|
required_providers {
|
||||||
virtfusion = {
|
virtfusion = {
|
||||||
source = "ezscale/virtfusion"
|
source = "registry.terraform.io/EZSCALE/virtfusion"
|
||||||
version = "0.0.3"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
provider "virtfusion" {
|
provider "virtfusion" {}
|
||||||
endpoint = "virtfusion.example.com"
|
|
||||||
api_token = ""
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "common" {
|
data "virtfusion_servers" "all" {}
|
||||||
type = map(string)
|
|
||||||
default = {
|
|
||||||
hypervisor_id = 1
|
|
||||||
package_id = 12
|
|
||||||
user_id = 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Create a SSH key
|
output "server_count" {
|
||||||
resource "virtfusion_ssh" "key1" {
|
value = length(data.virtfusion_servers.all.servers)
|
||||||
name = "My Test Key"
|
|
||||||
public_key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKWyBR+dk5M5MMfmH6Ss5QDSgcAvbCYu0DkqgPKH8O5T testkey@example.com"
|
|
||||||
user_id = var.common["user_id"]
|
|
||||||
}
|
|
||||||
|
|
||||||
# Create a server
|
|
||||||
resource "virtfusion_server" "node1" {
|
|
||||||
hypervisor_id = var.common["hypervisor_id"]
|
|
||||||
package_id = var.common["package_id"]
|
|
||||||
user_id = var.common["user_id"]
|
|
||||||
}
|
|
||||||
|
|
||||||
# Initialize the server with the OS we want, the SSH key we want, and the hostname we want.
|
|
||||||
resource "virtfusion_build" "node1" {
|
|
||||||
server_id = virtfusion_server.node1.id
|
|
||||||
name = "node1-demo"
|
|
||||||
hostname = "node1.example.com"
|
|
||||||
osid = 34
|
|
||||||
vnc = true
|
|
||||||
ipv6 = true
|
|
||||||
ssh_keys = [virtfusion_ssh.key1.id]
|
|
||||||
email = true
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
# How can I contribute?
|
**3. Run it:**
|
||||||
|
|
||||||
If you'd like to contribute, please feel free to open a pull request. If you're unsure of what to work on, please check the issues tab for any open issues.
|
```bash
|
||||||
|
terraform plan
|
||||||
|
```
|
||||||
|
|
||||||
|
The provider reads `VIRTFUSION_ENDPOINT` and `VIRTFUSION_API_TOKEN` from the environment. You can also set them directly in the provider block:
|
||||||
|
|
||||||
|
```hcl
|
||||||
|
provider "virtfusion" {
|
||||||
|
endpoint = "https://cp.example.com"
|
||||||
|
api_token = var.virtfusion_api_token
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage Examples
|
||||||
|
|
||||||
|
### Create a user, SSH key, server, and build it
|
||||||
|
|
||||||
|
```hcl
|
||||||
|
resource "virtfusion_user" "customer" {
|
||||||
|
name = "Jane Doe"
|
||||||
|
email = "jane@example.com"
|
||||||
|
ext_relation_id = "cust-001"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "virtfusion_ssh_key" "key" {
|
||||||
|
user_id = virtfusion_user.customer.id
|
||||||
|
name = "deploy-key"
|
||||||
|
public_key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIExample deploy@example.com"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "virtfusion_server" "web" {
|
||||||
|
package_id = 19
|
||||||
|
user_id = virtfusion_user.customer.id
|
||||||
|
hypervisor_id = 8
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "virtfusion_server_build" "web" {
|
||||||
|
server_id = virtfusion_server.web.id
|
||||||
|
name = "web-server"
|
||||||
|
hostname = "web.example.com"
|
||||||
|
osid = 13
|
||||||
|
vnc = true
|
||||||
|
ipv6 = true
|
||||||
|
ssh_keys = [virtfusion_ssh_key.key.id]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Read infrastructure data
|
||||||
|
|
||||||
|
```hcl
|
||||||
|
data "virtfusion_servers" "all" {}
|
||||||
|
data "virtfusion_packages" "all" {}
|
||||||
|
data "virtfusion_hypervisors" "all" {}
|
||||||
|
|
||||||
|
output "server_count" {
|
||||||
|
value = length(data.virtfusion_servers.all.servers)
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
List data sources support a `results` parameter (default: 300) and automatically paginate through all pages:
|
||||||
|
|
||||||
|
```hcl
|
||||||
|
data "virtfusion_servers" "all" {
|
||||||
|
results = 100 # override per-page limit
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Resources
|
||||||
|
|
||||||
|
| Resource | Description |
|
||||||
|
|----------|-------------|
|
||||||
|
| `virtfusion_server` | Create and manage servers |
|
||||||
|
| `virtfusion_server_build` | Build (install OS on) a server |
|
||||||
|
| `virtfusion_server_firewall` | Manage server firewall rules |
|
||||||
|
| `virtfusion_server_ipv4` | Add IPv4 addresses to a server |
|
||||||
|
| `virtfusion_server_network_whitelist` | Manage network whitelist entries |
|
||||||
|
| `virtfusion_server_traffic_block` | Manage traffic blocks |
|
||||||
|
| `virtfusion_server_power_action` | Control server power state |
|
||||||
|
| `virtfusion_server_password_reset` | Reset server root password |
|
||||||
|
| `virtfusion_ssh_key` | Manage SSH keys |
|
||||||
|
| `virtfusion_user` | Manage users |
|
||||||
|
| `virtfusion_user_auth_token` | Generate user authentication tokens |
|
||||||
|
| `virtfusion_user_server_auth_token` | Generate server-scoped authentication tokens |
|
||||||
|
| `virtfusion_user_password_reset` | Reset user passwords |
|
||||||
|
| `virtfusion_ip_block_range` | Add IPv4 ranges to IP blocks |
|
||||||
|
| `virtfusion_self_service_credit` | Manage self-service billing credits |
|
||||||
|
| `virtfusion_self_service_resource_pack` | Manage resource packs |
|
||||||
|
| `virtfusion_self_service_hourly_group_profile` | Manage hourly billing group profiles |
|
||||||
|
| `virtfusion_self_service_hourly_resource_pack` | Manage hourly resource packs |
|
||||||
|
| `virtfusion_self_service_resource_group_profile` | Manage resource group profiles |
|
||||||
|
| `virtfusion_self_service_pack_servers_action` | Suspend/unsuspend/delete pack servers |
|
||||||
|
|
||||||
|
## Data Sources
|
||||||
|
|
||||||
|
| Data Source | Description |
|
||||||
|
|-------------|-------------|
|
||||||
|
| `virtfusion_server` | Read a single server by ID |
|
||||||
|
| `virtfusion_servers` | List all servers |
|
||||||
|
| `virtfusion_servers_by_user` | List servers owned by a user |
|
||||||
|
| `virtfusion_server_backups` | List server backups |
|
||||||
|
| `virtfusion_server_firewall` | Read server firewall configuration |
|
||||||
|
| `virtfusion_server_templates` | List available templates for a server |
|
||||||
|
| `virtfusion_server_traffic` | Read server traffic usage |
|
||||||
|
| `virtfusion_server_traffic_blocks` | List server traffic blocks |
|
||||||
|
| `virtfusion_server_vnc` | Get VNC connection info |
|
||||||
|
| `virtfusion_hypervisor` | Read a single hypervisor |
|
||||||
|
| `virtfusion_hypervisors` | List all hypervisors |
|
||||||
|
| `virtfusion_hypervisor_group` | Read a single hypervisor group |
|
||||||
|
| `virtfusion_hypervisor_groups` | List all hypervisor groups |
|
||||||
|
| `virtfusion_hypervisor_group_resources` | Read aggregated resources for a group |
|
||||||
|
| `virtfusion_package` | Read a single package |
|
||||||
|
| `virtfusion_packages` | List all packages |
|
||||||
|
| `virtfusion_package_templates` | List templates for a package |
|
||||||
|
| `virtfusion_ip_block` | Read a single IP block |
|
||||||
|
| `virtfusion_ip_blocks` | List all IP blocks |
|
||||||
|
| `virtfusion_ssh_key` | Read a single SSH key |
|
||||||
|
| `virtfusion_ssh_keys_by_user` | List SSH keys for a user |
|
||||||
|
| `virtfusion_user` | Read a user by external relation ID |
|
||||||
|
| `virtfusion_dns_service` | Read DNS service configuration |
|
||||||
|
| `virtfusion_iso` | Read ISO media info |
|
||||||
|
| `virtfusion_queue_item` | Read a queue item status |
|
||||||
|
| `virtfusion_self_service_currencies` | List available currencies |
|
||||||
|
| `virtfusion_self_service_resource_pack` | Read a resource pack |
|
||||||
|
| `virtfusion_self_service_hourly_stats` | Read hourly billing stats |
|
||||||
|
| `virtfusion_self_service_report` | Read self-service reports |
|
||||||
|
| `virtfusion_self_service_usage` | Read self-service usage |
|
||||||
|
|
||||||
|
## Development
|
||||||
|
|
||||||
|
### Build
|
||||||
|
|
||||||
|
```bash
|
||||||
|
go build ./...
|
||||||
|
```
|
||||||
|
|
||||||
|
### Install locally
|
||||||
|
|
||||||
|
```bash
|
||||||
|
go install .
|
||||||
|
```
|
||||||
|
|
||||||
|
### Run linter
|
||||||
|
|
||||||
|
```bash
|
||||||
|
golangci-lint run
|
||||||
|
```
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
[MPL-2.0](LICENSE)
|
||||||
|
|||||||
25
docs/data-sources/dns_service.md
Normal file
25
docs/data-sources/dns_service.md
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
---
|
||||||
|
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||||
|
page_title: "virtfusion_dns_service Data Source - virtfusion"
|
||||||
|
subcategory: ""
|
||||||
|
description: |-
|
||||||
|
Fetches a single VirtFusion DNS service by ID.
|
||||||
|
---
|
||||||
|
|
||||||
|
# virtfusion_dns_service (Data Source)
|
||||||
|
|
||||||
|
Fetches a single VirtFusion DNS service by ID.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- schema generated by tfplugindocs -->
|
||||||
|
## Schema
|
||||||
|
|
||||||
|
### Required
|
||||||
|
|
||||||
|
- `id` (Number) The DNS service ID.
|
||||||
|
|
||||||
|
### Read-Only
|
||||||
|
|
||||||
|
- `name` (String) The DNS service name.
|
||||||
|
- `type` (String) The DNS service type.
|
||||||
27
docs/data-sources/hypervisor.md
Normal file
27
docs/data-sources/hypervisor.md
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
---
|
||||||
|
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||||
|
page_title: "virtfusion_hypervisor Data Source - virtfusion"
|
||||||
|
subcategory: ""
|
||||||
|
description: |-
|
||||||
|
Fetches a single VirtFusion hypervisor by ID.
|
||||||
|
---
|
||||||
|
|
||||||
|
# virtfusion_hypervisor (Data Source)
|
||||||
|
|
||||||
|
Fetches a single VirtFusion hypervisor by ID.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- schema generated by tfplugindocs -->
|
||||||
|
## Schema
|
||||||
|
|
||||||
|
### Required
|
||||||
|
|
||||||
|
- `id` (Number) The hypervisor ID.
|
||||||
|
|
||||||
|
### Read-Only
|
||||||
|
|
||||||
|
- `enabled` (Boolean) Whether the hypervisor is enabled.
|
||||||
|
- `hostname` (String) The hypervisor hostname.
|
||||||
|
- `name` (String) The hypervisor name.
|
||||||
|
- `type` (String) The hypervisor type.
|
||||||
25
docs/data-sources/hypervisor_group.md
Normal file
25
docs/data-sources/hypervisor_group.md
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
---
|
||||||
|
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||||
|
page_title: "virtfusion_hypervisor_group Data Source - virtfusion"
|
||||||
|
subcategory: ""
|
||||||
|
description: |-
|
||||||
|
Fetches a single VirtFusion hypervisor group by ID.
|
||||||
|
---
|
||||||
|
|
||||||
|
# virtfusion_hypervisor_group (Data Source)
|
||||||
|
|
||||||
|
Fetches a single VirtFusion hypervisor group by ID.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- schema generated by tfplugindocs -->
|
||||||
|
## Schema
|
||||||
|
|
||||||
|
### Required
|
||||||
|
|
||||||
|
- `id` (Number) The hypervisor group ID.
|
||||||
|
|
||||||
|
### Read-Only
|
||||||
|
|
||||||
|
- `enabled` (Boolean) Whether the hypervisor group is enabled.
|
||||||
|
- `name` (String) The hypervisor group name.
|
||||||
30
docs/data-sources/hypervisor_group_resources.md
Normal file
30
docs/data-sources/hypervisor_group_resources.md
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
---
|
||||||
|
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||||
|
page_title: "virtfusion_hypervisor_group_resources Data Source - virtfusion"
|
||||||
|
subcategory: ""
|
||||||
|
description: |-
|
||||||
|
Fetches resource information for a VirtFusion hypervisor group.
|
||||||
|
---
|
||||||
|
|
||||||
|
# virtfusion_hypervisor_group_resources (Data Source)
|
||||||
|
|
||||||
|
Fetches resource information for a VirtFusion hypervisor group.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- schema generated by tfplugindocs -->
|
||||||
|
## Schema
|
||||||
|
|
||||||
|
### Required
|
||||||
|
|
||||||
|
- `id` (Number) The hypervisor group ID.
|
||||||
|
|
||||||
|
### Optional
|
||||||
|
|
||||||
|
- `results` (Number) Maximum number of results to return. Defaults to 300.
|
||||||
|
|
||||||
|
### Read-Only
|
||||||
|
|
||||||
|
- `cpu_cores` (Number) The number of CPU cores available in the group.
|
||||||
|
- `memory` (Number) The amount of memory available in the group.
|
||||||
|
- `storage` (Number) The amount of storage available in the group.
|
||||||
33
docs/data-sources/hypervisor_groups.md
Normal file
33
docs/data-sources/hypervisor_groups.md
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
---
|
||||||
|
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||||
|
page_title: "virtfusion_hypervisor_groups Data Source - virtfusion"
|
||||||
|
subcategory: ""
|
||||||
|
description: |-
|
||||||
|
Fetches all VirtFusion hypervisor groups.
|
||||||
|
---
|
||||||
|
|
||||||
|
# virtfusion_hypervisor_groups (Data Source)
|
||||||
|
|
||||||
|
Fetches all VirtFusion hypervisor groups.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- schema generated by tfplugindocs -->
|
||||||
|
## Schema
|
||||||
|
|
||||||
|
### Optional
|
||||||
|
|
||||||
|
- `results` (Number) Maximum number of results to return. Defaults to 300.
|
||||||
|
|
||||||
|
### Read-Only
|
||||||
|
|
||||||
|
- `groups` (Attributes List) List of hypervisor groups. (see [below for nested schema](#nestedatt--groups))
|
||||||
|
|
||||||
|
<a id="nestedatt--groups"></a>
|
||||||
|
### Nested Schema for `groups`
|
||||||
|
|
||||||
|
Read-Only:
|
||||||
|
|
||||||
|
- `enabled` (Boolean) Whether the hypervisor group is enabled.
|
||||||
|
- `id` (Number) The hypervisor group ID.
|
||||||
|
- `name` (String) The hypervisor group name.
|
||||||
43
docs/data-sources/hypervisors.md
Normal file
43
docs/data-sources/hypervisors.md
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
---
|
||||||
|
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||||
|
page_title: "virtfusion_hypervisors Data Source - virtfusion"
|
||||||
|
subcategory: ""
|
||||||
|
description: |-
|
||||||
|
Fetches all VirtFusion hypervisors.
|
||||||
|
---
|
||||||
|
|
||||||
|
# virtfusion_hypervisors (Data Source)
|
||||||
|
|
||||||
|
Fetches all VirtFusion hypervisors.
|
||||||
|
|
||||||
|
## Example Usage
|
||||||
|
|
||||||
|
```terraform
|
||||||
|
data "virtfusion_hypervisors" "all" {}
|
||||||
|
|
||||||
|
output "hypervisor_names" {
|
||||||
|
value = [for h in data.virtfusion_hypervisors.all.hypervisors : h.name]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
<!-- schema generated by tfplugindocs -->
|
||||||
|
## Schema
|
||||||
|
|
||||||
|
### Optional
|
||||||
|
|
||||||
|
- `results` (Number) Maximum number of results to return. Defaults to 300.
|
||||||
|
|
||||||
|
### Read-Only
|
||||||
|
|
||||||
|
- `hypervisors` (Attributes List) List of hypervisors. (see [below for nested schema](#nestedatt--hypervisors))
|
||||||
|
|
||||||
|
<a id="nestedatt--hypervisors"></a>
|
||||||
|
### Nested Schema for `hypervisors`
|
||||||
|
|
||||||
|
Read-Only:
|
||||||
|
|
||||||
|
- `enabled` (Boolean) Whether the hypervisor is enabled.
|
||||||
|
- `hostname` (String) The hypervisor hostname.
|
||||||
|
- `id` (Number) The hypervisor ID.
|
||||||
|
- `name` (String) The hypervisor name.
|
||||||
|
- `type` (String) The hypervisor type.
|
||||||
28
docs/data-sources/ip_block.md
Normal file
28
docs/data-sources/ip_block.md
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
---
|
||||||
|
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||||
|
page_title: "virtfusion_ip_block Data Source - virtfusion"
|
||||||
|
subcategory: ""
|
||||||
|
description: |-
|
||||||
|
Fetches a single VirtFusion IP block by ID.
|
||||||
|
---
|
||||||
|
|
||||||
|
# virtfusion_ip_block (Data Source)
|
||||||
|
|
||||||
|
Fetches a single VirtFusion IP block by ID.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- schema generated by tfplugindocs -->
|
||||||
|
## Schema
|
||||||
|
|
||||||
|
### Required
|
||||||
|
|
||||||
|
- `id` (Number) The IP block ID.
|
||||||
|
|
||||||
|
### Read-Only
|
||||||
|
|
||||||
|
- `enabled` (Boolean) Whether the IP block is enabled.
|
||||||
|
- `gateway` (String) The IPv4 gateway address.
|
||||||
|
- `name` (String) The IP block name.
|
||||||
|
- `netmask` (String) The IPv4 netmask.
|
||||||
|
- `type` (Number) The IP block type (4 = IPv4, 6 = IPv6).
|
||||||
36
docs/data-sources/ip_blocks.md
Normal file
36
docs/data-sources/ip_blocks.md
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
---
|
||||||
|
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||||
|
page_title: "virtfusion_ip_blocks Data Source - virtfusion"
|
||||||
|
subcategory: ""
|
||||||
|
description: |-
|
||||||
|
Fetches all VirtFusion IP blocks.
|
||||||
|
---
|
||||||
|
|
||||||
|
# virtfusion_ip_blocks (Data Source)
|
||||||
|
|
||||||
|
Fetches all VirtFusion IP blocks.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- schema generated by tfplugindocs -->
|
||||||
|
## Schema
|
||||||
|
|
||||||
|
### Optional
|
||||||
|
|
||||||
|
- `results` (Number) Maximum number of results to return. Defaults to 300.
|
||||||
|
|
||||||
|
### Read-Only
|
||||||
|
|
||||||
|
- `ip_blocks` (Attributes List) List of IP blocks. (see [below for nested schema](#nestedatt--ip_blocks))
|
||||||
|
|
||||||
|
<a id="nestedatt--ip_blocks"></a>
|
||||||
|
### Nested Schema for `ip_blocks`
|
||||||
|
|
||||||
|
Read-Only:
|
||||||
|
|
||||||
|
- `enabled` (Boolean) Whether the IP block is enabled.
|
||||||
|
- `gateway` (String) The IPv4 gateway address.
|
||||||
|
- `id` (Number) The IP block ID.
|
||||||
|
- `name` (String) The IP block name.
|
||||||
|
- `netmask` (String) The IPv4 netmask.
|
||||||
|
- `type` (Number) The IP block type (4 = IPv4, 6 = IPv6).
|
||||||
24
docs/data-sources/iso.md
Normal file
24
docs/data-sources/iso.md
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
---
|
||||||
|
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||||
|
page_title: "virtfusion_iso Data Source - virtfusion"
|
||||||
|
subcategory: ""
|
||||||
|
description: |-
|
||||||
|
Fetches a single VirtFusion ISO by ID.
|
||||||
|
---
|
||||||
|
|
||||||
|
# virtfusion_iso (Data Source)
|
||||||
|
|
||||||
|
Fetches a single VirtFusion ISO by ID.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- schema generated by tfplugindocs -->
|
||||||
|
## Schema
|
||||||
|
|
||||||
|
### Required
|
||||||
|
|
||||||
|
- `id` (Number) The ISO ID.
|
||||||
|
|
||||||
|
### Read-Only
|
||||||
|
|
||||||
|
- `name` (String) The ISO name.
|
||||||
32
docs/data-sources/package.md
Normal file
32
docs/data-sources/package.md
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
---
|
||||||
|
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||||
|
page_title: "virtfusion_package Data Source - virtfusion"
|
||||||
|
subcategory: ""
|
||||||
|
description: |-
|
||||||
|
Fetches a single VirtFusion package by ID.
|
||||||
|
---
|
||||||
|
|
||||||
|
# virtfusion_package (Data Source)
|
||||||
|
|
||||||
|
Fetches a single VirtFusion package by ID.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- schema generated by tfplugindocs -->
|
||||||
|
## Schema
|
||||||
|
|
||||||
|
### Required
|
||||||
|
|
||||||
|
- `id` (Number) The package ID.
|
||||||
|
|
||||||
|
### Read-Only
|
||||||
|
|
||||||
|
- `cpu_cores` (Number) The number of CPU cores in the package.
|
||||||
|
- `enabled` (Boolean) Whether the package is enabled.
|
||||||
|
- `ipv4` (Number) The number of IPv4 addresses in the package.
|
||||||
|
- `memory` (Number) The amount of memory in the package.
|
||||||
|
- `name` (String) The package name.
|
||||||
|
- `network_speed_inbound` (Number) The inbound network speed in the package.
|
||||||
|
- `network_speed_outbound` (Number) The outbound network speed in the package.
|
||||||
|
- `storage` (Number) The amount of storage in the package.
|
||||||
|
- `traffic` (Number) The traffic limit in the package.
|
||||||
36
docs/data-sources/package_templates.md
Normal file
36
docs/data-sources/package_templates.md
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
---
|
||||||
|
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||||
|
page_title: "virtfusion_package_templates Data Source - virtfusion"
|
||||||
|
subcategory: ""
|
||||||
|
description: |-
|
||||||
|
Fetches templates available for a VirtFusion server package.
|
||||||
|
---
|
||||||
|
|
||||||
|
# virtfusion_package_templates (Data Source)
|
||||||
|
|
||||||
|
Fetches templates available for a VirtFusion server package.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- schema generated by tfplugindocs -->
|
||||||
|
## Schema
|
||||||
|
|
||||||
|
### Required
|
||||||
|
|
||||||
|
- `package_id` (Number) The package ID to fetch templates for.
|
||||||
|
|
||||||
|
### Optional
|
||||||
|
|
||||||
|
- `results` (Number) Maximum number of results to return. Defaults to 300.
|
||||||
|
|
||||||
|
### Read-Only
|
||||||
|
|
||||||
|
- `templates` (Attributes List) List of templates available for the package. (see [below for nested schema](#nestedatt--templates))
|
||||||
|
|
||||||
|
<a id="nestedatt--templates"></a>
|
||||||
|
### Nested Schema for `templates`
|
||||||
|
|
||||||
|
Read-Only:
|
||||||
|
|
||||||
|
- `id` (Number) The template ID.
|
||||||
|
- `name` (String) The template name.
|
||||||
48
docs/data-sources/packages.md
Normal file
48
docs/data-sources/packages.md
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
---
|
||||||
|
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||||
|
page_title: "virtfusion_packages Data Source - virtfusion"
|
||||||
|
subcategory: ""
|
||||||
|
description: |-
|
||||||
|
Fetches all VirtFusion packages.
|
||||||
|
---
|
||||||
|
|
||||||
|
# virtfusion_packages (Data Source)
|
||||||
|
|
||||||
|
Fetches all VirtFusion packages.
|
||||||
|
|
||||||
|
## Example Usage
|
||||||
|
|
||||||
|
```terraform
|
||||||
|
data "virtfusion_packages" "all" {}
|
||||||
|
|
||||||
|
output "package_names" {
|
||||||
|
value = [for p in data.virtfusion_packages.all.packages : p.name]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
<!-- schema generated by tfplugindocs -->
|
||||||
|
## Schema
|
||||||
|
|
||||||
|
### Optional
|
||||||
|
|
||||||
|
- `results` (Number) Maximum number of results to return. Defaults to 300.
|
||||||
|
|
||||||
|
### Read-Only
|
||||||
|
|
||||||
|
- `packages` (Attributes List) List of packages. (see [below for nested schema](#nestedatt--packages))
|
||||||
|
|
||||||
|
<a id="nestedatt--packages"></a>
|
||||||
|
### Nested Schema for `packages`
|
||||||
|
|
||||||
|
Read-Only:
|
||||||
|
|
||||||
|
- `cpu_cores` (Number) The number of CPU cores in the package.
|
||||||
|
- `enabled` (Boolean) Whether the package is enabled.
|
||||||
|
- `id` (Number) The package ID.
|
||||||
|
- `ipv4` (Number) The number of IPv4 addresses in the package.
|
||||||
|
- `memory` (Number) The amount of memory in the package.
|
||||||
|
- `name` (String) The package name.
|
||||||
|
- `network_speed_inbound` (Number) The inbound network speed in the package.
|
||||||
|
- `network_speed_outbound` (Number) The outbound network speed in the package.
|
||||||
|
- `storage` (Number) The amount of storage in the package.
|
||||||
|
- `traffic` (Number) The traffic limit in the package.
|
||||||
26
docs/data-sources/queue_item.md
Normal file
26
docs/data-sources/queue_item.md
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
---
|
||||||
|
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||||
|
page_title: "virtfusion_queue_item Data Source - virtfusion"
|
||||||
|
subcategory: ""
|
||||||
|
description: |-
|
||||||
|
Fetches a single VirtFusion queue item by ID.
|
||||||
|
---
|
||||||
|
|
||||||
|
# virtfusion_queue_item (Data Source)
|
||||||
|
|
||||||
|
Fetches a single VirtFusion queue item by ID.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- schema generated by tfplugindocs -->
|
||||||
|
## Schema
|
||||||
|
|
||||||
|
### Required
|
||||||
|
|
||||||
|
- `id` (Number) The queue item ID.
|
||||||
|
|
||||||
|
### Read-Only
|
||||||
|
|
||||||
|
- `action` (String) The queue item action.
|
||||||
|
- `created_at` (String) The creation timestamp.
|
||||||
|
- `status` (String) The queue item status.
|
||||||
33
docs/data-sources/self_service_currencies.md
Normal file
33
docs/data-sources/self_service_currencies.md
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
---
|
||||||
|
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||||
|
page_title: "virtfusion_self_service_currencies Data Source - virtfusion"
|
||||||
|
subcategory: ""
|
||||||
|
description: |-
|
||||||
|
Fetches all available VirtFusion self-service currencies.
|
||||||
|
---
|
||||||
|
|
||||||
|
# virtfusion_self_service_currencies (Data Source)
|
||||||
|
|
||||||
|
Fetches all available VirtFusion self-service currencies.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- schema generated by tfplugindocs -->
|
||||||
|
## Schema
|
||||||
|
|
||||||
|
### Optional
|
||||||
|
|
||||||
|
- `results` (Number) Maximum number of results to return. Defaults to 300.
|
||||||
|
|
||||||
|
### Read-Only
|
||||||
|
|
||||||
|
- `currencies` (Attributes List) List of available currencies. (see [below for nested schema](#nestedatt--currencies))
|
||||||
|
|
||||||
|
<a id="nestedatt--currencies"></a>
|
||||||
|
### Nested Schema for `currencies`
|
||||||
|
|
||||||
|
Read-Only:
|
||||||
|
|
||||||
|
- `code` (String) The currency code.
|
||||||
|
- `id` (Number) The currency ID.
|
||||||
|
- `name` (String) The currency name.
|
||||||
25
docs/data-sources/self_service_hourly_stats.md
Normal file
25
docs/data-sources/self_service_hourly_stats.md
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
---
|
||||||
|
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||||
|
page_title: "virtfusion_self_service_hourly_stats Data Source - virtfusion"
|
||||||
|
subcategory: ""
|
||||||
|
description: |-
|
||||||
|
Fetches VirtFusion self-service hourly stats for a user and group.
|
||||||
|
---
|
||||||
|
|
||||||
|
# virtfusion_self_service_hourly_stats (Data Source)
|
||||||
|
|
||||||
|
Fetches VirtFusion self-service hourly stats for a user and group.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- schema generated by tfplugindocs -->
|
||||||
|
## Schema
|
||||||
|
|
||||||
|
### Required
|
||||||
|
|
||||||
|
- `group_id` (Number) The group ID to fetch hourly stats for.
|
||||||
|
- `user_id` (Number) The user ID to fetch hourly stats for.
|
||||||
|
|
||||||
|
### Read-Only
|
||||||
|
|
||||||
|
- `stats_json` (String) The raw JSON response containing hourly stats.
|
||||||
25
docs/data-sources/self_service_report.md
Normal file
25
docs/data-sources/self_service_report.md
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
---
|
||||||
|
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||||
|
page_title: "virtfusion_self_service_report Data Source - virtfusion"
|
||||||
|
subcategory: ""
|
||||||
|
description: |-
|
||||||
|
Fetches a VirtFusion self-service report for a user and group.
|
||||||
|
---
|
||||||
|
|
||||||
|
# virtfusion_self_service_report (Data Source)
|
||||||
|
|
||||||
|
Fetches a VirtFusion self-service report for a user and group.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- schema generated by tfplugindocs -->
|
||||||
|
## Schema
|
||||||
|
|
||||||
|
### Required
|
||||||
|
|
||||||
|
- `group_id` (Number) The group ID to fetch the report for.
|
||||||
|
- `user_id` (Number) The user ID to fetch the report for.
|
||||||
|
|
||||||
|
### Read-Only
|
||||||
|
|
||||||
|
- `report_json` (String) The raw JSON response containing the report.
|
||||||
26
docs/data-sources/self_service_resource_pack.md
Normal file
26
docs/data-sources/self_service_resource_pack.md
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
---
|
||||||
|
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||||
|
page_title: "virtfusion_self_service_resource_pack Data Source - virtfusion"
|
||||||
|
subcategory: ""
|
||||||
|
description: |-
|
||||||
|
Fetches a single VirtFusion self-service resource pack by ID.
|
||||||
|
---
|
||||||
|
|
||||||
|
# virtfusion_self_service_resource_pack (Data Source)
|
||||||
|
|
||||||
|
Fetches a single VirtFusion self-service resource pack by ID.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- schema generated by tfplugindocs -->
|
||||||
|
## Schema
|
||||||
|
|
||||||
|
### Required
|
||||||
|
|
||||||
|
- `id` (Number) The resource pack ID.
|
||||||
|
|
||||||
|
### Read-Only
|
||||||
|
|
||||||
|
- `name` (String) The resource pack name.
|
||||||
|
- `pack_id` (Number) The pack ID associated with the resource pack.
|
||||||
|
- `user_id` (Number) The user ID associated with the resource pack.
|
||||||
25
docs/data-sources/self_service_usage.md
Normal file
25
docs/data-sources/self_service_usage.md
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
---
|
||||||
|
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||||
|
page_title: "virtfusion_self_service_usage Data Source - virtfusion"
|
||||||
|
subcategory: ""
|
||||||
|
description: |-
|
||||||
|
Fetches VirtFusion self-service usage data for a user and group.
|
||||||
|
---
|
||||||
|
|
||||||
|
# virtfusion_self_service_usage (Data Source)
|
||||||
|
|
||||||
|
Fetches VirtFusion self-service usage data for a user and group.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- schema generated by tfplugindocs -->
|
||||||
|
## Schema
|
||||||
|
|
||||||
|
### Required
|
||||||
|
|
||||||
|
- `group_id` (Number) The group ID to fetch usage data for.
|
||||||
|
- `user_id` (Number) The user ID to fetch usage data for.
|
||||||
|
|
||||||
|
### Read-Only
|
||||||
|
|
||||||
|
- `usage_json` (String) The raw JSON response containing usage data.
|
||||||
@@ -1,76 +1,42 @@
|
|||||||
---
|
---
|
||||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||||
page_title: "virtfusion_server Data Source - terraform-provider-virtfusion"
|
page_title: "virtfusion_server Data Source - virtfusion"
|
||||||
subcategory: ""
|
subcategory: ""
|
||||||
description: |-
|
description: |-
|
||||||
The Virtfusion Server data source allows access to the details of a server. This data source can be used to read information about an existing server.
|
Use this data source to read a single VirtFusion server by ID.
|
||||||
---
|
---
|
||||||
|
|
||||||
# virtfusion_server (Data Source)
|
# virtfusion_server (Data Source)
|
||||||
|
|
||||||
The Virtfusion Server data source allows access to the details of a server. This data source can be used to read information about an existing server.
|
Use this data source to read a single VirtFusion server by ID.
|
||||||
|
|
||||||
|
## Example Usage
|
||||||
|
|
||||||
|
```terraform
|
||||||
|
data "virtfusion_server" "example" {
|
||||||
|
id = 1
|
||||||
|
}
|
||||||
|
|
||||||
|
output "server_name" {
|
||||||
|
value = data.virtfusion_server.example.name
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
<!-- schema generated by tfplugindocs -->
|
<!-- schema generated by tfplugindocs -->
|
||||||
## Schema
|
## Schema
|
||||||
|
|
||||||
### Required
|
### Required
|
||||||
|
|
||||||
- `id` (Number) Server ID
|
- `id` (Number) The server ID.
|
||||||
|
|
||||||
### Read-Only
|
### Read-Only
|
||||||
|
|
||||||
- `build_failed` (Boolean) Build failed
|
- `cpu_cores` (Number) The number of CPU cores.
|
||||||
- `built` (String) Built
|
- `hostname` (String) The server hostname.
|
||||||
- `commission_status` (Number) Commission status
|
- `hypervisor_id` (Number) The hypervisor ID where the server is hosted.
|
||||||
- `config_level` (Number) Config level
|
- `memory` (Number) The memory size in MB.
|
||||||
- `created` (String) Created
|
- `name` (String) The server display name.
|
||||||
- `delete_level` (Number) Delete level
|
- `owner_id` (Number) The owner (user) ID who owns the server.
|
||||||
- `hostname` (String) Server hostname
|
- `storage` (Number) The storage size in GB.
|
||||||
- `hypervisor_id` (Number) Hypervisor ID
|
- `suspended` (Boolean) Whether the server is suspended.
|
||||||
- `migrate_level` (Number) Migrate level
|
- `uuid` (String) The server UUID.
|
||||||
- `name` (String) Server name
|
|
||||||
- `network` (Attributes) Network interfaces (see [below for nested schema](#nestedatt--network))
|
|
||||||
- `owner_id` (Number) Owner ID
|
|
||||||
- `primary_network_dhcp4` (Boolean) Primary network DHCP4
|
|
||||||
- `primary_network_dhcp6` (Boolean) Primary network DHCP6
|
|
||||||
- `protected` (Boolean) Protected
|
|
||||||
- `rebuild` (Boolean) Rebuild
|
|
||||||
- `state` (String) Server state
|
|
||||||
- `suspended` (Boolean) Suspended
|
|
||||||
- `updated` (String) Updated
|
|
||||||
- `uuid` (String) Server UUID
|
|
||||||
|
|
||||||
<a id="nestedatt--network"></a>
|
|
||||||
### Nested Schema for `network`
|
|
||||||
|
|
||||||
Read-Only:
|
|
||||||
|
|
||||||
- `interfaces` (Attributes) Network interfaces (see [below for nested schema](#nestedatt--network--interfaces))
|
|
||||||
|
|
||||||
<a id="nestedatt--network--interfaces"></a>
|
|
||||||
### Nested Schema for `network.interfaces`
|
|
||||||
|
|
||||||
Read-Only:
|
|
||||||
|
|
||||||
- `enabled` (Boolean) Enabled
|
|
||||||
- `ipv4` (Attributes) IPv4 (see [below for nested schema](#nestedatt--network--interfaces--ipv4))
|
|
||||||
- `mac` (String) MAC
|
|
||||||
- `name` (String) Name
|
|
||||||
- `type` (String) Type
|
|
||||||
|
|
||||||
<a id="nestedatt--network--interfaces--ipv4"></a>
|
|
||||||
### Nested Schema for `network.interfaces.ipv4`
|
|
||||||
|
|
||||||
Read-Only:
|
|
||||||
|
|
||||||
- `address` (String) Address
|
|
||||||
- `enabled` (Boolean) Enabled
|
|
||||||
- `gateway` (String) Gateway
|
|
||||||
- `id` (Number) ID
|
|
||||||
- `mac` (String) MAC
|
|
||||||
- `netmask` (String) Netmask
|
|
||||||
- `rdns` (String) RDNS
|
|
||||||
- `resolver_one` (String) Resolver one
|
|
||||||
- `resolver_two` (String) Resolver two
|
|
||||||
|
|||||||
37
docs/data-sources/server_backups.md
Normal file
37
docs/data-sources/server_backups.md
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
---
|
||||||
|
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||||
|
page_title: "virtfusion_server_backups Data Source - virtfusion"
|
||||||
|
subcategory: ""
|
||||||
|
description: |-
|
||||||
|
Use this data source to list backups for a VirtFusion server.
|
||||||
|
---
|
||||||
|
|
||||||
|
# virtfusion_server_backups (Data Source)
|
||||||
|
|
||||||
|
Use this data source to list backups for a VirtFusion server.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- schema generated by tfplugindocs -->
|
||||||
|
## Schema
|
||||||
|
|
||||||
|
### Required
|
||||||
|
|
||||||
|
- `server_id` (Number) The server ID to list backups for.
|
||||||
|
|
||||||
|
### Optional
|
||||||
|
|
||||||
|
- `results` (Number) Maximum number of results to return. Defaults to 300.
|
||||||
|
|
||||||
|
### Read-Only
|
||||||
|
|
||||||
|
- `backups` (Attributes List) The list of backups. (see [below for nested schema](#nestedatt--backups))
|
||||||
|
|
||||||
|
<a id="nestedatt--backups"></a>
|
||||||
|
### Nested Schema for `backups`
|
||||||
|
|
||||||
|
Read-Only:
|
||||||
|
|
||||||
|
- `created_at` (String) The backup creation timestamp.
|
||||||
|
- `id` (Number) The backup ID.
|
||||||
|
- `type` (String) The backup type.
|
||||||
40
docs/data-sources/server_firewall.md
Normal file
40
docs/data-sources/server_firewall.md
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
---
|
||||||
|
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||||
|
page_title: "virtfusion_server_firewall Data Source - virtfusion"
|
||||||
|
subcategory: ""
|
||||||
|
description: |-
|
||||||
|
Use this data source to read firewall information for a VirtFusion server.
|
||||||
|
---
|
||||||
|
|
||||||
|
# virtfusion_server_firewall (Data Source)
|
||||||
|
|
||||||
|
Use this data source to read firewall information for a VirtFusion server.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- schema generated by tfplugindocs -->
|
||||||
|
## Schema
|
||||||
|
|
||||||
|
### Required
|
||||||
|
|
||||||
|
- `server_id` (Number) The server ID to read firewall information for.
|
||||||
|
|
||||||
|
### Optional
|
||||||
|
|
||||||
|
- `interface_name` (String) The network interface name. Defaults to `eth0`.
|
||||||
|
|
||||||
|
### Read-Only
|
||||||
|
|
||||||
|
- `enabled` (Boolean) Whether the firewall is enabled.
|
||||||
|
- `rules` (Attributes List) The firewall rules. (see [below for nested schema](#nestedatt--rules))
|
||||||
|
|
||||||
|
<a id="nestedatt--rules"></a>
|
||||||
|
### Nested Schema for `rules`
|
||||||
|
|
||||||
|
Read-Only:
|
||||||
|
|
||||||
|
- `action` (String) The action for the rule (e.g. `accept`, `drop`).
|
||||||
|
- `direction` (String) The direction for the rule (e.g. `in`, `out`).
|
||||||
|
- `ip` (String) The IP address or CIDR for the rule.
|
||||||
|
- `port` (String) The port or port range for the rule.
|
||||||
|
- `protocol` (String) The protocol for the rule (e.g. `tcp`, `udp`).
|
||||||
36
docs/data-sources/server_templates.md
Normal file
36
docs/data-sources/server_templates.md
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
---
|
||||||
|
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||||
|
page_title: "virtfusion_server_templates Data Source - virtfusion"
|
||||||
|
subcategory: ""
|
||||||
|
description: |-
|
||||||
|
Use this data source to list available templates for a VirtFusion server.
|
||||||
|
---
|
||||||
|
|
||||||
|
# virtfusion_server_templates (Data Source)
|
||||||
|
|
||||||
|
Use this data source to list available templates for a VirtFusion server.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- schema generated by tfplugindocs -->
|
||||||
|
## Schema
|
||||||
|
|
||||||
|
### Required
|
||||||
|
|
||||||
|
- `server_id` (Number) The server ID to list templates for.
|
||||||
|
|
||||||
|
### Optional
|
||||||
|
|
||||||
|
- `results` (Number) Maximum number of results to return. Defaults to 300.
|
||||||
|
|
||||||
|
### Read-Only
|
||||||
|
|
||||||
|
- `templates` (Attributes List) The list of available templates. (see [below for nested schema](#nestedatt--templates))
|
||||||
|
|
||||||
|
<a id="nestedatt--templates"></a>
|
||||||
|
### Nested Schema for `templates`
|
||||||
|
|
||||||
|
Read-Only:
|
||||||
|
|
||||||
|
- `id` (Number) The template ID.
|
||||||
|
- `name` (String) The template name.
|
||||||
25
docs/data-sources/server_traffic.md
Normal file
25
docs/data-sources/server_traffic.md
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
---
|
||||||
|
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||||
|
page_title: "virtfusion_server_traffic Data Source - virtfusion"
|
||||||
|
subcategory: ""
|
||||||
|
description: |-
|
||||||
|
Use this data source to read traffic usage for a VirtFusion server.
|
||||||
|
---
|
||||||
|
|
||||||
|
# virtfusion_server_traffic (Data Source)
|
||||||
|
|
||||||
|
Use this data source to read traffic usage for a VirtFusion server.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- schema generated by tfplugindocs -->
|
||||||
|
## Schema
|
||||||
|
|
||||||
|
### Required
|
||||||
|
|
||||||
|
- `server_id` (Number) The server ID to read traffic for.
|
||||||
|
|
||||||
|
### Read-Only
|
||||||
|
|
||||||
|
- `limit` (Number) The traffic limit.
|
||||||
|
- `used` (Number) The amount of traffic used.
|
||||||
36
docs/data-sources/server_traffic_blocks.md
Normal file
36
docs/data-sources/server_traffic_blocks.md
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
---
|
||||||
|
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||||
|
page_title: "virtfusion_server_traffic_blocks Data Source - virtfusion"
|
||||||
|
subcategory: ""
|
||||||
|
description: |-
|
||||||
|
Use this data source to list traffic blocks for a VirtFusion server.
|
||||||
|
---
|
||||||
|
|
||||||
|
# virtfusion_server_traffic_blocks (Data Source)
|
||||||
|
|
||||||
|
Use this data source to list traffic blocks for a VirtFusion server.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- schema generated by tfplugindocs -->
|
||||||
|
## Schema
|
||||||
|
|
||||||
|
### Required
|
||||||
|
|
||||||
|
- `server_id` (Number) The server ID to list traffic blocks for.
|
||||||
|
|
||||||
|
### Optional
|
||||||
|
|
||||||
|
- `results` (Number) Maximum number of results to return. Defaults to 300.
|
||||||
|
|
||||||
|
### Read-Only
|
||||||
|
|
||||||
|
- `blocks` (Attributes List) The list of traffic blocks. (see [below for nested schema](#nestedatt--blocks))
|
||||||
|
|
||||||
|
<a id="nestedatt--blocks"></a>
|
||||||
|
### Nested Schema for `blocks`
|
||||||
|
|
||||||
|
Read-Only:
|
||||||
|
|
||||||
|
- `id` (Number) The traffic block ID.
|
||||||
|
- `type` (String) The traffic block type.
|
||||||
24
docs/data-sources/server_vnc.md
Normal file
24
docs/data-sources/server_vnc.md
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
---
|
||||||
|
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||||
|
page_title: "virtfusion_server_vnc Data Source - virtfusion"
|
||||||
|
subcategory: ""
|
||||||
|
description: |-
|
||||||
|
Use this data source to read VNC connection information for a VirtFusion server.
|
||||||
|
---
|
||||||
|
|
||||||
|
# virtfusion_server_vnc (Data Source)
|
||||||
|
|
||||||
|
Use this data source to read VNC connection information for a VirtFusion server.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- schema generated by tfplugindocs -->
|
||||||
|
## Schema
|
||||||
|
|
||||||
|
### Required
|
||||||
|
|
||||||
|
- `server_id` (Number) The server ID to read VNC information for.
|
||||||
|
|
||||||
|
### Read-Only
|
||||||
|
|
||||||
|
- `url` (String, Sensitive) The VNC connection URL.
|
||||||
37
docs/data-sources/servers.md
Normal file
37
docs/data-sources/servers.md
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
---
|
||||||
|
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||||
|
page_title: "virtfusion_servers Data Source - virtfusion"
|
||||||
|
subcategory: ""
|
||||||
|
description: |-
|
||||||
|
Use this data source to list all VirtFusion servers.
|
||||||
|
---
|
||||||
|
|
||||||
|
# virtfusion_servers (Data Source)
|
||||||
|
|
||||||
|
Use this data source to list all VirtFusion servers.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- schema generated by tfplugindocs -->
|
||||||
|
## Schema
|
||||||
|
|
||||||
|
### Optional
|
||||||
|
|
||||||
|
- `results` (Number) Maximum number of results to return. Defaults to 300.
|
||||||
|
|
||||||
|
### Read-Only
|
||||||
|
|
||||||
|
- `servers` (Attributes List) The list of servers. (see [below for nested schema](#nestedatt--servers))
|
||||||
|
|
||||||
|
<a id="nestedatt--servers"></a>
|
||||||
|
### Nested Schema for `servers`
|
||||||
|
|
||||||
|
Read-Only:
|
||||||
|
|
||||||
|
- `hostname` (String) The server hostname.
|
||||||
|
- `hypervisor_id` (Number) The hypervisor ID where the server is hosted.
|
||||||
|
- `id` (Number) The server ID.
|
||||||
|
- `name` (String) The server display name.
|
||||||
|
- `owner_id` (Number) The owner (user) ID who owns the server.
|
||||||
|
- `suspended` (Boolean) Whether the server is suspended.
|
||||||
|
- `uuid` (String) The server UUID.
|
||||||
41
docs/data-sources/servers_by_user.md
Normal file
41
docs/data-sources/servers_by_user.md
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
---
|
||||||
|
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||||
|
page_title: "virtfusion_servers_by_user Data Source - virtfusion"
|
||||||
|
subcategory: ""
|
||||||
|
description: |-
|
||||||
|
Use this data source to list all VirtFusion servers owned by a specific user.
|
||||||
|
---
|
||||||
|
|
||||||
|
# virtfusion_servers_by_user (Data Source)
|
||||||
|
|
||||||
|
Use this data source to list all VirtFusion servers owned by a specific user.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- schema generated by tfplugindocs -->
|
||||||
|
## Schema
|
||||||
|
|
||||||
|
### Required
|
||||||
|
|
||||||
|
- `user_id` (Number) The user ID to filter servers by.
|
||||||
|
|
||||||
|
### Optional
|
||||||
|
|
||||||
|
- `results` (Number) Maximum number of results to return. Defaults to 300.
|
||||||
|
|
||||||
|
### Read-Only
|
||||||
|
|
||||||
|
- `servers` (Attributes List) The list of servers owned by the user. (see [below for nested schema](#nestedatt--servers))
|
||||||
|
|
||||||
|
<a id="nestedatt--servers"></a>
|
||||||
|
### Nested Schema for `servers`
|
||||||
|
|
||||||
|
Read-Only:
|
||||||
|
|
||||||
|
- `hostname` (String) The server hostname.
|
||||||
|
- `hypervisor_id` (Number) The hypervisor ID where the server is hosted.
|
||||||
|
- `id` (Number) The server ID.
|
||||||
|
- `name` (String) The server display name.
|
||||||
|
- `owner_id` (Number) The owner (user) ID who owns the server.
|
||||||
|
- `suspended` (Boolean) Whether the server is suspended.
|
||||||
|
- `uuid` (String) The server UUID.
|
||||||
30
docs/data-sources/ssh_key.md
Normal file
30
docs/data-sources/ssh_key.md
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
---
|
||||||
|
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||||
|
page_title: "virtfusion_ssh_key Data Source - virtfusion"
|
||||||
|
subcategory: ""
|
||||||
|
description: |-
|
||||||
|
Fetches a single VirtFusion SSH key by ID.
|
||||||
|
---
|
||||||
|
|
||||||
|
# virtfusion_ssh_key (Data Source)
|
||||||
|
|
||||||
|
Fetches a single VirtFusion SSH key by ID.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- schema generated by tfplugindocs -->
|
||||||
|
## Schema
|
||||||
|
|
||||||
|
### Required
|
||||||
|
|
||||||
|
- `id` (Number) The SSH key ID.
|
||||||
|
|
||||||
|
### Read-Only
|
||||||
|
|
||||||
|
- `created_at` (String) The creation timestamp.
|
||||||
|
- `enabled` (Boolean) Whether the SSH key is enabled.
|
||||||
|
- `name` (String) The SSH key name.
|
||||||
|
- `public_key` (String) The public key content.
|
||||||
|
- `type` (String) The SSH key type.
|
||||||
|
- `updated_at` (String) The last update timestamp.
|
||||||
|
- `user_id` (Number) The ID of the user who owns this SSH key.
|
||||||
39
docs/data-sources/ssh_keys_by_user.md
Normal file
39
docs/data-sources/ssh_keys_by_user.md
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
---
|
||||||
|
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||||
|
page_title: "virtfusion_ssh_keys_by_user Data Source - virtfusion"
|
||||||
|
subcategory: ""
|
||||||
|
description: |-
|
||||||
|
Fetches all SSH keys for a VirtFusion user.
|
||||||
|
---
|
||||||
|
|
||||||
|
# virtfusion_ssh_keys_by_user (Data Source)
|
||||||
|
|
||||||
|
Fetches all SSH keys for a VirtFusion user.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- schema generated by tfplugindocs -->
|
||||||
|
## Schema
|
||||||
|
|
||||||
|
### Required
|
||||||
|
|
||||||
|
- `user_id` (Number) The user ID to fetch SSH keys for.
|
||||||
|
|
||||||
|
### Optional
|
||||||
|
|
||||||
|
- `results` (Number) Maximum number of results to return. Defaults to 300.
|
||||||
|
|
||||||
|
### Read-Only
|
||||||
|
|
||||||
|
- `ssh_keys` (Attributes List) List of SSH keys belonging to the user. (see [below for nested schema](#nestedatt--ssh_keys))
|
||||||
|
|
||||||
|
<a id="nestedatt--ssh_keys"></a>
|
||||||
|
### Nested Schema for `ssh_keys`
|
||||||
|
|
||||||
|
Read-Only:
|
||||||
|
|
||||||
|
- `enabled` (Boolean) Whether the SSH key is enabled.
|
||||||
|
- `id` (Number) The SSH key ID.
|
||||||
|
- `name` (String) The SSH key name.
|
||||||
|
- `public_key` (String) The public key content.
|
||||||
|
- `type` (String) The SSH key type.
|
||||||
29
docs/data-sources/user.md
Normal file
29
docs/data-sources/user.md
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
---
|
||||||
|
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||||
|
page_title: "virtfusion_user Data Source - virtfusion"
|
||||||
|
subcategory: ""
|
||||||
|
description: |-
|
||||||
|
Fetches a VirtFusion user by external relation ID.
|
||||||
|
---
|
||||||
|
|
||||||
|
# virtfusion_user (Data Source)
|
||||||
|
|
||||||
|
Fetches a VirtFusion user by external relation ID.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- schema generated by tfplugindocs -->
|
||||||
|
## Schema
|
||||||
|
|
||||||
|
### Required
|
||||||
|
|
||||||
|
- `ext_relation_id` (String) The external relation ID of the user.
|
||||||
|
|
||||||
|
### Read-Only
|
||||||
|
|
||||||
|
- `created_at` (String) The creation timestamp.
|
||||||
|
- `email` (String) The user email address.
|
||||||
|
- `enabled` (Boolean) Whether the user is enabled.
|
||||||
|
- `id` (Number) The numeric ID of the user.
|
||||||
|
- `name` (String) The user name.
|
||||||
|
- `updated_at` (String) The last update timestamp.
|
||||||
@@ -3,26 +3,31 @@
|
|||||||
page_title: "virtfusion Provider"
|
page_title: "virtfusion Provider"
|
||||||
subcategory: ""
|
subcategory: ""
|
||||||
description: |-
|
description: |-
|
||||||
|
The VirtFusion provider allows managing VirtFusion virtualization platform resources.
|
||||||
---
|
---
|
||||||
|
|
||||||
# virtfusion Provider
|
# virtfusion Provider
|
||||||
|
|
||||||
|
The VirtFusion provider allows managing VirtFusion virtualization platform resources.
|
||||||
|
|
||||||
## Example Usage
|
## Example Usage
|
||||||
|
|
||||||
```terraform
|
```terraform
|
||||||
provider "virtfusion" {
|
provider "virtfusion" {
|
||||||
endpoint = "example.com"
|
endpoint = "https://cp.example.com"
|
||||||
api_token = "myapikey"
|
api_token = var.virtfusion_api_token
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "virtfusion_api_token" {
|
||||||
|
type = string
|
||||||
|
sensitive = true
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
<!-- schema generated by tfplugindocs -->
|
<!-- schema generated by tfplugindocs -->
|
||||||
## Schema
|
## Schema
|
||||||
|
|
||||||
### Required
|
### Optional
|
||||||
|
|
||||||
- `api_token` (String) The API token to use for API requests.
|
- `api_token` (String, Sensitive) The API token for authentication. Can also be set with the `VIRTFUSION_API_TOKEN` environment variable.
|
||||||
- `endpoint` (String) The endpoint to use for API requests.
|
- `endpoint` (String) The VirtFusion API endpoint. Can be a hostname (e.g. `cp.example.com`) or full URL (e.g. `https://cp.example.com/api/v1`). Can also be set with the `VIRTFUSION_ENDPOINT` environment variable.
|
||||||
|
|||||||
@@ -1,43 +0,0 @@
|
|||||||
---
|
|
||||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
|
||||||
page_title: "virtfusion_build Resource - terraform-provider-virtfusion"
|
|
||||||
subcategory: ""
|
|
||||||
description: |-
|
|
||||||
Virtfusion Server Build Resource
|
|
||||||
---
|
|
||||||
|
|
||||||
# virtfusion_build (Resource)
|
|
||||||
|
|
||||||
Virtfusion Server Build Resource
|
|
||||||
|
|
||||||
## Example Usage
|
|
||||||
|
|
||||||
```terraform
|
|
||||||
resource "virtfusion_build" "node1" {
|
|
||||||
server_id = virtfusion_server.node1.id
|
|
||||||
name = "node1-demo"
|
|
||||||
hostname = "node1.example.com"
|
|
||||||
osid = 1
|
|
||||||
vnc = true
|
|
||||||
ipv6 = true
|
|
||||||
ssh_keys = [virtfusion_ssh.dummy_key.id]
|
|
||||||
email = true
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
<!-- schema generated by tfplugindocs -->
|
|
||||||
## Schema
|
|
||||||
|
|
||||||
### Required
|
|
||||||
|
|
||||||
- `name` (String) Server Name
|
|
||||||
- `osid` (Number) Server Operating System ID
|
|
||||||
- `server_id` (Number) Server ID
|
|
||||||
|
|
||||||
### Optional
|
|
||||||
|
|
||||||
- `email` (Boolean) Server Email
|
|
||||||
- `hostname` (String) Server Hostname
|
|
||||||
- `ipv6` (Boolean) Server IPv6
|
|
||||||
- `ssh_keys` (List of Number) Server SSH Keys IDs
|
|
||||||
- `vnc` (Boolean) Server VNC
|
|
||||||
28
docs/resources/ip_block_range.md
Normal file
28
docs/resources/ip_block_range.md
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
---
|
||||||
|
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||||
|
page_title: "virtfusion_ip_block_range Resource - virtfusion"
|
||||||
|
subcategory: ""
|
||||||
|
description: |-
|
||||||
|
Adds an IPv4 address range to a VirtFusion IP block. This is a create-only resource — ranges cannot be deleted via the API.
|
||||||
|
---
|
||||||
|
|
||||||
|
# virtfusion_ip_block_range (Resource)
|
||||||
|
|
||||||
|
Adds an IPv4 address range to a VirtFusion IP block. This is a create-only resource — ranges cannot be deleted via the API.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- schema generated by tfplugindocs -->
|
||||||
|
## Schema
|
||||||
|
|
||||||
|
### Required
|
||||||
|
|
||||||
|
- `end_ip` (String) The ending IP address of the range.
|
||||||
|
- `gateway` (String) The gateway address for the range.
|
||||||
|
- `ip_block_id` (Number) The ID of the IP block to add the range to.
|
||||||
|
- `netmask` (String) The netmask for the range.
|
||||||
|
- `start_ip` (String) The starting IP address of the range.
|
||||||
|
|
||||||
|
### Read-Only
|
||||||
|
|
||||||
|
- `id` (String) The identifier of the IP block range.
|
||||||
26
docs/resources/self_service_credit.md
Normal file
26
docs/resources/self_service_credit.md
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
---
|
||||||
|
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||||
|
page_title: "virtfusion_self_service_credit Resource - virtfusion"
|
||||||
|
subcategory: ""
|
||||||
|
description: |-
|
||||||
|
Manages self-service credit in VirtFusion. Deleting this resource cancels the credit.
|
||||||
|
---
|
||||||
|
|
||||||
|
# virtfusion_self_service_credit (Resource)
|
||||||
|
|
||||||
|
Manages self-service credit in VirtFusion. Deleting this resource cancels the credit.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- schema generated by tfplugindocs -->
|
||||||
|
## Schema
|
||||||
|
|
||||||
|
### Required
|
||||||
|
|
||||||
|
- `amount` (Number) The credit amount.
|
||||||
|
- `currency_code` (String) The currency code (e.g. `USD`, `EUR`).
|
||||||
|
- `user_id` (Number) The ID of the user to add credit to.
|
||||||
|
|
||||||
|
### Read-Only
|
||||||
|
|
||||||
|
- `id` (Number) The identifier of the credit entry.
|
||||||
26
docs/resources/self_service_hourly_group_profile.md
Normal file
26
docs/resources/self_service_hourly_group_profile.md
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
---
|
||||||
|
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||||
|
page_title: "virtfusion_self_service_hourly_group_profile Resource - virtfusion"
|
||||||
|
subcategory: ""
|
||||||
|
description: |-
|
||||||
|
Manages a self-service hourly group profile assignment in VirtFusion.
|
||||||
|
---
|
||||||
|
|
||||||
|
# virtfusion_self_service_hourly_group_profile (Resource)
|
||||||
|
|
||||||
|
Manages a self-service hourly group profile assignment in VirtFusion.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- schema generated by tfplugindocs -->
|
||||||
|
## Schema
|
||||||
|
|
||||||
|
### Required
|
||||||
|
|
||||||
|
- `group_id` (Number) The ID of the hypervisor group.
|
||||||
|
- `profile_id` (Number) The ID of the hourly profile.
|
||||||
|
- `user_id` (Number) The ID of the user.
|
||||||
|
|
||||||
|
### Read-Only
|
||||||
|
|
||||||
|
- `id` (String) The composite identifier of the hourly group profile (userId/groupId/profileId).
|
||||||
26
docs/resources/self_service_hourly_resource_pack.md
Normal file
26
docs/resources/self_service_hourly_resource_pack.md
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
---
|
||||||
|
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||||
|
page_title: "virtfusion_self_service_hourly_resource_pack Resource - virtfusion"
|
||||||
|
subcategory: ""
|
||||||
|
description: |-
|
||||||
|
Sets the hourly resource pack for a user and group in VirtFusion self-service. Changing any attribute forces recreation.
|
||||||
|
---
|
||||||
|
|
||||||
|
# virtfusion_self_service_hourly_resource_pack (Resource)
|
||||||
|
|
||||||
|
Sets the hourly resource pack for a user and group in VirtFusion self-service. Changing any attribute forces recreation.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- schema generated by tfplugindocs -->
|
||||||
|
## Schema
|
||||||
|
|
||||||
|
### Required
|
||||||
|
|
||||||
|
- `group_id` (Number) The ID of the group.
|
||||||
|
- `resource_pack_id` (Number) The ID of the resource pack.
|
||||||
|
- `user_id` (Number) The ID of the user.
|
||||||
|
|
||||||
|
### Read-Only
|
||||||
|
|
||||||
|
- `id` (String) The composite identifier for this hourly resource pack assignment.
|
||||||
29
docs/resources/self_service_pack_servers_action.md
Normal file
29
docs/resources/self_service_pack_servers_action.md
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
---
|
||||||
|
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||||
|
page_title: "virtfusion_self_service_pack_servers_action Resource - virtfusion"
|
||||||
|
subcategory: ""
|
||||||
|
description: |-
|
||||||
|
Performs an action on all servers in a self-service resource pack. This is a trigger-style resource — the action is executed on create and can be re-triggered by changing the triggers attribute.
|
||||||
|
---
|
||||||
|
|
||||||
|
# virtfusion_self_service_pack_servers_action (Resource)
|
||||||
|
|
||||||
|
Performs an action on all servers in a self-service resource pack. This is a trigger-style resource — the action is executed on create and can be re-triggered by changing the `triggers` attribute.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- schema generated by tfplugindocs -->
|
||||||
|
## Schema
|
||||||
|
|
||||||
|
### Required
|
||||||
|
|
||||||
|
- `action` (String) The action to perform on the pack servers. Must be one of: `suspend`, `unsuspend`, `delete`.
|
||||||
|
- `pack_id` (Number) The ID of the resource pack.
|
||||||
|
|
||||||
|
### Optional
|
||||||
|
|
||||||
|
- `triggers` (Map of String) A map of arbitrary strings that, when changed, will cause the action to be re-executed. Works like `triggers` in `terraform_data`.
|
||||||
|
|
||||||
|
### Read-Only
|
||||||
|
|
||||||
|
- `id` (String) The identifier for this pack servers action.
|
||||||
26
docs/resources/self_service_resource_group_profile.md
Normal file
26
docs/resources/self_service_resource_group_profile.md
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
---
|
||||||
|
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||||
|
page_title: "virtfusion_self_service_resource_group_profile Resource - virtfusion"
|
||||||
|
subcategory: ""
|
||||||
|
description: |-
|
||||||
|
Associates a resource group profile with a user in VirtFusion self-service. Changing any attribute forces recreation of the association.
|
||||||
|
---
|
||||||
|
|
||||||
|
# virtfusion_self_service_resource_group_profile (Resource)
|
||||||
|
|
||||||
|
Associates a resource group profile with a user in VirtFusion self-service. Changing any attribute forces recreation of the association.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- schema generated by tfplugindocs -->
|
||||||
|
## Schema
|
||||||
|
|
||||||
|
### Required
|
||||||
|
|
||||||
|
- `group_id` (Number) The ID of the resource group.
|
||||||
|
- `profile_id` (Number) The ID of the profile.
|
||||||
|
- `user_id` (Number) The ID of the user.
|
||||||
|
|
||||||
|
### Read-Only
|
||||||
|
|
||||||
|
- `id` (String) The composite identifier for this resource group profile association.
|
||||||
26
docs/resources/self_service_resource_pack.md
Normal file
26
docs/resources/self_service_resource_pack.md
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
---
|
||||||
|
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||||
|
page_title: "virtfusion_self_service_resource_pack Resource - virtfusion"
|
||||||
|
subcategory: ""
|
||||||
|
description: |-
|
||||||
|
Manages a self-service resource pack in VirtFusion.
|
||||||
|
---
|
||||||
|
|
||||||
|
# virtfusion_self_service_resource_pack (Resource)
|
||||||
|
|
||||||
|
Manages a self-service resource pack in VirtFusion.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- schema generated by tfplugindocs -->
|
||||||
|
## Schema
|
||||||
|
|
||||||
|
### Required
|
||||||
|
|
||||||
|
- `name` (String) The name of the resource pack.
|
||||||
|
- `pack_id` (Number) The ID of the pack.
|
||||||
|
- `user_id` (Number) The ID of the user who owns the resource pack.
|
||||||
|
|
||||||
|
### Read-Only
|
||||||
|
|
||||||
|
- `id` (Number) The identifier of the resource pack.
|
||||||
@@ -1,14 +1,14 @@
|
|||||||
---
|
---
|
||||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||||
page_title: "virtfusion_server Resource - terraform-provider-virtfusion"
|
page_title: "virtfusion_server Resource - virtfusion"
|
||||||
subcategory: ""
|
subcategory: ""
|
||||||
description: |-
|
description: |-
|
||||||
Virtfusion Server Resource
|
Manages a VirtFusion server.
|
||||||
---
|
---
|
||||||
|
|
||||||
# virtfusion_server (Resource)
|
# virtfusion_server (Resource)
|
||||||
|
|
||||||
Virtfusion Server Resource
|
Manages a VirtFusion server.
|
||||||
|
|
||||||
## Example Usage
|
## Example Usage
|
||||||
|
|
||||||
@@ -27,6 +27,10 @@ resource "virtfusion_server" "node1" {
|
|||||||
storage_profile = 1
|
storage_profile = 1
|
||||||
network_profile = 1
|
network_profile = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
output "server_id" {
|
||||||
|
value = virtfusion_server.node1.id
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
<!-- schema generated by tfplugindocs -->
|
<!-- schema generated by tfplugindocs -->
|
||||||
@@ -34,22 +38,36 @@ resource "virtfusion_server" "node1" {
|
|||||||
|
|
||||||
### Required
|
### Required
|
||||||
|
|
||||||
- `hypervisor_id` (Number) Hypervisor Group ID
|
- `hypervisor_id` (Number) The hypervisor ID where the server will be created.
|
||||||
- `package_id` (Number) Package ID
|
- `package_id` (Number) The package ID for the server.
|
||||||
- `user_id` (Number) User ID
|
- `user_id` (Number) The user ID who owns the server.
|
||||||
|
|
||||||
### Optional
|
### Optional
|
||||||
|
|
||||||
- `cores` (Number) How many cores to allocate. Omit to use the default core count from the package.
|
- `additional_storage_1` (Number) Additional storage 1 size in GB.
|
||||||
- `inbound_network_speed` (Number) Inbound network speed in kB/s. Omit to use the default inbound network speed from the package.
|
- `additional_storage_1_profile` (Number) Additional storage 1 profile ID.
|
||||||
- `ipv4` (Number) IPv4 Addresses to assign. Omit to use the default of 1 IPv4.
|
- `additional_storage_2` (Number) Additional storage 2 size in GB.
|
||||||
- `memory` (Number) How much memory to allocate in MB. Omit to use the default memory size from the package.
|
- `additional_storage_2_profile` (Number) Additional storage 2 profile ID.
|
||||||
- `network_profile` (Number) Network profile ID. Omit to use the default network profile from the package.
|
- `backup_plan_id` (Number) Backup plan ID. Set to 0 to remove the backup plan.
|
||||||
- `outbound_network_speed` (Number) Outbound network speed in kB/s. Omit to use the default outbound network speed from the package.
|
- `cores` (Number) Number of CPU cores override.
|
||||||
- `storage` (Number) Primary storage size in GB. Omit to use the default storage size from the package.
|
- `cpu_throttle` (Number) CPU throttle percentage (0-100).
|
||||||
- `storage_profile` (Number) Storage profile ID. Omit to use the default storage profile from the package.
|
- `custom_xml` (String) Custom XML configuration for the server.
|
||||||
- `traffic` (Number) How much traffic to allocate in GB. Omit to use the default traffic size from the package. 0=Unlimited
|
- `dry_run` (Boolean) If true, validates the request without creating the server.
|
||||||
|
- `inbound_network_speed` (Number) Inbound network speed override in Mbps.
|
||||||
|
- `ipv4` (Number) Number of IPv4 addresses to assign. Defaults to 1.
|
||||||
|
- `memory` (Number) Memory size override in MB.
|
||||||
|
- `name` (String) The server display name.
|
||||||
|
- `network_profile` (Number) Network profile ID.
|
||||||
|
- `outbound_network_speed` (Number) Outbound network speed override in Mbps.
|
||||||
|
- `owner_user_id` (Number) The user ID to transfer ownership to.
|
||||||
|
- `storage` (Number) Storage size override in GB.
|
||||||
|
- `storage_profile` (Number) Storage profile ID.
|
||||||
|
- `suspended` (Boolean) Whether the server is suspended.
|
||||||
|
- `traffic` (Number) Traffic limit override in GB.
|
||||||
|
- `vnc_enabled` (Boolean) Whether VNC is enabled on the server.
|
||||||
|
|
||||||
### Read-Only
|
### Read-Only
|
||||||
|
|
||||||
- `id` (Number) Server ID
|
- `hostname` (String) The server hostname.
|
||||||
|
- `id` (Number) The server ID.
|
||||||
|
- `uuid` (String) The server UUID.
|
||||||
|
|||||||
47
docs/resources/server_build.md
Normal file
47
docs/resources/server_build.md
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
---
|
||||||
|
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||||
|
page_title: "virtfusion_server_build Resource - virtfusion"
|
||||||
|
subcategory: ""
|
||||||
|
description: |-
|
||||||
|
Builds a VirtFusion server with an operating system. This is a one-time operation — once a server is built, it stays built.
|
||||||
|
---
|
||||||
|
|
||||||
|
# virtfusion_server_build (Resource)
|
||||||
|
|
||||||
|
Builds a VirtFusion server with an operating system. This is a one-time operation — once a server is built, it stays built.
|
||||||
|
|
||||||
|
## Example Usage
|
||||||
|
|
||||||
|
```terraform
|
||||||
|
resource "virtfusion_server_build" "node1_build" {
|
||||||
|
server_id = virtfusion_server.node1.id
|
||||||
|
name = "my-server"
|
||||||
|
hostname = "my-server.example.com"
|
||||||
|
osid = 1
|
||||||
|
vnc = true
|
||||||
|
ipv6 = false
|
||||||
|
ssh_keys = [virtfusion_ssh_key.mykey.id]
|
||||||
|
email = false
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
<!-- schema generated by tfplugindocs -->
|
||||||
|
## Schema
|
||||||
|
|
||||||
|
### Required
|
||||||
|
|
||||||
|
- `name` (String) The name for the server build.
|
||||||
|
- `osid` (Number) The operating system ID to install.
|
||||||
|
- `server_id` (Number) The ID of the server to build.
|
||||||
|
|
||||||
|
### Optional
|
||||||
|
|
||||||
|
- `email` (Boolean) Whether to send a notification email after build.
|
||||||
|
- `hostname` (String) The hostname for the server.
|
||||||
|
- `ipv6` (Boolean) Whether to enable IPv6.
|
||||||
|
- `ssh_keys` (List of Number) List of SSH key IDs to add to the server.
|
||||||
|
- `vnc` (Boolean) Whether to enable VNC access.
|
||||||
|
|
||||||
|
### Read-Only
|
||||||
|
|
||||||
|
- `id` (String) The identifier of the server build (same as server_id).
|
||||||
40
docs/resources/server_firewall.md
Normal file
40
docs/resources/server_firewall.md
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
---
|
||||||
|
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||||
|
page_title: "virtfusion_server_firewall Resource - virtfusion"
|
||||||
|
subcategory: ""
|
||||||
|
description: |-
|
||||||
|
Manages a VirtFusion server firewall.
|
||||||
|
---
|
||||||
|
|
||||||
|
# virtfusion_server_firewall (Resource)
|
||||||
|
|
||||||
|
Manages a VirtFusion server firewall.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- schema generated by tfplugindocs -->
|
||||||
|
## Schema
|
||||||
|
|
||||||
|
### Required
|
||||||
|
|
||||||
|
- `server_id` (Number) The ID of the server.
|
||||||
|
|
||||||
|
### Optional
|
||||||
|
|
||||||
|
- `interface_name` (String) The network interface name. Defaults to `eth0`.
|
||||||
|
- `rules` (Attributes List) The firewall rules. (see [below for nested schema](#nestedatt--rules))
|
||||||
|
|
||||||
|
### Read-Only
|
||||||
|
|
||||||
|
- `id` (String) Composite identifier in the format `server_id/interface_name`.
|
||||||
|
|
||||||
|
<a id="nestedatt--rules"></a>
|
||||||
|
### Nested Schema for `rules`
|
||||||
|
|
||||||
|
Required:
|
||||||
|
|
||||||
|
- `action` (String) The action for the rule (e.g. `accept`, `drop`).
|
||||||
|
- `direction` (String) The direction for the rule (e.g. `in`, `out`).
|
||||||
|
- `ip` (String) The IP address or CIDR for the rule.
|
||||||
|
- `port` (String) The port or port range for the rule.
|
||||||
|
- `protocol` (String) The protocol for the rule (e.g. `tcp`, `udp`).
|
||||||
28
docs/resources/server_ipv4.md
Normal file
28
docs/resources/server_ipv4.md
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
---
|
||||||
|
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||||
|
page_title: "virtfusion_server_ipv4 Resource - virtfusion"
|
||||||
|
subcategory: ""
|
||||||
|
description: |-
|
||||||
|
Adds IPv4 addresses to a VirtFusion server.
|
||||||
|
---
|
||||||
|
|
||||||
|
# virtfusion_server_ipv4 (Resource)
|
||||||
|
|
||||||
|
Adds IPv4 addresses to a VirtFusion server.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- schema generated by tfplugindocs -->
|
||||||
|
## Schema
|
||||||
|
|
||||||
|
### Required
|
||||||
|
|
||||||
|
- `server_id` (Number) The ID of the server. Changing this forces a new resource to be created.
|
||||||
|
|
||||||
|
### Optional
|
||||||
|
|
||||||
|
- `quantity` (Number) The number of IPv4 addresses to add. Defaults to `1`. Changing this forces a new resource to be created.
|
||||||
|
|
||||||
|
### Read-Only
|
||||||
|
|
||||||
|
- `id` (String) Resource identifier.
|
||||||
25
docs/resources/server_network_whitelist.md
Normal file
25
docs/resources/server_network_whitelist.md
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
---
|
||||||
|
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||||
|
page_title: "virtfusion_server_network_whitelist Resource - virtfusion"
|
||||||
|
subcategory: ""
|
||||||
|
description: |-
|
||||||
|
Manages a VirtFusion server network whitelist entry.
|
||||||
|
---
|
||||||
|
|
||||||
|
# virtfusion_server_network_whitelist (Resource)
|
||||||
|
|
||||||
|
Manages a VirtFusion server network whitelist entry.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- schema generated by tfplugindocs -->
|
||||||
|
## Schema
|
||||||
|
|
||||||
|
### Required
|
||||||
|
|
||||||
|
- `ip` (String) The IP address to whitelist. Changing this forces a new resource to be created.
|
||||||
|
- `server_id` (Number) The ID of the server. Changing this forces a new resource to be created.
|
||||||
|
|
||||||
|
### Read-Only
|
||||||
|
|
||||||
|
- `id` (String) Composite identifier in the format `server_id/ip`.
|
||||||
30
docs/resources/server_password_reset.md
Normal file
30
docs/resources/server_password_reset.md
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
---
|
||||||
|
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||||
|
page_title: "virtfusion_server_password_reset Resource - virtfusion"
|
||||||
|
subcategory: ""
|
||||||
|
description: |-
|
||||||
|
Resets the password for a VirtFusion server. This is a trigger-style resource — the reset is executed on create and can be re-triggered by changing the triggers attribute.
|
||||||
|
---
|
||||||
|
|
||||||
|
# virtfusion_server_password_reset (Resource)
|
||||||
|
|
||||||
|
Resets the password for a VirtFusion server. This is a trigger-style resource — the reset is executed on create and can be re-triggered by changing the `triggers` attribute.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- schema generated by tfplugindocs -->
|
||||||
|
## Schema
|
||||||
|
|
||||||
|
### Required
|
||||||
|
|
||||||
|
- `server_id` (Number) The ID of the server to reset the password for.
|
||||||
|
- `user` (String) The user to reset the password for. Must be `root` (Linux) or `Administrator` (Windows).
|
||||||
|
|
||||||
|
### Optional
|
||||||
|
|
||||||
|
- `triggers` (Map of String) A map of arbitrary strings that, when changed, will cause the password reset to be re-executed. Works like `triggers` in `terraform_data`.
|
||||||
|
|
||||||
|
### Read-Only
|
||||||
|
|
||||||
|
- `id` (String) The identifier for this password reset.
|
||||||
|
- `password` (String, Sensitive) The new password generated by the reset operation.
|
||||||
29
docs/resources/server_power_action.md
Normal file
29
docs/resources/server_power_action.md
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
---
|
||||||
|
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||||
|
page_title: "virtfusion_server_power_action Resource - virtfusion"
|
||||||
|
subcategory: ""
|
||||||
|
description: |-
|
||||||
|
Performs a power action on a VirtFusion server. This is a trigger-style resource — the action is executed on create and can be re-triggered by changing the triggers attribute.
|
||||||
|
---
|
||||||
|
|
||||||
|
# virtfusion_server_power_action (Resource)
|
||||||
|
|
||||||
|
Performs a power action on a VirtFusion server. This is a trigger-style resource — the action is executed on create and can be re-triggered by changing the `triggers` attribute.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- schema generated by tfplugindocs -->
|
||||||
|
## Schema
|
||||||
|
|
||||||
|
### Required
|
||||||
|
|
||||||
|
- `action` (String) The power action to perform. Must be one of: `boot`, `shutdown`, `restart`, `poweroff`.
|
||||||
|
- `server_id` (Number) The ID of the server to perform the power action on.
|
||||||
|
|
||||||
|
### Optional
|
||||||
|
|
||||||
|
- `triggers` (Map of String) A map of arbitrary strings that, when changed, will cause the power action to be re-executed. Works like `triggers` in `terraform_data`.
|
||||||
|
|
||||||
|
### Read-Only
|
||||||
|
|
||||||
|
- `id` (String) The identifier for this power action.
|
||||||
25
docs/resources/server_traffic_block.md
Normal file
25
docs/resources/server_traffic_block.md
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
---
|
||||||
|
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||||
|
page_title: "virtfusion_server_traffic_block Resource - virtfusion"
|
||||||
|
subcategory: ""
|
||||||
|
description: |-
|
||||||
|
Manages a traffic block on a VirtFusion server.
|
||||||
|
---
|
||||||
|
|
||||||
|
# virtfusion_server_traffic_block (Resource)
|
||||||
|
|
||||||
|
Manages a traffic block on a VirtFusion server.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- schema generated by tfplugindocs -->
|
||||||
|
## Schema
|
||||||
|
|
||||||
|
### Required
|
||||||
|
|
||||||
|
- `server_id` (Number) The ID of the server to add the traffic block to.
|
||||||
|
- `type` (String) The type of traffic block (e.g. `inbound` or `outbound`).
|
||||||
|
|
||||||
|
### Read-Only
|
||||||
|
|
||||||
|
- `id` (Number) The identifier of the traffic block.
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
---
|
|
||||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
|
||||||
page_title: "virtfusion_ssh Resource - terraform-provider-virtfusion"
|
|
||||||
subcategory: ""
|
|
||||||
description: |-
|
|
||||||
Virtfusion SSH Resource
|
|
||||||
---
|
|
||||||
|
|
||||||
# virtfusion_ssh (Resource)
|
|
||||||
|
|
||||||
Virtfusion SSH Resource
|
|
||||||
|
|
||||||
## Example Usage
|
|
||||||
|
|
||||||
```terraform
|
|
||||||
resource "virtfusion_ssh" "dummy_key" {
|
|
||||||
# This is what is displayed in the UI on the SSH keys page.
|
|
||||||
name = "dummy_key"
|
|
||||||
|
|
||||||
public_key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCRM5gzj6BpVbTEZ8XX5meQOC9X+znTMCQbXTfdqm9IP3HY2JbqH+yfCBWSsLpXim6WvsYtfkAhrtrkdmaX66Wn1uo6XvARwi/5D1VRTM94vwoitJb0rne4OorpwGIGCpDIi1iRA/ERIbAIQpw/2PJfm7q+fEj9TS+n/MzYOOmwTaKPEJ8+wHwXbjcSNoBQmEPonafbQKQN5PXe5rwnTNAqJWhGPHqF2t7lvZy+m7Sl7X1vUVlw+7iZzOVm9iDXmUInc8A0kz18l/O+4ELhRxxzjmSX5/KkN0GG7wS7CHlq9MS2741MS6p0ZNMgTT/04RfsY5JXoOa1gCeAdnXQST9ylvBd6hXubV95lRM8AXAhEJFHpa0Xn1gHMJ4F0cjjvmBIDx39QztuYsNJPk8veBBQwhOzhnJ3Zh2IYTQD+Mwu5yUrJzUt7ia8X5fhjbrYlfUgdH+siBbvJRzyXwnZdHArher55U4xPCJO4qRrFr72Jn+WGzkcY53oLnW5K3NnPaYViCJD2BgJZU1YF8oA3RyEG+2GS7Ksqs2nXXlZ1c+RXLUXM0pxDrwqvYrE3Ae+O/PtZ0cqpesyjxDfH/R2cj86jjdEi7S8nhgkumHwkoac8LCJnoAeC9S7sxmI99VBHcNwCazx3ZL2UAI3Ik/DQBZXcCPXw9MfY25SyQwEYftMKw== dummy_key"
|
|
||||||
|
|
||||||
# This is the user ID that the key will be associated with.
|
|
||||||
user_id = 1
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
<!-- schema generated by tfplugindocs -->
|
|
||||||
## Schema
|
|
||||||
|
|
||||||
### Required
|
|
||||||
|
|
||||||
- `name` (String) Key Name
|
|
||||||
- `public_key` (String) Public Key
|
|
||||||
- `user_id` (Number) User ID
|
|
||||||
|
|
||||||
### Read-Only
|
|
||||||
|
|
||||||
- `id` (Number) SSH Key ID
|
|
||||||
38
docs/resources/ssh_key.md
Normal file
38
docs/resources/ssh_key.md
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
---
|
||||||
|
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||||
|
page_title: "virtfusion_ssh_key Resource - virtfusion"
|
||||||
|
subcategory: ""
|
||||||
|
description: |-
|
||||||
|
Manages a VirtFusion SSH key.
|
||||||
|
---
|
||||||
|
|
||||||
|
# virtfusion_ssh_key (Resource)
|
||||||
|
|
||||||
|
Manages a VirtFusion SSH key.
|
||||||
|
|
||||||
|
## Example Usage
|
||||||
|
|
||||||
|
```terraform
|
||||||
|
resource "virtfusion_ssh_key" "mykey" {
|
||||||
|
user_id = 1
|
||||||
|
name = "my-ssh-key"
|
||||||
|
public_key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIExample user@example.com"
|
||||||
|
}
|
||||||
|
|
||||||
|
output "ssh_key_id" {
|
||||||
|
value = virtfusion_ssh_key.mykey.id
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
<!-- schema generated by tfplugindocs -->
|
||||||
|
## Schema
|
||||||
|
|
||||||
|
### Required
|
||||||
|
|
||||||
|
- `name` (String) The name of the SSH key.
|
||||||
|
- `public_key` (String) The public key content.
|
||||||
|
- `user_id` (Number) The ID of the user who owns this SSH key.
|
||||||
|
|
||||||
|
### Read-Only
|
||||||
|
|
||||||
|
- `id` (Number) The ID of the SSH key.
|
||||||
35
docs/resources/user.md
Normal file
35
docs/resources/user.md
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
---
|
||||||
|
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||||
|
page_title: "virtfusion_user Resource - virtfusion"
|
||||||
|
subcategory: ""
|
||||||
|
description: |-
|
||||||
|
Manages a VirtFusion user.
|
||||||
|
---
|
||||||
|
|
||||||
|
# virtfusion_user (Resource)
|
||||||
|
|
||||||
|
Manages a VirtFusion user.
|
||||||
|
|
||||||
|
## Example Usage
|
||||||
|
|
||||||
|
```terraform
|
||||||
|
resource "virtfusion_user" "customer1" {
|
||||||
|
name = "John Doe"
|
||||||
|
email = "john@example.com"
|
||||||
|
ext_relation_id = "cust-12345"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
<!-- schema generated by tfplugindocs -->
|
||||||
|
## Schema
|
||||||
|
|
||||||
|
### Required
|
||||||
|
|
||||||
|
- `email` (String) The email address of the user.
|
||||||
|
- `ext_relation_id` (String) The external relation ID used to look up the user. Changing this forces a new resource to be created.
|
||||||
|
- `name` (String) The name of the user.
|
||||||
|
|
||||||
|
### Read-Only
|
||||||
|
|
||||||
|
- `enabled` (Boolean) Whether the user is enabled.
|
||||||
|
- `id` (Number) The numeric ID of the user.
|
||||||
30
docs/resources/user_auth_token.md
Normal file
30
docs/resources/user_auth_token.md
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
---
|
||||||
|
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||||
|
page_title: "virtfusion_user_auth_token Resource - virtfusion"
|
||||||
|
subcategory: ""
|
||||||
|
description: |-
|
||||||
|
Generates an authentication token for a VirtFusion user. This is a trigger-style resource — the token is generated on create and can be re-generated by changing the triggers attribute.
|
||||||
|
---
|
||||||
|
|
||||||
|
# virtfusion_user_auth_token (Resource)
|
||||||
|
|
||||||
|
Generates an authentication token for a VirtFusion user. This is a trigger-style resource — the token is generated on create and can be re-generated by changing the `triggers` attribute.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- schema generated by tfplugindocs -->
|
||||||
|
## Schema
|
||||||
|
|
||||||
|
### Required
|
||||||
|
|
||||||
|
- `ext_relation_id` (String) The external relation ID of the user to generate the auth token for.
|
||||||
|
|
||||||
|
### Optional
|
||||||
|
|
||||||
|
- `triggers` (Map of String) A map of arbitrary strings that, when changed, will cause the auth token to be re-generated. Works like `triggers` in `terraform_data`.
|
||||||
|
|
||||||
|
### Read-Only
|
||||||
|
|
||||||
|
- `id` (String) The identifier for this auth token generation.
|
||||||
|
- `token` (String, Sensitive) The generated authentication token.
|
||||||
|
- `url` (String, Sensitive) The authentication URL for the generated token.
|
||||||
28
docs/resources/user_password_reset.md
Normal file
28
docs/resources/user_password_reset.md
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
---
|
||||||
|
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||||
|
page_title: "virtfusion_user_password_reset Resource - virtfusion"
|
||||||
|
subcategory: ""
|
||||||
|
description: |-
|
||||||
|
Resets the password for a VirtFusion user by external relation ID. This is a trigger-style resource — the reset is executed on create and can be re-triggered by changing the triggers attribute.
|
||||||
|
---
|
||||||
|
|
||||||
|
# virtfusion_user_password_reset (Resource)
|
||||||
|
|
||||||
|
Resets the password for a VirtFusion user by external relation ID. This is a trigger-style resource — the reset is executed on create and can be re-triggered by changing the `triggers` attribute.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- schema generated by tfplugindocs -->
|
||||||
|
## Schema
|
||||||
|
|
||||||
|
### Required
|
||||||
|
|
||||||
|
- `ext_relation_id` (String) The external relation ID of the user to reset the password for.
|
||||||
|
|
||||||
|
### Optional
|
||||||
|
|
||||||
|
- `triggers` (Map of String) A map of arbitrary strings that, when changed, will cause the password reset to be re-executed. Works like `triggers` in `terraform_data`.
|
||||||
|
|
||||||
|
### Read-Only
|
||||||
|
|
||||||
|
- `id` (String) The identifier for this password reset.
|
||||||
31
docs/resources/user_server_auth_token.md
Normal file
31
docs/resources/user_server_auth_token.md
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
---
|
||||||
|
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||||
|
page_title: "virtfusion_user_server_auth_token Resource - virtfusion"
|
||||||
|
subcategory: ""
|
||||||
|
description: |-
|
||||||
|
Generates a server-scoped authentication token for a VirtFusion user. This is a trigger-style resource — the token is generated on create and can be re-generated by changing the triggers attribute.
|
||||||
|
---
|
||||||
|
|
||||||
|
# virtfusion_user_server_auth_token (Resource)
|
||||||
|
|
||||||
|
Generates a server-scoped authentication token for a VirtFusion user. This is a trigger-style resource — the token is generated on create and can be re-generated by changing the `triggers` attribute.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- schema generated by tfplugindocs -->
|
||||||
|
## Schema
|
||||||
|
|
||||||
|
### Required
|
||||||
|
|
||||||
|
- `ext_relation_id` (String) The external relation ID of the user to generate the server auth token for.
|
||||||
|
- `server_id` (Number) The ID of the server to scope the auth token to.
|
||||||
|
|
||||||
|
### Optional
|
||||||
|
|
||||||
|
- `triggers` (Map of String) A map of arbitrary strings that, when changed, will cause the server auth token to be re-generated. Works like `triggers` in `terraform_data`.
|
||||||
|
|
||||||
|
### Read-Only
|
||||||
|
|
||||||
|
- `id` (String) The identifier for this server auth token generation.
|
||||||
|
- `token` (String, Sensitive) The generated server authentication token.
|
||||||
|
- `url` (String, Sensitive) The authentication URL for the generated server token.
|
||||||
506
endpoint-manifest.json
Normal file
506
endpoint-manifest.json
Normal file
@@ -0,0 +1,506 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"method": "GET",
|
||||||
|
"path": "/backups/server/{serverId}",
|
||||||
|
"summary": "Retrieve a server backups",
|
||||||
|
"tag": "Backups"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "GET",
|
||||||
|
"path": "/compute/hypervisors",
|
||||||
|
"summary": "Retrieve hypervisors",
|
||||||
|
"tag": "Hypervisors"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "GET",
|
||||||
|
"path": "/compute/hypervisors/{hypervisorId}",
|
||||||
|
"summary": "Retrive a Hypervisor",
|
||||||
|
"tag": "Hypervisors"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "GET",
|
||||||
|
"path": "/compute/hypervisors/groups",
|
||||||
|
"summary": "Retrieve hypervisor groups",
|
||||||
|
"tag": "Hypervisor Groups"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "GET",
|
||||||
|
"path": "/compute/hypervisors/groups/{hypervisorGroupId}",
|
||||||
|
"summary": "Retrieve a hypervisor group",
|
||||||
|
"tag": "Hypervisor Groups"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "GET",
|
||||||
|
"path": "/compute/hypervisors/groups/{hypervisorGroupId}/resources",
|
||||||
|
"summary": "Retrieve a hypervisor groups resources",
|
||||||
|
"tag": "Hypervisor Groups"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "GET",
|
||||||
|
"path": "/connect",
|
||||||
|
"summary": "Test connection",
|
||||||
|
"tag": "General"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "GET",
|
||||||
|
"path": "/connectivity/ipblocks",
|
||||||
|
"summary": "Retrieve IP blocks",
|
||||||
|
"tag": "IP Blocks"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "GET",
|
||||||
|
"path": "/connectivity/ipblocks/{blockId}",
|
||||||
|
"summary": "Retrieve an IP block",
|
||||||
|
"tag": "IP Blocks"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "POST",
|
||||||
|
"path": "/connectivity/ipblocks/{blockId}/ipv4",
|
||||||
|
"summary": "Add an IPv4 range to an IP block",
|
||||||
|
"tag": "IP Blocks"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "GET",
|
||||||
|
"path": "/dns/services/{serviceId}",
|
||||||
|
"summary": "Retrieve a DNS service",
|
||||||
|
"tag": "DNS"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "GET",
|
||||||
|
"path": "/media/iso/{isoId}",
|
||||||
|
"summary": "Retrieve an ISO",
|
||||||
|
"tag": "Media"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "GET",
|
||||||
|
"path": "/media/templates/fromServerPackageSpec/{serverPackageId}",
|
||||||
|
"summary": "Retrieve operating system templates that are available for a package",
|
||||||
|
"tag": "Media"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "GET",
|
||||||
|
"path": "/packages",
|
||||||
|
"summary": "Retrieve packages",
|
||||||
|
"tag": "Packages"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "GET",
|
||||||
|
"path": "/packages/{packageId}",
|
||||||
|
"summary": "Retrieve a packge",
|
||||||
|
"tag": "Packages"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "GET",
|
||||||
|
"path": "/queue/{queueId}",
|
||||||
|
"summary": "Retrieve a queue item",
|
||||||
|
"tag": "Queue & Tasks"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "PUT",
|
||||||
|
"path": "/selfService/access/byUserExtRelationId/{extRelationId}",
|
||||||
|
"summary": "Modify user access",
|
||||||
|
"tag": "Self Service/External Relational ID"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "DELETE",
|
||||||
|
"path": "/selfService/credit/{creditId}",
|
||||||
|
"summary": "Cancel credit that was applied to a user",
|
||||||
|
"tag": "Self Service"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "POST",
|
||||||
|
"path": "/selfService/credit/byUserExtRelationId/{extRelationId}",
|
||||||
|
"summary": "Add credit to user",
|
||||||
|
"tag": "Self Service/External Relational ID"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "GET",
|
||||||
|
"path": "/selfService/currencies",
|
||||||
|
"summary": "Retrieve currencies",
|
||||||
|
"tag": "Self Service"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "DELETE",
|
||||||
|
"path": "/selfService/hourlyGroupProfile/{profileId}/byUserExtRelationId/{extRelationId}",
|
||||||
|
"summary": "Remove hourly group profile from a user",
|
||||||
|
"tag": "Self Service/External Relational ID"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "POST",
|
||||||
|
"path": "/selfService/hourlyGroupProfile/byUserExtRelationId/{extRelationId}",
|
||||||
|
"summary": "Add an hourly group profile to a user",
|
||||||
|
"tag": "Self Service/External Relational ID"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "PUT",
|
||||||
|
"path": "/selfService/hourlyResourcePack/byUserExtRelationId/{extRelationId}",
|
||||||
|
"summary": "Set an hourly resource pack",
|
||||||
|
"tag": "Self Service/External Relational ID"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "GET",
|
||||||
|
"path": "/selfService/hourlyStats/byUserExtRelationId/{extRelationId}",
|
||||||
|
"summary": "Retrieve hourly statistics",
|
||||||
|
"tag": "Self Service/External Relational ID"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "GET",
|
||||||
|
"path": "/selfService/report/byUserExtRelationId/{extRelationId}",
|
||||||
|
"summary": "Generate a report",
|
||||||
|
"tag": "Self Service/External Relational ID"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "DELETE",
|
||||||
|
"path": "/selfService/resourceGroupProfile/{profileId}/byUserExtRelationId/{extRelationId}",
|
||||||
|
"summary": "Remove resource group from a user",
|
||||||
|
"tag": "Self Service/External Relational ID"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "POST",
|
||||||
|
"path": "/selfService/resourceGroupProfile/byUserExtRelationId/{extRelationId}",
|
||||||
|
"summary": "Add a resource group profile to a user",
|
||||||
|
"tag": "Self Service/External Relational ID"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "DELETE",
|
||||||
|
"path": "/selfService/resourcePack/{packId}",
|
||||||
|
"summary": "Delete a user resource pack",
|
||||||
|
"tag": "Self Service"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "GET",
|
||||||
|
"path": "/selfService/resourcePack/{packId}",
|
||||||
|
"summary": "Retrieve a user resource pack",
|
||||||
|
"tag": "Self Service"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "PUT",
|
||||||
|
"path": "/selfService/resourcePack/{packId}",
|
||||||
|
"summary": "Modify user resource pack",
|
||||||
|
"tag": "Self Service"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "POST",
|
||||||
|
"path": "/selfService/resourcePack/byUserExtRelationId/{extRelationId}",
|
||||||
|
"summary": "Add a resource pack to a user",
|
||||||
|
"tag": "Self Service/External Relational ID"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "DELETE",
|
||||||
|
"path": "/selfService/resourcePackServers/{packId}",
|
||||||
|
"summary": "Delete all servers attached to a pack ID",
|
||||||
|
"tag": "Self Service"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "POST",
|
||||||
|
"path": "/selfService/resourcePackServers/{packId}/suspend",
|
||||||
|
"summary": "Suspend all servers assigned to a reosurce pack",
|
||||||
|
"tag": "Self Service"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "POST",
|
||||||
|
"path": "/selfService/resourcePackServers/{packId}/unsuspend",
|
||||||
|
"summary": "Unsuspend all servers assigned to a reosurce pack",
|
||||||
|
"tag": "Self Service"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "GET",
|
||||||
|
"path": "/selfService/usage/byUserExtRelationId/{extRelationId}",
|
||||||
|
"summary": "Retrieve a users usage",
|
||||||
|
"tag": "Self Service/External Relational ID"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "GET",
|
||||||
|
"path": "/servers",
|
||||||
|
"summary": "Retrieve servers",
|
||||||
|
"tag": "Servers"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "POST",
|
||||||
|
"path": "/servers",
|
||||||
|
"summary": "Create a server",
|
||||||
|
"tag": "Servers"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "DELETE",
|
||||||
|
"path": "/servers/{serverId}",
|
||||||
|
"summary": "Delete a server",
|
||||||
|
"tag": "Servers"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "GET",
|
||||||
|
"path": "/servers/{serverId}",
|
||||||
|
"summary": "Retrieve a server",
|
||||||
|
"tag": "Servers"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "PUT",
|
||||||
|
"path": "/servers/{serverId}/backups/plan/{planId}",
|
||||||
|
"summary": "Add, remove or modify a backup plan",
|
||||||
|
"tag": "Servers"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "POST",
|
||||||
|
"path": "/servers/{serverId}/build",
|
||||||
|
"summary": "Build a server",
|
||||||
|
"tag": "Servers"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "POST",
|
||||||
|
"path": "/servers/{serverId}/customXML",
|
||||||
|
"summary": "Set custom XML",
|
||||||
|
"tag": "Servers"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "GET",
|
||||||
|
"path": "/servers/{serverId}/firewall/{interface}",
|
||||||
|
"summary": "Retrieve firewall",
|
||||||
|
"tag": "Servers/Network/Firewall"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "POST",
|
||||||
|
"path": "/servers/{serverId}/firewall/{interface}/disable",
|
||||||
|
"summary": "Disable firewall",
|
||||||
|
"tag": "Servers/Network/Firewall"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "POST",
|
||||||
|
"path": "/servers/{serverId}/firewall/{interface}/enable",
|
||||||
|
"summary": "Enable firewall",
|
||||||
|
"tag": "Servers/Network/Firewall"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "POST",
|
||||||
|
"path": "/servers/{serverId}/firewall/{interface}/rules",
|
||||||
|
"summary": "Apply firewall rulesets",
|
||||||
|
"tag": "Servers/Network/Firewall"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "DELETE",
|
||||||
|
"path": "/servers/{serverId}/ipv4",
|
||||||
|
"summary": "Remove an array of IPv4 addresses",
|
||||||
|
"tag": "Servers/Network"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "POST",
|
||||||
|
"path": "/servers/{serverId}/ipv4",
|
||||||
|
"summary": "Add an array of IPv4 addresses",
|
||||||
|
"tag": "Servers/Network"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "POST",
|
||||||
|
"path": "/servers/{serverId}/ipv4Qty",
|
||||||
|
"summary": "Add a quantity of IPv4 addresses",
|
||||||
|
"tag": "Servers/Network"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "PUT",
|
||||||
|
"path": "/servers/{serverId}/modify/cpuCores",
|
||||||
|
"summary": "Modify CPU cores",
|
||||||
|
"tag": "Servers"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "PUT",
|
||||||
|
"path": "/servers/{serverId}/modify/cpuThrottle",
|
||||||
|
"summary": "Throttle a servers CPU",
|
||||||
|
"tag": "Servers"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "PUT",
|
||||||
|
"path": "/servers/{serverId}/modify/memory",
|
||||||
|
"summary": "Modify memory",
|
||||||
|
"tag": "Servers"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "PUT",
|
||||||
|
"path": "/servers/{serverId}/modify/name",
|
||||||
|
"summary": "Modify name",
|
||||||
|
"tag": "Servers"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "PUT",
|
||||||
|
"path": "/servers/{serverId}/modify/traffic",
|
||||||
|
"summary": "Modify primary traffic allowance",
|
||||||
|
"tag": "Servers/Network/Traffic"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "DELETE",
|
||||||
|
"path": "/servers/{serverId}/networkWhitelist",
|
||||||
|
"summary": "Remove an address from the whitelist",
|
||||||
|
"tag": "Servers/Network"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "POST",
|
||||||
|
"path": "/servers/{serverId}/networkWhitelist",
|
||||||
|
"summary": "Add an address to the whitelist",
|
||||||
|
"tag": "Servers/Network"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "PUT",
|
||||||
|
"path": "/servers/{serverId}/owner/{newOwnerId}",
|
||||||
|
"summary": "Change owner",
|
||||||
|
"tag": "Servers"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "PUT",
|
||||||
|
"path": "/servers/{serverId}/package/{packageId}",
|
||||||
|
"summary": "Change a server package",
|
||||||
|
"tag": "Servers"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "POST",
|
||||||
|
"path": "/servers/{serverId}/power/boot",
|
||||||
|
"summary": "Boot a server",
|
||||||
|
"tag": "Servers/Power"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "POST",
|
||||||
|
"path": "/servers/{serverId}/power/poweroff",
|
||||||
|
"summary": "Poweroff a server",
|
||||||
|
"tag": "Servers/Power"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "POST",
|
||||||
|
"path": "/servers/{serverId}/power/restart",
|
||||||
|
"summary": "Restart a server",
|
||||||
|
"tag": "Servers/Power"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "POST",
|
||||||
|
"path": "/servers/{serverId}/power/shutdown",
|
||||||
|
"summary": "Shutdown a server",
|
||||||
|
"tag": "Servers/Power"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "POST",
|
||||||
|
"path": "/servers/{serverId}/resetPassword",
|
||||||
|
"summary": "Reset a server password",
|
||||||
|
"tag": "Servers"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "POST",
|
||||||
|
"path": "/servers/{serverId}/suspend",
|
||||||
|
"summary": "Suspend a server",
|
||||||
|
"tag": "Servers"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "GET",
|
||||||
|
"path": "/servers/{serverId}/templates",
|
||||||
|
"summary": "Retrieve OS templates available to a server",
|
||||||
|
"tag": "Servers"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "GET",
|
||||||
|
"path": "/servers/{serverId}/traffic",
|
||||||
|
"summary": "Retrieve a servers traffic statistics",
|
||||||
|
"tag": "Servers"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "GET",
|
||||||
|
"path": "/servers/{serverId}/traffic/blocks",
|
||||||
|
"summary": "Retrieve a servers traffic blocks",
|
||||||
|
"tag": "Servers/Network/Traffic"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "POST",
|
||||||
|
"path": "/servers/{serverId}/traffic/blocks",
|
||||||
|
"summary": "Add a traffic block to a server",
|
||||||
|
"tag": "Servers/Network/Traffic"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "DELETE",
|
||||||
|
"path": "/servers/{serverId}/traffic/blocks/{blockId}",
|
||||||
|
"summary": "Remove a traffic block from a server",
|
||||||
|
"tag": "Servers/Network/Traffic"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "POST",
|
||||||
|
"path": "/servers/{serverId}/unsuspend",
|
||||||
|
"summary": "Unsuspend a server",
|
||||||
|
"tag": "Servers"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "GET",
|
||||||
|
"path": "/servers/{serverId}/vnc",
|
||||||
|
"summary": "Retrive VNC details",
|
||||||
|
"tag": "Servers"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "POST",
|
||||||
|
"path": "/servers/{serverId}/vnc",
|
||||||
|
"summary": "Enable or disable VNC",
|
||||||
|
"tag": "Servers"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "GET",
|
||||||
|
"path": "/servers/user/{userId}",
|
||||||
|
"summary": "Retrieve a users servers",
|
||||||
|
"tag": "Servers"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "POST",
|
||||||
|
"path": "/ssh_keys",
|
||||||
|
"summary": "Add an SSH key to a user account",
|
||||||
|
"tag": "SSH Keys"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "DELETE",
|
||||||
|
"path": "/ssh_keys/{keyId}",
|
||||||
|
"summary": "Delete an SSH key from a user",
|
||||||
|
"tag": "SSH Keys"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "GET",
|
||||||
|
"path": "/ssh_keys/{keyId}",
|
||||||
|
"summary": "Retrieve an SSH key",
|
||||||
|
"tag": "SSH Keys"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "GET",
|
||||||
|
"path": "/ssh_keys/user/{userId}",
|
||||||
|
"summary": "Retrieve a users SSH keys",
|
||||||
|
"tag": "SSH Keys"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "POST",
|
||||||
|
"path": "/users",
|
||||||
|
"summary": "Create a user",
|
||||||
|
"tag": "Users"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "POST",
|
||||||
|
"path": "/users/{extRelationId}/authenticationTokens",
|
||||||
|
"summary": "Generate a set of login tokens",
|
||||||
|
"tag": "Users/External Rel ID & Rel Str"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "DELETE",
|
||||||
|
"path": "/users/{extRelationId}/byExtRelation",
|
||||||
|
"summary": "Delete a user",
|
||||||
|
"tag": "Users/External Rel ID & Rel Str"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "GET",
|
||||||
|
"path": "/users/{extRelationId}/byExtRelation",
|
||||||
|
"summary": "Retrieve a user",
|
||||||
|
"tag": "Users/External Rel ID & Rel Str"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "PUT",
|
||||||
|
"path": "/users/{extRelationId}/byExtRelation",
|
||||||
|
"summary": "Modify a user",
|
||||||
|
"tag": "Users/External Rel ID & Rel Str"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "POST",
|
||||||
|
"path": "/users/{extRelationId}/byExtRelation/resetPassword",
|
||||||
|
"summary": "Change a user passowrd",
|
||||||
|
"tag": "Users/External Rel ID & Rel Str"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"method": "POST",
|
||||||
|
"path": "/users/{extRelationId}/serverAuthenticationTokens/{serverId}",
|
||||||
|
"summary": "Generate a set of loging tokens using a server ID",
|
||||||
|
"tag": "Users/External Rel ID & Rel Str"
|
||||||
|
}
|
||||||
|
]
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
data "scaffolding_example" "example" {
|
|
||||||
configurable_attribute = "some-value"
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
data "virtfusion_hypervisors" "all" {}
|
||||||
|
|
||||||
|
output "hypervisor_names" {
|
||||||
|
value = [for h in data.virtfusion_hypervisors.all.hypervisors : h.name]
|
||||||
|
}
|
||||||
5
examples/data-sources/virtfusion_packages/data-source.tf
Normal file
5
examples/data-sources/virtfusion_packages/data-source.tf
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
data "virtfusion_packages" "all" {}
|
||||||
|
|
||||||
|
output "package_names" {
|
||||||
|
value = [for p in data.virtfusion_packages.all.packages : p.name]
|
||||||
|
}
|
||||||
7
examples/data-sources/virtfusion_server/data-source.tf
Normal file
7
examples/data-sources/virtfusion_server/data-source.tf
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
data "virtfusion_server" "example" {
|
||||||
|
id = 1
|
||||||
|
}
|
||||||
|
|
||||||
|
output "server_name" {
|
||||||
|
value = data.virtfusion_server.example.name
|
||||||
|
}
|
||||||
@@ -1,4 +1,9 @@
|
|||||||
provider "virtfusion" {
|
provider "virtfusion" {
|
||||||
endpoint = "example.com"
|
endpoint = "https://cp.example.com"
|
||||||
api_token = "myapikey"
|
api_token = var.virtfusion_api_token
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "virtfusion_api_token" {
|
||||||
|
type = string
|
||||||
|
sensitive = true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
resource "virtfusion_build" "node1" {
|
|
||||||
server_id = virtfusion_server.node1.id
|
|
||||||
name = "node1-demo"
|
|
||||||
hostname = "node1.example.com"
|
|
||||||
osid = 1
|
|
||||||
vnc = true
|
|
||||||
ipv6 = true
|
|
||||||
ssh_keys = [virtfusion_ssh.dummy_key.id]
|
|
||||||
email = true
|
|
||||||
}
|
|
||||||
@@ -12,3 +12,7 @@ resource "virtfusion_server" "node1" {
|
|||||||
storage_profile = 1
|
storage_profile = 1
|
||||||
network_profile = 1
|
network_profile = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
output "server_id" {
|
||||||
|
value = virtfusion_server.node1.id
|
||||||
|
}
|
||||||
|
|||||||
10
examples/resources/virtfusion_server_build/resource.tf
Normal file
10
examples/resources/virtfusion_server_build/resource.tf
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
resource "virtfusion_server_build" "node1_build" {
|
||||||
|
server_id = virtfusion_server.node1.id
|
||||||
|
name = "my-server"
|
||||||
|
hostname = "my-server.example.com"
|
||||||
|
osid = 1
|
||||||
|
vnc = true
|
||||||
|
ipv6 = false
|
||||||
|
ssh_keys = [virtfusion_ssh_key.mykey.id]
|
||||||
|
email = false
|
||||||
|
}
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
resource "virtfusion_ssh" "dummy_key" {
|
|
||||||
# This is what is displayed in the UI on the SSH keys page.
|
|
||||||
name = "dummy_key"
|
|
||||||
|
|
||||||
public_key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCRM5gzj6BpVbTEZ8XX5meQOC9X+znTMCQbXTfdqm9IP3HY2JbqH+yfCBWSsLpXim6WvsYtfkAhrtrkdmaX66Wn1uo6XvARwi/5D1VRTM94vwoitJb0rne4OorpwGIGCpDIi1iRA/ERIbAIQpw/2PJfm7q+fEj9TS+n/MzYOOmwTaKPEJ8+wHwXbjcSNoBQmEPonafbQKQN5PXe5rwnTNAqJWhGPHqF2t7lvZy+m7Sl7X1vUVlw+7iZzOVm9iDXmUInc8A0kz18l/O+4ELhRxxzjmSX5/KkN0GG7wS7CHlq9MS2741MS6p0ZNMgTT/04RfsY5JXoOa1gCeAdnXQST9ylvBd6hXubV95lRM8AXAhEJFHpa0Xn1gHMJ4F0cjjvmBIDx39QztuYsNJPk8veBBQwhOzhnJ3Zh2IYTQD+Mwu5yUrJzUt7ia8X5fhjbrYlfUgdH+siBbvJRzyXwnZdHArher55U4xPCJO4qRrFr72Jn+WGzkcY53oLnW5K3NnPaYViCJD2BgJZU1YF8oA3RyEG+2GS7Ksqs2nXXlZ1c+RXLUXM0pxDrwqvYrE3Ae+O/PtZ0cqpesyjxDfH/R2cj86jjdEi7S8nhgkumHwkoac8LCJnoAeC9S7sxmI99VBHcNwCazx3ZL2UAI3Ik/DQBZXcCPXw9MfY25SyQwEYftMKw== dummy_key"
|
|
||||||
|
|
||||||
# This is the user ID that the key will be associated with.
|
|
||||||
user_id = 1
|
|
||||||
}
|
|
||||||
9
examples/resources/virtfusion_ssh_key/resource.tf
Normal file
9
examples/resources/virtfusion_ssh_key/resource.tf
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
resource "virtfusion_ssh_key" "mykey" {
|
||||||
|
user_id = 1
|
||||||
|
name = "my-ssh-key"
|
||||||
|
public_key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIExample user@example.com"
|
||||||
|
}
|
||||||
|
|
||||||
|
output "ssh_key_id" {
|
||||||
|
value = virtfusion_ssh_key.mykey.id
|
||||||
|
}
|
||||||
5
examples/resources/virtfusion_user/resource.tf
Normal file
5
examples/resources/virtfusion_user/resource.tf
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
resource "virtfusion_user" "customer1" {
|
||||||
|
name = "John Doe"
|
||||||
|
email = "john@example.com"
|
||||||
|
ext_relation_id = "cust-12345"
|
||||||
|
}
|
||||||
73
go.mod
73
go.mod
@@ -1,64 +1,71 @@
|
|||||||
module terraform-provider-virtfusion
|
module terraform-provider-virtfusion
|
||||||
|
|
||||||
go 1.21.0
|
go 1.23
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/ezscale/goozzle v0.0.0-20231024225306-c7aec89610f0
|
github.com/hashicorp/terraform-plugin-docs v0.19.4
|
||||||
github.com/hashicorp/terraform-plugin-docs v0.16.0
|
github.com/hashicorp/terraform-plugin-framework v1.13.0
|
||||||
github.com/hashicorp/terraform-plugin-framework v1.4.2
|
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
|
github.com/BurntSushi/toml v1.2.1 // indirect
|
||||||
|
github.com/Kunde21/markdownfmt/v3 v3.1.0 // indirect
|
||||||
github.com/Masterminds/goutils v1.1.1 // indirect
|
github.com/Masterminds/goutils v1.1.1 // indirect
|
||||||
github.com/Masterminds/semver/v3 v3.2.1 // indirect
|
github.com/Masterminds/semver/v3 v3.2.0 // indirect
|
||||||
github.com/Masterminds/sprig/v3 v3.2.3 // indirect
|
github.com/Masterminds/sprig/v3 v3.2.3 // indirect
|
||||||
github.com/ProtonMail/go-crypto v0.0.0-20230923063757-afb1ddc0824c // indirect
|
github.com/ProtonMail/go-crypto v1.1.0-alpha.2 // indirect
|
||||||
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
|
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
|
||||||
github.com/armon/go-radix v1.0.0 // indirect
|
github.com/armon/go-radix v1.0.0 // indirect
|
||||||
github.com/bgentry/speakeasy v0.1.0 // indirect
|
github.com/bgentry/speakeasy v0.1.0 // indirect
|
||||||
github.com/cloudflare/circl v1.3.5 // indirect
|
github.com/bmatcuk/doublestar/v4 v4.6.1 // indirect
|
||||||
github.com/fatih/color v1.15.0 // indirect
|
github.com/cloudflare/circl v1.3.7 // indirect
|
||||||
github.com/golang/protobuf v1.5.3 // indirect
|
github.com/fatih/color v1.16.0 // indirect
|
||||||
github.com/google/uuid v1.3.1 // indirect
|
github.com/golang/protobuf v1.5.4 // indirect
|
||||||
|
github.com/google/uuid v1.6.0 // indirect
|
||||||
|
github.com/hashicorp/cli v1.1.6 // indirect
|
||||||
github.com/hashicorp/errwrap v1.1.0 // indirect
|
github.com/hashicorp/errwrap v1.1.0 // indirect
|
||||||
github.com/hashicorp/go-checkpoint v0.5.0 // indirect
|
github.com/hashicorp/go-checkpoint v0.5.0 // indirect
|
||||||
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
|
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
|
||||||
github.com/hashicorp/go-hclog v1.5.0 // indirect
|
github.com/hashicorp/go-hclog v1.5.0 // indirect
|
||||||
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
||||||
github.com/hashicorp/go-plugin v1.5.2 // indirect
|
github.com/hashicorp/go-plugin v1.6.2 // indirect
|
||||||
github.com/hashicorp/go-uuid v1.0.3 // indirect
|
github.com/hashicorp/go-uuid v1.0.3 // indirect
|
||||||
github.com/hashicorp/go-version v1.6.0 // indirect
|
github.com/hashicorp/go-version v1.7.0 // indirect
|
||||||
github.com/hashicorp/hc-install v0.6.1 // indirect
|
github.com/hashicorp/hc-install v0.7.0 // indirect
|
||||||
github.com/hashicorp/terraform-exec v0.19.0 // indirect
|
github.com/hashicorp/terraform-exec v0.21.0 // indirect
|
||||||
github.com/hashicorp/terraform-json v0.17.1 // indirect
|
github.com/hashicorp/terraform-json v0.22.1 // indirect
|
||||||
github.com/hashicorp/terraform-plugin-go v0.19.0 // indirect
|
github.com/hashicorp/terraform-plugin-go v0.25.0 // indirect
|
||||||
github.com/hashicorp/terraform-plugin-log v0.9.0 // indirect
|
github.com/hashicorp/terraform-plugin-log v0.9.0 // indirect
|
||||||
github.com/hashicorp/terraform-registry-address v0.2.2 // indirect
|
github.com/hashicorp/terraform-registry-address v0.2.3 // indirect
|
||||||
github.com/hashicorp/terraform-svchost v0.1.1 // indirect
|
github.com/hashicorp/terraform-svchost v0.1.1 // indirect
|
||||||
github.com/hashicorp/yamux v0.1.1 // indirect
|
github.com/hashicorp/yamux v0.1.1 // indirect
|
||||||
github.com/huandu/xstrings v1.4.0 // indirect
|
github.com/huandu/xstrings v1.3.3 // indirect
|
||||||
github.com/imdario/mergo v0.3.15 // indirect
|
github.com/imdario/mergo v0.3.15 // indirect
|
||||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||||
github.com/mitchellh/cli v1.1.5 // indirect
|
github.com/mattn/go-runewidth v0.0.9 // indirect
|
||||||
github.com/mitchellh/copystructure v1.2.0 // indirect
|
github.com/mitchellh/copystructure v1.2.0 // indirect
|
||||||
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
|
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
|
||||||
github.com/mitchellh/reflectwalk v1.0.2 // indirect
|
github.com/mitchellh/reflectwalk v1.0.2 // indirect
|
||||||
github.com/oklog/run v1.1.0 // indirect
|
github.com/oklog/run v1.0.0 // indirect
|
||||||
github.com/posener/complete v1.2.3 // indirect
|
github.com/posener/complete v1.2.3 // indirect
|
||||||
github.com/russross/blackfriday v1.6.0 // indirect
|
|
||||||
github.com/shopspring/decimal v1.3.1 // indirect
|
github.com/shopspring/decimal v1.3.1 // indirect
|
||||||
github.com/spf13/cast v1.5.1 // indirect
|
github.com/spf13/cast v1.5.0 // indirect
|
||||||
github.com/vmihailenco/msgpack/v5 v5.4.0 // indirect
|
github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect
|
||||||
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
|
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
|
||||||
github.com/zclconf/go-cty v1.14.1 // indirect
|
github.com/yuin/goldmark v1.7.1 // indirect
|
||||||
golang.org/x/crypto v0.14.0 // indirect
|
github.com/yuin/goldmark-meta v1.1.0 // indirect
|
||||||
golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect
|
github.com/zclconf/go-cty v1.14.4 // indirect
|
||||||
golang.org/x/mod v0.13.0 // indirect
|
go.abhg.dev/goldmark/frontmatter v0.2.0 // indirect
|
||||||
golang.org/x/net v0.17.0 // indirect
|
golang.org/x/crypto v0.26.0 // indirect
|
||||||
golang.org/x/sys v0.13.0 // indirect
|
golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df // indirect
|
||||||
golang.org/x/text v0.13.0 // indirect
|
golang.org/x/mod v0.17.0 // indirect
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20231016165738-49dd2c1f3d0b // indirect
|
golang.org/x/net v0.28.0 // indirect
|
||||||
google.golang.org/grpc v1.59.0 // indirect
|
golang.org/x/sys v0.24.0 // indirect
|
||||||
google.golang.org/protobuf v1.31.0 // indirect
|
golang.org/x/text v0.17.0 // indirect
|
||||||
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 // indirect
|
||||||
|
google.golang.org/grpc v1.67.1 // indirect
|
||||||
|
google.golang.org/protobuf v1.35.1 // indirect
|
||||||
|
gopkg.in/yaml.v2 v2.3.0 // indirect
|
||||||
|
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||||
)
|
)
|
||||||
|
|||||||
209
go.sum
209
go.sum
@@ -1,33 +1,31 @@
|
|||||||
dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk=
|
dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk=
|
||||||
dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk=
|
dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk=
|
||||||
|
github.com/BurntSushi/toml v1.2.1 h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak=
|
||||||
|
github.com/BurntSushi/toml v1.2.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
|
||||||
|
github.com/Kunde21/markdownfmt/v3 v3.1.0 h1:KiZu9LKs+wFFBQKhrZJrFZwtLnCCWJahL+S+E/3VnM0=
|
||||||
|
github.com/Kunde21/markdownfmt/v3 v3.1.0/go.mod h1:tPXN1RTyOzJwhfHoon9wUr4HGYmWgVxSQN6VBJDkrVc=
|
||||||
github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI=
|
github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI=
|
||||||
github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU=
|
github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU=
|
||||||
github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs=
|
github.com/Masterminds/semver/v3 v3.2.0 h1:3MEsd0SM6jqZojhjLWWeBY+Kcjy9i6MQAeY7YgDP83g=
|
||||||
github.com/Masterminds/semver/v3 v3.2.0/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ=
|
github.com/Masterminds/semver/v3 v3.2.0/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ=
|
||||||
github.com/Masterminds/semver/v3 v3.2.1 h1:RN9w6+7QoMeJVGyfmbcgs28Br8cvmnucEXnY0rYXWg0=
|
|
||||||
github.com/Masterminds/semver/v3 v3.2.1/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ=
|
|
||||||
github.com/Masterminds/sprig/v3 v3.2.1/go.mod h1:UoaO7Yp8KlPnJIYWTFkMaqPUYKTfGFPhxNuwnnxkKlk=
|
|
||||||
github.com/Masterminds/sprig/v3 v3.2.3 h1:eL2fZNezLomi0uOLqjQoN6BfsDD+fyLtgbJMAj9n6YA=
|
github.com/Masterminds/sprig/v3 v3.2.3 h1:eL2fZNezLomi0uOLqjQoN6BfsDD+fyLtgbJMAj9n6YA=
|
||||||
github.com/Masterminds/sprig/v3 v3.2.3/go.mod h1:rXcFaZ2zZbLRJv/xSysmlgIM1u11eBaRMhvYXJNkGuM=
|
github.com/Masterminds/sprig/v3 v3.2.3/go.mod h1:rXcFaZ2zZbLRJv/xSysmlgIM1u11eBaRMhvYXJNkGuM=
|
||||||
github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow=
|
github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow=
|
||||||
github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM=
|
github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM=
|
||||||
github.com/ProtonMail/go-crypto v0.0.0-20230923063757-afb1ddc0824c h1:kMFnB0vCcX7IL/m9Y5LO+KQYv+t1CQOiFe6+SV2J7bE=
|
github.com/ProtonMail/go-crypto v1.1.0-alpha.2 h1:bkyFVUP+ROOARdgCiJzNQo2V2kiB97LyUpzH9P6Hrlg=
|
||||||
github.com/ProtonMail/go-crypto v0.0.0-20230923063757-afb1ddc0824c/go.mod h1:EjAoLdwvbIOoOQr3ihjnSoLZRtE8azugULFRteWMNc0=
|
github.com/ProtonMail/go-crypto v1.1.0-alpha.2/go.mod h1:rA3QumHc/FZ8pAHreoekgiAbzpNsfQAosU5td4SnOrE=
|
||||||
github.com/acomagu/bufpipe v1.0.4 h1:e3H4WUzM3npvo5uv95QuJM3cQspFNtFBzvJ2oNjKIDQ=
|
|
||||||
github.com/acomagu/bufpipe v1.0.4/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ2sYmHc4=
|
|
||||||
github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew1u1fNQOlOtuGxQY=
|
github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew1u1fNQOlOtuGxQY=
|
||||||
github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4=
|
github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4=
|
||||||
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
|
|
||||||
github.com/armon/go-radix v1.0.0 h1:F4z6KzEeeQIMeLFa97iZU6vupzoecKdU5TX24SNppXI=
|
github.com/armon/go-radix v1.0.0 h1:F4z6KzEeeQIMeLFa97iZU6vupzoecKdU5TX24SNppXI=
|
||||||
github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
|
github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
|
||||||
github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQkY=
|
github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQkY=
|
||||||
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
|
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
|
||||||
|
github.com/bmatcuk/doublestar/v4 v4.6.1 h1:FH9SifrbvJhnlQpztAx++wlkk70QBf0iBWDwNy7PA4I=
|
||||||
|
github.com/bmatcuk/doublestar/v4 v4.6.1/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc=
|
||||||
github.com/bufbuild/protocompile v0.4.0 h1:LbFKd2XowZvQ/kajzguUp2DC9UEIQhIq77fZZlaQsNA=
|
github.com/bufbuild/protocompile v0.4.0 h1:LbFKd2XowZvQ/kajzguUp2DC9UEIQhIq77fZZlaQsNA=
|
||||||
github.com/bufbuild/protocompile v0.4.0/go.mod h1:3v93+mbWn/v3xzN+31nwkJfrEpAUwp+BagBSZWx+TP8=
|
github.com/bufbuild/protocompile v0.4.0/go.mod h1:3v93+mbWn/v3xzN+31nwkJfrEpAUwp+BagBSZWx+TP8=
|
||||||
github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0=
|
github.com/cloudflare/circl v1.3.7 h1:qlCDlTPz2n9fu58M0Nh1J/JzcFpfgkFHHX3O35r5vcU=
|
||||||
github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA=
|
github.com/cloudflare/circl v1.3.7/go.mod h1:sRTcRWXGLrKw6yIGJ+l7amYJFfAXbZG0kBSc8r4zxgA=
|
||||||
github.com/cloudflare/circl v1.3.5 h1:g+wWynZqVALYAlpSQFAa7TscDnUK8mKYtrxMpw6AUKo=
|
|
||||||
github.com/cloudflare/circl v1.3.5/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA=
|
|
||||||
github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53EtKeQYTC3kyg=
|
github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53EtKeQYTC3kyg=
|
||||||
github.com/cyphar/filepath-securejoin v0.2.4/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4=
|
github.com/cyphar/filepath-securejoin v0.2.4/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4=
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
@@ -35,32 +33,28 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
|
|||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc=
|
github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc=
|
||||||
github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ=
|
github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ=
|
||||||
github.com/ezscale/goozzle v0.0.0-20231024225306-c7aec89610f0 h1:psMxN9rlCDGzho8/btsyQoonZ81DZjyObL3jPTSHSlI=
|
|
||||||
github.com/ezscale/goozzle v0.0.0-20231024225306-c7aec89610f0/go.mod h1:DIbWPdLGs/WbZcOQnhQvcbTICRIwyY/SNNM0Uc2aAdk=
|
|
||||||
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
|
|
||||||
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
|
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
|
||||||
github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs=
|
github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM=
|
||||||
github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw=
|
github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE=
|
||||||
github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0XL9UY=
|
github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE=
|
||||||
github.com/frankban/quicktest v1.14.4/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
|
github.com/frankban/quicktest v1.14.3/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps=
|
||||||
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI=
|
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI=
|
||||||
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmSxCcxctByoQdvwPiA7DTK7jaaFDBTtu0ic=
|
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmSxCcxctByoQdvwPiA7DTK7jaaFDBTtu0ic=
|
||||||
github.com/go-git/go-billy/v5 v5.5.0 h1:yEY4yhzCDuMGSv83oGxiBotRzhwhNr8VZyphhiu+mTU=
|
github.com/go-git/go-billy/v5 v5.5.0 h1:yEY4yhzCDuMGSv83oGxiBotRzhwhNr8VZyphhiu+mTU=
|
||||||
github.com/go-git/go-billy/v5 v5.5.0/go.mod h1:hmexnoNsr2SJU1Ju67OaNz5ASJY3+sHgFRpCtpDCKow=
|
github.com/go-git/go-billy/v5 v5.5.0/go.mod h1:hmexnoNsr2SJU1Ju67OaNz5ASJY3+sHgFRpCtpDCKow=
|
||||||
github.com/go-git/go-git/v5 v5.9.0 h1:cD9SFA7sHVRdJ7AYck1ZaAa/yeuBvGPxwXDL8cxrObY=
|
github.com/go-git/go-git/v5 v5.12.0 h1:7Md+ndsjrzZxbddRDZjF14qK+NN56sy6wkqaVrjZtys=
|
||||||
github.com/go-git/go-git/v5 v5.9.0/go.mod h1:RKIqga24sWdMGZF+1Ekv9kylsDz6LzdTSI2s/OsZWE0=
|
github.com/go-git/go-git/v5 v5.12.0/go.mod h1:FTM9VKtnI2m65hNI/TenDDDnUf2Q9FHnXYjuz9i5OEY=
|
||||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE=
|
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE=
|
||||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||||
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
|
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
|
||||||
github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
|
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
|
||||||
github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
|
|
||||||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
|
||||||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
||||||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||||
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||||
github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4=
|
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
github.com/hashicorp/cli v1.1.6 h1:CMOV+/LJfL1tXCOKrgAX0uRKnzjj/mpmqNXloRSy2K8=
|
||||||
|
github.com/hashicorp/cli v1.1.6/go.mod h1:MPon5QYlgjjo0BSoAiN0ESeT5fRzDjVRp+uioJ0piz4=
|
||||||
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
||||||
github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I=
|
github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I=
|
||||||
github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
||||||
@@ -74,38 +68,35 @@ github.com/hashicorp/go-hclog v1.5.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVH
|
|||||||
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
|
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
|
||||||
github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo=
|
github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo=
|
||||||
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
|
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
|
||||||
github.com/hashicorp/go-plugin v1.5.2 h1:aWv8eimFqWlsEiMrYZdPYl+FdHaBJSN4AWwGWfT1G2Y=
|
github.com/hashicorp/go-plugin v1.6.2 h1:zdGAEd0V1lCaU0u+MxWQhtSDQmahpkwOun8U8EiRVog=
|
||||||
github.com/hashicorp/go-plugin v1.5.2/go.mod h1:w1sAEES3g3PuV/RzUrgow20W2uErMly84hhD3um1WL4=
|
github.com/hashicorp/go-plugin v1.6.2/go.mod h1:CkgLQ5CZqNmdL9U9JzM532t8ZiYQ35+pj3b1FD37R0Q=
|
||||||
github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
|
github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
|
||||||
github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8=
|
github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8=
|
||||||
github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
|
github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
|
||||||
github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek=
|
github.com/hashicorp/go-version v1.7.0 h1:5tqGy27NaOTB8yJKUZELlFAS/LTKJkrmONwQKeRZfjY=
|
||||||
github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
|
github.com/hashicorp/go-version v1.7.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
|
||||||
github.com/hashicorp/hc-install v0.6.1 h1:IGxShH7AVhPaSuSJpKtVi/EFORNjO+OYVJJrAtGG2mY=
|
github.com/hashicorp/hc-install v0.7.0 h1:Uu9edVqjKQxxuD28mR5TikkKDd/p55S8vzPC1659aBk=
|
||||||
github.com/hashicorp/hc-install v0.6.1/go.mod h1:0fW3jpg+wraYSnFDJ6Rlie3RvLf1bIqVIkzoon4KoVE=
|
github.com/hashicorp/hc-install v0.7.0/go.mod h1:ELmmzZlGnEcqoUMKUuykHaPCIR1sYLYX+KSggWSKZuA=
|
||||||
github.com/hashicorp/terraform-exec v0.19.0 h1:FpqZ6n50Tk95mItTSS9BjeOVUb4eg81SpgVtZNNtFSM=
|
github.com/hashicorp/terraform-exec v0.21.0 h1:uNkLAe95ey5Uux6KJdua6+cv8asgILFVWkd/RG0D2XQ=
|
||||||
github.com/hashicorp/terraform-exec v0.19.0/go.mod h1:tbxUpe3JKruE9Cuf65mycSIT8KiNPZ0FkuTE3H4urQg=
|
github.com/hashicorp/terraform-exec v0.21.0/go.mod h1:1PPeMYou+KDUSSeRE9szMZ/oHf4fYUmB923Wzbq1ICg=
|
||||||
github.com/hashicorp/terraform-json v0.17.1 h1:eMfvh/uWggKmY7Pmb3T85u86E2EQg6EQHgyRwf3RkyA=
|
github.com/hashicorp/terraform-json v0.22.1 h1:xft84GZR0QzjPVWs4lRUwvTcPnegqlyS7orfb5Ltvec=
|
||||||
github.com/hashicorp/terraform-json v0.17.1/go.mod h1:Huy6zt6euxaY9knPAFKjUITn8QxUFIe9VuSzb4zn/0o=
|
github.com/hashicorp/terraform-json v0.22.1/go.mod h1:JbWSQCLFSXFFhg42T7l9iJwdGXBYV8fmmD6o/ML4p3A=
|
||||||
github.com/hashicorp/terraform-plugin-docs v0.16.0 h1:UmxFr3AScl6Wged84jndJIfFccGyBZn52KtMNsS12dI=
|
github.com/hashicorp/terraform-plugin-docs v0.19.4 h1:G3Bgo7J22OMtegIgn8Cd/CaSeyEljqjH3G39w28JK4c=
|
||||||
github.com/hashicorp/terraform-plugin-docs v0.16.0/go.mod h1:M3ZrlKBJAbPMtNOPwHicGi1c+hZUh7/g0ifT/z7TVfA=
|
github.com/hashicorp/terraform-plugin-docs v0.19.4/go.mod h1:4pLASsatTmRynVzsjEhbXZ6s7xBlUw/2Kt0zfrq8HxA=
|
||||||
github.com/hashicorp/terraform-plugin-framework v1.4.2 h1:P7a7VP1GZbjc4rv921Xy5OckzhoiO3ig6SGxwelD2sI=
|
github.com/hashicorp/terraform-plugin-framework v1.13.0 h1:8OTG4+oZUfKgnfTdPTJwZ532Bh2BobF4H+yBiYJ/scw=
|
||||||
github.com/hashicorp/terraform-plugin-framework v1.4.2/go.mod h1:GWl3InPFZi2wVQmdVnINPKys09s9mLmTZr95/ngLnbY=
|
github.com/hashicorp/terraform-plugin-framework v1.13.0/go.mod h1:j64rwMGpgM3NYXTKuxrCnyubQb/4VKldEKlcG8cvmjU=
|
||||||
github.com/hashicorp/terraform-plugin-go v0.19.0 h1:BuZx/6Cp+lkmiG0cOBk6Zps0Cb2tmqQpDM3iAtnhDQU=
|
github.com/hashicorp/terraform-plugin-go v0.25.0 h1:oi13cx7xXA6QciMcpcFi/rwA974rdTxjqEhXJjbAyks=
|
||||||
github.com/hashicorp/terraform-plugin-go v0.19.0/go.mod h1:EhRSkEPNoylLQntYsk5KrDHTZJh9HQoumZXbOGOXmec=
|
github.com/hashicorp/terraform-plugin-go v0.25.0/go.mod h1:+SYagMYadJP86Kvn+TGeV+ofr/R3g4/If0O5sO96MVw=
|
||||||
github.com/hashicorp/terraform-plugin-log v0.9.0 h1:i7hOA+vdAItN1/7UrfBqBwvYPQ9TFvymaRGZED3FCV0=
|
github.com/hashicorp/terraform-plugin-log v0.9.0 h1:i7hOA+vdAItN1/7UrfBqBwvYPQ9TFvymaRGZED3FCV0=
|
||||||
github.com/hashicorp/terraform-plugin-log v0.9.0/go.mod h1:rKL8egZQ/eXSyDqzLUuwUYLVdlYeamldAHSxjUFADow=
|
github.com/hashicorp/terraform-plugin-log v0.9.0/go.mod h1:rKL8egZQ/eXSyDqzLUuwUYLVdlYeamldAHSxjUFADow=
|
||||||
github.com/hashicorp/terraform-registry-address v0.2.2 h1:lPQBg403El8PPicg/qONZJDC6YlgCVbWDtNmmZKtBno=
|
github.com/hashicorp/terraform-registry-address v0.2.3 h1:2TAiKJ1A3MAkZlH1YI/aTVcLZRu7JseiXNRHbOAyoTI=
|
||||||
github.com/hashicorp/terraform-registry-address v0.2.2/go.mod h1:LtwNbCihUoUZ3RYriyS2wF/lGPB6gF9ICLRtuDk7hSo=
|
github.com/hashicorp/terraform-registry-address v0.2.3/go.mod h1:lFHA76T8jfQteVfT7caREqguFrW3c4MFSPhZB7HHgUM=
|
||||||
github.com/hashicorp/terraform-svchost v0.1.1 h1:EZZimZ1GxdqFRinZ1tpJwVxxt49xc/S52uzrw4x0jKQ=
|
github.com/hashicorp/terraform-svchost v0.1.1 h1:EZZimZ1GxdqFRinZ1tpJwVxxt49xc/S52uzrw4x0jKQ=
|
||||||
github.com/hashicorp/terraform-svchost v0.1.1/go.mod h1:mNsjQfZyf/Jhz35v6/0LWcv26+X7JPS+buii2c9/ctc=
|
github.com/hashicorp/terraform-svchost v0.1.1/go.mod h1:mNsjQfZyf/Jhz35v6/0LWcv26+X7JPS+buii2c9/ctc=
|
||||||
github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE=
|
github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE=
|
||||||
github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ=
|
github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ=
|
||||||
github.com/huandu/xstrings v1.3.1/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
|
github.com/huandu/xstrings v1.3.3 h1:/Gcsuc1x8JVbJ9/rlye4xZnVAbEkGauT8lbebqcQws4=
|
||||||
github.com/huandu/xstrings v1.3.2/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
|
|
||||||
github.com/huandu/xstrings v1.3.3/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
|
github.com/huandu/xstrings v1.3.3/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
|
||||||
github.com/huandu/xstrings v1.4.0 h1:D17IlohoQq4UcpqD7fDk80P7l+lwAmlFaBHgOipl2FU=
|
|
||||||
github.com/huandu/xstrings v1.4.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
|
|
||||||
github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
|
github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
|
||||||
github.com/imdario/mergo v0.3.15 h1:M8XP7IuFNsqUx6VPK2P9OSmsYsI/YFaGil0uD21V3dM=
|
github.com/imdario/mergo v0.3.15 h1:M8XP7IuFNsqUx6VPK2P9OSmsYsI/YFaGil0uD21V3dM=
|
||||||
github.com/imdario/mergo v0.3.15/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY=
|
github.com/imdario/mergo v0.3.15/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY=
|
||||||
@@ -115,23 +106,21 @@ github.com/jhump/protoreflect v1.15.1 h1:HUMERORf3I3ZdX05WaQ6MIpd/NJ434hTp5YiKgf
|
|||||||
github.com/jhump/protoreflect v1.15.1/go.mod h1:jD/2GMKKE6OqX8qTjhADU1e6DShO+gavG9e0Q693nKo=
|
github.com/jhump/protoreflect v1.15.1/go.mod h1:jD/2GMKKE6OqX8qTjhADU1e6DShO+gavG9e0Q693nKo=
|
||||||
github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4=
|
github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4=
|
||||||
github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM=
|
github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM=
|
||||||
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
|
||||||
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
|
||||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||||
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
|
|
||||||
github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
|
github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
|
||||||
github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
|
github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
|
||||||
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
|
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
|
||||||
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
|
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
|
||||||
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
|
|
||||||
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
||||||
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
|
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
|
||||||
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
||||||
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||||
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||||
github.com/mitchellh/cli v1.1.5 h1:OxRIeJXpAMztws/XHlN2vu6imG5Dpq+j61AzAX5fLng=
|
github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0=
|
||||||
github.com/mitchellh/cli v1.1.5/go.mod h1:v8+iFts2sPIKUV1ltktPXMCC8fumSKFItNcD2cLtRR4=
|
github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
|
||||||
github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw=
|
github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw=
|
||||||
github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw=
|
github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw=
|
||||||
github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s=
|
github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s=
|
||||||
@@ -140,74 +129,69 @@ github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp
|
|||||||
github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
|
github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
|
||||||
github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ=
|
github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ=
|
||||||
github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
|
github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
|
||||||
github.com/oklog/run v1.1.0 h1:GEenZ1cK0+q0+wsJew9qUg/DyD8k3JzYsZAi5gYi2mA=
|
github.com/oklog/run v1.0.0 h1:Ru7dDtJNOyC66gQ5dQmaCa0qIsAUFY3sFpK1Xk8igrw=
|
||||||
github.com/oklog/run v1.1.0/go.mod h1:sVPdnTZT1zYwAJeCMu2Th4T21pA3FPOQRfWjQlk7DVU=
|
github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA=
|
||||||
github.com/pjbgf/sha1cd v0.3.0 h1:4D5XXmUUBUl/xQ6IjCkEAbqXskkq/4O7LmGn0AqMDs4=
|
github.com/pjbgf/sha1cd v0.3.0 h1:4D5XXmUUBUl/xQ6IjCkEAbqXskkq/4O7LmGn0AqMDs4=
|
||||||
github.com/pjbgf/sha1cd v0.3.0/go.mod h1:nZ1rrWOcGJ5uZgEEVL1VUM9iRQiZvWdbZjkKyFzPPsI=
|
github.com/pjbgf/sha1cd v0.3.0/go.mod h1:nZ1rrWOcGJ5uZgEEVL1VUM9iRQiZvWdbZjkKyFzPPsI=
|
||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=
|
|
||||||
github.com/posener/complete v1.2.3 h1:NP0eAhjcjImqslEwo/1hq7gpajME0fTLTezBKDqfXqo=
|
github.com/posener/complete v1.2.3 h1:NP0eAhjcjImqslEwo/1hq7gpajME0fTLTezBKDqfXqo=
|
||||||
github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s=
|
github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s=
|
||||||
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
|
github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
|
||||||
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
|
github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
|
||||||
github.com/russross/blackfriday v1.6.0 h1:KqfZb0pUVN2lYqZUYRddxF4OR8ZMURnJIG5Y3VRLtww=
|
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN3Uc8sB6B/s6Z4t2xvBgU1htSHuq8=
|
||||||
github.com/russross/blackfriday v1.6.0/go.mod h1:ti0ldHuxg49ri4ksnFxlkCfN+hvslNlmVHqNRXXJNAY=
|
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4=
|
||||||
github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ=
|
|
||||||
github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
|
|
||||||
github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
|
github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
|
||||||
github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8=
|
github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8=
|
||||||
github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
|
github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
|
||||||
github.com/skeema/knownhosts v1.2.0 h1:h9r9cf0+u7wSE+M183ZtMGgOJKiL96brpaz5ekfJCpM=
|
github.com/skeema/knownhosts v1.2.2 h1:Iug2P4fLmDw9f41PB6thxUkNUkJzB5i+1/exaj40L3A=
|
||||||
github.com/skeema/knownhosts v1.2.0/go.mod h1:g4fPeYpque7P0xefxtGzV81ihjC8sX2IqpAoNkjxbMo=
|
github.com/skeema/knownhosts v1.2.2/go.mod h1:xYbVRSPxqBZFrdmDyMmsOs+uX1UZC3nTN3ThzgDxUwo=
|
||||||
github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
|
github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
|
||||||
github.com/spf13/cast v1.5.1 h1:R+kOtfhWQE6TVQzY+4D7wJLBgkdVasCEFxSUBYBYIlA=
|
github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w=
|
||||||
github.com/spf13/cast v1.5.1/go.mod h1:b9PdjNptOpzXr7Rq1q9gJML/2cdGQAo69NKzQ10KN48=
|
github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU=
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||||
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
||||||
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
|
||||||
github.com/stretchr/testify v1.7.2 h1:4jaiDzPyXQvSd7D0EjG45355tLlV3VOECpq10pLC+8s=
|
|
||||||
github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals=
|
github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals=
|
||||||
github.com/vmihailenco/msgpack/v5 v5.4.0 h1:hRM0digJwyR6vll33NNAwCFguy5JuBD6jxDmQP3l608=
|
github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY=
|
||||||
github.com/vmihailenco/msgpack/v5 v5.4.0/go.mod h1:GaZTsDaehaPpQVyxrf5mtQlH+pc21PIudVV/E3rRQok=
|
github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||||
|
github.com/vmihailenco/msgpack/v5 v5.4.1 h1:cQriyiUvjTwOHg8QZaPihLWeRAAVoCpE00IUPn0Bjt8=
|
||||||
|
github.com/vmihailenco/msgpack/v5 v5.4.1/go.mod h1:GaZTsDaehaPpQVyxrf5mtQlH+pc21PIudVV/E3rRQok=
|
||||||
github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g=
|
github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g=
|
||||||
github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds=
|
github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds=
|
||||||
github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM=
|
github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM=
|
||||||
github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw=
|
github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw=
|
||||||
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
||||||
github.com/zclconf/go-cty v1.14.1 h1:t9fyA35fwjjUMcmL5hLER+e/rEPqrbCK1/OSE4SI9KA=
|
github.com/yuin/goldmark v1.7.1 h1:3bajkSilaCbjdKVsKdZjZCLBNPL9pYzrCakKaf4U49U=
|
||||||
github.com/zclconf/go-cty v1.14.1/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE=
|
github.com/yuin/goldmark v1.7.1/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E=
|
||||||
|
github.com/yuin/goldmark-meta v1.1.0 h1:pWw+JLHGZe8Rk0EGsMVssiNb/AaPMHfSRszZeUeiOUc=
|
||||||
|
github.com/yuin/goldmark-meta v1.1.0/go.mod h1:U4spWENafuA7Zyg+Lj5RqK/MF+ovMYtBvXi1lBb2VP0=
|
||||||
|
github.com/zclconf/go-cty v1.14.4 h1:uXXczd9QDGsgu0i/QFR/hzI5NYCHLf6NQw/atrbnhq8=
|
||||||
|
github.com/zclconf/go-cty v1.14.4/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE=
|
||||||
|
go.abhg.dev/goldmark/frontmatter v0.2.0 h1:P8kPG0YkL12+aYk2yU3xHv4tcXzeVnN+gU0tJ5JnxRw=
|
||||||
|
go.abhg.dev/goldmark/frontmatter v0.2.0/go.mod h1:XqrEkZuM57djk7zrlRUB02x8I5J0px76YjkOzhB4YlU=
|
||||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
golang.org/x/crypto v0.0.0-20200414173820-0848c9571904/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
|
||||||
golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
|
||||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||||
golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4=
|
golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4=
|
||||||
golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4=
|
golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw=
|
||||||
golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU=
|
golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54=
|
||||||
golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc=
|
golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df h1:UA2aFVmmsIlefxMk29Dp2juaUSth8Pyn3Tq5Y5mJGME=
|
||||||
golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4=
|
golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc=
|
||||||
golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI=
|
|
||||||
golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo=
|
|
||||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||||
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA=
|
||||||
golang.org/x/mod v0.13.0 h1:I/DsJXRlw/8l/0c24sM9yb0T4z9liZTduXvdAWYiysY=
|
golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
|
||||||
golang.org/x/mod v0.13.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
|
|
||||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
|
||||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||||
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||||
golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY=
|
golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY=
|
||||||
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE=
|
||||||
golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
|
golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg=
|
||||||
golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM=
|
|
||||||
golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
|
|
||||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
|
||||||
|
golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
@@ -219,45 +203,36 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc
|
|||||||
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
||||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
||||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
|
golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg=
|
||||||
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||||
golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc=
|
golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc=
|
||||||
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
|
|
||||||
golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U=
|
|
||||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||||
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||||
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc=
|
||||||
golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
|
||||||
golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
|
|
||||||
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
|
|
||||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||||
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
|
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg=
|
||||||
golang.org/x/tools v0.14.0 h1:jvNa2pY0M4r62jkRQ6RwEZZyPcymeL9XZMLBbV7U2nc=
|
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk=
|
||||||
golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg=
|
|
||||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 h1:e7S5W7MGGLaSu8j3YjdezkZ+m1/Nm0uRVRMEMGk26Xs=
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20231016165738-49dd2c1f3d0b h1:ZlWIi1wSK56/8hn4QcBp/j9M7Gt3U/3hZw3mC7vDICo=
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU=
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20231016165738-49dd2c1f3d0b/go.mod h1:swOH3j0KzcDDgGUWr+SNpyTen5YrXjS3eyPzFYKc6lc=
|
google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E=
|
||||||
google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk=
|
google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA=
|
||||||
google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98=
|
google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA=
|
||||||
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
|
||||||
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||||
google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=
|
|
||||||
google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME=
|
gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME=
|
||||||
gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI=
|
gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI=
|
||||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
|
gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
|
||||||
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
|
||||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
|
|||||||
71
internal/client/client.go
Normal file
71
internal/client/client.go
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
// Copyright (c) EZSCALE.
|
||||||
|
// SPDX-License-Identifier: MPL-2.0
|
||||||
|
|
||||||
|
package client
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Client is the VirtFusion API client.
|
||||||
|
type Client struct {
|
||||||
|
BaseURL string
|
||||||
|
Token string
|
||||||
|
HTTPClient *http.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
// New creates a new VirtFusion API client.
|
||||||
|
// The endpoint can be a hostname (e.g. "cp.example.com") or a full URL
|
||||||
|
// (e.g. "https://cp.example.com" or "https://cp.example.com/api/v1").
|
||||||
|
func New(endpoint, token string) (*Client, error) {
|
||||||
|
if endpoint == "" {
|
||||||
|
return nil, fmt.Errorf("endpoint is required")
|
||||||
|
}
|
||||||
|
if token == "" {
|
||||||
|
return nil, fmt.Errorf("api_token is required")
|
||||||
|
}
|
||||||
|
|
||||||
|
baseURL := normalizeEndpoint(endpoint)
|
||||||
|
|
||||||
|
return &Client{
|
||||||
|
BaseURL: baseURL,
|
||||||
|
Token: token,
|
||||||
|
HTTPClient: &http.Client{
|
||||||
|
Timeout: 60 * time.Second,
|
||||||
|
},
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// normalizeEndpoint takes a user-provided endpoint and returns a full base URL
|
||||||
|
// ending with /api/v1. Supports:
|
||||||
|
// - "cp.example.com" → "https://cp.example.com/api/v1"
|
||||||
|
// - "https://cp.example.com" → "https://cp.example.com/api/v1"
|
||||||
|
// - "https://cp.example.com/api/v1" → "https://cp.example.com/api/v1"
|
||||||
|
func normalizeEndpoint(endpoint string) string {
|
||||||
|
endpoint = strings.TrimRight(endpoint, "/")
|
||||||
|
|
||||||
|
// If no scheme, add https://
|
||||||
|
if !strings.Contains(endpoint, "://") {
|
||||||
|
endpoint = "https://" + endpoint
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse to validate
|
||||||
|
u, err := url.Parse(endpoint)
|
||||||
|
if err != nil {
|
||||||
|
// Fall back to simple construction
|
||||||
|
return endpoint + "/api/v1"
|
||||||
|
}
|
||||||
|
|
||||||
|
// If path already ends with /api/v1, use as-is
|
||||||
|
if strings.HasSuffix(u.Path, "/api/v1") {
|
||||||
|
return u.String()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Otherwise append /api/v1
|
||||||
|
u.Path = strings.TrimRight(u.Path, "/") + "/api/v1"
|
||||||
|
return u.String()
|
||||||
|
}
|
||||||
43
internal/client/errors.go
Normal file
43
internal/client/errors.go
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
// Copyright (c) EZSCALE.
|
||||||
|
// SPDX-License-Identifier: MPL-2.0
|
||||||
|
|
||||||
|
package client
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
|
// APIError represents an error returned by the VirtFusion API.
|
||||||
|
type APIError struct {
|
||||||
|
StatusCode int
|
||||||
|
Status string
|
||||||
|
Body string
|
||||||
|
Errors map[string][]string
|
||||||
|
}
|
||||||
|
|
||||||
|
// maxErrorBodyLen is the maximum number of bytes from the API response body
|
||||||
|
// to include in error messages, to avoid leaking sensitive data from verbose
|
||||||
|
// error responses.
|
||||||
|
const maxErrorBodyLen = 500
|
||||||
|
|
||||||
|
func (e *APIError) Error() string {
|
||||||
|
if len(e.Errors) > 0 {
|
||||||
|
return fmt.Sprintf("VirtFusion API error %d (%s): %v", e.StatusCode, e.Status, e.Errors)
|
||||||
|
}
|
||||||
|
if e.Body != "" {
|
||||||
|
body := e.Body
|
||||||
|
if len(body) > maxErrorBodyLen {
|
||||||
|
body = body[:maxErrorBodyLen] + "... (truncated)"
|
||||||
|
}
|
||||||
|
return fmt.Sprintf("VirtFusion API error %d (%s): %s", e.StatusCode, e.Status, body)
|
||||||
|
}
|
||||||
|
return fmt.Sprintf("VirtFusion API error %d (%s)", e.StatusCode, e.Status)
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsNotFound returns true if the error is a 404 Not Found response.
|
||||||
|
func (e *APIError) IsNotFound() bool {
|
||||||
|
return e.StatusCode == 404
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsValidationError returns true if the error is a 422 Unprocessable Entity response.
|
||||||
|
func (e *APIError) IsValidationError() bool {
|
||||||
|
return e.StatusCode == 422
|
||||||
|
}
|
||||||
195
internal/client/request.go
Normal file
195
internal/client/request.go
Normal file
@@ -0,0 +1,195 @@
|
|||||||
|
// Copyright (c) EZSCALE.
|
||||||
|
// SPDX-License-Identifier: MPL-2.0
|
||||||
|
|
||||||
|
package client
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
// paginatedResponse is the envelope returned by VirtFusion's Laravel-style pagination.
|
||||||
|
type paginatedResponse struct {
|
||||||
|
CurrentPage int `json:"current_page"`
|
||||||
|
LastPage int `json:"last_page"`
|
||||||
|
Data json.RawMessage `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get performs a GET request to the given path.
|
||||||
|
func (c *Client) Get(ctx context.Context, path string) (json.RawMessage, error) {
|
||||||
|
return c.doRequest(ctx, http.MethodGet, path, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetAllPages fetches all pages from a paginated endpoint and returns
|
||||||
|
// a synthetic JSON response with all items merged into a single "data" array.
|
||||||
|
// If the response is not paginated (no last_page field or single page), it
|
||||||
|
// returns the original response unchanged.
|
||||||
|
func (c *Client) GetAllPages(ctx context.Context, path string) (json.RawMessage, error) {
|
||||||
|
firstRaw, err := c.Get(ctx, path)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
var page paginatedResponse
|
||||||
|
// Attempt to detect pagination metadata. If the response doesn't look
|
||||||
|
// like a paginated envelope (unmarshal fails or last_page is absent/zero),
|
||||||
|
// return the raw response as-is — this is not an error.
|
||||||
|
unmarshallable := json.Unmarshal(firstRaw, &page) == nil
|
||||||
|
if !unmarshallable || page.LastPage <= 1 {
|
||||||
|
return firstRaw, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if page.LastPage <= 1 {
|
||||||
|
return firstRaw, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Collect data arrays from all pages.
|
||||||
|
allItems, err := flattenJSONArray(page.Data)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("parsing page 1 data: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
sep := "&"
|
||||||
|
if !strings.Contains(path, "?") {
|
||||||
|
sep = "?"
|
||||||
|
}
|
||||||
|
|
||||||
|
for p := 2; p <= page.LastPage; p++ {
|
||||||
|
pageRaw, err := c.Get(ctx, fmt.Sprintf("%s%spage=%d", path, sep, p))
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("fetching page %d: %w", p, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
var pageResp paginatedResponse
|
||||||
|
if err := json.Unmarshal(pageRaw, &pageResp); err != nil {
|
||||||
|
return nil, fmt.Errorf("parsing page %d: %w", p, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
items, err := flattenJSONArray(pageResp.Data)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("parsing page %d data: %w", p, err)
|
||||||
|
}
|
||||||
|
allItems = append(allItems, items...)
|
||||||
|
}
|
||||||
|
|
||||||
|
mergedData, err := json.Marshal(allItems)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("marshaling merged data: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Build a response that looks like {"data": [...all items...]} so
|
||||||
|
// existing list response types (e.g. ServerListResponse) unmarshal correctly.
|
||||||
|
result, err := json.Marshal(map[string]json.RawMessage{"data": mergedData})
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("marshaling merged response: %w", err)
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// flattenJSONArray unmarshals a JSON array into individual raw messages.
|
||||||
|
func flattenJSONArray(raw json.RawMessage) ([]json.RawMessage, error) {
|
||||||
|
var items []json.RawMessage
|
||||||
|
if err := json.Unmarshal(raw, &items); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return items, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Post performs a POST request to the given path with the given body.
|
||||||
|
func (c *Client) Post(ctx context.Context, path string, body interface{}) (json.RawMessage, error) {
|
||||||
|
return c.doRequest(ctx, http.MethodPost, path, body)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Put performs a PUT request to the given path with the given body.
|
||||||
|
func (c *Client) Put(ctx context.Context, path string, body interface{}) (json.RawMessage, error) {
|
||||||
|
return c.doRequest(ctx, http.MethodPut, path, body)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete performs a DELETE request to the given path.
|
||||||
|
func (c *Client) Delete(ctx context.Context, path string) (json.RawMessage, error) {
|
||||||
|
return c.doRequest(ctx, http.MethodDelete, path, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteWithBody performs a DELETE request with a JSON body.
|
||||||
|
func (c *Client) DeleteWithBody(ctx context.Context, path string, body interface{}) (json.RawMessage, error) {
|
||||||
|
return c.doRequest(ctx, http.MethodDelete, path, body)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) doRequest(ctx context.Context, method, path string, body interface{}) (json.RawMessage, error) {
|
||||||
|
// Split path from query string before joining, since url.JoinPath
|
||||||
|
// escapes '?' as '%3F' when it appears in the path.
|
||||||
|
pathPart := path
|
||||||
|
queryPart := ""
|
||||||
|
if idx := strings.IndexByte(path, '?'); idx >= 0 {
|
||||||
|
pathPart = path[:idx]
|
||||||
|
queryPart = path[idx:]
|
||||||
|
}
|
||||||
|
|
||||||
|
fullURL, err := url.JoinPath(c.BaseURL, pathPart)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("building URL: %w", err)
|
||||||
|
}
|
||||||
|
fullURL += queryPart
|
||||||
|
|
||||||
|
var bodyReader io.Reader
|
||||||
|
if body != nil {
|
||||||
|
jsonBody, err := json.Marshal(body)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("marshaling request body: %w", err)
|
||||||
|
}
|
||||||
|
bodyReader = bytes.NewReader(jsonBody)
|
||||||
|
}
|
||||||
|
|
||||||
|
req, err := http.NewRequestWithContext(ctx, method, fullURL, bodyReader)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("creating request: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
req.Header.Set("Authorization", "Bearer "+c.Token)
|
||||||
|
req.Header.Set("Accept", "application/json")
|
||||||
|
if body != nil {
|
||||||
|
req.Header.Set("Content-Type", "application/json")
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := c.HTTPClient.Do(req)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("executing request: %w", err)
|
||||||
|
}
|
||||||
|
defer resp.Body.Close()
|
||||||
|
|
||||||
|
// 204 No Content is a success with no body
|
||||||
|
if resp.StatusCode == http.StatusNoContent {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
respBody, err := io.ReadAll(resp.Body)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("reading response body: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if resp.StatusCode >= 400 {
|
||||||
|
apiErr := &APIError{
|
||||||
|
StatusCode: resp.StatusCode,
|
||||||
|
Status: resp.Status,
|
||||||
|
Body: string(respBody),
|
||||||
|
}
|
||||||
|
|
||||||
|
// Try to parse validation errors
|
||||||
|
var errResp struct {
|
||||||
|
Errors map[string][]string `json:"errors"`
|
||||||
|
}
|
||||||
|
if json.Unmarshal(respBody, &errResp) == nil && len(errResp.Errors) > 0 {
|
||||||
|
apiErr.Errors = errResp.Errors
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil, apiErr
|
||||||
|
}
|
||||||
|
|
||||||
|
return json.RawMessage(respBody), nil
|
||||||
|
}
|
||||||
516
internal/client/types.go
Normal file
516
internal/client/types.go
Normal file
@@ -0,0 +1,516 @@
|
|||||||
|
// Copyright (c) EZSCALE.
|
||||||
|
// SPDX-License-Identifier: MPL-2.0
|
||||||
|
|
||||||
|
package client
|
||||||
|
|
||||||
|
// ServerCreateRequest represents the request body for creating a server.
|
||||||
|
type ServerCreateRequest struct {
|
||||||
|
PackageID int64 `json:"packageId"`
|
||||||
|
UserID int64 `json:"userId"`
|
||||||
|
HypervisorID int64 `json:"hypervisorId"`
|
||||||
|
Ipv4 *int64 `json:"ipv4,omitempty"`
|
||||||
|
Storage *int64 `json:"storage,omitempty"`
|
||||||
|
Memory *int64 `json:"memory,omitempty"`
|
||||||
|
CPUCores *int64 `json:"cpuCores,omitempty"`
|
||||||
|
Traffic *int64 `json:"traffic,omitempty"`
|
||||||
|
NetworkSpeedInbound *int64 `json:"networkSpeedInbound,omitempty"`
|
||||||
|
NetworkSpeedOutbound *int64 `json:"networkSpeedOutbound,omitempty"`
|
||||||
|
StorageProfile *int64 `json:"storageProfile,omitempty"`
|
||||||
|
NetworkProfile *int64 `json:"networkProfile,omitempty"`
|
||||||
|
DryRun *bool `json:"dryRun,omitempty"`
|
||||||
|
AdditionalStorage1 *int64 `json:"additionalStorage1,omitempty"`
|
||||||
|
AdditionalStorage1Profile *int64 `json:"additionalStorage1Profile,omitempty"`
|
||||||
|
AdditionalStorage2 *int64 `json:"additionalStorage2,omitempty"`
|
||||||
|
AdditionalStorage2Profile *int64 `json:"additionalStorage2Profile,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ServerResponse represents the response from the API for server operations.
|
||||||
|
type ServerResponse struct {
|
||||||
|
Data ServerData `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ServerData represents a server in the API.
|
||||||
|
// The API returns "ownerId" (not "userId") and nests CPU/memory/storage
|
||||||
|
// under settings.resources and cpu.cores for detailed (single) responses.
|
||||||
|
// List responses use a flatter structure with "owner" as an int.
|
||||||
|
type ServerData struct {
|
||||||
|
ID int64 `json:"id"`
|
||||||
|
UUID string `json:"uuid"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Hostname string `json:"hostname"`
|
||||||
|
OwnerID int64 `json:"ownerId"`
|
||||||
|
HypervisorID int64 `json:"hypervisorId"`
|
||||||
|
Suspended bool `json:"suspended"`
|
||||||
|
|
||||||
|
// Nested objects present in detailed (single-server) responses.
|
||||||
|
CPU *ServerCPU `json:"cpu,omitempty"`
|
||||||
|
Settings *ServerSettings `json:"settings,omitempty"`
|
||||||
|
Traffic interface{} `json:"traffic,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ServerCPU represents CPU info from the detailed server response.
|
||||||
|
type ServerCPU struct {
|
||||||
|
Cores int64 `json:"cores"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ServerSettings holds nested settings from the detailed server response.
|
||||||
|
type ServerSettings struct {
|
||||||
|
Resources *ServerSettingsResources `json:"resources,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ServerSettingsResources holds resource allocations from server settings.
|
||||||
|
type ServerSettingsResources struct {
|
||||||
|
Memory int64 `json:"memory"`
|
||||||
|
Storage int64 `json:"storage"`
|
||||||
|
Traffic int64 `json:"traffic"`
|
||||||
|
CPUCores int64 `json:"cpuCores"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ServerListResponse represents a list of servers.
|
||||||
|
type ServerListResponse struct {
|
||||||
|
Data []ServerData `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ServerBuildRequest represents the request body for building a server.
|
||||||
|
type ServerBuildRequest struct {
|
||||||
|
Name string `json:"name"`
|
||||||
|
Hostname string `json:"hostname,omitempty"`
|
||||||
|
OperatingSystemID int64 `json:"operatingSystemId"`
|
||||||
|
VNC bool `json:"vnc"`
|
||||||
|
Ipv6 bool `json:"ipv6"`
|
||||||
|
SSHKeys []int64 `json:"sshKeys,omitempty"`
|
||||||
|
Email bool `json:"email"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// SSHKeyCreateRequest represents the request body for creating an SSH key.
|
||||||
|
type SSHKeyCreateRequest struct {
|
||||||
|
UserID int64 `json:"userId"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
PublicKey string `json:"publicKey"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// SSHKeyResponse represents the response from the API for SSH key operations.
|
||||||
|
type SSHKeyResponse struct {
|
||||||
|
Data SSHKeyData `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// SSHKeyData represents an SSH key in the API.
|
||||||
|
type SSHKeyData struct {
|
||||||
|
ID int64 `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Type string `json:"type"`
|
||||||
|
PublicKey string `json:"publicKey"`
|
||||||
|
Enabled bool `json:"enabled"`
|
||||||
|
UserID int64 `json:"userId"`
|
||||||
|
CreatedAt string `json:"created"`
|
||||||
|
UpdatedAt string `json:"updated"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// SSHKeyListResponse represents a list of SSH keys.
|
||||||
|
type SSHKeyListResponse struct {
|
||||||
|
Data []SSHKeyData `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// UserCreateRequest represents the request body for creating a user.
|
||||||
|
type UserCreateRequest struct {
|
||||||
|
Name string `json:"name"`
|
||||||
|
Email string `json:"email"`
|
||||||
|
ExtRelationID string `json:"extRelationId"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// UserResponse represents the response from the API for user operations.
|
||||||
|
type UserResponse struct {
|
||||||
|
Data UserData `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// UserData represents a user in the API.
|
||||||
|
type UserData struct {
|
||||||
|
ID int64 `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Email string `json:"email"`
|
||||||
|
ExtRelationID string `json:"extRelationId"`
|
||||||
|
Enabled bool `json:"enabled"`
|
||||||
|
CreatedAt string `json:"created"`
|
||||||
|
UpdatedAt string `json:"updated"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// UserModifyRequest represents the request body for modifying a user.
|
||||||
|
type UserModifyRequest struct {
|
||||||
|
Name string `json:"name,omitempty"`
|
||||||
|
Email string `json:"email,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// HypervisorResponse represents the response from the API for hypervisor operations.
|
||||||
|
type HypervisorResponse struct {
|
||||||
|
Data HypervisorData `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// HypervisorData represents a hypervisor in the API.
|
||||||
|
type HypervisorData struct {
|
||||||
|
ID int64 `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Type string `json:"type"`
|
||||||
|
Hostname string `json:"hostname"`
|
||||||
|
Enabled bool `json:"enabled"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// HypervisorListResponse represents a list of hypervisors.
|
||||||
|
type HypervisorListResponse struct {
|
||||||
|
Data []HypervisorData `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// HypervisorGroupResponse represents the response from the API for hypervisor group operations.
|
||||||
|
type HypervisorGroupResponse struct {
|
||||||
|
Data HypervisorGroupData `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// HypervisorGroupData represents a hypervisor group in the API.
|
||||||
|
type HypervisorGroupData struct {
|
||||||
|
ID int64 `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Enabled bool `json:"enabled"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// HypervisorGroupListResponse represents a list of hypervisor groups.
|
||||||
|
type HypervisorGroupListResponse struct {
|
||||||
|
Data []HypervisorGroupData `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// PackageResponse represents the response from the API for package operations.
|
||||||
|
type PackageResponse struct {
|
||||||
|
Data PackageData `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// PackageData represents a package in the API.
|
||||||
|
// The API uses "primaryStorage", "primaryNetworkSpeedIn/Out" etc.
|
||||||
|
type PackageData struct {
|
||||||
|
ID int64 `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Enabled bool `json:"enabled"`
|
||||||
|
CPUCores int64 `json:"cpuCores"`
|
||||||
|
Memory int64 `json:"memory"`
|
||||||
|
Storage int64 `json:"primaryStorage"`
|
||||||
|
Traffic int64 `json:"traffic"`
|
||||||
|
NetworkSpeedInbound int64 `json:"primaryNetworkSpeedIn"`
|
||||||
|
NetworkSpeedOutbound int64 `json:"primaryNetworkSpeedOut"`
|
||||||
|
Ipv4 int64 `json:"ipv4"`
|
||||||
|
StorageProfile int64 `json:"primaryStorageProfile"`
|
||||||
|
NetworkProfile int64 `json:"primaryNetworkProfile"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// PackageListResponse represents a list of packages.
|
||||||
|
type PackageListResponse struct {
|
||||||
|
Data []PackageData `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// IPBlockResponse represents the response from the API for IP block operations.
|
||||||
|
type IPBlockResponse struct {
|
||||||
|
Data IPBlockData `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// IPBlockData represents an IP block in the API.
|
||||||
|
// The API nests gateway/netmask under "ipv4" and returns "type" as an int.
|
||||||
|
type IPBlockData struct {
|
||||||
|
ID int64 `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Type int64 `json:"type"`
|
||||||
|
IPv4 IPBlockIPv4 `json:"ipv4"`
|
||||||
|
Enabled bool `json:"enabled"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// IPBlockIPv4 represents the IPv4 section of an IP block.
|
||||||
|
type IPBlockIPv4 struct {
|
||||||
|
Gateway string `json:"gateway"`
|
||||||
|
Netmask string `json:"netmask"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// IPBlockListResponse represents a list of IP blocks.
|
||||||
|
type IPBlockListResponse struct {
|
||||||
|
Data []IPBlockData `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// FirewallResponse represents the response from the API for firewall operations.
|
||||||
|
type FirewallResponse struct {
|
||||||
|
Data FirewallData `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// FirewallData represents firewall data in the API.
|
||||||
|
type FirewallData struct {
|
||||||
|
Enabled bool `json:"enabled"`
|
||||||
|
Rules []FirewallRule `json:"rules"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// FirewallRule represents a single firewall rule.
|
||||||
|
type FirewallRule struct {
|
||||||
|
Action string `json:"action"`
|
||||||
|
Direction string `json:"direction"`
|
||||||
|
Protocol string `json:"protocol"`
|
||||||
|
Port string `json:"port"`
|
||||||
|
IP string `json:"ip"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// FirewallSetRulesRequest represents the request body for setting firewall rules.
|
||||||
|
type FirewallSetRulesRequest struct {
|
||||||
|
Rules []FirewallRule `json:"rules"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// NetworkWhitelistRequest represents the request body for adding a network whitelist entry.
|
||||||
|
type NetworkWhitelistRequest struct {
|
||||||
|
IP string `json:"ip"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// TrafficBlockRequest represents the request body for adding a traffic block.
|
||||||
|
type TrafficBlockRequest struct {
|
||||||
|
Type string `json:"type"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// TrafficBlockResponse represents the response for traffic block operations.
|
||||||
|
type TrafficBlockResponse struct {
|
||||||
|
Data TrafficBlockData `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// TrafficBlockData represents a traffic block.
|
||||||
|
type TrafficBlockData struct {
|
||||||
|
ID int64 `json:"id"`
|
||||||
|
Type string `json:"type"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// TrafficBlockListResponse represents a list of traffic blocks.
|
||||||
|
type TrafficBlockListResponse struct {
|
||||||
|
Data []TrafficBlockData `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// TrafficResponse represents server traffic data.
|
||||||
|
type TrafficResponse struct {
|
||||||
|
Data TrafficData `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// TrafficData represents traffic usage data.
|
||||||
|
type TrafficData struct {
|
||||||
|
Used int64 `json:"used"`
|
||||||
|
Limit int64 `json:"limit"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// IPBlockRangeRequest represents the request body for adding an IPv4 range.
|
||||||
|
type IPBlockRangeRequest struct {
|
||||||
|
StartIP string `json:"startIp"`
|
||||||
|
EndIP string `json:"endIp"`
|
||||||
|
Gateway string `json:"gateway"`
|
||||||
|
Netmask string `json:"netmask"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ServerModifyNameRequest represents the request body for modifying a server name.
|
||||||
|
type ServerModifyNameRequest struct {
|
||||||
|
Name string `json:"name"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ServerModifyCPURequest represents the request body for modifying server CPU.
|
||||||
|
type ServerModifyCPURequest struct {
|
||||||
|
CPUCores int64 `json:"cpuCores"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ServerModifyMemoryRequest represents the request body for modifying server memory.
|
||||||
|
type ServerModifyMemoryRequest struct {
|
||||||
|
Memory int64 `json:"memory"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ServerModifyTrafficRequest represents the request body for modifying server traffic.
|
||||||
|
type ServerModifyTrafficRequest struct {
|
||||||
|
Traffic int64 `json:"traffic"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ServerModifyCPUThrottleRequest represents the request body for modifying CPU throttle.
|
||||||
|
type ServerModifyCPUThrottleRequest struct {
|
||||||
|
Percentage int64 `json:"percentage"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ServerCustomXMLRequest represents the request body for setting custom XML.
|
||||||
|
type ServerCustomXMLRequest struct {
|
||||||
|
XML string `json:"xml"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// VNCResponse represents the response for VNC operations.
|
||||||
|
type VNCResponse struct {
|
||||||
|
Data VNCData `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// VNCData represents VNC connection data.
|
||||||
|
type VNCData struct {
|
||||||
|
URL string `json:"url"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// BackupResponse represents the response for backup operations.
|
||||||
|
type BackupResponse struct {
|
||||||
|
Data []BackupData `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// BackupData represents a backup entry.
|
||||||
|
type BackupData struct {
|
||||||
|
ID int64 `json:"id"`
|
||||||
|
Type string `json:"type"`
|
||||||
|
CreatedAt string `json:"created"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// DNSServiceResponse represents the response for DNS service operations.
|
||||||
|
type DNSServiceResponse struct {
|
||||||
|
Data DNSServiceData `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// DNSServiceData represents a DNS service.
|
||||||
|
type DNSServiceData struct {
|
||||||
|
ID int64 `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Type string `json:"type"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ISOResponse represents the response for ISO operations.
|
||||||
|
type ISOResponse struct {
|
||||||
|
Data ISOData `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ISOData represents an ISO.
|
||||||
|
type ISOData struct {
|
||||||
|
ID int64 `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// QueueResponse represents the response for queue operations.
|
||||||
|
type QueueResponse struct {
|
||||||
|
Data QueueData `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// QueueData represents a queue item.
|
||||||
|
type QueueData struct {
|
||||||
|
ID int64 `json:"id"`
|
||||||
|
Status string `json:"status"`
|
||||||
|
Action string `json:"action"`
|
||||||
|
CreatedAt string `json:"created"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// TemplateResponse represents the response for template operations.
|
||||||
|
type TemplateResponse struct {
|
||||||
|
Data []TemplateData `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// TemplateData represents a template.
|
||||||
|
type TemplateData struct {
|
||||||
|
ID int64 `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// SelfServiceCreditRequest represents the request body for adding credit.
|
||||||
|
type SelfServiceCreditRequest struct {
|
||||||
|
Amount float64 `json:"amount"`
|
||||||
|
CurrencyCode string `json:"currencyCode"`
|
||||||
|
UserID int64 `json:"userId"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// SelfServiceCreditResponse represents the response for credit operations.
|
||||||
|
type SelfServiceCreditResponse struct {
|
||||||
|
Data SelfServiceCreditData `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// SelfServiceCreditData represents credit data.
|
||||||
|
type SelfServiceCreditData struct {
|
||||||
|
ID int64 `json:"id"`
|
||||||
|
Amount float64 `json:"amount"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// SelfServiceResourcePackRequest represents the request body for resource packs.
|
||||||
|
type SelfServiceResourcePackRequest struct {
|
||||||
|
Name string `json:"name"`
|
||||||
|
UserID int64 `json:"userId"`
|
||||||
|
PackID int64 `json:"packId"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// SelfServiceResourcePackResponse represents the response for resource pack operations.
|
||||||
|
type SelfServiceResourcePackResponse struct {
|
||||||
|
Data SelfServiceResourcePackData `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// SelfServiceResourcePackData represents a resource pack.
|
||||||
|
type SelfServiceResourcePackData struct {
|
||||||
|
ID int64 `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
UserID int64 `json:"userId"`
|
||||||
|
PackID int64 `json:"packId"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// CurrencyResponse represents the response for currency operations.
|
||||||
|
type CurrencyResponse struct {
|
||||||
|
Data []CurrencyData `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// CurrencyData represents a currency.
|
||||||
|
type CurrencyData struct {
|
||||||
|
ID int64 `json:"id"`
|
||||||
|
Code string `json:"code"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ServerIPv4AddRequest represents the request body for adding IPv4 to a server.
|
||||||
|
type ServerIPv4AddRequest struct {
|
||||||
|
Quantity int64 `json:"quantity,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// AuthTokenResponse represents the response for auth token generation.
|
||||||
|
type AuthTokenResponse struct {
|
||||||
|
Data AuthTokenData `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// AuthTokenData represents an auth token.
|
||||||
|
type AuthTokenData struct {
|
||||||
|
Token string `json:"token"`
|
||||||
|
URL string `json:"url"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// PasswordResetResponse represents the response for password reset operations.
|
||||||
|
type PasswordResetResponse struct {
|
||||||
|
Data PasswordResetData `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// PasswordResetData represents password reset data.
|
||||||
|
type PasswordResetData struct {
|
||||||
|
Password string `json:"password"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// HypervisorGroupResourcesResponse represents the response for hypervisor group resources.
|
||||||
|
// The API returns a paginated array of per-hypervisor resource entries.
|
||||||
|
type HypervisorGroupResourcesResponse struct {
|
||||||
|
Data []HypervisorGroupResourceEntry `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// HypervisorGroupResourceEntry represents a single hypervisor's resources within a group.
|
||||||
|
type HypervisorGroupResourceEntry struct {
|
||||||
|
Hypervisor HypervisorData `json:"hypervisor"`
|
||||||
|
Resources HypervisorGroupResourceDetail `json:"resources"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// HypervisorGroupResourceDetail represents the resource metrics for a hypervisor.
|
||||||
|
type HypervisorGroupResourceDetail struct {
|
||||||
|
Memory ResourceMetric `json:"memory"`
|
||||||
|
CPUCores ResourceMetric `json:"cpuCores"`
|
||||||
|
LocalStorage ResourceMetric `json:"localStorage"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ResourceMetric represents a resource metric with max/allocated/free values.
|
||||||
|
type ResourceMetric struct {
|
||||||
|
Max int64 `json:"max"`
|
||||||
|
Allocated int64 `json:"allocated"`
|
||||||
|
Free int64 `json:"free"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// SelfServiceHourlyStatsResponse represents the response for hourly stats.
|
||||||
|
type SelfServiceHourlyStatsResponse struct {
|
||||||
|
Data interface{} `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// SelfServiceReportResponse represents the response for self-service reports.
|
||||||
|
type SelfServiceReportResponse struct {
|
||||||
|
Data interface{} `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// SelfServiceUsageResponse represents the response for self-service usage.
|
||||||
|
type SelfServiceUsageResponse struct {
|
||||||
|
Data interface{} `json:"data"`
|
||||||
|
}
|
||||||
105
internal/provider/data_source_dns_service.go
Normal file
105
internal/provider/data_source_dns_service.go
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
// Copyright (c) EZSCALE.
|
||||||
|
// SPDX-License-Identifier: MPL-2.0
|
||||||
|
|
||||||
|
package provider
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"terraform-provider-virtfusion/internal/client"
|
||||||
|
|
||||||
|
"github.com/hashicorp/terraform-plugin-framework/datasource"
|
||||||
|
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
|
||||||
|
"github.com/hashicorp/terraform-plugin-framework/types"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
_ datasource.DataSource = &DNSServiceDataSource{}
|
||||||
|
_ datasource.DataSourceWithConfigure = &DNSServiceDataSource{}
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewDNSServiceDataSource returns a new DNS service data source.
|
||||||
|
func NewDNSServiceDataSource() datasource.DataSource {
|
||||||
|
return &DNSServiceDataSource{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// DNSServiceDataSource defines the data source implementation.
|
||||||
|
type DNSServiceDataSource struct {
|
||||||
|
client *client.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
// DNSServiceDataSourceModel describes the data source data model.
|
||||||
|
type DNSServiceDataSourceModel struct {
|
||||||
|
ID types.Int64 `tfsdk:"id"`
|
||||||
|
Name types.String `tfsdk:"name"`
|
||||||
|
Type types.String `tfsdk:"type"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *DNSServiceDataSource) Metadata(_ context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) {
|
||||||
|
resp.TypeName = req.ProviderTypeName + "_dns_service"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *DNSServiceDataSource) Schema(_ context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) {
|
||||||
|
resp.Schema = schema.Schema{
|
||||||
|
MarkdownDescription: "Fetches a single VirtFusion DNS service by ID.",
|
||||||
|
Attributes: map[string]schema.Attribute{
|
||||||
|
"id": schema.Int64Attribute{
|
||||||
|
MarkdownDescription: "The DNS service ID.",
|
||||||
|
Required: true,
|
||||||
|
},
|
||||||
|
"name": schema.StringAttribute{
|
||||||
|
MarkdownDescription: "The DNS service name.",
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"type": schema.StringAttribute{
|
||||||
|
MarkdownDescription: "The DNS service type.",
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *DNSServiceDataSource) Configure(_ context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) {
|
||||||
|
if req.ProviderData == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
c, ok := req.ProviderData.(*client.Client)
|
||||||
|
if !ok {
|
||||||
|
resp.Diagnostics.AddError(
|
||||||
|
"Unexpected Data Source Configure Type",
|
||||||
|
fmt.Sprintf("Expected *client.Client, got: %T.", req.ProviderData),
|
||||||
|
)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
d.client = c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *DNSServiceDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) {
|
||||||
|
var data DNSServiceDataSourceModel
|
||||||
|
resp.Diagnostics.Append(req.Config.Get(ctx, &data)...)
|
||||||
|
if resp.Diagnostics.HasError() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
rawResp, err := d.client.Get(ctx, fmt.Sprintf("/dns/services/%d", data.ID.ValueInt64()))
|
||||||
|
if err != nil {
|
||||||
|
resp.Diagnostics.AddError("Error Reading DNS Service", err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var dnsResp client.DNSServiceResponse
|
||||||
|
if err := json.Unmarshal(rawResp, &dnsResp); err != nil {
|
||||||
|
resp.Diagnostics.AddError("Error Parsing DNS Service Response", err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
data.ID = types.Int64Value(dnsResp.Data.ID)
|
||||||
|
data.Name = types.StringValue(dnsResp.Data.Name)
|
||||||
|
data.Type = types.StringValue(dnsResp.Data.Type)
|
||||||
|
|
||||||
|
resp.Diagnostics.Append(resp.State.Set(ctx, &data)...)
|
||||||
|
}
|
||||||
117
internal/provider/data_source_hypervisor.go
Normal file
117
internal/provider/data_source_hypervisor.go
Normal file
@@ -0,0 +1,117 @@
|
|||||||
|
// Copyright (c) EZSCALE.
|
||||||
|
// SPDX-License-Identifier: MPL-2.0
|
||||||
|
|
||||||
|
package provider
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"terraform-provider-virtfusion/internal/client"
|
||||||
|
|
||||||
|
"github.com/hashicorp/terraform-plugin-framework/datasource"
|
||||||
|
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
|
||||||
|
"github.com/hashicorp/terraform-plugin-framework/types"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
_ datasource.DataSource = &HypervisorDataSource{}
|
||||||
|
_ datasource.DataSourceWithConfigure = &HypervisorDataSource{}
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewHypervisorDataSource returns a new hypervisor data source.
|
||||||
|
func NewHypervisorDataSource() datasource.DataSource {
|
||||||
|
return &HypervisorDataSource{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// HypervisorDataSource defines the data source implementation.
|
||||||
|
type HypervisorDataSource struct {
|
||||||
|
client *client.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
// HypervisorDataSourceModel describes the data source data model.
|
||||||
|
type HypervisorDataSourceModel struct {
|
||||||
|
ID types.Int64 `tfsdk:"id"`
|
||||||
|
Name types.String `tfsdk:"name"`
|
||||||
|
Type types.String `tfsdk:"type"`
|
||||||
|
Hostname types.String `tfsdk:"hostname"`
|
||||||
|
Enabled types.Bool `tfsdk:"enabled"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *HypervisorDataSource) Metadata(_ context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) {
|
||||||
|
resp.TypeName = req.ProviderTypeName + "_hypervisor"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *HypervisorDataSource) Schema(_ context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) {
|
||||||
|
resp.Schema = schema.Schema{
|
||||||
|
MarkdownDescription: "Fetches a single VirtFusion hypervisor by ID.",
|
||||||
|
Attributes: map[string]schema.Attribute{
|
||||||
|
"id": schema.Int64Attribute{
|
||||||
|
MarkdownDescription: "The hypervisor ID.",
|
||||||
|
Required: true,
|
||||||
|
},
|
||||||
|
"name": schema.StringAttribute{
|
||||||
|
MarkdownDescription: "The hypervisor name.",
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"type": schema.StringAttribute{
|
||||||
|
MarkdownDescription: "The hypervisor type.",
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"hostname": schema.StringAttribute{
|
||||||
|
MarkdownDescription: "The hypervisor hostname.",
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"enabled": schema.BoolAttribute{
|
||||||
|
MarkdownDescription: "Whether the hypervisor is enabled.",
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *HypervisorDataSource) Configure(_ context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) {
|
||||||
|
if req.ProviderData == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
c, ok := req.ProviderData.(*client.Client)
|
||||||
|
if !ok {
|
||||||
|
resp.Diagnostics.AddError(
|
||||||
|
"Unexpected Data Source Configure Type",
|
||||||
|
fmt.Sprintf("Expected *client.Client, got: %T.", req.ProviderData),
|
||||||
|
)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
d.client = c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *HypervisorDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) {
|
||||||
|
var data HypervisorDataSourceModel
|
||||||
|
resp.Diagnostics.Append(req.Config.Get(ctx, &data)...)
|
||||||
|
if resp.Diagnostics.HasError() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
rawResp, err := d.client.Get(ctx, fmt.Sprintf("/compute/hypervisors/%d", data.ID.ValueInt64()))
|
||||||
|
if err != nil {
|
||||||
|
resp.Diagnostics.AddError("Error Reading Hypervisor", err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var hypervisorResp client.HypervisorResponse
|
||||||
|
if err := json.Unmarshal(rawResp, &hypervisorResp); err != nil {
|
||||||
|
resp.Diagnostics.AddError("Error Parsing Hypervisor Response", err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
data.ID = types.Int64Value(hypervisorResp.Data.ID)
|
||||||
|
data.Name = types.StringValue(hypervisorResp.Data.Name)
|
||||||
|
data.Type = types.StringValue(hypervisorResp.Data.Type)
|
||||||
|
data.Hostname = types.StringValue(hypervisorResp.Data.Hostname)
|
||||||
|
data.Enabled = types.BoolValue(hypervisorResp.Data.Enabled)
|
||||||
|
|
||||||
|
resp.Diagnostics.Append(resp.State.Set(ctx, &data)...)
|
||||||
|
}
|
||||||
105
internal/provider/data_source_hypervisor_group.go
Normal file
105
internal/provider/data_source_hypervisor_group.go
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
// Copyright (c) EZSCALE.
|
||||||
|
// SPDX-License-Identifier: MPL-2.0
|
||||||
|
|
||||||
|
package provider
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"terraform-provider-virtfusion/internal/client"
|
||||||
|
|
||||||
|
"github.com/hashicorp/terraform-plugin-framework/datasource"
|
||||||
|
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
|
||||||
|
"github.com/hashicorp/terraform-plugin-framework/types"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
_ datasource.DataSource = &HypervisorGroupDataSource{}
|
||||||
|
_ datasource.DataSourceWithConfigure = &HypervisorGroupDataSource{}
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewHypervisorGroupDataSource returns a new hypervisor group data source.
|
||||||
|
func NewHypervisorGroupDataSource() datasource.DataSource {
|
||||||
|
return &HypervisorGroupDataSource{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// HypervisorGroupDataSource defines the data source implementation.
|
||||||
|
type HypervisorGroupDataSource struct {
|
||||||
|
client *client.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
// HypervisorGroupDataSourceModel describes the data source data model.
|
||||||
|
type HypervisorGroupDataSourceModel struct {
|
||||||
|
ID types.Int64 `tfsdk:"id"`
|
||||||
|
Name types.String `tfsdk:"name"`
|
||||||
|
Enabled types.Bool `tfsdk:"enabled"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *HypervisorGroupDataSource) Metadata(_ context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) {
|
||||||
|
resp.TypeName = req.ProviderTypeName + "_hypervisor_group"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *HypervisorGroupDataSource) Schema(_ context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) {
|
||||||
|
resp.Schema = schema.Schema{
|
||||||
|
MarkdownDescription: "Fetches a single VirtFusion hypervisor group by ID.",
|
||||||
|
Attributes: map[string]schema.Attribute{
|
||||||
|
"id": schema.Int64Attribute{
|
||||||
|
MarkdownDescription: "The hypervisor group ID.",
|
||||||
|
Required: true,
|
||||||
|
},
|
||||||
|
"name": schema.StringAttribute{
|
||||||
|
MarkdownDescription: "The hypervisor group name.",
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"enabled": schema.BoolAttribute{
|
||||||
|
MarkdownDescription: "Whether the hypervisor group is enabled.",
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *HypervisorGroupDataSource) Configure(_ context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) {
|
||||||
|
if req.ProviderData == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
c, ok := req.ProviderData.(*client.Client)
|
||||||
|
if !ok {
|
||||||
|
resp.Diagnostics.AddError(
|
||||||
|
"Unexpected Data Source Configure Type",
|
||||||
|
fmt.Sprintf("Expected *client.Client, got: %T.", req.ProviderData),
|
||||||
|
)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
d.client = c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *HypervisorGroupDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) {
|
||||||
|
var data HypervisorGroupDataSourceModel
|
||||||
|
resp.Diagnostics.Append(req.Config.Get(ctx, &data)...)
|
||||||
|
if resp.Diagnostics.HasError() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
rawResp, err := d.client.Get(ctx, fmt.Sprintf("/compute/hypervisors/groups/%d", data.ID.ValueInt64()))
|
||||||
|
if err != nil {
|
||||||
|
resp.Diagnostics.AddError("Error Reading Hypervisor Group", err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var groupResp client.HypervisorGroupResponse
|
||||||
|
if err := json.Unmarshal(rawResp, &groupResp); err != nil {
|
||||||
|
resp.Diagnostics.AddError("Error Parsing Hypervisor Group Response", err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
data.ID = types.Int64Value(groupResp.Data.ID)
|
||||||
|
data.Name = types.StringValue(groupResp.Data.Name)
|
||||||
|
data.Enabled = types.BoolValue(groupResp.Data.Enabled)
|
||||||
|
|
||||||
|
resp.Diagnostics.Append(resp.State.Set(ctx, &data)...)
|
||||||
|
}
|
||||||
119
internal/provider/data_source_hypervisor_group_resources.go
Normal file
119
internal/provider/data_source_hypervisor_group_resources.go
Normal file
@@ -0,0 +1,119 @@
|
|||||||
|
// Copyright (c) EZSCALE.
|
||||||
|
// SPDX-License-Identifier: MPL-2.0
|
||||||
|
|
||||||
|
package provider
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"terraform-provider-virtfusion/internal/client"
|
||||||
|
|
||||||
|
"github.com/hashicorp/terraform-plugin-framework/datasource"
|
||||||
|
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
|
||||||
|
"github.com/hashicorp/terraform-plugin-framework/types"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
_ datasource.DataSource = &HypervisorGroupResourcesDataSource{}
|
||||||
|
_ datasource.DataSourceWithConfigure = &HypervisorGroupResourcesDataSource{}
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewHypervisorGroupResourcesDataSource returns a new hypervisor group resources data source.
|
||||||
|
func NewHypervisorGroupResourcesDataSource() datasource.DataSource {
|
||||||
|
return &HypervisorGroupResourcesDataSource{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// HypervisorGroupResourcesDataSource defines the data source implementation.
|
||||||
|
type HypervisorGroupResourcesDataSource struct {
|
||||||
|
client *client.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
// HypervisorGroupResourcesDataSourceModel describes the data source data model.
|
||||||
|
type HypervisorGroupResourcesDataSourceModel struct {
|
||||||
|
ID types.Int64 `tfsdk:"id"`
|
||||||
|
Results types.Int64 `tfsdk:"results"`
|
||||||
|
CPUCores types.Int64 `tfsdk:"cpu_cores"`
|
||||||
|
Memory types.Int64 `tfsdk:"memory"`
|
||||||
|
Storage types.Int64 `tfsdk:"storage"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *HypervisorGroupResourcesDataSource) Metadata(_ context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) {
|
||||||
|
resp.TypeName = req.ProviderTypeName + "_hypervisor_group_resources"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *HypervisorGroupResourcesDataSource) Schema(_ context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) {
|
||||||
|
resp.Schema = schema.Schema{
|
||||||
|
MarkdownDescription: "Fetches resource information for a VirtFusion hypervisor group.",
|
||||||
|
Attributes: map[string]schema.Attribute{
|
||||||
|
"id": schema.Int64Attribute{
|
||||||
|
MarkdownDescription: "The hypervisor group ID.",
|
||||||
|
Required: true,
|
||||||
|
},
|
||||||
|
"results": resultsSchemaAttribute(),
|
||||||
|
"cpu_cores": schema.Int64Attribute{
|
||||||
|
MarkdownDescription: "The number of CPU cores available in the group.",
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"memory": schema.Int64Attribute{
|
||||||
|
MarkdownDescription: "The amount of memory available in the group.",
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"storage": schema.Int64Attribute{
|
||||||
|
MarkdownDescription: "The amount of storage available in the group.",
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *HypervisorGroupResourcesDataSource) Configure(_ context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) {
|
||||||
|
if req.ProviderData == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
c, ok := req.ProviderData.(*client.Client)
|
||||||
|
if !ok {
|
||||||
|
resp.Diagnostics.AddError(
|
||||||
|
"Unexpected Data Source Configure Type",
|
||||||
|
fmt.Sprintf("Expected *client.Client, got: %T.", req.ProviderData),
|
||||||
|
)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
d.client = c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *HypervisorGroupResourcesDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) {
|
||||||
|
var data HypervisorGroupResourcesDataSourceModel
|
||||||
|
resp.Diagnostics.Append(req.Config.Get(ctx, &data)...)
|
||||||
|
if resp.Diagnostics.HasError() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
rawResp, err := d.client.GetAllPages(ctx, fmt.Sprintf("/compute/hypervisors/groups/%d/resources?%s", data.ID.ValueInt64(), resultsQueryParam(data.Results)))
|
||||||
|
if err != nil {
|
||||||
|
resp.Diagnostics.AddError("Error Reading Hypervisor Group Resources", err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var resourcesResp client.HypervisorGroupResourcesResponse
|
||||||
|
if err := json.Unmarshal(rawResp, &resourcesResp); err != nil {
|
||||||
|
resp.Diagnostics.AddError("Error Parsing Hypervisor Group Resources Response", err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Aggregate resource totals across all hypervisors in the group.
|
||||||
|
var totalCPU, totalMemory, totalStorage int64
|
||||||
|
for _, entry := range resourcesResp.Data {
|
||||||
|
totalCPU += entry.Resources.CPUCores.Max
|
||||||
|
totalMemory += entry.Resources.Memory.Max
|
||||||
|
totalStorage += entry.Resources.LocalStorage.Max
|
||||||
|
}
|
||||||
|
data.CPUCores = types.Int64Value(totalCPU)
|
||||||
|
data.Memory = types.Int64Value(totalMemory)
|
||||||
|
data.Storage = types.Int64Value(totalStorage)
|
||||||
|
|
||||||
|
resp.Diagnostics.Append(resp.State.Set(ctx, &data)...)
|
||||||
|
}
|
||||||
121
internal/provider/data_source_hypervisor_groups.go
Normal file
121
internal/provider/data_source_hypervisor_groups.go
Normal file
@@ -0,0 +1,121 @@
|
|||||||
|
// Copyright (c) EZSCALE.
|
||||||
|
// SPDX-License-Identifier: MPL-2.0
|
||||||
|
|
||||||
|
package provider
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"terraform-provider-virtfusion/internal/client"
|
||||||
|
|
||||||
|
"github.com/hashicorp/terraform-plugin-framework/datasource"
|
||||||
|
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
|
||||||
|
"github.com/hashicorp/terraform-plugin-framework/types"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
_ datasource.DataSource = &HypervisorGroupsDataSource{}
|
||||||
|
_ datasource.DataSourceWithConfigure = &HypervisorGroupsDataSource{}
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewHypervisorGroupsDataSource returns a new hypervisor groups data source.
|
||||||
|
func NewHypervisorGroupsDataSource() datasource.DataSource {
|
||||||
|
return &HypervisorGroupsDataSource{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// HypervisorGroupsDataSource defines the data source implementation.
|
||||||
|
type HypervisorGroupsDataSource struct {
|
||||||
|
client *client.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
// HypervisorGroupsDataSourceModel describes the data source data model.
|
||||||
|
type HypervisorGroupsDataSourceModel struct {
|
||||||
|
Results types.Int64 `tfsdk:"results"`
|
||||||
|
Groups []HypervisorGroupItemModel `tfsdk:"groups"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// HypervisorGroupItemModel describes a single hypervisor group in the list.
|
||||||
|
type HypervisorGroupItemModel struct {
|
||||||
|
ID types.Int64 `tfsdk:"id"`
|
||||||
|
Name types.String `tfsdk:"name"`
|
||||||
|
Enabled types.Bool `tfsdk:"enabled"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *HypervisorGroupsDataSource) Metadata(_ context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) {
|
||||||
|
resp.TypeName = req.ProviderTypeName + "_hypervisor_groups"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *HypervisorGroupsDataSource) Schema(_ context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) {
|
||||||
|
resp.Schema = schema.Schema{
|
||||||
|
MarkdownDescription: "Fetches all VirtFusion hypervisor groups.",
|
||||||
|
Attributes: map[string]schema.Attribute{
|
||||||
|
"results": resultsSchemaAttribute(),
|
||||||
|
"groups": schema.ListNestedAttribute{
|
||||||
|
MarkdownDescription: "List of hypervisor groups.",
|
||||||
|
Computed: true,
|
||||||
|
NestedObject: schema.NestedAttributeObject{
|
||||||
|
Attributes: map[string]schema.Attribute{
|
||||||
|
"id": schema.Int64Attribute{
|
||||||
|
MarkdownDescription: "The hypervisor group ID.",
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"name": schema.StringAttribute{
|
||||||
|
MarkdownDescription: "The hypervisor group name.",
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"enabled": schema.BoolAttribute{
|
||||||
|
MarkdownDescription: "Whether the hypervisor group is enabled.",
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *HypervisorGroupsDataSource) Configure(_ context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) {
|
||||||
|
if req.ProviderData == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
c, ok := req.ProviderData.(*client.Client)
|
||||||
|
if !ok {
|
||||||
|
resp.Diagnostics.AddError(
|
||||||
|
"Unexpected Data Source Configure Type",
|
||||||
|
fmt.Sprintf("Expected *client.Client, got: %T.", req.ProviderData),
|
||||||
|
)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
d.client = c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *HypervisorGroupsDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) {
|
||||||
|
var data HypervisorGroupsDataSourceModel
|
||||||
|
|
||||||
|
rawResp, err := d.client.GetAllPages(ctx, fmt.Sprintf("/compute/hypervisors/groups?%s", resultsQueryParam(data.Results)))
|
||||||
|
if err != nil {
|
||||||
|
resp.Diagnostics.AddError("Error Reading Hypervisor Groups", err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var listResp client.HypervisorGroupListResponse
|
||||||
|
if err := json.Unmarshal(rawResp, &listResp); err != nil {
|
||||||
|
resp.Diagnostics.AddError("Error Parsing Hypervisor Groups Response", err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
data.Groups = make([]HypervisorGroupItemModel, len(listResp.Data))
|
||||||
|
for i, g := range listResp.Data {
|
||||||
|
data.Groups[i] = HypervisorGroupItemModel{
|
||||||
|
ID: types.Int64Value(g.ID),
|
||||||
|
Name: types.StringValue(g.Name),
|
||||||
|
Enabled: types.BoolValue(g.Enabled),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
resp.Diagnostics.Append(resp.State.Set(ctx, &data)...)
|
||||||
|
}
|
||||||
133
internal/provider/data_source_hypervisors.go
Normal file
133
internal/provider/data_source_hypervisors.go
Normal file
@@ -0,0 +1,133 @@
|
|||||||
|
// Copyright (c) EZSCALE.
|
||||||
|
// SPDX-License-Identifier: MPL-2.0
|
||||||
|
|
||||||
|
package provider
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"terraform-provider-virtfusion/internal/client"
|
||||||
|
|
||||||
|
"github.com/hashicorp/terraform-plugin-framework/datasource"
|
||||||
|
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
|
||||||
|
"github.com/hashicorp/terraform-plugin-framework/types"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
_ datasource.DataSource = &HypervisorsDataSource{}
|
||||||
|
_ datasource.DataSourceWithConfigure = &HypervisorsDataSource{}
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewHypervisorsDataSource returns a new hypervisors data source.
|
||||||
|
func NewHypervisorsDataSource() datasource.DataSource {
|
||||||
|
return &HypervisorsDataSource{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// HypervisorsDataSource defines the data source implementation.
|
||||||
|
type HypervisorsDataSource struct {
|
||||||
|
client *client.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
// HypervisorsDataSourceModel describes the data source data model.
|
||||||
|
type HypervisorsDataSourceModel struct {
|
||||||
|
Results types.Int64 `tfsdk:"results"`
|
||||||
|
Hypervisors []HypervisorItemModel `tfsdk:"hypervisors"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// HypervisorItemModel describes a single hypervisor in the list.
|
||||||
|
type HypervisorItemModel struct {
|
||||||
|
ID types.Int64 `tfsdk:"id"`
|
||||||
|
Name types.String `tfsdk:"name"`
|
||||||
|
Type types.String `tfsdk:"type"`
|
||||||
|
Hostname types.String `tfsdk:"hostname"`
|
||||||
|
Enabled types.Bool `tfsdk:"enabled"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *HypervisorsDataSource) Metadata(_ context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) {
|
||||||
|
resp.TypeName = req.ProviderTypeName + "_hypervisors"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *HypervisorsDataSource) Schema(_ context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) {
|
||||||
|
resp.Schema = schema.Schema{
|
||||||
|
MarkdownDescription: "Fetches all VirtFusion hypervisors.",
|
||||||
|
Attributes: map[string]schema.Attribute{
|
||||||
|
"results": resultsSchemaAttribute(),
|
||||||
|
"hypervisors": schema.ListNestedAttribute{
|
||||||
|
MarkdownDescription: "List of hypervisors.",
|
||||||
|
Computed: true,
|
||||||
|
NestedObject: schema.NestedAttributeObject{
|
||||||
|
Attributes: map[string]schema.Attribute{
|
||||||
|
"id": schema.Int64Attribute{
|
||||||
|
MarkdownDescription: "The hypervisor ID.",
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"name": schema.StringAttribute{
|
||||||
|
MarkdownDescription: "The hypervisor name.",
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"type": schema.StringAttribute{
|
||||||
|
MarkdownDescription: "The hypervisor type.",
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"hostname": schema.StringAttribute{
|
||||||
|
MarkdownDescription: "The hypervisor hostname.",
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"enabled": schema.BoolAttribute{
|
||||||
|
MarkdownDescription: "Whether the hypervisor is enabled.",
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *HypervisorsDataSource) Configure(_ context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) {
|
||||||
|
if req.ProviderData == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
c, ok := req.ProviderData.(*client.Client)
|
||||||
|
if !ok {
|
||||||
|
resp.Diagnostics.AddError(
|
||||||
|
"Unexpected Data Source Configure Type",
|
||||||
|
fmt.Sprintf("Expected *client.Client, got: %T.", req.ProviderData),
|
||||||
|
)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
d.client = c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *HypervisorsDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) {
|
||||||
|
var data HypervisorsDataSourceModel
|
||||||
|
|
||||||
|
rawResp, err := d.client.GetAllPages(ctx, fmt.Sprintf("/compute/hypervisors?%s", resultsQueryParam(data.Results)))
|
||||||
|
if err != nil {
|
||||||
|
resp.Diagnostics.AddError("Error Reading Hypervisors", err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var listResp client.HypervisorListResponse
|
||||||
|
if err := json.Unmarshal(rawResp, &listResp); err != nil {
|
||||||
|
resp.Diagnostics.AddError("Error Parsing Hypervisors Response", err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
data.Hypervisors = make([]HypervisorItemModel, len(listResp.Data))
|
||||||
|
for i, h := range listResp.Data {
|
||||||
|
data.Hypervisors[i] = HypervisorItemModel{
|
||||||
|
ID: types.Int64Value(h.ID),
|
||||||
|
Name: types.StringValue(h.Name),
|
||||||
|
Type: types.StringValue(h.Type),
|
||||||
|
Hostname: types.StringValue(h.Hostname),
|
||||||
|
Enabled: types.BoolValue(h.Enabled),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
resp.Diagnostics.Append(resp.State.Set(ctx, &data)...)
|
||||||
|
}
|
||||||
123
internal/provider/data_source_ip_block.go
Normal file
123
internal/provider/data_source_ip_block.go
Normal file
@@ -0,0 +1,123 @@
|
|||||||
|
// Copyright (c) EZSCALE.
|
||||||
|
// SPDX-License-Identifier: MPL-2.0
|
||||||
|
|
||||||
|
package provider
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"terraform-provider-virtfusion/internal/client"
|
||||||
|
|
||||||
|
"github.com/hashicorp/terraform-plugin-framework/datasource"
|
||||||
|
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
|
||||||
|
"github.com/hashicorp/terraform-plugin-framework/types"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
_ datasource.DataSource = &IPBlockDataSource{}
|
||||||
|
_ datasource.DataSourceWithConfigure = &IPBlockDataSource{}
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewIPBlockDataSource returns a new IP block data source.
|
||||||
|
func NewIPBlockDataSource() datasource.DataSource {
|
||||||
|
return &IPBlockDataSource{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// IPBlockDataSource defines the data source implementation.
|
||||||
|
type IPBlockDataSource struct {
|
||||||
|
client *client.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
// IPBlockDataSourceModel describes the data source data model.
|
||||||
|
type IPBlockDataSourceModel struct {
|
||||||
|
ID types.Int64 `tfsdk:"id"`
|
||||||
|
Name types.String `tfsdk:"name"`
|
||||||
|
Type types.Int64 `tfsdk:"type"`
|
||||||
|
Gateway types.String `tfsdk:"gateway"`
|
||||||
|
Netmask types.String `tfsdk:"netmask"`
|
||||||
|
Enabled types.Bool `tfsdk:"enabled"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *IPBlockDataSource) Metadata(_ context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) {
|
||||||
|
resp.TypeName = req.ProviderTypeName + "_ip_block"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *IPBlockDataSource) Schema(_ context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) {
|
||||||
|
resp.Schema = schema.Schema{
|
||||||
|
MarkdownDescription: "Fetches a single VirtFusion IP block by ID.",
|
||||||
|
Attributes: map[string]schema.Attribute{
|
||||||
|
"id": schema.Int64Attribute{
|
||||||
|
MarkdownDescription: "The IP block ID.",
|
||||||
|
Required: true,
|
||||||
|
},
|
||||||
|
"name": schema.StringAttribute{
|
||||||
|
MarkdownDescription: "The IP block name.",
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"type": schema.Int64Attribute{
|
||||||
|
MarkdownDescription: "The IP block type (4 = IPv4, 6 = IPv6).",
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"gateway": schema.StringAttribute{
|
||||||
|
MarkdownDescription: "The IPv4 gateway address.",
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"netmask": schema.StringAttribute{
|
||||||
|
MarkdownDescription: "The IPv4 netmask.",
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"enabled": schema.BoolAttribute{
|
||||||
|
MarkdownDescription: "Whether the IP block is enabled.",
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *IPBlockDataSource) Configure(_ context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) {
|
||||||
|
if req.ProviderData == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
c, ok := req.ProviderData.(*client.Client)
|
||||||
|
if !ok {
|
||||||
|
resp.Diagnostics.AddError(
|
||||||
|
"Unexpected Data Source Configure Type",
|
||||||
|
fmt.Sprintf("Expected *client.Client, got: %T.", req.ProviderData),
|
||||||
|
)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
d.client = c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *IPBlockDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) {
|
||||||
|
var data IPBlockDataSourceModel
|
||||||
|
resp.Diagnostics.Append(req.Config.Get(ctx, &data)...)
|
||||||
|
if resp.Diagnostics.HasError() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
rawResp, err := d.client.Get(ctx, fmt.Sprintf("/connectivity/ipblocks/%d", data.ID.ValueInt64()))
|
||||||
|
if err != nil {
|
||||||
|
resp.Diagnostics.AddError("Error Reading IP Block", err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var blockResp client.IPBlockResponse
|
||||||
|
if err := json.Unmarshal(rawResp, &blockResp); err != nil {
|
||||||
|
resp.Diagnostics.AddError("Error Parsing IP Block Response", err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
data.ID = types.Int64Value(blockResp.Data.ID)
|
||||||
|
data.Name = types.StringValue(blockResp.Data.Name)
|
||||||
|
data.Type = types.Int64Value(blockResp.Data.Type)
|
||||||
|
data.Gateway = types.StringValue(blockResp.Data.IPv4.Gateway)
|
||||||
|
data.Netmask = types.StringValue(blockResp.Data.IPv4.Netmask)
|
||||||
|
data.Enabled = types.BoolValue(blockResp.Data.Enabled)
|
||||||
|
|
||||||
|
resp.Diagnostics.Append(resp.State.Set(ctx, &data)...)
|
||||||
|
}
|
||||||
139
internal/provider/data_source_ip_blocks.go
Normal file
139
internal/provider/data_source_ip_blocks.go
Normal file
@@ -0,0 +1,139 @@
|
|||||||
|
// Copyright (c) EZSCALE.
|
||||||
|
// SPDX-License-Identifier: MPL-2.0
|
||||||
|
|
||||||
|
package provider
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"terraform-provider-virtfusion/internal/client"
|
||||||
|
|
||||||
|
"github.com/hashicorp/terraform-plugin-framework/datasource"
|
||||||
|
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
|
||||||
|
"github.com/hashicorp/terraform-plugin-framework/types"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
_ datasource.DataSource = &IPBlocksDataSource{}
|
||||||
|
_ datasource.DataSourceWithConfigure = &IPBlocksDataSource{}
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewIPBlocksDataSource returns a new IP blocks data source.
|
||||||
|
func NewIPBlocksDataSource() datasource.DataSource {
|
||||||
|
return &IPBlocksDataSource{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// IPBlocksDataSource defines the data source implementation.
|
||||||
|
type IPBlocksDataSource struct {
|
||||||
|
client *client.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
// IPBlocksDataSourceModel describes the data source data model.
|
||||||
|
type IPBlocksDataSourceModel struct {
|
||||||
|
Results types.Int64 `tfsdk:"results"`
|
||||||
|
IPBlocks []IPBlockItemModel `tfsdk:"ip_blocks"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// IPBlockItemModel describes a single IP block in the list.
|
||||||
|
type IPBlockItemModel struct {
|
||||||
|
ID types.Int64 `tfsdk:"id"`
|
||||||
|
Name types.String `tfsdk:"name"`
|
||||||
|
Type types.Int64 `tfsdk:"type"`
|
||||||
|
Gateway types.String `tfsdk:"gateway"`
|
||||||
|
Netmask types.String `tfsdk:"netmask"`
|
||||||
|
Enabled types.Bool `tfsdk:"enabled"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *IPBlocksDataSource) Metadata(_ context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) {
|
||||||
|
resp.TypeName = req.ProviderTypeName + "_ip_blocks"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *IPBlocksDataSource) Schema(_ context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) {
|
||||||
|
resp.Schema = schema.Schema{
|
||||||
|
MarkdownDescription: "Fetches all VirtFusion IP blocks.",
|
||||||
|
Attributes: map[string]schema.Attribute{
|
||||||
|
"results": resultsSchemaAttribute(),
|
||||||
|
"ip_blocks": schema.ListNestedAttribute{
|
||||||
|
MarkdownDescription: "List of IP blocks.",
|
||||||
|
Computed: true,
|
||||||
|
NestedObject: schema.NestedAttributeObject{
|
||||||
|
Attributes: map[string]schema.Attribute{
|
||||||
|
"id": schema.Int64Attribute{
|
||||||
|
MarkdownDescription: "The IP block ID.",
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"name": schema.StringAttribute{
|
||||||
|
MarkdownDescription: "The IP block name.",
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"type": schema.Int64Attribute{
|
||||||
|
MarkdownDescription: "The IP block type (4 = IPv4, 6 = IPv6).",
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"gateway": schema.StringAttribute{
|
||||||
|
MarkdownDescription: "The IPv4 gateway address.",
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"netmask": schema.StringAttribute{
|
||||||
|
MarkdownDescription: "The IPv4 netmask.",
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"enabled": schema.BoolAttribute{
|
||||||
|
MarkdownDescription: "Whether the IP block is enabled.",
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *IPBlocksDataSource) Configure(_ context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) {
|
||||||
|
if req.ProviderData == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
c, ok := req.ProviderData.(*client.Client)
|
||||||
|
if !ok {
|
||||||
|
resp.Diagnostics.AddError(
|
||||||
|
"Unexpected Data Source Configure Type",
|
||||||
|
fmt.Sprintf("Expected *client.Client, got: %T.", req.ProviderData),
|
||||||
|
)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
d.client = c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *IPBlocksDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) {
|
||||||
|
var data IPBlocksDataSourceModel
|
||||||
|
|
||||||
|
rawResp, err := d.client.GetAllPages(ctx, fmt.Sprintf("/connectivity/ipblocks?%s", resultsQueryParam(data.Results)))
|
||||||
|
if err != nil {
|
||||||
|
resp.Diagnostics.AddError("Error Reading IP Blocks", err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var listResp client.IPBlockListResponse
|
||||||
|
if err := json.Unmarshal(rawResp, &listResp); err != nil {
|
||||||
|
resp.Diagnostics.AddError("Error Parsing IP Blocks Response", err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
data.IPBlocks = make([]IPBlockItemModel, len(listResp.Data))
|
||||||
|
for i, b := range listResp.Data {
|
||||||
|
data.IPBlocks[i] = IPBlockItemModel{
|
||||||
|
ID: types.Int64Value(b.ID),
|
||||||
|
Name: types.StringValue(b.Name),
|
||||||
|
Type: types.Int64Value(b.Type),
|
||||||
|
Gateway: types.StringValue(b.IPv4.Gateway),
|
||||||
|
Netmask: types.StringValue(b.IPv4.Netmask),
|
||||||
|
Enabled: types.BoolValue(b.Enabled),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
resp.Diagnostics.Append(resp.State.Set(ctx, &data)...)
|
||||||
|
}
|
||||||
99
internal/provider/data_source_iso.go
Normal file
99
internal/provider/data_source_iso.go
Normal file
@@ -0,0 +1,99 @@
|
|||||||
|
// Copyright (c) EZSCALE.
|
||||||
|
// SPDX-License-Identifier: MPL-2.0
|
||||||
|
|
||||||
|
package provider
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"terraform-provider-virtfusion/internal/client"
|
||||||
|
|
||||||
|
"github.com/hashicorp/terraform-plugin-framework/datasource"
|
||||||
|
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
|
||||||
|
"github.com/hashicorp/terraform-plugin-framework/types"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
_ datasource.DataSource = &ISODataSource{}
|
||||||
|
_ datasource.DataSourceWithConfigure = &ISODataSource{}
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewISODataSource returns a new ISO data source.
|
||||||
|
func NewISODataSource() datasource.DataSource {
|
||||||
|
return &ISODataSource{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ISODataSource defines the data source implementation.
|
||||||
|
type ISODataSource struct {
|
||||||
|
client *client.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
// ISODataSourceModel describes the data source data model.
|
||||||
|
type ISODataSourceModel struct {
|
||||||
|
ID types.Int64 `tfsdk:"id"`
|
||||||
|
Name types.String `tfsdk:"name"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *ISODataSource) Metadata(_ context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) {
|
||||||
|
resp.TypeName = req.ProviderTypeName + "_iso"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *ISODataSource) Schema(_ context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) {
|
||||||
|
resp.Schema = schema.Schema{
|
||||||
|
MarkdownDescription: "Fetches a single VirtFusion ISO by ID.",
|
||||||
|
Attributes: map[string]schema.Attribute{
|
||||||
|
"id": schema.Int64Attribute{
|
||||||
|
MarkdownDescription: "The ISO ID.",
|
||||||
|
Required: true,
|
||||||
|
},
|
||||||
|
"name": schema.StringAttribute{
|
||||||
|
MarkdownDescription: "The ISO name.",
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *ISODataSource) Configure(_ context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) {
|
||||||
|
if req.ProviderData == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
c, ok := req.ProviderData.(*client.Client)
|
||||||
|
if !ok {
|
||||||
|
resp.Diagnostics.AddError(
|
||||||
|
"Unexpected Data Source Configure Type",
|
||||||
|
fmt.Sprintf("Expected *client.Client, got: %T.", req.ProviderData),
|
||||||
|
)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
d.client = c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *ISODataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) {
|
||||||
|
var data ISODataSourceModel
|
||||||
|
resp.Diagnostics.Append(req.Config.Get(ctx, &data)...)
|
||||||
|
if resp.Diagnostics.HasError() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
rawResp, err := d.client.Get(ctx, fmt.Sprintf("/media/iso/%d", data.ID.ValueInt64()))
|
||||||
|
if err != nil {
|
||||||
|
resp.Diagnostics.AddError("Error Reading ISO", err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var isoResp client.ISOResponse
|
||||||
|
if err := json.Unmarshal(rawResp, &isoResp); err != nil {
|
||||||
|
resp.Diagnostics.AddError("Error Parsing ISO Response", err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
data.ID = types.Int64Value(isoResp.Data.ID)
|
||||||
|
data.Name = types.StringValue(isoResp.Data.Name)
|
||||||
|
|
||||||
|
resp.Diagnostics.Append(resp.State.Set(ctx, &data)...)
|
||||||
|
}
|
||||||
147
internal/provider/data_source_package.go
Normal file
147
internal/provider/data_source_package.go
Normal file
@@ -0,0 +1,147 @@
|
|||||||
|
// Copyright (c) EZSCALE.
|
||||||
|
// SPDX-License-Identifier: MPL-2.0
|
||||||
|
|
||||||
|
package provider
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"terraform-provider-virtfusion/internal/client"
|
||||||
|
|
||||||
|
"github.com/hashicorp/terraform-plugin-framework/datasource"
|
||||||
|
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
|
||||||
|
"github.com/hashicorp/terraform-plugin-framework/types"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
_ datasource.DataSource = &PackageDataSource{}
|
||||||
|
_ datasource.DataSourceWithConfigure = &PackageDataSource{}
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewPackageDataSource returns a new package data source.
|
||||||
|
func NewPackageDataSource() datasource.DataSource {
|
||||||
|
return &PackageDataSource{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// PackageDataSource defines the data source implementation.
|
||||||
|
type PackageDataSource struct {
|
||||||
|
client *client.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
// PackageDataSourceModel describes the data source data model.
|
||||||
|
type PackageDataSourceModel struct {
|
||||||
|
ID types.Int64 `tfsdk:"id"`
|
||||||
|
Name types.String `tfsdk:"name"`
|
||||||
|
Enabled types.Bool `tfsdk:"enabled"`
|
||||||
|
CPUCores types.Int64 `tfsdk:"cpu_cores"`
|
||||||
|
Memory types.Int64 `tfsdk:"memory"`
|
||||||
|
Storage types.Int64 `tfsdk:"storage"`
|
||||||
|
Traffic types.Int64 `tfsdk:"traffic"`
|
||||||
|
NetworkSpeedInbound types.Int64 `tfsdk:"network_speed_inbound"`
|
||||||
|
NetworkSpeedOutbound types.Int64 `tfsdk:"network_speed_outbound"`
|
||||||
|
Ipv4 types.Int64 `tfsdk:"ipv4"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *PackageDataSource) Metadata(_ context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) {
|
||||||
|
resp.TypeName = req.ProviderTypeName + "_package"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *PackageDataSource) Schema(_ context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) {
|
||||||
|
resp.Schema = schema.Schema{
|
||||||
|
MarkdownDescription: "Fetches a single VirtFusion package by ID.",
|
||||||
|
Attributes: map[string]schema.Attribute{
|
||||||
|
"id": schema.Int64Attribute{
|
||||||
|
MarkdownDescription: "The package ID.",
|
||||||
|
Required: true,
|
||||||
|
},
|
||||||
|
"name": schema.StringAttribute{
|
||||||
|
MarkdownDescription: "The package name.",
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"enabled": schema.BoolAttribute{
|
||||||
|
MarkdownDescription: "Whether the package is enabled.",
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"cpu_cores": schema.Int64Attribute{
|
||||||
|
MarkdownDescription: "The number of CPU cores in the package.",
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"memory": schema.Int64Attribute{
|
||||||
|
MarkdownDescription: "The amount of memory in the package.",
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"storage": schema.Int64Attribute{
|
||||||
|
MarkdownDescription: "The amount of storage in the package.",
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"traffic": schema.Int64Attribute{
|
||||||
|
MarkdownDescription: "The traffic limit in the package.",
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"network_speed_inbound": schema.Int64Attribute{
|
||||||
|
MarkdownDescription: "The inbound network speed in the package.",
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"network_speed_outbound": schema.Int64Attribute{
|
||||||
|
MarkdownDescription: "The outbound network speed in the package.",
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"ipv4": schema.Int64Attribute{
|
||||||
|
MarkdownDescription: "The number of IPv4 addresses in the package.",
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *PackageDataSource) Configure(_ context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) {
|
||||||
|
if req.ProviderData == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
c, ok := req.ProviderData.(*client.Client)
|
||||||
|
if !ok {
|
||||||
|
resp.Diagnostics.AddError(
|
||||||
|
"Unexpected Data Source Configure Type",
|
||||||
|
fmt.Sprintf("Expected *client.Client, got: %T.", req.ProviderData),
|
||||||
|
)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
d.client = c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *PackageDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) {
|
||||||
|
var data PackageDataSourceModel
|
||||||
|
resp.Diagnostics.Append(req.Config.Get(ctx, &data)...)
|
||||||
|
if resp.Diagnostics.HasError() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
rawResp, err := d.client.Get(ctx, fmt.Sprintf("/packages/%d", data.ID.ValueInt64()))
|
||||||
|
if err != nil {
|
||||||
|
resp.Diagnostics.AddError("Error Reading Package", err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var pkgResp client.PackageResponse
|
||||||
|
if err := json.Unmarshal(rawResp, &pkgResp); err != nil {
|
||||||
|
resp.Diagnostics.AddError("Error Parsing Package Response", err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
data.ID = types.Int64Value(pkgResp.Data.ID)
|
||||||
|
data.Name = types.StringValue(pkgResp.Data.Name)
|
||||||
|
data.Enabled = types.BoolValue(pkgResp.Data.Enabled)
|
||||||
|
data.CPUCores = types.Int64Value(pkgResp.Data.CPUCores)
|
||||||
|
data.Memory = types.Int64Value(pkgResp.Data.Memory)
|
||||||
|
data.Storage = types.Int64Value(pkgResp.Data.Storage)
|
||||||
|
data.Traffic = types.Int64Value(pkgResp.Data.Traffic)
|
||||||
|
data.NetworkSpeedInbound = types.Int64Value(pkgResp.Data.NetworkSpeedInbound)
|
||||||
|
data.NetworkSpeedOutbound = types.Int64Value(pkgResp.Data.NetworkSpeedOutbound)
|
||||||
|
data.Ipv4 = types.Int64Value(pkgResp.Data.Ipv4)
|
||||||
|
|
||||||
|
resp.Diagnostics.Append(resp.State.Set(ctx, &data)...)
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user