parent
0adf28daf6
commit
be86069155
@ -1,10 +1,33 @@
|
|||||||
### Version 3.2.2
|
### Version 3.3.0
|
||||||
|
|
||||||
### Bug fixes
|
### Bug fixes
|
||||||
|
|
||||||
- Fix bug with getting kvmvm data_source
|
- Fix bug with getting k8s_wg from import
|
||||||
|
- Fix bug with getting k8s from import
|
||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
|
||||||
- Add enable/disable functionality for kvmvm resource
|
- Add data_source k8s
|
||||||
- Add status checker for kvmvm resource
|
- Add data_source k8s_list
|
||||||
|
- Add data_source k8s_list_deleted
|
||||||
|
- Add data_source k8s_wg_list
|
||||||
|
- Add data_source k8s_wg
|
||||||
|
- Add a vins_id to the k8s schema/state
|
||||||
|
- Add a ips from computes to the k8s group workers in schema/state
|
||||||
|
- Add a ips from computes to the k8s masters in schema/state
|
||||||
|
- Add a ips from computes to the k8s_wg in schema/state
|
||||||
|
- Change data_source vins, the schema/state is aligned with the platform
|
||||||
|
- Add data_source vins_audits
|
||||||
|
- Add data_source vins_ext_net_list
|
||||||
|
- Add data_source vins_ip_list
|
||||||
|
- Change data_source vins_list, the schema/state is aligned with the platform
|
||||||
|
- Add data_source vins_list_deleted
|
||||||
|
- Add data_source vins_nat_rule_list
|
||||||
|
- Add status checker for vins resource
|
||||||
|
- Add the ability to create and update ip reservations
|
||||||
|
- Add the ability to create and update nat_rule reservations
|
||||||
|
- Add enable/disable functionality for vins resource
|
||||||
|
- Add the ability to restart vnfDev
|
||||||
|
- Add the ability to redeploy vnfDev
|
||||||
|
- Add the ability to import vins
|
||||||
|
- Add warnings handling, which does not interrupt the work when the state is successfully created
|
||||||
|
@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||||
|
Authors:
|
||||||
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
|
Source code: https://github.com/rudecs/terraform-provider-decort
|
||||||
|
|
||||||
|
Please see README.md to learn where to place source code so that it
|
||||||
|
builds seamlessly.
|
||||||
|
|
||||||
|
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dc
|
||||||
|
|
||||||
|
import "github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
|
|
||||||
|
type Warnings struct {
|
||||||
|
diagnostics diag.Diagnostics
|
||||||
|
}
|
||||||
|
|
||||||
|
func (w *Warnings) Add(err error) {
|
||||||
|
if w.diagnostics == nil {
|
||||||
|
w.diagnostics = diag.Diagnostics{}
|
||||||
|
}
|
||||||
|
diagFromErr := diag.FromErr(err)
|
||||||
|
diagFromErr[0].Severity = diag.Warning
|
||||||
|
w.diagnostics = append(w.diagnostics, diagFromErr[0])
|
||||||
|
}
|
||||||
|
|
||||||
|
func (w Warnings) Get() diag.Diagnostics {
|
||||||
|
return w.diagnostics
|
||||||
|
}
|
@ -0,0 +1,106 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||||
|
Authors:
|
||||||
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
|
Source code: https://github.com/rudecs/terraform-provider-decort
|
||||||
|
|
||||||
|
Please see README.md to learn where to place source code so that it
|
||||||
|
builds seamlessly.
|
||||||
|
|
||||||
|
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
||||||
|
*/
|
||||||
|
|
||||||
|
package vins
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/google/uuid"
|
||||||
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
|
"github.com/rudecs/terraform-provider-decort/internal/constants"
|
||||||
|
)
|
||||||
|
|
||||||
|
func dataSourceVinsAuditsRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
|
audits, err := utilityVinsAuditsCheckPresence(ctx, d, m)
|
||||||
|
if err != nil {
|
||||||
|
return diag.FromErr(err)
|
||||||
|
}
|
||||||
|
id := uuid.New()
|
||||||
|
d.SetId(id.String())
|
||||||
|
d.Set("items", flattenVinsAudits(audits))
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func DataSourceVinsAuditsSchemaMake() map[string]*schema.Schema {
|
||||||
|
rets := map[string]*schema.Schema{
|
||||||
|
"vins_id": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Required: true,
|
||||||
|
Description: "Unique ID of the ViNS. If ViNS ID is specified, then ViNS name, rg_id and account_id are ignored.",
|
||||||
|
},
|
||||||
|
"items": {
|
||||||
|
Type: schema.TypeList,
|
||||||
|
Computed: true,
|
||||||
|
Elem: &schema.Resource{
|
||||||
|
Schema: map[string]*schema.Schema{
|
||||||
|
"call": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"response_time": {
|
||||||
|
Type: schema.TypeFloat,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"statuscode": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"timestamp": {
|
||||||
|
Type: schema.TypeFloat,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"user": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
return rets
|
||||||
|
}
|
||||||
|
|
||||||
|
func DataSourceVinsAudits() *schema.Resource {
|
||||||
|
return &schema.Resource{
|
||||||
|
SchemaVersion: 1,
|
||||||
|
|
||||||
|
ReadContext: dataSourceVinsAuditsRead,
|
||||||
|
|
||||||
|
Timeouts: &schema.ResourceTimeout{
|
||||||
|
Read: &constants.Timeout30s,
|
||||||
|
Default: &constants.Timeout60s,
|
||||||
|
},
|
||||||
|
Schema: DataSourceVinsAuditsSchemaMake(),
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,110 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||||
|
Authors:
|
||||||
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
|
Source code: https://github.com/rudecs/terraform-provider-decort
|
||||||
|
|
||||||
|
Please see README.md to learn where to place source code so that it
|
||||||
|
builds seamlessly.
|
||||||
|
|
||||||
|
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
||||||
|
*/
|
||||||
|
|
||||||
|
package vins
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/google/uuid"
|
||||||
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
|
"github.com/rudecs/terraform-provider-decort/internal/constants"
|
||||||
|
)
|
||||||
|
|
||||||
|
func dataSourceVinsExtNetListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
|
extNetList, err := utilityVinsExtNetListCheckPresence(ctx, d, m)
|
||||||
|
if err != nil {
|
||||||
|
return diag.FromErr(err)
|
||||||
|
}
|
||||||
|
id := uuid.New()
|
||||||
|
d.SetId(id.String())
|
||||||
|
d.Set("items", flattenVinsExtNetList(extNetList))
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func DataSourceVinsExtNetListchemaMake() map[string]*schema.Schema {
|
||||||
|
rets := map[string]*schema.Schema{
|
||||||
|
"vins_id": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Required: true,
|
||||||
|
Description: "Unique ID of the ViNS. If ViNS ID is specified, then ViNS name, rg_id and account_id are ignored.",
|
||||||
|
},
|
||||||
|
"items": {
|
||||||
|
Type: schema.TypeList,
|
||||||
|
Computed: true,
|
||||||
|
Elem: &schema.Resource{
|
||||||
|
Schema: map[string]*schema.Schema{
|
||||||
|
"default_gw": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"ext_net_id": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"ip": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"prefix_len": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"status": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"tech_status": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
return rets
|
||||||
|
}
|
||||||
|
|
||||||
|
func DataSourceVinsExtNetList() *schema.Resource {
|
||||||
|
return &schema.Resource{
|
||||||
|
SchemaVersion: 1,
|
||||||
|
|
||||||
|
ReadContext: dataSourceVinsExtNetListRead,
|
||||||
|
|
||||||
|
Timeouts: &schema.ResourceTimeout{
|
||||||
|
Read: &constants.Timeout30s,
|
||||||
|
Default: &constants.Timeout60s,
|
||||||
|
},
|
||||||
|
Schema: DataSourceVinsExtNetListchemaMake(),
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,114 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||||
|
Authors:
|
||||||
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
|
Source code: https://github.com/rudecs/terraform-provider-decort
|
||||||
|
|
||||||
|
Please see README.md to learn where to place source code so that it
|
||||||
|
builds seamlessly.
|
||||||
|
|
||||||
|
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
||||||
|
*/
|
||||||
|
|
||||||
|
package vins
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/google/uuid"
|
||||||
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
|
"github.com/rudecs/terraform-provider-decort/internal/constants"
|
||||||
|
)
|
||||||
|
|
||||||
|
func dataSourceVinsIpListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
|
ips, err := utilityVinsIpListCheckPresence(ctx, d, m)
|
||||||
|
if err != nil {
|
||||||
|
return diag.FromErr(err)
|
||||||
|
}
|
||||||
|
id := uuid.New()
|
||||||
|
d.SetId(id.String())
|
||||||
|
d.Set("items", flattenVinsIpList(ips))
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func DataSourceVinsIpListSchemaMake() map[string]*schema.Schema {
|
||||||
|
rets := map[string]*schema.Schema{
|
||||||
|
"vins_id": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Required: true,
|
||||||
|
Description: "Unique ID of the ViNS. If ViNS ID is specified, then ViNS name, rg_id and account_id are ignored.",
|
||||||
|
},
|
||||||
|
"items": {
|
||||||
|
Type: schema.TypeList,
|
||||||
|
Computed: true,
|
||||||
|
Elem: &schema.Resource{
|
||||||
|
Schema: map[string]*schema.Schema{
|
||||||
|
"client_type": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"domainname": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"hostname": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"ip": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"mac": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"type": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"vm_id": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
return rets
|
||||||
|
}
|
||||||
|
|
||||||
|
func DataSourceVinsIpList() *schema.Resource {
|
||||||
|
return &schema.Resource{
|
||||||
|
SchemaVersion: 1,
|
||||||
|
|
||||||
|
ReadContext: dataSourceVinsIpListRead,
|
||||||
|
|
||||||
|
Timeouts: &schema.ResourceTimeout{
|
||||||
|
Read: &constants.Timeout30s,
|
||||||
|
Default: &constants.Timeout60s,
|
||||||
|
},
|
||||||
|
Schema: DataSourceVinsIpListSchemaMake(),
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,158 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||||
|
Authors:
|
||||||
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
|
Source code: https://github.com/rudecs/terraform-provider-decort
|
||||||
|
|
||||||
|
Please see README.md to learn where to place source code so that it
|
||||||
|
builds seamlessly.
|
||||||
|
|
||||||
|
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
||||||
|
*/
|
||||||
|
|
||||||
|
package vins
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/google/uuid"
|
||||||
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
|
"github.com/rudecs/terraform-provider-decort/internal/constants"
|
||||||
|
)
|
||||||
|
|
||||||
|
func dataSourceVinsListDeletedRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
|
vinsList, err := utilityVinsListDeletedCheckPresence(ctx, d, m)
|
||||||
|
if err != nil {
|
||||||
|
return diag.FromErr(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
id := uuid.New()
|
||||||
|
d.SetId(id.String())
|
||||||
|
d.Set("items", flattenVinsList(vinsList))
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func dataSourceVinsListDeletedSchemaMake() map[string]*schema.Schema {
|
||||||
|
res := map[string]*schema.Schema{
|
||||||
|
"page": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Optional: true,
|
||||||
|
Description: "Page number",
|
||||||
|
},
|
||||||
|
"size": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Optional: true,
|
||||||
|
Description: "Page size",
|
||||||
|
},
|
||||||
|
"items": {
|
||||||
|
Type: schema.TypeList,
|
||||||
|
Computed: true,
|
||||||
|
Elem: &schema.Resource{
|
||||||
|
Schema: map[string]*schema.Schema{
|
||||||
|
"account_id": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"account_name": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"created_by": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"created_time": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"deleted_by": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"deleted_time": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"external_ip": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"vins_id": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"vins_name": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"network": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"rg_id": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"rg_name": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"status": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"updated_by": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"updated_time": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"vxlan_id": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
func DataSourceVinsListDeleted() *schema.Resource {
|
||||||
|
return &schema.Resource{
|
||||||
|
SchemaVersion: 1,
|
||||||
|
|
||||||
|
ReadContext: dataSourceVinsListDeletedRead,
|
||||||
|
|
||||||
|
Timeouts: &schema.ResourceTimeout{
|
||||||
|
Read: &constants.Timeout30s,
|
||||||
|
Default: &constants.Timeout60s,
|
||||||
|
},
|
||||||
|
|
||||||
|
Schema: dataSourceVinsListDeletedSchemaMake(),
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,118 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||||
|
Authors:
|
||||||
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
|
Source code: https://github.com/rudecs/terraform-provider-decort
|
||||||
|
|
||||||
|
Please see README.md to learn where to place source code so that it
|
||||||
|
builds seamlessly.
|
||||||
|
|
||||||
|
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
||||||
|
*/
|
||||||
|
|
||||||
|
package vins
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/google/uuid"
|
||||||
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
|
"github.com/rudecs/terraform-provider-decort/internal/constants"
|
||||||
|
)
|
||||||
|
|
||||||
|
func dataSourceVinsNatRuleListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||||
|
natRules, err := utilityVinsNatRuleListCheckPresence(ctx, d, m)
|
||||||
|
if err != nil {
|
||||||
|
return diag.FromErr(err)
|
||||||
|
}
|
||||||
|
id := uuid.New()
|
||||||
|
d.SetId(id.String())
|
||||||
|
d.Set("items", flattenVinsNatRuleList(natRules))
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func DataSourceVinsNatRuleListSchemaMake() map[string]*schema.Schema {
|
||||||
|
rets := map[string]*schema.Schema{
|
||||||
|
"vins_id": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Required: true,
|
||||||
|
Description: "Unique ID of the ViNS. If ViNS ID is specified, then ViNS name, rg_id and account_id are ignored.",
|
||||||
|
},
|
||||||
|
"items": {
|
||||||
|
Type: schema.TypeList,
|
||||||
|
Computed: true,
|
||||||
|
Elem: &schema.Resource{
|
||||||
|
Schema: map[string]*schema.Schema{
|
||||||
|
"id": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"local_ip": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"local_port": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"protocol": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"public_port_end": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"public_port_start": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"vm_id": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"vm_name": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
return rets
|
||||||
|
}
|
||||||
|
|
||||||
|
func DataSourceVinsNatRuleList() *schema.Resource {
|
||||||
|
return &schema.Resource{
|
||||||
|
SchemaVersion: 1,
|
||||||
|
|
||||||
|
ReadContext: dataSourceVinsNatRuleListRead,
|
||||||
|
|
||||||
|
Timeouts: &schema.ResourceTimeout{
|
||||||
|
Read: &constants.Timeout30s,
|
||||||
|
Default: &constants.Timeout60s,
|
||||||
|
},
|
||||||
|
Schema: DataSourceVinsNatRuleListSchemaMake(),
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,514 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||||
|
Authors:
|
||||||
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
|
Source code: https://github.com/rudecs/terraform-provider-decort
|
||||||
|
|
||||||
|
Please see README.md to learn where to place source code so that it
|
||||||
|
builds seamlessly.
|
||||||
|
|
||||||
|
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
||||||
|
*/
|
||||||
|
|
||||||
|
package vins
|
||||||
|
|
||||||
|
import "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
|
|
||||||
|
func flattenMGMT(mgmt *VNFConfigMGMT) []map[string]interface{} {
|
||||||
|
res := make([]map[string]interface{}, 0)
|
||||||
|
temp := map[string]interface{}{
|
||||||
|
"ip_addr": mgmt.IPAddr,
|
||||||
|
"password": mgmt.Password,
|
||||||
|
"ssh_key": mgmt.SSHKey,
|
||||||
|
"user": mgmt.User,
|
||||||
|
}
|
||||||
|
res = append(res, temp)
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
func flattenResources(resources *VNFConfigResources) []map[string]interface{} {
|
||||||
|
res := make([]map[string]interface{}, 0)
|
||||||
|
temp := map[string]interface{}{
|
||||||
|
"cpu": resources.CPU,
|
||||||
|
"ram": resources.RAM,
|
||||||
|
"stack_id": resources.StackID,
|
||||||
|
"uuid": resources.UUID,
|
||||||
|
}
|
||||||
|
res = append(res, temp)
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
func flattenConfig(config VNFConfig) []map[string]interface{} {
|
||||||
|
res := make([]map[string]interface{}, 0)
|
||||||
|
temp := map[string]interface{}{
|
||||||
|
"mgmt": flattenMGMT(&config.MGMT),
|
||||||
|
"resources": flattenResources(&config.Resources),
|
||||||
|
}
|
||||||
|
res = append(res, temp)
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
func flattenQOS(qos QOS) []map[string]interface{} {
|
||||||
|
res := make([]map[string]interface{}, 0)
|
||||||
|
temp := map[string]interface{}{
|
||||||
|
"e_rate": qos.ERate,
|
||||||
|
"guid": qos.GUID,
|
||||||
|
"in_brust": qos.InBurst,
|
||||||
|
"in_rate": qos.InRate,
|
||||||
|
}
|
||||||
|
res = append(res, temp)
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
func flattenInterfaces(interfaces VNFInterfaceList) []map[string]interface{} {
|
||||||
|
res := make([]map[string]interface{}, 0)
|
||||||
|
|
||||||
|
for _, vnfInterface := range interfaces {
|
||||||
|
temp := map[string]interface{}{
|
||||||
|
"conn_id": vnfInterface.ConnID,
|
||||||
|
"conn_type": vnfInterface.ConnType,
|
||||||
|
"def_gw": vnfInterface.DefGW,
|
||||||
|
"flipgroup_id": vnfInterface.FlipGroupID,
|
||||||
|
"guid": vnfInterface.GUID,
|
||||||
|
"ip_address": vnfInterface.IPAddress,
|
||||||
|
"listen_ssh": vnfInterface.ListenSSH,
|
||||||
|
"mac": vnfInterface.MAC,
|
||||||
|
"name": vnfInterface.Name,
|
||||||
|
"net_id": vnfInterface.NetID,
|
||||||
|
"net_mask": vnfInterface.NetMask,
|
||||||
|
"net_type": vnfInterface.NetType,
|
||||||
|
"pci_slot": vnfInterface.PCISlot,
|
||||||
|
"qos": flattenQOS(vnfInterface.QOS),
|
||||||
|
"target": vnfInterface.Target,
|
||||||
|
"type": vnfInterface.Type,
|
||||||
|
"vnfs": vnfInterface.VNFS,
|
||||||
|
}
|
||||||
|
res = append(res, temp)
|
||||||
|
}
|
||||||
|
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
func flattenVNFDev(vnfDev VNFDev) []map[string]interface{} {
|
||||||
|
res := make([]map[string]interface{}, 0)
|
||||||
|
temp := map[string]interface{}{
|
||||||
|
"_ckey": vnfDev.CKey,
|
||||||
|
"account_id": vnfDev.AccountID,
|
||||||
|
"capabilities": vnfDev.Capabilities,
|
||||||
|
"config": flattenConfig(vnfDev.Config), //in progress
|
||||||
|
"config_saved": vnfDev.ConfigSaved,
|
||||||
|
"custom_pre_cfg": vnfDev.CustomPreConfig,
|
||||||
|
"desc": vnfDev.Description,
|
||||||
|
"gid": vnfDev.GID,
|
||||||
|
"guid": vnfDev.GUID,
|
||||||
|
"vnf_id": vnfDev.ID,
|
||||||
|
"interfaces": flattenInterfaces(vnfDev.Interfaces),
|
||||||
|
"lock_status": vnfDev.LockStatus,
|
||||||
|
"milestones": vnfDev.Milestones,
|
||||||
|
"vnf_name": vnfDev.Name,
|
||||||
|
"status": vnfDev.Status,
|
||||||
|
"tech_status": vnfDev.TechStatus,
|
||||||
|
"type": vnfDev.Type,
|
||||||
|
"vins": vnfDev.VINS,
|
||||||
|
}
|
||||||
|
|
||||||
|
res = append(res, temp)
|
||||||
|
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
func flattenComputes(computes VINSComputeList) []map[string]interface{} {
|
||||||
|
res := make([]map[string]interface{}, 0)
|
||||||
|
for _, compute := range computes {
|
||||||
|
temp := map[string]interface{}{
|
||||||
|
"compute_id": compute.ID,
|
||||||
|
"compute_name": compute.Name,
|
||||||
|
}
|
||||||
|
res = append(res, temp)
|
||||||
|
}
|
||||||
|
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
func flattenReservations(reservations ReservationList) []map[string]interface{} {
|
||||||
|
res := make([]map[string]interface{}, 0)
|
||||||
|
for _, reservation := range reservations {
|
||||||
|
temp := map[string]interface{}{
|
||||||
|
"client_type": reservation.ClientType,
|
||||||
|
"desc": reservation.Description,
|
||||||
|
"domainname": reservation.DomainName,
|
||||||
|
"hostname": reservation.HostName,
|
||||||
|
"ip": reservation.IP,
|
||||||
|
"mac": reservation.MAC,
|
||||||
|
"type": reservation.Type,
|
||||||
|
"vm_id": reservation.VMID,
|
||||||
|
}
|
||||||
|
res = append(res, temp)
|
||||||
|
}
|
||||||
|
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
func flattenDHCPConfig(config DHCPConfig) []map[string]interface{} {
|
||||||
|
res := make([]map[string]interface{}, 0)
|
||||||
|
temp := map[string]interface{}{
|
||||||
|
"default_gw": config.DefaultGW,
|
||||||
|
"dns": config.DNS,
|
||||||
|
"ip_end": config.IPEnd,
|
||||||
|
"ip_start": config.IPStart,
|
||||||
|
"lease": config.Lease,
|
||||||
|
"netmask": config.Netmask,
|
||||||
|
"network": config.Network,
|
||||||
|
"reservations": flattenReservations(config.Reservations),
|
||||||
|
}
|
||||||
|
res = append(res, temp)
|
||||||
|
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
func flattenPrimary(primary DevicePrimary) []map[string]interface{} {
|
||||||
|
res := make([]map[string]interface{}, 0)
|
||||||
|
temp := map[string]interface{}{
|
||||||
|
"dev_id": primary.DevID,
|
||||||
|
"iface01": primary.IFace01,
|
||||||
|
"iface02": primary.IFace02,
|
||||||
|
}
|
||||||
|
res = append(res, temp)
|
||||||
|
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
func flattenDevices(devices Devices) []map[string]interface{} {
|
||||||
|
res := make([]map[string]interface{}, 0)
|
||||||
|
temp := map[string]interface{}{
|
||||||
|
"primary": flattenPrimary(devices.Primary),
|
||||||
|
}
|
||||||
|
res = append(res, temp)
|
||||||
|
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
func flattenDHCP(dhcp DHCP) []map[string]interface{} {
|
||||||
|
res := make([]map[string]interface{}, 0)
|
||||||
|
temp := map[string]interface{}{
|
||||||
|
"_ckey": dhcp.CKey,
|
||||||
|
"account_id": dhcp.AccountID,
|
||||||
|
"config": flattenDHCPConfig(dhcp.Config),
|
||||||
|
"created_time": dhcp.CreatedTime,
|
||||||
|
"devices": flattenDevices(dhcp.Devices),
|
||||||
|
"gid": dhcp.GID,
|
||||||
|
"guid": dhcp.GUID,
|
||||||
|
"dhcp_id": dhcp.ID,
|
||||||
|
"lock_status": dhcp.LockStatus,
|
||||||
|
"milestones": dhcp.Milestones,
|
||||||
|
"owner_id": dhcp.OwnerID,
|
||||||
|
"owner_type": dhcp.OwnerType,
|
||||||
|
"pure_virtual": dhcp.PureVirtual,
|
||||||
|
"status": dhcp.Status,
|
||||||
|
"tech_status": dhcp.TechStatus,
|
||||||
|
"type": dhcp.Type,
|
||||||
|
}
|
||||||
|
res = append(res, temp)
|
||||||
|
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
func flattenGWConfig(config GWConfig) []map[string]interface{} {
|
||||||
|
res := make([]map[string]interface{}, 0)
|
||||||
|
temp := map[string]interface{}{
|
||||||
|
"default_gw": config.DefaultGW,
|
||||||
|
"ext_net_id": config.ExtNetID,
|
||||||
|
"ext_net_ip": config.ExtNetIP,
|
||||||
|
"ext_netmask": config.ExtNetMask,
|
||||||
|
"qos": flattenQOS(config.QOS),
|
||||||
|
}
|
||||||
|
res = append(res, temp)
|
||||||
|
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
func flattenGW(gw GW) []map[string]interface{} {
|
||||||
|
res := make([]map[string]interface{}, 0)
|
||||||
|
temp := map[string]interface{}{
|
||||||
|
"_ckey": gw.CKey,
|
||||||
|
"account_id": gw.AccountID,
|
||||||
|
"config": flattenGWConfig(gw.Config),
|
||||||
|
"created_time": gw.CreatedTime,
|
||||||
|
"devices": flattenDevices(gw.Devices),
|
||||||
|
"gid": gw.GID,
|
||||||
|
"guid": gw.GUID,
|
||||||
|
"gw_id": gw.ID,
|
||||||
|
"lock_status": gw.LockStatus,
|
||||||
|
"milestones": gw.Milestones,
|
||||||
|
"owner_id": gw.OwnerID,
|
||||||
|
"owner_type": gw.OwnerType,
|
||||||
|
"pure_virtual": gw.PureVirtual,
|
||||||
|
"status": gw.Status,
|
||||||
|
"tech_status": gw.TechStatus,
|
||||||
|
"type": gw.Type,
|
||||||
|
}
|
||||||
|
res = append(res, temp)
|
||||||
|
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
func flattenRules(rules ListNATRules) []map[string]interface{} {
|
||||||
|
res := make([]map[string]interface{}, 0)
|
||||||
|
for _, rule := range rules {
|
||||||
|
tmp := map[string]interface{}{
|
||||||
|
"rule_id": rule.ID,
|
||||||
|
"local_ip": rule.LocalIP,
|
||||||
|
"local_port": rule.LocalPort,
|
||||||
|
"protocol": rule.Protocol,
|
||||||
|
"public_port_end": rule.PublicPortEnd,
|
||||||
|
"public_port_start": rule.PublicPortStart,
|
||||||
|
"vm_id": rule.VMID,
|
||||||
|
"vm_name": rule.VMName,
|
||||||
|
}
|
||||||
|
res = append(res, tmp)
|
||||||
|
}
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
func flattenNATConfig(config NATConfig) []map[string]interface{} {
|
||||||
|
res := make([]map[string]interface{}, 0)
|
||||||
|
temp := map[string]interface{}{
|
||||||
|
"net_mask": config.NetMask,
|
||||||
|
"network": config.Network,
|
||||||
|
"rules": flattenRules(config.Rules),
|
||||||
|
}
|
||||||
|
res = append(res, temp)
|
||||||
|
|
||||||
|
return res
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func flattenNAT(nat NAT) []map[string]interface{} {
|
||||||
|
res := make([]map[string]interface{}, 0)
|
||||||
|
temp := map[string]interface{}{
|
||||||
|
"_ckey": nat.CKey,
|
||||||
|
"account_id": nat.AccountID,
|
||||||
|
"created_time": nat.CreatedTime,
|
||||||
|
"config": flattenNATConfig(nat.Config),
|
||||||
|
"devices": flattenDevices(nat.Devices),
|
||||||
|
"gid": nat.GID,
|
||||||
|
"guid": nat.GUID,
|
||||||
|
"nat_id": nat.ID,
|
||||||
|
"lock_status": nat.LockStatus,
|
||||||
|
"milestones": nat.Milestones,
|
||||||
|
"owner_id": nat.OwnerID,
|
||||||
|
"owner_type": nat.OwnerType,
|
||||||
|
"pure_virtual": nat.PureVirtual,
|
||||||
|
"status": nat.Status,
|
||||||
|
"tech_status": nat.TechStatus,
|
||||||
|
"type": nat.Type,
|
||||||
|
}
|
||||||
|
res = append(res, temp)
|
||||||
|
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
func flattenVNFS(vnfs VNFS) []map[string]interface{} {
|
||||||
|
res := make([]map[string]interface{}, 0)
|
||||||
|
temp := map[string]interface{}{
|
||||||
|
"dhcp": flattenDHCP(vnfs.DHCP),
|
||||||
|
"gw": flattenGW(vnfs.GW),
|
||||||
|
"nat": flattenNAT(vnfs.NAT),
|
||||||
|
}
|
||||||
|
res = append(res, temp)
|
||||||
|
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
func flattenRuleBlock(rules ListNATRules) []map[string]interface{} {
|
||||||
|
res := make([]map[string]interface{}, 0)
|
||||||
|
for _, rule := range rules {
|
||||||
|
tmp := map[string]interface{}{
|
||||||
|
"int_ip": rule.LocalIP,
|
||||||
|
"int_port": rule.LocalPort,
|
||||||
|
"ext_port_start": rule.PublicPortStart,
|
||||||
|
"ext_port_end": rule.PublicPortEnd,
|
||||||
|
"proto": rule.Protocol,
|
||||||
|
"rule_id": rule.ID,
|
||||||
|
}
|
||||||
|
res = append(res, tmp)
|
||||||
|
}
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
func flattenVins(d *schema.ResourceData, vins VINSDetailed) {
|
||||||
|
d.Set("vins_id", vins.ID)
|
||||||
|
d.Set("vnf_dev", flattenVNFDev(vins.VNFDev))
|
||||||
|
d.Set("_ckey", vins.CKey)
|
||||||
|
d.Set("account_id", vins.AccountID)
|
||||||
|
d.Set("account_name", vins.AccountName)
|
||||||
|
d.Set("computes", flattenComputes(vins.Computes))
|
||||||
|
d.Set("default_gw", vins.DefaultGW)
|
||||||
|
d.Set("default_qos", flattenQOS(vins.DefaultQOS))
|
||||||
|
d.Set("desc", vins.Description)
|
||||||
|
d.Set("gid", vins.GID)
|
||||||
|
d.Set("guid", vins.GUID)
|
||||||
|
d.Set("lock_status", vins.LockStatus)
|
||||||
|
d.Set("manager_id", vins.ManagerID)
|
||||||
|
d.Set("manager_type", vins.ManagerType)
|
||||||
|
d.Set("milestones", vins.Milestones)
|
||||||
|
d.Set("name", vins.Name)
|
||||||
|
d.Set("net_mask", vins.NetMask)
|
||||||
|
d.Set("network", vins.Network)
|
||||||
|
d.Set("pre_reservations_num", vins.PreReservaionsNum)
|
||||||
|
d.Set("redundant", vins.Redundant)
|
||||||
|
d.Set("rg_id", vins.RGID)
|
||||||
|
d.Set("rg_name", vins.RGName)
|
||||||
|
d.Set("sec_vnf_dev_id", vins.SecVNFDevID)
|
||||||
|
d.Set("status", vins.Status)
|
||||||
|
d.Set("user_managed", vins.UserManaged)
|
||||||
|
d.Set("vnfs", flattenVNFS(vins.VNFS))
|
||||||
|
d.Set("vxlan_id", vins.VXLanID)
|
||||||
|
d.Set("nat_rule", flattenRuleBlock(vins.VNFS.NAT.Config.Rules))
|
||||||
|
}
|
||||||
|
|
||||||
|
func flattenVinsData(d *schema.ResourceData, vins VINSDetailed) {
|
||||||
|
d.Set("vins_id", vins.ID)
|
||||||
|
d.Set("vnf_dev", flattenVNFDev(vins.VNFDev))
|
||||||
|
d.Set("_ckey", vins.CKey)
|
||||||
|
d.Set("account_id", vins.AccountID)
|
||||||
|
d.Set("account_name", vins.AccountName)
|
||||||
|
d.Set("computes", flattenComputes(vins.Computes))
|
||||||
|
d.Set("default_gw", vins.DefaultGW)
|
||||||
|
d.Set("default_qos", flattenQOS(vins.DefaultQOS))
|
||||||
|
d.Set("desc", vins.Description)
|
||||||
|
d.Set("gid", vins.GID)
|
||||||
|
d.Set("guid", vins.GUID)
|
||||||
|
d.Set("lock_status", vins.LockStatus)
|
||||||
|
d.Set("manager_id", vins.ManagerID)
|
||||||
|
d.Set("manager_type", vins.ManagerType)
|
||||||
|
d.Set("milestones", vins.Milestones)
|
||||||
|
d.Set("name", vins.Name)
|
||||||
|
d.Set("net_mask", vins.NetMask)
|
||||||
|
d.Set("network", vins.Network)
|
||||||
|
d.Set("pre_reservations_num", vins.PreReservaionsNum)
|
||||||
|
d.Set("redundant", vins.Redundant)
|
||||||
|
d.Set("rg_id", vins.RGID)
|
||||||
|
d.Set("rg_name", vins.RGName)
|
||||||
|
d.Set("sec_vnf_dev_id", vins.SecVNFDevID)
|
||||||
|
d.Set("status", vins.Status)
|
||||||
|
d.Set("user_managed", vins.UserManaged)
|
||||||
|
d.Set("vnfs", flattenVNFS(vins.VNFS))
|
||||||
|
d.Set("vxlan_id", vins.VXLanID)
|
||||||
|
}
|
||||||
|
|
||||||
|
func flattenVinsAudits(auidts VINSAuditsList) []map[string]interface{} {
|
||||||
|
res := make([]map[string]interface{}, 0)
|
||||||
|
for _, audit := range auidts {
|
||||||
|
temp := map[string]interface{}{
|
||||||
|
"call": audit.Call,
|
||||||
|
"response_time": audit.ResponseTime,
|
||||||
|
"statuscode": audit.StatusCode,
|
||||||
|
"timestamp": audit.Timestamp,
|
||||||
|
"user": audit.User,
|
||||||
|
}
|
||||||
|
res = append(res, temp)
|
||||||
|
}
|
||||||
|
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
func flattenVinsExtNetList(extNetList ExtNetList) []map[string]interface{} {
|
||||||
|
res := make([]map[string]interface{}, 0)
|
||||||
|
for _, extNet := range extNetList {
|
||||||
|
temp := map[string]interface{}{
|
||||||
|
"default_gw": extNet.DefaultGW,
|
||||||
|
"ext_net_id": extNet.ExtNetID,
|
||||||
|
"ip": extNet.IP,
|
||||||
|
"prefix_len": extNet.PrefixLen,
|
||||||
|
"status": extNet.Status,
|
||||||
|
"tech_status": extNet.TechStatus,
|
||||||
|
}
|
||||||
|
res = append(res, temp)
|
||||||
|
}
|
||||||
|
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
func flattenVinsIpList(ips IPList) []map[string]interface{} {
|
||||||
|
res := make([]map[string]interface{}, 0)
|
||||||
|
for _, ip := range ips {
|
||||||
|
temp := map[string]interface{}{
|
||||||
|
"client_type": ip.ClientType,
|
||||||
|
"domainname": ip.DomainName,
|
||||||
|
"hostname": ip.HostName,
|
||||||
|
"ip": ip.IP,
|
||||||
|
"mac": ip.MAC,
|
||||||
|
"type": ip.Type,
|
||||||
|
"vm_id": ip.VMID,
|
||||||
|
}
|
||||||
|
res = append(res, temp)
|
||||||
|
}
|
||||||
|
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
func flattenVinsList(vl VINSList) []map[string]interface{} {
|
||||||
|
res := make([]map[string]interface{}, 0)
|
||||||
|
for _, v := range vl {
|
||||||
|
temp := map[string]interface{}{
|
||||||
|
"account_id": v.AccountID,
|
||||||
|
"account_name": v.AccountName,
|
||||||
|
"created_by": v.CreatedBy,
|
||||||
|
"created_time": v.CreatedTime,
|
||||||
|
"deleted_by": v.DeletedBy,
|
||||||
|
"deleted_time": v.DeletedTime,
|
||||||
|
"external_ip": v.ExternalIP,
|
||||||
|
"vins_id": v.ID,
|
||||||
|
"vins_name": v.Name,
|
||||||
|
"network": v.Network,
|
||||||
|
"rg_id": v.RGID,
|
||||||
|
"rg_name": v.RGName,
|
||||||
|
"status": v.Status,
|
||||||
|
"updated_by": v.UpdatedBy,
|
||||||
|
"updated_time": v.UpdatedTime,
|
||||||
|
"vxlan_id": v.VXLANID,
|
||||||
|
}
|
||||||
|
res = append(res, temp)
|
||||||
|
}
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
func flattenVinsNatRuleList(natRules NATRuleList) []map[string]interface{} {
|
||||||
|
res := make([]map[string]interface{}, 0)
|
||||||
|
for _, natRule := range natRules {
|
||||||
|
temp := map[string]interface{}{
|
||||||
|
"id": natRule.ID,
|
||||||
|
"local_ip": natRule.LocalIP,
|
||||||
|
"local_port": natRule.LocalPort,
|
||||||
|
"protocol": natRule.Protocol,
|
||||||
|
"public_port_end": natRule.PublicPortEnd,
|
||||||
|
"public_port_start": natRule.PublicPortStart,
|
||||||
|
"vm_id": natRule.VMID,
|
||||||
|
"vm_name": natRule.VMName,
|
||||||
|
}
|
||||||
|
res = append(res, temp)
|
||||||
|
}
|
||||||
|
|
||||||
|
return res
|
||||||
|
}
|
@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||||
|
Authors:
|
||||||
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
|
Source code: https://github.com/rudecs/terraform-provider-decort
|
||||||
|
|
||||||
|
Please see README.md to learn where to place source code so that it
|
||||||
|
builds seamlessly.
|
||||||
|
|
||||||
|
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
||||||
|
*/
|
||||||
|
|
||||||
|
package vins
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"net/url"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
|
"github.com/rudecs/terraform-provider-decort/internal/controller"
|
||||||
|
)
|
||||||
|
|
||||||
|
func utilityVinsAuditsCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (VINSAuditsList, error) {
|
||||||
|
c := m.(*controller.ControllerCfg)
|
||||||
|
urlValues := &url.Values{}
|
||||||
|
auditsList := VINSAuditsList{}
|
||||||
|
|
||||||
|
urlValues.Add("vinsId", strconv.Itoa(d.Get("vins_id").(int)))
|
||||||
|
auidtsRaw, err := c.DecortAPICall(ctx, "POST", VinsAuditsAPI, urlValues)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = json.Unmarshal([]byte(auidtsRaw), &auditsList)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return auditsList, nil
|
||||||
|
}
|
@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||||
|
Authors:
|
||||||
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
|
Source code: https://github.com/rudecs/terraform-provider-decort
|
||||||
|
|
||||||
|
Please see README.md to learn where to place source code so that it
|
||||||
|
builds seamlessly.
|
||||||
|
|
||||||
|
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
||||||
|
*/
|
||||||
|
|
||||||
|
package vins
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"net/url"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
|
"github.com/rudecs/terraform-provider-decort/internal/controller"
|
||||||
|
)
|
||||||
|
|
||||||
|
func utilityVinsExtNetListCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (ExtNetList, error) {
|
||||||
|
c := m.(*controller.ControllerCfg)
|
||||||
|
urlValues := &url.Values{}
|
||||||
|
extNet := ExtNetList{}
|
||||||
|
|
||||||
|
urlValues.Add("vinsId", strconv.Itoa(d.Get("vins_id").(int)))
|
||||||
|
extNetRaw, err := c.DecortAPICall(ctx, "POST", VinsExtNetListAPI, urlValues)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = json.Unmarshal([]byte(extNetRaw), &extNet)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return extNet, nil
|
||||||
|
}
|
@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||||
|
Authors:
|
||||||
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
|
Source code: https://github.com/rudecs/terraform-provider-decort
|
||||||
|
|
||||||
|
Please see README.md to learn where to place source code so that it
|
||||||
|
builds seamlessly.
|
||||||
|
|
||||||
|
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
||||||
|
*/
|
||||||
|
|
||||||
|
package vins
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"net/url"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
|
"github.com/rudecs/terraform-provider-decort/internal/controller"
|
||||||
|
)
|
||||||
|
|
||||||
|
func utilityVinsIpListCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (IPList, error) {
|
||||||
|
c := m.(*controller.ControllerCfg)
|
||||||
|
urlValues := &url.Values{}
|
||||||
|
ips := IPList{}
|
||||||
|
|
||||||
|
urlValues.Add("vinsId", strconv.Itoa(d.Get("vins_id").(int)))
|
||||||
|
auidtsRaw, err := c.DecortAPICall(ctx, "POST", VinsIpListAPI, urlValues)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = json.Unmarshal([]byte(auidtsRaw), &ips)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return ips, nil
|
||||||
|
}
|
@ -0,0 +1,70 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||||
|
Authors:
|
||||||
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
|
Source code: https://github.com/rudecs/terraform-provider-decort
|
||||||
|
|
||||||
|
Please see README.md to learn where to place source code so that it
|
||||||
|
builds seamlessly.
|
||||||
|
|
||||||
|
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
||||||
|
*/
|
||||||
|
|
||||||
|
package vins
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"net/url"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
|
"github.com/rudecs/terraform-provider-decort/internal/controller"
|
||||||
|
log "github.com/sirupsen/logrus"
|
||||||
|
)
|
||||||
|
|
||||||
|
func utilityVinsListDeletedCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (VINSList, error) {
|
||||||
|
vinsList := VINSList{}
|
||||||
|
c := m.(*controller.ControllerCfg)
|
||||||
|
urlValues := &url.Values{}
|
||||||
|
|
||||||
|
if page, ok := d.GetOk("page"); ok {
|
||||||
|
urlValues.Add("page", strconv.Itoa(page.(int)))
|
||||||
|
}
|
||||||
|
if size, ok := d.GetOk("size"); ok {
|
||||||
|
urlValues.Add("size", strconv.Itoa(size.(int)))
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Debugf("utilityVinsListDeletedCheckPresence")
|
||||||
|
vinsListRaw, err := c.DecortAPICall(ctx, "POST", VinsListDeletedAPI, urlValues)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = json.Unmarshal([]byte(vinsListRaw), &vinsList)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return vinsList, nil
|
||||||
|
}
|
@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||||
|
Authors:
|
||||||
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||||
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||||
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||||
|
Orchestration Technology) with Terraform by Hashicorp.
|
||||||
|
|
||||||
|
Source code: https://github.com/rudecs/terraform-provider-decort
|
||||||
|
|
||||||
|
Please see README.md to learn where to place source code so that it
|
||||||
|
builds seamlessly.
|
||||||
|
|
||||||
|
Documentation: https://github.com/rudecs/terraform-provider-decort/wiki
|
||||||
|
*/
|
||||||
|
|
||||||
|
package vins
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"net/url"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
|
"github.com/rudecs/terraform-provider-decort/internal/controller"
|
||||||
|
)
|
||||||
|
|
||||||
|
func utilityVinsNatRuleListCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (NATRuleList, error) {
|
||||||
|
c := m.(*controller.ControllerCfg)
|
||||||
|
urlValues := &url.Values{}
|
||||||
|
natRuleList := NATRuleList{}
|
||||||
|
|
||||||
|
urlValues.Add("vinsId", strconv.Itoa(d.Get("vins_id").(int)))
|
||||||
|
auidtsRaw, err := c.DecortAPICall(ctx, "POST", VinsNatRuleListAPI, urlValues)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = json.Unmarshal([]byte(auidtsRaw), &natRuleList)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return natRuleList, nil
|
||||||
|
}
|
Loading…
Reference in new issue