Skip to content

Commit 863475f

Browse files
vsin12srinioci
authored andcommitted
Exempted - Breaking Fix in capacity_management service
1 parent ec651f3 commit 863475f

File tree

3 files changed

+100
-102
lines changed

3 files changed

+100
-102
lines changed

internal/service/capacity_management/capacity_management_occ_availability_catalog_occ_availabilities_data_source.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,13 +140,13 @@ func (s *CapacityManagementOccAvailabilityCatalogOccAvailabilitiesDataSourceCrud
140140
request.ResourceName = &tmp
141141
}
142142

143-
if resourceType, ok := s.D.GetOkExists("resource_type"); ok {
144-
request.ResourceType = oci_capacity_management.OccAvailabilitySummaryResourceTypeEnum(resourceType.(string))
145-
}
143+
// if resourceType, ok := s.D.GetOkExists("resource_type"); ok {
144+
// request.ResourceType = oci_capacity_management.OccAvailabilitySummaryResourceTypeEnum(resourceType.(string))
145+
// }
146146

147-
if workloadType, ok := s.D.GetOkExists("workload_type"); ok {
148-
request.WorkloadType = oci_capacity_management.OccAvailabilitySummaryWorkloadTypeEnum(workloadType.(string))
149-
}
147+
// if workloadType, ok := s.D.GetOkExists("workload_type"); ok {
148+
// request.WorkloadType = oci_capacity_management.OccAvailabilitySummaryWorkloadTypeEnum(workloadType.(string))
149+
// }
150150

151151
request.RequestMetadata.RetryPolicy = tfresource.GetRetryPolicy(false, "capacity_management")
152152

internal/service/capacity_management/capacity_management_occ_availability_catalog_resource.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -537,13 +537,13 @@ func OccAvailabilitySummaryToMap(obj oci_capacity_management.OccAvailabilitySumm
537537
result["resource_name"] = string(*obj.ResourceName)
538538
}
539539

540-
result["resource_type"] = string(obj.ResourceType)
540+
// result["resource_type"] = string(obj.ResourceType)
541541

542542
if obj.Unit != nil {
543543
result["unit"] = string(*obj.Unit)
544544
}
545545

546-
result["workload_type"] = string(obj.WorkloadType)
546+
// result["workload_type"] = string(obj.WorkloadType)
547547

548548
return result
549549
}

internal/service/capacity_management/capacity_management_occ_capacity_request_resource.go

