This commit is contained in:
asteam
2024-12-04 13:18:58 +03:00
parent 003e4d656e
commit 76ea459b3d
417 changed files with 30051 additions and 975 deletions

View File

@@ -34,8 +34,8 @@ func VINSDataSource(ctx context.Context, state *models.DataSourceVINSModel, c *d
id := uuid.New()
*state = models.DataSourceVINSModel{
VinsID: state.VinsID,
Reason: state.Reason,
VinsID: state.VinsID,
Timeouts: state.Timeouts,
VNFDev: flattenVNFDev(ctx, &recordVins.VNFDev),

View File

@@ -29,8 +29,8 @@ func VINSNATRuleListDataSource(ctx context.Context, state *models.DataSourceVINS
id := uuid.New()
*state = models.DataSourceVINSNATRuleListModel{
VinsID: state.VinsID,
Reason: state.Reason,
VinsID: state.VinsID,
Timeouts: state.Timeouts,
Id: types.StringValue(id.String()),

View File

@@ -11,7 +11,6 @@ import (
type DataSourceVINSModel struct {
// request fields
VinsID types.Int64 `tfsdk:"vins_id"`
Reason types.String `tfsdk:"reason"`
Timeouts timeouts.Value `tfsdk:"timeouts"`
// response fields

View File

@@ -8,7 +8,6 @@ import (
type DataSourceVINSNATRuleListModel struct {
// request fields
VinsID types.Int64 `tfsdk:"vins_id"`
Reason types.String `tfsdk:"reason"`
Timeouts timeouts.Value `tfsdk:"timeouts"`
// response fields

View File

@@ -33,7 +33,6 @@ type ResourceVINSModel struct {
ExtNet types.Object `tfsdk:"ext_net"`
IP types.List `tfsdk:"ip"`
NatRule types.List `tfsdk:"nat_rule"`
Reason types.String `tfsdk:"reason"`
Timeouts timeouts.Value `tfsdk:"timeouts"`
// response fields
@@ -75,7 +74,6 @@ type IPModel struct {
IPAddr types.String `tfsdk:"ip_addr"`
MacAddr types.String `tfsdk:"mac_addr"`
ComputeID types.Int64 `tfsdk:"compute_id"`
Reason types.String `tfsdk:"reason"`
}
type NatRuleResourceModel struct {
@@ -85,7 +83,6 @@ type NatRuleResourceModel struct {
ExtPortEnd types.Int64 `tfsdk:"ext_port_end"`
Proto types.String `tfsdk:"proto"`
RuleID types.Int64 `tfsdk:"rule_id"`
Reason types.String `tfsdk:"reason"`
}
var ItemNatRuleResource = map[string]attr.Type{

View File

@@ -13,12 +13,6 @@ func MakeSchemaDataSourceVINS() map[string]schema.Attribute {
Description: "Unique ID of the ViNS.",
},
// optional attributes
"reason": schema.StringAttribute{
Optional: true,
Description: "reason for action",
},
// computed attributes
"id": schema.StringAttribute{
Computed: true,

View File

@@ -11,11 +11,6 @@ func MakeSchemaDataSourceVINSNATRuleList() map[string]schema.Attribute {
Required: true,
Description: "VINS id",
},
// optional attributes
"reason": schema.StringAttribute{
Optional: true,
Description: "reason for action",
},
// computed attributes
"id": schema.StringAttribute{

View File

@@ -97,10 +97,6 @@ func MakeSchemaResourceVINS() map[string]schema.Attribute {
Description: "flag to redeploy vnfdev",
// default is false
},
"reason": schema.StringAttribute{
Optional: true,
Description: "reason for action",
},
"ext_net": schema.SingleNestedAttribute{
Optional: true,
@@ -142,9 +138,6 @@ func MakeSchemaResourceVINS() map[string]schema.Attribute {
Optional: true,
Description: "ID of the compute, associated with this reservation of type DHCP. Ignored for other types.",
},
"reason": schema.StringAttribute{
Optional: true,
},
},
},
},
@@ -183,9 +176,6 @@ func MakeSchemaResourceVINS() map[string]schema.Attribute {
Computed: true,
Description: "rule id",
},
"reason": schema.StringAttribute{
Optional: true,
},
},
},
},

View File

@@ -19,10 +19,6 @@ func VINSNATRuleListDataSourceCheckPresence(ctx context.Context, state *models.D
VINSID: uint64(state.VinsID.ValueInt64()),
}
if !state.Reason.IsNull() {
req.Reason = state.Reason.ValueString()
}
natRuleList, err := c.CloudBroker().VINS().NATRuleList(ctx, req)
if err != nil {
diags.AddError("Cannot get info about vins nat rule list", err.Error())

View File

@@ -79,9 +79,7 @@ func CreateInRGResourceVINS(ctx context.Context, plan *models.ResourceVINSModel,
} else {
createReq.PreReservationsNum = uint64(plan.PreReservationsNum.ValueInt64())
}
if !plan.Reason.IsNull() {
createReq.Reason = plan.Reason.ValueString()
}
if !plan.DNS.IsNull() {
result := make([]string, 0, len(plan.DNS.Elements()))
for _, val := range plan.DNS.Elements() {
@@ -135,10 +133,6 @@ func CreateInAccountResourceVINS(ctx context.Context, plan *models.ResourceVINSM
createReq.PreReservationsNum = uint64(plan.PreReservationsNum.ValueInt64())
}
if !plan.Reason.IsNull() {
createReq.Reason = plan.Reason.ValueString()
}
if !plan.DNS.IsNull() {
result := make([]string, 0, len(plan.DNS.Elements()))
for _, val := range plan.DNS.Elements() {
@@ -193,9 +187,6 @@ func IPCreateVINS(ctx context.Context, vinsId uint64, plan *models.ResourceVINSM
if ip.ComputeID.ValueInt64() != 0 {
ipReserveReq.ComputeID = uint64(ip.ComputeID.ValueInt64())
}
if ip.Reason.ValueString() != "" {
ipReserveReq.Reason = ip.Reason.ValueString()
}
tflog.Info(ctx, "IPCreateVINS: before calling CloudBroker().VINS().IPReserve", map[string]any{
"vins_id": vinsId,
@@ -299,9 +290,6 @@ func IPUpdateVINS(ctx context.Context, vinsId uint64, plan, state *models.Resour
if addedIPItem.ComputeID.ValueInt64() != 0 {
ipReserveReq.ComputeID = uint64(addedIPItem.ComputeID.ValueInt64())
}
if addedIPItem.Reason.ValueString() != "" {
ipReserveReq.MAC = addedIPItem.Reason.ValueString()
}
tflog.Info(ctx, "IPUpdateVINS: before calling CloudBroker().VINS().IPReserve", map[string]any{
"vins_id": vinsId,
@@ -404,9 +392,6 @@ func NATRuleCreateVINS(ctx context.Context, vinsId uint64, plan *models.Resource
if !nat.Proto.IsUnknown() {
natAddReq.Proto = nat.Proto.ValueString()
}
if !nat.Reason.IsNull() {
natAddReq.Reason = nat.Reason.ValueString()
}
tflog.Info(ctx, "NATRuleCreateVINS: before calling CloudBroker().VINS().NATRuleAdd", map[string]any{
"vins_id": vinsId,
@@ -511,10 +496,6 @@ func NATRuleUpdateVINS(ctx context.Context, vinsId uint64, plan, state *models.R
RuleID: deletedNatRuleItem.RuleID.ValueInt64(),
}
if deletedNatRuleItem.Reason.ValueString() != "" {
deleteNATReq.Reason = deletedNatRuleItem.Reason.ValueString()
}
tflog.Info(ctx, "NATRuleUpdateVINS: before calling CloudBroker().VINS().NATRuleDel", map[string]any{"vins_id": plan.Id.ValueString(), "req": deleteNATReq})
res, err := c.CloudBroker().VINS().NATRuleDel(ctx, deleteNATReq)
tflog.Info(ctx, "NATRuleUpdateVINS: response from CloudBroker().VINS().NATRuleDel", map[string]any{"vins_id": plan.Id.ValueString(), "response": res})
@@ -555,9 +536,6 @@ func NATRuleUpdateVINS(ctx context.Context, vinsId uint64, plan, state *models.R
if !addedNatRuleItem.Proto.IsUnknown() {
natAddReq.Proto = addedNatRuleItem.Proto.ValueString()
}
if !addedNatRuleItem.Reason.IsUnknown() {
natAddReq.Reason = addedNatRuleItem.Reason.ValueString()
}
tflog.Info(ctx, "NATRuleUpdateVINS: before calling CloudBroker().VINS().NATRuleAdd", map[string]any{
"vins_id": vinsId,
@@ -756,10 +734,6 @@ func VnfdevRestartUpdateVINS(ctx context.Context, vinsId uint64, plan *models.Re
VINSID: vinsId,
}
if !plan.Reason.IsNull() {
req.Reason = plan.Reason.ValueString()
}
res, err := c.CloudBroker().VINS().VNFDevRestart(ctx, req)
if err != nil {
diags.AddError(
@@ -784,10 +758,6 @@ func VnfdevRedeployUpdateVINS(ctx context.Context, vinsId uint64, plan *models.R
VINSID: vinsId,
}
if !plan.Reason.IsNull() {
req.Reason = plan.Reason.ValueString()
}
res, err := c.CloudBroker().VINS().VNFDevRedeploy(ctx, req)
if err != nil {
diags.AddError(
@@ -812,10 +782,6 @@ func VnfdevResetUpdateVINS(ctx context.Context, vinsId uint64, plan *models.Reso
VINSID: vinsId,
}
if !plan.Reason.IsNull() {
req.Reason = plan.Reason.ValueString()
}
res, err := c.CloudBroker().VINS().VNFDevReset(ctx, req)
if err != nil {
diags.AddError(
@@ -838,9 +804,7 @@ func VnfdevStartStopUpdateVINS(ctx context.Context, vinsId uint64, plan *models.
req := vins.VNFDevStartRequest{
VINSID: vinsId,
}
if !plan.Reason.IsNull() {
req.Reason = plan.Reason.ValueString()
}
tflog.Info(ctx, "VnfdevResetUpdateVINS: before calling CloudBroker().VINS().VNFDevStart", map[string]any{"vinsId": vinsId})
res, err := c.CloudBroker().VINS().VNFDevStart(ctx, req)
if err != nil {
@@ -857,9 +821,7 @@ func VnfdevStartStopUpdateVINS(ctx context.Context, vinsId uint64, plan *models.
req := vins.VNFDevStopRequest{
VINSID: vinsId,
}
if !plan.Reason.IsNull() {
req.Reason = plan.Reason.ValueString()
}
tflog.Info(ctx, "VnfdevResetUpdateVINS: before calling CloudBroker().VINS().VNFDevStop", map[string]any{"vinsId": vinsId})
res, err := c.CloudBroker().VINS().VNFDevStop(ctx, req)
if err != nil {