You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
101 lines
3.3 KiB
101 lines
3.3 KiB
/*
|
|
Copyright (c) 2019-2023 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|
Authors:
|
|
Petr Krutov, <petr.krutov@digitalenergy.online>
|
|
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
|
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
|
Tim Tkachev, <tvtkachev@basistech.ru>
|
|
Sergey Kisil, <svkisil@digitalenergy.online>
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
*/
|
|
|
|
/*
|
|
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
|
Orchestration Technology) with Terraform by Hashicorp.
|
|
|
|
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
|
|
|
Please see README.md to learn where to place source code so that it
|
|
builds seamlessly.
|
|
|
|
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
|
*/
|
|
|
|
package flipgroup
|
|
|
|
import (
|
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/flipgroup"
|
|
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/flattens"
|
|
)
|
|
|
|
func flattenFlipgroup(d *schema.ResourceData, flip *flipgroup.RecordFLIPGroup) {
|
|
d.Set("flipgroup_id", flip.ID)
|
|
d.Set("account_id", flip.AccountID)
|
|
d.Set("account_name", flip.AccountName)
|
|
d.Set("client_ids", flip.ClientIDs)
|
|
d.Set("client_names", flip.ClientNames)
|
|
d.Set("client_type", flip.ClientType)
|
|
d.Set("conn_id", flip.ConnID)
|
|
d.Set("conn_type", flip.ConnType)
|
|
d.Set("created_by", flip.CreatedBy)
|
|
d.Set("created_time", flip.CreatedTime)
|
|
d.Set("default_gw", flip.DefaultGW)
|
|
d.Set("deleted_by", flip.DeletedBy)
|
|
d.Set("deleted_time", flip.DeletedTime)
|
|
d.Set("description", flip.Description)
|
|
d.Set("gid", flip.GID)
|
|
d.Set("guid", flip.GUID)
|
|
d.Set("ip", flip.IP)
|
|
d.Set("milestones", flip.Milestones)
|
|
d.Set("name", flip.Name)
|
|
d.Set("net_id", flip.NetID)
|
|
d.Set("net_type", flip.NetType)
|
|
d.Set("network", flip.Network)
|
|
d.Set("rg_id", flip.RGID)
|
|
d.Set("rg_name", flip.RGName)
|
|
d.Set("status", flip.Status)
|
|
d.Set("updated_by", flip.UpdatedBy)
|
|
d.Set("updated_time", flip.UpdatedTime)
|
|
}
|
|
|
|
func flattenFlipgroupsList(fg *flipgroup.ListFLIPGroups) []map[string]interface{} {
|
|
res := make([]map[string]interface{}, 0, len(fg.Data))
|
|
for _, flip := range fg.Data {
|
|
temp := map[string]interface{}{
|
|
"ckey": flip.CKey,
|
|
"meta": flattens.FlattenMeta(flip.Meta),
|
|
"flipgroup_id": flip.ID,
|
|
"account_id": flip.AccountID,
|
|
"client_ids": flip.ClientIDs,
|
|
"client_type": flip.ClientType,
|
|
"conn_id": flip.ConnID,
|
|
"conn_type": flip.ConnType,
|
|
"default_gw": flip.DefaultGW,
|
|
"description": flip.Description,
|
|
"gid": flip.GID,
|
|
"guid": flip.GUID,
|
|
"ip": flip.IP,
|
|
"milestones": flip.Milestones,
|
|
"name": flip.Name,
|
|
"net_id": flip.NetID,
|
|
"net_type": flip.NetType,
|
|
"net_mask": flip.NetMask,
|
|
"status": flip.Status,
|
|
}
|
|
res = append(res, temp)
|
|
}
|
|
return res
|
|
}
|