Lines changed: 92 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ package capacity_management
66
import (
77
"context"
88
"fmt"
9-
"log"
10-
"strconv"
119
"strings"
1210
"time"
1311

@@ -599,103 +597,103 @@ func (s *CapacityManagementOccCapacityRequestResourceCrud) SetData() error {
599597
func (s *CapacityManagementOccCapacityRequestResourceCrud) mapToOccCapacityRequestBaseDetails(fieldKeyFormat string) (oci_capacity_management.OccCapacityRequestBaseDetails, error) {
600598
var baseObject oci_capacity_management.OccCapacityRequestBaseDetails
601599
//discriminator
602-
resourceTypeRaw, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "resource_type"))
603-
var resourceType string
604-
if ok {
605-
resourceType = resourceTypeRaw.(string)
606-
} else {
607-
resourceType = "" // default value
608-
}
609-
switch strings.ToLower(resourceType) {
610-
case strings.ToLower("SERVER_HW"):
611-
details := oci_capacity_management.OccCapacityRequestComputeDetails{}
612-
if demandQuantity, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "demand_quantity")); ok {
613-
tmp := demandQuantity.(string)
614-
tmpInt64, err := strconv.ParseInt(tmp, 10, 64)
615-
if err != nil {
616-
return details, fmt.Errorf("unable to convert demandQuantity string: %s to an int64 and encountered error: %v", tmp, err)
617-
}
618-
details.DemandQuantity = &tmpInt64
619-
}
620-
if resourceName, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "resource_name")); ok {
621-
tmp := resourceName.(string)
622-
details.ResourceName = &tmp
623-
}
624-
if actualHandoverQuantity, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "actual_handover_quantity")); ok {
625-
tmp := actualHandoverQuantity.(string)
626-
tmpInt64, err := strconv.ParseInt(tmp, 10, 64)
627-
if err != nil {
628-
return details, fmt.Errorf("unable to convert actualHandoverQuantity string: %s to an int64 and encountered error: %v", tmp, err)
629-
}
630-
details.ActualHandoverQuantity = &tmpInt64
631-
}
632-
if dateActualHandover, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "date_actual_handover")); ok {
633-
tmp, err := time.Parse(time.RFC3339, dateActualHandover.(string))
634-
if err != nil {
635-
return details, err
636-
}
637-
details.DateActualHandover = &oci_common.SDKTime{Time: tmp}
638-
}
639-
if dateExpectedHandover, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "date_expected_handover")); ok {
640-
tmp, err := time.Parse(time.RFC3339, dateExpectedHandover.(string))
641-
if err != nil {
642-
return details, err
643-
}
644-
details.DateExpectedHandover = &oci_common.SDKTime{Time: tmp}
645-
}
646-
if expectedHandoverQuantity, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "expected_handover_quantity")); ok {
647-
tmp := expectedHandoverQuantity.(string)
648-
tmpInt64, err := strconv.ParseInt(tmp, 10, 64)
649-
if err != nil {
650-
return details, fmt.Errorf("unable to convert expectedHandoverQuantity string: %s to an int64 and encountered error: %v", tmp, err)
651-
}
652-
details.ExpectedHandoverQuantity = &tmpInt64
653-
}
654-
if workloadType, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "workload_type")); ok {
655-
details.WorkloadType = oci_capacity_management.OccAvailabilitySummaryWorkloadTypeEnum(workloadType.(string))
656-
}
657-
baseObject = details
658-
default:
659-
return nil, fmt.Errorf("unknown resource_type '%v' was specified", resourceType)
660-
}
600+
// resourceTypeRaw, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "resource_type"))
601+
// var resourceType string
602+
// if ok {
603+
// resourceType = resourceTypeRaw.(string)
604+
// } else {
605+
// resourceType = "" // default value
606+
// }
607+
// switch strings.ToLower(resourceType) {
608+
// case strings.ToLower("SERVER_HW"):
609+
// details := oci_capacity_management.OccCapacityRequestComputeDetails{}
610+
// if demandQuantity, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "demand_quantity")); ok {
611+
// tmp := demandQuantity.(string)
612+
// tmpInt64, err := strconv.ParseInt(tmp, 10, 64)
613+
// if err != nil {
614+
// return details, fmt.Errorf("unable to convert demandQuantity string: %s to an int64 and encountered error: %v", tmp, err)
615+
// }
616+
// details.DemandQuantity = &tmpInt64
617+
// }
618+
// if resourceName, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "resource_name")); ok {
619+
// tmp := resourceName.(string)
620+
// details.ResourceName = &tmp
621+
// }
622+
// if actualHandoverQuantity, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "actual_handover_quantity")); ok {
623+
// tmp := actualHandoverQuantity.(string)
624+
// tmpInt64, err := strconv.ParseInt(tmp, 10, 64)
625+
// if err != nil {
626+
// return details, fmt.Errorf("unable to convert actualHandoverQuantity string: %s to an int64 and encountered error: %v", tmp, err)
627+
// }
628+
// details.ActualHandoverQuantity = &tmpInt64
629+
// }
630+
// if dateActualHandover, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "date_actual_handover")); ok {
631+
// tmp, err := time.Parse(time.RFC3339, dateActualHandover.(string))
632+
// if err != nil {
633+
// return details, err
634+
// }
635+
// details.DateActualHandover = &oci_common.SDKTime{Time: tmp}
636+
// }
637+
// if dateExpectedHandover, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "date_expected_handover")); ok {
638+
// tmp, err := time.Parse(time.RFC3339, dateExpectedHandover.(string))
639+
// if err != nil {
640+
// return details, err
641+
// }
642+
// details.DateExpectedHandover = &oci_common.SDKTime{Time: tmp}
643+
// }
644+
// if expectedHandoverQuantity, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "expected_handover_quantity")); ok {
645+
// tmp := expectedHandoverQuantity.(string)
646+
// tmpInt64, err := strconv.ParseInt(tmp, 10, 64)
647+
// if err != nil {
648+
// return details, fmt.Errorf("unable to convert expectedHandoverQuantity string: %s to an int64 and encountered error: %v", tmp, err)
649+
// }
650+
// details.ExpectedHandoverQuantity = &tmpInt64
651+
// }
652+
// if workloadType, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "workload_type")); ok {
653+
// details.WorkloadType = oci_capacity_management.OccAvailabilitySummaryWorkloadTypeEnum(workloadType.(string))
654+
// }
655+
// baseObject = details
656+
// default:
657+
// return nil, fmt.Errorf("unknown resource_type '%v' was specified", resourceType)
658+
// }
661659
return baseObject, nil
662660
}
663661

