This commit is contained in:
dayterr
2026-02-27 17:24:15 +03:00
parent b8283ebfaf
commit 156b0a2d0c
37 changed files with 1664 additions and 1835 deletions

View File

@@ -1,210 +1,38 @@
## Version 4.11.0 ## Version 4.11.1
### Добавлено ### Добавлено
#### audit
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BATF-1163 | Вычисляемые поля `resgroup_id`, `account_id`, `compute_id` в datasource `decort_cb_audit` в cloudbroker/audit |
#### bservice
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BATF-1137 | Для поля `chipset` изменено значение по умолчанию с `i440fx` на `Q35` в resource `decort_bservice_group` в cloudapi/bservice|
#### disks #### disks
| Идентификатор<br>задачи | Описание | | Идентификатор<br>задачи | Описание |
| --- | --- | | --- | --- |
| BATF-1186 | Опциональное поле `cache` в resources `decort_disk` в cloudapi/disks и в `decort_cb_disk` в cloudbroker/disks | | BATF-1216 | Вычисляемое поле `blk_discard` в resource `resource_disk` в cloudapi/disks |
| BATF-1186 | Вычисляемое поле `cache` в datasources `decort_disk`, `decort_disk_list`, `decort_disk_list_deleted`,`decort_disk_list_unattached` в cloudapi/disks и `decort_cb_disk`, `decort_cb_disk_list`, `decort_cb_disk_list_deleted`, `decort_cb_disk_list_unattached` в cloudbroker/disks |
| BATF-1201 | Опциональное поле `blk_discard` в resource `decort_cb_disk` в cloudbroker/disks |
| BATF-1201 | Вычисляемое поле `blk_discard` в datasources `decort_disk`, `decort_disk_list`, `decort_disk_list_deleted` и `decort_disk_list_unattached` в cloudapi/disks и `decort_cb_disk`, `decort_cb_disk_list`, `decort_cb_disk_list_deleted` и `decort_cb_disk_list_unattached` в cloudbroker/disks |
#### k8s
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BATF-1137 | Для поля `chipset` добавлено значение по умолчанию `Q35` и валидация возможных значений (`i440fx`, `Q35`) в resources `decort_k8s`, `decort_k8s_wg` в cloudapi/k8s и `decort_cb_k8s_cp`, `decort_cb_k8s_wg` в cloudbroker/k8s|
#### kvmvm #### kvmvm
| Идентификатор<br>задачи | Описание | | Идентификатор<br>задачи | Описание |
| --- | --- | | --- | --- |
| BATF-1099 | Возможность миграции диска в другой `SEP` в `decort_cb_kvmvm` в cloudbroker/kvmvm | | BATF-1216 | Вычисляемое поле `blk_discard` в resource `resource_kvmvm` в cloudapi/kvmvm |
| BATF-1137 | Для поля `chipset` добавлено значение по умолчанию `Q35` в resource `decort_cb_kvmvm` в cloudbroker/kvmvm |
| BATF-1139 | Опциональное поле `read_only` в resource `decort_cb_kvmvm` в cloudbroker/kvmvm |
| BATF-1139 | Вычисляемое поле `read_only` в datasources `decort_cb_kvmvm`, `decort_cb_kvmvm_list` в cloudbroker/kvmvm и в datasources `decort_kvmvm` и `decort_kvmvm_list` в cloudapi/kvmvm |
| BATF-1161 | Вычисляемое поле `sep_id` в блоке `disks` в datasources `decort_cb_kvmvm_list` в cloudbroker/kvmvm и `decort_kvmvm_list` в cloudapi/kvmvm |
| BATF-1187 | Опциональное поле `boot_disk_cache` в resources `decort_cb_kvmvm` в cloudbroker/kvmvm |
| BATF-1187 | Вычисляемое поле `cache` в структуру `disks` в datasources `decort_cb_kvmvm` в cloudbroker/kvmvm и `decort_kvmvm` в cloudapi/kvmvm и в resource `decort_kvmvm` в cloudapi/kvmvm |
| BATF-1187 | Опциональное поле `cache` в структуру `disks` в resources `decort_cb_kvmvm` в cloudbroker/kvmvm |
| BATF-1160 | Опциональное поле `net_mask` в структуру `network` в resources `decort_kvmvm` в cloudapi/kvmvm и `decort_cb_kvmvm` в cloudbroker/kvmvm |
| BATF-1202 | Опциональные поля `boot_disk_blk_discard` и `blk_discard` в resource `decort_cb_kvmvm` в cloudbroker/kvmvm |
| BATF-1202 | Вычисляемое поле `blk_discard` в datasources `decort_kvmvm` в cloudapi/kvmvm и в `decort_cb_kvmvm` в cloudbroker/kvmvm |
| BATF-1202 | Вычисляемое поле `blk_discard` в resource `decort_kvmvm` в cloudapi/kvmvm |
#### node
### Исправлено
#### disks
| Идентификатор<br>задачи | Описание | | Идентификатор<br>задачи | Описание |
| --- | --- | | --- | --- |
| BATF-1135 | Вычисляемые поля `openvswitch_bridges`, `description`, `sdn_hypervisor_name` в datasource `decort_cb_node` в `cloudbroker/node` | | BATF-1186 | Тип поля `cache` с опционального на вычисляемый в resources `decort_disk` в cloudapi/disks |
| BATF-1135 | Вычисляемые поля `flags`, `model_name` в структуру `cpu_info` в datasource `decort_cb_node` в `cloudbroker/node` |
| BATF-1135 | Вычисляемые поля `openvswitch_bridges`, `api_url`, `drivers`, `old_compat_lvm_id`, `cpu_allocation_ratio`, `mem_allocation_ratio`, `packages` в datasource `decort_cb_node_list` в `cloudbroker/node` |
| BATF-1135 | Вычисляемые поля `flags`, `model_name` в структуру `cpu_info` в datasource `decort_cb_node_list` в `cloudbroker/node` |
| BATF-1153 | Вычисляемое поле `usable_cpus` в datasource `decort_cb_node` и в `decort_cb_node_list` в `cloudbroker/node` |
| BATF-1193 | Вычисляемые поле `auto_start, auto_start_count` в datasource `decort_cb_node` и в `decort_cb_node_list` в `cloudbroker/node` |
| BATF-1197 | Вычисляемое поле `mem_allocation_ratio` в datasource `decort_cb_node` в `cloudbroker/node` |
#### sep #### kvmvm
| Идентификатор<br>задачи | Описание | | Идентификатор<br>задачи | Описание |
| --- | --- | | --- | --- |
| BATF-1161 | Опциональное поле `sep_ids` в datasource `decort_cb_sep_list` и в cloudbroker/sep | | BATF-1220 | Ошибки применения новой конфигурации после импортирования в resource `decort_kvmvm` в cloudapi/kvmvm и в resource `decort_cb_kvmvm` в cloudbroker/kvmvm |
#### storage policy #### rg
| Идентификатор<br>задачи | Описание | | Идентификатор<br>задачи | Описание |
| --- | --- | | --- | --- |
| BATF-1164 | Опциональное поле `sep_tech_status` в datasource `decort_storage_policy_list` в `cloudapi/stpolicy` и в datasource `decort_cb_storage_policy_list` в `cloudbroker/stpolicy` | | BATF-1214 | Оптимизировано создание ресурных групп с указанными полем `def_net_type` в `decort_resgroup` в cloudapi/rg и в `decort_cb_rg` в cloudbroker/rg|
| BATF-1152 | Вычисляемое поле `sep_tech_status` в datasource `decort_storage_policy_list` в `cloudapi/stpolicy` и в datasource `decort_cb_storage_policy_list` в `cloudbroker/stpolicy` | | BATF-1219 | Отображение полей `updated_by` и `updated_time` в datasource `decort_rg_list_computes` в cloudapi/rg |
#### user
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BATF-1154 | Опциональное поле `sort_by` в datasource `decort_cb_user_get_audit` в `cloudbroker/user` |
#### trunk
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BATF-1162 | Опциональное поле `mtu` в resource `decort_cb_trunk` в `cloudbroker/trunk` |
| BATF-1162 | Вычисляемое поле `mtu` в datasources `decort_cb_trunk` и `decort_cb_trunk_list` в `cloudbroker/trunk` и в datasources `decort_trunk` и `decort_trunk_list` в `cloudapi/trunk` |
#### zone #### zone
| Идентификатор<br>задачи | Описание | | Идентификатор<br>задачи | Описание |
| --- | --- | | --- | --- |
| BATF-1192 | Опциональное поле `auto_start` в resource `decort_cb_zone` в `cloudbroker/zone` | | BATF-1192 | Ошибка отображения в datasource `decort_zone` в cloudapi/zone |
| BATF-1192 | Вычисляемое поле `auto_start` в datasources `decort_zone`, `decort_zone_list` в `cloudapi/zone` и в `decort_cb_zone_list`, `decort_cb_zone` в `cloudbroker/zone` |
### Исправлено
#### account
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BATF-1061 | Вывод значения поле `storage_policy_ids` в data_sourse`decort_cb_account` в cloudbroker/account |
#### bservice
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BATF-1134 | Вычисляемое поле `stack_id` заменено на `node_id` в data_source и resource `decort_bservice` в cloudapi/bservice |
| BATF-1194 | Тип поля `driver` с опционального на вычисляемый в `decort_bservice_group` в `cloudbroker/bservice` |
#### disks
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BATF-1205 | Ошибка построения и применения плана при использовании состояния, созданного в предыдущих версиях провайдера в resources `decort_disk` в cloudapi/disks и в `decort_cb_disk` cloudbroker/disks |
#### image
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BATF-1205 | Ошибка построения и применения плана при использовании состояния, созданного в предыдущих версиях провайдера в resources `decort_image_from_blank_compute`, `decort_image_from_platform_disk`, `decort_virtual_image` в cloudapi/image и в `decort_cb_cdrom_image`, `decort_cb_image`, `decort_cb_image_from_blank_compute`, `decort_cb_image_from_platform_disk`, `decort_cb_virtual_image` в cloudbroker/image |
#### kvmvm
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BATF-1134 | Опциональные поля `stack_id`, `pin_to_stack` заменены на `node_id`, `pin_to_node` в resources `decort_kvmvm` в cloudapi/kvmvm и `decort_cb_kvmvm` в cloudbroker/kvmvm |
| BATF-1134 | Опциональные поля `stack_id`, `stack_name` заменены на `node_id`, `node_name` в data_source `decort_cb_kvmvm_list` в cloudbroker/kvmvm |
| BATF-1134 | Вычисляемое поле `stack_id` заменено на `node_id` в data_source `decort_kvmvm_pci_device_list` в cloudapi/kvmvm |
| BATF-1134 | Вычисляемые поля `stack_id`, `stack_name` заменены на `node_id`, `node_name` в data_source `decort_cb_kvmvm`, `decort_cb_kvmvm_list`, `decort_cb_kvmvm_list_deleted` в cloudbroker/kvmvm |
| BATF-1079 | Отображение поля `disks` в resource `decort_kvmvm` в cloudapi/kvmvm и в resource `decort_cb_kvmvm` в cloudbroker/kvmvm при импорте |
| BATF-1083 | Отображение поля `boot_disk` в resource `decort_kvmvm` в cloudapi/kvmvm при обновлении поля `image_id` |
| BATF-1092 | Отображение вычисляемых полей `devicename`,`created_by`, `deleted_by`, `updated_time` в блоке `disks` и блока `loader_meta_iso` в resource `decort_kvmvm`, datasource `decort_kvmvm` в cloudapi/kvmvm и в resource `decort_cb_kvmvm`, datasource `decort_cb_kvmvm` в cloudbroker/kvmvm |
| BATF-1142 | Остановка виртуальной машины перед удалением в resources `decort_kvmvm` и `decort_cb_kvmvm` в cloudapi/kvmvm и в cloudbroker/kvmvm |
| BATF-1165 | Тип поля `value` с опционального на обязательный в resource `decort_kvmvm` в cloudapi/kvmvm и в resource `decort_cb_kvmvm` в cloudbroker/kvmvm |
| BATF-1190 | Ошибка при старте на некорректной ноде при указании поля `node_id` в resource `decort_cb_kvmvm` в cloudbroker/kvmvm |
#### lb
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BATF-1188 | Тип поля `start` с обязательного на опциональный в `decort_lb` в `cloudapi/lb` и в `decort_cb_lb` в `cloudbroker/lb` |
#### node
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BATF-1166 | Отображение datasource `decort_cb_node_list` в `cloudbroker/node` |
| BATF-1197 | Тип поля `cpu_allocation_ratio` с int на float в `decort_cb_node` в `cloudbroker/node` |
#### pcidevice
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BATF-1134 | Обязательное поле `stack_id` заменено на `node_id` в resource `decort_cb_pcidevice` в cloudbroker/pcidevice |
| BATF-1134 | Вычисляемое поле `stack_id` заменено на `node_id` в datasoruces `decort_cb_pcidevice` и `decort_cb_pcidevice_list` в cloudbroker/pcidevice |
#### rg
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BATF-1062 | Отображение datasourses `decort_rg_list_deleted` в cloudapi/rg и `decort_cb_rg_list_deleted` в cloudbroker/rg |
#### sep
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BATF-1171 | Добавлен валидатор для поля `type` в resource `decort_cb_sep` в cloudbroker/sep |
| BATF-1171 | Заменено значение `ovs` на `ustor` в валидаторе поля `sep_type` в datasource `decort_cb_sep_template` в cloudbroker/sep |
#### user
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BATF-1158 | Тип поля `emailaddress` с []string на string в `decort_cb_user` в `cloudbroker/user` |
#### vins
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BATF-1134 | Вычисляемые поля `stack_id` заменены на `node_id` в datasource `decort_vins` в cloudapi/vins и datasource и resource `decort_cb_vins` в cloudbroker/vins |
### Удалено
#### account
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BATF-1136 | Поле `cu_np` во всех resources и datasources |
| BATF-1146 | Поля `exttraffic` и `ext_traffic` во всех resources и datasources |
#### disks
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BATF-1207 | Вычисляемое поле `ckey` из datasource `decort_disk_list_unattached` в cloudapi/disks и `decort_cb_disk_list_unattached` в cloudbroker/disks |
#### flipgroup
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BATF-1195 | Опциональное поле `rg_id` из datasource `decort_flipgroup_list` в cloudapi/flipgroup и `decort_cb_flipgroup_list` в cloudbroker/flipgroup |
| BATF-1195 | Вычисляемые поля `rg_id` и `rg_name` из datasources `decort_flipgroup` и `decort_flipgroup_list` в cloudapi/flipgroup и `decort_cb_flipgroup` и `decort_cb_flipgroup_list` в cloudbroker/flipgroup |
| BATF-1195 | Вычисляемые поля `rg_id` и `rg_name` из resource `decort_flipgroup` в cloudapi/flipgroup и `decort_cb_flipgroup` в cloudbroker/flipgroup |
#### grid
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BATF-1146 | Поля `exttraffic` и `ext_traffic` во всех datasources |
#### image
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BATF-1134 | Datasource `decort_cb_image_List_stacks` в cloudbroker/image |
| BATF-1206 | Вычисляемое поле `ckey` в resource `decort_image` и datasource `decort_image` в cloudapi/image и resources `decort_cb_cdrom_image` и `decort_cb_virtual_image` в cloudbroker/image |
#### node
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BATF-1134 | Вычисляемое поля `stack_id` в datasources `decort_cb_node` и `decort_cb_node_list` в cloudbroker/node |
#### pcidevice
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BATF-1134 | Вычисляемые поля `ckey`, `meta` в datasources `decort_cb_pcidevice` и `decort_cb_pcidevice_list` в cloudbroker/pcidevice |
#### stack
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BATF-1134 | Datasources `decort_stack` и `decort_stack_list` в cloudapi/stack и datasources `decort_cb_stack`, `decort_cb_stack_list` в cloudbroker/stack |
#### rg
| Идентификатор<br>задачи | Описание |
| --- | --- |
| BATF-1138 | Опциональное поле `ext_traffic` в resource `decort_resgroup` в cloudbroker/rg |
| BATF-1138 | Поле `cu_np` в resources `decort_resgroup` в cloudapi/rg и в `decort_cb_rg` в cloudbroker/rg |
| BATF-1146 | Поля `exttraffic`, `ext_traffic` и `cu_np` во всех resources и datasources |

