Skip to content

Commit 12bc881

Browse files
NitinMore7ravinitp
authored andcommitted
initial commit
1 parent 7159f15 commit 12bc881

File tree

1 file changed

+182
-29
lines changed

1 file changed

+182
-29
lines changed

internal/service/datascience/datascience_models_data_source.go

Lines changed: 182 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@ package datascience
55

66
import (
77
"context"
8-
9-
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
108
oci_datascience "github.com/oracle/oci-go-sdk/v65/datascience"
9+
1110
"github.com/oracle/terraform-provider-oci/internal/client"
1211
"github.com/oracle/terraform-provider-oci/internal/tfresource"
12+
13+
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
1314
)
1415

1516
func DatascienceModelsDataSource() *schema.Resource {
@@ -21,14 +22,6 @@ func DatascienceModelsDataSource() *schema.Resource {
2122
Type: schema.TypeString,
2223
Required: true,
2324
},
24-
"model_version_set_name": {
25-
Type: schema.TypeString,
26-
Required: true,
27-
},
28-
"version_label": {
29-
Type: schema.TypeString,
30-
Required: true,
31-
},
3225
"created_by": {
3326
Type: schema.TypeString,
3427
Optional: true,
@@ -52,7 +45,185 @@ func DatascienceModelsDataSource() *schema.Resource {
5245
"models": {
5346
Type: schema.TypeList,
5447
Computed: true,
55-
Elem: tfresource.GetDataSourceItemSchema(DatascienceModelResource()),
48+
Elem: &schema.Resource{
49+
Schema: map[string]*schema.Schema{
50+
// Required
51+
"artifact_content_length": {
52+
Type: schema.TypeString,
53+
Required: true,
54+
ForceNew: true,
55+
ValidateFunc: tfresource.ValidateInt64TypeString,
56+
DiffSuppressFunc: tfresource.Int64StringDiffSuppressFunction,
57+
},
58+
"model_artifact": {
59+
Type: schema.TypeString,
60+
Required: true,
61+
ForceNew: true,
62+
},
63+
"compartment_id": {
64+
Type: schema.TypeString,
65+
Required: true,
66+
},
67+
"project_id": {
68+
Type: schema.TypeString,
69+
Required: true,
70+
ForceNew: true,
71+
},
72+
"model_version_set_id": {
73+
Type: schema.TypeString,
74+
Optional: true,
75+
Computed: true,
76+
},
77+
"model_version_set_name": {
78+
Type: schema.TypeString,
79+
Optional: true,
80+
Computed: true,
81+
},
82+
"version_id": {
83+
Type: schema.TypeString,
84+
Optional: true,
85+
Computed: true,
86+
},
87+
"version_label": {
88+
Type: schema.TypeString,
89+
Optional: true,
90+
Computed: true,
91+
},
92+
93+
// Optional
94+
"custom_metadata_list": {
95+
Type: schema.TypeList,
96+
Optional: true,
97+
Computed: true,
98+
Elem: &schema.Resource{
99+
Schema: map[string]*schema.Schema{
100+
// Required
101+
102+
// Optional
103+
"category": {
104+
Type: schema.TypeString,
105+
Optional: true,
106+
Computed: true,
107+
},
108+
"description": {
109+
Type: schema.TypeString,
110+
Optional: true,
111+
Computed: true,
112+
},
113+
"key": {
114+
Type: schema.TypeString,
115+
Optional: true,
116+
Computed: true,
117+
},
118+
"value": {
119+
Type: schema.TypeString,
120+
Optional: true,
121+
Computed: true,
122+
},
123+
124+
// Computed
125+
},
126+
},
127+
},
128+
"defined_metadata_list": {
129+
Type: schema.TypeList,
130+
Optional: true,
131+
Computed: true,
132+
Elem: &schema.Resource{
133+
Schema: map[string]*schema.Schema{
134+
// Required
135+
136+
// Optional
137+
"category": {
138+
Type: schema.TypeString,
139+
Optional: true,
140+
Computed: true,
141+
},
142+
"description": {
143+
Type: schema.TypeString,
144+
Optional: true,
145+
Computed: true,
146+
},
147+
"key": {
148+
Type: schema.TypeString,
149+
Optional: true,
150+
Computed: true,
151+
},
152+
"value": {
153+
Type: schema.TypeString,
154+
Optional: true,
155+
Computed: true,
156+
},
157+
158+
// Computed
159+
},
160+
},
161+
},
162+
"artifact_content_disposition": {
163+
Type: schema.TypeString,
164+
Optional: true,
165+
Computed: true,
166+
ForceNew: true,
167+
},
168+
"defined_tags": {
169+
Type: schema.TypeMap,
170+
Optional: true,
171+
Computed: true,
172+
DiffSuppressFunc: tfresource.DefinedTagsDiffSuppressFunction,
173+
Elem: schema.TypeString,
174+
},
175+
"description": {
176+
Type: schema.TypeString,
177+
Optional: true,
178+
Computed: true,
179+
},
180+
"display_name": {
181+
Type: schema.TypeString,
182+
Optional: true,
183+
Computed: true,
184+
},
185+
"freeform_tags": {
186+
Type: schema.TypeMap,
187+
Optional: true,
188+
Computed: true,
189+
Elem: schema.TypeString,
190+
},
191+
"input_schema": {
192+
Type: schema.TypeString,
193+
Optional: true,
194+
Computed: true,
195+
ForceNew: true,
196+
},
197+
"output_schema": {
198+
Type: schema.TypeString,
199+
Optional: true,
200+
Computed: true,
201+
ForceNew: true,
202+
},
203+
204+
// Computed
205+
"artifact_content_md5": {
206+
Type: schema.TypeString,
207+
Computed: true,
208+
},
209+
"artifact_last_modified": {
210+
Type: schema.TypeString,
211+
Computed: true,
212+
},
213+
"created_by": {
214+
Type: schema.TypeString,
215+
Computed: true,
216+
},
217+
"empty_model": {
218+
Type: schema.TypeBool,
219+
Computed: true,
220+
},
221+
"time_created": {
222+
Type: schema.TypeString,
223+
Computed: true,
224+
},
225+
},
226+
},
56227
},
57228
},
58229
}
@@ -94,16 +265,6 @@ func (s *DatascienceModelsDataSourceCrud) Get() error {
94265
request.DisplayName = &tmp
95266
}
96267

97-
if model_version_set_name, ok := s.D.GetOkExists("model_version_set_name"); ok {
98-
tmp := model_version_set_name.(string)
99-
request.ModelVersionSetName = &tmp
100-
}
101-
102-
if version_label, ok := s.D.GetOkExists("version_label"); ok {
103-
tmp := version_label.(string)
104-
request.VersionLabel = &tmp
105-
}
106-
107268
if id, ok := s.D.GetOkExists("id"); ok {
108269
tmp := id.(string)
109270
request.Id = &tmp
@@ -184,14 +345,6 @@ func (s *DatascienceModelsDataSourceCrud) SetData() error {
184345
model["project_id"] = *r.ProjectId
185346
}
186347

187-
if r.ModelVersionSetName != nil {
188-
model["model_version_set_name"] = *r.ModelVersionSetName
189-
}
190-
191-
if r.VersionLabel != nil {
192-
model["version_label"] = *r.VersionLabel
193-
}
194-
195348
model["state"] = r.LifecycleState
196349

197350
if r.TimeCreated != nil {

0 commit comments

Comments
 (0)