3.0/migrate and refactoring See merge request rudecs/terraform-provider-decort!25gos_tech_4.4.3
commit
e4be812c68
@ -1,58 +0,0 @@
|
||||
/*
|
||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Author: Stanislav Solovev, <spsolovev@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.
|
||||
*/
|
||||
|
||||
/*
|
||||
This file is part of Terraform (by Hashicorp) provider for Digital Energy Cloud Orchestration
|
||||
Technology platfom.
|
||||
|
||||
Visit https://github.com/rudecs/terraform-provider-decort for full source code package and updates.
|
||||
*/
|
||||
|
||||
package decort
|
||||
|
||||
import (
|
||||
"github.com/google/uuid"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
|
||||
)
|
||||
|
||||
func dataSourceAccountDeletedListRead(d *schema.ResourceData, m interface{}) error {
|
||||
accountDeletedList, err := utilityAccountDeletedListCheckPresence(d, m)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
id := uuid.New()
|
||||
d.SetId(id.String())
|
||||
d.Set("items", flattenAccountList(accountDeletedList))
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func dataSourceAccountDeletedList() *schema.Resource {
|
||||
return &schema.Resource{
|
||||
SchemaVersion: 1,
|
||||
|
||||
Read: dataSourceAccountDeletedListRead,
|
||||
|
||||
Timeouts: &schema.ResourceTimeout{
|
||||
Read: &Timeout30s,
|
||||
Default: &Timeout60s,
|
||||
},
|
||||
|
||||
Schema: dataSourceAccountListSchemaMake(),
|
||||
}
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
/*
|
||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Author: Stanislav Solovev, <spsolovev@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.
|
||||
*/
|
||||
|
||||
/*
|
||||
This file is part of Terraform (by Hashicorp) provider for Digital Energy Cloud Orchestration
|
||||
Technology platfom.
|
||||
|
||||
Visit https://github.com/rudecs/terraform-provider-decort for full source code package and updates.
|
||||
*/
|
||||
|
||||
package decort
|
||||
|
||||
import (
|
||||
"github.com/google/uuid"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
|
||||
)
|
||||
|
||||
func dataSourceBasicServiceDeletedListRead(d *schema.ResourceData, m interface{}) error {
|
||||
basicServiceDeletedList, err := utilityBasicServiceDeletedListCheckPresence(d, m)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
id := uuid.New()
|
||||
d.SetId(id.String())
|
||||
d.Set("items", flattenBasicServiceList(basicServiceDeletedList))
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func dataSourceBasicServiceDeletedList() *schema.Resource {
|
||||
return &schema.Resource{
|
||||
SchemaVersion: 1,
|
||||
|
||||
Read: dataSourceBasicServiceDeletedListRead,
|
||||
|
||||
Timeouts: &schema.ResourceTimeout{
|
||||
Read: &Timeout30s,
|
||||
Default: &Timeout60s,
|
||||
},
|
||||
|
||||
Schema: dataSourceBasicServiceListSchemaMake(),
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,196 +0,0 @@
|
||||
/*
|
||||
Copyright (c) 2019-2021 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Author: Sergey Shubin, <sergey.shubin@digitalenergy.online>, <svs1370@gmail.com>
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
package decort
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/helper/validation"
|
||||
// "github.com/hashicorp/terraform-plugin-sdk/terraform"
|
||||
)
|
||||
|
||||
func Provider() *schema.Provider {
|
||||
return &schema.Provider{
|
||||
Schema: map[string]*schema.Schema{
|
||||
"authenticator": {
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
StateFunc: stateFuncToLower,
|
||||
ValidateFunc: validation.StringInSlice([]string{"oauth2", "legacy", "jwt"}, true), // ignore case while validating
|
||||
Description: "Authentication mode to use when connecting to DECORT cloud API. Should be one of 'oauth2', 'legacy' or 'jwt'.",
|
||||
},
|
||||
|
||||
"oauth2_url": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
StateFunc: stateFuncToLower,
|
||||
DefaultFunc: schema.EnvDefaultFunc("DECORT_OAUTH2_URL", nil),
|
||||
Description: "OAuth2 application URL in 'oauth2' authentication mode.",
|
||||
},
|
||||
|
||||
"controller_url": {
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
ForceNew: true,
|
||||
StateFunc: stateFuncToLower,
|
||||
Description: "URL of DECORT Cloud controller to use. API calls will be directed to this URL.",
|
||||
},
|
||||
|
||||
"user": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
DefaultFunc: schema.EnvDefaultFunc("DECORT_USER", nil),
|
||||
Description: "User name for DECORT cloud API operations in 'legacy' authentication mode.",
|
||||
},
|
||||
|
||||
"password": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
DefaultFunc: schema.EnvDefaultFunc("DECORT_PASSWORD", nil),
|
||||
Description: "User password for DECORT cloud API operations in 'legacy' authentication mode.",
|
||||
},
|
||||
|
||||
"app_id": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
DefaultFunc: schema.EnvDefaultFunc("DECORT_APP_ID", nil),
|
||||
Description: "Application ID to access DECORT cloud API in 'oauth2' authentication mode.",
|
||||
},
|
||||
|
||||
"app_secret": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
DefaultFunc: schema.EnvDefaultFunc("DECORT_APP_SECRET", nil),
|
||||
Description: "Application secret to access DECORT cloud API in 'oauth2' authentication mode.",
|
||||
},
|
||||
|
||||
"jwt": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
DefaultFunc: schema.EnvDefaultFunc("DECORT_JWT", nil),
|
||||
Description: "JWT to access DECORT cloud API in 'jwt' authentication mode.",
|
||||
},
|
||||
|
||||
"allow_unverified_ssl": {
|
||||
Type: schema.TypeBool,
|
||||
Optional: true,
|
||||
Default: false,
|
||||
Description: "If true, DECORT API will not verify SSL certificates. Use this with caution and in trusted environments only!",
|
||||
},
|
||||
},
|
||||
|
||||
ResourcesMap: map[string]*schema.Resource{
|
||||
"decort_resgroup": resourceResgroup(),
|
||||
"decort_kvmvm": resourceCompute(),
|
||||
"decort_disk": resourceDisk(),
|
||||
"decort_vins": resourceVins(),
|
||||
"decort_pfw": resourcePfw(),
|
||||
"decort_k8s": resourceK8s(),
|
||||
"decort_k8s_wg": resourceK8sWg(),
|
||||
"decort_image": resourceImage(),
|
||||
"decort_virtual_image": resourceVirtualImage(),
|
||||
"decort_cdrom_image": resourceCDROMImage(),
|
||||
"decort_delete_images": resourceDeleteImages(),
|
||||
"decort_snapshot": resourceSnapshot(),
|
||||
"decort_pcidevice": resourcePcidevice(),
|
||||
"decort_sep": resourceSep(),
|
||||
"decort_sep_config": resourceSepConfig(),
|
||||
"decort_account": resourceAccount(),
|
||||
"decort_bservice": resourceBasicService(),
|
||||
"decort_bservice_group": resourceBasicServiceGroup(),
|
||||
},
|
||||
|
||||
DataSourcesMap: map[string]*schema.Resource{
|
||||
"decort_account": dataSourceAccount(),
|
||||
"decort_resgroup": dataSourceResgroup(),
|
||||
"decort_kvmvm": dataSourceCompute(),
|
||||
"decort_image": dataSourceImage(),
|
||||
"decort_disk": dataSourceDisk(),
|
||||
"decort_vins": dataSourceVins(),
|
||||
"decort_grid": dataSourceGrid(),
|
||||
"decort_grid_list": dataSourceGridList(),
|
||||
"decort_image_list": dataSourceImageList(),
|
||||
"decort_image_list_stacks": dataSourceImageListStacks(),
|
||||
"decort_snapshot_list": dataSourceSnapshotList(),
|
||||
"decort_vgpu": dataSourceVGPU(),
|
||||
"decort_pcidevice": dataSourcePcidevice(),
|
||||
"decort_pcidevice_list": dataSourcePcideviceList(),
|
||||
"decort_sep_list": dataSourceSepList(),
|
||||
"decort_sep": dataSourceSep(),
|
||||
"decort_sep_consumption": dataSourceSepConsumption(),
|
||||
"decort_sep_disk_list": dataSourceSepDiskList(),
|
||||
"decort_sep_config": dataSourceSepConfig(),
|
||||
"decort_sep_pool": dataSourceSepPool(),
|
||||
"decort_disk_list": dataSourceDiskList(),
|
||||
"decort_rg_list": dataSourceRgList(),
|
||||
"decort_account_list": dataSourceAccountList(),
|
||||
"decort_account_computes_list": dataSourceAccountComputesList(),
|
||||
"decort_account_disks_list": dataSourceAccountDisksList(),
|
||||
"decort_account_vins_list": dataSourceAccountVinsList(),
|
||||
"decort_account_audits_list": dataSourceAccountAuditsList(),
|
||||
"decort_account_rg_list": dataSourceAccountRGList(),
|
||||
"decort_account_consumed_units": dataSourceAccountConsumedUnits(),
|
||||
"decort_account_consumed_units_by_type": dataSourceAccountConsumedUnitsByType(),
|
||||
"decort_account_reserved_units": dataSourceAccountReservedUnits(),
|
||||
"decort_account_templates_list": dataSourceAccountTemplatessList(),
|
||||
"decort_account_deleted_list": dataSourceAccountDeletedList(),
|
||||
"decort_account_flipgroups_list": dataSourceAccountFlipGroupsList(),
|
||||
"decort_bservice_list": dataSourceBasicServiceList(),
|
||||
"decort_bservice": dataSourceBasicService(),
|
||||
"decort_bservice_snapshot_list": dataSourceBasicServiceSnapshotList(),
|
||||
"decort_bservice_group": dataSourceBasicServiceGroup(),
|
||||
"decort_bservice_deleted_list": dataSourceBasicServiceDeletedList(),
|
||||
"decort_extnet_list": dataSourceExtnetList(),
|
||||
"decort_extnet_computes_list": dataSourceExtnetComputesList(),
|
||||
"decort_extnet": dataSourceExtnet(),
|
||||
"decort_extnet_default": dataSourceExtnetDefault(),
|
||||
"decort_vins_list": dataSourceVinsList(),
|
||||
// "decort_pfw": dataSourcePfw(),
|
||||
},
|
||||
|
||||
ConfigureFunc: providerConfigure,
|
||||
}
|
||||
}
|
||||
|
||||
func stateFuncToLower(argval interface{}) string {
|
||||
return strings.ToLower(argval.(string))
|
||||
}
|
||||
|
||||
func stateFuncToUpper(argval interface{}) string {
|
||||
return strings.ToUpper(argval.(string))
|
||||
}
|
||||
|
||||
func providerConfigure(d *schema.ResourceData) (interface{}, error) {
|
||||
decsController, err := ControllerConfigure(d)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// initialize global default Grid ID - it will be needed to create some resource types, e.g. disks
|
||||
gridId, err := decsController.utilityLocationGetDefaultGridID()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if gridId == 0 {
|
||||
return nil, fmt.Errorf("providerConfigure: invalid default Grid ID = 0")
|
||||
}
|
||||
|
||||
return decsController, nil
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
/*
|
||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Author: Stanislav Solovev, <spsolovev@digitalenergy.online>, <svs1370@gmail.com>
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
/*
|
||||
This file is part of Terraform (by Hashicorp) provider for Digital Energy Cloud Orchestration
|
||||
Technology platfom.
|
||||
|
||||
Visit https://github.com/rudecs/terraform-provider-decort for full source code package and updates.
|
||||
*/
|
||||
|
||||
package decort
|
||||
|
||||
import (
|
||||
"net/url"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
|
||||
)
|
||||
|
||||
func utilityExtnetDefaultCheckPresence(_ *schema.ResourceData, m interface{}) (string, error) {
|
||||
controller := m.(*ControllerCfg)
|
||||
urlValues := &url.Values{}
|
||||
|
||||
log.Debugf("utilityExtnetDefaultCheckPresence")
|
||||
res, err := controller.decortAPICall("POST", extnetGetDefaultAPI, urlValues)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return res, nil
|
||||
}
|
@ -1,50 +0,0 @@
|
||||
/*
|
||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Author: Stanislav Solovev, <spsolovev@digitalenergy.online>, <svs1370@gmail.com>
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
/*
|
||||
This file is part of Terraform (by Hashicorp) provider for Digital Energy Cloud Orchestration
|
||||
Technology platfom.
|
||||
|
||||
Visit https://github.com/rudecs/terraform-provider-decort for full source code package and updates.
|
||||
*/
|
||||
|
||||
package decort
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"net/url"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
|
||||
)
|
||||
|
||||
func utilityPcideviceListCheckPresence(_ *schema.ResourceData, m interface{}) (PcideviceList, error) {
|
||||
pcideviceList := PcideviceList{}
|
||||
controller := m.(*ControllerCfg)
|
||||
urlValues := &url.Values{}
|
||||
|
||||
pcideviceListRaw, err := controller.decortAPICall("POST", pcideviceListAPI, urlValues)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = json.Unmarshal([]byte(pcideviceListRaw), &pcideviceList)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return pcideviceList, nil
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
/*
|
||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Authors:
|
||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||
Stanislav Solovev, <spsolovev@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.
|
||||
*/
|
||||
|
||||
package constants
|
||||
|
||||
//CloudApi - a part of url for cloudapi
|
||||
const CloudApi = "/restmachine/cloudapi"
|
||||
|
||||
//CloudBroker - a part of url for cloudbroker
|
||||
const CloudBroker = "/restmachine/cloudbroker"
|
@ -0,0 +1,28 @@
|
||||
/*
|
||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Authors:
|
||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||
Stanislav Solovev, <spsolovev@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.
|
||||
*/
|
||||
|
||||
package constants
|
||||
|
||||
import "time"
|
||||
|
||||
// timeouts for API calls from CRUD functions of Terraform plugin
|
||||
var Timeout30s = time.Second * 30
|
||||
var Timeout60s = time.Second * 60
|
||||
var Timeout180s = time.Second * 180
|
||||
var Timeout20m = time.Minute * 20
|
@ -0,0 +1,41 @@
|
||||
/*
|
||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Authors:
|
||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||
Stanislav Solovev, <spsolovev@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.
|
||||
*/
|
||||
|
||||
package flattens
|
||||
|
||||
import "strconv"
|
||||
|
||||
func FlattenMeta(m []interface{}) []string {
|
||||
output := []string{}
|
||||
for _, item := range m {
|
||||
switch d := item.(type) {
|
||||
case string:
|
||||
output = append(output, d)
|
||||
case int:
|
||||
output = append(output, strconv.Itoa(d))
|
||||
case int64:
|
||||
output = append(output, strconv.FormatInt(d, 10))
|
||||
case float64:
|
||||
output = append(output, strconv.FormatInt(int64(d), 10))
|
||||
default:
|
||||
output = append(output, "")
|
||||
}
|
||||
}
|
||||
return output
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
/*
|
||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Authors:
|
||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||
Stanislav Solovev, <spsolovev@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.
|
||||
*/
|
||||
|
||||
package location
|
||||
|
||||
const LocationsListAPI = "/restmachine/cloudapi/locations/list" // Returns list of GridRecord on success
|
@ -0,0 +1,30 @@
|
||||
/*
|
||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Authors:
|
||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||
Stanislav Solovev, <spsolovev@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.
|
||||
*/
|
||||
|
||||
package location
|
||||
|
||||
type LocationRecord struct {
|
||||
GridID int `json:"gid"`
|
||||
Id int `json:"id"`
|
||||
LocationCode string `json:"locationCode"`
|
||||
Name string `json:"name"`
|
||||
Flag string `json:"flag"`
|
||||
}
|
||||
|
||||
type LocationsListResp []LocationRecord
|
@ -0,0 +1,87 @@
|
||||
/*
|
||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Authors:
|
||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||
Stanislav Solovev, <spsolovev@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.
|
||||
*/
|
||||
|
||||
package provider
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudapi/account"
|
||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudapi/bservice"
|
||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudapi/disks"
|
||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudapi/extnet"
|
||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudapi/rg"
|
||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudapi/snapshot"
|
||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudapi/vgpu"
|
||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudapi/vins"
|
||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudbroker/grid"
|
||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudbroker/image"
|
||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudbroker/pcidevice"
|
||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudbroker/sep"
|
||||
)
|
||||
|
||||
func NewDataSourcesMap() map[string]*schema.Resource {
|
||||
return map[string]*schema.Resource{
|
||||
"decort_account": account.DataSourceAccount(),
|
||||
"decort_resgroup": rg.DataSourceResgroup(),
|
||||
// "decort_kvmvm": dataSourceCompute(),
|
||||
"decort_image": image.DataSourceImage(),
|
||||
"decort_disk": disks.DataSourceDisk(),
|
||||
"decort_vins": vins.DataSourceVins(),
|
||||
"decort_grid": grid.DataSourceGrid(),
|
||||
"decort_grid_list": grid.DataSourceGridList(),
|
||||
"decort_image_list": image.DataSourceImageList(),
|
||||
"decort_image_list_stacks": image.DataSourceImageListStacks(),
|
||||
"decort_snapshot_list": snapshot.DataSourceSnapshotList(),
|
||||
"decort_vgpu": vgpu.DataSourceVGPU(),
|
||||
"decort_pcidevice": pcidevice.DataSourcePcidevice(),
|
||||
"decort_pcidevice_list": pcidevice.DataSourcePcideviceList(),
|
||||
"decort_sep_list": sep.DataSourceSepList(),
|
||||
"decort_sep": sep.DataSourceSep(),
|
||||
"decort_sep_consumption": sep.DataSourceSepConsumption(),
|
||||
"decort_sep_disk_list": sep.DataSourceSepDiskList(),
|
||||
"decort_sep_config": sep.DataSourceSepConfig(),
|
||||
"decort_sep_pool": sep.DataSourceSepPool(),
|
||||
"decort_disk_list": disks.DataSourceDiskList(),
|
||||
"decort_rg_list": rg.DataSourceRgList(),
|
||||
"decort_account_list": account.DataSourceAccountList(),
|
||||
"decort_account_computes_list": account.DataSourceAccountComputesList(),
|
||||
"decort_account_disks_list": account.DataSourceAccountDisksList(),
|
||||
"decort_account_vins_list": account.DataSourceAccountVinsList(),
|
||||
"decort_account_audits_list": account.DataSourceAccountAuditsList(),
|
||||
"decort_account_rg_list": account.DataSourceAccountRGList(),
|
||||
"decort_account_consumed_units": account.DataSourceAccountConsumedUnits(),
|
||||
"decort_account_consumed_units_by_type": account.DataSourceAccountConsumedUnitsByType(),
|
||||
"decort_account_reserved_units": account.DataSourceAccountReservedUnits(),
|
||||
"decort_account_templates_list": account.DataSourceAccountTemplatessList(),
|
||||
"decort_account_deleted_list": account.DataSourceAccountDeletedList(),
|
||||
"decort_account_flipgroups_list": account.DataSourceAccountFlipGroupsList(),
|
||||
"decort_bservice_list": bservice.DataSourceBasicServiceList(),
|
||||
"decort_bservice": bservice.DataSourceBasicService(),
|
||||
"decort_bservice_snapshot_list": bservice.DataSourceBasicServiceSnapshotList(),
|
||||
"decort_bservice_group": bservice.DataSourceBasicServiceGroup(),
|
||||
"decort_bservice_deleted_list": bservice.DataSourceBasicServiceDeletedList(),
|
||||
"decort_extnet_list": extnet.DataSourceExtnetList(),
|
||||
"decort_extnet_computes_list": extnet.DataSourceExtnetComputesList(),
|
||||
"decort_extnet": extnet.DataSourceExtnet(),
|
||||
"decort_extnet_default": extnet.DataSourceExtnetDefault(),
|
||||
"decort_vins_list": vins.DataSourceVinsList(),
|
||||
// "decort_pfw": dataSourcePfw(),
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,137 @@
|
||||
/*
|
||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Authors:
|
||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||
Stanislav Solovev, <spsolovev@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.
|
||||
*/
|
||||
|
||||
package provider
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
|
||||
"golang.org/x/net/context"
|
||||
|
||||
"github.com/rudecs/terraform-provider-decort/internal/controller"
|
||||
"github.com/rudecs/terraform-provider-decort/internal/location"
|
||||
)
|
||||
|
||||
func Provider() *schema.Provider {
|
||||
return &schema.Provider{
|
||||
Schema: map[string]*schema.Schema{
|
||||
"authenticator": {
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
StateFunc: StateFuncToLower,
|
||||
ValidateFunc: validation.StringInSlice([]string{"oauth2", "legacy", "jwt"}, true), // ignore case while validating
|
||||
Description: "Authentication mode to use when connecting to DECORT cloud API. Should be one of 'oauth2', 'legacy' or 'jwt'.",
|
||||
},
|
||||
|
||||
"oauth2_url": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
StateFunc: StateFuncToLower,
|
||||
DefaultFunc: schema.EnvDefaultFunc("DECORT_OAUTH2_URL", nil),
|
||||
Description: "OAuth2 application URL in 'oauth2' authentication mode.",
|
||||
},
|
||||
|
||||
"controller_url": {
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
ForceNew: true,
|
||||
StateFunc: StateFuncToLower,
|
||||
Description: "URL of DECORT Cloud controller to use. API calls will be directed to this URL.",
|
||||
},
|
||||
|
||||
"user": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
DefaultFunc: schema.EnvDefaultFunc("DECORT_USER", nil),
|
||||
Description: "User name for DECORT cloud API operations in 'legacy' authentication mode.",
|
||||
},
|
||||
|
||||
"password": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
DefaultFunc: schema.EnvDefaultFunc("DECORT_PASSWORD", nil),
|
||||
Description: "User password for DECORT cloud API operations in 'legacy' authentication mode.",
|
||||
},
|
||||
|
||||
"app_id": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
DefaultFunc: schema.EnvDefaultFunc("DECORT_APP_ID", nil),
|
||||
Description: "Application ID to access DECORT cloud API in 'oauth2' authentication mode.",
|
||||
},
|
||||
|
||||
"app_secret": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
DefaultFunc: schema.EnvDefaultFunc("DECORT_APP_SECRET", nil),
|
||||
Description: "Application secret to access DECORT cloud API in 'oauth2' authentication mode.",
|
||||
},
|
||||
|
||||
"jwt": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
DefaultFunc: schema.EnvDefaultFunc("DECORT_JWT", nil),
|
||||
Description: "JWT to access DECORT cloud API in 'jwt' authentication mode.",
|
||||
},
|
||||
|
||||
"allow_unverified_ssl": {
|
||||
Type: schema.TypeBool,
|
||||
Optional: true,
|
||||
Default: false,
|
||||
Description: "If true, DECORT API will not verify SSL certificates. Use this with caution and in trusted environments only!",
|
||||
},
|
||||
},
|
||||
|
||||
ResourcesMap: NewRersourcesMap(),
|
||||
|
||||
DataSourcesMap: NewDataSourcesMap(),
|
||||
|
||||
ConfigureFunc: providerConfigure,
|
||||
}
|
||||
}
|
||||
|
||||
func StateFuncToLower(argval interface{}) string {
|
||||
return strings.ToLower(argval.(string))
|
||||
}
|
||||
|
||||
func StateFuncToUpper(argval interface{}) string {
|
||||
return strings.ToUpper(argval.(string))
|
||||
}
|
||||
|
||||
func providerConfigure(d *schema.ResourceData) (interface{}, error) {
|
||||
decsController, err := controller.ControllerConfigure(d)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
gridId, err := location.UtilityLocationGetDefaultGridID(ctx, decsController)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if gridId == 0 {
|
||||
return nil, fmt.Errorf("providerConfigure: invalid default Grid ID = 0")
|
||||
}
|
||||
|
||||
return decsController, nil
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
/*
|
||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Authors:
|
||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||
Stanislav Solovev, <spsolovev@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.
|
||||
*/
|
||||
|
||||
package provider
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudapi/account"
|
||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudapi/bservice"
|
||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudapi/disks"
|
||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudapi/k8s"
|
||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudapi/pfw"
|
||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudapi/rg"
|
||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudapi/snapshot"
|
||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudapi/vins"
|
||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudbroker/image"
|
||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudbroker/pcidevice"
|
||||
"github.com/rudecs/terraform-provider-decort/internal/service/cloudbroker/sep"
|
||||
)
|
||||
|
||||
func NewRersourcesMap() map[string]*schema.Resource {
|
||||
return map[string]*schema.Resource{
|
||||
"decort_resgroup": rg.ResourceResgroup(),
|
||||
// "decort_kvmvm": resourceCompute(),
|
||||
"decort_disk": disks.ResourceDisk(),
|
||||
"decort_vins": vins.ResourceVins(),
|
||||
"decort_pfw": pfw.ResourcePfw(),
|
||||
"decort_k8s": k8s.ResourceK8s(),
|
||||
"decort_k8s_wg": k8s.ResourceK8sWg(),
|
||||
"decort_image": image.ResourceImage(),
|
||||
"decort_virtual_image": image.ResourceVirtualImage(),
|
||||
"decort_cdrom_image": image.ResourceCDROMImage(),
|
||||
"decort_delete_images": image.ResourceDeleteImages(),
|
||||
"decort_snapshot": snapshot.ResourceSnapshot(),
|
||||
"decort_pcidevice": pcidevice.ResourcePcidevice(),
|
||||
"decort_sep": sep.ResourceSep(),
|
||||
"decort_sep_config": sep.ResourceSepConfig(),
|
||||
"decort_account": account.ResourceAccount(),
|
||||
"decort_bservice": bservice.ResourceBasicService(),
|
||||
"decort_bservice_group": bservice.ResourceBasicServiceGroup(),
|
||||
}
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
/*
|
||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Authors:
|
||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||
Stanislav Solovev, <spsolovev@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://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 account
|
||||
|
||||
const accountAddUserAPI = "/restmachine/cloudapi/account/addUser"
|
||||
const accountAuditsAPI = "/restmachine/cloudapi/account/audits"
|
||||
const accountCreateAPI = "/restmachine/cloudapi/account/create"
|
||||
const accountDeleteAPI = "/restmachine/cloudapi/account/delete"
|
||||
const accountDeleteUserAPI = "/restmachine/cloudapi/account/deleteUser"
|
||||
const accountDisableAPI = "/restmachine/cloudapi/account/disable"
|
||||
const accountEnableAPI = "/restmachine/cloudapi/account/enable"
|
||||
const accountGetAPI = "/restmachine/cloudapi/account/get"
|
||||
const accountGetConsumedUnitsAPI = "/restmachine/cloudapi/account/getConsumedAccountUnits"
|
||||
const accountGetConsumedUnitsByTypeAPI = "/restmachine/cloudapi/account/getConsumedCloudUnitsByType"
|
||||
const accountGetReservedUnitsAPI = "/restmachine/cloudapi/account/getReservedAccountUnits"
|
||||
const accountListAPI = "/restmachine/cloudapi/account/list"
|
||||
const accountListComputesAPI = "/restmachine/cloudapi/account/listComputes"
|
||||
const accountListDeletedAPI = "/restmachine/cloudapi/account/listDeleted"
|
||||
const accountListDisksAPI = "/restmachine/cloudapi/account/listDisks"
|
||||
const accountListFlipGroupsAPI = "/restmachine/cloudapi/account/listFlipGroups"
|
||||
const accountListRGAPI = "/restmachine/cloudapi/account/listRG"
|
||||
const accountListTemplatesAPI = "/restmachine/cloudapi/account/listTemplates"
|
||||
const accountListVinsAPI = "/restmachine/cloudapi/account/listVins"
|
||||
const accountRestoreAPI = "/restmachine/cloudapi/account/restore"
|
||||
const accountUpdateAPI = "/restmachine/cloudapi/account/update"
|
||||
const accountUpdateUserAPI = "/restmachine/cloudapi/account/updateUser"
|
@ -0,0 +1,69 @@
|
||||
/*
|
||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Authors:
|
||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||
Stanislav Solovev, <spsolovev@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://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 account
|
||||
|
||||
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 dataSourceAccountDeletedListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||
accountDeletedList, err := utilityAccountDeletedListCheckPresence(ctx, d, m)
|
||||
if err != nil {
|
||||
return diag.FromErr(err)
|
||||
}
|
||||
|
||||
id := uuid.New()
|
||||
d.SetId(id.String())
|
||||
d.Set("items", flattenAccountList(accountDeletedList))
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func DataSourceAccountDeletedList() *schema.Resource {
|
||||
return &schema.Resource{
|
||||
SchemaVersion: 1,
|
||||
|
||||
ReadContext: dataSourceAccountDeletedListRead,
|
||||
|
||||
Timeouts: &schema.ResourceTimeout{
|
||||
Read: &constants.Timeout30s,
|
||||
Default: &constants.Timeout60s,
|
||||
},
|
||||
|
||||
Schema: dataSourceAccountListSchemaMake(),
|
||||
}
|
||||
}
|
@ -0,0 +1,260 @@
|
||||
/*
|
||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Authors:
|
||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||
Stanislav Solovev, <spsolovev@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://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 account
|
||||
|
||||
type AccountAclRecord struct {
|
||||
IsExplicit bool `json:"explicit"`
|
||||
Guid string `json:"guid"`
|
||||
Rights string `json:"right"`
|
||||
Status string `json:"status"`
|
||||
Type string `json:"type"`
|
||||
UgroupID string `json:"userGroupId"`
|
||||
CanBeDeleted bool `json:"canBeDeleted"`
|
||||
}
|
||||
|
||||
type ResourceLimits struct {
|
||||
CUC float64 `json:"CU_C"`
|
||||
CUD float64 `json:"CU_D"`
|
||||
CUI float64 `json:"CU_I"`
|
||||
CUM float64 `json:"CU_M"`
|
||||
CUNP float64 `json:"CU_NP"`
|
||||
GpuUnits float64 `json:"gpu_units"`
|
||||
}
|
||||
|
||||
type Account struct {
|
||||
DCLocation string `json:"DCLocation"`
|
||||
CKey string `jspn:"_ckey"`
|
||||
Meta []interface{} `json:"_meta"`
|
||||
Acl []AccountAclRecord `json:"acl"`
|
||||
Company string `json:"company"`
|
||||
CompanyUrl string `json:"companyurl"`
|
||||
CreatedBy string `jspn:"createdBy"`
|
||||
CreatedTime int `json:"createdTime"`
|
||||
DeactiovationTime float64 `json:"deactivationTime"`
|
||||
DeletedBy string `json:"deletedBy"`
|
||||
DeletedTime int `json:"deletedTime"`
|
||||
DisplayName string `json:"displayname"`
|
||||
GUID int `json:"guid"`
|
||||
ID int `json:"id"`
|
||||
Name string `json:"name"`
|
||||
ResourceLimits ResourceLimits `json:"resourceLimits"`
|
||||
SendAccessEmails bool `json:"sendAccessEmails"`
|
||||
ServiceAccount bool `json:"serviceAccount"`
|
||||
Status string `json:"status"`
|
||||
UpdatedTime int `json:"updatedTime"`
|
||||
Version int `json:"version"`
|
||||
Vins []int `json:"vins"`
|
||||
}
|
||||
|
||||
type AccountList []Account
|
||||
|
||||
type AccountCloudApi struct {
|
||||
Acl []AccountAclRecord `json:"acl"`
|
||||
CreatedTime int `json:"createdTime"`
|
||||
DeletedTime int `json:"deletedTime"`
|
||||
ID int `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Status string `json:"status"`
|
||||
UpdatedTime int `json:"updatedTime"`
|
||||
}
|
||||
|
||||
type AccountCloudApiList []AccountCloudApi
|
||||
|
||||
type Resource struct {
|
||||
CPU int `json:"cpu"`
|
||||
Disksize int `json:"disksize"`
|
||||
Extips int `json:"extips"`
|
||||
Exttraffic int `json:"exttraffic"`
|
||||
GPU int `json:"gpu"`
|
||||
RAM int `json:"ram"`
|
||||
}
|
||||
|
||||
type Resources struct {
|
||||
Current Resource `json:"Current"`
|
||||
Reserved Resource `json:"Reserved"`
|
||||
}
|
||||
|
||||
type Computes struct {
|
||||
Started int `json:"started"`
|
||||
Stopped int `json:"stopped"`
|
||||
}
|
||||
|
||||
type Machines struct {
|
||||
Running int `json:"running"`
|
||||
Halted int `json:"halted"`
|
||||
}
|
||||
|
||||
type AccountWithResources struct {
|
||||
Account
|
||||
Resources Resources `json:"Resources"`
|
||||
Computes Computes `json:"computes"`
|
||||
Machines Machines `json:"machines"`
|
||||
Vinses int `json:"vinses"`
|
||||
}
|
||||
|
||||
type AccountCompute struct {
|
||||
AccountId int `json:"accountId"`
|
||||
AccountName string `json:"accountName"`
|
||||
CPUs int `json:"cpus"`
|
||||
CreatedBy string `json:"createdBy"`
|
||||
CreatedTime int `json:"createdTime"`
|
||||
DeletedBy string `json:"deletedBy"`
|
||||
DeletedTime int `json:"deletedTime"`
|
||||
ComputeId int `json:"id"`
|
||||
ComputeName string `json:"name"`
|
||||
RAM int `json:"ram"`
|
||||
Registered bool `json:"registered"`
|
||||
RgId int `json:"rgId"`
|
||||
RgName string `json:"rgName"`
|
||||
Status string `json:"status"`
|
||||
TechStatus string `json:"techStatus"`
|
||||
TotalDisksSize int `json:"totalDisksSize"`
|
||||
UpdatedBy string `json:"updatedBy"`
|
||||
UpdatedTime int `json:"updatedTime"`
|
||||
UserManaged bool `json:"userManaged"`
|
||||
VinsConnected int `json:"vinsConnected"`
|
||||
}
|
||||
|
||||
type AccountComputesList []AccountCompute
|
||||
|
||||
type AccountDisk struct {
|
||||
ID int `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Pool string `json:"pool"`
|
||||
SepId int `json:"sepId"`
|
||||
SizeMax int `json:"sizeMax"`
|
||||
Type string `json:"type"`
|
||||
}
|
||||
|
||||
type AccountDisksList []AccountDisk
|
||||
|
||||
type AccountVin struct {
|
||||
AccountId int `json:"accountId"`
|
||||
AccountName string `json:"accountName"`
|
||||
Computes int `json:"computes"`
|
||||
CreatedBy string `json:"createdBy"`
|
||||
CreatedTime int `json:"createdTime"`
|
||||
DeletedBy string `json:"deletedBy"`
|
||||
DeletedTime int `json:"deletedTime"`
|
||||
ExternalIP string `json:"externalIP"`
|
||||
ID int `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Network string `json:"network"`
|
||||
PriVnfDevId int `json:"priVnfDevId"`
|
||||
RgId int `json:"rgId"`
|
||||
RgName string `json:"rgName"`
|
||||
Status string `json:"status"`
|
||||
UpdatedBy string `json:"updatedBy"`
|
||||
UpdatedTime int `json:"updatedTime"`
|
||||
}
|
||||
|
||||
type AccountVinsList []AccountVin
|
||||
|
||||
type AccountAudit struct {
|
||||
Call string `json:"call"`
|
||||
ResponseTime float64 `json:"responsetime"`
|
||||
StatusCode int `json:"statuscode"`
|
||||
Timestamp float64 `json:"timestamp"`
|
||||
User string `json:"user"`
|
||||
}
|
||||
|
||||
type AccountAuditsList []AccountAudit
|
||||
|
||||
type AccountRGComputes struct {
|
||||
Started int `json:"Started"`
|
||||
Stopped int `json:"Stopped"`
|
||||
}
|
||||
|
||||
type AccountRGResources struct {
|
||||
Consumed Resource `json:"Consumed"`
|
||||
Limits Resource `json:"Limits"`
|
||||
Reserved Resource `json:"Reserved"`
|
||||
}
|
||||
|
||||
type AccountRG struct {
|
||||
Computes AccountRGComputes `json:"Computes"`
|
||||
Resources AccountRGResources `json:"Resources"`
|
||||
CreatedBy string `json:"createdBy"`
|
||||
CreatedTime int `json:"createdTime"`
|
||||
DeletedBy string `json:"deletedBy"`
|
||||
DeletedTime int `json:"deletedTime"`
|
||||
RGID int `json:"id"`
|
||||
Milestones int `json:"milestones"`
|
||||
RGName string `json:"name"`
|
||||
Status string `json:"status"`
|
||||
UpdatedBy string `json:"updatedBy"`
|
||||
UpdatedTime int `json:"updatedTime"`
|
||||
Vinses int `json:"vinses"`
|
||||
}
|
||||
|
||||
type AccountRGList []AccountRG
|
||||
|
||||
type AccountTemplate struct {
|
||||
UNCPath string `json:"UNCPath"`
|
||||
AccountId int `json:"accountId"`
|
||||
Desc string `json:"desc"`
|
||||
ID int `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Public bool `json:"public"`
|
||||
Size int `json:"size"`
|
||||
Status string `json:"status"`
|
||||
Type string `json:"type"`
|
||||
Username string `json:"username"`
|
||||
}
|
||||
|
||||
type AccountTemplatesList []AccountTemplate
|
||||
|
||||
type AccountFlipGroup struct {
|
||||
AccountId int `json:"accountId"`
|
||||
ClientType string `json:"clientType"`
|
||||
ConnType string `json:"connType"`
|
||||
CreatedBy string `json:"createdBy"`
|
||||
CreatedTime int `json:"createdTime"`
|
||||
DefaultGW string `json:"defaultGW"`
|
||||
DeletedBy string `json:"deletedBy"`
|
||||
DeletedTime int `json:"deletedTime"`
|
||||
Desc string `json:"desc"`
|
||||
GID int `json:"gid"`
|
||||
GUID int `json:"guid"`
|
||||
ID int `json:"id"`
|
||||
IP string `json:"ip"`
|
||||
Milestones int `json:"milestones"`
|
||||
Name string `json:"name"`
|
||||
NetID int `json:"netId"`
|
||||
NetType string `json:"netType"`
|
||||
NetMask int `json:"netmask"`
|
||||
Status string `json:"status"`
|
||||
UpdatedBy string `json:"updatedBy"`
|
||||
UpdatedTime int `json:"updatedTime"`
|
||||
}
|
||||
|
||||
type AccountFlipGroupsList []AccountFlipGroup
|
@ -0,0 +1,59 @@
|
||||
/*
|
||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Authors:
|
||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||
Stanislav Solovev, <spsolovev@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://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 bservice
|
||||
|
||||
const bserviceCreateAPI = "/restmachine/cloudapi/bservice/create"
|
||||
const bserviceDeleteAPI = "/restmachine/cloudapi/bservice/delete"
|
||||
const bserviceDisableAPI = "/restmachine/cloudapi/bservice/disable"
|
||||
const bserviceEnableAPI = "/restmachine/cloudapi/bservice/enable"
|
||||
const bserviceGetAPI = "/restmachine/cloudapi/bservice/get"
|
||||
const bserviceGroupAddAPI = "/restmachine/cloudapi/bservice/groupAdd"
|
||||
const bserviceGroupComputeRemoveAPI = "/restmachine/cloudapi/bservice/groupComputeRemove"
|
||||
const bserviceGroupGetAPI = "/restmachine/cloudapi/bservice/groupGet"
|
||||
const bserviceGroupParentAddAPI = "/restmachine/cloudapi/bservice/groupParentAdd"
|
||||
const bserviceGroupParentRemoveAPI = "/restmachine/cloudapi/bservice/groupParentRemove"
|
||||
const bserviceGroupRemoveAPI = "/restmachine/cloudapi/bservice/groupRemove"
|
||||
const bserviceGroupResizeAPI = "/restmachine/cloudapi/bservice/groupResize"
|
||||
const bserviceGroupStartAPI = "/restmachine/cloudapi/bservice/groupStart"
|
||||
const bserviceGroupStopAPI = "/restmachine/cloudapi/bservice/groupStop"
|
||||
const bserviceGroupUpdateAPI = "/restmachine/cloudapi/bservice/groupUpdate"
|
||||
const bserviceGroupUpdateExtnetAPI = "/restmachine/cloudapi/bservice/groupUpdateExtnet"
|
||||
const bserviceGroupUpdateVinsAPI = "/restmachine/cloudapi/bservice/groupUpdateVins"
|
||||
const bserviceListAPI = "/restmachine/cloudapi/bservice/list"
|
||||
const bserviceListDeletedAPI = "/restmachine/cloudapi/bservice/listDeleted"
|
||||
const bserviceRestoreAPI = "/restmachine/cloudapi/bservice/restore"
|
||||
const bserviceSnapshotCreateAPI = "/restmachine/cloudapi/bservice/snapshotCreate"
|
||||
const bserviceSnapshotDeleteAPI = "/restmachine/cloudapi/bservice/snapshotDelete"
|
||||
const bserviceSnapshotListAPI = "/restmachine/cloudapi/bservice/snapshotList"
|
||||
const bserviceSnapshotRollbackAPI = "/restmachine/cloudapi/bservice/snapshotRollback"
|
||||
const bserviceStartAPI = "/restmachine/cloudapi/bservice/start"
|
||||
const bserviceStopAPI = "/restmachine/cloudapi/bservice/stop"
|
@ -0,0 +1,69 @@
|
||||
/*
|
||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Authors:
|
||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||
Stanislav Solovev, <spsolovev@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://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 bservice
|
||||
|
||||
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 dataSourceBasicServiceDeletedListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||
basicServiceDeletedList, err := utilityBasicServiceDeletedListCheckPresence(ctx, d, m)
|
||||
if err != nil {
|
||||
return diag.FromErr(err)
|
||||
}
|
||||
|
||||
id := uuid.New()
|
||||
d.SetId(id.String())
|
||||
d.Set("items", flattenBasicServiceList(basicServiceDeletedList))
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func DataSourceBasicServiceDeletedList() *schema.Resource {
|
||||
return &schema.Resource{
|
||||
SchemaVersion: 1,
|
||||
|
||||
ReadContext: dataSourceBasicServiceDeletedListRead,
|
||||
|
||||
Timeouts: &schema.ResourceTimeout{
|
||||
Read: &constants.Timeout30s,
|
||||
Default: &constants.Timeout60s,
|
||||
},
|
||||
|
||||
Schema: dataSourceBasicServiceListSchemaMake(),
|
||||
}
|
||||
}
|
@ -0,0 +1,144 @@
|
||||
/*
|
||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Authors:
|
||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||
Stanislav Solovev, <spsolovev@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://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 bservice
|
||||
|
||||
///Structs
|
||||
|
||||
type BasicServiceCompute struct {
|
||||
CompGroupId int `json:"compgroupId"`
|
||||
CompGroupName string `json:"compgroupName"`
|
||||
CompGroupRole string `json:"compgroupRole"`
|
||||
ID int `json:"id"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
type BasicServiceComputes []BasicServiceCompute
|
||||
|
||||
type BasicServiceSnapshot struct {
|
||||
GUID string `json:"guid"`
|
||||
Label string `json:"label"`
|
||||
Timestamp int `json:"timestamp"`
|
||||
Valid bool `json:"valid"`
|
||||
}
|
||||
|
||||
type BasicServiceSnapshots []BasicServiceSnapshot
|
||||
|
||||
type BasicService struct {
|
||||
AccountId int `json:"accountId"`
|
||||
AccountName string `json:"accountName"`
|
||||
BaseDomain string `json:"baseDomain"`
|
||||
|
||||
CreatedBy string `json:"createdBy"`
|
||||
CreatedTime int `json:"createdTime"`
|
||||
DeletedBy string `json:"deletedBy"`
|
||||
DeletedTime int `json:"deletedTime"`
|
||||
GID int `json:"gid"`
|
||||
Groups []int `json:"groups"`
|
||||
GUID int `json:"guid"`
|
||||
ID int `json:"id"`
|
||||
Name string `json:"name"`
|
||||
ParentSrvId int `json:"parentSrvId"`
|
||||
ParentSrvType string `json:"parentSrvType"`
|
||||
RGID int `json:"rgId"`
|
||||
RGName string `json:"rgName"`
|
||||
SSHUser string `json:"sshUser"`
|
||||
Status string `json:"status"`
|
||||
TechStatus string `json:"techStatus"`
|
||||
UpdatedBy string `json:"updatedBy"`
|
||||
UpdatedTime int `json:"updatedTime"`
|
||||
UserManaged bool `json:"userManaged"`
|
||||
}
|
||||
|
||||
type BasicServiceList []BasicService
|
||||
|
||||
type BasicServiceExtend struct {
|
||||
BasicService
|
||||
Computes BasicServiceComputes `json:"computes"`
|
||||
CPUTotal int `json:"cpuTotal"`
|
||||
DiskTotal int `json:"diskTotal"`
|
||||
GroupsName []string `json:"groupsName"`
|
||||
Milestones int `json:"milestones"`
|
||||
RamTotal int `json:"ramTotal"`
|
||||
Snapshots BasicServiceSnapshots `json:"snapshots"`
|
||||
SSHKey string `json:"sshKey"`
|
||||
}
|
||||
|
||||
type BasicServiceGroupOSUser struct {
|
||||
Login string `json:"login"`
|
||||
Password string `json:"password"`
|
||||
}
|
||||
|
||||
type BasicServiceGroupOSUsers []BasicServiceGroupOSUser
|
||||
|
||||
type BasicServicceGroupCompute struct {
|
||||
ID int `json:"id"`
|
||||
IPAdresses []string `json:"ipAddresses"`
|
||||
Name string `json:"name"`
|
||||
OSUsers BasicServiceGroupOSUsers `json:"osUsers"`
|
||||
}
|
||||
|
||||
type BasicServiceGroupComputes []BasicServicceGroupCompute
|
||||
|
||||
type BasicServiceGroup struct {
|
||||
AccountId int `json:"accountId"`
|
||||
AccountName string `json:"accountName"`
|
||||
Computes BasicServiceGroupComputes `json:"computes"`
|
||||
Consistency bool `json:"consistency"`
|
||||
CPU int `json:"cpu"`
|
||||
CreatedBy string `json:"createdBy"`
|
||||
CreatedTime int `json:"createdTime"`
|
||||
DeletedBy string `json:"deletedBy"`
|
||||
DeletedTime int `json:"deletedTime"`
|
||||
Disk int `json:"disk"`
|
||||
Driver string `json:"driver"`
|
||||
Extnets []int `json:"extnets"`
|
||||
GID int `json:"gid"`
|
||||
GUID int `json:"guid"`
|
||||
ID int `json:"id"`
|
||||
ImageId int `json:"imageId"`
|
||||
Milestones int `json:"milestones"`
|
||||
Name string `json:"name"`
|
||||
Parents []int `json:"parents"`
|
||||
RAM int `json:"ram"`
|
||||
RGID int `json:"rgId"`
|
||||
RGName string `json:"rgName"`
|
||||
Role string `json:"role"`
|
||||
SepId int `json:"sepId"`
|
||||
SeqNo int `json:"seqNo"`
|
||||
ServiceId int `json:"serviceId"`
|
||||
Status string `json:"status"`
|
||||
TechStatus string `json:"techStatus"`
|
||||
TimeoutStart int `json:"timeoutStart"`
|
||||
UpdatedBy string `json:"updatedBy"`
|
||||
UpdatedTime int `json:"updatedTime"`
|
||||
Vinses []int `json:"vinses"`
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
/*
|
||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Authors:
|
||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||
Stanislav Solovev, <spsolovev@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://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 disks
|
||||
|
||||
const DisksCreateAPI = "/restmachine/cloudapi/disks/create"
|
||||
const DisksGetAPI = "/restmachine/cloudapi/disks/get" // Returns single DiskRecord on success
|
||||
const DisksListAPI = "/restmachine/cloudapi/disks/list" // Returns list of DiskRecord on success
|
||||
const DisksResizeAPI = "/restmachine/cloudapi/disks/resize2"
|
||||
const DisksRenameAPI = "/restmachine/cloudapi/disks/rename"
|
||||
const DisksDeleteAPI = "/restmachine/cloudapi/disks/delete"
|
@ -0,0 +1,95 @@
|
||||
/*
|
||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Authors:
|
||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||
Stanislav Solovev, <spsolovev@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://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 disks
|
||||
|
||||
type DiskRecord struct {
|
||||
Acl map[string]interface{} `json:"acl"`
|
||||
AccountID int `json:"accountId"`
|
||||
AccountName string `json:"accountName"`
|
||||
BootPartition int `json:"bootPartition"`
|
||||
CreatedTime uint64 `json:"creationTime"`
|
||||
ComputeID int `json:"computeId"`
|
||||
ComputeName string `json:"computeName"`
|
||||
DeletedTime uint64 `json:"deletionTime"`
|
||||
DeviceName string `json:"devicename"`
|
||||
Desc string `json:"desc"`
|
||||
DestructionTime uint64 `json:"destructionTime"`
|
||||
DiskPath string `json:"diskPath"`
|
||||
GridID int `json:"gid"`
|
||||
GUID int `json:"guid"`
|
||||
ID uint `json:"id"`
|
||||
ImageID int `json:"imageId"`
|
||||
Images []int `json:"images"`
|
||||
IOTune map[string]interface{} `json:"iotune"`
|
||||
IQN string `json:"iqn"`
|
||||
Login string `json:"login"`
|
||||
Name string `json:"name"`
|
||||
MachineId int `json:"machineId"`
|
||||
MachineName string `json:"machineName"`
|
||||
Milestones uint64 `json:"milestones"`
|
||||
Order int `json:"order"`
|
||||
Params string `json:"params"`
|
||||
Passwd string `json:"passwd"`
|
||||
ParentId int `json:"parentId"`
|
||||
PciSlot int `json:"pciSlot"`
|
||||
Pool string `json:"pool"`
|
||||
PurgeTime uint64 `json:"purgeTime"`
|
||||
PurgeAttempts uint64 `json:"purgeAttempts"`
|
||||
RealityDeviceNumber int `json:"realityDeviceNumber"`
|
||||
ReferenceId string `json:"referenceId"`
|
||||
ResID string `json:"resId"`
|
||||
ResName string `json:"resName"`
|
||||
Role string `json:"role"`
|
||||
SepType string `json:"sepType"`
|
||||
SepID int `json:"sepId"` // NOTE: absent from compute/get output
|
||||
SizeMax int `json:"sizeMax"`
|
||||
SizeUsed int `json:"sizeUsed"` // sum over all snapshots of this disk to report total consumed space
|
||||
Snapshots []SnapshotRecord `json:"snapshots"`
|
||||
Status string `json:"status"`
|
||||
TechStatus string `json:"techStatus"`
|
||||
Type string `json:"type"`
|
||||
UpdateBy uint64 `json:"updateBy"`
|
||||
VMID int `json:"vmid"`
|
||||
}
|
||||
|
||||
type SnapshotRecord struct {
|
||||
Guid string `json:"guid"`
|
||||
Label string `json:"label"`
|
||||
ResId string `json:"resId"`
|
||||
SnapSetGuid string `json:"snapSetGuid"`
|
||||
SnapSetTime uint64 `json:"snapSetTime"`
|
||||
TimeStamp uint64 `json:"timestamp"`
|
||||
}
|
||||
|
||||
type SnapshotRecordList []SnapshotRecord
|
||||
|
||||
type DisksListResp []DiskRecord
|
@ -0,0 +1,37 @@
|
||||
/*
|
||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Authors:
|
||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||
Stanislav Solovev, <spsolovev@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://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 extnet
|
||||
|
||||
const extnetListAPI = "/restmachine/cloudapi/extnet/list"
|
||||
const extnetListComputesAPI = "/restmachine/cloudapi/extnet/listComputes"
|
||||
const extnetGetDefaultAPI = "/restmachine/cloudapi/extnet/getDefault"
|
||||
const extnetGetAPI = "/restmachine/cloudapi/extnet/get"
|
@ -0,0 +1,111 @@
|
||||
/*
|
||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Authors:
|
||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||
Stanislav Solovev, <spsolovev@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://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 extnet
|
||||
|
||||
type Extnet struct {
|
||||
ID int `json:"id"`
|
||||
IPCidr string `json:"ipcidr"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
type ExtnetExtend struct {
|
||||
Extnet
|
||||
IPAddr string `json:"ipaddr"`
|
||||
}
|
||||
|
||||
type ExtnetList []Extnet
|
||||
type ExtnetExtendList []ExtnetExtend
|
||||
|
||||
type ExtnetComputes struct {
|
||||
AccountId int `json:"accountId"`
|
||||
AccountName string `json:"accountName"`
|
||||
Extnets ExtnetExtendList `json:"extnets"`
|
||||
ID int `json:"id"`
|
||||
Name string `json:"name"`
|
||||
RGID int `json:"rgId"`
|
||||
RGName string `json:"rgName"`
|
||||
}
|
||||
|
||||
type ExtnetComputesList []ExtnetComputes
|
||||
|
||||
type ExtnetQos struct {
|
||||
ERate int `json:"eRate"`
|
||||
GUID string `json:"guid"`
|
||||
InBurst int `json:"inBurst"`
|
||||
InRate int `json:"inRate"`
|
||||
}
|
||||
|
||||
type ExtnetReservation struct {
|
||||
ClientType string `json:"clientType"`
|
||||
Desc string `json:"desc"`
|
||||
DomainName string `json:"domainname"`
|
||||
HostName string `json:"hostname"`
|
||||
IP string `json:"ip"`
|
||||
MAC string `json:"mac"`
|
||||
Type string `json:"type"`
|
||||
VMID int `json:"vmId"`
|
||||
}
|
||||
|
||||
type ExtnetReservations []ExtnetReservation
|
||||
|
||||
type ExtnetVNFS struct {
|
||||
DHCP int `json:"dhcp"`
|
||||
}
|
||||
|
||||
type ExtnetDetailed struct {
|
||||
CKey string `json:"_ckey"`
|
||||
Meta []interface{} `json:"_meta"`
|
||||
CheckIPs []string `json:"checkIPs"`
|
||||
CheckIps []string `json:"checkIps"`
|
||||
Default bool `json:"default"`
|
||||
DefaultQos ExtnetQos `json:"defaultQos"`
|
||||
Desc string `json:"desc"`
|
||||
Dns []string `json:"dns"`
|
||||
Excluded []string `json:"excluded"`
|
||||
FreeIps int `json:"free_ips"`
|
||||
Gateway string `json:"gateway"`
|
||||
GID int `json:"gid"`
|
||||
GUID int `json:"guid"`
|
||||
ID int `json:"id"`
|
||||
IPCidr string `json:"ipcidr"`
|
||||
Milestones int `json:"milestones"`
|
||||
Name string `json:"name"`
|
||||
Network string `json:"network"`
|
||||
NetworkId int `json:"networkId"`
|
||||
PreReservationsNum int `json:"preReservationsNum"`
|
||||
Prefix int `json:"prefix"`
|
||||
PriVnfDevId int `json:"priVnfDevId"`
|
||||
Reservations ExtnetReservations `json:"reservations"`
|
||||
SharedWith []int `json:"sharedWith"`
|
||||
Status string `json:"status"`
|
||||
VlanID int `json:"vlanId"`
|
||||
VNFS ExtnetVNFS `json:"vnfs"`
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
/*
|
||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Authors:
|
||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||
Stanislav Solovev, <spsolovev@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://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 extnet
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/url"
|
||||
|
||||
"github.com/rudecs/terraform-provider-decort/internal/controller"
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||
)
|
||||
|
||||
func utilityExtnetDefaultCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (string, error) {
|
||||
c := m.(*controller.ControllerCfg)
|
||||
urlValues := &url.Values{}
|
||||
|
||||
log.Debugf("utilityExtnetDefaultCheckPresence")
|
||||
res, err := c.DecortAPICall(ctx, "POST", extnetGetDefaultAPI, urlValues)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return res, nil
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
/*
|
||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Authors:
|
||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||
Stanislav Solovev, <spsolovev@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://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 k8s
|
||||
|
||||
const K8sCreateAPI = "/restmachine/cloudapi/k8s/create"
|
||||
const K8sGetAPI = "/restmachine/cloudapi/k8s/get"
|
||||
const K8sUpdateAPI = "/restmachine/cloudapi/k8s/update"
|
||||
const K8sDeleteAPI = "/restmachine/cloudapi/k8s/delete"
|
||||
|
||||
const K8sWgCreateAPI = "/restmachine/cloudapi/k8s/workersGroupAdd"
|
||||
const K8sWgDeleteAPI = "/restmachine/cloudapi/k8s/workersGroupDelete"
|
||||
|
||||
const K8sWorkerAddAPI = "/restmachine/cloudapi/k8s/workerAdd"
|
||||
const K8sWorkerDeleteAPI = "/restmachine/cloudapi/k8s/deleteWorkerFromGroup"
|
||||
|
||||
const K8sGetConfigAPI = "/restmachine/cloudapi/k8s/getConfig"
|
||||
|
||||
const LbGetAPI = "/restmachine/cloudapi/lb/get"
|
||||
|
||||
const AsyncTaskGetAPI = "/restmachine/cloudapi/tasks/get"
|
@ -0,0 +1,131 @@
|
||||
/*
|
||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Authors:
|
||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||
Stanislav Solovev, <spsolovev@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://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 k8s
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
type K8sNodeRecord struct {
|
||||
ID int `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Disk int `json:"disk"`
|
||||
Cpu int `json:"cpu"`
|
||||
Num int `json:"num"`
|
||||
Ram int `json:"ram"`
|
||||
DetailedInfo []struct {
|
||||
ID int `json:"id"`
|
||||
Name string `json:"name"`
|
||||
} `json:"detailedInfo"`
|
||||
}
|
||||
|
||||
//K8sRecord represents k8s instance
|
||||
type K8sRecord struct {
|
||||
AccountID int `json:"accountId"`
|
||||
AccountName string `json:"accountName"`
|
||||
CI int `json:"ciId"`
|
||||
ID int `json:"id"`
|
||||
Groups struct {
|
||||
Masters K8sNodeRecord `json:"masters"`
|
||||
Workers []K8sNodeRecord `json:"workers"`
|
||||
} `json:"k8sGroups"`
|
||||
LbID int `json:"lbId"`
|
||||
Name string `json:"name"`
|
||||
RgID int `json:"rgId"`
|
||||
RgName string `json:"rgName"`
|
||||
}
|
||||
|
||||
//LbRecord represents load balancer instance
|
||||
type LbRecord struct {
|
||||
ID int `json:"id"`
|
||||
Name string `json:"name"`
|
||||
RgID int `json:"rgId"`
|
||||
VinsID int `json:"vinsId"`
|
||||
ExtNetID int `json:"extnetId"`
|
||||
PrimaryNode struct {
|
||||
BackendIP string `json:"backendIp"`
|
||||
ComputeID int `json:"computeId"`
|
||||
FrontendIP string `json:"frontendIp"`
|
||||
NetworkID int `json:"networkId"`
|
||||
} `json:"primaryNode"`
|
||||
}
|
||||
|
||||
//Blasphemous workaround for parsing Result value
|
||||
type TaskResult int
|
||||
|
||||
func (r *TaskResult) UnmarshalJSON(b []byte) error {
|
||||
if b[0] == '"' {
|
||||
b := b[1 : len(b)-1]
|
||||
if len(b) == 0 {
|
||||
*r = 0
|
||||
return nil
|
||||
}
|
||||
n, err := strconv.Atoi(string(b))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
*r = TaskResult(n)
|
||||
} else if b[0] == '[' {
|
||||
res := []interface{}{}
|
||||
if err := json.Unmarshal(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
if n, ok := res[0].(float64); ok {
|
||||
*r = TaskResult(n)
|
||||
} else {
|
||||
return fmt.Errorf("could not unmarshal %v into int", res[0])
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
//AsyncTask represents a long task completion status
|
||||
type AsyncTask struct {
|
||||
AuditID string `json:"auditId"`
|
||||
Completed bool `json:"completed"`
|
||||
Error string `json:"error"`
|
||||
Log []string `json:"log"`
|
||||
Result TaskResult `json:"result"`
|
||||
Stage string `json:"stage"`
|
||||
Status string `json:"status"`
|
||||
UpdateTime uint64 `json:"updateTime"`
|
||||
UpdatedTime uint64 `json:"updatedTime"`
|
||||
}
|
||||
|
||||
type SshKeyConfig struct {
|
||||
User string
|
||||
SshKey string
|
||||
UserShell string
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
/*
|
||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Authors:
|
||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||
Stanislav Solovev, <spsolovev@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://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 kvmvm
|
||||
|
||||
const KvmX86CreateAPI = "/restmachine/cloudapi/kvmx86/create"
|
||||
const KvmPPCCreateAPI = "/restmachine/cloudapi/kvmppc/create"
|
||||
const ComputeGetAPI = "/restmachine/cloudapi/compute/get"
|
||||
const RgListComputesAPI = "/restmachine/cloudapi/rg/listComputes"
|
||||
const ComputeNetAttachAPI = "/restmachine/cloudapi/compute/netAttach"
|
||||
const ComputeNetDetachAPI = "/restmachine/cloudapi/compute/netDetach"
|
||||
const ComputeDiskAttachAPI = "/restmachine/cloudapi/compute/diskAttach"
|
||||
const ComputeDiskDetachAPI = "/restmachine/cloudapi/compute/diskDetach"
|
||||
const ComputeStartAPI = "/restmachine/cloudapi/compute/start"
|
||||
const ComputeStopAPI = "/restmachine/cloudapi/compute/stop"
|
||||
const ComputeResizeAPI = "/restmachine/cloudapi/compute/resize"
|
||||
const DisksResizeAPI = "/restmachine/cloudapi/disks/resize2"
|
||||
const ComputeDeleteAPI = "/restmachine/cloudapi/compute/delete"
|
@ -0,0 +1,190 @@
|
||||
/*
|
||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Authors:
|
||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||
Stanislav Solovev, <spsolovev@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://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 kvmvm
|
||||
|
||||
type DiskRecord struct {
|
||||
Acl map[string]interface{} `json:"acl"`
|
||||
AccountID int `json:"accountId"`
|
||||
AccountName string `json:"accountName"`
|
||||
BootPartition int `json:"bootPartition"`
|
||||
CreatedTime uint64 `json:"creationTime"`
|
||||
ComputeID int `json:"computeId"`
|
||||
ComputeName string `json:"computeName"`
|
||||
DeletedTime uint64 `json:"deletionTime"`
|
||||
DeviceName string `json:"devicename"`
|
||||
Desc string `json:"desc"`
|
||||
DestructionTime uint64 `json:"destructionTime"`
|
||||
DiskPath string `json:"diskPath"`
|
||||
GridID int `json:"gid"`
|
||||
GUID int `json:"guid"`
|
||||
ID uint `json:"id"`
|
||||
ImageID int `json:"imageId"`
|
||||
Images []int `json:"images"`
|
||||
IOTune map[string]interface{} `json:"iotune"`
|
||||
IQN string `json:"iqn"`
|
||||
Login string `json:"login"`
|
||||
Name string `json:"name"`
|
||||
MachineId int `json:"machineId"`
|
||||
MachineName string `json:"machineName"`
|
||||
Milestones uint64 `json:"milestones"`
|
||||
Order int `json:"order"`
|
||||
Params string `json:"params"`
|
||||
Passwd string `json:"passwd"`
|
||||
ParentId int `json:"parentId"`
|
||||
PciSlot int `json:"pciSlot"`
|
||||
Pool string `json:"pool"`
|
||||
PurgeTime uint64 `json:"purgeTime"`
|
||||
PurgeAttempts uint64 `json:"purgeAttempts"`
|
||||
RealityDeviceNumber int `json:"realityDeviceNumber"`
|
||||
ReferenceId string `json:"referenceId"`
|
||||
ResID string `json:"resId"`
|
||||
ResName string `json:"resName"`
|
||||
Role string `json:"role"`
|
||||
SepType string `json:"sepType"`
|
||||
SepID int `json:"sepId"` // NOTE: absent from compute/get output
|
||||
SizeMax int `json:"sizeMax"`
|
||||
SizeUsed int `json:"sizeUsed"` // sum over all snapshots of this disk to report total consumed space
|
||||
Snapshots []SnapshotRecord `json:"snapshots"`
|
||||
Status string `json:"status"`
|
||||
TechStatus string `json:"techStatus"`
|
||||
Type string `json:"type"`
|
||||
UpdateBy uint64 `json:"updateBy"`
|
||||
VMID int `json:"vmid"`
|
||||
}
|
||||
|
||||
type InterfaceRecord struct {
|
||||
ConnID int `json:"connId"` // This is VLAN ID or VxLAN ID, depending on ConnType
|
||||
ConnType string `json:"connType"` // Either "VLAN" or "VXLAN" tag
|
||||
DefaultGW string `json:"defGw"`
|
||||
Guid string `json:"guid"`
|
||||
IPAddress string `json:"ipAddress"` // without trailing network mask, i.e. "192.168.1.3"
|
||||
MAC string `json:"mac"`
|
||||
Name string `json:"name"`
|
||||
NetID int `json:"netId"` // This is either ExtNet ID or ViNS ID, depending on NetType
|
||||
NetMask int `json:"netMask"`
|
||||
NetType string `json:"netType"` // Either "EXTNET" or "VINS" tag
|
||||
PciSlot int `json:"pciSlot"`
|
||||
Target string `json:"target"`
|
||||
Type string `json:"type"`
|
||||
VNFs []int `json:"vnfs"`
|
||||
QOS InterfaceQosRecord `json:"qos"`
|
||||
}
|
||||
|
||||
type InterfaceQosRecord struct {
|
||||
ERate int `json:"eRate"`
|
||||
Guid string `json:"guid"`
|
||||
InBurst int `json:"inBurst"`
|
||||
InRate int `json:"inRate"`
|
||||
}
|
||||
|
||||
type SnapshotRecord struct {
|
||||
Guid string `json:"guid"`
|
||||
Label string `json:"label"`
|
||||
ResId string `json:"resId"`
|
||||
SnapSetGuid string `json:"snapSetGuid"`
|
||||
SnapSetTime uint64 `json:"snapSetTime"`
|
||||
TimeStamp uint64 `json:"timestamp"`
|
||||
}
|
||||
|
||||
type SnapshotRecordList []SnapshotRecord
|
||||
|
||||
type ComputeGetResp struct {
|
||||
// ACLs `json:"ACL"` - it is a dictionary, special parsing required
|
||||
AccountID int `json:"accountId"`
|
||||
AccountName string `json:"accountName"`
|
||||
Arch string `json:"arch"`
|
||||
BootDiskSize int `json:"bootdiskSize"`
|
||||
CloneReference int `json:"cloneReference"`
|
||||
Clones []int `json:"clones"`
|
||||
Cpu int `json:"cpus"`
|
||||
Desc string `json:"desc"`
|
||||
Disks []DiskRecord `json:"disks"`
|
||||
Driver string `json:"driver"`
|
||||
GridID int `json:"gid"`
|
||||
ID uint `json:"id"`
|
||||
ImageID int `json:"imageId"`
|
||||
ImageName string `json:"imageName"`
|
||||
Interfaces []InterfaceRecord `json:"interfaces"`
|
||||
LockStatus string `json:"lockStatus"`
|
||||
ManagerID int `json:"managerId"`
|
||||
ManagerType string `json:"manageType"`
|
||||
Name string `json:"name"`
|
||||
NatableVinsID int `json:"natableVinsId"`
|
||||
NatableVinsIP string `json:"natableVinsIp"`
|
||||
NatableVinsName string `json:"natableVinsName"`
|
||||
NatableVinsNet string `json:"natableVinsNetwork"`
|
||||
NatableVinsNetName string `json:"natableVinsNetworkName"`
|
||||
OsUsers []OsUserRecord `json:"osUsers"`
|
||||
Ram int `json:"ram"`
|
||||
RgID int `json:"rgId"`
|
||||
RgName string `json:"rgName"`
|
||||
SnapSets []SnapSetRecord `json:"snapSets"`
|
||||
Status string `json:"status"`
|
||||
// Tags []string `json:"tags"` // Tags were reworked since DECORT 3.7.1
|
||||
TechStatus string `json:"techStatus"`
|
||||
TotalDiskSize int `json:"totalDiskSize"`
|
||||
UpdatedBy string `json:"updatedBy"`
|
||||
UpdateTime uint64 `json:"updateTime"`
|
||||
UserManaged bool `json:"userManaged"`
|
||||
Vgpus []int `json:"vgpus"`
|
||||
VinsConnected int `json:"vinsConnected"`
|
||||
VirtualImageID int `json:"virtualImageId"`
|
||||
}
|
||||
|
||||
type OsUserRecord struct {
|
||||
Guid string `json:"guid"`
|
||||
Login string `json:"login"`
|
||||
Password string `json:"password"`
|
||||
PubKey string `json:"pubkey"`
|
||||
}
|
||||
|
||||
type SnapSetRecord struct {
|
||||
Disks []int `json:"disks"`
|
||||
Guid string `json:"guid"`
|
||||
Label string `json:"label"`
|
||||
TimeStamp uint64 `json:"timestamp"`
|
||||
}
|
||||
|
||||
type ComputeBriefRecord struct { // this is a brief compute specifiaction as returned by API rg/listComputes
|
||||
// we do not even include here all fields as returned by this API, but only the most important that
|
||||
// are really necessary to identify and distinguish computes
|
||||
AccountID int `json:"accountId"`
|
||||
AccountName string `json:"accountName"`
|
||||
Name string `json:"name"`
|
||||
ID uint `json:"id"`
|
||||
RgID int `json:"rgId"`
|
||||
RgName string `json:"rgName"`
|
||||
Status string `json:"status"`
|
||||
TechStatus string `json:"techStatus"`
|
||||
}
|
||||
|
||||
type RgListComputesResp []ComputeBriefRecord
|
@ -0,0 +1,36 @@
|
||||
/*
|
||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Authors:
|
||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||
Stanislav Solovev, <spsolovev@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://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 pfw
|
||||
|
||||
const ComputePfwListAPI = "/restmachine/cloudapi/compute/pfwList"
|
||||
const ComputePfwAddAPI = "/restmachine/cloudapi/compute/pfwAdd"
|
||||
const ComputePfwDelAPI = "/restmachine/cloudapi/compute/pfwDel"
|
@ -0,0 +1,45 @@
|
||||
/*
|
||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Authors:
|
||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||
Stanislav Solovev, <spsolovev@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://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 pfw
|
||||
type PfwRecord struct {
|
||||
ID int `json:"id"`
|
||||
LocalIP string `json:"localIp"`
|
||||
LocalPort int `json:"localPort"`
|
||||
Protocol string `json:"protocol"`
|
||||
PublicPortEnd int `json:"publicPortEnd"`
|
||||
PublicPortStart int `json:"publicPortStart"`
|
||||
ComputeID int `json:"vmId"`
|
||||
}
|
||||
|
||||
type ComputePfwListResp []PfwRecord
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue