This commit is contained in:
asteam
2024-07-25 14:33:38 +03:00
commit 6f40af6a5f
946 changed files with 98335 additions and 0 deletions

View File

@@ -0,0 +1,69 @@
package models
import (
"github.com/hashicorp/terraform-plugin-framework-timeouts/datasource/timeouts"
"github.com/hashicorp/terraform-plugin-framework/types"
)
type RecordBasicServiceModel struct {
ServiceId types.Int64 `tfsdk:"service_id"`
AccountID types.Int64 `tfsdk:"account_id"`
Timeouts timeouts.Value `tfsdk:"timeouts"`
AccountName types.String `tfsdk:"account_name"`
BaseDomain types.String `tfsdk:"base_domain"`
Computes []ItemComputeModel `tfsdk:"computes"`
CPUTotal types.Int64 `tfsdk:"cpu_total"`
CreatedBy types.String `tfsdk:"created_by"`
CreatedTime types.Int64 `tfsdk:"created_time"`
DeletedBy types.String `tfsdk:"deleted_by"`
DeletedTime types.Int64 `tfsdk:"deleted_time"`
DiskTotal types.Int64 `tfsdk:"disk_total"`
GID types.Int64 `tfsdk:"gid"`
Groups []ItemGroupModel `tfsdk:"groups"`
GUID types.Int64 `tfsdk:"guid"`
Milestones types.Int64 `tfsdk:"milestones"`
Name types.String `tfsdk:"service_name"`
ParentSrvID types.Int64 `tfsdk:"parent_srv_id"`
ParentSrvType types.String `tfsdk:"parent_srv_type"`
RAMTotal types.Int64 `tfsdk:"ram_total"`
RGID types.Int64 `tfsdk:"rg_id"`
RGName types.String `tfsdk:"rg_name"`
Snapshots []ItemSnapshotModel `tfsdk:"snapshots"`
SSHKey types.String `tfsdk:"ssh_key"`
SSHUser types.String `tfsdk:"ssh_user"`
Status types.String `tfsdk:"status"`
TechStatus types.String `tfsdk:"tech_status"`
UpdatedBy types.String `tfsdk:"updated_by"`
UpdatedTime types.Int64 `tfsdk:"updated_time"`
UserManaged types.Bool `tfsdk:"user_managed"`
}
type ItemComputeModel struct {
AccountID types.Int64 `tfsdk:"account_id"`
Architecture types.String `tfsdk:"architecture"`
CompGroupID types.Int64 `tfsdk:"compgroup_id"`
CompGroupName types.String `tfsdk:"compgroup_name"`
CompGroupRole types.String `tfsdk:"compgroup_role"`
ID types.Int64 `tfsdk:"id"`
Name types.String `tfsdk:"name"`
RGID types.Int64 `tfsdk:"rg_id"`
StackID types.Int64 `tfsdk:"stack_id"`
Status types.String `tfsdk:"status"`
TechStatus types.String `tfsdk:"tech_status"`
}
type ItemGroupModel struct {
Computes types.Int64 `tfsdk:"computes"`
Consistency types.Bool `tfsdk:"consistency"`
ID types.Int64 `tfsdk:"id"`
Name types.String `tfsdk:"name"`
Status types.String `tfsdk:"status"`
TechStatus types.String `tfsdk:"tech_status"`
}
type ItemSnapshotModel struct {
GUID types.String `tfsdk:"guid"`
Label types.String `tfsdk:"label"`
Timestamp types.Int64 `tfsdk:"timestamp"`
Valid types.Bool `tfsdk:"valid"`
}

View File

