1.0.0
This commit is contained in:
55
internal/service/cloudapi/rg/models/model_data_source_rg.go
Normal file
55
internal/service/cloudapi/rg/models/model_data_source_rg.go
Normal file
@@ -0,0 +1,55 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/terraform-plugin-framework-timeouts/datasource/timeouts"
|
||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
||||
)
|
||||
|
||||
type DataSourceRGModel struct {
|
||||
// request fields
|
||||
RGID types.Int64 `tfsdk:"rg_id"`
|
||||
Reason types.String `tfsdk:"reason"`
|
||||
Timeouts timeouts.Value `tfsdk:"timeouts"`
|
||||
|
||||
// response fields
|
||||
AccountID types.Int64 `tfsdk:"account_id"`
|
||||
AccountName types.String `tfsdk:"account_name"`
|
||||
ACL types.List `tfsdk:"acl"`
|
||||
ComputeFeatures types.List `tfsdk:"compute_features"`
|
||||
CPUAllocationParameter types.String `tfsdk:"cpu_allocation_parameter"`
|
||||
CPUAllocationRatio types.Float64 `tfsdk:"cpu_allocation_ratio"`
|
||||
CreatedBy types.String `tfsdk:"created_by"`
|
||||
CreatedTime types.Int64 `tfsdk:"created_time"`
|
||||
DefNetID types.Int64 `tfsdk:"def_net_id"`
|
||||
DefNetType types.String `tfsdk:"def_net_type"`
|
||||
DeletedBy types.String `tfsdk:"deleted_by"`
|
||||
DeletedTime types.Int64 `tfsdk:"deleted_time"`
|
||||
Description types.String `tfsdk:"desc"`
|
||||
Dirty types.Bool `tfsdk:"dirty"`
|
||||
GID types.Int64 `tfsdk:"gid"`
|
||||
GUID types.Int64 `tfsdk:"guid"`
|
||||
Id types.String `tfsdk:"id"`
|
||||
LockStatus types.String `tfsdk:"lock_status"`
|
||||
Milestones types.Int64 `tfsdk:"milestones"`
|
||||
Name types.String `tfsdk:"name"`
|
||||
RegisterComputes types.Bool `tfsdk:"register_computes"`
|
||||
ResourceLimits *ResourceLimitsModel `tfsdk:"resource_limits"`
|
||||
ResTypes types.List `tfsdk:"res_types"`
|
||||
Secret types.String `tfsdk:"secret"`
|
||||
Status types.String `tfsdk:"status"`
|
||||
UniqPools types.List `tfsdk:"uniq_pools"`
|
||||
UpdatedBy types.String `tfsdk:"updated_by"`
|
||||
UpdatedTime types.Int64 `tfsdk:"updated_time"`
|
||||
VINS types.List `tfsdk:"vins"`
|
||||
Computes types.List `tfsdk:"computes"`
|
||||
}
|
||||
|
||||
type ResourceLimitsModel struct {
|
||||
CUC types.Float64 `tfsdk:"cu_c"`
|
||||
CUD types.Float64 `tfsdk:"cu_d"`
|
||||
CUDM types.Float64 `tfsdk:"cu_dm"`
|
||||
CUI types.Float64 `tfsdk:"cu_i"`
|
||||
CUM types.Float64 `tfsdk:"cu_m"`
|
||||
CUNP types.Float64 `tfsdk:"cu_np"`
|
||||
GPUUnits types.Float64 `tfsdk:"gpu_units"`
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/terraform-plugin-framework-timeouts/datasource/timeouts"
|
||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
||||
)
|
||||
|
||||
type DataSourceRGAffinityGroupComputesModel struct {
|
||||
// request required fields
|
||||
RGID types.Int64 `tfsdk:"rg_id"`
|
||||
AffinityGroup types.String `tfsdk:"affinity_group"`
|
||||
|
||||
// request optional fields
|
||||
Timeouts timeouts.Value `tfsdk:"timeouts"`
|
||||
|
||||
// response fields
|
||||
Id types.String `tfsdk:"id"`
|
||||
Items []ItemAffinityGroupComputeModel `tfsdk:"items"`
|
||||
}
|
||||
|
||||
type ItemAffinityGroupComputeModel struct {
|
||||
ComputeID types.Int64 `tfsdk:"compute_id"`
|
||||
OtherNode types.List `tfsdk:"other_node"`
|
||||
OtherNodeIndirect types.List `tfsdk:"other_node_indirect"`
|
||||
OtherNodeIndirectSoft types.List `tfsdk:"other_node_indirect_soft"`
|
||||
OtherNodeSoft types.List `tfsdk:"other_node_soft"`
|
||||
SameNode types.List `tfsdk:"same_node"`
|
||||
SameNodeSoft types.List `tfsdk:"same_node_soft"`
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/terraform-plugin-framework-timeouts/datasource/timeouts"
|
||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
||||
)
|
||||
|
||||
type DataSourceRGAffinityGroupsGetModel struct {
|
||||
// request required fields
|
||||
RGID types.Int64 `tfsdk:"rg_id"`
|
||||
AffinityGroup types.String `tfsdk:"affinity_group"`
|
||||
|
||||
// request optional fields
|
||||
Timeouts timeouts.Value `tfsdk:"timeouts"`
|
||||
|
||||
// response fields
|
||||
Id types.String `tfsdk:"id"`
|
||||
Ids types.List `tfsdk:"ids"`
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/terraform-plugin-framework-timeouts/datasource/timeouts"
|
||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
||||
)
|
||||
|
||||
type DataSourceRGAffinityGroupsListModel struct {
|
||||
// request required fields
|
||||
RGID types.Int64 `tfsdk:"rg_id"`
|
||||
|
||||
// request optional fields
|
||||
Page types.Int64 `tfsdk:"page"`
|
||||
Size types.Int64 `tfsdk:"size"`
|
||||
Timeouts timeouts.Value `tfsdk:"timeouts"`
|
||||
|
||||
// response fields
|
||||
Id types.String `tfsdk:"id"`
|
||||
AffinityGroups []ItemAffinityGroupModel `tfsdk:"affinity_groups"`
|
||||
EntryCount types.Int64 `tfsdk:"entry_count"`
|
||||
}
|
||||
|
||||
type ItemAffinityGroupModel struct {
|
||||
Label types.String `tfsdk:"label"`
|
||||
Ids []ItemIDModel `tfsdk:"ids"`
|
||||
}
|
||||
|
||||
type ItemIDModel struct {
|
||||
Id types.Int64 `tfsdk:"id"`
|
||||
NodeId types.Int64 `tfsdk:"node_id"`
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/terraform-plugin-framework-timeouts/datasource/timeouts"
|
||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
||||
)
|
||||
|
||||
type DataSourceRGAuditsModel struct {
|
||||
// request field
|
||||
RGID types.Int64 `tfsdk:"rg_id"`
|
||||
Timeouts timeouts.Value `tfsdk:"timeouts"`
|
||||
|
||||
// response fields
|
||||
Id types.String `tfsdk:"id"`
|
||||
Items []ItemsRGAuditModel `tfsdk:"items"`
|
||||
}
|
||||
|
||||
type ItemsRGAuditModel struct {
|
||||
Call types.String `tfsdk:"call"`
|
||||
ResponseTime types.Float64 `tfsdk:"responsetime"`
|
||||
StatusCode types.Int64 `tfsdk:"statuscode"`
|
||||
Timestamp types.Float64 `tfsdk:"timestamp"`
|
||||
User types.String `tfsdk:"user"`
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/terraform-plugin-framework-timeouts/datasource/timeouts"
|
||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
||||
)
|
||||
|
||||
type DataSourceRGGetResourceConsumptionModel struct {
|
||||
// request fields
|
||||
RGID types.Int64 `tfsdk:"rg_id"`
|
||||
Timeouts timeouts.Value `tfsdk:"timeouts"`
|
||||
|
||||
// response fields
|
||||
Id types.String `tfsdk:"id"`
|
||||
Consumed *ResourceModel `tfsdk:"consumed"`
|
||||
Reserved *ResourceModel `tfsdk:"reserved"`
|
||||
ResourceLimits *ResourceLimitsModel `tfsdk:"resource_limits"`
|
||||
}
|
||||
|
||||
type ResourceModel struct {
|
||||
CPU types.Int64 `tfsdk:"cpu"`
|
||||
DiskSize types.Float64 `tfsdk:"disk_size"`
|
||||
DiskSizeMax types.Float64 `tfsdk:"disk_size_max"`
|
||||
ExtIPs types.Int64 `tfsdk:"extips"`
|
||||
ExtTraffic types.Int64 `tfsdk:"exttraffic"`
|
||||
GPU types.Int64 `tfsdk:"gpu"`
|
||||
RAM types.Int64 `tfsdk:"ram"`
|
||||
SEPs []SEPsModel `tfsdk:"seps"`
|
||||
}
|
||||
|
||||
type SEPsModel struct {
|
||||
SepID types.String `tfsdk:"sep_id"`
|
||||
DataName types.String `tfsdk:"data_name"`
|
||||
DiskSize types.Float64 `tfsdk:"disk_size"`
|
||||
DiskSizeMax types.Float64 `tfsdk:"disk_size_max"`
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/terraform-plugin-framework-timeouts/datasource/timeouts"
|
||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
||||
)
|
||||
|
||||
type DataSourceRGListModel struct {
|
||||
// request optional fields
|
||||
ById types.Int64 `tfsdk:"by_id"`
|
||||
Name types.String `tfsdk:"name"`
|
||||
AccountId types.Int64 `tfsdk:"account_id"`
|
||||
AccountName types.String `tfsdk:"account_name"`
|
||||
CreatedAfter types.Int64 `tfsdk:"created_after"`
|
||||
CreatedBefore types.Int64 `tfsdk:"created_before"`
|
||||
Status types.String `tfsdk:"status"`
|
||||
LockStatus types.String `tfsdk:"lock_status"`
|
||||
IncludeDeleted types.Bool `tfsdk:"includedeleted"`
|
||||
SortBy types.String `tfsdk:"sort_by"`
|
||||
Page types.Int64 `tfsdk:"page"`
|
||||
Size types.Int64 `tfsdk:"size"`
|
||||
Timeouts timeouts.Value `tfsdk:"timeouts"`
|
||||
|
||||
// response fields
|
||||
Id types.String `tfsdk:"id"`
|
||||
Items []ItemsRGListModel `tfsdk:"items"`
|
||||
EntryCount types.Int64 `tfsdk:"entry_count"`
|
||||
}
|
||||
|
||||
type ItemsRGListModel struct {
|
||||
AccountACL types.List `tfsdk:"account_acl"`
|
||||
AccountID types.Int64 `tfsdk:"account_id"`
|
||||
AccountName types.String `tfsdk:"account_name"`
|
||||
ComputeFeatures types.List `tfsdk:"compute_features"`
|
||||
CPUAllocationParameter types.String `tfsdk:"cpu_allocation_parameter"`
|
||||
CPUAllocationRatio types.Float64 `tfsdk:"cpu_allocation_ratio"`
|
||||
CreatedBy types.String `tfsdk:"created_by"`
|
||||
CreatedTime types.Int64 `tfsdk:"created_time"`
|
||||
DefNetID types.Int64 `tfsdk:"def_net_id"`
|
||||
DefNetType types.String `tfsdk:"def_net_type"`
|
||||
DeletedBy types.String `tfsdk:"deleted_by"`
|
||||
DeletedTime types.Int64 `tfsdk:"deleted_time"`
|
||||
Description types.String `tfsdk:"desc"`
|
||||
Dirty types.Bool `tfsdk:"dirty"`
|
||||
GID types.Int64 `tfsdk:"gid"`
|
||||
GUID types.Int64 `tfsdk:"guid"`
|
||||
RGID types.Int64 `tfsdk:"rg_id"`
|
||||
LockStatus types.String `tfsdk:"lock_status"`
|
||||
Milestones types.Int64 `tfsdk:"milestones"`
|
||||
Name types.String `tfsdk:"name"`
|
||||
RegisterComputes types.Bool `tfsdk:"register_computes"`
|
||||
ResourceLimits *ResourceLimitsModel `tfsdk:"resource_limits"`
|
||||
ResTypes types.List `tfsdk:"resource_types"`
|
||||
Secret types.String `tfsdk:"secret"`
|
||||
Status types.String `tfsdk:"status"`
|
||||
UniqPools types.List `tfsdk:"uniq_pools"`
|
||||
UpdatedBy types.String `tfsdk:"updated_by"`
|
||||
UpdatedTime types.Int64 `tfsdk:"updated_time"`
|
||||
VINS types.List `tfsdk:"vins"`
|
||||
VMS types.List `tfsdk:"vms"`
|
||||
}
|
||||
|
||||
type AccountACLModel struct {
|
||||
Explicit types.Bool `tfsdk:"explicit"`
|
||||
GUID types.String `tfsdk:"guid"`
|
||||
Right types.String `tfsdk:"right"`
|
||||
Status types.String `tfsdk:"status"`
|
||||
Type types.String `tfsdk:"type"`
|
||||
UserGroupID types.String `tfsdk:"user_group_id"`
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/terraform-plugin-framework-timeouts/datasource/timeouts"
|
||||
"github.com/hashicorp/terraform-plugin-framework/attr"
|
||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
||||
)
|
||||
|
||||
type DataSourceRGListComputesModel struct {
|
||||
// request required fields
|
||||
RGID types.Int64 `tfsdk:"rg_id"`
|
||||
|
||||
// request optional fields
|
||||
ComputeID types.Int64 `tfsdk:"compute_id"`
|
||||
Name types.String `tfsdk:"name"`
|
||||
AccountID types.Int64 `tfsdk:"account_id"`
|
||||
TechStatus types.String `tfsdk:"tech_status"`
|
||||
Status types.String `tfsdk:"status"`
|
||||
IPAddress types.String `tfsdk:"ip_address"`
|
||||
ExtNetName types.String `tfsdk:"extnet_name"`
|
||||
ExtNetID types.Int64 `tfsdk:"extnet_id"`
|
||||
SortBy types.String `tfsdk:"sort_by"`
|
||||
Page types.Int64 `tfsdk:"page"`
|
||||
Size types.Int64 `tfsdk:"size"`
|
||||
Timeouts timeouts.Value `tfsdk:"timeouts"`
|
||||
|
||||
// response fields
|
||||
Id types.String `tfsdk:"id"`
|
||||
Items []ItemsRGListComputeModel `tfsdk:"items"`
|
||||
EntryCount types.Int64 `tfsdk:"entry_count"`
|
||||
}
|
||||
|
||||
type ItemsRGListComputeModel struct {
|
||||
AccountID types.Int64 `tfsdk:"account_id"`
|
||||
AccountName types.String `tfsdk:"account_name"`
|
||||
AffinityLabel types.String `tfsdk:"affinity_label"`
|
||||
AffinityRules types.List `tfsdk:"affinity_rules"`
|
||||
AffinityWeight types.Int64 `tfsdk:"affinity_weight"`
|
||||
AntiAffinityRules types.List `tfsdk:"antiaffinity_rules"`
|
||||
CPUs types.Int64 `tfsdk:"cpus"`
|
||||
CreatedBy types.String `tfsdk:"created_by"`
|
||||
CreatedTime types.Int64 `tfsdk:"created_time"`
|
||||
DeletedBy types.String `tfsdk:"deleted_by"`
|
||||
DeletedTime types.Int64 `tfsdk:"deleted_time"`
|
||||
ID types.Int64 `tfsdk:"id"`
|
||||
Name types.String `tfsdk:"name"`
|
||||
RAM types.Int64 `tfsdk:"ram"`
|
||||
Registered types.Bool `tfsdk:"registered"`
|
||||
RGName types.String `tfsdk:"rg_name"`
|
||||
Status types.String `tfsdk:"status"`
|
||||
TechStatus types.String `tfsdk:"tech_status"`
|
||||
TotalDisksSize types.Int64 `tfsdk:"total_disks_size"`
|
||||
UpdatedBy types.String `tfsdk:"updated_by"`
|
||||
UpdatedTime types.Int64 `tfsdk:"updated_time"`
|
||||
UserManaged types.Bool `tfsdk:"user_managed"`
|
||||
VINSConnected types.Int64 `tfsdk:"vins_connected"`
|
||||
}
|
||||
|
||||
type AffinityRuleModel struct {
|
||||
GUID types.String `tfsdk:"guid"`
|
||||
Key types.String `tfsdk:"key"`
|
||||
Mode types.String `tfsdk:"mode"`
|
||||
Policy types.String `tfsdk:"policy"`
|
||||
Topology types.String `tfsdk:"topology"`
|
||||
Value types.String `tfsdk:"value"`
|
||||
}
|
||||
|
||||
var ItemAffinityRule = map[string]attr.Type{
|
||||
"guid": types.StringType,
|
||||
"key": types.StringType,
|
||||
"mode": types.StringType,
|
||||
"policy": types.StringType,
|
||||
"topology": types.StringType,
|
||||
"value": types.StringType,
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/terraform-plugin-framework-timeouts/datasource/timeouts"
|
||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
||||
)
|
||||
|
||||
type DataSourceRGListDeletedModel struct {
|
||||
// request optional fields
|
||||
ById types.Int64 `tfsdk:"by_id"`
|
||||
Name types.String `tfsdk:"name"`
|
||||
AccountId types.Int64 `tfsdk:"account_id"`
|
||||
AccountName types.String `tfsdk:"account_name"`
|
||||
CreatedAfter types.Int64 `tfsdk:"created_after"`
|
||||
CreatedBefore types.Int64 `tfsdk:"created_before"`
|
||||
LockStatus types.String `tfsdk:"lock_status"`
|
||||
SortBy types.String `tfsdk:"sort_by"`
|
||||
Page types.Int64 `tfsdk:"page"`
|
||||
Size types.Int64 `tfsdk:"size"`
|
||||
Timeouts timeouts.Value `tfsdk:"timeouts"`
|
||||
|
||||
// response fields
|
||||
Id types.String `tfsdk:"id"`
|
||||
Items []ItemsRGListDeletedModel `tfsdk:"items"`
|
||||
EntryCount types.Int64 `tfsdk:"entry_count"`
|
||||
}
|
||||
|
||||
type ItemsRGListDeletedModel struct {
|
||||
AccountACL types.List `tfsdk:"account_acl"`
|
||||
AccountID types.Int64 `tfsdk:"account_id"`
|
||||
AccountName types.String `tfsdk:"account_name"`
|
||||
ComputeFeatures types.List `tfsdk:"compute_features"`
|
||||
CPUAllocationParameter types.String `tfsdk:"cpu_allocation_parameter"`
|
||||
CPUAllocationRatio types.Float64 `tfsdk:"cpu_allocation_ratio"`
|
||||
CreatedBy types.String `tfsdk:"created_by"`
|
||||
CreatedTime types.Int64 `tfsdk:"created_time"`
|
||||
DefNetID types.Int64 `tfsdk:"def_net_id"`
|
||||
DefNetType types.String `tfsdk:"def_net_type"`
|
||||
DeletedBy types.String `tfsdk:"deleted_by"`
|
||||
DeletedTime types.Int64 `tfsdk:"deleted_time"`
|
||||
Description types.String `tfsdk:"desc"`
|
||||
Dirty types.Bool `tfsdk:"dirty"`
|
||||
GID types.Int64 `tfsdk:"gid"`
|
||||
GUID types.Int64 `tfsdk:"guid"`
|
||||
RGID types.Int64 `tfsdk:"rg_id"`
|
||||
LockStatus types.String `tfsdk:"lock_status"`
|
||||
Milestones types.Int64 `tfsdk:"milestones"`
|
||||
Name types.String `tfsdk:"name"`
|
||||
RegisterComputes types.Bool `tfsdk:"register_computes"`
|
||||
ResourceLimits *ResourceLimitsModel `tfsdk:"resource_limits"`
|
||||
ResTypes types.List `tfsdk:"resource_types"`
|
||||
Secret types.String `tfsdk:"secret"`
|
||||
Status types.String `tfsdk:"status"`
|
||||
UniqPools types.List `tfsdk:"uniq_pools"`
|
||||
UpdatedBy types.String `tfsdk:"updated_by"`
|
||||
UpdatedTime types.Int64 `tfsdk:"updated_time"`
|
||||
VINS types.List `tfsdk:"vins"`
|
||||
VMS types.List `tfsdk:"vms"`
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/terraform-plugin-framework-timeouts/datasource/timeouts"
|
||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
||||
)
|
||||
|
||||
type DataSourceRGListLBModel struct {
|
||||
// request required fields
|
||||
RGID types.Int64 `tfsdk:"rg_id"`
|
||||
|
||||
// request optional fields
|
||||
ByID types.Int64 `tfsdk:"by_id"`
|
||||
Name types.String `tfsdk:"name"`
|
||||
TechStatus types.String `tfsdk:"tech_status"`
|
||||
Status types.String `tfsdk:"status"`
|
||||
FrontIP types.String `tfsdk:"front_ip"`
|
||||
BackIP types.String `tfsdk:"back_ip"`
|
||||
SortBy types.String `tfsdk:"sort_by"`
|
||||
Page types.Int64 `tfsdk:"page"`
|
||||
Size types.Int64 `tfsdk:"size"`
|
||||
Timeouts timeouts.Value `tfsdk:"timeouts"`
|
||||
|
||||
// response fields
|
||||
Id types.String `tfsdk:"id"`
|
||||
Items []ItemsRGListLBModel `tfsdk:"items"`
|
||||
EntryCount types.Int64 `tfsdk:"entry_count"`
|
||||
}
|
||||
|
||||
type ItemsRGListLBModel struct {
|
||||
HAMode types.Bool `tfsdk:"ha_mode"`
|
||||
BackendHAIP types.String `tfsdk:"backend_haip"`
|
||||
Backends []ItemBackendModel `tfsdk:"backends"`
|
||||
CreatedBy types.String `tfsdk:"created_by"`
|
||||
CreatedTime types.Int64 `tfsdk:"created_time"`
|
||||
DeletedBy types.String `tfsdk:"deleted_by"`
|
||||
DeletedTime types.Int64 `tfsdk:"deleted_time"`
|
||||
Description types.String `tfsdk:"desc"`
|
||||
DPAPIUser types.String `tfsdk:"dp_api_user"`
|
||||
ExtNetID types.Int64 `tfsdk:"extnet_id"`
|
||||
FrontendHAIP types.String `tfsdk:"frontend_haip"`
|
||||
Frontends []ItemFrontendModel `tfsdk:"frontends"`
|
||||
GID types.Int64 `tfsdk:"gid"`
|
||||
GUID types.Int64 `tfsdk:"guid"`
|
||||
ID types.Int64 `tfsdk:"id"`
|
||||
ImageID types.Int64 `tfsdk:"image_id"`
|
||||
Milestones types.Int64 `tfsdk:"milestones"`
|
||||
Name types.String `tfsdk:"name"`
|
||||
PrimaryNode RecordNodeModel `tfsdk:"primary_node"`
|
||||
RGName types.String `tfsdk:"rg_name"`
|
||||
SecondaryNode RecordNodeModel `tfsdk:"secondary_node"`
|
||||
Status types.String `tfsdk:"status"`
|
||||
TechStatus types.String `tfsdk:"tech_status"`
|
||||
UpdatedBy types.String `tfsdk:"updated_by"`
|
||||
UpdatedTime types.Int64 `tfsdk:"updated_time"`
|
||||
VINSID types.Int64 `tfsdk:"vins_id"`
|
||||
}
|
||||
|
||||
type ItemFrontendModel struct {
|
||||
Backend types.String `tfsdk:"backend"`
|
||||
Bindings []ItemBindingModel `tfsdk:"bindings"`
|
||||
GUID types.String `tfsdk:"guid"`
|
||||
Name types.String `tfsdk:"name"`
|
||||
}
|
||||
|
||||
type ItemBindingModel struct {
|
||||
Address types.String `tfsdk:"address"`
|
||||
GUID types.String `tfsdk:"guid"`
|
||||
Name types.String `tfsdk:"name"`
|
||||
Port types.Int64 `tfsdk:"port"`
|
||||
}
|
||||
|
||||
type RecordNodeModel struct {
|
||||
BackendIP types.String `tfsdk:"backend_ip"`
|
||||
ComputeID types.Int64 `tfsdk:"compute_id"`
|
||||
FrontendIP types.String `tfsdk:"frontend_ip"`
|
||||
GUID types.String `tfsdk:"guid"`
|
||||
MGMTIP types.String `tfsdk:"mgmt_ip"`
|
||||
NetworkID types.Int64 `tfsdk:"network_id"`
|
||||
}
|
||||
|
||||
type ItemBackendModel struct {
|
||||
Algorithm types.String `tfsdk:"algorithm"`
|
||||
GUID types.String `tfsdk:"guid"`
|
||||
Name types.String `tfsdk:"name"`
|
||||
ServerDefaultSettings RecordServerSettingsModel `tfsdk:"server_default_settings"`
|
||||
Servers []ItemServerModel `tfsdk:"servers"`
|
||||
}
|
||||
|
||||
type RecordServerSettingsModel struct {
|
||||
Inter types.Int64 `tfsdk:"inter"`
|
||||
GUID types.String `tfsdk:"guid"`
|
||||
DownInter types.Int64 `tfsdk:"down_inter"`
|
||||
Rise types.Int64 `tfsdk:"rise"`
|
||||
Fall types.Int64 `tfsdk:"fall"`
|
||||
SlowStart types.Int64 `tfsdk:"slow_start"`
|
||||
MaxConn types.Int64 `tfsdk:"max_conn"`
|
||||
MaxQueue types.Int64 `tfsdk:"max_queue"`
|
||||
Weight types.Int64 `tfsdk:"weight"`
|
||||
}
|
||||
|
||||
type ItemServerModel struct {
|
||||
Address types.String `tfsdk:"address"`
|
||||
Check types.String `tfsdk:"check"`
|
||||
GUID types.String `tfsdk:"guid"`
|
||||
Name types.String `tfsdk:"name"`
|
||||
Port types.Int64 `tfsdk:"port"`
|
||||
ServerSettings RecordServerSettingsModel `tfsdk:"server_settings"`
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/terraform-plugin-framework-timeouts/datasource/timeouts"
|
||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
||||
)
|
||||
|
||||
type DataSourceRGListPFWModel struct {
|
||||
// request fields
|
||||
RGID types.Int64 `tfsdk:"rg_id"` // required
|
||||
Timeouts timeouts.Value `tfsdk:"timeouts"` // optional
|
||||
|
||||
// response fields
|
||||
Id types.String `tfsdk:"id"`
|
||||
Items []ItemsRGListPFWModel `tfsdk:"items"`
|
||||
EntryCount types.Int64 `tfsdk:"entry_count"`
|
||||
}
|
||||
|
||||
type ItemsRGListPFWModel struct {
|
||||
PublicPortEnd types.Int64 `tfsdk:"public_port_end"`
|
||||
PublicPortStart types.Int64 `tfsdk:"public_port_start"`
|
||||
VMID types.Int64 `tfsdk:"vm_id"`
|
||||
VMIP types.String `tfsdk:"vm_ip"`
|
||||
VMName types.String `tfsdk:"vm_name"`
|
||||
VMPort types.Int64 `tfsdk:"vm_port"`
|
||||
VINSID types.Int64 `tfsdk:"vins_id"`
|
||||
VINSName types.String `tfsdk:"vins_name"`
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/terraform-plugin-framework-timeouts/datasource/timeouts"
|
||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
||||
)
|
||||
|
||||
type DataSourceRGListVinsModel struct {
|
||||
// request required fields
|
||||
RGID types.Int64 `tfsdk:"rg_id"`
|
||||
|
||||
// request optional fields
|
||||
Name types.String `tfsdk:"name"`
|
||||
AccountID types.Int64 `tfsdk:"account_id"`
|
||||
ExtIP types.String `tfsdk:"ext_ip"`
|
||||
VINSID types.Int64 `tfsdk:"vins_id"`
|
||||
SortBy types.String `tfsdk:"sort_by"`
|
||||
Page types.Int64 `tfsdk:"page"`
|
||||
Size types.Int64 `tfsdk:"size"`
|
||||
Timeouts timeouts.Value `tfsdk:"timeouts"`
|
||||
|
||||
// response fields
|
||||
Id types.String `tfsdk:"id"`
|
||||
Items []ItemsRGListVinsModel `tfsdk:"items"`
|
||||
EntryCount types.Int64 `tfsdk:"entry_count"`
|
||||
}
|
||||
|
||||
type ItemsRGListVinsModel struct {
|
||||
AccountID types.Int64 `tfsdk:"account_id"`
|
||||
AccountName types.String `tfsdk:"account_name"`
|
||||
Computes types.Int64 `tfsdk:"computes"`
|
||||
CreatedBy types.String `tfsdk:"created_by"`
|
||||
CreatedTime types.Int64 `tfsdk:"created_time"`
|
||||
DeletedBy types.String `tfsdk:"deleted_by"`
|
||||
DeletedTime types.Int64 `tfsdk:"deleted_time"`
|
||||
ExternalIP types.String `tfsdk:"external_ip"`
|
||||
ExtnetID types.Int64 `tfsdk:"extnet_id"`
|
||||
FreeIPs types.Int64 `tfsdk:"free_ips"`
|
||||
ID types.Int64 `tfsdk:"id"`
|
||||
Name types.String `tfsdk:"name"`
|
||||
Network types.String `tfsdk:"network"`
|
||||
PriVNFDevID types.Int64 `tfsdk:"pri_vnf_dev_id"`
|
||||
RGName types.String `tfsdk:"rg_name"`
|
||||
Status types.String `tfsdk:"status"`
|
||||
UpdatedBy types.String `tfsdk:"updated_by"`
|
||||
UpdatedTime types.Int64 `tfsdk:"updated_time"`
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/terraform-plugin-framework-timeouts/datasource/timeouts"
|
||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
||||
)
|
||||
|
||||
type DataSourceRGResourceConsumptionListModel struct {
|
||||
// request fields
|
||||
Timeouts timeouts.Value `tfsdk:"timeouts"`
|
||||
|
||||
// response fields
|
||||
Id types.String `tfsdk:"id"`
|
||||
Items []ItemResourceConsumptionModel `tfsdk:"items"`
|
||||
EntryCount types.Int64 `tfsdk:"entry_count"`
|
||||
}
|
||||
|
||||
type ItemResourceConsumptionModel struct {
|
||||
RGID types.Int64 `tfsdk:"rg_id"`
|
||||
Consumed *ResourceModel `tfsdk:"consumed"`
|
||||
Reserved *ResourceModel `tfsdk:"reserved"`
|
||||
ResourceLimits *ResourceLimitsModel `tfsdk:"resource_limits"`
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/terraform-plugin-framework-timeouts/datasource/timeouts"
|
||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
||||
)
|
||||
|
||||
type DataSourceRGUsageModel struct {
|
||||
// request fields
|
||||
RGID types.Int64 `tfsdk:"rg_id"`
|
||||
Reason types.String `tfsdk:"reason"`
|
||||
Timeouts timeouts.Value `tfsdk:"timeouts"`
|
||||
|
||||
// response fields
|
||||
Id types.String `tfsdk:"id"`
|
||||
CPU types.Int64 `tfsdk:"cpu"`
|
||||
DiskSize types.Int64 `tfsdk:"disk_size"`
|
||||
DiskSizeMax types.Int64 `tfsdk:"disk_size_max"`
|
||||
ExtIPs types.Int64 `tfsdk:"extips"`
|
||||
ExtTraffic types.Int64 `tfsdk:"exttraffic"`
|
||||
GPU types.Int64 `tfsdk:"gpu"`
|
||||
RAM types.Int64 `tfsdk:"ram"`
|
||||
SEPs []SEPsModel `tfsdk:"seps"`
|
||||
}
|
||||
129
internal/service/cloudapi/rg/models/model_resource_rg.go
Normal file
129
internal/service/cloudapi/rg/models/model_resource_rg.go
Normal file
@@ -0,0 +1,129 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/terraform-plugin-framework-timeouts/resource/timeouts"
|
||||
"github.com/hashicorp/terraform-plugin-framework/attr"
|
||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
||||
)
|
||||
|
||||
type ResourceRGModel struct {
|
||||
// request fields - required
|
||||
AccountID types.Int64 `tfsdk:"account_id"`
|
||||
GID types.Int64 `tfsdk:"gid"`
|
||||
Name types.String `tfsdk:"name"`
|
||||
|
||||
// request fields - optional
|
||||
DefNetType types.String `tfsdk:"def_net_type"`
|
||||
IPCIDR types.String `tfsdk:"ipcidr"`
|
||||
ExtNetID types.Int64 `tfsdk:"ext_net_id"`
|
||||
ExtIP types.String `tfsdk:"ext_ip"`
|
||||
Owner types.String `tfsdk:"owner"`
|
||||
Quota types.Object `tfsdk:"quota"`
|
||||
Access types.List `tfsdk:"access"`
|
||||
DefNet types.Object `tfsdk:"def_net"`
|
||||
Description types.String `tfsdk:"description"`
|
||||
Force types.Bool `tfsdk:"force"`
|
||||
Permanently types.Bool `tfsdk:"permanently"`
|
||||
Reason types.String `tfsdk:"reason"`
|
||||
RegisterComputes types.Bool `tfsdk:"register_computes"`
|
||||
Restore types.Bool `tfsdk:"restore"`
|
||||
Enable types.Bool `tfsdk:"enable"`
|
||||
Timeouts timeouts.Value `tfsdk:"timeouts"`
|
||||
|
||||
// response fields
|
||||
RGID types.Int64 `tfsdk:"rg_id"`
|
||||
LastUpdated types.String `tfsdk:"last_updated"`
|
||||
AccountName types.String `tfsdk:"account_name"`
|
||||
ACL types.List `tfsdk:"acl"`
|
||||
ComputeFeatures types.List `tfsdk:"compute_features"`
|
||||
CPUAllocationParameter types.String `tfsdk:"cpu_allocation_parameter"`
|
||||
CPUAllocationRatio types.Float64 `tfsdk:"cpu_allocation_ratio"`
|
||||
DefNetID types.Int64 `tfsdk:"def_net_id"`
|
||||
DeletedBy types.String `tfsdk:"deleted_by"`
|
||||
DeletedTime types.Int64 `tfsdk:"deleted_time"`
|
||||
Dirty types.Bool `tfsdk:"dirty"`
|
||||
GUID types.Int64 `tfsdk:"guid"`
|
||||
Id types.String `tfsdk:"id"`
|
||||
LockStatus types.String `tfsdk:"lock_status"`
|
||||
Milestones types.Int64 `tfsdk:"milestones"`
|
||||
ResTypes types.List `tfsdk:"res_types"`
|
||||
Secret types.String `tfsdk:"secret"`
|
||||
Status types.String `tfsdk:"status"`
|
||||
UniqPools types.List `tfsdk:"uniq_pools"`
|
||||
UpdatedBy types.String `tfsdk:"updated_by"`
|
||||
UpdatedTime types.Int64 `tfsdk:"updated_time"`
|
||||
VINS types.List `tfsdk:"vins"`
|
||||
VMS types.List `tfsdk:"vms"`
|
||||
}
|
||||
|
||||
type ItemACLModel struct {
|
||||
Explicit types.Bool `tfsdk:"explicit"`
|
||||
GUID types.String `tfsdk:"guid"`
|
||||
Right types.String `tfsdk:"right"`
|
||||
Status types.String `tfsdk:"status"`
|
||||
Type types.String `tfsdk:"type"`
|
||||
UserGroupID types.String `tfsdk:"user_group_id"`
|
||||
}
|
||||
|
||||
type QuotaModel struct {
|
||||
CPU types.Int64 `tfsdk:"cpu"`
|
||||
Ram types.Int64 `tfsdk:"ram"`
|
||||
Disk types.Int64 `tfsdk:"disk"`
|
||||
ExtTraffic types.Int64 `tfsdk:"ext_traffic"`
|
||||
ExtIps types.Int64 `tfsdk:"ext_ips"`
|
||||
GpuUnits types.Int64 `tfsdk:"gpu_units"`
|
||||
CuD types.Int64 `tfsdk:"cu_d"`
|
||||
}
|
||||
|
||||
type AccessModel struct {
|
||||
User types.String `tfsdk:"user"`
|
||||
Right types.String `tfsdk:"right"`
|
||||
Reason types.String `tfsdk:"reason"`
|
||||
}
|
||||
|
||||
type DefNetModel struct {
|
||||
NetType types.String `tfsdk:"net_type"`
|
||||
NetId types.Int64 `tfsdk:"net_id"`
|
||||
Reason types.String `tfsdk:"reason"`
|
||||
}
|
||||
|
||||
var ItemAccess = map[string]attr.Type{
|
||||
"user": types.StringType,
|
||||
"right": types.StringType,
|
||||
"reason": types.StringType,
|
||||
}
|
||||
|
||||
var ItemDefNet = map[string]attr.Type{
|
||||
"net_type": types.StringType,
|
||||
"net_id": types.Int64Type,
|
||||
"reason": types.StringType,
|
||||
}
|
||||
|
||||
var ItemACL = map[string]attr.Type{
|
||||
"explicit": types.BoolType,
|
||||
"guid": types.StringType,
|
||||
"right": types.StringType,
|
||||
"status": types.StringType,
|
||||
"type": types.StringType,
|
||||
"user_group_id": types.StringType,
|
||||
}
|
||||
|
||||
var ItemQuota = map[string]attr.Type{
|
||||
"cpu": types.Int64Type,
|
||||
"ram": types.Int64Type,
|
||||
"disk": types.Int64Type,
|
||||
"ext_traffic": types.Int64Type,
|
||||
"ext_ips": types.Int64Type,
|
||||
"gpu_units": types.Int64Type,
|
||||
"cu_d": types.Int64Type,
|
||||
}
|
||||
|
||||
// Contains returns true if accessList contains a as an element. Otherwise it returns false.
|
||||
func (a *AccessModel) Contains(accessList []AccessModel) bool {
|
||||
for _, accessElem := range accessList {
|
||||
if a.User.Equal(accessElem.User) && a.Right.Equal(accessElem.Right) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
Reference in New Issue
Block a user