-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update to 1.45 and rename to quality monitors
- Loading branch information
1 parent
d7ae5e9
commit c240c31
Showing
30 changed files
with
873 additions
and
303 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package resources | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"github.com/databricks/cli/bundle/config/paths" | ||
"github.com/databricks/cli/libs/log" | ||
"github.com/databricks/databricks-sdk-go" | ||
"github.com/databricks/databricks-sdk-go/marshal" | ||
"github.com/databricks/databricks-sdk-go/service/catalog" | ||
) | ||
|
||
type QualityMonitor struct { | ||
// Represents the Input Arguments for Terraform and will get | ||
// converted to a HCL representation for CRUD | ||
*catalog.CreateMonitor | ||
|
||
// This represents the id which is the full name of the monitor | ||
// (catalog_name.schema_name.table_name) that can be used | ||
// as a reference in other resources. This value is returned by terraform. | ||
ID string `json:"id,omitempty" bundle:"readonly"` | ||
|
||
// Path to config file where the resource is defined. All bundle resources | ||
// include this for interpolation purposes. | ||
paths.Paths | ||
|
||
ModifiedStatus ModifiedStatus `json:"modified_status,omitempty" bundle:"internal"` | ||
} | ||
|
||
func (s *QualityMonitor) UnmarshalJSON(b []byte) error { | ||
return marshal.Unmarshal(b, s) | ||
} | ||
|
||
func (s QualityMonitor) MarshalJSON() ([]byte, error) { | ||
return marshal.Marshal(s) | ||
} | ||
|
||
func (s *QualityMonitor) Exists(ctx context.Context, w *databricks.WorkspaceClient, id string) (bool, error) { | ||
_, err := w.QualityMonitors.Get(ctx, catalog.GetQualityMonitorRequest{ | ||
TableName: id, | ||
}) | ||
if err != nil { | ||
log.Debugf(ctx, "registered model %s does not exist", id) | ||
return false, err | ||
} | ||
return true, nil | ||
} | ||
|
||
func (s *QualityMonitor) TerraformResourceName() string { | ||
return "databricks_quality_monitor" | ||
} | ||
|
||
func (s *QualityMonitor) Validate() error { | ||
if s == nil || !s.DynamicValue.IsValid() { | ||
return fmt.Errorf("registered model is not defined") | ||
} | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.