@@ -0,0 +1,45 @@
package models
import (
"github.com/hashicorp/terraform-plugin-framework-timeouts/datasource/timeouts"
"github.com/hashicorp/terraform-plugin-framework/types"
)
type ListBasicServicesDelModel struct {
//optional fields
AccountID types.Int64 `tfsdk:"account_id"`
RGID types.Int64 `tfsdk:"rg_id"`
SortBy types.String `tfsdk:"sort_by"`
Page types.Int64 `tfsdk:"page"`
Size types.Int64 `tfsdk:"size"`
Timeouts timeouts.Value `tfsdk:"timeouts"`
//computed fields
Data []ItemBasicServiceDelModel `tfsdk:"items"`
EntryCount types.Int64 `tfsdk:"entry_count"`
}
type ItemBasicServiceDelModel struct {
AccountID types.Int64 `tfsdk:"account_id"`
AccountName types.String `tfsdk:"account_name"`
BaseDomain types.String `tfsdk:"base_domain"`
CreatedBy types.String `tfsdk:"created_by"`
CreatedTime types.Int64 `tfsdk:"created_time"`
DeletedBy types.String `tfsdk:"deleted_by"`
DeletedTime types.Int64 `tfsdk:"deleted_time"`
GID types.Int64 `tfsdk:"gid"`
Groups []uint64 `tfsdk:"groups"`
GUID types.Int64 `tfsdk:"guid"`
ID types.Int64 `tfsdk:"service_id"`
Name types.String `tfsdk:"service_name"`
ParentSrvID types.Int64 `tfsdk:"parent_srv_id"`
ParentSrvType types.String `tfsdk:"parent_srv_type"`
RGID types.Int64 `tfsdk:"rg_id"`
RGName types.String `tfsdk:"rg_name"`
SSHUser types.String `tfsdk:"ssh_user"`
Status types.String `tfsdk:"status"`
TechStatus types.String `tfsdk:"tech_status"`
UpdatedBy types.String `tfsdk:"updated_by"`
UpdatedTime types.Int64 `tfsdk:"updated_time"`
UserManaged types.Bool `tfsdk:"user_managed"`
}

View File

@@ -0,0 +1,57 @@
package models
import (
"github.com/hashicorp/terraform-plugin-framework-timeouts/datasource/timeouts"
"github.com/hashicorp/terraform-plugin-framework/types"
)
type RecordGroupModel struct {
//required and optional fields
ServiceID types.Int64 `tfsdk:"service_id"`
ID types.Int64 `tfsdk:"compgroup_id"`
Timeouts timeouts.Value `tfsdk:"timeouts"`
//compute fields
AccountID types.Int64 `tfsdk:"account_id"`
AccountName types.String `tfsdk:"account_name"`
Computes []ItemGroupComputeModel `tfsdk:"computes"`
Consistency types.Bool `tfsdk:"consistency"`
CPU types.Int64 `tfsdk:"cpu"`
CreatedBy types.String `tfsdk:"created_by"`
CreatedTime types.Int64 `tfsdk:"created_time"`
DeletedBy types.String `tfsdk:"deleted_by"`
DeletedTime types.Int64 `tfsdk:"deleted_time"`
Disk types.Int64 `tfsdk:"disk"`
Driver types.String `tfsdk:"driver"`
ExtNets types.List `tfsdk:"extnets"`
GID types.Int64 `tfsdk:"gid"`
GUID types.Int64 `tfsdk:"guid"`
ImageID types.Int64 `tfsdk:"image_id"`
Milestones types.Int64 `tfsdk:"milestones"`
Name types.String `tfsdk:"compgroup_name"`
Parents types.List `tfsdk:"parents"`
RAM types.Int64 `tfsdk:"ram"`
RGID types.Int64 `tfsdk:"rg_id"`
RGName types.String `tfsdk:"rg_name"`
Role types.String `tfsdk:"role"`
SEPID types.Int64 `tfsdk:"sep_id"`
SeqNo types.Int64 `tfsdk:"seq_no"`
Status types.String `tfsdk:"status"`
TechStatus types.String `tfsdk:"tech_status"`
TimeoutStart types.Int64 `tfsdk:"timeout_start"`
UpdatedBy types.String `tfsdk:"updated_by"`
UpdatedTime types.Int64 `tfsdk:"updated_time"`
VINSes types.List `tfsdk:"vinses"`
}
type ItemGroupComputeModel struct {
ID types.Int64 `tfsdk:"id"`
IPAddresses types.List `tfsdk:"ip_addresses"`
Name types.String `tfsdk:"name"`
OSUsers []ItemOSUserModel `tfsdk:"os_users"`
}
type ItemOSUserModel struct {
Login types.String `tfsdk:"login"`
Password types.String `tfsdk:"password"`
}