View File

@@ -7,7 +7,7 @@ ZIPDIR = ./zip
BINARY=${NAME} BINARY=${NAME}
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=4.11.0 VERSION=4.11.1
OS_ARCH=$(shell go env GOHOSTOS)_$(shell go env GOHOSTARCH) OS_ARCH=$(shell go env GOHOSTOS)_$(shell go env GOHOSTARCH)
FILES = ${BINARY}_${VERSION}_darwin_amd64\ FILES = ${BINARY}_${VERSION}_darwin_amd64\

View File

@@ -17,7 +17,6 @@ description: |-
### Required ### Required
- `auto_start` (Boolean)
- `zone_id` (Number) - `zone_id` (Number)
### Optional ### Optional
@@ -27,6 +26,7 @@ description: |-
### Read-Only ### Read-Only
- `account_ids` (List of Number) - `account_ids` (List of Number)
- `auto_start` (Boolean)
- `bservice_ids` (List of Number) - `bservice_ids` (List of Number)
- `compute_ids` (List of Number) - `compute_ids` (List of Number)
- `created_time` (Number) - `created_time` (Number)

View File

@@ -17,7 +17,6 @@ description: |-
### Required ### Required
- `authenticator` (String) Authentication mode to use when connecting to DECORT cloud API. Should be one of 'decs3o', 'legacy', 'jwt' or 'bvs'. - `authenticator` (String) Authentication mode to use when connecting to DECORT cloud API. Should be one of 'decs3o', 'legacy', 'jwt' or 'bvs'.
- `controller_url` (String) URL of DECORT Cloud controller to use. API calls will be directed to this URL.
### Optional ### Optional
@@ -26,6 +25,7 @@ description: |-
- `app_secret` (String) Application secret to access DECORT cloud API in 'decs3o' and 'bvs' authentication mode. - `app_secret` (String) Application secret to access DECORT cloud API in 'decs3o' and 'bvs' authentication mode.
- `bvs_password` (String) User password for DECORT cloud API operations in 'bvs' authentication mode. - `bvs_password` (String) User password for DECORT cloud API operations in 'bvs' authentication mode.
- `bvs_user` (String) User name for DECORT cloud API operations in 'bvs' authentication mode. - `bvs_user` (String) User name for DECORT cloud API operations in 'bvs' authentication mode.
- `controller_url` (String) URL of DECORT Cloud controller to use. API calls will be directed to this URL.
- `domain` (String) User password for DECORT cloud API operations in 'bvs' authentication mode. - `domain` (String) User password for DECORT cloud API operations in 'bvs' authentication mode.
- `jwt` (String) JWT to access DECORT cloud API in 'jwt' authentication mode. - `jwt` (String) JWT to access DECORT cloud API in 'jwt' authentication mode.
- `oauth2_url` (String) OAuth2 application URL in 'decs3o' and 'bvs' authentication mode. - `oauth2_url` (String) OAuth2 application URL in 'decs3o' and 'bvs' authentication mode.

View File

@@ -37,6 +37,7 @@ description: |-
- `account_name` (String) The name of the subscriber '(account') to whom this disk belongs - `account_name` (String) The name of the subscriber '(account') to whom this disk belongs
- `acl` (String) - `acl` (String)
- `blk_discard` (Boolean) Flag indicating whether blk-discard is enabled for the disk
- `cache` (String) - `cache` (String)
- `computes` (List of Object) (see [below for nested schema](#nestedatt--computes)) - `computes` (List of Object) (see [below for nested schema](#nestedatt--computes))
- `created_by` (String) - `created_by` (String)

View File

@@ -802,6 +802,11 @@ func resourceDiskSchemaMake() map[string]*schema.Schema {
Type: schema.TypeBool, Type: schema.TypeBool,
Computed: true, Computed: true,
}, },
"blk_discard": {
Type: schema.TypeBool,
Computed: true,
Description: "Flag indicating whether blk-discard is enabled for the disk",
},
} }
return rets return rets

View File

@@ -71,7 +71,7 @@ func resourceDiskSnapshotCreate(ctx context.Context, d *schema.ResourceData, m i
TimeStamp: uint64(d.Get("timestamp").(int)), TimeStamp: uint64(d.Get("timestamp").(int)),
} }
log.Debugf("resourceDiskCreate: Snapshot rollback with label", label) log.Debugf("resourceDiskCreate: Snapshot rollback with label %s", label)
_, err := c.CloudAPI().Disks().SnapshotRollback(ctx, req) _, err := c.CloudAPI().Disks().SnapshotRollback(ctx, req)
if err != nil { if err != nil {
return diag.FromErr(err) return diag.FromErr(err)

View File

@@ -1,139 +1,139 @@
/* /*
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved. 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> 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.
You may obtain a copy of the License at You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. 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://repository.basistech.ru/BASIS/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://repository.basistech.ru/BASIS/terraform-provider-decort/wiki Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
*/ */
package image package image
import ( import (
"context" "context"
"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"
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/image" "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/image"
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants" "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/controller"
) )
func resourceImageVirtualCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { func resourceImageVirtualCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
log.Debugf("resourceImageVirtualCreate: called for image %s", d.Get("name").(string)) log.Debugf("resourceImageVirtualCreate: called for image %s", d.Get("name").(string))
c := m.(*controller.ControllerCfg) c := m.(*controller.ControllerCfg)
req := image.CreateVirtualRequest{ req := image.CreateVirtualRequest{
Name: d.Get("name").(string), Name: d.Get("name").(string),
TargetID: uint64(d.Get("link_to").(int)), TargetID: uint64(d.Get("link_to").(int)),
AccountID: uint64(d.Get("account_id").(int)), AccountID: uint64(d.Get("account_id").(int)),
} }
imageId, err := c.CloudAPI().Image().CreateVirtual(ctx, req) imageId, err := c.CloudAPI().Image().CreateVirtual(ctx, req)
if err != nil { if err != nil {
return diag.FromErr(err) return diag.FromErr(err)
} }
d.SetId(strconv.FormatUint(imageId, 10)) d.SetId(strconv.FormatUint(imageId, 10))
d.Set("image_id", imageId) d.Set("image_id", imageId)
_, err = utilityImageCheckPresence(ctx, d, m) _, err = utilityImageCheckPresence(ctx, d, m)
if err != nil { if err != nil {
return diag.FromErr(err) return diag.FromErr(err)
} }
return resourceImageRead(ctx, d, m) return resourceImageRead(ctx, d, m)
} }
func resourceImageVirtualUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { func resourceImageVirtualUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
log.Debugf("resourceImageUpdate: called for %s, id: %s", d.Get("name").(string), d.Id()) log.Debugf("resourceImageUpdate: called for %s, id: %s", d.Get("name").(string), d.Id())
if d.HasChange("name") { if d.HasChange("name") {
err := resourceImageRename(ctx, d, m) err := resourceImageRename(ctx, d, m)
if err != nil { if err != nil {
return diag.FromErr(err) return diag.FromErr(err)
} }
} }
if d.HasChange("link_to") { if d.HasChange("link_to") {
err := resourceImageVirtualLink(ctx, d, m) err := resourceImageVirtualLink(ctx, d, m)
if err != nil { if err != nil {
return diag.FromErr(err) return diag.FromErr(err)
} }
} }
return resourceImageRead(ctx, d, m) return resourceImageRead(ctx, d, m)
} }
func resourceImageVirtualLink(ctx context.Context, d *schema.ResourceData, m interface{}) error { func resourceImageVirtualLink(ctx context.Context, d *schema.ResourceData, m interface{}) error {
log.Debugf("resourceVirtualImageLink: called for %s, id: %s", d.Get("name").(string), d.Id()) log.Debugf("resourceVirtualImageLink: called for %s, id: %s", d.Get("name").(string), d.Id())
c := m.(*controller.ControllerCfg) c := m.(*controller.ControllerCfg)
req := image.LinkRequest{ req := image.LinkRequest{
ImageID: uint64(d.Get("image_id").(int)), ImageID: uint64(d.Get("image_id").(int)),
TargetID: uint64(d.Get("link_to").(int)), TargetID: uint64(d.Get("link_to").(int)),
} }
_, err := c.CloudAPI().Image().Link(ctx, req) _, err := c.CloudAPI().Image().Link(ctx, req)
if err != nil { if err != nil {
return err return err
} }
return nil return nil
} }
func ResourceImageVirtual() *schema.Resource { func ResourceImageVirtual() *schema.Resource {
return &schema.Resource{ return &schema.Resource{
SchemaVersion: 2, SchemaVersion: 2,
CreateContext: resourceImageVirtualCreate, CreateContext: resourceImageVirtualCreate,
ReadContext: resourceImageRead, ReadContext: resourceImageRead,
UpdateContext: resourceImageVirtualUpdate, UpdateContext: resourceImageVirtualUpdate,
DeleteContext: resourceImageDelete, DeleteContext: resourceImageDelete,
Importer: &schema.ResourceImporter{ Importer: &schema.ResourceImporter{
StateContext: schema.ImportStatePassthroughContext, StateContext: schema.ImportStatePassthroughContext,
}, },
Timeouts: &schema.ResourceTimeout{ Timeouts: &schema.ResourceTimeout{
Create: &constants.Timeout600s, Create: &constants.Timeout600s,
Read: &constants.Timeout300s, Read: &constants.Timeout300s,
Update: &constants.Timeout300s, Update: &constants.Timeout300s,
Delete: &constants.Timeout300s, Delete: &constants.Timeout300s,
Default: &constants.Timeout300s, Default: &constants.Timeout300s,
}, },
Schema: resourceImageVirtualSchemaMake(dataSourceImageExtendSchemaMake()), Schema: resourceImageVirtualSchemaMake(dataSourceImageExtendSchemaMake()),
StateUpgraders: []schema.StateUpgrader{ StateUpgraders: []schema.StateUpgrader{
{ {
Type: resourceImageVirtualSchemaV1().CoreConfigSchema().ImpliedType(), Type: resourceImageVirtualSchemaV1().CoreConfigSchema().ImpliedType(),
Upgrade: resourcePresentToUpgradeV1, Upgrade: resourcePresentToUpgradeV1,
Version: 1, Version: 1,
}, },
}, },
} }
} }

