Skip to content

Commit

Permalink
Fix code after latest changes in the framework
Browse files Browse the repository at this point in the history
  • Loading branch information
alexott committed Oct 12, 2024
1 parent e19c8c8 commit 3eb939a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions docs/data-sources/registered_model.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ The following arguments are supported:

* `full_name` - (Required, String) The fully-qualified name of the registered model (`catalog_name.schema_name.name`).
* `include_aliases` - (Optional, Boolean) flag to specify if list of aliases should be included into output.
* `include_browse` - (Optional, Boolean) flag to specify if include registered models in the response for which the principal can only access selective metadata for.

## Attribute Reference

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ type RegisteredModelDataSource struct {
}

type RegisteredModelData struct {
FullName types.String `tfsdk:"full_name"`
IncludeAliases types.Bool `tfsdk:"include_aliases" tf:"optional"`
ModelInfo *catalog_tf.RegisteredModelInfo `tfsdk:"model_info" tf:"optional,computed"`
FullName types.String `tfsdk:"full_name"`
IncludeAliases types.Bool `tfsdk:"include_aliases" tf:"optional"`
IncludeBrowse types.Bool `tfsdk:"include_browse" tf:"optional"`
ModelInfo []catalog_tf.RegisteredModelInfo `tfsdk:"model_info" tf:"optional,computed"`
}

func (d *RegisteredModelDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) {
Expand Down Expand Up @@ -67,6 +68,7 @@ func (d *RegisteredModelDataSource) Read(ctx context.Context, req datasource.Rea
modelInfoSdk, err := w.RegisteredModels.Get(ctx, catalog.GetRegisteredModelRequest{
FullName: modelFullName,
IncludeAliases: registeredModel.IncludeAliases.ValueBool(),
IncludeBrowse: registeredModel.IncludeBrowse.ValueBool(),
})
if err != nil {
if apierr.IsMissing(err) {
Expand All @@ -83,6 +85,6 @@ func (d *RegisteredModelDataSource) Read(ctx context.Context, req datasource.Rea
if modelInfo.Aliases == nil {
modelInfo.Aliases = []catalog_tf.RegisteredModelAlias{}
}
registeredModel.ModelInfo = &modelInfo
registeredModel.ModelInfo = append(registeredModel.ModelInfo, modelInfo)
resp.Diagnostics.Append(resp.State.Set(ctx, registeredModel)...)
}

0 comments on commit 3eb939a

Please sign in to comment.