Skip to content

Commit

Permalink
Merge branch 'custom-marshaller-test' into custom-marshaller
Browse files Browse the repository at this point in the history
  • Loading branch information
hectorcast-db committed Oct 13, 2023
2 parents c0903b8 + 53f4e35 commit af8ffab
Show file tree
Hide file tree
Showing 25 changed files with 307 additions and 298 deletions.
2 changes: 1 addition & 1 deletion .codegen/_openapi_sha
Original file line number Diff line number Diff line change
@@ -1 +1 @@
bcbf6e851e3d82fd910940910dd31c10c059746c
493a76554afd3afdd15dc858773d01643f80352a
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ cmd/account/ip-access-lists/ip-access-lists.go linguist-generated=true
cmd/account/log-delivery/log-delivery.go linguist-generated=true
cmd/account/metastore-assignments/metastore-assignments.go linguist-generated=true
cmd/account/metastores/metastores.go linguist-generated=true
cmd/account/network-policy/network-policy.go linguist-generated=true
cmd/account/networks/networks.go linguist-generated=true
cmd/account/o-auth-enrollment/o-auth-enrollment.go linguist-generated=true
cmd/account/o-auth-published-apps/o-auth-published-apps.go linguist-generated=true
Expand Down
9 changes: 9 additions & 0 deletions bundle/config/resources/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package resources

import (
"github.com/databricks/cli/bundle/config/paths"
"github.com/databricks/databricks-sdk-go/marshal"
"github.com/databricks/databricks-sdk-go/service/jobs"
"github.com/imdario/mergo"
)
Expand All @@ -15,6 +16,14 @@ type Job struct {
*jobs.JobSettings
}

func (s *Job) UnmarshalJSON(b []byte) error {
return marshal.Unmarshal(b, s)
}

func (s Job) MarshalJSON() ([]byte, error) {
return marshal.Marshal(s)
}

// MergeJobClusters merges job clusters with the same key.
// The job clusters field is a slice, and as such, overrides are appended to it.
// We can identify a job cluster by its key, however, so we can use this key
Expand Down
9 changes: 9 additions & 0 deletions bundle/config/resources/mlflow_experiment.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package resources

import (
"github.com/databricks/cli/bundle/config/paths"
"github.com/databricks/databricks-sdk-go/marshal"
"github.com/databricks/databricks-sdk-go/service/ml"
)

Expand All @@ -12,3 +13,11 @@ type MlflowExperiment struct {

*ml.Experiment
}

func (s *MlflowExperiment) UnmarshalJSON(b []byte) error {
return marshal.Unmarshal(b, s)
}

func (s MlflowExperiment) MarshalJSON() ([]byte, error) {
return marshal.Marshal(s)
}
9 changes: 9 additions & 0 deletions bundle/config/resources/mlflow_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package resources

import (
"github.com/databricks/cli/bundle/config/paths"
"github.com/databricks/databricks-sdk-go/marshal"
"github.com/databricks/databricks-sdk-go/service/ml"
)

Expand All @@ -12,3 +13,11 @@ type MlflowModel struct {

*ml.Model
}

func (s *MlflowModel) UnmarshalJSON(b []byte) error {
return marshal.Unmarshal(b, s)
}

func (s MlflowModel) MarshalJSON() ([]byte, error) {
return marshal.Marshal(s)
}
9 changes: 9 additions & 0 deletions bundle/config/resources/model_serving_endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package resources

import (
"github.com/databricks/cli/bundle/config/paths"
"github.com/databricks/databricks-sdk-go/marshal"
"github.com/databricks/databricks-sdk-go/service/serving"
)

Expand All @@ -22,3 +23,11 @@ type ModelServingEndpoint struct {
// Implementation could be different based on the resource type.
Permissions []Permission `json:"permissions,omitempty"`
}

func (s *ModelServingEndpoint) UnmarshalJSON(b []byte) error {
return marshal.Unmarshal(b, s)
}

func (s ModelServingEndpoint) MarshalJSON() ([]byte, error) {
return marshal.Marshal(s)
}
9 changes: 9 additions & 0 deletions bundle/config/resources/pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"strings"

"github.com/databricks/cli/bundle/config/paths"
"github.com/databricks/databricks-sdk-go/marshal"
"github.com/databricks/databricks-sdk-go/service/pipelines"
"github.com/imdario/mergo"
)
Expand All @@ -17,6 +18,14 @@ type Pipeline struct {
*pipelines.PipelineSpec
}

func (s *Pipeline) UnmarshalJSON(b []byte) error {
return marshal.Unmarshal(b, s)
}

func (s Pipeline) MarshalJSON() ([]byte, error) {
return marshal.Marshal(s)
}

// MergeClusters merges cluster definitions with same label.
// The clusters field is a slice, and as such, overrides are appended to it.
// We can identify a cluster by its label, however, so we can use this label
Expand Down
9 changes: 9 additions & 0 deletions bundle/config/workspace.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/databricks/cli/libs/databrickscfg"
"github.com/databricks/databricks-sdk-go"
"github.com/databricks/databricks-sdk-go/config"
"github.com/databricks/databricks-sdk-go/marshal"
"github.com/databricks/databricks-sdk-go/service/iam"
)

Expand Down Expand Up @@ -69,6 +70,14 @@ type User struct {
*iam.User
}

func (s *User) UnmarshalJSON(b []byte) error {
return marshal.Unmarshal(b, s)
}

func (s User) MarshalJSON() ([]byte, error) {
return marshal.Marshal(s)
}

func (w *Workspace) Client() (*databricks.WorkspaceClient, error) {
cfg := databricks.Config{
// Generic
Expand Down
5 changes: 3 additions & 2 deletions cmd/account/billable-usage/billable-usage.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions cmd/account/cmd.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit af8ffab

Please sign in to comment.