View File

@@ -805,13 +805,13 @@ func resourceK8sSchemaMake() map[string]*schema.Schema {
Description: "insert ssl certificate in x509 pem format", Description: "insert ssl certificate in x509 pem format",
}, },
"chipset": { "chipset": {
Type: schema.TypeString, Type: schema.TypeString,
Optional: true, Optional: true,
ValidateFunc: validation.StringInSlice([]string{"Q35", "i440fx"}, false), ValidateFunc: validation.StringInSlice([]string{"Q35", "i440fx"}, false),
Default: "Q35", Default: "Q35",
Description: "Type of the emulated system. Possible values: i440fx, Q35. Default: Q35", Description: "Type of the emulated system. Possible values: i440fx, Q35. Default: Q35",
}, },
"desc": { "desc": {
Type: schema.TypeString, Type: schema.TypeString,

View File

@@ -715,13 +715,13 @@ func resourceK8sCPSchemaMake() map[string]*schema.Schema {
), ),
Description: "Node RAM in MB.", Description: "Node RAM in MB.",
}, },
"chipset": { "chipset": {
Type: schema.TypeString, Type: schema.TypeString,
Optional: true, Optional: true,
ValidateFunc: validation.StringInSlice([]string{"Q35", "i440fx"}, false), ValidateFunc: validation.StringInSlice([]string{"Q35", "i440fx"}, false),
Default: "Q35", Default: "Q35",
Description: "Type of the emulated system. Possible values: i440fx, Q35. Default: Q35", Description: "Type of the emulated system. Possible values: i440fx, Q35. Default: Q35",
}, },
"disk": { "disk": {
Type: schema.TypeInt, Type: schema.TypeInt,
Optional: true, Optional: true,

View File

@@ -290,13 +290,13 @@ func resourceK8sWgSchemaMake() map[string]*schema.Schema {
Description: "Number of worker nodes to create.", Description: "Number of worker nodes to create.",
}, },
"chipset": { "chipset": {
Type: schema.TypeString, Type: schema.TypeString,
Optional: true, Optional: true,
ValidateFunc: validation.StringInSlice([]string{"Q35", "i440fx"}, false), ValidateFunc: validation.StringInSlice([]string{"Q35", "i440fx"}, false),
Default: "Q35", Default: "Q35",
Description: "Type of the emulated system. Possible values: i440fx, Q35. Default: Q35", Description: "Type of the emulated system. Possible values: i440fx, Q35. Default: Q35",
}, },
"cpu": { "cpu": {
Type: schema.TypeInt, Type: schema.TypeInt,

View File

@@ -476,6 +476,9 @@ func flattenCompute(d *schema.ResourceData, computeRec compute.RecordCompute, pc
d.Set("network_interface_naming", computeRec.NetworkInterfaceNaming) d.Set("network_interface_naming", computeRec.NetworkInterfaceNaming)
d.Set("zone_id", computeRec.ZoneID) d.Set("zone_id", computeRec.ZoneID)
d.Set("loader_meta_iso", flattenLoaderMetaIso(computeRec.LoaderMetaIso)) d.Set("loader_meta_iso", flattenLoaderMetaIso(computeRec.LoaderMetaIso))
d.Set("cpu_pin", computeRec.CPUPin)
d.Set("numa_affinity", computeRec.NumaAffinity)
d.Set("hp_backed", computeRec.HPBacked)
d.Set("enabled", false) d.Set("enabled", false)
if computeRec.Status == status.Enabled { if computeRec.Status == status.Enabled {

View File

@@ -1,300 +1,300 @@
/* /*
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved. 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> 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.
You may obtain a copy of the License at You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. 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://repository.basistech.ru/BASIS/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://repository.basistech.ru/BASIS/terraform-provider-decort/wiki Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
*/ */
package lb package lb
import ( import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/lb" "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/lb"
) )
func flattenLBFrontendBind(d *schema.ResourceData, b *lb.ItemBinding, lbId int64, frontendName string) { func flattenLBFrontendBind(d *schema.ResourceData, b *lb.ItemBinding, lbId int64, frontendName string) {
d.Set("lb_id", lbId) d.Set("lb_id", lbId)
d.Set("frontend_name", frontendName) d.Set("frontend_name", frontendName)
d.Set("name", b.Name) d.Set("name", b.Name)
d.Set("address", b.Address) d.Set("address", b.Address)
d.Set("guid", b.GUID) d.Set("guid", b.GUID)
d.Set("port", b.Port) d.Set("port", b.Port)
} }
func flattenLBFrontend(d *schema.ResourceData, f *lb.ItemFrontend, lbId int64) { func flattenLBFrontend(d *schema.ResourceData, f *lb.ItemFrontend, lbId int64) {
d.Set("lb_id", lbId) d.Set("lb_id", lbId)
d.Set("backend_name", f.Backend) d.Set("backend_name", f.Backend)
d.Set("name", f.Name) d.Set("name", f.Name)
d.Set("guid", f.GUID) d.Set("guid", f.GUID)
d.Set("bindings", flattendBindings(f.Bindings)) d.Set("bindings", flattendBindings(f.Bindings))
} }
func flattenResourceLBBackendServer(d *schema.ResourceData, s *lb.ItemServer, lbId int64, backendName string) { func flattenResourceLBBackendServer(d *schema.ResourceData, s *lb.ItemServer, lbId int64, backendName string) {
d.Set("lb_id", lbId) d.Set("lb_id", lbId)
d.Set("backend_name", backendName) d.Set("backend_name", backendName)
d.Set("name", s.Name) d.Set("name", s.Name)
d.Set("port", s.Port) d.Set("port", s.Port)
d.Set("address", s.Address) d.Set("address", s.Address)
d.Set("check", s.Check) d.Set("check", s.Check)
d.Set("guid", s.GUID) d.Set("guid", s.GUID)
d.Set("downinter", s.ServerSettings.DownInter) d.Set("downinter", s.ServerSettings.DownInter)
d.Set("fall", s.ServerSettings.Fall) d.Set("fall", s.ServerSettings.Fall)
d.Set("inter", s.ServerSettings.Inter) d.Set("inter", s.ServerSettings.Inter)
d.Set("maxconn", s.ServerSettings.MaxConn) d.Set("maxconn", s.ServerSettings.MaxConn)
d.Set("maxqueue", s.ServerSettings.MaxQueue) d.Set("maxqueue", s.ServerSettings.MaxQueue)
d.Set("rise", s.ServerSettings.Rise) d.Set("rise", s.ServerSettings.Rise)
d.Set("slowstart", s.ServerSettings.SlowStart) d.Set("slowstart", s.ServerSettings.SlowStart)
d.Set("weight", s.ServerSettings.Weight) d.Set("weight", s.ServerSettings.Weight)
} }
func flattenResourceLBBackend(d *schema.ResourceData, b *lb.ItemBackend, lbId int64) { func flattenResourceLBBackend(d *schema.ResourceData, b *lb.ItemBackend, lbId int64) {
d.Set("lb_id", lbId) d.Set("lb_id", lbId)
d.Set("name", b.Name) d.Set("name", b.Name)
d.Set("algorithm", b.Algorithm) d.Set("algorithm", b.Algorithm)
d.Set("guid", b.GUID) d.Set("guid", b.GUID)
d.Set("downinter", b.ServerDefaultSettings.DownInter) d.Set("downinter", b.ServerDefaultSettings.DownInter)
d.Set("fall", b.ServerDefaultSettings.Fall) d.Set("fall", b.ServerDefaultSettings.Fall)
d.Set("inter", b.ServerDefaultSettings.Inter) d.Set("inter", b.ServerDefaultSettings.Inter)
d.Set("maxconn", b.ServerDefaultSettings.MaxConn) d.Set("maxconn", b.ServerDefaultSettings.MaxConn)
d.Set("maxqueue", b.ServerDefaultSettings.MaxQueue) d.Set("maxqueue", b.ServerDefaultSettings.MaxQueue)
d.Set("rise", b.ServerDefaultSettings.Rise) d.Set("rise", b.ServerDefaultSettings.Rise)
d.Set("slowstart", b.ServerDefaultSettings.SlowStart) d.Set("slowstart", b.ServerDefaultSettings.SlowStart)
d.Set("weight", b.ServerDefaultSettings.Weight) d.Set("weight", b.ServerDefaultSettings.Weight)
d.Set("servers", flattenServers(b.Servers)) d.Set("servers", flattenServers(b.Servers))
} }
func flattenResourceLB(d *schema.ResourceData, lb *lb.RecordLB) { func flattenResourceLB(d *schema.ResourceData, lb *lb.RecordLB) {
d.Set("ha_mode", lb.HAMode) d.Set("ha_mode", lb.HAMode)
d.Set("backend_haip", lb.BackendHAIP) d.Set("backend_haip", lb.BackendHAIP)
d.Set("backends", flattenLBBackends(lb.Backends)) d.Set("backends", flattenLBBackends(lb.Backends))
d.Set("created_by", lb.CreatedBy) d.Set("created_by", lb.CreatedBy)
d.Set("created_time", lb.CreatedTime) d.Set("created_time", lb.CreatedTime)
d.Set("deleted_by", lb.DeletedBy) d.Set("deleted_by", lb.DeletedBy)
d.Set("deleted_time", lb.DeletedTime) d.Set("deleted_time", lb.DeletedTime)
d.Set("desc", lb.Description) d.Set("desc", lb.Description)
d.Set("dp_api_user", lb.DPAPIUser) d.Set("dp_api_user", lb.DPAPIUser)
d.Set("extnet_id", lb.ExtNetID) d.Set("extnet_id", lb.ExtNetID)
d.Set("frontend_haip", lb.FrontendHAIP) d.Set("frontend_haip", lb.FrontendHAIP)
d.Set("frontends", flattenFrontends(lb.Frontends)) d.Set("frontends", flattenFrontends(lb.Frontends))
d.Set("gid", lb.GID) d.Set("gid", lb.GID)
d.Set("guid", lb.GUID) d.Set("guid", lb.GUID)
d.Set("manager_id", lb.ManagerId) d.Set("manager_id", lb.ManagerId)
d.Set("manager_type", lb.ManagerType) d.Set("manager_type", lb.ManagerType)
d.Set("lb_id", lb.ID) d.Set("lb_id", lb.ID)
d.Set("image_id", lb.ImageID) d.Set("image_id", lb.ImageID)
d.Set("milestones", lb.Milestones) d.Set("milestones", lb.Milestones)
d.Set("name", lb.Name) d.Set("name", lb.Name)
d.Set("part_k8s", lb.PartK8s) d.Set("part_k8s", lb.PartK8s)
d.Set("primary_node", flattenNode(lb.PrimaryNode)) d.Set("primary_node", flattenNode(lb.PrimaryNode))
d.Set("rg_id", lb.RGID) d.Set("rg_id", lb.RGID)
d.Set("rg_name", lb.RGName) d.Set("rg_name", lb.RGName)
d.Set("secondary_node", flattenNode(lb.SecondaryNode)) d.Set("secondary_node", flattenNode(lb.SecondaryNode))
d.Set("status", lb.Status) d.Set("status", lb.Status)
d.Set("tech_status", lb.TechStatus) d.Set("tech_status", lb.TechStatus)
d.Set("updated_by", lb.UpdatedBy) d.Set("updated_by", lb.UpdatedBy)
d.Set("updated_time", lb.UpdatedTime) d.Set("updated_time", lb.UpdatedTime)
d.Set("user_managed", lb.UserManaged) d.Set("user_managed", lb.UserManaged)
d.Set("vins_id", lb.VINSID) d.Set("vins_id", lb.VINSID)
d.Set("zone_id", lb.ZoneID) d.Set("zone_id", lb.ZoneID)
} }
func flattenLB(d *schema.ResourceData, lb *lb.RecordLB) { func flattenLB(d *schema.ResourceData, lb *lb.RecordLB) {
d.Set("account_id", lb.AccountID) d.Set("account_id", lb.AccountID)
d.Set("ha_mode", lb.HAMode) d.Set("ha_mode", lb.HAMode)
d.Set("backend_haip", lb.BackendHAIP) d.Set("backend_haip", lb.BackendHAIP)
d.Set("backends", flattenLBBackends(lb.Backends)) d.Set("backends", flattenLBBackends(lb.Backends))
d.Set("created_by", lb.CreatedBy) d.Set("created_by", lb.CreatedBy)
d.Set("created_time", lb.CreatedTime) d.Set("created_time", lb.CreatedTime)
d.Set("deleted_by", lb.DeletedBy) d.Set("deleted_by", lb.DeletedBy)
d.Set("deleted_time", lb.DeletedTime) d.Set("deleted_time", lb.DeletedTime)
d.Set("desc", lb.Description) d.Set("desc", lb.Description)
d.Set("dp_api_user", lb.DPAPIUser) d.Set("dp_api_user", lb.DPAPIUser)
d.Set("extnet_id", lb.ExtNetID) d.Set("extnet_id", lb.ExtNetID)
d.Set("frontend_haip", lb.FrontendHAIP) d.Set("frontend_haip", lb.FrontendHAIP)
d.Set("frontends", flattenFrontends(lb.Frontends)) d.Set("frontends", flattenFrontends(lb.Frontends))
d.Set("gid", lb.GID) d.Set("gid", lb.GID)
d.Set("guid", lb.GUID) d.Set("guid", lb.GUID)
d.Set("manager_id", lb.ManagerId) d.Set("manager_id", lb.ManagerId)
d.Set("manager_type", lb.ManagerType) d.Set("manager_type", lb.ManagerType)
d.Set("image_id", lb.ImageID) d.Set("image_id", lb.ImageID)
d.Set("milestones", lb.Milestones) d.Set("milestones", lb.Milestones)
d.Set("name", lb.Name) d.Set("name", lb.Name)
d.Set("part_k8s", lb.PartK8s) d.Set("part_k8s", lb.PartK8s)
d.Set("primary_node", flattenNode(lb.PrimaryNode)) d.Set("primary_node", flattenNode(lb.PrimaryNode))
d.Set("rg_id", lb.RGID) d.Set("rg_id", lb.RGID)
d.Set("rg_name", lb.RGName) d.Set("rg_name", lb.RGName)
d.Set("secondary_node", flattenNode(lb.SecondaryNode)) d.Set("secondary_node", flattenNode(lb.SecondaryNode))
d.Set("status", lb.Status) d.Set("status", lb.Status)
d.Set("tech_status", lb.TechStatus) d.Set("tech_status", lb.TechStatus)
d.Set("updated_by", lb.UpdatedBy) d.Set("updated_by", lb.UpdatedBy)
d.Set("updated_time", lb.UpdatedTime) d.Set("updated_time", lb.UpdatedTime)
d.Set("user_managed", lb.UserManaged) d.Set("user_managed", lb.UserManaged)
d.Set("vins_id", lb.VINSID) d.Set("vins_id", lb.VINSID)
d.Set("zone_id", lb.ZoneID) d.Set("zone_id", lb.ZoneID)
} }
func flattenNode(node lb.RecordNode) []map[string]interface{} { func flattenNode(node lb.RecordNode) []map[string]interface{} {
temp := make([]map[string]interface{}, 0) temp := make([]map[string]interface{}, 0)
n := map[string]interface{}{ n := map[string]interface{}{
"backend_ip": node.BackendIP, "backend_ip": node.BackendIP,
"compute_id": node.ComputeID, "compute_id": node.ComputeID,
"frontend_ip": node.FrontendIP, "frontend_ip": node.FrontendIP,
"guid": node.GUID, "guid": node.GUID,
"mgmt_ip": node.MGMTIP, "mgmt_ip": node.MGMTIP,
"network_id": node.NetworkID, "network_id": node.NetworkID,
} }
temp = append(temp, n) temp = append(temp, n)
return temp return temp
} }
func flattendBindings(bs []lb.ItemBinding) []map[string]interface{} { func flattendBindings(bs []lb.ItemBinding) []map[string]interface{} {
temp := make([]map[string]interface{}, 0, len(bs)) temp := make([]map[string]interface{}, 0, len(bs))
for _, b := range bs { for _, b := range bs {
t := map[string]interface{}{ t := map[string]interface{}{
"address": b.Address, "address": b.Address,
"guid": b.GUID, "guid": b.GUID,
"name": b.Name, "name": b.Name,
"port": b.Port, "port": b.Port,
} }
temp = append(temp, t) temp = append(temp, t)
} }
return temp return temp
} }
func flattenFrontends(fs []lb.ItemFrontend) []map[string]interface{} { func flattenFrontends(fs []lb.ItemFrontend) []map[string]interface{} {
temp := make([]map[string]interface{}, 0, len(fs)) temp := make([]map[string]interface{}, 0, len(fs))
for _, f := range fs { for _, f := range fs {
t := map[string]interface{}{ t := map[string]interface{}{
"backend": f.Backend, "backend": f.Backend,
"bindings": flattendBindings(f.Bindings), "bindings": flattendBindings(f.Bindings),
"guid": f.GUID, "guid": f.GUID,
"name": f.Name, "name": f.Name,
} }
temp = append(temp, t) temp = append(temp, t)
} }
return temp return temp
} }
func flattenServers(servers []lb.ItemServer) []map[string]interface{} { func flattenServers(servers []lb.ItemServer) []map[string]interface{} {
temp := make([]map[string]interface{}, 0, len(servers)) temp := make([]map[string]interface{}, 0, len(servers))
for _, server := range servers { for _, server := range servers {
t := map[string]interface{}{ t := map[string]interface{}{
"address": server.Address, "address": server.Address,
"check": server.Check, "check": server.Check,
"guid": server.GUID, "guid": server.GUID,
"name": server.Name, "name": server.Name,
"port": server.Port, "port": server.Port,
"server_settings": flattenServerSettings(server.ServerSettings), "server_settings": flattenServerSettings(server.ServerSettings),
} }
temp = append(temp, t) temp = append(temp, t)
} }
return temp return temp
} }
func flattenServerSettings(defSet lb.RecordServerSettings) []map[string]interface{} { func flattenServerSettings(defSet lb.RecordServerSettings) []map[string]interface{} {
temp := map[string]interface{}{ temp := map[string]interface{}{
"downinter": defSet.DownInter, "downinter": defSet.DownInter,
"fall": defSet.Fall, "fall": defSet.Fall,
"guid": defSet.GUID, "guid": defSet.GUID,
"inter": defSet.Inter, "inter": defSet.Inter,
"maxconn": defSet.MaxConn, "maxconn": defSet.MaxConn,
"maxqueue": defSet.MaxQueue, "maxqueue": defSet.MaxQueue,
"rise": defSet.Rise, "rise": defSet.Rise,
"slowstart": defSet.SlowStart, "slowstart": defSet.SlowStart,
"weight": defSet.Weight, "weight": defSet.Weight,
} }
res := make([]map[string]interface{}, 0) res := make([]map[string]interface{}, 0)
res = append(res, temp) res = append(res, temp)
return res return res
} }
func flattenLBBackends(backends []lb.ItemBackend) []map[string]interface{} { func flattenLBBackends(backends []lb.ItemBackend) []map[string]interface{} {
temp := make([]map[string]interface{}, 0, len(backends)) temp := make([]map[string]interface{}, 0, len(backends))
for _, item := range backends { for _, item := range backends {
t := map[string]interface{}{ t := map[string]interface{}{
"algorithm": item.Algorithm, "algorithm": item.Algorithm,
"guid": item.GUID, "guid": item.GUID,
"name": item.Name, "name": item.Name,
"server_default_settings": flattenServerSettings(item.ServerDefaultSettings), "server_default_settings": flattenServerSettings(item.ServerDefaultSettings),
"servers": flattenServers(item.Servers), "servers": flattenServers(item.Servers),
} }
temp = append(temp, t) temp = append(temp, t)
} }
return temp return temp
} }
func flattenLBList(lbl *lb.ListLB) []map[string]interface{} { func flattenLBList(lbl *lb.ListLB) []map[string]interface{} {
res := make([]map[string]interface{}, 0, len(lbl.Data)) res := make([]map[string]interface{}, 0, len(lbl.Data))
for _, lb := range lbl.Data { for _, lb := range lbl.Data {
temp := map[string]interface{}{ temp := map[string]interface{}{
"ha_mode": lb.HAMode, "ha_mode": lb.HAMode,
"backend_haip": lb.BackendHAIP, "backend_haip": lb.BackendHAIP,
"backends": flattenLBBackends(lb.Backends), "backends": flattenLBBackends(lb.Backends),
"created_by": lb.CreatedBy, "created_by": lb.CreatedBy,
"created_time": lb.CreatedTime, "created_time": lb.CreatedTime,
"deleted_by": lb.DeletedBy, "deleted_by": lb.DeletedBy,
"deleted_time": lb.DeletedTime, "deleted_time": lb.DeletedTime,
"desc": lb.Description, "desc": lb.Description,
"dp_api_user": lb.DPAPIUser, "dp_api_user": lb.DPAPIUser,
"dp_api_password": lb.DPAPIPassword, "dp_api_password": lb.DPAPIPassword,
"extnet_id": lb.ExtNetID, "extnet_id": lb.ExtNetID,
"frontend_haip": lb.FrontendHAIP, "frontend_haip": lb.FrontendHAIP,
"frontends": flattenFrontends(lb.Frontends), "frontends": flattenFrontends(lb.Frontends),
"gid": lb.GID, "gid": lb.GID,
"guid": lb.GUID, "guid": lb.GUID,
"manager_id": lb.ManagerId, "manager_id": lb.ManagerId,
"manager_type": lb.ManagerType, "manager_type": lb.ManagerType,
"image_id": lb.ImageID, "image_id": lb.ImageID,
"milestones": lb.Milestones, "milestones": lb.Milestones,
"name": lb.Name, "name": lb.Name,
"part_k8s": lb.PartK8s, "part_k8s": lb.PartK8s,
"primary_node": flattenNode(lb.PrimaryNode), "primary_node": flattenNode(lb.PrimaryNode),
"rg_id": lb.RGID, "rg_id": lb.RGID,
"rg_name": lb.RGName, "rg_name": lb.RGName,
"secondary_node": flattenNode(lb.SecondaryNode), "secondary_node": flattenNode(lb.SecondaryNode),
"status": lb.Status, "status": lb.Status,
"tech_status": lb.TechStatus, "tech_status": lb.TechStatus,
"updated_by": lb.UpdatedBy, "updated_by": lb.UpdatedBy,
"updated_time": lb.UpdatedTime, "updated_time": lb.UpdatedTime,
"user_managed": lb.UserManaged, "user_managed": lb.UserManaged,
"vins_id": lb.VINSID, "vins_id": lb.VINSID,
"lb_id": lb.ID, "lb_id": lb.ID,
"zone_id": lb.ZoneID, "zone_id": lb.ZoneID,
} }
res = append(res, temp) res = append(res, temp)
} }
return res return res
} }

View File

@@ -1,119 +1,119 @@
/* /*
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved. 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> 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.
You may obtain a copy of the License at You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. 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://repository.basistech.ru/BASIS/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://repository.basistech.ru/BASIS/terraform-provider-decort/wiki Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
*/ */
package lb package lb
import "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" import "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
func lbResourceSchemaMake() map[string]*schema.Schema { func lbResourceSchemaMake() map[string]*schema.Schema {
sch := createLBSchema() sch := createLBSchema()
sch["rg_id"] = &schema.Schema{ sch["rg_id"] = &schema.Schema{
Type: schema.TypeInt, Type: schema.TypeInt,
Required: true, Required: true,
} }
sch["name"] = &schema.Schema{ sch["name"] = &schema.Schema{
Type: schema.TypeString, Type: schema.TypeString,
Required: true, Required: true,
} }
sch["zone_id"] = &schema.Schema{ sch["zone_id"] = &schema.Schema{
Type: schema.TypeInt, Type: schema.TypeInt,
Optional: true, Optional: true,
Computed: true, Computed: true,
} }
sch["extnet_id"] = &schema.Schema{ sch["extnet_id"] = &schema.Schema{
Type: schema.TypeInt, Type: schema.TypeInt,
Optional: true, Optional: true,
} }
sch["vins_id"] = &schema.Schema{ sch["vins_id"] = &schema.Schema{
Type: schema.TypeInt, Type: schema.TypeInt,
Optional: true, Optional: true,
} }
sch["start"] = &schema.Schema{ sch["start"] = &schema.Schema{
Type: schema.TypeBool, Type: schema.TypeBool,
Optional: true, Optional: true,
Default: true, Default: true,
} }
sch["desc"] = &schema.Schema{ sch["desc"] = &schema.Schema{
Type: schema.TypeString, Type: schema.TypeString,
Optional: true, Optional: true,
Computed: true, Computed: true,
} }
sch["enable"] = &schema.Schema{ sch["enable"] = &schema.Schema{
Type: schema.TypeBool, Type: schema.TypeBool,
Optional: true, Optional: true,
} }
sch["restart"] = &schema.Schema{ sch["restart"] = &schema.Schema{
Type: schema.TypeBool, Type: schema.TypeBool,
Optional: true, Optional: true,
} }
sch["restore"] = &schema.Schema{ sch["restore"] = &schema.Schema{
Type: schema.TypeBool, Type: schema.TypeBool,
Optional: true, Optional: true,
} }
sch["safe"] = &schema.Schema{ sch["safe"] = &schema.Schema{
Type: schema.TypeBool, Type: schema.TypeBool,
Default: true, Default: true,
Optional: true, Optional: true,
} }
sch["config_reset"] = &schema.Schema{ sch["config_reset"] = &schema.Schema{
Type: schema.TypeBool, Type: schema.TypeBool,
Optional: true, Optional: true,
} }
///4.4.0 ///4.4.0
sch["ha_mode"] = &schema.Schema{ sch["ha_mode"] = &schema.Schema{
Type: schema.TypeBool, Type: schema.TypeBool,
Optional: true, Optional: true,
} }
sch["sysctl_params"] = &schema.Schema{ sch["sysctl_params"] = &schema.Schema{
Type: schema.TypeList, Type: schema.TypeList,
Optional: true, Optional: true,
Elem: &schema.Schema{ Elem: &schema.Schema{
Type: schema.TypeMap, Type: schema.TypeMap,
Elem: &schema.Schema{ Elem: &schema.Schema{
Type: schema.TypeString, Type: schema.TypeString,
}, },
}, },
} }
/// ///
sch["permanently"] = &schema.Schema{ sch["permanently"] = &schema.Schema{
Type: schema.TypeBool, Type: schema.TypeBool,
Optional: true, Optional: true,
} }
return sch return sch
} }

View File

@@ -1,396 +1,396 @@
/* /*
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved. 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> 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.
You may obtain a copy of the License at You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. 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://repository.basistech.ru/BASIS/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://repository.basistech.ru/BASIS/terraform-provider-decort/wiki Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
*/ */
package lb package lb
import "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" import "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
func createLBSchema() map[string]*schema.Schema { func createLBSchema() map[string]*schema.Schema {
return map[string]*schema.Schema{ return map[string]*schema.Schema{
"account_id": { "account_id": {
Type: schema.TypeInt, Type: schema.TypeInt,
Computed: true, Computed: true,
}, },
"ha_mode": { "ha_mode": {
Type: schema.TypeBool, Type: schema.TypeBool,
Computed: true, Computed: true,
}, },
"backend_haip": { "backend_haip": {
Type: schema.TypeString, Type: schema.TypeString,
Computed: true, Computed: true,
}, },
"backends": { "backends": {
Type: schema.TypeList, Type: schema.TypeList,
Computed: true, Computed: true,
Elem: &schema.Resource{ Elem: &schema.Resource{
Schema: map[string]*schema.Schema{ Schema: map[string]*schema.Schema{
"algorithm": { "algorithm": {
Type: schema.TypeString, Type: schema.TypeString,
Computed: true, Computed: true,
}, },
"guid": { "guid": {
Type: schema.TypeString, Type: schema.TypeString,
Computed: true, Computed: true,
}, },
"name": { "name": {
Type: schema.TypeString, Type: schema.TypeString,
Computed: true, Computed: true,
}, },
"server_default_settings": { "server_default_settings": {
Type: schema.TypeList, Type: schema.TypeList,
Computed: true, Computed: true,
Elem: &schema.Resource{ Elem: &schema.Resource{
Schema: map[string]*schema.Schema{ Schema: map[string]*schema.Schema{
"downinter": { "downinter": {
Type: schema.TypeInt, Type: schema.TypeInt,
Computed: true, Computed: true,
}, },
"fall": { "fall": {
Type: schema.TypeInt, Type: schema.TypeInt,
Computed: true, Computed: true,
}, },
"guid": { "guid": {
Type: schema.TypeString, Type: schema.TypeString,
Computed: true, Computed: true,
}, },
"inter": { "inter": {
Type: schema.TypeInt, Type: schema.TypeInt,
Computed: true, Computed: true,
}, },
"maxconn": { "maxconn": {
Type: schema.TypeInt, Type: schema.TypeInt,
Computed: true, Computed: true,
}, },
"maxqueue": { "maxqueue": {
Type: schema.TypeInt, Type: schema.TypeInt,
Computed: true, Computed: true,
}, },
"rise": { "rise": {
Type: schema.TypeInt, Type: schema.TypeInt,
Computed: true, Computed: true,
}, },
"slowstart": { "slowstart": {
Type: schema.TypeInt, Type: schema.TypeInt,
Computed: true, Computed: true,
}, },
"weight": { "weight": {
Type: schema.TypeInt, Type: schema.TypeInt,
Computed: true, Computed: true,
}, },
}, },
}, },
}, },
"servers": { "servers": {
Type: schema.TypeList, Type: schema.TypeList,
Computed: true, Computed: true,
Elem: &schema.Resource{ Elem: &schema.Resource{
Schema: map[string]*schema.Schema{ Schema: map[string]*schema.Schema{
"address": { "address": {
Type: schema.TypeString, Type: schema.TypeString,
Computed: true, Computed: true,
}, },
"check": { "check": {
Type: schema.TypeString, Type: schema.TypeString,
Computed: true, Computed: true,
}, },
"guid": { "guid": {
Type: schema.TypeString, Type: schema.TypeString,
Computed: true, Computed: true,
}, },
"name": { "name": {
Type: schema.TypeString, Type: schema.TypeString,
Computed: true, Computed: true,
}, },
"port": { "port": {
Type: schema.TypeInt, Type: schema.TypeInt,
Computed: true, Computed: true,
}, },
"server_settings": { "server_settings": {
Type: schema.TypeList, Type: schema.TypeList,
Computed: true, Computed: true,
Elem: &schema.Resource{ Elem: &schema.Resource{
Schema: map[string]*schema.Schema{ Schema: map[string]*schema.Schema{
"downinter": { "downinter": {
Type: schema.TypeInt, Type: schema.TypeInt,
Computed: true, Computed: true,
}, },
"fall": { "fall": {
Type: schema.TypeInt, Type: schema.TypeInt,
Computed: true, Computed: true,
}, },
"guid": { "guid": {
Type: schema.TypeString, Type: schema.TypeString,
Computed: true, Computed: true,
}, },
"inter": { "inter": {
Type: schema.TypeInt, Type: schema.TypeInt,
Computed: true, Computed: true,
}, },
"maxconn": { "maxconn": {
Type: schema.TypeInt, Type: schema.TypeInt,
Computed: true, Computed: true,
}, },
"maxqueue": { "maxqueue": {
Type: schema.TypeInt, Type: schema.TypeInt,
Computed: true, Computed: true,
}, },
"rise": { "rise": {
Type: schema.TypeInt, Type: schema.TypeInt,
Computed: true, Computed: true,
}, },
"slowstart": { "slowstart": {
Type: schema.TypeInt, Type: schema.TypeInt,
Computed: true, Computed: true,
}, },
"weight": { "weight": {
Type: schema.TypeInt, Type: schema.TypeInt,
Computed: true, Computed: true,
}, },
}, },
}, },
}, },
}, },
}, },
}, },
}, },
}, },
}, },
"created_by": { "created_by": {
Type: schema.TypeString, Type: schema.TypeString,
Computed: true, Computed: true,
}, },
"created_time": { "created_time": {
Type: schema.TypeInt, Type: schema.TypeInt,
Computed: true, Computed: true,
}, },
"deleted_by": { "deleted_by": {
Type: schema.TypeString, Type: schema.TypeString,
Computed: true, Computed: true,
}, },
"deleted_time": { "deleted_time": {
Type: schema.TypeInt, Type: schema.TypeInt,
Computed: true, Computed: true,
}, },
"desc": { "desc": {
Type: schema.TypeString, Type: schema.TypeString,
Computed: true, Computed: true,
}, },
"dp_api_user": { "dp_api_user": {
Type: schema.TypeString, Type: schema.TypeString,
Computed: true, Computed: true,
}, },
"extnet_id": { "extnet_id": {
Type: schema.TypeInt, Type: schema.TypeInt,
Computed: true, Computed: true,
}, },
"frontend_haip": { "frontend_haip": {
Type: schema.TypeString, Type: schema.TypeString,
Computed: true, Computed: true,
}, },
"frontends": { "frontends": {
Type: schema.TypeList, Type: schema.TypeList,
Computed: true, Computed: true,
Elem: &schema.Resource{ Elem: &schema.Resource{
Schema: map[string]*schema.Schema{ Schema: map[string]*schema.Schema{
"backend": { "backend": {
Type: schema.TypeString, Type: schema.TypeString,
Computed: true, Computed: true,
}, },
"bindings": { "bindings": {
Type: schema.TypeList, Type: schema.TypeList,
Computed: true, Computed: true,
Elem: &schema.Resource{ Elem: &schema.Resource{
Schema: map[string]*schema.Schema{ Schema: map[string]*schema.Schema{
"address": { "address": {
Type: schema.TypeString, Type: schema.TypeString,
Computed: true, Computed: true,
}, },
"guid": { "guid": {
Type: schema.TypeString, Type: schema.TypeString,
Computed: true, Computed: true,
}, },
"name": { "name": {
Type: schema.TypeString, Type: schema.TypeString,
Computed: true, Computed: true,
}, },
"port": { "port": {
Type: schema.TypeInt, Type: schema.TypeInt,
Computed: true, Computed: true,
}, },
}, },
}, },
}, },
"guid": { "guid": {
Type: schema.TypeString, Type: schema.TypeString,
Computed: true, Computed: true,
}, },
"name": { "name": {
Type: schema.TypeString, Type: schema.TypeString,
Computed: true, Computed: true,
}, },
}, },
}, },
}, },
"gid": { "gid": {
Type: schema.TypeInt, Type: schema.TypeInt,
Computed: true, Computed: true,
}, },
"guid": { "guid": {
Type: schema.TypeInt, Type: schema.TypeInt,
Computed: true, Computed: true,
}, },
"lb_id": { "lb_id": {
Type: schema.TypeInt, Type: schema.TypeInt,
Computed: true, Computed: true,
}, },
"manager_id": { "manager_id": {
Type: schema.TypeInt, Type: schema.TypeInt,
Computed: true, Computed: true,
}, },
"manager_type": { "manager_type": {
Type: schema.TypeString, Type: schema.TypeString,
Computed: true, Computed: true,
}, },
"image_id": { "image_id": {
Type: schema.TypeInt, Type: schema.TypeInt,
Computed: true, Computed: true,
}, },
"milestones": { "milestones": {
Type: schema.TypeInt, Type: schema.TypeInt,
Computed: true, Computed: true,
}, },
"name": { "name": {
Type: schema.TypeString, Type: schema.TypeString,
Computed: true, Computed: true,
}, },
"part_k8s": { "part_k8s": {
Type: schema.TypeBool, Type: schema.TypeBool,
Computed: true, Computed: true,
}, },
"primary_node": { "primary_node": {
Type: schema.TypeList, Type: schema.TypeList,
Computed: true, Computed: true,
Elem: &schema.Resource{ Elem: &schema.Resource{
Schema: map[string]*schema.Schema{ Schema: map[string]*schema.Schema{
"backend_ip": { "backend_ip": {
Type: schema.TypeString, Type: schema.TypeString,
Computed: true, Computed: true,
}, },
"compute_id": { "compute_id": {
Type: schema.TypeInt, Type: schema.TypeInt,
Computed: true, Computed: true,
}, },
"frontend_ip": { "frontend_ip": {
Type: schema.TypeString, Type: schema.TypeString,
Computed: true, Computed: true,
}, },
"guid": { "guid": {
Type: schema.TypeString, Type: schema.TypeString,
Computed: true, Computed: true,
}, },
"mgmt_ip": { "mgmt_ip": {
Type: schema.TypeString, Type: schema.TypeString,
Computed: true, Computed: true,
}, },
"network_id": { "network_id": {
Type: schema.TypeInt, Type: schema.TypeInt,
Computed: true, Computed: true,
}, },
}, },
}, },
}, },
"rg_id": { "rg_id": {
Type: schema.TypeInt, Type: schema.TypeInt,
Computed: true, Computed: true,
}, },
"rg_name": { "rg_name": {
Type: schema.TypeString, Type: schema.TypeString,
Computed: true, Computed: true,
}, },
"secondary_node": { "secondary_node": {
Type: schema.TypeList, Type: schema.TypeList,
Computed: true, Computed: true,
Elem: &schema.Resource{ Elem: &schema.Resource{
Schema: map[string]*schema.Schema{ Schema: map[string]*schema.Schema{
"backend_ip": { "backend_ip": {
Type: schema.TypeString, Type: schema.TypeString,
Computed: true, Computed: true,
}, },
"compute_id": { "compute_id": {
Type: schema.TypeInt, Type: schema.TypeInt,
Computed: true, Computed: true,
}, },
"frontend_ip": { "frontend_ip": {
Type: schema.TypeString, Type: schema.TypeString,
Computed: true, Computed: true,
}, },
"guid": { "guid": {
Type: schema.TypeString, Type: schema.TypeString,
Computed: true, Computed: true,
}, },
"mgmt_ip": { "mgmt_ip": {
Type: schema.TypeString, Type: schema.TypeString,
Computed: true, Computed: true,
}, },
"network_id": { "network_id": {
Type: schema.TypeInt, Type: schema.TypeInt,
Computed: true, Computed: true,
}, },
}, },
}, },
}, },
"status": { "status": {
Type: schema.TypeString, Type: schema.TypeString,
Computed: true, Computed: true,
}, },
"tech_status": { "tech_status": {
Type: schema.TypeString, Type: schema.TypeString,
Computed: true, Computed: true,
}, },
"updated_by": { "updated_by": {
Type: schema.TypeString, Type: schema.TypeString,
Computed: true, Computed: true,
}, },
"updated_time": { "updated_time": {
Type: schema.TypeInt, Type: schema.TypeInt,
Computed: true, Computed: true,
}, },
"user_managed": { "user_managed": {
Type: schema.TypeBool, Type: schema.TypeBool,
Computed: true, Computed: true,
}, },
"vins_id": { "vins_id": {
Type: schema.TypeInt, Type: schema.TypeInt,
Computed: true, Computed: true,
}, },
} }
} }

View File

@@ -1,36 +1,36 @@
/* /*
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved. 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> 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.
You may obtain a copy of the License at You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package locations package locations
type Location struct { type Location struct {
GridID int `json:"gid"` GridID int `json:"gid"`
Id int `json:"id"` Id int `json:"id"`
Guid int `json:"guid"` Guid int `json:"guid"`
LocationCode string `json:"locationCode"` LocationCode string `json:"locationCode"`
Name string `json:"name"` Name string `json:"name"`
NetworkModes []string `json:"network_modes"` NetworkModes []string `json:"network_modes"`
SDNSupport bool `json:"sdn_support"` SDNSupport bool `json:"sdn_support"`
Flag string `json:"flag"` Flag string `json:"flag"`
Meta []interface{} `json:"_meta"` Meta []interface{} `json:"_meta"`
CKey string `json:"_ckey"` CKey string `json:"_ckey"`
} }
type LocationsList []Location type LocationsList []Location

View File

@@ -352,8 +352,8 @@ func flattenRgListComputes(lc *rg.ListComputes) []map[string]interface{} {
"status": compute.Status, "status": compute.Status,
"tech_status": compute.TechStatus, "tech_status": compute.TechStatus,
"total_disks_size": compute.TotalDisksSize, "total_disks_size": compute.TotalDisksSize,
"updated_by": compute.DeletedBy, "updated_by": compute.UpdatedBy,
"updated_time": compute.DeletedTime, "updated_time": compute.UpdatedTime,
"user_managed": compute.UserManaged, "user_managed": compute.UserManaged,
"vins_connected": compute.VINSConnected, "vins_connected": compute.VINSConnected,
} }

View File

@@ -128,8 +128,12 @@ func resourceResgroupCreate(ctx context.Context, d *schema.ResourceData, m inter
} }
} }
} }
if defNetType, ok := d.GetOk("def_net_type"); ok { if _, ok := d.GetOk("def_net"); !ok {
req.DefNet = defNetType.(string) // NOTE: in API default network type is set by "def_net" parameter if defNetType, ok := d.GetOk("def_net_type"); ok {
req.DefNet = defNetType.(string) // NOTE: in API default network type is set by "def_net" parameter
}
} else {
req.DefNet = "NONE"
} }
if owner, ok := d.GetOk("owner"); ok { if owner, ok := d.GetOk("owner"); ok {

View File

@@ -60,7 +60,7 @@ func dataSourceZoneSchemaMake() map[string]*schema.Schema {
}, },
"auto_start": { "auto_start": {
Type: schema.TypeBool, Type: schema.TypeBool,
Required: true, Computed: true,
}, },
"guid": { "guid": {
Type: schema.TypeInt, Type: schema.TypeInt,

View File

@@ -1,91 +1,91 @@
/* /*
Copyright (c) 2019-2024 Digital Energy Cloud Solutions LLC. All Rights Reserved. Copyright (c) 2019-2024 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> 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.
You may obtain a copy of the License at You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. 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://repository.basistech.ru/BASIS/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://repository.basistech.ru/BASIS/terraform-provider-decort/wiki Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
*/ */
package zone package zone
import ( import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/zone" "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/zone"
) )
func flattenZone(d *schema.ResourceData, item *zone.RecordZone) error { func flattenZone(d *schema.ResourceData, item *zone.RecordZone) error {
log.Debugf("flattenZone: start decoding RecordZone name %q / ID %d", log.Debugf("flattenZone: start decoding RecordZone name %q / ID %d",
item.Name, item.ID) item.Name, item.ID)
d.Set("zone_id", int(item.ID)) d.Set("zone_id", int(item.ID))
d.Set("guid", int(item.GUID)) d.Set("guid", int(item.GUID))
d.Set("gid", int(item.GID)) d.Set("gid", int(item.GID))
d.Set("name", item.Name) d.Set("name", item.Name)
d.Set("description", item.Description) d.Set("description", item.Description)
d.Set("deletable", item.Deletable) d.Set("deletable", item.Deletable)
d.Set("status", item.Status) d.Set("status", item.Status)
d.Set("created_time", item.CreatedTime) d.Set("created_time", item.CreatedTime)
d.Set("updated_time", item.UpdatedTime) d.Set("updated_time", item.UpdatedTime)
d.Set("node_ids", item.NodeIDs) d.Set("node_ids", item.NodeIDs)
d.Set("account_ids", item.AccountIDs) d.Set("account_ids", item.AccountIDs)
d.Set("compute_ids", item.ComputeIDs) d.Set("compute_ids", item.ComputeIDs)
d.Set("extnet_ids", item.ExtnetIDs) d.Set("extnet_ids", item.ExtnetIDs)
d.Set("vins_ids", item.VinsIDs) d.Set("vins_ids", item.VinsIDs)
d.Set("lb_ids", item.LBIDs) d.Set("lb_ids", item.LBIDs)
d.Set("bservice_ids", item.BserviceIDs) d.Set("bservice_ids", item.BserviceIDs)
d.Set("k8s_ids", item.K8SIDs) d.Set("k8s_ids", item.K8SIDs)
d.Set("auto_start", item.AutoStart) d.Set("auto_start", item.AutoStart)
log.Debugf("flattenZone: decoded RecordZone name %q / ID %d, complete", log.Debugf("flattenZone: decoded RecordZone name %q / ID %d, complete",
item.Name, item.ID) item.Name, item.ID)
return nil return nil
} }
func flattenZoneList(zone *zone.ListZones) []map[string]interface{} { func flattenZoneList(zone *zone.ListZones) []map[string]interface{} {
log.Debugf("flattenZoneList start") log.Debugf("flattenZoneList start")
res := make([]map[string]interface{}, 0, len(zone.Data)) res := make([]map[string]interface{}, 0, len(zone.Data))
for _, zone := range zone.Data { for _, zone := range zone.Data {
temp := map[string]interface{}{ temp := map[string]interface{}{
"zone_id": int(zone.ID), "zone_id": int(zone.ID),
"guid": int(zone.GUID), "guid": int(zone.GUID),
"gid": int(zone.GID), "gid": int(zone.GID),
"name": zone.Name, "name": zone.Name,
"description": zone.Description, "description": zone.Description,
"deletable": zone.Deletable, "deletable": zone.Deletable,
"status": zone.Status, "status": zone.Status,
"created_time": zone.CreatedTime, "created_time": zone.CreatedTime,
"updated_time": zone.UpdatedTime, "updated_time": zone.UpdatedTime,
"node_ids": zone.NodeIDs, "node_ids": zone.NodeIDs,
"auto_start": zone.AutoStart, "auto_start": zone.AutoStart,
} }
res = append(res, temp) res = append(res, temp)
} }
log.Debugf("flattenZoneList end") log.Debugf("flattenZoneList end")
return res return res
} }

View File

@@ -1,62 +1,62 @@
/* /*
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved. 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> 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.
You may obtain a copy of the License at You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. 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://repository.basistech.ru/BASIS/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://repository.basistech.ru/BASIS/terraform-provider-decort/wiki Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
*/ */
package zone package zone
import ( import (
"context" "context"
"strconv" "strconv"
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/zone" "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/zone"
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller" "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 utilityZoneCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (*zone.RecordZone, error) { func utilityZoneCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (*zone.RecordZone, error) {
c := m.(*controller.ControllerCfg) c := m.(*controller.ControllerCfg)
req := zone.GetRequest{} req := zone.GetRequest{}
if d.Id() != "" { if d.Id() != "" {
zoneId, _ := strconv.ParseUint(d.Id(), 10, 64) zoneId, _ := strconv.ParseUint(d.Id(), 10, 64)
req.ID = zoneId req.ID = zoneId
} else { } else {
req.ID = uint64(d.Get("zone_id").(int)) req.ID = uint64(d.Get("zone_id").(int))
} }
zoneData, err := c.CloudAPI().Zone().Get(ctx, req) zoneData, err := c.CloudAPI().Zone().Get(ctx, req)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return zoneData, nil return zoneData, nil
} }

View File

@@ -1,85 +1,85 @@
/* /*
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved. 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> 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.
You may obtain a copy of the License at You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. 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://repository.basistech.ru/BASIS/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://repository.basistech.ru/BASIS/terraform-provider-decort/wiki Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
*/ */
package zone package zone
import ( import (
"context" "context"
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/zone" "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/zone"
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller" "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 utilityZoneListCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (*zone.ListZones, error) { func utilityZoneListCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (*zone.ListZones, error) {
c := m.(*controller.ControllerCfg) c := m.(*controller.ControllerCfg)
req := zone.ListRequest{} req := zone.ListRequest{}
if byId, ok := d.GetOk("by_id"); ok { if byId, ok := d.GetOk("by_id"); ok {
req.ByID = uint64(byId.(int)) req.ByID = uint64(byId.(int))
} }
if gid, ok := d.GetOk("gid"); ok { if gid, ok := d.GetOk("gid"); ok {
req.GID = uint64(gid.(int)) req.GID = uint64(gid.(int))
} }
if name, ok := d.GetOk("name"); ok { if name, ok := d.GetOk("name"); ok {
req.Name = name.(string) req.Name = name.(string)
} }
if description, ok := d.GetOk("description"); ok { if description, ok := d.GetOk("description"); ok {
req.Description = description.(string) req.Description = description.(string)
} }
if status, ok := d.GetOk("status"); ok { if status, ok := d.GetOk("status"); ok {
req.Status = status.(string) req.Status = status.(string)
} }
if deletable, ok := d.GetOk("deletable"); ok { if deletable, ok := d.GetOk("deletable"); ok {
req.Deletable = deletable.(bool) req.Deletable = deletable.(bool)
} }
if nodeID, ok := d.GetOk("nodeId"); ok { if nodeID, ok := d.GetOk("nodeId"); ok {
req.NodeID = uint64(nodeID.(int)) req.NodeID = uint64(nodeID.(int))
} }
if sortBy, ok := d.GetOk("sort_by"); ok { if sortBy, ok := d.GetOk("sort_by"); ok {
req.SortBy = sortBy.(string) req.SortBy = sortBy.(string)
} }
if size, ok := d.GetOk("size"); ok { if size, ok := d.GetOk("size"); ok {
req.Size = uint64(size.(int)) req.Size = uint64(size.(int))
} }
if page, ok := d.GetOk("page"); ok { if page, ok := d.GetOk("page"); ok {
req.Page = uint64(page.(int)) req.Page = uint64(page.(int))
} }
zoneList, err := c.CloudAPI().Zone().List(ctx, req) zoneList, err := c.CloudAPI().Zone().List(ctx, req)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return zoneList, nil return zoneList, nil
} }

View File

@@ -1466,14 +1466,14 @@ func resourceK8sCPSchemaMake() map[string]*schema.Schema {
Optional: true, Optional: true,
Description: "insert ssl certificate in x509 pem format", Description: "insert ssl certificate in x509 pem format",
}, },
"chipset": { "chipset": {
Type: schema.TypeString, Type: schema.TypeString,
Optional: true, Optional: true,
ValidateFunc: validation.StringInSlice([]string{"Q35", "i440fx"}, false), ValidateFunc: validation.StringInSlice([]string{"Q35", "i440fx"}, false),
Default: "Q35", Default: "Q35",
Description: "Type of the emulated system. Possible values: i440fx, Q35. Default: Q35", Description: "Type of the emulated system. Possible values: i440fx, Q35. Default: Q35",
}, },
"lb_sysctl_params": { "lb_sysctl_params": {
Type: schema.TypeList, Type: schema.TypeList,
Optional: true, Optional: true,
Description: "Custom sysctl values for Load Balancer instance. Applied on boot.", Description: "Custom sysctl values for Load Balancer instance. Applied on boot.",
@@ -1810,19 +1810,19 @@ func resourceK8sWgSchemaMake() map[string]*schema.Schema {
), ),
Description: "Node RAM in MB.", Description: "Node RAM in MB.",
}, },
"chipset": { "chipset": {
Type: schema.TypeString, Type: schema.TypeString,
Optional: true, Optional: true,
ValidateFunc: validation.StringInSlice([]string{"Q35", "i440fx"}, false), ValidateFunc: validation.StringInSlice([]string{"Q35", "i440fx"}, false),
Default: "Q35", Default: "Q35",
Description: "Type of the emulated system. Possible values: i440fx, Q35. Default: Q35", Description: "Type of the emulated system. Possible values: i440fx, Q35. Default: Q35",
}, },
"disk": { "disk": {
Type: schema.TypeInt, Type: schema.TypeInt,
Optional: true, Optional: true,
Computed: true, Computed: true,
Description: "Worker node boot disk size. If unspecified or 0, size is defined by OS image size.", Description: "Worker node boot disk size. If unspecified or 0, size is defined by OS image size.",
}, },
"labels": { "labels": {
Type: schema.TypeList, Type: schema.TypeList,
Computed: true, Computed: true,

View File

@@ -110,6 +110,9 @@ func flattenCompute(d *schema.ResourceData, computeRec *compute.RecordCompute, p
d.Set("network_interface_naming", computeRec.NetworkInterfaceNaming) d.Set("network_interface_naming", computeRec.NetworkInterfaceNaming)
d.Set("zone_id", computeRec.ZoneID) d.Set("zone_id", computeRec.ZoneID)
d.Set("os_version", computeRec.OSVersion) d.Set("os_version", computeRec.OSVersion)
d.Set("cpu_pin", computeRec.CPUPin)
d.Set("numa_affinity", computeRec.NumaAffinity)
d.Set("hp_backed", computeRec.HPBacked)
return nil return nil
} }

View File

@@ -3531,22 +3531,22 @@ func resourceComputeSchemaMake() map[string]*schema.Schema {
DiffSuppressFunc: networkSubresIPAddreDiffSupperss, DiffSuppressFunc: networkSubresIPAddreDiffSupperss,
Description: "unique_identifier of LogicalPort on SDN side", Description: "unique_identifier of LogicalPort on SDN side",
}, },
"enabled": { "enabled": {
Type: schema.TypeBool, Type: schema.TypeBool,
Optional: true, Optional: true,
Computed: true, Computed: true,
Description: "network enable flag", Description: "network enable flag",
}, },
"net_mask": { "net_mask": {
Type: schema.TypeInt, Type: schema.TypeInt,
Optional: true, Optional: true,
Computed: true, Computed: true,
Description: "Subnet mask, used only for DPDK and VFNIC network types", Description: "Subnet mask, used only for DPDK and VFNIC network types",
},
}, },
}, },
Description: "Optional network connection(s) for this compute. You may specify several network blocks, one for each connection.",
}, },
Description: "Optional network connection(s) for this compute. You may specify several network blocks, one for each connection.",
},
"libvirt_settings": { "libvirt_settings": {
Type: schema.TypeSet, Type: schema.TypeSet,

View File

@@ -105,8 +105,12 @@ func resourceResgroupCreate(ctx context.Context, d *schema.ResourceData, m inter
req.Owner = owner.(string) req.Owner = owner.(string)
} }
if defNetType, ok := d.GetOk("def_net_type"); ok { if _, ok := d.GetOk("def_net"); !ok {
req.DefNet = defNetType.(string) if defNetType, ok := d.GetOk("def_net_type"); ok {
req.DefNet = defNetType.(string)
}
} else {
req.DefNet = "NONE"
} }
if description, ok := d.GetOk("description"); ok { if description, ok := d.GetOk("description"); ok {

View File

@@ -1,91 +1,91 @@
/* /*
Copyright (c) 2019-2024 Digital Energy Cloud Solutions LLC. All Rights Reserved. Copyright (c) 2019-2024 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> 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.
You may obtain a copy of the License at You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. 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://repository.basistech.ru/BASIS/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://repository.basistech.ru/BASIS/terraform-provider-decort/wiki Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
*/ */
package zone package zone
import ( import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/zone" "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/zone"
) )
func flattenZone(d *schema.ResourceData, item *zone.RecordZone) error { func flattenZone(d *schema.ResourceData, item *zone.RecordZone) error {
log.Debugf("flattenZone: start decoding RecordZone name %q / ID %d", log.Debugf("flattenZone: start decoding RecordZone name %q / ID %d",
item.Name, item.ID) item.Name, item.ID)
d.Set("zone_id", int(item.ID)) d.Set("zone_id", int(item.ID))
d.Set("guid", int(item.GUID)) d.Set("guid", int(item.GUID))
d.Set("gid", int(item.GID)) d.Set("gid", int(item.GID))
d.Set("name", item.Name) d.Set("name", item.Name)
d.Set("description", item.Description) d.Set("description", item.Description)
d.Set("deletable", item.Deletable) d.Set("deletable", item.Deletable)
d.Set("status", item.Status) d.Set("status", item.Status)
d.Set("created_time", item.CreatedTime) d.Set("created_time", item.CreatedTime)
d.Set("updated_time", item.UpdatedTime) d.Set("updated_time", item.UpdatedTime)
d.Set("node_ids", item.NodeIDs) d.Set("node_ids", item.NodeIDs)
d.Set("account_ids", item.AccountIDs) d.Set("account_ids", item.AccountIDs)
d.Set("compute_ids", item.ComputeIDs) d.Set("compute_ids", item.ComputeIDs)
d.Set("extnet_ids", item.ExtnetIDs) d.Set("extnet_ids", item.ExtnetIDs)
d.Set("vins_ids", item.VinsIDs) d.Set("vins_ids", item.VinsIDs)
d.Set("lb_ids", item.LBIDs) d.Set("lb_ids", item.LBIDs)
d.Set("bservice_ids", item.BserviceIDs) d.Set("bservice_ids", item.BserviceIDs)
d.Set("k8s_ids", item.K8SIDs) d.Set("k8s_ids", item.K8SIDs)
d.Set("auto_start", item.AutoStart) d.Set("auto_start", item.AutoStart)
log.Debugf("flattenZone: decoded RecordZone name %q / ID %d, complete", log.Debugf("flattenZone: decoded RecordZone name %q / ID %d, complete",
item.Name, item.ID) item.Name, item.ID)
return nil return nil
} }
func flattenZoneList(zone *zone.ListZones) []map[string]interface{} { func flattenZoneList(zone *zone.ListZones) []map[string]interface{} {
log.Debugf("flattenZoneList start") log.Debugf("flattenZoneList start")
res := make([]map[string]interface{}, 0, len(zone.Data)) res := make([]map[string]interface{}, 0, len(zone.Data))
for _, zone := range zone.Data { for _, zone := range zone.Data {
temp := map[string]interface{}{ temp := map[string]interface{}{
"zone_id": int(zone.ID), "zone_id": int(zone.ID),
"guid": int(zone.GUID), "guid": int(zone.GUID),
"gid": int(zone.GID), "gid": int(zone.GID),
"name": zone.Name, "name": zone.Name,
"description": zone.Description, "description": zone.Description,
"deletable": zone.Deletable, "deletable": zone.Deletable,
"status": zone.Status, "status": zone.Status,
"created_time": zone.CreatedTime, "created_time": zone.CreatedTime,
"updated_time": zone.UpdatedTime, "updated_time": zone.UpdatedTime,
"node_ids": zone.NodeIDs, "node_ids": zone.NodeIDs,
"auto_start": zone.AutoStart, "auto_start": zone.AutoStart,
} }
res = append(res, temp) res = append(res, temp)
} }
log.Debugf("flattenZoneList end") log.Debugf("flattenZoneList end")
return res return res
} }

View File

@@ -1,159 +1,159 @@
/* /*
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved. 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> 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.
You may obtain a copy of the License at You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. 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://repository.basistech.ru/BASIS/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://repository.basistech.ru/BASIS/terraform-provider-decort/wiki Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
*/ */
package zone package zone
import ( import (
"context" "context"
"strconv" "strconv"
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/zone" "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/zone"
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller" "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"
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
) )
func utilityZoneCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (*zone.RecordZone, error) { func utilityZoneCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (*zone.RecordZone, error) {
c := m.(*controller.ControllerCfg) c := m.(*controller.ControllerCfg)
req := zone.GetRequest{} req := zone.GetRequest{}
if d.Id() != "" { if d.Id() != "" {
zoneId, _ := strconv.ParseUint(d.Id(), 10, 64) zoneId, _ := strconv.ParseUint(d.Id(), 10, 64)
req.ID = zoneId req.ID = zoneId
} else { } else {
req.ID = uint64(d.Get("zone_id").(int)) req.ID = uint64(d.Get("zone_id").(int))
} }
zoneData, err := c.CloudBroker().Zone().Get(ctx, req) zoneData, err := c.CloudBroker().Zone().Get(ctx, req)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return zoneData, nil return zoneData, nil
} }
func utilityZoneUpdate(ctx context.Context, d *schema.ResourceData, m interface{}, zoneID uint64) error { func utilityZoneUpdate(ctx context.Context, d *schema.ResourceData, m interface{}, zoneID uint64) error {
c := m.(*controller.ControllerCfg) c := m.(*controller.ControllerCfg)
if d.HasChanges("name", "description", "auto_start") { if d.HasChanges("name", "description", "auto_start") {
req := zone.UpdateRequest{ req := zone.UpdateRequest{
ID: zoneID, ID: zoneID,
} }
if d.HasChange("name") { if d.HasChange("name") {
req.Name = d.Get("name").(string) req.Name = d.Get("name").(string)
} }
if d.HasChange("description") { if d.HasChange("description") {
req.Description = d.Get("description").(string) req.Description = d.Get("description").(string)
} }
if d.HasChange("auto_start") { if d.HasChange("auto_start") {
req.AutoStart = d.Get("auto_start").(bool) req.AutoStart = d.Get("auto_start").(bool)
} }
_, err := c.CloudBroker().Zone().Update(ctx, req) _, err := c.CloudBroker().Zone().Update(ctx, req)
if err != nil { if err != nil {
return err return err
} }
log.Debugf("utilityZoneUpdate: update zone with ID: %d, complete with params=%v", zoneID, req) log.Debugf("utilityZoneUpdate: update zone with ID: %d, complete with params=%v", zoneID, req)
} }
addedNodes := make([]interface{}, 0) addedNodes := make([]interface{}, 0)
removedNodes := make([]interface{}, 0) removedNodes := make([]interface{}, 0)
old_set, new_set := d.GetChange("node_ids") old_set, new_set := d.GetChange("node_ids")
oldSlice := old_set.([]interface{}) oldSlice := old_set.([]interface{})
newSlice := new_set.([]interface{}) newSlice := new_set.([]interface{})
for _, oldElem := range oldSlice { for _, oldElem := range oldSlice {
if !containsNodes(newSlice, oldElem) { if !containsNodes(newSlice, oldElem) {
removedNodes = append(removedNodes, oldElem) removedNodes = append(removedNodes, oldElem)
} }
} }
for _, newElem := range newSlice { for _, newElem := range newSlice {
if !containsNodes(oldSlice, newElem) { if !containsNodes(oldSlice, newElem) {
addedNodes = append(addedNodes, newElem) addedNodes = append(addedNodes, newElem)
} }
} }
log.Debugf("Found node_ids change with %v deletion(s) and %v addition(s) [zoneID=%v]", len(removedNodes), len(addedNodes), zoneID) log.Debugf("Found node_ids change with %v deletion(s) and %v addition(s) [zoneID=%v]", len(removedNodes), len(addedNodes), zoneID)
if len(addedNodes) > 0 { if len(addedNodes) > 0 {
addedUint := make([]uint64, len(addedNodes)) addedUint := make([]uint64, len(addedNodes))
for i, v := range addedNodes { for i, v := range addedNodes {
addedUint[i] = uint64(v.(int)) addedUint[i] = uint64(v.(int))
} }
req := zone.AddNodeRequest{ req := zone.AddNodeRequest{
ID: zoneID, ID: zoneID,
NodeIDs: addedUint, NodeIDs: addedUint,
} }
if _, err := c.CloudBroker().Zone().AddNode(ctx, req); err != nil { if _, err := c.CloudBroker().Zone().AddNode(ctx, req); err != nil {
return err return err
} }
} }
if len(removedNodes) > 0 { if len(removedNodes) > 0 {
removedUint := make([]uint64, len(removedNodes)) removedUint := make([]uint64, len(removedNodes))
for i, v := range removedNodes { for i, v := range removedNodes {
removedUint[i] = uint64(v.(int)) removedUint[i] = uint64(v.(int))
} }
req := zone.DelNodeRequest{ req := zone.DelNodeRequest{
ID: zoneID, ID: zoneID,
NodeIDs: removedUint, NodeIDs: removedUint,
} }
log.Debug("del") log.Debug("del")
log.Debug(req.NodeIDs) log.Debug(req.NodeIDs)
if _, err := c.CloudBroker().Zone().DelNode(ctx, req); err != nil { if _, err := c.CloudBroker().Zone().DelNode(ctx, req); err != nil {
return err return err
} }
} }
return nil return nil
} }
func containsNodes(set []interface{}, check interface{}) bool { func containsNodes(set []interface{}, check interface{}) bool {
for _, elem := range set { for _, elem := range set {
elemConv := elem.(int) elemConv := elem.(int)
checkConv := check.(int) checkConv := check.(int)
if elemConv == checkConv { if elemConv == checkConv {
return true return true
} }
} }
return false return false
} }

View File

@@ -1,85 +1,85 @@
/* /*
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved. 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> 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.
You may obtain a copy of the License at You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. 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://repository.basistech.ru/BASIS/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://repository.basistech.ru/BASIS/terraform-provider-decort/wiki Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
*/ */
package zone package zone
import ( import (
"context" "context"
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/zone" "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/zone"
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller" "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 utilityZoneListCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (*zone.ListZones, error) { func utilityZoneListCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (*zone.ListZones, error) {
c := m.(*controller.ControllerCfg) c := m.(*controller.ControllerCfg)
req := zone.ListRequest{} req := zone.ListRequest{}
if byId, ok := d.GetOk("by_id"); ok { if byId, ok := d.GetOk("by_id"); ok {
req.ByID = uint64(byId.(int)) req.ByID = uint64(byId.(int))
} }
if gid, ok := d.GetOk("gid"); ok { if gid, ok := d.GetOk("gid"); ok {
req.GID = uint64(gid.(int)) req.GID = uint64(gid.(int))
} }
if name, ok := d.GetOk("name"); ok { if name, ok := d.GetOk("name"); ok {
req.Name = name.(string) req.Name = name.(string)
} }
if description, ok := d.GetOk("description"); ok { if description, ok := d.GetOk("description"); ok {
req.Description = description.(string) req.Description = description.(string)
} }
if status, ok := d.GetOk("status"); ok { if status, ok := d.GetOk("status"); ok {
req.Status = status.(string) req.Status = status.(string)
} }
if deletable, ok := d.GetOk("deletable"); ok { if deletable, ok := d.GetOk("deletable"); ok {
req.Deletable = deletable.(bool) req.Deletable = deletable.(bool)
} }
if nodeID, ok := d.GetOk("nodeId"); ok { if nodeID, ok := d.GetOk("nodeId"); ok {
req.NodeID = uint64(nodeID.(int)) req.NodeID = uint64(nodeID.(int))
} }
if sortBy, ok := d.GetOk("sort_by"); ok { if sortBy, ok := d.GetOk("sort_by"); ok {
req.SortBy = sortBy.(string) req.SortBy = sortBy.(string)
} }
if size, ok := d.GetOk("size"); ok { if size, ok := d.GetOk("size"); ok {
req.Size = uint64(size.(int)) req.Size = uint64(size.(int))
} }
if page, ok := d.GetOk("page"); ok { if page, ok := d.GetOk("page"); ok {
req.Page = uint64(page.(int)) req.Page = uint64(page.(int))
} }
zoneList, err := c.CloudBroker().Zone().List(ctx, req) zoneList, err := c.CloudBroker().Zone().List(ctx, req)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return zoneList, nil return zoneList, nil
} }

View File

@@ -37,4 +37,3 @@ func DataSourceAccessGroupList() *schema.Resource {
Schema: dataSourceAccessGroupListSchemaMake(), Schema: dataSourceAccessGroupListSchemaMake(),
} }
} }

View File

@@ -49,4 +49,3 @@ func utilityAccessGroupListCheckPresence(ctx context.Context, d *schema.Resource
return accessGroupList, nil return accessGroupList, nil
} }

