Skip to content

Commit ded8289

Browse files
denikIsaac
andcommitted
direct: delete clusters/sql_warehouses/secret_scopes RemapState (copier handles them)
After the prep PRs made these dumb, the auto-generated copier reproduces them exactly (TestNoRedundantRemapState), so remove the methods. Co-authored-by: Isaac <no-reply@databricks.com>
1 parent 81f635f commit ded8289

3 files changed

Lines changed: 0 additions & 85 deletions

File tree

‎bundle/direct/dresources/cluster.go‎

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -103,54 +103,6 @@ func (r *ResourceCluster) PrepareState(input *resources.Cluster) *ClusterState {
103103
return s
104104
}
105105

106-
// RemapState maps the remote ClusterRemote to ClusterState for diff comparison.
107-
// Started is derived from cluster state so the planner can detect start/stop changes.
108-
func (r *ResourceCluster) RemapState(input *ClusterRemote) *ClusterState {
109-
spec := &ClusterState{
110-
ClusterSpec: compute.ClusterSpec{
111-
ApplyPolicyDefaultValues: input.ApplyPolicyDefaultValues,
112-
Autoscale: input.Autoscale,
113-
AutoterminationMinutes: input.AutoterminationMinutes,
114-
AwsAttributes: input.AwsAttributes,
115-
AzureAttributes: input.AzureAttributes,
116-
ClusterLogConf: input.ClusterLogConf,
117-
ClusterName: input.ClusterName,
118-
CustomTags: input.CustomTags,
119-
DataSecurityMode: input.DataSecurityMode,
120-
DependencyMode: input.DependencyMode,
121-
DockerImage: input.DockerImage,
122-
DriverInstancePoolId: input.DriverInstancePoolId,
123-
DriverNodeTypeId: input.DriverNodeTypeId,
124-
DriverNodeTypeFlexibility: input.DriverNodeTypeFlexibility,
125-
EnableElasticDisk: input.EnableElasticDisk,
126-
EnableLocalDiskEncryption: input.EnableLocalDiskEncryption,
127-
GcpAttributes: input.GcpAttributes,
128-
InitScripts: input.InitScripts,
129-
InstancePoolId: input.InstancePoolId,
130-
IsSingleNode: input.IsSingleNode,
131-
Kind: input.Kind,
132-
NodeTypeId: input.NodeTypeId,
133-
NumWorkers: input.NumWorkers,
134-
PolicyId: input.PolicyId,
135-
RemoteDiskThroughput: input.RemoteDiskThroughput,
136-
RuntimeEngine: input.RuntimeEngine,
137-
SingleUserName: input.SingleUserName,
138-
SparkConf: input.SparkConf,
139-
SparkEnvVars: input.SparkEnvVars,
140-
SparkVersion: input.SparkVersion,
141-
SshPublicKeys: input.SshPublicKeys,
142-
TotalInitialRemoteDiskSize: input.TotalInitialRemoteDiskSize,
143-
UseMlRuntime: input.UseMlRuntime,
144-
WorkloadType: input.WorkloadType,
145-
WorkerNodeTypeFlexibility: input.WorkerNodeTypeFlexibility,
146-
ForceSendFields: utils.FilterFields[compute.ClusterSpec](input.ForceSendFields),
147-
},
148-
Lifecycle: input.Lifecycle,
149-
Libraries: input.Libraries,
150-
}
151-
return spec
152-
}
153-
154106
func (r *ResourceCluster) DoRead(ctx context.Context, id string) (*ClusterRemote, error) {
155107
var details *compute.ClusterDetails
156108
var libraries []compute.Library

‎bundle/direct/dresources/secret_scope.go‎

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"fmt"
66

77
"github.com/databricks/cli/bundle/config/resources"
8-
"github.com/databricks/cli/libs/utils"
98
"github.com/databricks/databricks-sdk-go"
109
"github.com/databricks/databricks-sdk-go/service/workspace"
1110
)
@@ -49,18 +48,6 @@ func (*ResourceSecretScope) PrepareState(input *resources.SecretScope) *SecretSc
4948
}
5049
}
5150

52-
func (*ResourceSecretScope) RemapState(remote *SecretScopeRemote) *SecretScopeConfig {
53-
return &SecretScopeConfig{
54-
CreateScope: workspace.CreateScope{
55-
Scope: remote.Scope,
56-
ScopeBackendType: remote.ScopeBackendType,
57-
BackendAzureKeyvault: remote.BackendAzureKeyvault,
58-
InitialManagePrincipal: "",
59-
ForceSendFields: utils.FilterFields[workspace.CreateScope](remote.ForceSendFields),
60-
},
61-
}
62-
}
63-
6451
// DoRead fetches the secret scope by name. Since the Secrets API does not provide
6552
// a "get by name" endpoint (see https://docs.databricks.com/api/workspace/secrets),
6653
// we must list all scopes and filter by name to check if the scope still exists.

‎bundle/direct/dresources/sql_warehouse.go‎

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -68,30 +68,6 @@ func (*ResourceSqlWarehouse) PrepareState(input *resources.SqlWarehouse) *SqlWar
6868
return s
6969
}
7070

71-
// RemapState maps the remote SqlWarehouseRemote to SqlWarehouseState for diff comparison.
72-
// Started is derived from warehouse state so the planner can detect start/stop changes.
73-
func (*ResourceSqlWarehouse) RemapState(warehouse *SqlWarehouseRemote) *SqlWarehouseState {
74-
return &SqlWarehouseState{
75-
CreateWarehouseRequest: sql.CreateWarehouseRequest{
76-
AutoStopMins: warehouse.AutoStopMins,
77-
Channel: warehouse.Channel,
78-
ClusterSize: warehouse.ClusterSize,
79-
CreatorName: warehouse.CreatorName,
80-
EnablePhoton: warehouse.EnablePhoton,
81-
EnableServerlessCompute: warehouse.EnableServerlessCompute,
82-
InstanceProfileArn: warehouse.InstanceProfileArn,
83-
MaxNumClusters: warehouse.MaxNumClusters,
84-
MinNumClusters: warehouse.MinNumClusters,
85-
Name: warehouse.Name,
86-
SpotInstancePolicy: warehouse.SpotInstancePolicy,
87-
Tags: warehouse.Tags,
88-
WarehouseType: sql.CreateWarehouseRequestWarehouseType(warehouse.WarehouseType),
89-
ForceSendFields: utils.FilterFields[sql.CreateWarehouseRequest](warehouse.ForceSendFields),
90-
},
91-
Lifecycle: warehouse.Lifecycle,
92-
}
93-
}
94-
9571
// DoRead reads the warehouse by id.
9672
func (r *ResourceSqlWarehouse) DoRead(ctx context.Context, id string) (*SqlWarehouseRemote, error) {
9773
warehouse, err := r.client.Warehouses.GetById(ctx, id)

0 commit comments

Comments
 (0)