Skip to content

Commit 453d941

Browse files
update (#3626)
1 parent 69d1881 commit 453d941

File tree

2 files changed

+0
-105
lines changed

2 files changed

+0
-105
lines changed

clusters/resource_cluster.go

Lines changed: 0 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"context"
55
"fmt"
66
"log"
7-
"slices"
87
"strings"
98
"time"
109

@@ -440,105 +439,6 @@ func setPinnedStatus(ctx context.Context, d *schema.ResourceData, clusterAPI com
440439
return d.Set("is_pinned", pinnedEvent == compute.EventTypePinned)
441440
}
442441

443-
func RemoveUnnecessaryFieldsFromForceSendFields(cluster any) error {
444-
switch clusterSpec := cluster.(type) {
445-
case *compute.ClusterSpec:
446-
if clusterSpec.AwsAttributes != nil {
447-
newAwsAttributesForceSendFields := []string{}
448-
// These fields should never be 0.
449-
unnecessaryFieldNamesForAwsAttributes := []string{
450-
"SpotBidPricePercent",
451-
"EbsVolumeCount",
452-
"EbsVolumeIops",
453-
"EbsVolumeSize",
454-
"EbsVolumeThroughput",
455-
}
456-
for _, field := range clusterSpec.AwsAttributes.ForceSendFields {
457-
if !slices.Contains(unnecessaryFieldNamesForAwsAttributes, field) {
458-
newAwsAttributesForceSendFields = append(newAwsAttributesForceSendFields, field)
459-
}
460-
}
461-
clusterSpec.AwsAttributes.ForceSendFields = newAwsAttributesForceSendFields
462-
}
463-
if clusterSpec.GcpAttributes != nil {
464-
newGcpAttributesForceSendFields := []string{}
465-
// Should never be 0.
466-
unnecessaryFieldNamesForGcpAttributes := []string{
467-
"BootDiskSize",
468-
}
469-
for _, field := range clusterSpec.GcpAttributes.ForceSendFields {
470-
if !slices.Contains(unnecessaryFieldNamesForGcpAttributes, field) {
471-
newGcpAttributesForceSendFields = append(newGcpAttributesForceSendFields, field)
472-
}
473-
}
474-
clusterSpec.GcpAttributes.ForceSendFields = newGcpAttributesForceSendFields
475-
}
476-
if clusterSpec.AzureAttributes != nil {
477-
newAzureAttributesForceSendFields := []string{}
478-
// Should never be 0.
479-
unnecessaryFieldNamesForAzureAttributes := []string{
480-
"FirstOnDemand",
481-
"SpotBidMaxPrice",
482-
}
483-
for _, field := range clusterSpec.AzureAttributes.ForceSendFields {
484-
if !slices.Contains(unnecessaryFieldNamesForAzureAttributes, field) {
485-
newAzureAttributesForceSendFields = append(newAzureAttributesForceSendFields, field)
486-
}
487-
}
488-
clusterSpec.AzureAttributes.ForceSendFields = newAzureAttributesForceSendFields
489-
}
490-
return nil
491-
case *compute.EditCluster:
492-
if clusterSpec.AwsAttributes != nil {
493-
newAwsAttributesForceSendFields := []string{}
494-
// These fields should never be 0.
495-
unnecessaryFieldNamesForAwsAttributes := []string{
496-
"SpotBidPricePercent",
497-
"EbsVolumeCount",
498-
"EbsVolumeIops",
499-
"EbsVolumeSize",
500-
"EbsVolumeThroughput",
501-
}
502-
for _, field := range clusterSpec.AwsAttributes.ForceSendFields {
503-
if !slices.Contains(unnecessaryFieldNamesForAwsAttributes, field) {
504-
newAwsAttributesForceSendFields = append(newAwsAttributesForceSendFields, field)
505-
}
506-
}
507-
clusterSpec.AwsAttributes.ForceSendFields = newAwsAttributesForceSendFields
508-
}
509-
if clusterSpec.GcpAttributes != nil {
510-
newGcpAttributesForceSendFields := []string{}
511-
// Should never be 0.
512-
unnecessaryFieldNamesForGcpAttributes := []string{
513-
"BootDiskSize",
514-
}
515-
for _, field := range clusterSpec.GcpAttributes.ForceSendFields {
516-
if !slices.Contains(unnecessaryFieldNamesForGcpAttributes, field) {
517-
newGcpAttributesForceSendFields = append(newGcpAttributesForceSendFields, field)
518-
}
519-
}
520-
clusterSpec.GcpAttributes.ForceSendFields = newGcpAttributesForceSendFields
521-
}
522-
if clusterSpec.AzureAttributes != nil {
523-
newAzureAttributesForceSendFields := []string{}
524-
// Should never be 0.
525-
unnecessaryFieldNamesForAzureAttributes := []string{
526-
"FirstOnDemand",
527-
"SpotBidMaxPrice",
528-
}
529-
for _, field := range clusterSpec.AzureAttributes.ForceSendFields {
530-
if !slices.Contains(unnecessaryFieldNamesForAzureAttributes, field) {
531-
newAzureAttributesForceSendFields = append(newAzureAttributesForceSendFields, field)
532-
}
533-
}
534-
clusterSpec.AzureAttributes.ForceSendFields = newAzureAttributesForceSendFields
535-
}
536-
return nil
537-
default:
538-
return fmt.Errorf(unsupportedExceptCreateEditClusterSpecErr, cluster, "*", "*", "*")
539-
}
540-
}
541-
542442
func resourceClusterRead(ctx context.Context, d *schema.ResourceData, c *common.DatabricksClient) error {
543443
w, err := c.WorkspaceClient()
544444
if err != nil {
@@ -674,7 +574,6 @@ func resourceClusterUpdate(ctx context.Context, d *schema.ResourceData, c *commo
674574
Autoscale: cluster.Autoscale,
675575
})
676576
} else {
677-
err = RemoveUnnecessaryFieldsFromForceSendFields(&cluster)
678577
if err != nil {
679578
return err
680579
}

jobs/jobs_api_go_sdk.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,6 @@ func updateJobClusterSpec(clusterSpec *compute.ClusterSpec, d *schema.ResourceDa
165165
if err != nil {
166166
return err
167167
}
168-
err = clusters.RemoveUnnecessaryFieldsFromForceSendFields(clusterSpec)
169-
if err != nil {
170-
return err
171-
}
172168
return nil
173169
}
174170

0 commit comments

Comments
 (0)