View File

@@ -37,4 +37,3 @@ func DataSourceDefaultSecurityPolicyList() *schema.Resource {
Schema: dataSourceDefaultSecurityPolicyListSchemaMake(), Schema: dataSourceDefaultSecurityPolicyListSchemaMake(),
} }
} }

View File

@@ -366,4 +366,3 @@ func dataSourceDefaultSecurityPolicyListSchemaMake() map[string]*schema.Schema {
return res return res
} }

View File

@@ -37,4 +37,3 @@ func utilityDefaultSecurityPolicyListCheckPresence(ctx context.Context, d *schem
return defaultSecurityPolicyList, nil return defaultSecurityPolicyList, nil
} }

View File

@@ -52,7 +52,7 @@ func utilitySegmentListCheckPresence(ctx context.Context, d *schema.ResourceData
if updatedTo, ok := d.GetOk("updated_to"); ok { if updatedTo, ok := d.GetOk("updated_to"); ok {
req.UpdatedTo = updatedTo.(string) req.UpdatedTo = updatedTo.(string)
} }
log.Debugf("utilitySegmentListCheckPresence") log.Debugf("utilitySegmentListCheckPresence")
segmentList, err := c.SDN().Segments().List(ctx, req) segmentList, err := c.SDN().Segments().List(ctx, req)
if err != nil { if err != nil {

View File

@@ -69,15 +69,6 @@ resource "decort_disk" "acl" {
#возможные значенния - "none", "writethrough" #возможные значенния - "none", "writethrough"
#используется при создании и обновлении #используется при создании и обновлении
#shareable = false #shareable = false
#установка режима кэширования
#опциональный параметр
#тип - строка
#возможные значенния - "none", "writethrough"
#значение по умолчанию - none
#используется при создании
#cache = "none"
} }
output "test" { output "test" {

View File

@@ -57,11 +57,6 @@ data "decort_cb_flipgroup_list" "fg" {
#тип - строка #тип - строка
#by_ip = "1.1.1.1.1" #by_ip = "1.1.1.1.1"
#фильтр по id ресурсной группы
#опциональный параметр
#тип - целое число
#rg_id = 11111
#сортировка по одному из поддерживаемых полей #сортировка по одному из поддерживаемых полей
#опциональный параметр #опциональный параметр
#тип - строка #тип - строка