View File

@@ -0,0 +1,48 @@
package models
import (
"github.com/hashicorp/terraform-plugin-framework-timeouts/datasource/timeouts"
"github.com/hashicorp/terraform-plugin-framework/types"
)
type ListBasicServicesModel struct {
ByID types.Int64 `tfsdk:"by_id"`
Name types.String `tfsdk:"name"`
RGName types.String `tfsdk:"rg_name"`
Status types.String `tfsdk:"status"`
TechStatus types.String `tfsdk:"tech_status"`
AccountName types.String `tfsdk:"account_name"`
AccountID types.Int64 `tfsdk:"account_id"`
RGID types.Int64 `tfsdk:"rg_id"`
SortBy types.String `tfsdk:"sort_by"`
Page types.Int64 `tfsdk:"page"`
Size types.Int64 `tfsdk:"size"`
Data []ItemBasicServiceModel `tfsdk:"items"`
EntryCount types.Int64 `tfsdk:"entry_count"`
Timeouts timeouts.Value `tfsdk:"timeouts"`
}
type ItemBasicServiceModel struct {
AccountID types.Int64 `tfsdk:"account_id"`
AccountName types.String `tfsdk:"account_name"`
BaseDomain types.String `tfsdk:"base_domain"`
CreatedBy types.String `tfsdk:"created_by"`
CreatedTime types.Int64 `tfsdk:"created_time"`
DeletedBy types.String `tfsdk:"deleted_by"`
DeletedTime types.Int64 `tfsdk:"deleted_time"`
GID types.Int64 `tfsdk:"gid"`
Groups []uint64 `tfsdk:"groups"`
GUID types.Int64 `tfsdk:"guid"`
ID types.Int64 `tfsdk:"service_id"`
Name types.String `tfsdk:"service_name"`
ParentSrvID types.Int64 `tfsdk:"parent_srv_id"`
ParentSrvType types.String `tfsdk:"parent_srv_type"`
RGID types.Int64 `tfsdk:"rg_id"`
RGName types.String `tfsdk:"rg_name"`
SSHUser types.String `tfsdk:"ssh_user"`
Status types.String `tfsdk:"status"`
TechStatus types.String `tfsdk:"tech_status"`
UpdatedBy types.String `tfsdk:"updated_by"`
UpdatedTime types.Int64 `tfsdk:"updated_time"`
UserManaged types.Bool `tfsdk:"user_managed"`
}

View File

@@ -0,0 +1,23 @@
package models
import (
"github.com/hashicorp/terraform-plugin-framework-timeouts/datasource/timeouts"
"github.com/hashicorp/terraform-plugin-framework/types"
)
type ListInfoSnapshotsModel struct {
//required fields
ServiceID types.Int64 `tfsdk:"service_id"`
//computed fields
Data []ItemSnapshotsModel `tfsdk:"items"`
EntryCount types.Int64 `tfsdk:"entry_count"`
Timeouts timeouts.Value `tfsdk:"timeouts"`
}
type ItemSnapshotsModel struct {
GUID types.String `tfsdk:"guid"`
Label types.String `tfsdk:"label"`
Timestamp types.Int64 `tfsdk:"timestamp"`
Valid types.Bool `tfsdk:"valid"`
}

View File

