4.5.0-alpha
This commit is contained in:
@@ -1,59 +0,0 @@
|
||||
/*
|
||||
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://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||
|
||||
Please see README.md to learn where to place source code so that it
|
||||
builds seamlessly.
|
||||
|
||||
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||
*/
|
||||
|
||||
package sep
|
||||
|
||||
const sepAddConsumerNodesAPI = "/restmachine/cloudbroker/sep/addConsumerNodes"
|
||||
const sepDelConsumerNodesAPI = "/restmachine/cloudbroker/sep/delConsumerNodes"
|
||||
const sepAddProviderNodesAPI = "/restmachine/cloudbroker/sep/addProviderNodes"
|
||||
|
||||
const sepConfigFieldEditAPI = "/restmachine/cloudbroker/sep/configFieldEdit"
|
||||
const sepConfigInsertAPI = "/restmachine/cloudbroker/sep/configInsert"
|
||||
const sepConfigValidateAPI = "/restmachine/cloudbroker/sep/configValidate"
|
||||
|
||||
const sepConsumptionAPI = "/restmachine/cloudbroker/sep/consumption"
|
||||
|
||||
const sepDecommissionAPI = "/restmachine/cloudbroker/sep/decommission"
|
||||
|
||||
const sepEnableAPI = "/restmachine/cloudbroker/sep/enable"
|
||||
const sepDisableAPI = "/restmachine/cloudbroker/sep/disable"
|
||||
|
||||
const sepDiskListAPI = "/restmachine/cloudbroker/sep/diskList"
|
||||
|
||||
const sepGetAPI = "/restmachine/cloudbroker/sep/get"
|
||||
const sepGetConfigAPI = "/restmachine/cloudbroker/sep/getConfig"
|
||||
const sepGetPoolAPI = "/restmachine/cloudbroker/sep/getPool"
|
||||
|
||||
const sepCreateAPI = "/restmachine/cloudbroker/sep/create"
|
||||
const sepDeleteAPI = "/restmachine/cloudbroker/sep/delete"
|
||||
const sepListAPI = "/restmachine/cloudbroker/sep/list"
|
||||
|
||||
const sepUpdateCapacityLimitAPI = "/restmachine/cloudbroker/sep/updateCapacityLimit"
|
||||
@@ -1,8 +1,9 @@
|
||||
/*
|
||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Copyright (c) 2019-2023 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Authors:
|
||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||
Sergey Kisil, <svkisil@digitalenergy.online>
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@@ -34,8 +35,8 @@ package sep
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"strconv"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||
@@ -47,8 +48,6 @@ func dataSourceSepRead(ctx context.Context, d *schema.ResourceData, m interface{
|
||||
if err != nil {
|
||||
return diag.FromErr(err)
|
||||
}
|
||||
id := uuid.New()
|
||||
d.SetId(id.String())
|
||||
|
||||
d.Set("ckey", desSep.CKey)
|
||||
d.Set("meta", flattens.FlattenMeta(desSep.Meta))
|
||||
@@ -61,11 +60,14 @@ func dataSourceSepRead(ctx context.Context, d *schema.ResourceData, m interface{
|
||||
d.Set("name", desSep.Name)
|
||||
d.Set("obj_status", desSep.ObjStatus)
|
||||
d.Set("provided_by", desSep.ProvidedBy)
|
||||
d.Set("shared_with", desSep.SharedWith)
|
||||
d.Set("tech_status", desSep.TechStatus)
|
||||
d.Set("type", desSep.Type)
|
||||
data, _ := json.Marshal(desSep.Config)
|
||||
d.Set("config", string(data))
|
||||
|
||||
d.SetId(strconv.Itoa(d.Get("sep_id").(int)))
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -88,7 +90,7 @@ func dataSourceSepCSchemaMake() map[string]*schema.Schema {
|
||||
},
|
||||
},
|
||||
"consumed_by": {
|
||||
Type: schema.TypeList,
|
||||
Type: schema.TypeSet,
|
||||
Computed: true,
|
||||
Elem: &schema.Schema{
|
||||
Type: schema.TypeInt,
|
||||
@@ -125,6 +127,13 @@ func dataSourceSepCSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeInt,
|
||||
},
|
||||
},
|
||||
"shared_with": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
Elem: &schema.Schema{
|
||||
Type: schema.TypeInt,
|
||||
},
|
||||
},
|
||||
"tech_status": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Copyright (c) 2019-2023 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Authors:
|
||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
/*
|
||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Copyright (c) 2019-2023 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Authors:
|
||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||
Sergey Kisil, <svkisil@digitalenergy.online>
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@@ -37,11 +38,9 @@ import (
|
||||
"github.com/google/uuid"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/sep"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||
)
|
||||
|
||||
// TODO: how to marshal byPool????
|
||||
func dataSourceSepConsumptionRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||
sepCons, err := utilitySepConsumptionCheckPresence(ctx, d, m)
|
||||
if err != nil {
|
||||
@@ -52,43 +51,11 @@ func dataSourceSepConsumptionRead(ctx context.Context, d *schema.ResourceData, m
|
||||
|
||||
d.Set("type", sepCons.Type)
|
||||
d.Set("total", flattenSepConsumption(sepCons.Total))
|
||||
// d.Set("by_pool", flattenSepConsumptionPools(sepCons.ByPool))
|
||||
d.Set("by_pool", flattenSepConsumptionPools(sepCons))
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func flattenSepConsumptionPools(mp map[string]SepConsumptionInd) []map[string]interface{} {
|
||||
sh := make([]map[string]interface{}, 0)
|
||||
for k, v := range mp {
|
||||
temp := map[string]interface{}{
|
||||
"name": k,
|
||||
"disk_count": v.DiskCount,
|
||||
"disk_usage": v.DiskUsage,
|
||||
"snapshot_count": v.SnapshotCount,
|
||||
"snapshot_usage": v.SnapshotUsage,
|
||||
"usage": v.Usage,
|
||||
"usage_limit": v.UsageLimit,
|
||||
}
|
||||
sh = append(sh, temp)
|
||||
}
|
||||
return sh
|
||||
}
|
||||
|
||||
func flattenSepConsumption(sc sep.Total) []map[string]interface{} {
|
||||
sh := make([]map[string]interface{}, 0)
|
||||
temp := map[string]interface{}{
|
||||
"capacity_limit": sc.CapacityLimit,
|
||||
"disk_count": sc.DiskCount,
|
||||
"disk_usage": sc.DiskUsage,
|
||||
"snapshot_count": sc.SnapshotCount,
|
||||
"snapshot_usage": sc.SnapshotUsage,
|
||||
"usage": sc.Usage,
|
||||
"usage_limit": sc.UsageLimit,
|
||||
}
|
||||
sh = append(sh, temp)
|
||||
return sh
|
||||
}
|
||||
|
||||
func dataSourceSepConsumptionSchemaMake() map[string]*schema.Schema {
|
||||
return map[string]*schema.Schema{
|
||||
"sep_id": {
|
||||
@@ -97,8 +64,9 @@ func dataSourceSepConsumptionSchemaMake() map[string]*schema.Schema {
|
||||
Description: "sep id",
|
||||
},
|
||||
"by_pool": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
Description: "consumption divided by pool",
|
||||
Elem: &schema.Resource{
|
||||
Schema: map[string]*schema.Schema{
|
||||
"name": {
|
||||
@@ -138,7 +106,6 @@ func dataSourceSepConsumptionSchemaMake() map[string]*schema.Schema {
|
||||
},
|
||||
},
|
||||
},
|
||||
Description: "consumption divided by pool",
|
||||
},
|
||||
"total": {
|
||||
Type: schema.TypeList,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Copyright (c) 2019-2023 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Authors:
|
||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
/*
|
||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Copyright (c) 2019-2023 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Authors:
|
||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||
Sergey Kisil, <svkisil@digitalenergy.online>
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@@ -33,42 +34,13 @@ package sep
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/sep"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/flattens"
|
||||
)
|
||||
|
||||
func flattenSepList(sl *sep.ListSEP) []map[string]interface{} {
|
||||
res := make([]map[string]interface{}, 0)
|
||||
for _, item := range sl.Data {
|
||||
data, _ := json.Marshal(item.Config)
|
||||
temp := map[string]interface{}{
|
||||
"ckey": item.CKey,
|
||||
"meta": flattens.FlattenMeta(item.Meta),
|
||||
"consumed_by": item.ConsumedBy,
|
||||
"desc": item.Description,
|
||||
"gid": item.GID,
|
||||
"guid": item.GUID,
|
||||
"sep_id": item.ID,
|
||||
"milestones": item.Milestones,
|
||||
"name": item.Name,
|
||||
"obj_status": item.ObjStatus,
|
||||
"provided_by": item.ProvidedBy,
|
||||
"tech_status": item.TechStatus,
|
||||
"type": item.Type,
|
||||
"config": string(data),
|
||||
}
|
||||
|
||||
res = append(res, temp)
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
func dataSourceSepListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||
sepList, err := utilitySepListCheckPresence(ctx, d, m)
|
||||
if err != nil {
|
||||
@@ -77,12 +49,48 @@ func dataSourceSepListRead(ctx context.Context, d *schema.ResourceData, m interf
|
||||
id := uuid.New()
|
||||
d.SetId(id.String())
|
||||
d.Set("items", flattenSepList(sepList))
|
||||
d.Set("entryCount", sepList.EntryCount)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func dataSourceSepListSchemaMake() map[string]*schema.Schema {
|
||||
rets := map[string]*schema.Schema{
|
||||
"by_id": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
Description: "find by id",
|
||||
},
|
||||
"name": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "find by name",
|
||||
},
|
||||
"gid": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
Description: "find by gid",
|
||||
},
|
||||
"type": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "find by sep type",
|
||||
},
|
||||
"provided_by": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
Description: "find by provided physical node id",
|
||||
},
|
||||
"tech_status": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "find by techStatus",
|
||||
},
|
||||
"consumed_by": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
Description: "find by consumed physical node id",
|
||||
},
|
||||
"page": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
@@ -101,6 +109,11 @@ func dataSourceSepListSchemaMake() map[string]*schema.Schema {
|
||||
Schema: dataSourceSepShortSchemaMake(),
|
||||
},
|
||||
},
|
||||
"entry_count": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
Description: "entryCount",
|
||||
},
|
||||
}
|
||||
|
||||
return rets
|
||||
@@ -120,7 +133,7 @@ func dataSourceSepShortSchemaMake() map[string]*schema.Schema {
|
||||
},
|
||||
},
|
||||
"consumed_by": {
|
||||
Type: schema.TypeList,
|
||||
Type: schema.TypeSet,
|
||||
Computed: true,
|
||||
Elem: &schema.Schema{
|
||||
Type: schema.TypeInt,
|
||||
@@ -161,6 +174,13 @@ func dataSourceSepShortSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeInt,
|
||||
},
|
||||
},
|
||||
"shared_with": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
Elem: &schema.Schema{
|
||||
Type: schema.TypeInt,
|
||||
},
|
||||
},
|
||||
"tech_status": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
/*
|
||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Copyright (c) 2019-2023 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Authors:
|
||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||
Sergey Kisil, <svkisil@digitalenergy.online>
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@@ -33,7 +34,6 @@ package sep
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||
@@ -48,9 +48,7 @@ func dataSourceSepPoolRead(ctx context.Context, d *schema.ResourceData, m interf
|
||||
}
|
||||
id := uuid.New()
|
||||
d.SetId(id.String())
|
||||
|
||||
data, _ := json.Marshal(sepPool)
|
||||
d.Set("pool", string(data))
|
||||
d.Set("pool", flattenSepPool(sepPool))
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -68,8 +66,65 @@ func dataSourceSepPoolSchemaMake() map[string]*schema.Schema {
|
||||
Description: "pool name",
|
||||
},
|
||||
"pool": {
|
||||
Type: schema.TypeString,
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
Elem: &schema.Resource{
|
||||
Schema: map[string]*schema.Schema{
|
||||
"access_account_ids": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
Elem: &schema.Schema{
|
||||
Type: schema.TypeInt,
|
||||
},
|
||||
},
|
||||
"access_res_group_ids": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
Elem: &schema.Schema{
|
||||
Type: schema.TypeInt,
|
||||
},
|
||||
},
|
||||
"name": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"pagecache_ratio": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"reference_id": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"types": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
Elem: &schema.Schema{
|
||||
Type: schema.TypeString,
|
||||
},
|
||||
},
|
||||
"uris": {
|
||||
Type: schema.TypeSet,
|
||||
Computed: true,
|
||||
Elem: &schema.Resource{
|
||||
Schema: map[string]*schema.Schema{
|
||||
"ip": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"port": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"usage_limit": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
126
internal/service/cloudbroker/sep/flattens.go
Normal file
126
internal/service/cloudbroker/sep/flattens.go
Normal file
@@ -0,0 +1,126 @@
|
||||
/*
|
||||
Copyright (c) 2019-2023 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Authors:
|
||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||
Sergey Kisil, <svkisil@digitalenergy.online>
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||
Orchestration Technology) with Terraform by Hashicorp.
|
||||
|
||||
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||
|
||||
Please see README.md to learn where to place source code so that it
|
||||
builds seamlessly.
|
||||
|
||||
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||
*/
|
||||
|
||||
package sep
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/sep"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/flattens"
|
||||
)
|
||||
|
||||
func flattenSepList(sl *sep.ListSEP) []map[string]interface{} {
|
||||
res := make([]map[string]interface{}, 0)
|
||||
for _, item := range sl.Data {
|
||||
data, _ := json.Marshal(item.Config)
|
||||
temp := map[string]interface{}{
|
||||
"ckey": item.CKey,
|
||||
"meta": flattens.FlattenMeta(item.Meta),
|
||||
"consumed_by": item.ConsumedBy,
|
||||
"desc": item.Description,
|
||||
"gid": item.GID,
|
||||
"guid": item.GUID,
|
||||
"sep_id": item.ID,
|
||||
"milestones": item.Milestones,
|
||||
"name": item.Name,
|
||||
"obj_status": item.ObjStatus,
|
||||
"provided_by": item.ProvidedBy,
|
||||
"shared_with": item.SharedWith,
|
||||
"tech_status": item.TechStatus,
|
||||
"type": item.Type,
|
||||
"config": string(data),
|
||||
}
|
||||
res = append(res, temp)
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
func flattenSepPool(rp *sep.RecordPool) []map[string]interface{} {
|
||||
sh := make([]map[string]interface{}, 0)
|
||||
res := map[string]interface{}{
|
||||
"access_account_ids": rp.AccessAccountIDs,
|
||||
"access_res_group_ids": rp.AccessResGroupIDs,
|
||||
"name": rp.Name,
|
||||
"pagecache_ratio": rp.PageCacheRatio,
|
||||
"reference_id": rp.ReferenceID,
|
||||
"types": rp.Types,
|
||||
"uris": flattenSepPoolUris(rp),
|
||||
"usage_limit": rp.UsageLimit,
|
||||
}
|
||||
sh = append(sh, res)
|
||||
return sh
|
||||
}
|
||||
|
||||
func flattenSepPoolUris(rp *sep.RecordPool) []map[string]interface{} {
|
||||
res := make([]map[string]interface{}, 0)
|
||||
for _, ur := range rp.URIs {
|
||||
temp := map[string]interface{}{
|
||||
"ip": ur.IP,
|
||||
"port": ur.Port,
|
||||
}
|
||||
res = append(res, temp)
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
func flattenSepConsumption(sc sep.Total) []map[string]interface{} {
|
||||
sh := make([]map[string]interface{}, 0)
|
||||
temp := map[string]interface{}{
|
||||
"capacity_limit": sc.CapacityLimit,
|
||||
"disk_count": sc.DiskCount,
|
||||
"disk_usage": sc.DiskUsage,
|
||||
"snapshot_count": sc.SnapshotCount,
|
||||
"snapshot_usage": sc.SnapshotUsage,
|
||||
"usage": sc.Usage,
|
||||
"usage_limit": sc.UsageLimit,
|
||||
}
|
||||
sh = append(sh, temp)
|
||||
return sh
|
||||
}
|
||||
|
||||
func flattenSepConsumptionPools(bp *sep.RecordConsumption) []map[string]interface{} {
|
||||
sh := make([]map[string]interface{}, 0)
|
||||
for key, value := range bp.ByPool {
|
||||
temp := map[string]interface{}{
|
||||
"name": key,
|
||||
"disk_count": value.DiskCount,
|
||||
"disk_usage": value.DiskUsage,
|
||||
"snapshot_count": value.SnapshotCount,
|
||||
"snapshot_usage": value.SnapshotUsage,
|
||||
"usage": value.Usage,
|
||||
"usage_limit": value.UsageLimit,
|
||||
}
|
||||
sh = append(sh, temp)
|
||||
}
|
||||
return sh
|
||||
}
|
||||
@@ -1,77 +0,0 @@
|
||||
/*
|
||||
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://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||
|
||||
Please see README.md to learn where to place source code so that it
|
||||
builds seamlessly.
|
||||
|
||||
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||
*/
|
||||
|
||||
package sep
|
||||
|
||||
///Sep Models
|
||||
type SepConsumptionInd struct {
|
||||
DiskCount int `json:"disk_count"`
|
||||
DiskUsage int `json:"disk_usage"`
|
||||
SnapshotCount int `json:"snapshot_count"`
|
||||
SnapshotUsage int `json:"snapshot_usage"`
|
||||
Usage int `json:"usage"`
|
||||
UsageLimit int `json:"usage_limit"`
|
||||
}
|
||||
|
||||
type SepConsumptionTotal struct {
|
||||
CapacityLimit int `json:"capacity_limit"`
|
||||
SepConsumptionInd
|
||||
}
|
||||
|
||||
type SepConsumption struct {
|
||||
Total SepConsumptionTotal `json:"total"`
|
||||
Type string `json:"type"`
|
||||
ByPool map[string]SepConsumptionInd `json:"byPool"`
|
||||
}
|
||||
|
||||
type SepDiskList []int
|
||||
|
||||
type Sep struct {
|
||||
Ckey string `json:"_ckey"`
|
||||
Meta []interface{} `json:"_meta"`
|
||||
ConsumedBy []int `json:"consumedBy"`
|
||||
Desc string `json:"desc"`
|
||||
Gid int `json:"gid"`
|
||||
Guid int `json:"guid"`
|
||||
Id int `json:"id"`
|
||||
Milestones int `json:"milestones"`
|
||||
Name string `json:"name"`
|
||||
ObjStatus string `json:"objStatus"`
|
||||
ProvidedBy []int `json:"providedBy"`
|
||||
TechStatus string `json:"techStatus"`
|
||||
Type string `json:"type"`
|
||||
Config SepConfig `json:"config"`
|
||||
}
|
||||
|
||||
type SepConfig map[string]interface{}
|
||||
|
||||
type SepList []Sep
|
||||
type SepPool map[string]interface{}
|
||||
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
Copyright (c) 2019-2023 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Authors:
|
||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||
Sergey Kisil, <svkisil@digitalenergy.online>
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||
Orchestration Technology) with Terraform by Hashicorp.
|
||||
|
||||
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||
|
||||
Please see README.md to learn where to place source code so that it
|
||||
builds seamlessly.
|
||||
|
||||
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||
*/
|
||||
|
||||
package sep
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/grid"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
|
||||
)
|
||||
|
||||
func existGID(ctx context.Context, d *schema.ResourceData, m interface{}) (bool, error) {
|
||||
c := m.(*controller.ControllerCfg)
|
||||
gid := uint64(d.Get("gid").(int))
|
||||
req := grid.ListRequest{}
|
||||
|
||||
gridList, err := c.CloudBroker().Grid().List(ctx, req)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
return len(gridList.FilterByID(gid).Data) != 0, nil
|
||||
}
|
||||
|
||||
func resourceSepConfigExists(ctx context.Context, d *schema.ResourceData, m interface{}) (bool, error) {
|
||||
log.Debugf("resourceSepConfigExists: called for sep id: %d", d.Get("sep_id").(int))
|
||||
|
||||
sepDesConfig, err := utilitySepConfigCheckPresence(ctx, d, m)
|
||||
if sepDesConfig == nil {
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
return false, nil
|
||||
}
|
||||
|
||||
return true, nil
|
||||
}
|
||||
@@ -1,8 +1,9 @@
|
||||
/*
|
||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Copyright (c) 2019-2023 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Authors:
|
||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||
Sergey Kisil, <svkisil@digitalenergy.online>
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@@ -51,8 +52,16 @@ func resourceSepCreate(ctx context.Context, d *schema.ResourceData, m interface{
|
||||
c := m.(*controller.ControllerCfg)
|
||||
req := sep.CreateRequest{}
|
||||
|
||||
req.Name = d.Get("name").(string)
|
||||
haveGID, err := existGID(ctx, d, m)
|
||||
if err != nil {
|
||||
return diag.FromErr(err)
|
||||
}
|
||||
if !haveGID {
|
||||
return diag.Errorf("resourceSepCreate: can't create Sep because GID %d is not allowed or does not exist", d.Get("gid").(int))
|
||||
}
|
||||
req.GID = uint64(d.Get("gid").(int))
|
||||
|
||||
req.Name = d.Get("name").(string)
|
||||
req.SEPType = d.Get("type").(string)
|
||||
|
||||
if desc, ok := d.GetOk("desc"); ok {
|
||||
@@ -110,6 +119,7 @@ func resourceSepRead(ctx context.Context, d *schema.ResourceData, m interface{})
|
||||
d.Set("name", sep.Name)
|
||||
d.Set("obj_status", sep.ObjStatus)
|
||||
d.Set("provided_by", sep.ProvidedBy)
|
||||
d.Set("shared_with", sep.SharedWith)
|
||||
d.Set("tech_status", sep.TechStatus)
|
||||
d.Set("type", sep.Type)
|
||||
data, _ := json.Marshal(sep.Config)
|
||||
@@ -148,6 +158,14 @@ func resourceSepUpdate(ctx context.Context, d *schema.ResourceData, m interface{
|
||||
log.Debugf("resourceSepEdit: called for %s, id: %d", d.Get("name").(string), d.Get("sep_id").(int))
|
||||
c := m.(*controller.ControllerCfg)
|
||||
|
||||
haveGID, err := existGID(ctx, d, m)
|
||||
if err != nil {
|
||||
return diag.FromErr(err)
|
||||
}
|
||||
if !haveGID {
|
||||
return diag.Errorf("resourceSepUpdate: can't update Sep because GID %d is not allowed or does not exist", d.Get("gid").(int))
|
||||
}
|
||||
|
||||
if d.HasChange("decommission") {
|
||||
decommission := d.Get("decommission").(bool)
|
||||
if decommission {
|
||||
@@ -236,11 +254,7 @@ func resourceSepUpdate(ctx context.Context, d *schema.ResourceData, m interface{
|
||||
}
|
||||
}
|
||||
|
||||
if diagnostics := resourceSepRead(ctx, d, m); diagnostics != nil {
|
||||
return diagnostics
|
||||
}
|
||||
|
||||
return nil
|
||||
return resourceSepRead(ctx, d, m)
|
||||
}
|
||||
|
||||
func resourceSepChangeEnabled(ctx context.Context, d *schema.ResourceData, m interface{}) error {
|
||||
@@ -273,64 +287,45 @@ func resourceSepChangeEnabled(ctx context.Context, d *schema.ResourceData, m int
|
||||
func resourceSepUpdateNodes(ctx context.Context, d *schema.ResourceData, m interface{}) error {
|
||||
log.Debugf("resourceSepUpdateNodes: called for %s, id: %d", d.Get("name").(string), d.Get("sep_id").(int))
|
||||
c := m.(*controller.ControllerCfg)
|
||||
delReq := sep.DelConsumerNodesRequest{
|
||||
SEPID: uint64(d.Get("sep_id").(int)),
|
||||
|
||||
oldSet, newSet := d.GetChange("consumed_by")
|
||||
|
||||
deletedConsumed := (oldSet.(*schema.Set).Difference(newSet.(*schema.Set))).List()
|
||||
var consumerDelIds []uint64
|
||||
for _, deletedInterface := range deletedConsumed {
|
||||
deletedItem := deletedInterface.(int)
|
||||
consumerDelIds = append(consumerDelIds, uint64(deletedItem))
|
||||
}
|
||||
|
||||
addReq := sep.AddConsumerNodesRequest{
|
||||
SEPID: uint64(d.Get("sep_id").(int)),
|
||||
}
|
||||
|
||||
toDel := false
|
||||
|
||||
t1, t2 := d.GetChange("consumed_by")
|
||||
|
||||
consumedIds := make([]interface{}, 0)
|
||||
|
||||
if d1, d2 := t1.([]interface{}), t2.([]interface{}); len(d1) > len(d2) {
|
||||
for _, n := range d2 {
|
||||
if !findElInt(d1, n) {
|
||||
consumedIds = append(consumedIds, n)
|
||||
}
|
||||
if len(consumerDelIds) != 0 {
|
||||
reqDel := sep.DelConsumerNodesRequest{
|
||||
SEPID: uint64(d.Get("sep_id").(int)),
|
||||
ConsumerNIDs: consumerDelIds,
|
||||
}
|
||||
toDel = true
|
||||
} else {
|
||||
consumedIds = d.Get("consumed_by").([]interface{})
|
||||
}
|
||||
|
||||
var consumerNIDs []uint64
|
||||
for _, consumedId := range consumedIds {
|
||||
consumerNIDs = append(consumerNIDs, uint64(consumedId.(int)))
|
||||
}
|
||||
|
||||
if toDel {
|
||||
delReq.ConsumerNIDs = consumerNIDs
|
||||
|
||||
_, err := c.CloudBroker().SEP().DelConsumerNodes(ctx, delReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
addReq.ConsumerNIDs = consumerNIDs
|
||||
|
||||
_, err := c.CloudBroker().SEP().AddConsumerNodes(ctx, addReq)
|
||||
_, err := c.CloudBroker().SEP().DelConsumerNodes(ctx, reqDel)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
addedConsumed := (newSet.(*schema.Set).Difference(oldSet.(*schema.Set))).List()
|
||||
var consumerAddIds []uint64
|
||||
for _, addedInterface := range addedConsumed {
|
||||
AddedItem := addedInterface.(int)
|
||||
consumerAddIds = append(consumerAddIds, uint64(AddedItem))
|
||||
}
|
||||
if len(consumerAddIds) != 0 {
|
||||
reqAdd := sep.AddConsumerNodesRequest{
|
||||
SEPID: uint64(d.Get("sep_id").(int)),
|
||||
ConsumerNIDs: consumerAddIds,
|
||||
}
|
||||
_, err := c.CloudBroker().SEP().AddConsumerNodes(ctx, reqAdd)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func findElInt(sl []interface{}, el interface{}) bool {
|
||||
for _, e := range sl {
|
||||
if e.(int) == el.(int) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func resourceSepUpdateProviders(ctx context.Context, d *schema.ResourceData, m interface{}) error {
|
||||
log.Debugf("resourceSepUpdateProviders: called for %s, id: %d", d.Get("name").(string), d.Get("sep_id").(int))
|
||||
c := m.(*controller.ControllerCfg)
|
||||
@@ -396,7 +391,7 @@ func resourceSepSchemaMake() map[string]*schema.Schema {
|
||||
},
|
||||
},
|
||||
"consumed_by": {
|
||||
Type: schema.TypeList,
|
||||
Type: schema.TypeSet,
|
||||
Optional: true,
|
||||
Computed: true,
|
||||
Elem: &schema.Schema{
|
||||
@@ -441,6 +436,14 @@ func resourceSepSchemaMake() map[string]*schema.Schema {
|
||||
},
|
||||
Description: "list of provider nodes IDs",
|
||||
},
|
||||
"shared_with": {
|
||||
Type: schema.TypeList,
|
||||
Optional: true,
|
||||
Computed: true,
|
||||
Elem: &schema.Schema{
|
||||
Type: schema.TypeInt,
|
||||
},
|
||||
},
|
||||
"tech_status": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Copyright (c) 2019-2023 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Authors:
|
||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||
@@ -85,20 +85,6 @@ func resourceSepConfigDelete(ctx context.Context, d *schema.ResourceData, m inte
|
||||
return nil
|
||||
}
|
||||
|
||||
func resourceSepConfigExists(ctx context.Context, d *schema.ResourceData, m interface{}) (bool, error) {
|
||||
log.Debugf("resourceSepConfigExists: called for sep id: %d", d.Get("sep_id").(int))
|
||||
|
||||
sepDesConfig, err := utilitySepConfigCheckPresence(ctx, d, m)
|
||||
if sepDesConfig == nil {
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
return false, nil
|
||||
}
|
||||
|
||||
return true, nil
|
||||
}
|
||||
|
||||
func resourceSepConfigUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||
log.Debugf("resourceSepConfigEdit: called for sep id: %d", d.Get("sep_id").(int))
|
||||
c := m.(*controller.ControllerCfg)
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
/*
|
||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Copyright (c) 2019-2023 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Authors:
|
||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||
Sergey Kisil, <svkisil@digitalenergy.online>
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@@ -46,11 +47,16 @@ func utilitySepCheckPresence(ctx context.Context, d *schema.ResourceData, m inte
|
||||
c := m.(*controller.ControllerCfg)
|
||||
req := sep.GetRequest{}
|
||||
|
||||
if d.Get("sep_id").(int) == 0 {
|
||||
if d.Get("sep_id") != nil {
|
||||
if d.Get("sep_id").(int) == 0 {
|
||||
id, _ := strconv.ParseUint(d.Id(), 10, 64)
|
||||
req.SEPID = id
|
||||
} else {
|
||||
req.SEPID = uint64(d.Get("sep_id").(int))
|
||||
}
|
||||
} else {
|
||||
id, _ := strconv.ParseUint(d.Id(), 10, 64)
|
||||
req.SEPID = id
|
||||
} else {
|
||||
req.SEPID = uint64(d.Get("sep_id").(int))
|
||||
}
|
||||
|
||||
log.Debugf("utilitySepCheckPresence: load sep")
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Copyright (c) 2019-2023 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Authors:
|
||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Copyright (c) 2019-2023 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Authors:
|
||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Copyright (c) 2019-2023 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Authors:
|
||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
/*
|
||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Copyright (c) 2019-2023 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Authors:
|
||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||
Sergey Kisil, <svkisil@digitalenergy.online>
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@@ -45,6 +46,27 @@ func utilitySepListCheckPresence(ctx context.Context, d *schema.ResourceData, m
|
||||
c := m.(*controller.ControllerCfg)
|
||||
req := sep.ListRequest{}
|
||||
|
||||
if by_id, ok := d.GetOk("by_id"); ok {
|
||||
req.ByID = uint64(by_id.(int))
|
||||
}
|
||||
if name, ok := d.GetOk("name"); ok {
|
||||
req.Name = string(name.(string))
|
||||
}
|
||||
if gid, ok := d.GetOk("gid"); ok {
|
||||
req.GID = uint64(gid.(int))
|
||||
}
|
||||
if type_, ok := d.GetOk("type"); ok {
|
||||
req.Type = string(type_.(string))
|
||||
}
|
||||
if provided_by, ok := d.GetOk("provided_by"); ok {
|
||||
req.ProvidedBy = uint64(provided_by.(int))
|
||||
}
|
||||
if tech_status, ok := d.GetOk("tech_status"); ok {
|
||||
req.TechStatus = string(tech_status.(string))
|
||||
}
|
||||
if consumed_by, ok := d.GetOk("consumed_by"); ok {
|
||||
req.ConsumedBy = uint64(consumed_by.(int))
|
||||
}
|
||||
if page, ok := d.GetOk("page"); ok {
|
||||
req.Page = uint64(page.(int))
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Copyright (c) 2019-2023 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Authors:
|
||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||
|
||||
Reference in New Issue
Block a user