@@ -15,25 +15,6 @@ import (
1515 "github.com/hashicorp/terraform-plugin-framework/diag"
1616)
1717
18- // MLJobStats represents the statistics structure for an ML job
19- type MLJobStats struct {
20- Jobs []MLJob `json:"jobs"`
21- }
22-
23- // MLJob represents a single ML job in the stats response
24- type MLJob struct {
25- JobId string `json:"job_id"`
26- State string `json:"state"`
27- Node * MLJobNode `json:"node,omitempty"`
28- }
29-
30- // MLJobNode represents the node information for an ML job
31- type MLJobNode struct {
32- Id string `json:"id"`
33- Name string `json:"name"`
34- Attributes map [string ]interface {} `json:"attributes"`
35- }
36-
3718// OpenMLJob opens a machine learning job
3819func OpenMLJob (ctx context.Context , apiClient * clients.ApiClient , jobId string ) diag.Diagnostics {
3920 var diags diag.Diagnostics
@@ -120,7 +101,7 @@ func CloseMLJob(ctx context.Context, apiClient *clients.ApiClient, jobId string,
120101}
121102
122103// GetMLJobStats retrieves the stats for a specific machine learning job
123- func GetMLJobStats (ctx context.Context , apiClient * clients.ApiClient , jobId string ) (* MLJob , diag.Diagnostics ) {
104+ func GetMLJobStats (ctx context.Context , apiClient * clients.ApiClient , jobId string ) (* models. MLJob , diag.Diagnostics ) {
124105 var diags diag.Diagnostics
125106
126107 esClient , err := apiClient .GetESClient ()
@@ -148,8 +129,7 @@ func GetMLJobStats(ctx context.Context, apiClient *clients.ApiClient, jobId stri
148129 if diags .HasError () {
149130 return nil , diags
150131 }
151-
152- var jobStats MLJobStats
132+ var jobStats models.MLJobStats
153133 if err := json .NewDecoder (res .Body ).Decode (& jobStats ); err != nil {
154134 diags .AddError ("Failed to decode ML job stats response" , err .Error ())
155135 return nil , diags
0 commit comments