664662
func OccCapacityRequestBaseDetailsToMap(obj oci_capacity_management.OccCapacityRequestBaseDetails) map[string]interface{} {
665663
result := map[string]interface{}{}
666-
switch v := (obj).(type) {
667-
case oci_capacity_management.OccCapacityRequestComputeDetails:
668-
result["resource_type"] = "SERVER_HW"
669-
670-
if v.DemandQuantity != nil {
671-
result["demand_quantity"] = strconv.FormatInt(*v.DemandQuantity, 10)
672-
}
673-
674-
if v.ResourceName != nil {
675-
result["resource_name"] = string(*v.ResourceName)
676-
}
677-
678-
if v.ActualHandoverQuantity != nil {
679-
result["actual_handover_quantity"] = strconv.FormatInt(*v.ActualHandoverQuantity, 10)
680-
}
681-
682-
if v.DateActualHandover != nil {
683-
result["date_actual_handover"] = v.DateActualHandover.Format(time.RFC3339Nano)
684-
}
685-
686-
if v.DateExpectedHandover != nil {
687-
result["date_expected_handover"] = v.DateExpectedHandover.Format(time.RFC3339Nano)
688-
}
689-
690-
if v.ExpectedHandoverQuantity != nil {
691-
result["expected_handover_quantity"] = strconv.FormatInt(*v.ExpectedHandoverQuantity, 10)
692-
}
693-
694-
result["workload_type"] = string(v.WorkloadType)
695-
default:
696-
log.Printf("[WARN] Received 'resource_type' of unknown type %v", obj)
697-
return nil
698-
}
664+
// switch v := (obj).(type) {
665+
// case oci_capacity_management.OccCapacityRequestComputeDetails:
666+
// result["resource_type"] = "SERVER_HW"
667+
668+
// if v.DemandQuantity != nil {
669+
// result["demand_quantity"] = strconv.FormatInt(*v.DemandQuantity, 10)
670+
// }
671+
672+
// if v.ResourceName != nil {
673+
// result["resource_name"] = string(*v.ResourceName)
674+
// }
675+
676+
// if v.ActualHandoverQuantity != nil {
677+
// result["actual_handover_quantity"] = strconv.FormatInt(*v.ActualHandoverQuantity, 10)
678+
// }
679+
680+
// if v.DateActualHandover != nil {
681+
// result["date_actual_handover"] = v.DateActualHandover.Format(time.RFC3339Nano)
682+
// }
683+
684+
// if v.DateExpectedHandover != nil {
685+
// result["date_expected_handover"] = v.DateExpectedHandover.Format(time.RFC3339Nano)
686+
// }
687+
688+
// if v.ExpectedHandoverQuantity != nil {
689+
// result["expected_handover_quantity"] = strconv.FormatInt(*v.ExpectedHandoverQuantity, 10)
690+
// }
691+
692+
// result["workload_type"] = string(v.WorkloadType)
693+
// default:
694+
// log.Printf("[WARN] Received 'resource_type' of unknown type %v", obj)
695+
// return nil
696+
// }
699697

700698
return result
701699
}

0 commit comments

Comments
 (0)