@@ -0,0 +1,112 @@
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 RecordBasicServiceResourceModel struct {
//required fields
Name types.String `tfsdk:"service_name"`
RGID types.Int64 `tfsdk:"rg_id"`
//optional fields
SSHKey types.String `tfsdk:"ssh_key"`
SSHUser types.String `tfsdk:"ssh_user"`
Permanently types.Bool `tfsdk:"permanently"`
Enable types.Bool `tfsdk:"enable"`
Restore types.Bool `tfsdk:"restore"`
Start types.Bool `tfsdk:"start"`
ServiceId types.Int64 `tfsdk:"service_id"`
Snapshots types.List `tfsdk:"snapshots"`
Timeouts timeouts.Value `tfsdk:"timeouts"`
//computed fields
AccountID types.Int64 `tfsdk:"account_id"`
AccountName types.String `tfsdk:"account_name"`
BaseDomain types.String `tfsdk:"base_domain"`
Computes types.List `tfsdk:"computes"`
CPUTotal types.Int64 `tfsdk:"cpu_total"`
CreatedBy types.String `tfsdk:"created_by"`
CreatedTime types.Int64 `tfsdk:"created_time"`
DeletedBy types.String `tfsdk:"deleted_by"`
DeletedTime types.Int64 `tfsdk:"deleted_time"`
DiskTotal types.Int64 `tfsdk:"disk_total"`
GID types.Int64 `tfsdk:"gid"`
Groups types.List `tfsdk:"groups"`
GUID types.Int64 `tfsdk:"guid"`
Milestones types.Int64 `tfsdk:"milestones"`
ParentSrvID types.Int64 `tfsdk:"parent_srv_id"`
ParentSrvType types.String `tfsdk:"parent_srv_type"`
RAMTotal types.Int64 `tfsdk:"ram_total"`
RGName types.String `tfsdk:"rg_name"`
Status types.String `tfsdk:"status"`
TechStatus types.String `tfsdk:"tech_status"`
UpdatedBy types.String `tfsdk:"updated_by"`
UpdatedTime types.Int64 `tfsdk:"updated_time"`
UserManaged types.Bool `tfsdk:"user_managed"`
ID types.String `tfsdk:"id"`
}
type ItemComputeResourceModel struct {
AccountID types.Int64 `tfsdk:"account_id"`
Architecture types.String `tfsdk:"architecture"`
CompGroupID types.Int64 `tfsdk:"compgroup_id"`
CompGroupName types.String `tfsdk:"compgroup_name"`
CompGroupRole types.String `tfsdk:"compgroup_role"`
ID types.Int64 `tfsdk:"id"`
Name types.String `tfsdk:"name"`
RGID types.Int64 `tfsdk:"rg_id"`
StackID types.Int64 `tfsdk:"stack_id"`
Status types.String `tfsdk:"status"`
TechStatus types.String `tfsdk:"tech_status"`
}
var ItemComputeResource = map[string]attr.Type{
"account_id": types.Int64Type,
"architecture": types.StringType,
"compgroup_id": types.Int64Type,
"compgroup_name": types.StringType,
"compgroup_role": types.StringType,
"id": types.Int64Type,
"name": types.StringType,
"rg_id": types.Int64Type,
"stack_id": types.Int64Type,
"status": types.StringType,
"tech_status": types.StringType,
}
type ItemGroupResourceModel struct {
Computes types.Int64 `tfsdk:"computes"`
Consistency types.Bool `tfsdk:"consistency"`
ID types.Int64 `tfsdk:"id"`
Name types.String `tfsdk:"name"`
Status types.String `tfsdk:"status"`
TechStatus types.String `tfsdk:"tech_status"`
}
var ItemGroupResource = map[string]attr.Type{
"computes": types.Int64Type,
"consistency": types.BoolType,
"id": types.Int64Type,
"name": types.StringType,
"status": types.StringType,
"tech_status": types.StringType,
}
type ItemSnapshotResourceModel struct {
GUID types.String `tfsdk:"guid"`
Label types.String `tfsdk:"label"`
Rollback types.Bool `tfsdk:"rollback"`
Timestamp types.Int64 `tfsdk:"timestamp"`
Valid types.Bool `tfsdk:"valid"`
}
var ItemSnapshotResource = map[string]attr.Type{
"guid": types.StringType,
"label": types.StringType,
"rollback": types.BoolType,
"timestamp": types.Int64Type,
"valid": types.BoolType,
}

