Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 85ce76564f | |||
| 928481d26f | |||
| 0e64974821 | |||
| 371bb0d90f | |||
| caf7213bca | |||
| 9cf150437d | |||
| 523d96189f | |||
|
|
8ca233dd32 | ||
|
|
9bad8a6947 | ||
|
|
e3e7e7bd89 | ||
|
|
b112c5ee22 | ||
|
|
f2f31b939e | ||
|
|
c781ffafaa | ||
|
|
3715db2923 | ||
|
|
f83c8e8a9a | ||
|
|
af82decadd |
14
CHANGELOG.md
14
CHANGELOG.md
@@ -1,11 +1,5 @@
|
|||||||
### Version 3.4.3
|
## Version 4.2.2
|
||||||
|
|
||||||
### Features
|
## Bug Fixes
|
||||||
|
- Fixed inability of decort_lb_backend_server resource deletion;
|
||||||
- Change field type disksize from int to float in:
|
- Fixed possible panic when adding NAT rules to decort_vins resource;
|
||||||
- resource decort_resgroup
|
|
||||||
- resource decort_account
|
|
||||||
- data source decort_rg
|
|
||||||
- data source decort_account
|
|
||||||
- data source decort_account_rg_list
|
|
||||||
- Models of the resources
|
|
||||||
|
|||||||
56
Makefile
56
Makefile
@@ -2,15 +2,32 @@ TEST?=$$(go list ./... | grep -v 'vendor')
|
|||||||
HOSTNAME=digitalenergy.online
|
HOSTNAME=digitalenergy.online
|
||||||
NAMESPACE=decort
|
NAMESPACE=decort
|
||||||
NAME=terraform-provider-decort
|
NAME=terraform-provider-decort
|
||||||
|
BINDIR = ./bin
|
||||||
|
ZIPDIR = ./zip
|
||||||
#BINARY=terraform-provider-${NAME}
|
#BINARY=terraform-provider-${NAME}
|
||||||
BINARY=${NAME}.exe
|
BINARY=${NAME}.exe
|
||||||
WORKPATH= ./examples/terraform.d/plugins/${HOSTNAME}/${NAMESPACE}/${NAMESPACE}/${VERSION}/${OS_ARCH}
|
WORKPATH= ./examples/terraform.d/plugins/${HOSTNAME}/${NAMESPACE}/${NAMESPACE}/${VERSION}/${OS_ARCH}
|
||||||
MAINPATH = ./cmd/decort/
|
MAINPATH = ./cmd/decort/
|
||||||
VERSION=1.1
|
VERSION=4.2.2
|
||||||
#OS_ARCH=darwin_amd64
|
#OS_ARCH=darwin_amd64
|
||||||
OS_ARCH=windows_amd64
|
OS_ARCH=windows_amd64
|
||||||
#OS_ARCH=linux_amd64
|
#OS_ARCH=linux_amd64
|
||||||
|
|
||||||
|
FILES= ${BINARY}_${VERSION}_darwin_amd64\
|
||||||
|
${BINARY}_${VERSION}_freebsd_386\
|
||||||
|
${BINARY}_${VERSION}_freebsd_amd64\
|
||||||
|
${BINARY}_${VERSION}_freebsd_arm\
|
||||||
|
${BINARY}_${VERSION}_linux_386\
|
||||||
|
${BINARY}_${VERSION}_linux_amd64\
|
||||||
|
${BINARY}_${VERSION}_linux_arm\
|
||||||
|
${BINARY}_${VERSION}_openbsd_386\
|
||||||
|
${BINARY}_${VERSION}_openbsd_amd64\
|
||||||
|
${BINARY}_${VERSION}_solaris_amd64\
|
||||||
|
${BINARY}_${VERSION}_windows_386 \
|
||||||
|
${BINARY}_${VERSION}_windows_amd64\
|
||||||
|
|
||||||
|
BINS = $(addprefix bin/, $(FILES))
|
||||||
|
|
||||||
default: install
|
default: install
|
||||||
|
|
||||||
image:
|
image:
|
||||||
@@ -29,19 +46,30 @@ st:
|
|||||||
build:
|
build:
|
||||||
go build -o ${BINARY} ${MAINPATH}
|
go build -o ${BINARY} ${MAINPATH}
|
||||||
|
|
||||||
release:
|
release: $(FILES)
|
||||||
GOOS=darwin GOARCH=amd64 go build -o ./bin/${BINARY}_${VERSION}_darwin_amd64
|
|
||||||
GOOS=freebsd GOARCH=386 go build -o ./bin/${BINARY}_${VERSION}_freebsd_386
|
$(FILES) : $(BINDIR) $(ZIPDIR) $(BINS)
|
||||||
GOOS=freebsd GOARCH=amd64 go build -o ./bin/${BINARY}_${VERSION}_freebsd_amd64
|
zip -r $(ZIPDIR)/$@.zip $(BINDIR)/$@
|
||||||
GOOS=freebsd GOARCH=arm go build -o ./bin/${BINARY}_${VERSION}_freebsd_arm
|
|
||||||
GOOS=linux GOARCH=386 go build -o ./bin/${BINARY}_${VERSION}_linux_386
|
$(BINDIR):
|
||||||
GOOS=linux GOARCH=amd64 go build -o ./bin/${BINARY}_${VERSION}_linux_amd64
|
mkdir $@
|
||||||
GOOS=linux GOARCH=arm go build -o ./bin/${BINARY}_${VERSION}_linux_arm
|
|
||||||
GOOS=openbsd GOARCH=386 go build -o ./bin/${BINARY}_${VERSION}_openbsd_386
|
$(ZIPDIR):
|
||||||
GOOS=openbsd GOARCH=amd64 go build -o ./bin/${BINARY}_${VERSION}_openbsd_amd64
|
mkdir $@
|
||||||
GOOS=solaris GOARCH=amd64 go build -o ./bin/${BINARY}_${VERSION}_solaris_amd64
|
|
||||||
GOOS=windows GOARCH=386 go build -o ./bin/${BINARY}_${VERSION}_windows_386
|
$(BINS):
|
||||||
GOOS=windows GOARCH=amd64 go build -o ./bin/${BINARY}_${VERSION}_windows_amd64
|
GOOS=darwin GOARCH=amd64 go build -o ./bin/${BINARY}_${VERSION}_darwin_amd64 $(MAINPATH)
|
||||||
|
GOOS=freebsd GOARCH=386 go build -o ./bin/${BINARY}_${VERSION}_freebsd_386 $(MAINPATH)
|
||||||
|
GOOS=freebsd GOARCH=amd64 go build -o ./bin/${BINARY}_${VERSION}_freebsd_amd64 $(MAINPATH)
|
||||||
|
GOOS=freebsd GOARCH=arm go build -o ./bin/${BINARY}_${VERSION}_freebsd_arm $(MAINPATH)
|
||||||
|
GOOS=linux GOARCH=386 go build -o ./bin/${BINARY}_${VERSION}_linux_386 $(MAINPATH)
|
||||||
|
GOOS=linux GOARCH=amd64 go build -o ./bin/${BINARY}_${VERSION}_linux_amd64 $(MAINPATH)
|
||||||
|
GOOS=linux GOARCH=arm go build -o ./bin/${BINARY}_${VERSION}_linux_arm $(MAINPATH)
|
||||||
|
GOOS=openbsd GOARCH=386 go build -o ./bin/${BINARY}_${VERSION}_openbsd_386 $(MAINPATH)
|
||||||
|
GOOS=openbsd GOARCH=amd64 go build -o ./bin/${BINARY}_${VERSION}_openbsd_amd64 $(MAINPATH)
|
||||||
|
GOOS=solaris GOARCH=amd64 go build -o ./bin/${BINARY}_${VERSION}_solaris_amd64 $(MAINPATH)
|
||||||
|
GOOS=windows GOARCH=386 go build -o ./bin/${BINARY}_${VERSION}_windows_386 $(MAINPATH)
|
||||||
|
GOOS=windows GOARCH=amd64 go build -o ./bin/${BINARY}_${VERSION}_windows_amd64 $(MAINPATH)
|
||||||
|
|
||||||
install: build
|
install: build
|
||||||
mkdir -p ~/.terraform.d/plugins/${HOSTNAME}/${NAMESPACE}/${NAME}/${VERSION}/${OS_ARCH}
|
mkdir -p ~/.terraform.d/plugins/${HOSTNAME}/${NAMESPACE}/${NAME}/${VERSION}/${OS_ARCH}
|
||||||
|
|||||||
13
README.md
13
README.md
@@ -6,6 +6,7 @@ Terraform provider для платформы Digital Energy Cloud Orchestration
|
|||||||
|
|
||||||
| Версия DECORT API | Версия провайдера Terraform |
|
| Версия DECORT API | Версия провайдера Terraform |
|
||||||
| ------ | ------ |
|
| ------ | ------ |
|
||||||
|
| 3.8.6 | 4.x.x |
|
||||||
| 3.8.5 | 3.4.x |
|
| 3.8.5 | 3.4.x |
|
||||||
| 3.8.0 - 3.8.4 | 3.3.1 |
|
| 3.8.0 - 3.8.4 | 3.3.1 |
|
||||||
| 3.7.x | rc-1.25 |
|
| 3.7.x | rc-1.25 |
|
||||||
@@ -17,9 +18,9 @@ Terraform provider для платформы Digital Energy Cloud Orchestration
|
|||||||
Провайдер позволяет работать в двух режимах:
|
Провайдер позволяет работать в двух режимах:
|
||||||
|
|
||||||
- Режим пользователя,
|
- Режим пользователя,
|
||||||
- Режим администратора.
|
- Режим администратора. <br>
|
||||||
Для переключения между режимами используйте флаг DECORT_ADMIN_MODE.
|
Используйте ресурсы `decort_cb_` для администрирования. <br>
|
||||||
Вики проекта: https://github.com/rudecs/terraform-provider-decort/wiki
|
Вики проекта: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
|
|
||||||
## Возможности провайдера
|
## Возможности провайдера
|
||||||
|
|
||||||
@@ -40,7 +41,7 @@ Terraform provider для платформы Digital Energy Cloud Orchestration
|
|||||||
- Работа с locations,
|
- Работа с locations,
|
||||||
- Работа с load balancer.
|
- Работа с load balancer.
|
||||||
|
|
||||||
Вики проекта: https://github.com/rudecs/terraform-provider-decort/wiki
|
Вики проекта: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
|
|
||||||
## Начало
|
## Начало
|
||||||
|
|
||||||
@@ -80,7 +81,7 @@ terraform init
|
|||||||
3. Склонируйте репозиторий с провайдером, выполнив команду:
|
3. Склонируйте репозиторий с провайдером, выполнив команду:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git clone https://github.com/rudecs/terraform-provider-decort.git
|
git clone https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
```
|
```
|
||||||
|
|
||||||
4. Перейдите в скачанную папку с провайдером и выполните команду
|
4. Перейдите в скачанную папку с провайдером и выполните команду
|
||||||
@@ -158,7 +159,7 @@ terraform init
|
|||||||
|
|
||||||
Примеры работы можно найти:
|
Примеры работы можно найти:
|
||||||
|
|
||||||
- На вики проекта: https://github.com/rudecs/terraform-provider-decort/wiki
|
- На вики проекта: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
- В папке `samples`
|
- В папке `samples`
|
||||||
|
|
||||||
Схемы к terraform'у доступны:
|
Схемы к terraform'у доступны:
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ The provider support two working modes:
|
|||||||
- User mode,
|
- User mode,
|
||||||
- Administator mode.
|
- Administator mode.
|
||||||
Use flag DECORT_ADMIN_MODE for swithcing beetwen modes.
|
Use flag DECORT_ADMIN_MODE for swithcing beetwen modes.
|
||||||
See user guide at https://github.com/rudecs/terraform-provider-decort/wiki
|
See user guide at https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@ The provider support two working modes:
|
|||||||
|
|
||||||
This provider supports Import operations on pre-existing resources.
|
This provider supports Import operations on pre-existing resources.
|
||||||
|
|
||||||
See user guide at https://github.com/rudecs/terraform-provider-decort/wiki
|
See user guide at https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
|
|
||||||
## Get Started
|
## Get Started
|
||||||
|
|
||||||
@@ -158,7 +158,7 @@ More details about the provider's building process: https://learn.hashicorp.com/
|
|||||||
|
|
||||||
## Examples and Samples
|
## Examples and Samples
|
||||||
|
|
||||||
- Examples: https://github.com/rudecs/terraform-provider-decort/wiki
|
- Examples: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
- Samples: see in repository `samples`
|
- Samples: see in repository `samples`
|
||||||
|
|
||||||
Terraform schemas in:
|
Terraform schemas in:
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@@ -21,12 +22,12 @@ limitations under the License.
|
|||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package main
|
package main
|
||||||
@@ -37,7 +38,7 @@ import (
|
|||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/plugin"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/plugin"
|
||||||
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/provider"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/provider"
|
||||||
)
|
)
|
||||||
|
|
||||||
//go:generate go run github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs
|
//go:generate go run github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs
|
||||||
|
|||||||
17
go.mod
17
go.mod
@@ -1,4 +1,4 @@
|
|||||||
module github.com/rudecs/terraform-provider-decort
|
module repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
go 1.18
|
go 1.18
|
||||||
|
|
||||||
@@ -8,7 +8,8 @@ require (
|
|||||||
github.com/hashicorp/terraform-plugin-docs v0.13.0
|
github.com/hashicorp/terraform-plugin-docs v0.13.0
|
||||||
github.com/hashicorp/terraform-plugin-sdk/v2 v2.24.1
|
github.com/hashicorp/terraform-plugin-sdk/v2 v2.24.1
|
||||||
github.com/sirupsen/logrus v1.9.0
|
github.com/sirupsen/logrus v1.9.0
|
||||||
golang.org/x/net v0.4.0
|
golang.org/x/net v0.5.0
|
||||||
|
repository.basistech.ru/BASIS/decort-golang-sdk v1.4.6
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
@@ -20,8 +21,12 @@ require (
|
|||||||
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/fatih/color v1.13.0 // indirect
|
github.com/fatih/color v1.13.0 // indirect
|
||||||
|
github.com/go-playground/locales v0.14.1 // indirect
|
||||||
|
github.com/go-playground/universal-translator v0.18.1 // indirect
|
||||||
|
github.com/go-playground/validator/v10 v10.11.2 // indirect
|
||||||
github.com/golang/protobuf v1.5.2 // indirect
|
github.com/golang/protobuf v1.5.2 // indirect
|
||||||
github.com/google/go-cmp v0.5.9 // indirect
|
github.com/google/go-cmp v0.5.9 // indirect
|
||||||
|
github.com/google/go-querystring v1.1.0 // 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
|
||||||
@@ -43,6 +48,7 @@ require (
|
|||||||
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.4.0 // indirect
|
||||||
github.com/imdario/mergo v0.3.13 // indirect
|
github.com/imdario/mergo v0.3.13 // indirect
|
||||||
|
github.com/leodido/go-urn v1.2.1 // 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.16 // indirect
|
github.com/mattn/go-isatty v0.0.16 // indirect
|
||||||
github.com/mitchellh/cli v1.1.5 // indirect
|
github.com/mitchellh/cli v1.1.5 // indirect
|
||||||
@@ -60,11 +66,12 @@ require (
|
|||||||
github.com/vmihailenco/msgpack/v4 v4.3.12 // indirect
|
github.com/vmihailenco/msgpack/v4 v4.3.12 // indirect
|
||||||
github.com/vmihailenco/tagparser v0.1.2 // indirect
|
github.com/vmihailenco/tagparser v0.1.2 // indirect
|
||||||
github.com/zclconf/go-cty v1.12.1 // indirect
|
github.com/zclconf/go-cty v1.12.1 // indirect
|
||||||
golang.org/x/crypto v0.4.0 // indirect
|
golang.org/x/crypto v0.5.0 // indirect
|
||||||
golang.org/x/sys v0.3.0 // indirect
|
golang.org/x/sys v0.4.0 // indirect
|
||||||
golang.org/x/text v0.5.0 // indirect
|
golang.org/x/text v0.6.0 // indirect
|
||||||
google.golang.org/appengine v1.6.7 // indirect
|
google.golang.org/appengine v1.6.7 // indirect
|
||||||
google.golang.org/genproto v0.0.0-20221207170731-23e4bf6bdc37 // indirect
|
google.golang.org/genproto v0.0.0-20221207170731-23e4bf6bdc37 // indirect
|
||||||
google.golang.org/grpc v1.51.0 // indirect
|
google.golang.org/grpc v1.51.0 // indirect
|
||||||
google.golang.org/protobuf v1.28.1 // indirect
|
google.golang.org/protobuf v1.28.1 // indirect
|
||||||
|
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||||
)
|
)
|
||||||
|
|||||||
172
go.sum
172
go.sum
@@ -1,17 +1,10 @@
|
|||||||
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
|
||||||
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
|
||||||
github.com/Masterminds/goutils v1.1.0/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU=
|
|
||||||
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 h1:hLg3sBzpNErnxhQtUy/mmLR2I9foDujNK030IGemrRc=
|
|
||||||
github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs=
|
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 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/sprig/v3 v3.2.0/go.mod h1:tWhwTbUTndesPNeF0C900vKoq283u6zp4APT9vaF3SI=
|
|
||||||
github.com/Masterminds/sprig/v3 v3.2.1/go.mod h1:UoaO7Yp8KlPnJIYWTFkMaqPUYKTfGFPhxNuwnnxkKlk=
|
github.com/Masterminds/sprig/v3 v3.2.1/go.mod h1:UoaO7Yp8KlPnJIYWTFkMaqPUYKTfGFPhxNuwnnxkKlk=
|
||||||
github.com/Masterminds/sprig/v3 v3.2.2 h1:17jRggJu518dr3QaafizSXOjKYp94wKfABxUmyxvxX8=
|
|
||||||
github.com/Masterminds/sprig/v3 v3.2.2/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.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA=
|
github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA=
|
||||||
@@ -21,14 +14,10 @@ github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7 h1:YoJbenK9C6
|
|||||||
github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7/go.mod h1:z4/9nQmJSSwwds7ejkxaJwO37dru3geImFUdJlaLzQo=
|
github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7/go.mod h1:z4/9nQmJSSwwds7ejkxaJwO37dru3geImFUdJlaLzQo=
|
||||||
github.com/acomagu/bufpipe v1.0.3 h1:fxAGrHZTgQ9w5QqVItgzwj235/uYZYgbXitB+dLupOk=
|
github.com/acomagu/bufpipe v1.0.3 h1:fxAGrHZTgQ9w5QqVItgzwj235/uYZYgbXitB+dLupOk=
|
||||||
github.com/acomagu/bufpipe v1.0.3/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ2sYmHc4=
|
github.com/acomagu/bufpipe v1.0.3/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ2sYmHc4=
|
||||||
github.com/agext/levenshtein v1.2.2 h1:0S/Yg6LYmFJ5stwQeRp6EeOcCbj7xiqQSdNelsXvaqE=
|
|
||||||
github.com/agext/levenshtein v1.2.2/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558=
|
|
||||||
github.com/agext/levenshtein v1.2.3 h1:YB2fHEn0UJagG8T1rrWknE3ZQzWM06O8AMAatNn7lmo=
|
github.com/agext/levenshtein v1.2.3 h1:YB2fHEn0UJagG8T1rrWknE3ZQzWM06O8AMAatNn7lmo=
|
||||||
github.com/agext/levenshtein v1.2.3/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558=
|
github.com/agext/levenshtein v1.2.3/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558=
|
||||||
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c=
|
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c=
|
||||||
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
|
|
||||||
github.com/apparentlymart/go-dump v0.0.0-20190214190832-042adf3cf4a0 h1:MzVXffFUye+ZcSR6opIgz9Co7WcDx6ZcY+RjfFHoA0I=
|
github.com/apparentlymart/go-dump v0.0.0-20190214190832-042adf3cf4a0 h1:MzVXffFUye+ZcSR6opIgz9Co7WcDx6ZcY+RjfFHoA0I=
|
||||||
github.com/apparentlymart/go-textseg v1.0.0 h1:rRmlIsPEEhUTIKQb7T++Nz/A5Q6C9IuX2wFoYVvnCs0=
|
|
||||||
github.com/apparentlymart/go-textseg v1.0.0/go.mod h1:z96Txxhf3xSFMPmb5X/1W05FF/Nj9VFpLOpjS5yuumk=
|
github.com/apparentlymart/go-textseg v1.0.0/go.mod h1:z96Txxhf3xSFMPmb5X/1W05FF/Nj9VFpLOpjS5yuumk=
|
||||||
github.com/apparentlymart/go-textseg/v12 v12.0.0/go.mod h1:S/4uRK2UtaQttw1GenVJEynmyUenKwP++x/+DdGV/Ec=
|
github.com/apparentlymart/go-textseg/v12 v12.0.0/go.mod h1:S/4uRK2UtaQttw1GenVJEynmyUenKwP++x/+DdGV/Ec=
|
||||||
github.com/apparentlymart/go-textseg/v13 v13.0.0 h1:Y+KvPE1NYz0xl601PVImeQfFyEy6iT90AvPUL1NNfNw=
|
github.com/apparentlymart/go-textseg/v13 v13.0.0 h1:Y+KvPE1NYz0xl601PVImeQfFyEy6iT90AvPUL1NNfNw=
|
||||||
@@ -39,33 +28,17 @@ github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgI
|
|||||||
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
|
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
|
||||||
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/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
|
||||||
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
|
||||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
|
||||||
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
|
|
||||||
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
|
|
||||||
github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI=
|
|
||||||
github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
|
|
||||||
github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
|
|
||||||
github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
|
|
||||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||||
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=
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
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.12.0 h1:QAUIPSaCu4G+POclxeqb3F+WPpdKqFGlw36+yOzGlrg=
|
github.com/emirpasic/gods v1.12.0 h1:QAUIPSaCu4G+POclxeqb3F+WPpdKqFGlw36+yOzGlrg=
|
||||||
github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o=
|
github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o=
|
||||||
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
|
||||||
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
|
||||||
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
|
|
||||||
github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
|
|
||||||
github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE=
|
|
||||||
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
|
|
||||||
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
|
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
|
||||||
github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w=
|
github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w=
|
||||||
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
|
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
|
||||||
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc=
|
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc=
|
||||||
github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE=
|
github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE=
|
||||||
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
|
|
||||||
github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0=
|
github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0=
|
||||||
github.com/go-git/gcfg v1.5.0 h1:Q5ViNfGF8zFgyJWPqYwA7qGFoMTEiBmdlkcfRmpIMa4=
|
github.com/go-git/gcfg v1.5.0 h1:Q5ViNfGF8zFgyJWPqYwA7qGFoMTEiBmdlkcfRmpIMa4=
|
||||||
github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E=
|
github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E=
|
||||||
@@ -75,46 +48,36 @@ github.com/go-git/go-billy/v5 v5.3.1/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI
|
|||||||
github.com/go-git/go-git-fixtures/v4 v4.2.1/go.mod h1:K8zd3kDUAykwTdDCr+I0per6Y6vMiRR/nnVTBtavnB0=
|
github.com/go-git/go-git-fixtures/v4 v4.2.1/go.mod h1:K8zd3kDUAykwTdDCr+I0per6Y6vMiRR/nnVTBtavnB0=
|
||||||
github.com/go-git/go-git/v5 v5.4.2 h1:BXyZu9t0VkbiHtqrsvdq39UDhGJTl1h55VW6CSC4aY4=
|
github.com/go-git/go-git/v5 v5.4.2 h1:BXyZu9t0VkbiHtqrsvdq39UDhGJTl1h55VW6CSC4aY4=
|
||||||
github.com/go-git/go-git/v5 v5.4.2/go.mod h1:gQ1kArt6d+n+BGd+/B/I74HwRTLhth2+zti4ihgckDc=
|
github.com/go-git/go-git/v5 v5.4.2/go.mod h1:gQ1kArt6d+n+BGd+/B/I74HwRTLhth2+zti4ihgckDc=
|
||||||
|
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
|
||||||
|
github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
|
||||||
|
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
|
||||||
|
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
|
||||||
|
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
|
||||||
|
github.com/go-playground/validator/v10 v10.11.2 h1:q3SHpufmypg+erIExEKUmsgmhDTyhcJ38oeKGACXohU=
|
||||||
|
github.com/go-playground/validator/v10 v10.11.2/go.mod h1:NieE624vt4SCTJtD87arVLvdmjPAeV8BQlHtMnw9D7s=
|
||||||
github.com/go-test/deep v1.0.3 h1:ZrJSEWsXzPOxaZnFteGEfooLba+ju3FYIbOrS+rQd68=
|
github.com/go-test/deep v1.0.3 h1:ZrJSEWsXzPOxaZnFteGEfooLba+ju3FYIbOrS+rQd68=
|
||||||
github.com/golang-jwt/jwt/v4 v4.4.2 h1:rcc4lwaZgFMCZ5jxF9ABolDcIHdBytAFgqFPbSJQAYs=
|
|
||||||
github.com/golang-jwt/jwt/v4 v4.4.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
|
|
||||||
github.com/golang-jwt/jwt/v4 v4.4.3 h1:Hxl6lhQFj4AnOX6MLrsCb/+7tCj7DxP7VA+2rDIq5AU=
|
github.com/golang-jwt/jwt/v4 v4.4.3 h1:Hxl6lhQFj4AnOX6MLrsCb/+7tCj7DxP7VA+2rDIq5AU=
|
||||||
github.com/golang-jwt/jwt/v4 v4.4.3/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
|
github.com/golang-jwt/jwt/v4 v4.4.3/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
|
||||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
|
||||||
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
|
||||||
github.com/golang/protobuf v1.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
github.com/golang/protobuf v1.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||||
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||||
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
|
||||||
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
|
|
||||||
github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
|
github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
|
||||||
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
|
|
||||||
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
|
|
||||||
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
|
|
||||||
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
|
|
||||||
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
|
|
||||||
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
|
|
||||||
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
|
||||||
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
|
||||||
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
|
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
|
||||||
github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=
|
github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=
|
||||||
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
|
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
|
||||||
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
|
||||||
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||||
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||||
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||||
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
|
||||||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||||
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
|
||||||
github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg=
|
|
||||||
github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||||
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
|
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
|
||||||
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||||
|
github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=
|
||||||
|
github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU=
|
||||||
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.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
|
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
|
||||||
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
|
|
||||||
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=
|
||||||
@@ -126,15 +89,11 @@ github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9n
|
|||||||
github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48=
|
github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48=
|
||||||
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 h1:1/D3zfFHttUKaCaGKZ/dR2roBXv0vKbSCnssIldfQdI=
|
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 h1:1/D3zfFHttUKaCaGKZ/dR2roBXv0vKbSCnssIldfQdI=
|
||||||
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320/go.mod h1:EiZBMaudVLy8fmjf9Npq1dq9RalhveqZG5w/yz3mHWs=
|
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320/go.mod h1:EiZBMaudVLy8fmjf9Npq1dq9RalhveqZG5w/yz3mHWs=
|
||||||
github.com/hashicorp/go-hclog v1.2.1 h1:YQsLlGDJgwhXFpucSPyVbCBviQtjlHv3jLTlp8YmtEw=
|
|
||||||
github.com/hashicorp/go-hclog v1.2.1/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M=
|
|
||||||
github.com/hashicorp/go-hclog v1.4.0 h1:ctuWFGrhFha8BnnzxqeRGidlEcQkDyL5u8J8t5eA11I=
|
github.com/hashicorp/go-hclog v1.4.0 h1:ctuWFGrhFha8BnnzxqeRGidlEcQkDyL5u8J8t5eA11I=
|
||||||
github.com/hashicorp/go-hclog v1.4.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M=
|
github.com/hashicorp/go-hclog v1.4.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M=
|
||||||
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.4.4 h1:NVdrSdFRt3SkZtNckJ6tog7gbpRrcbOjQi/rgF7JYWQ=
|
|
||||||
github.com/hashicorp/go-plugin v1.4.4/go.mod h1:viDMjcLJuDui6pXb8U4HVfb8AamCWhHGUjr2IrTF67s=
|
|
||||||
github.com/hashicorp/go-plugin v1.4.8 h1:CHGwpxYDOttQOY7HOWgETU9dyVjOXzniXDqJcYJE1zM=
|
github.com/hashicorp/go-plugin v1.4.8 h1:CHGwpxYDOttQOY7HOWgETU9dyVjOXzniXDqJcYJE1zM=
|
||||||
github.com/hashicorp/go-plugin v1.4.8/go.mod h1:viDMjcLJuDui6pXb8U4HVfb8AamCWhHGUjr2IrTF67s=
|
github.com/hashicorp/go-plugin v1.4.8/go.mod h1:viDMjcLJuDui6pXb8U4HVfb8AamCWhHGUjr2IrTF67s=
|
||||||
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=
|
||||||
@@ -146,44 +105,29 @@ github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mO
|
|||||||
github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
|
github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
|
||||||
github.com/hashicorp/hc-install v0.4.0 h1:cZkRFr1WVa0Ty6x5fTvL1TuO1flul231rWkGH92oYYk=
|
github.com/hashicorp/hc-install v0.4.0 h1:cZkRFr1WVa0Ty6x5fTvL1TuO1flul231rWkGH92oYYk=
|
||||||
github.com/hashicorp/hc-install v0.4.0/go.mod h1:5d155H8EC5ewegao9A4PUTMNPZaq+TbOzkJJZ4vrXeI=
|
github.com/hashicorp/hc-install v0.4.0/go.mod h1:5d155H8EC5ewegao9A4PUTMNPZaq+TbOzkJJZ4vrXeI=
|
||||||
github.com/hashicorp/hcl/v2 v2.13.0 h1:0Apadu1w6M11dyGFxWnmhhcMjkbAiKCv7G1r/2QgCNc=
|
|
||||||
github.com/hashicorp/hcl/v2 v2.13.0/go.mod h1:e4z5nxYlWNPdDSNYX+ph14EvWYMFm3eP0zIUqPc2jr0=
|
|
||||||
github.com/hashicorp/hcl/v2 v2.15.0 h1:CPDXO6+uORPjKflkWCCwoWc9uRp+zSIPcCQ+BrxV7m8=
|
github.com/hashicorp/hcl/v2 v2.15.0 h1:CPDXO6+uORPjKflkWCCwoWc9uRp+zSIPcCQ+BrxV7m8=
|
||||||
github.com/hashicorp/hcl/v2 v2.15.0/go.mod h1:JRmR89jycNkrrqnMmvPDMd56n1rQJ2Q6KocSLCMCXng=
|
github.com/hashicorp/hcl/v2 v2.15.0/go.mod h1:JRmR89jycNkrrqnMmvPDMd56n1rQJ2Q6KocSLCMCXng=
|
||||||
github.com/hashicorp/logutils v1.0.0 h1:dLEQVugN8vlakKOUE3ihGLTZJRB4j+M2cdTm/ORI65Y=
|
github.com/hashicorp/logutils v1.0.0 h1:dLEQVugN8vlakKOUE3ihGLTZJRB4j+M2cdTm/ORI65Y=
|
||||||
github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64=
|
github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64=
|
||||||
github.com/hashicorp/terraform-exec v0.17.2 h1:EU7i3Fh7vDUI9nNRdMATCEfnm9axzTnad8zszYZ73Go=
|
|
||||||
github.com/hashicorp/terraform-exec v0.17.2/go.mod h1:tuIbsL2l4MlwwIZx9HPM+LOV9vVyEfBYu2GsO1uH3/8=
|
|
||||||
github.com/hashicorp/terraform-exec v0.17.3 h1:MX14Kvnka/oWGmIkyuyvL6POx25ZmKrjlaclkx3eErU=
|
github.com/hashicorp/terraform-exec v0.17.3 h1:MX14Kvnka/oWGmIkyuyvL6POx25ZmKrjlaclkx3eErU=
|
||||||
github.com/hashicorp/terraform-exec v0.17.3/go.mod h1:+NELG0EqQekJzhvikkeQsOAZpsw0cv/03rbeQJqscAI=
|
github.com/hashicorp/terraform-exec v0.17.3/go.mod h1:+NELG0EqQekJzhvikkeQsOAZpsw0cv/03rbeQJqscAI=
|
||||||
github.com/hashicorp/terraform-json v0.14.0 h1:sh9iZ1Y8IFJLx+xQiKHGud6/TSUCM0N8e17dKDpqV7s=
|
github.com/hashicorp/terraform-json v0.14.0 h1:sh9iZ1Y8IFJLx+xQiKHGud6/TSUCM0N8e17dKDpqV7s=
|
||||||
github.com/hashicorp/terraform-json v0.14.0/go.mod h1:5A9HIWPkk4e5aeeXIBbkcOvaZbIYnAIkEyqP2pNSckM=
|
github.com/hashicorp/terraform-json v0.14.0/go.mod h1:5A9HIWPkk4e5aeeXIBbkcOvaZbIYnAIkEyqP2pNSckM=
|
||||||
github.com/hashicorp/terraform-plugin-docs v0.13.0 h1:6e+VIWsVGb6jYJewfzq2ok2smPzZrt1Wlm9koLeKazY=
|
github.com/hashicorp/terraform-plugin-docs v0.13.0 h1:6e+VIWsVGb6jYJewfzq2ok2smPzZrt1Wlm9koLeKazY=
|
||||||
github.com/hashicorp/terraform-plugin-docs v0.13.0/go.mod h1:W0oCmHAjIlTHBbvtppWHe8fLfZ2BznQbuv8+UD8OucQ=
|
github.com/hashicorp/terraform-plugin-docs v0.13.0/go.mod h1:W0oCmHAjIlTHBbvtppWHe8fLfZ2BznQbuv8+UD8OucQ=
|
||||||
github.com/hashicorp/terraform-plugin-go v0.12.0 h1:6wW9mT1dSs0Xq4LR6HXj1heQ5ovr5GxXNJwkErZzpJw=
|
|
||||||
github.com/hashicorp/terraform-plugin-go v0.12.0/go.mod h1:kwhmaWHNDvT1B3QiSJdAtrB/D4RaKSY/v3r2BuoWK4M=
|
|
||||||
github.com/hashicorp/terraform-plugin-go v0.14.2 h1:rhsVEOGCnY04msNymSvbUsXfRLKh9znXZmHlf5e8mhE=
|
github.com/hashicorp/terraform-plugin-go v0.14.2 h1:rhsVEOGCnY04msNymSvbUsXfRLKh9znXZmHlf5e8mhE=
|
||||||
github.com/hashicorp/terraform-plugin-go v0.14.2/go.mod h1:Q12UjumPNGiFsZffxOsA40Tlz1WVXt2Evh865Zj0+UA=
|
github.com/hashicorp/terraform-plugin-go v0.14.2/go.mod h1:Q12UjumPNGiFsZffxOsA40Tlz1WVXt2Evh865Zj0+UA=
|
||||||
github.com/hashicorp/terraform-plugin-log v0.6.0 h1:/Vq78uSIdUSZ3iqDc9PESKtwt8YqNKN6u+khD+lLjuw=
|
|
||||||
github.com/hashicorp/terraform-plugin-log v0.6.0/go.mod h1:p4R1jWBXRTvL4odmEkFfDdhUjHf9zcs/BCoNHAc7IK4=
|
|
||||||
github.com/hashicorp/terraform-plugin-log v0.7.0 h1:SDxJUyT8TwN4l5b5/VkiTIaQgY6R+Y2BQ0sRZftGKQs=
|
github.com/hashicorp/terraform-plugin-log v0.7.0 h1:SDxJUyT8TwN4l5b5/VkiTIaQgY6R+Y2BQ0sRZftGKQs=
|
||||||
github.com/hashicorp/terraform-plugin-log v0.7.0/go.mod h1:p4R1jWBXRTvL4odmEkFfDdhUjHf9zcs/BCoNHAc7IK4=
|
github.com/hashicorp/terraform-plugin-log v0.7.0/go.mod h1:p4R1jWBXRTvL4odmEkFfDdhUjHf9zcs/BCoNHAc7IK4=
|
||||||
github.com/hashicorp/terraform-plugin-sdk/v2 v2.19.0 h1:7gDAcfto/C4Cjtf90SdukQshsxdMxJ/P69QxiF3digI=
|
|
||||||
github.com/hashicorp/terraform-plugin-sdk/v2 v2.19.0/go.mod h1:/WYikYjhKB7c2j1HmXZhRsAARldRb4M38bLCLOhC3so=
|
|
||||||
github.com/hashicorp/terraform-plugin-sdk/v2 v2.24.1 h1:zHcMbxY0+rFO9gY99elV/XC/UnQVg7FhRCbj1i5b7vM=
|
github.com/hashicorp/terraform-plugin-sdk/v2 v2.24.1 h1:zHcMbxY0+rFO9gY99elV/XC/UnQVg7FhRCbj1i5b7vM=
|
||||||
github.com/hashicorp/terraform-plugin-sdk/v2 v2.24.1/go.mod h1:+tNlb0wkfdsDJ7JEiERLz4HzM19HyiuIoGzTsM7rPpw=
|
github.com/hashicorp/terraform-plugin-sdk/v2 v2.24.1/go.mod h1:+tNlb0wkfdsDJ7JEiERLz4HzM19HyiuIoGzTsM7rPpw=
|
||||||
github.com/hashicorp/terraform-registry-address v0.0.0-20220623143253-7d51757b572c h1:D8aRO6+mTqHfLsK/BC3j5OAoogv1WLRWzY1AaTo3rBg=
|
|
||||||
github.com/hashicorp/terraform-registry-address v0.0.0-20220623143253-7d51757b572c/go.mod h1:Wn3Na71knbXc1G8Lh+yu/dQWWJeFQEpDeJMtWMtlmNI=
|
|
||||||
github.com/hashicorp/terraform-registry-address v0.1.0 h1:W6JkV9wbum+m516rCl5/NjKxCyTVaaUBbzYcMzBDO3U=
|
github.com/hashicorp/terraform-registry-address v0.1.0 h1:W6JkV9wbum+m516rCl5/NjKxCyTVaaUBbzYcMzBDO3U=
|
||||||
github.com/hashicorp/terraform-registry-address v0.1.0/go.mod h1:EnyO2jYO6j29DTHbJcm00E5nQTFeTtyZH3H5ycydQ5A=
|
github.com/hashicorp/terraform-registry-address v0.1.0/go.mod h1:EnyO2jYO6j29DTHbJcm00E5nQTFeTtyZH3H5ycydQ5A=
|
||||||
github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734 h1:HKLsbzeOsfXmKNpr3GiT18XAblV0BjCbzL8KQAMZGa0=
|
github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734 h1:HKLsbzeOsfXmKNpr3GiT18XAblV0BjCbzL8KQAMZGa0=
|
||||||
github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734/go.mod h1:kNDNcF7sN4DocDLBkQYz73HGKwN1ANB1blq4lIYLYvg=
|
github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734/go.mod h1:kNDNcF7sN4DocDLBkQYz73HGKwN1ANB1blq4lIYLYvg=
|
||||||
github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d h1:kJCB4vdITiW1eC1vq2e6IsrXKrZit1bv/TDYFGMp4BQ=
|
|
||||||
github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM=
|
|
||||||
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.1/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
|
||||||
github.com/huandu/xstrings v1.3.2 h1:L18LIDzqlW6xN2rEkpdV8+oL/IXWJ1APd+vsdYy4Wdw=
|
|
||||||
github.com/huandu/xstrings v1.3.2/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
|
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 h1:D17IlohoQq4UcpqD7fDk80P7l+lwAmlFaBHgOipl2FU=
|
||||||
@@ -208,21 +152,19 @@ 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/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k=
|
github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k=
|
||||||
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
|
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
|
||||||
|
github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w=
|
||||||
|
github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY=
|
||||||
github.com/matryer/is v1.2.0/go.mod h1:2fLPjFQM9rhQ15aVEtbuwhJinnOqrmgXPNdZsdwlWXA=
|
github.com/matryer/is v1.2.0/go.mod h1:2fLPjFQM9rhQ15aVEtbuwhJinnOqrmgXPNdZsdwlWXA=
|
||||||
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
|
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 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40=
|
|
||||||
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.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 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y=
|
|
||||||
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 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ=
|
github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ=
|
||||||
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/mitchellh/cli v1.1.4 h1:qj8czE26AU4PbiaPXK5uVmMSM+V5BYsFBiM9HhGRLUA=
|
|
||||||
github.com/mitchellh/cli v1.1.4/go.mod h1:vTLESy5mRhKOs9KDp0/RATawxP1UqBmdrpVRMnpcvKQ=
|
|
||||||
github.com/mitchellh/cli v1.1.5 h1:OxRIeJXpAMztws/XHlN2vu6imG5Dpq+j61AzAX5fLng=
|
github.com/mitchellh/cli v1.1.5 h1:OxRIeJXpAMztws/XHlN2vu6imG5Dpq+j61AzAX5fLng=
|
||||||
github.com/mitchellh/cli v1.1.5/go.mod h1:v8+iFts2sPIKUV1ltktPXMCC8fumSKFItNcD2cLtRR4=
|
github.com/mitchellh/cli v1.1.5/go.mod h1:v8+iFts2sPIKUV1ltktPXMCC8fumSKFItNcD2cLtRR4=
|
||||||
github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw=
|
github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw=
|
||||||
@@ -232,8 +174,6 @@ github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG
|
|||||||
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
|
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
|
||||||
github.com/mitchellh/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJJ2JqpQmpLJOu07cU=
|
github.com/mitchellh/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJJ2JqpQmpLJOu07cU=
|
||||||
github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp04twqAjfvlZyCfX3sDjEym8=
|
github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp04twqAjfvlZyCfX3sDjEym8=
|
||||||
github.com/mitchellh/go-wordwrap v1.0.0 h1:6GlHJ/LTGMrIJbwgdqdl2eEH8o+Exx/0m8ir9Gns0u4=
|
|
||||||
github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo=
|
|
||||||
github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQflz0v0=
|
github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQflz0v0=
|
||||||
github.com/mitchellh/go-wordwrap v1.0.1/go.mod h1:R62XHJLzvMFRBbcrT7m7WgmE1eOyTSsCt+hzestvNj0=
|
github.com/mitchellh/go-wordwrap v1.0.1/go.mod h1:R62XHJLzvMFRBbcrT7m7WgmE1eOyTSsCt+hzestvNj0=
|
||||||
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
|
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
|
||||||
@@ -242,9 +182,6 @@ github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx
|
|||||||
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/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
|
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
|
||||||
github.com/nsf/jsondiff v0.0.0-20200515183724-f29ed568f4ce h1:RPclfga2SEJmgMmz2k+Mg7cowZ8yv4Trqw9UsJby758=
|
|
||||||
github.com/oklog/run v1.0.0 h1:Ru7dDtJNOyC66gQ5dQmaCa0qIsAUFY3sFpK1Xk8igrw=
|
|
||||||
github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA=
|
|
||||||
github.com/oklog/run v1.1.0 h1:GEenZ1cK0+q0+wsJew9qUg/DyD8k3JzYsZAi5gYi2mA=
|
github.com/oklog/run v1.1.0 h1:GEenZ1cK0+q0+wsJew9qUg/DyD8k3JzYsZAi5gYi2mA=
|
||||||
github.com/oklog/run v1.1.0/go.mod h1:sVPdnTZT1zYwAJeCMu2Th4T21pA3FPOQRfWjQlk7DVU=
|
github.com/oklog/run v1.1.0/go.mod h1:sVPdnTZT1zYwAJeCMu2Th4T21pA3FPOQRfWjQlk7DVU=
|
||||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
@@ -254,9 +191,7 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN
|
|||||||
github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=
|
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/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
github.com/rogpeppe/go-internal v1.8.0 h1:FCbCCtXNOY3UtUuHUYaghJg4y7Fd14rXifAYUAtL9R8=
|
||||||
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
|
|
||||||
github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k=
|
|
||||||
github.com/russross/blackfriday v1.6.0 h1:KqfZb0pUVN2lYqZUYRddxF4OR8ZMURnJIG5Y3VRLtww=
|
github.com/russross/blackfriday v1.6.0 h1:KqfZb0pUVN2lYqZUYRddxF4OR8ZMURnJIG5Y3VRLtww=
|
||||||
github.com/russross/blackfriday v1.6.0/go.mod h1:ti0ldHuxg49ri4ksnFxlkCfN+hvslNlmVHqNRXXJNAY=
|
github.com/russross/blackfriday v1.6.0/go.mod h1:ti0ldHuxg49ri4ksnFxlkCfN+hvslNlmVHqNRXXJNAY=
|
||||||
github.com/sebdah/goldie v1.0.0/go.mod h1:jXP4hmWywNEwZzhMuv2ccnqTSFpuq8iyQhtQdkkZBH4=
|
github.com/sebdah/goldie v1.0.0/go.mod h1:jXP4hmWywNEwZzhMuv2ccnqTSFpuq8iyQhtQdkkZBH4=
|
||||||
@@ -286,7 +221,6 @@ github.com/vmihailenco/msgpack v4.0.4+incompatible h1:dSLoQfGFAo3F6OoNhwUmLwVgaU
|
|||||||
github.com/vmihailenco/msgpack v4.0.4+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk=
|
github.com/vmihailenco/msgpack v4.0.4+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk=
|
||||||
github.com/vmihailenco/msgpack/v4 v4.3.12 h1:07s4sz9IReOgdikxLTKNbBdqDMLsjPKXwvCazn8G65U=
|
github.com/vmihailenco/msgpack/v4 v4.3.12 h1:07s4sz9IReOgdikxLTKNbBdqDMLsjPKXwvCazn8G65U=
|
||||||
github.com/vmihailenco/msgpack/v4 v4.3.12/go.mod h1:gborTTJjAo/GWTqqRjrLCn9pgNN+NXzzngzBKDPIqw4=
|
github.com/vmihailenco/msgpack/v4 v4.3.12/go.mod h1:gborTTJjAo/GWTqqRjrLCn9pgNN+NXzzngzBKDPIqw4=
|
||||||
github.com/vmihailenco/tagparser v0.1.1 h1:quXMXlA39OCbd2wAdTsGDlK9RkOk6Wuw+x37wVyIuWY=
|
|
||||||
github.com/vmihailenco/tagparser v0.1.1/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI=
|
github.com/vmihailenco/tagparser v0.1.1/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI=
|
||||||
github.com/vmihailenco/tagparser v0.1.2 h1:gnjoVuB/kljJ5wICEEOpx98oXMWPLj22G67Vbd1qPqc=
|
github.com/vmihailenco/tagparser v0.1.2 h1:gnjoVuB/kljJ5wICEEOpx98oXMWPLj22G67Vbd1qPqc=
|
||||||
github.com/vmihailenco/tagparser v0.1.2/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI=
|
github.com/vmihailenco/tagparser v0.1.2/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI=
|
||||||
@@ -295,62 +229,42 @@ github.com/xanzy/ssh-agent v0.3.0/go.mod h1:3s9xbODqPuuhK9JV1R321M/FlMZSBvE5aY6e
|
|||||||
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.1.0/go.mod h1:xnAOWiHeOqg2nWS62VtQ7pbOu17FtxJNW8RLEih+O3s=
|
github.com/zclconf/go-cty v1.1.0/go.mod h1:xnAOWiHeOqg2nWS62VtQ7pbOu17FtxJNW8RLEih+O3s=
|
||||||
github.com/zclconf/go-cty v1.2.0/go.mod h1:hOPWgoHbaTUnI5k4D2ld+GRpFJSCe6bCM7m1q/N4PQ8=
|
github.com/zclconf/go-cty v1.2.0/go.mod h1:hOPWgoHbaTUnI5k4D2ld+GRpFJSCe6bCM7m1q/N4PQ8=
|
||||||
github.com/zclconf/go-cty v1.10.0 h1:mp9ZXQeIcN8kAwuqorjH+Q+njbJKjLrvB2yIh4q7U+0=
|
|
||||||
github.com/zclconf/go-cty v1.10.0/go.mod h1:vVKLxnk3puL4qRAv72AO+W99LUD4da90g3uUAzyuvAk=
|
github.com/zclconf/go-cty v1.10.0/go.mod h1:vVKLxnk3puL4qRAv72AO+W99LUD4da90g3uUAzyuvAk=
|
||||||
github.com/zclconf/go-cty v1.12.1 h1:PcupnljUm9EIvbgSHQnHhUr3fO6oFmkOrvs2BAFNXXY=
|
github.com/zclconf/go-cty v1.12.1 h1:PcupnljUm9EIvbgSHQnHhUr3fO6oFmkOrvs2BAFNXXY=
|
||||||
github.com/zclconf/go-cty v1.12.1/go.mod h1:s9IfD1LK5ccNMSWCVFCE2rJfHiZgi7JijgeWIMfhLvA=
|
github.com/zclconf/go-cty v1.12.1/go.mod h1:s9IfD1LK5ccNMSWCVFCE2rJfHiZgi7JijgeWIMfhLvA=
|
||||||
github.com/zclconf/go-cty-debug v0.0.0-20191215020915-b22d67c1ba0b/go.mod h1:ZRKQfBXbGkpdV6QMzT3rU1kSTAnfu1dO8dPKjYprgj8=
|
github.com/zclconf/go-cty-debug v0.0.0-20191215020915-b22d67c1ba0b/go.mod h1:ZRKQfBXbGkpdV6QMzT3rU1kSTAnfu1dO8dPKjYprgj8=
|
||||||
go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI=
|
|
||||||
golang.org/x/crypto v0.0.0-20190219172222-a4c6cb3142f2/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
golang.org/x/crypto v0.0.0-20190219172222-a4c6cb3142f2/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||||
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-20200414173820-0848c9571904/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
|
||||||
golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||||
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
|
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
|
||||||
golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
|
golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
|
||||||
golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/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.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||||
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d h1:sK3txAijHtOK88l68nt020reeT1ZdKLIYetKl95FzVY=
|
|
||||||
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
|
||||||
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.4.0 h1:UVQgzMY87xqpKNgb+kDsll2Igd33HszWHFLmpaRMq/8=
|
golang.org/x/crypto v0.5.0 h1:U/0M97KRkSFvyD/3FSmdP5W5swImpNgle/EHFhOsQPE=
|
||||||
golang.org/x/crypto v0.4.0/go.mod h1:3quD/ATkf6oY+rnes5c3ExXTbLc8mueNue5/DoinL80=
|
golang.org/x/crypto v0.5.0/go.mod h1:NK/OQwhpMQP3MwtdjgLlYHnH9ebylxKWv3e0fK+mkQU=
|
||||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
|
||||||
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
|
||||||
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
|
|
||||||
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
|
||||||
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/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
golang.org/x/net v0.0.0-20180811021610-c39426892332/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
golang.org/x/net v0.0.0-20180811021610-c39426892332/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
|
||||||
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
|
||||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
|
||||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||||
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
|
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
|
||||||
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-20191009170851-d66e71096ffb/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
golang.org/x/net v0.0.0-20191009170851-d66e71096ffb/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
|
||||||
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
|
||||||
golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||||
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-20210326060303-6b1517762897/go.mod h1:uSPa2vr4CLtc/ILN5odXGNXS6mhrKVzTaCXzk9m6W3k=
|
golang.org/x/net v0.0.0-20210326060303-6b1517762897/go.mod h1:uSPa2vr4CLtc/ILN5odXGNXS6mhrKVzTaCXzk9m6W3k=
|
||||||
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 h1:CIJ76btIcR3eFI5EgSo6k1qKw9KJexJuRLI9G7Hp5wE=
|
|
||||||
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
|
||||||
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.4.0 h1:Q5QPcMlvfxFTAPV0+07Xz/MpK9NTXu2VDUuy0FeMfaU=
|
golang.org/x/net v0.5.0 h1:GyT4nK/YDHSqa1c4753ouYCDajOYKTja9Xb/OHtgvSw=
|
||||||
golang.org/x/net v0.4.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE=
|
golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws=
|
||||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
|
||||||
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||||
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
|
||||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/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-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/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
|
||||||
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/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-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-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
@@ -359,10 +273,7 @@ golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7w
|
|||||||
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-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/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=
|
||||||
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20210502180810-71e4cd670f79/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20210502180810-71e4cd670f79/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
@@ -371,13 +282,12 @@ golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBc
|
|||||||
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 h1:0A+M6Uqn+Eje4kHMK80dtF3JCXC4ykBgQG4Fe06QRhQ=
|
|
||||||
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/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-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 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ=
|
golang.org/x/sys v0.4.0 h1:Zr2JFtRQNX3BCZ8YtxRE9hNJYC8J6I1MVbMg6owUp18=
|
||||||
golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
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=
|
||||||
@@ -385,61 +295,26 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
|||||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||||
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.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
|
|
||||||
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.5.0 h1:OLmvp0KP+FVG99Ct/qFiL/Fhk4zp4QQnZ7b2U+5piUM=
|
golang.org/x/text v0.6.0 h1:3XmdazWV+ubf7QgHSTWeykHOci5oeekaGJBLkrkaw4k=
|
||||||
golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||||
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-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
|
||||||
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
|
|
||||||
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
|
||||||
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
|
||||||
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/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=
|
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
|
||||||
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
||||||
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||||
google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
|
google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
|
||||||
google.golang.org/appengine v1.6.6 h1:lMO5rYAqUxkmaj76jAkRUvt5JZgFymx/+Q5Mzfivuhc=
|
|
||||||
google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
|
|
||||||
google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c=
|
google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c=
|
||||||
google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
|
google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
|
||||||
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
|
||||||
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
|
|
||||||
google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
|
||||||
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
|
|
||||||
google.golang.org/genproto v0.0.0-20200711021454-869866162049 h1:YFTFpQhgvrLrmxtiIncJxFXeCyq84ixuKWVCaCAi9Oc=
|
|
||||||
google.golang.org/genproto v0.0.0-20200711021454-869866162049/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
|
||||||
google.golang.org/genproto v0.0.0-20221207170731-23e4bf6bdc37 h1:jmIfw8+gSvXcZSgaFAGyInDXeWzUhvYH57G/5GKMn70=
|
google.golang.org/genproto v0.0.0-20221207170731-23e4bf6bdc37 h1:jmIfw8+gSvXcZSgaFAGyInDXeWzUhvYH57G/5GKMn70=
|
||||||
google.golang.org/genproto v0.0.0-20221207170731-23e4bf6bdc37/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM=
|
google.golang.org/genproto v0.0.0-20221207170731-23e4bf6bdc37/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM=
|
||||||
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
|
||||||
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
|
|
||||||
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
|
|
||||||
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
|
||||||
google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0=
|
|
||||||
google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
|
|
||||||
google.golang.org/grpc v1.48.0 h1:rQOsyJ/8+ufEDJd/Gdsz7HG220Mh9HAhFHRGnIjda0w=
|
|
||||||
google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk=
|
|
||||||
google.golang.org/grpc v1.51.0 h1:E1eGv1FTqoLIdnBCZufiSHgKjlqG6fKFf6pPWtMTh8U=
|
google.golang.org/grpc v1.51.0 h1:E1eGv1FTqoLIdnBCZufiSHgKjlqG6fKFf6pPWtMTh8U=
|
||||||
google.golang.org/grpc v1.51.0/go.mod h1:wgNDFcnuBGmxLKI/qn4T+m5BtEBYXJPvibbUPsAIPww=
|
google.golang.org/grpc v1.51.0/go.mod h1:wgNDFcnuBGmxLKI/qn4T+m5BtEBYXJPvibbUPsAIPww=
|
||||||
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
|
||||||
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
|
|
||||||
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
|
|
||||||
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
|
|
||||||
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
|
|
||||||
google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
|
||||||
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
|
||||||
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
|
||||||
google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4=
|
|
||||||
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
|
|
||||||
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
||||||
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||||
google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
|
||||||
google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw=
|
|
||||||
google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
|
||||||
google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w=
|
google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w=
|
||||||
google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
google.golang.org/protobuf v1.28.1/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=
|
||||||
@@ -451,12 +326,11 @@ gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EV
|
|||||||
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.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
|
||||||
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
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.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.0/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=
|
||||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
repository.basistech.ru/BASIS/decort-golang-sdk v1.4.6 h1:kUKBLbRGbhDQlqMvPvfdCarrXSbLmaN+YlB0cMlvyBM=
|
||||||
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
repository.basistech.ru/BASIS/decort-golang-sdk v1.4.6/go.mod h1:szsTGa73O75ckCWVGJPvTtRbhA/ubuYrYhMkPjvHlmE=
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@@ -34,6 +35,11 @@ import (
|
|||||||
// "time"
|
// "time"
|
||||||
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
decort "repository.basistech.ru/BASIS/decort-golang-sdk"
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/config"
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/interfaces"
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi"
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker"
|
||||||
|
|
||||||
jwt "github.com/golang-jwt/jwt/v4"
|
jwt "github.com/golang-jwt/jwt/v4"
|
||||||
|
|
||||||
@@ -61,6 +67,7 @@ type ControllerCfg struct {
|
|||||||
oauth2_url string // always required
|
oauth2_url string // always required
|
||||||
decort_username string // assigned to either legacy_user (legacy mode) or Oauth2 user (oauth2 mode) upon successful verification
|
decort_username string // assigned to either legacy_user (legacy mode) or Oauth2 user (oauth2 mode) upon successful verification
|
||||||
cc_client *http.Client // assigned when all initial checks successfully passed
|
cc_client *http.Client // assigned when all initial checks successfully passed
|
||||||
|
caller interfaces.Caller
|
||||||
}
|
}
|
||||||
|
|
||||||
func ControllerConfigure(d *schema.ResourceData) (*ControllerCfg, error) {
|
func ControllerConfigure(d *schema.ResourceData) (*ControllerCfg, error) {
|
||||||
@@ -146,6 +153,16 @@ func ControllerConfigure(d *schema.ResourceData) (*ControllerCfg, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
ret_config.decort_username = ret_config.legacy_user
|
ret_config.decort_username = ret_config.legacy_user
|
||||||
|
|
||||||
|
sdkConf := config.LegacyConfig{
|
||||||
|
Username: ret_config.legacy_user,
|
||||||
|
Password: ret_config.legacy_password,
|
||||||
|
DecortURL: ret_config.controller_url,
|
||||||
|
SSLSkipVerify: allow_unverified_ssl,
|
||||||
|
}
|
||||||
|
|
||||||
|
ret_config.caller = decort.NewLegacy(sdkConf)
|
||||||
|
|
||||||
case MODE_JWT:
|
case MODE_JWT:
|
||||||
//
|
//
|
||||||
ok, err := ret_config.validateJWT("")
|
ok, err := ret_config.validateJWT("")
|
||||||
@@ -176,6 +193,17 @@ func ControllerConfigure(d *schema.ResourceData) (*ControllerCfg, error) {
|
|||||||
} else {
|
} else {
|
||||||
return nil, fmt.Errorf("Failed to extract user and iss fields from JWT token in oauth2 mode.")
|
return nil, fmt.Errorf("Failed to extract user and iss fields from JWT token in oauth2 mode.")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sdkConf := config.Config{
|
||||||
|
AppID: ret_config.app_id,
|
||||||
|
AppSecret: ret_config.app_secret,
|
||||||
|
SSOURL: ret_config.oauth2_url,
|
||||||
|
DecortURL: ret_config.controller_url,
|
||||||
|
SSLSkipVerify: allow_unverified_ssl,
|
||||||
|
}
|
||||||
|
|
||||||
|
ret_config.caller = decort.New(sdkConf)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// FYI, this should never happen due to all above checks, but we want to be fool proof
|
// FYI, this should never happen due to all above checks, but we want to be fool proof
|
||||||
return nil, fmt.Errorf("Unknown authenticator mode code %d provided.", ret_config.auth_mode_code)
|
return nil, fmt.Errorf("Unknown authenticator mode code %d provided.", ret_config.auth_mode_code)
|
||||||
@@ -243,7 +271,7 @@ func (config *ControllerCfg) validateJWT(jwt string) (bool, error) {
|
|||||||
Validate JWT against DECORT controller. JWT can be supplied as argument to this method. If empty string supplied as
|
Validate JWT against DECORT controller. JWT can be supplied as argument to this method. If empty string supplied as
|
||||||
argument, JWT will be taken from config attribute.
|
argument, JWT will be taken from config attribute.
|
||||||
DECORT controller URL will always be taken from the config attribute assigned at instantiation.
|
DECORT controller URL will always be taken from the config attribute assigned at instantiation.
|
||||||
Validation is accomplished by attempting API call that lists accounts for the invoking user.
|
Validation is accomplished by attempting API call that lists account for the invoking user.
|
||||||
*/
|
*/
|
||||||
if jwt == "" {
|
if jwt == "" {
|
||||||
if config.jwt == "" {
|
if config.jwt == "" {
|
||||||
@@ -256,7 +284,7 @@ func (config *ControllerCfg) validateJWT(jwt string) (bool, error) {
|
|||||||
return false, fmt.Errorf("validateJWT method called, but no OAuth2 URL provided.")
|
return false, fmt.Errorf("validateJWT method called, but no OAuth2 URL provided.")
|
||||||
}
|
}
|
||||||
|
|
||||||
req, err := http.NewRequest("POST", config.controller_url+"/restmachine/cloudapi/accounts/list", nil)
|
req, err := http.NewRequest("POST", config.controller_url+"/restmachine/cloudapi/account/list", nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
@@ -297,7 +325,7 @@ func (config *ControllerCfg) validateLegacyUser() (bool, error) {
|
|||||||
params.Add("password", config.legacy_password)
|
params.Add("password", config.legacy_password)
|
||||||
params_str := params.Encode()
|
params_str := params.Encode()
|
||||||
|
|
||||||
req, err := http.NewRequest("POST", config.controller_url+"/restmachine/cloudapi/users/authenticate", strings.NewReader(params_str))
|
req, err := http.NewRequest("POST", config.controller_url+"/restmachine/cloudapi/user/authenticate", strings.NewReader(params_str))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
@@ -326,6 +354,26 @@ func (config *ControllerCfg) validateLegacyUser() (bool, error) {
|
|||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (config *ControllerCfg) CloudAPI() *cloudapi.CloudAPI {
|
||||||
|
if config.auth_mode_code == MODE_LEGACY {
|
||||||
|
client, _ := config.caller.(*decort.LegacyDecortClient)
|
||||||
|
return client.CloudAPI()
|
||||||
|
}
|
||||||
|
|
||||||
|
client, _ := config.caller.(*decort.DecortClient)
|
||||||
|
return client.CloudAPI()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (config *ControllerCfg) CloudBroker() *cloudbroker.CloudBroker {
|
||||||
|
if config.auth_mode_code == MODE_LEGACY {
|
||||||
|
client, _ := config.caller.(*decort.LegacyDecortClient)
|
||||||
|
return client.CloudBroker()
|
||||||
|
}
|
||||||
|
|
||||||
|
client, _ := config.caller.(*decort.DecortClient)
|
||||||
|
return client.CloudBroker()
|
||||||
|
}
|
||||||
|
|
||||||
func (config *ControllerCfg) DecortAPICall(ctx context.Context, method string, api_name string, url_values *url.Values) (json_resp string, err error) { //nolint:unparam
|
func (config *ControllerCfg) DecortAPICall(ctx context.Context, method string, api_name string, url_values *url.Values) (json_resp string, err error) { //nolint:unparam
|
||||||
// This is a convenience wrapper around standard HTTP request methods that is aware of the
|
// This is a convenience wrapper around standard HTTP request methods that is aware of the
|
||||||
// authorization mode for which the provider was initialized and compiles request accordingly.
|
// authorization mode for which the provider was initialized and compiles request accordingly.
|
||||||
|
|||||||
@@ -22,12 +22,12 @@ limitations under the License.
|
|||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//Diagnostics Collector
|
//Diagnostics Collector
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@@ -21,29 +22,21 @@ package location
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/url"
|
|
||||||
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/controller"
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/locations"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
|
||||||
)
|
)
|
||||||
|
|
||||||
var DefaultGridID int
|
var DefaultGridID int
|
||||||
|
|
||||||
func UtilityLocationGetDefaultGridID(ctx context.Context, m interface{}) (int, error) {
|
func UtilityLocationGetDefaultGridID(ctx context.Context, m interface{}) (int, error) {
|
||||||
c := m.(*controller.ControllerCfg)
|
c := m.(*controller.ControllerCfg)
|
||||||
|
req := locations.ListRequest{}
|
||||||
urlValues := &url.Values{}
|
|
||||||
|
|
||||||
log.Debug("utilityLocationGetDefaultGridID: retrieving locations list")
|
log.Debug("utilityLocationGetDefaultGridID: retrieving locations list")
|
||||||
apiResp, err := c.DecortAPICall(ctx, "POST", LocationsListAPI, urlValues)
|
locList, err := c.CloudAPI().Locations().List(ctx, req)
|
||||||
if err != nil {
|
|
||||||
return 0, err
|
|
||||||
}
|
|
||||||
|
|
||||||
locList := LocationsListResp{}
|
|
||||||
err = json.Unmarshal([]byte(apiResp), &locList)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
@@ -53,7 +46,7 @@ func UtilityLocationGetDefaultGridID(ctx context.Context, m interface{}) (int, e
|
|||||||
return 0, fmt.Errorf("utilityLocationGetDefaultGridID: retrieved 0 length locations list")
|
return 0, fmt.Errorf("utilityLocationGetDefaultGridID: retrieved 0 length locations list")
|
||||||
}
|
}
|
||||||
|
|
||||||
DefaultGridID = locList[0].GridID
|
DefaultGridID = int(locList[0].GID)
|
||||||
log.Debugf("utilityLocationGetDefaultGridID: default location GridID %d, name %s", DefaultGridID, locList[0].Name)
|
log.Debugf("utilityLocationGetDefaultGridID: default location GridID %d, name %s", DefaultGridID, locList[0].Name)
|
||||||
|
|
||||||
return DefaultGridID, nil
|
return DefaultGridID, nil
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
|
|||||||
@@ -1,96 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|
||||||
Authors:
|
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package cloudapi
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudapi/account"
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudapi/bservice"
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudapi/disks"
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudapi/extnet"
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudapi/image"
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudapi/k8s"
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudapi/kvmvm"
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudapi/lb"
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudapi/locations"
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudapi/rg"
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudapi/snapshot"
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudapi/vins"
|
|
||||||
)
|
|
||||||
|
|
||||||
func NewDataSourcesMap() map[string]*schema.Resource {
|
|
||||||
return map[string]*schema.Resource{
|
|
||||||
"decort_account": account.DataSourceAccount(),
|
|
||||||
"decort_resgroup": rg.DataSourceResgroup(),
|
|
||||||
"decort_kvmvm": kvmvm.DataSourceCompute(),
|
|
||||||
"decort_k8s": k8s.DataSourceK8s(),
|
|
||||||
"decort_k8s_list": k8s.DataSourceK8sList(),
|
|
||||||
"decort_k8s_list_deleted": k8s.DataSourceK8sListDeleted(),
|
|
||||||
"decort_k8s_wg": k8s.DataSourceK8sWg(),
|
|
||||||
"decort_k8s_wg_list": k8s.DataSourceK8sWgList(),
|
|
||||||
"decort_vins": vins.DataSourceVins(),
|
|
||||||
"decort_vins_list": vins.DataSourceVinsList(),
|
|
||||||
"decort_vins_audits": vins.DataSourceVinsAudits(),
|
|
||||||
"decort_vins_ip_list": vins.DataSourceVinsIpList(),
|
|
||||||
"decort_vins_list_deleted": vins.DataSourceVinsListDeleted(),
|
|
||||||
"decort_vins_ext_net_list": vins.DataSourceVinsExtNetList(),
|
|
||||||
"decort_vins_nat_rule_list": vins.DataSourceVinsNatRuleList(),
|
|
||||||
"decort_snapshot_list": snapshot.DataSourceSnapshotList(),
|
|
||||||
"decort_disk": disks.DataSourceDisk(),
|
|
||||||
"decort_disk_list": disks.DataSourceDiskList(),
|
|
||||||
"decort_rg_list": rg.DataSourceRgList(),
|
|
||||||
"decort_disk_list_types_detailed": disks.DataSourceDiskListTypesDetailed(),
|
|
||||||
"decort_disk_list_types": disks.DataSourceDiskListTypes(),
|
|
||||||
"decort_disk_list_deleted": disks.DataSourceDiskListDeleted(),
|
|
||||||
"decort_disk_list_unattached": disks.DataSourceDiskListUnattached(),
|
|
||||||
"decort_disk_snapshot": disks.DataSourceDiskSnapshot(),
|
|
||||||
"decort_disk_snapshot_list": disks.DataSourceDiskSnapshotList(),
|
|
||||||
"decort_account_list": account.DataSourceAccountList(),
|
|
||||||
"decort_account_computes_list": account.DataSourceAccountComputesList(),
|
|
||||||
"decort_account_disks_list": account.DataSourceAccountDisksList(),
|
|
||||||
"decort_account_vins_list": account.DataSourceAccountVinsList(),
|
|
||||||
"decort_account_audits_list": account.DataSourceAccountAuditsList(),
|
|
||||||
"decort_account_rg_list": account.DataSourceAccountRGList(),
|
|
||||||
"decort_account_consumed_units": account.DataSourceAccountConsumedUnits(),
|
|
||||||
"decort_account_consumed_units_by_type": account.DataSourceAccountConsumedUnitsByType(),
|
|
||||||
"decort_account_reserved_units": account.DataSourceAccountReservedUnits(),
|
|
||||||
"decort_account_templates_list": account.DataSourceAccountTemplatessList(),
|
|
||||||
"decort_account_deleted_list": account.DataSourceAccountDeletedList(),
|
|
||||||
"decort_account_flipgroups_list": account.DataSourceAccountFlipGroupsList(),
|
|
||||||
"decort_bservice_list": bservice.DataSourceBasicServiceList(),
|
|
||||||
"decort_bservice": bservice.DataSourceBasicService(),
|
|
||||||
"decort_bservice_snapshot_list": bservice.DataSourceBasicServiceSnapshotList(),
|
|
||||||
"decort_bservice_group": bservice.DataSourceBasicServiceGroup(),
|
|
||||||
"decort_bservice_deleted_list": bservice.DataSourceBasicServiceDeletedList(),
|
|
||||||
"decort_extnet_list": extnet.DataSourceExtnetList(),
|
|
||||||
"decort_extnet_computes_list": extnet.DataSourceExtnetComputesList(),
|
|
||||||
"decort_extnet": extnet.DataSourceExtnet(),
|
|
||||||
"decort_extnet_default": extnet.DataSourceExtnetDefault(),
|
|
||||||
"decort_locations_list": locations.DataSourceLocationsList(),
|
|
||||||
"decort_location_url": locations.DataSourceLocationUrl(),
|
|
||||||
"decort_image_list": image.DataSourceImageList(),
|
|
||||||
"decort_image": image.DataSourceImage(),
|
|
||||||
"decort_lb": lb.DataSourceLB(),
|
|
||||||
"decort_lb_list": lb.DataSourceLBList(),
|
|
||||||
"decort_lb_list_deleted": lb.DataSourceLBListDeleted(),
|
|
||||||
// "decort_pfw": dataSourcePfw(),
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,59 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|
||||||
Authors:
|
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package cloudapi
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudapi/account"
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudapi/bservice"
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudapi/disks"
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudapi/image"
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudapi/k8s"
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudapi/kvmvm"
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudapi/lb"
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudapi/pfw"
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudapi/rg"
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudapi/snapshot"
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudapi/vins"
|
|
||||||
)
|
|
||||||
|
|
||||||
func NewRersourcesMap() map[string]*schema.Resource {
|
|
||||||
return map[string]*schema.Resource{
|
|
||||||
"decort_resgroup": rg.ResourceResgroup(),
|
|
||||||
"decort_kvmvm": kvmvm.ResourceCompute(),
|
|
||||||
"decort_disk": disks.ResourceDisk(),
|
|
||||||
"decort_disk_snapshot": disks.ResourceDiskSnapshot(),
|
|
||||||
"decort_vins": vins.ResourceVins(),
|
|
||||||
"decort_pfw": pfw.ResourcePfw(),
|
|
||||||
"decort_k8s": k8s.ResourceK8s(),
|
|
||||||
"decort_k8s_wg": k8s.ResourceK8sWg(),
|
|
||||||
"decort_snapshot": snapshot.ResourceSnapshot(),
|
|
||||||
"decort_account": account.ResourceAccount(),
|
|
||||||
"decort_bservice": bservice.ResourceBasicService(),
|
|
||||||
"decort_bservice_group": bservice.ResourceBasicServiceGroup(),
|
|
||||||
"decort_image": image.ResourceImage(),
|
|
||||||
"decort_image_virtual": image.ResourceImageVirtual(),
|
|
||||||
"decort_lb": lb.ResourceLB(),
|
|
||||||
"decort_lb_backend": lb.ResourceLBBackend(),
|
|
||||||
"decort_lb_backend_server": lb.ResourceLBBackendServer(),
|
|
||||||
"decort_lb_frontend": lb.ResourceLBFrontend(),
|
|
||||||
"decort_lb_frontend_bind": lb.ResourceLBFrontendBind(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,65 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|
||||||
Authors:
|
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package cloudbroker
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudbroker/account"
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudbroker/disks"
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudbroker/grid"
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudbroker/image"
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudbroker/pcidevice"
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudbroker/rg"
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudbroker/sep"
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudbroker/vgpu"
|
|
||||||
)
|
|
||||||
|
|
||||||
func NewDataSourcesMap() map[string]*schema.Resource {
|
|
||||||
return map[string]*schema.Resource{
|
|
||||||
"decort_account": account.DataSourceAccount(),
|
|
||||||
"decort_account_list": account.DataSourceAccountList(),
|
|
||||||
"decort_account_computes_list": account.DataSourceAccountComputesList(),
|
|
||||||
"decort_account_deleted_list": account.DataSourceAccountDeletedList(),
|
|
||||||
"decort_account_disks_list": account.DataSourceAccountDisksList(),
|
|
||||||
"decort_account_flipgroups_list": account.DataSourceAccountFlipGroupsList(),
|
|
||||||
"decort_account_rg_list": account.DataSourceAccountRGList(),
|
|
||||||
"decort_account_vins_list": account.DataSourceAccountVinsList(),
|
|
||||||
"decort_account_audits_list": account.DataSourceAccountAuditsList(),
|
|
||||||
"decort_disk": disks.DataSourceDisk(),
|
|
||||||
"decort_disk_list": disks.DataSourceDiskList(),
|
|
||||||
"decort_image": image.DataSourceImage(),
|
|
||||||
"decort_grid": grid.DataSourceGrid(),
|
|
||||||
"decort_grid_list": grid.DataSourceGridList(),
|
|
||||||
"decort_image_list": image.DataSourceImageList(),
|
|
||||||
"decort_image_list_stacks": image.DataSourceImageListStacks(),
|
|
||||||
"decort_pcidevice": pcidevice.DataSourcePcidevice(),
|
|
||||||
"decort_pcidevice_list": pcidevice.DataSourcePcideviceList(),
|
|
||||||
"decort_sep_list": sep.DataSourceSepList(),
|
|
||||||
"decort_sep": sep.DataSourceSep(),
|
|
||||||
"decort_sep_consumption": sep.DataSourceSepConsumption(),
|
|
||||||
"decort_sep_disk_list": sep.DataSourceSepDiskList(),
|
|
||||||
"decort_sep_config": sep.DataSourceSepConfig(),
|
|
||||||
"decort_sep_pool": sep.DataSourceSepPool(),
|
|
||||||
"decort_vgpu": vgpu.DataSourceVGPU(),
|
|
||||||
"decort_rg_list": rg.DataSourceRgList(),
|
|
||||||
// "decort_pfw": dataSourcePfw(),
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,56 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|
||||||
Authors:
|
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package cloudbroker
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudbroker/account"
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudbroker/disks"
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudbroker/image"
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudbroker/k8s"
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudbroker/kvmvm"
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudbroker/pcidevice"
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudbroker/pfw"
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudbroker/rg"
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudbroker/sep"
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudbroker/snapshot"
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudbroker/vins"
|
|
||||||
)
|
|
||||||
|
|
||||||
func NewRersourcesMap() map[string]*schema.Resource {
|
|
||||||
return map[string]*schema.Resource{
|
|
||||||
"decort_account": account.ResourceAccount(),
|
|
||||||
"decort_disk": disks.ResourceDisk(),
|
|
||||||
"decort_image": image.ResourceImage(),
|
|
||||||
"decort_virtual_image": image.ResourceVirtualImage(),
|
|
||||||
"decort_cdrom_image": image.ResourceCDROMImage(),
|
|
||||||
"decort_delete_images": image.ResourceDeleteImages(),
|
|
||||||
"decort_pcidevice": pcidevice.ResourcePcidevice(),
|
|
||||||
"decort_sep": sep.ResourceSep(),
|
|
||||||
"decort_sep_config": sep.ResourceSepConfig(),
|
|
||||||
"decort_resgroup": rg.ResourceResgroup(),
|
|
||||||
"decort_kvmvm": kvmvm.ResourceCompute(),
|
|
||||||
"decort_vins": vins.ResourceVins(),
|
|
||||||
"decort_pfw": pfw.ResourcePfw(),
|
|
||||||
"decort_k8s": k8s.ResourceK8s(),
|
|
||||||
"decort_k8s_wg": k8s.ResourceK8sWg(),
|
|
||||||
"decort_snapshot": snapshot.ResourceSnapshot(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
154
internal/provider/data_sources_map.go
Normal file
154
internal/provider/data_sources_map.go
Normal file
@@ -0,0 +1,154 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||||
|
Authors:
|
||||||
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package provider
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/account"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/bservice"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/disks"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/extnet"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/flipgroup"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/image"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/k8s"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/kvmvm"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/lb"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/locations"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/rg"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/snapshot"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/vins"
|
||||||
|
|
||||||
|
cb_account "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/account"
|
||||||
|
cb_disks "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/disks"
|
||||||
|
cb_grid "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/grid"
|
||||||
|
cb_image "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/image"
|
||||||
|
cb_pcidevice "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/pcidevice"
|
||||||
|
cb_rg "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/rg"
|
||||||
|
cb_sep "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/sep"
|
||||||
|
cb_vgpu "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/vgpu"
|
||||||
|
)
|
||||||
|
|
||||||
|
func newDataSourcesMap() map[string]*schema.Resource {
|
||||||
|
return map[string]*schema.Resource{
|
||||||
|
"decort_account": account.DataSourceAccount(),
|
||||||
|
"decort_resgroup": rg.DataSourceResgroup(),
|
||||||
|
"decort_kvmvm": kvmvm.DataSourceCompute(),
|
||||||
|
"decort_kvmvm_list": kvmvm.DataSourceComputeList(),
|
||||||
|
"decort_kvmvm_audits": kvmvm.DataSourceComputeAudits(),
|
||||||
|
"decort_kvmvm_get_audits": kvmvm.DataSourceComputeGetAudits(),
|
||||||
|
"decort_kvmvm_get_console_url": kvmvm.DataSourceComputeGetConsoleUrl(),
|
||||||
|
"decort_kvmvm_get_log": kvmvm.DataSourceComputeGetLog(),
|
||||||
|
"decort_kvmvm_pfw_list": kvmvm.DataSourceComputePfwList(),
|
||||||
|
"decort_kvmvm_user_list": kvmvm.DataSourceComputeUserList(),
|
||||||
|
"decort_kvmvm_snapshot_usage": kvmvm.DataSourceComputeSnapshotUsage(),
|
||||||
|
"decort_k8s": k8s.DataSourceK8s(),
|
||||||
|
"decort_k8s_list": k8s.DataSourceK8sList(),
|
||||||
|
"decort_k8s_list_deleted": k8s.DataSourceK8sListDeleted(),
|
||||||
|
"decort_k8s_wg": k8s.DataSourceK8sWg(),
|
||||||
|
"decort_k8s_wg_list": k8s.DataSourceK8sWgList(),
|
||||||
|
"decort_k8s_computes": k8s.DataSourceK8sComputes(),
|
||||||
|
"decort_vins": vins.DataSourceVins(),
|
||||||
|
"decort_vins_list": vins.DataSourceVinsList(),
|
||||||
|
"decort_vins_audits": vins.DataSourceVinsAudits(),
|
||||||
|
"decort_vins_ip_list": vins.DataSourceVinsIpList(),
|
||||||
|
"decort_vins_list_deleted": vins.DataSourceVinsListDeleted(),
|
||||||
|
"decort_vins_ext_net_list": vins.DataSourceVinsExtNetList(),
|
||||||
|
"decort_vins_nat_rule_list": vins.DataSourceVinsNatRuleList(),
|
||||||
|
"decort_snapshot_list": snapshot.DataSourceSnapshotList(),
|
||||||
|
"decort_disk": disks.DataSourceDisk(),
|
||||||
|
"decort_disk_list": disks.DataSourceDiskList(),
|
||||||
|
"decort_rg_list": rg.DataSourceRgList(),
|
||||||
|
"decort_rg_affinity_group_computes": rg.DataSourceRgAffinityGroupComputes(),
|
||||||
|
"decort_rg_affinity_groups_list": rg.DataSourceRgAffinityGroupsList(),
|
||||||
|
"decort_rg_affinity_groups_get": rg.DataSourceRgAffinityGroupsGet(),
|
||||||
|
"decort_rg_audits": rg.DataSourceRgAudits(),
|
||||||
|
"decort_rg_list_computes": rg.DataSourceRgListComputes(),
|
||||||
|
"decort_rg_list_deleted": rg.DataSourceRgListDeleted(),
|
||||||
|
"decort_rg_list_lb": rg.DataSourceRgListLb(),
|
||||||
|
"decort_rg_list_pfw": rg.DataSourceRgListPfw(),
|
||||||
|
"decort_rg_list_vins": rg.DataSourceRgListVins(),
|
||||||
|
"decort_rg_usage": rg.DataSourceRgUsage(),
|
||||||
|
"decort_disk_list_types_detailed": disks.DataSourceDiskListTypesDetailed(),
|
||||||
|
"decort_disk_list_types": disks.DataSourceDiskListTypes(),
|
||||||
|
"decort_disk_list_deleted": disks.DataSourceDiskListDeleted(),
|
||||||
|
"decort_disk_list_unattached": disks.DataSourceDiskListUnattached(),
|
||||||
|
"decort_disk_snapshot": disks.DataSourceDiskSnapshot(),
|
||||||
|
"decort_disk_snapshot_list": disks.DataSourceDiskSnapshotList(),
|
||||||
|
"decort_account_list": account.DataSourceAccountList(),
|
||||||
|
"decort_account_computes_list": account.DataSourceAccountComputesList(),
|
||||||
|
"decort_account_disks_list": account.DataSourceAccountDisksList(),
|
||||||
|
"decort_account_vins_list": account.DataSourceAccountVinsList(),
|
||||||
|
"decort_account_audits_list": account.DataSourceAccountAuditsList(),
|
||||||
|
"decort_account_rg_list": account.DataSourceAccountRGList(),
|
||||||
|
"decort_account_consumed_units": account.DataSourceAccountConsumedUnits(),
|
||||||
|
"decort_account_consumed_units_by_type": account.DataSourceAccountConsumedUnitsByType(),
|
||||||
|
"decort_account_reserved_units": account.DataSourceAccountReservedUnits(),
|
||||||
|
"decort_account_templates_list": account.DataSourceAccountTemplatessList(),
|
||||||
|
"decort_account_deleted_list": account.DataSourceAccountDeletedList(),
|
||||||
|
"decort_account_flipgroups_list": account.DataSourceAccountFlipGroupsList(),
|
||||||
|
"decort_bservice_list": bservice.DataSourceBasicServiceList(),
|
||||||
|
"decort_bservice": bservice.DataSourceBasicService(),
|
||||||
|
"decort_bservice_snapshot_list": bservice.DataSourceBasicServiceSnapshotList(),
|
||||||
|
"decort_bservice_group": bservice.DataSourceBasicServiceGroup(),
|
||||||
|
"decort_bservice_deleted_list": bservice.DataSourceBasicServiceDeletedList(),
|
||||||
|
"decort_extnet_list": extnet.DataSourceExtnetList(),
|
||||||
|
"decort_extnet_computes_list": extnet.DataSourceExtnetComputesList(),
|
||||||
|
"decort_extnet": extnet.DataSourceExtnet(),
|
||||||
|
"decort_extnet_default": extnet.DataSourceExtnetDefault(),
|
||||||
|
"decort_locations_list": locations.DataSourceLocationsList(),
|
||||||
|
"decort_location_url": locations.DataSourceLocationUrl(),
|
||||||
|
"decort_image_list": image.DataSourceImageList(),
|
||||||
|
"decort_image": image.DataSourceImage(),
|
||||||
|
"decort_lb": lb.DataSourceLB(),
|
||||||
|
"decort_lb_list": lb.DataSourceLBList(),
|
||||||
|
"decort_lb_list_deleted": lb.DataSourceLBListDeleted(),
|
||||||
|
"decort_flipgroup": flipgroup.DataSourceFlipgroup(),
|
||||||
|
"decort_flipgroup_list": flipgroup.DataSourceFlipGroupList(),
|
||||||
|
|
||||||
|
"decort_cb_account": cb_account.DataSourceAccount(),
|
||||||
|
"decort_cb_account_list": cb_account.DataSourceAccountList(),
|
||||||
|
"decort_cb_account_computes_list": cb_account.DataSourceAccountComputesList(),
|
||||||
|
"decort_cb_account_deleted_list": cb_account.DataSourceAccountDeletedList(),
|
||||||
|
"decort_cb_account_disks_list": cb_account.DataSourceAccountDisksList(),
|
||||||
|
"decort_cb_account_flipgroups_list": cb_account.DataSourceAccountFlipGroupsList(),
|
||||||
|
"decort_cb_account_rg_list": cb_account.DataSourceAccountRGList(),
|
||||||
|
"decort_cb_account_vins_list": cb_account.DataSourceAccountVinsList(),
|
||||||
|
"decort_cb_account_audits_list": cb_account.DataSourceAccountAuditsList(),
|
||||||
|
"decort_cb_disk": cb_disks.DataSourceDisk(),
|
||||||
|
"decort_cb_disk_list": cb_disks.DataSourceDiskList(),
|
||||||
|
"decort_cb_image": cb_image.DataSourceImage(),
|
||||||
|
"decort_cb_grid": cb_grid.DataSourceGrid(),
|
||||||
|
"decort_cb_grid_list": cb_grid.DataSourceGridList(),
|
||||||
|
"decort_cb_image_list": cb_image.DataSourceImageList(),
|
||||||
|
"decort_cb_image_list_stacks": cb_image.DataSourceImageListStacks(),
|
||||||
|
"decort_cb_pcidevice": cb_pcidevice.DataSourcePcidevice(),
|
||||||
|
"decort_cb_pcidevice_list": cb_pcidevice.DataSourcePcideviceList(),
|
||||||
|
"decort_cb_sep_list": cb_sep.DataSourceSepList(),
|
||||||
|
"decort_cb_sep": cb_sep.DataSourceSep(),
|
||||||
|
"decort_cb_sep_consumption": cb_sep.DataSourceSepConsumption(),
|
||||||
|
"decort_cb_sep_disk_list": cb_sep.DataSourceSepDiskList(),
|
||||||
|
"decort_cb_sep_config": cb_sep.DataSourceSepConfig(),
|
||||||
|
"decort_cb_sep_pool": cb_sep.DataSourceSepPool(),
|
||||||
|
"decort_cb_vgpu": cb_vgpu.DataSourceVGPU(),
|
||||||
|
"decort_cb_rg_list": cb_rg.DataSourceRgList(),
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -3,6 +3,7 @@ Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@@ -27,9 +28,9 @@ import (
|
|||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/controller"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/location"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/location"
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/statefuncs"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/statefuncs"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Provider() *schema.Provider {
|
func Provider() *schema.Provider {
|
||||||
@@ -102,9 +103,9 @@ func Provider() *schema.Provider {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
ResourcesMap: selectSchema(false),
|
ResourcesMap: newResourcesMap(),
|
||||||
|
|
||||||
DataSourcesMap: selectSchema(true),
|
DataSourcesMap: newDataSourcesMap(),
|
||||||
|
|
||||||
ConfigureContextFunc: providerConfigure,
|
ConfigureContextFunc: providerConfigure,
|
||||||
}
|
}
|
||||||
|
|||||||
92
internal/provider/resource_map.go
Normal file
92
internal/provider/resource_map.go
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||||
|
Authors:
|
||||||
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package provider
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/account"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/bservice"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/disks"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/flipgroup"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/image"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/k8s"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/kvmvm"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/lb"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/pfw"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/rg"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/snapshot"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudapi/vins"
|
||||||
|
|
||||||
|
cb_account "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/account"
|
||||||
|
cb_disks "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/disks"
|
||||||
|
cb_image "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/image"
|
||||||
|
cb_k8s "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/k8s"
|
||||||
|
cb_kvmvm "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/kvmvm"
|
||||||
|
cb_pcidevice "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/pcidevice"
|
||||||
|
cb_pfw "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/pfw"
|
||||||
|
cb_rg "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/rg"
|
||||||
|
cb_sep "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/sep"
|
||||||
|
cb_snapshot "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/snapshot"
|
||||||
|
cb_vins "repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/vins"
|
||||||
|
)
|
||||||
|
|
||||||
|
func newResourcesMap() map[string]*schema.Resource {
|
||||||
|
return map[string]*schema.Resource{
|
||||||
|
"decort_resgroup": rg.ResourceResgroup(),
|
||||||
|
"decort_kvmvm": kvmvm.ResourceCompute(),
|
||||||
|
"decort_disk": disks.ResourceDisk(),
|
||||||
|
"decort_disk_snapshot": disks.ResourceDiskSnapshot(),
|
||||||
|
"decort_vins": vins.ResourceVins(),
|
||||||
|
"decort_pfw": pfw.ResourcePfw(),
|
||||||
|
"decort_k8s": k8s.ResourceK8s(),
|
||||||
|
"decort_k8s_wg": k8s.ResourceK8sWg(),
|
||||||
|
"decort_k8s_cp": k8s.ResourceK8sCP(),
|
||||||
|
"decort_snapshot": snapshot.ResourceSnapshot(),
|
||||||
|
"decort_account": account.ResourceAccount(),
|
||||||
|
"decort_bservice": bservice.ResourceBasicService(),
|
||||||
|
"decort_bservice_group": bservice.ResourceBasicServiceGroup(),
|
||||||
|
"decort_image": image.ResourceImage(),
|
||||||
|
"decort_image_virtual": image.ResourceImageVirtual(),
|
||||||
|
"decort_lb": lb.ResourceLB(),
|
||||||
|
"decort_lb_backend": lb.ResourceLBBackend(),
|
||||||
|
"decort_lb_backend_server": lb.ResourceLBBackendServer(),
|
||||||
|
"decort_lb_frontend": lb.ResourceLBFrontend(),
|
||||||
|
"decort_lb_frontend_bind": lb.ResourceLBFrontendBind(),
|
||||||
|
"decort_flipgroup": flipgroup.ResourceFlipgroup(),
|
||||||
|
|
||||||
|
"decort_cb_account": cb_account.ResourceAccount(),
|
||||||
|
"decort_cb_disk": cb_disks.ResourceDisk(),
|
||||||
|
"decort_cb_image": cb_image.ResourceImage(),
|
||||||
|
"decort_cb_virtual_image": cb_image.ResourceVirtualImage(),
|
||||||
|
"decort_cb_cdrom_image": cb_image.ResourceCDROMImage(),
|
||||||
|
"decort_cb_delete_images": cb_image.ResourceDeleteImages(),
|
||||||
|
"decort_cb_pcidevice": cb_pcidevice.ResourcePcidevice(),
|
||||||
|
"decort_cb_sep": cb_sep.ResourceSep(),
|
||||||
|
"decort_cb_sep_config": cb_sep.ResourceSepConfig(),
|
||||||
|
"decort_cb_resgroup": cb_rg.ResourceResgroup(),
|
||||||
|
"decort_cb_kvmvm": cb_kvmvm.ResourceCompute(),
|
||||||
|
"decort_cb_vins": cb_vins.ResourceVins(),
|
||||||
|
"decort_cb_pfw": cb_pfw.ResourcePfw(),
|
||||||
|
"decort_cb_k8s": cb_k8s.ResourceK8s(),
|
||||||
|
"decort_cb_k8s_wg": cb_k8s.ResourceK8sWg(),
|
||||||
|
"decort_cb_snapshot": cb_snapshot.ResourceSnapshot(),
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|
||||||
Authors:
|
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package provider
|
|
||||||
|
|
||||||
import (
|
|
||||||
"os"
|
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
|
||||||
ca "github.com/rudecs/terraform-provider-decort/internal/provider/cloudapi"
|
|
||||||
cb "github.com/rudecs/terraform-provider-decort/internal/provider/cloudbroker"
|
|
||||||
)
|
|
||||||
|
|
||||||
func selectSchema(isDatasource bool) map[string]*schema.Resource {
|
|
||||||
adminMode, err := strconv.ParseBool(os.Getenv("DECORT_ADMIN_MODE"))
|
|
||||||
if err != nil {
|
|
||||||
adminMode = false
|
|
||||||
}
|
|
||||||
if isDatasource {
|
|
||||||
return selectDataSourceSchema(adminMode)
|
|
||||||
}
|
|
||||||
return selectResourceSchema(adminMode)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func selectDataSourceSchema(adminMode bool) map[string]*schema.Resource {
|
|
||||||
if adminMode {
|
|
||||||
return cb.NewDataSourcesMap()
|
|
||||||
}
|
|
||||||
return ca.NewDataSourcesMap()
|
|
||||||
}
|
|
||||||
|
|
||||||
func selectResourceSchema(adminMode bool) map[string]*schema.Resource {
|
|
||||||
if adminMode {
|
|
||||||
return cb.NewRersourcesMap()
|
|
||||||
}
|
|
||||||
return ca.NewRersourcesMap()
|
|
||||||
}
|
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|
||||||
Authors:
|
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
|
||||||
builds seamlessly.
|
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
|
||||||
*/
|
|
||||||
|
|
||||||
package account
|
|
||||||
|
|
||||||
const accountAddUserAPI = "/restmachine/cloudapi/account/addUser"
|
|
||||||
const accountAuditsAPI = "/restmachine/cloudapi/account/audits"
|
|
||||||
const accountCreateAPI = "/restmachine/cloudapi/account/create"
|
|
||||||
const accountDeleteAPI = "/restmachine/cloudapi/account/delete"
|
|
||||||
const accountDeleteUserAPI = "/restmachine/cloudapi/account/deleteUser"
|
|
||||||
const accountDisableAPI = "/restmachine/cloudapi/account/disable"
|
|
||||||
const accountEnableAPI = "/restmachine/cloudapi/account/enable"
|
|
||||||
const accountGetAPI = "/restmachine/cloudapi/account/get"
|
|
||||||
const accountGetConsumedUnitsAPI = "/restmachine/cloudapi/account/getConsumedAccountUnits"
|
|
||||||
const accountGetConsumedUnitsByTypeAPI = "/restmachine/cloudapi/account/getConsumedCloudUnitsByType"
|
|
||||||
const accountGetReservedUnitsAPI = "/restmachine/cloudapi/account/getReservedAccountUnits"
|
|
||||||
const accountListAPI = "/restmachine/cloudapi/account/list"
|
|
||||||
const accountListComputesAPI = "/restmachine/cloudapi/account/listComputes"
|
|
||||||
const accountListDeletedAPI = "/restmachine/cloudapi/account/listDeleted"
|
|
||||||
const accountListDisksAPI = "/restmachine/cloudapi/account/listDisks"
|
|
||||||
const accountListFlipGroupsAPI = "/restmachine/cloudapi/account/listFlipGroups"
|
|
||||||
const accountListRGAPI = "/restmachine/cloudapi/account/listRG"
|
|
||||||
const accountListTemplatesAPI = "/restmachine/cloudapi/account/listTemplates"
|
|
||||||
const accountListVinsAPI = "/restmachine/cloudapi/account/listVins"
|
|
||||||
const accountRestoreAPI = "/restmachine/cloudapi/account/restore"
|
|
||||||
const accountUpdateAPI = "/restmachine/cloudapi/account/update"
|
|
||||||
const accountUpdateUserAPI = "/restmachine/cloudapi/account/updateUser"
|
|
||||||
@@ -3,6 +3,7 @@ Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@@ -21,24 +22,23 @@ limitations under the License.
|
|||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package account
|
package account
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/constants"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/flattens"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func dataSourceAccountRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func dataSourceAccountRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
@@ -47,128 +47,213 @@ func dataSourceAccountRead(ctx context.Context, d *schema.ResourceData, m interf
|
|||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
id := uuid.New()
|
flattenAccount(d, *acc)
|
||||||
d.SetId(id.String())
|
d.SetId(strconv.Itoa(int(acc.ID)))
|
||||||
d.Set("dc_location", acc.DCLocation)
|
|
||||||
d.Set("resources", flattenAccResources(acc.Resources))
|
|
||||||
d.Set("ckey", acc.CKey)
|
|
||||||
d.Set("meta", flattens.FlattenMeta(acc.Meta))
|
|
||||||
d.Set("acl", flattenAccAcl(acc.Acl))
|
|
||||||
d.Set("company", acc.Company)
|
|
||||||
d.Set("companyurl", acc.CompanyUrl)
|
|
||||||
d.Set("created_by", acc.CreatedBy)
|
|
||||||
d.Set("created_time", acc.CreatedTime)
|
|
||||||
d.Set("deactivation_time", acc.DeactiovationTime)
|
|
||||||
d.Set("deleted_by", acc.DeletedBy)
|
|
||||||
d.Set("deleted_time", acc.DeletedTime)
|
|
||||||
d.Set("displayname", acc.DisplayName)
|
|
||||||
d.Set("guid", acc.GUID)
|
|
||||||
d.Set("account_id", acc.ID)
|
|
||||||
d.Set("account_name", acc.Name)
|
|
||||||
d.Set("resource_limits", flattenRgResourceLimits(acc.ResourceLimits))
|
|
||||||
d.Set("send_access_emails", acc.SendAccessEmails)
|
|
||||||
d.Set("service_account", acc.ServiceAccount)
|
|
||||||
d.Set("status", acc.Status)
|
|
||||||
d.Set("updated_time", acc.UpdatedTime)
|
|
||||||
d.Set("version", acc.Version)
|
|
||||||
d.Set("vins", acc.Vins)
|
|
||||||
d.Set("vinses", acc.Vinses)
|
|
||||||
d.Set("computes", flattenAccComputes(acc.Computes))
|
|
||||||
d.Set("machines", flattenAccMachines(acc.Machines))
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func flattenAccComputes(acs Computes) []map[string]interface{} {
|
func aclSchemaMake() map[string]*schema.Schema {
|
||||||
res := make([]map[string]interface{}, 0)
|
res := map[string]*schema.Schema{
|
||||||
temp := map[string]interface{}{
|
"can_be_deleted": {
|
||||||
"started": acs.Started,
|
Type: schema.TypeBool,
|
||||||
"stopped": acs.Stopped,
|
Computed: true,
|
||||||
|
},
|
||||||
|
"explicit": {
|
||||||
|
Type: schema.TypeBool,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"guid": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"right": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"status": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"type": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"user_group_id": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
res = append(res, temp)
|
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
func flattenAccMachines(ams Machines) []map[string]interface{} {
|
func resourceLimitsSchemaMake() map[string]*schema.Schema {
|
||||||
res := make([]map[string]interface{}, 0)
|
res := map[string]*schema.Schema{
|
||||||
temp := map[string]interface{}{
|
"cu_c": {
|
||||||
"running": ams.Running,
|
Type: schema.TypeFloat,
|
||||||
"halted": ams.Halted,
|
Computed: true,
|
||||||
|
},
|
||||||
|
"cu_d": {
|
||||||
|
Type: schema.TypeFloat,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"cu_i": {
|
||||||
|
Type: schema.TypeFloat,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"cu_m": {
|
||||||
|
Type: schema.TypeFloat,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"cu_np": {
|
||||||
|
Type: schema.TypeFloat,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"gpu_units": {
|
||||||
|
Type: schema.TypeFloat,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
res = append(res, temp)
|
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
func flattenAccAcl(acls []AccountAclRecord) []map[string]interface{} {
|
func sepsSchemaMake() map[string]*schema.Schema {
|
||||||
res := make([]map[string]interface{}, 0)
|
res := map[string]*schema.Schema{
|
||||||
for _, acls := range acls {
|
"sep_id": {
|
||||||
temp := map[string]interface{}{
|
Type: schema.TypeString,
|
||||||
"can_be_deleted": acls.CanBeDeleted,
|
Computed: true,
|
||||||
"explicit": acls.IsExplicit,
|
},
|
||||||
"guid": acls.Guid,
|
"data_name": {
|
||||||
"right": acls.Rights,
|
Type: schema.TypeString,
|
||||||
"status": acls.Status,
|
Computed: true,
|
||||||
"type": acls.Type,
|
},
|
||||||
"user_group_id": acls.UgroupID,
|
"disk_size": {
|
||||||
}
|
Type: schema.TypeFloat,
|
||||||
res = append(res, temp)
|
Computed: true,
|
||||||
|
},
|
||||||
|
"disk_size_max": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
func flattenRgResourceLimits(rl ResourceLimits) []map[string]interface{} {
|
func resourcesSchemaMake() map[string]*schema.Schema {
|
||||||
res := make([]map[string]interface{}, 0)
|
res := map[string]*schema.Schema{
|
||||||
temp := map[string]interface{}{
|
"current": {
|
||||||
"cu_c": rl.CUC,
|
Type: schema.TypeList,
|
||||||
"cu_d": rl.CUD,
|
Computed: true,
|
||||||
"cu_i": rl.CUI,
|
Elem: &schema.Resource{
|
||||||
"cu_m": rl.CUM,
|
Schema: map[string]*schema.Schema{
|
||||||
"cu_np": rl.CUNP,
|
"cpu": {
|
||||||
"gpu_units": rl.GpuUnits,
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"disksize": {
|
||||||
|
Type: schema.TypeFloat,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"extips": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"exttraffic": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"gpu": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"ram": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"seps": {
|
||||||
|
Type: schema.TypeSet,
|
||||||
|
Computed: true,
|
||||||
|
Elem: &schema.Resource{
|
||||||
|
Schema: sepsSchemaMake(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"reserved": {
|
||||||
|
Type: schema.TypeList,
|
||||||
|
Computed: true,
|
||||||
|
Elem: &schema.Resource{
|
||||||
|
Schema: map[string]*schema.Schema{
|
||||||
|
"cpu": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"disksize": {
|
||||||
|
Type: schema.TypeFloat,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"extips": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"exttraffic": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"gpu": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"ram": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"seps": {
|
||||||
|
Type: schema.TypeSet,
|
||||||
|
Computed: true,
|
||||||
|
Elem: &schema.Resource{
|
||||||
|
Schema: sepsSchemaMake(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
res = append(res, temp)
|
|
||||||
|
|
||||||
return res
|
return res
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func flattenAccResources(r Resources) []map[string]interface{} {
|
|
||||||
res := make([]map[string]interface{}, 0)
|
|
||||||
temp := map[string]interface{}{
|
|
||||||
"current": flattenAccResource(r.Current),
|
|
||||||
"reserved": flattenAccResource(r.Reserved),
|
|
||||||
}
|
|
||||||
res = append(res, temp)
|
|
||||||
return res
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func flattenAccountSeps(seps map[string]map[string]ResourceSep) []map[string]interface{} {
|
func computesSchemaMake() map[string]*schema.Schema {
|
||||||
res := make([]map[string]interface{}, 0)
|
res := map[string]*schema.Schema{
|
||||||
for sepKey, sepVal := range seps {
|
"started": {
|
||||||
for dataKey, dataVal := range sepVal {
|
Type: schema.TypeInt,
|
||||||
temp := map[string]interface{}{
|
Computed: true,
|
||||||
"sep_id": sepKey,
|
},
|
||||||
"data_name": dataKey,
|
"stopped": {
|
||||||
"disk_size": dataVal.DiskSize,
|
Type: schema.TypeInt,
|
||||||
"disk_size_max": dataVal.DiskSizeMax,
|
Computed: true,
|
||||||
}
|
},
|
||||||
res = append(res, temp)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
func flattenAccResource(r Resource) []map[string]interface{} {
|
func machinesSchemaMake() map[string]*schema.Schema {
|
||||||
res := make([]map[string]interface{}, 0)
|
res := map[string]*schema.Schema{
|
||||||
temp := map[string]interface{}{
|
"halted": {
|
||||||
"cpu": r.CPU,
|
Type: schema.TypeInt,
|
||||||
"disksize": r.Disksize,
|
Computed: true,
|
||||||
"extips": r.Extips,
|
},
|
||||||
"exttraffic": r.Exttraffic,
|
"running": {
|
||||||
"gpu": r.GPU,
|
Type: schema.TypeInt,
|
||||||
"ram": r.RAM,
|
Computed: true,
|
||||||
"seps": flattenAccountSeps(r.SEPs),
|
},
|
||||||
}
|
}
|
||||||
res = append(res, temp)
|
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -187,120 +272,7 @@ func dataSourceAccountSchemaMake() map[string]*schema.Schema {
|
|||||||
Type: schema.TypeList,
|
Type: schema.TypeList,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
Elem: &schema.Resource{
|
Elem: &schema.Resource{
|
||||||
Schema: map[string]*schema.Schema{
|
Schema: resourcesSchemaMake(),
|
||||||
"current": {
|
|
||||||
Type: schema.TypeList,
|
|
||||||
Computed: true,
|
|
||||||
Elem: &schema.Resource{
|
|
||||||
Schema: map[string]*schema.Schema{
|
|
||||||
"cpu": {
|
|
||||||
Type: schema.TypeInt,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
"disksize": {
|
|
||||||
Type: schema.TypeFloat,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
"extips": {
|
|
||||||
Type: schema.TypeInt,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
"exttraffic": {
|
|
||||||
Type: schema.TypeInt,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
"gpu": {
|
|
||||||
Type: schema.TypeInt,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
"ram": {
|
|
||||||
Type: schema.TypeInt,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
"seps": {
|
|
||||||
Type: schema.TypeList,
|
|
||||||
Computed: true,
|
|
||||||
Elem: &schema.Resource{
|
|
||||||
Schema: map[string]*schema.Schema{
|
|
||||||
"sep_id": {
|
|
||||||
Type: schema.TypeString,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
"data_name": {
|
|
||||||
Type: schema.TypeString,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
"disk_size": {
|
|
||||||
Type: schema.TypeFloat,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
"disk_size_max": {
|
|
||||||
Type: schema.TypeInt,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"reserved": {
|
|
||||||
Type: schema.TypeList,
|
|
||||||
Computed: true,
|
|
||||||
Elem: &schema.Resource{
|
|
||||||
Schema: map[string]*schema.Schema{
|
|
||||||
"cpu": {
|
|
||||||
Type: schema.TypeInt,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
"disksize": {
|
|
||||||
Type: schema.TypeFloat,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
"extips": {
|
|
||||||
Type: schema.TypeInt,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
"exttraffic": {
|
|
||||||
Type: schema.TypeInt,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
"gpu": {
|
|
||||||
Type: schema.TypeInt,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
"ram": {
|
|
||||||
Type: schema.TypeInt,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
"seps": {
|
|
||||||
Type: schema.TypeList,
|
|
||||||
Computed: true,
|
|
||||||
Elem: &schema.Resource{
|
|
||||||
Schema: map[string]*schema.Schema{
|
|
||||||
"sep_id": {
|
|
||||||
Type: schema.TypeString,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
"data_name": {
|
|
||||||
Type: schema.TypeString,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
"disk_size": {
|
|
||||||
Type: schema.TypeFloat,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
"disk_size_max": {
|
|
||||||
Type: schema.TypeInt,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"ckey": {
|
"ckey": {
|
||||||
@@ -318,36 +290,7 @@ func dataSourceAccountSchemaMake() map[string]*schema.Schema {
|
|||||||
Type: schema.TypeList,
|
Type: schema.TypeList,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
Elem: &schema.Resource{
|
Elem: &schema.Resource{
|
||||||
Schema: map[string]*schema.Schema{
|
Schema: aclSchemaMake(),
|
||||||
"can_be_deleted": {
|
|
||||||
Type: schema.TypeBool,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
"explicit": {
|
|
||||||
Type: schema.TypeBool,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
"guid": {
|
|
||||||
Type: schema.TypeString,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
"right": {
|
|
||||||
Type: schema.TypeString,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
"status": {
|
|
||||||
Type: schema.TypeString,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
"type": {
|
|
||||||
Type: schema.TypeString,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
"user_group_id": {
|
|
||||||
Type: schema.TypeString,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"company": {
|
"company": {
|
||||||
@@ -394,32 +337,7 @@ func dataSourceAccountSchemaMake() map[string]*schema.Schema {
|
|||||||
Type: schema.TypeList,
|
Type: schema.TypeList,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
Elem: &schema.Resource{
|
Elem: &schema.Resource{
|
||||||
Schema: map[string]*schema.Schema{
|
Schema: resourceLimitsSchemaMake(),
|
||||||
"cu_c": {
|
|
||||||
Type: schema.TypeFloat,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
"cu_d": {
|
|
||||||
Type: schema.TypeFloat,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
"cu_i": {
|
|
||||||
Type: schema.TypeFloat,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
"cu_m": {
|
|
||||||
Type: schema.TypeFloat,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
"cu_np": {
|
|
||||||
Type: schema.TypeFloat,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
"gpu_units": {
|
|
||||||
Type: schema.TypeFloat,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"send_access_emails": {
|
"send_access_emails": {
|
||||||
@@ -453,38 +371,28 @@ func dataSourceAccountSchemaMake() map[string]*schema.Schema {
|
|||||||
Type: schema.TypeList,
|
Type: schema.TypeList,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
Elem: &schema.Resource{
|
Elem: &schema.Resource{
|
||||||
Schema: map[string]*schema.Schema{
|
Schema: computesSchemaMake(),
|
||||||
"started": {
|
|
||||||
Type: schema.TypeInt,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
"stopped": {
|
|
||||||
Type: schema.TypeInt,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"machines": {
|
"machines": {
|
||||||
Type: schema.TypeList,
|
Type: schema.TypeList,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
Elem: &schema.Resource{
|
Elem: &schema.Resource{
|
||||||
Schema: map[string]*schema.Schema{
|
Schema: machinesSchemaMake(),
|
||||||
"halted": {
|
|
||||||
Type: schema.TypeInt,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
"running": {
|
|
||||||
Type: schema.TypeInt,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"vinses": {
|
"vinses": {
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
},
|
},
|
||||||
|
"cpu_allocation_parameter": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"cpu_allocation_ratio": {
|
||||||
|
Type: schema.TypeFloat,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@@ -21,12 +22,12 @@ limitations under the License.
|
|||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package account
|
package account
|
||||||
@@ -37,10 +38,11 @@ import (
|
|||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/constants"
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/account"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
)
|
)
|
||||||
|
|
||||||
func flattenAccountAuditsList(aal AccountAuditsList) []map[string]interface{} {
|
func flattenAccountAuditsList(aal account.ListAudits) []map[string]interface{} {
|
||||||
res := make([]map[string]interface{}, 0)
|
res := make([]map[string]interface{}, 0)
|
||||||
for _, aa := range aal {
|
for _, aa := range aal {
|
||||||
temp := map[string]interface{}{
|
temp := map[string]interface{}{
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@@ -21,12 +22,12 @@ limitations under the License.
|
|||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package account
|
package account
|
||||||
@@ -37,33 +38,34 @@ import (
|
|||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/constants"
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/account"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
)
|
)
|
||||||
|
|
||||||
func flattenAccountComputesList(acl AccountComputesList) []map[string]interface{} {
|
func flattenAccountComputesList(acl account.ListComputes) []map[string]interface{} {
|
||||||
res := make([]map[string]interface{}, 0)
|
res := make([]map[string]interface{}, 0)
|
||||||
for _, acc := range acl {
|
for _, acc := range acl {
|
||||||
temp := map[string]interface{}{
|
temp := map[string]interface{}{
|
||||||
"account_id": acc.AccountId,
|
"account_id": acc.AccountID,
|
||||||
"account_name": acc.AccountName,
|
"account_name": acc.AccountName,
|
||||||
"cpus": acc.CPUs,
|
"cpus": acc.CPUs,
|
||||||
"created_by": acc.CreatedBy,
|
"created_by": acc.CreatedBy,
|
||||||
"created_time": acc.CreatedTime,
|
"created_time": acc.CreatedTime,
|
||||||
"deleted_by": acc.DeletedBy,
|
"deleted_by": acc.DeletedBy,
|
||||||
"deleted_time": acc.DeletedTime,
|
"deleted_time": acc.DeletedTime,
|
||||||
"compute_id": acc.ComputeId,
|
"compute_id": acc.ComputeID,
|
||||||
"compute_name": acc.ComputeName,
|
"compute_name": acc.ComputeName,
|
||||||
"ram": acc.RAM,
|
"ram": acc.RAM,
|
||||||
"registered": acc.Registered,
|
"registered": acc.Registered,
|
||||||
"rg_id": acc.RgId,
|
"rg_id": acc.RGID,
|
||||||
"rg_name": acc.RgName,
|
"rg_name": acc.RGName,
|
||||||
"status": acc.Status,
|
"status": acc.Status,
|
||||||
"tech_status": acc.TechStatus,
|
"tech_status": acc.TechStatus,
|
||||||
"total_disks_size": acc.TotalDisksSize,
|
"total_disks_size": acc.TotalDisksSize,
|
||||||
"updated_by": acc.UpdatedBy,
|
"updated_by": acc.UpdatedBy,
|
||||||
"updated_time": acc.UpdatedTime,
|
"updated_time": acc.UpdatedTime,
|
||||||
"user_managed": acc.UserManaged,
|
"user_managed": acc.UserManaged,
|
||||||
"vins_connected": acc.VinsConnected,
|
"vins_connected": acc.VINSConnected,
|
||||||
}
|
}
|
||||||
res = append(res, temp)
|
res = append(res, temp)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@@ -21,12 +22,12 @@ limitations under the License.
|
|||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package account
|
package account
|
||||||
@@ -37,7 +38,7 @@ import (
|
|||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/constants"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
)
|
)
|
||||||
|
|
||||||
func dataSourceAccountConsumedUnitsRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func dataSourceAccountConsumedUnitsRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
@@ -53,7 +54,7 @@ func dataSourceAccountConsumedUnitsRead(ctx context.Context, d *schema.ResourceD
|
|||||||
d.Set("cu_i", accountConsumedUnits.CUI)
|
d.Set("cu_i", accountConsumedUnits.CUI)
|
||||||
d.Set("cu_m", accountConsumedUnits.CUM)
|
d.Set("cu_m", accountConsumedUnits.CUM)
|
||||||
d.Set("cu_np", accountConsumedUnits.CUNP)
|
d.Set("cu_np", accountConsumedUnits.CUNP)
|
||||||
d.Set("gpu_units", accountConsumedUnits.GpuUnits)
|
d.Set("gpu_units", accountConsumedUnits.GPUUnits)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@@ -21,12 +22,12 @@ limitations under the License.
|
|||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package account
|
package account
|
||||||
@@ -37,7 +38,7 @@ import (
|
|||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/constants"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
)
|
)
|
||||||
|
|
||||||
func dataSourceAccountConsumedUnitsByTypeRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func dataSourceAccountConsumedUnitsByTypeRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@@ -21,12 +22,12 @@ limitations under the License.
|
|||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package account
|
package account
|
||||||
@@ -37,7 +38,7 @@ import (
|
|||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/constants"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
)
|
)
|
||||||
|
|
||||||
func dataSourceAccountDeletedListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func dataSourceAccountDeletedListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@@ -21,12 +22,12 @@ limitations under the License.
|
|||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
package account
|
package account
|
||||||
|
|
||||||
@@ -36,17 +37,18 @@ import (
|
|||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/constants"
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/account"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
)
|
)
|
||||||
|
|
||||||
func flattenAccountDisksList(adl AccountDisksList) []map[string]interface{} {
|
func flattenAccountDisksList(adl account.ListDisks) []map[string]interface{} {
|
||||||
res := make([]map[string]interface{}, 0)
|
res := make([]map[string]interface{}, 0)
|
||||||
for _, ad := range adl {
|
for _, ad := range adl {
|
||||||
temp := map[string]interface{}{
|
temp := map[string]interface{}{
|
||||||
"disk_id": ad.ID,
|
"disk_id": ad.ID,
|
||||||
"disk_name": ad.Name,
|
"disk_name": ad.Name,
|
||||||
"pool": ad.Pool,
|
"pool": ad.Pool,
|
||||||
"sep_id": ad.SepId,
|
"sep_id": ad.SEPID,
|
||||||
"shareable": ad.Shareable,
|
"shareable": ad.Shareable,
|
||||||
"size_max": ad.SizeMax,
|
"size_max": ad.SizeMax,
|
||||||
"type": ad.Type,
|
"type": ad.Type,
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@@ -21,12 +22,12 @@ limitations under the License.
|
|||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package account
|
package account
|
||||||
@@ -37,14 +38,15 @@ import (
|
|||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/constants"
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/account"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
)
|
)
|
||||||
|
|
||||||
func flattenAccountFlipGroupsList(afgl AccountFlipGroupsList) []map[string]interface{} {
|
func flattenAccountFlipGroupsList(afgl account.ListFLIPGroups) []map[string]interface{} {
|
||||||
res := make([]map[string]interface{}, 0)
|
res := make([]map[string]interface{}, 0)
|
||||||
for _, afg := range afgl {
|
for _, afg := range afgl {
|
||||||
temp := map[string]interface{}{
|
temp := map[string]interface{}{
|
||||||
"account_id": afg.AccountId,
|
"account_id": afg.AccountID,
|
||||||
"client_type": afg.ClientType,
|
"client_type": afg.ClientType,
|
||||||
"conn_type": afg.ConnType,
|
"conn_type": afg.ConnType,
|
||||||
"created_by": afg.CreatedBy,
|
"created_by": afg.CreatedBy,
|
||||||
@@ -52,7 +54,7 @@ func flattenAccountFlipGroupsList(afgl AccountFlipGroupsList) []map[string]inter
|
|||||||
"default_gw": afg.DefaultGW,
|
"default_gw": afg.DefaultGW,
|
||||||
"deleted_by": afg.DeletedBy,
|
"deleted_by": afg.DeletedBy,
|
||||||
"deleted_time": afg.DeletedTime,
|
"deleted_time": afg.DeletedTime,
|
||||||
"desc": afg.Desc,
|
"desc": afg.Description,
|
||||||
"gid": afg.GID,
|
"gid": afg.GID,
|
||||||
"guid": afg.GUID,
|
"guid": afg.GUID,
|
||||||
"fg_id": afg.ID,
|
"fg_id": afg.ID,
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@@ -21,12 +22,12 @@ limitations under the License.
|
|||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package account
|
package account
|
||||||
@@ -37,14 +38,15 @@ import (
|
|||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/constants"
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/account"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
)
|
)
|
||||||
|
|
||||||
func flattenAccountList(al AccountCloudApiList) []map[string]interface{} {
|
func flattenAccountList(al account.ListAccounts) []map[string]interface{} {
|
||||||
res := make([]map[string]interface{}, 0)
|
res := make([]map[string]interface{}, 0)
|
||||||
for _, acc := range al {
|
for _, acc := range al {
|
||||||
temp := map[string]interface{}{
|
temp := map[string]interface{}{
|
||||||
"acl": flattenRgAcl(acc.Acl),
|
"acl": flattenRgAcl(acc.ACL),
|
||||||
"created_time": acc.CreatedTime,
|
"created_time": acc.CreatedTime,
|
||||||
"deleted_time": acc.DeletedTime,
|
"deleted_time": acc.DeletedTime,
|
||||||
"account_id": acc.ID,
|
"account_id": acc.ID,
|
||||||
@@ -57,12 +59,12 @@ func flattenAccountList(al AccountCloudApiList) []map[string]interface{} {
|
|||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
func flattenRgAcl(rgAcls []AccountAclRecord) []map[string]interface{} {
|
func flattenRgAcl(rgAcls []account.RecordACL) []map[string]interface{} {
|
||||||
res := make([]map[string]interface{}, 0)
|
res := make([]map[string]interface{}, 0)
|
||||||
for _, rgAcl := range rgAcls {
|
for _, rgAcl := range rgAcls {
|
||||||
temp := map[string]interface{}{
|
temp := map[string]interface{}{
|
||||||
"explicit": rgAcl.IsExplicit,
|
"explicit": rgAcl.IsExplicit,
|
||||||
"guid": rgAcl.Guid,
|
"guid": rgAcl.GUID,
|
||||||
"right": rgAcl.Rights,
|
"right": rgAcl.Rights,
|
||||||
"status": rgAcl.Status,
|
"status": rgAcl.Status,
|
||||||
"type": rgAcl.Type,
|
"type": rgAcl.Type,
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@@ -21,12 +22,12 @@ limitations under the License.
|
|||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package account
|
package account
|
||||||
@@ -37,7 +38,7 @@ import (
|
|||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/constants"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
)
|
)
|
||||||
|
|
||||||
func dataSourceAccountReservedUnitsRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func dataSourceAccountReservedUnitsRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
@@ -53,7 +54,7 @@ func dataSourceAccountReservedUnitsRead(ctx context.Context, d *schema.ResourceD
|
|||||||
d.Set("cu_i", accountReservedUnits.CUI)
|
d.Set("cu_i", accountReservedUnits.CUI)
|
||||||
d.Set("cu_m", accountReservedUnits.CUM)
|
d.Set("cu_m", accountReservedUnits.CUM)
|
||||||
d.Set("cu_np", accountReservedUnits.CUNP)
|
d.Set("cu_np", accountReservedUnits.CUNP)
|
||||||
d.Set("gpu_units", accountReservedUnits.GpuUnits)
|
d.Set("gpu_units", accountReservedUnits.GPUUnits)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@@ -21,12 +22,12 @@ limitations under the License.
|
|||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package account
|
package account
|
||||||
@@ -37,10 +38,11 @@ import (
|
|||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/constants"
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/account"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
)
|
)
|
||||||
|
|
||||||
func flattenAccountRGList(argl AccountRGList) []map[string]interface{} {
|
func flattenAccountRGList(argl account.ListRG) []map[string]interface{} {
|
||||||
res := make([]map[string]interface{}, 0)
|
res := make([]map[string]interface{}, 0)
|
||||||
for _, arg := range argl {
|
for _, arg := range argl {
|
||||||
temp := map[string]interface{}{
|
temp := map[string]interface{}{
|
||||||
@@ -56,7 +58,7 @@ func flattenAccountRGList(argl AccountRGList) []map[string]interface{} {
|
|||||||
"status": arg.Status,
|
"status": arg.Status,
|
||||||
"updated_by": arg.UpdatedBy,
|
"updated_by": arg.UpdatedBy,
|
||||||
"updated_time": arg.UpdatedTime,
|
"updated_time": arg.UpdatedTime,
|
||||||
"vinses": arg.Vinses,
|
"vinses": arg.VINSes,
|
||||||
}
|
}
|
||||||
res = append(res, temp)
|
res = append(res, temp)
|
||||||
}
|
}
|
||||||
@@ -64,7 +66,7 @@ func flattenAccountRGList(argl AccountRGList) []map[string]interface{} {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func flattenAccRGComputes(argc AccountRGComputes) []map[string]interface{} {
|
func flattenAccRGComputes(argc account.RGComputes) []map[string]interface{} {
|
||||||
res := make([]map[string]interface{}, 0)
|
res := make([]map[string]interface{}, 0)
|
||||||
temp := map[string]interface{}{
|
temp := map[string]interface{}{
|
||||||
"started": argc.Started,
|
"started": argc.Started,
|
||||||
@@ -74,13 +76,13 @@ func flattenAccRGComputes(argc AccountRGComputes) []map[string]interface{} {
|
|||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
func flattenAccResourceHack(r ResourceHack) []map[string]interface{} {
|
func flattenAccResourceHack(r account.LimitsRG) []map[string]interface{} {
|
||||||
res := make([]map[string]interface{}, 0)
|
res := make([]map[string]interface{}, 0)
|
||||||
temp := map[string]interface{}{
|
temp := map[string]interface{}{
|
||||||
"cpu": r.CPU,
|
"cpu": r.CPU,
|
||||||
"disksize": r.Disksize,
|
"disksize": r.DiskSize,
|
||||||
"extips": r.Extips,
|
"extips": r.ExtIPs,
|
||||||
"exttraffic": r.Exttraffic,
|
"exttraffic": r.ExtTraffic,
|
||||||
"gpu": r.GPU,
|
"gpu": r.GPU,
|
||||||
"ram": r.RAM,
|
"ram": r.RAM,
|
||||||
//"seps": flattenAccountSeps(r.SEPs),
|
//"seps": flattenAccountSeps(r.SEPs),
|
||||||
@@ -89,13 +91,13 @@ func flattenAccResourceHack(r ResourceHack) []map[string]interface{} {
|
|||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
func flattenAccResourceRg(r Resource) []map[string]interface{} {
|
func flattenAccResourceRg(r account.Resource) []map[string]interface{} {
|
||||||
res := make([]map[string]interface{}, 0)
|
res := make([]map[string]interface{}, 0)
|
||||||
temp := map[string]interface{}{
|
temp := map[string]interface{}{
|
||||||
"cpu": r.CPU,
|
"cpu": r.CPU,
|
||||||
"disksize": r.Disksize,
|
"disksize": r.DiskSize,
|
||||||
"extips": r.Extips,
|
"extips": r.ExtIPs,
|
||||||
"exttraffic": r.Exttraffic,
|
"exttraffic": r.ExtTraffic,
|
||||||
"gpu": r.GPU,
|
"gpu": r.GPU,
|
||||||
"ram": r.RAM,
|
"ram": r.RAM,
|
||||||
}
|
}
|
||||||
@@ -103,7 +105,7 @@ func flattenAccResourceRg(r Resource) []map[string]interface{} {
|
|||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
func flattenAccRGResources(argr AccountRGResources) []map[string]interface{} {
|
func flattenAccRGResources(argr account.RGResources) []map[string]interface{} {
|
||||||
res := make([]map[string]interface{}, 0)
|
res := make([]map[string]interface{}, 0)
|
||||||
temp := map[string]interface{}{
|
temp := map[string]interface{}{
|
||||||
"consumed": flattenAccResourceRg(argr.Consumed),
|
"consumed": flattenAccResourceRg(argr.Consumed),
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@@ -21,12 +22,12 @@ limitations under the License.
|
|||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package account
|
package account
|
||||||
@@ -37,16 +38,17 @@ import (
|
|||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/constants"
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/account"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
)
|
)
|
||||||
|
|
||||||
func flattenAccountTemplatesList(atl AccountTemplatesList) []map[string]interface{} {
|
func flattenAccountTemplatesList(atl account.ListTemplates) []map[string]interface{} {
|
||||||
res := make([]map[string]interface{}, 0)
|
res := make([]map[string]interface{}, 0)
|
||||||
for _, at := range atl {
|
for _, at := range atl {
|
||||||
temp := map[string]interface{}{
|
temp := map[string]interface{}{
|
||||||
"unc_path": at.UNCPath,
|
"unc_path": at.UNCPath,
|
||||||
"account_id": at.AccountId,
|
"account_id": at.AccountID,
|
||||||
"desc": at.Desc,
|
"desc": at.Description,
|
||||||
"template_id": at.ID,
|
"template_id": at.ID,
|
||||||
"template_name": at.Name,
|
"template_name": at.Name,
|
||||||
"public": at.Public,
|
"public": at.Public,
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@@ -21,12 +22,12 @@ limitations under the License.
|
|||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package account
|
package account
|
||||||
@@ -37,14 +38,15 @@ import (
|
|||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/constants"
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/account"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
)
|
)
|
||||||
|
|
||||||
func flattenAccountVinsList(avl AccountVinsList) []map[string]interface{} {
|
func flattenAccountVinsList(avl account.ListVINS) []map[string]interface{} {
|
||||||
res := make([]map[string]interface{}, 0)
|
res := make([]map[string]interface{}, 0)
|
||||||
for _, av := range avl {
|
for _, av := range avl {
|
||||||
temp := map[string]interface{}{
|
temp := map[string]interface{}{
|
||||||
"account_id": av.AccountId,
|
"account_id": av.AccountID,
|
||||||
"account_name": av.AccountName,
|
"account_name": av.AccountName,
|
||||||
"computes": av.Computes,
|
"computes": av.Computes,
|
||||||
"created_by": av.CreatedBy,
|
"created_by": av.CreatedBy,
|
||||||
@@ -55,9 +57,9 @@ func flattenAccountVinsList(avl AccountVinsList) []map[string]interface{} {
|
|||||||
"vin_id": av.ID,
|
"vin_id": av.ID,
|
||||||
"vin_name": av.Name,
|
"vin_name": av.Name,
|
||||||
"network": av.Network,
|
"network": av.Network,
|
||||||
"pri_vnf_dev_id": av.PriVnfDevId,
|
"pri_vnf_dev_id": av.PriVNFDevID,
|
||||||
"rg_id": av.RgId,
|
"rg_id": av.RGID,
|
||||||
"rg_name": av.RgName,
|
"rg_name": av.RGName,
|
||||||
"status": av.Status,
|
"status": av.Status,
|
||||||
"updated_by": av.UpdatedBy,
|
"updated_by": av.UpdatedBy,
|
||||||
"updated_time": av.UpdatedTime,
|
"updated_time": av.UpdatedTime,
|
||||||
|
|||||||
137
internal/service/cloudapi/account/flattens.go
Normal file
137
internal/service/cloudapi/account/flattens.go
Normal file
@@ -0,0 +1,137 @@
|
|||||||
|
package account
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/account"
|
||||||
|
)
|
||||||
|
|
||||||
|
func flattenAccount(d *schema.ResourceData, acc account.RecordAccount) error {
|
||||||
|
d.Set("dc_location", acc.DCLocation)
|
||||||
|
d.Set("resources", flattenAccResources(acc.Resources))
|
||||||
|
d.Set("ckey", acc.CKey)
|
||||||
|
d.Set("acl", flattenAccAcl(acc.ACL))
|
||||||
|
d.Set("company", acc.Company)
|
||||||
|
d.Set("companyurl", acc.CompanyURL)
|
||||||
|
d.Set("created_by", acc.CreatedBy)
|
||||||
|
d.Set("created_time", acc.CreatedTime)
|
||||||
|
d.Set("deactivation_time", acc.DeactivationTime)
|
||||||
|
d.Set("deleted_by", acc.DeletedBy)
|
||||||
|
d.Set("deleted_time", acc.DeletedTime)
|
||||||
|
d.Set("displayname", acc.DisplayName)
|
||||||
|
d.Set("guid", acc.GUID)
|
||||||
|
d.Set("account_id", acc.ID)
|
||||||
|
d.Set("account_name", acc.Name)
|
||||||
|
d.Set("resource_limits", flattenRgResourceLimits(acc.ResourceLimits))
|
||||||
|
d.Set("send_access_emails", acc.SendAccessEmails)
|
||||||
|
d.Set("status", acc.Status)
|
||||||
|
d.Set("updated_time", acc.UpdatedTime)
|
||||||
|
d.Set("version", acc.Version)
|
||||||
|
d.Set("vins", acc.VINS)
|
||||||
|
d.Set("vinses", acc.VINSes)
|
||||||
|
d.Set("computes", flattenAccComputes(acc.Computes))
|
||||||
|
d.Set("machines", flattenAccMachines(acc.Machines))
|
||||||
|
d.Set("cpu_allocation_parameter", acc.CPUAllocationParameter)
|
||||||
|
d.Set("cpu_allocation_ratio", acc.CPUAllocationRatio)
|
||||||
|
|
||||||
|
if username, ok := d.GetOk("username"); ok {
|
||||||
|
d.Set("username", username)
|
||||||
|
} else {
|
||||||
|
d.Set("username", acc.ACL[0].UgroupID)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func flattenAccComputes(acs account.Computes) []map[string]interface{} {
|
||||||
|
res := make([]map[string]interface{}, 0)
|
||||||
|
temp := map[string]interface{}{
|
||||||
|
"started": acs.Started,
|
||||||
|
"stopped": acs.Stopped,
|
||||||
|
}
|
||||||
|
res = append(res, temp)
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
func flattenAccMachines(ams account.Machines) []map[string]interface{} {
|
||||||
|
res := make([]map[string]interface{}, 0)
|
||||||
|
temp := map[string]interface{}{
|
||||||
|
"running": ams.Running,
|
||||||
|
"halted": ams.Halted,
|
||||||
|
}
|
||||||
|
res = append(res, temp)
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
func flattenAccAcl(acls []account.RecordACL) []map[string]interface{} {
|
||||||
|
res := make([]map[string]interface{}, 0)
|
||||||
|
for _, acls := range acls {
|
||||||
|
temp := map[string]interface{}{
|
||||||
|
"can_be_deleted": acls.CanBeDeleted,
|
||||||
|
"explicit": acls.IsExplicit,
|
||||||
|
"guid": acls.GUID,
|
||||||
|
"right": acls.Rights,
|
||||||
|
"status": acls.Status,
|
||||||
|
"type": acls.Type,
|
||||||
|
"user_group_id": acls.UgroupID,
|
||||||
|
}
|
||||||
|
res = append(res, temp)
|
||||||
|
}
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
func flattenRgResourceLimits(rl account.ResourceLimits) []map[string]interface{} {
|
||||||
|
res := make([]map[string]interface{}, 0)
|
||||||
|
temp := map[string]interface{}{
|
||||||
|
"cu_c": rl.CUC,
|
||||||
|
"cu_d": rl.CUD,
|
||||||
|
"cu_i": rl.CUI,
|
||||||
|
"cu_m": rl.CUM,
|
||||||
|
"cu_np": rl.CUNP,
|
||||||
|
"gpu_units": rl.GPUUnits,
|
||||||
|
}
|
||||||
|
res = append(res, temp)
|
||||||
|
|
||||||
|
return res
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func flattenAccResources(r account.Resources) []map[string]interface{} {
|
||||||
|
res := make([]map[string]interface{}, 0)
|
||||||
|
temp := map[string]interface{}{
|
||||||
|
"current": flattenAccResource(r.Current),
|
||||||
|
"reserved": flattenAccResource(r.Reserved),
|
||||||
|
}
|
||||||
|
res = append(res, temp)
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
func flattenAccountSeps(seps map[string]map[string]account.DiskUsage) []map[string]interface{} {
|
||||||
|
res := make([]map[string]interface{}, 0)
|
||||||
|
for sepKey, sepVal := range seps {
|
||||||
|
for dataKey, dataVal := range sepVal {
|
||||||
|
temp := map[string]interface{}{
|
||||||
|
"sep_id": sepKey,
|
||||||
|
"data_name": dataKey,
|
||||||
|
"disk_size": dataVal.DiskSize,
|
||||||
|
"disk_size_max": dataVal.DiskSizeMax,
|
||||||
|
}
|
||||||
|
res = append(res, temp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
func flattenAccResource(r account.Resource) []map[string]interface{} {
|
||||||
|
res := make([]map[string]interface{}, 0)
|
||||||
|
temp := map[string]interface{}{
|
||||||
|
"cpu": r.CPU,
|
||||||
|
"disksize": r.DiskSize,
|
||||||
|
"extips": r.ExtIPs,
|
||||||
|
"exttraffic": r.ExtTraffic,
|
||||||
|
"gpu": r.GPU,
|
||||||
|
"ram": r.RAM,
|
||||||
|
"seps": flattenAccountSeps(r.SEPs),
|
||||||
|
}
|
||||||
|
res = append(res, temp)
|
||||||
|
return res
|
||||||
|
}
|
||||||
@@ -1,276 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|
||||||
Authors:
|
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
|
||||||
builds seamlessly.
|
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
|
||||||
*/
|
|
||||||
|
|
||||||
package account
|
|
||||||
|
|
||||||
type AccountAclRecord struct {
|
|
||||||
IsExplicit bool `json:"explicit"`
|
|
||||||
Guid string `json:"guid"`
|
|
||||||
Rights string `json:"right"`
|
|
||||||
Status string `json:"status"`
|
|
||||||
Type string `json:"type"`
|
|
||||||
UgroupID string `json:"userGroupId"`
|
|
||||||
CanBeDeleted bool `json:"canBeDeleted"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type ResourceLimits struct {
|
|
||||||
CUC float64 `json:"CU_C"`
|
|
||||||
CUD float64 `json:"CU_D"`
|
|
||||||
CUI float64 `json:"CU_I"`
|
|
||||||
CUM float64 `json:"CU_M"`
|
|
||||||
CUNP float64 `json:"CU_NP"`
|
|
||||||
GpuUnits float64 `json:"gpu_units"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type Account struct {
|
|
||||||
DCLocation string `json:"DCLocation"`
|
|
||||||
CKey string `jspn:"_ckey"`
|
|
||||||
Meta []interface{} `json:"_meta"`
|
|
||||||
Acl []AccountAclRecord `json:"acl"`
|
|
||||||
Company string `json:"company"`
|
|
||||||
CompanyUrl string `json:"companyurl"`
|
|
||||||
CreatedBy string `jspn:"createdBy"`
|
|
||||||
CreatedTime int `json:"createdTime"`
|
|
||||||
DeactiovationTime float64 `json:"deactivationTime"`
|
|
||||||
DeletedBy string `json:"deletedBy"`
|
|
||||||
DeletedTime int `json:"deletedTime"`
|
|
||||||
DisplayName string `json:"displayname"`
|
|
||||||
GUID int `json:"guid"`
|
|
||||||
ID int `json:"id"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
ResourceLimits ResourceLimits `json:"resourceLimits"`
|
|
||||||
SendAccessEmails bool `json:"sendAccessEmails"`
|
|
||||||
ServiceAccount bool `json:"serviceAccount"`
|
|
||||||
Status string `json:"status"`
|
|
||||||
UpdatedTime int `json:"updatedTime"`
|
|
||||||
Version int `json:"version"`
|
|
||||||
Vins []int `json:"vins"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AccountList []Account
|
|
||||||
|
|
||||||
type AccountCloudApi struct {
|
|
||||||
Acl []AccountAclRecord `json:"acl"`
|
|
||||||
CreatedTime int `json:"createdTime"`
|
|
||||||
DeletedTime int `json:"deletedTime"`
|
|
||||||
ID int `json:"id"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
Status string `json:"status"`
|
|
||||||
UpdatedTime int `json:"updatedTime"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AccountCloudApiList []AccountCloudApi
|
|
||||||
|
|
||||||
type ResourceSep struct {
|
|
||||||
DiskSize float64 `json:"disksize"`
|
|
||||||
DiskSizeMax int `json:"disksizemax"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type Resource struct {
|
|
||||||
CPU int `json:"cpu"`
|
|
||||||
Disksize float64 `json:"disksize"`
|
|
||||||
Extips int `json:"extips"`
|
|
||||||
Exttraffic int `json:"exttraffic"`
|
|
||||||
GPU int `json:"gpu"`
|
|
||||||
RAM int `json:"ram"`
|
|
||||||
SEPs map[string]map[string]ResourceSep `json:"seps"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type Resources struct {
|
|
||||||
Current Resource `json:"Current"`
|
|
||||||
Reserved Resource `json:"Reserved"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type Computes struct {
|
|
||||||
Started int `json:"started"`
|
|
||||||
Stopped int `json:"stopped"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type Machines struct {
|
|
||||||
Running int `json:"running"`
|
|
||||||
Halted int `json:"halted"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AccountWithResources struct {
|
|
||||||
Account
|
|
||||||
Resources Resources `json:"Resources"`
|
|
||||||
Computes Computes `json:"computes"`
|
|
||||||
Machines Machines `json:"machines"`
|
|
||||||
Vinses int `json:"vinses"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AccountCompute struct {
|
|
||||||
AccountId int `json:"accountId"`
|
|
||||||
AccountName string `json:"accountName"`
|
|
||||||
CPUs int `json:"cpus"`
|
|
||||||
CreatedBy string `json:"createdBy"`
|
|
||||||
CreatedTime int `json:"createdTime"`
|
|
||||||
DeletedBy string `json:"deletedBy"`
|
|
||||||
DeletedTime int `json:"deletedTime"`
|
|
||||||
ComputeId int `json:"id"`
|
|
||||||
ComputeName string `json:"name"`
|
|
||||||
RAM int `json:"ram"`
|
|
||||||
Registered bool `json:"registered"`
|
|
||||||
RgId int `json:"rgId"`
|
|
||||||
RgName string `json:"rgName"`
|
|
||||||
Status string `json:"status"`
|
|
||||||
TechStatus string `json:"techStatus"`
|
|
||||||
TotalDisksSize int `json:"totalDisksSize"`
|
|
||||||
UpdatedBy string `json:"updatedBy"`
|
|
||||||
UpdatedTime int `json:"updatedTime"`
|
|
||||||
UserManaged bool `json:"userManaged"`
|
|
||||||
VinsConnected int `json:"vinsConnected"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AccountComputesList []AccountCompute
|
|
||||||
|
|
||||||
type AccountDisk struct {
|
|
||||||
ID int `json:"id"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
Pool string `json:"pool"`
|
|
||||||
SepId int `json:"sepId"`
|
|
||||||
Shareable bool `json:"shareable"`
|
|
||||||
SizeMax int `json:"sizeMax"`
|
|
||||||
Type string `json:"type"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AccountDisksList []AccountDisk
|
|
||||||
|
|
||||||
type AccountVin struct {
|
|
||||||
AccountId int `json:"accountId"`
|
|
||||||
AccountName string `json:"accountName"`
|
|
||||||
Computes int `json:"computes"`
|
|
||||||
CreatedBy string `json:"createdBy"`
|
|
||||||
CreatedTime int `json:"createdTime"`
|
|
||||||
DeletedBy string `json:"deletedBy"`
|
|
||||||
DeletedTime int `json:"deletedTime"`
|
|
||||||
ExternalIP string `json:"externalIP"`
|
|
||||||
ID int `json:"id"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
Network string `json:"network"`
|
|
||||||
PriVnfDevId int `json:"priVnfDevId"`
|
|
||||||
RgId int `json:"rgId"`
|
|
||||||
RgName string `json:"rgName"`
|
|
||||||
Status string `json:"status"`
|
|
||||||
UpdatedBy string `json:"updatedBy"`
|
|
||||||
UpdatedTime int `json:"updatedTime"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AccountVinsList []AccountVin
|
|
||||||
|
|
||||||
type AccountAudit struct {
|
|
||||||
Call string `json:"call"`
|
|
||||||
ResponseTime float64 `json:"responsetime"`
|
|
||||||
StatusCode int `json:"statuscode"`
|
|
||||||
Timestamp float64 `json:"timestamp"`
|
|
||||||
User string `json:"user"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AccountAuditsList []AccountAudit
|
|
||||||
|
|
||||||
type AccountRGComputes struct {
|
|
||||||
Started int `json:"Started"`
|
|
||||||
Stopped int `json:"Stopped"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type ResourceHack struct {
|
|
||||||
CPU int `json:"cpu"`
|
|
||||||
Disksize float64 `json:"disksize"`
|
|
||||||
Extips int `json:"extips"`
|
|
||||||
Exttraffic int `json:"exttraffic"`
|
|
||||||
GPU int `json:"gpu"`
|
|
||||||
RAM int `json:"ram"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AccountRGResources struct {
|
|
||||||
Consumed Resource `json:"Consumed"`
|
|
||||||
Limits ResourceHack `json:"Limits"`
|
|
||||||
Reserved Resource `json:"Reserved"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AccountRG struct {
|
|
||||||
Computes AccountRGComputes `json:"Computes"`
|
|
||||||
Resources AccountRGResources `json:"Resources"`
|
|
||||||
CreatedBy string `json:"createdBy"`
|
|
||||||
CreatedTime int `json:"createdTime"`
|
|
||||||
DeletedBy string `json:"deletedBy"`
|
|
||||||
DeletedTime int `json:"deletedTime"`
|
|
||||||
RGID int `json:"id"`
|
|
||||||
Milestones int `json:"milestones"`
|
|
||||||
RGName string `json:"name"`
|
|
||||||
Status string `json:"status"`
|
|
||||||
UpdatedBy string `json:"updatedBy"`
|
|
||||||
UpdatedTime int `json:"updatedTime"`
|
|
||||||
Vinses int `json:"vinses"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AccountRGList []AccountRG
|
|
||||||
|
|
||||||
type AccountTemplate struct {
|
|
||||||
UNCPath string `json:"UNCPath"`
|
|
||||||
AccountId int `json:"accountId"`
|
|
||||||
Desc string `json:"desc"`
|
|
||||||
ID int `json:"id"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
Public bool `json:"public"`
|
|
||||||
Size int `json:"size"`
|
|
||||||
Status string `json:"status"`
|
|
||||||
Type string `json:"type"`
|
|
||||||
Username string `json:"username"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AccountTemplatesList []AccountTemplate
|
|
||||||
|
|
||||||
type AccountFlipGroup struct {
|
|
||||||
AccountId int `json:"accountId"`
|
|
||||||
ClientType string `json:"clientType"`
|
|
||||||
ConnType string `json:"connType"`
|
|
||||||
CreatedBy string `json:"createdBy"`
|
|
||||||
CreatedTime int `json:"createdTime"`
|
|
||||||
DefaultGW string `json:"defaultGW"`
|
|
||||||
DeletedBy string `json:"deletedBy"`
|
|
||||||
DeletedTime int `json:"deletedTime"`
|
|
||||||
Desc string `json:"desc"`
|
|
||||||
GID int `json:"gid"`
|
|
||||||
GUID int `json:"guid"`
|
|
||||||
ID int `json:"id"`
|
|
||||||
IP string `json:"ip"`
|
|
||||||
Milestones int `json:"milestones"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
NetID int `json:"netId"`
|
|
||||||
NetType string `json:"netType"`
|
|
||||||
NetMask int `json:"netmask"`
|
|
||||||
Status string `json:"status"`
|
|
||||||
UpdatedBy string `json:"updatedBy"`
|
|
||||||
UpdatedTime int `json:"updatedTime"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AccountFlipGroupsList []AccountFlipGroup
|
|
||||||
@@ -3,6 +3,7 @@ Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@@ -21,130 +22,131 @@ limitations under the License.
|
|||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package account
|
package account
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"net/url"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/constants"
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/controller"
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/flattens"
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/account"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/status"
|
||||||
)
|
)
|
||||||
|
|
||||||
func resourceAccountCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func resourceAccountCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
log.Debugf("resourceAccountCreate")
|
log.Debugf("resourceAccountCreate")
|
||||||
|
|
||||||
c := m.(*controller.ControllerCfg)
|
c := m.(*controller.ControllerCfg)
|
||||||
urlValues := &url.Values{}
|
req := account.CreateRequest{}
|
||||||
|
|
||||||
urlValues.Add("name", d.Get("account_name").(string))
|
req.Name = d.Get("account_name").(string)
|
||||||
urlValues.Add("username", d.Get("username").(string))
|
req.Username = d.Get("username").(string)
|
||||||
|
|
||||||
if emailaddress, ok := d.GetOk("emailaddress"); ok {
|
if emailaddress, ok := d.GetOk("emailaddress"); ok {
|
||||||
urlValues.Add("emailaddress", emailaddress.(string))
|
req.EmailAddress = emailaddress.(string)
|
||||||
}
|
}
|
||||||
if sendAccessEmails, ok := d.GetOk("send_access_emails"); ok {
|
if sendAccessEmails, ok := d.GetOk("send_access_emails"); ok {
|
||||||
urlValues.Add("sendAccessEmails", strconv.FormatBool(sendAccessEmails.(bool)))
|
req.SendAccessEmails = sendAccessEmails.(bool)
|
||||||
}
|
}
|
||||||
|
|
||||||
if resLimits, ok := d.GetOk("resource_limits"); ok {
|
if resLimits, ok := d.GetOk("resource_limits"); ok {
|
||||||
resLimit := resLimits.([]interface{})[0]
|
resLimit := resLimits.([]interface{})[0]
|
||||||
resLimitConv := resLimit.(map[string]interface{})
|
resLimitConv := resLimit.(map[string]interface{})
|
||||||
if resLimitConv["cu_m"] != nil {
|
if resLimitConv["cu_m"] != nil {
|
||||||
maxMemCap := int(resLimitConv["cu_m"].(float64))
|
maxMemCap := int(resLimitConv["cu_m"].(float64))
|
||||||
if maxMemCap == 0 {
|
if maxMemCap == 0 {
|
||||||
urlValues.Add("maxMemoryCapacity", strconv.Itoa(-1))
|
req.MaxMemoryCapacity = -1
|
||||||
} else {
|
} else {
|
||||||
urlValues.Add("maxMemoryCapacity", strconv.Itoa(maxMemCap))
|
req.MaxMemoryCapacity = int64(maxMemCap)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if resLimitConv["cu_d"] != nil {
|
if resLimitConv["cu_d"] != nil {
|
||||||
maxDiskCap := int(resLimitConv["cu_d"].(float64))
|
maxDiskCap := int(resLimitConv["cu_d"].(float64))
|
||||||
if maxDiskCap == 0 {
|
if maxDiskCap == 0 {
|
||||||
urlValues.Add("maxVDiskCapacity", strconv.Itoa(-1))
|
req.MaxVDiskCapacity = -1
|
||||||
} else {
|
} else {
|
||||||
urlValues.Add("maxVDiskCapacity", strconv.Itoa(maxDiskCap))
|
req.MaxVDiskCapacity = int64(maxDiskCap)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if resLimitConv["cu_c"] != nil {
|
if resLimitConv["cu_c"] != nil {
|
||||||
maxCPUCap := int(resLimitConv["cu_c"].(float64))
|
maxCPUCap := int(resLimitConv["cu_c"].(float64))
|
||||||
if maxCPUCap == 0 {
|
if maxCPUCap == 0 {
|
||||||
urlValues.Add("maxCPUCapacity", strconv.Itoa(-1))
|
req.MaxCPUCapacity = -1
|
||||||
} else {
|
} else {
|
||||||
urlValues.Add("maxCPUCapacity", strconv.Itoa(maxCPUCap))
|
req.MaxCPUCapacity = int64(maxCPUCap)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if resLimitConv["cu_i"] != nil {
|
if resLimitConv["cu_i"] != nil {
|
||||||
maxNumPublicIP := int(resLimitConv["cu_i"].(float64))
|
maxNumPublicIP := int(resLimitConv["cu_i"].(float64))
|
||||||
if maxNumPublicIP == 0 {
|
if maxNumPublicIP == 0 {
|
||||||
urlValues.Add("maxNumPublicIP", strconv.Itoa(-1))
|
req.MaxNumPublicIP = -1
|
||||||
} else {
|
} else {
|
||||||
urlValues.Add("maxNumPublicIP", strconv.Itoa(maxNumPublicIP))
|
req.MaxNumPublicIP = int64(maxNumPublicIP)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if resLimitConv["cu_np"] != nil {
|
if resLimitConv["cu_np"] != nil {
|
||||||
maxNP := int(resLimitConv["cu_np"].(float64))
|
maxNP := int(resLimitConv["cu_np"].(float64))
|
||||||
if maxNP == 0 {
|
if maxNP == 0 {
|
||||||
urlValues.Add("maxNetworkPeerTransfer", strconv.Itoa(-1))
|
req.MaxNetworkPeerTransfer = -1
|
||||||
} else {
|
} else {
|
||||||
urlValues.Add("maxNetworkPeerTransfer", strconv.Itoa(maxNP))
|
req.MaxNetworkPeerTransfer = int64(maxNP)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if resLimitConv["gpu_units"] != nil {
|
if resLimitConv["gpu_units"] != nil {
|
||||||
gpuUnits := int(resLimitConv["gpu_units"].(float64))
|
gpuUnits := int(resLimitConv["gpu_units"].(float64))
|
||||||
if gpuUnits == 0 {
|
if gpuUnits == 0 {
|
||||||
urlValues.Add("gpu_units", strconv.Itoa(-1))
|
req.GPUUnits = -1
|
||||||
} else {
|
} else {
|
||||||
urlValues.Add("gpu_units", strconv.Itoa(gpuUnits))
|
req.GPUUnits = int64(gpuUnits)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
accountId, err := c.DecortAPICall(ctx, "POST", accountCreateAPI, urlValues)
|
accountId, err := c.CloudAPI().Account().Create(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
d.SetId(accountId)
|
d.SetId(strconv.FormatUint(accountId, 10))
|
||||||
d.Set("account_id", accountId)
|
d.Set("account_id", accountId)
|
||||||
|
|
||||||
diagnostics := resourceAccountRead(ctx, d, m)
|
|
||||||
if diagnostics != nil {
|
|
||||||
return diagnostics
|
|
||||||
}
|
|
||||||
|
|
||||||
urlValues = &url.Values{}
|
|
||||||
|
|
||||||
if enable, ok := d.GetOk("enable"); ok {
|
if enable, ok := d.GetOk("enable"); ok {
|
||||||
api := accountDisableAPI
|
reqSwitch := account.DisableEnableRequest{
|
||||||
|
AccountID: accountId,
|
||||||
|
}
|
||||||
enable := enable.(bool)
|
enable := enable.(bool)
|
||||||
|
|
||||||
if enable {
|
if enable {
|
||||||
api = accountEnableAPI
|
|
||||||
}
|
|
||||||
urlValues.Add("accountId", strconv.Itoa(d.Get("account_id").(int)))
|
|
||||||
|
|
||||||
_, err := c.DecortAPICall(ctx, "POST", api, urlValues)
|
_, err := c.CloudAPI().Account().Enable(ctx, reqSwitch)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
|
||||||
|
|
||||||
urlValues = &url.Values{}
|
} else {
|
||||||
|
|
||||||
|
_, err := c.CloudAPI().Account().Disable(ctx, reqSwitch)
|
||||||
|
if err != nil {
|
||||||
|
return diag.FromErr(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if users, ok := d.GetOk("users"); ok {
|
if users, ok := d.GetOk("users"); ok {
|
||||||
@@ -153,117 +155,176 @@ func resourceAccountCreate(ctx context.Context, d *schema.ResourceData, m interf
|
|||||||
if len(addedUsers) > 0 {
|
if len(addedUsers) > 0 {
|
||||||
for _, user := range addedUsers {
|
for _, user := range addedUsers {
|
||||||
userConv := user.(map[string]interface{})
|
userConv := user.(map[string]interface{})
|
||||||
urlValues.Add("accountId", strconv.Itoa(d.Get("account_id").(int)))
|
|
||||||
urlValues.Add("userId", userConv["user_id"].(string))
|
req := account.AddUserRequest{
|
||||||
urlValues.Add("accesstype", strings.ToUpper(userConv["access_type"].(string)))
|
AccountID: accountId,
|
||||||
_, err := c.DecortAPICall(ctx, "POST", accountAddUserAPI, urlValues)
|
UserID: userConv["user_id"].(string),
|
||||||
|
AccessType: strings.ToUpper(userConv["access_type"].(string)),
|
||||||
|
}
|
||||||
|
_, err := c.CloudAPI().Account().AddUser(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
urlValues = &url.Values{}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return resourceAccountRead(ctx, d, m)
|
||||||
}
|
}
|
||||||
|
|
||||||
func resourceAccountRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func resourceAccountRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
log.Debugf("resourceAccountRead")
|
log.Debugf("resourceAccountRead: called for account with ID: %v", d.Id())
|
||||||
|
|
||||||
|
c := m.(*controller.ControllerCfg)
|
||||||
|
|
||||||
acc, err := utilityAccountCheckPresence(ctx, d, m)
|
acc, err := utilityAccountCheckPresence(ctx, d, m)
|
||||||
if acc == nil {
|
if err != nil {
|
||||||
d.SetId("")
|
d.SetId("")
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
d.Set("dc_location", acc.DCLocation)
|
hasChanged := false
|
||||||
d.Set("resources", flattenAccResources(acc.Resources))
|
|
||||||
d.Set("ckey", acc.CKey)
|
switch acc.Status {
|
||||||
d.Set("meta", flattens.FlattenMeta(acc.Meta))
|
case status.Destroyed:
|
||||||
d.Set("acl", flattenAccAcl(acc.Acl))
|
d.SetId("")
|
||||||
d.Set("company", acc.Company)
|
return resourceAccountCreate(ctx, d, m)
|
||||||
d.Set("companyurl", acc.CompanyUrl)
|
case status.Destroying:
|
||||||
d.Set("created_by", acc.CreatedBy)
|
return diag.Errorf("The account is in progress with status: %s", acc.Status)
|
||||||
d.Set("created_time", acc.CreatedTime)
|
case status.Deleted:
|
||||||
d.Set("deactivation_time", acc.DeactiovationTime)
|
id, _ := strconv.ParseUint(d.Id(), 10, 64)
|
||||||
d.Set("deleted_by", acc.DeletedBy)
|
|
||||||
d.Set("deleted_time", acc.DeletedTime)
|
req := account.RestoreRequest{
|
||||||
d.Set("displayname", acc.DisplayName)
|
AccountID: id,
|
||||||
d.Set("guid", acc.GUID)
|
}
|
||||||
d.Set("account_id", acc.ID)
|
|
||||||
d.Set("account_name", acc.Name)
|
_, err := c.CloudAPI().Account().Restore(ctx, req)
|
||||||
d.Set("resource_limits", flattenRgResourceLimits(acc.ResourceLimits))
|
if err != nil {
|
||||||
d.Set("send_access_emails", acc.SendAccessEmails)
|
return diag.FromErr(err)
|
||||||
d.Set("service_account", acc.ServiceAccount)
|
}
|
||||||
d.Set("status", acc.Status)
|
|
||||||
d.Set("updated_time", acc.UpdatedTime)
|
hasChanged = true
|
||||||
d.Set("version", acc.Version)
|
case status.Disabled:
|
||||||
d.Set("vins", acc.Vins)
|
log.Debugf("The account is in status: %s, troubles may occur with update. Please, enable account first.", acc.Status)
|
||||||
d.Set("vinses", acc.Vinses)
|
case status.Confirmed:
|
||||||
d.Set("computes", flattenAccComputes(acc.Computes))
|
}
|
||||||
d.Set("machines", flattenAccMachines(acc.Machines))
|
|
||||||
|
if hasChanged {
|
||||||
|
acc, err = utilityAccountCheckPresence(ctx, d, m)
|
||||||
|
if err != nil {
|
||||||
|
d.SetId("")
|
||||||
|
return diag.FromErr(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
flattenAccount(d, *acc)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func resourceAccountDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func resourceAccountDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
log.Debugf("resourceAccountDelete")
|
log.Debugf("resourceAccountDelete")
|
||||||
|
|
||||||
account, err := utilityAccountCheckPresence(ctx, d, m)
|
|
||||||
if account == nil {
|
|
||||||
if err != nil {
|
|
||||||
return diag.FromErr(err)
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
c := m.(*controller.ControllerCfg)
|
c := m.(*controller.ControllerCfg)
|
||||||
urlValues := &url.Values{}
|
|
||||||
urlValues.Add("accountId", strconv.Itoa(d.Get("account_id").(int)))
|
|
||||||
urlValues.Add("permanently", strconv.FormatBool(d.Get("permanently").(bool)))
|
|
||||||
|
|
||||||
_, err = c.DecortAPICall(ctx, "POST", accountDeleteAPI, urlValues)
|
_, err := utilityAccountCheckPresence(ctx, d, m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
req := account.DeleteRequest{
|
||||||
|
AccountID: uint64(d.Get("account_id").(int)),
|
||||||
|
Permanently: d.Get("permanently").(bool),
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err = c.CloudAPI().Account().Delete(ctx, req)
|
||||||
|
if err != nil {
|
||||||
|
return diag.FromErr(err)
|
||||||
|
}
|
||||||
|
|
||||||
d.SetId("")
|
d.SetId("")
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func resourceAccountEdit(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func resourceAccountUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
log.Debugf("resourceAccountEdit")
|
log.Debugf("resourceAccountUpdate")
|
||||||
c := m.(*controller.ControllerCfg)
|
c := m.(*controller.ControllerCfg)
|
||||||
|
|
||||||
urlValues := &url.Values{}
|
acc, err := utilityAccountCheckPresence(ctx, d, m)
|
||||||
if d.HasChange("enable") {
|
if err != nil {
|
||||||
api := accountDisableAPI
|
d.SetId("")
|
||||||
enable := d.Get("enable").(bool)
|
return diag.FromErr(err)
|
||||||
if enable {
|
}
|
||||||
api = accountEnableAPI
|
|
||||||
}
|
|
||||||
urlValues.Add("accountId", strconv.Itoa(d.Get("account_id").(int)))
|
|
||||||
|
|
||||||
_, err := c.DecortAPICall(ctx, "POST", api, urlValues)
|
accountId, _ := strconv.ParseUint(d.Id(), 10, 64)
|
||||||
|
|
||||||
|
hasChanged := false
|
||||||
|
|
||||||
|
switch acc.Status {
|
||||||
|
case status.Destroyed:
|
||||||
|
d.SetId("")
|
||||||
|
return resourceAccountCreate(ctx, d, m)
|
||||||
|
case status.Destroying:
|
||||||
|
return diag.Errorf("The account is in progress with status: %s", acc.Status)
|
||||||
|
case status.Deleted:
|
||||||
|
|
||||||
|
req := account.RestoreRequest{
|
||||||
|
AccountID: accountId,
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err := c.CloudAPI().Account().Restore(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
urlValues = &url.Values{}
|
hasChanged = true
|
||||||
|
case status.Disabled:
|
||||||
|
log.Debugf("The account is in status: %s, troubles may occur with update. Please, enable account first.", acc.Status)
|
||||||
|
case status.Confirmed:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if hasChanged {
|
||||||
|
acc, err = utilityAccountCheckPresence(ctx, d, m)
|
||||||
|
if err != nil {
|
||||||
|
d.SetId("")
|
||||||
|
return diag.FromErr(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if d.HasChange("enable") {
|
||||||
|
reqSwitch := account.DisableEnableRequest{
|
||||||
|
AccountID: accountId,
|
||||||
|
}
|
||||||
|
enable := d.Get("enable").(bool)
|
||||||
|
|
||||||
|
if enable {
|
||||||
|
|
||||||
|
_, err := c.CloudAPI().Account().Enable(ctx, reqSwitch)
|
||||||
|
if err != nil {
|
||||||
|
return diag.FromErr(err)
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
_, err := c.CloudAPI().Account().Disable(ctx, reqSwitch)
|
||||||
|
if err != nil {
|
||||||
|
return diag.FromErr(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
req := account.UpdateRequest{
|
||||||
|
AccountID: accountId,
|
||||||
|
}
|
||||||
|
|
||||||
|
updated := false
|
||||||
|
|
||||||
if d.HasChange("account_name") {
|
if d.HasChange("account_name") {
|
||||||
urlValues.Add("name", d.Get("account_name").(string))
|
req.Name = d.Get("account_name").(string)
|
||||||
urlValues.Add("accountId", strconv.Itoa(d.Get("account_id").(int)))
|
updated = true
|
||||||
_, err := c.DecortAPICall(ctx, "POST", accountUpdateAPI, urlValues)
|
|
||||||
if err != nil {
|
|
||||||
return diag.FromErr(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
urlValues = &url.Values{}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if d.HasChange("resource_limits") {
|
if d.HasChange("resource_limits") {
|
||||||
resLimit := d.Get("resource_limits").([]interface{})[0]
|
resLimit := d.Get("resource_limits").([]interface{})[0]
|
||||||
resLimitConv := resLimit.(map[string]interface{})
|
resLimitConv := resLimit.(map[string]interface{})
|
||||||
@@ -271,85 +332,83 @@ func resourceAccountEdit(ctx context.Context, d *schema.ResourceData, m interfac
|
|||||||
if resLimitConv["cu_m"] != nil {
|
if resLimitConv["cu_m"] != nil {
|
||||||
maxMemCap := int(resLimitConv["cu_m"].(float64))
|
maxMemCap := int(resLimitConv["cu_m"].(float64))
|
||||||
if maxMemCap == 0 {
|
if maxMemCap == 0 {
|
||||||
urlValues.Add("maxMemoryCapacity", strconv.Itoa(-1))
|
req.MaxMemoryCapacity = -1
|
||||||
} else {
|
} else {
|
||||||
urlValues.Add("maxMemoryCapacity", strconv.Itoa(maxMemCap))
|
req.MaxMemoryCapacity = int64(maxMemCap)
|
||||||
}
|
}
|
||||||
|
updated = true
|
||||||
}
|
}
|
||||||
if resLimitConv["cu_d"] != nil {
|
if resLimitConv["cu_d"] != nil {
|
||||||
maxDiskCap := int(resLimitConv["cu_d"].(float64))
|
maxDiskCap := int(resLimitConv["cu_d"].(float64))
|
||||||
if maxDiskCap == 0 {
|
if maxDiskCap == 0 {
|
||||||
urlValues.Add("maxVDiskCapacity", strconv.Itoa(-1))
|
req.MaxVDiskCapacity = -1
|
||||||
} else {
|
} else {
|
||||||
urlValues.Add("maxVDiskCapacity", strconv.Itoa(maxDiskCap))
|
req.MaxVDiskCapacity = int64(maxDiskCap)
|
||||||
}
|
}
|
||||||
|
updated = true
|
||||||
}
|
}
|
||||||
if resLimitConv["cu_c"] != nil {
|
if resLimitConv["cu_c"] != nil {
|
||||||
maxCPUCap := int(resLimitConv["cu_c"].(float64))
|
maxCPUCap := int(resLimitConv["cu_c"].(float64))
|
||||||
if maxCPUCap == 0 {
|
if maxCPUCap == 0 {
|
||||||
urlValues.Add("maxCPUCapacity", strconv.Itoa(-1))
|
req.MaxCPUCapacity = -1
|
||||||
} else {
|
} else {
|
||||||
urlValues.Add("maxCPUCapacity", strconv.Itoa(maxCPUCap))
|
req.MaxCPUCapacity = int64(maxCPUCap)
|
||||||
}
|
}
|
||||||
|
updated = true
|
||||||
}
|
}
|
||||||
if resLimitConv["cu_i"] != nil {
|
if resLimitConv["cu_i"] != nil {
|
||||||
maxNumPublicIP := int(resLimitConv["cu_i"].(float64))
|
maxNumPublicIP := int(resLimitConv["cu_i"].(float64))
|
||||||
if maxNumPublicIP == 0 {
|
if maxNumPublicIP == 0 {
|
||||||
urlValues.Add("maxNumPublicIP", strconv.Itoa(-1))
|
req.MaxNumPublicIP = -1
|
||||||
} else {
|
} else {
|
||||||
urlValues.Add("maxNumPublicIP", strconv.Itoa(maxNumPublicIP))
|
req.MaxNumPublicIP = int64(maxNumPublicIP)
|
||||||
}
|
}
|
||||||
|
updated = true
|
||||||
}
|
}
|
||||||
if resLimitConv["cu_np"] != nil {
|
if resLimitConv["cu_np"] != nil {
|
||||||
maxNP := int(resLimitConv["cu_np"].(float64))
|
maxNP := int(resLimitConv["cu_np"].(float64))
|
||||||
if maxNP == 0 {
|
if maxNP == 0 {
|
||||||
urlValues.Add("maxNetworkPeerTransfer", strconv.Itoa(-1))
|
req.MaxNetworkPeerTransfer = -1
|
||||||
} else {
|
} else {
|
||||||
urlValues.Add("maxNetworkPeerTransfer", strconv.Itoa(maxNP))
|
req.MaxNetworkPeerTransfer = int64(maxNP)
|
||||||
}
|
}
|
||||||
|
updated = true
|
||||||
}
|
}
|
||||||
if resLimitConv["gpu_units"] != nil {
|
if resLimitConv["gpu_units"] != nil {
|
||||||
gpuUnits := int(resLimitConv["gpu_units"].(float64))
|
gpuUnits := int(resLimitConv["gpu_units"].(float64))
|
||||||
if gpuUnits == 0 {
|
if gpuUnits == 0 {
|
||||||
urlValues.Add("gpu_units", strconv.Itoa(-1))
|
req.GPUUnits = -1
|
||||||
} else {
|
} else {
|
||||||
urlValues.Add("gpu_units", strconv.Itoa(gpuUnits))
|
req.GPUUnits = int64(gpuUnits)
|
||||||
}
|
}
|
||||||
|
updated = true
|
||||||
}
|
}
|
||||||
|
|
||||||
urlValues.Add("accountId", strconv.Itoa(d.Get("account_id").(int)))
|
|
||||||
_, err := c.DecortAPICall(ctx, "POST", accountUpdateAPI, urlValues)
|
|
||||||
if err != nil {
|
|
||||||
return diag.FromErr(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
urlValues = &url.Values{}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if d.HasChange("send_access_emails") {
|
if d.HasChange("send_access_emails") {
|
||||||
urlValues.Add("sendAccessEmails", strconv.FormatBool(d.Get("send_access_emails").(bool)))
|
req.SendAccessEmails = d.Get("send_access_emails").(bool)
|
||||||
urlValues.Add("accountId", strconv.Itoa(d.Get("account_id").(int)))
|
updated = true
|
||||||
_, err := c.DecortAPICall(ctx, "POST", accountUpdateAPI, urlValues)
|
}
|
||||||
|
|
||||||
|
if updated {
|
||||||
|
_, err := c.CloudAPI().Account().Update(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
urlValues = &url.Values{}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if d.HasChange("restore") {
|
if d.HasChange("restore") {
|
||||||
restore := d.Get("restore").(bool)
|
restore := d.Get("restore").(bool)
|
||||||
if restore {
|
if restore {
|
||||||
urlValues.Add("accountId", strconv.Itoa(d.Get("account_id").(int)))
|
if acc.Status == "DELETED" {
|
||||||
_, err := c.DecortAPICall(ctx, "POST", accountRestoreAPI, urlValues)
|
req := account.RestoreRequest{
|
||||||
if err != nil {
|
AccountID: accountId,
|
||||||
return diag.FromErr(err)
|
}
|
||||||
|
_, err := c.CloudAPI().Account().Restore(ctx, req)
|
||||||
|
if err != nil {
|
||||||
|
return diag.FromErr(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
urlValues = &url.Values{}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -358,9 +417,9 @@ func resourceAccountEdit(ctx context.Context, d *schema.ResourceData, m interfac
|
|||||||
addedUsers := make([]interface{}, 0)
|
addedUsers := make([]interface{}, 0)
|
||||||
updatedUsers := make([]interface{}, 0)
|
updatedUsers := make([]interface{}, 0)
|
||||||
|
|
||||||
old, new := d.GetChange("users")
|
old, new_ := d.GetChange("users")
|
||||||
oldConv := old.([]interface{})
|
oldConv := old.([]interface{})
|
||||||
newConv := new.([]interface{})
|
newConv := new_.([]interface{})
|
||||||
for _, el := range oldConv {
|
for _, el := range oldConv {
|
||||||
if !isContainsUser(newConv, el) {
|
if !isContainsUser(newConv, el) {
|
||||||
deletedUsers = append(deletedUsers, el)
|
deletedUsers = append(deletedUsers, el)
|
||||||
@@ -368,7 +427,15 @@ func resourceAccountEdit(ctx context.Context, d *schema.ResourceData, m interfac
|
|||||||
}
|
}
|
||||||
for _, el := range newConv {
|
for _, el := range newConv {
|
||||||
if !isContainsUser(oldConv, el) {
|
if !isContainsUser(oldConv, el) {
|
||||||
addedUsers = append(addedUsers, el)
|
duplicate := false
|
||||||
|
for _, user := range acc.ACL {
|
||||||
|
if user.UgroupID == el.(map[string]interface{})["user_id"].(string) {
|
||||||
|
duplicate = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !duplicate {
|
||||||
|
addedUsers = append(addedUsers, el)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if isChangedUser(oldConv, el) {
|
if isChangedUser(oldConv, el) {
|
||||||
updatedUsers = append(updatedUsers, el)
|
updatedUsers = append(updatedUsers, el)
|
||||||
@@ -379,51 +446,56 @@ func resourceAccountEdit(ctx context.Context, d *schema.ResourceData, m interfac
|
|||||||
if len(deletedUsers) > 0 {
|
if len(deletedUsers) > 0 {
|
||||||
for _, user := range deletedUsers {
|
for _, user := range deletedUsers {
|
||||||
userConv := user.(map[string]interface{})
|
userConv := user.(map[string]interface{})
|
||||||
urlValues.Add("accountId", strconv.Itoa(d.Get("account_id").(int)))
|
|
||||||
urlValues.Add("userId", userConv["user_id"].(string))
|
req := account.DeleteUserRequest{
|
||||||
urlValues.Add("recursivedelete", strconv.FormatBool(userConv["recursive_delete"].(bool)))
|
AccountID: accountId,
|
||||||
_, err := c.DecortAPICall(ctx, "POST", accountDeleteUserAPI, urlValues)
|
UserID: userConv["user_id"].(string),
|
||||||
|
RecursiveDelete: userConv["recursive_delete"].(bool),
|
||||||
|
}
|
||||||
|
_, err := c.CloudAPI().Account().DeleteUser(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
urlValues = &url.Values{}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(addedUsers) > 0 {
|
if len(addedUsers) > 0 {
|
||||||
for _, user := range addedUsers {
|
for _, user := range addedUsers {
|
||||||
userConv := user.(map[string]interface{})
|
userConv := user.(map[string]interface{})
|
||||||
urlValues.Add("accountId", strconv.Itoa(d.Get("account_id").(int)))
|
|
||||||
urlValues.Add("userId", userConv["user_id"].(string))
|
req := account.AddUserRequest{
|
||||||
urlValues.Add("accesstype", strings.ToUpper(userConv["access_type"].(string)))
|
AccountID: accountId,
|
||||||
_, err := c.DecortAPICall(ctx, "POST", accountAddUserAPI, urlValues)
|
UserID: userConv["user_id"].(string),
|
||||||
|
AccessType: strings.ToUpper(userConv["access_type"].(string)),
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err := c.CloudAPI().Account().AddUser(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
urlValues = &url.Values{}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(updatedUsers) > 0 {
|
if len(updatedUsers) > 0 {
|
||||||
for _, user := range updatedUsers {
|
for _, user := range updatedUsers {
|
||||||
userConv := user.(map[string]interface{})
|
userConv := user.(map[string]interface{})
|
||||||
urlValues.Add("accountId", strconv.Itoa(d.Get("account_id").(int)))
|
|
||||||
urlValues.Add("userId", userConv["user_id"].(string))
|
req := account.UpdateUserRequest{
|
||||||
urlValues.Add("accesstype", strings.ToUpper(userConv["access_type"].(string)))
|
AccountID: accountId,
|
||||||
_, err := c.DecortAPICall(ctx, "POST", accountUpdateUserAPI, urlValues)
|
UserID: userConv["user_id"].(string),
|
||||||
|
AccessType: strings.ToUpper(userConv["access_type"].(string)),
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err := c.CloudAPI().Account().UpdateUser(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
urlValues = &url.Values{}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return resourceAccountRead(ctx, d, m)
|
||||||
}
|
}
|
||||||
|
|
||||||
func isContainsUser(els []interface{}, el interface{}) bool {
|
func isContainsUser(els []interface{}, el interface{}) bool {
|
||||||
@@ -470,7 +542,6 @@ func resourceAccountSchemaMake() map[string]*schema.Schema {
|
|||||||
"send_access_emails": {
|
"send_access_emails": {
|
||||||
Type: schema.TypeBool,
|
Type: schema.TypeBool,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
Default: true,
|
|
||||||
Description: "if true send emails when a user is granted access to resources",
|
Description: "if true send emails when a user is granted access to resources",
|
||||||
},
|
},
|
||||||
"users": {
|
"users": {
|
||||||
@@ -552,7 +623,6 @@ func resourceAccountSchemaMake() map[string]*schema.Schema {
|
|||||||
},
|
},
|
||||||
"account_id": {
|
"account_id": {
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Optional: true,
|
|
||||||
Computed: true,
|
Computed: true,
|
||||||
},
|
},
|
||||||
"dc_location": {
|
"dc_location": {
|
||||||
@@ -563,167 +633,25 @@ func resourceAccountSchemaMake() map[string]*schema.Schema {
|
|||||||
Type: schema.TypeList,
|
Type: schema.TypeList,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
Elem: &schema.Resource{
|
Elem: &schema.Resource{
|
||||||
Schema: map[string]*schema.Schema{
|
Schema: resourcesSchemaMake(),
|
||||||
"current": {
|
|
||||||
Type: schema.TypeList,
|
|
||||||
Computed: true,
|
|
||||||
Elem: &schema.Resource{
|
|
||||||
Schema: map[string]*schema.Schema{
|
|
||||||
"cpu": {
|
|
||||||
Type: schema.TypeInt,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
"disksize": {
|
|
||||||
Type: schema.TypeFloat,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
"extips": {
|
|
||||||
Type: schema.TypeInt,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
"exttraffic": {
|
|
||||||
Type: schema.TypeInt,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
"gpu": {
|
|
||||||
Type: schema.TypeInt,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
"ram": {
|
|
||||||
Type: schema.TypeInt,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
"seps": {
|
|
||||||
Type: schema.TypeList,
|
|
||||||
Computed: true,
|
|
||||||
Elem: &schema.Resource{
|
|
||||||
Schema: map[string]*schema.Schema{
|
|
||||||
"sep_id": {
|
|
||||||
Type: schema.TypeString,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
"data_name": {
|
|
||||||
Type: schema.TypeString,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
"disk_size": {
|
|
||||||
Type: schema.TypeFloat,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
"disk_size_max": {
|
|
||||||
Type: schema.TypeInt,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"reserved": {
|
|
||||||
Type: schema.TypeList,
|
|
||||||
Computed: true,
|
|
||||||
Elem: &schema.Resource{
|
|
||||||
Schema: map[string]*schema.Schema{
|
|
||||||
"cpu": {
|
|
||||||
Type: schema.TypeInt,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
"disksize": {
|
|
||||||
Type: schema.TypeFloat,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
"extips": {
|
|
||||||
Type: schema.TypeInt,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
"exttraffic": {
|
|
||||||
Type: schema.TypeInt,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
"gpu": {
|
|
||||||
Type: schema.TypeInt,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
"ram": {
|
|
||||||
Type: schema.TypeInt,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
"seps": {
|
|
||||||
Type: schema.TypeList,
|
|
||||||
Computed: true,
|
|
||||||
Elem: &schema.Resource{
|
|
||||||
Schema: map[string]*schema.Schema{
|
|
||||||
"sep_id": {
|
|
||||||
Type: schema.TypeString,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
"data_name": {
|
|
||||||
Type: schema.TypeString,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
"disk_size": {
|
|
||||||
Type: schema.TypeFloat,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
"disk_size_max": {
|
|
||||||
Type: schema.TypeInt,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"ckey": {
|
"ckey": {
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
},
|
},
|
||||||
"meta": {
|
// "meta": {
|
||||||
Type: schema.TypeList,
|
// Type: schema.TypeList,
|
||||||
Computed: true,
|
// Computed: true,
|
||||||
Elem: &schema.Schema{
|
// Elem: &schema.Schema{
|
||||||
Type: schema.TypeString,
|
// Type: schema.TypeString,
|
||||||
},
|
// },
|
||||||
},
|
// },
|
||||||
"acl": {
|
"acl": {
|
||||||
Type: schema.TypeList,
|
Type: schema.TypeList,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
Elem: &schema.Resource{
|
Elem: &schema.Resource{
|
||||||
Schema: map[string]*schema.Schema{
|
Schema: aclSchemaMake(),
|
||||||
"can_be_deleted": {
|
|
||||||
Type: schema.TypeBool,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
"explicit": {
|
|
||||||
Type: schema.TypeBool,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
"guid": {
|
|
||||||
Type: schema.TypeString,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
"right": {
|
|
||||||
Type: schema.TypeString,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
"status": {
|
|
||||||
Type: schema.TypeString,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
"type": {
|
|
||||||
Type: schema.TypeString,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
"user_group_id": {
|
|
||||||
Type: schema.TypeString,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"company": {
|
"company": {
|
||||||
@@ -789,38 +717,28 @@ func resourceAccountSchemaMake() map[string]*schema.Schema {
|
|||||||
Type: schema.TypeList,
|
Type: schema.TypeList,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
Elem: &schema.Resource{
|
Elem: &schema.Resource{
|
||||||
Schema: map[string]*schema.Schema{
|
Schema: computesSchemaMake(),
|
||||||
"started": {
|
|
||||||
Type: schema.TypeInt,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
"stopped": {
|
|
||||||
Type: schema.TypeInt,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"machines": {
|
"machines": {
|
||||||
Type: schema.TypeList,
|
Type: schema.TypeList,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
Elem: &schema.Resource{
|
Elem: &schema.Resource{
|
||||||
Schema: map[string]*schema.Schema{
|
Schema: machinesSchemaMake(),
|
||||||
"halted": {
|
|
||||||
Type: schema.TypeInt,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
"running": {
|
|
||||||
Type: schema.TypeInt,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"vinses": {
|
"vinses": {
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
},
|
},
|
||||||
|
"cpu_allocation_parameter": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"cpu_allocation_ratio": {
|
||||||
|
Type: schema.TypeFloat,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -830,7 +748,7 @@ func ResourceAccount() *schema.Resource {
|
|||||||
|
|
||||||
CreateContext: resourceAccountCreate,
|
CreateContext: resourceAccountCreate,
|
||||||
ReadContext: resourceAccountRead,
|
ReadContext: resourceAccountRead,
|
||||||
UpdateContext: resourceAccountEdit,
|
UpdateContext: resourceAccountUpdate,
|
||||||
DeleteContext: resourceAccountDelete,
|
DeleteContext: resourceAccountDelete,
|
||||||
|
|
||||||
Importer: &schema.ResourceImporter{
|
Importer: &schema.ResourceImporter{
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@@ -21,46 +22,44 @@ limitations under the License.
|
|||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package account
|
package account
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
|
||||||
"net/url"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/controller"
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/account"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
|
||||||
|
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
)
|
)
|
||||||
|
|
||||||
func utilityAccountCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (*AccountWithResources, error) {
|
func utilityAccountCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (*account.RecordAccount, error) {
|
||||||
account := &AccountWithResources{}
|
|
||||||
c := m.(*controller.ControllerCfg)
|
c := m.(*controller.ControllerCfg)
|
||||||
urlValues := &url.Values{}
|
var id uint64
|
||||||
|
|
||||||
if (strconv.Itoa(d.Get("account_id").(int))) != "0" {
|
if (strconv.Itoa(d.Get("account_id").(int))) != "0" {
|
||||||
urlValues.Add("accountId", strconv.Itoa(d.Get("account_id").(int)))
|
id = uint64(d.Get("account_id").(int))
|
||||||
} else {
|
} else {
|
||||||
urlValues.Add("accountId", d.Id())
|
idParsed, _ := strconv.Atoi(d.Id())
|
||||||
|
id = uint64(idParsed)
|
||||||
|
}
|
||||||
|
|
||||||
|
req := account.GetRequest{
|
||||||
|
AccountID: id,
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Debugf("utilityAccountCheckPresence: load account")
|
log.Debugf("utilityAccountCheckPresence: load account")
|
||||||
accountRaw, err := c.DecortAPICall(ctx, "POST", accountGetAPI, urlValues)
|
account, err := c.CloudAPI().Account().Get(ctx, req)
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
err = json.Unmarshal([]byte(accountRaw), &account)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@@ -21,42 +22,38 @@ limitations under the License.
|
|||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package account
|
package account
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
|
||||||
"net/url"
|
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/controller"
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/account"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
|
||||||
|
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
)
|
)
|
||||||
|
|
||||||
func utilityAccountAuditsListCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (AccountAuditsList, error) {
|
func utilityAccountAuditsListCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (account.ListAudits, error) {
|
||||||
accountAuditsList := AccountAuditsList{}
|
|
||||||
c := m.(*controller.ControllerCfg)
|
c := m.(*controller.ControllerCfg)
|
||||||
urlValues := &url.Values{}
|
var id uint64
|
||||||
|
|
||||||
urlValues.Add("accountId", strconv.Itoa(d.Get("account_id").(int)))
|
id = uint64(d.Get("account_id").(int))
|
||||||
|
|
||||||
log.Debugf("utilityAccountAuditsListCheckPresence: load account list")
|
req := account.AuditsRequest{
|
||||||
accountAuditsListRaw, err := c.DecortAPICall(ctx, "POST", accountAuditsAPI, urlValues)
|
AccountID: id,
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
err = json.Unmarshal([]byte(accountAuditsListRaw), &accountAuditsList)
|
log.Debugf("utilityAccountAuditsListCheckPresence: load account list")
|
||||||
|
accountAuditsList, err := c.CloudAPI().Account().Audits(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@@ -21,42 +22,38 @@ limitations under the License.
|
|||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package account
|
package account
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
|
||||||
"net/url"
|
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/controller"
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/account"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
|
||||||
|
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
)
|
)
|
||||||
|
|
||||||
func utilityAccountComputesListCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (AccountComputesList, error) {
|
func utilityAccountComputesListCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (account.ListComputes, error) {
|
||||||
accountComputesList := AccountComputesList{}
|
|
||||||
c := m.(*controller.ControllerCfg)
|
c := m.(*controller.ControllerCfg)
|
||||||
urlValues := &url.Values{}
|
var id uint64
|
||||||
|
|
||||||
urlValues.Add("accountId", strconv.Itoa(d.Get("account_id").(int)))
|
id = uint64(d.Get("account_id").(int))
|
||||||
|
|
||||||
log.Debugf("utilityAccountComputesListCheckPresence: load account list")
|
req := account.ListComputesRequest{
|
||||||
accountComputesListRaw, err := c.DecortAPICall(ctx, "POST", accountListComputesAPI, urlValues)
|
AccountID: id,
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
err = json.Unmarshal([]byte(accountComputesListRaw), &accountComputesList)
|
log.Debugf("utilityAccountComputesListCheckPresence: load account list")
|
||||||
|
accountComputesList, err := c.CloudAPI().Account().ListComputes(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@@ -21,42 +22,38 @@ limitations under the License.
|
|||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package account
|
package account
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
|
||||||
"net/url"
|
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/controller"
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/account"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
|
||||||
|
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
)
|
)
|
||||||
|
|
||||||
func utilityAccountConsumedUnitsCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (*ResourceLimits, error) {
|
func utilityAccountConsumedUnitsCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (*account.ResourceLimits, error) {
|
||||||
accountConsumedUnits := &ResourceLimits{}
|
|
||||||
c := m.(*controller.ControllerCfg)
|
c := m.(*controller.ControllerCfg)
|
||||||
urlValues := &url.Values{}
|
var id uint64
|
||||||
|
|
||||||
urlValues.Add("accountId", strconv.Itoa(d.Get("account_id").(int)))
|
id = uint64(d.Get("account_id").(int))
|
||||||
|
|
||||||
log.Debugf("utilityAccountConsumedUnitsCheckPresence: load account list")
|
req := account.GetConsumedAccountUnitsRequest{
|
||||||
accountConsumedUnitsRaw, err := c.DecortAPICall(ctx, "POST", accountGetConsumedUnitsAPI, urlValues)
|
AccountID: id,
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
err = json.Unmarshal([]byte(accountConsumedUnitsRaw), accountConsumedUnits)
|
log.Debugf("utilityAccountConsumedUnitsCheckPresence: load account list")
|
||||||
|
accountConsumedUnits, err := c.CloudAPI().Account().GetConsumedAccountUnits(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@@ -21,41 +22,42 @@ limitations under the License.
|
|||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package account
|
package account
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"net/url"
|
|
||||||
"strconv"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/controller"
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/account"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
|
||||||
|
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
)
|
)
|
||||||
|
|
||||||
func utilityAccountConsumedUnitsByTypeCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (float64, error) {
|
func utilityAccountConsumedUnitsByTypeCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (float64, error) {
|
||||||
c := m.(*controller.ControllerCfg)
|
c := m.(*controller.ControllerCfg)
|
||||||
urlValues := &url.Values{}
|
var id uint64
|
||||||
|
var cuType string
|
||||||
|
|
||||||
urlValues.Add("accountId", strconv.Itoa(d.Get("account_id").(int)))
|
id = uint64(d.Get("account_id").(int))
|
||||||
urlValues.Add("cutype", strings.ToUpper(d.Get("cu_type").(string)))
|
cuType = strings.ToUpper(d.Get("cu_type").(string))
|
||||||
|
|
||||||
|
req := account.GetConsumedCloudUnitsByTypeRequest{
|
||||||
|
AccountID: id,
|
||||||
|
CUType: cuType,
|
||||||
|
}
|
||||||
|
|
||||||
log.Debugf("utilityAccountConsumedUnitsByTypeCheckPresence")
|
log.Debugf("utilityAccountConsumedUnitsByTypeCheckPresence")
|
||||||
resultRaw, err := c.DecortAPICall(ctx, "POST", accountGetConsumedUnitsByTypeAPI, urlValues)
|
result, err := c.CloudAPI().Account().GetConsumedCloudUnitsByType(ctx, req)
|
||||||
if err != nil {
|
|
||||||
return 0, err
|
|
||||||
}
|
|
||||||
result, err := strconv.ParseFloat(resultRaw, 64)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@@ -21,50 +22,49 @@ limitations under the License.
|
|||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package account
|
package account
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
|
||||||
"net/url"
|
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/controller"
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/account"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
|
||||||
|
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
)
|
)
|
||||||
|
|
||||||
func utilityAccountDeletedListCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (AccountCloudApiList, error) {
|
func utilityAccountDeletedListCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (account.ListAccounts, error) {
|
||||||
accountDeletedList := AccountCloudApiList{}
|
|
||||||
c := m.(*controller.ControllerCfg)
|
c := m.(*controller.ControllerCfg)
|
||||||
urlValues := &url.Values{}
|
var (
|
||||||
|
pageVal uint64 = 0
|
||||||
|
sizeVal uint64 = 0
|
||||||
|
)
|
||||||
|
|
||||||
if page, ok := d.GetOk("page"); ok {
|
if page, ok := d.GetOk("page"); ok {
|
||||||
urlValues.Add("page", strconv.Itoa(page.(int)))
|
pageVal = uint64(page.(int))
|
||||||
}
|
}
|
||||||
if size, ok := d.GetOk("size"); ok {
|
if size, ok := d.GetOk("size"); ok {
|
||||||
urlValues.Add("size", strconv.Itoa(size.(int)))
|
sizeVal = uint64(size.(int))
|
||||||
|
}
|
||||||
|
|
||||||
|
req := account.ListDeletedRequest{
|
||||||
|
Page: pageVal,
|
||||||
|
Size: sizeVal,
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Debugf("utilityAccountDeletedListCheckPresence: load")
|
log.Debugf("utilityAccountDeletedListCheckPresence: load")
|
||||||
accountDeletedListRaw, err := c.DecortAPICall(ctx, "POST", accountListDeletedAPI, urlValues)
|
accountDeletedList, err := c.CloudAPI().Account().ListDeleted(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = json.Unmarshal([]byte(accountDeletedListRaw), &accountDeletedList)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return accountDeletedList, nil
|
return accountDeletedList, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@@ -21,42 +22,36 @@ limitations under the License.
|
|||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package account
|
package account
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
|
||||||
"net/url"
|
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/controller"
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/account"
|
||||||
log "github.com/sirupsen/logrus"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
|
||||||
|
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
)
|
)
|
||||||
|
|
||||||
func utilityAccountDisksListCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (AccountDisksList, error) {
|
func utilityAccountDisksListCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (account.ListDisks, error) {
|
||||||
accountDisksList := AccountDisksList{}
|
|
||||||
c := m.(*controller.ControllerCfg)
|
c := m.(*controller.ControllerCfg)
|
||||||
urlValues := &url.Values{}
|
var id uint64
|
||||||
|
|
||||||
urlValues.Add("accountId", strconv.Itoa(d.Get("account_id").(int)))
|
id = uint64(d.Get("account_id").(int))
|
||||||
|
|
||||||
log.Debugf("utilityAccountDisksListCheckPresence: load account list")
|
req := account.ListDisksRequest{
|
||||||
accountDisksListRaw, err := c.DecortAPICall(ctx, "POST", accountListDisksAPI, urlValues)
|
AccountID: id,
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
err = json.Unmarshal([]byte(accountDisksListRaw), &accountDisksList)
|
accountDisksList, err := c.CloudAPI().Account().ListDisks(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@@ -21,42 +22,38 @@ limitations under the License.
|
|||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package account
|
package account
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
|
||||||
"net/url"
|
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/controller"
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/account"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
|
||||||
|
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
)
|
)
|
||||||
|
|
||||||
func utilityAccountFlipGroupsListCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (AccountFlipGroupsList, error) {
|
func utilityAccountFlipGroupsListCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (account.ListFLIPGroups, error) {
|
||||||
accountFlipGroupsList := AccountFlipGroupsList{}
|
|
||||||
c := m.(*controller.ControllerCfg)
|
c := m.(*controller.ControllerCfg)
|
||||||
urlValues := &url.Values{}
|
var id uint64
|
||||||
|
|
||||||
urlValues.Add("accountId", strconv.Itoa(d.Get("account_id").(int)))
|
id = uint64(d.Get("account_id").(int))
|
||||||
|
|
||||||
log.Debugf("utilityAccountFlipGroupsListCheckPresence")
|
req := account.ListFLIPGroupsRequest{
|
||||||
accountFlipGroupsListRaw, err := c.DecortAPICall(ctx, "POST", accountListFlipGroupsAPI, urlValues)
|
AccountID: id,
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
err = json.Unmarshal([]byte(accountFlipGroupsListRaw), &accountFlipGroupsList)
|
log.Debugf("utilityAccountFlipGroupsListCheckPresence")
|
||||||
|
accountFlipGroupsList, err := c.CloudAPI().Account().ListFLIPGroups(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@@ -21,78 +22,50 @@ limitations under the License.
|
|||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package account
|
package account
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
|
||||||
"net/url"
|
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/controller"
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/account"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
|
||||||
|
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
)
|
)
|
||||||
|
|
||||||
func utilityAccountListCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (AccountCloudApiList, error) {
|
func utilityAccountListCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (account.ListAccounts, error) {
|
||||||
accountList := AccountCloudApiList{}
|
|
||||||
c := m.(*controller.ControllerCfg)
|
c := m.(*controller.ControllerCfg)
|
||||||
urlValues := &url.Values{}
|
var (
|
||||||
|
pageVal uint64 = 0
|
||||||
|
sizeVal uint64 = 0
|
||||||
|
)
|
||||||
|
|
||||||
if page, ok := d.GetOk("page"); ok {
|
if page, ok := d.GetOk("page"); ok {
|
||||||
urlValues.Add("page", strconv.Itoa(page.(int)))
|
pageVal = uint64(page.(int))
|
||||||
}
|
}
|
||||||
if size, ok := d.GetOk("size"); ok {
|
if size, ok := d.GetOk("size"); ok {
|
||||||
urlValues.Add("size", strconv.Itoa(size.(int)))
|
sizeVal = uint64(size.(int))
|
||||||
|
}
|
||||||
|
|
||||||
|
req := account.ListRequest{
|
||||||
|
Page: pageVal,
|
||||||
|
Size: sizeVal,
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Debugf("utilityAccountListCheckPresence: load account list")
|
log.Debugf("utilityAccountListCheckPresence: load account list")
|
||||||
accountListRaw, err := c.DecortAPICall(ctx, "POST", accountListAPI, urlValues)
|
accountList, err := c.CloudAPI().Account().List(ctx, req)
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
err = json.Unmarshal([]byte(accountListRaw), &accountList)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return accountList, nil
|
return accountList, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
/*uncomment for cloudbroker
|
|
||||||
func utilityAccountListCheckPresence(d *schema.ResourceData, m interface{}) (AccountList, error) {
|
|
||||||
accountList := AccountList{}
|
|
||||||
controller := m.(*ControllerCfg)
|
|
||||||
urlValues := &url.Values{}
|
|
||||||
|
|
||||||
if page, ok := d.GetOk("page"); ok {
|
|
||||||
urlValues.Add("page", strconv.Itoa(page.(int)))
|
|
||||||
}
|
|
||||||
if size, ok := d.GetOk("size"); ok {
|
|
||||||
urlValues.Add("size", strconv.Itoa(size.(int)))
|
|
||||||
}
|
|
||||||
|
|
||||||
log.Debugf("utilityAccountListCheckPresence: load account list")
|
|
||||||
accountListRaw, err := controller.decortAPICall("POST", accountListAPI, urlValues)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
err = json.Unmarshal([]byte(accountListRaw), &accountList)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return accountList, nil
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@@ -21,42 +22,38 @@ limitations under the License.
|
|||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package account
|
package account
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
|
||||||
"net/url"
|
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/controller"
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/account"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
|
||||||
|
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
)
|
)
|
||||||
|
|
||||||
func utilityAccountReservedUnitsCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (*ResourceLimits, error) {
|
func utilityAccountReservedUnitsCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (*account.ResourceLimits, error) {
|
||||||
accountReservedUnits := &ResourceLimits{}
|
|
||||||
c := m.(*controller.ControllerCfg)
|
c := m.(*controller.ControllerCfg)
|
||||||
urlValues := &url.Values{}
|
var id uint64
|
||||||
|
|
||||||
urlValues.Add("accountId", strconv.Itoa(d.Get("account_id").(int)))
|
id = uint64(d.Get("account_id").(int))
|
||||||
|
|
||||||
log.Debugf("utilityAccountReservedUnitsCheckPresence: load units")
|
req := account.GetReservedAccountUnitsRequest{
|
||||||
accountReservedUnitsRaw, err := c.DecortAPICall(ctx, "POST", accountGetReservedUnitsAPI, urlValues)
|
AccountID: id,
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
err = json.Unmarshal([]byte(accountReservedUnitsRaw), accountReservedUnits)
|
log.Debugf("utilityAccountReservedUnitsCheckPresence: load units")
|
||||||
|
accountReservedUnits, err := c.CloudAPI().Account().GetReservedAccountUnits(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@@ -21,42 +22,38 @@ limitations under the License.
|
|||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package account
|
package account
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
|
||||||
"net/url"
|
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/controller"
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/account"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
|
||||||
|
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
)
|
)
|
||||||
|
|
||||||
func utilityAccountRGListCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (AccountRGList, error) {
|
func utilityAccountRGListCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (account.ListRG, error) {
|
||||||
accountRGList := AccountRGList{}
|
|
||||||
c := m.(*controller.ControllerCfg)
|
c := m.(*controller.ControllerCfg)
|
||||||
urlValues := &url.Values{}
|
var id uint64
|
||||||
|
|
||||||
urlValues.Add("accountId", strconv.Itoa(d.Get("account_id").(int)))
|
id = uint64(d.Get("account_id").(int))
|
||||||
|
|
||||||
log.Debugf("utilityAccountRGListCheckPresence: load account list")
|
req := account.ListRGRequest{
|
||||||
accountRGListRaw, err := c.DecortAPICall(ctx, "POST", accountListRGAPI, urlValues)
|
AccountID: id,
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
err = json.Unmarshal([]byte(accountRGListRaw), &accountRGList)
|
log.Debugf("utilityAccountRGListCheckPresence: load account list")
|
||||||
|
accountRGList, err := c.CloudAPI().Account().ListRG(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@@ -21,42 +22,38 @@ limitations under the License.
|
|||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package account
|
package account
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
|
||||||
"net/url"
|
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/controller"
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/account"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
|
||||||
|
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
)
|
)
|
||||||
|
|
||||||
func utilityAccountTemplatesListCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (AccountTemplatesList, error) {
|
func utilityAccountTemplatesListCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (account.ListTemplates, error) {
|
||||||
accountTemplatesList := AccountTemplatesList{}
|
|
||||||
c := m.(*controller.ControllerCfg)
|
c := m.(*controller.ControllerCfg)
|
||||||
urlValues := &url.Values{}
|
var id uint64
|
||||||
|
|
||||||
urlValues.Add("accountId", strconv.Itoa(d.Get("account_id").(int)))
|
id = uint64(d.Get("account_id").(int))
|
||||||
|
|
||||||
log.Debugf("utilityAccountTemplatesListCheckPresence: load")
|
req := account.ListTemplatesRequest{
|
||||||
accountTemplatesListRaw, err := c.DecortAPICall(ctx, "POST", accountListTemplatesAPI, urlValues)
|
AccountID: id,
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
err = json.Unmarshal([]byte(accountTemplatesListRaw), &accountTemplatesList)
|
log.Debugf("utilityAccountTemplatesListCheckPresence: load")
|
||||||
|
accountTemplatesList, err := c.CloudAPI().Account().ListTemplates(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@@ -21,42 +22,38 @@ limitations under the License.
|
|||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package account
|
package account
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
|
||||||
"net/url"
|
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/controller"
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/account"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
|
||||||
|
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
)
|
)
|
||||||
|
|
||||||
func utilityAccountVinsListCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (AccountVinsList, error) {
|
func utilityAccountVinsListCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (account.ListVINS, error) {
|
||||||
accountVinsList := AccountVinsList{}
|
|
||||||
c := m.(*controller.ControllerCfg)
|
c := m.(*controller.ControllerCfg)
|
||||||
urlValues := &url.Values{}
|
var id uint64
|
||||||
|
|
||||||
urlValues.Add("accountId", strconv.Itoa(d.Get("account_id").(int)))
|
id = uint64(d.Get("account_id").(int))
|
||||||
|
|
||||||
log.Debugf("utilityAccountVinsListCheckPresence: load account list")
|
req := account.ListVINSRequest{
|
||||||
accountVinsListRaw, err := c.DecortAPICall(ctx, "POST", accountListVinsAPI, urlValues)
|
AccountID: id,
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
err = json.Unmarshal([]byte(accountVinsListRaw), &accountVinsList)
|
log.Debugf("utilityAccountVinsListCheckPresence: load account list")
|
||||||
|
accountVinsList, err := c.CloudAPI().Account().ListVINS(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,59 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|
||||||
Authors:
|
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
|
||||||
builds seamlessly.
|
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
|
||||||
*/
|
|
||||||
|
|
||||||
package bservice
|
|
||||||
|
|
||||||
const bserviceCreateAPI = "/restmachine/cloudapi/bservice/create"
|
|
||||||
const bserviceDeleteAPI = "/restmachine/cloudapi/bservice/delete"
|
|
||||||
const bserviceDisableAPI = "/restmachine/cloudapi/bservice/disable"
|
|
||||||
const bserviceEnableAPI = "/restmachine/cloudapi/bservice/enable"
|
|
||||||
const bserviceGetAPI = "/restmachine/cloudapi/bservice/get"
|
|
||||||
const bserviceGroupAddAPI = "/restmachine/cloudapi/bservice/groupAdd"
|
|
||||||
const bserviceGroupComputeRemoveAPI = "/restmachine/cloudapi/bservice/groupComputeRemove"
|
|
||||||
const bserviceGroupGetAPI = "/restmachine/cloudapi/bservice/groupGet"
|
|
||||||
const bserviceGroupParentAddAPI = "/restmachine/cloudapi/bservice/groupParentAdd"
|
|
||||||
const bserviceGroupParentRemoveAPI = "/restmachine/cloudapi/bservice/groupParentRemove"
|
|
||||||
const bserviceGroupRemoveAPI = "/restmachine/cloudapi/bservice/groupRemove"
|
|
||||||
const bserviceGroupResizeAPI = "/restmachine/cloudapi/bservice/groupResize"
|
|
||||||
const bserviceGroupStartAPI = "/restmachine/cloudapi/bservice/groupStart"
|
|
||||||
const bserviceGroupStopAPI = "/restmachine/cloudapi/bservice/groupStop"
|
|
||||||
const bserviceGroupUpdateAPI = "/restmachine/cloudapi/bservice/groupUpdate"
|
|
||||||
const bserviceGroupUpdateExtnetAPI = "/restmachine/cloudapi/bservice/groupUpdateExtnet"
|
|
||||||
const bserviceGroupUpdateVinsAPI = "/restmachine/cloudapi/bservice/groupUpdateVins"
|
|
||||||
const bserviceListAPI = "/restmachine/cloudapi/bservice/list"
|
|
||||||
const bserviceListDeletedAPI = "/restmachine/cloudapi/bservice/listDeleted"
|
|
||||||
const bserviceRestoreAPI = "/restmachine/cloudapi/bservice/restore"
|
|
||||||
const bserviceSnapshotCreateAPI = "/restmachine/cloudapi/bservice/snapshotCreate"
|
|
||||||
const bserviceSnapshotDeleteAPI = "/restmachine/cloudapi/bservice/snapshotDelete"
|
|
||||||
const bserviceSnapshotListAPI = "/restmachine/cloudapi/bservice/snapshotList"
|
|
||||||
const bserviceSnapshotRollbackAPI = "/restmachine/cloudapi/bservice/snapshotRollback"
|
|
||||||
const bserviceStartAPI = "/restmachine/cloudapi/bservice/start"
|
|
||||||
const bserviceStopAPI = "/restmachine/cloudapi/bservice/stop"
|
|
||||||
@@ -3,6 +3,7 @@ Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@@ -21,23 +22,23 @@ limitations under the License.
|
|||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package bservice
|
package bservice
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/constants"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
)
|
)
|
||||||
|
|
||||||
func dataSourceBasicServiceRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func dataSourceBasicServiceRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
@@ -46,70 +47,13 @@ func dataSourceBasicServiceRead(ctx context.Context, d *schema.ResourceData, m i
|
|||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
id := uuid.New()
|
d.SetId(strconv.FormatUint(bs.ID, 10))
|
||||||
d.SetId(id.String())
|
|
||||||
d.Set("account_id", bs.AccountId)
|
flattenService(d, bs)
|
||||||
d.Set("account_name", bs.AccountName)
|
|
||||||
d.Set("base_domain", bs.BaseDomain)
|
|
||||||
d.Set("computes", flattenBasicServiceComputes(bs.Computes))
|
|
||||||
d.Set("cpu_total", bs.CPUTotal)
|
|
||||||
d.Set("created_by", bs.CreatedBy)
|
|
||||||
d.Set("created_time", bs.CreatedTime)
|
|
||||||
d.Set("deleted_by", bs.DeletedBy)
|
|
||||||
d.Set("deleted_time", bs.DeletedTime)
|
|
||||||
d.Set("disk_total", bs.DiskTotal)
|
|
||||||
d.Set("gid", bs.GID)
|
|
||||||
d.Set("groups", bs.Groups)
|
|
||||||
d.Set("groups_name", bs.GroupsName)
|
|
||||||
d.Set("guid", bs.GUID)
|
|
||||||
d.Set("milestones", bs.Milestones)
|
|
||||||
d.Set("service_name", bs.Name)
|
|
||||||
d.Set("parent_srv_id", bs.ParentSrvId)
|
|
||||||
d.Set("parent_srv_type", bs.ParentSrvType)
|
|
||||||
d.Set("ram_total", bs.RamTotal)
|
|
||||||
d.Set("rg_id", bs.RGID)
|
|
||||||
d.Set("rg_name", bs.RGName)
|
|
||||||
d.Set("snapshots", flattenBasicServiceSnapshots(bs.Snapshots))
|
|
||||||
d.Set("ssh_key", bs.SSHKey)
|
|
||||||
d.Set("ssh_user", bs.SSHUser)
|
|
||||||
d.Set("status", bs.Status)
|
|
||||||
d.Set("tech_status", bs.TechStatus)
|
|
||||||
d.Set("updated_by", bs.UpdatedBy)
|
|
||||||
d.Set("updated_time", bs.UpdatedTime)
|
|
||||||
d.Set("user_managed", bs.UserManaged)
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func flattenBasicServiceComputes(bscs BasicServiceComputes) []map[string]interface{} {
|
|
||||||
res := make([]map[string]interface{}, 0)
|
|
||||||
for _, bsc := range bscs {
|
|
||||||
temp := map[string]interface{}{
|
|
||||||
"compgroup_id": bsc.CompGroupId,
|
|
||||||
"compgroup_name": bsc.CompGroupName,
|
|
||||||
"compgroup_role": bsc.CompGroupRole,
|
|
||||||
"id": bsc.ID,
|
|
||||||
"name": bsc.Name,
|
|
||||||
}
|
|
||||||
res = append(res, temp)
|
|
||||||
}
|
|
||||||
|
|
||||||
return res
|
|
||||||
}
|
|
||||||
|
|
||||||
func flattenBasicServiceSnapshots(bsrvss BasicServiceSnapshots) []map[string]interface{} {
|
|
||||||
res := make([]map[string]interface{}, 0)
|
|
||||||
for _, bsrvs := range bsrvss {
|
|
||||||
temp := map[string]interface{}{
|
|
||||||
"guid": bsrvs.GUID,
|
|
||||||
"label": bsrvs.Label,
|
|
||||||
"timestamp": bsrvs.Timestamp,
|
|
||||||
"valid": bsrvs.Valid,
|
|
||||||
}
|
|
||||||
res = append(res, temp)
|
|
||||||
}
|
|
||||||
return res
|
|
||||||
}
|
|
||||||
|
|
||||||
func dataSourceBasicServiceSchemaMake() map[string]*schema.Schema {
|
func dataSourceBasicServiceSchemaMake() map[string]*schema.Schema {
|
||||||
res := map[string]*schema.Schema{
|
res := map[string]*schema.Schema{
|
||||||
"service_id": {
|
"service_id": {
|
||||||
@@ -133,6 +77,14 @@ func dataSourceBasicServiceSchemaMake() map[string]*schema.Schema {
|
|||||||
Computed: true,
|
Computed: true,
|
||||||
Elem: &schema.Resource{
|
Elem: &schema.Resource{
|
||||||
Schema: map[string]*schema.Schema{
|
Schema: map[string]*schema.Schema{
|
||||||
|
"account_id": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"architecture": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
"compgroup_id": {
|
"compgroup_id": {
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
@@ -149,10 +101,26 @@ func dataSourceBasicServiceSchemaMake() map[string]*schema.Schema {
|
|||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
},
|
},
|
||||||
|
"rg_id": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"stack_id": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
"name": {
|
"name": {
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
},
|
},
|
||||||
|
"status": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"tech_status": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -188,8 +156,33 @@ func dataSourceBasicServiceSchemaMake() map[string]*schema.Schema {
|
|||||||
"groups": {
|
"groups": {
|
||||||
Type: schema.TypeList,
|
Type: schema.TypeList,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
Elem: &schema.Schema{
|
Elem: &schema.Resource{
|
||||||
Type: schema.TypeInt,
|
Schema: map[string]*schema.Schema{
|
||||||
|
"computes": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"consistency": {
|
||||||
|
Type: schema.TypeBool,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"status": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"tech_status": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"groups_name": {
|
"groups_name": {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@@ -21,12 +22,12 @@ limitations under the License.
|
|||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package bservice
|
package bservice
|
||||||
@@ -37,7 +38,7 @@ import (
|
|||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/constants"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
)
|
)
|
||||||
|
|
||||||
func dataSourceBasicServiceDeletedListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func dataSourceBasicServiceDeletedListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@@ -21,12 +22,12 @@ limitations under the License.
|
|||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package bservice
|
package bservice
|
||||||
@@ -37,7 +38,8 @@ import (
|
|||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/constants"
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/bservice"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
)
|
)
|
||||||
|
|
||||||
func dataSourceBasicServiceGroupRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func dataSourceBasicServiceGroupRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
@@ -48,7 +50,7 @@ func dataSourceBasicServiceGroupRead(ctx context.Context, d *schema.ResourceData
|
|||||||
|
|
||||||
id := uuid.New()
|
id := uuid.New()
|
||||||
d.SetId(id.String())
|
d.SetId(id.String())
|
||||||
d.Set("account_id", bsg.AccountId)
|
d.Set("account_id", bsg.AccountID)
|
||||||
d.Set("account_name", bsg.AccountName)
|
d.Set("account_name", bsg.AccountName)
|
||||||
d.Set("computes", flattenBSGroupComputes(bsg.Computes))
|
d.Set("computes", flattenBSGroupComputes(bsg.Computes))
|
||||||
d.Set("consistency", bsg.Consistency)
|
d.Set("consistency", bsg.Consistency)
|
||||||
@@ -59,10 +61,10 @@ func dataSourceBasicServiceGroupRead(ctx context.Context, d *schema.ResourceData
|
|||||||
d.Set("deleted_time", bsg.DeletedTime)
|
d.Set("deleted_time", bsg.DeletedTime)
|
||||||
d.Set("disk", bsg.Disk)
|
d.Set("disk", bsg.Disk)
|
||||||
d.Set("driver", bsg.Driver)
|
d.Set("driver", bsg.Driver)
|
||||||
d.Set("extnets", bsg.Extnets)
|
d.Set("extnets", bsg.ExtNets)
|
||||||
d.Set("gid", bsg.GID)
|
d.Set("gid", bsg.GID)
|
||||||
d.Set("guid", bsg.GUID)
|
d.Set("guid", bsg.GUID)
|
||||||
d.Set("image_id", bsg.ImageId)
|
d.Set("image_id", bsg.ImageID)
|
||||||
d.Set("milestones", bsg.Milestones)
|
d.Set("milestones", bsg.Milestones)
|
||||||
d.Set("compgroup_name", bsg.Name)
|
d.Set("compgroup_name", bsg.Name)
|
||||||
d.Set("parents", bsg.Parents)
|
d.Set("parents", bsg.Parents)
|
||||||
@@ -70,18 +72,18 @@ func dataSourceBasicServiceGroupRead(ctx context.Context, d *schema.ResourceData
|
|||||||
d.Set("rg_id", bsg.RGID)
|
d.Set("rg_id", bsg.RGID)
|
||||||
d.Set("rg_name", bsg.RGName)
|
d.Set("rg_name", bsg.RGName)
|
||||||
d.Set("role", bsg.Role)
|
d.Set("role", bsg.Role)
|
||||||
d.Set("sep_id", bsg.SepId)
|
d.Set("sep_id", bsg.SEPID)
|
||||||
d.Set("seq_no", bsg.SeqNo)
|
d.Set("seq_no", bsg.SeqNo)
|
||||||
d.Set("status", bsg.Status)
|
d.Set("status", bsg.Status)
|
||||||
d.Set("tech_status", bsg.TechStatus)
|
d.Set("tech_status", bsg.TechStatus)
|
||||||
d.Set("timeout_start", bsg.TimeoutStart)
|
d.Set("timeout_start", bsg.TimeoutStart)
|
||||||
d.Set("updated_by", bsg.UpdatedBy)
|
d.Set("updated_by", bsg.UpdatedBy)
|
||||||
d.Set("updated_time", bsg.UpdatedTime)
|
d.Set("updated_time", bsg.UpdatedTime)
|
||||||
d.Set("vinses", bsg.Vinses)
|
d.Set("vinses", bsg.VINSes)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func flattenBSGroupOSUsers(bsgosus BasicServiceGroupOSUsers) []map[string]interface{} {
|
func flattenBSGroupOSUsers(bsgosus bservice.ListOSUsers) []map[string]interface{} {
|
||||||
res := make([]map[string]interface{}, 0)
|
res := make([]map[string]interface{}, 0)
|
||||||
for _, bsgosu := range bsgosus {
|
for _, bsgosu := range bsgosus {
|
||||||
temp := map[string]interface{}{
|
temp := map[string]interface{}{
|
||||||
@@ -94,12 +96,12 @@ func flattenBSGroupOSUsers(bsgosus BasicServiceGroupOSUsers) []map[string]interf
|
|||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
func flattenBSGroupComputes(bsgcs BasicServiceGroupComputes) []map[string]interface{} {
|
func flattenBSGroupComputes(bsgcs bservice.ListGroupComputes) []map[string]interface{} {
|
||||||
res := make([]map[string]interface{}, 0)
|
res := make([]map[string]interface{}, 0)
|
||||||
for _, bsgc := range bsgcs {
|
for _, bsgc := range bsgcs {
|
||||||
temp := map[string]interface{}{
|
temp := map[string]interface{}{
|
||||||
"id": bsgc.ID,
|
"id": bsgc.ID,
|
||||||
"ip_addresses": bsgc.IPAdresses,
|
"ip_addresses": bsgc.IPAddresses,
|
||||||
"name": bsgc.Name,
|
"name": bsgc.Name,
|
||||||
"os_users": flattenBSGroupOSUsers(bsgc.OSUsers),
|
"os_users": flattenBSGroupOSUsers(bsgc.OSUsers),
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@@ -21,12 +22,12 @@ limitations under the License.
|
|||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package bservice
|
package bservice
|
||||||
@@ -37,14 +38,15 @@ import (
|
|||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/constants"
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/bservice"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
)
|
)
|
||||||
|
|
||||||
func flattenBasicServiceList(bsl BasicServiceList) []map[string]interface{} {
|
func flattenBasicServiceList(bsl bservice.ListBasicServices) []map[string]interface{} {
|
||||||
res := make([]map[string]interface{}, 0)
|
res := make([]map[string]interface{}, 0)
|
||||||
for _, bs := range bsl {
|
for _, bs := range bsl {
|
||||||
temp := map[string]interface{}{
|
temp := map[string]interface{}{
|
||||||
"account_id": bs.AccountId,
|
"account_id": bs.AccountID,
|
||||||
"account_name": bs.AccountName,
|
"account_name": bs.AccountName,
|
||||||
"base_domain": bs.BaseDomain,
|
"base_domain": bs.BaseDomain,
|
||||||
"created_by": bs.CreatedBy,
|
"created_by": bs.CreatedBy,
|
||||||
@@ -56,7 +58,7 @@ func flattenBasicServiceList(bsl BasicServiceList) []map[string]interface{} {
|
|||||||
"guid": bs.GUID,
|
"guid": bs.GUID,
|
||||||
"service_id": bs.ID,
|
"service_id": bs.ID,
|
||||||
"service_name": bs.Name,
|
"service_name": bs.Name,
|
||||||
"parent_srv_id": bs.ParentSrvId,
|
"parent_srv_id": bs.ParentSrvID,
|
||||||
"parent_srv_type": bs.ParentSrvType,
|
"parent_srv_type": bs.ParentSrvType,
|
||||||
"rg_id": bs.RGID,
|
"rg_id": bs.RGID,
|
||||||
"rg_name": bs.RGName,
|
"rg_name": bs.RGName,
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@@ -21,12 +22,12 @@ limitations under the License.
|
|||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package bservice
|
package bservice
|
||||||
@@ -37,7 +38,7 @@ import (
|
|||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/constants"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
)
|
)
|
||||||
|
|
||||||
func dataSourceBasicServiceSnapshotListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func dataSourceBasicServiceSnapshotListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
|
|||||||
124
internal/service/cloudapi/bservice/flattens.go
Normal file
124
internal/service/cloudapi/bservice/flattens.go
Normal file
@@ -0,0 +1,124 @@
|
|||||||
|
package bservice
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/bservice"
|
||||||
|
)
|
||||||
|
|
||||||
|
func flattenResourceBasicServiceGroup(d *schema.ResourceData, bsg *bservice.RecordGroup) {
|
||||||
|
d.Set("account_id", bsg.AccountID)
|
||||||
|
d.Set("account_name", bsg.AccountName)
|
||||||
|
d.Set("computes", flattenBSGroupComputes(bsg.Computes))
|
||||||
|
d.Set("consistency", bsg.Consistency)
|
||||||
|
d.Set("cpu", bsg.CPU)
|
||||||
|
d.Set("created_by", bsg.CreatedBy)
|
||||||
|
d.Set("created_time", bsg.CreatedTime)
|
||||||
|
d.Set("deleted_by", bsg.DeletedBy)
|
||||||
|
d.Set("deleted_time", bsg.DeletedTime)
|
||||||
|
d.Set("disk", bsg.Disk)
|
||||||
|
d.Set("driver", bsg.Driver)
|
||||||
|
d.Set("extnets", bsg.ExtNets)
|
||||||
|
d.Set("gid", bsg.GID)
|
||||||
|
d.Set("guid", bsg.GUID)
|
||||||
|
d.Set("image_id", bsg.ImageID)
|
||||||
|
d.Set("milestones", bsg.Milestones)
|
||||||
|
d.Set("compgroup_name", bsg.Name)
|
||||||
|
d.Set("compgroup_id", bsg.ID)
|
||||||
|
d.Set("parents", bsg.Parents)
|
||||||
|
d.Set("ram", bsg.RAM)
|
||||||
|
d.Set("rg_id", bsg.RGID)
|
||||||
|
d.Set("rg_name", bsg.RGName)
|
||||||
|
d.Set("role", bsg.Role)
|
||||||
|
d.Set("sep_id", bsg.SEPID)
|
||||||
|
d.Set("seq_no", bsg.SeqNo)
|
||||||
|
d.Set("status", bsg.Status)
|
||||||
|
d.Set("tech_status", bsg.TechStatus)
|
||||||
|
d.Set("timeout_start", bsg.TimeoutStart)
|
||||||
|
d.Set("updated_by", bsg.UpdatedBy)
|
||||||
|
d.Set("updated_time", bsg.UpdatedTime)
|
||||||
|
d.Set("vinses", bsg.VINSes)
|
||||||
|
}
|
||||||
|
|
||||||
|
func flattenGroups(groups bservice.ListGroups) []map[string]interface{} {
|
||||||
|
res := make([]map[string]interface{}, 0)
|
||||||
|
for _, group := range groups {
|
||||||
|
temp := map[string]interface{}{
|
||||||
|
"computes": group.Computes,
|
||||||
|
"consistency": group.Consistency,
|
||||||
|
"id": group.ID,
|
||||||
|
"name": group.Name,
|
||||||
|
"status": group.Status,
|
||||||
|
"tech_status": group.TechStatus,
|
||||||
|
}
|
||||||
|
res = append(res, temp)
|
||||||
|
}
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
func flattenService(d *schema.ResourceData, bs *bservice.RecordBasicService) {
|
||||||
|
d.Set("account_id", bs.AccountID)
|
||||||
|
d.Set("account_name", bs.AccountName)
|
||||||
|
d.Set("base_domain", bs.BaseDomain)
|
||||||
|
d.Set("computes", flattenBasicServiceComputes(bs.Computes))
|
||||||
|
d.Set("cpu_total", bs.CPUTotal)
|
||||||
|
d.Set("created_by", bs.CreatedBy)
|
||||||
|
d.Set("created_time", bs.CreatedTime)
|
||||||
|
d.Set("deleted_by", bs.DeletedBy)
|
||||||
|
d.Set("deleted_time", bs.DeletedTime)
|
||||||
|
d.Set("disk_total", bs.DiskTotal)
|
||||||
|
d.Set("gid", bs.GID)
|
||||||
|
d.Set("groups", flattenGroups(bs.Groups))
|
||||||
|
d.Set("guid", bs.GUID)
|
||||||
|
d.Set("milestones", bs.Milestones)
|
||||||
|
d.Set("service_name", bs.Name)
|
||||||
|
d.Set("service_id", bs.ID)
|
||||||
|
d.Set("parent_srv_id", bs.ParentSrvID)
|
||||||
|
d.Set("parent_srv_type", bs.ParentSrvType)
|
||||||
|
d.Set("ram_total", bs.RAMTotal)
|
||||||
|
d.Set("rg_id", bs.RGID)
|
||||||
|
d.Set("rg_name", bs.RGName)
|
||||||
|
d.Set("snapshots", flattenBasicServiceSnapshots(bs.Snapshots))
|
||||||
|
d.Set("ssh_key", bs.SSHKey)
|
||||||
|
d.Set("ssh_user", bs.SSHUser)
|
||||||
|
d.Set("status", bs.Status)
|
||||||
|
d.Set("tech_status", bs.TechStatus)
|
||||||
|
d.Set("updated_by", bs.UpdatedBy)
|
||||||
|
d.Set("updated_time", bs.UpdatedTime)
|
||||||
|
d.Set("user_managed", bs.UserManaged)
|
||||||
|
}
|
||||||
|
|
||||||
|
func flattenBasicServiceComputes(bscs bservice.ListComputes) []map[string]interface{} {
|
||||||
|
res := make([]map[string]interface{}, 0)
|
||||||
|
for _, bsc := range bscs {
|
||||||
|
temp := map[string]interface{}{
|
||||||
|
"account_id": bsc.AccountID,
|
||||||
|
"architecture": bsc.Architecture,
|
||||||
|
"compgroup_id": bsc.CompGroupID,
|
||||||
|
"compgroup_name": bsc.CompGroupName,
|
||||||
|
"compgroup_role": bsc.CompGroupRole,
|
||||||
|
"id": bsc.ID,
|
||||||
|
"name": bsc.Name,
|
||||||
|
"rg_id": bsc.RGID,
|
||||||
|
"stack_id": bsc.StackID,
|
||||||
|
"status": bsc.Status,
|
||||||
|
"tech_status": bsc.TechStatus,
|
||||||
|
}
|
||||||
|
res = append(res, temp)
|
||||||
|
}
|
||||||
|
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
func flattenBasicServiceSnapshots(bsrvss bservice.ListSnapshots) []map[string]interface{} {
|
||||||
|
res := make([]map[string]interface{}, 0)
|
||||||
|
for _, bsrvs := range bsrvss {
|
||||||
|
temp := map[string]interface{}{
|
||||||
|
"guid": bsrvs.GUID,
|
||||||
|
"label": bsrvs.Label,
|
||||||
|
"timestamp": bsrvs.Timestamp,
|
||||||
|
"valid": bsrvs.Valid,
|
||||||
|
}
|
||||||
|
res = append(res, temp)
|
||||||
|
}
|
||||||
|
return res
|
||||||
|
}
|
||||||
@@ -1,144 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|
||||||
Authors:
|
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
|
||||||
builds seamlessly.
|
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
|
||||||
*/
|
|
||||||
|
|
||||||
package bservice
|
|
||||||
|
|
||||||
///Structs
|
|
||||||
|
|
||||||
type BasicServiceCompute struct {
|
|
||||||
CompGroupId int `json:"compgroupId"`
|
|
||||||
CompGroupName string `json:"compgroupName"`
|
|
||||||
CompGroupRole string `json:"compgroupRole"`
|
|
||||||
ID int `json:"id"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type BasicServiceComputes []BasicServiceCompute
|
|
||||||
|
|
||||||
type BasicServiceSnapshot struct {
|
|
||||||
GUID string `json:"guid"`
|
|
||||||
Label string `json:"label"`
|
|
||||||
Timestamp int `json:"timestamp"`
|
|
||||||
Valid bool `json:"valid"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type BasicServiceSnapshots []BasicServiceSnapshot
|
|
||||||
|
|
||||||
type BasicService struct {
|
|
||||||
AccountId int `json:"accountId"`
|
|
||||||
AccountName string `json:"accountName"`
|
|
||||||
BaseDomain string `json:"baseDomain"`
|
|
||||||
|
|
||||||
CreatedBy string `json:"createdBy"`
|
|
||||||
CreatedTime int `json:"createdTime"`
|
|
||||||
DeletedBy string `json:"deletedBy"`
|
|
||||||
DeletedTime int `json:"deletedTime"`
|
|
||||||
GID int `json:"gid"`
|
|
||||||
Groups []int `json:"groups"`
|
|
||||||
GUID int `json:"guid"`
|
|
||||||
ID int `json:"id"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
ParentSrvId int `json:"parentSrvId"`
|
|
||||||
ParentSrvType string `json:"parentSrvType"`
|
|
||||||
RGID int `json:"rgId"`
|
|
||||||
RGName string `json:"rgName"`
|
|
||||||
SSHUser string `json:"sshUser"`
|
|
||||||
Status string `json:"status"`
|
|
||||||
TechStatus string `json:"techStatus"`
|
|
||||||
UpdatedBy string `json:"updatedBy"`
|
|
||||||
UpdatedTime int `json:"updatedTime"`
|
|
||||||
UserManaged bool `json:"userManaged"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type BasicServiceList []BasicService
|
|
||||||
|
|
||||||
type BasicServiceExtend struct {
|
|
||||||
BasicService
|
|
||||||
Computes BasicServiceComputes `json:"computes"`
|
|
||||||
CPUTotal int `json:"cpuTotal"`
|
|
||||||
DiskTotal int `json:"diskTotal"`
|
|
||||||
GroupsName []string `json:"groupsName"`
|
|
||||||
Milestones int `json:"milestones"`
|
|
||||||
RamTotal int `json:"ramTotal"`
|
|
||||||
Snapshots BasicServiceSnapshots `json:"snapshots"`
|
|
||||||
SSHKey string `json:"sshKey"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type BasicServiceGroupOSUser struct {
|
|
||||||
Login string `json:"login"`
|
|
||||||
Password string `json:"password"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type BasicServiceGroupOSUsers []BasicServiceGroupOSUser
|
|
||||||
|
|
||||||
type BasicServicceGroupCompute struct {
|
|
||||||
ID int `json:"id"`
|
|
||||||
IPAdresses []string `json:"ipAddresses"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
OSUsers BasicServiceGroupOSUsers `json:"osUsers"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type BasicServiceGroupComputes []BasicServicceGroupCompute
|
|
||||||
|
|
||||||
type BasicServiceGroup struct {
|
|
||||||
AccountId int `json:"accountId"`
|
|
||||||
AccountName string `json:"accountName"`
|
|
||||||
Computes BasicServiceGroupComputes `json:"computes"`
|
|
||||||
Consistency bool `json:"consistency"`
|
|
||||||
CPU int `json:"cpu"`
|
|
||||||
CreatedBy string `json:"createdBy"`
|
|
||||||
CreatedTime int `json:"createdTime"`
|
|
||||||
DeletedBy string `json:"deletedBy"`
|
|
||||||
DeletedTime int `json:"deletedTime"`
|
|
||||||
Disk int `json:"disk"`
|
|
||||||
Driver string `json:"driver"`
|
|
||||||
Extnets []int `json:"extnets"`
|
|
||||||
GID int `json:"gid"`
|
|
||||||
GUID int `json:"guid"`
|
|
||||||
ID int `json:"id"`
|
|
||||||
ImageId int `json:"imageId"`
|
|
||||||
Milestones int `json:"milestones"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
Parents []int `json:"parents"`
|
|
||||||
RAM int `json:"ram"`
|
|
||||||
RGID int `json:"rgId"`
|
|
||||||
RGName string `json:"rgName"`
|
|
||||||
Role string `json:"role"`
|
|
||||||
SepId int `json:"sepId"`
|
|
||||||
SeqNo int `json:"seqNo"`
|
|
||||||
ServiceId int `json:"serviceId"`
|
|
||||||
Status string `json:"status"`
|
|
||||||
TechStatus string `json:"techStatus"`
|
|
||||||
TimeoutStart int `json:"timeoutStart"`
|
|
||||||
UpdatedBy string `json:"updatedBy"`
|
|
||||||
UpdatedTime int `json:"updatedTime"`
|
|
||||||
Vinses []int `json:"vinses"`
|
|
||||||
}
|
|
||||||
@@ -3,6 +3,7 @@ Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@@ -21,176 +22,280 @@ limitations under the License.
|
|||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package bservice
|
package bservice
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"net/url"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/constants"
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/controller"
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/bservice"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/status"
|
||||||
)
|
)
|
||||||
|
|
||||||
func resourceBasicServiceCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func resourceBasicServiceCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
log.Debugf("resourceBasicServiceCreate")
|
log.Debugf("resourceBasicServiceCreate")
|
||||||
|
|
||||||
c := m.(*controller.ControllerCfg)
|
c := m.(*controller.ControllerCfg)
|
||||||
urlValues := &url.Values{}
|
req := bservice.CreateRequest{}
|
||||||
|
|
||||||
urlValues.Add("name", d.Get("service_name").(string))
|
haveRGID, err := existRGID(ctx, d, m)
|
||||||
urlValues.Add("rgId", strconv.Itoa(d.Get("rg_id").(int)))
|
|
||||||
|
|
||||||
if sshKey, ok := d.GetOk("ssh_key"); ok {
|
|
||||||
urlValues.Add("sshKey", sshKey.(string))
|
|
||||||
}
|
|
||||||
if sshUser, ok := d.GetOk("ssh_user"); ok {
|
|
||||||
urlValues.Add("sshUser", sshUser.(string))
|
|
||||||
}
|
|
||||||
|
|
||||||
serviceId, err := c.DecortAPICall(ctx, "POST", bserviceCreateAPI, urlValues)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
d.SetId(serviceId)
|
if !haveRGID {
|
||||||
d.Set("service_id", serviceId)
|
return diag.Errorf("resourceBasicServiceCreate: can't create basic service because RGID %d is not allowed or does not exist", d.Get("rg_id").(int))
|
||||||
|
|
||||||
diagnostics := resourceBasicServiceRead(ctx, d, m)
|
|
||||||
if diagnostics != nil {
|
|
||||||
return diagnostics
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
req.Name = d.Get("service_name").(string)
|
||||||
|
req.RGID = uint64(d.Get("rg_id").(int))
|
||||||
|
|
||||||
|
if sshKey, ok := d.GetOk("ssh_key"); ok {
|
||||||
|
req.SSHKey = sshKey.(string)
|
||||||
|
}
|
||||||
|
if sshUser, ok := d.GetOk("ssh_user"); ok {
|
||||||
|
req.SSHUser = sshUser.(string)
|
||||||
|
}
|
||||||
|
|
||||||
|
serviceId, err := c.CloudAPI().BService().Create(ctx, req)
|
||||||
|
if err != nil {
|
||||||
|
return diag.FromErr(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
d.SetId(strconv.FormatUint(serviceId, 10))
|
||||||
|
d.Set("service_id", serviceId)
|
||||||
|
|
||||||
|
return resourceBasicServiceRead(ctx, d, m)
|
||||||
}
|
}
|
||||||
|
|
||||||
func resourceBasicServiceRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func resourceBasicServiceRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
log.Debugf("resourceBasicServiceRead")
|
log.Debugf("resourceBasicServiceRead")
|
||||||
|
|
||||||
|
c := m.(*controller.ControllerCfg)
|
||||||
|
|
||||||
bs, err := utilityBasicServiceCheckPresence(ctx, d, m)
|
bs, err := utilityBasicServiceCheckPresence(ctx, d, m)
|
||||||
if bs == nil {
|
if err != nil {
|
||||||
d.SetId("")
|
d.SetId("")
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
d.Set("account_id", bs.AccountId)
|
hasChanged := false
|
||||||
d.Set("account_name", bs.AccountName)
|
|
||||||
d.Set("base_domain", bs.BaseDomain)
|
switch bs.Status {
|
||||||
d.Set("computes", flattenBasicServiceComputes(bs.Computes))
|
case status.Modeled:
|
||||||
d.Set("cpu_total", bs.CPUTotal)
|
return diag.Errorf("The basic service is in status: %s, please, contact support for more information", bs.Status)
|
||||||
d.Set("created_by", bs.CreatedBy)
|
case status.Created:
|
||||||
d.Set("created_time", bs.CreatedTime)
|
case status.Enabled:
|
||||||
d.Set("deleted_by", bs.DeletedBy)
|
case status.Enabling:
|
||||||
d.Set("deleted_time", bs.DeletedTime)
|
case status.Disabled:
|
||||||
d.Set("disk_total", bs.DiskTotal)
|
log.Debugf("The basic service is in status: %s, troubles can occur with the update. Please, enable bservice first.", bs.Status)
|
||||||
d.Set("gid", bs.GID)
|
case status.Disabling:
|
||||||
d.Set("groups", bs.Groups)
|
log.Debugf("The basic service is in status: %s, troubles can occur with the update.", bs.Status)
|
||||||
d.Set("groups_name", bs.GroupsName)
|
case status.Deleted:
|
||||||
d.Set("guid", bs.GUID)
|
id, _ := strconv.ParseUint(d.Id(), 10, 64)
|
||||||
d.Set("milestones", bs.Milestones)
|
restoreReq := bservice.RestoreRequest{
|
||||||
d.Set("service_name", bs.Name)
|
ServiceID: id,
|
||||||
d.Set("service_id", bs.ID)
|
}
|
||||||
d.Set("parent_srv_id", bs.ParentSrvId)
|
enableReq := bservice.EnableRequest{
|
||||||
d.Set("parent_srv_type", bs.ParentSrvType)
|
ServiceID: id,
|
||||||
d.Set("ram_total", bs.RamTotal)
|
}
|
||||||
d.Set("rg_id", bs.RGID)
|
|
||||||
d.Set("rg_name", bs.RGName)
|
_, err := c.CloudAPI().BService().Restore(ctx, restoreReq)
|
||||||
d.Set("snapshots", flattenBasicServiceSnapshots(bs.Snapshots))
|
if err != nil {
|
||||||
d.Set("ssh_key", bs.SSHKey)
|
return diag.FromErr(err)
|
||||||
d.Set("ssh_user", bs.SSHUser)
|
}
|
||||||
d.Set("status", bs.Status)
|
|
||||||
d.Set("tech_status", bs.TechStatus)
|
_, err = c.CloudAPI().BService().Enable(ctx, enableReq)
|
||||||
d.Set("updated_by", bs.UpdatedBy)
|
if err != nil {
|
||||||
d.Set("updated_time", bs.UpdatedTime)
|
return diag.FromErr(err)
|
||||||
d.Set("user_managed", bs.UserManaged)
|
}
|
||||||
|
|
||||||
|
hasChanged = true
|
||||||
|
case status.Deleting:
|
||||||
|
case status.Destroyed:
|
||||||
|
d.SetId("")
|
||||||
|
return resourceBasicServiceCreate(ctx, d, m)
|
||||||
|
case status.Destroying:
|
||||||
|
return diag.Errorf("The basic service is in progress with status: %s", bs.Status)
|
||||||
|
case status.Restoring:
|
||||||
|
case status.Reconfiguring:
|
||||||
|
}
|
||||||
|
|
||||||
|
if hasChanged {
|
||||||
|
bs, err = utilityBasicServiceCheckPresence(ctx, d, m)
|
||||||
|
if err != nil {
|
||||||
|
d.SetId("")
|
||||||
|
return diag.FromErr(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
flattenService(d, bs)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func resourceBasicServiceDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func resourceBasicServiceDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
log.Debugf("resourceBasicServiceDelete")
|
log.Debugf("resourceBasicServiceDelete")
|
||||||
|
|
||||||
bs, err := utilityBasicServiceCheckPresence(ctx, d, m)
|
|
||||||
if bs == nil {
|
|
||||||
if err != nil {
|
|
||||||
return diag.FromErr(err)
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
c := m.(*controller.ControllerCfg)
|
c := m.(*controller.ControllerCfg)
|
||||||
urlValues := &url.Values{}
|
|
||||||
urlValues.Add("serviceId", strconv.Itoa(d.Get("service_id").(int)))
|
|
||||||
urlValues.Add("permanently", strconv.FormatBool(d.Get("permanently").(bool)))
|
|
||||||
|
|
||||||
_, err = c.DecortAPICall(ctx, "POST", bserviceDeleteAPI, urlValues)
|
_, err := utilityBasicServiceCheckPresence(ctx, d, m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
req := bservice.DeleteRequest{
|
||||||
|
ServiceID: uint64(d.Get("service_id").(int)),
|
||||||
|
Permanently: d.Get("permanently").(bool),
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err = c.CloudAPI().BService().Delete(ctx, req)
|
||||||
|
if err != nil {
|
||||||
|
return diag.FromErr(err)
|
||||||
|
}
|
||||||
|
|
||||||
d.SetId("")
|
d.SetId("")
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func resourceBasicServiceEdit(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func resourceBasicServiceUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
log.Debugf("resourceBasicServiceEdit")
|
log.Debugf("resourceBasicServiceUpdate")
|
||||||
c := m.(*controller.ControllerCfg)
|
c := m.(*controller.ControllerCfg)
|
||||||
|
|
||||||
urlValues := &url.Values{}
|
haveRGID, err := existRGID(ctx, d, m)
|
||||||
if d.HasChange("enable") {
|
if err != nil {
|
||||||
api := bserviceDisableAPI
|
return diag.FromErr(err)
|
||||||
enable := d.Get("enable").(bool)
|
}
|
||||||
if enable {
|
|
||||||
api = bserviceEnableAPI
|
|
||||||
}
|
|
||||||
urlValues.Add("serviceId", strconv.Itoa(d.Get("service_id").(int)))
|
|
||||||
|
|
||||||
_, err := c.DecortAPICall(ctx, "POST", api, urlValues)
|
if !haveRGID {
|
||||||
|
return diag.Errorf("resourceBasicServiceUpdate: can't create basic service because RGID %d is not allowed or does not exist", d.Get("rg_id").(int))
|
||||||
|
}
|
||||||
|
|
||||||
|
bs, err := utilityBasicServiceCheckPresence(ctx, d, m)
|
||||||
|
if err != nil {
|
||||||
|
d.SetId("")
|
||||||
|
return diag.FromErr(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
hasChanged := false
|
||||||
|
|
||||||
|
switch bs.Status {
|
||||||
|
case status.Modeled:
|
||||||
|
return diag.Errorf("The basic service is in status: %s, please, contact support for more information", bs.Status)
|
||||||
|
case status.Created:
|
||||||
|
case status.Enabled:
|
||||||
|
case status.Enabling:
|
||||||
|
case status.Disabled:
|
||||||
|
log.Debugf("The basic service is in status: %s, troubles can occur with the update. Please, enable bservice first.", bs.Status)
|
||||||
|
case status.Disabling:
|
||||||
|
log.Debugf("The basic service is in status: %s, troubles can occur with the update.", bs.Status)
|
||||||
|
case status.Deleted:
|
||||||
|
id, _ := strconv.ParseUint(d.Id(), 10, 64)
|
||||||
|
restoreReq := bservice.RestoreRequest{
|
||||||
|
ServiceID: id,
|
||||||
|
}
|
||||||
|
enableReq := bservice.EnableRequest{
|
||||||
|
ServiceID: id,
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err := c.CloudAPI().BService().Restore(ctx, restoreReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
urlValues = &url.Values{}
|
_, err = c.CloudAPI().BService().Enable(ctx, enableReq)
|
||||||
|
if err != nil {
|
||||||
|
return diag.FromErr(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
hasChanged = true
|
||||||
|
case status.Deleting:
|
||||||
|
case status.Destroyed:
|
||||||
|
d.SetId("")
|
||||||
|
return resourceBasicServiceCreate(ctx, d, m)
|
||||||
|
case status.Destroying:
|
||||||
|
return diag.Errorf("The basic service is in progress with status: %s", bs.Status)
|
||||||
|
case status.Restoring:
|
||||||
|
case status.Reconfiguring:
|
||||||
|
}
|
||||||
|
|
||||||
|
if hasChanged {
|
||||||
|
bs, err = utilityBasicServiceCheckPresence(ctx, d, m)
|
||||||
|
if err != nil {
|
||||||
|
d.SetId("")
|
||||||
|
return diag.FromErr(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if d.HasChange("enable") {
|
||||||
|
enable := d.Get("enable").(bool)
|
||||||
|
if enable {
|
||||||
|
req := bservice.EnableRequest{
|
||||||
|
ServiceID: uint64(d.Get("service_id").(int)),
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err := c.CloudAPI().BService().Enable(ctx, req)
|
||||||
|
if err != nil {
|
||||||
|
return diag.FromErr(err)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
req := bservice.DisableRequest{
|
||||||
|
ServiceID: uint64(d.Get("service_id").(int)),
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err := c.CloudAPI().BService().Disable(ctx, req)
|
||||||
|
if err != nil {
|
||||||
|
return diag.FromErr(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if d.HasChange("restore") {
|
if d.HasChange("restore") {
|
||||||
restore := d.Get("restore").(bool)
|
restore := d.Get("restore").(bool)
|
||||||
if restore {
|
if restore {
|
||||||
urlValues.Add("serviceId", strconv.Itoa(d.Get("service_id").(int)))
|
req := bservice.RestoreRequest{
|
||||||
_, err := c.DecortAPICall(ctx, "POST", bserviceRestoreAPI, urlValues)
|
ServiceID: uint64(d.Get("service_id").(int)),
|
||||||
|
}
|
||||||
|
_, err := c.CloudAPI().BService().Restore(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
urlValues = &url.Values{}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if d.HasChange("start") {
|
if d.HasChange("start") {
|
||||||
api := bserviceStopAPI
|
|
||||||
start := d.Get("start").(bool)
|
start := d.Get("start").(bool)
|
||||||
if start {
|
if start {
|
||||||
api = bserviceStartAPI
|
req := bservice.StartRequest{
|
||||||
}
|
ServiceID: uint64(d.Get("service_id").(int)),
|
||||||
urlValues.Add("serviceId", strconv.Itoa(d.Get("service_id").(int)))
|
}
|
||||||
|
|
||||||
_, err := c.DecortAPICall(ctx, "POST", api, urlValues)
|
_, err := c.CloudAPI().BService().Start(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
req := bservice.StopRequest{
|
||||||
|
ServiceID: uint64(d.Get("service_id").(int)),
|
||||||
|
}
|
||||||
|
|
||||||
urlValues = &url.Values{}
|
_, err := c.CloudAPI().BService().Stop(ctx, req)
|
||||||
|
if err != nil {
|
||||||
|
return diag.FromErr(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if d.HasChange("snapshots") {
|
if d.HasChange("snapshots") {
|
||||||
@@ -219,42 +324,45 @@ func resourceBasicServiceEdit(ctx context.Context, d *schema.ResourceData, m int
|
|||||||
if len(deletedSnapshots) > 0 {
|
if len(deletedSnapshots) > 0 {
|
||||||
for _, snapshot := range deletedSnapshots {
|
for _, snapshot := range deletedSnapshots {
|
||||||
snapshotConv := snapshot.(map[string]interface{})
|
snapshotConv := snapshot.(map[string]interface{})
|
||||||
urlValues.Add("serviceId", strconv.Itoa(d.Get("service_id").(int)))
|
req := bservice.SnapshotDeleteRequest{
|
||||||
urlValues.Add("label", snapshotConv["label"].(string))
|
ServiceID: uint64(d.Get("service_id").(int)),
|
||||||
_, err := c.DecortAPICall(ctx, "POST", bserviceSnapshotDeleteAPI, urlValues)
|
Label: snapshotConv["label"].(string),
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err := c.CloudAPI().BService().SnapshotDelete(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
urlValues = &url.Values{}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(addedSnapshots) > 0 {
|
if len(addedSnapshots) > 0 {
|
||||||
for _, snapshot := range addedSnapshots {
|
for _, snapshot := range addedSnapshots {
|
||||||
snapshotConv := snapshot.(map[string]interface{})
|
snapshotConv := snapshot.(map[string]interface{})
|
||||||
urlValues.Add("serviceId", strconv.Itoa(d.Get("service_id").(int)))
|
req := bservice.SnapshotCreateRequest{
|
||||||
urlValues.Add("label", snapshotConv["label"].(string))
|
ServiceID: uint64(d.Get("service_id").(int)),
|
||||||
_, err := c.DecortAPICall(ctx, "POST", bserviceSnapshotCreateAPI, urlValues)
|
Label: snapshotConv["label"].(string),
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err := c.CloudAPI().BService().SnapshotCreate(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
urlValues = &url.Values{}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(updatedSnapshots) > 0 {
|
if len(updatedSnapshots) > 0 {
|
||||||
for _, snapshot := range updatedSnapshots {
|
for _, snapshot := range updatedSnapshots {
|
||||||
snapshotConv := snapshot.(map[string]interface{})
|
snapshotConv := snapshot.(map[string]interface{})
|
||||||
urlValues.Add("serviceId", strconv.Itoa(d.Get("service_id").(int)))
|
req := bservice.SnapshotRollbackRequest{
|
||||||
urlValues.Add("label", snapshotConv["label"].(string))
|
ServiceID: uint64(d.Get("service_id").(int)),
|
||||||
_, err := c.DecortAPICall(ctx, "POST", bserviceSnapshotRollbackAPI, urlValues)
|
Label: snapshotConv["label"].(string),
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err := c.CloudAPI().BService().SnapshotRollback(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
urlValues = &url.Values{}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -321,7 +429,7 @@ func resourceBasicServiceSchemaMake() map[string]*schema.Schema {
|
|||||||
Type: schema.TypeBool,
|
Type: schema.TypeBool,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
Default: false,
|
Default: false,
|
||||||
Description: "if set to False, Basic service will be deleted to recycle bin. Otherwise destroyed immediately",
|
Description: "Enable service. Enabling a service technically means setting model status of all computes and service itself to ENABLED. It does not start computes.",
|
||||||
},
|
},
|
||||||
"restore": {
|
"restore": {
|
||||||
Type: schema.TypeBool,
|
Type: schema.TypeBool,
|
||||||
@@ -357,6 +465,14 @@ func resourceBasicServiceSchemaMake() map[string]*schema.Schema {
|
|||||||
Computed: true,
|
Computed: true,
|
||||||
Elem: &schema.Resource{
|
Elem: &schema.Resource{
|
||||||
Schema: map[string]*schema.Schema{
|
Schema: map[string]*schema.Schema{
|
||||||
|
"account_id": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"architecture": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
"compgroup_id": {
|
"compgroup_id": {
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
@@ -373,14 +489,29 @@ func resourceBasicServiceSchemaMake() map[string]*schema.Schema {
|
|||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
},
|
},
|
||||||
|
"rg_id": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"stack_id": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
"name": {
|
"name": {
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
},
|
},
|
||||||
|
"status": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"tech_status": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
"cpu_total": {
|
"cpu_total": {
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
@@ -412,15 +543,33 @@ func resourceBasicServiceSchemaMake() map[string]*schema.Schema {
|
|||||||
"groups": {
|
"groups": {
|
||||||
Type: schema.TypeList,
|
Type: schema.TypeList,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
Elem: &schema.Schema{
|
Elem: &schema.Resource{
|
||||||
Type: schema.TypeInt,
|
Schema: map[string]*schema.Schema{
|
||||||
},
|
"computes": {
|
||||||
},
|
Type: schema.TypeInt,
|
||||||
"groups_name": {
|
Computed: true,
|
||||||
Type: schema.TypeList,
|
},
|
||||||
Computed: true,
|
"consistency": {
|
||||||
Elem: &schema.Schema{
|
Type: schema.TypeBool,
|
||||||
Type: schema.TypeString,
|
Computed: true,
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"status": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"tech_status": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"guid": {
|
"guid": {
|
||||||
@@ -507,7 +656,7 @@ func ResourceBasicService() *schema.Resource {
|
|||||||
|
|
||||||
CreateContext: resourceBasicServiceCreate,
|
CreateContext: resourceBasicServiceCreate,
|
||||||
ReadContext: resourceBasicServiceRead,
|
ReadContext: resourceBasicServiceRead,
|
||||||
UpdateContext: resourceBasicServiceEdit,
|
UpdateContext: resourceBasicServiceUpdate,
|
||||||
DeleteContext: resourceBasicServiceDelete,
|
DeleteContext: resourceBasicServiceDelete,
|
||||||
|
|
||||||
Importer: &schema.ResourceImporter{
|
Importer: &schema.ResourceImporter{
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@@ -21,139 +22,90 @@ limitations under the License.
|
|||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package bservice
|
package bservice
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"net/url"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/constants"
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/controller"
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/bservice"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
|
||||||
)
|
)
|
||||||
|
|
||||||
func resourceBasicServiceGroupCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func resourceBasicServiceGroupCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
log.Debugf("resourceBasicServiceGroupCreate")
|
log.Debugf("resourceBasicServiceGroupCreate")
|
||||||
|
|
||||||
c := m.(*controller.ControllerCfg)
|
c := m.(*controller.ControllerCfg)
|
||||||
urlValues := &url.Values{}
|
req := bservice.GroupAddRequest{
|
||||||
|
ServiceID: uint64(d.Get("service_id").(int)),
|
||||||
urlValues.Add("serviceId", strconv.Itoa(d.Get("service_id").(int)))
|
Name: d.Get("compgroup_name").(string),
|
||||||
urlValues.Add("name", d.Get("compgroup_name").(string))
|
Count: uint64(d.Get("comp_count").(int)),
|
||||||
|
CPU: uint64(d.Get("cpu").(int)),
|
||||||
urlValues.Add("count", strconv.Itoa(d.Get("comp_count").(int)))
|
RAM: uint64(d.Get("ram").(int)),
|
||||||
urlValues.Add("cpu", strconv.Itoa(d.Get("cpu").(int)))
|
Disk: uint64(d.Get("disk").(int)),
|
||||||
urlValues.Add("ram", strconv.Itoa(d.Get("ram").(int)))
|
ImageID: uint64(d.Get("image_id").(int)),
|
||||||
urlValues.Add("disk", strconv.Itoa(d.Get("disk").(int)))
|
Driver: d.Get("driver").(string),
|
||||||
urlValues.Add("imageId", strconv.Itoa(d.Get("image_id").(int)))
|
}
|
||||||
urlValues.Add("driver", strings.ToUpper(d.Get("driver").(string)))
|
|
||||||
|
|
||||||
if role, ok := d.GetOk("role"); ok {
|
if role, ok := d.GetOk("role"); ok {
|
||||||
urlValues.Add("role", role.(string))
|
req.Role = role.(string)
|
||||||
}
|
}
|
||||||
|
|
||||||
if timeoutStart, ok := d.GetOk("timeout_start"); ok {
|
if timeoutStart, ok := d.GetOk("timeout_start"); ok {
|
||||||
urlValues.Add("timeoutStart", strconv.Itoa(timeoutStart.(int)))
|
req.TimeoutStart = uint64(timeoutStart.(int))
|
||||||
}
|
}
|
||||||
|
|
||||||
if vinses, ok := d.GetOk("vinses"); ok {
|
if vinses, ok := d.GetOk("vinses"); ok {
|
||||||
vs := vinses.([]interface{})
|
res := []uint64{}
|
||||||
temp := ""
|
for _, vins := range vinses.([]interface{}) {
|
||||||
l := len(vs)
|
res = append(res, uint64(vins.(int)))
|
||||||
for i, v := range vs {
|
|
||||||
s := strconv.Itoa(v.(int))
|
|
||||||
if i != (l - 1) {
|
|
||||||
s += ","
|
|
||||||
}
|
|
||||||
temp = temp + s
|
|
||||||
}
|
}
|
||||||
temp = "[" + temp + "]"
|
|
||||||
urlValues.Add("vinses", temp)
|
req.VINSes = res
|
||||||
}
|
}
|
||||||
if extnets, ok := d.GetOk("extnets"); ok {
|
if extnets, ok := d.GetOk("extnets"); ok {
|
||||||
es := extnets.([]interface{})
|
res := []uint64{}
|
||||||
temp := ""
|
for _, enet := range extnets.([]interface{}) {
|
||||||
l := len(es)
|
res = append(res, uint64(enet.(int)))
|
||||||
for i, e := range es {
|
|
||||||
s := strconv.Itoa(e.(int))
|
|
||||||
if i != (l - 1) {
|
|
||||||
s += ","
|
|
||||||
}
|
|
||||||
temp = temp + s
|
|
||||||
}
|
}
|
||||||
temp = "[" + temp + "]"
|
|
||||||
urlValues.Add("extnets", temp)
|
req.ExtNets = res
|
||||||
}
|
}
|
||||||
|
|
||||||
compgroupId, err := c.DecortAPICall(ctx, "POST", bserviceGroupAddAPI, urlValues)
|
compgroupId, err := c.CloudAPI().BService().GroupAdd(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
d.SetId(compgroupId)
|
d.SetId(strconv.FormatUint(compgroupId, 10))
|
||||||
d.Set("compgroup_id", compgroupId)
|
d.Set("compgroup_id", compgroupId)
|
||||||
|
|
||||||
diagnostics := resourceBasicServiceGroupRead(ctx, d, m)
|
return resourceBasicServiceGroupRead(ctx, d, m)
|
||||||
if diagnostics != nil {
|
|
||||||
return diagnostics
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func resourceBasicServiceGroupRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func resourceBasicServiceGroupRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
log.Debugf("resourceBasicServiceGroupRead")
|
log.Debugf("resourceBasicServiceGroupRead")
|
||||||
|
|
||||||
bsg, err := utilityBasicServiceGroupCheckPresence(ctx, d, m)
|
bsg, err := utilityBasicServiceGroupCheckPresence(ctx, d, m)
|
||||||
if bsg == nil {
|
if err != nil {
|
||||||
d.SetId("")
|
d.SetId("")
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
d.Set("account_id", bsg.AccountId)
|
flattenResourceBasicServiceGroup(d, bsg)
|
||||||
d.Set("account_name", bsg.AccountName)
|
|
||||||
d.Set("computes", flattenBSGroupComputes(bsg.Computes))
|
|
||||||
d.Set("consistency", bsg.Consistency)
|
|
||||||
d.Set("cpu", bsg.CPU)
|
|
||||||
d.Set("created_by", bsg.CreatedBy)
|
|
||||||
d.Set("created_time", bsg.CreatedTime)
|
|
||||||
d.Set("deleted_by", bsg.DeletedBy)
|
|
||||||
d.Set("deleted_time", bsg.DeletedTime)
|
|
||||||
d.Set("disk", bsg.Disk)
|
|
||||||
d.Set("driver", bsg.Driver)
|
|
||||||
d.Set("extnets", bsg.Extnets)
|
|
||||||
d.Set("gid", bsg.GID)
|
|
||||||
d.Set("guid", bsg.GUID)
|
|
||||||
d.Set("image_id", bsg.ImageId)
|
|
||||||
d.Set("milestones", bsg.Milestones)
|
|
||||||
d.Set("compgroup_name", bsg.Name)
|
|
||||||
d.Set("compgroup_id", bsg.ID)
|
|
||||||
d.Set("parents", bsg.Parents)
|
|
||||||
d.Set("ram", bsg.RAM)
|
|
||||||
d.Set("rg_id", bsg.RGID)
|
|
||||||
d.Set("rg_name", bsg.RGName)
|
|
||||||
d.Set("role", bsg.Role)
|
|
||||||
d.Set("sep_id", bsg.SepId)
|
|
||||||
d.Set("seq_no", bsg.SeqNo)
|
|
||||||
d.Set("status", bsg.Status)
|
|
||||||
d.Set("tech_status", bsg.TechStatus)
|
|
||||||
d.Set("timeout_start", bsg.TimeoutStart)
|
|
||||||
d.Set("updated_by", bsg.UpdatedBy)
|
|
||||||
d.Set("updated_time", bsg.UpdatedTime)
|
|
||||||
d.Set("vinses", bsg.Vinses)
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -162,19 +114,17 @@ func resourceBasicServiceGroupDelete(ctx context.Context, d *schema.ResourceData
|
|||||||
log.Debugf("resourceBasicServiceGroupDelete")
|
log.Debugf("resourceBasicServiceGroupDelete")
|
||||||
|
|
||||||
bsg, err := utilityBasicServiceGroupCheckPresence(ctx, d, m)
|
bsg, err := utilityBasicServiceGroupCheckPresence(ctx, d, m)
|
||||||
if bsg == nil {
|
if err != nil {
|
||||||
if err != nil {
|
return diag.FromErr(err)
|
||||||
return diag.FromErr(err)
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
c := m.(*controller.ControllerCfg)
|
c := m.(*controller.ControllerCfg)
|
||||||
urlValues := &url.Values{}
|
req := bservice.GroupRemoveRequest{
|
||||||
urlValues.Add("serviceId", strconv.Itoa(d.Get("service_id").(int)))
|
ServiceID: bsg.ServiceID,
|
||||||
urlValues.Add("compgroupId", strconv.Itoa(d.Get("compgroup_id").(int)))
|
CompGroupID: bsg.ID,
|
||||||
|
}
|
||||||
|
|
||||||
_, err = c.DecortAPICall(ctx, "POST", bserviceGroupRemoveAPI, urlValues)
|
_, err = c.CloudAPI().BService().GroupRemove(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
@@ -183,113 +133,106 @@ func resourceBasicServiceGroupDelete(ctx context.Context, d *schema.ResourceData
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func resourceBasicServiceGroupEdit(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func resourceBasicServiceGroupUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
log.Debugf("resourceBasicServiceGroupEdit")
|
log.Debugf("resourceBasicServiceGroupEdit")
|
||||||
c := m.(*controller.ControllerCfg)
|
c := m.(*controller.ControllerCfg)
|
||||||
|
|
||||||
urlValues := &url.Values{}
|
|
||||||
|
|
||||||
if d.HasChange("comp_count") {
|
if d.HasChange("comp_count") {
|
||||||
urlValues.Add("serviceId", strconv.Itoa(d.Get("service_id").(int)))
|
req := bservice.GroupResizeRequest{
|
||||||
urlValues.Add("compgroupId", strconv.Itoa(d.Get("compgroup_id").(int)))
|
ServiceID: uint64(d.Get("service_id").(int)),
|
||||||
urlValues.Add("count", strconv.Itoa(d.Get("comp_count").(int)))
|
CompGroupID: uint64(d.Get("compgroup_id").(int)),
|
||||||
urlValues.Add("mode", strings.ToUpper(d.Get("mode").(string)))
|
Count: int64(d.Get("comp_count").(int)),
|
||||||
_, err := c.DecortAPICall(ctx, "POST", bserviceGroupResizeAPI, urlValues)
|
Mode: d.Get("mode").(string),
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err := c.CloudAPI().BService().GroupResize(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
urlValues = &url.Values{}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if d.HasChange("start") {
|
if d.HasChange("start") {
|
||||||
api := bserviceGroupStopAPI
|
|
||||||
start := d.Get("start").(bool)
|
start := d.Get("start").(bool)
|
||||||
if start {
|
if start {
|
||||||
api = bserviceGroupStartAPI
|
req := bservice.GroupStartRequest{
|
||||||
|
ServiceID: uint64(d.Get("service_id").(int)),
|
||||||
|
CompGroupID: uint64(d.Get("compgroup_id").(int)),
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err := c.CloudAPI().BService().GroupStart(ctx, req)
|
||||||
|
if err != nil {
|
||||||
|
return diag.FromErr(err)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
urlValues.Add("force", strconv.FormatBool(d.Get("force_stop").(bool)))
|
req := bservice.GroupStopRequest{
|
||||||
}
|
ServiceID: uint64(d.Get("service_id").(int)),
|
||||||
urlValues.Add("serviceId", strconv.Itoa(d.Get("service_id").(int)))
|
CompGroupID: uint64(d.Get("compgroup_id").(int)),
|
||||||
urlValues.Add("compgroupId", strconv.Itoa(d.Get("compgroup_id").(int)))
|
Force: d.Get("force_stop").(bool),
|
||||||
|
}
|
||||||
|
|
||||||
_, err := c.DecortAPICall(ctx, "POST", api, urlValues)
|
_, err := c.CloudAPI().BService().GroupStop(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
urlValues = &url.Values{}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if d.HasChanges("compgroup_name", "ram", "cpu", "disk", "role") {
|
if d.HasChanges("compgroup_name", "ram", "cpu", "disk", "role") {
|
||||||
urlValues.Add("name", d.Get("compgroup_name").(string))
|
req := bservice.GroupUpdateRequest{
|
||||||
urlValues.Add("cpu", strconv.Itoa(d.Get("cpu").(int)))
|
ServiceID: uint64(d.Get("service_id").(int)),
|
||||||
urlValues.Add("ram", strconv.Itoa(d.Get("ram").(int)))
|
CompGroupID: uint64(d.Get("compgroup_id").(int)),
|
||||||
urlValues.Add("disk", strconv.Itoa(d.Get("disk").(int)))
|
Name: d.Get("compgroup_name").(string),
|
||||||
urlValues.Add("role", d.Get("role").(string))
|
Role: d.Get("role").(string),
|
||||||
urlValues.Add("force", strconv.FormatBool(d.Get("force_update").(bool)))
|
CPU: uint64(d.Get("cpu").(int)),
|
||||||
|
RAM: uint64(d.Get("ram").(int)),
|
||||||
|
Disk: uint64(d.Get("disk").(int)),
|
||||||
|
Force: d.Get("force_update").(bool),
|
||||||
|
}
|
||||||
|
|
||||||
urlValues.Add("serviceId", strconv.Itoa(d.Get("service_id").(int)))
|
_, err := c.CloudAPI().BService().GroupUpdate(ctx, req)
|
||||||
urlValues.Add("compgroupId", strconv.Itoa(d.Get("compgroup_id").(int)))
|
|
||||||
|
|
||||||
_, err := c.DecortAPICall(ctx, "POST", bserviceGroupUpdateAPI, urlValues)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
urlValues = &url.Values{}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if d.HasChange("extnets") {
|
if d.HasChange("extnets") {
|
||||||
extnets := d.Get("extnets").([]interface{})
|
extnets := d.Get("extnets").([]interface{})
|
||||||
temp := ""
|
|
||||||
l := len(extnets)
|
|
||||||
for i, e := range extnets {
|
|
||||||
s := strconv.Itoa(e.(int))
|
|
||||||
if i != (l - 1) {
|
|
||||||
s += ",\n"
|
|
||||||
} else {
|
|
||||||
s += "\n"
|
|
||||||
}
|
|
||||||
temp = temp + s
|
|
||||||
}
|
|
||||||
temp = "[" + temp + "]"
|
|
||||||
|
|
||||||
urlValues.Add("serviceId", strconv.Itoa(d.Get("service_id").(int)))
|
res := []uint64{}
|
||||||
urlValues.Add("compgroupId", strconv.Itoa(d.Get("compgroup_id").(int)))
|
for _, enet := range extnets {
|
||||||
urlValues.Add("extnets", temp)
|
res = append(res, uint64(enet.(int)))
|
||||||
_, err := c.DecortAPICall(ctx, "POST", bserviceGroupUpdateExtnetAPI, urlValues)
|
}
|
||||||
|
|
||||||
|
req := bservice.GroupUpdateExtNetRequest{
|
||||||
|
ServiceID: uint64(d.Get("service_id").(int)),
|
||||||
|
CompGroupID: uint64(d.Get("compgroup_id").(int)),
|
||||||
|
ExtNets: res,
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err := c.CloudAPI().BService().GroupUpdateExtNet(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
urlValues = &url.Values{}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if d.HasChange("vinses") {
|
if d.HasChange("vinses") {
|
||||||
vinses := d.Get("vinses").([]interface{})
|
vinses := d.Get("vinses").([]interface{})
|
||||||
temp := ""
|
|
||||||
l := len(vinses)
|
|
||||||
for i, v := range vinses {
|
|
||||||
s := strconv.Itoa(v.(int))
|
|
||||||
if i != (l - 1) {
|
|
||||||
s += ",\n"
|
|
||||||
} else {
|
|
||||||
s += "\n"
|
|
||||||
}
|
|
||||||
temp = temp + s
|
|
||||||
}
|
|
||||||
temp = "[" + temp + "]"
|
|
||||||
|
|
||||||
urlValues.Add("serviceId", strconv.Itoa(d.Get("service_id").(int)))
|
res := []uint64{}
|
||||||
urlValues.Add("compgroupId", strconv.Itoa(d.Get("compgroup_id").(int)))
|
for _, vins := range vinses {
|
||||||
urlValues.Add("vinses", temp)
|
res = append(res, uint64(vins.(int)))
|
||||||
_, err := c.DecortAPICall(ctx, "POST", bserviceGroupUpdateVinsAPI, urlValues)
|
}
|
||||||
|
|
||||||
|
req := bservice.GroupUpdateVINSRequest{
|
||||||
|
ServiceID: uint64(d.Get("service_id").(int)),
|
||||||
|
CompGroupID: uint64(d.Get("compgroup_id").(int)),
|
||||||
|
VINSes: res,
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err := c.CloudAPI().BService().GroupUpdateVINS(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
urlValues = &url.Values{}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if d.HasChange("parents") {
|
if d.HasChange("parents") {
|
||||||
@@ -314,31 +257,33 @@ func resourceBasicServiceGroupEdit(ctx context.Context, d *schema.ResourceData,
|
|||||||
for _, parent := range deletedParents {
|
for _, parent := range deletedParents {
|
||||||
parentConv := parent.(int)
|
parentConv := parent.(int)
|
||||||
|
|
||||||
urlValues.Add("serviceId", strconv.Itoa(d.Get("service_id").(int)))
|
req := bservice.GroupParentRemoveRequest{
|
||||||
urlValues.Add("compgroupId", strconv.Itoa(d.Get("compgroup_id").(int)))
|
ServiceID: uint64(d.Get("service_id").(int)),
|
||||||
urlValues.Add("parentId", strconv.Itoa(parentConv))
|
CompGroupID: uint64(d.Get("compgroup_id").(int)),
|
||||||
|
ParentID: uint64(parentConv),
|
||||||
|
}
|
||||||
|
|
||||||
_, err := c.DecortAPICall(ctx, "POST", bserviceGroupParentRemoveAPI, urlValues)
|
_, err := c.CloudAPI().BService().GroupParentRemove(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
urlValues = &url.Values{}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(addedParents) > 0 {
|
if len(addedParents) > 0 {
|
||||||
for _, parent := range addedParents {
|
for _, parent := range addedParents {
|
||||||
parentConv := parent.(int)
|
parentConv := parent.(int)
|
||||||
urlValues.Add("serviceId", strconv.Itoa(d.Get("service_id").(int)))
|
|
||||||
urlValues.Add("compgroupId", strconv.Itoa(d.Get("compgroup_id").(int)))
|
req := bservice.GroupParentAddRequest{
|
||||||
urlValues.Add("parentId", strconv.Itoa(parentConv))
|
ServiceID: uint64(d.Get("service_id").(int)),
|
||||||
_, err := c.DecortAPICall(ctx, "POST", bserviceGroupParentAddAPI, urlValues)
|
CompGroupID: uint64(d.Get("compgroup_id").(int)),
|
||||||
|
ParentID: uint64(parentConv),
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err := c.CloudAPI().BService().GroupParentAdd(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
urlValues = &url.Values{}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -347,16 +292,16 @@ func resourceBasicServiceGroupEdit(ctx context.Context, d *schema.ResourceData,
|
|||||||
rcs := d.Get("remove_computes").([]interface{})
|
rcs := d.Get("remove_computes").([]interface{})
|
||||||
if len(rcs) > 0 {
|
if len(rcs) > 0 {
|
||||||
for _, rc := range rcs {
|
for _, rc := range rcs {
|
||||||
urlValues.Add("serviceId", strconv.Itoa(d.Get("service_id").(int)))
|
req := bservice.GroupComputeRemoveRequest{
|
||||||
urlValues.Add("compgroupId", strconv.Itoa(d.Get("compgroup_id").(int)))
|
ServiceID: uint64(d.Get("service_id").(int)),
|
||||||
urlValues.Add("computeId", strconv.Itoa(rc.(int)))
|
CompGroupID: uint64(d.Get("compgroup_id").(int)),
|
||||||
|
ComputeID: uint64(rc.(int)),
|
||||||
|
}
|
||||||
|
|
||||||
_, err := c.DecortAPICall(ctx, "POST", bserviceGroupComputeRemoveAPI, urlValues)
|
_, err := c.CloudAPI().BService().GroupComputeRemove(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
urlValues = &url.Values{}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -612,7 +557,7 @@ func ResourceBasicServiceGroup() *schema.Resource {
|
|||||||
|
|
||||||
CreateContext: resourceBasicServiceGroupCreate,
|
CreateContext: resourceBasicServiceGroupCreate,
|
||||||
ReadContext: resourceBasicServiceGroupRead,
|
ReadContext: resourceBasicServiceGroupRead,
|
||||||
UpdateContext: resourceBasicServiceGroupEdit,
|
UpdateContext: resourceBasicServiceGroupUpdate,
|
||||||
DeleteContext: resourceBasicServiceGroupDelete,
|
DeleteContext: resourceBasicServiceGroupDelete,
|
||||||
|
|
||||||
Importer: &schema.ResourceImporter{
|
Importer: &schema.ResourceImporter{
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package bservice
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/rg"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
|
||||||
|
)
|
||||||
|
|
||||||
|
func existRGID(ctx context.Context, d *schema.ResourceData, m interface{}) (bool, error) {
|
||||||
|
c := m.(*controller.ControllerCfg)
|
||||||
|
|
||||||
|
req := rg.ListRequest{}
|
||||||
|
|
||||||
|
rgList, err := c.CloudAPI().RG().List(ctx, req)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
rgId := uint64(d.Get("rg_id").(int))
|
||||||
|
|
||||||
|
return len(rgList.FilterByID(rgId)) != 0, nil
|
||||||
|
}
|
||||||
@@ -3,6 +3,7 @@ Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@@ -21,53 +22,45 @@ limitations under the License.
|
|||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package bservice
|
package bservice
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
|
||||||
"net/url"
|
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/controller"
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/bservice"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
|
||||||
|
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
)
|
)
|
||||||
|
|
||||||
func utilityBasicServiceDeletedListCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (BasicServiceList, error) {
|
func utilityBasicServiceDeletedListCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (bservice.ListBasicServices, error) {
|
||||||
basicServiceDeletedList := BasicServiceList{}
|
|
||||||
c := m.(*controller.ControllerCfg)
|
c := m.(*controller.ControllerCfg)
|
||||||
urlValues := &url.Values{}
|
req := bservice.ListRequest{}
|
||||||
|
|
||||||
if accountId, ok := d.GetOk("account_id"); ok {
|
if accountId, ok := d.GetOk("account_id"); ok {
|
||||||
urlValues.Add("accountId", strconv.Itoa(accountId.(int)))
|
req.AccountID = uint64(accountId.(int))
|
||||||
}
|
}
|
||||||
if rgId, ok := d.GetOk("rg_id"); ok {
|
if rgId, ok := d.GetOk("rg_id"); ok {
|
||||||
urlValues.Add("rgId", strconv.Itoa(rgId.(int)))
|
req.RGID = uint64(rgId.(int))
|
||||||
}
|
}
|
||||||
if page, ok := d.GetOk("page"); ok {
|
if page, ok := d.GetOk("page"); ok {
|
||||||
urlValues.Add("page", strconv.Itoa(page.(int)))
|
req.Page = uint64(page.(int))
|
||||||
}
|
}
|
||||||
if size, ok := d.GetOk("size"); ok {
|
if size, ok := d.GetOk("size"); ok {
|
||||||
urlValues.Add("size", strconv.Itoa(size.(int)))
|
req.Size = uint64(size.(int))
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Debugf("utilityBasicServiceDeletedListCheckPresence")
|
log.Debugf("utilityBasicServiceDeletedListCheckPresence")
|
||||||
basicServiceDeletedListRaw, err := c.DecortAPICall(ctx, "POST", bserviceListDeletedAPI, urlValues)
|
basicServiceDeletedList, err := c.CloudAPI().BService().ListDeleted(ctx, req)
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
err = json.Unmarshal([]byte(basicServiceDeletedListRaw), &basicServiceDeletedList)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@@ -21,46 +22,43 @@ limitations under the License.
|
|||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package bservice
|
package bservice
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
|
||||||
"net/url"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/controller"
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/bservice"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
|
||||||
|
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
)
|
)
|
||||||
|
|
||||||
func utilityBasicServiceCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (*BasicServiceExtend, error) {
|
func utilityBasicServiceCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (*bservice.RecordBasicService, error) {
|
||||||
bservice := &BasicServiceExtend{}
|
|
||||||
c := m.(*controller.ControllerCfg)
|
c := m.(*controller.ControllerCfg)
|
||||||
urlValues := &url.Values{}
|
var id uint64
|
||||||
|
|
||||||
if (strconv.Itoa(d.Get("service_id").(int))) != "0" {
|
if (strconv.Itoa(d.Get("service_id").(int))) != "0" {
|
||||||
urlValues.Add("serviceId", strconv.Itoa(d.Get("service_id").(int)))
|
id = uint64(d.Get("service_id").(int))
|
||||||
} else {
|
} else {
|
||||||
urlValues.Add("serviceId", d.Id())
|
id, _ = strconv.ParseUint(d.Id(), 10, 64)
|
||||||
|
}
|
||||||
|
|
||||||
|
req := bservice.GetRequest{
|
||||||
|
ServiceID: id,
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Debugf("utilityBasicServiceCheckPresence")
|
log.Debugf("utilityBasicServiceCheckPresence")
|
||||||
bserviceRaw, err := c.DecortAPICall(ctx, "POST", bserviceGetAPI, urlValues)
|
bservice, err := c.CloudAPI().BService().Get(ctx, req)
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
err = json.Unmarshal([]byte(bserviceRaw), &bservice)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@@ -21,47 +22,43 @@ limitations under the License.
|
|||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package bservice
|
package bservice
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
|
||||||
"net/url"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/controller"
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/bservice"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
|
||||||
|
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
)
|
)
|
||||||
|
|
||||||
func utilityBasicServiceGroupCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (*BasicServiceGroup, error) {
|
func utilityBasicServiceGroupCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (*bservice.RecordGroup, error) {
|
||||||
bserviceGroup := &BasicServiceGroup{}
|
|
||||||
c := m.(*controller.ControllerCfg)
|
c := m.(*controller.ControllerCfg)
|
||||||
urlValues := &url.Values{}
|
|
||||||
|
|
||||||
urlValues.Add("serviceId", strconv.Itoa(d.Get("service_id").(int)))
|
req := bservice.GroupGetRequest{
|
||||||
|
ServiceID: uint64(d.Get("service_id").(int)),
|
||||||
|
}
|
||||||
|
|
||||||
if (strconv.Itoa(d.Get("compgroup_id").(int))) != "0" {
|
if (strconv.Itoa(d.Get("compgroup_id").(int))) != "0" {
|
||||||
urlValues.Add("compgroupId", strconv.Itoa(d.Get("compgroup_id").(int)))
|
req.CompGroupID = uint64(d.Get("compgroup_id").(int))
|
||||||
} else {
|
} else {
|
||||||
urlValues.Add("compgroupId", d.Id())
|
comGroupID, _ := strconv.ParseUint(d.Id(), 10, 64)
|
||||||
|
req.CompGroupID = comGroupID
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Debugf("utilityBasicServiceGroupCheckPresence")
|
log.Debugf("utilityBasicServiceGroupCheckPresence")
|
||||||
bserviceGroupRaw, err := c.DecortAPICall(ctx, "POST", bserviceGroupGetAPI, urlValues)
|
bserviceGroup, err := c.CloudAPI().BService().GroupGet(ctx, req)
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
err = json.Unmarshal([]byte(bserviceGroupRaw), &bserviceGroup)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@@ -21,53 +22,45 @@ limitations under the License.
|
|||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package bservice
|
package bservice
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
|
||||||
"net/url"
|
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/controller"
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/bservice"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
|
||||||
|
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
)
|
)
|
||||||
|
|
||||||
func utilityBasicServiceListCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (BasicServiceList, error) {
|
func utilityBasicServiceListCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (bservice.ListBasicServices, error) {
|
||||||
basicServiceList := BasicServiceList{}
|
|
||||||
c := m.(*controller.ControllerCfg)
|
c := m.(*controller.ControllerCfg)
|
||||||
urlValues := &url.Values{}
|
req := bservice.ListRequest{}
|
||||||
|
|
||||||
if accountId, ok := d.GetOk("account_id"); ok {
|
if accountId, ok := d.GetOk("account_id"); ok {
|
||||||
urlValues.Add("accountId", strconv.Itoa(accountId.(int)))
|
req.AccountID = uint64(accountId.(int))
|
||||||
}
|
}
|
||||||
if rgId, ok := d.GetOk("rg_id"); ok {
|
if rgId, ok := d.GetOk("rg_id"); ok {
|
||||||
urlValues.Add("rgId", strconv.Itoa(rgId.(int)))
|
req.RGID = uint64(rgId.(int))
|
||||||
}
|
}
|
||||||
if page, ok := d.GetOk("page"); ok {
|
if page, ok := d.GetOk("page"); ok {
|
||||||
urlValues.Add("page", strconv.Itoa(page.(int)))
|
req.Page = uint64(page.(int))
|
||||||
}
|
}
|
||||||
if size, ok := d.GetOk("size"); ok {
|
if size, ok := d.GetOk("size"); ok {
|
||||||
urlValues.Add("size", strconv.Itoa(size.(int)))
|
req.Size = uint64(size.(int))
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Debugf("utilityBasicServiceListCheckPresence")
|
log.Debugf("utilityBasicServiceListCheckPresence")
|
||||||
basicServiceListRaw, err := c.DecortAPICall(ctx, "POST", bserviceListAPI, urlValues)
|
basicServiceList, err := c.CloudAPI().BService().List(ctx, req)
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
err = json.Unmarshal([]byte(basicServiceListRaw), &basicServiceList)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@@ -21,44 +22,40 @@ limitations under the License.
|
|||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package bservice
|
package bservice
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
|
||||||
"net/url"
|
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/controller"
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/bservice"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
|
||||||
|
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
)
|
)
|
||||||
|
|
||||||
func utilityBasicServiceSnapshotListCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (BasicServiceSnapshots, error) {
|
func utilityBasicServiceSnapshotListCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (bservice.ListSnapshots, error) {
|
||||||
basicServiceSnapshotList := BasicServiceSnapshots{}
|
|
||||||
c := m.(*controller.ControllerCfg)
|
c := m.(*controller.ControllerCfg)
|
||||||
urlValues := &url.Values{}
|
var id uint64
|
||||||
|
|
||||||
if serviceId, ok := d.GetOk("service_id"); ok {
|
if serviceId, ok := d.GetOk("service_id"); ok {
|
||||||
urlValues.Add("serviceId", strconv.Itoa(serviceId.(int)))
|
id = uint64(serviceId.(int))
|
||||||
|
}
|
||||||
|
|
||||||
|
req := bservice.SnapshotListRequest{
|
||||||
|
ServiceID: id,
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Debugf("utilityBasicServiceSnapshotListCheckPresence")
|
log.Debugf("utilityBasicServiceSnapshotListCheckPresence")
|
||||||
basicServiceSnapshotListRaw, err := c.DecortAPICall(ctx, "POST", bserviceSnapshotListAPI, urlValues)
|
basicServiceSnapshotList, err := c.CloudAPI().BService().SnapshotList(ctx, req)
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
err = json.Unmarshal([]byte(basicServiceSnapshotListRaw), &basicServiceSnapshotList)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,52 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|
||||||
Authors:
|
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
|
||||||
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
|
||||||
builds seamlessly.
|
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
|
||||||
*/
|
|
||||||
|
|
||||||
package disks
|
|
||||||
|
|
||||||
const (
|
|
||||||
disksCreateAPI = "/restmachine/cloudapi/disks/create"
|
|
||||||
disksGetAPI = "/restmachine/cloudapi/disks/get"
|
|
||||||
disksListAPI = "/restmachine/cloudapi/disks/list"
|
|
||||||
disksResizeAPI = "/restmachine/cloudapi/disks/resize2"
|
|
||||||
disksRenameAPI = "/restmachine/cloudapi/disks/rename"
|
|
||||||
disksDeleteAPI = "/restmachine/cloudapi/disks/delete"
|
|
||||||
disksIOLimitAPI = "/restmachine/cloudapi/disks/limitIO"
|
|
||||||
disksRestoreAPI = "/restmachine/cloudapi/disks/restore"
|
|
||||||
disksListTypesAPI = "/restmachine/cloudapi/disks/listTypes"
|
|
||||||
disksListDeletedAPI = "/restmachine/cloudapi/disks/listDeleted"
|
|
||||||
disksListUnattachedAPI = "/restmachine/cloudapi/disks/listUnattached"
|
|
||||||
|
|
||||||
disksSnapshotDeleteAPI = "/restmachine/cloudapi/disks/snapshotDelete"
|
|
||||||
disksSnapshotRollbackAPI = "/restmachine/cloudapi/disks/snapshotRollback"
|
|
||||||
disksShareAPI = "/restmachine/cloudapi/disks/share"
|
|
||||||
disksUnshareAPI = "/restmachine/cloudapi/disks/unshare"
|
|
||||||
)
|
|
||||||
@@ -22,24 +22,23 @@ limitations under the License.
|
|||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package disks
|
package disks
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
|
||||||
|
|
||||||
// "net/url"
|
// "net/url"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/constants"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
|
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
@@ -54,53 +53,7 @@ func dataSourceDiskRead(ctx context.Context, d *schema.ResourceData, m interface
|
|||||||
id := uuid.New()
|
id := uuid.New()
|
||||||
d.SetId(id.String())
|
d.SetId(id.String())
|
||||||
|
|
||||||
diskAcl, _ := json.Marshal(disk.Acl)
|
flattenDisk(d, disk)
|
||||||
|
|
||||||
d.Set("account_id", disk.AccountID)
|
|
||||||
d.Set("account_name", disk.AccountName)
|
|
||||||
d.Set("acl", string(diskAcl))
|
|
||||||
d.Set("boot_partition", disk.BootPartition)
|
|
||||||
d.Set("computes", flattenDiskComputes(disk.Computes))
|
|
||||||
d.Set("created_time", disk.CreatedTime)
|
|
||||||
d.Set("deleted_time", disk.DeletedTime)
|
|
||||||
d.Set("desc", disk.Desc)
|
|
||||||
d.Set("destruction_time", disk.DestructionTime)
|
|
||||||
d.Set("devicename", disk.DeviceName)
|
|
||||||
d.Set("disk_path", disk.DiskPath)
|
|
||||||
d.Set("gid", disk.GridID)
|
|
||||||
d.Set("guid", disk.GUID)
|
|
||||||
d.Set("disk_id", disk.ID)
|
|
||||||
d.Set("image_id", disk.ImageID)
|
|
||||||
d.Set("images", disk.Images)
|
|
||||||
d.Set("iotune", flattenIOTune(disk.IOTune))
|
|
||||||
d.Set("iqn", disk.IQN)
|
|
||||||
d.Set("login", disk.Login)
|
|
||||||
d.Set("milestones", disk.Milestones)
|
|
||||||
d.Set("disk_name", disk.Name)
|
|
||||||
d.Set("order", disk.Order)
|
|
||||||
d.Set("params", disk.Params)
|
|
||||||
d.Set("parent_id", disk.ParentId)
|
|
||||||
d.Set("passwd", disk.Passwd)
|
|
||||||
d.Set("pci_slot", disk.PciSlot)
|
|
||||||
d.Set("pool", disk.Pool)
|
|
||||||
d.Set("present_to", disk.PresentTo)
|
|
||||||
d.Set("purge_attempts", disk.PurgeAttempts)
|
|
||||||
d.Set("purge_time", disk.PurgeTime)
|
|
||||||
d.Set("reality_device_number", disk.RealityDeviceNumber)
|
|
||||||
d.Set("reference_id", disk.ReferenceId)
|
|
||||||
d.Set("res_id", disk.ResID)
|
|
||||||
d.Set("res_name", disk.ResName)
|
|
||||||
d.Set("role", disk.Role)
|
|
||||||
d.Set("sep_id", disk.SepID)
|
|
||||||
d.Set("sep_type", disk.SepType)
|
|
||||||
d.Set("shareable", disk.Shareable)
|
|
||||||
d.Set("size_max", disk.SizeMax)
|
|
||||||
d.Set("size_used", disk.SizeUsed)
|
|
||||||
d.Set("snapshots", flattenDiskSnapshotList(disk.Snapshots))
|
|
||||||
d.Set("status", disk.Status)
|
|
||||||
d.Set("tech_status", disk.TechStatus)
|
|
||||||
d.Set("type", disk.Type)
|
|
||||||
d.Set("vmid", disk.VMID)
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -126,11 +79,11 @@ func dataSourceDiskSchemaMake() map[string]*schema.Schema {
|
|||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
},
|
},
|
||||||
"boot_partition": {
|
// "boot_partition": {
|
||||||
Type: schema.TypeInt,
|
// Type: schema.TypeInt,
|
||||||
Computed: true,
|
// Computed: true,
|
||||||
Description: "Number of disk partitions",
|
// Description: "Number of disk partitions",
|
||||||
},
|
// },
|
||||||
"computes": {
|
"computes": {
|
||||||
Type: schema.TypeList,
|
Type: schema.TypeList,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
@@ -172,21 +125,21 @@ func dataSourceDiskSchemaMake() map[string]*schema.Schema {
|
|||||||
Computed: true,
|
Computed: true,
|
||||||
Description: "Name of the device",
|
Description: "Name of the device",
|
||||||
},
|
},
|
||||||
"disk_path": {
|
// "disk_path": {
|
||||||
Type: schema.TypeString,
|
// Type: schema.TypeString,
|
||||||
Computed: true,
|
// Computed: true,
|
||||||
Description: "Disk path",
|
// Description: "Disk path",
|
||||||
},
|
// },
|
||||||
"gid": {
|
"gid": {
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
Description: "ID of the grid (platform)",
|
Description: "ID of the grid (platform)",
|
||||||
},
|
},
|
||||||
"guid": {
|
// "guid": {
|
||||||
Type: schema.TypeInt,
|
// Type: schema.TypeInt,
|
||||||
Computed: true,
|
// Computed: true,
|
||||||
Description: "Disk ID on the storage side",
|
// Description: "Disk ID on the storage side",
|
||||||
},
|
// },
|
||||||
"image_id": {
|
"image_id": {
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
@@ -273,21 +226,21 @@ func dataSourceDiskSchemaMake() map[string]*schema.Schema {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"iqn": {
|
// "iqn": {
|
||||||
Type: schema.TypeString,
|
// Type: schema.TypeString,
|
||||||
Computed: true,
|
// Computed: true,
|
||||||
Description: "Disk IQN",
|
// Description: "Disk IQN",
|
||||||
},
|
// },
|
||||||
"login": {
|
// "login": {
|
||||||
Type: schema.TypeString,
|
// Type: schema.TypeString,
|
||||||
Computed: true,
|
// Computed: true,
|
||||||
Description: "Login to access the disk",
|
// Description: "Login to access the disk",
|
||||||
},
|
// },
|
||||||
"milestones": {
|
// "milestones": {
|
||||||
Type: schema.TypeInt,
|
// Type: schema.TypeInt,
|
||||||
Computed: true,
|
// Computed: true,
|
||||||
Description: "Milestones",
|
// Description: "Milestones",
|
||||||
},
|
// },
|
||||||
"disk_name": {
|
"disk_name": {
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
@@ -308,11 +261,11 @@ func dataSourceDiskSchemaMake() map[string]*schema.Schema {
|
|||||||
Computed: true,
|
Computed: true,
|
||||||
Description: "ID of the parent disk",
|
Description: "ID of the parent disk",
|
||||||
},
|
},
|
||||||
"passwd": {
|
// "passwd": {
|
||||||
Type: schema.TypeString,
|
// Type: schema.TypeString,
|
||||||
Computed: true,
|
// Computed: true,
|
||||||
Description: "Password to access the disk",
|
// Description: "Password to access the disk",
|
||||||
},
|
// },
|
||||||
"pci_slot": {
|
"pci_slot": {
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
@@ -330,26 +283,26 @@ func dataSourceDiskSchemaMake() map[string]*schema.Schema {
|
|||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"purge_attempts": {
|
// "purge_attempts": {
|
||||||
Type: schema.TypeInt,
|
// Type: schema.TypeInt,
|
||||||
Computed: true,
|
// Computed: true,
|
||||||
Description: "Number of deletion attempts",
|
// Description: "Number of deletion attempts",
|
||||||
},
|
// },
|
||||||
"purge_time": {
|
"purge_time": {
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
Description: "Time of the last deletion attempt",
|
Description: "Time of the last deletion attempt",
|
||||||
},
|
},
|
||||||
"reality_device_number": {
|
// "reality_device_number": {
|
||||||
Type: schema.TypeInt,
|
// Type: schema.TypeInt,
|
||||||
Computed: true,
|
// Computed: true,
|
||||||
Description: "Reality device number",
|
// Description: "Reality device number",
|
||||||
},
|
// },
|
||||||
"reference_id": {
|
// "reference_id": {
|
||||||
Type: schema.TypeString,
|
// Type: schema.TypeString,
|
||||||
Computed: true,
|
// Computed: true,
|
||||||
Description: "ID of the reference to the disk",
|
// Description: "ID of the reference to the disk",
|
||||||
},
|
// },
|
||||||
"res_id": {
|
"res_id": {
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
|
|||||||
@@ -22,139 +22,27 @@ limitations under the License.
|
|||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package disks
|
package disks
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/constants"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
)
|
)
|
||||||
|
|
||||||
func flattenDiskComputes(computes map[string]string) []map[string]interface{} {
|
|
||||||
res := make([]map[string]interface{}, 0)
|
|
||||||
for computeKey, computeVal := range computes {
|
|
||||||
temp := map[string]interface{}{
|
|
||||||
"compute_id": computeKey,
|
|
||||||
"compute_name": computeVal,
|
|
||||||
}
|
|
||||||
res = append(res, temp)
|
|
||||||
}
|
|
||||||
return res
|
|
||||||
}
|
|
||||||
|
|
||||||
func flattenIOTune(iot IOTune) []map[string]interface{} {
|
|
||||||
res := make([]map[string]interface{}, 0)
|
|
||||||
temp := map[string]interface{}{
|
|
||||||
"read_bytes_sec": iot.ReadBytesSec,
|
|
||||||
"read_bytes_sec_max": iot.ReadBytesSecMax,
|
|
||||||
"read_iops_sec": iot.ReadIopsSec,
|
|
||||||
"read_iops_sec_max": iot.ReadIopsSecMax,
|
|
||||||
"size_iops_sec": iot.SizeIopsSec,
|
|
||||||
"total_bytes_sec": iot.TotalBytesSec,
|
|
||||||
"total_bytes_sec_max": iot.TotalBytesSecMax,
|
|
||||||
"total_iops_sec": iot.TotalIopsSec,
|
|
||||||
"total_iops_sec_max": iot.TotalIopsSecMax,
|
|
||||||
"write_bytes_sec": iot.WriteBytesSec,
|
|
||||||
"write_bytes_sec_max": iot.WriteBytesSecMax,
|
|
||||||
"write_iops_sec": iot.WriteIopsSec,
|
|
||||||
"write_iops_sec_max": iot.WriteIopsSecMax,
|
|
||||||
}
|
|
||||||
|
|
||||||
res = append(res, temp)
|
|
||||||
return res
|
|
||||||
}
|
|
||||||
|
|
||||||
func flattenDiskList(dl DisksList) []map[string]interface{} {
|
|
||||||
res := make([]map[string]interface{}, 0)
|
|
||||||
for _, disk := range dl {
|
|
||||||
diskAcl, _ := json.Marshal(disk.Acl)
|
|
||||||
temp := map[string]interface{}{
|
|
||||||
"account_id": disk.AccountID,
|
|
||||||
"account_name": disk.AccountName,
|
|
||||||
"acl": string(diskAcl),
|
|
||||||
"computes": flattenDiskComputes(disk.Computes),
|
|
||||||
"boot_partition": disk.BootPartition,
|
|
||||||
"created_time": disk.CreatedTime,
|
|
||||||
"deleted_time": disk.DeletedTime,
|
|
||||||
"desc": disk.Desc,
|
|
||||||
"destruction_time": disk.DestructionTime,
|
|
||||||
"devicename": disk.DeviceName,
|
|
||||||
"disk_path": disk.DiskPath,
|
|
||||||
"gid": disk.GridID,
|
|
||||||
"guid": disk.GUID,
|
|
||||||
"disk_id": disk.ID,
|
|
||||||
"image_id": disk.ImageID,
|
|
||||||
"images": disk.Images,
|
|
||||||
"iotune": flattenIOTune(disk.IOTune),
|
|
||||||
"iqn": disk.IQN,
|
|
||||||
"login": disk.Login,
|
|
||||||
"machine_id": disk.MachineId,
|
|
||||||
"machine_name": disk.MachineName,
|
|
||||||
"milestones": disk.Milestones,
|
|
||||||
"disk_name": disk.Name,
|
|
||||||
"order": disk.Order,
|
|
||||||
"params": disk.Params,
|
|
||||||
"parent_id": disk.ParentId,
|
|
||||||
"passwd": disk.Passwd,
|
|
||||||
"pci_slot": disk.PciSlot,
|
|
||||||
"pool": disk.Pool,
|
|
||||||
"present_to": disk.PresentTo,
|
|
||||||
"purge_attempts": disk.PurgeAttempts,
|
|
||||||
"purge_time": disk.PurgeTime,
|
|
||||||
"reality_device_number": disk.RealityDeviceNumber,
|
|
||||||
"reference_id": disk.ReferenceId,
|
|
||||||
"res_id": disk.ResID,
|
|
||||||
"res_name": disk.ResName,
|
|
||||||
"role": disk.Role,
|
|
||||||
"sep_id": disk.SepID,
|
|
||||||
"sep_type": disk.SepType,
|
|
||||||
"shareable": disk.Shareable,
|
|
||||||
"size_max": disk.SizeMax,
|
|
||||||
"size_used": disk.SizeUsed,
|
|
||||||
"snapshots": flattenDiskSnapshotList(disk.Snapshots),
|
|
||||||
"status": disk.Status,
|
|
||||||
"tech_status": disk.TechStatus,
|
|
||||||
"type": disk.Type,
|
|
||||||
"vmid": disk.VMID,
|
|
||||||
}
|
|
||||||
res = append(res, temp)
|
|
||||||
}
|
|
||||||
return res
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func flattenDiskSnapshotList(sl SnapshotList) []interface{} {
|
|
||||||
res := make([]interface{}, 0)
|
|
||||||
for _, snapshot := range sl {
|
|
||||||
temp := map[string]interface{}{
|
|
||||||
"guid": snapshot.Guid,
|
|
||||||
"label": snapshot.Label,
|
|
||||||
"res_id": snapshot.ResId,
|
|
||||||
"snap_set_guid": snapshot.SnapSetGuid,
|
|
||||||
"snap_set_time": snapshot.SnapSetTime,
|
|
||||||
"timestamp": snapshot.TimeStamp,
|
|
||||||
}
|
|
||||||
res = append(res, temp)
|
|
||||||
}
|
|
||||||
|
|
||||||
return res
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func dataSourceDiskListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func dataSourceDiskListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
diskList, err := utilityDiskListCheckPresence(ctx, d, m, disksListAPI)
|
diskList, err := utilityDiskListCheckPresence(ctx, d, m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
@@ -207,11 +95,11 @@ func dataSourceDiskListSchemaMake() map[string]*schema.Schema {
|
|||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
},
|
},
|
||||||
"boot_partition": {
|
// "boot_partition": {
|
||||||
Type: schema.TypeInt,
|
// Type: schema.TypeInt,
|
||||||
Computed: true,
|
// Computed: true,
|
||||||
Description: "Number of disk partitions",
|
// Description: "Number of disk partitions",
|
||||||
},
|
// },
|
||||||
"computes": {
|
"computes": {
|
||||||
Type: schema.TypeList,
|
Type: schema.TypeList,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
@@ -253,21 +141,21 @@ func dataSourceDiskListSchemaMake() map[string]*schema.Schema {
|
|||||||
Computed: true,
|
Computed: true,
|
||||||
Description: "Name of the device",
|
Description: "Name of the device",
|
||||||
},
|
},
|
||||||
"disk_path": {
|
// "disk_path": {
|
||||||
Type: schema.TypeString,
|
// Type: schema.TypeString,
|
||||||
Computed: true,
|
// Computed: true,
|
||||||
Description: "Disk path",
|
// Description: "Disk path",
|
||||||
},
|
// },
|
||||||
"gid": {
|
"gid": {
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
Description: "ID of the grid (platform)",
|
Description: "ID of the grid (platform)",
|
||||||
},
|
},
|
||||||
"guid": {
|
// "guid": {
|
||||||
Type: schema.TypeInt,
|
// Type: schema.TypeInt,
|
||||||
Computed: true,
|
// Computed: true,
|
||||||
Description: "Disk ID on the storage side",
|
// Description: "Disk ID on the storage side",
|
||||||
},
|
// },
|
||||||
"disk_id": {
|
"disk_id": {
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
@@ -359,16 +247,16 @@ func dataSourceDiskListSchemaMake() map[string]*schema.Schema {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"iqn": {
|
// "iqn": {
|
||||||
Type: schema.TypeString,
|
// Type: schema.TypeString,
|
||||||
Computed: true,
|
// Computed: true,
|
||||||
Description: "Disk IQN",
|
// Description: "Disk IQN",
|
||||||
},
|
// },
|
||||||
"login": {
|
// "login": {
|
||||||
Type: schema.TypeString,
|
// Type: schema.TypeString,
|
||||||
Computed: true,
|
// Computed: true,
|
||||||
Description: "Login to access the disk",
|
// Description: "Login to access the disk",
|
||||||
},
|
// },
|
||||||
"machine_id": {
|
"machine_id": {
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
@@ -379,11 +267,11 @@ func dataSourceDiskListSchemaMake() map[string]*schema.Schema {
|
|||||||
Computed: true,
|
Computed: true,
|
||||||
Description: "Machine name",
|
Description: "Machine name",
|
||||||
},
|
},
|
||||||
"milestones": {
|
// "milestones": {
|
||||||
Type: schema.TypeInt,
|
// Type: schema.TypeInt,
|
||||||
Computed: true,
|
// Computed: true,
|
||||||
Description: "Milestones",
|
// Description: "Milestones",
|
||||||
},
|
// },
|
||||||
"disk_name": {
|
"disk_name": {
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
@@ -404,11 +292,11 @@ func dataSourceDiskListSchemaMake() map[string]*schema.Schema {
|
|||||||
Computed: true,
|
Computed: true,
|
||||||
Description: "ID of the parent disk",
|
Description: "ID of the parent disk",
|
||||||
},
|
},
|
||||||
"passwd": {
|
// "passwd": {
|
||||||
Type: schema.TypeString,
|
// Type: schema.TypeString,
|
||||||
Computed: true,
|
// Computed: true,
|
||||||
Description: "Password to access the disk",
|
// Description: "Password to access the disk",
|
||||||
},
|
// },
|
||||||
"pci_slot": {
|
"pci_slot": {
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
@@ -426,26 +314,26 @@ func dataSourceDiskListSchemaMake() map[string]*schema.Schema {
|
|||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"purge_attempts": {
|
// "purge_attempts": {
|
||||||
Type: schema.TypeInt,
|
// Type: schema.TypeInt,
|
||||||
Computed: true,
|
// Computed: true,
|
||||||
Description: "Number of deletion attempts",
|
// Description: "Number of deletion attempts",
|
||||||
},
|
// },
|
||||||
"purge_time": {
|
"purge_time": {
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
Description: "Time of the last deletion attempt",
|
Description: "Time of the last deletion attempt",
|
||||||
},
|
},
|
||||||
"reality_device_number": {
|
// "reality_device_number": {
|
||||||
Type: schema.TypeInt,
|
// Type: schema.TypeInt,
|
||||||
Computed: true,
|
// Computed: true,
|
||||||
Description: "Reality device number",
|
// Description: "Reality device number",
|
||||||
},
|
// },
|
||||||
"reference_id": {
|
// "reference_id": {
|
||||||
Type: schema.TypeString,
|
// Type: schema.TypeString,
|
||||||
Computed: true,
|
// Computed: true,
|
||||||
Description: "ID of the reference to the disk",
|
// Description: "ID of the reference to the disk",
|
||||||
},
|
// },
|
||||||
"res_id": {
|
"res_id": {
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
|
|||||||
@@ -22,12 +22,12 @@ limitations under the License.
|
|||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package disks
|
package disks
|
||||||
@@ -38,7 +38,7 @@ import (
|
|||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/constants"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
)
|
)
|
||||||
|
|
||||||
func dataSourceDiskListTypesRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func dataSourceDiskListTypesRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
|
|||||||
@@ -22,12 +22,12 @@ limitations under the License.
|
|||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package disks
|
package disks
|
||||||
@@ -38,27 +38,29 @@ import (
|
|||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/constants"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
)
|
)
|
||||||
|
|
||||||
func flattenDiskListTypesDetailed(tld TypesDetailedList) []map[string]interface{} {
|
func flattenDiskListTypesDetailed(tld []interface{}) []map[string]interface{} {
|
||||||
res := make([]map[string]interface{}, 0)
|
res := make([]map[string]interface{}, 0)
|
||||||
for _, typeListDetailed := range tld {
|
for _, typeListDetailed := range tld {
|
||||||
|
toMap := typeListDetailed.(map[string]interface{})
|
||||||
temp := map[string]interface{}{
|
temp := map[string]interface{}{
|
||||||
"pools": flattenListTypesDetailedPools(typeListDetailed.Pools),
|
"pools": flattenListTypesDetailedPools(toMap["pools"].([]interface{})),
|
||||||
"sep_id": typeListDetailed.SepID,
|
"sep_id": toMap["sepId"].(float64),
|
||||||
}
|
}
|
||||||
res = append(res, temp)
|
res = append(res, temp)
|
||||||
}
|
}
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
func flattenListTypesDetailedPools(pools PoolList) []interface{} {
|
func flattenListTypesDetailedPools(pools []interface{}) []interface{} {
|
||||||
res := make([]interface{}, 0)
|
res := make([]interface{}, 0)
|
||||||
for _, pool := range pools {
|
for _, pool := range pools {
|
||||||
|
toMap := pool.(map[string]interface{})
|
||||||
temp := map[string]interface{}{
|
temp := map[string]interface{}{
|
||||||
"name": pool.Name,
|
"name": toMap["name"].(string),
|
||||||
"types": pool.Types,
|
"types": toMap["types"].([]interface{}),
|
||||||
}
|
}
|
||||||
res = append(res, temp)
|
res = append(res, temp)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,104 +22,25 @@ limitations under the License.
|
|||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package disks
|
package disks
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
|
||||||
"net/url"
|
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/constants"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/controller"
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/flattens"
|
|
||||||
log "github.com/sirupsen/logrus"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func utilityDiskListUnattachedCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (UnattachedList, error) {
|
|
||||||
unattachedList := UnattachedList{}
|
|
||||||
c := m.(*controller.ControllerCfg)
|
|
||||||
urlValues := &url.Values{}
|
|
||||||
if accountId, ok := d.GetOk("accountId"); ok {
|
|
||||||
urlValues.Add("accountId", strconv.Itoa(accountId.(int)))
|
|
||||||
}
|
|
||||||
|
|
||||||
log.Debugf("utilityDiskListUnattachedCheckPresence: load disk Unattached list")
|
|
||||||
unattachedListRaw, err := c.DecortAPICall(ctx, "POST", disksListUnattachedAPI, urlValues)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
err = json.Unmarshal([]byte(unattachedListRaw), &unattachedList)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return unattachedList, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func flattenDiskListUnattached(ul UnattachedList) []map[string]interface{} {
|
|
||||||
res := make([]map[string]interface{}, 0)
|
|
||||||
for _, unattachedDisk := range ul {
|
|
||||||
unattachedDiskAcl, _ := json.Marshal(unattachedDisk.Acl)
|
|
||||||
tmp := map[string]interface{}{
|
|
||||||
"_ckey": unattachedDisk.Ckey,
|
|
||||||
"_meta": flattens.FlattenMeta(unattachedDisk.Meta),
|
|
||||||
"account_id": unattachedDisk.AccountID,
|
|
||||||
"account_name": unattachedDisk.AccountName,
|
|
||||||
"acl": string(unattachedDiskAcl),
|
|
||||||
"boot_partition": unattachedDisk.BootPartition,
|
|
||||||
"created_time": unattachedDisk.CreatedTime,
|
|
||||||
"deleted_time": unattachedDisk.DeletedTime,
|
|
||||||
"desc": unattachedDisk.Desc,
|
|
||||||
"destruction_time": unattachedDisk.DestructionTime,
|
|
||||||
"disk_path": unattachedDisk.DiskPath,
|
|
||||||
"gid": unattachedDisk.GridID,
|
|
||||||
"guid": unattachedDisk.GUID,
|
|
||||||
"disk_id": unattachedDisk.ID,
|
|
||||||
"image_id": unattachedDisk.ImageID,
|
|
||||||
"images": unattachedDisk.Images,
|
|
||||||
"iotune": flattenIOTune(unattachedDisk.IOTune),
|
|
||||||
"iqn": unattachedDisk.IQN,
|
|
||||||
"login": unattachedDisk.Login,
|
|
||||||
"milestones": unattachedDisk.Milestones,
|
|
||||||
"disk_name": unattachedDisk.Name,
|
|
||||||
"order": unattachedDisk.Order,
|
|
||||||
"params": unattachedDisk.Params,
|
|
||||||
"parent_id": unattachedDisk.ParentID,
|
|
||||||
"passwd": unattachedDisk.Passwd,
|
|
||||||
"pci_slot": unattachedDisk.PciSlot,
|
|
||||||
"pool": unattachedDisk.Pool,
|
|
||||||
"purge_attempts": unattachedDisk.PurgeAttempts,
|
|
||||||
"purge_time": unattachedDisk.PurgeTime,
|
|
||||||
"reality_device_number": unattachedDisk.RealityDeviceNumber,
|
|
||||||
"reference_id": unattachedDisk.ReferenceID,
|
|
||||||
"res_id": unattachedDisk.ResID,
|
|
||||||
"res_name": unattachedDisk.ResName,
|
|
||||||
"role": unattachedDisk.Role,
|
|
||||||
"sep_id": unattachedDisk.SepID,
|
|
||||||
"size_max": unattachedDisk.SizeMax,
|
|
||||||
"size_used": unattachedDisk.SizeUsed,
|
|
||||||
"snapshots": flattenDiskSnapshotList(unattachedDisk.Snapshots),
|
|
||||||
"status": unattachedDisk.Status,
|
|
||||||
"tech_status": unattachedDisk.TechStatus,
|
|
||||||
"type": unattachedDisk.Type,
|
|
||||||
"vmid": unattachedDisk.VMID,
|
|
||||||
}
|
|
||||||
res = append(res, tmp)
|
|
||||||
}
|
|
||||||
return res
|
|
||||||
}
|
|
||||||
|
|
||||||
func dataSourceDiskListUnattachedRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func dataSourceDiskListUnattachedRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
diskListUnattached, err := utilityDiskListUnattachedCheckPresence(ctx, d, m)
|
diskListUnattached, err := utilityDiskListUnattachedCheckPresence(ctx, d, m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -22,12 +22,12 @@ limitations under the License.
|
|||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package disks
|
package disks
|
||||||
@@ -38,21 +38,19 @@ import (
|
|||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/constants"
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/disks"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
)
|
)
|
||||||
|
|
||||||
func dataSourceDiskSnapshotRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func dataSourceDiskSnapshotRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
disk, err := utilityDiskCheckPresence(ctx, d, m)
|
disk, err := utilityDiskCheckPresence(ctx, d, m)
|
||||||
if disk == nil {
|
if err != nil {
|
||||||
if err != nil {
|
return diag.FromErr(err)
|
||||||
return diag.FromErr(err)
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
snapshots := disk.Snapshots
|
|
||||||
snapshot := Snapshot{}
|
var snapshot disks.ItemSnapshot
|
||||||
label := d.Get("label").(string)
|
label := d.Get("label").(string)
|
||||||
for _, sn := range snapshots {
|
for _, sn := range disk.Snapshots {
|
||||||
if label == sn.Label {
|
if label == sn.Label {
|
||||||
snapshot = sn
|
snapshot = sn
|
||||||
break
|
break
|
||||||
@@ -64,11 +62,9 @@ func dataSourceDiskSnapshotRead(ctx context.Context, d *schema.ResourceData, m i
|
|||||||
|
|
||||||
id := uuid.New()
|
id := uuid.New()
|
||||||
d.SetId(id.String())
|
d.SetId(id.String())
|
||||||
d.Set("timestamp", snapshot.TimeStamp)
|
|
||||||
d.Set("guid", snapshot.Guid)
|
flattenDiskSnapshot(d, snapshot)
|
||||||
d.Set("res_id", snapshot.ResId)
|
|
||||||
d.Set("snap_set_guid", snapshot.SnapSetGuid)
|
|
||||||
d.Set("snap_set_time", snapshot.SnapSetTime)
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,12 +22,12 @@ limitations under the License.
|
|||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package disks
|
package disks
|
||||||
@@ -38,16 +38,13 @@ import (
|
|||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/constants"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
)
|
)
|
||||||
|
|
||||||
func dataSourceDiskSnapshotListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func dataSourceDiskSnapshotListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
disk, err := utilityDiskCheckPresence(ctx, d, m)
|
disk, err := utilityDiskCheckPresence(ctx, d, m)
|
||||||
if disk == nil {
|
if err != nil {
|
||||||
if err != nil {
|
return diag.FromErr(err)
|
||||||
return diag.FromErr(err)
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
id := uuid.New()
|
id := uuid.New()
|
||||||
|
|||||||
@@ -22,12 +22,12 @@ limitations under the License.
|
|||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package disks
|
package disks
|
||||||
@@ -38,11 +38,11 @@ import (
|
|||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/constants"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
)
|
)
|
||||||
|
|
||||||
func dataSourceDiskListDeletedRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func dataSourceDiskListDeletedRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
diskList, err := utilityDiskListCheckPresence(ctx, d, m, disksListDeletedAPI)
|
diskList, err := utilityDiskListCheckPresence(ctx, d, m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|||||||
219
internal/service/cloudapi/disks/flattens.go
Normal file
219
internal/service/cloudapi/disks/flattens.go
Normal file
@@ -0,0 +1,219 @@
|
|||||||
|
package disks
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
|
||||||
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/disks"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/flattens"
|
||||||
|
)
|
||||||
|
|
||||||
|
func flattenDiskSnapshot(d *schema.ResourceData, snapshot disks.ItemSnapshot) {
|
||||||
|
d.Set("timestamp", snapshot.TimeStamp)
|
||||||
|
d.Set("guid", snapshot.GUID)
|
||||||
|
d.Set("res_id", snapshot.ResID)
|
||||||
|
d.Set("snap_set_guid", snapshot.SnapSetGUID)
|
||||||
|
d.Set("snap_set_time", snapshot.SnapSetTime)
|
||||||
|
}
|
||||||
|
|
||||||
|
func flattenDiskListUnattached(ul disks.ListDisksUnattached) []map[string]interface{} {
|
||||||
|
res := make([]map[string]interface{}, 0)
|
||||||
|
for _, unattachedDisk := range ul {
|
||||||
|
unattachedDiskAcl, _ := json.Marshal(unattachedDisk.ACL)
|
||||||
|
tmp := map[string]interface{}{
|
||||||
|
"_ckey": unattachedDisk.CKey,
|
||||||
|
"_meta": flattens.FlattenMeta(unattachedDisk.Meta),
|
||||||
|
"account_id": unattachedDisk.AccountID,
|
||||||
|
"account_name": unattachedDisk.AccountName,
|
||||||
|
"acl": string(unattachedDiskAcl),
|
||||||
|
"boot_partition": unattachedDisk.BootPartition,
|
||||||
|
"created_time": unattachedDisk.CreatedTime,
|
||||||
|
"deleted_time": unattachedDisk.DeletedTime,
|
||||||
|
"desc": unattachedDisk.Description,
|
||||||
|
"destruction_time": unattachedDisk.DestructionTime,
|
||||||
|
"disk_path": unattachedDisk.DiskPath,
|
||||||
|
"gid": unattachedDisk.GID,
|
||||||
|
"guid": unattachedDisk.GUID,
|
||||||
|
"disk_id": unattachedDisk.ID,
|
||||||
|
"image_id": unattachedDisk.ImageID,
|
||||||
|
"images": unattachedDisk.Images,
|
||||||
|
"iotune": flattenIOTune(unattachedDisk.IOTune),
|
||||||
|
"iqn": unattachedDisk.IQN,
|
||||||
|
"login": unattachedDisk.Login,
|
||||||
|
"milestones": unattachedDisk.Milestones,
|
||||||
|
"disk_name": unattachedDisk.Name,
|
||||||
|
"order": unattachedDisk.Order,
|
||||||
|
"params": unattachedDisk.Params,
|
||||||
|
"parent_id": unattachedDisk.ParentID,
|
||||||
|
"passwd": unattachedDisk.Password,
|
||||||
|
"pci_slot": unattachedDisk.PCISlot,
|
||||||
|
"pool": unattachedDisk.Pool,
|
||||||
|
"purge_attempts": unattachedDisk.PurgeAttempts,
|
||||||
|
"purge_time": unattachedDisk.PurgeTime,
|
||||||
|
"reality_device_number": unattachedDisk.RealityDeviceNumber,
|
||||||
|
"reference_id": unattachedDisk.ReferenceID,
|
||||||
|
"res_id": unattachedDisk.ResID,
|
||||||
|
"res_name": unattachedDisk.ResName,
|
||||||
|
"role": unattachedDisk.Role,
|
||||||
|
"sep_id": unattachedDisk.SEPID,
|
||||||
|
"size_max": unattachedDisk.SizeMax,
|
||||||
|
"size_used": unattachedDisk.SizeUsed,
|
||||||
|
"snapshots": flattenDiskSnapshotList(unattachedDisk.Snapshots),
|
||||||
|
"status": unattachedDisk.Status,
|
||||||
|
"tech_status": unattachedDisk.TechStatus,
|
||||||
|
"type": unattachedDisk.Type,
|
||||||
|
"vmid": unattachedDisk.VMID,
|
||||||
|
}
|
||||||
|
res = append(res, tmp)
|
||||||
|
}
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
func flattenDisk(d *schema.ResourceData, disk *disks.RecordDisk) {
|
||||||
|
diskAcl, _ := json.Marshal(disk.ACL)
|
||||||
|
|
||||||
|
d.Set("account_id", disk.AccountID)
|
||||||
|
d.Set("account_name", disk.AccountName)
|
||||||
|
d.Set("acl", string(diskAcl))
|
||||||
|
// d.Set("boot_partition", disk.BootPartition)
|
||||||
|
d.Set("computes", flattenDiskComputes(disk.Computes))
|
||||||
|
d.Set("created_time", disk.CreatedTime)
|
||||||
|
d.Set("deleted_time", disk.DeletedTime)
|
||||||
|
d.Set("desc", disk.Description)
|
||||||
|
d.Set("destruction_time", disk.DestructionTime)
|
||||||
|
d.Set("devicename", disk.DeviceName)
|
||||||
|
// d.Set("disk_path", disk.DiskPath)
|
||||||
|
d.Set("gid", disk.GID)
|
||||||
|
// d.Set("guid", disk.GUID)
|
||||||
|
d.Set("disk_id", disk.ID)
|
||||||
|
d.Set("image_id", disk.ImageID)
|
||||||
|
d.Set("images", disk.Images)
|
||||||
|
d.Set("iotune", flattenIOTune(disk.IOTune))
|
||||||
|
// d.Set("iqn", disk.IQN)
|
||||||
|
// d.Set("login", disk.Login)
|
||||||
|
// d.Set("milestones", disk.Milestones)
|
||||||
|
d.Set("disk_name", disk.Name)
|
||||||
|
d.Set("order", disk.Order)
|
||||||
|
d.Set("params", disk.Params)
|
||||||
|
d.Set("parent_id", disk.ParentID)
|
||||||
|
// d.Set("passwd", disk.Passwd)
|
||||||
|
d.Set("pci_slot", disk.PCISlot)
|
||||||
|
d.Set("pool", disk.Pool)
|
||||||
|
d.Set("present_to", disk.PresentTo)
|
||||||
|
// d.Set("purge_attempts", disk.PurgeAttempts)
|
||||||
|
d.Set("purge_time", disk.PurgeTime)
|
||||||
|
// d.Set("reality_device_number", disk.RealityDeviceNumber)
|
||||||
|
// d.Set("reference_id", disk.ReferenceID)
|
||||||
|
d.Set("res_id", disk.ResID)
|
||||||
|
d.Set("res_name", disk.ResName)
|
||||||
|
d.Set("role", disk.Role)
|
||||||
|
d.Set("sep_id", disk.SepID)
|
||||||
|
d.Set("sep_type", disk.SepType)
|
||||||
|
d.Set("size_max", disk.SizeMax)
|
||||||
|
d.Set("size_used", disk.SizeUsed)
|
||||||
|
d.Set("shareable", disk.Shareable)
|
||||||
|
d.Set("snapshots", flattenDiskSnapshotList(disk.Snapshots))
|
||||||
|
d.Set("status", disk.Status)
|
||||||
|
d.Set("tech_status", disk.TechStatus)
|
||||||
|
d.Set("type", disk.Type)
|
||||||
|
d.Set("vmid", disk.VMID)
|
||||||
|
}
|
||||||
|
|
||||||
|
func flattenDiskSnapshotList(sl disks.ListSnapshots) []interface{} {
|
||||||
|
res := make([]interface{}, 0)
|
||||||
|
for _, snapshot := range sl {
|
||||||
|
temp := map[string]interface{}{
|
||||||
|
"guid": snapshot.GUID,
|
||||||
|
"label": snapshot.Label,
|
||||||
|
"res_id": snapshot.ResID,
|
||||||
|
"snap_set_guid": snapshot.SnapSetGUID,
|
||||||
|
"snap_set_time": snapshot.SnapSetTime,
|
||||||
|
"timestamp": snapshot.TimeStamp,
|
||||||
|
}
|
||||||
|
res = append(res, temp)
|
||||||
|
}
|
||||||
|
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
func flattenDiskList(dl disks.ListDisks) []map[string]interface{} {
|
||||||
|
res := make([]map[string]interface{}, 0)
|
||||||
|
for _, disk := range dl {
|
||||||
|
diskAcl, _ := json.Marshal(disk.ACL)
|
||||||
|
temp := map[string]interface{}{
|
||||||
|
"account_id": disk.AccountID,
|
||||||
|
"account_name": disk.AccountName,
|
||||||
|
"acl": string(diskAcl),
|
||||||
|
"computes": flattenDiskComputes(disk.Computes),
|
||||||
|
"created_time": disk.CreatedTime,
|
||||||
|
"deleted_time": disk.DeletedTime,
|
||||||
|
"desc": disk.Description,
|
||||||
|
"destruction_time": disk.DestructionTime,
|
||||||
|
"devicename": disk.DeviceName,
|
||||||
|
"gid": disk.GID,
|
||||||
|
"disk_id": disk.ID,
|
||||||
|
"image_id": disk.ImageID,
|
||||||
|
"images": disk.Images,
|
||||||
|
"iotune": flattenIOTune(disk.IOTune),
|
||||||
|
"machine_id": disk.MachineID,
|
||||||
|
"machine_name": disk.MachineName,
|
||||||
|
"disk_name": disk.Name,
|
||||||
|
"order": disk.Order,
|
||||||
|
"params": disk.Params,
|
||||||
|
"parent_id": disk.ParentID,
|
||||||
|
"pci_slot": disk.PCISlot,
|
||||||
|
"pool": disk.Pool,
|
||||||
|
"present_to": disk.PresentTo,
|
||||||
|
"purge_time": disk.PurgeTime,
|
||||||
|
"res_id": disk.ResID,
|
||||||
|
"res_name": disk.ResName,
|
||||||
|
"role": disk.Role,
|
||||||
|
"sep_id": disk.SepID,
|
||||||
|
"sep_type": disk.SepType,
|
||||||
|
"shareable": disk.Shareable,
|
||||||
|
"size_max": disk.SizeMax,
|
||||||
|
"size_used": disk.SizeUsed,
|
||||||
|
"snapshots": flattenDiskSnapshotList(disk.Snapshots),
|
||||||
|
"status": disk.Status,
|
||||||
|
"tech_status": disk.TechStatus,
|
||||||
|
"type": disk.Type,
|
||||||
|
"vmid": disk.VMID,
|
||||||
|
}
|
||||||
|
res = append(res, temp)
|
||||||
|
}
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
func flattenIOTune(iot disks.IOTune) []map[string]interface{} {
|
||||||
|
res := make([]map[string]interface{}, 0)
|
||||||
|
temp := map[string]interface{}{
|
||||||
|
"read_bytes_sec": iot.ReadBytesSec,
|
||||||
|
"read_bytes_sec_max": iot.ReadBytesSecMax,
|
||||||
|
"read_iops_sec": iot.ReadIOPSSec,
|
||||||
|
"read_iops_sec_max": iot.ReadIOPSSecMax,
|
||||||
|
"size_iops_sec": iot.SizeIOPSSec,
|
||||||
|
"total_bytes_sec": iot.TotalBytesSec,
|
||||||
|
"total_bytes_sec_max": iot.TotalBytesSecMax,
|
||||||
|
"total_iops_sec": iot.TotalIOPSSec,
|
||||||
|
"total_iops_sec_max": iot.TotalIOPSSecMax,
|
||||||
|
"write_bytes_sec": iot.WriteBytesSec,
|
||||||
|
"write_bytes_sec_max": iot.WriteBytesSecMax,
|
||||||
|
"write_iops_sec": iot.WriteIOPSSec,
|
||||||
|
"write_iops_sec_max": iot.WriteIOPSSecMax,
|
||||||
|
}
|
||||||
|
|
||||||
|
res = append(res, temp)
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
func flattenDiskComputes(computes map[string]string) []map[string]interface{} {
|
||||||
|
res := make([]map[string]interface{}, 0)
|
||||||
|
for computeKey, computeVal := range computes {
|
||||||
|
temp := map[string]interface{}{
|
||||||
|
"compute_id": computeKey,
|
||||||
|
"compute_name": computeVal,
|
||||||
|
}
|
||||||
|
res = append(res, temp)
|
||||||
|
}
|
||||||
|
return res
|
||||||
|
}
|
||||||
@@ -1,181 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|
||||||
Authors:
|
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
|
||||||
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
|
||||||
builds seamlessly.
|
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
|
||||||
*/
|
|
||||||
|
|
||||||
package disks
|
|
||||||
|
|
||||||
type Disk struct {
|
|
||||||
Acl map[string]interface{} `json:"acl"`
|
|
||||||
AccountID int `json:"accountId"`
|
|
||||||
AccountName string `json:"accountName"`
|
|
||||||
BootPartition int `json:"bootPartition"`
|
|
||||||
Computes map[string]string `json:"computes"`
|
|
||||||
CreatedTime uint64 `json:"creationTime"`
|
|
||||||
DeletedTime uint64 `json:"deletionTime"`
|
|
||||||
DeviceName string `json:"devicename"`
|
|
||||||
Desc string `json:"desc"`
|
|
||||||
DestructionTime uint64 `json:"destructionTime"`
|
|
||||||
DiskPath string `json:"diskPath"`
|
|
||||||
GridID int `json:"gid"`
|
|
||||||
GUID int `json:"guid"`
|
|
||||||
ID uint `json:"id"`
|
|
||||||
ImageID int `json:"imageId"`
|
|
||||||
Images []int `json:"images"`
|
|
||||||
IOTune IOTune `json:"iotune"`
|
|
||||||
IQN string `json:"iqn"`
|
|
||||||
Login string `json:"login"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
MachineId int `json:"machineId"`
|
|
||||||
MachineName string `json:"machineName"`
|
|
||||||
Milestones uint64 `json:"milestones"`
|
|
||||||
Order int `json:"order"`
|
|
||||||
Params string `json:"params"`
|
|
||||||
Passwd string `json:"passwd"`
|
|
||||||
ParentId int `json:"parentId"`
|
|
||||||
PciSlot int `json:"pciSlot"`
|
|
||||||
Pool string `json:"pool"`
|
|
||||||
PresentTo []int `json:"presentTo"`
|
|
||||||
PurgeTime uint64 `json:"purgeTime"`
|
|
||||||
PurgeAttempts uint64 `json:"purgeAttempts"`
|
|
||||||
RealityDeviceNumber int `json:"realityDeviceNumber"`
|
|
||||||
ReferenceId string `json:"referenceId"`
|
|
||||||
ResID string `json:"resId"`
|
|
||||||
ResName string `json:"resName"`
|
|
||||||
Role string `json:"role"`
|
|
||||||
SepType string `json:"sepType"`
|
|
||||||
Shareable bool `json:"shareable"`
|
|
||||||
SepID int `json:"sepId"` // NOTE: absent from compute/get output
|
|
||||||
SizeMax int `json:"sizeMax"`
|
|
||||||
SizeUsed float64 `json:"sizeUsed"` // sum over all snapshots of this disk to report total consumed space
|
|
||||||
Snapshots []Snapshot `json:"snapshots"`
|
|
||||||
Status string `json:"status"`
|
|
||||||
TechStatus string `json:"techStatus"`
|
|
||||||
Type string `json:"type"`
|
|
||||||
UpdateBy uint64 `json:"updateBy"`
|
|
||||||
VMID int `json:"vmid"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type Snapshot struct {
|
|
||||||
Guid string `json:"guid"`
|
|
||||||
Label string `json:"label"`
|
|
||||||
ResId string `json:"resId"`
|
|
||||||
SnapSetGuid string `json:"snapSetGuid"`
|
|
||||||
SnapSetTime uint64 `json:"snapSetTime"`
|
|
||||||
TimeStamp uint64 `json:"timestamp"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type SnapshotList []Snapshot
|
|
||||||
|
|
||||||
type DisksList []Disk
|
|
||||||
|
|
||||||
type IOTune struct {
|
|
||||||
ReadBytesSec int `json:"read_bytes_sec"`
|
|
||||||
ReadBytesSecMax int `json:"read_bytes_sec_max"`
|
|
||||||
ReadIopsSec int `json:"read_iops_sec"`
|
|
||||||
ReadIopsSecMax int `json:"read_iops_sec_max"`
|
|
||||||
SizeIopsSec int `json:"size_iops_sec"`
|
|
||||||
TotalBytesSec int `json:"total_bytes_sec"`
|
|
||||||
TotalBytesSecMax int `json:"total_bytes_sec_max"`
|
|
||||||
TotalIopsSec int `json:"total_iops_sec"`
|
|
||||||
TotalIopsSecMax int `json:"total_iops_sec_max"`
|
|
||||||
WriteBytesSec int `json:"write_bytes_sec"`
|
|
||||||
WriteBytesSecMax int `json:"write_bytes_sec_max"`
|
|
||||||
WriteIopsSec int `json:"write_iops_sec"`
|
|
||||||
WriteIopsSecMax int `json:"write_iops_sec_max"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type Pool struct {
|
|
||||||
Name string `json:"name"`
|
|
||||||
Types []string `json:"types"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type PoolList []Pool
|
|
||||||
|
|
||||||
type TypeDetailed struct {
|
|
||||||
Pools []Pool `json:"pools"`
|
|
||||||
SepID int `json:"sepId"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type TypesDetailedList []TypeDetailed
|
|
||||||
|
|
||||||
type TypesList []string
|
|
||||||
|
|
||||||
type Unattached struct {
|
|
||||||
Ckey string `json:"_ckey"`
|
|
||||||
Meta []interface{} `json:"_meta"`
|
|
||||||
AccountID int `json:"accountId"`
|
|
||||||
AccountName string `json:"accountName"`
|
|
||||||
Acl map[string]interface{} `json:"acl"`
|
|
||||||
BootPartition int `json:"bootPartition"`
|
|
||||||
CreatedTime int `json:"createdTime"`
|
|
||||||
DeletedTime int `json:"deletedTime"`
|
|
||||||
Desc string `json:"desc"`
|
|
||||||
DestructionTime int `json:"destructionTime"`
|
|
||||||
DiskPath string `json:"diskPath"`
|
|
||||||
GridID int `json:"gid"`
|
|
||||||
GUID int `json:"guid"`
|
|
||||||
ID int `json:"id"`
|
|
||||||
ImageID int `json:"imageId"`
|
|
||||||
Images []int `json:"images"`
|
|
||||||
IOTune IOTune `json:"iotune"`
|
|
||||||
IQN string `json:"iqn"`
|
|
||||||
Login string `json:"login"`
|
|
||||||
Milestones int `json:"milestones"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
Order int `json:"order"`
|
|
||||||
Params string `json:"params"`
|
|
||||||
ParentID int `json:"parentId"`
|
|
||||||
Passwd string `json:"passwd"`
|
|
||||||
PciSlot int `json:"pciSlot"`
|
|
||||||
Pool string `json:"pool"`
|
|
||||||
PurgeAttempts int `json:"purgeAttempts"`
|
|
||||||
PurgeTime int `json:"purgeTime"`
|
|
||||||
RealityDeviceNumber int `json:"realityDeviceNumber"`
|
|
||||||
ReferenceID string `json:"referenceId"`
|
|
||||||
ResID string `json:"resId"`
|
|
||||||
ResName string `json:"resName"`
|
|
||||||
Role string `json:"role"`
|
|
||||||
SepID int `json:"sepId"`
|
|
||||||
SizeMax int `json:"sizeMax"`
|
|
||||||
SizeUsed float64 `json:"sizeUsed"`
|
|
||||||
Snapshots []Snapshot `json:"snapshots"`
|
|
||||||
Status string `json:"status"`
|
|
||||||
TechStatus string `json:"techStatus"`
|
|
||||||
Type string `json:"type"`
|
|
||||||
VMID int `json:"vmid"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type UnattachedList []Unattached
|
|
||||||
|
|
||||||
type Pair struct {
|
|
||||||
intPort int
|
|
||||||
extPortStart int
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package disks
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/account"
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/locations"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
|
||||||
|
)
|
||||||
|
|
||||||
|
func existAccountID(ctx context.Context, d *schema.ResourceData, m interface{}) (bool, error) {
|
||||||
|
c := m.(*controller.ControllerCfg)
|
||||||
|
accountId := uint64(d.Get("account_id").(int))
|
||||||
|
req := account.ListRequest{}
|
||||||
|
|
||||||
|
accountList, err := c.CloudAPI().Account().List(ctx, req)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return len(accountList.FilterByID(accountId)) != 0, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func existGID(ctx context.Context, d *schema.ResourceData, m interface{}) (bool, error) {
|
||||||
|
c := m.(*controller.ControllerCfg)
|
||||||
|
gid := uint64(d.Get("gid").(int))
|
||||||
|
req := locations.ListRequest{}
|
||||||
|
|
||||||
|
locationList, err := c.CloudAPI().Locations().List(ctx, req)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return len(locationList.FilterByGID(gid)) != 0, nil
|
||||||
|
}
|
||||||
@@ -22,29 +22,28 @@ limitations under the License.
|
|||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package disks
|
package disks
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/url"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/constants"
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/controller"
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/dc"
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/status"
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/disks"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/dc"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/status"
|
||||||
|
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
@@ -53,183 +52,213 @@ import (
|
|||||||
|
|
||||||
func resourceDiskCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func resourceDiskCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
c := m.(*controller.ControllerCfg)
|
c := m.(*controller.ControllerCfg)
|
||||||
urlValues := &url.Values{}
|
req := disks.CreateRequest{}
|
||||||
|
|
||||||
urlValues.Add("accountId", fmt.Sprintf("%d", d.Get("account_id").(int)))
|
haveAccount, err := existAccountID(ctx, d, m)
|
||||||
urlValues.Add("gid", fmt.Sprintf("%d", d.Get("gid").(int)))
|
if err != nil {
|
||||||
urlValues.Add("name", d.Get("disk_name").(string))
|
return diag.FromErr(err)
|
||||||
urlValues.Add("size", fmt.Sprintf("%d", d.Get("size_max").(int)))
|
}
|
||||||
|
if !haveAccount {
|
||||||
|
return diag.Errorf("resourceDiskCreate: can't create Disk because AccountID %d is not allowed or does not exist", d.Get("account_id").(int))
|
||||||
|
}
|
||||||
|
|
||||||
|
haveGID, err := existGID(ctx, d, m)
|
||||||
|
if err != nil {
|
||||||
|
return diag.FromErr(err)
|
||||||
|
}
|
||||||
|
if !haveGID {
|
||||||
|
return diag.Errorf("resourceDiskCreate: can't create Disk because GID %d is not allowed or does not exist", d.Get("gid").(int))
|
||||||
|
}
|
||||||
|
|
||||||
|
req.AccountID = uint64(d.Get("account_id").(int))
|
||||||
|
req.GID = uint64(d.Get("gid").(int))
|
||||||
|
req.Name = d.Get("disk_name").(string)
|
||||||
|
req.Size = uint64(d.Get("size_max").(int))
|
||||||
if typeRaw, ok := d.GetOk("type"); ok {
|
if typeRaw, ok := d.GetOk("type"); ok {
|
||||||
urlValues.Add("type", strings.ToUpper(typeRaw.(string)))
|
req.Type = strings.ToUpper(typeRaw.(string))
|
||||||
} else {
|
} else {
|
||||||
urlValues.Add("type", "D")
|
req.Type = "D"
|
||||||
}
|
}
|
||||||
|
|
||||||
if sepId, ok := d.GetOk("sep_id"); ok {
|
if sepId, ok := d.GetOk("sep_id"); ok {
|
||||||
urlValues.Add("sep_id", strconv.Itoa(sepId.(int)))
|
req.SEPID = uint64(sepId.(int))
|
||||||
}
|
}
|
||||||
|
|
||||||
if poolName, ok := d.GetOk("pool"); ok {
|
if poolName, ok := d.GetOk("pool"); ok {
|
||||||
urlValues.Add("pool", poolName.(string))
|
req.Pool = poolName.(string)
|
||||||
}
|
}
|
||||||
|
|
||||||
argVal, argSet := d.GetOk("desc")
|
argVal, argSet := d.GetOk("desc")
|
||||||
if argSet {
|
if argSet {
|
||||||
urlValues.Add("description", argVal.(string))
|
req.Description = argVal.(string)
|
||||||
}
|
}
|
||||||
|
|
||||||
diskId, err := c.DecortAPICall(ctx, "POST", disksCreateAPI, urlValues)
|
diskId, err := c.CloudAPI().Disks().Create(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
urlValues = &url.Values{}
|
d.SetId(strconv.FormatUint(diskId, 10))
|
||||||
|
|
||||||
d.SetId(diskId) // update ID of the resource to tell Terraform that the disk resource exists
|
|
||||||
|
|
||||||
if iotuneRaw, ok := d.GetOk("iotune"); ok {
|
if iotuneRaw, ok := d.GetOk("iotune"); ok {
|
||||||
iot := iotuneRaw.([]interface{})[0]
|
iot := iotuneRaw.([]interface{})[0]
|
||||||
iotune := iot.(map[string]interface{})
|
iotune := iot.(map[string]interface{})
|
||||||
urlValues.Add("diskId", diskId)
|
req := disks.LimitIORequest{
|
||||||
urlValues.Add("iops", strconv.Itoa(iotune["total_iops_sec"].(int)))
|
DiskID: diskId,
|
||||||
urlValues.Add("read_bytes_sec", strconv.Itoa(iotune["read_bytes_sec"].(int)))
|
IOPS: uint64(iotune["total_iops_sec"].(int)),
|
||||||
urlValues.Add("read_bytes_sec_max", strconv.Itoa(iotune["read_bytes_sec_max"].(int)))
|
ReadBytesSec: uint64(iotune["read_bytes_sec"].(int)),
|
||||||
urlValues.Add("read_iops_sec", strconv.Itoa(iotune["read_iops_sec"].(int)))
|
ReadBytesSecMax: uint64(iotune["read_bytes_sec_max"].(int)),
|
||||||
urlValues.Add("read_iops_sec_max", strconv.Itoa(iotune["read_iops_sec_max"].(int)))
|
ReadIOPSSec: uint64(iotune["read_iops_sec"].(int)),
|
||||||
urlValues.Add("size_iops_sec", strconv.Itoa(iotune["size_iops_sec"].(int)))
|
ReadIOPSSecMax: uint64(iotune["read_iops_sec_max"].(int)),
|
||||||
urlValues.Add("total_bytes_sec", strconv.Itoa(iotune["total_bytes_sec"].(int)))
|
SizeIOPSSec: uint64(iotune["size_iops_sec"].(int)),
|
||||||
urlValues.Add("total_bytes_sec_max", strconv.Itoa(iotune["total_bytes_sec_max"].(int)))
|
TotalBytesSec: uint64(iotune["total_bytes_sec"].(int)),
|
||||||
urlValues.Add("total_iops_sec_max", strconv.Itoa(iotune["total_iops_sec_max"].(int)))
|
TotalBytesSecMax: uint64(iotune["total_bytes_sec_max"].(int)),
|
||||||
urlValues.Add("write_bytes_sec", strconv.Itoa(iotune["write_bytes_sec"].(int)))
|
TotalIOPSSecMax: uint64(iotune["total_iops_sec_max"].(int)),
|
||||||
urlValues.Add("write_bytes_sec_max", strconv.Itoa(iotune["write_bytes_sec_max"].(int)))
|
TotalIOPSSec: uint64(iotune["total_iops_sec"].(int)),
|
||||||
urlValues.Add("write_iops_sec", strconv.Itoa(iotune["write_iops_sec"].(int)))
|
WriteBytesSec: uint64(iotune["write_bytes_sec"].(int)),
|
||||||
urlValues.Add("write_iops_sec_max", strconv.Itoa(iotune["write_iops_sec_max"].(int)))
|
WriteBytesSecMax: uint64(iotune["write_bytes_sec_max"].(int)),
|
||||||
|
WriteIOPSSec: uint64(iotune["write_iops_sec"].(int)),
|
||||||
|
WriteIOPSSecMax: uint64(iotune["write_iops_sec_max"].(int)),
|
||||||
|
}
|
||||||
|
|
||||||
_, err := c.DecortAPICall(ctx, "POST", disksIOLimitAPI, urlValues)
|
_, err := c.CloudAPI().Disks().LimitIO(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
urlValues = &url.Values{}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if shareable := d.Get("shareable"); shareable.(bool) == true {
|
if shareable := d.Get("shareable"); shareable.(bool) == true {
|
||||||
urlValues.Add("diskId", diskId)
|
req := disks.ShareRequest{
|
||||||
_, err := c.DecortAPICall(ctx, "POST", disksShareAPI, urlValues)
|
DiskID: diskId,
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err := c.CloudAPI().Disks().Share(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
urlValues = &url.Values{}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dgn := resourceDiskRead(ctx, d, m)
|
return resourceDiskRead(ctx, d, m)
|
||||||
if dgn != nil {
|
|
||||||
return dgn
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func resourceDiskRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func resourceDiskRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
urlValues := &url.Values{}
|
|
||||||
c := m.(*controller.ControllerCfg)
|
c := m.(*controller.ControllerCfg)
|
||||||
warnings := dc.Warnings{}
|
warnings := dc.Warnings{}
|
||||||
|
|
||||||
disk, err := utilityDiskCheckPresence(ctx, d, m)
|
disk, err := utilityDiskCheckPresence(ctx, d, m)
|
||||||
if disk == nil {
|
if err != nil {
|
||||||
d.SetId("")
|
d.SetId("")
|
||||||
if err != nil {
|
return diag.FromErr(err)
|
||||||
return diag.FromErr(err)
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
hasChangeState := false
|
hasChangeState := false
|
||||||
if disk.Status == status.Destroyed || disk.Status == status.Purged {
|
|
||||||
d.Set("disk_id", 0)
|
|
||||||
return resourceDiskCreate(ctx, d, m)
|
|
||||||
} else if disk.Status == status.Deleted {
|
|
||||||
hasChangeState = true
|
|
||||||
urlValues.Add("diskId", d.Id())
|
|
||||||
urlValues.Add("reason", d.Get("reason").(string))
|
|
||||||
|
|
||||||
_, err := c.DecortAPICall(ctx, "POST", disksRestoreAPI, urlValues)
|
switch disk.Status {
|
||||||
|
case status.Destroyed, status.Purged:
|
||||||
|
d.Set("disk_id", 0)
|
||||||
|
d.SetId("")
|
||||||
|
return resourceDiskCreate(ctx, d, m)
|
||||||
|
case status.Deleted:
|
||||||
|
hasChangeState = true
|
||||||
|
req := disks.RestoreRequest{
|
||||||
|
DiskID: disk.ID,
|
||||||
|
}
|
||||||
|
|
||||||
|
if reason, ok := d.GetOk("reason"); ok {
|
||||||
|
req.Reason = reason.(string)
|
||||||
|
} else {
|
||||||
|
req.Reason = "Terraform automatic restore"
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err := c.CloudAPI().Disks().Restore(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
warnings.Add(err)
|
warnings.Add(err)
|
||||||
}
|
}
|
||||||
|
case status.Assigned:
|
||||||
|
case status.Modeled:
|
||||||
|
return diag.Errorf("The disk is in status: %s, please, contact support for more information", disk.Status)
|
||||||
|
case status.Creating:
|
||||||
|
case status.Created:
|
||||||
|
case status.Allocated:
|
||||||
|
case status.Unallocated:
|
||||||
}
|
}
|
||||||
|
|
||||||
if hasChangeState {
|
if hasChangeState {
|
||||||
urlValues = &url.Values{}
|
|
||||||
disk, err = utilityDiskCheckPresence(ctx, d, m)
|
disk, err = utilityDiskCheckPresence(ctx, d, m)
|
||||||
if disk == nil {
|
if err != nil {
|
||||||
d.SetId("")
|
d.SetId("")
|
||||||
if err != nil {
|
return diag.FromErr(err)
|
||||||
return diag.FromErr(err)
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
diskAcl, _ := json.Marshal(disk.Acl)
|
flattenDisk(d, disk)
|
||||||
|
|
||||||
d.Set("account_id", disk.AccountID)
|
|
||||||
d.Set("account_name", disk.AccountName)
|
|
||||||
d.Set("acl", string(diskAcl))
|
|
||||||
d.Set("boot_partition", disk.BootPartition)
|
|
||||||
d.Set("computes", flattenDiskComputes(disk.Computes))
|
|
||||||
d.Set("created_time", disk.CreatedTime)
|
|
||||||
d.Set("deleted_time", disk.DeletedTime)
|
|
||||||
d.Set("desc", disk.Desc)
|
|
||||||
d.Set("destruction_time", disk.DestructionTime)
|
|
||||||
d.Set("devicename", disk.DeviceName)
|
|
||||||
d.Set("disk_path", disk.DiskPath)
|
|
||||||
d.Set("gid", disk.GridID)
|
|
||||||
d.Set("guid", disk.GUID)
|
|
||||||
d.Set("disk_id", disk.ID)
|
|
||||||
d.Set("image_id", disk.ImageID)
|
|
||||||
d.Set("images", disk.Images)
|
|
||||||
d.Set("iotune", flattenIOTune(disk.IOTune))
|
|
||||||
d.Set("iqn", disk.IQN)
|
|
||||||
d.Set("login", disk.Login)
|
|
||||||
d.Set("milestones", disk.Milestones)
|
|
||||||
d.Set("disk_name", disk.Name)
|
|
||||||
d.Set("order", disk.Order)
|
|
||||||
d.Set("params", disk.Params)
|
|
||||||
d.Set("parent_id", disk.ParentId)
|
|
||||||
d.Set("passwd", disk.Passwd)
|
|
||||||
d.Set("pci_slot", disk.PciSlot)
|
|
||||||
d.Set("pool", disk.Pool)
|
|
||||||
d.Set("present_to", disk.PresentTo)
|
|
||||||
d.Set("purge_attempts", disk.PurgeAttempts)
|
|
||||||
d.Set("purge_time", disk.PurgeTime)
|
|
||||||
d.Set("reality_device_number", disk.RealityDeviceNumber)
|
|
||||||
d.Set("reference_id", disk.ReferenceId)
|
|
||||||
d.Set("res_id", disk.ResID)
|
|
||||||
d.Set("res_name", disk.ResName)
|
|
||||||
d.Set("role", disk.Role)
|
|
||||||
d.Set("sep_id", disk.SepID)
|
|
||||||
d.Set("sep_type", disk.SepType)
|
|
||||||
d.Set("size_max", disk.SizeMax)
|
|
||||||
d.Set("size_used", disk.SizeUsed)
|
|
||||||
d.Set("shareable", disk.Shareable)
|
|
||||||
d.Set("snapshots", flattenDiskSnapshotList(disk.Snapshots))
|
|
||||||
d.Set("status", disk.Status)
|
|
||||||
d.Set("tech_status", disk.TechStatus)
|
|
||||||
d.Set("type", disk.Type)
|
|
||||||
d.Set("vmid", disk.VMID)
|
|
||||||
|
|
||||||
return warnings.Get()
|
return warnings.Get()
|
||||||
}
|
}
|
||||||
|
|
||||||
func resourceDiskUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func resourceDiskUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
c := m.(*controller.ControllerCfg)
|
c := m.(*controller.ControllerCfg)
|
||||||
urlValues := &url.Values{}
|
warnings := dc.Warnings{}
|
||||||
|
|
||||||
|
haveAccount, err := existAccountID(ctx, d, m)
|
||||||
|
if err != nil {
|
||||||
|
return diag.FromErr(err)
|
||||||
|
}
|
||||||
|
if !haveAccount {
|
||||||
|
return diag.Errorf("resourceDiskUpdate: can't update Disk because AccountID %d is not allowed or does not exist", d.Get("account_id").(int))
|
||||||
|
}
|
||||||
|
|
||||||
|
haveGID, err := existGID(ctx, d, m)
|
||||||
|
if err != nil {
|
||||||
|
return diag.FromErr(err)
|
||||||
|
}
|
||||||
|
if !haveGID {
|
||||||
|
return diag.Errorf("resourceDiskUpdate: can't update Disk because GID %d is not allowed or does not exist", d.Get("gid").(int))
|
||||||
|
}
|
||||||
|
|
||||||
disk, err := utilityDiskCheckPresence(ctx, d, m)
|
disk, err := utilityDiskCheckPresence(ctx, d, m)
|
||||||
if disk == nil {
|
if err != nil {
|
||||||
|
return diag.FromErr(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
hasChangeState := false
|
||||||
|
|
||||||
|
switch disk.Status {
|
||||||
|
case status.Destroyed, status.Purged:
|
||||||
|
d.Set("disk_id", 0)
|
||||||
|
d.SetId("")
|
||||||
|
return resourceDiskCreate(ctx, d, m)
|
||||||
|
case status.Deleted:
|
||||||
|
hasChangeState = true
|
||||||
|
req := disks.RestoreRequest{
|
||||||
|
DiskID: disk.ID,
|
||||||
|
}
|
||||||
|
|
||||||
|
if reason, ok := d.GetOk("reason"); ok {
|
||||||
|
req.Reason = reason.(string)
|
||||||
|
} else {
|
||||||
|
req.Reason = "Terraform automatic restore"
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err := c.CloudAPI().Disks().Restore(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
warnings.Add(err)
|
||||||
|
}
|
||||||
|
case status.Assigned:
|
||||||
|
case status.Modeled:
|
||||||
|
return diag.Errorf("The disk is in status: %s, please, contact support for more information", disk.Status)
|
||||||
|
case status.Creating:
|
||||||
|
case status.Created:
|
||||||
|
case status.Allocated:
|
||||||
|
case status.Unallocated:
|
||||||
|
}
|
||||||
|
|
||||||
|
if hasChangeState {
|
||||||
|
disk, err = utilityDiskCheckPresence(ctx, d, m)
|
||||||
|
if err != nil {
|
||||||
|
d.SetId("")
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if d.HasChange("size_max") {
|
if d.HasChange("size_max") {
|
||||||
@@ -237,68 +266,75 @@ func resourceDiskUpdate(ctx context.Context, d *schema.ResourceData, m interface
|
|||||||
if oldSize.(int) < newSize.(int) {
|
if oldSize.(int) < newSize.(int) {
|
||||||
log.Debugf("resourceDiskUpdate: resizing disk ID %s - %d GB -> %d GB",
|
log.Debugf("resourceDiskUpdate: resizing disk ID %s - %d GB -> %d GB",
|
||||||
d.Id(), oldSize.(int), newSize.(int))
|
d.Id(), oldSize.(int), newSize.(int))
|
||||||
urlValues.Add("diskId", d.Id())
|
req := disks.ResizeRequest{
|
||||||
urlValues.Add("size", fmt.Sprintf("%d", newSize.(int)))
|
DiskID: disk.ID,
|
||||||
_, err := c.DecortAPICall(ctx, "POST", disksResizeAPI, urlValues)
|
Size: uint64(newSize.(int)),
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err := c.CloudAPI().Disks().Resize(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
d.Set("size_max", newSize)
|
d.Set("size_max", newSize)
|
||||||
} else if oldSize.(int) > newSize.(int) {
|
} else if oldSize.(int) > newSize.(int) {
|
||||||
return diag.FromErr(fmt.Errorf("resourceDiskUpdate: Disk ID %s - reducing disk size is not allowed", d.Id()))
|
return diag.FromErr(fmt.Errorf("resourceDiskUpdate: Disk ID %s - reducing disk size is not allowed", d.Id()))
|
||||||
}
|
}
|
||||||
urlValues = &url.Values{}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if d.HasChange("disk_name") {
|
if d.HasChange("disk_name") {
|
||||||
urlValues.Add("diskId", d.Id())
|
req := disks.RenameRequest{
|
||||||
urlValues.Add("name", d.Get("disk_name").(string))
|
DiskID: disk.ID,
|
||||||
_, err := c.DecortAPICall(ctx, "POST", disksRenameAPI, urlValues)
|
Name: d.Get("disk_name").(string),
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err := c.CloudAPI().Disks().Rename(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
urlValues = &url.Values{}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if d.HasChange("iotune") {
|
if d.HasChange("iotune") {
|
||||||
iot := d.Get("iotune").([]interface{})[0]
|
iot := d.Get("iotune").([]interface{})[0]
|
||||||
iotune := iot.(map[string]interface{})
|
iotune := iot.(map[string]interface{})
|
||||||
urlValues.Add("diskId", d.Id())
|
req := disks.LimitIORequest{
|
||||||
urlValues.Add("iops", strconv.Itoa(iotune["total_iops_sec"].(int)))
|
DiskID: disk.ID,
|
||||||
urlValues.Add("read_bytes_sec", strconv.Itoa(iotune["read_bytes_sec"].(int)))
|
IOPS: uint64(iotune["total_iops_sec"].(int)),
|
||||||
urlValues.Add("read_bytes_sec_max", strconv.Itoa(iotune["read_bytes_sec_max"].(int)))
|
ReadBytesSec: uint64(iotune["read_bytes_sec"].(int)),
|
||||||
urlValues.Add("read_iops_sec", strconv.Itoa(iotune["read_iops_sec"].(int)))
|
ReadBytesSecMax: uint64(iotune["read_bytes_sec_max"].(int)),
|
||||||
urlValues.Add("read_iops_sec_max", strconv.Itoa(iotune["read_iops_sec_max"].(int)))
|
ReadIOPSSec: uint64(iotune["read_iops_sec"].(int)),
|
||||||
urlValues.Add("size_iops_sec", strconv.Itoa(iotune["size_iops_sec"].(int)))
|
ReadIOPSSecMax: uint64(iotune["read_iops_sec_max"].(int)),
|
||||||
urlValues.Add("total_bytes_sec", strconv.Itoa(iotune["total_bytes_sec"].(int)))
|
SizeIOPSSec: uint64(iotune["size_iops_sec"].(int)),
|
||||||
urlValues.Add("total_bytes_sec_max", strconv.Itoa(iotune["total_bytes_sec_max"].(int)))
|
TotalBytesSec: uint64(iotune["total_bytes_sec"].(int)),
|
||||||
urlValues.Add("total_iops_sec_max", strconv.Itoa(iotune["total_iops_sec_max"].(int)))
|
TotalBytesSecMax: uint64(iotune["total_bytes_sec_max"].(int)),
|
||||||
urlValues.Add("write_bytes_sec", strconv.Itoa(iotune["write_bytes_sec"].(int)))
|
TotalIOPSSecMax: uint64(iotune["total_iops_sec_max"].(int)),
|
||||||
urlValues.Add("write_bytes_sec_max", strconv.Itoa(iotune["write_bytes_sec_max"].(int)))
|
TotalIOPSSec: uint64(iotune["total_iops_sec"].(int)),
|
||||||
urlValues.Add("write_iops_sec", strconv.Itoa(iotune["write_iops_sec"].(int)))
|
WriteBytesSec: uint64(iotune["write_bytes_sec"].(int)),
|
||||||
urlValues.Add("write_iops_sec_max", strconv.Itoa(iotune["write_iops_sec_max"].(int)))
|
WriteBytesSecMax: uint64(iotune["write_bytes_sec_max"].(int)),
|
||||||
|
WriteIOPSSec: uint64(iotune["write_iops_sec"].(int)),
|
||||||
|
WriteIOPSSecMax: uint64(iotune["write_iops_sec_max"].(int)),
|
||||||
|
}
|
||||||
|
|
||||||
_, err := c.DecortAPICall(ctx, "POST", disksIOLimitAPI, urlValues)
|
_, err := c.CloudAPI().Disks().LimitIO(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
urlValues = &url.Values{}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if d.HasChange("shareable") {
|
if d.HasChange("shareable") {
|
||||||
oldShare, newShare := d.GetChange("shareable")
|
oldShare, newShare := d.GetChange("shareable")
|
||||||
urlValues = &url.Values{}
|
|
||||||
urlValues.Add("diskId", d.Id())
|
|
||||||
if oldShare.(bool) == false && newShare.(bool) == true {
|
if oldShare.(bool) == false && newShare.(bool) == true {
|
||||||
_, err := c.DecortAPICall(ctx, "POST", disksShareAPI, urlValues)
|
req := disks.ShareRequest{DiskID: disk.ID}
|
||||||
|
|
||||||
|
_, err := c.CloudAPI().Disks().Share(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if oldShare.(bool) == true && newShare.(bool) == false {
|
if oldShare.(bool) == true && newShare.(bool) == false {
|
||||||
_, err := c.DecortAPICall(ctx, "POST", disksUnshareAPI, urlValues)
|
req := disks.UnshareRequest{DiskID: disk.ID}
|
||||||
|
|
||||||
|
_, err := c.CloudAPI().Disks().Unshare(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
@@ -310,26 +346,29 @@ func resourceDiskUpdate(ctx context.Context, d *schema.ResourceData, m interface
|
|||||||
|
|
||||||
func resourceDiskDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func resourceDiskDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
disk, err := utilityDiskCheckPresence(ctx, d, m)
|
disk, err := utilityDiskCheckPresence(ctx, d, m)
|
||||||
if disk == nil {
|
if err != nil {
|
||||||
if err != nil {
|
d.SetId("")
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
if disk.Status == status.Destroyed || disk.Status == status.Purged {
|
if disk.Status == status.Destroyed || disk.Status == status.Purged {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
params := &url.Values{}
|
|
||||||
params.Add("diskId", d.Id())
|
req := disks.DeleteRequest{
|
||||||
params.Add("detach", strconv.FormatBool(d.Get("detach").(bool)))
|
DiskID: disk.ID,
|
||||||
params.Add("permanently", strconv.FormatBool(d.Get("permanently").(bool)))
|
Detach: d.Get("detach").(bool),
|
||||||
params.Add("reason", d.Get("reason").(string))
|
Permanently: d.Get("permanently").(bool),
|
||||||
|
Reason: d.Get("reason").(string),
|
||||||
|
}
|
||||||
|
|
||||||
c := m.(*controller.ControllerCfg)
|
c := m.(*controller.ControllerCfg)
|
||||||
_, err = c.DecortAPICall(ctx, "POST", disksDeleteAPI, params)
|
_, err = c.CloudAPI().Disks().Delete(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
d.SetId("")
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -363,13 +402,6 @@ func resourceDiskSchemaMake() map[string]*schema.Schema {
|
|||||||
Computed: true,
|
Computed: true,
|
||||||
Description: "Pool for disk location",
|
Description: "Pool for disk location",
|
||||||
},
|
},
|
||||||
"present_to": {
|
|
||||||
Type: schema.TypeList,
|
|
||||||
Computed: true,
|
|
||||||
Elem: &schema.Schema{
|
|
||||||
Type: schema.TypeInt,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"sep_id": {
|
"sep_id": {
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
@@ -412,85 +444,6 @@ func resourceDiskSchemaMake() map[string]*schema.Schema {
|
|||||||
Optional: true,
|
Optional: true,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
"disk_id": {
|
|
||||||
Type: schema.TypeInt,
|
|
||||||
Computed: true,
|
|
||||||
Description: "Disk ID. Duplicates the value of the ID parameter",
|
|
||||||
},
|
|
||||||
"account_name": {
|
|
||||||
Type: schema.TypeString,
|
|
||||||
Computed: true,
|
|
||||||
Description: "The name of the subscriber '(account') to whom this disk belongs",
|
|
||||||
},
|
|
||||||
"acl": {
|
|
||||||
Type: schema.TypeString,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
"boot_partition": {
|
|
||||||
Type: schema.TypeInt,
|
|
||||||
Computed: true,
|
|
||||||
Description: "Number of disk partitions",
|
|
||||||
},
|
|
||||||
"computes": {
|
|
||||||
Type: schema.TypeList,
|
|
||||||
Computed: true,
|
|
||||||
Elem: &schema.Resource{
|
|
||||||
Schema: map[string]*schema.Schema{
|
|
||||||
"compute_id": {
|
|
||||||
Type: schema.TypeString,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
"compute_name": {
|
|
||||||
Type: schema.TypeString,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"created_time": {
|
|
||||||
Type: schema.TypeInt,
|
|
||||||
Computed: true,
|
|
||||||
Description: "Created time",
|
|
||||||
},
|
|
||||||
"deleted_time": {
|
|
||||||
Type: schema.TypeInt,
|
|
||||||
Computed: true,
|
|
||||||
Description: "Deleted time",
|
|
||||||
},
|
|
||||||
"destruction_time": {
|
|
||||||
Type: schema.TypeInt,
|
|
||||||
Computed: true,
|
|
||||||
Description: "Time of final deletion",
|
|
||||||
},
|
|
||||||
"devicename": {
|
|
||||||
Type: schema.TypeString,
|
|
||||||
Computed: true,
|
|
||||||
Description: "Name of the device",
|
|
||||||
},
|
|
||||||
"disk_path": {
|
|
||||||
Type: schema.TypeString,
|
|
||||||
Computed: true,
|
|
||||||
Description: "Disk path",
|
|
||||||
},
|
|
||||||
"guid": {
|
|
||||||
Type: schema.TypeInt,
|
|
||||||
Computed: true,
|
|
||||||
Description: "Disk ID on the storage side",
|
|
||||||
},
|
|
||||||
"image_id": {
|
|
||||||
Type: schema.TypeInt,
|
|
||||||
Computed: true,
|
|
||||||
Description: "Image ID",
|
|
||||||
},
|
|
||||||
"images": {
|
|
||||||
Type: schema.TypeList,
|
|
||||||
Computed: true,
|
|
||||||
Elem: &schema.Schema{
|
|
||||||
Type: schema.TypeString,
|
|
||||||
},
|
|
||||||
Description: "IDs of images using the disk",
|
|
||||||
},
|
|
||||||
"iotune": {
|
"iotune": {
|
||||||
Type: schema.TypeList,
|
Type: schema.TypeList,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
@@ -579,22 +532,106 @@ func resourceDiskSchemaMake() map[string]*schema.Schema {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"iqn": {
|
"present_to": {
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeList,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
Description: "Disk IQN",
|
Elem: &schema.Schema{
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
"login": {
|
"disk_id": {
|
||||||
Type: schema.TypeString,
|
|
||||||
Computed: true,
|
|
||||||
Description: "Login to access the disk",
|
|
||||||
},
|
|
||||||
"milestones": {
|
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
Description: "Milestones",
|
Description: "Disk ID. Duplicates the value of the ID parameter",
|
||||||
},
|
},
|
||||||
|
"account_name": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
Description: "The name of the subscriber '(account') to whom this disk belongs",
|
||||||
|
},
|
||||||
|
"acl": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
// "boot_partition": {
|
||||||
|
// Type: schema.TypeInt,
|
||||||
|
// Computed: true,
|
||||||
|
// Description: "Number of disk partitions",
|
||||||
|
// },
|
||||||
|
"computes": {
|
||||||
|
Type: schema.TypeList,
|
||||||
|
Computed: true,
|
||||||
|
Elem: &schema.Resource{
|
||||||
|
Schema: map[string]*schema.Schema{
|
||||||
|
"compute_id": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"compute_name": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"created_time": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
Description: "Created time",
|
||||||
|
},
|
||||||
|
"deleted_time": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
Description: "Deleted time",
|
||||||
|
},
|
||||||
|
"destruction_time": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
Description: "Time of final deletion",
|
||||||
|
},
|
||||||
|
"devicename": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
Description: "Name of the device",
|
||||||
|
},
|
||||||
|
// "disk_path": {
|
||||||
|
// Type: schema.TypeString,
|
||||||
|
// Computed: true,
|
||||||
|
// Description: "Disk path",
|
||||||
|
// },
|
||||||
|
// "guid": {
|
||||||
|
// Type: schema.TypeInt,
|
||||||
|
// Computed: true,
|
||||||
|
// Description: "Disk ID on the storage side",
|
||||||
|
// },
|
||||||
|
"image_id": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
Description: "Image ID",
|
||||||
|
},
|
||||||
|
"images": {
|
||||||
|
Type: schema.TypeList,
|
||||||
|
Computed: true,
|
||||||
|
Elem: &schema.Schema{
|
||||||
|
Type: schema.TypeString,
|
||||||
|
},
|
||||||
|
Description: "IDs of images using the disk",
|
||||||
|
},
|
||||||
|
// "iqn": {
|
||||||
|
// Type: schema.TypeString,
|
||||||
|
// Computed: true,
|
||||||
|
// Description: "Disk IQN",
|
||||||
|
// },
|
||||||
|
// "login": {
|
||||||
|
// Type: schema.TypeString,
|
||||||
|
// Computed: true,
|
||||||
|
// Description: "Login to access the disk",
|
||||||
|
// },
|
||||||
|
// "milestones": {
|
||||||
|
// Type: schema.TypeInt,
|
||||||
|
// Computed: true,
|
||||||
|
// Description: "Milestones",
|
||||||
|
// },
|
||||||
"order": {
|
"order": {
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
@@ -610,36 +647,36 @@ func resourceDiskSchemaMake() map[string]*schema.Schema {
|
|||||||
Computed: true,
|
Computed: true,
|
||||||
Description: "ID of the parent disk",
|
Description: "ID of the parent disk",
|
||||||
},
|
},
|
||||||
"passwd": {
|
// "passwd": {
|
||||||
Type: schema.TypeString,
|
// Type: schema.TypeString,
|
||||||
Computed: true,
|
// Computed: true,
|
||||||
Description: "Password to access the disk",
|
// Description: "Password to access the disk",
|
||||||
},
|
// },
|
||||||
"pci_slot": {
|
"pci_slot": {
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
Description: "ID of the pci slot to which the disk is connected",
|
Description: "ID of the pci slot to which the disk is connected",
|
||||||
},
|
},
|
||||||
"purge_attempts": {
|
// "purge_attempts": {
|
||||||
Type: schema.TypeInt,
|
// Type: schema.TypeInt,
|
||||||
Computed: true,
|
// Computed: true,
|
||||||
Description: "Number of deletion attempts",
|
// Description: "Number of deletion attempts",
|
||||||
},
|
// },
|
||||||
"purge_time": {
|
"purge_time": {
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
Description: "Time of the last deletion attempt",
|
Description: "Time of the last deletion attempt",
|
||||||
},
|
},
|
||||||
"reality_device_number": {
|
// "reality_device_number": {
|
||||||
Type: schema.TypeInt,
|
// Type: schema.TypeInt,
|
||||||
Computed: true,
|
// Computed: true,
|
||||||
Description: "Reality device number",
|
// Description: "Reality device number",
|
||||||
},
|
// },
|
||||||
"reference_id": {
|
// "reference_id": {
|
||||||
Type: schema.TypeString,
|
// Type: schema.TypeString,
|
||||||
Computed: true,
|
// Computed: true,
|
||||||
Description: "ID of the reference to the disk",
|
// Description: "ID of the reference to the disk",
|
||||||
},
|
// },
|
||||||
"res_id": {
|
"res_id": {
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
|
|||||||
@@ -22,40 +22,37 @@ limitations under the License.
|
|||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package disks
|
package disks
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"net/url"
|
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/constants"
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/controller"
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/disks"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
|
||||||
)
|
)
|
||||||
|
|
||||||
func resourceDiskSnapshotCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func resourceDiskSnapshotCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
urlValues := &url.Values{}
|
|
||||||
c := m.(*controller.ControllerCfg)
|
c := m.(*controller.ControllerCfg)
|
||||||
|
|
||||||
disk, err := utilityDiskCheckPresence(ctx, d, m)
|
disk, err := utilityDiskCheckPresence(ctx, d, m)
|
||||||
if disk == nil {
|
if err != nil {
|
||||||
if err != nil {
|
return diag.FromErr(err)
|
||||||
return diag.FromErr(err)
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
snapshots := disk.Snapshots
|
snapshots := disk.Snapshots
|
||||||
snapshot := Snapshot{}
|
snapshot := disks.ItemSnapshot{}
|
||||||
label := d.Get("label").(string)
|
label := d.Get("label").(string)
|
||||||
for _, sn := range snapshots {
|
for _, sn := range snapshots {
|
||||||
if label == sn.Label {
|
if label == sn.Label {
|
||||||
@@ -66,30 +63,31 @@ func resourceDiskSnapshotCreate(ctx context.Context, d *schema.ResourceData, m i
|
|||||||
if label != snapshot.Label {
|
if label != snapshot.Label {
|
||||||
return diag.Errorf("Snapshot with label \"%v\" not found", label)
|
return diag.Errorf("Snapshot with label \"%v\" not found", label)
|
||||||
}
|
}
|
||||||
|
|
||||||
if rollback := d.Get("rollback").(bool); rollback {
|
if rollback := d.Get("rollback").(bool); rollback {
|
||||||
urlValues.Add("diskId", strconv.Itoa(d.Get("disk_id").(int)))
|
req := disks.SnapshotRollbackRequest{
|
||||||
urlValues.Add("label", label)
|
DiskID: disk.ID,
|
||||||
urlValues.Add("timestamp", strconv.Itoa(d.Get("timestamp").(int)))
|
Label: label,
|
||||||
|
TimeStamp: uint64(d.Get("timestamp").(int)),
|
||||||
|
}
|
||||||
|
|
||||||
log.Debugf("resourceDiskCreate: Snapshot rollback with label", label)
|
log.Debugf("resourceDiskCreate: Snapshot rollback with label", label)
|
||||||
_, err := c.DecortAPICall(ctx, "POST", disksSnapshotRollbackAPI, urlValues)
|
_, err := c.CloudAPI().Disks().SnapshotRollback(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
urlValues = &url.Values{}
|
|
||||||
}
|
}
|
||||||
return resourceDiskSnapshotRead(ctx, d, m)
|
return resourceDiskSnapshotRead(ctx, d, m)
|
||||||
}
|
}
|
||||||
|
|
||||||
func resourceDiskSnapshotRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func resourceDiskSnapshotRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
disk, err := utilityDiskCheckPresence(ctx, d, m)
|
disk, err := utilityDiskCheckPresence(ctx, d, m)
|
||||||
if disk == nil {
|
if err != nil {
|
||||||
if err != nil {
|
return diag.FromErr(err)
|
||||||
return diag.FromErr(err)
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
snapshots := disk.Snapshots
|
snapshots := disk.Snapshots
|
||||||
snapshot := Snapshot{}
|
snapshot := disks.ItemSnapshot{}
|
||||||
label := d.Get("label").(string)
|
label := d.Get("label").(string)
|
||||||
for _, sn := range snapshots {
|
for _, sn := range snapshots {
|
||||||
if label == sn.Label {
|
if label == sn.Label {
|
||||||
@@ -101,27 +99,20 @@ func resourceDiskSnapshotRead(ctx context.Context, d *schema.ResourceData, m int
|
|||||||
return diag.Errorf("Snapshot with label \"%v\" not found", label)
|
return diag.Errorf("Snapshot with label \"%v\" not found", label)
|
||||||
}
|
}
|
||||||
|
|
||||||
d.SetId(d.Get("label").(string))
|
flattenDiskSnapshot(d, snapshot)
|
||||||
d.Set("timestamp", snapshot.TimeStamp)
|
|
||||||
d.Set("guid", snapshot.Guid)
|
|
||||||
d.Set("res_id", snapshot.ResId)
|
|
||||||
d.Set("snap_set_guid", snapshot.SnapSetGuid)
|
|
||||||
d.Set("snap_set_time", snapshot.SnapSetTime)
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func resourceDiskSnapshotUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func resourceDiskSnapshotUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
urlValues := &url.Values{}
|
|
||||||
c := m.(*controller.ControllerCfg)
|
c := m.(*controller.ControllerCfg)
|
||||||
disk, err := utilityDiskCheckPresence(ctx, d, m)
|
disk, err := utilityDiskCheckPresence(ctx, d, m)
|
||||||
if disk == nil {
|
if err != nil {
|
||||||
if err != nil {
|
return diag.FromErr(err)
|
||||||
return diag.FromErr(err)
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
snapshots := disk.Snapshots
|
snapshots := disk.Snapshots
|
||||||
snapshot := Snapshot{}
|
snapshot := disks.ItemSnapshot{}
|
||||||
label := d.Get("label").(string)
|
label := d.Get("label").(string)
|
||||||
for _, sn := range snapshots {
|
for _, sn := range snapshots {
|
||||||
if label == sn.Label {
|
if label == sn.Label {
|
||||||
@@ -129,19 +120,23 @@ func resourceDiskSnapshotUpdate(ctx context.Context, d *schema.ResourceData, m i
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if label != snapshot.Label {
|
if label != snapshot.Label {
|
||||||
return diag.Errorf("Snapshot with label \"%v\" not found", label)
|
return diag.Errorf("Snapshot with label \"%v\" not found", label)
|
||||||
}
|
}
|
||||||
|
|
||||||
if d.HasChange("rollback") && d.Get("rollback").(bool) == true {
|
if d.HasChange("rollback") && d.Get("rollback").(bool) == true {
|
||||||
urlValues.Add("diskId", strconv.Itoa(d.Get("disk_id").(int)))
|
req := disks.SnapshotRollbackRequest{
|
||||||
urlValues.Add("label", label)
|
DiskID: disk.ID,
|
||||||
urlValues.Add("timestamp", strconv.Itoa(d.Get("timestamp").(int)))
|
Label: label,
|
||||||
|
TimeStamp: uint64(d.Get("timestamp").(int)),
|
||||||
|
}
|
||||||
|
|
||||||
log.Debugf("resourceDiskUpdtae: Snapshot rollback with label", label)
|
log.Debugf("resourceDiskUpdtae: Snapshot rollback with label", label)
|
||||||
_, err := c.DecortAPICall(ctx, "POST", disksSnapshotRollbackAPI, urlValues)
|
_, err := c.CloudAPI().Disks().SnapshotRollback(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
urlValues = &url.Values{}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return resourceDiskSnapshotRead(ctx, d, m)
|
return resourceDiskSnapshotRead(ctx, d, m)
|
||||||
@@ -151,22 +146,23 @@ func resourceDiskSnapshotDelete(ctx context.Context, d *schema.ResourceData, m i
|
|||||||
c := m.(*controller.ControllerCfg)
|
c := m.(*controller.ControllerCfg)
|
||||||
|
|
||||||
disk, err := utilityDiskCheckPresence(ctx, d, m)
|
disk, err := utilityDiskCheckPresence(ctx, d, m)
|
||||||
if disk == nil { //if disk not exits, can't call snapshotDelete
|
if err != nil {
|
||||||
d.SetId("")
|
d.SetId("")
|
||||||
if err != nil {
|
return diag.FromErr(err)
|
||||||
return diag.FromErr(err)
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
params := &url.Values{}
|
req := disks.SnapshotDeleteRequest{
|
||||||
params.Add("diskId", strconv.Itoa(d.Get("disk_id").(int)))
|
DiskID: disk.ID,
|
||||||
params.Add("label", d.Get("label").(string))
|
Label: d.Get("label").(string),
|
||||||
|
}
|
||||||
|
|
||||||
_, err = c.DecortAPICall(ctx, "POST", disksSnapshotDeleteAPI, params)
|
_, err = c.CloudAPI().Disks().SnapshotDelete(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
d.SetId("")
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -190,17 +186,17 @@ func resourceDiskSnapshotSchemaMake() map[string]*schema.Schema {
|
|||||||
Default: false,
|
Default: false,
|
||||||
Description: "Needed in order to make a snapshot rollback",
|
Description: "Needed in order to make a snapshot rollback",
|
||||||
},
|
},
|
||||||
"guid": {
|
|
||||||
Type: schema.TypeString,
|
|
||||||
Computed: true,
|
|
||||||
Description: "ID of the snapshot",
|
|
||||||
},
|
|
||||||
"timestamp": {
|
"timestamp": {
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
Description: "Snapshot time",
|
Description: "Snapshot time",
|
||||||
},
|
},
|
||||||
|
"guid": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
Description: "ID of the snapshot",
|
||||||
|
},
|
||||||
"res_id": {
|
"res_id": {
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
|
|||||||
@@ -22,47 +22,45 @@ limitations under the License.
|
|||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package disks
|
package disks
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
|
||||||
"net/url"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/controller"
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/disks"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
|
||||||
|
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
)
|
)
|
||||||
|
|
||||||
func utilityDiskCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (*Disk, error) {
|
func utilityDiskCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (*disks.RecordDisk, error) {
|
||||||
c := m.(*controller.ControllerCfg)
|
c := m.(*controller.ControllerCfg)
|
||||||
urlValues := &url.Values{}
|
req := disks.GetRequest{}
|
||||||
|
|
||||||
disk := &Disk{}
|
if d.Get("disk_id") != nil {
|
||||||
|
if d.Get("disk_id").(int) == 0 {
|
||||||
if d.Get("disk_id").(int) == 0 {
|
id, _ := strconv.ParseUint(d.Id(), 10, 64)
|
||||||
urlValues.Add("diskId", d.Id())
|
req.DiskID = id
|
||||||
|
} else {
|
||||||
|
req.DiskID = uint64(d.Get("disk_id").(int))
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
urlValues.Add("diskId", strconv.Itoa(d.Get("disk_id").(int)))
|
id, _ := strconv.ParseUint(d.Id(), 10, 64)
|
||||||
|
req.DiskID = id
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Debugf("utilityDiskCheckPresence: load disk")
|
log.Debugf("utilityDiskCheckPresence: load disk")
|
||||||
diskRaw, err := c.DecortAPICall(ctx, "POST", disksGetAPI, urlValues)
|
disk, err := c.CloudAPI().Disks().Get(ctx, req)
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
err = json.Unmarshal([]byte(diskRaw), disk)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,54 +22,46 @@ limitations under the License.
|
|||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package disks
|
package disks
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
|
||||||
"net/url"
|
|
||||||
"strconv"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/controller"
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/disks"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
|
||||||
|
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
)
|
)
|
||||||
|
|
||||||
func utilityDiskListCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}, api string) (DisksList, error) {
|
func utilityDiskListCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (disks.ListDisks, error) {
|
||||||
diskList := DisksList{}
|
|
||||||
c := m.(*controller.ControllerCfg)
|
c := m.(*controller.ControllerCfg)
|
||||||
urlValues := &url.Values{}
|
req := disks.ListRequest{}
|
||||||
|
|
||||||
if page, ok := d.GetOk("page"); ok {
|
if page, ok := d.GetOk("page"); ok {
|
||||||
urlValues.Add("page", strconv.Itoa(page.(int)))
|
req.Page = uint64(page.(int))
|
||||||
}
|
}
|
||||||
if size, ok := d.GetOk("size"); ok {
|
if size, ok := d.GetOk("size"); ok {
|
||||||
urlValues.Add("size", strconv.Itoa(size.(int)))
|
req.Size = uint64(size.(int))
|
||||||
}
|
}
|
||||||
if diskType, ok := d.GetOk("type"); ok {
|
if diskType, ok := d.GetOk("type"); ok {
|
||||||
urlValues.Add("type", strings.ToUpper(diskType.(string)))
|
req.Type = strings.ToUpper(diskType.(string))
|
||||||
}
|
}
|
||||||
if accountId, ok := d.GetOk("accountId"); ok {
|
if accountId, ok := d.GetOk("accountId"); ok {
|
||||||
urlValues.Add("accountId", strconv.Itoa(accountId.(int)))
|
req.AccountID = uint64(accountId.(int))
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Debugf("utilityDiskListCheckPresence: load disk list")
|
log.Debugf("utilityDiskListCheckPresence: load disk list")
|
||||||
diskListRaw, err := c.DecortAPICall(ctx, "POST", api, urlValues)
|
diskList, err := c.CloudAPI().Disks().List(ctx, req)
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
err = json.Unmarshal([]byte(diskListRaw), &diskList)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package disks
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
|
log "github.com/sirupsen/logrus"
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/disks"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
|
||||||
|
)
|
||||||
|
|
||||||
|
func utilityDiskListUnattachedCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (disks.ListDisksUnattached, error) {
|
||||||
|
c := m.(*controller.ControllerCfg)
|
||||||
|
req := disks.ListUnattachedRequest{}
|
||||||
|
if accountId, ok := d.GetOk("accountId"); ok {
|
||||||
|
req.AccountID = uint64(accountId.(int))
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Debugf("utilityDiskListUnattachedCheckPresence: load disk Unattached list")
|
||||||
|
unattachedList, err := c.CloudAPI().Disks().ListUnattached(ctx, req)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return unattachedList, nil
|
||||||
|
}
|
||||||
@@ -22,38 +22,33 @@ limitations under the License.
|
|||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package disks
|
package disks
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
|
||||||
"net/url"
|
|
||||||
|
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/controller"
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/disks"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
|
||||||
)
|
)
|
||||||
|
|
||||||
func utilityDiskListTypesDetailedCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (TypesDetailedList, error) {
|
func utilityDiskListTypesDetailedCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) ([]interface{}, error) {
|
||||||
listTypesDetailed := TypesDetailedList{}
|
|
||||||
c := m.(*controller.ControllerCfg)
|
c := m.(*controller.ControllerCfg)
|
||||||
urlValues := &url.Values{}
|
req := disks.ListTypesRequest{
|
||||||
urlValues.Add("detailed", "true")
|
Detailed: true,
|
||||||
log.Debugf("utilityDiskListTypesDetailedCheckPresence: load disk list Types Detailed")
|
|
||||||
diskListRaw, err := c.DecortAPICall(ctx, "POST", disksListTypesAPI, urlValues)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
err = json.Unmarshal([]byte(diskListRaw), &listTypesDetailed)
|
log.Debugf("utilityDiskListTypesDetailedCheckPresence: load disk list Types Detailed")
|
||||||
|
listTypesDetailed, err := c.CloudAPI().Disks().ListTypes(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,38 +22,33 @@ limitations under the License.
|
|||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package disks
|
package disks
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
|
||||||
"net/url"
|
|
||||||
|
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/controller"
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/disks"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
|
||||||
)
|
)
|
||||||
|
|
||||||
func utilityDiskListTypesCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (TypesList, error) {
|
func utilityDiskListTypesCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) ([]interface{}, error) {
|
||||||
typesList := TypesList{}
|
|
||||||
c := m.(*controller.ControllerCfg)
|
c := m.(*controller.ControllerCfg)
|
||||||
urlValues := &url.Values{}
|
req := disks.ListTypesRequest{
|
||||||
urlValues.Add("detailed", "false")
|
Detailed: false,
|
||||||
log.Debugf("utilityDiskListTypesCheckPresence: load disk list Types Detailed")
|
|
||||||
diskListRaw, err := c.DecortAPICall(ctx, "POST", disksListTypesAPI, urlValues)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
err = json.Unmarshal([]byte(diskListRaw), &typesList)
|
log.Debugf("utilityDiskListTypesCheckPresence: load disk list Types Detailed")
|
||||||
|
typesList, err := c.CloudAPI().Disks().ListTypes(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,37 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|
||||||
Authors:
|
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
|
||||||
builds seamlessly.
|
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
|
||||||
*/
|
|
||||||
|
|
||||||
package extnet
|
|
||||||
|
|
||||||
const extnetListAPI = "/restmachine/cloudapi/extnet/list"
|
|
||||||
const extnetListComputesAPI = "/restmachine/cloudapi/extnet/listComputes"
|
|
||||||
const extnetGetDefaultAPI = "/restmachine/cloudapi/extnet/getDefault"
|
|
||||||
const extnetGetAPI = "/restmachine/cloudapi/extnet/get"
|
|
||||||
@@ -3,6 +3,7 @@ Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@@ -21,24 +22,23 @@ limitations under the License.
|
|||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package extnet
|
package extnet
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/constants"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/flattens"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func dataSourceExtnetRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func dataSourceExtnetRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
@@ -47,77 +47,12 @@ func dataSourceExtnetRead(ctx context.Context, d *schema.ResourceData, m interfa
|
|||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
id := uuid.New()
|
d.SetId(strconv.FormatUint(e.ID, 10))
|
||||||
d.SetId(id.String())
|
flattenExtnet(d, e)
|
||||||
d.Set("ckey", e.CKey)
|
|
||||||
d.Set("meta", flattens.FlattenMeta(e.Meta))
|
|
||||||
d.Set("check__ips", e.CheckIPs)
|
|
||||||
d.Set("check_ips", e.CheckIps)
|
|
||||||
d.Set("default", e.Default)
|
|
||||||
d.Set("default_qos", flattenExtnetDefaultQos(e.DefaultQos))
|
|
||||||
d.Set("desc", e.Desc)
|
|
||||||
d.Set("dns", e.Dns)
|
|
||||||
d.Set("excluded", e.Excluded)
|
|
||||||
d.Set("free_ips", e.FreeIps)
|
|
||||||
d.Set("gateway", e.Gateway)
|
|
||||||
d.Set("gid", e.GID)
|
|
||||||
d.Set("guid", e.GUID)
|
|
||||||
d.Set("ipcidr", e.IPCidr)
|
|
||||||
d.Set("milestones", e.Milestones)
|
|
||||||
d.Set("net_name", e.Name)
|
|
||||||
d.Set("network", e.Network)
|
|
||||||
d.Set("network_id", e.NetworkId)
|
|
||||||
d.Set("pre_reservations_num", e.PreReservationsNum)
|
|
||||||
d.Set("prefix", e.Prefix)
|
|
||||||
d.Set("pri_vnf_dev_id", e.PriVnfDevId)
|
|
||||||
d.Set("reservations", flattenExtnetReservations(e.Reservations))
|
|
||||||
d.Set("shared_with", e.SharedWith)
|
|
||||||
d.Set("status", e.Status)
|
|
||||||
d.Set("vlan_id", e.VlanID)
|
|
||||||
d.Set("vnfs", flattenExtnetVNFS(e.VNFS))
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func flattenExtnetReservations(ers ExtnetReservations) []map[string]interface{} {
|
|
||||||
res := make([]map[string]interface{}, 0)
|
|
||||||
for _, er := range ers {
|
|
||||||
temp := map[string]interface{}{
|
|
||||||
"client_type": er.ClientType,
|
|
||||||
"domainname": er.DomainName,
|
|
||||||
"hostname": er.HostName,
|
|
||||||
"desc": er.Desc,
|
|
||||||
"ip": er.IP,
|
|
||||||
"mac": er.MAC,
|
|
||||||
"type": er.Type,
|
|
||||||
"vm_id": er.VMID,
|
|
||||||
}
|
|
||||||
res = append(res, temp)
|
|
||||||
}
|
|
||||||
|
|
||||||
return res
|
|
||||||
}
|
|
||||||
|
|
||||||
func flattenExtnetDefaultQos(edqos ExtnetQos) []map[string]interface{} {
|
|
||||||
res := make([]map[string]interface{}, 0)
|
|
||||||
temp := map[string]interface{}{
|
|
||||||
"e_rate": edqos.ERate,
|
|
||||||
"guid": edqos.GUID,
|
|
||||||
"in_burst": edqos.InBurst,
|
|
||||||
"in_rate": edqos.InRate,
|
|
||||||
}
|
|
||||||
res = append(res, temp)
|
|
||||||
return res
|
|
||||||
}
|
|
||||||
|
|
||||||
func flattenExtnetVNFS(evnfs ExtnetVNFS) []map[string]interface{} {
|
|
||||||
res := make([]map[string]interface{}, 0)
|
|
||||||
temp := map[string]interface{}{
|
|
||||||
"dhcp": evnfs.DHCP,
|
|
||||||
}
|
|
||||||
res = append(res, temp)
|
|
||||||
return res
|
|
||||||
}
|
|
||||||
|
|
||||||
func dataSourceExtnetSchemaMake() map[string]*schema.Schema {
|
func dataSourceExtnetSchemaMake() map[string]*schema.Schema {
|
||||||
res := map[string]*schema.Schema{
|
res := map[string]*schema.Schema{
|
||||||
"net_id": {
|
"net_id": {
|
||||||
@@ -163,6 +98,10 @@ func dataSourceExtnetSchemaMake() map[string]*schema.Schema {
|
|||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
},
|
},
|
||||||
|
"e_burst": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
"guid": {
|
"guid": {
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
@@ -192,8 +131,29 @@ func dataSourceExtnetSchemaMake() map[string]*schema.Schema {
|
|||||||
"excluded": {
|
"excluded": {
|
||||||
Type: schema.TypeList,
|
Type: schema.TypeList,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
Elem: &schema.Schema{
|
Elem: &schema.Resource{
|
||||||
Type: schema.TypeString,
|
Schema: map[string]*schema.Schema{
|
||||||
|
"client_type": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"mac": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"ip": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"type": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"vm_id": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"free_ips": {
|
"free_ips": {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@@ -21,12 +22,12 @@ limitations under the License.
|
|||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package extnet
|
package extnet
|
||||||
@@ -37,40 +38,9 @@ import (
|
|||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/constants"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
)
|
)
|
||||||
|
|
||||||
func flattenExtnetsComputes(ecs ExtnetExtendList) []map[string]interface{} {
|
|
||||||
res := make([]map[string]interface{}, 0)
|
|
||||||
for _, ec := range ecs {
|
|
||||||
temp := map[string]interface{}{
|
|
||||||
"net_id": ec.ID,
|
|
||||||
"ipaddr": ec.IPAddr,
|
|
||||||
"ipcidr": ec.IPCidr,
|
|
||||||
"name": ec.Name,
|
|
||||||
}
|
|
||||||
res = append(res, temp)
|
|
||||||
}
|
|
||||||
return res
|
|
||||||
}
|
|
||||||
|
|
||||||
func flattenExtnetComputesList(ecl ExtnetComputesList) []map[string]interface{} {
|
|
||||||
res := make([]map[string]interface{}, 0)
|
|
||||||
for _, ec := range ecl {
|
|
||||||
temp := map[string]interface{}{
|
|
||||||
"account_id": ec.AccountId,
|
|
||||||
"account_name": ec.AccountName,
|
|
||||||
"extnets": flattenExtnetsComputes(ec.Extnets),
|
|
||||||
"id": ec.ID,
|
|
||||||
"name": ec.Name,
|
|
||||||
"rg_id": ec.RGID,
|
|
||||||
"rg_name": ec.RGName,
|
|
||||||
}
|
|
||||||
res = append(res, temp)
|
|
||||||
}
|
|
||||||
return res
|
|
||||||
}
|
|
||||||
|
|
||||||
func dataSourceExtnetComputesListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func dataSourceExtnetComputesListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
extnetComputesList, err := utilityExtnetComputesListCheckPresence(ctx, d, m)
|
extnetComputesList, err := utilityExtnetComputesListCheckPresence(ctx, d, m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@@ -21,12 +22,12 @@ limitations under the License.
|
|||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package extnet
|
package extnet
|
||||||
@@ -38,7 +39,7 @@ import (
|
|||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/constants"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
)
|
)
|
||||||
|
|
||||||
func dataSourceExtnetDefaultRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func dataSourceExtnetDefaultRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@@ -21,12 +22,12 @@ limitations under the License.
|
|||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package extnet
|
package extnet
|
||||||
@@ -37,22 +38,9 @@ import (
|
|||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/constants"
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
)
|
)
|
||||||
|
|
||||||
func flattenExtnetList(el ExtnetList) []map[string]interface{} {
|
|
||||||
res := make([]map[string]interface{}, 0)
|
|
||||||
for _, e := range el {
|
|
||||||
temp := map[string]interface{}{
|
|
||||||
"net_id": e.ID,
|
|
||||||
"ipcidr": e.IPCidr,
|
|
||||||
"name": e.Name,
|
|
||||||
}
|
|
||||||
res = append(res, temp)
|
|
||||||
}
|
|
||||||
return res
|
|
||||||
}
|
|
||||||
|
|
||||||
func dataSourceExtnetListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
func dataSourceExtnetListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
extnetList, err := utilityExtnetListCheckPresence(ctx, d, m)
|
extnetList, err := utilityExtnetListCheckPresence(ctx, d, m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
137
internal/service/cloudapi/extnet/flattens.go
Normal file
137
internal/service/cloudapi/extnet/flattens.go
Normal file
@@ -0,0 +1,137 @@
|
|||||||
|
package extnet
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/extnet"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/flattens"
|
||||||
|
)
|
||||||
|
|
||||||
|
func flattenExtnet(d *schema.ResourceData, e *extnet.RecordExtNet) {
|
||||||
|
d.Set("ckey", e.CKey)
|
||||||
|
d.Set("meta", flattens.FlattenMeta(e.Meta))
|
||||||
|
d.Set("check__ips", e.CheckIPs)
|
||||||
|
d.Set("check_ips", e.CheckIps)
|
||||||
|
d.Set("default", e.Default)
|
||||||
|
d.Set("default_qos", flattenExtnetDefaultQos(e.DefaultQOS))
|
||||||
|
d.Set("desc", e.Description)
|
||||||
|
d.Set("dns", e.DNS)
|
||||||
|
d.Set("excluded", flattenExcluded(e.Excluded))
|
||||||
|
d.Set("free_ips", e.FreeIPs)
|
||||||
|
d.Set("gateway", e.Gateway)
|
||||||
|
d.Set("gid", e.GID)
|
||||||
|
d.Set("guid", e.GUID)
|
||||||
|
d.Set("ipcidr", e.IPCIDR)
|
||||||
|
d.Set("milestones", e.Milestones)
|
||||||
|
d.Set("net_name", e.Name)
|
||||||
|
d.Set("network", e.Network)
|
||||||
|
d.Set("network_id", e.NetworkID)
|
||||||
|
d.Set("pre_reservations_num", e.PreReservationsNum)
|
||||||
|
d.Set("prefix", e.Prefix)
|
||||||
|
d.Set("pri_vnf_dev_id", e.PriVNFDevID)
|
||||||
|
d.Set("reservations", flattenExtnetReservations(e.Reservations))
|
||||||
|
d.Set("shared_with", e.SharedWith)
|
||||||
|
d.Set("status", e.Status)
|
||||||
|
d.Set("vlan_id", e.VLANID)
|
||||||
|
d.Set("vnfs", flattenExtnetVNFS(e.VNFs))
|
||||||
|
}
|
||||||
|
|
||||||
|
func flattenExcluded(ex []extnet.Excluded) []map[string]interface{} {
|
||||||
|
res := make([]map[string]interface{}, 0)
|
||||||
|
for _, item := range ex {
|
||||||
|
temp := map[string]interface{}{
|
||||||
|
"client_type": item.ClientType,
|
||||||
|
"mac": item.MAC,
|
||||||
|
"ip": item.IP,
|
||||||
|
"type": item.Type,
|
||||||
|
"vm_id": item.VMID,
|
||||||
|
}
|
||||||
|
res = append(res, temp)
|
||||||
|
}
|
||||||
|
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
func flattenExtnetReservations(ers extnet.ListReservations) []map[string]interface{} {
|
||||||
|
res := make([]map[string]interface{}, 0)
|
||||||
|
for _, er := range ers {
|
||||||
|
temp := map[string]interface{}{
|
||||||
|
"client_type": er.ClientType,
|
||||||
|
"domainname": er.DomainName,
|
||||||
|
"hostname": er.Hostname,
|
||||||
|
"desc": er.Description,
|
||||||
|
"ip": er.IP,
|
||||||
|
"mac": er.MAC,
|
||||||
|
"type": er.Type,
|
||||||
|
"vm_id": er.VMID,
|
||||||
|
}
|
||||||
|
res = append(res, temp)
|
||||||
|
}
|
||||||
|
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
func flattenExtnetDefaultQos(edqos extnet.QOS) []map[string]interface{} {
|
||||||
|
res := make([]map[string]interface{}, 0)
|
||||||
|
temp := map[string]interface{}{
|
||||||
|
"e_rate": edqos.ERate,
|
||||||
|
"e_burst": edqos.EBurst,
|
||||||
|
"guid": edqos.GUID,
|
||||||
|
"in_burst": edqos.InBurst,
|
||||||
|
"in_rate": edqos.InRate,
|
||||||
|
}
|
||||||
|
res = append(res, temp)
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
func flattenExtnetVNFS(evnfs extnet.VNFs) []map[string]interface{} {
|
||||||
|
res := make([]map[string]interface{}, 0)
|
||||||
|
temp := map[string]interface{}{
|
||||||
|
"dhcp": evnfs.DHCP,
|
||||||
|
}
|
||||||
|
res = append(res, temp)
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
func flattenExtnetsComputes(ecs extnet.ListExtNetExtends) []map[string]interface{} {
|
||||||
|
res := make([]map[string]interface{}, 0)
|
||||||
|
for _, ec := range ecs {
|
||||||
|
temp := map[string]interface{}{
|
||||||
|
"net_id": ec.ID,
|
||||||
|
"ipaddr": ec.IPAddr,
|
||||||
|
"ipcidr": ec.IPCIDR,
|
||||||
|
"name": ec.Name,
|
||||||
|
}
|
||||||
|
res = append(res, temp)
|
||||||
|
}
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
func flattenExtnetComputesList(ecl extnet.ListExtNetComputes) []map[string]interface{} {
|
||||||
|
res := make([]map[string]interface{}, 0)
|
||||||
|
for _, ec := range ecl {
|
||||||
|
temp := map[string]interface{}{
|
||||||
|
"account_id": ec.AccountID,
|
||||||
|
"account_name": ec.AccountName,
|
||||||
|
"extnets": flattenExtnetsComputes(ec.ExtNets),
|
||||||
|
"id": ec.ID,
|
||||||
|
"name": ec.Name,
|
||||||
|
"rg_id": ec.RGID,
|
||||||
|
"rg_name": ec.RGName,
|
||||||
|
}
|
||||||
|
res = append(res, temp)
|
||||||
|
}
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
func flattenExtnetList(el extnet.ListExtNets) []map[string]interface{} {
|
||||||
|
res := make([]map[string]interface{}, 0)
|
||||||
|
for _, e := range el {
|
||||||
|
temp := map[string]interface{}{
|
||||||
|
"net_id": e.ID,
|
||||||
|
"ipcidr": e.IPCIDR,
|
||||||
|
"name": e.Name,
|
||||||
|
}
|
||||||
|
res = append(res, temp)
|
||||||
|
}
|
||||||
|
return res
|
||||||
|
}
|
||||||
@@ -1,111 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|
||||||
Authors:
|
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
|
||||||
builds seamlessly.
|
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
|
||||||
*/
|
|
||||||
|
|
||||||
package extnet
|
|
||||||
|
|
||||||
type Extnet struct {
|
|
||||||
ID int `json:"id"`
|
|
||||||
IPCidr string `json:"ipcidr"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
}
|
|
||||||
type ExtnetExtend struct {
|
|
||||||
Extnet
|
|
||||||
IPAddr string `json:"ipaddr"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type ExtnetList []Extnet
|
|
||||||
type ExtnetExtendList []ExtnetExtend
|
|
||||||
|
|
||||||
type ExtnetComputes struct {
|
|
||||||
AccountId int `json:"accountId"`
|
|
||||||
AccountName string `json:"accountName"`
|
|
||||||
Extnets ExtnetExtendList `json:"extnets"`
|
|
||||||
ID int `json:"id"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
RGID int `json:"rgId"`
|
|
||||||
RGName string `json:"rgName"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type ExtnetComputesList []ExtnetComputes
|
|
||||||
|
|
||||||
type ExtnetQos struct {
|
|
||||||
ERate int `json:"eRate"`
|
|
||||||
GUID string `json:"guid"`
|
|
||||||
InBurst int `json:"inBurst"`
|
|
||||||
InRate int `json:"inRate"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type ExtnetReservation struct {
|
|
||||||
ClientType string `json:"clientType"`
|
|
||||||
Desc string `json:"desc"`
|
|
||||||
DomainName string `json:"domainname"`
|
|
||||||
HostName string `json:"hostname"`
|
|
||||||
IP string `json:"ip"`
|
|
||||||
MAC string `json:"mac"`
|
|
||||||
Type string `json:"type"`
|
|
||||||
VMID int `json:"vmId"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type ExtnetReservations []ExtnetReservation
|
|
||||||
|
|
||||||
type ExtnetVNFS struct {
|
|
||||||
DHCP int `json:"dhcp"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type ExtnetDetailed struct {
|
|
||||||
CKey string `json:"_ckey"`
|
|
||||||
Meta []interface{} `json:"_meta"`
|
|
||||||
CheckIPs []string `json:"checkIPs"`
|
|
||||||
CheckIps []string `json:"checkIps"`
|
|
||||||
Default bool `json:"default"`
|
|
||||||
DefaultQos ExtnetQos `json:"defaultQos"`
|
|
||||||
Desc string `json:"desc"`
|
|
||||||
Dns []string `json:"dns"`
|
|
||||||
Excluded []string `json:"excluded"`
|
|
||||||
FreeIps int `json:"free_ips"`
|
|
||||||
Gateway string `json:"gateway"`
|
|
||||||
GID int `json:"gid"`
|
|
||||||
GUID int `json:"guid"`
|
|
||||||
ID int `json:"id"`
|
|
||||||
IPCidr string `json:"ipcidr"`
|
|
||||||
Milestones int `json:"milestones"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
Network string `json:"network"`
|
|
||||||
NetworkId int `json:"networkId"`
|
|
||||||
PreReservationsNum int `json:"preReservationsNum"`
|
|
||||||
Prefix int `json:"prefix"`
|
|
||||||
PriVnfDevId int `json:"priVnfDevId"`
|
|
||||||
Reservations ExtnetReservations `json:"reservations"`
|
|
||||||
SharedWith []int `json:"sharedWith"`
|
|
||||||
Status string `json:"status"`
|
|
||||||
VlanID int `json:"vlanId"`
|
|
||||||
VNFS ExtnetVNFS `json:"vnfs"`
|
|
||||||
}
|
|
||||||
@@ -3,6 +3,7 @@ Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@@ -21,42 +22,34 @@ limitations under the License.
|
|||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package extnet
|
package extnet
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
|
||||||
"net/url"
|
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/controller"
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/extnet"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
|
||||||
|
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
)
|
)
|
||||||
|
|
||||||
func utilityExtnetCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (*ExtnetDetailed, error) {
|
func utilityExtnetCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (*extnet.RecordExtNet, error) {
|
||||||
extnet := &ExtnetDetailed{}
|
|
||||||
c := m.(*controller.ControllerCfg)
|
c := m.(*controller.ControllerCfg)
|
||||||
urlValues := &url.Values{}
|
req := extnet.GetRequest{
|
||||||
|
NetID: uint64(d.Get("net_id").(int)),
|
||||||
urlValues.Add("net_id", strconv.Itoa(d.Get("net_id").(int)))
|
|
||||||
|
|
||||||
log.Debugf("utilityExtnetCheckPresence")
|
|
||||||
extnetRaw, err := c.DecortAPICall(ctx, "POST", extnetGetAPI, urlValues)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
err = json.Unmarshal([]byte(extnetRaw), &extnet)
|
log.Debugf("utilityExtnetCheckPresence")
|
||||||
|
extnet, err := c.CloudAPI().ExtNet().Get(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@@ -21,42 +22,34 @@ limitations under the License.
|
|||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package extnet
|
package extnet
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
|
||||||
"net/url"
|
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/controller"
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/extnet"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
|
||||||
|
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
)
|
)
|
||||||
|
|
||||||
func utilityExtnetComputesListCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (ExtnetComputesList, error) {
|
func utilityExtnetComputesListCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (extnet.ListExtNetComputes, error) {
|
||||||
extnetComputesList := ExtnetComputesList{}
|
|
||||||
c := m.(*controller.ControllerCfg)
|
c := m.(*controller.ControllerCfg)
|
||||||
urlValues := &url.Values{}
|
req := extnet.ListComputesRequest{
|
||||||
|
AccountID: uint64(d.Get("account_id").(int)),
|
||||||
urlValues.Add("accountId", strconv.Itoa(d.Get("account_id").(int)))
|
|
||||||
|
|
||||||
log.Debugf("utilityExtnetComputesListCheckPresence")
|
|
||||||
extnetComputesListRaw, err := c.DecortAPICall(ctx, "POST", extnetListComputesAPI, urlValues)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
err = json.Unmarshal([]byte(extnetComputesListRaw), &extnetComputesList)
|
log.Debugf("utilityExtnetComputesListCheckPresence")
|
||||||
|
extnetComputesList, err := c.CloudAPI().ExtNet().ListComputes(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@@ -21,33 +22,32 @@ limitations under the License.
|
|||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package extnet
|
package extnet
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"net/url"
|
"strconv"
|
||||||
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/controller"
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
|
||||||
)
|
)
|
||||||
|
|
||||||
func utilityExtnetDefaultCheckPresence(ctx context.Context, m interface{}) (string, error) {
|
func utilityExtnetDefaultCheckPresence(ctx context.Context, m interface{}) (string, error) {
|
||||||
c := m.(*controller.ControllerCfg)
|
c := m.(*controller.ControllerCfg)
|
||||||
urlValues := &url.Values{}
|
|
||||||
|
|
||||||
log.Debugf("utilityExtnetDefaultCheckPresence")
|
log.Debugf("utilityExtnetDefaultCheckPresence")
|
||||||
res, err := c.DecortAPICall(ctx, "POST", extnetGetDefaultAPI, urlValues)
|
res, err := c.CloudAPI().ExtNet().GetDefault(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
return res, nil
|
return strconv.FormatUint(res, 10), nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|||||||
Authors:
|
Authors:
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@@ -21,50 +22,42 @@ limitations under the License.
|
|||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
Source code: https://github.com/rudecs/terraform-provider-decort
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
Please see README.md to learn where to place source code so that it
|
||||||
builds seamlessly.
|
builds seamlessly.
|
||||||
|
|
||||||
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package extnet
|
package extnet
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
|
||||||
"net/url"
|
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"github.com/rudecs/terraform-provider-decort/internal/controller"
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/extnet"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
|
||||||
|
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
)
|
)
|
||||||
|
|
||||||
func utilityExtnetListCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (ExtnetList, error) {
|
func utilityExtnetListCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (extnet.ListExtNets, error) {
|
||||||
extnetList := ExtnetList{}
|
|
||||||
c := m.(*controller.ControllerCfg)
|
c := m.(*controller.ControllerCfg)
|
||||||
urlValues := &url.Values{}
|
req := extnet.ListRequest{}
|
||||||
|
|
||||||
if accountId, ok := d.GetOk("account_id"); ok {
|
if accountId, ok := d.GetOk("account_id"); ok {
|
||||||
urlValues.Add("accountId", strconv.Itoa(accountId.(int)))
|
req.AccountID = uint64(accountId.(int))
|
||||||
}
|
}
|
||||||
if page, ok := d.GetOk("page"); ok {
|
if page, ok := d.GetOk("page"); ok {
|
||||||
urlValues.Add("page", strconv.Itoa(page.(int)))
|
req.Page = uint64(page.(int))
|
||||||
}
|
}
|
||||||
if size, ok := d.GetOk("size"); ok {
|
if size, ok := d.GetOk("size"); ok {
|
||||||
urlValues.Add("size", strconv.Itoa(size.(int)))
|
req.Size = uint64(size.(int))
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Debugf("utilityExtnetListCheckPresence")
|
log.Debugf("utilityExtnetListCheckPresence")
|
||||||
extnetListRaw, err := c.DecortAPICall(ctx, "POST", extnetListAPI, urlValues)
|
extnetList, err := c.CloudAPI().ExtNet().List(ctx, req)
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
err = json.Unmarshal([]byte(extnetListRaw), &extnetList)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
191
internal/service/cloudapi/flipgroup/data_source_flipgroup.go
Normal file
191
internal/service/cloudapi/flipgroup/data_source_flipgroup.go
Normal file
@@ -0,0 +1,191 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||||
|
Authors:
|
||||||
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
Tim Tkachev, <tvtkachev@basistech.ru>
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
|
Please see README.md to learn where to place source code so that it
|
||||||
|
builds seamlessly.
|
||||||
|
|
||||||
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
|
*/
|
||||||
|
|
||||||
|
package flipgroup
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
|
)
|
||||||
|
|
||||||
|
func dataSourceFlipgroupRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
|
fg, err := utilityFlipgroupCheckPresence(ctx, d, m)
|
||||||
|
if err != nil {
|
||||||
|
d.SetId("")
|
||||||
|
return diag.FromErr(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
flattenFlipgroup(d, fg)
|
||||||
|
d.SetId(fmt.Sprint(fg.ID))
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func dataSourceFlipgroupSchemaMake() map[string]*schema.Schema {
|
||||||
|
return map[string]*schema.Schema{
|
||||||
|
"flipgroup_id": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Required: true,
|
||||||
|
Description: "Flipgroupd ID",
|
||||||
|
},
|
||||||
|
"account_id": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"account_name": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"client_ids": {
|
||||||
|
Type: schema.TypeList,
|
||||||
|
Computed: true,
|
||||||
|
Elem: &schema.Schema{
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"client_names": {
|
||||||
|
Type: schema.TypeList,
|
||||||
|
Computed: true,
|
||||||
|
Elem: &schema.Schema{
|
||||||
|
Type: schema.TypeString,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"client_type": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"conn_id": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"conn_type": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"created_by": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"created_time": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"default_gw": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"deleted_by": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"deleted_time": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"desc": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"gid": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"guid": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"ip": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"milestones": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"net_id": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"net_type": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"network": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"rg_id": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"rg_name": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"status": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"updated_by": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"updated_time": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func DataSourceFlipgroup() *schema.Resource {
|
||||||
|
return &schema.Resource{
|
||||||
|
SchemaVersion: 1,
|
||||||
|
|
||||||
|
ReadContext: dataSourceFlipgroupRead,
|
||||||
|
|
||||||
|
Timeouts: &schema.ResourceTimeout{
|
||||||
|
Read: &constants.Timeout180s,
|
||||||
|
Default: &constants.Timeout180s,
|
||||||
|
},
|
||||||
|
|
||||||
|
Schema: dataSourceFlipgroupSchemaMake(),
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,210 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||||
|
Authors:
|
||||||
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
Tim Tkachev, <tvtkachev@basistech.ru>
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||||
|
|
||||||
|
Please see README.md to learn where to place source code so that it
|
||||||
|
builds seamlessly.
|
||||||
|
|
||||||
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
|
*/
|
||||||
|
|
||||||
|
package flipgroup
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/google/uuid"
|
||||||
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||||
|
)
|
||||||
|
|
||||||
|
func dataSourceFlipgroupList(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
|
fg_list, err := utilityFlipgroupListCheckPresence(ctx, d, m)
|
||||||
|
if err != nil {
|
||||||
|
d.SetId("")
|
||||||
|
return diag.FromErr(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
id := uuid.New()
|
||||||
|
d.SetId(id.String())
|
||||||
|
|
||||||
|
d.Set("items", flattenFlipgroupList(fg_list))
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func dataSourceFlipgroupListSchemaMake() map[string]*schema.Schema {
|
||||||
|
return map[string]*schema.Schema{
|
||||||
|
"page": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Optional: true,
|
||||||
|
Description: "Page number",
|
||||||
|
},
|
||||||
|
"size": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Optional: true,
|
||||||
|
Description: "Page size",
|
||||||
|
},
|
||||||
|
"items": {
|
||||||
|
Type: schema.TypeList,
|
||||||
|
Computed: true,
|
||||||
|
Elem: &schema.Resource{
|
||||||
|
Schema: map[string]*schema.Schema{
|
||||||
|
"flipgroup_id": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"account_id": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"account_name": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"client_ids": {
|
||||||
|
Type: schema.TypeList,
|
||||||
|
Computed: true,
|
||||||
|
Elem: &schema.Schema{
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"client_names": {
|
||||||
|
Type: schema.TypeList,
|
||||||
|
Computed: true,
|
||||||
|
Elem: &schema.Schema{
|
||||||
|
Type: schema.TypeString,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"client_type": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"conn_id": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"conn_type": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"created_by": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"created_time": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"default_gw": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"deleted_by": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"deleted_time": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"desc": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"gid": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"guid": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"milestones": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"net_id": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"net_type": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"ip": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"network": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"rg_id": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"rg_name": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"status": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"updated_by": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"updated_time": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func DataSourceFlipGroupList() *schema.Resource {
|
||||||
|
return &schema.Resource{
|
||||||
|
SchemaVersion: 1,
|
||||||
|
|
||||||
|
ReadContext: dataSourceFlipgroupList,
|
||||||
|
|
||||||
|
Timeouts: &schema.ResourceTimeout{
|
||||||
|
Read: &constants.Timeout180s,
|
||||||
|
Default: &constants.Timeout180s,
|
||||||
|
},
|
||||||
|
|
||||||
|
Schema: dataSourceFlipgroupListSchemaMake(),
|
||||||
|
}
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user