View File

@@ -0,0 +1,82 @@
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 ResourceRecordGroupModel struct {
//required fields
ServiceID types.Int64 `tfsdk:"service_id"`
CompCount types.Int64 `tfsdk:"comp_count"`
Name types.String `tfsdk:"compgroup_name"`
CPU types.Int64 `tfsdk:"cpu"`
RAM types.Int64 `tfsdk:"ram"`
Disk types.Int64 `tfsdk:"disk"`
ImageID types.Int64 `tfsdk:"image_id"`
Driver types.String `tfsdk:"driver"`
//optional fields
SEPID types.Int64 `tfsdk:"sep_id"`
SepPool types.String `tfsdk:"sep_pool"`
CloudInit types.String `tfsdk:"cloud_init"`
Role types.String `tfsdk:"role"`
TimeoutStart types.Int64 `tfsdk:"timeout_start"`
VINSes types.List `tfsdk:"vinses"`
ExtNets types.List `tfsdk:"extnets"`
Mode types.String `tfsdk:"mode"`
Start types.Bool `tfsdk:"start"`
ForceStop types.Bool `tfsdk:"force_stop"`
ForceUpdate types.Bool `tfsdk:"force_update"`
Parents types.List `tfsdk:"parents"`
RemoveComputes types.List `tfsdk:"remove_computes"`
CompgroupID types.Int64 `tfsdk:"compgroup_id"`
Timeouts timeouts.Value `tfsdk:"timeouts"`
//compute fields
AccountID types.Int64 `tfsdk:"account_id"`
AccountName types.String `tfsdk:"account_name"`
Computes types.List `tfsdk:"computes"`
Consistency types.Bool `tfsdk:"consistency"`
CreatedBy types.String `tfsdk:"created_by"`
CreatedTime types.Int64 `tfsdk:"created_time"`
DeletedBy types.String `tfsdk:"deleted_by"`
DeletedTime types.Int64 `tfsdk:"deleted_time"`
GID types.Int64 `tfsdk:"gid"`
GUID types.Int64 `tfsdk:"guid"`
Milestones types.Int64 `tfsdk:"milestones"`
RGID types.Int64 `tfsdk:"rg_id"`
RGName types.String `tfsdk:"rg_name"`
SeqNo types.Int64 `tfsdk:"seq_no"`
Status types.String `tfsdk:"status"`
TechStatus types.String `tfsdk:"tech_status"`
UpdatedBy types.String `tfsdk:"updated_by"`
UpdatedTime types.Int64 `tfsdk:"updated_time"`
ID types.String `tfsdk:"id"`
SID types.String `tfsdk:"sid"`
}
type ResourceItemGroupComputeModel struct {
ID types.Int64 `tfsdk:"id"`
IPAddresses types.List `tfsdk:"ip_addresses"`
Name types.String `tfsdk:"name"`
OSUsers types.List `tfsdk:"os_users"`
}
var ResourceItemGroupCompute = map[string]attr.Type{
"id": types.Int64Type,
"ip_addresses": types.ListType{ElemType: types.StringType},
"name": types.StringType,
"os_users": types.ListType{ElemType: types.ObjectType{AttrTypes: ResourceItemOSUser}},
}
type ResourceItemOSUserModel struct {
Login types.String `tfsdk:"login"`
Password types.String `tfsdk:"password"`
}
var ResourceItemOSUser = map[string]attr.Type{
"login": types.StringType,
"password": types.StringType,
}