diff --git a/.gitattributes b/.gitattributes index 40da8503e..41750e4f0 100644 --- a/.gitattributes +++ b/.gitattributes @@ -4,6 +4,7 @@ apierr/error_overrides.go linguist-generated=true error_alias.go linguist-generated=true experimental/mocks/mock_account_client.go linguist-generated=true experimental/mocks/mock_workspace_client.go linguist-generated=true +experimental/mocks/service/aibuilder/mock_ai_builder_interface.go linguist-generated=true experimental/mocks/service/aibuilder/mock_custom_llms_interface.go linguist-generated=true experimental/mocks/service/apps/mock_apps_interface.go linguist-generated=true experimental/mocks/service/billing/mock_billable_usage_interface.go linguist-generated=true @@ -81,6 +82,7 @@ experimental/mocks/service/marketplace/mock_provider_personalization_requests_in experimental/mocks/service/marketplace/mock_provider_provider_analytics_dashboards_interface.go linguist-generated=true experimental/mocks/service/marketplace/mock_provider_providers_interface.go linguist-generated=true experimental/mocks/service/ml/mock_experiments_interface.go linguist-generated=true +experimental/mocks/service/ml/mock_feature_store_interface.go linguist-generated=true experimental/mocks/service/ml/mock_forecasting_interface.go linguist-generated=true experimental/mocks/service/ml/mock_model_registry_interface.go linguist-generated=true experimental/mocks/service/oauth2/mock_account_federation_policy_interface.go linguist-generated=true @@ -163,117 +165,94 @@ experimental/mocks/service/workspace/mock_workspace_interface.go linguist-genera service/aibuilder/api.go linguist-generated=true service/aibuilder/impl.go linguist-generated=true service/aibuilder/interface.go linguist-generated=true -service/aibuilder/internal.go linguist-generated=true service/aibuilder/model.go linguist-generated=true service/apps/api.go linguist-generated=true service/apps/impl.go linguist-generated=true service/apps/interface.go linguist-generated=true -service/apps/internal.go linguist-generated=true service/apps/model.go linguist-generated=true service/billing/api.go linguist-generated=true service/billing/impl.go linguist-generated=true service/billing/interface.go linguist-generated=true -service/billing/internal.go linguist-generated=true service/billing/model.go linguist-generated=true service/catalog/api.go linguist-generated=true service/catalog/impl.go linguist-generated=true service/catalog/interface.go linguist-generated=true -service/catalog/internal.go linguist-generated=true service/catalog/model.go linguist-generated=true service/cleanrooms/api.go linguist-generated=true service/cleanrooms/impl.go linguist-generated=true service/cleanrooms/interface.go linguist-generated=true -service/cleanrooms/internal.go linguist-generated=true service/cleanrooms/model.go linguist-generated=true service/compute/api.go linguist-generated=true service/compute/impl.go linguist-generated=true service/compute/interface.go linguist-generated=true -service/compute/internal.go linguist-generated=true service/compute/model.go linguist-generated=true service/dashboards/api.go linguist-generated=true service/dashboards/impl.go linguist-generated=true service/dashboards/interface.go linguist-generated=true -service/dashboards/internal.go linguist-generated=true service/dashboards/model.go linguist-generated=true service/database/api.go linguist-generated=true service/database/impl.go linguist-generated=true service/database/interface.go linguist-generated=true -service/database/internal.go linguist-generated=true service/database/model.go linguist-generated=true service/files/api.go linguist-generated=true service/files/impl.go linguist-generated=true service/files/interface.go linguist-generated=true -service/files/internal.go linguist-generated=true service/files/model.go linguist-generated=true service/iam/api.go linguist-generated=true service/iam/impl.go linguist-generated=true service/iam/interface.go linguist-generated=true -service/iam/internal.go linguist-generated=true service/iam/model.go linguist-generated=true service/jobs/api.go linguist-generated=true service/jobs/impl.go linguist-generated=true service/jobs/interface.go linguist-generated=true -service/jobs/internal.go linguist-generated=true service/jobs/model.go linguist-generated=true service/marketplace/api.go linguist-generated=true service/marketplace/impl.go linguist-generated=true service/marketplace/interface.go linguist-generated=true -service/marketplace/internal.go linguist-generated=true service/marketplace/model.go linguist-generated=true service/ml/api.go linguist-generated=true service/ml/impl.go linguist-generated=true service/ml/interface.go linguist-generated=true -service/ml/internal.go linguist-generated=true service/ml/model.go linguist-generated=true service/oauth2/api.go linguist-generated=true service/oauth2/impl.go linguist-generated=true service/oauth2/interface.go linguist-generated=true -service/oauth2/internal.go linguist-generated=true service/oauth2/model.go linguist-generated=true service/pipelines/api.go linguist-generated=true service/pipelines/impl.go linguist-generated=true service/pipelines/interface.go linguist-generated=true -service/pipelines/internal.go linguist-generated=true service/pipelines/model.go linguist-generated=true service/pkg.go linguist-generated=true service/provisioning/api.go linguist-generated=true service/provisioning/impl.go linguist-generated=true service/provisioning/interface.go linguist-generated=true -service/provisioning/internal.go linguist-generated=true service/provisioning/model.go linguist-generated=true service/qualitymonitorv2/api.go linguist-generated=true service/qualitymonitorv2/impl.go linguist-generated=true service/qualitymonitorv2/interface.go linguist-generated=true -service/qualitymonitorv2/internal.go linguist-generated=true service/qualitymonitorv2/model.go linguist-generated=true service/serving/api.go linguist-generated=true service/serving/impl.go linguist-generated=true service/serving/interface.go linguist-generated=true -service/serving/internal.go linguist-generated=true service/serving/model.go linguist-generated=true service/settings/api.go linguist-generated=true service/settings/impl.go linguist-generated=true service/settings/interface.go linguist-generated=true -service/settings/internal.go linguist-generated=true service/settings/model.go linguist-generated=true service/sharing/api.go linguist-generated=true service/sharing/impl.go linguist-generated=true service/sharing/interface.go linguist-generated=true -service/sharing/internal.go linguist-generated=true service/sharing/model.go linguist-generated=true service/sql/api.go linguist-generated=true service/sql/impl.go linguist-generated=true service/sql/interface.go linguist-generated=true -service/sql/internal.go linguist-generated=true service/sql/model.go linguist-generated=true service/vectorsearch/api.go linguist-generated=true service/vectorsearch/impl.go linguist-generated=true service/vectorsearch/interface.go linguist-generated=true -service/vectorsearch/internal.go linguist-generated=true service/vectorsearch/model.go linguist-generated=true service/workspace/api.go linguist-generated=true service/workspace/impl.go linguist-generated=true service/workspace/interface.go linguist-generated=true -service/workspace/internal.go linguist-generated=true service/workspace/model.go linguist-generated=true workspace_client.go linguist-generated=true diff --git a/Makefile b/Makefile index 1c6ad5e42..616864a67 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ build: vendor fmt: @echo "✓ Formatting source code with goimports ..." - @go run golang.org/x/tools/cmd/goimports@0.34.0 -w $(shell find . -type f -name '*.go' -not -path "./vendor/*") + @go run golang.org/x/tools/cmd/goimports@v0.34.0 -w $(shell find . -type f -name '*.go' -not -path "./vendor/*") @echo "✓ Formatting source code with gofmt ..." @gofmt -w $(shell find . -type f -name '*.go' -not -path "./vendor/*") diff --git a/NEXT_CHANGELOG.md b/NEXT_CHANGELOG.md index cd81cd7c0..45677aa36 100644 --- a/NEXT_CHANGELOG.md +++ b/NEXT_CHANGELOG.md @@ -1,10 +1,12 @@ # NEXT CHANGELOG -## Release v0.74.0 +## Release v0.73.1 ### New Features and Improvements ### Bug Fixes +* Revert custom serialization which introduced a bug + impacting nested query paramters in v0.73.0 ### Documentation diff --git a/service/aibuilder/impl.go b/service/aibuilder/impl.go index 3187a2d50..ba644c86a 100755 --- a/service/aibuilder/impl.go +++ b/service/aibuilder/impl.go @@ -16,189 +16,65 @@ type aiBuilderImpl struct { } func (a *aiBuilderImpl) CancelOptimize(ctx context.Context, request CancelCustomLlmOptimizationRunRequest) error { - - requestPb, pbErr := cancelCustomLlmOptimizationRunRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var cancelOptimizeResponsePb cancelOptimizeResponsePb - path := fmt.Sprintf("/api/2.0/custom-llms/%v/optimize/cancel", requestPb.Id) + var cancelOptimizeResponse CancelOptimizeResponse + path := fmt.Sprintf("/api/2.0/custom-llms/%v/optimize/cancel", request.Id) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &cancelOptimizeResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &cancelOptimizeResponse) return err } func (a *aiBuilderImpl) CreateCustomLlm(ctx context.Context, request CreateCustomLlmRequest) (*CustomLlm, error) { - - requestPb, pbErr := createCustomLlmRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var customLlmPb customLlmPb + var customLlm CustomLlm path := "/api/2.0/custom-llms" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &customLlmPb, - ) - if err != nil { - return nil, err - } - resp, err := customLlmFromPb(&customLlmPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &customLlm) + return &customLlm, err } func (a *aiBuilderImpl) DeleteCustomLlm(ctx context.Context, request DeleteCustomLlmRequest) error { - - requestPb, pbErr := deleteCustomLlmRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteCustomLlmResponsePb deleteCustomLlmResponsePb - path := fmt.Sprintf("/api/2.0/custom-lms/%v", requestPb.Id) + var deleteCustomLlmResponse DeleteCustomLlmResponse + path := fmt.Sprintf("/api/2.0/custom-lms/%v", request.Id) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteCustomLlmResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteCustomLlmResponse) return err } func (a *aiBuilderImpl) GetCustomLlm(ctx context.Context, request GetCustomLlmRequest) (*CustomLlm, error) { - - requestPb, pbErr := getCustomLlmRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var customLlmPb customLlmPb - path := fmt.Sprintf("/api/2.0/custom-llms/%v", requestPb.Id) + var customLlm CustomLlm + path := fmt.Sprintf("/api/2.0/custom-llms/%v", request.Id) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &customLlmPb, - ) - if err != nil { - return nil, err - } - resp, err := customLlmFromPb(&customLlmPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &customLlm) + return &customLlm, err } func (a *aiBuilderImpl) StartOptimize(ctx context.Context, request StartCustomLlmOptimizationRunRequest) (*CustomLlm, error) { - - requestPb, pbErr := startCustomLlmOptimizationRunRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var customLlmPb customLlmPb - path := fmt.Sprintf("/api/2.0/custom-llms/%v/optimize", requestPb.Id) + var customLlm CustomLlm + path := fmt.Sprintf("/api/2.0/custom-llms/%v/optimize", request.Id) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &customLlmPb, - ) - if err != nil { - return nil, err - } - resp, err := customLlmFromPb(&customLlmPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &customLlm) + return &customLlm, err } func (a *aiBuilderImpl) UpdateCustomLlm(ctx context.Context, request UpdateCustomLlmRequest) (*CustomLlm, error) { - - requestPb, pbErr := updateCustomLlmRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var customLlmPb customLlmPb - path := fmt.Sprintf("/api/2.0/custom-llms/%v", requestPb.Id) + var customLlm CustomLlm + path := fmt.Sprintf("/api/2.0/custom-llms/%v", request.Id) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &customLlmPb, - ) - if err != nil { - return nil, err - } - resp, err := customLlmFromPb(&customLlmPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &customLlm) + return &customLlm, err } diff --git a/service/aibuilder/internal.go b/service/aibuilder/internal.go deleted file mode 100755 index 73d3da397..000000000 --- a/service/aibuilder/internal.go +++ /dev/null @@ -1,410 +0,0 @@ -// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. - -package aibuilder - -import ( - "fmt" - "strings" - "time" - - "github.com/databricks/databricks-sdk-go/marshal" -) - -func cancelCustomLlmOptimizationRunRequestToPb(st *CancelCustomLlmOptimizationRunRequest) (*cancelCustomLlmOptimizationRunRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &cancelCustomLlmOptimizationRunRequestPb{} - pb.Id = st.Id - - return pb, nil -} - -type cancelCustomLlmOptimizationRunRequestPb struct { - Id string `json:"-" url:"-"` -} - -func cancelCustomLlmOptimizationRunRequestFromPb(pb *cancelCustomLlmOptimizationRunRequestPb) (*CancelCustomLlmOptimizationRunRequest, error) { - if pb == nil { - return nil, nil - } - st := &CancelCustomLlmOptimizationRunRequest{} - st.Id = pb.Id - - return st, nil -} - -func cancelOptimizeResponseToPb(st *CancelOptimizeResponse) (*cancelOptimizeResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &cancelOptimizeResponsePb{} - - return pb, nil -} - -type cancelOptimizeResponsePb struct { -} - -func cancelOptimizeResponseFromPb(pb *cancelOptimizeResponsePb) (*CancelOptimizeResponse, error) { - if pb == nil { - return nil, nil - } - st := &CancelOptimizeResponse{} - - return st, nil -} - -func createCustomLlmRequestToPb(st *CreateCustomLlmRequest) (*createCustomLlmRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &createCustomLlmRequestPb{} - pb.AgentArtifactPath = st.AgentArtifactPath - pb.Datasets = st.Datasets - pb.Guidelines = st.Guidelines - pb.Instructions = st.Instructions - pb.Name = st.Name - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createCustomLlmRequestPb struct { - AgentArtifactPath string `json:"agent_artifact_path,omitempty"` - Datasets []Dataset `json:"datasets,omitempty"` - Guidelines []string `json:"guidelines,omitempty"` - Instructions string `json:"instructions"` - Name string `json:"name"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createCustomLlmRequestFromPb(pb *createCustomLlmRequestPb) (*CreateCustomLlmRequest, error) { - if pb == nil { - return nil, nil - } - st := &CreateCustomLlmRequest{} - st.AgentArtifactPath = pb.AgentArtifactPath - st.Datasets = pb.Datasets - st.Guidelines = pb.Guidelines - st.Instructions = pb.Instructions - st.Name = pb.Name - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createCustomLlmRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createCustomLlmRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func customLlmToPb(st *CustomLlm) (*customLlmPb, error) { - if st == nil { - return nil, nil - } - pb := &customLlmPb{} - pb.AgentArtifactPath = st.AgentArtifactPath - pb.CreationTime = st.CreationTime - pb.Creator = st.Creator - pb.Datasets = st.Datasets - pb.EndpointName = st.EndpointName - pb.Guidelines = st.Guidelines - pb.Id = st.Id - pb.Instructions = st.Instructions - pb.Name = st.Name - pb.OptimizationState = st.OptimizationState - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type customLlmPb struct { - AgentArtifactPath string `json:"agent_artifact_path,omitempty"` - CreationTime string `json:"creation_time,omitempty"` - Creator string `json:"creator,omitempty"` - Datasets []Dataset `json:"datasets,omitempty"` - EndpointName string `json:"endpoint_name,omitempty"` - Guidelines []string `json:"guidelines,omitempty"` - Id string `json:"id,omitempty"` - Instructions string `json:"instructions"` - Name string `json:"name"` - OptimizationState State `json:"optimization_state"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func customLlmFromPb(pb *customLlmPb) (*CustomLlm, error) { - if pb == nil { - return nil, nil - } - st := &CustomLlm{} - st.AgentArtifactPath = pb.AgentArtifactPath - st.CreationTime = pb.CreationTime - st.Creator = pb.Creator - st.Datasets = pb.Datasets - st.EndpointName = pb.EndpointName - st.Guidelines = pb.Guidelines - st.Id = pb.Id - st.Instructions = pb.Instructions - st.Name = pb.Name - st.OptimizationState = pb.OptimizationState - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *customLlmPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st customLlmPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func datasetToPb(st *Dataset) (*datasetPb, error) { - if st == nil { - return nil, nil - } - pb := &datasetPb{} - pb.Table = st.Table - - return pb, nil -} - -type datasetPb struct { - Table Table `json:"table"` -} - -func datasetFromPb(pb *datasetPb) (*Dataset, error) { - if pb == nil { - return nil, nil - } - st := &Dataset{} - st.Table = pb.Table - - return st, nil -} - -func deleteCustomLlmRequestToPb(st *DeleteCustomLlmRequest) (*deleteCustomLlmRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteCustomLlmRequestPb{} - pb.Id = st.Id - - return pb, nil -} - -type deleteCustomLlmRequestPb struct { - Id string `json:"-" url:"-"` -} - -func deleteCustomLlmRequestFromPb(pb *deleteCustomLlmRequestPb) (*DeleteCustomLlmRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteCustomLlmRequest{} - st.Id = pb.Id - - return st, nil -} - -func deleteCustomLlmResponseToPb(st *DeleteCustomLlmResponse) (*deleteCustomLlmResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteCustomLlmResponsePb{} - - return pb, nil -} - -type deleteCustomLlmResponsePb struct { -} - -func deleteCustomLlmResponseFromPb(pb *deleteCustomLlmResponsePb) (*DeleteCustomLlmResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteCustomLlmResponse{} - - return st, nil -} - -func getCustomLlmRequestToPb(st *GetCustomLlmRequest) (*getCustomLlmRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getCustomLlmRequestPb{} - pb.Id = st.Id - - return pb, nil -} - -type getCustomLlmRequestPb struct { - Id string `json:"-" url:"-"` -} - -func getCustomLlmRequestFromPb(pb *getCustomLlmRequestPb) (*GetCustomLlmRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetCustomLlmRequest{} - st.Id = pb.Id - - return st, nil -} - -func startCustomLlmOptimizationRunRequestToPb(st *StartCustomLlmOptimizationRunRequest) (*startCustomLlmOptimizationRunRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &startCustomLlmOptimizationRunRequestPb{} - pb.Id = st.Id - - return pb, nil -} - -type startCustomLlmOptimizationRunRequestPb struct { - Id string `json:"-" url:"-"` -} - -func startCustomLlmOptimizationRunRequestFromPb(pb *startCustomLlmOptimizationRunRequestPb) (*StartCustomLlmOptimizationRunRequest, error) { - if pb == nil { - return nil, nil - } - st := &StartCustomLlmOptimizationRunRequest{} - st.Id = pb.Id - - return st, nil -} - -func tableToPb(st *Table) (*tablePb, error) { - if st == nil { - return nil, nil - } - pb := &tablePb{} - pb.RequestCol = st.RequestCol - pb.ResponseCol = st.ResponseCol - pb.TablePath = st.TablePath - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type tablePb struct { - RequestCol string `json:"request_col"` - ResponseCol string `json:"response_col,omitempty"` - TablePath string `json:"table_path"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func tableFromPb(pb *tablePb) (*Table, error) { - if pb == nil { - return nil, nil - } - st := &Table{} - st.RequestCol = pb.RequestCol - st.ResponseCol = pb.ResponseCol - st.TablePath = pb.TablePath - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *tablePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st tablePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func updateCustomLlmRequestToPb(st *UpdateCustomLlmRequest) (*updateCustomLlmRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &updateCustomLlmRequestPb{} - pb.CustomLlm = st.CustomLlm - pb.Id = st.Id - pb.UpdateMask = st.UpdateMask - - return pb, nil -} - -type updateCustomLlmRequestPb struct { - CustomLlm CustomLlm `json:"custom_llm"` - Id string `json:"-" url:"-"` - UpdateMask string `json:"update_mask"` -} - -func updateCustomLlmRequestFromPb(pb *updateCustomLlmRequestPb) (*UpdateCustomLlmRequest, error) { - if pb == nil { - return nil, nil - } - st := &UpdateCustomLlmRequest{} - st.CustomLlm = pb.CustomLlm - st.Id = pb.Id - st.UpdateMask = pb.UpdateMask - - return st, nil -} - -func durationToPb(d *time.Duration) (*string, error) { - if d == nil { - return nil, nil - } - s := fmt.Sprintf("%.9fs", d.Seconds()) - return &s, nil -} - -func durationFromPb(s *string) (*time.Duration, error) { - if s == nil { - return nil, nil - } - d, err := time.ParseDuration(*s) - if err != nil { - return nil, err - } - return &d, nil -} - -func timestampToPb(t *time.Time) (*string, error) { - if t == nil { - return nil, nil - } - s := t.Format(time.RFC3339) - return &s, nil -} - -func timestampFromPb(s *string) (*time.Time, error) { - if s == nil { - return nil, nil - } - t, err := time.Parse(time.RFC3339, *s) - if err != nil { - return nil, err - } - return &t, nil -} - -func fieldMaskToPb(fm *[]string) (*string, error) { - if fm == nil { - return nil, nil - } - s := strings.Join(*fm, ",") - return &s, nil -} - -func fieldMaskFromPb(s *string) (*[]string, error) { - if s == nil { - return nil, nil - } - fm := strings.Split(*s, ",") - return &fm, nil -} diff --git a/service/aibuilder/model.go b/service/aibuilder/model.go index 98a553caf..c88ca98f2 100755 --- a/service/aibuilder/model.go +++ b/service/aibuilder/model.go @@ -3,324 +3,98 @@ package aibuilder import ( - "encoding/json" "fmt" + + "github.com/databricks/databricks-sdk-go/marshal" ) type CancelCustomLlmOptimizationRunRequest struct { - Id string `json:"-" tf:"-"` -} - -func (st *CancelCustomLlmOptimizationRunRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &cancelCustomLlmOptimizationRunRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := cancelCustomLlmOptimizationRunRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CancelCustomLlmOptimizationRunRequest) MarshalJSON() ([]byte, error) { - pb, err := cancelCustomLlmOptimizationRunRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Id string `json:"-" url:"-"` } type CancelOptimizeResponse struct { } -func (st *CancelOptimizeResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &cancelOptimizeResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := cancelOptimizeResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CancelOptimizeResponse) MarshalJSON() ([]byte, error) { - pb, err := cancelOptimizeResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type CreateCustomLlmRequest struct { // Optional: UC path for agent artifacts. If you are using a dataset that // you only have read permissions, please provide a destination path where // you have write permissions. Please provide this in catalog.schema format. - // Wire name: 'agent_artifact_path' AgentArtifactPath string `json:"agent_artifact_path,omitempty"` // Datasets used for training and evaluating the model, not for inference. // Currently, only 1 dataset is accepted. - // Wire name: 'datasets' Datasets []Dataset `json:"datasets,omitempty"` // Guidelines for the custom LLM to adhere to - // Wire name: 'guidelines' Guidelines []string `json:"guidelines,omitempty"` // Instructions for the custom LLM to follow - // Wire name: 'instructions' Instructions string `json:"instructions"` // Name of the custom LLM. Only alphanumeric characters and dashes allowed. - // Wire name: 'name' Name string `json:"name"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateCustomLlmRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createCustomLlmRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createCustomLlmRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateCustomLlmRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateCustomLlmRequest) MarshalJSON() ([]byte, error) { - pb, err := createCustomLlmRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateCustomLlmRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CustomLlm struct { - - // Wire name: 'agent_artifact_path' AgentArtifactPath string `json:"agent_artifact_path,omitempty"` // Creation timestamp of the custom LLM - // Wire name: 'creation_time' CreationTime string `json:"creation_time,omitempty"` // Creator of the custom LLM - // Wire name: 'creator' Creator string `json:"creator,omitempty"` // Datasets used for training and evaluating the model, not for inference - // Wire name: 'datasets' Datasets []Dataset `json:"datasets,omitempty"` // Name of the endpoint that will be used to serve the custom LLM - // Wire name: 'endpoint_name' EndpointName string `json:"endpoint_name,omitempty"` // Guidelines for the custom LLM to adhere to - // Wire name: 'guidelines' Guidelines []string `json:"guidelines,omitempty"` - // Wire name: 'id' Id string `json:"id,omitempty"` // Instructions for the custom LLM to follow - // Wire name: 'instructions' Instructions string `json:"instructions"` // Name of the custom LLM - // Wire name: 'name' Name string `json:"name"` // If optimization is kicked off, tracks the state of the custom LLM - // Wire name: 'optimization_state' OptimizationState State `json:"optimization_state"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CustomLlm) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &customLlmPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := customLlmFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CustomLlm) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CustomLlm) MarshalJSON() ([]byte, error) { - pb, err := customLlmToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CustomLlm) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type Dataset struct { - - // Wire name: 'table' Table Table `json:"table"` } -func (st *Dataset) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &datasetPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := datasetFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st Dataset) MarshalJSON() ([]byte, error) { - pb, err := datasetToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Delete a Custom LLM type DeleteCustomLlmRequest struct { // The id of the custom llm - Id string `json:"-" tf:"-"` -} - -func (st *DeleteCustomLlmRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteCustomLlmRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteCustomLlmRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteCustomLlmRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteCustomLlmRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Id string `json:"-" url:"-"` } type DeleteCustomLlmResponse struct { } -func (st *DeleteCustomLlmResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteCustomLlmResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteCustomLlmResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteCustomLlmResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteCustomLlmResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Get a Custom LLM type GetCustomLlmRequest struct { // The id of the custom llm - Id string `json:"-" tf:"-"` -} - -func (st *GetCustomLlmRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getCustomLlmRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getCustomLlmRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetCustomLlmRequest) MarshalJSON() ([]byte, error) { - pb, err := getCustomLlmRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Id string `json:"-" url:"-"` } type StartCustomLlmOptimizationRunRequest struct { // The Id of the tile. - Id string `json:"-" tf:"-"` -} - -func (st *StartCustomLlmOptimizationRunRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &startCustomLlmOptimizationRunRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := startCustomLlmOptimizationRunRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st StartCustomLlmOptimizationRunRequest) MarshalJSON() ([]byte, error) { - pb, err := startCustomLlmOptimizationRunRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Id string `json:"-" url:"-"` } // States of Custom LLM optimization lifecycle. @@ -375,49 +149,28 @@ func (f *State) Type() string { type Table struct { // Name of the request column - // Wire name: 'request_col' RequestCol string `json:"request_col"` // Optional: Name of the response column if the data is labeled - // Wire name: 'response_col' ResponseCol string `json:"response_col,omitempty"` // Full UC table path in catalog.schema.table_name format - // Wire name: 'table_path' TablePath string `json:"table_path"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *Table) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &tablePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := tableFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *Table) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st Table) MarshalJSON() ([]byte, error) { - pb, err := tableToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s Table) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type UpdateCustomLlmRequest struct { // The CustomLlm containing the fields which should be updated. - // Wire name: 'custom_llm' CustomLlm CustomLlm `json:"custom_llm"` // The id of the custom llm - Id string `json:"-" tf:"-"` + Id string `json:"-" url:"-"` // The list of the CustomLlm fields to update. These should correspond to // the values (or lack thereof) present in `custom_llm`. // @@ -432,31 +185,5 @@ type UpdateCustomLlmRequest struct { // always explicitly list the fields being updated and avoid using `*` // wildcards, as it can lead to unintended results if the API changes in the // future. - // Wire name: 'update_mask' UpdateMask string `json:"update_mask"` } - -func (st *UpdateCustomLlmRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateCustomLlmRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateCustomLlmRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateCustomLlmRequest) MarshalJSON() ([]byte, error) { - pb, err := updateCustomLlmRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} diff --git a/service/apps/impl.go b/service/apps/impl.go index b121b2644..a2f7de3d1 100755 --- a/service/apps/impl.go +++ b/service/apps/impl.go @@ -19,232 +19,78 @@ type appsImpl struct { } func (a *appsImpl) Create(ctx context.Context, request CreateAppRequest) (*App, error) { - - requestPb, pbErr := createAppRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var appPb appPb + var app App path := "/api/2.0/apps" queryParams := make(map[string]any) - if requestPb.NoCompute != false || slices.Contains(requestPb.ForceSendFields, "NoCompute") { - queryParams["no_compute"] = requestPb.NoCompute + if request.NoCompute != false || slices.Contains(request.ForceSendFields, "NoCompute") { + queryParams["no_compute"] = request.NoCompute } headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb).App, - &appPb, - ) - if err != nil { - return nil, err - } - resp, err := appFromPb(&appPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.App, &app) + return &app, err } func (a *appsImpl) Delete(ctx context.Context, request DeleteAppRequest) (*App, error) { - - requestPb, pbErr := deleteAppRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var appPb appPb - path := fmt.Sprintf("/api/2.0/apps/%v", requestPb.Name) + var app App + path := fmt.Sprintf("/api/2.0/apps/%v", request.Name) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &appPb, - ) - if err != nil { - return nil, err - } - resp, err := appFromPb(&appPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &app) + return &app, err } func (a *appsImpl) Deploy(ctx context.Context, request CreateAppDeploymentRequest) (*AppDeployment, error) { - - requestPb, pbErr := createAppDeploymentRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var appDeploymentPb appDeploymentPb - path := fmt.Sprintf("/api/2.0/apps/%v/deployments", requestPb.AppName) + var appDeployment AppDeployment + path := fmt.Sprintf("/api/2.0/apps/%v/deployments", request.AppName) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb).AppDeployment, - &appDeploymentPb, - ) - if err != nil { - return nil, err - } - resp, err := appDeploymentFromPb(&appDeploymentPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.AppDeployment, &appDeployment) + return &appDeployment, err } func (a *appsImpl) Get(ctx context.Context, request GetAppRequest) (*App, error) { - - requestPb, pbErr := getAppRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var appPb appPb - path := fmt.Sprintf("/api/2.0/apps/%v", requestPb.Name) + var app App + path := fmt.Sprintf("/api/2.0/apps/%v", request.Name) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &appPb, - ) - if err != nil { - return nil, err - } - resp, err := appFromPb(&appPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &app) + return &app, err } func (a *appsImpl) GetDeployment(ctx context.Context, request GetAppDeploymentRequest) (*AppDeployment, error) { - - requestPb, pbErr := getAppDeploymentRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var appDeploymentPb appDeploymentPb - path := fmt.Sprintf("/api/2.0/apps/%v/deployments/%v", requestPb.AppName, requestPb.DeploymentId) + var appDeployment AppDeployment + path := fmt.Sprintf("/api/2.0/apps/%v/deployments/%v", request.AppName, request.DeploymentId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &appDeploymentPb, - ) - if err != nil { - return nil, err - } - resp, err := appDeploymentFromPb(&appDeploymentPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &appDeployment) + return &appDeployment, err } func (a *appsImpl) GetPermissionLevels(ctx context.Context, request GetAppPermissionLevelsRequest) (*GetAppPermissionLevelsResponse, error) { - - requestPb, pbErr := getAppPermissionLevelsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var getAppPermissionLevelsResponsePb getAppPermissionLevelsResponsePb - path := fmt.Sprintf("/api/2.0/permissions/apps/%v/permissionLevels", requestPb.AppName) + var getAppPermissionLevelsResponse GetAppPermissionLevelsResponse + path := fmt.Sprintf("/api/2.0/permissions/apps/%v/permissionLevels", request.AppName) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &getAppPermissionLevelsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := getAppPermissionLevelsResponseFromPb(&getAppPermissionLevelsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getAppPermissionLevelsResponse) + return &getAppPermissionLevelsResponse, err } func (a *appsImpl) GetPermissions(ctx context.Context, request GetAppPermissionsRequest) (*AppPermissions, error) { - - requestPb, pbErr := getAppPermissionsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var appPermissionsPb appPermissionsPb - path := fmt.Sprintf("/api/2.0/permissions/apps/%v", requestPb.AppName) + var appPermissions AppPermissions + path := fmt.Sprintf("/api/2.0/permissions/apps/%v", request.AppName) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &appPermissionsPb, - ) - if err != nil { - return nil, err - } - resp, err := appPermissionsFromPb(&appPermissionsPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &appPermissions) + return &appPermissions, err } // Lists all apps in the workspace. @@ -279,35 +125,13 @@ func (a *appsImpl) ListAll(ctx context.Context, request ListAppsRequest) ([]App, } func (a *appsImpl) internalList(ctx context.Context, request ListAppsRequest) (*ListAppsResponse, error) { - - requestPb, pbErr := listAppsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listAppsResponsePb listAppsResponsePb + var listAppsResponse ListAppsResponse path := "/api/2.0/apps" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listAppsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listAppsResponseFromPb(&listAppsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listAppsResponse) + return &listAppsResponse, err } // Lists all app deployments for the app with the supplied name. @@ -342,198 +166,66 @@ func (a *appsImpl) ListDeploymentsAll(ctx context.Context, request ListAppDeploy } func (a *appsImpl) internalListDeployments(ctx context.Context, request ListAppDeploymentsRequest) (*ListAppDeploymentsResponse, error) { - - requestPb, pbErr := listAppDeploymentsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listAppDeploymentsResponsePb listAppDeploymentsResponsePb - path := fmt.Sprintf("/api/2.0/apps/%v/deployments", requestPb.AppName) + var listAppDeploymentsResponse ListAppDeploymentsResponse + path := fmt.Sprintf("/api/2.0/apps/%v/deployments", request.AppName) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listAppDeploymentsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listAppDeploymentsResponseFromPb(&listAppDeploymentsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listAppDeploymentsResponse) + return &listAppDeploymentsResponse, err } func (a *appsImpl) SetPermissions(ctx context.Context, request AppPermissionsRequest) (*AppPermissions, error) { - - requestPb, pbErr := appPermissionsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var appPermissionsPb appPermissionsPb - path := fmt.Sprintf("/api/2.0/permissions/apps/%v", requestPb.AppName) + var appPermissions AppPermissions + path := fmt.Sprintf("/api/2.0/permissions/apps/%v", request.AppName) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPut, - path, - headers, - queryParams, - (*requestPb), - &appPermissionsPb, - ) - if err != nil { - return nil, err - } - resp, err := appPermissionsFromPb(&appPermissionsPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &appPermissions) + return &appPermissions, err } func (a *appsImpl) Start(ctx context.Context, request StartAppRequest) (*App, error) { - - requestPb, pbErr := startAppRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var appPb appPb - path := fmt.Sprintf("/api/2.0/apps/%v/start", requestPb.Name) + var app App + path := fmt.Sprintf("/api/2.0/apps/%v/start", request.Name) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &appPb, - ) - if err != nil { - return nil, err - } - resp, err := appFromPb(&appPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &app) + return &app, err } func (a *appsImpl) Stop(ctx context.Context, request StopAppRequest) (*App, error) { - - requestPb, pbErr := stopAppRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var appPb appPb - path := fmt.Sprintf("/api/2.0/apps/%v/stop", requestPb.Name) + var app App + path := fmt.Sprintf("/api/2.0/apps/%v/stop", request.Name) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &appPb, - ) - if err != nil { - return nil, err - } - resp, err := appFromPb(&appPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &app) + return &app, err } func (a *appsImpl) Update(ctx context.Context, request UpdateAppRequest) (*App, error) { - - requestPb, pbErr := updateAppRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var appPb appPb - path := fmt.Sprintf("/api/2.0/apps/%v", requestPb.Name) + var app App + path := fmt.Sprintf("/api/2.0/apps/%v", request.Name) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb).App, - &appPb, - ) - if err != nil { - return nil, err - } - resp, err := appFromPb(&appPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.App, &app) + return &app, err } func (a *appsImpl) UpdatePermissions(ctx context.Context, request AppPermissionsRequest) (*AppPermissions, error) { - - requestPb, pbErr := appPermissionsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var appPermissionsPb appPermissionsPb - path := fmt.Sprintf("/api/2.0/permissions/apps/%v", requestPb.AppName) + var appPermissions AppPermissions + path := fmt.Sprintf("/api/2.0/permissions/apps/%v", request.AppName) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &appPermissionsPb, - ) - if err != nil { - return nil, err - } - resp, err := appPermissionsFromPb(&appPermissionsPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &appPermissions) + return &appPermissions, err } diff --git a/service/apps/internal.go b/service/apps/internal.go deleted file mode 100755 index 4fbfd7cec..000000000 --- a/service/apps/internal.go +++ /dev/null @@ -1,1262 +0,0 @@ -// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. - -package apps - -import ( - "fmt" - "strings" - "time" - - "github.com/databricks/databricks-sdk-go/marshal" -) - -func appToPb(st *App) (*appPb, error) { - if st == nil { - return nil, nil - } - pb := &appPb{} - pb.ActiveDeployment = st.ActiveDeployment - pb.AppStatus = st.AppStatus - pb.BudgetPolicyId = st.BudgetPolicyId - pb.ComputeStatus = st.ComputeStatus - pb.CreateTime = st.CreateTime - pb.Creator = st.Creator - pb.DefaultSourceCodePath = st.DefaultSourceCodePath - pb.Description = st.Description - pb.EffectiveBudgetPolicyId = st.EffectiveBudgetPolicyId - pb.EffectiveUserApiScopes = st.EffectiveUserApiScopes - pb.Id = st.Id - pb.Name = st.Name - pb.Oauth2AppClientId = st.Oauth2AppClientId - pb.Oauth2AppIntegrationId = st.Oauth2AppIntegrationId - pb.PendingDeployment = st.PendingDeployment - pb.Resources = st.Resources - pb.ServicePrincipalClientId = st.ServicePrincipalClientId - pb.ServicePrincipalId = st.ServicePrincipalId - pb.ServicePrincipalName = st.ServicePrincipalName - pb.UpdateTime = st.UpdateTime - pb.Updater = st.Updater - pb.Url = st.Url - pb.UserApiScopes = st.UserApiScopes - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type appPb struct { - ActiveDeployment *AppDeployment `json:"active_deployment,omitempty"` - AppStatus *ApplicationStatus `json:"app_status,omitempty"` - BudgetPolicyId string `json:"budget_policy_id,omitempty"` - ComputeStatus *ComputeStatus `json:"compute_status,omitempty"` - CreateTime string `json:"create_time,omitempty"` - Creator string `json:"creator,omitempty"` - DefaultSourceCodePath string `json:"default_source_code_path,omitempty"` - Description string `json:"description,omitempty"` - EffectiveBudgetPolicyId string `json:"effective_budget_policy_id,omitempty"` - EffectiveUserApiScopes []string `json:"effective_user_api_scopes,omitempty"` - Id string `json:"id,omitempty"` - Name string `json:"name"` - Oauth2AppClientId string `json:"oauth2_app_client_id,omitempty"` - Oauth2AppIntegrationId string `json:"oauth2_app_integration_id,omitempty"` - PendingDeployment *AppDeployment `json:"pending_deployment,omitempty"` - Resources []AppResource `json:"resources,omitempty"` - ServicePrincipalClientId string `json:"service_principal_client_id,omitempty"` - ServicePrincipalId int64 `json:"service_principal_id,omitempty"` - ServicePrincipalName string `json:"service_principal_name,omitempty"` - UpdateTime string `json:"update_time,omitempty"` - Updater string `json:"updater,omitempty"` - Url string `json:"url,omitempty"` - UserApiScopes []string `json:"user_api_scopes,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func appFromPb(pb *appPb) (*App, error) { - if pb == nil { - return nil, nil - } - st := &App{} - st.ActiveDeployment = pb.ActiveDeployment - st.AppStatus = pb.AppStatus - st.BudgetPolicyId = pb.BudgetPolicyId - st.ComputeStatus = pb.ComputeStatus - st.CreateTime = pb.CreateTime - st.Creator = pb.Creator - st.DefaultSourceCodePath = pb.DefaultSourceCodePath - st.Description = pb.Description - st.EffectiveBudgetPolicyId = pb.EffectiveBudgetPolicyId - st.EffectiveUserApiScopes = pb.EffectiveUserApiScopes - st.Id = pb.Id - st.Name = pb.Name - st.Oauth2AppClientId = pb.Oauth2AppClientId - st.Oauth2AppIntegrationId = pb.Oauth2AppIntegrationId - st.PendingDeployment = pb.PendingDeployment - st.Resources = pb.Resources - st.ServicePrincipalClientId = pb.ServicePrincipalClientId - st.ServicePrincipalId = pb.ServicePrincipalId - st.ServicePrincipalName = pb.ServicePrincipalName - st.UpdateTime = pb.UpdateTime - st.Updater = pb.Updater - st.Url = pb.Url - st.UserApiScopes = pb.UserApiScopes - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *appPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st appPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func appAccessControlRequestToPb(st *AppAccessControlRequest) (*appAccessControlRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &appAccessControlRequestPb{} - pb.GroupName = st.GroupName - pb.PermissionLevel = st.PermissionLevel - pb.ServicePrincipalName = st.ServicePrincipalName - pb.UserName = st.UserName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type appAccessControlRequestPb struct { - GroupName string `json:"group_name,omitempty"` - PermissionLevel AppPermissionLevel `json:"permission_level,omitempty"` - ServicePrincipalName string `json:"service_principal_name,omitempty"` - UserName string `json:"user_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func appAccessControlRequestFromPb(pb *appAccessControlRequestPb) (*AppAccessControlRequest, error) { - if pb == nil { - return nil, nil - } - st := &AppAccessControlRequest{} - st.GroupName = pb.GroupName - st.PermissionLevel = pb.PermissionLevel - st.ServicePrincipalName = pb.ServicePrincipalName - st.UserName = pb.UserName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *appAccessControlRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st appAccessControlRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func appAccessControlResponseToPb(st *AppAccessControlResponse) (*appAccessControlResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &appAccessControlResponsePb{} - pb.AllPermissions = st.AllPermissions - pb.DisplayName = st.DisplayName - pb.GroupName = st.GroupName - pb.ServicePrincipalName = st.ServicePrincipalName - pb.UserName = st.UserName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type appAccessControlResponsePb struct { - AllPermissions []AppPermission `json:"all_permissions,omitempty"` - DisplayName string `json:"display_name,omitempty"` - GroupName string `json:"group_name,omitempty"` - ServicePrincipalName string `json:"service_principal_name,omitempty"` - UserName string `json:"user_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func appAccessControlResponseFromPb(pb *appAccessControlResponsePb) (*AppAccessControlResponse, error) { - if pb == nil { - return nil, nil - } - st := &AppAccessControlResponse{} - st.AllPermissions = pb.AllPermissions - st.DisplayName = pb.DisplayName - st.GroupName = pb.GroupName - st.ServicePrincipalName = pb.ServicePrincipalName - st.UserName = pb.UserName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *appAccessControlResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st appAccessControlResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func appDeploymentToPb(st *AppDeployment) (*appDeploymentPb, error) { - if st == nil { - return nil, nil - } - pb := &appDeploymentPb{} - pb.CreateTime = st.CreateTime - pb.Creator = st.Creator - pb.DeploymentArtifacts = st.DeploymentArtifacts - pb.DeploymentId = st.DeploymentId - pb.Mode = st.Mode - pb.SourceCodePath = st.SourceCodePath - pb.Status = st.Status - pb.UpdateTime = st.UpdateTime - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type appDeploymentPb struct { - CreateTime string `json:"create_time,omitempty"` - Creator string `json:"creator,omitempty"` - DeploymentArtifacts *AppDeploymentArtifacts `json:"deployment_artifacts,omitempty"` - DeploymentId string `json:"deployment_id,omitempty"` - Mode AppDeploymentMode `json:"mode,omitempty"` - SourceCodePath string `json:"source_code_path,omitempty"` - Status *AppDeploymentStatus `json:"status,omitempty"` - UpdateTime string `json:"update_time,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func appDeploymentFromPb(pb *appDeploymentPb) (*AppDeployment, error) { - if pb == nil { - return nil, nil - } - st := &AppDeployment{} - st.CreateTime = pb.CreateTime - st.Creator = pb.Creator - st.DeploymentArtifacts = pb.DeploymentArtifacts - st.DeploymentId = pb.DeploymentId - st.Mode = pb.Mode - st.SourceCodePath = pb.SourceCodePath - st.Status = pb.Status - st.UpdateTime = pb.UpdateTime - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *appDeploymentPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st appDeploymentPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func appDeploymentArtifactsToPb(st *AppDeploymentArtifacts) (*appDeploymentArtifactsPb, error) { - if st == nil { - return nil, nil - } - pb := &appDeploymentArtifactsPb{} - pb.SourceCodePath = st.SourceCodePath - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type appDeploymentArtifactsPb struct { - SourceCodePath string `json:"source_code_path,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func appDeploymentArtifactsFromPb(pb *appDeploymentArtifactsPb) (*AppDeploymentArtifacts, error) { - if pb == nil { - return nil, nil - } - st := &AppDeploymentArtifacts{} - st.SourceCodePath = pb.SourceCodePath - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *appDeploymentArtifactsPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st appDeploymentArtifactsPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func appDeploymentStatusToPb(st *AppDeploymentStatus) (*appDeploymentStatusPb, error) { - if st == nil { - return nil, nil - } - pb := &appDeploymentStatusPb{} - pb.Message = st.Message - pb.State = st.State - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type appDeploymentStatusPb struct { - Message string `json:"message,omitempty"` - State AppDeploymentState `json:"state,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func appDeploymentStatusFromPb(pb *appDeploymentStatusPb) (*AppDeploymentStatus, error) { - if pb == nil { - return nil, nil - } - st := &AppDeploymentStatus{} - st.Message = pb.Message - st.State = pb.State - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *appDeploymentStatusPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st appDeploymentStatusPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func appPermissionToPb(st *AppPermission) (*appPermissionPb, error) { - if st == nil { - return nil, nil - } - pb := &appPermissionPb{} - pb.Inherited = st.Inherited - pb.InheritedFromObject = st.InheritedFromObject - pb.PermissionLevel = st.PermissionLevel - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type appPermissionPb struct { - Inherited bool `json:"inherited,omitempty"` - InheritedFromObject []string `json:"inherited_from_object,omitempty"` - PermissionLevel AppPermissionLevel `json:"permission_level,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func appPermissionFromPb(pb *appPermissionPb) (*AppPermission, error) { - if pb == nil { - return nil, nil - } - st := &AppPermission{} - st.Inherited = pb.Inherited - st.InheritedFromObject = pb.InheritedFromObject - st.PermissionLevel = pb.PermissionLevel - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *appPermissionPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st appPermissionPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func appPermissionsToPb(st *AppPermissions) (*appPermissionsPb, error) { - if st == nil { - return nil, nil - } - pb := &appPermissionsPb{} - pb.AccessControlList = st.AccessControlList - pb.ObjectId = st.ObjectId - pb.ObjectType = st.ObjectType - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type appPermissionsPb struct { - AccessControlList []AppAccessControlResponse `json:"access_control_list,omitempty"` - ObjectId string `json:"object_id,omitempty"` - ObjectType string `json:"object_type,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func appPermissionsFromPb(pb *appPermissionsPb) (*AppPermissions, error) { - if pb == nil { - return nil, nil - } - st := &AppPermissions{} - st.AccessControlList = pb.AccessControlList - st.ObjectId = pb.ObjectId - st.ObjectType = pb.ObjectType - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *appPermissionsPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st appPermissionsPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func appPermissionsDescriptionToPb(st *AppPermissionsDescription) (*appPermissionsDescriptionPb, error) { - if st == nil { - return nil, nil - } - pb := &appPermissionsDescriptionPb{} - pb.Description = st.Description - pb.PermissionLevel = st.PermissionLevel - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type appPermissionsDescriptionPb struct { - Description string `json:"description,omitempty"` - PermissionLevel AppPermissionLevel `json:"permission_level,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func appPermissionsDescriptionFromPb(pb *appPermissionsDescriptionPb) (*AppPermissionsDescription, error) { - if pb == nil { - return nil, nil - } - st := &AppPermissionsDescription{} - st.Description = pb.Description - st.PermissionLevel = pb.PermissionLevel - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *appPermissionsDescriptionPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st appPermissionsDescriptionPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func appPermissionsRequestToPb(st *AppPermissionsRequest) (*appPermissionsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &appPermissionsRequestPb{} - pb.AccessControlList = st.AccessControlList - pb.AppName = st.AppName - - return pb, nil -} - -type appPermissionsRequestPb struct { - AccessControlList []AppAccessControlRequest `json:"access_control_list,omitempty"` - AppName string `json:"-" url:"-"` -} - -func appPermissionsRequestFromPb(pb *appPermissionsRequestPb) (*AppPermissionsRequest, error) { - if pb == nil { - return nil, nil - } - st := &AppPermissionsRequest{} - st.AccessControlList = pb.AccessControlList - st.AppName = pb.AppName - - return st, nil -} - -func appResourceToPb(st *AppResource) (*appResourcePb, error) { - if st == nil { - return nil, nil - } - pb := &appResourcePb{} - pb.Description = st.Description - pb.Job = st.Job - pb.Name = st.Name - pb.Secret = st.Secret - pb.ServingEndpoint = st.ServingEndpoint - pb.SqlWarehouse = st.SqlWarehouse - pb.UcSecurable = st.UcSecurable - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type appResourcePb struct { - Description string `json:"description,omitempty"` - Job *AppResourceJob `json:"job,omitempty"` - Name string `json:"name"` - Secret *AppResourceSecret `json:"secret,omitempty"` - ServingEndpoint *AppResourceServingEndpoint `json:"serving_endpoint,omitempty"` - SqlWarehouse *AppResourceSqlWarehouse `json:"sql_warehouse,omitempty"` - UcSecurable *AppResourceUcSecurable `json:"uc_securable,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func appResourceFromPb(pb *appResourcePb) (*AppResource, error) { - if pb == nil { - return nil, nil - } - st := &AppResource{} - st.Description = pb.Description - st.Job = pb.Job - st.Name = pb.Name - st.Secret = pb.Secret - st.ServingEndpoint = pb.ServingEndpoint - st.SqlWarehouse = pb.SqlWarehouse - st.UcSecurable = pb.UcSecurable - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *appResourcePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st appResourcePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func appResourceJobToPb(st *AppResourceJob) (*appResourceJobPb, error) { - if st == nil { - return nil, nil - } - pb := &appResourceJobPb{} - pb.Id = st.Id - pb.Permission = st.Permission - - return pb, nil -} - -type appResourceJobPb struct { - Id string `json:"id"` - Permission AppResourceJobJobPermission `json:"permission"` -} - -func appResourceJobFromPb(pb *appResourceJobPb) (*AppResourceJob, error) { - if pb == nil { - return nil, nil - } - st := &AppResourceJob{} - st.Id = pb.Id - st.Permission = pb.Permission - - return st, nil -} - -func appResourceSecretToPb(st *AppResourceSecret) (*appResourceSecretPb, error) { - if st == nil { - return nil, nil - } - pb := &appResourceSecretPb{} - pb.Key = st.Key - pb.Permission = st.Permission - pb.Scope = st.Scope - - return pb, nil -} - -type appResourceSecretPb struct { - Key string `json:"key"` - Permission AppResourceSecretSecretPermission `json:"permission"` - Scope string `json:"scope"` -} - -func appResourceSecretFromPb(pb *appResourceSecretPb) (*AppResourceSecret, error) { - if pb == nil { - return nil, nil - } - st := &AppResourceSecret{} - st.Key = pb.Key - st.Permission = pb.Permission - st.Scope = pb.Scope - - return st, nil -} - -func appResourceServingEndpointToPb(st *AppResourceServingEndpoint) (*appResourceServingEndpointPb, error) { - if st == nil { - return nil, nil - } - pb := &appResourceServingEndpointPb{} - pb.Name = st.Name - pb.Permission = st.Permission - - return pb, nil -} - -type appResourceServingEndpointPb struct { - Name string `json:"name"` - Permission AppResourceServingEndpointServingEndpointPermission `json:"permission"` -} - -func appResourceServingEndpointFromPb(pb *appResourceServingEndpointPb) (*AppResourceServingEndpoint, error) { - if pb == nil { - return nil, nil - } - st := &AppResourceServingEndpoint{} - st.Name = pb.Name - st.Permission = pb.Permission - - return st, nil -} - -func appResourceSqlWarehouseToPb(st *AppResourceSqlWarehouse) (*appResourceSqlWarehousePb, error) { - if st == nil { - return nil, nil - } - pb := &appResourceSqlWarehousePb{} - pb.Id = st.Id - pb.Permission = st.Permission - - return pb, nil -} - -type appResourceSqlWarehousePb struct { - Id string `json:"id"` - Permission AppResourceSqlWarehouseSqlWarehousePermission `json:"permission"` -} - -func appResourceSqlWarehouseFromPb(pb *appResourceSqlWarehousePb) (*AppResourceSqlWarehouse, error) { - if pb == nil { - return nil, nil - } - st := &AppResourceSqlWarehouse{} - st.Id = pb.Id - st.Permission = pb.Permission - - return st, nil -} - -func appResourceUcSecurableToPb(st *AppResourceUcSecurable) (*appResourceUcSecurablePb, error) { - if st == nil { - return nil, nil - } - pb := &appResourceUcSecurablePb{} - pb.Permission = st.Permission - pb.SecurableFullName = st.SecurableFullName - pb.SecurableType = st.SecurableType - - return pb, nil -} - -type appResourceUcSecurablePb struct { - Permission AppResourceUcSecurableUcSecurablePermission `json:"permission"` - SecurableFullName string `json:"securable_full_name"` - SecurableType AppResourceUcSecurableUcSecurableType `json:"securable_type"` -} - -func appResourceUcSecurableFromPb(pb *appResourceUcSecurablePb) (*AppResourceUcSecurable, error) { - if pb == nil { - return nil, nil - } - st := &AppResourceUcSecurable{} - st.Permission = pb.Permission - st.SecurableFullName = pb.SecurableFullName - st.SecurableType = pb.SecurableType - - return st, nil -} - -func applicationStatusToPb(st *ApplicationStatus) (*applicationStatusPb, error) { - if st == nil { - return nil, nil - } - pb := &applicationStatusPb{} - pb.Message = st.Message - pb.State = st.State - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type applicationStatusPb struct { - Message string `json:"message,omitempty"` - State ApplicationState `json:"state,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func applicationStatusFromPb(pb *applicationStatusPb) (*ApplicationStatus, error) { - if pb == nil { - return nil, nil - } - st := &ApplicationStatus{} - st.Message = pb.Message - st.State = pb.State - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *applicationStatusPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st applicationStatusPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func computeStatusToPb(st *ComputeStatus) (*computeStatusPb, error) { - if st == nil { - return nil, nil - } - pb := &computeStatusPb{} - pb.Message = st.Message - pb.State = st.State - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type computeStatusPb struct { - Message string `json:"message,omitempty"` - State ComputeState `json:"state,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func computeStatusFromPb(pb *computeStatusPb) (*ComputeStatus, error) { - if pb == nil { - return nil, nil - } - st := &ComputeStatus{} - st.Message = pb.Message - st.State = pb.State - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *computeStatusPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st computeStatusPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createAppDeploymentRequestToPb(st *CreateAppDeploymentRequest) (*createAppDeploymentRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &createAppDeploymentRequestPb{} - pb.AppDeployment = st.AppDeployment - pb.AppName = st.AppName - - return pb, nil -} - -type createAppDeploymentRequestPb struct { - AppDeployment AppDeployment `json:"app_deployment"` - AppName string `json:"-" url:"-"` -} - -func createAppDeploymentRequestFromPb(pb *createAppDeploymentRequestPb) (*CreateAppDeploymentRequest, error) { - if pb == nil { - return nil, nil - } - st := &CreateAppDeploymentRequest{} - st.AppDeployment = pb.AppDeployment - st.AppName = pb.AppName - - return st, nil -} - -func createAppRequestToPb(st *CreateAppRequest) (*createAppRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &createAppRequestPb{} - pb.App = st.App - pb.NoCompute = st.NoCompute - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createAppRequestPb struct { - App App `json:"app"` - NoCompute bool `json:"-" url:"no_compute,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createAppRequestFromPb(pb *createAppRequestPb) (*CreateAppRequest, error) { - if pb == nil { - return nil, nil - } - st := &CreateAppRequest{} - st.App = pb.App - st.NoCompute = pb.NoCompute - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createAppRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createAppRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func deleteAppRequestToPb(st *DeleteAppRequest) (*deleteAppRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteAppRequestPb{} - pb.Name = st.Name - - return pb, nil -} - -type deleteAppRequestPb struct { - Name string `json:"-" url:"-"` -} - -func deleteAppRequestFromPb(pb *deleteAppRequestPb) (*DeleteAppRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteAppRequest{} - st.Name = pb.Name - - return st, nil -} - -func getAppDeploymentRequestToPb(st *GetAppDeploymentRequest) (*getAppDeploymentRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getAppDeploymentRequestPb{} - pb.AppName = st.AppName - pb.DeploymentId = st.DeploymentId - - return pb, nil -} - -type getAppDeploymentRequestPb struct { - AppName string `json:"-" url:"-"` - DeploymentId string `json:"-" url:"-"` -} - -func getAppDeploymentRequestFromPb(pb *getAppDeploymentRequestPb) (*GetAppDeploymentRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetAppDeploymentRequest{} - st.AppName = pb.AppName - st.DeploymentId = pb.DeploymentId - - return st, nil -} - -func getAppPermissionLevelsRequestToPb(st *GetAppPermissionLevelsRequest) (*getAppPermissionLevelsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getAppPermissionLevelsRequestPb{} - pb.AppName = st.AppName - - return pb, nil -} - -type getAppPermissionLevelsRequestPb struct { - AppName string `json:"-" url:"-"` -} - -func getAppPermissionLevelsRequestFromPb(pb *getAppPermissionLevelsRequestPb) (*GetAppPermissionLevelsRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetAppPermissionLevelsRequest{} - st.AppName = pb.AppName - - return st, nil -} - -func getAppPermissionLevelsResponseToPb(st *GetAppPermissionLevelsResponse) (*getAppPermissionLevelsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &getAppPermissionLevelsResponsePb{} - pb.PermissionLevels = st.PermissionLevels - - return pb, nil -} - -type getAppPermissionLevelsResponsePb struct { - PermissionLevels []AppPermissionsDescription `json:"permission_levels,omitempty"` -} - -func getAppPermissionLevelsResponseFromPb(pb *getAppPermissionLevelsResponsePb) (*GetAppPermissionLevelsResponse, error) { - if pb == nil { - return nil, nil - } - st := &GetAppPermissionLevelsResponse{} - st.PermissionLevels = pb.PermissionLevels - - return st, nil -} - -func getAppPermissionsRequestToPb(st *GetAppPermissionsRequest) (*getAppPermissionsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getAppPermissionsRequestPb{} - pb.AppName = st.AppName - - return pb, nil -} - -type getAppPermissionsRequestPb struct { - AppName string `json:"-" url:"-"` -} - -func getAppPermissionsRequestFromPb(pb *getAppPermissionsRequestPb) (*GetAppPermissionsRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetAppPermissionsRequest{} - st.AppName = pb.AppName - - return st, nil -} - -func getAppRequestToPb(st *GetAppRequest) (*getAppRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getAppRequestPb{} - pb.Name = st.Name - - return pb, nil -} - -type getAppRequestPb struct { - Name string `json:"-" url:"-"` -} - -func getAppRequestFromPb(pb *getAppRequestPb) (*GetAppRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetAppRequest{} - st.Name = pb.Name - - return st, nil -} - -func listAppDeploymentsRequestToPb(st *ListAppDeploymentsRequest) (*listAppDeploymentsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listAppDeploymentsRequestPb{} - pb.AppName = st.AppName - pb.PageSize = st.PageSize - pb.PageToken = st.PageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listAppDeploymentsRequestPb struct { - AppName string `json:"-" url:"-"` - PageSize int `json:"-" url:"page_size,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listAppDeploymentsRequestFromPb(pb *listAppDeploymentsRequestPb) (*ListAppDeploymentsRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListAppDeploymentsRequest{} - st.AppName = pb.AppName - st.PageSize = pb.PageSize - st.PageToken = pb.PageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listAppDeploymentsRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listAppDeploymentsRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listAppDeploymentsResponseToPb(st *ListAppDeploymentsResponse) (*listAppDeploymentsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listAppDeploymentsResponsePb{} - pb.AppDeployments = st.AppDeployments - pb.NextPageToken = st.NextPageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listAppDeploymentsResponsePb struct { - AppDeployments []AppDeployment `json:"app_deployments,omitempty"` - NextPageToken string `json:"next_page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listAppDeploymentsResponseFromPb(pb *listAppDeploymentsResponsePb) (*ListAppDeploymentsResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListAppDeploymentsResponse{} - st.AppDeployments = pb.AppDeployments - st.NextPageToken = pb.NextPageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listAppDeploymentsResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listAppDeploymentsResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listAppsRequestToPb(st *ListAppsRequest) (*listAppsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listAppsRequestPb{} - pb.PageSize = st.PageSize - pb.PageToken = st.PageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listAppsRequestPb struct { - PageSize int `json:"-" url:"page_size,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listAppsRequestFromPb(pb *listAppsRequestPb) (*ListAppsRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListAppsRequest{} - st.PageSize = pb.PageSize - st.PageToken = pb.PageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listAppsRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listAppsRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listAppsResponseToPb(st *ListAppsResponse) (*listAppsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listAppsResponsePb{} - pb.Apps = st.Apps - pb.NextPageToken = st.NextPageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listAppsResponsePb struct { - Apps []App `json:"apps,omitempty"` - NextPageToken string `json:"next_page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listAppsResponseFromPb(pb *listAppsResponsePb) (*ListAppsResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListAppsResponse{} - st.Apps = pb.Apps - st.NextPageToken = pb.NextPageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listAppsResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listAppsResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func startAppRequestToPb(st *StartAppRequest) (*startAppRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &startAppRequestPb{} - pb.Name = st.Name - - return pb, nil -} - -type startAppRequestPb struct { - Name string `json:"-" url:"-"` -} - -func startAppRequestFromPb(pb *startAppRequestPb) (*StartAppRequest, error) { - if pb == nil { - return nil, nil - } - st := &StartAppRequest{} - st.Name = pb.Name - - return st, nil -} - -func stopAppRequestToPb(st *StopAppRequest) (*stopAppRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &stopAppRequestPb{} - pb.Name = st.Name - - return pb, nil -} - -type stopAppRequestPb struct { - Name string `json:"-" url:"-"` -} - -func stopAppRequestFromPb(pb *stopAppRequestPb) (*StopAppRequest, error) { - if pb == nil { - return nil, nil - } - st := &StopAppRequest{} - st.Name = pb.Name - - return st, nil -} - -func updateAppRequestToPb(st *UpdateAppRequest) (*updateAppRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &updateAppRequestPb{} - pb.App = st.App - pb.Name = st.Name - - return pb, nil -} - -type updateAppRequestPb struct { - App App `json:"app"` - Name string `json:"-" url:"-"` -} - -func updateAppRequestFromPb(pb *updateAppRequestPb) (*UpdateAppRequest, error) { - if pb == nil { - return nil, nil - } - st := &UpdateAppRequest{} - st.App = pb.App - st.Name = pb.Name - - return st, nil -} - -func durationToPb(d *time.Duration) (*string, error) { - if d == nil { - return nil, nil - } - s := fmt.Sprintf("%.9fs", d.Seconds()) - return &s, nil -} - -func durationFromPb(s *string) (*time.Duration, error) { - if s == nil { - return nil, nil - } - d, err := time.ParseDuration(*s) - if err != nil { - return nil, err - } - return &d, nil -} - -func timestampToPb(t *time.Time) (*string, error) { - if t == nil { - return nil, nil - } - s := t.Format(time.RFC3339) - return &s, nil -} - -func timestampFromPb(s *string) (*time.Time, error) { - if s == nil { - return nil, nil - } - t, err := time.Parse(time.RFC3339, *s) - if err != nil { - return nil, err - } - return &t, nil -} - -func fieldMaskToPb(fm *[]string) (*string, error) { - if fm == nil { - return nil, nil - } - s := strings.Join(*fm, ",") - return &s, nil -} - -func fieldMaskFromPb(s *string) (*[]string, error) { - if s == nil { - return nil, nil - } - fm := strings.Split(*s, ",") - return &fm, nil -} diff --git a/service/apps/model.go b/service/apps/model.go index 7f095ef89..b090cbd9b 100755 --- a/service/apps/model.go +++ b/service/apps/model.go @@ -3,216 +3,129 @@ package apps import ( - "encoding/json" "fmt" + + "github.com/databricks/databricks-sdk-go/marshal" ) type App struct { // The active deployment of the app. A deployment is considered active when // it has been deployed to the app compute. - // Wire name: 'active_deployment' ActiveDeployment *AppDeployment `json:"active_deployment,omitempty"` - // Wire name: 'app_status' AppStatus *ApplicationStatus `json:"app_status,omitempty"` - // Wire name: 'budget_policy_id' BudgetPolicyId string `json:"budget_policy_id,omitempty"` - // Wire name: 'compute_status' ComputeStatus *ComputeStatus `json:"compute_status,omitempty"` // The creation time of the app. Formatted timestamp in ISO 6801. - // Wire name: 'create_time' CreateTime string `json:"create_time,omitempty"` // The email of the user that created the app. - // Wire name: 'creator' Creator string `json:"creator,omitempty"` // The default workspace file system path of the source code from which app // deployment are created. This field tracks the workspace source code path // of the last active deployment. - // Wire name: 'default_source_code_path' DefaultSourceCodePath string `json:"default_source_code_path,omitempty"` // The description of the app. - // Wire name: 'description' Description string `json:"description,omitempty"` - // Wire name: 'effective_budget_policy_id' EffectiveBudgetPolicyId string `json:"effective_budget_policy_id,omitempty"` // The effective api scopes granted to the user access token. - // Wire name: 'effective_user_api_scopes' EffectiveUserApiScopes []string `json:"effective_user_api_scopes,omitempty"` // The unique identifier of the app. - // Wire name: 'id' Id string `json:"id,omitempty"` // The name of the app. The name must contain only lowercase alphanumeric // characters and hyphens. It must be unique within the workspace. - // Wire name: 'name' Name string `json:"name"` - // Wire name: 'oauth2_app_client_id' Oauth2AppClientId string `json:"oauth2_app_client_id,omitempty"` - // Wire name: 'oauth2_app_integration_id' Oauth2AppIntegrationId string `json:"oauth2_app_integration_id,omitempty"` // The pending deployment of the app. A deployment is considered pending // when it is being prepared for deployment to the app compute. - // Wire name: 'pending_deployment' PendingDeployment *AppDeployment `json:"pending_deployment,omitempty"` // Resources for the app. - // Wire name: 'resources' Resources []AppResource `json:"resources,omitempty"` - // Wire name: 'service_principal_client_id' ServicePrincipalClientId string `json:"service_principal_client_id,omitempty"` - // Wire name: 'service_principal_id' ServicePrincipalId int64 `json:"service_principal_id,omitempty"` - // Wire name: 'service_principal_name' ServicePrincipalName string `json:"service_principal_name,omitempty"` // The update time of the app. Formatted timestamp in ISO 6801. - // Wire name: 'update_time' UpdateTime string `json:"update_time,omitempty"` // The email of the user that last updated the app. - // Wire name: 'updater' Updater string `json:"updater,omitempty"` // The URL of the app once it is deployed. - // Wire name: 'url' Url string `json:"url,omitempty"` - // Wire name: 'user_api_scopes' UserApiScopes []string `json:"user_api_scopes,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *App) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &appPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := appFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *App) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st App) MarshalJSON() ([]byte, error) { - pb, err := appToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s App) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type AppAccessControlRequest struct { // name of the group - // Wire name: 'group_name' GroupName string `json:"group_name,omitempty"` // Permission level - // Wire name: 'permission_level' PermissionLevel AppPermissionLevel `json:"permission_level,omitempty"` // application ID of a service principal - // Wire name: 'service_principal_name' ServicePrincipalName string `json:"service_principal_name,omitempty"` // name of the user - // Wire name: 'user_name' UserName string `json:"user_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *AppAccessControlRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &appAccessControlRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := appAccessControlRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *AppAccessControlRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st AppAccessControlRequest) MarshalJSON() ([]byte, error) { - pb, err := appAccessControlRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s AppAccessControlRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type AppAccessControlResponse struct { // All permissions. - // Wire name: 'all_permissions' AllPermissions []AppPermission `json:"all_permissions,omitempty"` // Display name of the user or service principal. - // Wire name: 'display_name' DisplayName string `json:"display_name,omitempty"` // name of the group - // Wire name: 'group_name' GroupName string `json:"group_name,omitempty"` // Name of the service principal. - // Wire name: 'service_principal_name' ServicePrincipalName string `json:"service_principal_name,omitempty"` // name of the user - // Wire name: 'user_name' UserName string `json:"user_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *AppAccessControlResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &appAccessControlResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := appAccessControlResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *AppAccessControlResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st AppAccessControlResponse) MarshalJSON() ([]byte, error) { - pb, err := appAccessControlResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s AppAccessControlResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type AppDeployment struct { // The creation time of the deployment. Formatted timestamp in ISO 6801. - // Wire name: 'create_time' CreateTime string `json:"create_time,omitempty"` // The email of the user creates the deployment. - // Wire name: 'creator' Creator string `json:"creator,omitempty"` // The deployment artifacts for an app. - // Wire name: 'deployment_artifacts' DeploymentArtifacts *AppDeploymentArtifacts `json:"deployment_artifacts,omitempty"` // The unique id of the deployment. - // Wire name: 'deployment_id' DeploymentId string `json:"deployment_id,omitempty"` // The mode of which the deployment will manage the source code. - // Wire name: 'mode' Mode AppDeploymentMode `json:"mode,omitempty"` // The workspace file system path of the source code used to create the app // deployment. This is different from @@ -221,75 +134,37 @@ type AppDeployment struct { // the app in the workspace during deployment creation, whereas the latter // provides a system generated stable snapshotted source code path used by // the deployment. - // Wire name: 'source_code_path' SourceCodePath string `json:"source_code_path,omitempty"` // Status and status message of the deployment - // Wire name: 'status' Status *AppDeploymentStatus `json:"status,omitempty"` // The update time of the deployment. Formatted timestamp in ISO 6801. - // Wire name: 'update_time' UpdateTime string `json:"update_time,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *AppDeployment) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &appDeploymentPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := appDeploymentFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *AppDeployment) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st AppDeployment) MarshalJSON() ([]byte, error) { - pb, err := appDeploymentToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s AppDeployment) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type AppDeploymentArtifacts struct { // The snapshotted workspace file system path of the source code loaded by // the deployed app. - // Wire name: 'source_code_path' SourceCodePath string `json:"source_code_path,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *AppDeploymentArtifacts) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &appDeploymentArtifactsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := appDeploymentArtifactsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *AppDeploymentArtifacts) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st AppDeploymentArtifacts) MarshalJSON() ([]byte, error) { - pb, err := appDeploymentArtifactsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s AppDeploymentArtifacts) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type AppDeploymentMode string @@ -374,77 +249,37 @@ func (f *AppDeploymentState) Type() string { type AppDeploymentStatus struct { // Message corresponding with the deployment state. - // Wire name: 'message' Message string `json:"message,omitempty"` // State of the deployment. - // Wire name: 'state' State AppDeploymentState `json:"state,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *AppDeploymentStatus) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &appDeploymentStatusPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := appDeploymentStatusFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *AppDeploymentStatus) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st AppDeploymentStatus) MarshalJSON() ([]byte, error) { - pb, err := appDeploymentStatusToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s AppDeploymentStatus) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type AppPermission struct { - - // Wire name: 'inherited' Inherited bool `json:"inherited,omitempty"` - // Wire name: 'inherited_from_object' InheritedFromObject []string `json:"inherited_from_object,omitempty"` // Permission level - // Wire name: 'permission_level' PermissionLevel AppPermissionLevel `json:"permission_level,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *AppPermission) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &appPermissionPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := appPermissionFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *AppPermission) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st AppPermission) MarshalJSON() ([]byte, error) { - pb, err := appPermissionToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s AppPermission) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Permission level @@ -486,199 +321,80 @@ func (f *AppPermissionLevel) Type() string { } type AppPermissions struct { - - // Wire name: 'access_control_list' AccessControlList []AppAccessControlResponse `json:"access_control_list,omitempty"` - // Wire name: 'object_id' ObjectId string `json:"object_id,omitempty"` - // Wire name: 'object_type' ObjectType string `json:"object_type,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *AppPermissions) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &appPermissionsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := appPermissionsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *AppPermissions) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st AppPermissions) MarshalJSON() ([]byte, error) { - pb, err := appPermissionsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s AppPermissions) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type AppPermissionsDescription struct { - - // Wire name: 'description' Description string `json:"description,omitempty"` // Permission level - // Wire name: 'permission_level' PermissionLevel AppPermissionLevel `json:"permission_level,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *AppPermissionsDescription) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &appPermissionsDescriptionPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := appPermissionsDescriptionFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *AppPermissionsDescription) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st AppPermissionsDescription) MarshalJSON() ([]byte, error) { - pb, err := appPermissionsDescriptionToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s AppPermissionsDescription) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type AppPermissionsRequest struct { - - // Wire name: 'access_control_list' AccessControlList []AppAccessControlRequest `json:"access_control_list,omitempty"` // The app for which to get or manage permissions. - AppName string `json:"-" tf:"-"` -} - -func (st *AppPermissionsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &appPermissionsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := appPermissionsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st AppPermissionsRequest) MarshalJSON() ([]byte, error) { - pb, err := appPermissionsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + AppName string `json:"-" url:"-"` } type AppResource struct { // Description of the App Resource. - // Wire name: 'description' Description string `json:"description,omitempty"` - // Wire name: 'job' Job *AppResourceJob `json:"job,omitempty"` // Name of the App Resource. - // Wire name: 'name' Name string `json:"name"` - // Wire name: 'secret' Secret *AppResourceSecret `json:"secret,omitempty"` - // Wire name: 'serving_endpoint' ServingEndpoint *AppResourceServingEndpoint `json:"serving_endpoint,omitempty"` - // Wire name: 'sql_warehouse' SqlWarehouse *AppResourceSqlWarehouse `json:"sql_warehouse,omitempty"` - // Wire name: 'uc_securable' UcSecurable *AppResourceUcSecurable `json:"uc_securable,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *AppResource) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &appResourcePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := appResourceFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *AppResource) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st AppResource) MarshalJSON() ([]byte, error) { - pb, err := appResourceToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s AppResource) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type AppResourceJob struct { // Id of the job to grant permission on. - // Wire name: 'id' Id string `json:"id"` // Permissions to grant on the Job. Supported permissions are: "CAN_MANAGE", // "IS_OWNER", "CAN_MANAGE_RUN", "CAN_VIEW". - // Wire name: 'permission' Permission AppResourceJobJobPermission `json:"permission"` } -func (st *AppResourceJob) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &appResourceJobPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := appResourceJobFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st AppResourceJob) MarshalJSON() ([]byte, error) { - pb, err := appResourceJobToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type AppResourceJobJobPermission string const AppResourceJobJobPermissionCanManage AppResourceJobJobPermission = `CAN_MANAGE` @@ -724,42 +440,14 @@ func (f *AppResourceJobJobPermission) Type() string { type AppResourceSecret struct { // Key of the secret to grant permission on. - // Wire name: 'key' Key string `json:"key"` // Permission to grant on the secret scope. For secrets, only one permission // is allowed. Permission must be one of: "READ", "WRITE", "MANAGE". - // Wire name: 'permission' Permission AppResourceSecretSecretPermission `json:"permission"` // Scope of the secret to grant permission on. - // Wire name: 'scope' Scope string `json:"scope"` } -func (st *AppResourceSecret) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &appResourceSecretPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := appResourceSecretFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st AppResourceSecret) MarshalJSON() ([]byte, error) { - pb, err := appResourceSecretToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Permission to grant on the secret scope. Supported permissions are: "READ", // "WRITE", "MANAGE". type AppResourceSecretSecretPermission string @@ -804,39 +492,12 @@ func (f *AppResourceSecretSecretPermission) Type() string { type AppResourceServingEndpoint struct { // Name of the serving endpoint to grant permission on. - // Wire name: 'name' Name string `json:"name"` // Permission to grant on the serving endpoint. Supported permissions are: // "CAN_MANAGE", "CAN_QUERY", "CAN_VIEW". - // Wire name: 'permission' Permission AppResourceServingEndpointServingEndpointPermission `json:"permission"` } -func (st *AppResourceServingEndpoint) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &appResourceServingEndpointPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := appResourceServingEndpointFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st AppResourceServingEndpoint) MarshalJSON() ([]byte, error) { - pb, err := appResourceServingEndpointToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type AppResourceServingEndpointServingEndpointPermission string const AppResourceServingEndpointServingEndpointPermissionCanManage AppResourceServingEndpointServingEndpointPermission = `CAN_MANAGE` @@ -879,39 +540,12 @@ func (f *AppResourceServingEndpointServingEndpointPermission) Type() string { type AppResourceSqlWarehouse struct { // Id of the SQL warehouse to grant permission on. - // Wire name: 'id' Id string `json:"id"` // Permission to grant on the SQL warehouse. Supported permissions are: // "CAN_MANAGE", "CAN_USE", "IS_OWNER". - // Wire name: 'permission' Permission AppResourceSqlWarehouseSqlWarehousePermission `json:"permission"` } -func (st *AppResourceSqlWarehouse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &appResourceSqlWarehousePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := appResourceSqlWarehouseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st AppResourceSqlWarehouse) MarshalJSON() ([]byte, error) { - pb, err := appResourceSqlWarehouseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type AppResourceSqlWarehouseSqlWarehousePermission string const AppResourceSqlWarehouseSqlWarehousePermissionCanManage AppResourceSqlWarehouseSqlWarehousePermission = `CAN_MANAGE` @@ -953,42 +587,13 @@ func (f *AppResourceSqlWarehouseSqlWarehousePermission) Type() string { } type AppResourceUcSecurable struct { - - // Wire name: 'permission' Permission AppResourceUcSecurableUcSecurablePermission `json:"permission"` - // Wire name: 'securable_full_name' SecurableFullName string `json:"securable_full_name"` - // Wire name: 'securable_type' SecurableType AppResourceUcSecurableUcSecurableType `json:"securable_type"` } -func (st *AppResourceUcSecurable) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &appResourceUcSecurablePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := appResourceUcSecurableFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st AppResourceUcSecurable) MarshalJSON() ([]byte, error) { - pb, err := appResourceUcSecurableToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type AppResourceUcSecurableUcSecurablePermission string const AppResourceUcSecurableUcSecurablePermissionReadVolume AppResourceUcSecurableUcSecurablePermission = `READ_VOLUME` @@ -1105,38 +710,19 @@ func (f *ApplicationState) Type() string { type ApplicationStatus struct { // Application status message - // Wire name: 'message' Message string `json:"message,omitempty"` // State of the application. - // Wire name: 'state' State ApplicationState `json:"state,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ApplicationStatus) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &applicationStatusPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := applicationStatusFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ApplicationStatus) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ApplicationStatus) MarshalJSON() ([]byte, error) { - pb, err := applicationStatusToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ApplicationStatus) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ComputeState string @@ -1193,535 +779,169 @@ func (f *ComputeState) Type() string { type ComputeStatus struct { // Compute status message - // Wire name: 'message' Message string `json:"message,omitempty"` // State of the app compute. - // Wire name: 'state' State ComputeState `json:"state,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ComputeStatus) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &computeStatusPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := computeStatusFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ComputeStatus) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ComputeStatus) MarshalJSON() ([]byte, error) { - pb, err := computeStatusToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ComputeStatus) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Create an app deployment type CreateAppDeploymentRequest struct { - - // Wire name: 'app_deployment' AppDeployment AppDeployment `json:"app_deployment"` // The name of the app. - AppName string `json:"-" tf:"-"` -} - -func (st *CreateAppDeploymentRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createAppDeploymentRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createAppDeploymentRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CreateAppDeploymentRequest) MarshalJSON() ([]byte, error) { - pb, err := createAppDeploymentRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + AppName string `json:"-" url:"-"` } // Create an app type CreateAppRequest struct { - - // Wire name: 'app' App App `json:"app"` // If true, the app will not be started after creation. - NoCompute bool `json:"-" tf:"-"` + NoCompute bool `json:"-" url:"no_compute,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateAppRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createAppRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createAppRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateAppRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateAppRequest) MarshalJSON() ([]byte, error) { - pb, err := createAppRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateAppRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Delete an app type DeleteAppRequest struct { // The name of the app. - Name string `json:"-" tf:"-"` -} - -func (st *DeleteAppRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteAppRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteAppRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteAppRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteAppRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Name string `json:"-" url:"-"` } // Get an app deployment type GetAppDeploymentRequest struct { // The name of the app. - AppName string `json:"-" tf:"-"` + AppName string `json:"-" url:"-"` // The unique id of the deployment. - DeploymentId string `json:"-" tf:"-"` -} - -func (st *GetAppDeploymentRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getAppDeploymentRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getAppDeploymentRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetAppDeploymentRequest) MarshalJSON() ([]byte, error) { - pb, err := getAppDeploymentRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + DeploymentId string `json:"-" url:"-"` } // Get app permission levels type GetAppPermissionLevelsRequest struct { // The app for which to get or manage permissions. - AppName string `json:"-" tf:"-"` -} - -func (st *GetAppPermissionLevelsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getAppPermissionLevelsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getAppPermissionLevelsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetAppPermissionLevelsRequest) MarshalJSON() ([]byte, error) { - pb, err := getAppPermissionLevelsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + AppName string `json:"-" url:"-"` } type GetAppPermissionLevelsResponse struct { // Specific permission levels - // Wire name: 'permission_levels' PermissionLevels []AppPermissionsDescription `json:"permission_levels,omitempty"` } -func (st *GetAppPermissionLevelsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getAppPermissionLevelsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getAppPermissionLevelsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetAppPermissionLevelsResponse) MarshalJSON() ([]byte, error) { - pb, err := getAppPermissionLevelsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Get app permissions type GetAppPermissionsRequest struct { // The app for which to get or manage permissions. - AppName string `json:"-" tf:"-"` -} - -func (st *GetAppPermissionsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getAppPermissionsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getAppPermissionsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetAppPermissionsRequest) MarshalJSON() ([]byte, error) { - pb, err := getAppPermissionsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + AppName string `json:"-" url:"-"` } // Get an app type GetAppRequest struct { // The name of the app. - Name string `json:"-" tf:"-"` -} - -func (st *GetAppRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getAppRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getAppRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetAppRequest) MarshalJSON() ([]byte, error) { - pb, err := getAppRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Name string `json:"-" url:"-"` } // List app deployments type ListAppDeploymentsRequest struct { // The name of the app. - AppName string `json:"-" tf:"-"` + AppName string `json:"-" url:"-"` // Upper bound for items returned. - PageSize int `json:"-" tf:"-"` + PageSize int `json:"-" url:"page_size,omitempty"` // Pagination token to go to the next page of apps. Requests first page if // absent. - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListAppDeploymentsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listAppDeploymentsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listAppDeploymentsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListAppDeploymentsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListAppDeploymentsRequest) MarshalJSON() ([]byte, error) { - pb, err := listAppDeploymentsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListAppDeploymentsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListAppDeploymentsResponse struct { // Deployment history of the app. - // Wire name: 'app_deployments' AppDeployments []AppDeployment `json:"app_deployments,omitempty"` // Pagination token to request the next page of apps. - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListAppDeploymentsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listAppDeploymentsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listAppDeploymentsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListAppDeploymentsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListAppDeploymentsResponse) MarshalJSON() ([]byte, error) { - pb, err := listAppDeploymentsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListAppDeploymentsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // List apps type ListAppsRequest struct { // Upper bound for items returned. - PageSize int `json:"-" tf:"-"` + PageSize int `json:"-" url:"page_size,omitempty"` // Pagination token to go to the next page of apps. Requests first page if // absent. - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListAppsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listAppsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listAppsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListAppsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListAppsRequest) MarshalJSON() ([]byte, error) { - pb, err := listAppsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListAppsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListAppsResponse struct { - - // Wire name: 'apps' Apps []App `json:"apps,omitempty"` // Pagination token to request the next page of apps. - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListAppsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listAppsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listAppsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListAppsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListAppsResponse) MarshalJSON() ([]byte, error) { - pb, err := listAppsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListAppsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type StartAppRequest struct { // The name of the app. - Name string `json:"-" tf:"-"` -} - -func (st *StartAppRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &startAppRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := startAppRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st StartAppRequest) MarshalJSON() ([]byte, error) { - pb, err := startAppRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Name string `json:"-" url:"-"` } type StopAppRequest struct { // The name of the app. - Name string `json:"-" tf:"-"` -} - -func (st *StopAppRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &stopAppRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := stopAppRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st StopAppRequest) MarshalJSON() ([]byte, error) { - pb, err := stopAppRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Name string `json:"-" url:"-"` } // Update an app type UpdateAppRequest struct { - - // Wire name: 'app' App App `json:"app"` // The name of the app. The name must contain only lowercase alphanumeric // characters and hyphens. It must be unique within the workspace. - Name string `json:"-" tf:"-"` -} - -func (st *UpdateAppRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateAppRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateAppRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateAppRequest) MarshalJSON() ([]byte, error) { - pb, err := updateAppRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Name string `json:"-" url:"-"` } diff --git a/service/billing/impl.go b/service/billing/impl.go index 2a79a6dcc..3aeb3f8bf 100755 --- a/service/billing/impl.go +++ b/service/billing/impl.go @@ -18,35 +18,13 @@ type billableUsageImpl struct { } func (a *billableUsageImpl) Download(ctx context.Context, request DownloadRequest) (*DownloadResponse, error) { - - requestPb, pbErr := downloadRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var downloadResponsePb downloadResponsePb + var downloadResponse DownloadResponse path := fmt.Sprintf("/api/2.0/accounts/%v/usage/download", a.client.ConfiguredAccountID()) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "text/plain" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &downloadResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := downloadResponseFromPb(&downloadResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &downloadResponse) + return &downloadResponse, err } // unexported type that holds implementations of just BudgetPolicy API methods @@ -55,96 +33,34 @@ type budgetPolicyImpl struct { } func (a *budgetPolicyImpl) Create(ctx context.Context, request CreateBudgetPolicyRequest) (*BudgetPolicy, error) { - - requestPb, pbErr := createBudgetPolicyRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var budgetPolicyPb budgetPolicyPb + var budgetPolicy BudgetPolicy path := fmt.Sprintf("/api/2.1/accounts/%v/budget-policies", a.client.ConfiguredAccountID()) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &budgetPolicyPb, - ) - if err != nil { - return nil, err - } - resp, err := budgetPolicyFromPb(&budgetPolicyPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &budgetPolicy) + return &budgetPolicy, err } func (a *budgetPolicyImpl) Delete(ctx context.Context, request DeleteBudgetPolicyRequest) error { - - requestPb, pbErr := deleteBudgetPolicyRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteResponsePb deleteResponsePb - path := fmt.Sprintf("/api/2.1/accounts/%v/budget-policies/%v", a.client.ConfiguredAccountID(), requestPb.PolicyId) + var deleteResponse DeleteResponse + path := fmt.Sprintf("/api/2.1/accounts/%v/budget-policies/%v", a.client.ConfiguredAccountID(), request.PolicyId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteResponse) return err } func (a *budgetPolicyImpl) Get(ctx context.Context, request GetBudgetPolicyRequest) (*BudgetPolicy, error) { - - requestPb, pbErr := getBudgetPolicyRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var budgetPolicyPb budgetPolicyPb - path := fmt.Sprintf("/api/2.1/accounts/%v/budget-policies/%v", a.client.ConfiguredAccountID(), requestPb.PolicyId) + var budgetPolicy BudgetPolicy + path := fmt.Sprintf("/api/2.1/accounts/%v/budget-policies/%v", a.client.ConfiguredAccountID(), request.PolicyId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &budgetPolicyPb, - ) - if err != nil { - return nil, err - } - resp, err := budgetPolicyFromPb(&budgetPolicyPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &budgetPolicy) + return &budgetPolicy, err } // Lists all policies. Policies are returned in the alphabetically ascending @@ -181,71 +97,27 @@ func (a *budgetPolicyImpl) ListAll(ctx context.Context, request ListBudgetPolici } func (a *budgetPolicyImpl) internalList(ctx context.Context, request ListBudgetPoliciesRequest) (*ListBudgetPoliciesResponse, error) { - - requestPb, pbErr := listBudgetPoliciesRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listBudgetPoliciesResponsePb listBudgetPoliciesResponsePb + var listBudgetPoliciesResponse ListBudgetPoliciesResponse path := fmt.Sprintf("/api/2.1/accounts/%v/budget-policies", a.client.ConfiguredAccountID()) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listBudgetPoliciesResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listBudgetPoliciesResponseFromPb(&listBudgetPoliciesResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listBudgetPoliciesResponse) + return &listBudgetPoliciesResponse, err } func (a *budgetPolicyImpl) Update(ctx context.Context, request UpdateBudgetPolicyRequest) (*BudgetPolicy, error) { - - requestPb, pbErr := updateBudgetPolicyRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var budgetPolicyPb budgetPolicyPb - path := fmt.Sprintf("/api/2.1/accounts/%v/budget-policies/%v", a.client.ConfiguredAccountID(), requestPb.PolicyId) + var budgetPolicy BudgetPolicy + path := fmt.Sprintf("/api/2.1/accounts/%v/budget-policies/%v", a.client.ConfiguredAccountID(), request.PolicyId) queryParams := make(map[string]any) - if requestPb.LimitConfig != nil { - queryParams["limit_config"] = requestPb.LimitConfig + if request.LimitConfig != nil { + queryParams["limit_config"] = request.LimitConfig } headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb).Policy, - &budgetPolicyPb, - ) - if err != nil { - return nil, err - } - resp, err := budgetPolicyFromPb(&budgetPolicyPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.Policy, &budgetPolicy) + return &budgetPolicy, err } // unexported type that holds implementations of just budgets API methods @@ -254,96 +126,34 @@ type budgetsImpl struct { } func (a *budgetsImpl) Create(ctx context.Context, request CreateBudgetConfigurationRequest) (*CreateBudgetConfigurationResponse, error) { - - requestPb, pbErr := createBudgetConfigurationRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var createBudgetConfigurationResponsePb createBudgetConfigurationResponsePb + var createBudgetConfigurationResponse CreateBudgetConfigurationResponse path := fmt.Sprintf("/api/2.1/accounts/%v/budgets", a.client.ConfiguredAccountID()) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &createBudgetConfigurationResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := createBudgetConfigurationResponseFromPb(&createBudgetConfigurationResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &createBudgetConfigurationResponse) + return &createBudgetConfigurationResponse, err } func (a *budgetsImpl) Delete(ctx context.Context, request DeleteBudgetConfigurationRequest) error { - - requestPb, pbErr := deleteBudgetConfigurationRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteBudgetConfigurationResponsePb deleteBudgetConfigurationResponsePb - path := fmt.Sprintf("/api/2.1/accounts/%v/budgets/%v", a.client.ConfiguredAccountID(), requestPb.BudgetId) + var deleteBudgetConfigurationResponse DeleteBudgetConfigurationResponse + path := fmt.Sprintf("/api/2.1/accounts/%v/budgets/%v", a.client.ConfiguredAccountID(), request.BudgetId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteBudgetConfigurationResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteBudgetConfigurationResponse) return err } func (a *budgetsImpl) Get(ctx context.Context, request GetBudgetConfigurationRequest) (*GetBudgetConfigurationResponse, error) { - - requestPb, pbErr := getBudgetConfigurationRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var getBudgetConfigurationResponsePb getBudgetConfigurationResponsePb - path := fmt.Sprintf("/api/2.1/accounts/%v/budgets/%v", a.client.ConfiguredAccountID(), requestPb.BudgetId) + var getBudgetConfigurationResponse GetBudgetConfigurationResponse + path := fmt.Sprintf("/api/2.1/accounts/%v/budgets/%v", a.client.ConfiguredAccountID(), request.BudgetId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &getBudgetConfigurationResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := getBudgetConfigurationResponseFromPb(&getBudgetConfigurationResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getBudgetConfigurationResponse) + return &getBudgetConfigurationResponse, err } // Gets all budgets associated with this account. @@ -378,68 +188,24 @@ func (a *budgetsImpl) ListAll(ctx context.Context, request ListBudgetConfigurati } func (a *budgetsImpl) internalList(ctx context.Context, request ListBudgetConfigurationsRequest) (*ListBudgetConfigurationsResponse, error) { - - requestPb, pbErr := listBudgetConfigurationsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listBudgetConfigurationsResponsePb listBudgetConfigurationsResponsePb + var listBudgetConfigurationsResponse ListBudgetConfigurationsResponse path := fmt.Sprintf("/api/2.1/accounts/%v/budgets", a.client.ConfiguredAccountID()) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listBudgetConfigurationsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listBudgetConfigurationsResponseFromPb(&listBudgetConfigurationsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listBudgetConfigurationsResponse) + return &listBudgetConfigurationsResponse, err } func (a *budgetsImpl) Update(ctx context.Context, request UpdateBudgetConfigurationRequest) (*UpdateBudgetConfigurationResponse, error) { - - requestPb, pbErr := updateBudgetConfigurationRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var updateBudgetConfigurationResponsePb updateBudgetConfigurationResponsePb - path := fmt.Sprintf("/api/2.1/accounts/%v/budgets/%v", a.client.ConfiguredAccountID(), requestPb.BudgetId) + var updateBudgetConfigurationResponse UpdateBudgetConfigurationResponse + path := fmt.Sprintf("/api/2.1/accounts/%v/budgets/%v", a.client.ConfiguredAccountID(), request.BudgetId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPut, - path, - headers, - queryParams, - (*requestPb), - &updateBudgetConfigurationResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := updateBudgetConfigurationResponseFromPb(&updateBudgetConfigurationResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &updateBudgetConfigurationResponse) + return &updateBudgetConfigurationResponse, err } // unexported type that holds implementations of just LogDelivery API methods @@ -448,68 +214,24 @@ type logDeliveryImpl struct { } func (a *logDeliveryImpl) Create(ctx context.Context, request WrappedCreateLogDeliveryConfiguration) (*WrappedLogDeliveryConfiguration, error) { - - requestPb, pbErr := wrappedCreateLogDeliveryConfigurationToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var wrappedLogDeliveryConfigurationPb wrappedLogDeliveryConfigurationPb + var wrappedLogDeliveryConfiguration WrappedLogDeliveryConfiguration path := fmt.Sprintf("/api/2.0/accounts/%v/log-delivery", a.client.ConfiguredAccountID()) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &wrappedLogDeliveryConfigurationPb, - ) - if err != nil { - return nil, err - } - resp, err := wrappedLogDeliveryConfigurationFromPb(&wrappedLogDeliveryConfigurationPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &wrappedLogDeliveryConfiguration) + return &wrappedLogDeliveryConfiguration, err } func (a *logDeliveryImpl) Get(ctx context.Context, request GetLogDeliveryRequest) (*GetLogDeliveryConfigurationResponse, error) { - - requestPb, pbErr := getLogDeliveryRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var getLogDeliveryConfigurationResponsePb getLogDeliveryConfigurationResponsePb - path := fmt.Sprintf("/api/2.0/accounts/%v/log-delivery/%v", a.client.ConfiguredAccountID(), requestPb.LogDeliveryConfigurationId) + var getLogDeliveryConfigurationResponse GetLogDeliveryConfigurationResponse + path := fmt.Sprintf("/api/2.0/accounts/%v/log-delivery/%v", a.client.ConfiguredAccountID(), request.LogDeliveryConfigurationId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &getLogDeliveryConfigurationResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := getLogDeliveryConfigurationResponseFromPb(&getLogDeliveryConfigurationResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getLogDeliveryConfigurationResponse) + return &getLogDeliveryConfigurationResponse, err } // Gets all Databricks log delivery configurations associated with an account @@ -546,63 +268,23 @@ func (a *logDeliveryImpl) ListAll(ctx context.Context, request ListLogDeliveryRe } func (a *logDeliveryImpl) internalList(ctx context.Context, request ListLogDeliveryRequest) (*WrappedLogDeliveryConfigurations, error) { - - requestPb, pbErr := listLogDeliveryRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var wrappedLogDeliveryConfigurationsPb wrappedLogDeliveryConfigurationsPb + var wrappedLogDeliveryConfigurations WrappedLogDeliveryConfigurations path := fmt.Sprintf("/api/2.0/accounts/%v/log-delivery", a.client.ConfiguredAccountID()) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &wrappedLogDeliveryConfigurationsPb, - ) - if err != nil { - return nil, err - } - resp, err := wrappedLogDeliveryConfigurationsFromPb(&wrappedLogDeliveryConfigurationsPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &wrappedLogDeliveryConfigurations) + return &wrappedLogDeliveryConfigurations, err } func (a *logDeliveryImpl) PatchStatus(ctx context.Context, request UpdateLogDeliveryConfigurationStatusRequest) error { - - requestPb, pbErr := updateLogDeliveryConfigurationStatusRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var patchStatusResponsePb patchStatusResponsePb - path := fmt.Sprintf("/api/2.0/accounts/%v/log-delivery/%v", a.client.ConfiguredAccountID(), requestPb.LogDeliveryConfigurationId) + var patchStatusResponse PatchStatusResponse + path := fmt.Sprintf("/api/2.0/accounts/%v/log-delivery/%v", a.client.ConfiguredAccountID(), request.LogDeliveryConfigurationId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &patchStatusResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &patchStatusResponse) return err } @@ -612,66 +294,22 @@ type usageDashboardsImpl struct { } func (a *usageDashboardsImpl) Create(ctx context.Context, request CreateBillingUsageDashboardRequest) (*CreateBillingUsageDashboardResponse, error) { - - requestPb, pbErr := createBillingUsageDashboardRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var createBillingUsageDashboardResponsePb createBillingUsageDashboardResponsePb + var createBillingUsageDashboardResponse CreateBillingUsageDashboardResponse path := fmt.Sprintf("/api/2.0/accounts/%v/dashboard", a.client.ConfiguredAccountID()) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &createBillingUsageDashboardResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := createBillingUsageDashboardResponseFromPb(&createBillingUsageDashboardResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &createBillingUsageDashboardResponse) + return &createBillingUsageDashboardResponse, err } func (a *usageDashboardsImpl) Get(ctx context.Context, request GetBillingUsageDashboardRequest) (*GetBillingUsageDashboardResponse, error) { - - requestPb, pbErr := getBillingUsageDashboardRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var getBillingUsageDashboardResponsePb getBillingUsageDashboardResponsePb + var getBillingUsageDashboardResponse GetBillingUsageDashboardResponse path := fmt.Sprintf("/api/2.0/accounts/%v/dashboard", a.client.ConfiguredAccountID()) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &getBillingUsageDashboardResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := getBillingUsageDashboardResponseFromPb(&getBillingUsageDashboardResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getBillingUsageDashboardResponse) + return &getBillingUsageDashboardResponse, err } diff --git a/service/billing/internal.go b/service/billing/internal.go deleted file mode 100755 index 7a037d237..000000000 --- a/service/billing/internal.go +++ /dev/null @@ -1,1780 +0,0 @@ -// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. - -package billing - -import ( - "fmt" - "io" - "strings" - "time" - - "github.com/databricks/databricks-sdk-go/marshal" - "github.com/databricks/databricks-sdk-go/service/compute" -) - -func actionConfigurationToPb(st *ActionConfiguration) (*actionConfigurationPb, error) { - if st == nil { - return nil, nil - } - pb := &actionConfigurationPb{} - pb.ActionConfigurationId = st.ActionConfigurationId - pb.ActionType = st.ActionType - pb.Target = st.Target - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type actionConfigurationPb struct { - ActionConfigurationId string `json:"action_configuration_id,omitempty"` - ActionType ActionConfigurationType `json:"action_type,omitempty"` - Target string `json:"target,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func actionConfigurationFromPb(pb *actionConfigurationPb) (*ActionConfiguration, error) { - if pb == nil { - return nil, nil - } - st := &ActionConfiguration{} - st.ActionConfigurationId = pb.ActionConfigurationId - st.ActionType = pb.ActionType - st.Target = pb.Target - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *actionConfigurationPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st actionConfigurationPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func alertConfigurationToPb(st *AlertConfiguration) (*alertConfigurationPb, error) { - if st == nil { - return nil, nil - } - pb := &alertConfigurationPb{} - pb.ActionConfigurations = st.ActionConfigurations - pb.AlertConfigurationId = st.AlertConfigurationId - pb.QuantityThreshold = st.QuantityThreshold - pb.QuantityType = st.QuantityType - pb.TimePeriod = st.TimePeriod - pb.TriggerType = st.TriggerType - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type alertConfigurationPb struct { - ActionConfigurations []ActionConfiguration `json:"action_configurations,omitempty"` - AlertConfigurationId string `json:"alert_configuration_id,omitempty"` - QuantityThreshold string `json:"quantity_threshold,omitempty"` - QuantityType AlertConfigurationQuantityType `json:"quantity_type,omitempty"` - TimePeriod AlertConfigurationTimePeriod `json:"time_period,omitempty"` - TriggerType AlertConfigurationTriggerType `json:"trigger_type,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func alertConfigurationFromPb(pb *alertConfigurationPb) (*AlertConfiguration, error) { - if pb == nil { - return nil, nil - } - st := &AlertConfiguration{} - st.ActionConfigurations = pb.ActionConfigurations - st.AlertConfigurationId = pb.AlertConfigurationId - st.QuantityThreshold = pb.QuantityThreshold - st.QuantityType = pb.QuantityType - st.TimePeriod = pb.TimePeriod - st.TriggerType = pb.TriggerType - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *alertConfigurationPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st alertConfigurationPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func budgetConfigurationToPb(st *BudgetConfiguration) (*budgetConfigurationPb, error) { - if st == nil { - return nil, nil - } - pb := &budgetConfigurationPb{} - pb.AccountId = st.AccountId - pb.AlertConfigurations = st.AlertConfigurations - pb.BudgetConfigurationId = st.BudgetConfigurationId - pb.CreateTime = st.CreateTime - pb.DisplayName = st.DisplayName - pb.Filter = st.Filter - pb.UpdateTime = st.UpdateTime - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type budgetConfigurationPb struct { - AccountId string `json:"account_id,omitempty"` - AlertConfigurations []AlertConfiguration `json:"alert_configurations,omitempty"` - BudgetConfigurationId string `json:"budget_configuration_id,omitempty"` - CreateTime int64 `json:"create_time,omitempty"` - DisplayName string `json:"display_name,omitempty"` - Filter *BudgetConfigurationFilter `json:"filter,omitempty"` - UpdateTime int64 `json:"update_time,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func budgetConfigurationFromPb(pb *budgetConfigurationPb) (*BudgetConfiguration, error) { - if pb == nil { - return nil, nil - } - st := &BudgetConfiguration{} - st.AccountId = pb.AccountId - st.AlertConfigurations = pb.AlertConfigurations - st.BudgetConfigurationId = pb.BudgetConfigurationId - st.CreateTime = pb.CreateTime - st.DisplayName = pb.DisplayName - st.Filter = pb.Filter - st.UpdateTime = pb.UpdateTime - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *budgetConfigurationPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st budgetConfigurationPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func budgetConfigurationFilterToPb(st *BudgetConfigurationFilter) (*budgetConfigurationFilterPb, error) { - if st == nil { - return nil, nil - } - pb := &budgetConfigurationFilterPb{} - pb.Tags = st.Tags - pb.WorkspaceId = st.WorkspaceId - - return pb, nil -} - -type budgetConfigurationFilterPb struct { - Tags []BudgetConfigurationFilterTagClause `json:"tags,omitempty"` - WorkspaceId *BudgetConfigurationFilterWorkspaceIdClause `json:"workspace_id,omitempty"` -} - -func budgetConfigurationFilterFromPb(pb *budgetConfigurationFilterPb) (*BudgetConfigurationFilter, error) { - if pb == nil { - return nil, nil - } - st := &BudgetConfigurationFilter{} - st.Tags = pb.Tags - st.WorkspaceId = pb.WorkspaceId - - return st, nil -} - -func budgetConfigurationFilterClauseToPb(st *BudgetConfigurationFilterClause) (*budgetConfigurationFilterClausePb, error) { - if st == nil { - return nil, nil - } - pb := &budgetConfigurationFilterClausePb{} - pb.Operator = st.Operator - pb.Values = st.Values - - return pb, nil -} - -type budgetConfigurationFilterClausePb struct { - Operator BudgetConfigurationFilterOperator `json:"operator,omitempty"` - Values []string `json:"values,omitempty"` -} - -func budgetConfigurationFilterClauseFromPb(pb *budgetConfigurationFilterClausePb) (*BudgetConfigurationFilterClause, error) { - if pb == nil { - return nil, nil - } - st := &BudgetConfigurationFilterClause{} - st.Operator = pb.Operator - st.Values = pb.Values - - return st, nil -} - -func budgetConfigurationFilterTagClauseToPb(st *BudgetConfigurationFilterTagClause) (*budgetConfigurationFilterTagClausePb, error) { - if st == nil { - return nil, nil - } - pb := &budgetConfigurationFilterTagClausePb{} - pb.Key = st.Key - pb.Value = st.Value - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type budgetConfigurationFilterTagClausePb struct { - Key string `json:"key,omitempty"` - Value *BudgetConfigurationFilterClause `json:"value,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func budgetConfigurationFilterTagClauseFromPb(pb *budgetConfigurationFilterTagClausePb) (*BudgetConfigurationFilterTagClause, error) { - if pb == nil { - return nil, nil - } - st := &BudgetConfigurationFilterTagClause{} - st.Key = pb.Key - st.Value = pb.Value - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *budgetConfigurationFilterTagClausePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st budgetConfigurationFilterTagClausePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func budgetConfigurationFilterWorkspaceIdClauseToPb(st *BudgetConfigurationFilterWorkspaceIdClause) (*budgetConfigurationFilterWorkspaceIdClausePb, error) { - if st == nil { - return nil, nil - } - pb := &budgetConfigurationFilterWorkspaceIdClausePb{} - pb.Operator = st.Operator - pb.Values = st.Values - - return pb, nil -} - -type budgetConfigurationFilterWorkspaceIdClausePb struct { - Operator BudgetConfigurationFilterOperator `json:"operator,omitempty"` - Values []int64 `json:"values,omitempty"` -} - -func budgetConfigurationFilterWorkspaceIdClauseFromPb(pb *budgetConfigurationFilterWorkspaceIdClausePb) (*BudgetConfigurationFilterWorkspaceIdClause, error) { - if pb == nil { - return nil, nil - } - st := &BudgetConfigurationFilterWorkspaceIdClause{} - st.Operator = pb.Operator - st.Values = pb.Values - - return st, nil -} - -func budgetPolicyToPb(st *BudgetPolicy) (*budgetPolicyPb, error) { - if st == nil { - return nil, nil - } - pb := &budgetPolicyPb{} - pb.BindingWorkspaceIds = st.BindingWorkspaceIds - pb.CustomTags = st.CustomTags - pb.PolicyId = st.PolicyId - pb.PolicyName = st.PolicyName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type budgetPolicyPb struct { - BindingWorkspaceIds []int64 `json:"binding_workspace_ids,omitempty"` - CustomTags []compute.CustomPolicyTag `json:"custom_tags,omitempty"` - PolicyId string `json:"policy_id,omitempty"` - PolicyName string `json:"policy_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func budgetPolicyFromPb(pb *budgetPolicyPb) (*BudgetPolicy, error) { - if pb == nil { - return nil, nil - } - st := &BudgetPolicy{} - st.BindingWorkspaceIds = pb.BindingWorkspaceIds - st.CustomTags = pb.CustomTags - st.PolicyId = pb.PolicyId - st.PolicyName = pb.PolicyName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *budgetPolicyPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st budgetPolicyPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createBillingUsageDashboardRequestToPb(st *CreateBillingUsageDashboardRequest) (*createBillingUsageDashboardRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &createBillingUsageDashboardRequestPb{} - pb.DashboardType = st.DashboardType - pb.WorkspaceId = st.WorkspaceId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createBillingUsageDashboardRequestPb struct { - DashboardType UsageDashboardType `json:"dashboard_type,omitempty"` - WorkspaceId int64 `json:"workspace_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createBillingUsageDashboardRequestFromPb(pb *createBillingUsageDashboardRequestPb) (*CreateBillingUsageDashboardRequest, error) { - if pb == nil { - return nil, nil - } - st := &CreateBillingUsageDashboardRequest{} - st.DashboardType = pb.DashboardType - st.WorkspaceId = pb.WorkspaceId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createBillingUsageDashboardRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createBillingUsageDashboardRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createBillingUsageDashboardResponseToPb(st *CreateBillingUsageDashboardResponse) (*createBillingUsageDashboardResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &createBillingUsageDashboardResponsePb{} - pb.DashboardId = st.DashboardId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createBillingUsageDashboardResponsePb struct { - DashboardId string `json:"dashboard_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createBillingUsageDashboardResponseFromPb(pb *createBillingUsageDashboardResponsePb) (*CreateBillingUsageDashboardResponse, error) { - if pb == nil { - return nil, nil - } - st := &CreateBillingUsageDashboardResponse{} - st.DashboardId = pb.DashboardId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createBillingUsageDashboardResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createBillingUsageDashboardResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createBudgetConfigurationBudgetToPb(st *CreateBudgetConfigurationBudget) (*createBudgetConfigurationBudgetPb, error) { - if st == nil { - return nil, nil - } - pb := &createBudgetConfigurationBudgetPb{} - pb.AccountId = st.AccountId - pb.AlertConfigurations = st.AlertConfigurations - pb.DisplayName = st.DisplayName - pb.Filter = st.Filter - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createBudgetConfigurationBudgetPb struct { - AccountId string `json:"account_id,omitempty"` - AlertConfigurations []CreateBudgetConfigurationBudgetAlertConfigurations `json:"alert_configurations,omitempty"` - DisplayName string `json:"display_name,omitempty"` - Filter *BudgetConfigurationFilter `json:"filter,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createBudgetConfigurationBudgetFromPb(pb *createBudgetConfigurationBudgetPb) (*CreateBudgetConfigurationBudget, error) { - if pb == nil { - return nil, nil - } - st := &CreateBudgetConfigurationBudget{} - st.AccountId = pb.AccountId - st.AlertConfigurations = pb.AlertConfigurations - st.DisplayName = pb.DisplayName - st.Filter = pb.Filter - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createBudgetConfigurationBudgetPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createBudgetConfigurationBudgetPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createBudgetConfigurationBudgetActionConfigurationsToPb(st *CreateBudgetConfigurationBudgetActionConfigurations) (*createBudgetConfigurationBudgetActionConfigurationsPb, error) { - if st == nil { - return nil, nil - } - pb := &createBudgetConfigurationBudgetActionConfigurationsPb{} - pb.ActionType = st.ActionType - pb.Target = st.Target - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createBudgetConfigurationBudgetActionConfigurationsPb struct { - ActionType ActionConfigurationType `json:"action_type,omitempty"` - Target string `json:"target,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createBudgetConfigurationBudgetActionConfigurationsFromPb(pb *createBudgetConfigurationBudgetActionConfigurationsPb) (*CreateBudgetConfigurationBudgetActionConfigurations, error) { - if pb == nil { - return nil, nil - } - st := &CreateBudgetConfigurationBudgetActionConfigurations{} - st.ActionType = pb.ActionType - st.Target = pb.Target - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createBudgetConfigurationBudgetActionConfigurationsPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createBudgetConfigurationBudgetActionConfigurationsPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createBudgetConfigurationBudgetAlertConfigurationsToPb(st *CreateBudgetConfigurationBudgetAlertConfigurations) (*createBudgetConfigurationBudgetAlertConfigurationsPb, error) { - if st == nil { - return nil, nil - } - pb := &createBudgetConfigurationBudgetAlertConfigurationsPb{} - pb.ActionConfigurations = st.ActionConfigurations - pb.QuantityThreshold = st.QuantityThreshold - pb.QuantityType = st.QuantityType - pb.TimePeriod = st.TimePeriod - pb.TriggerType = st.TriggerType - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createBudgetConfigurationBudgetAlertConfigurationsPb struct { - ActionConfigurations []CreateBudgetConfigurationBudgetActionConfigurations `json:"action_configurations,omitempty"` - QuantityThreshold string `json:"quantity_threshold,omitempty"` - QuantityType AlertConfigurationQuantityType `json:"quantity_type,omitempty"` - TimePeriod AlertConfigurationTimePeriod `json:"time_period,omitempty"` - TriggerType AlertConfigurationTriggerType `json:"trigger_type,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createBudgetConfigurationBudgetAlertConfigurationsFromPb(pb *createBudgetConfigurationBudgetAlertConfigurationsPb) (*CreateBudgetConfigurationBudgetAlertConfigurations, error) { - if pb == nil { - return nil, nil - } - st := &CreateBudgetConfigurationBudgetAlertConfigurations{} - st.ActionConfigurations = pb.ActionConfigurations - st.QuantityThreshold = pb.QuantityThreshold - st.QuantityType = pb.QuantityType - st.TimePeriod = pb.TimePeriod - st.TriggerType = pb.TriggerType - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createBudgetConfigurationBudgetAlertConfigurationsPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createBudgetConfigurationBudgetAlertConfigurationsPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createBudgetConfigurationRequestToPb(st *CreateBudgetConfigurationRequest) (*createBudgetConfigurationRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &createBudgetConfigurationRequestPb{} - pb.Budget = st.Budget - - return pb, nil -} - -type createBudgetConfigurationRequestPb struct { - Budget CreateBudgetConfigurationBudget `json:"budget"` -} - -func createBudgetConfigurationRequestFromPb(pb *createBudgetConfigurationRequestPb) (*CreateBudgetConfigurationRequest, error) { - if pb == nil { - return nil, nil - } - st := &CreateBudgetConfigurationRequest{} - st.Budget = pb.Budget - - return st, nil -} - -func createBudgetConfigurationResponseToPb(st *CreateBudgetConfigurationResponse) (*createBudgetConfigurationResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &createBudgetConfigurationResponsePb{} - pb.Budget = st.Budget - - return pb, nil -} - -type createBudgetConfigurationResponsePb struct { - Budget *BudgetConfiguration `json:"budget,omitempty"` -} - -func createBudgetConfigurationResponseFromPb(pb *createBudgetConfigurationResponsePb) (*CreateBudgetConfigurationResponse, error) { - if pb == nil { - return nil, nil - } - st := &CreateBudgetConfigurationResponse{} - st.Budget = pb.Budget - - return st, nil -} - -func createBudgetPolicyRequestToPb(st *CreateBudgetPolicyRequest) (*createBudgetPolicyRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &createBudgetPolicyRequestPb{} - pb.Policy = st.Policy - pb.RequestId = st.RequestId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createBudgetPolicyRequestPb struct { - Policy *BudgetPolicy `json:"policy,omitempty"` - RequestId string `json:"request_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createBudgetPolicyRequestFromPb(pb *createBudgetPolicyRequestPb) (*CreateBudgetPolicyRequest, error) { - if pb == nil { - return nil, nil - } - st := &CreateBudgetPolicyRequest{} - st.Policy = pb.Policy - st.RequestId = pb.RequestId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createBudgetPolicyRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createBudgetPolicyRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createLogDeliveryConfigurationParamsToPb(st *CreateLogDeliveryConfigurationParams) (*createLogDeliveryConfigurationParamsPb, error) { - if st == nil { - return nil, nil - } - pb := &createLogDeliveryConfigurationParamsPb{} - pb.ConfigName = st.ConfigName - pb.CredentialsId = st.CredentialsId - pb.DeliveryPathPrefix = st.DeliveryPathPrefix - pb.DeliveryStartTime = st.DeliveryStartTime - pb.LogType = st.LogType - pb.OutputFormat = st.OutputFormat - pb.Status = st.Status - pb.StorageConfigurationId = st.StorageConfigurationId - pb.WorkspaceIdsFilter = st.WorkspaceIdsFilter - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createLogDeliveryConfigurationParamsPb struct { - ConfigName string `json:"config_name,omitempty"` - CredentialsId string `json:"credentials_id"` - DeliveryPathPrefix string `json:"delivery_path_prefix,omitempty"` - DeliveryStartTime string `json:"delivery_start_time,omitempty"` - LogType LogType `json:"log_type"` - OutputFormat OutputFormat `json:"output_format"` - Status LogDeliveryConfigStatus `json:"status,omitempty"` - StorageConfigurationId string `json:"storage_configuration_id"` - WorkspaceIdsFilter []int64 `json:"workspace_ids_filter,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createLogDeliveryConfigurationParamsFromPb(pb *createLogDeliveryConfigurationParamsPb) (*CreateLogDeliveryConfigurationParams, error) { - if pb == nil { - return nil, nil - } - st := &CreateLogDeliveryConfigurationParams{} - st.ConfigName = pb.ConfigName - st.CredentialsId = pb.CredentialsId - st.DeliveryPathPrefix = pb.DeliveryPathPrefix - st.DeliveryStartTime = pb.DeliveryStartTime - st.LogType = pb.LogType - st.OutputFormat = pb.OutputFormat - st.Status = pb.Status - st.StorageConfigurationId = pb.StorageConfigurationId - st.WorkspaceIdsFilter = pb.WorkspaceIdsFilter - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createLogDeliveryConfigurationParamsPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createLogDeliveryConfigurationParamsPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func deleteBudgetConfigurationRequestToPb(st *DeleteBudgetConfigurationRequest) (*deleteBudgetConfigurationRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteBudgetConfigurationRequestPb{} - pb.BudgetId = st.BudgetId - - return pb, nil -} - -type deleteBudgetConfigurationRequestPb struct { - BudgetId string `json:"-" url:"-"` -} - -func deleteBudgetConfigurationRequestFromPb(pb *deleteBudgetConfigurationRequestPb) (*DeleteBudgetConfigurationRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteBudgetConfigurationRequest{} - st.BudgetId = pb.BudgetId - - return st, nil -} - -func deleteBudgetConfigurationResponseToPb(st *DeleteBudgetConfigurationResponse) (*deleteBudgetConfigurationResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteBudgetConfigurationResponsePb{} - - return pb, nil -} - -type deleteBudgetConfigurationResponsePb struct { -} - -func deleteBudgetConfigurationResponseFromPb(pb *deleteBudgetConfigurationResponsePb) (*DeleteBudgetConfigurationResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteBudgetConfigurationResponse{} - - return st, nil -} - -func deleteBudgetPolicyRequestToPb(st *DeleteBudgetPolicyRequest) (*deleteBudgetPolicyRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteBudgetPolicyRequestPb{} - pb.PolicyId = st.PolicyId - - return pb, nil -} - -type deleteBudgetPolicyRequestPb struct { - PolicyId string `json:"-" url:"-"` -} - -func deleteBudgetPolicyRequestFromPb(pb *deleteBudgetPolicyRequestPb) (*DeleteBudgetPolicyRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteBudgetPolicyRequest{} - st.PolicyId = pb.PolicyId - - return st, nil -} - -func deleteResponseToPb(st *DeleteResponse) (*deleteResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteResponsePb{} - - return pb, nil -} - -type deleteResponsePb struct { -} - -func deleteResponseFromPb(pb *deleteResponsePb) (*DeleteResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteResponse{} - - return st, nil -} - -func downloadRequestToPb(st *DownloadRequest) (*downloadRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &downloadRequestPb{} - pb.EndMonth = st.EndMonth - pb.PersonalData = st.PersonalData - pb.StartMonth = st.StartMonth - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type downloadRequestPb struct { - EndMonth string `json:"-" url:"end_month"` - PersonalData bool `json:"-" url:"personal_data,omitempty"` - StartMonth string `json:"-" url:"start_month"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func downloadRequestFromPb(pb *downloadRequestPb) (*DownloadRequest, error) { - if pb == nil { - return nil, nil - } - st := &DownloadRequest{} - st.EndMonth = pb.EndMonth - st.PersonalData = pb.PersonalData - st.StartMonth = pb.StartMonth - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *downloadRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st downloadRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func downloadResponseToPb(st *DownloadResponse) (*downloadResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &downloadResponsePb{} - pb.Contents = st.Contents - - return pb, nil -} - -type downloadResponsePb struct { - Contents io.ReadCloser `json:"-"` -} - -func downloadResponseFromPb(pb *downloadResponsePb) (*DownloadResponse, error) { - if pb == nil { - return nil, nil - } - st := &DownloadResponse{} - st.Contents = pb.Contents - - return st, nil -} - -func filterToPb(st *Filter) (*filterPb, error) { - if st == nil { - return nil, nil - } - pb := &filterPb{} - pb.CreatorUserId = st.CreatorUserId - pb.CreatorUserName = st.CreatorUserName - pb.PolicyName = st.PolicyName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type filterPb struct { - CreatorUserId int64 `json:"creator_user_id,omitempty" url:"creator_user_id,omitempty"` - CreatorUserName string `json:"creator_user_name,omitempty" url:"creator_user_name,omitempty"` - PolicyName string `json:"policy_name,omitempty" url:"policy_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func filterFromPb(pb *filterPb) (*Filter, error) { - if pb == nil { - return nil, nil - } - st := &Filter{} - st.CreatorUserId = pb.CreatorUserId - st.CreatorUserName = pb.CreatorUserName - st.PolicyName = pb.PolicyName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *filterPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st filterPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getBillingUsageDashboardRequestToPb(st *GetBillingUsageDashboardRequest) (*getBillingUsageDashboardRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getBillingUsageDashboardRequestPb{} - pb.DashboardType = st.DashboardType - pb.WorkspaceId = st.WorkspaceId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getBillingUsageDashboardRequestPb struct { - DashboardType UsageDashboardType `json:"-" url:"dashboard_type,omitempty"` - WorkspaceId int64 `json:"-" url:"workspace_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getBillingUsageDashboardRequestFromPb(pb *getBillingUsageDashboardRequestPb) (*GetBillingUsageDashboardRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetBillingUsageDashboardRequest{} - st.DashboardType = pb.DashboardType - st.WorkspaceId = pb.WorkspaceId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getBillingUsageDashboardRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getBillingUsageDashboardRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getBillingUsageDashboardResponseToPb(st *GetBillingUsageDashboardResponse) (*getBillingUsageDashboardResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &getBillingUsageDashboardResponsePb{} - pb.DashboardId = st.DashboardId - pb.DashboardUrl = st.DashboardUrl - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getBillingUsageDashboardResponsePb struct { - DashboardId string `json:"dashboard_id,omitempty"` - DashboardUrl string `json:"dashboard_url,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getBillingUsageDashboardResponseFromPb(pb *getBillingUsageDashboardResponsePb) (*GetBillingUsageDashboardResponse, error) { - if pb == nil { - return nil, nil - } - st := &GetBillingUsageDashboardResponse{} - st.DashboardId = pb.DashboardId - st.DashboardUrl = pb.DashboardUrl - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getBillingUsageDashboardResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getBillingUsageDashboardResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getBudgetConfigurationRequestToPb(st *GetBudgetConfigurationRequest) (*getBudgetConfigurationRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getBudgetConfigurationRequestPb{} - pb.BudgetId = st.BudgetId - - return pb, nil -} - -type getBudgetConfigurationRequestPb struct { - BudgetId string `json:"-" url:"-"` -} - -func getBudgetConfigurationRequestFromPb(pb *getBudgetConfigurationRequestPb) (*GetBudgetConfigurationRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetBudgetConfigurationRequest{} - st.BudgetId = pb.BudgetId - - return st, nil -} - -func getBudgetConfigurationResponseToPb(st *GetBudgetConfigurationResponse) (*getBudgetConfigurationResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &getBudgetConfigurationResponsePb{} - pb.Budget = st.Budget - - return pb, nil -} - -type getBudgetConfigurationResponsePb struct { - Budget *BudgetConfiguration `json:"budget,omitempty"` -} - -func getBudgetConfigurationResponseFromPb(pb *getBudgetConfigurationResponsePb) (*GetBudgetConfigurationResponse, error) { - if pb == nil { - return nil, nil - } - st := &GetBudgetConfigurationResponse{} - st.Budget = pb.Budget - - return st, nil -} - -func getBudgetPolicyRequestToPb(st *GetBudgetPolicyRequest) (*getBudgetPolicyRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getBudgetPolicyRequestPb{} - pb.PolicyId = st.PolicyId - - return pb, nil -} - -type getBudgetPolicyRequestPb struct { - PolicyId string `json:"-" url:"-"` -} - -func getBudgetPolicyRequestFromPb(pb *getBudgetPolicyRequestPb) (*GetBudgetPolicyRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetBudgetPolicyRequest{} - st.PolicyId = pb.PolicyId - - return st, nil -} - -func getLogDeliveryConfigurationResponseToPb(st *GetLogDeliveryConfigurationResponse) (*getLogDeliveryConfigurationResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &getLogDeliveryConfigurationResponsePb{} - pb.LogDeliveryConfiguration = st.LogDeliveryConfiguration - - return pb, nil -} - -type getLogDeliveryConfigurationResponsePb struct { - LogDeliveryConfiguration *LogDeliveryConfiguration `json:"log_delivery_configuration,omitempty"` -} - -func getLogDeliveryConfigurationResponseFromPb(pb *getLogDeliveryConfigurationResponsePb) (*GetLogDeliveryConfigurationResponse, error) { - if pb == nil { - return nil, nil - } - st := &GetLogDeliveryConfigurationResponse{} - st.LogDeliveryConfiguration = pb.LogDeliveryConfiguration - - return st, nil -} - -func getLogDeliveryRequestToPb(st *GetLogDeliveryRequest) (*getLogDeliveryRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getLogDeliveryRequestPb{} - pb.LogDeliveryConfigurationId = st.LogDeliveryConfigurationId - - return pb, nil -} - -type getLogDeliveryRequestPb struct { - LogDeliveryConfigurationId string `json:"-" url:"-"` -} - -func getLogDeliveryRequestFromPb(pb *getLogDeliveryRequestPb) (*GetLogDeliveryRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetLogDeliveryRequest{} - st.LogDeliveryConfigurationId = pb.LogDeliveryConfigurationId - - return st, nil -} - -func limitConfigToPb(st *LimitConfig) (*limitConfigPb, error) { - if st == nil { - return nil, nil - } - pb := &limitConfigPb{} - - return pb, nil -} - -type limitConfigPb struct { -} - -func limitConfigFromPb(pb *limitConfigPb) (*LimitConfig, error) { - if pb == nil { - return nil, nil - } - st := &LimitConfig{} - - return st, nil -} - -func listBudgetConfigurationsRequestToPb(st *ListBudgetConfigurationsRequest) (*listBudgetConfigurationsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listBudgetConfigurationsRequestPb{} - pb.PageToken = st.PageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listBudgetConfigurationsRequestPb struct { - PageToken string `json:"-" url:"page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listBudgetConfigurationsRequestFromPb(pb *listBudgetConfigurationsRequestPb) (*ListBudgetConfigurationsRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListBudgetConfigurationsRequest{} - st.PageToken = pb.PageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listBudgetConfigurationsRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listBudgetConfigurationsRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listBudgetConfigurationsResponseToPb(st *ListBudgetConfigurationsResponse) (*listBudgetConfigurationsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listBudgetConfigurationsResponsePb{} - pb.Budgets = st.Budgets - pb.NextPageToken = st.NextPageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listBudgetConfigurationsResponsePb struct { - Budgets []BudgetConfiguration `json:"budgets,omitempty"` - NextPageToken string `json:"next_page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listBudgetConfigurationsResponseFromPb(pb *listBudgetConfigurationsResponsePb) (*ListBudgetConfigurationsResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListBudgetConfigurationsResponse{} - st.Budgets = pb.Budgets - st.NextPageToken = pb.NextPageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listBudgetConfigurationsResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listBudgetConfigurationsResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listBudgetPoliciesRequestToPb(st *ListBudgetPoliciesRequest) (*listBudgetPoliciesRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listBudgetPoliciesRequestPb{} - pb.FilterBy = st.FilterBy - pb.PageSize = st.PageSize - pb.PageToken = st.PageToken - pb.SortSpec = st.SortSpec - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listBudgetPoliciesRequestPb struct { - FilterBy *Filter `json:"-" url:"filter_by,omitempty"` - PageSize int `json:"-" url:"page_size,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - SortSpec *SortSpec `json:"-" url:"sort_spec,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listBudgetPoliciesRequestFromPb(pb *listBudgetPoliciesRequestPb) (*ListBudgetPoliciesRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListBudgetPoliciesRequest{} - st.FilterBy = pb.FilterBy - st.PageSize = pb.PageSize - st.PageToken = pb.PageToken - st.SortSpec = pb.SortSpec - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listBudgetPoliciesRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listBudgetPoliciesRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listBudgetPoliciesResponseToPb(st *ListBudgetPoliciesResponse) (*listBudgetPoliciesResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listBudgetPoliciesResponsePb{} - pb.NextPageToken = st.NextPageToken - pb.Policies = st.Policies - pb.PreviousPageToken = st.PreviousPageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listBudgetPoliciesResponsePb struct { - NextPageToken string `json:"next_page_token,omitempty"` - Policies []BudgetPolicy `json:"policies,omitempty"` - PreviousPageToken string `json:"previous_page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listBudgetPoliciesResponseFromPb(pb *listBudgetPoliciesResponsePb) (*ListBudgetPoliciesResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListBudgetPoliciesResponse{} - st.NextPageToken = pb.NextPageToken - st.Policies = pb.Policies - st.PreviousPageToken = pb.PreviousPageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listBudgetPoliciesResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listBudgetPoliciesResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listLogDeliveryRequestToPb(st *ListLogDeliveryRequest) (*listLogDeliveryRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listLogDeliveryRequestPb{} - pb.CredentialsId = st.CredentialsId - pb.PageToken = st.PageToken - pb.Status = st.Status - pb.StorageConfigurationId = st.StorageConfigurationId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listLogDeliveryRequestPb struct { - CredentialsId string `json:"-" url:"credentials_id,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - Status LogDeliveryConfigStatus `json:"-" url:"status,omitempty"` - StorageConfigurationId string `json:"-" url:"storage_configuration_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listLogDeliveryRequestFromPb(pb *listLogDeliveryRequestPb) (*ListLogDeliveryRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListLogDeliveryRequest{} - st.CredentialsId = pb.CredentialsId - st.PageToken = pb.PageToken - st.Status = pb.Status - st.StorageConfigurationId = pb.StorageConfigurationId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listLogDeliveryRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listLogDeliveryRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func logDeliveryConfigurationToPb(st *LogDeliveryConfiguration) (*logDeliveryConfigurationPb, error) { - if st == nil { - return nil, nil - } - pb := &logDeliveryConfigurationPb{} - pb.AccountId = st.AccountId - pb.ConfigId = st.ConfigId - pb.ConfigName = st.ConfigName - pb.CreationTime = st.CreationTime - pb.CredentialsId = st.CredentialsId - pb.DeliveryPathPrefix = st.DeliveryPathPrefix - pb.DeliveryStartTime = st.DeliveryStartTime - pb.LogDeliveryStatus = st.LogDeliveryStatus - pb.LogType = st.LogType - pb.OutputFormat = st.OutputFormat - pb.Status = st.Status - pb.StorageConfigurationId = st.StorageConfigurationId - pb.UpdateTime = st.UpdateTime - pb.WorkspaceIdsFilter = st.WorkspaceIdsFilter - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type logDeliveryConfigurationPb struct { - AccountId string `json:"account_id"` - ConfigId string `json:"config_id,omitempty"` - ConfigName string `json:"config_name,omitempty"` - CreationTime int64 `json:"creation_time,omitempty"` - CredentialsId string `json:"credentials_id"` - DeliveryPathPrefix string `json:"delivery_path_prefix,omitempty"` - DeliveryStartTime string `json:"delivery_start_time,omitempty"` - LogDeliveryStatus *LogDeliveryStatus `json:"log_delivery_status,omitempty"` - LogType LogType `json:"log_type"` - OutputFormat OutputFormat `json:"output_format"` - Status LogDeliveryConfigStatus `json:"status,omitempty"` - StorageConfigurationId string `json:"storage_configuration_id"` - UpdateTime int64 `json:"update_time,omitempty"` - WorkspaceIdsFilter []int64 `json:"workspace_ids_filter,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func logDeliveryConfigurationFromPb(pb *logDeliveryConfigurationPb) (*LogDeliveryConfiguration, error) { - if pb == nil { - return nil, nil - } - st := &LogDeliveryConfiguration{} - st.AccountId = pb.AccountId - st.ConfigId = pb.ConfigId - st.ConfigName = pb.ConfigName - st.CreationTime = pb.CreationTime - st.CredentialsId = pb.CredentialsId - st.DeliveryPathPrefix = pb.DeliveryPathPrefix - st.DeliveryStartTime = pb.DeliveryStartTime - st.LogDeliveryStatus = pb.LogDeliveryStatus - st.LogType = pb.LogType - st.OutputFormat = pb.OutputFormat - st.Status = pb.Status - st.StorageConfigurationId = pb.StorageConfigurationId - st.UpdateTime = pb.UpdateTime - st.WorkspaceIdsFilter = pb.WorkspaceIdsFilter - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *logDeliveryConfigurationPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st logDeliveryConfigurationPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func logDeliveryStatusToPb(st *LogDeliveryStatus) (*logDeliveryStatusPb, error) { - if st == nil { - return nil, nil - } - pb := &logDeliveryStatusPb{} - pb.LastAttemptTime = st.LastAttemptTime - pb.LastSuccessfulAttemptTime = st.LastSuccessfulAttemptTime - pb.Message = st.Message - pb.Status = st.Status - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type logDeliveryStatusPb struct { - LastAttemptTime string `json:"last_attempt_time,omitempty"` - LastSuccessfulAttemptTime string `json:"last_successful_attempt_time,omitempty"` - Message string `json:"message"` - Status DeliveryStatus `json:"status"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func logDeliveryStatusFromPb(pb *logDeliveryStatusPb) (*LogDeliveryStatus, error) { - if pb == nil { - return nil, nil - } - st := &LogDeliveryStatus{} - st.LastAttemptTime = pb.LastAttemptTime - st.LastSuccessfulAttemptTime = pb.LastSuccessfulAttemptTime - st.Message = pb.Message - st.Status = pb.Status - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *logDeliveryStatusPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st logDeliveryStatusPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func patchStatusResponseToPb(st *PatchStatusResponse) (*patchStatusResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &patchStatusResponsePb{} - - return pb, nil -} - -type patchStatusResponsePb struct { -} - -func patchStatusResponseFromPb(pb *patchStatusResponsePb) (*PatchStatusResponse, error) { - if pb == nil { - return nil, nil - } - st := &PatchStatusResponse{} - - return st, nil -} - -func sortSpecToPb(st *SortSpec) (*sortSpecPb, error) { - if st == nil { - return nil, nil - } - pb := &sortSpecPb{} - pb.Descending = st.Descending - pb.Field = st.Field - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type sortSpecPb struct { - Descending bool `json:"descending,omitempty" url:"descending,omitempty"` - Field SortSpecField `json:"field,omitempty" url:"field,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func sortSpecFromPb(pb *sortSpecPb) (*SortSpec, error) { - if pb == nil { - return nil, nil - } - st := &SortSpec{} - st.Descending = pb.Descending - st.Field = pb.Field - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *sortSpecPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st sortSpecPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func updateBudgetConfigurationBudgetToPb(st *UpdateBudgetConfigurationBudget) (*updateBudgetConfigurationBudgetPb, error) { - if st == nil { - return nil, nil - } - pb := &updateBudgetConfigurationBudgetPb{} - pb.AccountId = st.AccountId - pb.AlertConfigurations = st.AlertConfigurations - pb.BudgetConfigurationId = st.BudgetConfigurationId - pb.DisplayName = st.DisplayName - pb.Filter = st.Filter - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type updateBudgetConfigurationBudgetPb struct { - AccountId string `json:"account_id,omitempty"` - AlertConfigurations []AlertConfiguration `json:"alert_configurations,omitempty"` - BudgetConfigurationId string `json:"budget_configuration_id,omitempty"` - DisplayName string `json:"display_name,omitempty"` - Filter *BudgetConfigurationFilter `json:"filter,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func updateBudgetConfigurationBudgetFromPb(pb *updateBudgetConfigurationBudgetPb) (*UpdateBudgetConfigurationBudget, error) { - if pb == nil { - return nil, nil - } - st := &UpdateBudgetConfigurationBudget{} - st.AccountId = pb.AccountId - st.AlertConfigurations = pb.AlertConfigurations - st.BudgetConfigurationId = pb.BudgetConfigurationId - st.DisplayName = pb.DisplayName - st.Filter = pb.Filter - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *updateBudgetConfigurationBudgetPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st updateBudgetConfigurationBudgetPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func updateBudgetConfigurationRequestToPb(st *UpdateBudgetConfigurationRequest) (*updateBudgetConfigurationRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &updateBudgetConfigurationRequestPb{} - pb.Budget = st.Budget - pb.BudgetId = st.BudgetId - - return pb, nil -} - -type updateBudgetConfigurationRequestPb struct { - Budget UpdateBudgetConfigurationBudget `json:"budget"` - BudgetId string `json:"-" url:"-"` -} - -func updateBudgetConfigurationRequestFromPb(pb *updateBudgetConfigurationRequestPb) (*UpdateBudgetConfigurationRequest, error) { - if pb == nil { - return nil, nil - } - st := &UpdateBudgetConfigurationRequest{} - st.Budget = pb.Budget - st.BudgetId = pb.BudgetId - - return st, nil -} - -func updateBudgetConfigurationResponseToPb(st *UpdateBudgetConfigurationResponse) (*updateBudgetConfigurationResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &updateBudgetConfigurationResponsePb{} - pb.Budget = st.Budget - - return pb, nil -} - -type updateBudgetConfigurationResponsePb struct { - Budget *BudgetConfiguration `json:"budget,omitempty"` -} - -func updateBudgetConfigurationResponseFromPb(pb *updateBudgetConfigurationResponsePb) (*UpdateBudgetConfigurationResponse, error) { - if pb == nil { - return nil, nil - } - st := &UpdateBudgetConfigurationResponse{} - st.Budget = pb.Budget - - return st, nil -} - -func updateBudgetPolicyRequestToPb(st *UpdateBudgetPolicyRequest) (*updateBudgetPolicyRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &updateBudgetPolicyRequestPb{} - pb.LimitConfig = st.LimitConfig - pb.Policy = st.Policy - pb.PolicyId = st.PolicyId - - return pb, nil -} - -type updateBudgetPolicyRequestPb struct { - LimitConfig *LimitConfig `json:"-" url:"limit_config,omitempty"` - Policy BudgetPolicy `json:"policy"` - PolicyId string `json:"-" url:"-"` -} - -func updateBudgetPolicyRequestFromPb(pb *updateBudgetPolicyRequestPb) (*UpdateBudgetPolicyRequest, error) { - if pb == nil { - return nil, nil - } - st := &UpdateBudgetPolicyRequest{} - st.LimitConfig = pb.LimitConfig - st.Policy = pb.Policy - st.PolicyId = pb.PolicyId - - return st, nil -} - -func updateLogDeliveryConfigurationStatusRequestToPb(st *UpdateLogDeliveryConfigurationStatusRequest) (*updateLogDeliveryConfigurationStatusRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &updateLogDeliveryConfigurationStatusRequestPb{} - pb.LogDeliveryConfigurationId = st.LogDeliveryConfigurationId - pb.Status = st.Status - - return pb, nil -} - -type updateLogDeliveryConfigurationStatusRequestPb struct { - LogDeliveryConfigurationId string `json:"-" url:"-"` - Status LogDeliveryConfigStatus `json:"status"` -} - -func updateLogDeliveryConfigurationStatusRequestFromPb(pb *updateLogDeliveryConfigurationStatusRequestPb) (*UpdateLogDeliveryConfigurationStatusRequest, error) { - if pb == nil { - return nil, nil - } - st := &UpdateLogDeliveryConfigurationStatusRequest{} - st.LogDeliveryConfigurationId = pb.LogDeliveryConfigurationId - st.Status = pb.Status - - return st, nil -} - -func wrappedCreateLogDeliveryConfigurationToPb(st *WrappedCreateLogDeliveryConfiguration) (*wrappedCreateLogDeliveryConfigurationPb, error) { - if st == nil { - return nil, nil - } - pb := &wrappedCreateLogDeliveryConfigurationPb{} - pb.LogDeliveryConfiguration = st.LogDeliveryConfiguration - - return pb, nil -} - -type wrappedCreateLogDeliveryConfigurationPb struct { - LogDeliveryConfiguration CreateLogDeliveryConfigurationParams `json:"log_delivery_configuration"` -} - -func wrappedCreateLogDeliveryConfigurationFromPb(pb *wrappedCreateLogDeliveryConfigurationPb) (*WrappedCreateLogDeliveryConfiguration, error) { - if pb == nil { - return nil, nil - } - st := &WrappedCreateLogDeliveryConfiguration{} - st.LogDeliveryConfiguration = pb.LogDeliveryConfiguration - - return st, nil -} - -func wrappedLogDeliveryConfigurationToPb(st *WrappedLogDeliveryConfiguration) (*wrappedLogDeliveryConfigurationPb, error) { - if st == nil { - return nil, nil - } - pb := &wrappedLogDeliveryConfigurationPb{} - pb.LogDeliveryConfiguration = st.LogDeliveryConfiguration - - return pb, nil -} - -type wrappedLogDeliveryConfigurationPb struct { - LogDeliveryConfiguration *LogDeliveryConfiguration `json:"log_delivery_configuration,omitempty"` -} - -func wrappedLogDeliveryConfigurationFromPb(pb *wrappedLogDeliveryConfigurationPb) (*WrappedLogDeliveryConfiguration, error) { - if pb == nil { - return nil, nil - } - st := &WrappedLogDeliveryConfiguration{} - st.LogDeliveryConfiguration = pb.LogDeliveryConfiguration - - return st, nil -} - -func wrappedLogDeliveryConfigurationsToPb(st *WrappedLogDeliveryConfigurations) (*wrappedLogDeliveryConfigurationsPb, error) { - if st == nil { - return nil, nil - } - pb := &wrappedLogDeliveryConfigurationsPb{} - pb.LogDeliveryConfigurations = st.LogDeliveryConfigurations - pb.NextPageToken = st.NextPageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type wrappedLogDeliveryConfigurationsPb struct { - LogDeliveryConfigurations []LogDeliveryConfiguration `json:"log_delivery_configurations,omitempty"` - NextPageToken string `json:"next_page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func wrappedLogDeliveryConfigurationsFromPb(pb *wrappedLogDeliveryConfigurationsPb) (*WrappedLogDeliveryConfigurations, error) { - if pb == nil { - return nil, nil - } - st := &WrappedLogDeliveryConfigurations{} - st.LogDeliveryConfigurations = pb.LogDeliveryConfigurations - st.NextPageToken = pb.NextPageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *wrappedLogDeliveryConfigurationsPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st wrappedLogDeliveryConfigurationsPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func durationToPb(d *time.Duration) (*string, error) { - if d == nil { - return nil, nil - } - s := fmt.Sprintf("%.9fs", d.Seconds()) - return &s, nil -} - -func durationFromPb(s *string) (*time.Duration, error) { - if s == nil { - return nil, nil - } - d, err := time.ParseDuration(*s) - if err != nil { - return nil, err - } - return &d, nil -} - -func timestampToPb(t *time.Time) (*string, error) { - if t == nil { - return nil, nil - } - s := t.Format(time.RFC3339) - return &s, nil -} - -func timestampFromPb(s *string) (*time.Time, error) { - if s == nil { - return nil, nil - } - t, err := time.Parse(time.RFC3339, *s) - if err != nil { - return nil, err - } - return &t, nil -} - -func fieldMaskToPb(fm *[]string) (*string, error) { - if fm == nil { - return nil, nil - } - s := strings.Join(*fm, ",") - return &s, nil -} - -func fieldMaskFromPb(s *string) (*[]string, error) { - if s == nil { - return nil, nil - } - fm := strings.Split(*s, ",") - return &fm, nil -} diff --git a/service/billing/model.go b/service/billing/model.go index 8d94eec7a..542b9b5a3 100644 --- a/service/billing/model.go +++ b/service/billing/model.go @@ -3,50 +3,30 @@ package billing import ( - "encoding/json" "fmt" "io" + "github.com/databricks/databricks-sdk-go/marshal" "github.com/databricks/databricks-sdk-go/service/compute" ) type ActionConfiguration struct { // Databricks action configuration ID. - // Wire name: 'action_configuration_id' ActionConfigurationId string `json:"action_configuration_id,omitempty"` // The type of the action. - // Wire name: 'action_type' ActionType ActionConfigurationType `json:"action_type,omitempty"` // Target for the action. For example, an email address. - // Wire name: 'target' Target string `json:"target,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ActionConfiguration) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &actionConfigurationPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := actionConfigurationFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ActionConfiguration) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ActionConfiguration) MarshalJSON() ([]byte, error) { - pb, err := actionConfigurationToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ActionConfiguration) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ActionConfigurationType string @@ -86,53 +66,30 @@ func (f *ActionConfigurationType) Type() string { type AlertConfiguration struct { // Configured actions for this alert. These define what happens when an // alert enters a triggered state. - // Wire name: 'action_configurations' ActionConfigurations []ActionConfiguration `json:"action_configurations,omitempty"` // Databricks alert configuration ID. - // Wire name: 'alert_configuration_id' AlertConfigurationId string `json:"alert_configuration_id,omitempty"` // The threshold for the budget alert to determine if it is in a triggered // state. The number is evaluated based on `quantity_type`. - // Wire name: 'quantity_threshold' QuantityThreshold string `json:"quantity_threshold,omitempty"` // The way to calculate cost for this budget alert. This is what // `quantity_threshold` is measured in. - // Wire name: 'quantity_type' QuantityType AlertConfigurationQuantityType `json:"quantity_type,omitempty"` // The time window of usage data for the budget. - // Wire name: 'time_period' TimePeriod AlertConfigurationTimePeriod `json:"time_period,omitempty"` // The evaluation method to determine when this budget alert is in a // triggered state. - // Wire name: 'trigger_type' TriggerType AlertConfigurationTriggerType `json:"trigger_type,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *AlertConfiguration) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &alertConfigurationPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := alertConfigurationFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *AlertConfiguration) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st AlertConfiguration) MarshalJSON() ([]byte, error) { - pb, err := alertConfigurationToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s AlertConfiguration) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type AlertConfigurationQuantityType string @@ -239,129 +196,50 @@ func (f *AlertConfigurationTriggerType) Type() string { type BudgetConfiguration struct { // Databricks account ID. - // Wire name: 'account_id' AccountId string `json:"account_id,omitempty"` // Alerts to configure when this budget is in a triggered state. Budgets // must have exactly one alert configuration. - // Wire name: 'alert_configurations' AlertConfigurations []AlertConfiguration `json:"alert_configurations,omitempty"` // Databricks budget configuration ID. - // Wire name: 'budget_configuration_id' BudgetConfigurationId string `json:"budget_configuration_id,omitempty"` // Creation time of this budget configuration. - // Wire name: 'create_time' CreateTime int64 `json:"create_time,omitempty"` // Human-readable name of budget configuration. Max Length: 128 - // Wire name: 'display_name' DisplayName string `json:"display_name,omitempty"` // Configured filters for this budget. These are applied to your account's // usage to limit the scope of what is considered for this budget. Leave // empty to include all usage for this account. All provided filters must be // matched for usage to be included. - // Wire name: 'filter' Filter *BudgetConfigurationFilter `json:"filter,omitempty"` // Update time of this budget configuration. - // Wire name: 'update_time' UpdateTime int64 `json:"update_time,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *BudgetConfiguration) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &budgetConfigurationPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := budgetConfigurationFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *BudgetConfiguration) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st BudgetConfiguration) MarshalJSON() ([]byte, error) { - pb, err := budgetConfigurationToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s BudgetConfiguration) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type BudgetConfigurationFilter struct { // A list of tag keys and values that will limit the budget to usage that // includes those specific custom tags. Tags are case-sensitive and should // be entered exactly as they appear in your usage data. - // Wire name: 'tags' Tags []BudgetConfigurationFilterTagClause `json:"tags,omitempty"` // If provided, usage must match with the provided Databricks workspace IDs. - // Wire name: 'workspace_id' WorkspaceId *BudgetConfigurationFilterWorkspaceIdClause `json:"workspace_id,omitempty"` } -func (st *BudgetConfigurationFilter) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &budgetConfigurationFilterPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := budgetConfigurationFilterFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st BudgetConfigurationFilter) MarshalJSON() ([]byte, error) { - pb, err := budgetConfigurationFilterToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type BudgetConfigurationFilterClause struct { - - // Wire name: 'operator' Operator BudgetConfigurationFilterOperator `json:"operator,omitempty"` - // Wire name: 'values' Values []string `json:"values,omitempty"` } -func (st *BudgetConfigurationFilterClause) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &budgetConfigurationFilterClausePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := budgetConfigurationFilterClauseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st BudgetConfigurationFilterClause) MarshalJSON() ([]byte, error) { - pb, err := budgetConfigurationFilterClauseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type BudgetConfigurationFilterOperator string const BudgetConfigurationFilterOperatorIn BudgetConfigurationFilterOperator = `IN` @@ -397,454 +275,211 @@ func (f *BudgetConfigurationFilterOperator) Type() string { } type BudgetConfigurationFilterTagClause struct { - - // Wire name: 'key' Key string `json:"key,omitempty"` - // Wire name: 'value' Value *BudgetConfigurationFilterClause `json:"value,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *BudgetConfigurationFilterTagClause) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &budgetConfigurationFilterTagClausePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := budgetConfigurationFilterTagClauseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *BudgetConfigurationFilterTagClause) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st BudgetConfigurationFilterTagClause) MarshalJSON() ([]byte, error) { - pb, err := budgetConfigurationFilterTagClauseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s BudgetConfigurationFilterTagClause) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type BudgetConfigurationFilterWorkspaceIdClause struct { - - // Wire name: 'operator' Operator BudgetConfigurationFilterOperator `json:"operator,omitempty"` - // Wire name: 'values' Values []int64 `json:"values,omitempty"` } -func (st *BudgetConfigurationFilterWorkspaceIdClause) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &budgetConfigurationFilterWorkspaceIdClausePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := budgetConfigurationFilterWorkspaceIdClauseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st BudgetConfigurationFilterWorkspaceIdClause) MarshalJSON() ([]byte, error) { - pb, err := budgetConfigurationFilterWorkspaceIdClauseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Contains the BudgetPolicy details. type BudgetPolicy struct { // List of workspaces that this budget policy will be exclusively bound to. // An empty binding implies that this budget policy is open to any workspace // in the account. - // Wire name: 'binding_workspace_ids' BindingWorkspaceIds []int64 `json:"binding_workspace_ids,omitempty"` // A list of tags defined by the customer. At most 20 entries are allowed // per policy. - // Wire name: 'custom_tags' CustomTags []compute.CustomPolicyTag `json:"custom_tags,omitempty"` // The Id of the policy. This field is generated by Databricks and globally // unique. - // Wire name: 'policy_id' PolicyId string `json:"policy_id,omitempty"` // The name of the policy. - Must be unique among active policies. - Can // contain only characters from the ISO 8859-1 (latin1) set. - Can't start // with reserved keywords such as `databricks:default-policy`. - // Wire name: 'policy_name' PolicyName string `json:"policy_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *BudgetPolicy) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &budgetPolicyPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := budgetPolicyFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *BudgetPolicy) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st BudgetPolicy) MarshalJSON() ([]byte, error) { - pb, err := budgetPolicyToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s BudgetPolicy) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreateBillingUsageDashboardRequest struct { // Workspace level usage dashboard shows usage data for the specified // workspace ID. Global level usage dashboard shows usage data for all // workspaces in the account. - // Wire name: 'dashboard_type' DashboardType UsageDashboardType `json:"dashboard_type,omitempty"` // The workspace ID of the workspace in which the usage dashboard is // created. - // Wire name: 'workspace_id' WorkspaceId int64 `json:"workspace_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateBillingUsageDashboardRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createBillingUsageDashboardRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createBillingUsageDashboardRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateBillingUsageDashboardRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateBillingUsageDashboardRequest) MarshalJSON() ([]byte, error) { - pb, err := createBillingUsageDashboardRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateBillingUsageDashboardRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreateBillingUsageDashboardResponse struct { // The unique id of the usage dashboard. - // Wire name: 'dashboard_id' DashboardId string `json:"dashboard_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateBillingUsageDashboardResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createBillingUsageDashboardResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createBillingUsageDashboardResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateBillingUsageDashboardResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateBillingUsageDashboardResponse) MarshalJSON() ([]byte, error) { - pb, err := createBillingUsageDashboardResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateBillingUsageDashboardResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreateBudgetConfigurationBudget struct { // Databricks account ID. - // Wire name: 'account_id' AccountId string `json:"account_id,omitempty"` // Alerts to configure when this budget is in a triggered state. Budgets // must have exactly one alert configuration. - // Wire name: 'alert_configurations' AlertConfigurations []CreateBudgetConfigurationBudgetAlertConfigurations `json:"alert_configurations,omitempty"` // Human-readable name of budget configuration. Max Length: 128 - // Wire name: 'display_name' DisplayName string `json:"display_name,omitempty"` // Configured filters for this budget. These are applied to your account's // usage to limit the scope of what is considered for this budget. Leave // empty to include all usage for this account. All provided filters must be // matched for usage to be included. - // Wire name: 'filter' Filter *BudgetConfigurationFilter `json:"filter,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateBudgetConfigurationBudget) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createBudgetConfigurationBudgetPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createBudgetConfigurationBudgetFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateBudgetConfigurationBudget) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateBudgetConfigurationBudget) MarshalJSON() ([]byte, error) { - pb, err := createBudgetConfigurationBudgetToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateBudgetConfigurationBudget) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreateBudgetConfigurationBudgetActionConfigurations struct { // The type of the action. - // Wire name: 'action_type' ActionType ActionConfigurationType `json:"action_type,omitempty"` // Target for the action. For example, an email address. - // Wire name: 'target' Target string `json:"target,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateBudgetConfigurationBudgetActionConfigurations) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createBudgetConfigurationBudgetActionConfigurationsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createBudgetConfigurationBudgetActionConfigurationsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateBudgetConfigurationBudgetActionConfigurations) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateBudgetConfigurationBudgetActionConfigurations) MarshalJSON() ([]byte, error) { - pb, err := createBudgetConfigurationBudgetActionConfigurationsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateBudgetConfigurationBudgetActionConfigurations) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreateBudgetConfigurationBudgetAlertConfigurations struct { // Configured actions for this alert. These define what happens when an // alert enters a triggered state. - // Wire name: 'action_configurations' ActionConfigurations []CreateBudgetConfigurationBudgetActionConfigurations `json:"action_configurations,omitempty"` // The threshold for the budget alert to determine if it is in a triggered // state. The number is evaluated based on `quantity_type`. - // Wire name: 'quantity_threshold' QuantityThreshold string `json:"quantity_threshold,omitempty"` // The way to calculate cost for this budget alert. This is what // `quantity_threshold` is measured in. - // Wire name: 'quantity_type' QuantityType AlertConfigurationQuantityType `json:"quantity_type,omitempty"` // The time window of usage data for the budget. - // Wire name: 'time_period' TimePeriod AlertConfigurationTimePeriod `json:"time_period,omitempty"` // The evaluation method to determine when this budget alert is in a // triggered state. - // Wire name: 'trigger_type' TriggerType AlertConfigurationTriggerType `json:"trigger_type,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateBudgetConfigurationBudgetAlertConfigurations) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createBudgetConfigurationBudgetAlertConfigurationsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createBudgetConfigurationBudgetAlertConfigurationsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateBudgetConfigurationBudgetAlertConfigurations) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateBudgetConfigurationBudgetAlertConfigurations) MarshalJSON() ([]byte, error) { - pb, err := createBudgetConfigurationBudgetAlertConfigurationsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateBudgetConfigurationBudgetAlertConfigurations) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreateBudgetConfigurationRequest struct { // Properties of the new budget configuration. - // Wire name: 'budget' Budget CreateBudgetConfigurationBudget `json:"budget"` } -func (st *CreateBudgetConfigurationRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createBudgetConfigurationRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createBudgetConfigurationRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CreateBudgetConfigurationRequest) MarshalJSON() ([]byte, error) { - pb, err := createBudgetConfigurationRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type CreateBudgetConfigurationResponse struct { // The created budget configuration. - // Wire name: 'budget' Budget *BudgetConfiguration `json:"budget,omitempty"` } -func (st *CreateBudgetConfigurationResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createBudgetConfigurationResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createBudgetConfigurationResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CreateBudgetConfigurationResponse) MarshalJSON() ([]byte, error) { - pb, err := createBudgetConfigurationResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // A request to create a BudgetPolicy. type CreateBudgetPolicyRequest struct { // The policy to create. `policy_id` needs to be empty as it will be // generated `policy_name` must be provided, custom_tags may need to be // provided depending on the cloud provider. All other fields are optional. - // Wire name: 'policy' Policy *BudgetPolicy `json:"policy,omitempty"` // A unique identifier for this request. Restricted to 36 ASCII characters. // A random UUID is recommended. This request is only idempotent if a // `request_id` is provided. - // Wire name: 'request_id' RequestId string `json:"request_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateBudgetPolicyRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createBudgetPolicyRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createBudgetPolicyRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateBudgetPolicyRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateBudgetPolicyRequest) MarshalJSON() ([]byte, error) { - pb, err := createBudgetPolicyRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateBudgetPolicyRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // * Log Delivery Configuration type CreateLogDeliveryConfigurationParams struct { // The optional human-readable name of the log delivery configuration. // Defaults to empty. - // Wire name: 'config_name' ConfigName string `json:"config_name,omitempty"` // The ID for a method:credentials/create that represents the AWS IAM role // with policy and trust relationship as described in the main billable // usage documentation page. See [Configure billable usage delivery]. // // [Configure billable usage delivery]: https://docs.databricks.com/administration-guide/account-settings/billable-usage-delivery.html - // Wire name: 'credentials_id' CredentialsId string `json:"credentials_id"` // The optional delivery path prefix within Amazon S3 storage. Defaults to // empty, which means that logs are delivered to the root of the bucket. // This must be a valid S3 object key. This must not start or end with a // slash character. - // Wire name: 'delivery_path_prefix' DeliveryPathPrefix string `json:"delivery_path_prefix,omitempty"` // This field applies only if log_type is BILLABLE_USAGE. This is the // optional start month and year for delivery, specified in YYYY-MM format. // Defaults to current year and month. BILLABLE_USAGE logs are not available // for usage before March 2019 (2019-03). - // Wire name: 'delivery_start_time' DeliveryStartTime string `json:"delivery_start_time,omitempty"` // Log delivery type. Supported values are: * `BILLABLE_USAGE` — Configure // [billable usage log delivery]. For the CSV schema, see the [View billable @@ -855,7 +490,6 @@ type CreateLogDeliveryConfigurationParams struct { // [View billable usage]: https://docs.databricks.com/administration-guide/account-settings/usage.html // [audit log delivery]: https://docs.databricks.com/administration-guide/account-settings/audit-logs.html // [billable usage log delivery]: https://docs.databricks.com/administration-guide/account-settings/billable-usage-delivery.html - // Wire name: 'log_type' LogType LogType `json:"log_type"` // The file type of log delivery. * If `log_type` is `BILLABLE_USAGE`, this // value must be `CSV`. Only the CSV (comma-separated values) format is @@ -866,21 +500,18 @@ type CreateLogDeliveryConfigurationParams struct { // // [Configuring audit logs]: https://docs.databricks.com/administration-guide/account-settings/audit-logs.html // [View billable usage]: https://docs.databricks.com/administration-guide/account-settings/usage.html - // Wire name: 'output_format' OutputFormat OutputFormat `json:"output_format"` // Status of log delivery configuration. Set to `ENABLED` (enabled) or // `DISABLED` (disabled). Defaults to `ENABLED`. You can [enable or disable // the configuration](#operation/patch-log-delivery-config-status) later. // Deletion of a configuration is not supported, so disable a log delivery // configuration that is no longer needed. - // Wire name: 'status' Status LogDeliveryConfigStatus `json:"status,omitempty"` // The ID for a method:storage/create that represents the S3 bucket with // bucket policy as described in the main billable usage documentation page. // See [Configure billable usage delivery]. // // [Configure billable usage delivery]: https://docs.databricks.com/administration-guide/account-settings/billable-usage-delivery.html - // Wire name: 'storage_configuration_id' StorageConfigurationId string `json:"storage_configuration_id"` // Optional filter that specifies workspace IDs to deliver logs for. By // default the workspace filter is empty and log delivery applies at the @@ -895,155 +526,37 @@ type CreateLogDeliveryConfigurationParams struct { // delivery won't include account level logs. For some types of Databricks // deployments there is only one workspace per account ID, so this field is // unnecessary. - // Wire name: 'workspace_ids_filter' WorkspaceIdsFilter []int64 `json:"workspace_ids_filter,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateLogDeliveryConfigurationParams) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createLogDeliveryConfigurationParamsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createLogDeliveryConfigurationParamsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateLogDeliveryConfigurationParams) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateLogDeliveryConfigurationParams) MarshalJSON() ([]byte, error) { - pb, err := createLogDeliveryConfigurationParamsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateLogDeliveryConfigurationParams) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Delete budget type DeleteBudgetConfigurationRequest struct { // The Databricks budget configuration ID. - BudgetId string `json:"-" tf:"-"` -} - -func (st *DeleteBudgetConfigurationRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteBudgetConfigurationRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteBudgetConfigurationRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteBudgetConfigurationRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteBudgetConfigurationRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + BudgetId string `json:"-" url:"-"` } type DeleteBudgetConfigurationResponse struct { } -func (st *DeleteBudgetConfigurationResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteBudgetConfigurationResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteBudgetConfigurationResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteBudgetConfigurationResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteBudgetConfigurationResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Delete a budget policy type DeleteBudgetPolicyRequest struct { // The Id of the policy. - PolicyId string `json:"-" tf:"-"` -} - -func (st *DeleteBudgetPolicyRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteBudgetPolicyRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteBudgetPolicyRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteBudgetPolicyRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteBudgetPolicyRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + PolicyId string `json:"-" url:"-"` } type DeleteResponse struct { } -func (st *DeleteResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // * The status string for log delivery. Possible values are: `CREATED`: There // were no log delivery attempts since the config was created. `SUCCEEDED`: The // latest attempt of log delivery has succeeded completely. `USER_FAILURE`: The @@ -1103,70 +616,28 @@ func (f *DeliveryStatus) Type() string { type DownloadRequest struct { // Format: `YYYY-MM`. Last month to return billable usage logs for. This // field is required. - EndMonth string `json:"-" tf:"-"` + EndMonth string `json:"-" url:"end_month"` // Specify whether to include personally identifiable information in the // billable usage logs, for example the email addresses of cluster creators. // Handle this information with care. Defaults to false. - PersonalData bool `json:"-" tf:"-"` + PersonalData bool `json:"-" url:"personal_data,omitempty"` // Format: `YYYY-MM`. First month to return billable usage logs for. This // field is required. - StartMonth string `json:"-" tf:"-"` + StartMonth string `json:"-" url:"start_month"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DownloadRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &downloadRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := downloadRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DownloadRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DownloadRequest) MarshalJSON() ([]byte, error) { - pb, err := downloadRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DownloadRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type DownloadResponse struct { - Contents io.ReadCloser `json:"-" tf:"-"` -} - -func (st *DownloadResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &downloadResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := downloadResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DownloadResponse) MarshalJSON() ([]byte, error) { - pb, err := downloadResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Contents io.ReadCloser `json:"-"` } // Structured representation of a filter to be applied to a list of policies. @@ -1174,43 +645,23 @@ func (st DownloadResponse) MarshalJSON() ([]byte, error) { type Filter struct { // The policy creator user id to be filtered on. If unspecified, all // policies will be returned. - // Wire name: 'creator_user_id' - CreatorUserId int64 `json:"creator_user_id,omitempty"` + CreatorUserId int64 `json:"creator_user_id,omitempty" url:"creator_user_id,omitempty"` // The policy creator user name to be filtered on. If unspecified, all // policies will be returned. - // Wire name: 'creator_user_name' - CreatorUserName string `json:"creator_user_name,omitempty"` + CreatorUserName string `json:"creator_user_name,omitempty" url:"creator_user_name,omitempty"` // The partial name of policies to be filtered on. If unspecified, all // policies will be returned. - // Wire name: 'policy_name' - PolicyName string `json:"policy_name,omitempty"` + PolicyName string `json:"policy_name,omitempty" url:"policy_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *Filter) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &filterPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := filterFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *Filter) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st Filter) MarshalJSON() ([]byte, error) { - pb, err := filterToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s Filter) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get usage dashboard @@ -1218,228 +669,64 @@ type GetBillingUsageDashboardRequest struct { // Workspace level usage dashboard shows usage data for the specified // workspace ID. Global level usage dashboard shows usage data for all // workspaces in the account. - DashboardType UsageDashboardType `json:"-" tf:"-"` + DashboardType UsageDashboardType `json:"-" url:"dashboard_type,omitempty"` // The workspace ID of the workspace in which the usage dashboard is // created. - WorkspaceId int64 `json:"-" tf:"-"` + WorkspaceId int64 `json:"-" url:"workspace_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetBillingUsageDashboardRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getBillingUsageDashboardRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getBillingUsageDashboardRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetBillingUsageDashboardRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetBillingUsageDashboardRequest) MarshalJSON() ([]byte, error) { - pb, err := getBillingUsageDashboardRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetBillingUsageDashboardRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type GetBillingUsageDashboardResponse struct { // The unique id of the usage dashboard. - // Wire name: 'dashboard_id' DashboardId string `json:"dashboard_id,omitempty"` // The URL of the usage dashboard. - // Wire name: 'dashboard_url' DashboardUrl string `json:"dashboard_url,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetBillingUsageDashboardResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getBillingUsageDashboardResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getBillingUsageDashboardResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetBillingUsageDashboardResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetBillingUsageDashboardResponse) MarshalJSON() ([]byte, error) { - pb, err := getBillingUsageDashboardResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetBillingUsageDashboardResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get budget type GetBudgetConfigurationRequest struct { // The budget configuration ID - BudgetId string `json:"-" tf:"-"` -} - -func (st *GetBudgetConfigurationRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getBudgetConfigurationRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getBudgetConfigurationRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetBudgetConfigurationRequest) MarshalJSON() ([]byte, error) { - pb, err := getBudgetConfigurationRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + BudgetId string `json:"-" url:"-"` } type GetBudgetConfigurationResponse struct { - - // Wire name: 'budget' Budget *BudgetConfiguration `json:"budget,omitempty"` } -func (st *GetBudgetConfigurationResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getBudgetConfigurationResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getBudgetConfigurationResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetBudgetConfigurationResponse) MarshalJSON() ([]byte, error) { - pb, err := getBudgetConfigurationResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Get a budget policy type GetBudgetPolicyRequest struct { // The Id of the policy. - PolicyId string `json:"-" tf:"-"` -} - -func (st *GetBudgetPolicyRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getBudgetPolicyRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getBudgetPolicyRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetBudgetPolicyRequest) MarshalJSON() ([]byte, error) { - pb, err := getBudgetPolicyRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + PolicyId string `json:"-" url:"-"` } type GetLogDeliveryConfigurationResponse struct { // The fetched log delivery configuration - // Wire name: 'log_delivery_configuration' LogDeliveryConfiguration *LogDeliveryConfiguration `json:"log_delivery_configuration,omitempty"` } -func (st *GetLogDeliveryConfigurationResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getLogDeliveryConfigurationResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getLogDeliveryConfigurationResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetLogDeliveryConfigurationResponse) MarshalJSON() ([]byte, error) { - pb, err := getLogDeliveryConfigurationResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Get log delivery configuration type GetLogDeliveryRequest struct { // The log delivery configuration id of customer - LogDeliveryConfigurationId string `json:"-" tf:"-"` -} - -func (st *GetLogDeliveryRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getLogDeliveryRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getLogDeliveryRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetLogDeliveryRequest) MarshalJSON() ([]byte, error) { - pb, err := getLogDeliveryRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + LogDeliveryConfigurationId string `json:"-" url:"-"` } // The limit configuration of the policy. Limit configuration provide a budget @@ -1447,111 +734,49 @@ func (st GetLogDeliveryRequest) MarshalJSON() ([]byte, error) { type LimitConfig struct { } -func (st *LimitConfig) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &limitConfigPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := limitConfigFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st LimitConfig) MarshalJSON() ([]byte, error) { - pb, err := limitConfigToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Get all budgets type ListBudgetConfigurationsRequest struct { // A page token received from a previous get all budget configurations call. // This token can be used to retrieve the subsequent page. Requests first // page if absent. - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListBudgetConfigurationsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listBudgetConfigurationsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listBudgetConfigurationsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListBudgetConfigurationsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListBudgetConfigurationsRequest) MarshalJSON() ([]byte, error) { - pb, err := listBudgetConfigurationsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListBudgetConfigurationsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListBudgetConfigurationsResponse struct { - - // Wire name: 'budgets' Budgets []BudgetConfiguration `json:"budgets,omitempty"` // Token which can be sent as `page_token` to retrieve the next page of // results. If this field is omitted, there are no subsequent budgets. - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListBudgetConfigurationsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listBudgetConfigurationsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listBudgetConfigurationsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListBudgetConfigurationsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListBudgetConfigurationsResponse) MarshalJSON() ([]byte, error) { - pb, err := listBudgetConfigurationsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListBudgetConfigurationsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // List policies type ListBudgetPoliciesRequest struct { // A filter to apply to the list of policies. - FilterBy *Filter `json:"-" tf:"-"` + FilterBy *Filter `json:"-" url:"filter_by,omitempty"` // The maximum number of budget policies to return. If unspecified, at most // 100 budget policies will be returned. The maximum value is 1000; values // above 1000 will be coerced to 1000. - PageSize int `json:"-" tf:"-"` + PageSize int `json:"-" url:"page_size,omitempty"` // A page token, received from a previous `ListServerlessPolicies` call. // Provide this to retrieve the subsequent page. If unspecified, the first // page will be returned. @@ -1559,119 +784,65 @@ type ListBudgetPoliciesRequest struct { // When paginating, all other parameters provided to // `ListServerlessPoliciesRequest` must match the call that provided the // page token. - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` // The sort specification. - SortSpec *SortSpec `json:"-" tf:"-"` + SortSpec *SortSpec `json:"-" url:"sort_spec,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListBudgetPoliciesRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listBudgetPoliciesRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listBudgetPoliciesRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListBudgetPoliciesRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListBudgetPoliciesRequest) MarshalJSON() ([]byte, error) { - pb, err := listBudgetPoliciesRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListBudgetPoliciesRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // A list of policies. type ListBudgetPoliciesResponse struct { // A token that can be sent as `page_token` to retrieve the next page. If // this field is omitted, there are no subsequent pages. - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` - // Wire name: 'policies' Policies []BudgetPolicy `json:"policies,omitempty"` // A token that can be sent as `page_token` to retrieve the previous page. // In this field is omitted, there are no previous pages. - // Wire name: 'previous_page_token' PreviousPageToken string `json:"previous_page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListBudgetPoliciesResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listBudgetPoliciesResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listBudgetPoliciesResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListBudgetPoliciesResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListBudgetPoliciesResponse) MarshalJSON() ([]byte, error) { - pb, err := listBudgetPoliciesResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListBudgetPoliciesResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get all log delivery configurations type ListLogDeliveryRequest struct { // The Credentials id to filter the search results with - CredentialsId string `json:"-" tf:"-"` + CredentialsId string `json:"-" url:"credentials_id,omitempty"` // A page token received from a previous get all budget configurations call. // This token can be used to retrieve the subsequent page. Requests first // page if absent. - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` // The log delivery status to filter the search results with - Status LogDeliveryConfigStatus `json:"-" tf:"-"` + Status LogDeliveryConfigStatus `json:"-" url:"status,omitempty"` // The Storage Configuration id to filter the search results with - StorageConfigurationId string `json:"-" tf:"-"` + StorageConfigurationId string `json:"-" url:"storage_configuration_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListLogDeliveryRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listLogDeliveryRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listLogDeliveryRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListLogDeliveryRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListLogDeliveryRequest) MarshalJSON() ([]byte, error) { - pb, err := listLogDeliveryRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListLogDeliveryRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // * Log Delivery Status @@ -1718,40 +889,32 @@ func (f *LogDeliveryConfigStatus) Type() string { // * Log Delivery Configuration type LogDeliveryConfiguration struct { // Databricks account ID. - // Wire name: 'account_id' AccountId string `json:"account_id"` // The unique UUID of log delivery configuration - // Wire name: 'config_id' ConfigId string `json:"config_id,omitempty"` // The optional human-readable name of the log delivery configuration. // Defaults to empty. - // Wire name: 'config_name' ConfigName string `json:"config_name,omitempty"` // Time in epoch milliseconds when the log delivery configuration was // created. - // Wire name: 'creation_time' CreationTime int64 `json:"creation_time,omitempty"` // The ID for a method:credentials/create that represents the AWS IAM role // with policy and trust relationship as described in the main billable // usage documentation page. See [Configure billable usage delivery]. // // [Configure billable usage delivery]: https://docs.databricks.com/administration-guide/account-settings/billable-usage-delivery.html - // Wire name: 'credentials_id' CredentialsId string `json:"credentials_id"` // The optional delivery path prefix within Amazon S3 storage. Defaults to // empty, which means that logs are delivered to the root of the bucket. // This must be a valid S3 object key. This must not start or end with a // slash character. - // Wire name: 'delivery_path_prefix' DeliveryPathPrefix string `json:"delivery_path_prefix,omitempty"` // This field applies only if log_type is BILLABLE_USAGE. This is the // optional start month and year for delivery, specified in YYYY-MM format. // Defaults to current year and month. BILLABLE_USAGE logs are not available // for usage before March 2019 (2019-03). - // Wire name: 'delivery_start_time' DeliveryStartTime string `json:"delivery_start_time,omitempty"` // The LogDeliveryStatus of this log delivery configuration - // Wire name: 'log_delivery_status' LogDeliveryStatus *LogDeliveryStatus `json:"log_delivery_status,omitempty"` // Log delivery type. Supported values are: * `BILLABLE_USAGE` — Configure // [billable usage log delivery]. For the CSV schema, see the [View billable @@ -1762,7 +925,6 @@ type LogDeliveryConfiguration struct { // [View billable usage]: https://docs.databricks.com/administration-guide/account-settings/usage.html // [audit log delivery]: https://docs.databricks.com/administration-guide/account-settings/audit-logs.html // [billable usage log delivery]: https://docs.databricks.com/administration-guide/account-settings/billable-usage-delivery.html - // Wire name: 'log_type' LogType LogType `json:"log_type"` // The file type of log delivery. * If `log_type` is `BILLABLE_USAGE`, this // value must be `CSV`. Only the CSV (comma-separated values) format is @@ -1773,25 +935,21 @@ type LogDeliveryConfiguration struct { // // [Configuring audit logs]: https://docs.databricks.com/administration-guide/account-settings/audit-logs.html // [View billable usage]: https://docs.databricks.com/administration-guide/account-settings/usage.html - // Wire name: 'output_format' OutputFormat OutputFormat `json:"output_format"` // Status of log delivery configuration. Set to `ENABLED` (enabled) or // `DISABLED` (disabled). Defaults to `ENABLED`. You can [enable or disable // the configuration](#operation/patch-log-delivery-config-status) later. // Deletion of a configuration is not supported, so disable a log delivery // configuration that is no longer needed. - // Wire name: 'status' Status LogDeliveryConfigStatus `json:"status,omitempty"` // The ID for a method:storage/create that represents the S3 bucket with // bucket policy as described in the main billable usage documentation page. // See [Configure billable usage delivery]. // // [Configure billable usage delivery]: https://docs.databricks.com/administration-guide/account-settings/billable-usage-delivery.html - // Wire name: 'storage_configuration_id' StorageConfigurationId string `json:"storage_configuration_id"` // Time in epoch milliseconds when the log delivery configuration was // updated. - // Wire name: 'update_time' UpdateTime int64 `json:"update_time,omitempty"` // Optional filter that specifies workspace IDs to deliver logs for. By // default the workspace filter is empty and log delivery applies at the @@ -1806,48 +964,27 @@ type LogDeliveryConfiguration struct { // delivery won't include account level logs. For some types of Databricks // deployments there is only one workspace per account ID, so this field is // unnecessary. - // Wire name: 'workspace_ids_filter' WorkspaceIdsFilter []int64 `json:"workspace_ids_filter,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *LogDeliveryConfiguration) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &logDeliveryConfigurationPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := logDeliveryConfigurationFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *LogDeliveryConfiguration) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st LogDeliveryConfiguration) MarshalJSON() ([]byte, error) { - pb, err := logDeliveryConfigurationToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s LogDeliveryConfiguration) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type LogDeliveryStatus struct { // The UTC time for the latest log delivery attempt. - // Wire name: 'last_attempt_time' LastAttemptTime string `json:"last_attempt_time,omitempty"` // The UTC time for the latest successful log delivery. - // Wire name: 'last_successful_attempt_time' LastSuccessfulAttemptTime string `json:"last_successful_attempt_time,omitempty"` // Informative message about the latest log delivery attempt. If the log // delivery fails with USER_FAILURE, error details will be provided for // fixing misconfigurations in cloud permissions. - // Wire name: 'message' Message string `json:"message"` // Enum that describes the status. Possible values are: * `CREATED`: There // were no log delivery attempts since the config was created. * @@ -1859,35 +996,17 @@ type LogDeliveryStatus struct { // `NOT_FOUND`: The log delivery status as the configuration has been // disabled since the release of this feature or there are no workspaces in // the account. - // Wire name: 'status' Status DeliveryStatus `json:"status"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *LogDeliveryStatus) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &logDeliveryStatusPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := logDeliveryStatusFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *LogDeliveryStatus) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st LogDeliveryStatus) MarshalJSON() ([]byte, error) { - pb, err := logDeliveryStatusToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s LogDeliveryStatus) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // * Log Delivery Type @@ -1969,65 +1088,21 @@ func (f *OutputFormat) Type() string { type PatchStatusResponse struct { } -func (st *PatchStatusResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &patchStatusResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := patchStatusResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st PatchStatusResponse) MarshalJSON() ([]byte, error) { - pb, err := patchStatusResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type SortSpec struct { // Whether to sort in descending order. - // Wire name: 'descending' - Descending bool `json:"descending,omitempty"` + Descending bool `json:"descending,omitempty" url:"descending,omitempty"` // The filed to sort by - // Wire name: 'field' - Field SortSpecField `json:"field,omitempty"` + Field SortSpecField `json:"field,omitempty" url:"field,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *SortSpec) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &sortSpecPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := sortSpecFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *SortSpec) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st SortSpec) MarshalJSON() ([]byte, error) { - pb, err := sortSpecToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s SortSpec) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type SortSpecField string @@ -2066,194 +1141,68 @@ func (f *SortSpecField) Type() string { type UpdateBudgetConfigurationBudget struct { // Databricks account ID. - // Wire name: 'account_id' AccountId string `json:"account_id,omitempty"` // Alerts to configure when this budget is in a triggered state. Budgets // must have exactly one alert configuration. - // Wire name: 'alert_configurations' AlertConfigurations []AlertConfiguration `json:"alert_configurations,omitempty"` // Databricks budget configuration ID. - // Wire name: 'budget_configuration_id' BudgetConfigurationId string `json:"budget_configuration_id,omitempty"` // Human-readable name of budget configuration. Max Length: 128 - // Wire name: 'display_name' DisplayName string `json:"display_name,omitempty"` // Configured filters for this budget. These are applied to your account's // usage to limit the scope of what is considered for this budget. Leave // empty to include all usage for this account. All provided filters must be // matched for usage to be included. - // Wire name: 'filter' Filter *BudgetConfigurationFilter `json:"filter,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *UpdateBudgetConfigurationBudget) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateBudgetConfigurationBudgetPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateBudgetConfigurationBudgetFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *UpdateBudgetConfigurationBudget) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st UpdateBudgetConfigurationBudget) MarshalJSON() ([]byte, error) { - pb, err := updateBudgetConfigurationBudgetToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s UpdateBudgetConfigurationBudget) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type UpdateBudgetConfigurationRequest struct { // The updated budget. This will overwrite the budget specified by the // budget ID. - // Wire name: 'budget' Budget UpdateBudgetConfigurationBudget `json:"budget"` // The Databricks budget configuration ID. - BudgetId string `json:"-" tf:"-"` -} - -func (st *UpdateBudgetConfigurationRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateBudgetConfigurationRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateBudgetConfigurationRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateBudgetConfigurationRequest) MarshalJSON() ([]byte, error) { - pb, err := updateBudgetConfigurationRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + BudgetId string `json:"-" url:"-"` } type UpdateBudgetConfigurationResponse struct { // The updated budget. - // Wire name: 'budget' Budget *BudgetConfiguration `json:"budget,omitempty"` } -func (st *UpdateBudgetConfigurationResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateBudgetConfigurationResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateBudgetConfigurationResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateBudgetConfigurationResponse) MarshalJSON() ([]byte, error) { - pb, err := updateBudgetConfigurationResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Update a budget policy type UpdateBudgetPolicyRequest struct { // DEPRECATED. This is redundant field as LimitConfig is part of the // BudgetPolicy - LimitConfig *LimitConfig `json:"-" tf:"-"` + LimitConfig *LimitConfig `json:"-" url:"limit_config,omitempty"` // Contains the BudgetPolicy details. - // Wire name: 'policy' Policy BudgetPolicy `json:"policy"` // The Id of the policy. This field is generated by Databricks and globally // unique. - PolicyId string `json:"-" tf:"-"` -} - -func (st *UpdateBudgetPolicyRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateBudgetPolicyRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateBudgetPolicyRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateBudgetPolicyRequest) MarshalJSON() ([]byte, error) { - pb, err := updateBudgetPolicyRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + PolicyId string `json:"-" url:"-"` } // * Update Log Delivery Configuration type UpdateLogDeliveryConfigurationStatusRequest struct { // The log delivery configuration id of customer - LogDeliveryConfigurationId string `json:"-" tf:"-"` + LogDeliveryConfigurationId string `json:"-" url:"-"` // Status of log delivery configuration. Set to `ENABLED` (enabled) or // `DISABLED` (disabled). Defaults to `ENABLED`. You can [enable or disable // the configuration](#operation/patch-log-delivery-config-status) later. // Deletion of a configuration is not supported, so disable a log delivery // configuration that is no longer needed. - // Wire name: 'status' Status LogDeliveryConfigStatus `json:"status"` } -func (st *UpdateLogDeliveryConfigurationStatusRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateLogDeliveryConfigurationStatusRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateLogDeliveryConfigurationStatusRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateLogDeliveryConfigurationStatusRequest) MarshalJSON() ([]byte, error) { - pb, err := updateLogDeliveryConfigurationStatusRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type UsageDashboardType string const UsageDashboardTypeUsageDashboardTypeGlobal UsageDashboardType = `USAGE_DASHBOARD_TYPE_GLOBAL` @@ -2294,99 +1243,28 @@ func (f *UsageDashboardType) Type() string { // * Properties of the new log delivery configuration. type WrappedCreateLogDeliveryConfiguration struct { // * Log Delivery Configuration - // Wire name: 'log_delivery_configuration' LogDeliveryConfiguration CreateLogDeliveryConfigurationParams `json:"log_delivery_configuration"` } -func (st *WrappedCreateLogDeliveryConfiguration) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &wrappedCreateLogDeliveryConfigurationPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := wrappedCreateLogDeliveryConfigurationFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st WrappedCreateLogDeliveryConfiguration) MarshalJSON() ([]byte, error) { - pb, err := wrappedCreateLogDeliveryConfigurationToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type WrappedLogDeliveryConfiguration struct { // The created log delivery configuration - // Wire name: 'log_delivery_configuration' LogDeliveryConfiguration *LogDeliveryConfiguration `json:"log_delivery_configuration,omitempty"` } -func (st *WrappedLogDeliveryConfiguration) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &wrappedLogDeliveryConfigurationPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := wrappedLogDeliveryConfigurationFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st WrappedLogDeliveryConfiguration) MarshalJSON() ([]byte, error) { - pb, err := wrappedLogDeliveryConfigurationToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type WrappedLogDeliveryConfigurations struct { // Log delivery configurations were returned successfully. - // Wire name: 'log_delivery_configurations' LogDeliveryConfigurations []LogDeliveryConfiguration `json:"log_delivery_configurations,omitempty"` // Token which can be sent as `page_token` to retrieve the next page of // results. If this field is omitted, there are no subsequent budgets. - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *WrappedLogDeliveryConfigurations) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &wrappedLogDeliveryConfigurationsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := wrappedLogDeliveryConfigurationsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *WrappedLogDeliveryConfigurations) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st WrappedLogDeliveryConfigurations) MarshalJSON() ([]byte, error) { - pb, err := wrappedLogDeliveryConfigurationsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s WrappedLogDeliveryConfigurations) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } diff --git a/service/catalog/impl.go b/service/catalog/impl.go index 6be9d4844..4545ea223 100755 --- a/service/catalog/impl.go +++ b/service/catalog/impl.go @@ -18,92 +18,34 @@ type accountMetastoreAssignmentsImpl struct { } func (a *accountMetastoreAssignmentsImpl) Create(ctx context.Context, request AccountsCreateMetastoreAssignment) error { - - requestPb, pbErr := accountsCreateMetastoreAssignmentToPb(&request) - if pbErr != nil { - return pbErr - } - - var createResponsePb createResponsePb - path := fmt.Sprintf("/api/2.0/accounts/%v/workspaces/%v/metastores/%v", a.client.ConfiguredAccountID(), requestPb.WorkspaceId, requestPb.MetastoreId) + var createResponse CreateResponse + path := fmt.Sprintf("/api/2.0/accounts/%v/workspaces/%v/metastores/%v", a.client.ConfiguredAccountID(), request.WorkspaceId, request.MetastoreId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &createResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &createResponse) return err } func (a *accountMetastoreAssignmentsImpl) Delete(ctx context.Context, request DeleteAccountMetastoreAssignmentRequest) error { - - requestPb, pbErr := deleteAccountMetastoreAssignmentRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteResponsePb deleteResponsePb - path := fmt.Sprintf("/api/2.0/accounts/%v/workspaces/%v/metastores/%v", a.client.ConfiguredAccountID(), requestPb.WorkspaceId, requestPb.MetastoreId) + var deleteResponse DeleteResponse + path := fmt.Sprintf("/api/2.0/accounts/%v/workspaces/%v/metastores/%v", a.client.ConfiguredAccountID(), request.WorkspaceId, request.MetastoreId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteResponse) return err } func (a *accountMetastoreAssignmentsImpl) Get(ctx context.Context, request GetAccountMetastoreAssignmentRequest) (*AccountsMetastoreAssignment, error) { - - requestPb, pbErr := getAccountMetastoreAssignmentRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var accountsMetastoreAssignmentPb accountsMetastoreAssignmentPb - path := fmt.Sprintf("/api/2.0/accounts/%v/workspaces/%v/metastore", a.client.ConfiguredAccountID(), requestPb.WorkspaceId) + var accountsMetastoreAssignment AccountsMetastoreAssignment + path := fmt.Sprintf("/api/2.0/accounts/%v/workspaces/%v/metastore", a.client.ConfiguredAccountID(), request.WorkspaceId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &accountsMetastoreAssignmentPb, - ) - if err != nil { - return nil, err - } - resp, err := accountsMetastoreAssignmentFromPb(&accountsMetastoreAssignmentPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &accountsMetastoreAssignment) + return &accountsMetastoreAssignment, err } // Gets a list of all Databricks workspace IDs that have been assigned to given @@ -134,63 +76,23 @@ func (a *accountMetastoreAssignmentsImpl) ListAll(ctx context.Context, request L } func (a *accountMetastoreAssignmentsImpl) internalList(ctx context.Context, request ListAccountMetastoreAssignmentsRequest) (*ListAccountMetastoreAssignmentsResponse, error) { - - requestPb, pbErr := listAccountMetastoreAssignmentsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listAccountMetastoreAssignmentsResponsePb listAccountMetastoreAssignmentsResponsePb - path := fmt.Sprintf("/api/2.0/accounts/%v/metastores/%v/workspaces", a.client.ConfiguredAccountID(), requestPb.MetastoreId) + var listAccountMetastoreAssignmentsResponse ListAccountMetastoreAssignmentsResponse + path := fmt.Sprintf("/api/2.0/accounts/%v/metastores/%v/workspaces", a.client.ConfiguredAccountID(), request.MetastoreId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listAccountMetastoreAssignmentsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listAccountMetastoreAssignmentsResponseFromPb(&listAccountMetastoreAssignmentsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listAccountMetastoreAssignmentsResponse) + return &listAccountMetastoreAssignmentsResponse, err } func (a *accountMetastoreAssignmentsImpl) Update(ctx context.Context, request AccountsUpdateMetastoreAssignment) error { - - requestPb, pbErr := accountsUpdateMetastoreAssignmentToPb(&request) - if pbErr != nil { - return pbErr - } - - var updateResponsePb updateResponsePb - path := fmt.Sprintf("/api/2.0/accounts/%v/workspaces/%v/metastores/%v", a.client.ConfiguredAccountID(), requestPb.WorkspaceId, requestPb.MetastoreId) + var updateResponse UpdateResponse + path := fmt.Sprintf("/api/2.0/accounts/%v/workspaces/%v/metastores/%v", a.client.ConfiguredAccountID(), request.WorkspaceId, request.MetastoreId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPut, - path, - headers, - queryParams, - (*requestPb), - &updateResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &updateResponse) return err } @@ -200,96 +102,34 @@ type accountMetastoresImpl struct { } func (a *accountMetastoresImpl) Create(ctx context.Context, request AccountsCreateMetastore) (*AccountsMetastoreInfo, error) { - - requestPb, pbErr := accountsCreateMetastoreToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var accountsMetastoreInfoPb accountsMetastoreInfoPb + var accountsMetastoreInfo AccountsMetastoreInfo path := fmt.Sprintf("/api/2.0/accounts/%v/metastores", a.client.ConfiguredAccountID()) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &accountsMetastoreInfoPb, - ) - if err != nil { - return nil, err - } - resp, err := accountsMetastoreInfoFromPb(&accountsMetastoreInfoPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &accountsMetastoreInfo) + return &accountsMetastoreInfo, err } func (a *accountMetastoresImpl) Delete(ctx context.Context, request DeleteAccountMetastoreRequest) error { - - requestPb, pbErr := deleteAccountMetastoreRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteResponsePb deleteResponsePb - path := fmt.Sprintf("/api/2.0/accounts/%v/metastores/%v", a.client.ConfiguredAccountID(), requestPb.MetastoreId) + var deleteResponse DeleteResponse + path := fmt.Sprintf("/api/2.0/accounts/%v/metastores/%v", a.client.ConfiguredAccountID(), request.MetastoreId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteResponse) return err } func (a *accountMetastoresImpl) Get(ctx context.Context, request GetAccountMetastoreRequest) (*AccountsMetastoreInfo, error) { - - requestPb, pbErr := getAccountMetastoreRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var accountsMetastoreInfoPb accountsMetastoreInfoPb - path := fmt.Sprintf("/api/2.0/accounts/%v/metastores/%v", a.client.ConfiguredAccountID(), requestPb.MetastoreId) + var accountsMetastoreInfo AccountsMetastoreInfo + path := fmt.Sprintf("/api/2.0/accounts/%v/metastores/%v", a.client.ConfiguredAccountID(), request.MetastoreId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &accountsMetastoreInfoPb, - ) - if err != nil { - return nil, err - } - resp, err := accountsMetastoreInfoFromPb(&accountsMetastoreInfoPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &accountsMetastoreInfo) + return &accountsMetastoreInfo, err } // Gets all Unity Catalog metastores associated with an account specified by ID. @@ -319,63 +159,24 @@ func (a *accountMetastoresImpl) ListAll(ctx context.Context) ([]MetastoreInfo, e } func (a *accountMetastoresImpl) internalList(ctx context.Context) (*ListMetastoresResponse, error) { - - var listMetastoresResponsePb listMetastoresResponsePb + var listMetastoresResponse ListMetastoresResponse path := fmt.Sprintf("/api/2.0/accounts/%v/metastores", a.client.ConfiguredAccountID()) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - nil, - nil, - &listMetastoresResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listMetastoresResponseFromPb(&listMetastoresResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, nil, nil, &listMetastoresResponse) + return &listMetastoresResponse, err } func (a *accountMetastoresImpl) Update(ctx context.Context, request AccountsUpdateMetastore) (*AccountsMetastoreInfo, error) { - - requestPb, pbErr := accountsUpdateMetastoreToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var accountsMetastoreInfoPb accountsMetastoreInfoPb - path := fmt.Sprintf("/api/2.0/accounts/%v/metastores/%v", a.client.ConfiguredAccountID(), requestPb.MetastoreId) + var accountsMetastoreInfo AccountsMetastoreInfo + path := fmt.Sprintf("/api/2.0/accounts/%v/metastores/%v", a.client.ConfiguredAccountID(), request.MetastoreId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPut, - path, - headers, - queryParams, - (*requestPb), - &accountsMetastoreInfoPb, - ) - if err != nil { - return nil, err - } - resp, err := accountsMetastoreInfoFromPb(&accountsMetastoreInfoPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &accountsMetastoreInfo) + return &accountsMetastoreInfo, err } // unexported type that holds implementations of just AccountStorageCredentials API methods @@ -384,96 +185,34 @@ type accountStorageCredentialsImpl struct { } func (a *accountStorageCredentialsImpl) Create(ctx context.Context, request AccountsCreateStorageCredential) (*AccountsStorageCredentialInfo, error) { - - requestPb, pbErr := accountsCreateStorageCredentialToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var accountsStorageCredentialInfoPb accountsStorageCredentialInfoPb - path := fmt.Sprintf("/api/2.0/accounts/%v/metastores/%v/storage-credentials", a.client.ConfiguredAccountID(), requestPb.MetastoreId) + var accountsStorageCredentialInfo AccountsStorageCredentialInfo + path := fmt.Sprintf("/api/2.0/accounts/%v/metastores/%v/storage-credentials", a.client.ConfiguredAccountID(), request.MetastoreId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &accountsStorageCredentialInfoPb, - ) - if err != nil { - return nil, err - } - resp, err := accountsStorageCredentialInfoFromPb(&accountsStorageCredentialInfoPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &accountsStorageCredentialInfo) + return &accountsStorageCredentialInfo, err } func (a *accountStorageCredentialsImpl) Delete(ctx context.Context, request DeleteAccountStorageCredentialRequest) error { - - requestPb, pbErr := deleteAccountStorageCredentialRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteResponsePb deleteResponsePb - path := fmt.Sprintf("/api/2.0/accounts/%v/metastores/%v/storage-credentials/%v", a.client.ConfiguredAccountID(), requestPb.MetastoreId, requestPb.StorageCredentialName) + var deleteResponse DeleteResponse + path := fmt.Sprintf("/api/2.0/accounts/%v/metastores/%v/storage-credentials/%v", a.client.ConfiguredAccountID(), request.MetastoreId, request.StorageCredentialName) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteResponse) return err } func (a *accountStorageCredentialsImpl) Get(ctx context.Context, request GetAccountStorageCredentialRequest) (*AccountsStorageCredentialInfo, error) { - - requestPb, pbErr := getAccountStorageCredentialRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var accountsStorageCredentialInfoPb accountsStorageCredentialInfoPb - path := fmt.Sprintf("/api/2.0/accounts/%v/metastores/%v/storage-credentials/%v", a.client.ConfiguredAccountID(), requestPb.MetastoreId, requestPb.StorageCredentialName) + var accountsStorageCredentialInfo AccountsStorageCredentialInfo + path := fmt.Sprintf("/api/2.0/accounts/%v/metastores/%v/storage-credentials/%v", a.client.ConfiguredAccountID(), request.MetastoreId, request.StorageCredentialName) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &accountsStorageCredentialInfoPb, - ) - if err != nil { - return nil, err - } - resp, err := accountsStorageCredentialInfoFromPb(&accountsStorageCredentialInfoPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &accountsStorageCredentialInfo) + return &accountsStorageCredentialInfo, err } // Gets a list of all storage credentials that have been assigned to given @@ -504,68 +243,24 @@ func (a *accountStorageCredentialsImpl) ListAll(ctx context.Context, request Lis } func (a *accountStorageCredentialsImpl) internalList(ctx context.Context, request ListAccountStorageCredentialsRequest) (*ListAccountStorageCredentialsResponse, error) { - - requestPb, pbErr := listAccountStorageCredentialsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listAccountStorageCredentialsResponsePb listAccountStorageCredentialsResponsePb - path := fmt.Sprintf("/api/2.0/accounts/%v/metastores/%v/storage-credentials", a.client.ConfiguredAccountID(), requestPb.MetastoreId) + var listAccountStorageCredentialsResponse ListAccountStorageCredentialsResponse + path := fmt.Sprintf("/api/2.0/accounts/%v/metastores/%v/storage-credentials", a.client.ConfiguredAccountID(), request.MetastoreId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listAccountStorageCredentialsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listAccountStorageCredentialsResponseFromPb(&listAccountStorageCredentialsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listAccountStorageCredentialsResponse) + return &listAccountStorageCredentialsResponse, err } func (a *accountStorageCredentialsImpl) Update(ctx context.Context, request AccountsUpdateStorageCredential) (*AccountsStorageCredentialInfo, error) { - - requestPb, pbErr := accountsUpdateStorageCredentialToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var accountsStorageCredentialInfoPb accountsStorageCredentialInfoPb - path := fmt.Sprintf("/api/2.0/accounts/%v/metastores/%v/storage-credentials/%v", a.client.ConfiguredAccountID(), requestPb.MetastoreId, requestPb.StorageCredentialName) + var accountsStorageCredentialInfo AccountsStorageCredentialInfo + path := fmt.Sprintf("/api/2.0/accounts/%v/metastores/%v/storage-credentials/%v", a.client.ConfiguredAccountID(), request.MetastoreId, request.StorageCredentialName) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPut, - path, - headers, - queryParams, - (*requestPb), - &accountsStorageCredentialInfoPb, - ) - if err != nil { - return nil, err - } - resp, err := accountsStorageCredentialInfoFromPb(&accountsStorageCredentialInfoPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &accountsStorageCredentialInfo) + return &accountsStorageCredentialInfo, err } // unexported type that holds implementations of just ArtifactAllowlists API methods @@ -574,68 +269,24 @@ type artifactAllowlistsImpl struct { } func (a *artifactAllowlistsImpl) Get(ctx context.Context, request GetArtifactAllowlistRequest) (*ArtifactAllowlistInfo, error) { - - requestPb, pbErr := getArtifactAllowlistRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var artifactAllowlistInfoPb artifactAllowlistInfoPb - path := fmt.Sprintf("/api/2.1/unity-catalog/artifact-allowlists/%v", requestPb.ArtifactType) + var artifactAllowlistInfo ArtifactAllowlistInfo + path := fmt.Sprintf("/api/2.1/unity-catalog/artifact-allowlists/%v", request.ArtifactType) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &artifactAllowlistInfoPb, - ) - if err != nil { - return nil, err - } - resp, err := artifactAllowlistInfoFromPb(&artifactAllowlistInfoPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &artifactAllowlistInfo) + return &artifactAllowlistInfo, err } func (a *artifactAllowlistsImpl) Update(ctx context.Context, request SetArtifactAllowlist) (*ArtifactAllowlistInfo, error) { - - requestPb, pbErr := setArtifactAllowlistToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var artifactAllowlistInfoPb artifactAllowlistInfoPb - path := fmt.Sprintf("/api/2.1/unity-catalog/artifact-allowlists/%v", requestPb.ArtifactType) + var artifactAllowlistInfo ArtifactAllowlistInfo + path := fmt.Sprintf("/api/2.1/unity-catalog/artifact-allowlists/%v", request.ArtifactType) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPut, - path, - headers, - queryParams, - (*requestPb), - &artifactAllowlistInfoPb, - ) - if err != nil { - return nil, err - } - resp, err := artifactAllowlistInfoFromPb(&artifactAllowlistInfoPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &artifactAllowlistInfo) + return &artifactAllowlistInfo, err } // unexported type that holds implementations of just Catalogs API methods @@ -644,96 +295,34 @@ type catalogsImpl struct { } func (a *catalogsImpl) Create(ctx context.Context, request CreateCatalog) (*CatalogInfo, error) { - - requestPb, pbErr := createCatalogToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var catalogInfoPb catalogInfoPb + var catalogInfo CatalogInfo path := "/api/2.1/unity-catalog/catalogs" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &catalogInfoPb, - ) - if err != nil { - return nil, err - } - resp, err := catalogInfoFromPb(&catalogInfoPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &catalogInfo) + return &catalogInfo, err } func (a *catalogsImpl) Delete(ctx context.Context, request DeleteCatalogRequest) error { - - requestPb, pbErr := deleteCatalogRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteResponsePb deleteResponsePb - path := fmt.Sprintf("/api/2.1/unity-catalog/catalogs/%v", requestPb.Name) + var deleteResponse DeleteResponse + path := fmt.Sprintf("/api/2.1/unity-catalog/catalogs/%v", request.Name) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteResponse) return err } func (a *catalogsImpl) Get(ctx context.Context, request GetCatalogRequest) (*CatalogInfo, error) { - - requestPb, pbErr := getCatalogRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var catalogInfoPb catalogInfoPb - path := fmt.Sprintf("/api/2.1/unity-catalog/catalogs/%v", requestPb.Name) + var catalogInfo CatalogInfo + path := fmt.Sprintf("/api/2.1/unity-catalog/catalogs/%v", request.Name) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &catalogInfoPb, - ) - if err != nil { - return nil, err - } - resp, err := catalogInfoFromPb(&catalogInfoPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &catalogInfo) + return &catalogInfo, err } // Gets an array of catalogs in the metastore. If the caller is the metastore @@ -776,68 +365,24 @@ func (a *catalogsImpl) ListAll(ctx context.Context, request ListCatalogsRequest) } func (a *catalogsImpl) internalList(ctx context.Context, request ListCatalogsRequest) (*ListCatalogsResponse, error) { - - requestPb, pbErr := listCatalogsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listCatalogsResponsePb listCatalogsResponsePb + var listCatalogsResponse ListCatalogsResponse path := "/api/2.1/unity-catalog/catalogs" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listCatalogsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listCatalogsResponseFromPb(&listCatalogsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listCatalogsResponse) + return &listCatalogsResponse, err } func (a *catalogsImpl) Update(ctx context.Context, request UpdateCatalog) (*CatalogInfo, error) { - - requestPb, pbErr := updateCatalogToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var catalogInfoPb catalogInfoPb - path := fmt.Sprintf("/api/2.1/unity-catalog/catalogs/%v", requestPb.Name) + var catalogInfo CatalogInfo + path := fmt.Sprintf("/api/2.1/unity-catalog/catalogs/%v", request.Name) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &catalogInfoPb, - ) - if err != nil { - return nil, err - } - resp, err := catalogInfoFromPb(&catalogInfoPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &catalogInfo) + return &catalogInfo, err } // unexported type that holds implementations of just Connections API methods @@ -846,96 +391,34 @@ type connectionsImpl struct { } func (a *connectionsImpl) Create(ctx context.Context, request CreateConnection) (*ConnectionInfo, error) { - - requestPb, pbErr := createConnectionToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var connectionInfoPb connectionInfoPb + var connectionInfo ConnectionInfo path := "/api/2.1/unity-catalog/connections" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &connectionInfoPb, - ) - if err != nil { - return nil, err - } - resp, err := connectionInfoFromPb(&connectionInfoPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &connectionInfo) + return &connectionInfo, err } func (a *connectionsImpl) Delete(ctx context.Context, request DeleteConnectionRequest) error { - - requestPb, pbErr := deleteConnectionRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteResponsePb deleteResponsePb - path := fmt.Sprintf("/api/2.1/unity-catalog/connections/%v", requestPb.Name) + var deleteResponse DeleteResponse + path := fmt.Sprintf("/api/2.1/unity-catalog/connections/%v", request.Name) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteResponse) return err } func (a *connectionsImpl) Get(ctx context.Context, request GetConnectionRequest) (*ConnectionInfo, error) { - - requestPb, pbErr := getConnectionRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var connectionInfoPb connectionInfoPb - path := fmt.Sprintf("/api/2.1/unity-catalog/connections/%v", requestPb.Name) + var connectionInfo ConnectionInfo + path := fmt.Sprintf("/api/2.1/unity-catalog/connections/%v", request.Name) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &connectionInfoPb, - ) - if err != nil { - return nil, err - } - resp, err := connectionInfoFromPb(&connectionInfoPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &connectionInfo) + return &connectionInfo, err } // List all connections. @@ -970,68 +453,24 @@ func (a *connectionsImpl) ListAll(ctx context.Context, request ListConnectionsRe } func (a *connectionsImpl) internalList(ctx context.Context, request ListConnectionsRequest) (*ListConnectionsResponse, error) { - - requestPb, pbErr := listConnectionsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listConnectionsResponsePb listConnectionsResponsePb + var listConnectionsResponse ListConnectionsResponse path := "/api/2.1/unity-catalog/connections" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listConnectionsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listConnectionsResponseFromPb(&listConnectionsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listConnectionsResponse) + return &listConnectionsResponse, err } func (a *connectionsImpl) Update(ctx context.Context, request UpdateConnection) (*ConnectionInfo, error) { - - requestPb, pbErr := updateConnectionToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var connectionInfoPb connectionInfoPb - path := fmt.Sprintf("/api/2.1/unity-catalog/connections/%v", requestPb.Name) + var connectionInfo ConnectionInfo + path := fmt.Sprintf("/api/2.1/unity-catalog/connections/%v", request.Name) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &connectionInfoPb, - ) - if err != nil { - return nil, err - } - resp, err := connectionInfoFromPb(&connectionInfoPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &connectionInfo) + return &connectionInfo, err } // unexported type that holds implementations of just Credentials API methods @@ -1040,129 +479,45 @@ type credentialsImpl struct { } func (a *credentialsImpl) CreateCredential(ctx context.Context, request CreateCredentialRequest) (*CredentialInfo, error) { - - requestPb, pbErr := createCredentialRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var credentialInfoPb credentialInfoPb + var credentialInfo CredentialInfo path := "/api/2.1/unity-catalog/credentials" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &credentialInfoPb, - ) - if err != nil { - return nil, err - } - resp, err := credentialInfoFromPb(&credentialInfoPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &credentialInfo) + return &credentialInfo, err } func (a *credentialsImpl) DeleteCredential(ctx context.Context, request DeleteCredentialRequest) error { - - requestPb, pbErr := deleteCredentialRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteCredentialResponsePb deleteCredentialResponsePb - path := fmt.Sprintf("/api/2.1/unity-catalog/credentials/%v", requestPb.NameArg) + var deleteCredentialResponse DeleteCredentialResponse + path := fmt.Sprintf("/api/2.1/unity-catalog/credentials/%v", request.NameArg) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteCredentialResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteCredentialResponse) return err } func (a *credentialsImpl) GenerateTemporaryServiceCredential(ctx context.Context, request GenerateTemporaryServiceCredentialRequest) (*TemporaryCredentials, error) { - - requestPb, pbErr := generateTemporaryServiceCredentialRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var temporaryCredentialsPb temporaryCredentialsPb + var temporaryCredentials TemporaryCredentials path := "/api/2.1/unity-catalog/temporary-service-credentials" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &temporaryCredentialsPb, - ) - if err != nil { - return nil, err - } - resp, err := temporaryCredentialsFromPb(&temporaryCredentialsPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &temporaryCredentials) + return &temporaryCredentials, err } func (a *credentialsImpl) GetCredential(ctx context.Context, request GetCredentialRequest) (*CredentialInfo, error) { - - requestPb, pbErr := getCredentialRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var credentialInfoPb credentialInfoPb - path := fmt.Sprintf("/api/2.1/unity-catalog/credentials/%v", requestPb.NameArg) + var credentialInfo CredentialInfo + path := fmt.Sprintf("/api/2.1/unity-catalog/credentials/%v", request.NameArg) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &credentialInfoPb, - ) - if err != nil { - return nil, err - } - resp, err := credentialInfoFromPb(&credentialInfoPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &credentialInfo) + return &credentialInfo, err } // Gets an array of credentials (as __CredentialInfo__ objects). @@ -1207,101 +562,35 @@ func (a *credentialsImpl) ListCredentialsAll(ctx context.Context, request ListCr } func (a *credentialsImpl) internalListCredentials(ctx context.Context, request ListCredentialsRequest) (*ListCredentialsResponse, error) { - - requestPb, pbErr := listCredentialsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listCredentialsResponsePb listCredentialsResponsePb + var listCredentialsResponse ListCredentialsResponse path := "/api/2.1/unity-catalog/credentials" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listCredentialsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listCredentialsResponseFromPb(&listCredentialsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listCredentialsResponse) + return &listCredentialsResponse, err } func (a *credentialsImpl) UpdateCredential(ctx context.Context, request UpdateCredentialRequest) (*CredentialInfo, error) { - - requestPb, pbErr := updateCredentialRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var credentialInfoPb credentialInfoPb - path := fmt.Sprintf("/api/2.1/unity-catalog/credentials/%v", requestPb.NameArg) + var credentialInfo CredentialInfo + path := fmt.Sprintf("/api/2.1/unity-catalog/credentials/%v", request.NameArg) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &credentialInfoPb, - ) - if err != nil { - return nil, err - } - resp, err := credentialInfoFromPb(&credentialInfoPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &credentialInfo) + return &credentialInfo, err } func (a *credentialsImpl) ValidateCredential(ctx context.Context, request ValidateCredentialRequest) (*ValidateCredentialResponse, error) { - - requestPb, pbErr := validateCredentialRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var validateCredentialResponsePb validateCredentialResponsePb + var validateCredentialResponse ValidateCredentialResponse path := "/api/2.1/unity-catalog/validate-credentials" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &validateCredentialResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := validateCredentialResponseFromPb(&validateCredentialResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &validateCredentialResponse) + return &validateCredentialResponse, err } // unexported type that holds implementations of just ExternalLocations API methods @@ -1310,96 +599,34 @@ type externalLocationsImpl struct { } func (a *externalLocationsImpl) Create(ctx context.Context, request CreateExternalLocation) (*ExternalLocationInfo, error) { - - requestPb, pbErr := createExternalLocationToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var externalLocationInfoPb externalLocationInfoPb + var externalLocationInfo ExternalLocationInfo path := "/api/2.1/unity-catalog/external-locations" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &externalLocationInfoPb, - ) - if err != nil { - return nil, err - } - resp, err := externalLocationInfoFromPb(&externalLocationInfoPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &externalLocationInfo) + return &externalLocationInfo, err } func (a *externalLocationsImpl) Delete(ctx context.Context, request DeleteExternalLocationRequest) error { - - requestPb, pbErr := deleteExternalLocationRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteResponsePb deleteResponsePb - path := fmt.Sprintf("/api/2.1/unity-catalog/external-locations/%v", requestPb.Name) + var deleteResponse DeleteResponse + path := fmt.Sprintf("/api/2.1/unity-catalog/external-locations/%v", request.Name) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteResponse) return err } func (a *externalLocationsImpl) Get(ctx context.Context, request GetExternalLocationRequest) (*ExternalLocationInfo, error) { - - requestPb, pbErr := getExternalLocationRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var externalLocationInfoPb externalLocationInfoPb - path := fmt.Sprintf("/api/2.1/unity-catalog/external-locations/%v", requestPb.Name) + var externalLocationInfo ExternalLocationInfo + path := fmt.Sprintf("/api/2.1/unity-catalog/external-locations/%v", request.Name) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &externalLocationInfoPb, - ) - if err != nil { - return nil, err - } - resp, err := externalLocationInfoFromPb(&externalLocationInfoPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &externalLocationInfo) + return &externalLocationInfo, err } // Gets an array of external locations (__ExternalLocationInfo__ objects) from @@ -1442,68 +669,24 @@ func (a *externalLocationsImpl) ListAll(ctx context.Context, request ListExterna } func (a *externalLocationsImpl) internalList(ctx context.Context, request ListExternalLocationsRequest) (*ListExternalLocationsResponse, error) { - - requestPb, pbErr := listExternalLocationsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listExternalLocationsResponsePb listExternalLocationsResponsePb + var listExternalLocationsResponse ListExternalLocationsResponse path := "/api/2.1/unity-catalog/external-locations" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listExternalLocationsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listExternalLocationsResponseFromPb(&listExternalLocationsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listExternalLocationsResponse) + return &listExternalLocationsResponse, err } func (a *externalLocationsImpl) Update(ctx context.Context, request UpdateExternalLocation) (*ExternalLocationInfo, error) { - - requestPb, pbErr := updateExternalLocationToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var externalLocationInfoPb externalLocationInfoPb - path := fmt.Sprintf("/api/2.1/unity-catalog/external-locations/%v", requestPb.Name) + var externalLocationInfo ExternalLocationInfo + path := fmt.Sprintf("/api/2.1/unity-catalog/external-locations/%v", request.Name) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &externalLocationInfoPb, - ) - if err != nil { - return nil, err - } - resp, err := externalLocationInfoFromPb(&externalLocationInfoPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &externalLocationInfo) + return &externalLocationInfo, err } // unexported type that holds implementations of just Functions API methods @@ -1512,96 +695,34 @@ type functionsImpl struct { } func (a *functionsImpl) Create(ctx context.Context, request CreateFunctionRequest) (*FunctionInfo, error) { - - requestPb, pbErr := createFunctionRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var functionInfoPb functionInfoPb + var functionInfo FunctionInfo path := "/api/2.1/unity-catalog/functions" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &functionInfoPb, - ) - if err != nil { - return nil, err - } - resp, err := functionInfoFromPb(&functionInfoPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &functionInfo) + return &functionInfo, err } func (a *functionsImpl) Delete(ctx context.Context, request DeleteFunctionRequest) error { - - requestPb, pbErr := deleteFunctionRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteResponsePb deleteResponsePb - path := fmt.Sprintf("/api/2.1/unity-catalog/functions/%v", requestPb.Name) + var deleteResponse DeleteResponse + path := fmt.Sprintf("/api/2.1/unity-catalog/functions/%v", request.Name) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteResponse) return err } func (a *functionsImpl) Get(ctx context.Context, request GetFunctionRequest) (*FunctionInfo, error) { - - requestPb, pbErr := getFunctionRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var functionInfoPb functionInfoPb - path := fmt.Sprintf("/api/2.1/unity-catalog/functions/%v", requestPb.Name) + var functionInfo FunctionInfo + path := fmt.Sprintf("/api/2.1/unity-catalog/functions/%v", request.Name) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &functionInfoPb, - ) - if err != nil { - return nil, err - } - resp, err := functionInfoFromPb(&functionInfoPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &functionInfo) + return &functionInfo, err } // List functions within the specified parent catalog and schema. If the user is @@ -1648,68 +769,24 @@ func (a *functionsImpl) ListAll(ctx context.Context, request ListFunctionsReques } func (a *functionsImpl) internalList(ctx context.Context, request ListFunctionsRequest) (*ListFunctionsResponse, error) { - - requestPb, pbErr := listFunctionsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listFunctionsResponsePb listFunctionsResponsePb + var listFunctionsResponse ListFunctionsResponse path := "/api/2.1/unity-catalog/functions" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listFunctionsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listFunctionsResponseFromPb(&listFunctionsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listFunctionsResponse) + return &listFunctionsResponse, err } func (a *functionsImpl) Update(ctx context.Context, request UpdateFunction) (*FunctionInfo, error) { - - requestPb, pbErr := updateFunctionToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var functionInfoPb functionInfoPb - path := fmt.Sprintf("/api/2.1/unity-catalog/functions/%v", requestPb.Name) + var functionInfo FunctionInfo + path := fmt.Sprintf("/api/2.1/unity-catalog/functions/%v", request.Name) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &functionInfoPb, - ) - if err != nil { - return nil, err - } - resp, err := functionInfoFromPb(&functionInfoPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &functionInfo) + return &functionInfo, err } // unexported type that holds implementations of just Grants API methods @@ -1718,100 +795,34 @@ type grantsImpl struct { } func (a *grantsImpl) Get(ctx context.Context, request GetGrantRequest) (*GetPermissionsResponse, error) { - - requestPb, pbErr := getGrantRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var getPermissionsResponsePb getPermissionsResponsePb - path := fmt.Sprintf("/api/2.1/unity-catalog/permissions/%v/%v", requestPb.SecurableType, requestPb.FullName) + var getPermissionsResponse GetPermissionsResponse + path := fmt.Sprintf("/api/2.1/unity-catalog/permissions/%v/%v", request.SecurableType, request.FullName) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &getPermissionsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := getPermissionsResponseFromPb(&getPermissionsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getPermissionsResponse) + return &getPermissionsResponse, err } func (a *grantsImpl) GetEffective(ctx context.Context, request GetEffectiveRequest) (*EffectivePermissionsList, error) { - - requestPb, pbErr := getEffectiveRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var effectivePermissionsListPb effectivePermissionsListPb - path := fmt.Sprintf("/api/2.1/unity-catalog/effective-permissions/%v/%v", requestPb.SecurableType, requestPb.FullName) + var effectivePermissionsList EffectivePermissionsList + path := fmt.Sprintf("/api/2.1/unity-catalog/effective-permissions/%v/%v", request.SecurableType, request.FullName) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &effectivePermissionsListPb, - ) - if err != nil { - return nil, err - } - resp, err := effectivePermissionsListFromPb(&effectivePermissionsListPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &effectivePermissionsList) + return &effectivePermissionsList, err } func (a *grantsImpl) Update(ctx context.Context, request UpdatePermissions) (*UpdatePermissionsResponse, error) { - - requestPb, pbErr := updatePermissionsToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var updatePermissionsResponsePb updatePermissionsResponsePb - path := fmt.Sprintf("/api/2.1/unity-catalog/permissions/%v/%v", requestPb.SecurableType, requestPb.FullName) + var updatePermissionsResponse UpdatePermissionsResponse + path := fmt.Sprintf("/api/2.1/unity-catalog/permissions/%v/%v", request.SecurableType, request.FullName) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &updatePermissionsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := updatePermissionsResponseFromPb(&updatePermissionsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &updatePermissionsResponse) + return &updatePermissionsResponse, err } // unexported type that holds implementations of just Metastores API methods @@ -1820,152 +831,55 @@ type metastoresImpl struct { } func (a *metastoresImpl) Assign(ctx context.Context, request CreateMetastoreAssignment) error { - - requestPb, pbErr := createMetastoreAssignmentToPb(&request) - if pbErr != nil { - return pbErr - } - - var assignResponsePb assignResponsePb - path := fmt.Sprintf("/api/2.1/unity-catalog/workspaces/%v/metastore", requestPb.WorkspaceId) + var assignResponse AssignResponse + path := fmt.Sprintf("/api/2.1/unity-catalog/workspaces/%v/metastore", request.WorkspaceId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPut, - path, - headers, - queryParams, - (*requestPb), - &assignResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &assignResponse) return err } func (a *metastoresImpl) Create(ctx context.Context, request CreateMetastore) (*MetastoreInfo, error) { - - requestPb, pbErr := createMetastoreToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var metastoreInfoPb metastoreInfoPb + var metastoreInfo MetastoreInfo path := "/api/2.1/unity-catalog/metastores" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &metastoreInfoPb, - ) - if err != nil { - return nil, err - } - resp, err := metastoreInfoFromPb(&metastoreInfoPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &metastoreInfo) + return &metastoreInfo, err } func (a *metastoresImpl) Current(ctx context.Context) (*MetastoreAssignment, error) { - - var metastoreAssignmentPb metastoreAssignmentPb + var metastoreAssignment MetastoreAssignment path := "/api/2.1/unity-catalog/current-metastore-assignment" headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - nil, - nil, - &metastoreAssignmentPb, - ) - if err != nil { - return nil, err - } - resp, err := metastoreAssignmentFromPb(&metastoreAssignmentPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, nil, nil, &metastoreAssignment) + return &metastoreAssignment, err } func (a *metastoresImpl) Delete(ctx context.Context, request DeleteMetastoreRequest) error { - - requestPb, pbErr := deleteMetastoreRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteResponsePb deleteResponsePb - path := fmt.Sprintf("/api/2.1/unity-catalog/metastores/%v", requestPb.Id) + var deleteResponse DeleteResponse + path := fmt.Sprintf("/api/2.1/unity-catalog/metastores/%v", request.Id) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteResponse) return err } func (a *metastoresImpl) Get(ctx context.Context, request GetMetastoreRequest) (*MetastoreInfo, error) { - - requestPb, pbErr := getMetastoreRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var metastoreInfoPb metastoreInfoPb - path := fmt.Sprintf("/api/2.1/unity-catalog/metastores/%v", requestPb.Id) + var metastoreInfo MetastoreInfo + path := fmt.Sprintf("/api/2.1/unity-catalog/metastores/%v", request.Id) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &metastoreInfoPb, - ) - if err != nil { - return nil, err - } - resp, err := metastoreInfoFromPb(&metastoreInfoPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &metastoreInfo) + return &metastoreInfo, err } // Gets an array of the available metastores (as __MetastoreInfo__ objects). The @@ -2004,151 +918,54 @@ func (a *metastoresImpl) ListAll(ctx context.Context, request ListMetastoresRequ } func (a *metastoresImpl) internalList(ctx context.Context, request ListMetastoresRequest) (*ListMetastoresResponse, error) { - - requestPb, pbErr := listMetastoresRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listMetastoresResponsePb listMetastoresResponsePb + var listMetastoresResponse ListMetastoresResponse path := "/api/2.1/unity-catalog/metastores" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listMetastoresResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listMetastoresResponseFromPb(&listMetastoresResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listMetastoresResponse) + return &listMetastoresResponse, err } func (a *metastoresImpl) Summary(ctx context.Context) (*GetMetastoreSummaryResponse, error) { - - var getMetastoreSummaryResponsePb getMetastoreSummaryResponsePb + var getMetastoreSummaryResponse GetMetastoreSummaryResponse path := "/api/2.1/unity-catalog/metastore_summary" headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - nil, - nil, - &getMetastoreSummaryResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := getMetastoreSummaryResponseFromPb(&getMetastoreSummaryResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, nil, nil, &getMetastoreSummaryResponse) + return &getMetastoreSummaryResponse, err } func (a *metastoresImpl) Unassign(ctx context.Context, request UnassignRequest) error { - - requestPb, pbErr := unassignRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var unassignResponsePb unassignResponsePb - path := fmt.Sprintf("/api/2.1/unity-catalog/workspaces/%v/metastore", requestPb.WorkspaceId) + var unassignResponse UnassignResponse + path := fmt.Sprintf("/api/2.1/unity-catalog/workspaces/%v/metastore", request.WorkspaceId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &unassignResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &unassignResponse) return err } func (a *metastoresImpl) Update(ctx context.Context, request UpdateMetastore) (*MetastoreInfo, error) { - - requestPb, pbErr := updateMetastoreToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var metastoreInfoPb metastoreInfoPb - path := fmt.Sprintf("/api/2.1/unity-catalog/metastores/%v", requestPb.Id) + var metastoreInfo MetastoreInfo + path := fmt.Sprintf("/api/2.1/unity-catalog/metastores/%v", request.Id) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &metastoreInfoPb, - ) - if err != nil { - return nil, err - } - resp, err := metastoreInfoFromPb(&metastoreInfoPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &metastoreInfo) + return &metastoreInfo, err } func (a *metastoresImpl) UpdateAssignment(ctx context.Context, request UpdateMetastoreAssignment) error { - - requestPb, pbErr := updateMetastoreAssignmentToPb(&request) - if pbErr != nil { - return pbErr - } - - var updateAssignmentResponsePb updateAssignmentResponsePb - path := fmt.Sprintf("/api/2.1/unity-catalog/workspaces/%v/metastore", requestPb.WorkspaceId) + var updateAssignmentResponse UpdateAssignmentResponse + path := fmt.Sprintf("/api/2.1/unity-catalog/workspaces/%v/metastore", request.WorkspaceId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &updateAssignmentResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &updateAssignmentResponse) return err } @@ -2158,94 +975,32 @@ type modelVersionsImpl struct { } func (a *modelVersionsImpl) Delete(ctx context.Context, request DeleteModelVersionRequest) error { - - requestPb, pbErr := deleteModelVersionRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteResponsePb deleteResponsePb - path := fmt.Sprintf("/api/2.1/unity-catalog/models/%v/versions/%v", requestPb.FullName, requestPb.Version) + var deleteResponse DeleteResponse + path := fmt.Sprintf("/api/2.1/unity-catalog/models/%v/versions/%v", request.FullName, request.Version) queryParams := make(map[string]any) headers := make(map[string]string) - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteResponse) return err } func (a *modelVersionsImpl) Get(ctx context.Context, request GetModelVersionRequest) (*ModelVersionInfo, error) { - - requestPb, pbErr := getModelVersionRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var modelVersionInfoPb modelVersionInfoPb - path := fmt.Sprintf("/api/2.1/unity-catalog/models/%v/versions/%v", requestPb.FullName, requestPb.Version) + var modelVersionInfo ModelVersionInfo + path := fmt.Sprintf("/api/2.1/unity-catalog/models/%v/versions/%v", request.FullName, request.Version) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &modelVersionInfoPb, - ) - if err != nil { - return nil, err - } - resp, err := modelVersionInfoFromPb(&modelVersionInfoPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &modelVersionInfo) + return &modelVersionInfo, err } func (a *modelVersionsImpl) GetByAlias(ctx context.Context, request GetByAliasRequest) (*ModelVersionInfo, error) { - - requestPb, pbErr := getByAliasRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var modelVersionInfoPb modelVersionInfoPb - path := fmt.Sprintf("/api/2.1/unity-catalog/models/%v/aliases/%v", requestPb.FullName, requestPb.Alias) + var modelVersionInfo ModelVersionInfo + path := fmt.Sprintf("/api/2.1/unity-catalog/models/%v/aliases/%v", request.FullName, request.Alias) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &modelVersionInfoPb, - ) - if err != nil { - return nil, err - } - resp, err := modelVersionInfoFromPb(&modelVersionInfoPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &modelVersionInfo) + return &modelVersionInfo, err } // List model versions. You can list model versions under a particular schema, @@ -2304,68 +1059,24 @@ func (a *modelVersionsImpl) ListAll(ctx context.Context, request ListModelVersio } func (a *modelVersionsImpl) internalList(ctx context.Context, request ListModelVersionsRequest) (*ListModelVersionsResponse, error) { - - requestPb, pbErr := listModelVersionsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listModelVersionsResponsePb listModelVersionsResponsePb - path := fmt.Sprintf("/api/2.1/unity-catalog/models/%v/versions", requestPb.FullName) + var listModelVersionsResponse ListModelVersionsResponse + path := fmt.Sprintf("/api/2.1/unity-catalog/models/%v/versions", request.FullName) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listModelVersionsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listModelVersionsResponseFromPb(&listModelVersionsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listModelVersionsResponse) + return &listModelVersionsResponse, err } func (a *modelVersionsImpl) Update(ctx context.Context, request UpdateModelVersionRequest) (*ModelVersionInfo, error) { - - requestPb, pbErr := updateModelVersionRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var modelVersionInfoPb modelVersionInfoPb - path := fmt.Sprintf("/api/2.1/unity-catalog/models/%v/versions/%v", requestPb.FullName, requestPb.Version) + var modelVersionInfo ModelVersionInfo + path := fmt.Sprintf("/api/2.1/unity-catalog/models/%v/versions/%v", request.FullName, request.Version) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &modelVersionInfoPb, - ) - if err != nil { - return nil, err - } - resp, err := modelVersionInfoFromPb(&modelVersionInfoPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &modelVersionInfo) + return &modelVersionInfo, err } // unexported type that holds implementations of just OnlineTables API methods @@ -2374,96 +1085,34 @@ type onlineTablesImpl struct { } func (a *onlineTablesImpl) Create(ctx context.Context, request CreateOnlineTableRequest) (*OnlineTable, error) { - - requestPb, pbErr := createOnlineTableRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var onlineTablePb onlineTablePb + var onlineTable OnlineTable path := "/api/2.0/online-tables" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb).Table, - &onlineTablePb, - ) - if err != nil { - return nil, err - } - resp, err := onlineTableFromPb(&onlineTablePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.Table, &onlineTable) + return &onlineTable, err } func (a *onlineTablesImpl) Delete(ctx context.Context, request DeleteOnlineTableRequest) error { - - requestPb, pbErr := deleteOnlineTableRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteResponsePb deleteResponsePb - path := fmt.Sprintf("/api/2.0/online-tables/%v", requestPb.Name) + var deleteResponse DeleteResponse + path := fmt.Sprintf("/api/2.0/online-tables/%v", request.Name) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteResponse) return err } func (a *onlineTablesImpl) Get(ctx context.Context, request GetOnlineTableRequest) (*OnlineTable, error) { - - requestPb, pbErr := getOnlineTableRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var onlineTablePb onlineTablePb - path := fmt.Sprintf("/api/2.0/online-tables/%v", requestPb.Name) + var onlineTable OnlineTable + path := fmt.Sprintf("/api/2.0/online-tables/%v", request.Name) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &onlineTablePb, - ) - if err != nil { - return nil, err - } - resp, err := onlineTableFromPb(&onlineTablePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &onlineTable) + return &onlineTable, err } // unexported type that holds implementations of just QualityMonitors API methods @@ -2472,284 +1121,94 @@ type qualityMonitorsImpl struct { } func (a *qualityMonitorsImpl) CancelRefresh(ctx context.Context, request CancelRefreshRequest) error { - - requestPb, pbErr := cancelRefreshRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var cancelRefreshResponsePb cancelRefreshResponsePb - path := fmt.Sprintf("/api/2.1/unity-catalog/tables/%v/monitor/refreshes/%v/cancel", requestPb.TableName, requestPb.RefreshId) + var cancelRefreshResponse CancelRefreshResponse + path := fmt.Sprintf("/api/2.1/unity-catalog/tables/%v/monitor/refreshes/%v/cancel", request.TableName, request.RefreshId) queryParams := make(map[string]any) headers := make(map[string]string) - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - nil, - &cancelRefreshResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, nil, &cancelRefreshResponse) return err } func (a *qualityMonitorsImpl) Create(ctx context.Context, request CreateMonitor) (*MonitorInfo, error) { - - requestPb, pbErr := createMonitorToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var monitorInfoPb monitorInfoPb - path := fmt.Sprintf("/api/2.1/unity-catalog/tables/%v/monitor", requestPb.TableName) + var monitorInfo MonitorInfo + path := fmt.Sprintf("/api/2.1/unity-catalog/tables/%v/monitor", request.TableName) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &monitorInfoPb, - ) - if err != nil { - return nil, err - } - resp, err := monitorInfoFromPb(&monitorInfoPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &monitorInfo) + return &monitorInfo, err } func (a *qualityMonitorsImpl) Delete(ctx context.Context, request DeleteQualityMonitorRequest) error { - - requestPb, pbErr := deleteQualityMonitorRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteResponsePb deleteResponsePb - path := fmt.Sprintf("/api/2.1/unity-catalog/tables/%v/monitor", requestPb.TableName) + var deleteResponse DeleteResponse + path := fmt.Sprintf("/api/2.1/unity-catalog/tables/%v/monitor", request.TableName) queryParams := make(map[string]any) headers := make(map[string]string) - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteResponse) return err } func (a *qualityMonitorsImpl) Get(ctx context.Context, request GetQualityMonitorRequest) (*MonitorInfo, error) { - - requestPb, pbErr := getQualityMonitorRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var monitorInfoPb monitorInfoPb - path := fmt.Sprintf("/api/2.1/unity-catalog/tables/%v/monitor", requestPb.TableName) + var monitorInfo MonitorInfo + path := fmt.Sprintf("/api/2.1/unity-catalog/tables/%v/monitor", request.TableName) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &monitorInfoPb, - ) - if err != nil { - return nil, err - } - resp, err := monitorInfoFromPb(&monitorInfoPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &monitorInfo) + return &monitorInfo, err } func (a *qualityMonitorsImpl) GetRefresh(ctx context.Context, request GetRefreshRequest) (*MonitorRefreshInfo, error) { - - requestPb, pbErr := getRefreshRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var monitorRefreshInfoPb monitorRefreshInfoPb - path := fmt.Sprintf("/api/2.1/unity-catalog/tables/%v/monitor/refreshes/%v", requestPb.TableName, requestPb.RefreshId) + var monitorRefreshInfo MonitorRefreshInfo + path := fmt.Sprintf("/api/2.1/unity-catalog/tables/%v/monitor/refreshes/%v", request.TableName, request.RefreshId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &monitorRefreshInfoPb, - ) - if err != nil { - return nil, err - } - resp, err := monitorRefreshInfoFromPb(&monitorRefreshInfoPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &monitorRefreshInfo) + return &monitorRefreshInfo, err } func (a *qualityMonitorsImpl) ListRefreshes(ctx context.Context, request ListRefreshesRequest) (*MonitorRefreshListResponse, error) { - - requestPb, pbErr := listRefreshesRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var monitorRefreshListResponsePb monitorRefreshListResponsePb - path := fmt.Sprintf("/api/2.1/unity-catalog/tables/%v/monitor/refreshes", requestPb.TableName) + var monitorRefreshListResponse MonitorRefreshListResponse + path := fmt.Sprintf("/api/2.1/unity-catalog/tables/%v/monitor/refreshes", request.TableName) queryParams := make(map[string]any) - headers := make(map[string]string) - headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &monitorRefreshListResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := monitorRefreshListResponseFromPb(&monitorRefreshListResponsePb) - if err != nil { - return nil, err - } - - return resp, err + headers := make(map[string]string) + headers["Accept"] = "application/json" + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &monitorRefreshListResponse) + return &monitorRefreshListResponse, err } func (a *qualityMonitorsImpl) RegenerateDashboard(ctx context.Context, request RegenerateDashboardRequest) (*RegenerateDashboardResponse, error) { - - requestPb, pbErr := regenerateDashboardRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var regenerateDashboardResponsePb regenerateDashboardResponsePb - path := fmt.Sprintf("/api/2.1/quality-monitoring/tables/%v/monitor/dashboard", requestPb.TableName) + var regenerateDashboardResponse RegenerateDashboardResponse + path := fmt.Sprintf("/api/2.1/quality-monitoring/tables/%v/monitor/dashboard", request.TableName) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - ®enerateDashboardResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := regenerateDashboardResponseFromPb(®enerateDashboardResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, ®enerateDashboardResponse) + return ®enerateDashboardResponse, err } func (a *qualityMonitorsImpl) RunRefresh(ctx context.Context, request RunRefreshRequest) (*MonitorRefreshInfo, error) { - - requestPb, pbErr := runRefreshRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var monitorRefreshInfoPb monitorRefreshInfoPb - path := fmt.Sprintf("/api/2.1/unity-catalog/tables/%v/monitor/refreshes", requestPb.TableName) + var monitorRefreshInfo MonitorRefreshInfo + path := fmt.Sprintf("/api/2.1/unity-catalog/tables/%v/monitor/refreshes", request.TableName) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - nil, - &monitorRefreshInfoPb, - ) - if err != nil { - return nil, err - } - resp, err := monitorRefreshInfoFromPb(&monitorRefreshInfoPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, nil, &monitorRefreshInfo) + return &monitorRefreshInfo, err } func (a *qualityMonitorsImpl) Update(ctx context.Context, request UpdateMonitor) (*MonitorInfo, error) { - - requestPb, pbErr := updateMonitorToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var monitorInfoPb monitorInfoPb - path := fmt.Sprintf("/api/2.1/unity-catalog/tables/%v/monitor", requestPb.TableName) + var monitorInfo MonitorInfo + path := fmt.Sprintf("/api/2.1/unity-catalog/tables/%v/monitor", request.TableName) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPut, - path, - headers, - queryParams, - (*requestPb), - &monitorInfoPb, - ) - if err != nil { - return nil, err - } - resp, err := monitorInfoFromPb(&monitorInfoPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &monitorInfo) + return &monitorInfo, err } // unexported type that holds implementations of just RegisteredModels API methods @@ -2758,122 +1217,42 @@ type registeredModelsImpl struct { } func (a *registeredModelsImpl) Create(ctx context.Context, request CreateRegisteredModelRequest) (*RegisteredModelInfo, error) { - - requestPb, pbErr := createRegisteredModelRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var registeredModelInfoPb registeredModelInfoPb + var registeredModelInfo RegisteredModelInfo path := "/api/2.1/unity-catalog/models" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - ®isteredModelInfoPb, - ) - if err != nil { - return nil, err - } - resp, err := registeredModelInfoFromPb(®isteredModelInfoPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, ®isteredModelInfo) + return ®isteredModelInfo, err } func (a *registeredModelsImpl) Delete(ctx context.Context, request DeleteRegisteredModelRequest) error { - - requestPb, pbErr := deleteRegisteredModelRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteResponsePb deleteResponsePb - path := fmt.Sprintf("/api/2.1/unity-catalog/models/%v", requestPb.FullName) + var deleteResponse DeleteResponse + path := fmt.Sprintf("/api/2.1/unity-catalog/models/%v", request.FullName) queryParams := make(map[string]any) headers := make(map[string]string) - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteResponse) return err } func (a *registeredModelsImpl) DeleteAlias(ctx context.Context, request DeleteAliasRequest) error { - - requestPb, pbErr := deleteAliasRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteAliasResponsePb deleteAliasResponsePb - path := fmt.Sprintf("/api/2.1/unity-catalog/models/%v/aliases/%v", requestPb.FullName, requestPb.Alias) + var deleteAliasResponse DeleteAliasResponse + path := fmt.Sprintf("/api/2.1/unity-catalog/models/%v/aliases/%v", request.FullName, request.Alias) queryParams := make(map[string]any) headers := make(map[string]string) - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteAliasResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteAliasResponse) return err } func (a *registeredModelsImpl) Get(ctx context.Context, request GetRegisteredModelRequest) (*RegisteredModelInfo, error) { - - requestPb, pbErr := getRegisteredModelRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var registeredModelInfoPb registeredModelInfoPb - path := fmt.Sprintf("/api/2.1/unity-catalog/models/%v", requestPb.FullName) + var registeredModelInfo RegisteredModelInfo + path := fmt.Sprintf("/api/2.1/unity-catalog/models/%v", request.FullName) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - ®isteredModelInfoPb, - ) - if err != nil { - return nil, err - } - resp, err := registeredModelInfoFromPb(®isteredModelInfoPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, ®isteredModelInfo) + return ®isteredModelInfo, err } // List registered models. You can list registered models under a particular @@ -2930,101 +1309,35 @@ func (a *registeredModelsImpl) ListAll(ctx context.Context, request ListRegister } func (a *registeredModelsImpl) internalList(ctx context.Context, request ListRegisteredModelsRequest) (*ListRegisteredModelsResponse, error) { - - requestPb, pbErr := listRegisteredModelsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listRegisteredModelsResponsePb listRegisteredModelsResponsePb + var listRegisteredModelsResponse ListRegisteredModelsResponse path := "/api/2.1/unity-catalog/models" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listRegisteredModelsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listRegisteredModelsResponseFromPb(&listRegisteredModelsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listRegisteredModelsResponse) + return &listRegisteredModelsResponse, err } func (a *registeredModelsImpl) SetAlias(ctx context.Context, request SetRegisteredModelAliasRequest) (*RegisteredModelAlias, error) { - - requestPb, pbErr := setRegisteredModelAliasRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var registeredModelAliasPb registeredModelAliasPb - path := fmt.Sprintf("/api/2.1/unity-catalog/models/%v/aliases/%v", requestPb.FullName, requestPb.Alias) + var registeredModelAlias RegisteredModelAlias + path := fmt.Sprintf("/api/2.1/unity-catalog/models/%v/aliases/%v", request.FullName, request.Alias) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPut, - path, - headers, - queryParams, - (*requestPb), - ®isteredModelAliasPb, - ) - if err != nil { - return nil, err - } - resp, err := registeredModelAliasFromPb(®isteredModelAliasPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, ®isteredModelAlias) + return ®isteredModelAlias, err } func (a *registeredModelsImpl) Update(ctx context.Context, request UpdateRegisteredModelRequest) (*RegisteredModelInfo, error) { - - requestPb, pbErr := updateRegisteredModelRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var registeredModelInfoPb registeredModelInfoPb - path := fmt.Sprintf("/api/2.1/unity-catalog/models/%v", requestPb.FullName) + var registeredModelInfo RegisteredModelInfo + path := fmt.Sprintf("/api/2.1/unity-catalog/models/%v", request.FullName) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - ®isteredModelInfoPb, - ) - if err != nil { - return nil, err - } - resp, err := registeredModelInfoFromPb(®isteredModelInfoPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, ®isteredModelInfo) + return ®isteredModelInfo, err } // unexported type that holds implementations of just ResourceQuotas API methods @@ -3033,35 +1346,13 @@ type resourceQuotasImpl struct { } func (a *resourceQuotasImpl) GetQuota(ctx context.Context, request GetQuotaRequest) (*GetQuotaResponse, error) { - - requestPb, pbErr := getQuotaRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var getQuotaResponsePb getQuotaResponsePb - path := fmt.Sprintf("/api/2.1/unity-catalog/resource-quotas/%v/%v/%v", requestPb.ParentSecurableType, requestPb.ParentFullName, requestPb.QuotaName) + var getQuotaResponse GetQuotaResponse + path := fmt.Sprintf("/api/2.1/unity-catalog/resource-quotas/%v/%v/%v", request.ParentSecurableType, request.ParentFullName, request.QuotaName) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &getQuotaResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := getQuotaResponseFromPb(&getQuotaResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getQuotaResponse) + return &getQuotaResponse, err } // ListQuotas returns all quota values under the metastore. There are no SLAs on @@ -3100,35 +1391,13 @@ func (a *resourceQuotasImpl) ListQuotasAll(ctx context.Context, request ListQuot } func (a *resourceQuotasImpl) internalListQuotas(ctx context.Context, request ListQuotasRequest) (*ListQuotasResponse, error) { - - requestPb, pbErr := listQuotasRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listQuotasResponsePb listQuotasResponsePb + var listQuotasResponse ListQuotasResponse path := "/api/2.1/unity-catalog/resource-quotas/all-resource-quotas" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listQuotasResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listQuotasResponseFromPb(&listQuotasResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listQuotasResponse) + return &listQuotasResponse, err } // unexported type that holds implementations of just Schemas API methods @@ -3137,96 +1406,34 @@ type schemasImpl struct { } func (a *schemasImpl) Create(ctx context.Context, request CreateSchema) (*SchemaInfo, error) { - - requestPb, pbErr := createSchemaToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var schemaInfoPb schemaInfoPb + var schemaInfo SchemaInfo path := "/api/2.1/unity-catalog/schemas" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &schemaInfoPb, - ) - if err != nil { - return nil, err - } - resp, err := schemaInfoFromPb(&schemaInfoPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &schemaInfo) + return &schemaInfo, err } func (a *schemasImpl) Delete(ctx context.Context, request DeleteSchemaRequest) error { - - requestPb, pbErr := deleteSchemaRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteResponsePb deleteResponsePb - path := fmt.Sprintf("/api/2.1/unity-catalog/schemas/%v", requestPb.FullName) + var deleteResponse DeleteResponse + path := fmt.Sprintf("/api/2.1/unity-catalog/schemas/%v", request.FullName) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteResponse) return err } func (a *schemasImpl) Get(ctx context.Context, request GetSchemaRequest) (*SchemaInfo, error) { - - requestPb, pbErr := getSchemaRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var schemaInfoPb schemaInfoPb - path := fmt.Sprintf("/api/2.1/unity-catalog/schemas/%v", requestPb.FullName) + var schemaInfo SchemaInfo + path := fmt.Sprintf("/api/2.1/unity-catalog/schemas/%v", request.FullName) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &schemaInfoPb, - ) - if err != nil { - return nil, err - } - resp, err := schemaInfoFromPb(&schemaInfoPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &schemaInfo) + return &schemaInfo, err } // Gets an array of schemas for a catalog in the metastore. If the caller is the @@ -3269,68 +1476,24 @@ func (a *schemasImpl) ListAll(ctx context.Context, request ListSchemasRequest) ( } func (a *schemasImpl) internalList(ctx context.Context, request ListSchemasRequest) (*ListSchemasResponse, error) { - - requestPb, pbErr := listSchemasRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listSchemasResponsePb listSchemasResponsePb + var listSchemasResponse ListSchemasResponse path := "/api/2.1/unity-catalog/schemas" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listSchemasResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listSchemasResponseFromPb(&listSchemasResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listSchemasResponse) + return &listSchemasResponse, err } func (a *schemasImpl) Update(ctx context.Context, request UpdateSchema) (*SchemaInfo, error) { - - requestPb, pbErr := updateSchemaToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var schemaInfoPb schemaInfoPb - path := fmt.Sprintf("/api/2.1/unity-catalog/schemas/%v", requestPb.FullName) + var schemaInfo SchemaInfo + path := fmt.Sprintf("/api/2.1/unity-catalog/schemas/%v", request.FullName) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &schemaInfoPb, - ) - if err != nil { - return nil, err - } - resp, err := schemaInfoFromPb(&schemaInfoPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &schemaInfo) + return &schemaInfo, err } // unexported type that holds implementations of just StorageCredentials API methods @@ -3339,96 +1502,34 @@ type storageCredentialsImpl struct { } func (a *storageCredentialsImpl) Create(ctx context.Context, request CreateStorageCredential) (*StorageCredentialInfo, error) { - - requestPb, pbErr := createStorageCredentialToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var storageCredentialInfoPb storageCredentialInfoPb + var storageCredentialInfo StorageCredentialInfo path := "/api/2.1/unity-catalog/storage-credentials" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &storageCredentialInfoPb, - ) - if err != nil { - return nil, err - } - resp, err := storageCredentialInfoFromPb(&storageCredentialInfoPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &storageCredentialInfo) + return &storageCredentialInfo, err } func (a *storageCredentialsImpl) Delete(ctx context.Context, request DeleteStorageCredentialRequest) error { - - requestPb, pbErr := deleteStorageCredentialRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteResponsePb deleteResponsePb - path := fmt.Sprintf("/api/2.1/unity-catalog/storage-credentials/%v", requestPb.Name) + var deleteResponse DeleteResponse + path := fmt.Sprintf("/api/2.1/unity-catalog/storage-credentials/%v", request.Name) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteResponse) return err } func (a *storageCredentialsImpl) Get(ctx context.Context, request GetStorageCredentialRequest) (*StorageCredentialInfo, error) { - - requestPb, pbErr := getStorageCredentialRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var storageCredentialInfoPb storageCredentialInfoPb - path := fmt.Sprintf("/api/2.1/unity-catalog/storage-credentials/%v", requestPb.Name) + var storageCredentialInfo StorageCredentialInfo + path := fmt.Sprintf("/api/2.1/unity-catalog/storage-credentials/%v", request.Name) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &storageCredentialInfoPb, - ) - if err != nil { - return nil, err - } - resp, err := storageCredentialInfoFromPb(&storageCredentialInfoPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &storageCredentialInfo) + return &storageCredentialInfo, err } // Gets an array of storage credentials (as __StorageCredentialInfo__ objects). @@ -3471,101 +1572,35 @@ func (a *storageCredentialsImpl) ListAll(ctx context.Context, request ListStorag } func (a *storageCredentialsImpl) internalList(ctx context.Context, request ListStorageCredentialsRequest) (*ListStorageCredentialsResponse, error) { - - requestPb, pbErr := listStorageCredentialsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listStorageCredentialsResponsePb listStorageCredentialsResponsePb + var listStorageCredentialsResponse ListStorageCredentialsResponse path := "/api/2.1/unity-catalog/storage-credentials" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listStorageCredentialsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listStorageCredentialsResponseFromPb(&listStorageCredentialsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listStorageCredentialsResponse) + return &listStorageCredentialsResponse, err } func (a *storageCredentialsImpl) Update(ctx context.Context, request UpdateStorageCredential) (*StorageCredentialInfo, error) { - - requestPb, pbErr := updateStorageCredentialToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var storageCredentialInfoPb storageCredentialInfoPb - path := fmt.Sprintf("/api/2.1/unity-catalog/storage-credentials/%v", requestPb.Name) + var storageCredentialInfo StorageCredentialInfo + path := fmt.Sprintf("/api/2.1/unity-catalog/storage-credentials/%v", request.Name) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &storageCredentialInfoPb, - ) - if err != nil { - return nil, err - } - resp, err := storageCredentialInfoFromPb(&storageCredentialInfoPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &storageCredentialInfo) + return &storageCredentialInfo, err } func (a *storageCredentialsImpl) Validate(ctx context.Context, request ValidateStorageCredential) (*ValidateStorageCredentialResponse, error) { - - requestPb, pbErr := validateStorageCredentialToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var validateStorageCredentialResponsePb validateStorageCredentialResponsePb + var validateStorageCredentialResponse ValidateStorageCredentialResponse path := "/api/2.1/unity-catalog/validate-storage-credentials" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &validateStorageCredentialResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := validateStorageCredentialResponseFromPb(&validateStorageCredentialResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &validateStorageCredentialResponse) + return &validateStorageCredentialResponse, err } // unexported type that holds implementations of just SystemSchemas API methods @@ -3574,59 +1609,23 @@ type systemSchemasImpl struct { } func (a *systemSchemasImpl) Disable(ctx context.Context, request DisableRequest) error { - - requestPb, pbErr := disableRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var disableResponsePb disableResponsePb - path := fmt.Sprintf("/api/2.1/unity-catalog/metastores/%v/systemschemas/%v", requestPb.MetastoreId, requestPb.SchemaName) + var disableResponse DisableResponse + path := fmt.Sprintf("/api/2.1/unity-catalog/metastores/%v/systemschemas/%v", request.MetastoreId, request.SchemaName) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &disableResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &disableResponse) return err } func (a *systemSchemasImpl) Enable(ctx context.Context, request EnableRequest) error { - - requestPb, pbErr := enableRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var enableResponsePb enableResponsePb - path := fmt.Sprintf("/api/2.1/unity-catalog/metastores/%v/systemschemas/%v", requestPb.MetastoreId, requestPb.SchemaName) + var enableResponse EnableResponse + path := fmt.Sprintf("/api/2.1/unity-catalog/metastores/%v/systemschemas/%v", request.MetastoreId, request.SchemaName) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPut, - path, - headers, - queryParams, - (*requestPb), - &enableResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &enableResponse) return err } @@ -3664,35 +1663,13 @@ func (a *systemSchemasImpl) ListAll(ctx context.Context, request ListSystemSchem } func (a *systemSchemasImpl) internalList(ctx context.Context, request ListSystemSchemasRequest) (*ListSystemSchemasResponse, error) { - - requestPb, pbErr := listSystemSchemasRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listSystemSchemasResponsePb listSystemSchemasResponsePb - path := fmt.Sprintf("/api/2.1/unity-catalog/metastores/%v/systemschemas", requestPb.MetastoreId) + var listSystemSchemasResponse ListSystemSchemasResponse + path := fmt.Sprintf("/api/2.1/unity-catalog/metastores/%v/systemschemas", request.MetastoreId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listSystemSchemasResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listSystemSchemasResponseFromPb(&listSystemSchemasResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listSystemSchemasResponse) + return &listSystemSchemasResponse, err } // unexported type that holds implementations of just TableConstraints API methods @@ -3701,63 +1678,23 @@ type tableConstraintsImpl struct { } func (a *tableConstraintsImpl) Create(ctx context.Context, request CreateTableConstraint) (*TableConstraint, error) { - - requestPb, pbErr := createTableConstraintToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var tableConstraintPb tableConstraintPb + var tableConstraint TableConstraint path := "/api/2.1/unity-catalog/constraints" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &tableConstraintPb, - ) - if err != nil { - return nil, err - } - resp, err := tableConstraintFromPb(&tableConstraintPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &tableConstraint) + return &tableConstraint, err } func (a *tableConstraintsImpl) Delete(ctx context.Context, request DeleteTableConstraintRequest) error { - - requestPb, pbErr := deleteTableConstraintRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteResponsePb deleteResponsePb - path := fmt.Sprintf("/api/2.1/unity-catalog/constraints/%v", requestPb.FullName) + var deleteResponse DeleteResponse + path := fmt.Sprintf("/api/2.1/unity-catalog/constraints/%v", request.FullName) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteResponse) return err } @@ -3767,95 +1704,33 @@ type tablesImpl struct { } func (a *tablesImpl) Delete(ctx context.Context, request DeleteTableRequest) error { - - requestPb, pbErr := deleteTableRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteResponsePb deleteResponsePb - path := fmt.Sprintf("/api/2.1/unity-catalog/tables/%v", requestPb.FullName) + var deleteResponse DeleteResponse + path := fmt.Sprintf("/api/2.1/unity-catalog/tables/%v", request.FullName) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteResponse) return err } func (a *tablesImpl) Exists(ctx context.Context, request ExistsRequest) (*TableExistsResponse, error) { - - requestPb, pbErr := existsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var tableExistsResponsePb tableExistsResponsePb - path := fmt.Sprintf("/api/2.1/unity-catalog/tables/%v/exists", requestPb.FullName) + var tableExistsResponse TableExistsResponse + path := fmt.Sprintf("/api/2.1/unity-catalog/tables/%v/exists", request.FullName) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &tableExistsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := tableExistsResponseFromPb(&tableExistsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &tableExistsResponse) + return &tableExistsResponse, err } func (a *tablesImpl) Get(ctx context.Context, request GetTableRequest) (*TableInfo, error) { - - requestPb, pbErr := getTableRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var tableInfoPb tableInfoPb - path := fmt.Sprintf("/api/2.1/unity-catalog/tables/%v", requestPb.FullName) + var tableInfo TableInfo + path := fmt.Sprintf("/api/2.1/unity-catalog/tables/%v", request.FullName) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &tableInfoPb, - ) - if err != nil { - return nil, err - } - resp, err := tableInfoFromPb(&tableInfoPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &tableInfo) + return &tableInfo, err } // Gets an array of all tables for the current metastore under the parent @@ -3902,35 +1777,13 @@ func (a *tablesImpl) ListAll(ctx context.Context, request ListTablesRequest) ([] } func (a *tablesImpl) internalList(ctx context.Context, request ListTablesRequest) (*ListTablesResponse, error) { - - requestPb, pbErr := listTablesRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listTablesResponsePb listTablesResponsePb + var listTablesResponse ListTablesResponse path := "/api/2.1/unity-catalog/tables" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listTablesResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listTablesResponseFromPb(&listTablesResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listTablesResponse) + return &listTablesResponse, err } // Gets an array of summaries for tables for a schema and catalog within the @@ -3987,63 +1840,23 @@ func (a *tablesImpl) ListSummariesAll(ctx context.Context, request ListSummaries } func (a *tablesImpl) internalListSummaries(ctx context.Context, request ListSummariesRequest) (*ListTableSummariesResponse, error) { - - requestPb, pbErr := listSummariesRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listTableSummariesResponsePb listTableSummariesResponsePb + var listTableSummariesResponse ListTableSummariesResponse path := "/api/2.1/unity-catalog/table-summaries" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listTableSummariesResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listTableSummariesResponseFromPb(&listTableSummariesResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listTableSummariesResponse) + return &listTableSummariesResponse, err } func (a *tablesImpl) Update(ctx context.Context, request UpdateTableRequest) error { - - requestPb, pbErr := updateTableRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var updateResponsePb updateResponsePb - path := fmt.Sprintf("/api/2.1/unity-catalog/tables/%v", requestPb.FullName) + var updateResponse UpdateResponse + path := fmt.Sprintf("/api/2.1/unity-catalog/tables/%v", request.FullName) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &updateResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &updateResponse) return err } @@ -4053,36 +1866,14 @@ type temporaryTableCredentialsImpl struct { } func (a *temporaryTableCredentialsImpl) GenerateTemporaryTableCredentials(ctx context.Context, request GenerateTemporaryTableCredentialRequest) (*GenerateTemporaryTableCredentialResponse, error) { - - requestPb, pbErr := generateTemporaryTableCredentialRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var generateTemporaryTableCredentialResponsePb generateTemporaryTableCredentialResponsePb + var generateTemporaryTableCredentialResponse GenerateTemporaryTableCredentialResponse path := "/api/2.0/unity-catalog/temporary-table-credentials" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &generateTemporaryTableCredentialResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := generateTemporaryTableCredentialResponseFromPb(&generateTemporaryTableCredentialResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &generateTemporaryTableCredentialResponse) + return &generateTemporaryTableCredentialResponse, err } // unexported type that holds implementations of just Volumes API methods @@ -4091,62 +1882,22 @@ type volumesImpl struct { } func (a *volumesImpl) Create(ctx context.Context, request CreateVolumeRequestContent) (*VolumeInfo, error) { - - requestPb, pbErr := createVolumeRequestContentToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var volumeInfoPb volumeInfoPb + var volumeInfo VolumeInfo path := "/api/2.1/unity-catalog/volumes" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &volumeInfoPb, - ) - if err != nil { - return nil, err - } - resp, err := volumeInfoFromPb(&volumeInfoPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &volumeInfo) + return &volumeInfo, err } func (a *volumesImpl) Delete(ctx context.Context, request DeleteVolumeRequest) error { - - requestPb, pbErr := deleteVolumeRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteResponsePb deleteResponsePb - path := fmt.Sprintf("/api/2.1/unity-catalog/volumes/%v", requestPb.Name) + var deleteResponse DeleteResponse + path := fmt.Sprintf("/api/2.1/unity-catalog/volumes/%v", request.Name) queryParams := make(map[string]any) headers := make(map[string]string) - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteResponse) return err } @@ -4202,100 +1953,34 @@ func (a *volumesImpl) ListAll(ctx context.Context, request ListVolumesRequest) ( } func (a *volumesImpl) internalList(ctx context.Context, request ListVolumesRequest) (*ListVolumesResponseContent, error) { - - requestPb, pbErr := listVolumesRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listVolumesResponseContentPb listVolumesResponseContentPb + var listVolumesResponseContent ListVolumesResponseContent path := "/api/2.1/unity-catalog/volumes" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listVolumesResponseContentPb, - ) - if err != nil { - return nil, err - } - resp, err := listVolumesResponseContentFromPb(&listVolumesResponseContentPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listVolumesResponseContent) + return &listVolumesResponseContent, err } func (a *volumesImpl) Read(ctx context.Context, request ReadVolumeRequest) (*VolumeInfo, error) { - - requestPb, pbErr := readVolumeRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var volumeInfoPb volumeInfoPb - path := fmt.Sprintf("/api/2.1/unity-catalog/volumes/%v", requestPb.Name) + var volumeInfo VolumeInfo + path := fmt.Sprintf("/api/2.1/unity-catalog/volumes/%v", request.Name) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &volumeInfoPb, - ) - if err != nil { - return nil, err - } - resp, err := volumeInfoFromPb(&volumeInfoPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &volumeInfo) + return &volumeInfo, err } func (a *volumesImpl) Update(ctx context.Context, request UpdateVolumeRequestContent) (*VolumeInfo, error) { - - requestPb, pbErr := updateVolumeRequestContentToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var volumeInfoPb volumeInfoPb - path := fmt.Sprintf("/api/2.1/unity-catalog/volumes/%v", requestPb.Name) + var volumeInfo VolumeInfo + path := fmt.Sprintf("/api/2.1/unity-catalog/volumes/%v", request.Name) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &volumeInfoPb, - ) - if err != nil { - return nil, err - } - resp, err := volumeInfoFromPb(&volumeInfoPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &volumeInfo) + return &volumeInfo, err } // unexported type that holds implementations of just WorkspaceBindings API methods @@ -4304,35 +1989,13 @@ type workspaceBindingsImpl struct { } func (a *workspaceBindingsImpl) Get(ctx context.Context, request GetWorkspaceBindingRequest) (*GetCatalogWorkspaceBindingsResponse, error) { - - requestPb, pbErr := getWorkspaceBindingRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var getCatalogWorkspaceBindingsResponsePb getCatalogWorkspaceBindingsResponsePb - path := fmt.Sprintf("/api/2.1/unity-catalog/workspace-bindings/catalogs/%v", requestPb.Name) + var getCatalogWorkspaceBindingsResponse GetCatalogWorkspaceBindingsResponse + path := fmt.Sprintf("/api/2.1/unity-catalog/workspace-bindings/catalogs/%v", request.Name) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &getCatalogWorkspaceBindingsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := getCatalogWorkspaceBindingsResponseFromPb(&getCatalogWorkspaceBindingsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getCatalogWorkspaceBindingsResponse) + return &getCatalogWorkspaceBindingsResponse, err } // Gets workspace bindings of the securable. The caller must be a metastore @@ -4369,99 +2032,33 @@ func (a *workspaceBindingsImpl) GetBindingsAll(ctx context.Context, request GetB } func (a *workspaceBindingsImpl) internalGetBindings(ctx context.Context, request GetBindingsRequest) (*GetWorkspaceBindingsResponse, error) { - - requestPb, pbErr := getBindingsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var getWorkspaceBindingsResponsePb getWorkspaceBindingsResponsePb - path := fmt.Sprintf("/api/2.1/unity-catalog/bindings/%v/%v", requestPb.SecurableType, requestPb.SecurableName) + var getWorkspaceBindingsResponse GetWorkspaceBindingsResponse + path := fmt.Sprintf("/api/2.1/unity-catalog/bindings/%v/%v", request.SecurableType, request.SecurableName) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &getWorkspaceBindingsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := getWorkspaceBindingsResponseFromPb(&getWorkspaceBindingsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getWorkspaceBindingsResponse) + return &getWorkspaceBindingsResponse, err } func (a *workspaceBindingsImpl) Update(ctx context.Context, request UpdateWorkspaceBindings) (*UpdateCatalogWorkspaceBindingsResponse, error) { - - requestPb, pbErr := updateWorkspaceBindingsToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var updateCatalogWorkspaceBindingsResponsePb updateCatalogWorkspaceBindingsResponsePb - path := fmt.Sprintf("/api/2.1/unity-catalog/workspace-bindings/catalogs/%v", requestPb.Name) + var updateCatalogWorkspaceBindingsResponse UpdateCatalogWorkspaceBindingsResponse + path := fmt.Sprintf("/api/2.1/unity-catalog/workspace-bindings/catalogs/%v", request.Name) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &updateCatalogWorkspaceBindingsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := updateCatalogWorkspaceBindingsResponseFromPb(&updateCatalogWorkspaceBindingsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &updateCatalogWorkspaceBindingsResponse) + return &updateCatalogWorkspaceBindingsResponse, err } func (a *workspaceBindingsImpl) UpdateBindings(ctx context.Context, request UpdateWorkspaceBindingsParameters) (*UpdateWorkspaceBindingsResponse, error) { - - requestPb, pbErr := updateWorkspaceBindingsParametersToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var updateWorkspaceBindingsResponsePb updateWorkspaceBindingsResponsePb - path := fmt.Sprintf("/api/2.1/unity-catalog/bindings/%v/%v", requestPb.SecurableType, requestPb.SecurableName) + var updateWorkspaceBindingsResponse UpdateWorkspaceBindingsResponse + path := fmt.Sprintf("/api/2.1/unity-catalog/bindings/%v/%v", request.SecurableType, request.SecurableName) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &updateWorkspaceBindingsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := updateWorkspaceBindingsResponseFromPb(&updateWorkspaceBindingsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &updateWorkspaceBindingsResponse) + return &updateWorkspaceBindingsResponse, err } diff --git a/service/catalog/internal.go b/service/catalog/internal.go deleted file mode 100755 index bf6f213be..000000000 --- a/service/catalog/internal.go +++ /dev/null @@ -1,9914 +0,0 @@ -// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. - -package catalog - -import ( - "fmt" - "strings" - "time" - - "github.com/databricks/databricks-sdk-go/marshal" -) - -func accountsCreateMetastoreToPb(st *AccountsCreateMetastore) (*accountsCreateMetastorePb, error) { - if st == nil { - return nil, nil - } - pb := &accountsCreateMetastorePb{} - pb.MetastoreInfo = st.MetastoreInfo - - return pb, nil -} - -type accountsCreateMetastorePb struct { - MetastoreInfo *CreateMetastore `json:"metastore_info,omitempty"` -} - -func accountsCreateMetastoreFromPb(pb *accountsCreateMetastorePb) (*AccountsCreateMetastore, error) { - if pb == nil { - return nil, nil - } - st := &AccountsCreateMetastore{} - st.MetastoreInfo = pb.MetastoreInfo - - return st, nil -} - -func accountsCreateMetastoreAssignmentToPb(st *AccountsCreateMetastoreAssignment) (*accountsCreateMetastoreAssignmentPb, error) { - if st == nil { - return nil, nil - } - pb := &accountsCreateMetastoreAssignmentPb{} - pb.MetastoreAssignment = st.MetastoreAssignment - pb.MetastoreId = st.MetastoreId - pb.WorkspaceId = st.WorkspaceId - - return pb, nil -} - -type accountsCreateMetastoreAssignmentPb struct { - MetastoreAssignment *CreateMetastoreAssignment `json:"metastore_assignment,omitempty"` - MetastoreId string `json:"-" url:"-"` - WorkspaceId int64 `json:"-" url:"-"` -} - -func accountsCreateMetastoreAssignmentFromPb(pb *accountsCreateMetastoreAssignmentPb) (*AccountsCreateMetastoreAssignment, error) { - if pb == nil { - return nil, nil - } - st := &AccountsCreateMetastoreAssignment{} - st.MetastoreAssignment = pb.MetastoreAssignment - st.MetastoreId = pb.MetastoreId - st.WorkspaceId = pb.WorkspaceId - - return st, nil -} - -func accountsCreateStorageCredentialToPb(st *AccountsCreateStorageCredential) (*accountsCreateStorageCredentialPb, error) { - if st == nil { - return nil, nil - } - pb := &accountsCreateStorageCredentialPb{} - pb.CredentialInfo = st.CredentialInfo - pb.MetastoreId = st.MetastoreId - - return pb, nil -} - -type accountsCreateStorageCredentialPb struct { - CredentialInfo *CreateStorageCredential `json:"credential_info,omitempty"` - MetastoreId string `json:"-" url:"-"` -} - -func accountsCreateStorageCredentialFromPb(pb *accountsCreateStorageCredentialPb) (*AccountsCreateStorageCredential, error) { - if pb == nil { - return nil, nil - } - st := &AccountsCreateStorageCredential{} - st.CredentialInfo = pb.CredentialInfo - st.MetastoreId = pb.MetastoreId - - return st, nil -} - -func accountsMetastoreAssignmentToPb(st *AccountsMetastoreAssignment) (*accountsMetastoreAssignmentPb, error) { - if st == nil { - return nil, nil - } - pb := &accountsMetastoreAssignmentPb{} - pb.MetastoreAssignment = st.MetastoreAssignment - - return pb, nil -} - -type accountsMetastoreAssignmentPb struct { - MetastoreAssignment *MetastoreAssignment `json:"metastore_assignment,omitempty"` -} - -func accountsMetastoreAssignmentFromPb(pb *accountsMetastoreAssignmentPb) (*AccountsMetastoreAssignment, error) { - if pb == nil { - return nil, nil - } - st := &AccountsMetastoreAssignment{} - st.MetastoreAssignment = pb.MetastoreAssignment - - return st, nil -} - -func accountsMetastoreInfoToPb(st *AccountsMetastoreInfo) (*accountsMetastoreInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &accountsMetastoreInfoPb{} - pb.MetastoreInfo = st.MetastoreInfo - - return pb, nil -} - -type accountsMetastoreInfoPb struct { - MetastoreInfo *MetastoreInfo `json:"metastore_info,omitempty"` -} - -func accountsMetastoreInfoFromPb(pb *accountsMetastoreInfoPb) (*AccountsMetastoreInfo, error) { - if pb == nil { - return nil, nil - } - st := &AccountsMetastoreInfo{} - st.MetastoreInfo = pb.MetastoreInfo - - return st, nil -} - -func accountsStorageCredentialInfoToPb(st *AccountsStorageCredentialInfo) (*accountsStorageCredentialInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &accountsStorageCredentialInfoPb{} - pb.CredentialInfo = st.CredentialInfo - - return pb, nil -} - -type accountsStorageCredentialInfoPb struct { - CredentialInfo *StorageCredentialInfo `json:"credential_info,omitempty"` -} - -func accountsStorageCredentialInfoFromPb(pb *accountsStorageCredentialInfoPb) (*AccountsStorageCredentialInfo, error) { - if pb == nil { - return nil, nil - } - st := &AccountsStorageCredentialInfo{} - st.CredentialInfo = pb.CredentialInfo - - return st, nil -} - -func accountsUpdateMetastoreToPb(st *AccountsUpdateMetastore) (*accountsUpdateMetastorePb, error) { - if st == nil { - return nil, nil - } - pb := &accountsUpdateMetastorePb{} - pb.MetastoreId = st.MetastoreId - pb.MetastoreInfo = st.MetastoreInfo - - return pb, nil -} - -type accountsUpdateMetastorePb struct { - MetastoreId string `json:"-" url:"-"` - MetastoreInfo *UpdateMetastore `json:"metastore_info,omitempty"` -} - -func accountsUpdateMetastoreFromPb(pb *accountsUpdateMetastorePb) (*AccountsUpdateMetastore, error) { - if pb == nil { - return nil, nil - } - st := &AccountsUpdateMetastore{} - st.MetastoreId = pb.MetastoreId - st.MetastoreInfo = pb.MetastoreInfo - - return st, nil -} - -func accountsUpdateMetastoreAssignmentToPb(st *AccountsUpdateMetastoreAssignment) (*accountsUpdateMetastoreAssignmentPb, error) { - if st == nil { - return nil, nil - } - pb := &accountsUpdateMetastoreAssignmentPb{} - pb.MetastoreAssignment = st.MetastoreAssignment - pb.MetastoreId = st.MetastoreId - pb.WorkspaceId = st.WorkspaceId - - return pb, nil -} - -type accountsUpdateMetastoreAssignmentPb struct { - MetastoreAssignment *UpdateMetastoreAssignment `json:"metastore_assignment,omitempty"` - MetastoreId string `json:"-" url:"-"` - WorkspaceId int64 `json:"-" url:"-"` -} - -func accountsUpdateMetastoreAssignmentFromPb(pb *accountsUpdateMetastoreAssignmentPb) (*AccountsUpdateMetastoreAssignment, error) { - if pb == nil { - return nil, nil - } - st := &AccountsUpdateMetastoreAssignment{} - st.MetastoreAssignment = pb.MetastoreAssignment - st.MetastoreId = pb.MetastoreId - st.WorkspaceId = pb.WorkspaceId - - return st, nil -} - -func accountsUpdateStorageCredentialToPb(st *AccountsUpdateStorageCredential) (*accountsUpdateStorageCredentialPb, error) { - if st == nil { - return nil, nil - } - pb := &accountsUpdateStorageCredentialPb{} - pb.CredentialInfo = st.CredentialInfo - pb.MetastoreId = st.MetastoreId - pb.StorageCredentialName = st.StorageCredentialName - - return pb, nil -} - -type accountsUpdateStorageCredentialPb struct { - CredentialInfo *UpdateStorageCredential `json:"credential_info,omitempty"` - MetastoreId string `json:"-" url:"-"` - StorageCredentialName string `json:"-" url:"-"` -} - -func accountsUpdateStorageCredentialFromPb(pb *accountsUpdateStorageCredentialPb) (*AccountsUpdateStorageCredential, error) { - if pb == nil { - return nil, nil - } - st := &AccountsUpdateStorageCredential{} - st.CredentialInfo = pb.CredentialInfo - st.MetastoreId = pb.MetastoreId - st.StorageCredentialName = pb.StorageCredentialName - - return st, nil -} - -func artifactAllowlistInfoToPb(st *ArtifactAllowlistInfo) (*artifactAllowlistInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &artifactAllowlistInfoPb{} - pb.ArtifactMatchers = st.ArtifactMatchers - pb.CreatedAt = st.CreatedAt - pb.CreatedBy = st.CreatedBy - pb.MetastoreId = st.MetastoreId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type artifactAllowlistInfoPb struct { - ArtifactMatchers []ArtifactMatcher `json:"artifact_matchers,omitempty"` - CreatedAt int64 `json:"created_at,omitempty"` - CreatedBy string `json:"created_by,omitempty"` - MetastoreId string `json:"metastore_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func artifactAllowlistInfoFromPb(pb *artifactAllowlistInfoPb) (*ArtifactAllowlistInfo, error) { - if pb == nil { - return nil, nil - } - st := &ArtifactAllowlistInfo{} - st.ArtifactMatchers = pb.ArtifactMatchers - st.CreatedAt = pb.CreatedAt - st.CreatedBy = pb.CreatedBy - st.MetastoreId = pb.MetastoreId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *artifactAllowlistInfoPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st artifactAllowlistInfoPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func artifactMatcherToPb(st *ArtifactMatcher) (*artifactMatcherPb, error) { - if st == nil { - return nil, nil - } - pb := &artifactMatcherPb{} - pb.Artifact = st.Artifact - pb.MatchType = st.MatchType - - return pb, nil -} - -type artifactMatcherPb struct { - Artifact string `json:"artifact"` - MatchType MatchType `json:"match_type"` -} - -func artifactMatcherFromPb(pb *artifactMatcherPb) (*ArtifactMatcher, error) { - if pb == nil { - return nil, nil - } - st := &ArtifactMatcher{} - st.Artifact = pb.Artifact - st.MatchType = pb.MatchType - - return st, nil -} - -func assignResponseToPb(st *AssignResponse) (*assignResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &assignResponsePb{} - - return pb, nil -} - -type assignResponsePb struct { -} - -func assignResponseFromPb(pb *assignResponsePb) (*AssignResponse, error) { - if pb == nil { - return nil, nil - } - st := &AssignResponse{} - - return st, nil -} - -func awsCredentialsToPb(st *AwsCredentials) (*awsCredentialsPb, error) { - if st == nil { - return nil, nil - } - pb := &awsCredentialsPb{} - pb.AccessKeyId = st.AccessKeyId - pb.AccessPoint = st.AccessPoint - pb.SecretAccessKey = st.SecretAccessKey - pb.SessionToken = st.SessionToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type awsCredentialsPb struct { - AccessKeyId string `json:"access_key_id,omitempty"` - AccessPoint string `json:"access_point,omitempty"` - SecretAccessKey string `json:"secret_access_key,omitempty"` - SessionToken string `json:"session_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func awsCredentialsFromPb(pb *awsCredentialsPb) (*AwsCredentials, error) { - if pb == nil { - return nil, nil - } - st := &AwsCredentials{} - st.AccessKeyId = pb.AccessKeyId - st.AccessPoint = pb.AccessPoint - st.SecretAccessKey = pb.SecretAccessKey - st.SessionToken = pb.SessionToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *awsCredentialsPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st awsCredentialsPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func awsIamRoleToPb(st *AwsIamRole) (*awsIamRolePb, error) { - if st == nil { - return nil, nil - } - pb := &awsIamRolePb{} - pb.ExternalId = st.ExternalId - pb.RoleArn = st.RoleArn - pb.UnityCatalogIamArn = st.UnityCatalogIamArn - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type awsIamRolePb struct { - ExternalId string `json:"external_id,omitempty"` - RoleArn string `json:"role_arn,omitempty"` - UnityCatalogIamArn string `json:"unity_catalog_iam_arn,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func awsIamRoleFromPb(pb *awsIamRolePb) (*AwsIamRole, error) { - if pb == nil { - return nil, nil - } - st := &AwsIamRole{} - st.ExternalId = pb.ExternalId - st.RoleArn = pb.RoleArn - st.UnityCatalogIamArn = pb.UnityCatalogIamArn - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *awsIamRolePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st awsIamRolePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func awsIamRoleRequestToPb(st *AwsIamRoleRequest) (*awsIamRoleRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &awsIamRoleRequestPb{} - pb.RoleArn = st.RoleArn - - return pb, nil -} - -type awsIamRoleRequestPb struct { - RoleArn string `json:"role_arn"` -} - -func awsIamRoleRequestFromPb(pb *awsIamRoleRequestPb) (*AwsIamRoleRequest, error) { - if pb == nil { - return nil, nil - } - st := &AwsIamRoleRequest{} - st.RoleArn = pb.RoleArn - - return st, nil -} - -func awsIamRoleResponseToPb(st *AwsIamRoleResponse) (*awsIamRoleResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &awsIamRoleResponsePb{} - pb.ExternalId = st.ExternalId - pb.RoleArn = st.RoleArn - pb.UnityCatalogIamArn = st.UnityCatalogIamArn - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type awsIamRoleResponsePb struct { - ExternalId string `json:"external_id,omitempty"` - RoleArn string `json:"role_arn"` - UnityCatalogIamArn string `json:"unity_catalog_iam_arn,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func awsIamRoleResponseFromPb(pb *awsIamRoleResponsePb) (*AwsIamRoleResponse, error) { - if pb == nil { - return nil, nil - } - st := &AwsIamRoleResponse{} - st.ExternalId = pb.ExternalId - st.RoleArn = pb.RoleArn - st.UnityCatalogIamArn = pb.UnityCatalogIamArn - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *awsIamRoleResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st awsIamRoleResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func awsSqsQueueToPb(st *AwsSqsQueue) (*awsSqsQueuePb, error) { - if st == nil { - return nil, nil - } - pb := &awsSqsQueuePb{} - pb.ManagedResourceId = st.ManagedResourceId - pb.QueueUrl = st.QueueUrl - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type awsSqsQueuePb struct { - ManagedResourceId string `json:"managed_resource_id,omitempty"` - QueueUrl string `json:"queue_url,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func awsSqsQueueFromPb(pb *awsSqsQueuePb) (*AwsSqsQueue, error) { - if pb == nil { - return nil, nil - } - st := &AwsSqsQueue{} - st.ManagedResourceId = pb.ManagedResourceId - st.QueueUrl = pb.QueueUrl - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *awsSqsQueuePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st awsSqsQueuePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func azureActiveDirectoryTokenToPb(st *AzureActiveDirectoryToken) (*azureActiveDirectoryTokenPb, error) { - if st == nil { - return nil, nil - } - pb := &azureActiveDirectoryTokenPb{} - pb.AadToken = st.AadToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type azureActiveDirectoryTokenPb struct { - AadToken string `json:"aad_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func azureActiveDirectoryTokenFromPb(pb *azureActiveDirectoryTokenPb) (*AzureActiveDirectoryToken, error) { - if pb == nil { - return nil, nil - } - st := &AzureActiveDirectoryToken{} - st.AadToken = pb.AadToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *azureActiveDirectoryTokenPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st azureActiveDirectoryTokenPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func azureManagedIdentityToPb(st *AzureManagedIdentity) (*azureManagedIdentityPb, error) { - if st == nil { - return nil, nil - } - pb := &azureManagedIdentityPb{} - pb.AccessConnectorId = st.AccessConnectorId - pb.CredentialId = st.CredentialId - pb.ManagedIdentityId = st.ManagedIdentityId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type azureManagedIdentityPb struct { - AccessConnectorId string `json:"access_connector_id"` - CredentialId string `json:"credential_id,omitempty"` - ManagedIdentityId string `json:"managed_identity_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func azureManagedIdentityFromPb(pb *azureManagedIdentityPb) (*AzureManagedIdentity, error) { - if pb == nil { - return nil, nil - } - st := &AzureManagedIdentity{} - st.AccessConnectorId = pb.AccessConnectorId - st.CredentialId = pb.CredentialId - st.ManagedIdentityId = pb.ManagedIdentityId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *azureManagedIdentityPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st azureManagedIdentityPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func azureManagedIdentityRequestToPb(st *AzureManagedIdentityRequest) (*azureManagedIdentityRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &azureManagedIdentityRequestPb{} - pb.AccessConnectorId = st.AccessConnectorId - pb.ManagedIdentityId = st.ManagedIdentityId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type azureManagedIdentityRequestPb struct { - AccessConnectorId string `json:"access_connector_id"` - ManagedIdentityId string `json:"managed_identity_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func azureManagedIdentityRequestFromPb(pb *azureManagedIdentityRequestPb) (*AzureManagedIdentityRequest, error) { - if pb == nil { - return nil, nil - } - st := &AzureManagedIdentityRequest{} - st.AccessConnectorId = pb.AccessConnectorId - st.ManagedIdentityId = pb.ManagedIdentityId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *azureManagedIdentityRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st azureManagedIdentityRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func azureManagedIdentityResponseToPb(st *AzureManagedIdentityResponse) (*azureManagedIdentityResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &azureManagedIdentityResponsePb{} - pb.AccessConnectorId = st.AccessConnectorId - pb.CredentialId = st.CredentialId - pb.ManagedIdentityId = st.ManagedIdentityId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type azureManagedIdentityResponsePb struct { - AccessConnectorId string `json:"access_connector_id"` - CredentialId string `json:"credential_id,omitempty"` - ManagedIdentityId string `json:"managed_identity_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func azureManagedIdentityResponseFromPb(pb *azureManagedIdentityResponsePb) (*AzureManagedIdentityResponse, error) { - if pb == nil { - return nil, nil - } - st := &AzureManagedIdentityResponse{} - st.AccessConnectorId = pb.AccessConnectorId - st.CredentialId = pb.CredentialId - st.ManagedIdentityId = pb.ManagedIdentityId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *azureManagedIdentityResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st azureManagedIdentityResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func azureQueueStorageToPb(st *AzureQueueStorage) (*azureQueueStoragePb, error) { - if st == nil { - return nil, nil - } - pb := &azureQueueStoragePb{} - pb.ManagedResourceId = st.ManagedResourceId - pb.QueueUrl = st.QueueUrl - pb.ResourceGroup = st.ResourceGroup - pb.SubscriptionId = st.SubscriptionId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type azureQueueStoragePb struct { - ManagedResourceId string `json:"managed_resource_id,omitempty"` - QueueUrl string `json:"queue_url,omitempty"` - ResourceGroup string `json:"resource_group,omitempty"` - SubscriptionId string `json:"subscription_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func azureQueueStorageFromPb(pb *azureQueueStoragePb) (*AzureQueueStorage, error) { - if pb == nil { - return nil, nil - } - st := &AzureQueueStorage{} - st.ManagedResourceId = pb.ManagedResourceId - st.QueueUrl = pb.QueueUrl - st.ResourceGroup = pb.ResourceGroup - st.SubscriptionId = pb.SubscriptionId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *azureQueueStoragePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st azureQueueStoragePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func azureServicePrincipalToPb(st *AzureServicePrincipal) (*azureServicePrincipalPb, error) { - if st == nil { - return nil, nil - } - pb := &azureServicePrincipalPb{} - pb.ApplicationId = st.ApplicationId - pb.ClientSecret = st.ClientSecret - pb.DirectoryId = st.DirectoryId - - return pb, nil -} - -type azureServicePrincipalPb struct { - ApplicationId string `json:"application_id"` - ClientSecret string `json:"client_secret"` - DirectoryId string `json:"directory_id"` -} - -func azureServicePrincipalFromPb(pb *azureServicePrincipalPb) (*AzureServicePrincipal, error) { - if pb == nil { - return nil, nil - } - st := &AzureServicePrincipal{} - st.ApplicationId = pb.ApplicationId - st.ClientSecret = pb.ClientSecret - st.DirectoryId = pb.DirectoryId - - return st, nil -} - -func azureUserDelegationSasToPb(st *AzureUserDelegationSas) (*azureUserDelegationSasPb, error) { - if st == nil { - return nil, nil - } - pb := &azureUserDelegationSasPb{} - pb.SasToken = st.SasToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type azureUserDelegationSasPb struct { - SasToken string `json:"sas_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func azureUserDelegationSasFromPb(pb *azureUserDelegationSasPb) (*AzureUserDelegationSas, error) { - if pb == nil { - return nil, nil - } - st := &AzureUserDelegationSas{} - st.SasToken = pb.SasToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *azureUserDelegationSasPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st azureUserDelegationSasPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func cancelRefreshRequestToPb(st *CancelRefreshRequest) (*cancelRefreshRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &cancelRefreshRequestPb{} - pb.RefreshId = st.RefreshId - pb.TableName = st.TableName - - return pb, nil -} - -type cancelRefreshRequestPb struct { - RefreshId string `json:"-" url:"-"` - TableName string `json:"-" url:"-"` -} - -func cancelRefreshRequestFromPb(pb *cancelRefreshRequestPb) (*CancelRefreshRequest, error) { - if pb == nil { - return nil, nil - } - st := &CancelRefreshRequest{} - st.RefreshId = pb.RefreshId - st.TableName = pb.TableName - - return st, nil -} - -func cancelRefreshResponseToPb(st *CancelRefreshResponse) (*cancelRefreshResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &cancelRefreshResponsePb{} - - return pb, nil -} - -type cancelRefreshResponsePb struct { -} - -func cancelRefreshResponseFromPb(pb *cancelRefreshResponsePb) (*CancelRefreshResponse, error) { - if pb == nil { - return nil, nil - } - st := &CancelRefreshResponse{} - - return st, nil -} - -func catalogInfoToPb(st *CatalogInfo) (*catalogInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &catalogInfoPb{} - pb.BrowseOnly = st.BrowseOnly - pb.CatalogType = st.CatalogType - pb.Comment = st.Comment - pb.ConnectionName = st.ConnectionName - pb.CreatedAt = st.CreatedAt - pb.CreatedBy = st.CreatedBy - pb.EffectivePredictiveOptimizationFlag = st.EffectivePredictiveOptimizationFlag - pb.EnablePredictiveOptimization = st.EnablePredictiveOptimization - pb.FullName = st.FullName - pb.IsolationMode = st.IsolationMode - pb.MetastoreId = st.MetastoreId - pb.Name = st.Name - pb.Options = st.Options - pb.Owner = st.Owner - pb.Properties = st.Properties - pb.ProviderName = st.ProviderName - pb.ProvisioningInfo = st.ProvisioningInfo - pb.SecurableType = st.SecurableType - pb.ShareName = st.ShareName - pb.StorageLocation = st.StorageLocation - pb.StorageRoot = st.StorageRoot - pb.UpdatedAt = st.UpdatedAt - pb.UpdatedBy = st.UpdatedBy - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type catalogInfoPb struct { - BrowseOnly bool `json:"browse_only,omitempty"` - CatalogType CatalogType `json:"catalog_type,omitempty"` - Comment string `json:"comment,omitempty"` - ConnectionName string `json:"connection_name,omitempty"` - CreatedAt int64 `json:"created_at,omitempty"` - CreatedBy string `json:"created_by,omitempty"` - EffectivePredictiveOptimizationFlag *EffectivePredictiveOptimizationFlag `json:"effective_predictive_optimization_flag,omitempty"` - EnablePredictiveOptimization EnablePredictiveOptimization `json:"enable_predictive_optimization,omitempty"` - FullName string `json:"full_name,omitempty"` - IsolationMode CatalogIsolationMode `json:"isolation_mode,omitempty"` - MetastoreId string `json:"metastore_id,omitempty"` - Name string `json:"name,omitempty"` - Options map[string]string `json:"options,omitempty"` - Owner string `json:"owner,omitempty"` - Properties map[string]string `json:"properties,omitempty"` - ProviderName string `json:"provider_name,omitempty"` - ProvisioningInfo *ProvisioningInfo `json:"provisioning_info,omitempty"` - SecurableType SecurableType `json:"securable_type,omitempty"` - ShareName string `json:"share_name,omitempty"` - StorageLocation string `json:"storage_location,omitempty"` - StorageRoot string `json:"storage_root,omitempty"` - UpdatedAt int64 `json:"updated_at,omitempty"` - UpdatedBy string `json:"updated_by,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func catalogInfoFromPb(pb *catalogInfoPb) (*CatalogInfo, error) { - if pb == nil { - return nil, nil - } - st := &CatalogInfo{} - st.BrowseOnly = pb.BrowseOnly - st.CatalogType = pb.CatalogType - st.Comment = pb.Comment - st.ConnectionName = pb.ConnectionName - st.CreatedAt = pb.CreatedAt - st.CreatedBy = pb.CreatedBy - st.EffectivePredictiveOptimizationFlag = pb.EffectivePredictiveOptimizationFlag - st.EnablePredictiveOptimization = pb.EnablePredictiveOptimization - st.FullName = pb.FullName - st.IsolationMode = pb.IsolationMode - st.MetastoreId = pb.MetastoreId - st.Name = pb.Name - st.Options = pb.Options - st.Owner = pb.Owner - st.Properties = pb.Properties - st.ProviderName = pb.ProviderName - st.ProvisioningInfo = pb.ProvisioningInfo - st.SecurableType = pb.SecurableType - st.ShareName = pb.ShareName - st.StorageLocation = pb.StorageLocation - st.StorageRoot = pb.StorageRoot - st.UpdatedAt = pb.UpdatedAt - st.UpdatedBy = pb.UpdatedBy - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *catalogInfoPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st catalogInfoPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func cloudflareApiTokenToPb(st *CloudflareApiToken) (*cloudflareApiTokenPb, error) { - if st == nil { - return nil, nil - } - pb := &cloudflareApiTokenPb{} - pb.AccessKeyId = st.AccessKeyId - pb.AccountId = st.AccountId - pb.SecretAccessKey = st.SecretAccessKey - - return pb, nil -} - -type cloudflareApiTokenPb struct { - AccessKeyId string `json:"access_key_id"` - AccountId string `json:"account_id"` - SecretAccessKey string `json:"secret_access_key"` -} - -func cloudflareApiTokenFromPb(pb *cloudflareApiTokenPb) (*CloudflareApiToken, error) { - if pb == nil { - return nil, nil - } - st := &CloudflareApiToken{} - st.AccessKeyId = pb.AccessKeyId - st.AccountId = pb.AccountId - st.SecretAccessKey = pb.SecretAccessKey - - return st, nil -} - -func columnInfoToPb(st *ColumnInfo) (*columnInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &columnInfoPb{} - pb.Comment = st.Comment - pb.Mask = st.Mask - pb.Name = st.Name - pb.Nullable = st.Nullable - pb.PartitionIndex = st.PartitionIndex - pb.Position = st.Position - pb.TypeIntervalType = st.TypeIntervalType - pb.TypeJson = st.TypeJson - pb.TypeName = st.TypeName - pb.TypePrecision = st.TypePrecision - pb.TypeScale = st.TypeScale - pb.TypeText = st.TypeText - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type columnInfoPb struct { - Comment string `json:"comment,omitempty"` - Mask *ColumnMask `json:"mask,omitempty"` - Name string `json:"name,omitempty"` - Nullable bool `json:"nullable,omitempty"` - PartitionIndex int `json:"partition_index,omitempty"` - Position int `json:"position,omitempty"` - TypeIntervalType string `json:"type_interval_type,omitempty"` - TypeJson string `json:"type_json,omitempty"` - TypeName ColumnTypeName `json:"type_name,omitempty"` - TypePrecision int `json:"type_precision,omitempty"` - TypeScale int `json:"type_scale,omitempty"` - TypeText string `json:"type_text,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func columnInfoFromPb(pb *columnInfoPb) (*ColumnInfo, error) { - if pb == nil { - return nil, nil - } - st := &ColumnInfo{} - st.Comment = pb.Comment - st.Mask = pb.Mask - st.Name = pb.Name - st.Nullable = pb.Nullable - st.PartitionIndex = pb.PartitionIndex - st.Position = pb.Position - st.TypeIntervalType = pb.TypeIntervalType - st.TypeJson = pb.TypeJson - st.TypeName = pb.TypeName - st.TypePrecision = pb.TypePrecision - st.TypeScale = pb.TypeScale - st.TypeText = pb.TypeText - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *columnInfoPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st columnInfoPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func columnMaskToPb(st *ColumnMask) (*columnMaskPb, error) { - if st == nil { - return nil, nil - } - pb := &columnMaskPb{} - pb.FunctionName = st.FunctionName - pb.UsingColumnNames = st.UsingColumnNames - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type columnMaskPb struct { - FunctionName string `json:"function_name,omitempty"` - UsingColumnNames []string `json:"using_column_names,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func columnMaskFromPb(pb *columnMaskPb) (*ColumnMask, error) { - if pb == nil { - return nil, nil - } - st := &ColumnMask{} - st.FunctionName = pb.FunctionName - st.UsingColumnNames = pb.UsingColumnNames - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *columnMaskPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st columnMaskPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func connectionInfoToPb(st *ConnectionInfo) (*connectionInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &connectionInfoPb{} - pb.Comment = st.Comment - pb.ConnectionId = st.ConnectionId - pb.ConnectionType = st.ConnectionType - pb.CreatedAt = st.CreatedAt - pb.CreatedBy = st.CreatedBy - pb.CredentialType = st.CredentialType - pb.FullName = st.FullName - pb.MetastoreId = st.MetastoreId - pb.Name = st.Name - pb.Options = st.Options - pb.Owner = st.Owner - pb.Properties = st.Properties - pb.ProvisioningInfo = st.ProvisioningInfo - pb.ReadOnly = st.ReadOnly - pb.SecurableType = st.SecurableType - pb.UpdatedAt = st.UpdatedAt - pb.UpdatedBy = st.UpdatedBy - pb.Url = st.Url - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type connectionInfoPb struct { - Comment string `json:"comment,omitempty"` - ConnectionId string `json:"connection_id,omitempty"` - ConnectionType ConnectionType `json:"connection_type,omitempty"` - CreatedAt int64 `json:"created_at,omitempty"` - CreatedBy string `json:"created_by,omitempty"` - CredentialType CredentialType `json:"credential_type,omitempty"` - FullName string `json:"full_name,omitempty"` - MetastoreId string `json:"metastore_id,omitempty"` - Name string `json:"name,omitempty"` - Options map[string]string `json:"options,omitempty"` - Owner string `json:"owner,omitempty"` - Properties map[string]string `json:"properties,omitempty"` - ProvisioningInfo *ProvisioningInfo `json:"provisioning_info,omitempty"` - ReadOnly bool `json:"read_only,omitempty"` - SecurableType SecurableType `json:"securable_type,omitempty"` - UpdatedAt int64 `json:"updated_at,omitempty"` - UpdatedBy string `json:"updated_by,omitempty"` - Url string `json:"url,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func connectionInfoFromPb(pb *connectionInfoPb) (*ConnectionInfo, error) { - if pb == nil { - return nil, nil - } - st := &ConnectionInfo{} - st.Comment = pb.Comment - st.ConnectionId = pb.ConnectionId - st.ConnectionType = pb.ConnectionType - st.CreatedAt = pb.CreatedAt - st.CreatedBy = pb.CreatedBy - st.CredentialType = pb.CredentialType - st.FullName = pb.FullName - st.MetastoreId = pb.MetastoreId - st.Name = pb.Name - st.Options = pb.Options - st.Owner = pb.Owner - st.Properties = pb.Properties - st.ProvisioningInfo = pb.ProvisioningInfo - st.ReadOnly = pb.ReadOnly - st.SecurableType = pb.SecurableType - st.UpdatedAt = pb.UpdatedAt - st.UpdatedBy = pb.UpdatedBy - st.Url = pb.Url - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *connectionInfoPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st connectionInfoPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func continuousUpdateStatusToPb(st *ContinuousUpdateStatus) (*continuousUpdateStatusPb, error) { - if st == nil { - return nil, nil - } - pb := &continuousUpdateStatusPb{} - pb.InitialPipelineSyncProgress = st.InitialPipelineSyncProgress - pb.LastProcessedCommitVersion = st.LastProcessedCommitVersion - pb.Timestamp = st.Timestamp - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type continuousUpdateStatusPb struct { - InitialPipelineSyncProgress *PipelineProgress `json:"initial_pipeline_sync_progress,omitempty"` - LastProcessedCommitVersion int64 `json:"last_processed_commit_version,omitempty"` - Timestamp string `json:"timestamp,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func continuousUpdateStatusFromPb(pb *continuousUpdateStatusPb) (*ContinuousUpdateStatus, error) { - if pb == nil { - return nil, nil - } - st := &ContinuousUpdateStatus{} - st.InitialPipelineSyncProgress = pb.InitialPipelineSyncProgress - st.LastProcessedCommitVersion = pb.LastProcessedCommitVersion - st.Timestamp = pb.Timestamp - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *continuousUpdateStatusPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st continuousUpdateStatusPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createCatalogToPb(st *CreateCatalog) (*createCatalogPb, error) { - if st == nil { - return nil, nil - } - pb := &createCatalogPb{} - pb.Comment = st.Comment - pb.ConnectionName = st.ConnectionName - pb.Name = st.Name - pb.Options = st.Options - pb.Properties = st.Properties - pb.ProviderName = st.ProviderName - pb.ShareName = st.ShareName - pb.StorageRoot = st.StorageRoot - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createCatalogPb struct { - Comment string `json:"comment,omitempty"` - ConnectionName string `json:"connection_name,omitempty"` - Name string `json:"name"` - Options map[string]string `json:"options,omitempty"` - Properties map[string]string `json:"properties,omitempty"` - ProviderName string `json:"provider_name,omitempty"` - ShareName string `json:"share_name,omitempty"` - StorageRoot string `json:"storage_root,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createCatalogFromPb(pb *createCatalogPb) (*CreateCatalog, error) { - if pb == nil { - return nil, nil - } - st := &CreateCatalog{} - st.Comment = pb.Comment - st.ConnectionName = pb.ConnectionName - st.Name = pb.Name - st.Options = pb.Options - st.Properties = pb.Properties - st.ProviderName = pb.ProviderName - st.ShareName = pb.ShareName - st.StorageRoot = pb.StorageRoot - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createCatalogPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createCatalogPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createConnectionToPb(st *CreateConnection) (*createConnectionPb, error) { - if st == nil { - return nil, nil - } - pb := &createConnectionPb{} - pb.Comment = st.Comment - pb.ConnectionType = st.ConnectionType - pb.Name = st.Name - pb.Options = st.Options - pb.Properties = st.Properties - pb.ReadOnly = st.ReadOnly - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createConnectionPb struct { - Comment string `json:"comment,omitempty"` - ConnectionType ConnectionType `json:"connection_type"` - Name string `json:"name"` - Options map[string]string `json:"options"` - Properties map[string]string `json:"properties,omitempty"` - ReadOnly bool `json:"read_only,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createConnectionFromPb(pb *createConnectionPb) (*CreateConnection, error) { - if pb == nil { - return nil, nil - } - st := &CreateConnection{} - st.Comment = pb.Comment - st.ConnectionType = pb.ConnectionType - st.Name = pb.Name - st.Options = pb.Options - st.Properties = pb.Properties - st.ReadOnly = pb.ReadOnly - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createConnectionPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createConnectionPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createCredentialRequestToPb(st *CreateCredentialRequest) (*createCredentialRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &createCredentialRequestPb{} - pb.AwsIamRole = st.AwsIamRole - pb.AzureManagedIdentity = st.AzureManagedIdentity - pb.AzureServicePrincipal = st.AzureServicePrincipal - pb.Comment = st.Comment - pb.DatabricksGcpServiceAccount = st.DatabricksGcpServiceAccount - pb.Name = st.Name - pb.Purpose = st.Purpose - pb.ReadOnly = st.ReadOnly - pb.SkipValidation = st.SkipValidation - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createCredentialRequestPb struct { - AwsIamRole *AwsIamRole `json:"aws_iam_role,omitempty"` - AzureManagedIdentity *AzureManagedIdentity `json:"azure_managed_identity,omitempty"` - AzureServicePrincipal *AzureServicePrincipal `json:"azure_service_principal,omitempty"` - Comment string `json:"comment,omitempty"` - DatabricksGcpServiceAccount *DatabricksGcpServiceAccount `json:"databricks_gcp_service_account,omitempty"` - Name string `json:"name"` - Purpose CredentialPurpose `json:"purpose,omitempty"` - ReadOnly bool `json:"read_only,omitempty"` - SkipValidation bool `json:"skip_validation,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createCredentialRequestFromPb(pb *createCredentialRequestPb) (*CreateCredentialRequest, error) { - if pb == nil { - return nil, nil - } - st := &CreateCredentialRequest{} - st.AwsIamRole = pb.AwsIamRole - st.AzureManagedIdentity = pb.AzureManagedIdentity - st.AzureServicePrincipal = pb.AzureServicePrincipal - st.Comment = pb.Comment - st.DatabricksGcpServiceAccount = pb.DatabricksGcpServiceAccount - st.Name = pb.Name - st.Purpose = pb.Purpose - st.ReadOnly = pb.ReadOnly - st.SkipValidation = pb.SkipValidation - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createCredentialRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createCredentialRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createExternalLocationToPb(st *CreateExternalLocation) (*createExternalLocationPb, error) { - if st == nil { - return nil, nil - } - pb := &createExternalLocationPb{} - pb.Comment = st.Comment - pb.CredentialName = st.CredentialName - pb.EnableFileEvents = st.EnableFileEvents - pb.EncryptionDetails = st.EncryptionDetails - pb.Fallback = st.Fallback - pb.FileEventQueue = st.FileEventQueue - pb.Name = st.Name - pb.ReadOnly = st.ReadOnly - pb.SkipValidation = st.SkipValidation - pb.Url = st.Url - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createExternalLocationPb struct { - Comment string `json:"comment,omitempty"` - CredentialName string `json:"credential_name"` - EnableFileEvents bool `json:"enable_file_events,omitempty"` - EncryptionDetails *EncryptionDetails `json:"encryption_details,omitempty"` - Fallback bool `json:"fallback,omitempty"` - FileEventQueue *FileEventQueue `json:"file_event_queue,omitempty"` - Name string `json:"name"` - ReadOnly bool `json:"read_only,omitempty"` - SkipValidation bool `json:"skip_validation,omitempty"` - Url string `json:"url"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createExternalLocationFromPb(pb *createExternalLocationPb) (*CreateExternalLocation, error) { - if pb == nil { - return nil, nil - } - st := &CreateExternalLocation{} - st.Comment = pb.Comment - st.CredentialName = pb.CredentialName - st.EnableFileEvents = pb.EnableFileEvents - st.EncryptionDetails = pb.EncryptionDetails - st.Fallback = pb.Fallback - st.FileEventQueue = pb.FileEventQueue - st.Name = pb.Name - st.ReadOnly = pb.ReadOnly - st.SkipValidation = pb.SkipValidation - st.Url = pb.Url - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createExternalLocationPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createExternalLocationPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createFunctionToPb(st *CreateFunction) (*createFunctionPb, error) { - if st == nil { - return nil, nil - } - pb := &createFunctionPb{} - pb.CatalogName = st.CatalogName - pb.Comment = st.Comment - pb.DataType = st.DataType - pb.ExternalLanguage = st.ExternalLanguage - pb.ExternalName = st.ExternalName - pb.FullDataType = st.FullDataType - pb.InputParams = st.InputParams - pb.IsDeterministic = st.IsDeterministic - pb.IsNullCall = st.IsNullCall - pb.Name = st.Name - pb.ParameterStyle = st.ParameterStyle - pb.Properties = st.Properties - pb.ReturnParams = st.ReturnParams - pb.RoutineBody = st.RoutineBody - pb.RoutineDefinition = st.RoutineDefinition - pb.RoutineDependencies = st.RoutineDependencies - pb.SchemaName = st.SchemaName - pb.SecurityType = st.SecurityType - pb.SpecificName = st.SpecificName - pb.SqlDataAccess = st.SqlDataAccess - pb.SqlPath = st.SqlPath - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createFunctionPb struct { - CatalogName string `json:"catalog_name"` - Comment string `json:"comment,omitempty"` - DataType ColumnTypeName `json:"data_type"` - ExternalLanguage string `json:"external_language,omitempty"` - ExternalName string `json:"external_name,omitempty"` - FullDataType string `json:"full_data_type"` - InputParams FunctionParameterInfos `json:"input_params"` - IsDeterministic bool `json:"is_deterministic"` - IsNullCall bool `json:"is_null_call"` - Name string `json:"name"` - ParameterStyle CreateFunctionParameterStyle `json:"parameter_style"` - Properties string `json:"properties,omitempty"` - ReturnParams *FunctionParameterInfos `json:"return_params,omitempty"` - RoutineBody CreateFunctionRoutineBody `json:"routine_body"` - RoutineDefinition string `json:"routine_definition"` - RoutineDependencies *DependencyList `json:"routine_dependencies,omitempty"` - SchemaName string `json:"schema_name"` - SecurityType CreateFunctionSecurityType `json:"security_type"` - SpecificName string `json:"specific_name"` - SqlDataAccess CreateFunctionSqlDataAccess `json:"sql_data_access"` - SqlPath string `json:"sql_path,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createFunctionFromPb(pb *createFunctionPb) (*CreateFunction, error) { - if pb == nil { - return nil, nil - } - st := &CreateFunction{} - st.CatalogName = pb.CatalogName - st.Comment = pb.Comment - st.DataType = pb.DataType - st.ExternalLanguage = pb.ExternalLanguage - st.ExternalName = pb.ExternalName - st.FullDataType = pb.FullDataType - st.InputParams = pb.InputParams - st.IsDeterministic = pb.IsDeterministic - st.IsNullCall = pb.IsNullCall - st.Name = pb.Name - st.ParameterStyle = pb.ParameterStyle - st.Properties = pb.Properties - st.ReturnParams = pb.ReturnParams - st.RoutineBody = pb.RoutineBody - st.RoutineDefinition = pb.RoutineDefinition - st.RoutineDependencies = pb.RoutineDependencies - st.SchemaName = pb.SchemaName - st.SecurityType = pb.SecurityType - st.SpecificName = pb.SpecificName - st.SqlDataAccess = pb.SqlDataAccess - st.SqlPath = pb.SqlPath - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createFunctionPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createFunctionPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createFunctionRequestToPb(st *CreateFunctionRequest) (*createFunctionRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &createFunctionRequestPb{} - pb.FunctionInfo = st.FunctionInfo - - return pb, nil -} - -type createFunctionRequestPb struct { - FunctionInfo CreateFunction `json:"function_info"` -} - -func createFunctionRequestFromPb(pb *createFunctionRequestPb) (*CreateFunctionRequest, error) { - if pb == nil { - return nil, nil - } - st := &CreateFunctionRequest{} - st.FunctionInfo = pb.FunctionInfo - - return st, nil -} - -func createMetastoreToPb(st *CreateMetastore) (*createMetastorePb, error) { - if st == nil { - return nil, nil - } - pb := &createMetastorePb{} - pb.Name = st.Name - pb.Region = st.Region - pb.StorageRoot = st.StorageRoot - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createMetastorePb struct { - Name string `json:"name"` - Region string `json:"region,omitempty"` - StorageRoot string `json:"storage_root,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createMetastoreFromPb(pb *createMetastorePb) (*CreateMetastore, error) { - if pb == nil { - return nil, nil - } - st := &CreateMetastore{} - st.Name = pb.Name - st.Region = pb.Region - st.StorageRoot = pb.StorageRoot - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createMetastorePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createMetastorePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createMetastoreAssignmentToPb(st *CreateMetastoreAssignment) (*createMetastoreAssignmentPb, error) { - if st == nil { - return nil, nil - } - pb := &createMetastoreAssignmentPb{} - pb.DefaultCatalogName = st.DefaultCatalogName - pb.MetastoreId = st.MetastoreId - pb.WorkspaceId = st.WorkspaceId - - return pb, nil -} - -type createMetastoreAssignmentPb struct { - DefaultCatalogName string `json:"default_catalog_name"` - MetastoreId string `json:"metastore_id"` - WorkspaceId int64 `json:"-" url:"-"` -} - -func createMetastoreAssignmentFromPb(pb *createMetastoreAssignmentPb) (*CreateMetastoreAssignment, error) { - if pb == nil { - return nil, nil - } - st := &CreateMetastoreAssignment{} - st.DefaultCatalogName = pb.DefaultCatalogName - st.MetastoreId = pb.MetastoreId - st.WorkspaceId = pb.WorkspaceId - - return st, nil -} - -func createMonitorToPb(st *CreateMonitor) (*createMonitorPb, error) { - if st == nil { - return nil, nil - } - pb := &createMonitorPb{} - pb.AssetsDir = st.AssetsDir - pb.BaselineTableName = st.BaselineTableName - pb.CustomMetrics = st.CustomMetrics - pb.DataClassificationConfig = st.DataClassificationConfig - pb.InferenceLog = st.InferenceLog - pb.Notifications = st.Notifications - pb.OutputSchemaName = st.OutputSchemaName - pb.Schedule = st.Schedule - pb.SkipBuiltinDashboard = st.SkipBuiltinDashboard - pb.SlicingExprs = st.SlicingExprs - pb.Snapshot = st.Snapshot - pb.TableName = st.TableName - pb.TimeSeries = st.TimeSeries - pb.WarehouseId = st.WarehouseId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createMonitorPb struct { - AssetsDir string `json:"assets_dir"` - BaselineTableName string `json:"baseline_table_name,omitempty"` - CustomMetrics []MonitorMetric `json:"custom_metrics,omitempty"` - DataClassificationConfig *MonitorDataClassificationConfig `json:"data_classification_config,omitempty"` - InferenceLog *MonitorInferenceLog `json:"inference_log,omitempty"` - Notifications *MonitorNotifications `json:"notifications,omitempty"` - OutputSchemaName string `json:"output_schema_name"` - Schedule *MonitorCronSchedule `json:"schedule,omitempty"` - SkipBuiltinDashboard bool `json:"skip_builtin_dashboard,omitempty"` - SlicingExprs []string `json:"slicing_exprs,omitempty"` - Snapshot *MonitorSnapshot `json:"snapshot,omitempty"` - TableName string `json:"-" url:"-"` - TimeSeries *MonitorTimeSeries `json:"time_series,omitempty"` - WarehouseId string `json:"warehouse_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createMonitorFromPb(pb *createMonitorPb) (*CreateMonitor, error) { - if pb == nil { - return nil, nil - } - st := &CreateMonitor{} - st.AssetsDir = pb.AssetsDir - st.BaselineTableName = pb.BaselineTableName - st.CustomMetrics = pb.CustomMetrics - st.DataClassificationConfig = pb.DataClassificationConfig - st.InferenceLog = pb.InferenceLog - st.Notifications = pb.Notifications - st.OutputSchemaName = pb.OutputSchemaName - st.Schedule = pb.Schedule - st.SkipBuiltinDashboard = pb.SkipBuiltinDashboard - st.SlicingExprs = pb.SlicingExprs - st.Snapshot = pb.Snapshot - st.TableName = pb.TableName - st.TimeSeries = pb.TimeSeries - st.WarehouseId = pb.WarehouseId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createMonitorPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createMonitorPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createOnlineTableRequestToPb(st *CreateOnlineTableRequest) (*createOnlineTableRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &createOnlineTableRequestPb{} - pb.Table = st.Table - - return pb, nil -} - -type createOnlineTableRequestPb struct { - Table OnlineTable `json:"table"` -} - -func createOnlineTableRequestFromPb(pb *createOnlineTableRequestPb) (*CreateOnlineTableRequest, error) { - if pb == nil { - return nil, nil - } - st := &CreateOnlineTableRequest{} - st.Table = pb.Table - - return st, nil -} - -func createRegisteredModelRequestToPb(st *CreateRegisteredModelRequest) (*createRegisteredModelRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &createRegisteredModelRequestPb{} - pb.CatalogName = st.CatalogName - pb.Comment = st.Comment - pb.Name = st.Name - pb.SchemaName = st.SchemaName - pb.StorageLocation = st.StorageLocation - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createRegisteredModelRequestPb struct { - CatalogName string `json:"catalog_name"` - Comment string `json:"comment,omitempty"` - Name string `json:"name"` - SchemaName string `json:"schema_name"` - StorageLocation string `json:"storage_location,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createRegisteredModelRequestFromPb(pb *createRegisteredModelRequestPb) (*CreateRegisteredModelRequest, error) { - if pb == nil { - return nil, nil - } - st := &CreateRegisteredModelRequest{} - st.CatalogName = pb.CatalogName - st.Comment = pb.Comment - st.Name = pb.Name - st.SchemaName = pb.SchemaName - st.StorageLocation = pb.StorageLocation - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createRegisteredModelRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createRegisteredModelRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createResponseToPb(st *CreateResponse) (*createResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &createResponsePb{} - - return pb, nil -} - -type createResponsePb struct { -} - -func createResponseFromPb(pb *createResponsePb) (*CreateResponse, error) { - if pb == nil { - return nil, nil - } - st := &CreateResponse{} - - return st, nil -} - -func createSchemaToPb(st *CreateSchema) (*createSchemaPb, error) { - if st == nil { - return nil, nil - } - pb := &createSchemaPb{} - pb.CatalogName = st.CatalogName - pb.Comment = st.Comment - pb.Name = st.Name - pb.Properties = st.Properties - pb.StorageRoot = st.StorageRoot - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createSchemaPb struct { - CatalogName string `json:"catalog_name"` - Comment string `json:"comment,omitempty"` - Name string `json:"name"` - Properties map[string]string `json:"properties,omitempty"` - StorageRoot string `json:"storage_root,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createSchemaFromPb(pb *createSchemaPb) (*CreateSchema, error) { - if pb == nil { - return nil, nil - } - st := &CreateSchema{} - st.CatalogName = pb.CatalogName - st.Comment = pb.Comment - st.Name = pb.Name - st.Properties = pb.Properties - st.StorageRoot = pb.StorageRoot - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createSchemaPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createSchemaPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createStorageCredentialToPb(st *CreateStorageCredential) (*createStorageCredentialPb, error) { - if st == nil { - return nil, nil - } - pb := &createStorageCredentialPb{} - pb.AwsIamRole = st.AwsIamRole - pb.AzureManagedIdentity = st.AzureManagedIdentity - pb.AzureServicePrincipal = st.AzureServicePrincipal - pb.CloudflareApiToken = st.CloudflareApiToken - pb.Comment = st.Comment - pb.DatabricksGcpServiceAccount = st.DatabricksGcpServiceAccount - pb.Name = st.Name - pb.ReadOnly = st.ReadOnly - pb.SkipValidation = st.SkipValidation - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createStorageCredentialPb struct { - AwsIamRole *AwsIamRoleRequest `json:"aws_iam_role,omitempty"` - AzureManagedIdentity *AzureManagedIdentityRequest `json:"azure_managed_identity,omitempty"` - AzureServicePrincipal *AzureServicePrincipal `json:"azure_service_principal,omitempty"` - CloudflareApiToken *CloudflareApiToken `json:"cloudflare_api_token,omitempty"` - Comment string `json:"comment,omitempty"` - DatabricksGcpServiceAccount *DatabricksGcpServiceAccountRequest `json:"databricks_gcp_service_account,omitempty"` - Name string `json:"name"` - ReadOnly bool `json:"read_only,omitempty"` - SkipValidation bool `json:"skip_validation,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createStorageCredentialFromPb(pb *createStorageCredentialPb) (*CreateStorageCredential, error) { - if pb == nil { - return nil, nil - } - st := &CreateStorageCredential{} - st.AwsIamRole = pb.AwsIamRole - st.AzureManagedIdentity = pb.AzureManagedIdentity - st.AzureServicePrincipal = pb.AzureServicePrincipal - st.CloudflareApiToken = pb.CloudflareApiToken - st.Comment = pb.Comment - st.DatabricksGcpServiceAccount = pb.DatabricksGcpServiceAccount - st.Name = pb.Name - st.ReadOnly = pb.ReadOnly - st.SkipValidation = pb.SkipValidation - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createStorageCredentialPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createStorageCredentialPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createTableConstraintToPb(st *CreateTableConstraint) (*createTableConstraintPb, error) { - if st == nil { - return nil, nil - } - pb := &createTableConstraintPb{} - pb.Constraint = st.Constraint - pb.FullNameArg = st.FullNameArg - - return pb, nil -} - -type createTableConstraintPb struct { - Constraint TableConstraint `json:"constraint"` - FullNameArg string `json:"full_name_arg"` -} - -func createTableConstraintFromPb(pb *createTableConstraintPb) (*CreateTableConstraint, error) { - if pb == nil { - return nil, nil - } - st := &CreateTableConstraint{} - st.Constraint = pb.Constraint - st.FullNameArg = pb.FullNameArg - - return st, nil -} - -func createVolumeRequestContentToPb(st *CreateVolumeRequestContent) (*createVolumeRequestContentPb, error) { - if st == nil { - return nil, nil - } - pb := &createVolumeRequestContentPb{} - pb.CatalogName = st.CatalogName - pb.Comment = st.Comment - pb.Name = st.Name - pb.SchemaName = st.SchemaName - pb.StorageLocation = st.StorageLocation - pb.VolumeType = st.VolumeType - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createVolumeRequestContentPb struct { - CatalogName string `json:"catalog_name"` - Comment string `json:"comment,omitempty"` - Name string `json:"name"` - SchemaName string `json:"schema_name"` - StorageLocation string `json:"storage_location,omitempty"` - VolumeType VolumeType `json:"volume_type"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createVolumeRequestContentFromPb(pb *createVolumeRequestContentPb) (*CreateVolumeRequestContent, error) { - if pb == nil { - return nil, nil - } - st := &CreateVolumeRequestContent{} - st.CatalogName = pb.CatalogName - st.Comment = pb.Comment - st.Name = pb.Name - st.SchemaName = pb.SchemaName - st.StorageLocation = pb.StorageLocation - st.VolumeType = pb.VolumeType - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createVolumeRequestContentPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createVolumeRequestContentPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func credentialInfoToPb(st *CredentialInfo) (*credentialInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &credentialInfoPb{} - pb.AwsIamRole = st.AwsIamRole - pb.AzureManagedIdentity = st.AzureManagedIdentity - pb.AzureServicePrincipal = st.AzureServicePrincipal - pb.Comment = st.Comment - pb.CreatedAt = st.CreatedAt - pb.CreatedBy = st.CreatedBy - pb.DatabricksGcpServiceAccount = st.DatabricksGcpServiceAccount - pb.FullName = st.FullName - pb.Id = st.Id - pb.IsolationMode = st.IsolationMode - pb.MetastoreId = st.MetastoreId - pb.Name = st.Name - pb.Owner = st.Owner - pb.Purpose = st.Purpose - pb.ReadOnly = st.ReadOnly - pb.UpdatedAt = st.UpdatedAt - pb.UpdatedBy = st.UpdatedBy - pb.UsedForManagedStorage = st.UsedForManagedStorage - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type credentialInfoPb struct { - AwsIamRole *AwsIamRole `json:"aws_iam_role,omitempty"` - AzureManagedIdentity *AzureManagedIdentity `json:"azure_managed_identity,omitempty"` - AzureServicePrincipal *AzureServicePrincipal `json:"azure_service_principal,omitempty"` - Comment string `json:"comment,omitempty"` - CreatedAt int64 `json:"created_at,omitempty"` - CreatedBy string `json:"created_by,omitempty"` - DatabricksGcpServiceAccount *DatabricksGcpServiceAccount `json:"databricks_gcp_service_account,omitempty"` - FullName string `json:"full_name,omitempty"` - Id string `json:"id,omitempty"` - IsolationMode IsolationMode `json:"isolation_mode,omitempty"` - MetastoreId string `json:"metastore_id,omitempty"` - Name string `json:"name,omitempty"` - Owner string `json:"owner,omitempty"` - Purpose CredentialPurpose `json:"purpose,omitempty"` - ReadOnly bool `json:"read_only,omitempty"` - UpdatedAt int64 `json:"updated_at,omitempty"` - UpdatedBy string `json:"updated_by,omitempty"` - UsedForManagedStorage bool `json:"used_for_managed_storage,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func credentialInfoFromPb(pb *credentialInfoPb) (*CredentialInfo, error) { - if pb == nil { - return nil, nil - } - st := &CredentialInfo{} - st.AwsIamRole = pb.AwsIamRole - st.AzureManagedIdentity = pb.AzureManagedIdentity - st.AzureServicePrincipal = pb.AzureServicePrincipal - st.Comment = pb.Comment - st.CreatedAt = pb.CreatedAt - st.CreatedBy = pb.CreatedBy - st.DatabricksGcpServiceAccount = pb.DatabricksGcpServiceAccount - st.FullName = pb.FullName - st.Id = pb.Id - st.IsolationMode = pb.IsolationMode - st.MetastoreId = pb.MetastoreId - st.Name = pb.Name - st.Owner = pb.Owner - st.Purpose = pb.Purpose - st.ReadOnly = pb.ReadOnly - st.UpdatedAt = pb.UpdatedAt - st.UpdatedBy = pb.UpdatedBy - st.UsedForManagedStorage = pb.UsedForManagedStorage - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *credentialInfoPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st credentialInfoPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func credentialValidationResultToPb(st *CredentialValidationResult) (*credentialValidationResultPb, error) { - if st == nil { - return nil, nil - } - pb := &credentialValidationResultPb{} - pb.Message = st.Message - pb.Result = st.Result - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type credentialValidationResultPb struct { - Message string `json:"message,omitempty"` - Result ValidateCredentialResult `json:"result,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func credentialValidationResultFromPb(pb *credentialValidationResultPb) (*CredentialValidationResult, error) { - if pb == nil { - return nil, nil - } - st := &CredentialValidationResult{} - st.Message = pb.Message - st.Result = pb.Result - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *credentialValidationResultPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st credentialValidationResultPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func databricksGcpServiceAccountToPb(st *DatabricksGcpServiceAccount) (*databricksGcpServiceAccountPb, error) { - if st == nil { - return nil, nil - } - pb := &databricksGcpServiceAccountPb{} - pb.CredentialId = st.CredentialId - pb.Email = st.Email - pb.PrivateKeyId = st.PrivateKeyId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type databricksGcpServiceAccountPb struct { - CredentialId string `json:"credential_id,omitempty"` - Email string `json:"email,omitempty"` - PrivateKeyId string `json:"private_key_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func databricksGcpServiceAccountFromPb(pb *databricksGcpServiceAccountPb) (*DatabricksGcpServiceAccount, error) { - if pb == nil { - return nil, nil - } - st := &DatabricksGcpServiceAccount{} - st.CredentialId = pb.CredentialId - st.Email = pb.Email - st.PrivateKeyId = pb.PrivateKeyId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *databricksGcpServiceAccountPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st databricksGcpServiceAccountPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func databricksGcpServiceAccountRequestToPb(st *DatabricksGcpServiceAccountRequest) (*databricksGcpServiceAccountRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &databricksGcpServiceAccountRequestPb{} - - return pb, nil -} - -type databricksGcpServiceAccountRequestPb struct { -} - -func databricksGcpServiceAccountRequestFromPb(pb *databricksGcpServiceAccountRequestPb) (*DatabricksGcpServiceAccountRequest, error) { - if pb == nil { - return nil, nil - } - st := &DatabricksGcpServiceAccountRequest{} - - return st, nil -} - -func databricksGcpServiceAccountResponseToPb(st *DatabricksGcpServiceAccountResponse) (*databricksGcpServiceAccountResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &databricksGcpServiceAccountResponsePb{} - pb.CredentialId = st.CredentialId - pb.Email = st.Email - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type databricksGcpServiceAccountResponsePb struct { - CredentialId string `json:"credential_id,omitempty"` - Email string `json:"email,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func databricksGcpServiceAccountResponseFromPb(pb *databricksGcpServiceAccountResponsePb) (*DatabricksGcpServiceAccountResponse, error) { - if pb == nil { - return nil, nil - } - st := &DatabricksGcpServiceAccountResponse{} - st.CredentialId = pb.CredentialId - st.Email = pb.Email - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *databricksGcpServiceAccountResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st databricksGcpServiceAccountResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func deleteAccountMetastoreAssignmentRequestToPb(st *DeleteAccountMetastoreAssignmentRequest) (*deleteAccountMetastoreAssignmentRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteAccountMetastoreAssignmentRequestPb{} - pb.MetastoreId = st.MetastoreId - pb.WorkspaceId = st.WorkspaceId - - return pb, nil -} - -type deleteAccountMetastoreAssignmentRequestPb struct { - MetastoreId string `json:"-" url:"-"` - WorkspaceId int64 `json:"-" url:"-"` -} - -func deleteAccountMetastoreAssignmentRequestFromPb(pb *deleteAccountMetastoreAssignmentRequestPb) (*DeleteAccountMetastoreAssignmentRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteAccountMetastoreAssignmentRequest{} - st.MetastoreId = pb.MetastoreId - st.WorkspaceId = pb.WorkspaceId - - return st, nil -} - -func deleteAccountMetastoreRequestToPb(st *DeleteAccountMetastoreRequest) (*deleteAccountMetastoreRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteAccountMetastoreRequestPb{} - pb.Force = st.Force - pb.MetastoreId = st.MetastoreId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type deleteAccountMetastoreRequestPb struct { - Force bool `json:"-" url:"force,omitempty"` - MetastoreId string `json:"-" url:"-"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func deleteAccountMetastoreRequestFromPb(pb *deleteAccountMetastoreRequestPb) (*DeleteAccountMetastoreRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteAccountMetastoreRequest{} - st.Force = pb.Force - st.MetastoreId = pb.MetastoreId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *deleteAccountMetastoreRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st deleteAccountMetastoreRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func deleteAccountStorageCredentialRequestToPb(st *DeleteAccountStorageCredentialRequest) (*deleteAccountStorageCredentialRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteAccountStorageCredentialRequestPb{} - pb.Force = st.Force - pb.MetastoreId = st.MetastoreId - pb.StorageCredentialName = st.StorageCredentialName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type deleteAccountStorageCredentialRequestPb struct { - Force bool `json:"-" url:"force,omitempty"` - MetastoreId string `json:"-" url:"-"` - StorageCredentialName string `json:"-" url:"-"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func deleteAccountStorageCredentialRequestFromPb(pb *deleteAccountStorageCredentialRequestPb) (*DeleteAccountStorageCredentialRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteAccountStorageCredentialRequest{} - st.Force = pb.Force - st.MetastoreId = pb.MetastoreId - st.StorageCredentialName = pb.StorageCredentialName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *deleteAccountStorageCredentialRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st deleteAccountStorageCredentialRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func deleteAliasRequestToPb(st *DeleteAliasRequest) (*deleteAliasRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteAliasRequestPb{} - pb.Alias = st.Alias - pb.FullName = st.FullName - - return pb, nil -} - -type deleteAliasRequestPb struct { - Alias string `json:"-" url:"-"` - FullName string `json:"-" url:"-"` -} - -func deleteAliasRequestFromPb(pb *deleteAliasRequestPb) (*DeleteAliasRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteAliasRequest{} - st.Alias = pb.Alias - st.FullName = pb.FullName - - return st, nil -} - -func deleteAliasResponseToPb(st *DeleteAliasResponse) (*deleteAliasResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteAliasResponsePb{} - - return pb, nil -} - -type deleteAliasResponsePb struct { -} - -func deleteAliasResponseFromPb(pb *deleteAliasResponsePb) (*DeleteAliasResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteAliasResponse{} - - return st, nil -} - -func deleteCatalogRequestToPb(st *DeleteCatalogRequest) (*deleteCatalogRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteCatalogRequestPb{} - pb.Force = st.Force - pb.Name = st.Name - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type deleteCatalogRequestPb struct { - Force bool `json:"-" url:"force,omitempty"` - Name string `json:"-" url:"-"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func deleteCatalogRequestFromPb(pb *deleteCatalogRequestPb) (*DeleteCatalogRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteCatalogRequest{} - st.Force = pb.Force - st.Name = pb.Name - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *deleteCatalogRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st deleteCatalogRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func deleteConnectionRequestToPb(st *DeleteConnectionRequest) (*deleteConnectionRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteConnectionRequestPb{} - pb.Name = st.Name - - return pb, nil -} - -type deleteConnectionRequestPb struct { - Name string `json:"-" url:"-"` -} - -func deleteConnectionRequestFromPb(pb *deleteConnectionRequestPb) (*DeleteConnectionRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteConnectionRequest{} - st.Name = pb.Name - - return st, nil -} - -func deleteCredentialRequestToPb(st *DeleteCredentialRequest) (*deleteCredentialRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteCredentialRequestPb{} - pb.Force = st.Force - pb.NameArg = st.NameArg - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type deleteCredentialRequestPb struct { - Force bool `json:"-" url:"force,omitempty"` - NameArg string `json:"-" url:"-"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func deleteCredentialRequestFromPb(pb *deleteCredentialRequestPb) (*DeleteCredentialRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteCredentialRequest{} - st.Force = pb.Force - st.NameArg = pb.NameArg - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *deleteCredentialRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st deleteCredentialRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func deleteCredentialResponseToPb(st *DeleteCredentialResponse) (*deleteCredentialResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteCredentialResponsePb{} - - return pb, nil -} - -type deleteCredentialResponsePb struct { -} - -func deleteCredentialResponseFromPb(pb *deleteCredentialResponsePb) (*DeleteCredentialResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteCredentialResponse{} - - return st, nil -} - -func deleteExternalLocationRequestToPb(st *DeleteExternalLocationRequest) (*deleteExternalLocationRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteExternalLocationRequestPb{} - pb.Force = st.Force - pb.Name = st.Name - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type deleteExternalLocationRequestPb struct { - Force bool `json:"-" url:"force,omitempty"` - Name string `json:"-" url:"-"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func deleteExternalLocationRequestFromPb(pb *deleteExternalLocationRequestPb) (*DeleteExternalLocationRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteExternalLocationRequest{} - st.Force = pb.Force - st.Name = pb.Name - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *deleteExternalLocationRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st deleteExternalLocationRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func deleteFunctionRequestToPb(st *DeleteFunctionRequest) (*deleteFunctionRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteFunctionRequestPb{} - pb.Force = st.Force - pb.Name = st.Name - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type deleteFunctionRequestPb struct { - Force bool `json:"-" url:"force,omitempty"` - Name string `json:"-" url:"-"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func deleteFunctionRequestFromPb(pb *deleteFunctionRequestPb) (*DeleteFunctionRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteFunctionRequest{} - st.Force = pb.Force - st.Name = pb.Name - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *deleteFunctionRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st deleteFunctionRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func deleteMetastoreRequestToPb(st *DeleteMetastoreRequest) (*deleteMetastoreRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteMetastoreRequestPb{} - pb.Force = st.Force - pb.Id = st.Id - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type deleteMetastoreRequestPb struct { - Force bool `json:"-" url:"force,omitempty"` - Id string `json:"-" url:"-"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func deleteMetastoreRequestFromPb(pb *deleteMetastoreRequestPb) (*DeleteMetastoreRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteMetastoreRequest{} - st.Force = pb.Force - st.Id = pb.Id - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *deleteMetastoreRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st deleteMetastoreRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func deleteModelVersionRequestToPb(st *DeleteModelVersionRequest) (*deleteModelVersionRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteModelVersionRequestPb{} - pb.FullName = st.FullName - pb.Version = st.Version - - return pb, nil -} - -type deleteModelVersionRequestPb struct { - FullName string `json:"-" url:"-"` - Version int `json:"-" url:"-"` -} - -func deleteModelVersionRequestFromPb(pb *deleteModelVersionRequestPb) (*DeleteModelVersionRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteModelVersionRequest{} - st.FullName = pb.FullName - st.Version = pb.Version - - return st, nil -} - -func deleteOnlineTableRequestToPb(st *DeleteOnlineTableRequest) (*deleteOnlineTableRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteOnlineTableRequestPb{} - pb.Name = st.Name - - return pb, nil -} - -type deleteOnlineTableRequestPb struct { - Name string `json:"-" url:"-"` -} - -func deleteOnlineTableRequestFromPb(pb *deleteOnlineTableRequestPb) (*DeleteOnlineTableRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteOnlineTableRequest{} - st.Name = pb.Name - - return st, nil -} - -func deleteQualityMonitorRequestToPb(st *DeleteQualityMonitorRequest) (*deleteQualityMonitorRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteQualityMonitorRequestPb{} - pb.TableName = st.TableName - - return pb, nil -} - -type deleteQualityMonitorRequestPb struct { - TableName string `json:"-" url:"-"` -} - -func deleteQualityMonitorRequestFromPb(pb *deleteQualityMonitorRequestPb) (*DeleteQualityMonitorRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteQualityMonitorRequest{} - st.TableName = pb.TableName - - return st, nil -} - -func deleteRegisteredModelRequestToPb(st *DeleteRegisteredModelRequest) (*deleteRegisteredModelRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteRegisteredModelRequestPb{} - pb.FullName = st.FullName - - return pb, nil -} - -type deleteRegisteredModelRequestPb struct { - FullName string `json:"-" url:"-"` -} - -func deleteRegisteredModelRequestFromPb(pb *deleteRegisteredModelRequestPb) (*DeleteRegisteredModelRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteRegisteredModelRequest{} - st.FullName = pb.FullName - - return st, nil -} - -func deleteResponseToPb(st *DeleteResponse) (*deleteResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteResponsePb{} - - return pb, nil -} - -type deleteResponsePb struct { -} - -func deleteResponseFromPb(pb *deleteResponsePb) (*DeleteResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteResponse{} - - return st, nil -} - -func deleteSchemaRequestToPb(st *DeleteSchemaRequest) (*deleteSchemaRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteSchemaRequestPb{} - pb.Force = st.Force - pb.FullName = st.FullName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type deleteSchemaRequestPb struct { - Force bool `json:"-" url:"force,omitempty"` - FullName string `json:"-" url:"-"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func deleteSchemaRequestFromPb(pb *deleteSchemaRequestPb) (*DeleteSchemaRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteSchemaRequest{} - st.Force = pb.Force - st.FullName = pb.FullName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *deleteSchemaRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st deleteSchemaRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func deleteStorageCredentialRequestToPb(st *DeleteStorageCredentialRequest) (*deleteStorageCredentialRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteStorageCredentialRequestPb{} - pb.Force = st.Force - pb.Name = st.Name - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type deleteStorageCredentialRequestPb struct { - Force bool `json:"-" url:"force,omitempty"` - Name string `json:"-" url:"-"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func deleteStorageCredentialRequestFromPb(pb *deleteStorageCredentialRequestPb) (*DeleteStorageCredentialRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteStorageCredentialRequest{} - st.Force = pb.Force - st.Name = pb.Name - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *deleteStorageCredentialRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st deleteStorageCredentialRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func deleteTableConstraintRequestToPb(st *DeleteTableConstraintRequest) (*deleteTableConstraintRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteTableConstraintRequestPb{} - pb.Cascade = st.Cascade - pb.ConstraintName = st.ConstraintName - pb.FullName = st.FullName - - return pb, nil -} - -type deleteTableConstraintRequestPb struct { - Cascade bool `json:"-" url:"cascade"` - ConstraintName string `json:"-" url:"constraint_name"` - FullName string `json:"-" url:"-"` -} - -func deleteTableConstraintRequestFromPb(pb *deleteTableConstraintRequestPb) (*DeleteTableConstraintRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteTableConstraintRequest{} - st.Cascade = pb.Cascade - st.ConstraintName = pb.ConstraintName - st.FullName = pb.FullName - - return st, nil -} - -func deleteTableRequestToPb(st *DeleteTableRequest) (*deleteTableRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteTableRequestPb{} - pb.FullName = st.FullName - - return pb, nil -} - -type deleteTableRequestPb struct { - FullName string `json:"-" url:"-"` -} - -func deleteTableRequestFromPb(pb *deleteTableRequestPb) (*DeleteTableRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteTableRequest{} - st.FullName = pb.FullName - - return st, nil -} - -func deleteVolumeRequestToPb(st *DeleteVolumeRequest) (*deleteVolumeRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteVolumeRequestPb{} - pb.Name = st.Name - - return pb, nil -} - -type deleteVolumeRequestPb struct { - Name string `json:"-" url:"-"` -} - -func deleteVolumeRequestFromPb(pb *deleteVolumeRequestPb) (*DeleteVolumeRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteVolumeRequest{} - st.Name = pb.Name - - return st, nil -} - -func deltaRuntimePropertiesKvPairsToPb(st *DeltaRuntimePropertiesKvPairs) (*deltaRuntimePropertiesKvPairsPb, error) { - if st == nil { - return nil, nil - } - pb := &deltaRuntimePropertiesKvPairsPb{} - pb.DeltaRuntimeProperties = st.DeltaRuntimeProperties - - return pb, nil -} - -type deltaRuntimePropertiesKvPairsPb struct { - DeltaRuntimeProperties map[string]string `json:"delta_runtime_properties"` -} - -func deltaRuntimePropertiesKvPairsFromPb(pb *deltaRuntimePropertiesKvPairsPb) (*DeltaRuntimePropertiesKvPairs, error) { - if pb == nil { - return nil, nil - } - st := &DeltaRuntimePropertiesKvPairs{} - st.DeltaRuntimeProperties = pb.DeltaRuntimeProperties - - return st, nil -} - -func dependencyToPb(st *Dependency) (*dependencyPb, error) { - if st == nil { - return nil, nil - } - pb := &dependencyPb{} - pb.Function = st.Function - pb.Table = st.Table - - return pb, nil -} - -type dependencyPb struct { - Function *FunctionDependency `json:"function,omitempty"` - Table *TableDependency `json:"table,omitempty"` -} - -func dependencyFromPb(pb *dependencyPb) (*Dependency, error) { - if pb == nil { - return nil, nil - } - st := &Dependency{} - st.Function = pb.Function - st.Table = pb.Table - - return st, nil -} - -func dependencyListToPb(st *DependencyList) (*dependencyListPb, error) { - if st == nil { - return nil, nil - } - pb := &dependencyListPb{} - pb.Dependencies = st.Dependencies - - return pb, nil -} - -type dependencyListPb struct { - Dependencies []Dependency `json:"dependencies,omitempty"` -} - -func dependencyListFromPb(pb *dependencyListPb) (*DependencyList, error) { - if pb == nil { - return nil, nil - } - st := &DependencyList{} - st.Dependencies = pb.Dependencies - - return st, nil -} - -func disableRequestToPb(st *DisableRequest) (*disableRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &disableRequestPb{} - pb.MetastoreId = st.MetastoreId - pb.SchemaName = st.SchemaName - - return pb, nil -} - -type disableRequestPb struct { - MetastoreId string `json:"-" url:"-"` - SchemaName string `json:"-" url:"-"` -} - -func disableRequestFromPb(pb *disableRequestPb) (*DisableRequest, error) { - if pb == nil { - return nil, nil - } - st := &DisableRequest{} - st.MetastoreId = pb.MetastoreId - st.SchemaName = pb.SchemaName - - return st, nil -} - -func disableResponseToPb(st *DisableResponse) (*disableResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &disableResponsePb{} - - return pb, nil -} - -type disableResponsePb struct { -} - -func disableResponseFromPb(pb *disableResponsePb) (*DisableResponse, error) { - if pb == nil { - return nil, nil - } - st := &DisableResponse{} - - return st, nil -} - -func effectivePermissionsListToPb(st *EffectivePermissionsList) (*effectivePermissionsListPb, error) { - if st == nil { - return nil, nil - } - pb := &effectivePermissionsListPb{} - pb.NextPageToken = st.NextPageToken - pb.PrivilegeAssignments = st.PrivilegeAssignments - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type effectivePermissionsListPb struct { - NextPageToken string `json:"next_page_token,omitempty"` - PrivilegeAssignments []EffectivePrivilegeAssignment `json:"privilege_assignments,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func effectivePermissionsListFromPb(pb *effectivePermissionsListPb) (*EffectivePermissionsList, error) { - if pb == nil { - return nil, nil - } - st := &EffectivePermissionsList{} - st.NextPageToken = pb.NextPageToken - st.PrivilegeAssignments = pb.PrivilegeAssignments - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *effectivePermissionsListPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st effectivePermissionsListPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func effectivePredictiveOptimizationFlagToPb(st *EffectivePredictiveOptimizationFlag) (*effectivePredictiveOptimizationFlagPb, error) { - if st == nil { - return nil, nil - } - pb := &effectivePredictiveOptimizationFlagPb{} - pb.InheritedFromName = st.InheritedFromName - pb.InheritedFromType = st.InheritedFromType - pb.Value = st.Value - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type effectivePredictiveOptimizationFlagPb struct { - InheritedFromName string `json:"inherited_from_name,omitempty"` - InheritedFromType EffectivePredictiveOptimizationFlagInheritedFromType `json:"inherited_from_type,omitempty"` - Value EnablePredictiveOptimization `json:"value"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func effectivePredictiveOptimizationFlagFromPb(pb *effectivePredictiveOptimizationFlagPb) (*EffectivePredictiveOptimizationFlag, error) { - if pb == nil { - return nil, nil - } - st := &EffectivePredictiveOptimizationFlag{} - st.InheritedFromName = pb.InheritedFromName - st.InheritedFromType = pb.InheritedFromType - st.Value = pb.Value - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *effectivePredictiveOptimizationFlagPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st effectivePredictiveOptimizationFlagPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func effectivePrivilegeToPb(st *EffectivePrivilege) (*effectivePrivilegePb, error) { - if st == nil { - return nil, nil - } - pb := &effectivePrivilegePb{} - pb.InheritedFromName = st.InheritedFromName - pb.InheritedFromType = st.InheritedFromType - pb.Privilege = st.Privilege - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type effectivePrivilegePb struct { - InheritedFromName string `json:"inherited_from_name,omitempty"` - InheritedFromType SecurableType `json:"inherited_from_type,omitempty"` - Privilege Privilege `json:"privilege,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func effectivePrivilegeFromPb(pb *effectivePrivilegePb) (*EffectivePrivilege, error) { - if pb == nil { - return nil, nil - } - st := &EffectivePrivilege{} - st.InheritedFromName = pb.InheritedFromName - st.InheritedFromType = pb.InheritedFromType - st.Privilege = pb.Privilege - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *effectivePrivilegePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st effectivePrivilegePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func effectivePrivilegeAssignmentToPb(st *EffectivePrivilegeAssignment) (*effectivePrivilegeAssignmentPb, error) { - if st == nil { - return nil, nil - } - pb := &effectivePrivilegeAssignmentPb{} - pb.Principal = st.Principal - pb.Privileges = st.Privileges - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type effectivePrivilegeAssignmentPb struct { - Principal string `json:"principal,omitempty"` - Privileges []EffectivePrivilege `json:"privileges,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func effectivePrivilegeAssignmentFromPb(pb *effectivePrivilegeAssignmentPb) (*EffectivePrivilegeAssignment, error) { - if pb == nil { - return nil, nil - } - st := &EffectivePrivilegeAssignment{} - st.Principal = pb.Principal - st.Privileges = pb.Privileges - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *effectivePrivilegeAssignmentPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st effectivePrivilegeAssignmentPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func enableRequestToPb(st *EnableRequest) (*enableRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &enableRequestPb{} - pb.CatalogName = st.CatalogName - pb.MetastoreId = st.MetastoreId - pb.SchemaName = st.SchemaName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type enableRequestPb struct { - CatalogName string `json:"catalog_name,omitempty"` - MetastoreId string `json:"-" url:"-"` - SchemaName string `json:"-" url:"-"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func enableRequestFromPb(pb *enableRequestPb) (*EnableRequest, error) { - if pb == nil { - return nil, nil - } - st := &EnableRequest{} - st.CatalogName = pb.CatalogName - st.MetastoreId = pb.MetastoreId - st.SchemaName = pb.SchemaName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *enableRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st enableRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func enableResponseToPb(st *EnableResponse) (*enableResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &enableResponsePb{} - - return pb, nil -} - -type enableResponsePb struct { -} - -func enableResponseFromPb(pb *enableResponsePb) (*EnableResponse, error) { - if pb == nil { - return nil, nil - } - st := &EnableResponse{} - - return st, nil -} - -func encryptionDetailsToPb(st *EncryptionDetails) (*encryptionDetailsPb, error) { - if st == nil { - return nil, nil - } - pb := &encryptionDetailsPb{} - pb.SseEncryptionDetails = st.SseEncryptionDetails - - return pb, nil -} - -type encryptionDetailsPb struct { - SseEncryptionDetails *SseEncryptionDetails `json:"sse_encryption_details,omitempty"` -} - -func encryptionDetailsFromPb(pb *encryptionDetailsPb) (*EncryptionDetails, error) { - if pb == nil { - return nil, nil - } - st := &EncryptionDetails{} - st.SseEncryptionDetails = pb.SseEncryptionDetails - - return st, nil -} - -func existsRequestToPb(st *ExistsRequest) (*existsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &existsRequestPb{} - pb.FullName = st.FullName - - return pb, nil -} - -type existsRequestPb struct { - FullName string `json:"-" url:"-"` -} - -func existsRequestFromPb(pb *existsRequestPb) (*ExistsRequest, error) { - if pb == nil { - return nil, nil - } - st := &ExistsRequest{} - st.FullName = pb.FullName - - return st, nil -} - -func externalLocationInfoToPb(st *ExternalLocationInfo) (*externalLocationInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &externalLocationInfoPb{} - pb.BrowseOnly = st.BrowseOnly - pb.Comment = st.Comment - pb.CreatedAt = st.CreatedAt - pb.CreatedBy = st.CreatedBy - pb.CredentialId = st.CredentialId - pb.CredentialName = st.CredentialName - pb.EnableFileEvents = st.EnableFileEvents - pb.EncryptionDetails = st.EncryptionDetails - pb.Fallback = st.Fallback - pb.FileEventQueue = st.FileEventQueue - pb.IsolationMode = st.IsolationMode - pb.MetastoreId = st.MetastoreId - pb.Name = st.Name - pb.Owner = st.Owner - pb.ReadOnly = st.ReadOnly - pb.UpdatedAt = st.UpdatedAt - pb.UpdatedBy = st.UpdatedBy - pb.Url = st.Url - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type externalLocationInfoPb struct { - BrowseOnly bool `json:"browse_only,omitempty"` - Comment string `json:"comment,omitempty"` - CreatedAt int64 `json:"created_at,omitempty"` - CreatedBy string `json:"created_by,omitempty"` - CredentialId string `json:"credential_id,omitempty"` - CredentialName string `json:"credential_name,omitempty"` - EnableFileEvents bool `json:"enable_file_events,omitempty"` - EncryptionDetails *EncryptionDetails `json:"encryption_details,omitempty"` - Fallback bool `json:"fallback,omitempty"` - FileEventQueue *FileEventQueue `json:"file_event_queue,omitempty"` - IsolationMode IsolationMode `json:"isolation_mode,omitempty"` - MetastoreId string `json:"metastore_id,omitempty"` - Name string `json:"name,omitempty"` - Owner string `json:"owner,omitempty"` - ReadOnly bool `json:"read_only,omitempty"` - UpdatedAt int64 `json:"updated_at,omitempty"` - UpdatedBy string `json:"updated_by,omitempty"` - Url string `json:"url,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func externalLocationInfoFromPb(pb *externalLocationInfoPb) (*ExternalLocationInfo, error) { - if pb == nil { - return nil, nil - } - st := &ExternalLocationInfo{} - st.BrowseOnly = pb.BrowseOnly - st.Comment = pb.Comment - st.CreatedAt = pb.CreatedAt - st.CreatedBy = pb.CreatedBy - st.CredentialId = pb.CredentialId - st.CredentialName = pb.CredentialName - st.EnableFileEvents = pb.EnableFileEvents - st.EncryptionDetails = pb.EncryptionDetails - st.Fallback = pb.Fallback - st.FileEventQueue = pb.FileEventQueue - st.IsolationMode = pb.IsolationMode - st.MetastoreId = pb.MetastoreId - st.Name = pb.Name - st.Owner = pb.Owner - st.ReadOnly = pb.ReadOnly - st.UpdatedAt = pb.UpdatedAt - st.UpdatedBy = pb.UpdatedBy - st.Url = pb.Url - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *externalLocationInfoPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st externalLocationInfoPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func failedStatusToPb(st *FailedStatus) (*failedStatusPb, error) { - if st == nil { - return nil, nil - } - pb := &failedStatusPb{} - pb.LastProcessedCommitVersion = st.LastProcessedCommitVersion - pb.Timestamp = st.Timestamp - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type failedStatusPb struct { - LastProcessedCommitVersion int64 `json:"last_processed_commit_version,omitempty"` - Timestamp string `json:"timestamp,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func failedStatusFromPb(pb *failedStatusPb) (*FailedStatus, error) { - if pb == nil { - return nil, nil - } - st := &FailedStatus{} - st.LastProcessedCommitVersion = pb.LastProcessedCommitVersion - st.Timestamp = pb.Timestamp - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *failedStatusPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st failedStatusPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func fileEventQueueToPb(st *FileEventQueue) (*fileEventQueuePb, error) { - if st == nil { - return nil, nil - } - pb := &fileEventQueuePb{} - pb.ManagedAqs = st.ManagedAqs - pb.ManagedPubsub = st.ManagedPubsub - pb.ManagedSqs = st.ManagedSqs - pb.ProvidedAqs = st.ProvidedAqs - pb.ProvidedPubsub = st.ProvidedPubsub - pb.ProvidedSqs = st.ProvidedSqs - - return pb, nil -} - -type fileEventQueuePb struct { - ManagedAqs *AzureQueueStorage `json:"managed_aqs,omitempty"` - ManagedPubsub *GcpPubsub `json:"managed_pubsub,omitempty"` - ManagedSqs *AwsSqsQueue `json:"managed_sqs,omitempty"` - ProvidedAqs *AzureQueueStorage `json:"provided_aqs,omitempty"` - ProvidedPubsub *GcpPubsub `json:"provided_pubsub,omitempty"` - ProvidedSqs *AwsSqsQueue `json:"provided_sqs,omitempty"` -} - -func fileEventQueueFromPb(pb *fileEventQueuePb) (*FileEventQueue, error) { - if pb == nil { - return nil, nil - } - st := &FileEventQueue{} - st.ManagedAqs = pb.ManagedAqs - st.ManagedPubsub = pb.ManagedPubsub - st.ManagedSqs = pb.ManagedSqs - st.ProvidedAqs = pb.ProvidedAqs - st.ProvidedPubsub = pb.ProvidedPubsub - st.ProvidedSqs = pb.ProvidedSqs - - return st, nil -} - -func foreignKeyConstraintToPb(st *ForeignKeyConstraint) (*foreignKeyConstraintPb, error) { - if st == nil { - return nil, nil - } - pb := &foreignKeyConstraintPb{} - pb.ChildColumns = st.ChildColumns - pb.Name = st.Name - pb.ParentColumns = st.ParentColumns - pb.ParentTable = st.ParentTable - - return pb, nil -} - -type foreignKeyConstraintPb struct { - ChildColumns []string `json:"child_columns"` - Name string `json:"name"` - ParentColumns []string `json:"parent_columns"` - ParentTable string `json:"parent_table"` -} - -func foreignKeyConstraintFromPb(pb *foreignKeyConstraintPb) (*ForeignKeyConstraint, error) { - if pb == nil { - return nil, nil - } - st := &ForeignKeyConstraint{} - st.ChildColumns = pb.ChildColumns - st.Name = pb.Name - st.ParentColumns = pb.ParentColumns - st.ParentTable = pb.ParentTable - - return st, nil -} - -func functionDependencyToPb(st *FunctionDependency) (*functionDependencyPb, error) { - if st == nil { - return nil, nil - } - pb := &functionDependencyPb{} - pb.FunctionFullName = st.FunctionFullName - - return pb, nil -} - -type functionDependencyPb struct { - FunctionFullName string `json:"function_full_name"` -} - -func functionDependencyFromPb(pb *functionDependencyPb) (*FunctionDependency, error) { - if pb == nil { - return nil, nil - } - st := &FunctionDependency{} - st.FunctionFullName = pb.FunctionFullName - - return st, nil -} - -func functionInfoToPb(st *FunctionInfo) (*functionInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &functionInfoPb{} - pb.BrowseOnly = st.BrowseOnly - pb.CatalogName = st.CatalogName - pb.Comment = st.Comment - pb.CreatedAt = st.CreatedAt - pb.CreatedBy = st.CreatedBy - pb.DataType = st.DataType - pb.ExternalLanguage = st.ExternalLanguage - pb.ExternalName = st.ExternalName - pb.FullDataType = st.FullDataType - pb.FullName = st.FullName - pb.FunctionId = st.FunctionId - pb.InputParams = st.InputParams - pb.IsDeterministic = st.IsDeterministic - pb.IsNullCall = st.IsNullCall - pb.MetastoreId = st.MetastoreId - pb.Name = st.Name - pb.Owner = st.Owner - pb.ParameterStyle = st.ParameterStyle - pb.Properties = st.Properties - pb.ReturnParams = st.ReturnParams - pb.RoutineBody = st.RoutineBody - pb.RoutineDefinition = st.RoutineDefinition - pb.RoutineDependencies = st.RoutineDependencies - pb.SchemaName = st.SchemaName - pb.SecurityType = st.SecurityType - pb.SpecificName = st.SpecificName - pb.SqlDataAccess = st.SqlDataAccess - pb.SqlPath = st.SqlPath - pb.UpdatedAt = st.UpdatedAt - pb.UpdatedBy = st.UpdatedBy - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type functionInfoPb struct { - BrowseOnly bool `json:"browse_only,omitempty"` - CatalogName string `json:"catalog_name,omitempty"` - Comment string `json:"comment,omitempty"` - CreatedAt int64 `json:"created_at,omitempty"` - CreatedBy string `json:"created_by,omitempty"` - DataType ColumnTypeName `json:"data_type,omitempty"` - ExternalLanguage string `json:"external_language,omitempty"` - ExternalName string `json:"external_name,omitempty"` - FullDataType string `json:"full_data_type,omitempty"` - FullName string `json:"full_name,omitempty"` - FunctionId string `json:"function_id,omitempty"` - InputParams *FunctionParameterInfos `json:"input_params,omitempty"` - IsDeterministic bool `json:"is_deterministic,omitempty"` - IsNullCall bool `json:"is_null_call,omitempty"` - MetastoreId string `json:"metastore_id,omitempty"` - Name string `json:"name,omitempty"` - Owner string `json:"owner,omitempty"` - ParameterStyle FunctionInfoParameterStyle `json:"parameter_style,omitempty"` - Properties string `json:"properties,omitempty"` - ReturnParams *FunctionParameterInfos `json:"return_params,omitempty"` - RoutineBody FunctionInfoRoutineBody `json:"routine_body,omitempty"` - RoutineDefinition string `json:"routine_definition,omitempty"` - RoutineDependencies *DependencyList `json:"routine_dependencies,omitempty"` - SchemaName string `json:"schema_name,omitempty"` - SecurityType FunctionInfoSecurityType `json:"security_type,omitempty"` - SpecificName string `json:"specific_name,omitempty"` - SqlDataAccess FunctionInfoSqlDataAccess `json:"sql_data_access,omitempty"` - SqlPath string `json:"sql_path,omitempty"` - UpdatedAt int64 `json:"updated_at,omitempty"` - UpdatedBy string `json:"updated_by,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func functionInfoFromPb(pb *functionInfoPb) (*FunctionInfo, error) { - if pb == nil { - return nil, nil - } - st := &FunctionInfo{} - st.BrowseOnly = pb.BrowseOnly - st.CatalogName = pb.CatalogName - st.Comment = pb.Comment - st.CreatedAt = pb.CreatedAt - st.CreatedBy = pb.CreatedBy - st.DataType = pb.DataType - st.ExternalLanguage = pb.ExternalLanguage - st.ExternalName = pb.ExternalName - st.FullDataType = pb.FullDataType - st.FullName = pb.FullName - st.FunctionId = pb.FunctionId - st.InputParams = pb.InputParams - st.IsDeterministic = pb.IsDeterministic - st.IsNullCall = pb.IsNullCall - st.MetastoreId = pb.MetastoreId - st.Name = pb.Name - st.Owner = pb.Owner - st.ParameterStyle = pb.ParameterStyle - st.Properties = pb.Properties - st.ReturnParams = pb.ReturnParams - st.RoutineBody = pb.RoutineBody - st.RoutineDefinition = pb.RoutineDefinition - st.RoutineDependencies = pb.RoutineDependencies - st.SchemaName = pb.SchemaName - st.SecurityType = pb.SecurityType - st.SpecificName = pb.SpecificName - st.SqlDataAccess = pb.SqlDataAccess - st.SqlPath = pb.SqlPath - st.UpdatedAt = pb.UpdatedAt - st.UpdatedBy = pb.UpdatedBy - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *functionInfoPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st functionInfoPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func functionParameterInfoToPb(st *FunctionParameterInfo) (*functionParameterInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &functionParameterInfoPb{} - pb.Comment = st.Comment - pb.Name = st.Name - pb.ParameterDefault = st.ParameterDefault - pb.ParameterMode = st.ParameterMode - pb.ParameterType = st.ParameterType - pb.Position = st.Position - pb.TypeIntervalType = st.TypeIntervalType - pb.TypeJson = st.TypeJson - pb.TypeName = st.TypeName - pb.TypePrecision = st.TypePrecision - pb.TypeScale = st.TypeScale - pb.TypeText = st.TypeText - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type functionParameterInfoPb struct { - Comment string `json:"comment,omitempty"` - Name string `json:"name"` - ParameterDefault string `json:"parameter_default,omitempty"` - ParameterMode FunctionParameterMode `json:"parameter_mode,omitempty"` - ParameterType FunctionParameterType `json:"parameter_type,omitempty"` - Position int `json:"position"` - TypeIntervalType string `json:"type_interval_type,omitempty"` - TypeJson string `json:"type_json,omitempty"` - TypeName ColumnTypeName `json:"type_name"` - TypePrecision int `json:"type_precision,omitempty"` - TypeScale int `json:"type_scale,omitempty"` - TypeText string `json:"type_text"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func functionParameterInfoFromPb(pb *functionParameterInfoPb) (*FunctionParameterInfo, error) { - if pb == nil { - return nil, nil - } - st := &FunctionParameterInfo{} - st.Comment = pb.Comment - st.Name = pb.Name - st.ParameterDefault = pb.ParameterDefault - st.ParameterMode = pb.ParameterMode - st.ParameterType = pb.ParameterType - st.Position = pb.Position - st.TypeIntervalType = pb.TypeIntervalType - st.TypeJson = pb.TypeJson - st.TypeName = pb.TypeName - st.TypePrecision = pb.TypePrecision - st.TypeScale = pb.TypeScale - st.TypeText = pb.TypeText - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *functionParameterInfoPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st functionParameterInfoPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func functionParameterInfosToPb(st *FunctionParameterInfos) (*functionParameterInfosPb, error) { - if st == nil { - return nil, nil - } - pb := &functionParameterInfosPb{} - pb.Parameters = st.Parameters - - return pb, nil -} - -type functionParameterInfosPb struct { - Parameters []FunctionParameterInfo `json:"parameters,omitempty"` -} - -func functionParameterInfosFromPb(pb *functionParameterInfosPb) (*FunctionParameterInfos, error) { - if pb == nil { - return nil, nil - } - st := &FunctionParameterInfos{} - st.Parameters = pb.Parameters - - return st, nil -} - -func gcpOauthTokenToPb(st *GcpOauthToken) (*gcpOauthTokenPb, error) { - if st == nil { - return nil, nil - } - pb := &gcpOauthTokenPb{} - pb.OauthToken = st.OauthToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type gcpOauthTokenPb struct { - OauthToken string `json:"oauth_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func gcpOauthTokenFromPb(pb *gcpOauthTokenPb) (*GcpOauthToken, error) { - if pb == nil { - return nil, nil - } - st := &GcpOauthToken{} - st.OauthToken = pb.OauthToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *gcpOauthTokenPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st gcpOauthTokenPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func gcpPubsubToPb(st *GcpPubsub) (*gcpPubsubPb, error) { - if st == nil { - return nil, nil - } - pb := &gcpPubsubPb{} - pb.ManagedResourceId = st.ManagedResourceId - pb.SubscriptionName = st.SubscriptionName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type gcpPubsubPb struct { - ManagedResourceId string `json:"managed_resource_id,omitempty"` - SubscriptionName string `json:"subscription_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func gcpPubsubFromPb(pb *gcpPubsubPb) (*GcpPubsub, error) { - if pb == nil { - return nil, nil - } - st := &GcpPubsub{} - st.ManagedResourceId = pb.ManagedResourceId - st.SubscriptionName = pb.SubscriptionName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *gcpPubsubPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st gcpPubsubPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func generateTemporaryServiceCredentialAzureOptionsToPb(st *GenerateTemporaryServiceCredentialAzureOptions) (*generateTemporaryServiceCredentialAzureOptionsPb, error) { - if st == nil { - return nil, nil - } - pb := &generateTemporaryServiceCredentialAzureOptionsPb{} - pb.Resources = st.Resources - - return pb, nil -} - -type generateTemporaryServiceCredentialAzureOptionsPb struct { - Resources []string `json:"resources,omitempty"` -} - -func generateTemporaryServiceCredentialAzureOptionsFromPb(pb *generateTemporaryServiceCredentialAzureOptionsPb) (*GenerateTemporaryServiceCredentialAzureOptions, error) { - if pb == nil { - return nil, nil - } - st := &GenerateTemporaryServiceCredentialAzureOptions{} - st.Resources = pb.Resources - - return st, nil -} - -func generateTemporaryServiceCredentialGcpOptionsToPb(st *GenerateTemporaryServiceCredentialGcpOptions) (*generateTemporaryServiceCredentialGcpOptionsPb, error) { - if st == nil { - return nil, nil - } - pb := &generateTemporaryServiceCredentialGcpOptionsPb{} - pb.Scopes = st.Scopes - - return pb, nil -} - -type generateTemporaryServiceCredentialGcpOptionsPb struct { - Scopes []string `json:"scopes,omitempty"` -} - -func generateTemporaryServiceCredentialGcpOptionsFromPb(pb *generateTemporaryServiceCredentialGcpOptionsPb) (*GenerateTemporaryServiceCredentialGcpOptions, error) { - if pb == nil { - return nil, nil - } - st := &GenerateTemporaryServiceCredentialGcpOptions{} - st.Scopes = pb.Scopes - - return st, nil -} - -func generateTemporaryServiceCredentialRequestToPb(st *GenerateTemporaryServiceCredentialRequest) (*generateTemporaryServiceCredentialRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &generateTemporaryServiceCredentialRequestPb{} - pb.AzureOptions = st.AzureOptions - pb.CredentialName = st.CredentialName - pb.GcpOptions = st.GcpOptions - - return pb, nil -} - -type generateTemporaryServiceCredentialRequestPb struct { - AzureOptions *GenerateTemporaryServiceCredentialAzureOptions `json:"azure_options,omitempty"` - CredentialName string `json:"credential_name"` - GcpOptions *GenerateTemporaryServiceCredentialGcpOptions `json:"gcp_options,omitempty"` -} - -func generateTemporaryServiceCredentialRequestFromPb(pb *generateTemporaryServiceCredentialRequestPb) (*GenerateTemporaryServiceCredentialRequest, error) { - if pb == nil { - return nil, nil - } - st := &GenerateTemporaryServiceCredentialRequest{} - st.AzureOptions = pb.AzureOptions - st.CredentialName = pb.CredentialName - st.GcpOptions = pb.GcpOptions - - return st, nil -} - -func generateTemporaryTableCredentialRequestToPb(st *GenerateTemporaryTableCredentialRequest) (*generateTemporaryTableCredentialRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &generateTemporaryTableCredentialRequestPb{} - pb.Operation = st.Operation - pb.TableId = st.TableId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type generateTemporaryTableCredentialRequestPb struct { - Operation TableOperation `json:"operation,omitempty"` - TableId string `json:"table_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func generateTemporaryTableCredentialRequestFromPb(pb *generateTemporaryTableCredentialRequestPb) (*GenerateTemporaryTableCredentialRequest, error) { - if pb == nil { - return nil, nil - } - st := &GenerateTemporaryTableCredentialRequest{} - st.Operation = pb.Operation - st.TableId = pb.TableId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *generateTemporaryTableCredentialRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st generateTemporaryTableCredentialRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func generateTemporaryTableCredentialResponseToPb(st *GenerateTemporaryTableCredentialResponse) (*generateTemporaryTableCredentialResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &generateTemporaryTableCredentialResponsePb{} - pb.AwsTempCredentials = st.AwsTempCredentials - pb.AzureAad = st.AzureAad - pb.AzureUserDelegationSas = st.AzureUserDelegationSas - pb.ExpirationTime = st.ExpirationTime - pb.GcpOauthToken = st.GcpOauthToken - pb.R2TempCredentials = st.R2TempCredentials - pb.Url = st.Url - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type generateTemporaryTableCredentialResponsePb struct { - AwsTempCredentials *AwsCredentials `json:"aws_temp_credentials,omitempty"` - AzureAad *AzureActiveDirectoryToken `json:"azure_aad,omitempty"` - AzureUserDelegationSas *AzureUserDelegationSas `json:"azure_user_delegation_sas,omitempty"` - ExpirationTime int64 `json:"expiration_time,omitempty"` - GcpOauthToken *GcpOauthToken `json:"gcp_oauth_token,omitempty"` - R2TempCredentials *R2Credentials `json:"r2_temp_credentials,omitempty"` - Url string `json:"url,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func generateTemporaryTableCredentialResponseFromPb(pb *generateTemporaryTableCredentialResponsePb) (*GenerateTemporaryTableCredentialResponse, error) { - if pb == nil { - return nil, nil - } - st := &GenerateTemporaryTableCredentialResponse{} - st.AwsTempCredentials = pb.AwsTempCredentials - st.AzureAad = pb.AzureAad - st.AzureUserDelegationSas = pb.AzureUserDelegationSas - st.ExpirationTime = pb.ExpirationTime - st.GcpOauthToken = pb.GcpOauthToken - st.R2TempCredentials = pb.R2TempCredentials - st.Url = pb.Url - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *generateTemporaryTableCredentialResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st generateTemporaryTableCredentialResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getAccountMetastoreAssignmentRequestToPb(st *GetAccountMetastoreAssignmentRequest) (*getAccountMetastoreAssignmentRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getAccountMetastoreAssignmentRequestPb{} - pb.WorkspaceId = st.WorkspaceId - - return pb, nil -} - -type getAccountMetastoreAssignmentRequestPb struct { - WorkspaceId int64 `json:"-" url:"-"` -} - -func getAccountMetastoreAssignmentRequestFromPb(pb *getAccountMetastoreAssignmentRequestPb) (*GetAccountMetastoreAssignmentRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetAccountMetastoreAssignmentRequest{} - st.WorkspaceId = pb.WorkspaceId - - return st, nil -} - -func getAccountMetastoreRequestToPb(st *GetAccountMetastoreRequest) (*getAccountMetastoreRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getAccountMetastoreRequestPb{} - pb.MetastoreId = st.MetastoreId - - return pb, nil -} - -type getAccountMetastoreRequestPb struct { - MetastoreId string `json:"-" url:"-"` -} - -func getAccountMetastoreRequestFromPb(pb *getAccountMetastoreRequestPb) (*GetAccountMetastoreRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetAccountMetastoreRequest{} - st.MetastoreId = pb.MetastoreId - - return st, nil -} - -func getAccountStorageCredentialRequestToPb(st *GetAccountStorageCredentialRequest) (*getAccountStorageCredentialRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getAccountStorageCredentialRequestPb{} - pb.MetastoreId = st.MetastoreId - pb.StorageCredentialName = st.StorageCredentialName - - return pb, nil -} - -type getAccountStorageCredentialRequestPb struct { - MetastoreId string `json:"-" url:"-"` - StorageCredentialName string `json:"-" url:"-"` -} - -func getAccountStorageCredentialRequestFromPb(pb *getAccountStorageCredentialRequestPb) (*GetAccountStorageCredentialRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetAccountStorageCredentialRequest{} - st.MetastoreId = pb.MetastoreId - st.StorageCredentialName = pb.StorageCredentialName - - return st, nil -} - -func getArtifactAllowlistRequestToPb(st *GetArtifactAllowlistRequest) (*getArtifactAllowlistRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getArtifactAllowlistRequestPb{} - pb.ArtifactType = st.ArtifactType - - return pb, nil -} - -type getArtifactAllowlistRequestPb struct { - ArtifactType ArtifactType `json:"-" url:"-"` -} - -func getArtifactAllowlistRequestFromPb(pb *getArtifactAllowlistRequestPb) (*GetArtifactAllowlistRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetArtifactAllowlistRequest{} - st.ArtifactType = pb.ArtifactType - - return st, nil -} - -func getBindingsRequestToPb(st *GetBindingsRequest) (*getBindingsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getBindingsRequestPb{} - pb.MaxResults = st.MaxResults - pb.PageToken = st.PageToken - pb.SecurableName = st.SecurableName - pb.SecurableType = st.SecurableType - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getBindingsRequestPb struct { - MaxResults int `json:"-" url:"max_results,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - SecurableName string `json:"-" url:"-"` - SecurableType string `json:"-" url:"-"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getBindingsRequestFromPb(pb *getBindingsRequestPb) (*GetBindingsRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetBindingsRequest{} - st.MaxResults = pb.MaxResults - st.PageToken = pb.PageToken - st.SecurableName = pb.SecurableName - st.SecurableType = pb.SecurableType - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getBindingsRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getBindingsRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getByAliasRequestToPb(st *GetByAliasRequest) (*getByAliasRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getByAliasRequestPb{} - pb.Alias = st.Alias - pb.FullName = st.FullName - pb.IncludeAliases = st.IncludeAliases - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getByAliasRequestPb struct { - Alias string `json:"-" url:"-"` - FullName string `json:"-" url:"-"` - IncludeAliases bool `json:"-" url:"include_aliases,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getByAliasRequestFromPb(pb *getByAliasRequestPb) (*GetByAliasRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetByAliasRequest{} - st.Alias = pb.Alias - st.FullName = pb.FullName - st.IncludeAliases = pb.IncludeAliases - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getByAliasRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getByAliasRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getCatalogRequestToPb(st *GetCatalogRequest) (*getCatalogRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getCatalogRequestPb{} - pb.IncludeBrowse = st.IncludeBrowse - pb.Name = st.Name - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getCatalogRequestPb struct { - IncludeBrowse bool `json:"-" url:"include_browse,omitempty"` - Name string `json:"-" url:"-"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getCatalogRequestFromPb(pb *getCatalogRequestPb) (*GetCatalogRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetCatalogRequest{} - st.IncludeBrowse = pb.IncludeBrowse - st.Name = pb.Name - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getCatalogRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getCatalogRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getCatalogWorkspaceBindingsResponseToPb(st *GetCatalogWorkspaceBindingsResponse) (*getCatalogWorkspaceBindingsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &getCatalogWorkspaceBindingsResponsePb{} - pb.Workspaces = st.Workspaces - - return pb, nil -} - -type getCatalogWorkspaceBindingsResponsePb struct { - Workspaces []int64 `json:"workspaces,omitempty"` -} - -func getCatalogWorkspaceBindingsResponseFromPb(pb *getCatalogWorkspaceBindingsResponsePb) (*GetCatalogWorkspaceBindingsResponse, error) { - if pb == nil { - return nil, nil - } - st := &GetCatalogWorkspaceBindingsResponse{} - st.Workspaces = pb.Workspaces - - return st, nil -} - -func getConnectionRequestToPb(st *GetConnectionRequest) (*getConnectionRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getConnectionRequestPb{} - pb.Name = st.Name - - return pb, nil -} - -type getConnectionRequestPb struct { - Name string `json:"-" url:"-"` -} - -func getConnectionRequestFromPb(pb *getConnectionRequestPb) (*GetConnectionRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetConnectionRequest{} - st.Name = pb.Name - - return st, nil -} - -func getCredentialRequestToPb(st *GetCredentialRequest) (*getCredentialRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getCredentialRequestPb{} - pb.NameArg = st.NameArg - - return pb, nil -} - -type getCredentialRequestPb struct { - NameArg string `json:"-" url:"-"` -} - -func getCredentialRequestFromPb(pb *getCredentialRequestPb) (*GetCredentialRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetCredentialRequest{} - st.NameArg = pb.NameArg - - return st, nil -} - -func getEffectiveRequestToPb(st *GetEffectiveRequest) (*getEffectiveRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getEffectiveRequestPb{} - pb.FullName = st.FullName - pb.MaxResults = st.MaxResults - pb.PageToken = st.PageToken - pb.Principal = st.Principal - pb.SecurableType = st.SecurableType - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getEffectiveRequestPb struct { - FullName string `json:"-" url:"-"` - MaxResults int `json:"-" url:"max_results,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - Principal string `json:"-" url:"principal,omitempty"` - SecurableType string `json:"-" url:"-"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getEffectiveRequestFromPb(pb *getEffectiveRequestPb) (*GetEffectiveRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetEffectiveRequest{} - st.FullName = pb.FullName - st.MaxResults = pb.MaxResults - st.PageToken = pb.PageToken - st.Principal = pb.Principal - st.SecurableType = pb.SecurableType - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getEffectiveRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getEffectiveRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getExternalLocationRequestToPb(st *GetExternalLocationRequest) (*getExternalLocationRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getExternalLocationRequestPb{} - pb.IncludeBrowse = st.IncludeBrowse - pb.Name = st.Name - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getExternalLocationRequestPb struct { - IncludeBrowse bool `json:"-" url:"include_browse,omitempty"` - Name string `json:"-" url:"-"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getExternalLocationRequestFromPb(pb *getExternalLocationRequestPb) (*GetExternalLocationRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetExternalLocationRequest{} - st.IncludeBrowse = pb.IncludeBrowse - st.Name = pb.Name - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getExternalLocationRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getExternalLocationRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getFunctionRequestToPb(st *GetFunctionRequest) (*getFunctionRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getFunctionRequestPb{} - pb.IncludeBrowse = st.IncludeBrowse - pb.Name = st.Name - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getFunctionRequestPb struct { - IncludeBrowse bool `json:"-" url:"include_browse,omitempty"` - Name string `json:"-" url:"-"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getFunctionRequestFromPb(pb *getFunctionRequestPb) (*GetFunctionRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetFunctionRequest{} - st.IncludeBrowse = pb.IncludeBrowse - st.Name = pb.Name - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getFunctionRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getFunctionRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getGrantRequestToPb(st *GetGrantRequest) (*getGrantRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getGrantRequestPb{} - pb.FullName = st.FullName - pb.MaxResults = st.MaxResults - pb.PageToken = st.PageToken - pb.Principal = st.Principal - pb.SecurableType = st.SecurableType - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getGrantRequestPb struct { - FullName string `json:"-" url:"-"` - MaxResults int `json:"-" url:"max_results,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - Principal string `json:"-" url:"principal,omitempty"` - SecurableType string `json:"-" url:"-"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getGrantRequestFromPb(pb *getGrantRequestPb) (*GetGrantRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetGrantRequest{} - st.FullName = pb.FullName - st.MaxResults = pb.MaxResults - st.PageToken = pb.PageToken - st.Principal = pb.Principal - st.SecurableType = pb.SecurableType - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getGrantRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getGrantRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getMetastoreRequestToPb(st *GetMetastoreRequest) (*getMetastoreRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getMetastoreRequestPb{} - pb.Id = st.Id - - return pb, nil -} - -type getMetastoreRequestPb struct { - Id string `json:"-" url:"-"` -} - -func getMetastoreRequestFromPb(pb *getMetastoreRequestPb) (*GetMetastoreRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetMetastoreRequest{} - st.Id = pb.Id - - return st, nil -} - -func getMetastoreSummaryResponseToPb(st *GetMetastoreSummaryResponse) (*getMetastoreSummaryResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &getMetastoreSummaryResponsePb{} - pb.Cloud = st.Cloud - pb.CreatedAt = st.CreatedAt - pb.CreatedBy = st.CreatedBy - pb.DefaultDataAccessConfigId = st.DefaultDataAccessConfigId - pb.DeltaSharingOrganizationName = st.DeltaSharingOrganizationName - pb.DeltaSharingRecipientTokenLifetimeInSeconds = st.DeltaSharingRecipientTokenLifetimeInSeconds - pb.DeltaSharingScope = st.DeltaSharingScope - pb.ExternalAccessEnabled = st.ExternalAccessEnabled - pb.GlobalMetastoreId = st.GlobalMetastoreId - pb.MetastoreId = st.MetastoreId - pb.Name = st.Name - pb.Owner = st.Owner - pb.PrivilegeModelVersion = st.PrivilegeModelVersion - pb.Region = st.Region - pb.StorageRoot = st.StorageRoot - pb.StorageRootCredentialId = st.StorageRootCredentialId - pb.StorageRootCredentialName = st.StorageRootCredentialName - pb.UpdatedAt = st.UpdatedAt - pb.UpdatedBy = st.UpdatedBy - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getMetastoreSummaryResponsePb struct { - Cloud string `json:"cloud,omitempty"` - CreatedAt int64 `json:"created_at,omitempty"` - CreatedBy string `json:"created_by,omitempty"` - DefaultDataAccessConfigId string `json:"default_data_access_config_id,omitempty"` - DeltaSharingOrganizationName string `json:"delta_sharing_organization_name,omitempty"` - DeltaSharingRecipientTokenLifetimeInSeconds int64 `json:"delta_sharing_recipient_token_lifetime_in_seconds,omitempty"` - DeltaSharingScope DeltaSharingScopeEnum `json:"delta_sharing_scope,omitempty"` - ExternalAccessEnabled bool `json:"external_access_enabled,omitempty"` - GlobalMetastoreId string `json:"global_metastore_id,omitempty"` - MetastoreId string `json:"metastore_id,omitempty"` - Name string `json:"name,omitempty"` - Owner string `json:"owner,omitempty"` - PrivilegeModelVersion string `json:"privilege_model_version,omitempty"` - Region string `json:"region,omitempty"` - StorageRoot string `json:"storage_root,omitempty"` - StorageRootCredentialId string `json:"storage_root_credential_id,omitempty"` - StorageRootCredentialName string `json:"storage_root_credential_name,omitempty"` - UpdatedAt int64 `json:"updated_at,omitempty"` - UpdatedBy string `json:"updated_by,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getMetastoreSummaryResponseFromPb(pb *getMetastoreSummaryResponsePb) (*GetMetastoreSummaryResponse, error) { - if pb == nil { - return nil, nil - } - st := &GetMetastoreSummaryResponse{} - st.Cloud = pb.Cloud - st.CreatedAt = pb.CreatedAt - st.CreatedBy = pb.CreatedBy - st.DefaultDataAccessConfigId = pb.DefaultDataAccessConfigId - st.DeltaSharingOrganizationName = pb.DeltaSharingOrganizationName - st.DeltaSharingRecipientTokenLifetimeInSeconds = pb.DeltaSharingRecipientTokenLifetimeInSeconds - st.DeltaSharingScope = pb.DeltaSharingScope - st.ExternalAccessEnabled = pb.ExternalAccessEnabled - st.GlobalMetastoreId = pb.GlobalMetastoreId - st.MetastoreId = pb.MetastoreId - st.Name = pb.Name - st.Owner = pb.Owner - st.PrivilegeModelVersion = pb.PrivilegeModelVersion - st.Region = pb.Region - st.StorageRoot = pb.StorageRoot - st.StorageRootCredentialId = pb.StorageRootCredentialId - st.StorageRootCredentialName = pb.StorageRootCredentialName - st.UpdatedAt = pb.UpdatedAt - st.UpdatedBy = pb.UpdatedBy - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getMetastoreSummaryResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getMetastoreSummaryResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getModelVersionRequestToPb(st *GetModelVersionRequest) (*getModelVersionRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getModelVersionRequestPb{} - pb.FullName = st.FullName - pb.IncludeAliases = st.IncludeAliases - pb.IncludeBrowse = st.IncludeBrowse - pb.Version = st.Version - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getModelVersionRequestPb struct { - FullName string `json:"-" url:"-"` - IncludeAliases bool `json:"-" url:"include_aliases,omitempty"` - IncludeBrowse bool `json:"-" url:"include_browse,omitempty"` - Version int `json:"-" url:"-"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getModelVersionRequestFromPb(pb *getModelVersionRequestPb) (*GetModelVersionRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetModelVersionRequest{} - st.FullName = pb.FullName - st.IncludeAliases = pb.IncludeAliases - st.IncludeBrowse = pb.IncludeBrowse - st.Version = pb.Version - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getModelVersionRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getModelVersionRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getOnlineTableRequestToPb(st *GetOnlineTableRequest) (*getOnlineTableRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getOnlineTableRequestPb{} - pb.Name = st.Name - - return pb, nil -} - -type getOnlineTableRequestPb struct { - Name string `json:"-" url:"-"` -} - -func getOnlineTableRequestFromPb(pb *getOnlineTableRequestPb) (*GetOnlineTableRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetOnlineTableRequest{} - st.Name = pb.Name - - return st, nil -} - -func getPermissionsResponseToPb(st *GetPermissionsResponse) (*getPermissionsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &getPermissionsResponsePb{} - pb.NextPageToken = st.NextPageToken - pb.PrivilegeAssignments = st.PrivilegeAssignments - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getPermissionsResponsePb struct { - NextPageToken string `json:"next_page_token,omitempty"` - PrivilegeAssignments []PrivilegeAssignment `json:"privilege_assignments,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getPermissionsResponseFromPb(pb *getPermissionsResponsePb) (*GetPermissionsResponse, error) { - if pb == nil { - return nil, nil - } - st := &GetPermissionsResponse{} - st.NextPageToken = pb.NextPageToken - st.PrivilegeAssignments = pb.PrivilegeAssignments - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getPermissionsResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getPermissionsResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getQualityMonitorRequestToPb(st *GetQualityMonitorRequest) (*getQualityMonitorRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getQualityMonitorRequestPb{} - pb.TableName = st.TableName - - return pb, nil -} - -type getQualityMonitorRequestPb struct { - TableName string `json:"-" url:"-"` -} - -func getQualityMonitorRequestFromPb(pb *getQualityMonitorRequestPb) (*GetQualityMonitorRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetQualityMonitorRequest{} - st.TableName = pb.TableName - - return st, nil -} - -func getQuotaRequestToPb(st *GetQuotaRequest) (*getQuotaRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getQuotaRequestPb{} - pb.ParentFullName = st.ParentFullName - pb.ParentSecurableType = st.ParentSecurableType - pb.QuotaName = st.QuotaName - - return pb, nil -} - -type getQuotaRequestPb struct { - ParentFullName string `json:"-" url:"-"` - ParentSecurableType string `json:"-" url:"-"` - QuotaName string `json:"-" url:"-"` -} - -func getQuotaRequestFromPb(pb *getQuotaRequestPb) (*GetQuotaRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetQuotaRequest{} - st.ParentFullName = pb.ParentFullName - st.ParentSecurableType = pb.ParentSecurableType - st.QuotaName = pb.QuotaName - - return st, nil -} - -func getQuotaResponseToPb(st *GetQuotaResponse) (*getQuotaResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &getQuotaResponsePb{} - pb.QuotaInfo = st.QuotaInfo - - return pb, nil -} - -type getQuotaResponsePb struct { - QuotaInfo *QuotaInfo `json:"quota_info,omitempty"` -} - -func getQuotaResponseFromPb(pb *getQuotaResponsePb) (*GetQuotaResponse, error) { - if pb == nil { - return nil, nil - } - st := &GetQuotaResponse{} - st.QuotaInfo = pb.QuotaInfo - - return st, nil -} - -func getRefreshRequestToPb(st *GetRefreshRequest) (*getRefreshRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getRefreshRequestPb{} - pb.RefreshId = st.RefreshId - pb.TableName = st.TableName - - return pb, nil -} - -type getRefreshRequestPb struct { - RefreshId string `json:"-" url:"-"` - TableName string `json:"-" url:"-"` -} - -func getRefreshRequestFromPb(pb *getRefreshRequestPb) (*GetRefreshRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetRefreshRequest{} - st.RefreshId = pb.RefreshId - st.TableName = pb.TableName - - return st, nil -} - -func getRegisteredModelRequestToPb(st *GetRegisteredModelRequest) (*getRegisteredModelRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getRegisteredModelRequestPb{} - pb.FullName = st.FullName - pb.IncludeAliases = st.IncludeAliases - pb.IncludeBrowse = st.IncludeBrowse - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getRegisteredModelRequestPb struct { - FullName string `json:"-" url:"-"` - IncludeAliases bool `json:"-" url:"include_aliases,omitempty"` - IncludeBrowse bool `json:"-" url:"include_browse,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getRegisteredModelRequestFromPb(pb *getRegisteredModelRequestPb) (*GetRegisteredModelRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetRegisteredModelRequest{} - st.FullName = pb.FullName - st.IncludeAliases = pb.IncludeAliases - st.IncludeBrowse = pb.IncludeBrowse - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getRegisteredModelRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getRegisteredModelRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getSchemaRequestToPb(st *GetSchemaRequest) (*getSchemaRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getSchemaRequestPb{} - pb.FullName = st.FullName - pb.IncludeBrowse = st.IncludeBrowse - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getSchemaRequestPb struct { - FullName string `json:"-" url:"-"` - IncludeBrowse bool `json:"-" url:"include_browse,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getSchemaRequestFromPb(pb *getSchemaRequestPb) (*GetSchemaRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetSchemaRequest{} - st.FullName = pb.FullName - st.IncludeBrowse = pb.IncludeBrowse - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getSchemaRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getSchemaRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getStorageCredentialRequestToPb(st *GetStorageCredentialRequest) (*getStorageCredentialRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getStorageCredentialRequestPb{} - pb.Name = st.Name - - return pb, nil -} - -type getStorageCredentialRequestPb struct { - Name string `json:"-" url:"-"` -} - -func getStorageCredentialRequestFromPb(pb *getStorageCredentialRequestPb) (*GetStorageCredentialRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetStorageCredentialRequest{} - st.Name = pb.Name - - return st, nil -} - -func getTableRequestToPb(st *GetTableRequest) (*getTableRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getTableRequestPb{} - pb.FullName = st.FullName - pb.IncludeBrowse = st.IncludeBrowse - pb.IncludeDeltaMetadata = st.IncludeDeltaMetadata - pb.IncludeManifestCapabilities = st.IncludeManifestCapabilities - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getTableRequestPb struct { - FullName string `json:"-" url:"-"` - IncludeBrowse bool `json:"-" url:"include_browse,omitempty"` - IncludeDeltaMetadata bool `json:"-" url:"include_delta_metadata,omitempty"` - IncludeManifestCapabilities bool `json:"-" url:"include_manifest_capabilities,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getTableRequestFromPb(pb *getTableRequestPb) (*GetTableRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetTableRequest{} - st.FullName = pb.FullName - st.IncludeBrowse = pb.IncludeBrowse - st.IncludeDeltaMetadata = pb.IncludeDeltaMetadata - st.IncludeManifestCapabilities = pb.IncludeManifestCapabilities - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getTableRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getTableRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getWorkspaceBindingRequestToPb(st *GetWorkspaceBindingRequest) (*getWorkspaceBindingRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getWorkspaceBindingRequestPb{} - pb.Name = st.Name - - return pb, nil -} - -type getWorkspaceBindingRequestPb struct { - Name string `json:"-" url:"-"` -} - -func getWorkspaceBindingRequestFromPb(pb *getWorkspaceBindingRequestPb) (*GetWorkspaceBindingRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetWorkspaceBindingRequest{} - st.Name = pb.Name - - return st, nil -} - -func getWorkspaceBindingsResponseToPb(st *GetWorkspaceBindingsResponse) (*getWorkspaceBindingsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &getWorkspaceBindingsResponsePb{} - pb.Bindings = st.Bindings - pb.NextPageToken = st.NextPageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getWorkspaceBindingsResponsePb struct { - Bindings []WorkspaceBinding `json:"bindings,omitempty"` - NextPageToken string `json:"next_page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getWorkspaceBindingsResponseFromPb(pb *getWorkspaceBindingsResponsePb) (*GetWorkspaceBindingsResponse, error) { - if pb == nil { - return nil, nil - } - st := &GetWorkspaceBindingsResponse{} - st.Bindings = pb.Bindings - st.NextPageToken = pb.NextPageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getWorkspaceBindingsResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getWorkspaceBindingsResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listAccountMetastoreAssignmentsRequestToPb(st *ListAccountMetastoreAssignmentsRequest) (*listAccountMetastoreAssignmentsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listAccountMetastoreAssignmentsRequestPb{} - pb.MetastoreId = st.MetastoreId - - return pb, nil -} - -type listAccountMetastoreAssignmentsRequestPb struct { - MetastoreId string `json:"-" url:"-"` -} - -func listAccountMetastoreAssignmentsRequestFromPb(pb *listAccountMetastoreAssignmentsRequestPb) (*ListAccountMetastoreAssignmentsRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListAccountMetastoreAssignmentsRequest{} - st.MetastoreId = pb.MetastoreId - - return st, nil -} - -func listAccountMetastoreAssignmentsResponseToPb(st *ListAccountMetastoreAssignmentsResponse) (*listAccountMetastoreAssignmentsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listAccountMetastoreAssignmentsResponsePb{} - pb.WorkspaceIds = st.WorkspaceIds - - return pb, nil -} - -type listAccountMetastoreAssignmentsResponsePb struct { - WorkspaceIds []int64 `json:"workspace_ids,omitempty"` -} - -func listAccountMetastoreAssignmentsResponseFromPb(pb *listAccountMetastoreAssignmentsResponsePb) (*ListAccountMetastoreAssignmentsResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListAccountMetastoreAssignmentsResponse{} - st.WorkspaceIds = pb.WorkspaceIds - - return st, nil -} - -func listAccountStorageCredentialsRequestToPb(st *ListAccountStorageCredentialsRequest) (*listAccountStorageCredentialsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listAccountStorageCredentialsRequestPb{} - pb.MetastoreId = st.MetastoreId - - return pb, nil -} - -type listAccountStorageCredentialsRequestPb struct { - MetastoreId string `json:"-" url:"-"` -} - -func listAccountStorageCredentialsRequestFromPb(pb *listAccountStorageCredentialsRequestPb) (*ListAccountStorageCredentialsRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListAccountStorageCredentialsRequest{} - st.MetastoreId = pb.MetastoreId - - return st, nil -} - -func listAccountStorageCredentialsResponseToPb(st *ListAccountStorageCredentialsResponse) (*listAccountStorageCredentialsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listAccountStorageCredentialsResponsePb{} - pb.StorageCredentials = st.StorageCredentials - - return pb, nil -} - -type listAccountStorageCredentialsResponsePb struct { - StorageCredentials []StorageCredentialInfo `json:"storage_credentials,omitempty"` -} - -func listAccountStorageCredentialsResponseFromPb(pb *listAccountStorageCredentialsResponsePb) (*ListAccountStorageCredentialsResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListAccountStorageCredentialsResponse{} - st.StorageCredentials = pb.StorageCredentials - - return st, nil -} - -func listCatalogsRequestToPb(st *ListCatalogsRequest) (*listCatalogsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listCatalogsRequestPb{} - pb.IncludeBrowse = st.IncludeBrowse - pb.MaxResults = st.MaxResults - pb.PageToken = st.PageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listCatalogsRequestPb struct { - IncludeBrowse bool `json:"-" url:"include_browse,omitempty"` - MaxResults int `json:"-" url:"max_results,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listCatalogsRequestFromPb(pb *listCatalogsRequestPb) (*ListCatalogsRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListCatalogsRequest{} - st.IncludeBrowse = pb.IncludeBrowse - st.MaxResults = pb.MaxResults - st.PageToken = pb.PageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listCatalogsRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listCatalogsRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listCatalogsResponseToPb(st *ListCatalogsResponse) (*listCatalogsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listCatalogsResponsePb{} - pb.Catalogs = st.Catalogs - pb.NextPageToken = st.NextPageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listCatalogsResponsePb struct { - Catalogs []CatalogInfo `json:"catalogs,omitempty"` - NextPageToken string `json:"next_page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listCatalogsResponseFromPb(pb *listCatalogsResponsePb) (*ListCatalogsResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListCatalogsResponse{} - st.Catalogs = pb.Catalogs - st.NextPageToken = pb.NextPageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listCatalogsResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listCatalogsResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listConnectionsRequestToPb(st *ListConnectionsRequest) (*listConnectionsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listConnectionsRequestPb{} - pb.MaxResults = st.MaxResults - pb.PageToken = st.PageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listConnectionsRequestPb struct { - MaxResults int `json:"-" url:"max_results,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listConnectionsRequestFromPb(pb *listConnectionsRequestPb) (*ListConnectionsRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListConnectionsRequest{} - st.MaxResults = pb.MaxResults - st.PageToken = pb.PageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listConnectionsRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listConnectionsRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listConnectionsResponseToPb(st *ListConnectionsResponse) (*listConnectionsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listConnectionsResponsePb{} - pb.Connections = st.Connections - pb.NextPageToken = st.NextPageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listConnectionsResponsePb struct { - Connections []ConnectionInfo `json:"connections,omitempty"` - NextPageToken string `json:"next_page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listConnectionsResponseFromPb(pb *listConnectionsResponsePb) (*ListConnectionsResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListConnectionsResponse{} - st.Connections = pb.Connections - st.NextPageToken = pb.NextPageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listConnectionsResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listConnectionsResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listCredentialsRequestToPb(st *ListCredentialsRequest) (*listCredentialsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listCredentialsRequestPb{} - pb.MaxResults = st.MaxResults - pb.PageToken = st.PageToken - pb.Purpose = st.Purpose - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listCredentialsRequestPb struct { - MaxResults int `json:"-" url:"max_results,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - Purpose CredentialPurpose `json:"-" url:"purpose,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listCredentialsRequestFromPb(pb *listCredentialsRequestPb) (*ListCredentialsRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListCredentialsRequest{} - st.MaxResults = pb.MaxResults - st.PageToken = pb.PageToken - st.Purpose = pb.Purpose - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listCredentialsRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listCredentialsRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listCredentialsResponseToPb(st *ListCredentialsResponse) (*listCredentialsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listCredentialsResponsePb{} - pb.Credentials = st.Credentials - pb.NextPageToken = st.NextPageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listCredentialsResponsePb struct { - Credentials []CredentialInfo `json:"credentials,omitempty"` - NextPageToken string `json:"next_page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listCredentialsResponseFromPb(pb *listCredentialsResponsePb) (*ListCredentialsResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListCredentialsResponse{} - st.Credentials = pb.Credentials - st.NextPageToken = pb.NextPageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listCredentialsResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listCredentialsResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listExternalLocationsRequestToPb(st *ListExternalLocationsRequest) (*listExternalLocationsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listExternalLocationsRequestPb{} - pb.IncludeBrowse = st.IncludeBrowse - pb.MaxResults = st.MaxResults - pb.PageToken = st.PageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listExternalLocationsRequestPb struct { - IncludeBrowse bool `json:"-" url:"include_browse,omitempty"` - MaxResults int `json:"-" url:"max_results,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listExternalLocationsRequestFromPb(pb *listExternalLocationsRequestPb) (*ListExternalLocationsRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListExternalLocationsRequest{} - st.IncludeBrowse = pb.IncludeBrowse - st.MaxResults = pb.MaxResults - st.PageToken = pb.PageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listExternalLocationsRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listExternalLocationsRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listExternalLocationsResponseToPb(st *ListExternalLocationsResponse) (*listExternalLocationsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listExternalLocationsResponsePb{} - pb.ExternalLocations = st.ExternalLocations - pb.NextPageToken = st.NextPageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listExternalLocationsResponsePb struct { - ExternalLocations []ExternalLocationInfo `json:"external_locations,omitempty"` - NextPageToken string `json:"next_page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listExternalLocationsResponseFromPb(pb *listExternalLocationsResponsePb) (*ListExternalLocationsResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListExternalLocationsResponse{} - st.ExternalLocations = pb.ExternalLocations - st.NextPageToken = pb.NextPageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listExternalLocationsResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listExternalLocationsResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listFunctionsRequestToPb(st *ListFunctionsRequest) (*listFunctionsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listFunctionsRequestPb{} - pb.CatalogName = st.CatalogName - pb.IncludeBrowse = st.IncludeBrowse - pb.MaxResults = st.MaxResults - pb.PageToken = st.PageToken - pb.SchemaName = st.SchemaName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listFunctionsRequestPb struct { - CatalogName string `json:"-" url:"catalog_name"` - IncludeBrowse bool `json:"-" url:"include_browse,omitempty"` - MaxResults int `json:"-" url:"max_results,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - SchemaName string `json:"-" url:"schema_name"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listFunctionsRequestFromPb(pb *listFunctionsRequestPb) (*ListFunctionsRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListFunctionsRequest{} - st.CatalogName = pb.CatalogName - st.IncludeBrowse = pb.IncludeBrowse - st.MaxResults = pb.MaxResults - st.PageToken = pb.PageToken - st.SchemaName = pb.SchemaName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listFunctionsRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listFunctionsRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listFunctionsResponseToPb(st *ListFunctionsResponse) (*listFunctionsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listFunctionsResponsePb{} - pb.Functions = st.Functions - pb.NextPageToken = st.NextPageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listFunctionsResponsePb struct { - Functions []FunctionInfo `json:"functions,omitempty"` - NextPageToken string `json:"next_page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listFunctionsResponseFromPb(pb *listFunctionsResponsePb) (*ListFunctionsResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListFunctionsResponse{} - st.Functions = pb.Functions - st.NextPageToken = pb.NextPageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listFunctionsResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listFunctionsResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listMetastoresRequestToPb(st *ListMetastoresRequest) (*listMetastoresRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listMetastoresRequestPb{} - pb.MaxResults = st.MaxResults - pb.PageToken = st.PageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listMetastoresRequestPb struct { - MaxResults int `json:"-" url:"max_results,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listMetastoresRequestFromPb(pb *listMetastoresRequestPb) (*ListMetastoresRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListMetastoresRequest{} - st.MaxResults = pb.MaxResults - st.PageToken = pb.PageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listMetastoresRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listMetastoresRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listMetastoresResponseToPb(st *ListMetastoresResponse) (*listMetastoresResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listMetastoresResponsePb{} - pb.Metastores = st.Metastores - pb.NextPageToken = st.NextPageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listMetastoresResponsePb struct { - Metastores []MetastoreInfo `json:"metastores,omitempty"` - NextPageToken string `json:"next_page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listMetastoresResponseFromPb(pb *listMetastoresResponsePb) (*ListMetastoresResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListMetastoresResponse{} - st.Metastores = pb.Metastores - st.NextPageToken = pb.NextPageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listMetastoresResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listMetastoresResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listModelVersionsRequestToPb(st *ListModelVersionsRequest) (*listModelVersionsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listModelVersionsRequestPb{} - pb.FullName = st.FullName - pb.IncludeBrowse = st.IncludeBrowse - pb.MaxResults = st.MaxResults - pb.PageToken = st.PageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listModelVersionsRequestPb struct { - FullName string `json:"-" url:"-"` - IncludeBrowse bool `json:"-" url:"include_browse,omitempty"` - MaxResults int `json:"-" url:"max_results,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listModelVersionsRequestFromPb(pb *listModelVersionsRequestPb) (*ListModelVersionsRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListModelVersionsRequest{} - st.FullName = pb.FullName - st.IncludeBrowse = pb.IncludeBrowse - st.MaxResults = pb.MaxResults - st.PageToken = pb.PageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listModelVersionsRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listModelVersionsRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listModelVersionsResponseToPb(st *ListModelVersionsResponse) (*listModelVersionsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listModelVersionsResponsePb{} - pb.ModelVersions = st.ModelVersions - pb.NextPageToken = st.NextPageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listModelVersionsResponsePb struct { - ModelVersions []ModelVersionInfo `json:"model_versions,omitempty"` - NextPageToken string `json:"next_page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listModelVersionsResponseFromPb(pb *listModelVersionsResponsePb) (*ListModelVersionsResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListModelVersionsResponse{} - st.ModelVersions = pb.ModelVersions - st.NextPageToken = pb.NextPageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listModelVersionsResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listModelVersionsResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listQuotasRequestToPb(st *ListQuotasRequest) (*listQuotasRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listQuotasRequestPb{} - pb.MaxResults = st.MaxResults - pb.PageToken = st.PageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listQuotasRequestPb struct { - MaxResults int `json:"-" url:"max_results,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listQuotasRequestFromPb(pb *listQuotasRequestPb) (*ListQuotasRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListQuotasRequest{} - st.MaxResults = pb.MaxResults - st.PageToken = pb.PageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listQuotasRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listQuotasRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listQuotasResponseToPb(st *ListQuotasResponse) (*listQuotasResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listQuotasResponsePb{} - pb.NextPageToken = st.NextPageToken - pb.Quotas = st.Quotas - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listQuotasResponsePb struct { - NextPageToken string `json:"next_page_token,omitempty"` - Quotas []QuotaInfo `json:"quotas,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listQuotasResponseFromPb(pb *listQuotasResponsePb) (*ListQuotasResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListQuotasResponse{} - st.NextPageToken = pb.NextPageToken - st.Quotas = pb.Quotas - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listQuotasResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listQuotasResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listRefreshesRequestToPb(st *ListRefreshesRequest) (*listRefreshesRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listRefreshesRequestPb{} - pb.TableName = st.TableName - - return pb, nil -} - -type listRefreshesRequestPb struct { - TableName string `json:"-" url:"-"` -} - -func listRefreshesRequestFromPb(pb *listRefreshesRequestPb) (*ListRefreshesRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListRefreshesRequest{} - st.TableName = pb.TableName - - return st, nil -} - -func listRegisteredModelsRequestToPb(st *ListRegisteredModelsRequest) (*listRegisteredModelsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listRegisteredModelsRequestPb{} - pb.CatalogName = st.CatalogName - pb.IncludeBrowse = st.IncludeBrowse - pb.MaxResults = st.MaxResults - pb.PageToken = st.PageToken - pb.SchemaName = st.SchemaName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listRegisteredModelsRequestPb struct { - CatalogName string `json:"-" url:"catalog_name,omitempty"` - IncludeBrowse bool `json:"-" url:"include_browse,omitempty"` - MaxResults int `json:"-" url:"max_results,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - SchemaName string `json:"-" url:"schema_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listRegisteredModelsRequestFromPb(pb *listRegisteredModelsRequestPb) (*ListRegisteredModelsRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListRegisteredModelsRequest{} - st.CatalogName = pb.CatalogName - st.IncludeBrowse = pb.IncludeBrowse - st.MaxResults = pb.MaxResults - st.PageToken = pb.PageToken - st.SchemaName = pb.SchemaName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listRegisteredModelsRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listRegisteredModelsRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listRegisteredModelsResponseToPb(st *ListRegisteredModelsResponse) (*listRegisteredModelsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listRegisteredModelsResponsePb{} - pb.NextPageToken = st.NextPageToken - pb.RegisteredModels = st.RegisteredModels - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listRegisteredModelsResponsePb struct { - NextPageToken string `json:"next_page_token,omitempty"` - RegisteredModels []RegisteredModelInfo `json:"registered_models,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listRegisteredModelsResponseFromPb(pb *listRegisteredModelsResponsePb) (*ListRegisteredModelsResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListRegisteredModelsResponse{} - st.NextPageToken = pb.NextPageToken - st.RegisteredModels = pb.RegisteredModels - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listRegisteredModelsResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listRegisteredModelsResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listSchemasRequestToPb(st *ListSchemasRequest) (*listSchemasRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listSchemasRequestPb{} - pb.CatalogName = st.CatalogName - pb.IncludeBrowse = st.IncludeBrowse - pb.MaxResults = st.MaxResults - pb.PageToken = st.PageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listSchemasRequestPb struct { - CatalogName string `json:"-" url:"catalog_name"` - IncludeBrowse bool `json:"-" url:"include_browse,omitempty"` - MaxResults int `json:"-" url:"max_results,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listSchemasRequestFromPb(pb *listSchemasRequestPb) (*ListSchemasRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListSchemasRequest{} - st.CatalogName = pb.CatalogName - st.IncludeBrowse = pb.IncludeBrowse - st.MaxResults = pb.MaxResults - st.PageToken = pb.PageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listSchemasRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listSchemasRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listSchemasResponseToPb(st *ListSchemasResponse) (*listSchemasResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listSchemasResponsePb{} - pb.NextPageToken = st.NextPageToken - pb.Schemas = st.Schemas - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listSchemasResponsePb struct { - NextPageToken string `json:"next_page_token,omitempty"` - Schemas []SchemaInfo `json:"schemas,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listSchemasResponseFromPb(pb *listSchemasResponsePb) (*ListSchemasResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListSchemasResponse{} - st.NextPageToken = pb.NextPageToken - st.Schemas = pb.Schemas - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listSchemasResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listSchemasResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listStorageCredentialsRequestToPb(st *ListStorageCredentialsRequest) (*listStorageCredentialsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listStorageCredentialsRequestPb{} - pb.MaxResults = st.MaxResults - pb.PageToken = st.PageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listStorageCredentialsRequestPb struct { - MaxResults int `json:"-" url:"max_results,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listStorageCredentialsRequestFromPb(pb *listStorageCredentialsRequestPb) (*ListStorageCredentialsRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListStorageCredentialsRequest{} - st.MaxResults = pb.MaxResults - st.PageToken = pb.PageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listStorageCredentialsRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listStorageCredentialsRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listStorageCredentialsResponseToPb(st *ListStorageCredentialsResponse) (*listStorageCredentialsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listStorageCredentialsResponsePb{} - pb.NextPageToken = st.NextPageToken - pb.StorageCredentials = st.StorageCredentials - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listStorageCredentialsResponsePb struct { - NextPageToken string `json:"next_page_token,omitempty"` - StorageCredentials []StorageCredentialInfo `json:"storage_credentials,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listStorageCredentialsResponseFromPb(pb *listStorageCredentialsResponsePb) (*ListStorageCredentialsResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListStorageCredentialsResponse{} - st.NextPageToken = pb.NextPageToken - st.StorageCredentials = pb.StorageCredentials - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listStorageCredentialsResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listStorageCredentialsResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listSummariesRequestToPb(st *ListSummariesRequest) (*listSummariesRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listSummariesRequestPb{} - pb.CatalogName = st.CatalogName - pb.IncludeManifestCapabilities = st.IncludeManifestCapabilities - pb.MaxResults = st.MaxResults - pb.PageToken = st.PageToken - pb.SchemaNamePattern = st.SchemaNamePattern - pb.TableNamePattern = st.TableNamePattern - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listSummariesRequestPb struct { - CatalogName string `json:"-" url:"catalog_name"` - IncludeManifestCapabilities bool `json:"-" url:"include_manifest_capabilities,omitempty"` - MaxResults int `json:"-" url:"max_results,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - SchemaNamePattern string `json:"-" url:"schema_name_pattern,omitempty"` - TableNamePattern string `json:"-" url:"table_name_pattern,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listSummariesRequestFromPb(pb *listSummariesRequestPb) (*ListSummariesRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListSummariesRequest{} - st.CatalogName = pb.CatalogName - st.IncludeManifestCapabilities = pb.IncludeManifestCapabilities - st.MaxResults = pb.MaxResults - st.PageToken = pb.PageToken - st.SchemaNamePattern = pb.SchemaNamePattern - st.TableNamePattern = pb.TableNamePattern - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listSummariesRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listSummariesRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listSystemSchemasRequestToPb(st *ListSystemSchemasRequest) (*listSystemSchemasRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listSystemSchemasRequestPb{} - pb.MaxResults = st.MaxResults - pb.MetastoreId = st.MetastoreId - pb.PageToken = st.PageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listSystemSchemasRequestPb struct { - MaxResults int `json:"-" url:"max_results,omitempty"` - MetastoreId string `json:"-" url:"-"` - PageToken string `json:"-" url:"page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listSystemSchemasRequestFromPb(pb *listSystemSchemasRequestPb) (*ListSystemSchemasRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListSystemSchemasRequest{} - st.MaxResults = pb.MaxResults - st.MetastoreId = pb.MetastoreId - st.PageToken = pb.PageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listSystemSchemasRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listSystemSchemasRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listSystemSchemasResponseToPb(st *ListSystemSchemasResponse) (*listSystemSchemasResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listSystemSchemasResponsePb{} - pb.NextPageToken = st.NextPageToken - pb.Schemas = st.Schemas - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listSystemSchemasResponsePb struct { - NextPageToken string `json:"next_page_token,omitempty"` - Schemas []SystemSchemaInfo `json:"schemas,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listSystemSchemasResponseFromPb(pb *listSystemSchemasResponsePb) (*ListSystemSchemasResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListSystemSchemasResponse{} - st.NextPageToken = pb.NextPageToken - st.Schemas = pb.Schemas - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listSystemSchemasResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listSystemSchemasResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listTableSummariesResponseToPb(st *ListTableSummariesResponse) (*listTableSummariesResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listTableSummariesResponsePb{} - pb.NextPageToken = st.NextPageToken - pb.Tables = st.Tables - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listTableSummariesResponsePb struct { - NextPageToken string `json:"next_page_token,omitempty"` - Tables []TableSummary `json:"tables,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listTableSummariesResponseFromPb(pb *listTableSummariesResponsePb) (*ListTableSummariesResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListTableSummariesResponse{} - st.NextPageToken = pb.NextPageToken - st.Tables = pb.Tables - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listTableSummariesResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listTableSummariesResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listTablesRequestToPb(st *ListTablesRequest) (*listTablesRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listTablesRequestPb{} - pb.CatalogName = st.CatalogName - pb.IncludeBrowse = st.IncludeBrowse - pb.IncludeDeltaMetadata = st.IncludeDeltaMetadata - pb.IncludeManifestCapabilities = st.IncludeManifestCapabilities - pb.MaxResults = st.MaxResults - pb.OmitColumns = st.OmitColumns - pb.OmitProperties = st.OmitProperties - pb.OmitUsername = st.OmitUsername - pb.PageToken = st.PageToken - pb.SchemaName = st.SchemaName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listTablesRequestPb struct { - CatalogName string `json:"-" url:"catalog_name"` - IncludeBrowse bool `json:"-" url:"include_browse,omitempty"` - IncludeDeltaMetadata bool `json:"-" url:"include_delta_metadata,omitempty"` - IncludeManifestCapabilities bool `json:"-" url:"include_manifest_capabilities,omitempty"` - MaxResults int `json:"-" url:"max_results,omitempty"` - OmitColumns bool `json:"-" url:"omit_columns,omitempty"` - OmitProperties bool `json:"-" url:"omit_properties,omitempty"` - OmitUsername bool `json:"-" url:"omit_username,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - SchemaName string `json:"-" url:"schema_name"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listTablesRequestFromPb(pb *listTablesRequestPb) (*ListTablesRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListTablesRequest{} - st.CatalogName = pb.CatalogName - st.IncludeBrowse = pb.IncludeBrowse - st.IncludeDeltaMetadata = pb.IncludeDeltaMetadata - st.IncludeManifestCapabilities = pb.IncludeManifestCapabilities - st.MaxResults = pb.MaxResults - st.OmitColumns = pb.OmitColumns - st.OmitProperties = pb.OmitProperties - st.OmitUsername = pb.OmitUsername - st.PageToken = pb.PageToken - st.SchemaName = pb.SchemaName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listTablesRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listTablesRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listTablesResponseToPb(st *ListTablesResponse) (*listTablesResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listTablesResponsePb{} - pb.NextPageToken = st.NextPageToken - pb.Tables = st.Tables - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listTablesResponsePb struct { - NextPageToken string `json:"next_page_token,omitempty"` - Tables []TableInfo `json:"tables,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listTablesResponseFromPb(pb *listTablesResponsePb) (*ListTablesResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListTablesResponse{} - st.NextPageToken = pb.NextPageToken - st.Tables = pb.Tables - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listTablesResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listTablesResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listVolumesRequestToPb(st *ListVolumesRequest) (*listVolumesRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listVolumesRequestPb{} - pb.CatalogName = st.CatalogName - pb.IncludeBrowse = st.IncludeBrowse - pb.MaxResults = st.MaxResults - pb.PageToken = st.PageToken - pb.SchemaName = st.SchemaName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listVolumesRequestPb struct { - CatalogName string `json:"-" url:"catalog_name"` - IncludeBrowse bool `json:"-" url:"include_browse,omitempty"` - MaxResults int `json:"-" url:"max_results,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - SchemaName string `json:"-" url:"schema_name"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listVolumesRequestFromPb(pb *listVolumesRequestPb) (*ListVolumesRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListVolumesRequest{} - st.CatalogName = pb.CatalogName - st.IncludeBrowse = pb.IncludeBrowse - st.MaxResults = pb.MaxResults - st.PageToken = pb.PageToken - st.SchemaName = pb.SchemaName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listVolumesRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listVolumesRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listVolumesResponseContentToPb(st *ListVolumesResponseContent) (*listVolumesResponseContentPb, error) { - if st == nil { - return nil, nil - } - pb := &listVolumesResponseContentPb{} - pb.NextPageToken = st.NextPageToken - pb.Volumes = st.Volumes - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listVolumesResponseContentPb struct { - NextPageToken string `json:"next_page_token,omitempty"` - Volumes []VolumeInfo `json:"volumes,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listVolumesResponseContentFromPb(pb *listVolumesResponseContentPb) (*ListVolumesResponseContent, error) { - if pb == nil { - return nil, nil - } - st := &ListVolumesResponseContent{} - st.NextPageToken = pb.NextPageToken - st.Volumes = pb.Volumes - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listVolumesResponseContentPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listVolumesResponseContentPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func metastoreAssignmentToPb(st *MetastoreAssignment) (*metastoreAssignmentPb, error) { - if st == nil { - return nil, nil - } - pb := &metastoreAssignmentPb{} - pb.DefaultCatalogName = st.DefaultCatalogName - pb.MetastoreId = st.MetastoreId - pb.WorkspaceId = st.WorkspaceId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type metastoreAssignmentPb struct { - DefaultCatalogName string `json:"default_catalog_name,omitempty"` - MetastoreId string `json:"metastore_id"` - WorkspaceId int64 `json:"workspace_id"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func metastoreAssignmentFromPb(pb *metastoreAssignmentPb) (*MetastoreAssignment, error) { - if pb == nil { - return nil, nil - } - st := &MetastoreAssignment{} - st.DefaultCatalogName = pb.DefaultCatalogName - st.MetastoreId = pb.MetastoreId - st.WorkspaceId = pb.WorkspaceId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *metastoreAssignmentPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st metastoreAssignmentPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func metastoreInfoToPb(st *MetastoreInfo) (*metastoreInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &metastoreInfoPb{} - pb.Cloud = st.Cloud - pb.CreatedAt = st.CreatedAt - pb.CreatedBy = st.CreatedBy - pb.DefaultDataAccessConfigId = st.DefaultDataAccessConfigId - pb.DeltaSharingOrganizationName = st.DeltaSharingOrganizationName - pb.DeltaSharingRecipientTokenLifetimeInSeconds = st.DeltaSharingRecipientTokenLifetimeInSeconds - pb.DeltaSharingScope = st.DeltaSharingScope - pb.ExternalAccessEnabled = st.ExternalAccessEnabled - pb.GlobalMetastoreId = st.GlobalMetastoreId - pb.MetastoreId = st.MetastoreId - pb.Name = st.Name - pb.Owner = st.Owner - pb.PrivilegeModelVersion = st.PrivilegeModelVersion - pb.Region = st.Region - pb.StorageRoot = st.StorageRoot - pb.StorageRootCredentialId = st.StorageRootCredentialId - pb.StorageRootCredentialName = st.StorageRootCredentialName - pb.UpdatedAt = st.UpdatedAt - pb.UpdatedBy = st.UpdatedBy - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type metastoreInfoPb struct { - Cloud string `json:"cloud,omitempty"` - CreatedAt int64 `json:"created_at,omitempty"` - CreatedBy string `json:"created_by,omitempty"` - DefaultDataAccessConfigId string `json:"default_data_access_config_id,omitempty"` - DeltaSharingOrganizationName string `json:"delta_sharing_organization_name,omitempty"` - DeltaSharingRecipientTokenLifetimeInSeconds int64 `json:"delta_sharing_recipient_token_lifetime_in_seconds,omitempty"` - DeltaSharingScope DeltaSharingScopeEnum `json:"delta_sharing_scope,omitempty"` - ExternalAccessEnabled bool `json:"external_access_enabled,omitempty"` - GlobalMetastoreId string `json:"global_metastore_id,omitempty"` - MetastoreId string `json:"metastore_id,omitempty"` - Name string `json:"name,omitempty"` - Owner string `json:"owner,omitempty"` - PrivilegeModelVersion string `json:"privilege_model_version,omitempty"` - Region string `json:"region,omitempty"` - StorageRoot string `json:"storage_root,omitempty"` - StorageRootCredentialId string `json:"storage_root_credential_id,omitempty"` - StorageRootCredentialName string `json:"storage_root_credential_name,omitempty"` - UpdatedAt int64 `json:"updated_at,omitempty"` - UpdatedBy string `json:"updated_by,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func metastoreInfoFromPb(pb *metastoreInfoPb) (*MetastoreInfo, error) { - if pb == nil { - return nil, nil - } - st := &MetastoreInfo{} - st.Cloud = pb.Cloud - st.CreatedAt = pb.CreatedAt - st.CreatedBy = pb.CreatedBy - st.DefaultDataAccessConfigId = pb.DefaultDataAccessConfigId - st.DeltaSharingOrganizationName = pb.DeltaSharingOrganizationName - st.DeltaSharingRecipientTokenLifetimeInSeconds = pb.DeltaSharingRecipientTokenLifetimeInSeconds - st.DeltaSharingScope = pb.DeltaSharingScope - st.ExternalAccessEnabled = pb.ExternalAccessEnabled - st.GlobalMetastoreId = pb.GlobalMetastoreId - st.MetastoreId = pb.MetastoreId - st.Name = pb.Name - st.Owner = pb.Owner - st.PrivilegeModelVersion = pb.PrivilegeModelVersion - st.Region = pb.Region - st.StorageRoot = pb.StorageRoot - st.StorageRootCredentialId = pb.StorageRootCredentialId - st.StorageRootCredentialName = pb.StorageRootCredentialName - st.UpdatedAt = pb.UpdatedAt - st.UpdatedBy = pb.UpdatedBy - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *metastoreInfoPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st metastoreInfoPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func modelVersionInfoToPb(st *ModelVersionInfo) (*modelVersionInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &modelVersionInfoPb{} - pb.Aliases = st.Aliases - pb.BrowseOnly = st.BrowseOnly - pb.CatalogName = st.CatalogName - pb.Comment = st.Comment - pb.CreatedAt = st.CreatedAt - pb.CreatedBy = st.CreatedBy - pb.Id = st.Id - pb.MetastoreId = st.MetastoreId - pb.ModelName = st.ModelName - pb.ModelVersionDependencies = st.ModelVersionDependencies - pb.RunId = st.RunId - pb.RunWorkspaceId = st.RunWorkspaceId - pb.SchemaName = st.SchemaName - pb.Source = st.Source - pb.Status = st.Status - pb.StorageLocation = st.StorageLocation - pb.UpdatedAt = st.UpdatedAt - pb.UpdatedBy = st.UpdatedBy - pb.Version = st.Version - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type modelVersionInfoPb struct { - Aliases []RegisteredModelAlias `json:"aliases,omitempty"` - BrowseOnly bool `json:"browse_only,omitempty"` - CatalogName string `json:"catalog_name,omitempty"` - Comment string `json:"comment,omitempty"` - CreatedAt int64 `json:"created_at,omitempty"` - CreatedBy string `json:"created_by,omitempty"` - Id string `json:"id,omitempty"` - MetastoreId string `json:"metastore_id,omitempty"` - ModelName string `json:"model_name,omitempty"` - ModelVersionDependencies *DependencyList `json:"model_version_dependencies,omitempty"` - RunId string `json:"run_id,omitempty"` - RunWorkspaceId int `json:"run_workspace_id,omitempty"` - SchemaName string `json:"schema_name,omitempty"` - Source string `json:"source,omitempty"` - Status ModelVersionInfoStatus `json:"status,omitempty"` - StorageLocation string `json:"storage_location,omitempty"` - UpdatedAt int64 `json:"updated_at,omitempty"` - UpdatedBy string `json:"updated_by,omitempty"` - Version int `json:"version,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func modelVersionInfoFromPb(pb *modelVersionInfoPb) (*ModelVersionInfo, error) { - if pb == nil { - return nil, nil - } - st := &ModelVersionInfo{} - st.Aliases = pb.Aliases - st.BrowseOnly = pb.BrowseOnly - st.CatalogName = pb.CatalogName - st.Comment = pb.Comment - st.CreatedAt = pb.CreatedAt - st.CreatedBy = pb.CreatedBy - st.Id = pb.Id - st.MetastoreId = pb.MetastoreId - st.ModelName = pb.ModelName - st.ModelVersionDependencies = pb.ModelVersionDependencies - st.RunId = pb.RunId - st.RunWorkspaceId = pb.RunWorkspaceId - st.SchemaName = pb.SchemaName - st.Source = pb.Source - st.Status = pb.Status - st.StorageLocation = pb.StorageLocation - st.UpdatedAt = pb.UpdatedAt - st.UpdatedBy = pb.UpdatedBy - st.Version = pb.Version - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *modelVersionInfoPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st modelVersionInfoPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func monitorCronScheduleToPb(st *MonitorCronSchedule) (*monitorCronSchedulePb, error) { - if st == nil { - return nil, nil - } - pb := &monitorCronSchedulePb{} - pb.PauseStatus = st.PauseStatus - pb.QuartzCronExpression = st.QuartzCronExpression - pb.TimezoneId = st.TimezoneId - - return pb, nil -} - -type monitorCronSchedulePb struct { - PauseStatus MonitorCronSchedulePauseStatus `json:"pause_status,omitempty"` - QuartzCronExpression string `json:"quartz_cron_expression"` - TimezoneId string `json:"timezone_id"` -} - -func monitorCronScheduleFromPb(pb *monitorCronSchedulePb) (*MonitorCronSchedule, error) { - if pb == nil { - return nil, nil - } - st := &MonitorCronSchedule{} - st.PauseStatus = pb.PauseStatus - st.QuartzCronExpression = pb.QuartzCronExpression - st.TimezoneId = pb.TimezoneId - - return st, nil -} - -func monitorDataClassificationConfigToPb(st *MonitorDataClassificationConfig) (*monitorDataClassificationConfigPb, error) { - if st == nil { - return nil, nil - } - pb := &monitorDataClassificationConfigPb{} - pb.Enabled = st.Enabled - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type monitorDataClassificationConfigPb struct { - Enabled bool `json:"enabled,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func monitorDataClassificationConfigFromPb(pb *monitorDataClassificationConfigPb) (*MonitorDataClassificationConfig, error) { - if pb == nil { - return nil, nil - } - st := &MonitorDataClassificationConfig{} - st.Enabled = pb.Enabled - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *monitorDataClassificationConfigPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st monitorDataClassificationConfigPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func monitorDestinationToPb(st *MonitorDestination) (*monitorDestinationPb, error) { - if st == nil { - return nil, nil - } - pb := &monitorDestinationPb{} - pb.EmailAddresses = st.EmailAddresses - - return pb, nil -} - -type monitorDestinationPb struct { - EmailAddresses []string `json:"email_addresses,omitempty"` -} - -func monitorDestinationFromPb(pb *monitorDestinationPb) (*MonitorDestination, error) { - if pb == nil { - return nil, nil - } - st := &MonitorDestination{} - st.EmailAddresses = pb.EmailAddresses - - return st, nil -} - -func monitorInferenceLogToPb(st *MonitorInferenceLog) (*monitorInferenceLogPb, error) { - if st == nil { - return nil, nil - } - pb := &monitorInferenceLogPb{} - pb.Granularities = st.Granularities - pb.LabelCol = st.LabelCol - pb.ModelIdCol = st.ModelIdCol - pb.PredictionCol = st.PredictionCol - pb.PredictionProbaCol = st.PredictionProbaCol - pb.ProblemType = st.ProblemType - pb.TimestampCol = st.TimestampCol - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type monitorInferenceLogPb struct { - Granularities []string `json:"granularities"` - LabelCol string `json:"label_col,omitempty"` - ModelIdCol string `json:"model_id_col"` - PredictionCol string `json:"prediction_col"` - PredictionProbaCol string `json:"prediction_proba_col,omitempty"` - ProblemType MonitorInferenceLogProblemType `json:"problem_type"` - TimestampCol string `json:"timestamp_col"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func monitorInferenceLogFromPb(pb *monitorInferenceLogPb) (*MonitorInferenceLog, error) { - if pb == nil { - return nil, nil - } - st := &MonitorInferenceLog{} - st.Granularities = pb.Granularities - st.LabelCol = pb.LabelCol - st.ModelIdCol = pb.ModelIdCol - st.PredictionCol = pb.PredictionCol - st.PredictionProbaCol = pb.PredictionProbaCol - st.ProblemType = pb.ProblemType - st.TimestampCol = pb.TimestampCol - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *monitorInferenceLogPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st monitorInferenceLogPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func monitorInfoToPb(st *MonitorInfo) (*monitorInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &monitorInfoPb{} - pb.AssetsDir = st.AssetsDir - pb.BaselineTableName = st.BaselineTableName - pb.CustomMetrics = st.CustomMetrics - pb.DashboardId = st.DashboardId - pb.DataClassificationConfig = st.DataClassificationConfig - pb.DriftMetricsTableName = st.DriftMetricsTableName - pb.InferenceLog = st.InferenceLog - pb.LatestMonitorFailureMsg = st.LatestMonitorFailureMsg - pb.MonitorVersion = st.MonitorVersion - pb.Notifications = st.Notifications - pb.OutputSchemaName = st.OutputSchemaName - pb.ProfileMetricsTableName = st.ProfileMetricsTableName - pb.Schedule = st.Schedule - pb.SlicingExprs = st.SlicingExprs - pb.Snapshot = st.Snapshot - pb.Status = st.Status - pb.TableName = st.TableName - pb.TimeSeries = st.TimeSeries - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type monitorInfoPb struct { - AssetsDir string `json:"assets_dir,omitempty"` - BaselineTableName string `json:"baseline_table_name,omitempty"` - CustomMetrics []MonitorMetric `json:"custom_metrics,omitempty"` - DashboardId string `json:"dashboard_id,omitempty"` - DataClassificationConfig *MonitorDataClassificationConfig `json:"data_classification_config,omitempty"` - DriftMetricsTableName string `json:"drift_metrics_table_name"` - InferenceLog *MonitorInferenceLog `json:"inference_log,omitempty"` - LatestMonitorFailureMsg string `json:"latest_monitor_failure_msg,omitempty"` - MonitorVersion string `json:"monitor_version"` - Notifications *MonitorNotifications `json:"notifications,omitempty"` - OutputSchemaName string `json:"output_schema_name,omitempty"` - ProfileMetricsTableName string `json:"profile_metrics_table_name"` - Schedule *MonitorCronSchedule `json:"schedule,omitempty"` - SlicingExprs []string `json:"slicing_exprs,omitempty"` - Snapshot *MonitorSnapshot `json:"snapshot,omitempty"` - Status MonitorInfoStatus `json:"status"` - TableName string `json:"table_name"` - TimeSeries *MonitorTimeSeries `json:"time_series,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func monitorInfoFromPb(pb *monitorInfoPb) (*MonitorInfo, error) { - if pb == nil { - return nil, nil - } - st := &MonitorInfo{} - st.AssetsDir = pb.AssetsDir - st.BaselineTableName = pb.BaselineTableName - st.CustomMetrics = pb.CustomMetrics - st.DashboardId = pb.DashboardId - st.DataClassificationConfig = pb.DataClassificationConfig - st.DriftMetricsTableName = pb.DriftMetricsTableName - st.InferenceLog = pb.InferenceLog - st.LatestMonitorFailureMsg = pb.LatestMonitorFailureMsg - st.MonitorVersion = pb.MonitorVersion - st.Notifications = pb.Notifications - st.OutputSchemaName = pb.OutputSchemaName - st.ProfileMetricsTableName = pb.ProfileMetricsTableName - st.Schedule = pb.Schedule - st.SlicingExprs = pb.SlicingExprs - st.Snapshot = pb.Snapshot - st.Status = pb.Status - st.TableName = pb.TableName - st.TimeSeries = pb.TimeSeries - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *monitorInfoPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st monitorInfoPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func monitorMetricToPb(st *MonitorMetric) (*monitorMetricPb, error) { - if st == nil { - return nil, nil - } - pb := &monitorMetricPb{} - pb.Definition = st.Definition - pb.InputColumns = st.InputColumns - pb.Name = st.Name - pb.OutputDataType = st.OutputDataType - pb.Type = st.Type - - return pb, nil -} - -type monitorMetricPb struct { - Definition string `json:"definition"` - InputColumns []string `json:"input_columns"` - Name string `json:"name"` - OutputDataType string `json:"output_data_type"` - Type MonitorMetricType `json:"type"` -} - -func monitorMetricFromPb(pb *monitorMetricPb) (*MonitorMetric, error) { - if pb == nil { - return nil, nil - } - st := &MonitorMetric{} - st.Definition = pb.Definition - st.InputColumns = pb.InputColumns - st.Name = pb.Name - st.OutputDataType = pb.OutputDataType - st.Type = pb.Type - - return st, nil -} - -func monitorNotificationsToPb(st *MonitorNotifications) (*monitorNotificationsPb, error) { - if st == nil { - return nil, nil - } - pb := &monitorNotificationsPb{} - pb.OnFailure = st.OnFailure - pb.OnNewClassificationTagDetected = st.OnNewClassificationTagDetected - - return pb, nil -} - -type monitorNotificationsPb struct { - OnFailure *MonitorDestination `json:"on_failure,omitempty"` - OnNewClassificationTagDetected *MonitorDestination `json:"on_new_classification_tag_detected,omitempty"` -} - -func monitorNotificationsFromPb(pb *monitorNotificationsPb) (*MonitorNotifications, error) { - if pb == nil { - return nil, nil - } - st := &MonitorNotifications{} - st.OnFailure = pb.OnFailure - st.OnNewClassificationTagDetected = pb.OnNewClassificationTagDetected - - return st, nil -} - -func monitorRefreshInfoToPb(st *MonitorRefreshInfo) (*monitorRefreshInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &monitorRefreshInfoPb{} - pb.EndTimeMs = st.EndTimeMs - pb.Message = st.Message - pb.RefreshId = st.RefreshId - pb.StartTimeMs = st.StartTimeMs - pb.State = st.State - pb.Trigger = st.Trigger - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type monitorRefreshInfoPb struct { - EndTimeMs int64 `json:"end_time_ms,omitempty"` - Message string `json:"message,omitempty"` - RefreshId int64 `json:"refresh_id"` - StartTimeMs int64 `json:"start_time_ms"` - State MonitorRefreshInfoState `json:"state"` - Trigger MonitorRefreshInfoTrigger `json:"trigger,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func monitorRefreshInfoFromPb(pb *monitorRefreshInfoPb) (*MonitorRefreshInfo, error) { - if pb == nil { - return nil, nil - } - st := &MonitorRefreshInfo{} - st.EndTimeMs = pb.EndTimeMs - st.Message = pb.Message - st.RefreshId = pb.RefreshId - st.StartTimeMs = pb.StartTimeMs - st.State = pb.State - st.Trigger = pb.Trigger - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *monitorRefreshInfoPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st monitorRefreshInfoPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func monitorRefreshListResponseToPb(st *MonitorRefreshListResponse) (*monitorRefreshListResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &monitorRefreshListResponsePb{} - pb.Refreshes = st.Refreshes - - return pb, nil -} - -type monitorRefreshListResponsePb struct { - Refreshes []MonitorRefreshInfo `json:"refreshes,omitempty"` -} - -func monitorRefreshListResponseFromPb(pb *monitorRefreshListResponsePb) (*MonitorRefreshListResponse, error) { - if pb == nil { - return nil, nil - } - st := &MonitorRefreshListResponse{} - st.Refreshes = pb.Refreshes - - return st, nil -} - -func monitorSnapshotToPb(st *MonitorSnapshot) (*monitorSnapshotPb, error) { - if st == nil { - return nil, nil - } - pb := &monitorSnapshotPb{} - - return pb, nil -} - -type monitorSnapshotPb struct { -} - -func monitorSnapshotFromPb(pb *monitorSnapshotPb) (*MonitorSnapshot, error) { - if pb == nil { - return nil, nil - } - st := &MonitorSnapshot{} - - return st, nil -} - -func monitorTimeSeriesToPb(st *MonitorTimeSeries) (*monitorTimeSeriesPb, error) { - if st == nil { - return nil, nil - } - pb := &monitorTimeSeriesPb{} - pb.Granularities = st.Granularities - pb.TimestampCol = st.TimestampCol - - return pb, nil -} - -type monitorTimeSeriesPb struct { - Granularities []string `json:"granularities"` - TimestampCol string `json:"timestamp_col"` -} - -func monitorTimeSeriesFromPb(pb *monitorTimeSeriesPb) (*MonitorTimeSeries, error) { - if pb == nil { - return nil, nil - } - st := &MonitorTimeSeries{} - st.Granularities = pb.Granularities - st.TimestampCol = pb.TimestampCol - - return st, nil -} - -func namedTableConstraintToPb(st *NamedTableConstraint) (*namedTableConstraintPb, error) { - if st == nil { - return nil, nil - } - pb := &namedTableConstraintPb{} - pb.Name = st.Name - - return pb, nil -} - -type namedTableConstraintPb struct { - Name string `json:"name"` -} - -func namedTableConstraintFromPb(pb *namedTableConstraintPb) (*NamedTableConstraint, error) { - if pb == nil { - return nil, nil - } - st := &NamedTableConstraint{} - st.Name = pb.Name - - return st, nil -} - -func onlineTableToPb(st *OnlineTable) (*onlineTablePb, error) { - if st == nil { - return nil, nil - } - pb := &onlineTablePb{} - pb.Name = st.Name - pb.Spec = st.Spec - pb.Status = st.Status - pb.TableServingUrl = st.TableServingUrl - pb.UnityCatalogProvisioningState = st.UnityCatalogProvisioningState - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type onlineTablePb struct { - Name string `json:"name,omitempty"` - Spec *OnlineTableSpec `json:"spec,omitempty"` - Status *OnlineTableStatus `json:"status,omitempty"` - TableServingUrl string `json:"table_serving_url,omitempty"` - UnityCatalogProvisioningState ProvisioningInfoState `json:"unity_catalog_provisioning_state,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func onlineTableFromPb(pb *onlineTablePb) (*OnlineTable, error) { - if pb == nil { - return nil, nil - } - st := &OnlineTable{} - st.Name = pb.Name - st.Spec = pb.Spec - st.Status = pb.Status - st.TableServingUrl = pb.TableServingUrl - st.UnityCatalogProvisioningState = pb.UnityCatalogProvisioningState - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *onlineTablePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st onlineTablePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func onlineTableSpecToPb(st *OnlineTableSpec) (*onlineTableSpecPb, error) { - if st == nil { - return nil, nil - } - pb := &onlineTableSpecPb{} - pb.PerformFullCopy = st.PerformFullCopy - pb.PipelineId = st.PipelineId - pb.PrimaryKeyColumns = st.PrimaryKeyColumns - pb.RunContinuously = st.RunContinuously - pb.RunTriggered = st.RunTriggered - pb.SourceTableFullName = st.SourceTableFullName - pb.TimeseriesKey = st.TimeseriesKey - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type onlineTableSpecPb struct { - PerformFullCopy bool `json:"perform_full_copy,omitempty"` - PipelineId string `json:"pipeline_id,omitempty"` - PrimaryKeyColumns []string `json:"primary_key_columns,omitempty"` - RunContinuously *OnlineTableSpecContinuousSchedulingPolicy `json:"run_continuously,omitempty"` - RunTriggered *OnlineTableSpecTriggeredSchedulingPolicy `json:"run_triggered,omitempty"` - SourceTableFullName string `json:"source_table_full_name,omitempty"` - TimeseriesKey string `json:"timeseries_key,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func onlineTableSpecFromPb(pb *onlineTableSpecPb) (*OnlineTableSpec, error) { - if pb == nil { - return nil, nil - } - st := &OnlineTableSpec{} - st.PerformFullCopy = pb.PerformFullCopy - st.PipelineId = pb.PipelineId - st.PrimaryKeyColumns = pb.PrimaryKeyColumns - st.RunContinuously = pb.RunContinuously - st.RunTriggered = pb.RunTriggered - st.SourceTableFullName = pb.SourceTableFullName - st.TimeseriesKey = pb.TimeseriesKey - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *onlineTableSpecPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st onlineTableSpecPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func onlineTableSpecContinuousSchedulingPolicyToPb(st *OnlineTableSpecContinuousSchedulingPolicy) (*onlineTableSpecContinuousSchedulingPolicyPb, error) { - if st == nil { - return nil, nil - } - pb := &onlineTableSpecContinuousSchedulingPolicyPb{} - - return pb, nil -} - -type onlineTableSpecContinuousSchedulingPolicyPb struct { -} - -func onlineTableSpecContinuousSchedulingPolicyFromPb(pb *onlineTableSpecContinuousSchedulingPolicyPb) (*OnlineTableSpecContinuousSchedulingPolicy, error) { - if pb == nil { - return nil, nil - } - st := &OnlineTableSpecContinuousSchedulingPolicy{} - - return st, nil -} - -func onlineTableSpecTriggeredSchedulingPolicyToPb(st *OnlineTableSpecTriggeredSchedulingPolicy) (*onlineTableSpecTriggeredSchedulingPolicyPb, error) { - if st == nil { - return nil, nil - } - pb := &onlineTableSpecTriggeredSchedulingPolicyPb{} - - return pb, nil -} - -type onlineTableSpecTriggeredSchedulingPolicyPb struct { -} - -func onlineTableSpecTriggeredSchedulingPolicyFromPb(pb *onlineTableSpecTriggeredSchedulingPolicyPb) (*OnlineTableSpecTriggeredSchedulingPolicy, error) { - if pb == nil { - return nil, nil - } - st := &OnlineTableSpecTriggeredSchedulingPolicy{} - - return st, nil -} - -func onlineTableStatusToPb(st *OnlineTableStatus) (*onlineTableStatusPb, error) { - if st == nil { - return nil, nil - } - pb := &onlineTableStatusPb{} - pb.ContinuousUpdateStatus = st.ContinuousUpdateStatus - pb.DetailedState = st.DetailedState - pb.FailedStatus = st.FailedStatus - pb.Message = st.Message - pb.ProvisioningStatus = st.ProvisioningStatus - pb.TriggeredUpdateStatus = st.TriggeredUpdateStatus - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type onlineTableStatusPb struct { - ContinuousUpdateStatus *ContinuousUpdateStatus `json:"continuous_update_status,omitempty"` - DetailedState OnlineTableState `json:"detailed_state,omitempty"` - FailedStatus *FailedStatus `json:"failed_status,omitempty"` - Message string `json:"message,omitempty"` - ProvisioningStatus *ProvisioningStatus `json:"provisioning_status,omitempty"` - TriggeredUpdateStatus *TriggeredUpdateStatus `json:"triggered_update_status,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func onlineTableStatusFromPb(pb *onlineTableStatusPb) (*OnlineTableStatus, error) { - if pb == nil { - return nil, nil - } - st := &OnlineTableStatus{} - st.ContinuousUpdateStatus = pb.ContinuousUpdateStatus - st.DetailedState = pb.DetailedState - st.FailedStatus = pb.FailedStatus - st.Message = pb.Message - st.ProvisioningStatus = pb.ProvisioningStatus - st.TriggeredUpdateStatus = pb.TriggeredUpdateStatus - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *onlineTableStatusPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st onlineTableStatusPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func permissionsChangeToPb(st *PermissionsChange) (*permissionsChangePb, error) { - if st == nil { - return nil, nil - } - pb := &permissionsChangePb{} - pb.Add = st.Add - pb.Principal = st.Principal - pb.Remove = st.Remove - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type permissionsChangePb struct { - Add []Privilege `json:"add,omitempty"` - Principal string `json:"principal,omitempty"` - Remove []Privilege `json:"remove,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func permissionsChangeFromPb(pb *permissionsChangePb) (*PermissionsChange, error) { - if pb == nil { - return nil, nil - } - st := &PermissionsChange{} - st.Add = pb.Add - st.Principal = pb.Principal - st.Remove = pb.Remove - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *permissionsChangePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st permissionsChangePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func pipelineProgressToPb(st *PipelineProgress) (*pipelineProgressPb, error) { - if st == nil { - return nil, nil - } - pb := &pipelineProgressPb{} - pb.EstimatedCompletionTimeSeconds = st.EstimatedCompletionTimeSeconds - pb.LatestVersionCurrentlyProcessing = st.LatestVersionCurrentlyProcessing - pb.SyncProgressCompletion = st.SyncProgressCompletion - pb.SyncedRowCount = st.SyncedRowCount - pb.TotalRowCount = st.TotalRowCount - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type pipelineProgressPb struct { - EstimatedCompletionTimeSeconds float64 `json:"estimated_completion_time_seconds,omitempty"` - LatestVersionCurrentlyProcessing int64 `json:"latest_version_currently_processing,omitempty"` - SyncProgressCompletion float64 `json:"sync_progress_completion,omitempty"` - SyncedRowCount int64 `json:"synced_row_count,omitempty"` - TotalRowCount int64 `json:"total_row_count,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func pipelineProgressFromPb(pb *pipelineProgressPb) (*PipelineProgress, error) { - if pb == nil { - return nil, nil - } - st := &PipelineProgress{} - st.EstimatedCompletionTimeSeconds = pb.EstimatedCompletionTimeSeconds - st.LatestVersionCurrentlyProcessing = pb.LatestVersionCurrentlyProcessing - st.SyncProgressCompletion = pb.SyncProgressCompletion - st.SyncedRowCount = pb.SyncedRowCount - st.TotalRowCount = pb.TotalRowCount - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *pipelineProgressPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st pipelineProgressPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func primaryKeyConstraintToPb(st *PrimaryKeyConstraint) (*primaryKeyConstraintPb, error) { - if st == nil { - return nil, nil - } - pb := &primaryKeyConstraintPb{} - pb.ChildColumns = st.ChildColumns - pb.Name = st.Name - pb.TimeseriesColumns = st.TimeseriesColumns - - return pb, nil -} - -type primaryKeyConstraintPb struct { - ChildColumns []string `json:"child_columns"` - Name string `json:"name"` - TimeseriesColumns []string `json:"timeseries_columns,omitempty"` -} - -func primaryKeyConstraintFromPb(pb *primaryKeyConstraintPb) (*PrimaryKeyConstraint, error) { - if pb == nil { - return nil, nil - } - st := &PrimaryKeyConstraint{} - st.ChildColumns = pb.ChildColumns - st.Name = pb.Name - st.TimeseriesColumns = pb.TimeseriesColumns - - return st, nil -} - -func privilegeAssignmentToPb(st *PrivilegeAssignment) (*privilegeAssignmentPb, error) { - if st == nil { - return nil, nil - } - pb := &privilegeAssignmentPb{} - pb.Principal = st.Principal - pb.Privileges = st.Privileges - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type privilegeAssignmentPb struct { - Principal string `json:"principal,omitempty"` - Privileges []Privilege `json:"privileges,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func privilegeAssignmentFromPb(pb *privilegeAssignmentPb) (*PrivilegeAssignment, error) { - if pb == nil { - return nil, nil - } - st := &PrivilegeAssignment{} - st.Principal = pb.Principal - st.Privileges = pb.Privileges - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *privilegeAssignmentPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st privilegeAssignmentPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func provisioningInfoToPb(st *ProvisioningInfo) (*provisioningInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &provisioningInfoPb{} - pb.State = st.State - - return pb, nil -} - -type provisioningInfoPb struct { - State ProvisioningInfoState `json:"state,omitempty"` -} - -func provisioningInfoFromPb(pb *provisioningInfoPb) (*ProvisioningInfo, error) { - if pb == nil { - return nil, nil - } - st := &ProvisioningInfo{} - st.State = pb.State - - return st, nil -} - -func provisioningStatusToPb(st *ProvisioningStatus) (*provisioningStatusPb, error) { - if st == nil { - return nil, nil - } - pb := &provisioningStatusPb{} - pb.InitialPipelineSyncProgress = st.InitialPipelineSyncProgress - - return pb, nil -} - -type provisioningStatusPb struct { - InitialPipelineSyncProgress *PipelineProgress `json:"initial_pipeline_sync_progress,omitempty"` -} - -func provisioningStatusFromPb(pb *provisioningStatusPb) (*ProvisioningStatus, error) { - if pb == nil { - return nil, nil - } - st := &ProvisioningStatus{} - st.InitialPipelineSyncProgress = pb.InitialPipelineSyncProgress - - return st, nil -} - -func quotaInfoToPb(st *QuotaInfo) (*quotaInfoPb, error) { - if st == nil { - return nil, nil - } - pb := "aInfoPb{} - pb.LastRefreshedAt = st.LastRefreshedAt - pb.ParentFullName = st.ParentFullName - pb.ParentSecurableType = st.ParentSecurableType - pb.QuotaCount = st.QuotaCount - pb.QuotaLimit = st.QuotaLimit - pb.QuotaName = st.QuotaName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type quotaInfoPb struct { - LastRefreshedAt int64 `json:"last_refreshed_at,omitempty"` - ParentFullName string `json:"parent_full_name,omitempty"` - ParentSecurableType SecurableType `json:"parent_securable_type,omitempty"` - QuotaCount int `json:"quota_count,omitempty"` - QuotaLimit int `json:"quota_limit,omitempty"` - QuotaName string `json:"quota_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func quotaInfoFromPb(pb *quotaInfoPb) (*QuotaInfo, error) { - if pb == nil { - return nil, nil - } - st := &QuotaInfo{} - st.LastRefreshedAt = pb.LastRefreshedAt - st.ParentFullName = pb.ParentFullName - st.ParentSecurableType = pb.ParentSecurableType - st.QuotaCount = pb.QuotaCount - st.QuotaLimit = pb.QuotaLimit - st.QuotaName = pb.QuotaName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *quotaInfoPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st quotaInfoPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func r2CredentialsToPb(st *R2Credentials) (*r2CredentialsPb, error) { - if st == nil { - return nil, nil - } - pb := &r2CredentialsPb{} - pb.AccessKeyId = st.AccessKeyId - pb.SecretAccessKey = st.SecretAccessKey - pb.SessionToken = st.SessionToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type r2CredentialsPb struct { - AccessKeyId string `json:"access_key_id,omitempty"` - SecretAccessKey string `json:"secret_access_key,omitempty"` - SessionToken string `json:"session_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func r2CredentialsFromPb(pb *r2CredentialsPb) (*R2Credentials, error) { - if pb == nil { - return nil, nil - } - st := &R2Credentials{} - st.AccessKeyId = pb.AccessKeyId - st.SecretAccessKey = pb.SecretAccessKey - st.SessionToken = pb.SessionToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *r2CredentialsPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st r2CredentialsPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func readVolumeRequestToPb(st *ReadVolumeRequest) (*readVolumeRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &readVolumeRequestPb{} - pb.IncludeBrowse = st.IncludeBrowse - pb.Name = st.Name - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type readVolumeRequestPb struct { - IncludeBrowse bool `json:"-" url:"include_browse,omitempty"` - Name string `json:"-" url:"-"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func readVolumeRequestFromPb(pb *readVolumeRequestPb) (*ReadVolumeRequest, error) { - if pb == nil { - return nil, nil - } - st := &ReadVolumeRequest{} - st.IncludeBrowse = pb.IncludeBrowse - st.Name = pb.Name - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *readVolumeRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st readVolumeRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func regenerateDashboardRequestToPb(st *RegenerateDashboardRequest) (*regenerateDashboardRequestPb, error) { - if st == nil { - return nil, nil - } - pb := ®enerateDashboardRequestPb{} - pb.TableName = st.TableName - pb.WarehouseId = st.WarehouseId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type regenerateDashboardRequestPb struct { - TableName string `json:"-" url:"-"` - WarehouseId string `json:"warehouse_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func regenerateDashboardRequestFromPb(pb *regenerateDashboardRequestPb) (*RegenerateDashboardRequest, error) { - if pb == nil { - return nil, nil - } - st := &RegenerateDashboardRequest{} - st.TableName = pb.TableName - st.WarehouseId = pb.WarehouseId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *regenerateDashboardRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st regenerateDashboardRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func regenerateDashboardResponseToPb(st *RegenerateDashboardResponse) (*regenerateDashboardResponsePb, error) { - if st == nil { - return nil, nil - } - pb := ®enerateDashboardResponsePb{} - pb.DashboardId = st.DashboardId - pb.ParentFolder = st.ParentFolder - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type regenerateDashboardResponsePb struct { - DashboardId string `json:"dashboard_id,omitempty"` - ParentFolder string `json:"parent_folder,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func regenerateDashboardResponseFromPb(pb *regenerateDashboardResponsePb) (*RegenerateDashboardResponse, error) { - if pb == nil { - return nil, nil - } - st := &RegenerateDashboardResponse{} - st.DashboardId = pb.DashboardId - st.ParentFolder = pb.ParentFolder - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *regenerateDashboardResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st regenerateDashboardResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func registeredModelAliasToPb(st *RegisteredModelAlias) (*registeredModelAliasPb, error) { - if st == nil { - return nil, nil - } - pb := ®isteredModelAliasPb{} - pb.AliasName = st.AliasName - pb.VersionNum = st.VersionNum - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type registeredModelAliasPb struct { - AliasName string `json:"alias_name,omitempty"` - VersionNum int `json:"version_num,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func registeredModelAliasFromPb(pb *registeredModelAliasPb) (*RegisteredModelAlias, error) { - if pb == nil { - return nil, nil - } - st := &RegisteredModelAlias{} - st.AliasName = pb.AliasName - st.VersionNum = pb.VersionNum - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *registeredModelAliasPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st registeredModelAliasPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func registeredModelInfoToPb(st *RegisteredModelInfo) (*registeredModelInfoPb, error) { - if st == nil { - return nil, nil - } - pb := ®isteredModelInfoPb{} - pb.Aliases = st.Aliases - pb.BrowseOnly = st.BrowseOnly - pb.CatalogName = st.CatalogName - pb.Comment = st.Comment - pb.CreatedAt = st.CreatedAt - pb.CreatedBy = st.CreatedBy - pb.FullName = st.FullName - pb.MetastoreId = st.MetastoreId - pb.Name = st.Name - pb.Owner = st.Owner - pb.SchemaName = st.SchemaName - pb.StorageLocation = st.StorageLocation - pb.UpdatedAt = st.UpdatedAt - pb.UpdatedBy = st.UpdatedBy - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type registeredModelInfoPb struct { - Aliases []RegisteredModelAlias `json:"aliases,omitempty"` - BrowseOnly bool `json:"browse_only,omitempty"` - CatalogName string `json:"catalog_name,omitempty"` - Comment string `json:"comment,omitempty"` - CreatedAt int64 `json:"created_at,omitempty"` - CreatedBy string `json:"created_by,omitempty"` - FullName string `json:"full_name,omitempty"` - MetastoreId string `json:"metastore_id,omitempty"` - Name string `json:"name,omitempty"` - Owner string `json:"owner,omitempty"` - SchemaName string `json:"schema_name,omitempty"` - StorageLocation string `json:"storage_location,omitempty"` - UpdatedAt int64 `json:"updated_at,omitempty"` - UpdatedBy string `json:"updated_by,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func registeredModelInfoFromPb(pb *registeredModelInfoPb) (*RegisteredModelInfo, error) { - if pb == nil { - return nil, nil - } - st := &RegisteredModelInfo{} - st.Aliases = pb.Aliases - st.BrowseOnly = pb.BrowseOnly - st.CatalogName = pb.CatalogName - st.Comment = pb.Comment - st.CreatedAt = pb.CreatedAt - st.CreatedBy = pb.CreatedBy - st.FullName = pb.FullName - st.MetastoreId = pb.MetastoreId - st.Name = pb.Name - st.Owner = pb.Owner - st.SchemaName = pb.SchemaName - st.StorageLocation = pb.StorageLocation - st.UpdatedAt = pb.UpdatedAt - st.UpdatedBy = pb.UpdatedBy - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *registeredModelInfoPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st registeredModelInfoPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func runRefreshRequestToPb(st *RunRefreshRequest) (*runRefreshRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &runRefreshRequestPb{} - pb.TableName = st.TableName - - return pb, nil -} - -type runRefreshRequestPb struct { - TableName string `json:"-" url:"-"` -} - -func runRefreshRequestFromPb(pb *runRefreshRequestPb) (*RunRefreshRequest, error) { - if pb == nil { - return nil, nil - } - st := &RunRefreshRequest{} - st.TableName = pb.TableName - - return st, nil -} - -func schemaInfoToPb(st *SchemaInfo) (*schemaInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &schemaInfoPb{} - pb.BrowseOnly = st.BrowseOnly - pb.CatalogName = st.CatalogName - pb.CatalogType = st.CatalogType - pb.Comment = st.Comment - pb.CreatedAt = st.CreatedAt - pb.CreatedBy = st.CreatedBy - pb.EffectivePredictiveOptimizationFlag = st.EffectivePredictiveOptimizationFlag - pb.EnablePredictiveOptimization = st.EnablePredictiveOptimization - pb.FullName = st.FullName - pb.MetastoreId = st.MetastoreId - pb.Name = st.Name - pb.Owner = st.Owner - pb.Properties = st.Properties - pb.SchemaId = st.SchemaId - pb.StorageLocation = st.StorageLocation - pb.StorageRoot = st.StorageRoot - pb.UpdatedAt = st.UpdatedAt - pb.UpdatedBy = st.UpdatedBy - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type schemaInfoPb struct { - BrowseOnly bool `json:"browse_only,omitempty"` - CatalogName string `json:"catalog_name,omitempty"` - CatalogType CatalogType `json:"catalog_type,omitempty"` - Comment string `json:"comment,omitempty"` - CreatedAt int64 `json:"created_at,omitempty"` - CreatedBy string `json:"created_by,omitempty"` - EffectivePredictiveOptimizationFlag *EffectivePredictiveOptimizationFlag `json:"effective_predictive_optimization_flag,omitempty"` - EnablePredictiveOptimization EnablePredictiveOptimization `json:"enable_predictive_optimization,omitempty"` - FullName string `json:"full_name,omitempty"` - MetastoreId string `json:"metastore_id,omitempty"` - Name string `json:"name,omitempty"` - Owner string `json:"owner,omitempty"` - Properties map[string]string `json:"properties,omitempty"` - SchemaId string `json:"schema_id,omitempty"` - StorageLocation string `json:"storage_location,omitempty"` - StorageRoot string `json:"storage_root,omitempty"` - UpdatedAt int64 `json:"updated_at,omitempty"` - UpdatedBy string `json:"updated_by,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func schemaInfoFromPb(pb *schemaInfoPb) (*SchemaInfo, error) { - if pb == nil { - return nil, nil - } - st := &SchemaInfo{} - st.BrowseOnly = pb.BrowseOnly - st.CatalogName = pb.CatalogName - st.CatalogType = pb.CatalogType - st.Comment = pb.Comment - st.CreatedAt = pb.CreatedAt - st.CreatedBy = pb.CreatedBy - st.EffectivePredictiveOptimizationFlag = pb.EffectivePredictiveOptimizationFlag - st.EnablePredictiveOptimization = pb.EnablePredictiveOptimization - st.FullName = pb.FullName - st.MetastoreId = pb.MetastoreId - st.Name = pb.Name - st.Owner = pb.Owner - st.Properties = pb.Properties - st.SchemaId = pb.SchemaId - st.StorageLocation = pb.StorageLocation - st.StorageRoot = pb.StorageRoot - st.UpdatedAt = pb.UpdatedAt - st.UpdatedBy = pb.UpdatedBy - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *schemaInfoPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st schemaInfoPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func setArtifactAllowlistToPb(st *SetArtifactAllowlist) (*setArtifactAllowlistPb, error) { - if st == nil { - return nil, nil - } - pb := &setArtifactAllowlistPb{} - pb.ArtifactMatchers = st.ArtifactMatchers - pb.ArtifactType = st.ArtifactType - pb.CreatedAt = st.CreatedAt - pb.CreatedBy = st.CreatedBy - pb.MetastoreId = st.MetastoreId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type setArtifactAllowlistPb struct { - ArtifactMatchers []ArtifactMatcher `json:"artifact_matchers"` - ArtifactType ArtifactType `json:"-" url:"-"` - CreatedAt int64 `json:"created_at,omitempty"` - CreatedBy string `json:"created_by,omitempty"` - MetastoreId string `json:"metastore_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func setArtifactAllowlistFromPb(pb *setArtifactAllowlistPb) (*SetArtifactAllowlist, error) { - if pb == nil { - return nil, nil - } - st := &SetArtifactAllowlist{} - st.ArtifactMatchers = pb.ArtifactMatchers - st.ArtifactType = pb.ArtifactType - st.CreatedAt = pb.CreatedAt - st.CreatedBy = pb.CreatedBy - st.MetastoreId = pb.MetastoreId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *setArtifactAllowlistPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st setArtifactAllowlistPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func setRegisteredModelAliasRequestToPb(st *SetRegisteredModelAliasRequest) (*setRegisteredModelAliasRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &setRegisteredModelAliasRequestPb{} - pb.Alias = st.Alias - pb.FullName = st.FullName - pb.VersionNum = st.VersionNum - - return pb, nil -} - -type setRegisteredModelAliasRequestPb struct { - Alias string `json:"alias" url:"-"` - FullName string `json:"full_name" url:"-"` - VersionNum int `json:"version_num"` -} - -func setRegisteredModelAliasRequestFromPb(pb *setRegisteredModelAliasRequestPb) (*SetRegisteredModelAliasRequest, error) { - if pb == nil { - return nil, nil - } - st := &SetRegisteredModelAliasRequest{} - st.Alias = pb.Alias - st.FullName = pb.FullName - st.VersionNum = pb.VersionNum - - return st, nil -} - -func sseEncryptionDetailsToPb(st *SseEncryptionDetails) (*sseEncryptionDetailsPb, error) { - if st == nil { - return nil, nil - } - pb := &sseEncryptionDetailsPb{} - pb.Algorithm = st.Algorithm - pb.AwsKmsKeyArn = st.AwsKmsKeyArn - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type sseEncryptionDetailsPb struct { - Algorithm SseEncryptionDetailsAlgorithm `json:"algorithm,omitempty"` - AwsKmsKeyArn string `json:"aws_kms_key_arn,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func sseEncryptionDetailsFromPb(pb *sseEncryptionDetailsPb) (*SseEncryptionDetails, error) { - if pb == nil { - return nil, nil - } - st := &SseEncryptionDetails{} - st.Algorithm = pb.Algorithm - st.AwsKmsKeyArn = pb.AwsKmsKeyArn - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *sseEncryptionDetailsPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st sseEncryptionDetailsPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func storageCredentialInfoToPb(st *StorageCredentialInfo) (*storageCredentialInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &storageCredentialInfoPb{} - pb.AwsIamRole = st.AwsIamRole - pb.AzureManagedIdentity = st.AzureManagedIdentity - pb.AzureServicePrincipal = st.AzureServicePrincipal - pb.CloudflareApiToken = st.CloudflareApiToken - pb.Comment = st.Comment - pb.CreatedAt = st.CreatedAt - pb.CreatedBy = st.CreatedBy - pb.DatabricksGcpServiceAccount = st.DatabricksGcpServiceAccount - pb.FullName = st.FullName - pb.Id = st.Id - pb.IsolationMode = st.IsolationMode - pb.MetastoreId = st.MetastoreId - pb.Name = st.Name - pb.Owner = st.Owner - pb.ReadOnly = st.ReadOnly - pb.UpdatedAt = st.UpdatedAt - pb.UpdatedBy = st.UpdatedBy - pb.UsedForManagedStorage = st.UsedForManagedStorage - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type storageCredentialInfoPb struct { - AwsIamRole *AwsIamRoleResponse `json:"aws_iam_role,omitempty"` - AzureManagedIdentity *AzureManagedIdentityResponse `json:"azure_managed_identity,omitempty"` - AzureServicePrincipal *AzureServicePrincipal `json:"azure_service_principal,omitempty"` - CloudflareApiToken *CloudflareApiToken `json:"cloudflare_api_token,omitempty"` - Comment string `json:"comment,omitempty"` - CreatedAt int64 `json:"created_at,omitempty"` - CreatedBy string `json:"created_by,omitempty"` - DatabricksGcpServiceAccount *DatabricksGcpServiceAccountResponse `json:"databricks_gcp_service_account,omitempty"` - FullName string `json:"full_name,omitempty"` - Id string `json:"id,omitempty"` - IsolationMode IsolationMode `json:"isolation_mode,omitempty"` - MetastoreId string `json:"metastore_id,omitempty"` - Name string `json:"name,omitempty"` - Owner string `json:"owner,omitempty"` - ReadOnly bool `json:"read_only,omitempty"` - UpdatedAt int64 `json:"updated_at,omitempty"` - UpdatedBy string `json:"updated_by,omitempty"` - UsedForManagedStorage bool `json:"used_for_managed_storage,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func storageCredentialInfoFromPb(pb *storageCredentialInfoPb) (*StorageCredentialInfo, error) { - if pb == nil { - return nil, nil - } - st := &StorageCredentialInfo{} - st.AwsIamRole = pb.AwsIamRole - st.AzureManagedIdentity = pb.AzureManagedIdentity - st.AzureServicePrincipal = pb.AzureServicePrincipal - st.CloudflareApiToken = pb.CloudflareApiToken - st.Comment = pb.Comment - st.CreatedAt = pb.CreatedAt - st.CreatedBy = pb.CreatedBy - st.DatabricksGcpServiceAccount = pb.DatabricksGcpServiceAccount - st.FullName = pb.FullName - st.Id = pb.Id - st.IsolationMode = pb.IsolationMode - st.MetastoreId = pb.MetastoreId - st.Name = pb.Name - st.Owner = pb.Owner - st.ReadOnly = pb.ReadOnly - st.UpdatedAt = pb.UpdatedAt - st.UpdatedBy = pb.UpdatedBy - st.UsedForManagedStorage = pb.UsedForManagedStorage - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *storageCredentialInfoPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st storageCredentialInfoPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func systemSchemaInfoToPb(st *SystemSchemaInfo) (*systemSchemaInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &systemSchemaInfoPb{} - pb.Schema = st.Schema - pb.State = st.State - - return pb, nil -} - -type systemSchemaInfoPb struct { - Schema string `json:"schema"` - State string `json:"state"` -} - -func systemSchemaInfoFromPb(pb *systemSchemaInfoPb) (*SystemSchemaInfo, error) { - if pb == nil { - return nil, nil - } - st := &SystemSchemaInfo{} - st.Schema = pb.Schema - st.State = pb.State - - return st, nil -} - -func tableConstraintToPb(st *TableConstraint) (*tableConstraintPb, error) { - if st == nil { - return nil, nil - } - pb := &tableConstraintPb{} - pb.ForeignKeyConstraint = st.ForeignKeyConstraint - pb.NamedTableConstraint = st.NamedTableConstraint - pb.PrimaryKeyConstraint = st.PrimaryKeyConstraint - - return pb, nil -} - -type tableConstraintPb struct { - ForeignKeyConstraint *ForeignKeyConstraint `json:"foreign_key_constraint,omitempty"` - NamedTableConstraint *NamedTableConstraint `json:"named_table_constraint,omitempty"` - PrimaryKeyConstraint *PrimaryKeyConstraint `json:"primary_key_constraint,omitempty"` -} - -func tableConstraintFromPb(pb *tableConstraintPb) (*TableConstraint, error) { - if pb == nil { - return nil, nil - } - st := &TableConstraint{} - st.ForeignKeyConstraint = pb.ForeignKeyConstraint - st.NamedTableConstraint = pb.NamedTableConstraint - st.PrimaryKeyConstraint = pb.PrimaryKeyConstraint - - return st, nil -} - -func tableDependencyToPb(st *TableDependency) (*tableDependencyPb, error) { - if st == nil { - return nil, nil - } - pb := &tableDependencyPb{} - pb.TableFullName = st.TableFullName - - return pb, nil -} - -type tableDependencyPb struct { - TableFullName string `json:"table_full_name"` -} - -func tableDependencyFromPb(pb *tableDependencyPb) (*TableDependency, error) { - if pb == nil { - return nil, nil - } - st := &TableDependency{} - st.TableFullName = pb.TableFullName - - return st, nil -} - -func tableExistsResponseToPb(st *TableExistsResponse) (*tableExistsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &tableExistsResponsePb{} - pb.TableExists = st.TableExists - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type tableExistsResponsePb struct { - TableExists bool `json:"table_exists,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func tableExistsResponseFromPb(pb *tableExistsResponsePb) (*TableExistsResponse, error) { - if pb == nil { - return nil, nil - } - st := &TableExistsResponse{} - st.TableExists = pb.TableExists - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *tableExistsResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st tableExistsResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func tableInfoToPb(st *TableInfo) (*tableInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &tableInfoPb{} - pb.AccessPoint = st.AccessPoint - pb.BrowseOnly = st.BrowseOnly - pb.CatalogName = st.CatalogName - pb.Columns = st.Columns - pb.Comment = st.Comment - pb.CreatedAt = st.CreatedAt - pb.CreatedBy = st.CreatedBy - pb.DataAccessConfigurationId = st.DataAccessConfigurationId - pb.DataSourceFormat = st.DataSourceFormat - pb.DeletedAt = st.DeletedAt - pb.DeltaRuntimePropertiesKvpairs = st.DeltaRuntimePropertiesKvpairs - pb.EffectivePredictiveOptimizationFlag = st.EffectivePredictiveOptimizationFlag - pb.EnablePredictiveOptimization = st.EnablePredictiveOptimization - pb.EncryptionDetails = st.EncryptionDetails - pb.FullName = st.FullName - pb.MetastoreId = st.MetastoreId - pb.Name = st.Name - pb.Owner = st.Owner - pb.PipelineId = st.PipelineId - pb.Properties = st.Properties - pb.RowFilter = st.RowFilter - pb.SchemaName = st.SchemaName - pb.SqlPath = st.SqlPath - pb.StorageCredentialName = st.StorageCredentialName - pb.StorageLocation = st.StorageLocation - pb.TableConstraints = st.TableConstraints - pb.TableId = st.TableId - pb.TableType = st.TableType - pb.UpdatedAt = st.UpdatedAt - pb.UpdatedBy = st.UpdatedBy - pb.ViewDefinition = st.ViewDefinition - pb.ViewDependencies = st.ViewDependencies - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type tableInfoPb struct { - AccessPoint string `json:"access_point,omitempty"` - BrowseOnly bool `json:"browse_only,omitempty"` - CatalogName string `json:"catalog_name,omitempty"` - Columns []ColumnInfo `json:"columns,omitempty"` - Comment string `json:"comment,omitempty"` - CreatedAt int64 `json:"created_at,omitempty"` - CreatedBy string `json:"created_by,omitempty"` - DataAccessConfigurationId string `json:"data_access_configuration_id,omitempty"` - DataSourceFormat DataSourceFormat `json:"data_source_format,omitempty"` - DeletedAt int64 `json:"deleted_at,omitempty"` - DeltaRuntimePropertiesKvpairs *DeltaRuntimePropertiesKvPairs `json:"delta_runtime_properties_kvpairs,omitempty"` - EffectivePredictiveOptimizationFlag *EffectivePredictiveOptimizationFlag `json:"effective_predictive_optimization_flag,omitempty"` - EnablePredictiveOptimization EnablePredictiveOptimization `json:"enable_predictive_optimization,omitempty"` - EncryptionDetails *EncryptionDetails `json:"encryption_details,omitempty"` - FullName string `json:"full_name,omitempty"` - MetastoreId string `json:"metastore_id,omitempty"` - Name string `json:"name,omitempty"` - Owner string `json:"owner,omitempty"` - PipelineId string `json:"pipeline_id,omitempty"` - Properties map[string]string `json:"properties,omitempty"` - RowFilter *TableRowFilter `json:"row_filter,omitempty"` - SchemaName string `json:"schema_name,omitempty"` - SqlPath string `json:"sql_path,omitempty"` - StorageCredentialName string `json:"storage_credential_name,omitempty"` - StorageLocation string `json:"storage_location,omitempty"` - TableConstraints []TableConstraint `json:"table_constraints,omitempty"` - TableId string `json:"table_id,omitempty"` - TableType TableType `json:"table_type,omitempty"` - UpdatedAt int64 `json:"updated_at,omitempty"` - UpdatedBy string `json:"updated_by,omitempty"` - ViewDefinition string `json:"view_definition,omitempty"` - ViewDependencies *DependencyList `json:"view_dependencies,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func tableInfoFromPb(pb *tableInfoPb) (*TableInfo, error) { - if pb == nil { - return nil, nil - } - st := &TableInfo{} - st.AccessPoint = pb.AccessPoint - st.BrowseOnly = pb.BrowseOnly - st.CatalogName = pb.CatalogName - st.Columns = pb.Columns - st.Comment = pb.Comment - st.CreatedAt = pb.CreatedAt - st.CreatedBy = pb.CreatedBy - st.DataAccessConfigurationId = pb.DataAccessConfigurationId - st.DataSourceFormat = pb.DataSourceFormat - st.DeletedAt = pb.DeletedAt - st.DeltaRuntimePropertiesKvpairs = pb.DeltaRuntimePropertiesKvpairs - st.EffectivePredictiveOptimizationFlag = pb.EffectivePredictiveOptimizationFlag - st.EnablePredictiveOptimization = pb.EnablePredictiveOptimization - st.EncryptionDetails = pb.EncryptionDetails - st.FullName = pb.FullName - st.MetastoreId = pb.MetastoreId - st.Name = pb.Name - st.Owner = pb.Owner - st.PipelineId = pb.PipelineId - st.Properties = pb.Properties - st.RowFilter = pb.RowFilter - st.SchemaName = pb.SchemaName - st.SqlPath = pb.SqlPath - st.StorageCredentialName = pb.StorageCredentialName - st.StorageLocation = pb.StorageLocation - st.TableConstraints = pb.TableConstraints - st.TableId = pb.TableId - st.TableType = pb.TableType - st.UpdatedAt = pb.UpdatedAt - st.UpdatedBy = pb.UpdatedBy - st.ViewDefinition = pb.ViewDefinition - st.ViewDependencies = pb.ViewDependencies - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *tableInfoPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st tableInfoPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func tableRowFilterToPb(st *TableRowFilter) (*tableRowFilterPb, error) { - if st == nil { - return nil, nil - } - pb := &tableRowFilterPb{} - pb.FunctionName = st.FunctionName - pb.InputColumnNames = st.InputColumnNames - - return pb, nil -} - -type tableRowFilterPb struct { - FunctionName string `json:"function_name"` - InputColumnNames []string `json:"input_column_names"` -} - -func tableRowFilterFromPb(pb *tableRowFilterPb) (*TableRowFilter, error) { - if pb == nil { - return nil, nil - } - st := &TableRowFilter{} - st.FunctionName = pb.FunctionName - st.InputColumnNames = pb.InputColumnNames - - return st, nil -} - -func tableSummaryToPb(st *TableSummary) (*tableSummaryPb, error) { - if st == nil { - return nil, nil - } - pb := &tableSummaryPb{} - pb.FullName = st.FullName - pb.TableType = st.TableType - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type tableSummaryPb struct { - FullName string `json:"full_name,omitempty"` - TableType TableType `json:"table_type,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func tableSummaryFromPb(pb *tableSummaryPb) (*TableSummary, error) { - if pb == nil { - return nil, nil - } - st := &TableSummary{} - st.FullName = pb.FullName - st.TableType = pb.TableType - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *tableSummaryPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st tableSummaryPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func tagKeyValueToPb(st *TagKeyValue) (*tagKeyValuePb, error) { - if st == nil { - return nil, nil - } - pb := &tagKeyValuePb{} - pb.Key = st.Key - pb.Value = st.Value - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type tagKeyValuePb struct { - Key string `json:"key,omitempty"` - Value string `json:"value,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func tagKeyValueFromPb(pb *tagKeyValuePb) (*TagKeyValue, error) { - if pb == nil { - return nil, nil - } - st := &TagKeyValue{} - st.Key = pb.Key - st.Value = pb.Value - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *tagKeyValuePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st tagKeyValuePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func temporaryCredentialsToPb(st *TemporaryCredentials) (*temporaryCredentialsPb, error) { - if st == nil { - return nil, nil - } - pb := &temporaryCredentialsPb{} - pb.AwsTempCredentials = st.AwsTempCredentials - pb.AzureAad = st.AzureAad - pb.ExpirationTime = st.ExpirationTime - pb.GcpOauthToken = st.GcpOauthToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type temporaryCredentialsPb struct { - AwsTempCredentials *AwsCredentials `json:"aws_temp_credentials,omitempty"` - AzureAad *AzureActiveDirectoryToken `json:"azure_aad,omitempty"` - ExpirationTime int64 `json:"expiration_time,omitempty"` - GcpOauthToken *GcpOauthToken `json:"gcp_oauth_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func temporaryCredentialsFromPb(pb *temporaryCredentialsPb) (*TemporaryCredentials, error) { - if pb == nil { - return nil, nil - } - st := &TemporaryCredentials{} - st.AwsTempCredentials = pb.AwsTempCredentials - st.AzureAad = pb.AzureAad - st.ExpirationTime = pb.ExpirationTime - st.GcpOauthToken = pb.GcpOauthToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *temporaryCredentialsPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st temporaryCredentialsPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func triggeredUpdateStatusToPb(st *TriggeredUpdateStatus) (*triggeredUpdateStatusPb, error) { - if st == nil { - return nil, nil - } - pb := &triggeredUpdateStatusPb{} - pb.LastProcessedCommitVersion = st.LastProcessedCommitVersion - pb.Timestamp = st.Timestamp - pb.TriggeredUpdateProgress = st.TriggeredUpdateProgress - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type triggeredUpdateStatusPb struct { - LastProcessedCommitVersion int64 `json:"last_processed_commit_version,omitempty"` - Timestamp string `json:"timestamp,omitempty"` - TriggeredUpdateProgress *PipelineProgress `json:"triggered_update_progress,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func triggeredUpdateStatusFromPb(pb *triggeredUpdateStatusPb) (*TriggeredUpdateStatus, error) { - if pb == nil { - return nil, nil - } - st := &TriggeredUpdateStatus{} - st.LastProcessedCommitVersion = pb.LastProcessedCommitVersion - st.Timestamp = pb.Timestamp - st.TriggeredUpdateProgress = pb.TriggeredUpdateProgress - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *triggeredUpdateStatusPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st triggeredUpdateStatusPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func unassignRequestToPb(st *UnassignRequest) (*unassignRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &unassignRequestPb{} - pb.MetastoreId = st.MetastoreId - pb.WorkspaceId = st.WorkspaceId - - return pb, nil -} - -type unassignRequestPb struct { - MetastoreId string `json:"-" url:"metastore_id"` - WorkspaceId int64 `json:"-" url:"-"` -} - -func unassignRequestFromPb(pb *unassignRequestPb) (*UnassignRequest, error) { - if pb == nil { - return nil, nil - } - st := &UnassignRequest{} - st.MetastoreId = pb.MetastoreId - st.WorkspaceId = pb.WorkspaceId - - return st, nil -} - -func unassignResponseToPb(st *UnassignResponse) (*unassignResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &unassignResponsePb{} - - return pb, nil -} - -type unassignResponsePb struct { -} - -func unassignResponseFromPb(pb *unassignResponsePb) (*UnassignResponse, error) { - if pb == nil { - return nil, nil - } - st := &UnassignResponse{} - - return st, nil -} - -func updateAssignmentResponseToPb(st *UpdateAssignmentResponse) (*updateAssignmentResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &updateAssignmentResponsePb{} - - return pb, nil -} - -type updateAssignmentResponsePb struct { -} - -func updateAssignmentResponseFromPb(pb *updateAssignmentResponsePb) (*UpdateAssignmentResponse, error) { - if pb == nil { - return nil, nil - } - st := &UpdateAssignmentResponse{} - - return st, nil -} - -func updateCatalogToPb(st *UpdateCatalog) (*updateCatalogPb, error) { - if st == nil { - return nil, nil - } - pb := &updateCatalogPb{} - pb.Comment = st.Comment - pb.EnablePredictiveOptimization = st.EnablePredictiveOptimization - pb.IsolationMode = st.IsolationMode - pb.Name = st.Name - pb.NewName = st.NewName - pb.Options = st.Options - pb.Owner = st.Owner - pb.Properties = st.Properties - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type updateCatalogPb struct { - Comment string `json:"comment,omitempty"` - EnablePredictiveOptimization EnablePredictiveOptimization `json:"enable_predictive_optimization,omitempty"` - IsolationMode CatalogIsolationMode `json:"isolation_mode,omitempty"` - Name string `json:"-" url:"-"` - NewName string `json:"new_name,omitempty"` - Options map[string]string `json:"options,omitempty"` - Owner string `json:"owner,omitempty"` - Properties map[string]string `json:"properties,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func updateCatalogFromPb(pb *updateCatalogPb) (*UpdateCatalog, error) { - if pb == nil { - return nil, nil - } - st := &UpdateCatalog{} - st.Comment = pb.Comment - st.EnablePredictiveOptimization = pb.EnablePredictiveOptimization - st.IsolationMode = pb.IsolationMode - st.Name = pb.Name - st.NewName = pb.NewName - st.Options = pb.Options - st.Owner = pb.Owner - st.Properties = pb.Properties - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *updateCatalogPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st updateCatalogPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func updateCatalogWorkspaceBindingsResponseToPb(st *UpdateCatalogWorkspaceBindingsResponse) (*updateCatalogWorkspaceBindingsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &updateCatalogWorkspaceBindingsResponsePb{} - pb.Workspaces = st.Workspaces - - return pb, nil -} - -type updateCatalogWorkspaceBindingsResponsePb struct { - Workspaces []int64 `json:"workspaces,omitempty"` -} - -func updateCatalogWorkspaceBindingsResponseFromPb(pb *updateCatalogWorkspaceBindingsResponsePb) (*UpdateCatalogWorkspaceBindingsResponse, error) { - if pb == nil { - return nil, nil - } - st := &UpdateCatalogWorkspaceBindingsResponse{} - st.Workspaces = pb.Workspaces - - return st, nil -} - -func updateConnectionToPb(st *UpdateConnection) (*updateConnectionPb, error) { - if st == nil { - return nil, nil - } - pb := &updateConnectionPb{} - pb.Name = st.Name - pb.NewName = st.NewName - pb.Options = st.Options - pb.Owner = st.Owner - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type updateConnectionPb struct { - Name string `json:"-" url:"-"` - NewName string `json:"new_name,omitempty"` - Options map[string]string `json:"options"` - Owner string `json:"owner,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func updateConnectionFromPb(pb *updateConnectionPb) (*UpdateConnection, error) { - if pb == nil { - return nil, nil - } - st := &UpdateConnection{} - st.Name = pb.Name - st.NewName = pb.NewName - st.Options = pb.Options - st.Owner = pb.Owner - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *updateConnectionPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st updateConnectionPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func updateCredentialRequestToPb(st *UpdateCredentialRequest) (*updateCredentialRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &updateCredentialRequestPb{} - pb.AwsIamRole = st.AwsIamRole - pb.AzureManagedIdentity = st.AzureManagedIdentity - pb.AzureServicePrincipal = st.AzureServicePrincipal - pb.Comment = st.Comment - pb.DatabricksGcpServiceAccount = st.DatabricksGcpServiceAccount - pb.Force = st.Force - pb.IsolationMode = st.IsolationMode - pb.NameArg = st.NameArg - pb.NewName = st.NewName - pb.Owner = st.Owner - pb.ReadOnly = st.ReadOnly - pb.SkipValidation = st.SkipValidation - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type updateCredentialRequestPb struct { - AwsIamRole *AwsIamRole `json:"aws_iam_role,omitempty"` - AzureManagedIdentity *AzureManagedIdentity `json:"azure_managed_identity,omitempty"` - AzureServicePrincipal *AzureServicePrincipal `json:"azure_service_principal,omitempty"` - Comment string `json:"comment,omitempty"` - DatabricksGcpServiceAccount *DatabricksGcpServiceAccount `json:"databricks_gcp_service_account,omitempty"` - Force bool `json:"force,omitempty"` - IsolationMode IsolationMode `json:"isolation_mode,omitempty"` - NameArg string `json:"-" url:"-"` - NewName string `json:"new_name,omitempty"` - Owner string `json:"owner,omitempty"` - ReadOnly bool `json:"read_only,omitempty"` - SkipValidation bool `json:"skip_validation,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func updateCredentialRequestFromPb(pb *updateCredentialRequestPb) (*UpdateCredentialRequest, error) { - if pb == nil { - return nil, nil - } - st := &UpdateCredentialRequest{} - st.AwsIamRole = pb.AwsIamRole - st.AzureManagedIdentity = pb.AzureManagedIdentity - st.AzureServicePrincipal = pb.AzureServicePrincipal - st.Comment = pb.Comment - st.DatabricksGcpServiceAccount = pb.DatabricksGcpServiceAccount - st.Force = pb.Force - st.IsolationMode = pb.IsolationMode - st.NameArg = pb.NameArg - st.NewName = pb.NewName - st.Owner = pb.Owner - st.ReadOnly = pb.ReadOnly - st.SkipValidation = pb.SkipValidation - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *updateCredentialRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st updateCredentialRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func updateExternalLocationToPb(st *UpdateExternalLocation) (*updateExternalLocationPb, error) { - if st == nil { - return nil, nil - } - pb := &updateExternalLocationPb{} - pb.Comment = st.Comment - pb.CredentialName = st.CredentialName - pb.EnableFileEvents = st.EnableFileEvents - pb.EncryptionDetails = st.EncryptionDetails - pb.Fallback = st.Fallback - pb.FileEventQueue = st.FileEventQueue - pb.Force = st.Force - pb.IsolationMode = st.IsolationMode - pb.Name = st.Name - pb.NewName = st.NewName - pb.Owner = st.Owner - pb.ReadOnly = st.ReadOnly - pb.SkipValidation = st.SkipValidation - pb.Url = st.Url - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type updateExternalLocationPb struct { - Comment string `json:"comment,omitempty"` - CredentialName string `json:"credential_name,omitempty"` - EnableFileEvents bool `json:"enable_file_events,omitempty"` - EncryptionDetails *EncryptionDetails `json:"encryption_details,omitempty"` - Fallback bool `json:"fallback,omitempty"` - FileEventQueue *FileEventQueue `json:"file_event_queue,omitempty"` - Force bool `json:"force,omitempty"` - IsolationMode IsolationMode `json:"isolation_mode,omitempty"` - Name string `json:"-" url:"-"` - NewName string `json:"new_name,omitempty"` - Owner string `json:"owner,omitempty"` - ReadOnly bool `json:"read_only,omitempty"` - SkipValidation bool `json:"skip_validation,omitempty"` - Url string `json:"url,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func updateExternalLocationFromPb(pb *updateExternalLocationPb) (*UpdateExternalLocation, error) { - if pb == nil { - return nil, nil - } - st := &UpdateExternalLocation{} - st.Comment = pb.Comment - st.CredentialName = pb.CredentialName - st.EnableFileEvents = pb.EnableFileEvents - st.EncryptionDetails = pb.EncryptionDetails - st.Fallback = pb.Fallback - st.FileEventQueue = pb.FileEventQueue - st.Force = pb.Force - st.IsolationMode = pb.IsolationMode - st.Name = pb.Name - st.NewName = pb.NewName - st.Owner = pb.Owner - st.ReadOnly = pb.ReadOnly - st.SkipValidation = pb.SkipValidation - st.Url = pb.Url - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *updateExternalLocationPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st updateExternalLocationPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func updateFunctionToPb(st *UpdateFunction) (*updateFunctionPb, error) { - if st == nil { - return nil, nil - } - pb := &updateFunctionPb{} - pb.Name = st.Name - pb.Owner = st.Owner - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type updateFunctionPb struct { - Name string `json:"-" url:"-"` - Owner string `json:"owner,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func updateFunctionFromPb(pb *updateFunctionPb) (*UpdateFunction, error) { - if pb == nil { - return nil, nil - } - st := &UpdateFunction{} - st.Name = pb.Name - st.Owner = pb.Owner - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *updateFunctionPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st updateFunctionPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func updateMetastoreToPb(st *UpdateMetastore) (*updateMetastorePb, error) { - if st == nil { - return nil, nil - } - pb := &updateMetastorePb{} - pb.DeltaSharingOrganizationName = st.DeltaSharingOrganizationName - pb.DeltaSharingRecipientTokenLifetimeInSeconds = st.DeltaSharingRecipientTokenLifetimeInSeconds - pb.DeltaSharingScope = st.DeltaSharingScope - pb.Id = st.Id - pb.NewName = st.NewName - pb.Owner = st.Owner - pb.PrivilegeModelVersion = st.PrivilegeModelVersion - pb.StorageRootCredentialId = st.StorageRootCredentialId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type updateMetastorePb struct { - DeltaSharingOrganizationName string `json:"delta_sharing_organization_name,omitempty"` - DeltaSharingRecipientTokenLifetimeInSeconds int64 `json:"delta_sharing_recipient_token_lifetime_in_seconds,omitempty"` - DeltaSharingScope DeltaSharingScopeEnum `json:"delta_sharing_scope,omitempty"` - Id string `json:"-" url:"-"` - NewName string `json:"new_name,omitempty"` - Owner string `json:"owner,omitempty"` - PrivilegeModelVersion string `json:"privilege_model_version,omitempty"` - StorageRootCredentialId string `json:"storage_root_credential_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func updateMetastoreFromPb(pb *updateMetastorePb) (*UpdateMetastore, error) { - if pb == nil { - return nil, nil - } - st := &UpdateMetastore{} - st.DeltaSharingOrganizationName = pb.DeltaSharingOrganizationName - st.DeltaSharingRecipientTokenLifetimeInSeconds = pb.DeltaSharingRecipientTokenLifetimeInSeconds - st.DeltaSharingScope = pb.DeltaSharingScope - st.Id = pb.Id - st.NewName = pb.NewName - st.Owner = pb.Owner - st.PrivilegeModelVersion = pb.PrivilegeModelVersion - st.StorageRootCredentialId = pb.StorageRootCredentialId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *updateMetastorePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st updateMetastorePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func updateMetastoreAssignmentToPb(st *UpdateMetastoreAssignment) (*updateMetastoreAssignmentPb, error) { - if st == nil { - return nil, nil - } - pb := &updateMetastoreAssignmentPb{} - pb.DefaultCatalogName = st.DefaultCatalogName - pb.MetastoreId = st.MetastoreId - pb.WorkspaceId = st.WorkspaceId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type updateMetastoreAssignmentPb struct { - DefaultCatalogName string `json:"default_catalog_name,omitempty"` - MetastoreId string `json:"metastore_id,omitempty"` - WorkspaceId int64 `json:"-" url:"-"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func updateMetastoreAssignmentFromPb(pb *updateMetastoreAssignmentPb) (*UpdateMetastoreAssignment, error) { - if pb == nil { - return nil, nil - } - st := &UpdateMetastoreAssignment{} - st.DefaultCatalogName = pb.DefaultCatalogName - st.MetastoreId = pb.MetastoreId - st.WorkspaceId = pb.WorkspaceId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *updateMetastoreAssignmentPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st updateMetastoreAssignmentPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func updateModelVersionRequestToPb(st *UpdateModelVersionRequest) (*updateModelVersionRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &updateModelVersionRequestPb{} - pb.Comment = st.Comment - pb.FullName = st.FullName - pb.Version = st.Version - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type updateModelVersionRequestPb struct { - Comment string `json:"comment,omitempty"` - FullName string `json:"-" url:"-"` - Version int `json:"-" url:"-"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func updateModelVersionRequestFromPb(pb *updateModelVersionRequestPb) (*UpdateModelVersionRequest, error) { - if pb == nil { - return nil, nil - } - st := &UpdateModelVersionRequest{} - st.Comment = pb.Comment - st.FullName = pb.FullName - st.Version = pb.Version - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *updateModelVersionRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st updateModelVersionRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func updateMonitorToPb(st *UpdateMonitor) (*updateMonitorPb, error) { - if st == nil { - return nil, nil - } - pb := &updateMonitorPb{} - pb.BaselineTableName = st.BaselineTableName - pb.CustomMetrics = st.CustomMetrics - pb.DashboardId = st.DashboardId - pb.DataClassificationConfig = st.DataClassificationConfig - pb.InferenceLog = st.InferenceLog - pb.Notifications = st.Notifications - pb.OutputSchemaName = st.OutputSchemaName - pb.Schedule = st.Schedule - pb.SlicingExprs = st.SlicingExprs - pb.Snapshot = st.Snapshot - pb.TableName = st.TableName - pb.TimeSeries = st.TimeSeries - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type updateMonitorPb struct { - BaselineTableName string `json:"baseline_table_name,omitempty"` - CustomMetrics []MonitorMetric `json:"custom_metrics,omitempty"` - DashboardId string `json:"dashboard_id,omitempty"` - DataClassificationConfig *MonitorDataClassificationConfig `json:"data_classification_config,omitempty"` - InferenceLog *MonitorInferenceLog `json:"inference_log,omitempty"` - Notifications *MonitorNotifications `json:"notifications,omitempty"` - OutputSchemaName string `json:"output_schema_name"` - Schedule *MonitorCronSchedule `json:"schedule,omitempty"` - SlicingExprs []string `json:"slicing_exprs,omitempty"` - Snapshot *MonitorSnapshot `json:"snapshot,omitempty"` - TableName string `json:"-" url:"-"` - TimeSeries *MonitorTimeSeries `json:"time_series,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func updateMonitorFromPb(pb *updateMonitorPb) (*UpdateMonitor, error) { - if pb == nil { - return nil, nil - } - st := &UpdateMonitor{} - st.BaselineTableName = pb.BaselineTableName - st.CustomMetrics = pb.CustomMetrics - st.DashboardId = pb.DashboardId - st.DataClassificationConfig = pb.DataClassificationConfig - st.InferenceLog = pb.InferenceLog - st.Notifications = pb.Notifications - st.OutputSchemaName = pb.OutputSchemaName - st.Schedule = pb.Schedule - st.SlicingExprs = pb.SlicingExprs - st.Snapshot = pb.Snapshot - st.TableName = pb.TableName - st.TimeSeries = pb.TimeSeries - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *updateMonitorPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st updateMonitorPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func updatePermissionsToPb(st *UpdatePermissions) (*updatePermissionsPb, error) { - if st == nil { - return nil, nil - } - pb := &updatePermissionsPb{} - pb.Changes = st.Changes - pb.FullName = st.FullName - pb.SecurableType = st.SecurableType - - return pb, nil -} - -type updatePermissionsPb struct { - Changes []PermissionsChange `json:"changes,omitempty"` - FullName string `json:"-" url:"-"` - SecurableType string `json:"-" url:"-"` -} - -func updatePermissionsFromPb(pb *updatePermissionsPb) (*UpdatePermissions, error) { - if pb == nil { - return nil, nil - } - st := &UpdatePermissions{} - st.Changes = pb.Changes - st.FullName = pb.FullName - st.SecurableType = pb.SecurableType - - return st, nil -} - -func updatePermissionsResponseToPb(st *UpdatePermissionsResponse) (*updatePermissionsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &updatePermissionsResponsePb{} - pb.PrivilegeAssignments = st.PrivilegeAssignments - - return pb, nil -} - -type updatePermissionsResponsePb struct { - PrivilegeAssignments []PrivilegeAssignment `json:"privilege_assignments,omitempty"` -} - -func updatePermissionsResponseFromPb(pb *updatePermissionsResponsePb) (*UpdatePermissionsResponse, error) { - if pb == nil { - return nil, nil - } - st := &UpdatePermissionsResponse{} - st.PrivilegeAssignments = pb.PrivilegeAssignments - - return st, nil -} - -func updateRegisteredModelRequestToPb(st *UpdateRegisteredModelRequest) (*updateRegisteredModelRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &updateRegisteredModelRequestPb{} - pb.Comment = st.Comment - pb.FullName = st.FullName - pb.NewName = st.NewName - pb.Owner = st.Owner - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type updateRegisteredModelRequestPb struct { - Comment string `json:"comment,omitempty"` - FullName string `json:"-" url:"-"` - NewName string `json:"new_name,omitempty"` - Owner string `json:"owner,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func updateRegisteredModelRequestFromPb(pb *updateRegisteredModelRequestPb) (*UpdateRegisteredModelRequest, error) { - if pb == nil { - return nil, nil - } - st := &UpdateRegisteredModelRequest{} - st.Comment = pb.Comment - st.FullName = pb.FullName - st.NewName = pb.NewName - st.Owner = pb.Owner - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *updateRegisteredModelRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st updateRegisteredModelRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func updateResponseToPb(st *UpdateResponse) (*updateResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &updateResponsePb{} - - return pb, nil -} - -type updateResponsePb struct { -} - -func updateResponseFromPb(pb *updateResponsePb) (*UpdateResponse, error) { - if pb == nil { - return nil, nil - } - st := &UpdateResponse{} - - return st, nil -} - -func updateSchemaToPb(st *UpdateSchema) (*updateSchemaPb, error) { - if st == nil { - return nil, nil - } - pb := &updateSchemaPb{} - pb.Comment = st.Comment - pb.EnablePredictiveOptimization = st.EnablePredictiveOptimization - pb.FullName = st.FullName - pb.NewName = st.NewName - pb.Owner = st.Owner - pb.Properties = st.Properties - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type updateSchemaPb struct { - Comment string `json:"comment,omitempty"` - EnablePredictiveOptimization EnablePredictiveOptimization `json:"enable_predictive_optimization,omitempty"` - FullName string `json:"-" url:"-"` - NewName string `json:"new_name,omitempty"` - Owner string `json:"owner,omitempty"` - Properties map[string]string `json:"properties,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func updateSchemaFromPb(pb *updateSchemaPb) (*UpdateSchema, error) { - if pb == nil { - return nil, nil - } - st := &UpdateSchema{} - st.Comment = pb.Comment - st.EnablePredictiveOptimization = pb.EnablePredictiveOptimization - st.FullName = pb.FullName - st.NewName = pb.NewName - st.Owner = pb.Owner - st.Properties = pb.Properties - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *updateSchemaPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st updateSchemaPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func updateStorageCredentialToPb(st *UpdateStorageCredential) (*updateStorageCredentialPb, error) { - if st == nil { - return nil, nil - } - pb := &updateStorageCredentialPb{} - pb.AwsIamRole = st.AwsIamRole - pb.AzureManagedIdentity = st.AzureManagedIdentity - pb.AzureServicePrincipal = st.AzureServicePrincipal - pb.CloudflareApiToken = st.CloudflareApiToken - pb.Comment = st.Comment - pb.DatabricksGcpServiceAccount = st.DatabricksGcpServiceAccount - pb.Force = st.Force - pb.IsolationMode = st.IsolationMode - pb.Name = st.Name - pb.NewName = st.NewName - pb.Owner = st.Owner - pb.ReadOnly = st.ReadOnly - pb.SkipValidation = st.SkipValidation - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type updateStorageCredentialPb struct { - AwsIamRole *AwsIamRoleRequest `json:"aws_iam_role,omitempty"` - AzureManagedIdentity *AzureManagedIdentityResponse `json:"azure_managed_identity,omitempty"` - AzureServicePrincipal *AzureServicePrincipal `json:"azure_service_principal,omitempty"` - CloudflareApiToken *CloudflareApiToken `json:"cloudflare_api_token,omitempty"` - Comment string `json:"comment,omitempty"` - DatabricksGcpServiceAccount *DatabricksGcpServiceAccountRequest `json:"databricks_gcp_service_account,omitempty"` - Force bool `json:"force,omitempty"` - IsolationMode IsolationMode `json:"isolation_mode,omitempty"` - Name string `json:"-" url:"-"` - NewName string `json:"new_name,omitempty"` - Owner string `json:"owner,omitempty"` - ReadOnly bool `json:"read_only,omitempty"` - SkipValidation bool `json:"skip_validation,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func updateStorageCredentialFromPb(pb *updateStorageCredentialPb) (*UpdateStorageCredential, error) { - if pb == nil { - return nil, nil - } - st := &UpdateStorageCredential{} - st.AwsIamRole = pb.AwsIamRole - st.AzureManagedIdentity = pb.AzureManagedIdentity - st.AzureServicePrincipal = pb.AzureServicePrincipal - st.CloudflareApiToken = pb.CloudflareApiToken - st.Comment = pb.Comment - st.DatabricksGcpServiceAccount = pb.DatabricksGcpServiceAccount - st.Force = pb.Force - st.IsolationMode = pb.IsolationMode - st.Name = pb.Name - st.NewName = pb.NewName - st.Owner = pb.Owner - st.ReadOnly = pb.ReadOnly - st.SkipValidation = pb.SkipValidation - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *updateStorageCredentialPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st updateStorageCredentialPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func updateTableRequestToPb(st *UpdateTableRequest) (*updateTableRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &updateTableRequestPb{} - pb.FullName = st.FullName - pb.Owner = st.Owner - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type updateTableRequestPb struct { - FullName string `json:"-" url:"-"` - Owner string `json:"owner,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func updateTableRequestFromPb(pb *updateTableRequestPb) (*UpdateTableRequest, error) { - if pb == nil { - return nil, nil - } - st := &UpdateTableRequest{} - st.FullName = pb.FullName - st.Owner = pb.Owner - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *updateTableRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st updateTableRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func updateVolumeRequestContentToPb(st *UpdateVolumeRequestContent) (*updateVolumeRequestContentPb, error) { - if st == nil { - return nil, nil - } - pb := &updateVolumeRequestContentPb{} - pb.Comment = st.Comment - pb.Name = st.Name - pb.NewName = st.NewName - pb.Owner = st.Owner - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type updateVolumeRequestContentPb struct { - Comment string `json:"comment,omitempty"` - Name string `json:"-" url:"-"` - NewName string `json:"new_name,omitempty"` - Owner string `json:"owner,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func updateVolumeRequestContentFromPb(pb *updateVolumeRequestContentPb) (*UpdateVolumeRequestContent, error) { - if pb == nil { - return nil, nil - } - st := &UpdateVolumeRequestContent{} - st.Comment = pb.Comment - st.Name = pb.Name - st.NewName = pb.NewName - st.Owner = pb.Owner - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *updateVolumeRequestContentPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st updateVolumeRequestContentPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func updateWorkspaceBindingsToPb(st *UpdateWorkspaceBindings) (*updateWorkspaceBindingsPb, error) { - if st == nil { - return nil, nil - } - pb := &updateWorkspaceBindingsPb{} - pb.AssignWorkspaces = st.AssignWorkspaces - pb.Name = st.Name - pb.UnassignWorkspaces = st.UnassignWorkspaces - - return pb, nil -} - -type updateWorkspaceBindingsPb struct { - AssignWorkspaces []int64 `json:"assign_workspaces,omitempty"` - Name string `json:"-" url:"-"` - UnassignWorkspaces []int64 `json:"unassign_workspaces,omitempty"` -} - -func updateWorkspaceBindingsFromPb(pb *updateWorkspaceBindingsPb) (*UpdateWorkspaceBindings, error) { - if pb == nil { - return nil, nil - } - st := &UpdateWorkspaceBindings{} - st.AssignWorkspaces = pb.AssignWorkspaces - st.Name = pb.Name - st.UnassignWorkspaces = pb.UnassignWorkspaces - - return st, nil -} - -func updateWorkspaceBindingsParametersToPb(st *UpdateWorkspaceBindingsParameters) (*updateWorkspaceBindingsParametersPb, error) { - if st == nil { - return nil, nil - } - pb := &updateWorkspaceBindingsParametersPb{} - pb.Add = st.Add - pb.Remove = st.Remove - pb.SecurableName = st.SecurableName - pb.SecurableType = st.SecurableType - - return pb, nil -} - -type updateWorkspaceBindingsParametersPb struct { - Add []WorkspaceBinding `json:"add,omitempty"` - Remove []WorkspaceBinding `json:"remove,omitempty"` - SecurableName string `json:"-" url:"-"` - SecurableType string `json:"-" url:"-"` -} - -func updateWorkspaceBindingsParametersFromPb(pb *updateWorkspaceBindingsParametersPb) (*UpdateWorkspaceBindingsParameters, error) { - if pb == nil { - return nil, nil - } - st := &UpdateWorkspaceBindingsParameters{} - st.Add = pb.Add - st.Remove = pb.Remove - st.SecurableName = pb.SecurableName - st.SecurableType = pb.SecurableType - - return st, nil -} - -func updateWorkspaceBindingsResponseToPb(st *UpdateWorkspaceBindingsResponse) (*updateWorkspaceBindingsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &updateWorkspaceBindingsResponsePb{} - pb.Bindings = st.Bindings - - return pb, nil -} - -type updateWorkspaceBindingsResponsePb struct { - Bindings []WorkspaceBinding `json:"bindings,omitempty"` -} - -func updateWorkspaceBindingsResponseFromPb(pb *updateWorkspaceBindingsResponsePb) (*UpdateWorkspaceBindingsResponse, error) { - if pb == nil { - return nil, nil - } - st := &UpdateWorkspaceBindingsResponse{} - st.Bindings = pb.Bindings - - return st, nil -} - -func validateCredentialRequestToPb(st *ValidateCredentialRequest) (*validateCredentialRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &validateCredentialRequestPb{} - pb.AwsIamRole = st.AwsIamRole - pb.AzureManagedIdentity = st.AzureManagedIdentity - pb.CredentialName = st.CredentialName - pb.DatabricksGcpServiceAccount = st.DatabricksGcpServiceAccount - pb.ExternalLocationName = st.ExternalLocationName - pb.Purpose = st.Purpose - pb.ReadOnly = st.ReadOnly - pb.Url = st.Url - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type validateCredentialRequestPb struct { - AwsIamRole *AwsIamRole `json:"aws_iam_role,omitempty"` - AzureManagedIdentity *AzureManagedIdentity `json:"azure_managed_identity,omitempty"` - CredentialName string `json:"credential_name,omitempty"` - DatabricksGcpServiceAccount *DatabricksGcpServiceAccount `json:"databricks_gcp_service_account,omitempty"` - ExternalLocationName string `json:"external_location_name,omitempty"` - Purpose CredentialPurpose `json:"purpose,omitempty"` - ReadOnly bool `json:"read_only,omitempty"` - Url string `json:"url,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func validateCredentialRequestFromPb(pb *validateCredentialRequestPb) (*ValidateCredentialRequest, error) { - if pb == nil { - return nil, nil - } - st := &ValidateCredentialRequest{} - st.AwsIamRole = pb.AwsIamRole - st.AzureManagedIdentity = pb.AzureManagedIdentity - st.CredentialName = pb.CredentialName - st.DatabricksGcpServiceAccount = pb.DatabricksGcpServiceAccount - st.ExternalLocationName = pb.ExternalLocationName - st.Purpose = pb.Purpose - st.ReadOnly = pb.ReadOnly - st.Url = pb.Url - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *validateCredentialRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st validateCredentialRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func validateCredentialResponseToPb(st *ValidateCredentialResponse) (*validateCredentialResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &validateCredentialResponsePb{} - pb.IsDir = st.IsDir - pb.Results = st.Results - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type validateCredentialResponsePb struct { - IsDir bool `json:"isDir,omitempty"` - Results []CredentialValidationResult `json:"results,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func validateCredentialResponseFromPb(pb *validateCredentialResponsePb) (*ValidateCredentialResponse, error) { - if pb == nil { - return nil, nil - } - st := &ValidateCredentialResponse{} - st.IsDir = pb.IsDir - st.Results = pb.Results - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *validateCredentialResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st validateCredentialResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func validateStorageCredentialToPb(st *ValidateStorageCredential) (*validateStorageCredentialPb, error) { - if st == nil { - return nil, nil - } - pb := &validateStorageCredentialPb{} - pb.AwsIamRole = st.AwsIamRole - pb.AzureManagedIdentity = st.AzureManagedIdentity - pb.AzureServicePrincipal = st.AzureServicePrincipal - pb.CloudflareApiToken = st.CloudflareApiToken - pb.DatabricksGcpServiceAccount = st.DatabricksGcpServiceAccount - pb.ExternalLocationName = st.ExternalLocationName - pb.ReadOnly = st.ReadOnly - pb.StorageCredentialName = st.StorageCredentialName - pb.Url = st.Url - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type validateStorageCredentialPb struct { - AwsIamRole *AwsIamRoleRequest `json:"aws_iam_role,omitempty"` - AzureManagedIdentity *AzureManagedIdentityRequest `json:"azure_managed_identity,omitempty"` - AzureServicePrincipal *AzureServicePrincipal `json:"azure_service_principal,omitempty"` - CloudflareApiToken *CloudflareApiToken `json:"cloudflare_api_token,omitempty"` - DatabricksGcpServiceAccount *DatabricksGcpServiceAccountRequest `json:"databricks_gcp_service_account,omitempty"` - ExternalLocationName string `json:"external_location_name,omitempty"` - ReadOnly bool `json:"read_only,omitempty"` - StorageCredentialName string `json:"storage_credential_name,omitempty"` - Url string `json:"url,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func validateStorageCredentialFromPb(pb *validateStorageCredentialPb) (*ValidateStorageCredential, error) { - if pb == nil { - return nil, nil - } - st := &ValidateStorageCredential{} - st.AwsIamRole = pb.AwsIamRole - st.AzureManagedIdentity = pb.AzureManagedIdentity - st.AzureServicePrincipal = pb.AzureServicePrincipal - st.CloudflareApiToken = pb.CloudflareApiToken - st.DatabricksGcpServiceAccount = pb.DatabricksGcpServiceAccount - st.ExternalLocationName = pb.ExternalLocationName - st.ReadOnly = pb.ReadOnly - st.StorageCredentialName = pb.StorageCredentialName - st.Url = pb.Url - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *validateStorageCredentialPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st validateStorageCredentialPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func validateStorageCredentialResponseToPb(st *ValidateStorageCredentialResponse) (*validateStorageCredentialResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &validateStorageCredentialResponsePb{} - pb.IsDir = st.IsDir - pb.Results = st.Results - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type validateStorageCredentialResponsePb struct { - IsDir bool `json:"isDir,omitempty"` - Results []ValidationResult `json:"results,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func validateStorageCredentialResponseFromPb(pb *validateStorageCredentialResponsePb) (*ValidateStorageCredentialResponse, error) { - if pb == nil { - return nil, nil - } - st := &ValidateStorageCredentialResponse{} - st.IsDir = pb.IsDir - st.Results = pb.Results - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *validateStorageCredentialResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st validateStorageCredentialResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func validationResultToPb(st *ValidationResult) (*validationResultPb, error) { - if st == nil { - return nil, nil - } - pb := &validationResultPb{} - pb.Message = st.Message - pb.Operation = st.Operation - pb.Result = st.Result - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type validationResultPb struct { - Message string `json:"message,omitempty"` - Operation ValidationResultOperation `json:"operation,omitempty"` - Result ValidationResultResult `json:"result,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func validationResultFromPb(pb *validationResultPb) (*ValidationResult, error) { - if pb == nil { - return nil, nil - } - st := &ValidationResult{} - st.Message = pb.Message - st.Operation = pb.Operation - st.Result = pb.Result - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *validationResultPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st validationResultPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func volumeInfoToPb(st *VolumeInfo) (*volumeInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &volumeInfoPb{} - pb.AccessPoint = st.AccessPoint - pb.BrowseOnly = st.BrowseOnly - pb.CatalogName = st.CatalogName - pb.Comment = st.Comment - pb.CreatedAt = st.CreatedAt - pb.CreatedBy = st.CreatedBy - pb.EncryptionDetails = st.EncryptionDetails - pb.FullName = st.FullName - pb.MetastoreId = st.MetastoreId - pb.Name = st.Name - pb.Owner = st.Owner - pb.SchemaName = st.SchemaName - pb.StorageLocation = st.StorageLocation - pb.UpdatedAt = st.UpdatedAt - pb.UpdatedBy = st.UpdatedBy - pb.VolumeId = st.VolumeId - pb.VolumeType = st.VolumeType - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type volumeInfoPb struct { - AccessPoint string `json:"access_point,omitempty"` - BrowseOnly bool `json:"browse_only,omitempty"` - CatalogName string `json:"catalog_name,omitempty"` - Comment string `json:"comment,omitempty"` - CreatedAt int64 `json:"created_at,omitempty"` - CreatedBy string `json:"created_by,omitempty"` - EncryptionDetails *EncryptionDetails `json:"encryption_details,omitempty"` - FullName string `json:"full_name,omitempty"` - MetastoreId string `json:"metastore_id,omitempty"` - Name string `json:"name,omitempty"` - Owner string `json:"owner,omitempty"` - SchemaName string `json:"schema_name,omitempty"` - StorageLocation string `json:"storage_location,omitempty"` - UpdatedAt int64 `json:"updated_at,omitempty"` - UpdatedBy string `json:"updated_by,omitempty"` - VolumeId string `json:"volume_id,omitempty"` - VolumeType VolumeType `json:"volume_type,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func volumeInfoFromPb(pb *volumeInfoPb) (*VolumeInfo, error) { - if pb == nil { - return nil, nil - } - st := &VolumeInfo{} - st.AccessPoint = pb.AccessPoint - st.BrowseOnly = pb.BrowseOnly - st.CatalogName = pb.CatalogName - st.Comment = pb.Comment - st.CreatedAt = pb.CreatedAt - st.CreatedBy = pb.CreatedBy - st.EncryptionDetails = pb.EncryptionDetails - st.FullName = pb.FullName - st.MetastoreId = pb.MetastoreId - st.Name = pb.Name - st.Owner = pb.Owner - st.SchemaName = pb.SchemaName - st.StorageLocation = pb.StorageLocation - st.UpdatedAt = pb.UpdatedAt - st.UpdatedBy = pb.UpdatedBy - st.VolumeId = pb.VolumeId - st.VolumeType = pb.VolumeType - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *volumeInfoPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st volumeInfoPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func workspaceBindingToPb(st *WorkspaceBinding) (*workspaceBindingPb, error) { - if st == nil { - return nil, nil - } - pb := &workspaceBindingPb{} - pb.BindingType = st.BindingType - pb.WorkspaceId = st.WorkspaceId - - return pb, nil -} - -type workspaceBindingPb struct { - BindingType WorkspaceBindingBindingType `json:"binding_type,omitempty"` - WorkspaceId int64 `json:"workspace_id"` -} - -func workspaceBindingFromPb(pb *workspaceBindingPb) (*WorkspaceBinding, error) { - if pb == nil { - return nil, nil - } - st := &WorkspaceBinding{} - st.BindingType = pb.BindingType - st.WorkspaceId = pb.WorkspaceId - - return st, nil -} - -func durationToPb(d *time.Duration) (*string, error) { - if d == nil { - return nil, nil - } - s := fmt.Sprintf("%.9fs", d.Seconds()) - return &s, nil -} - -func durationFromPb(s *string) (*time.Duration, error) { - if s == nil { - return nil, nil - } - d, err := time.ParseDuration(*s) - if err != nil { - return nil, err - } - return &d, nil -} - -func timestampToPb(t *time.Time) (*string, error) { - if t == nil { - return nil, nil - } - s := t.Format(time.RFC3339) - return &s, nil -} - -func timestampFromPb(s *string) (*time.Time, error) { - if s == nil { - return nil, nil - } - t, err := time.Parse(time.RFC3339, *s) - if err != nil { - return nil, err - } - return &t, nil -} - -func fieldMaskToPb(fm *[]string) (*string, error) { - if fm == nil { - return nil, nil - } - s := strings.Join(*fm, ",") - return &s, nil -} - -func fieldMaskFromPb(s *string) (*[]string, error) { - if s == nil { - return nil, nil - } - fm := strings.Split(*s, ",") - return &fm, nil -} diff --git a/service/catalog/model.go b/service/catalog/model.go index cd14038b8..e80afe7d3 100755 --- a/service/catalog/model.go +++ b/service/catalog/model.go @@ -3,381 +3,92 @@ package catalog import ( - "encoding/json" "fmt" + + "github.com/databricks/databricks-sdk-go/marshal" ) type AccountsCreateMetastore struct { - - // Wire name: 'metastore_info' MetastoreInfo *CreateMetastore `json:"metastore_info,omitempty"` } -func (st *AccountsCreateMetastore) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &accountsCreateMetastorePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := accountsCreateMetastoreFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st AccountsCreateMetastore) MarshalJSON() ([]byte, error) { - pb, err := accountsCreateMetastoreToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type AccountsCreateMetastoreAssignment struct { - - // Wire name: 'metastore_assignment' MetastoreAssignment *CreateMetastoreAssignment `json:"metastore_assignment,omitempty"` // Unity Catalog metastore ID - MetastoreId string `json:"-" tf:"-"` + MetastoreId string `json:"-" url:"-"` // Workspace ID. - WorkspaceId int64 `json:"-" tf:"-"` -} - -func (st *AccountsCreateMetastoreAssignment) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &accountsCreateMetastoreAssignmentPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := accountsCreateMetastoreAssignmentFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st AccountsCreateMetastoreAssignment) MarshalJSON() ([]byte, error) { - pb, err := accountsCreateMetastoreAssignmentToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + WorkspaceId int64 `json:"-" url:"-"` } type AccountsCreateStorageCredential struct { - - // Wire name: 'credential_info' CredentialInfo *CreateStorageCredential `json:"credential_info,omitempty"` // Unity Catalog metastore ID - MetastoreId string `json:"-" tf:"-"` -} - -func (st *AccountsCreateStorageCredential) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &accountsCreateStorageCredentialPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := accountsCreateStorageCredentialFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st AccountsCreateStorageCredential) MarshalJSON() ([]byte, error) { - pb, err := accountsCreateStorageCredentialToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + MetastoreId string `json:"-" url:"-"` } type AccountsMetastoreAssignment struct { - - // Wire name: 'metastore_assignment' MetastoreAssignment *MetastoreAssignment `json:"metastore_assignment,omitempty"` } -func (st *AccountsMetastoreAssignment) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &accountsMetastoreAssignmentPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := accountsMetastoreAssignmentFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st AccountsMetastoreAssignment) MarshalJSON() ([]byte, error) { - pb, err := accountsMetastoreAssignmentToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type AccountsMetastoreInfo struct { - - // Wire name: 'metastore_info' MetastoreInfo *MetastoreInfo `json:"metastore_info,omitempty"` } -func (st *AccountsMetastoreInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &accountsMetastoreInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := accountsMetastoreInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st AccountsMetastoreInfo) MarshalJSON() ([]byte, error) { - pb, err := accountsMetastoreInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type AccountsStorageCredentialInfo struct { - - // Wire name: 'credential_info' CredentialInfo *StorageCredentialInfo `json:"credential_info,omitempty"` } -func (st *AccountsStorageCredentialInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &accountsStorageCredentialInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := accountsStorageCredentialInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st AccountsStorageCredentialInfo) MarshalJSON() ([]byte, error) { - pb, err := accountsStorageCredentialInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type AccountsUpdateMetastore struct { // Unity Catalog metastore ID - MetastoreId string `json:"-" tf:"-"` + MetastoreId string `json:"-" url:"-"` - // Wire name: 'metastore_info' MetastoreInfo *UpdateMetastore `json:"metastore_info,omitempty"` } -func (st *AccountsUpdateMetastore) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &accountsUpdateMetastorePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := accountsUpdateMetastoreFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st AccountsUpdateMetastore) MarshalJSON() ([]byte, error) { - pb, err := accountsUpdateMetastoreToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type AccountsUpdateMetastoreAssignment struct { - - // Wire name: 'metastore_assignment' MetastoreAssignment *UpdateMetastoreAssignment `json:"metastore_assignment,omitempty"` // Unity Catalog metastore ID - MetastoreId string `json:"-" tf:"-"` + MetastoreId string `json:"-" url:"-"` // Workspace ID. - WorkspaceId int64 `json:"-" tf:"-"` -} - -func (st *AccountsUpdateMetastoreAssignment) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &accountsUpdateMetastoreAssignmentPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := accountsUpdateMetastoreAssignmentFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st AccountsUpdateMetastoreAssignment) MarshalJSON() ([]byte, error) { - pb, err := accountsUpdateMetastoreAssignmentToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + WorkspaceId int64 `json:"-" url:"-"` } type AccountsUpdateStorageCredential struct { - - // Wire name: 'credential_info' CredentialInfo *UpdateStorageCredential `json:"credential_info,omitempty"` // Unity Catalog metastore ID - MetastoreId string `json:"-" tf:"-"` + MetastoreId string `json:"-" url:"-"` // Name of the storage credential. - StorageCredentialName string `json:"-" tf:"-"` -} - -func (st *AccountsUpdateStorageCredential) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &accountsUpdateStorageCredentialPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := accountsUpdateStorageCredentialFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st AccountsUpdateStorageCredential) MarshalJSON() ([]byte, error) { - pb, err := accountsUpdateStorageCredentialToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + StorageCredentialName string `json:"-" url:"-"` } type ArtifactAllowlistInfo struct { // A list of allowed artifact match patterns. - // Wire name: 'artifact_matchers' ArtifactMatchers []ArtifactMatcher `json:"artifact_matchers,omitempty"` // Time at which this artifact allowlist was set, in epoch milliseconds. - // Wire name: 'created_at' CreatedAt int64 `json:"created_at,omitempty"` // Username of the user who set the artifact allowlist. - // Wire name: 'created_by' CreatedBy string `json:"created_by,omitempty"` // Unique identifier of parent metastore. - // Wire name: 'metastore_id' MetastoreId string `json:"metastore_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ArtifactAllowlistInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &artifactAllowlistInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := artifactAllowlistInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ArtifactAllowlistInfo) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ArtifactAllowlistInfo) MarshalJSON() ([]byte, error) { - pb, err := artifactAllowlistInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ArtifactAllowlistInfo) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ArtifactMatcher struct { // The artifact path or maven coordinate - // Wire name: 'artifact' Artifact string `json:"artifact"` // The pattern matching type of the artifact - // Wire name: 'match_type' MatchType MatchType `json:"match_type"` } -func (st *ArtifactMatcher) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &artifactMatcherPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := artifactMatcherFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ArtifactMatcher) MarshalJSON() ([]byte, error) { - pb, err := artifactMatcherToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // The artifact type type ArtifactType string @@ -422,233 +133,102 @@ func (f *ArtifactType) Type() string { type AssignResponse struct { } -func (st *AssignResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &assignResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := assignResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st AssignResponse) MarshalJSON() ([]byte, error) { - pb, err := assignResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // AWS temporary credentials for API authentication. Read more at // https://docs.aws.amazon.com/STS/latest/APIReference/API_Credentials.html. type AwsCredentials struct { // The access key ID that identifies the temporary credentials. - // Wire name: 'access_key_id' AccessKeyId string `json:"access_key_id,omitempty"` // The Amazon Resource Name (ARN) of the S3 access point for temporary // credentials related the external location. - // Wire name: 'access_point' AccessPoint string `json:"access_point,omitempty"` // The secret access key that can be used to sign AWS API requests. - // Wire name: 'secret_access_key' SecretAccessKey string `json:"secret_access_key,omitempty"` // The token that users must pass to AWS API to use the temporary // credentials. - // Wire name: 'session_token' SessionToken string `json:"session_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *AwsCredentials) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &awsCredentialsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := awsCredentialsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *AwsCredentials) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st AwsCredentials) MarshalJSON() ([]byte, error) { - pb, err := awsCredentialsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s AwsCredentials) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The AWS IAM role configuration type AwsIamRole struct { // The external ID used in role assumption to prevent the confused deputy // problem. - // Wire name: 'external_id' ExternalId string `json:"external_id,omitempty"` // The Amazon Resource Name (ARN) of the AWS IAM role used to vend temporary // credentials. - // Wire name: 'role_arn' RoleArn string `json:"role_arn,omitempty"` // The Amazon Resource Name (ARN) of the AWS IAM user managed by Databricks. // This is the identity that is going to assume the AWS IAM role. - // Wire name: 'unity_catalog_iam_arn' UnityCatalogIamArn string `json:"unity_catalog_iam_arn,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *AwsIamRole) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &awsIamRolePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := awsIamRoleFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *AwsIamRole) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st AwsIamRole) MarshalJSON() ([]byte, error) { - pb, err := awsIamRoleToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s AwsIamRole) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The AWS IAM role configuration type AwsIamRoleRequest struct { // The Amazon Resource Name (ARN) of the AWS IAM role used to vend temporary // credentials. - // Wire name: 'role_arn' RoleArn string `json:"role_arn"` } -func (st *AwsIamRoleRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &awsIamRoleRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := awsIamRoleRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st AwsIamRoleRequest) MarshalJSON() ([]byte, error) { - pb, err := awsIamRoleRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // The AWS IAM role configuration type AwsIamRoleResponse struct { // The external ID used in role assumption to prevent the confused deputy // problem. - // Wire name: 'external_id' ExternalId string `json:"external_id,omitempty"` // The Amazon Resource Name (ARN) of the AWS IAM role used to vend temporary // credentials. - // Wire name: 'role_arn' RoleArn string `json:"role_arn"` // The Amazon Resource Name (ARN) of the AWS IAM user managed by Databricks. // This is the identity that is going to assume the AWS IAM role. - // Wire name: 'unity_catalog_iam_arn' UnityCatalogIamArn string `json:"unity_catalog_iam_arn,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *AwsIamRoleResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &awsIamRoleResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := awsIamRoleResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *AwsIamRoleResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st AwsIamRoleResponse) MarshalJSON() ([]byte, error) { - pb, err := awsIamRoleResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s AwsIamRoleResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type AwsSqsQueue struct { // Unique identifier included in the name of file events managed cloud // resources. - // Wire name: 'managed_resource_id' ManagedResourceId string `json:"managed_resource_id,omitempty"` // The AQS queue url in the format // https://sqs.{region}.amazonaws.com/{account id}/{queue name} REQUIRED for // provided_sqs. - // Wire name: 'queue_url' QueueUrl string `json:"queue_url,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *AwsSqsQueue) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &awsSqsQueuePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := awsSqsQueueFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *AwsSqsQueue) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st AwsSqsQueue) MarshalJSON() ([]byte, error) { - pb, err := awsSqsQueueToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s AwsSqsQueue) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Azure Active Directory token, essentially the Oauth token for Azure Service @@ -657,35 +237,17 @@ func (st AwsSqsQueue) MarshalJSON() ([]byte, error) { type AzureActiveDirectoryToken struct { // Opaque token that contains claims that you can use in Azure Active // Directory to access cloud services. - // Wire name: 'aad_token' AadToken string `json:"aad_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *AzureActiveDirectoryToken) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &azureActiveDirectoryTokenPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := azureActiveDirectoryTokenFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *AzureActiveDirectoryToken) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st AzureActiveDirectoryToken) MarshalJSON() ([]byte, error) { - pb, err := azureActiveDirectoryTokenToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s AzureActiveDirectoryToken) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The Azure managed identity configuration. @@ -693,10 +255,8 @@ type AzureManagedIdentity struct { // The Azure resource ID of the Azure Databricks Access Connector. Use the // format // `/subscriptions/{guid}/resourceGroups/{rg-name}/providers/Microsoft.Databricks/accessConnectors/{connector-name}`. - // Wire name: 'access_connector_id' AccessConnectorId string `json:"access_connector_id"` // The Databricks internal ID that represents this managed identity. - // Wire name: 'credential_id' CredentialId string `json:"credential_id,omitempty"` // The Azure resource ID of the managed identity. Use the format, // `/subscriptions/{guid}/resourceGroups/{rg-name}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identity-name}` @@ -704,35 +264,17 @@ type AzureManagedIdentity struct { // identities, the access_connector_id is used to identify the identity. If // this field is not provided, then we assume the AzureManagedIdentity is // using the system-assigned identity. - // Wire name: 'managed_identity_id' ManagedIdentityId string `json:"managed_identity_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *AzureManagedIdentity) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &azureManagedIdentityPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := azureManagedIdentityFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *AzureManagedIdentity) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st AzureManagedIdentity) MarshalJSON() ([]byte, error) { - pb, err := azureManagedIdentityToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s AzureManagedIdentity) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The Azure managed identity configuration. @@ -740,7 +282,6 @@ type AzureManagedIdentityRequest struct { // The Azure resource ID of the Azure Databricks Access Connector. Use the // format // `/subscriptions/{guid}/resourceGroups/{rg-name}/providers/Microsoft.Databricks/accessConnectors/{connector-name}`. - // Wire name: 'access_connector_id' AccessConnectorId string `json:"access_connector_id"` // The Azure resource ID of the managed identity. Use the format, // `/subscriptions/{guid}/resourceGroups/{rg-name}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identity-name}` @@ -748,35 +289,17 @@ type AzureManagedIdentityRequest struct { // identities, the access_connector_id is used to identify the identity. If // this field is not provided, then we assume the AzureManagedIdentity is // using the system-assigned identity. - // Wire name: 'managed_identity_id' ManagedIdentityId string `json:"managed_identity_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *AzureManagedIdentityRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &azureManagedIdentityRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := azureManagedIdentityRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *AzureManagedIdentityRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st AzureManagedIdentityRequest) MarshalJSON() ([]byte, error) { - pb, err := azureManagedIdentityRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s AzureManagedIdentityRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The Azure managed identity configuration. @@ -784,10 +307,8 @@ type AzureManagedIdentityResponse struct { // The Azure resource ID of the Azure Databricks Access Connector. Use the // format // `/subscriptions/{guid}/resourceGroups/{rg-name}/providers/Microsoft.Databricks/accessConnectors/{connector-name}`. - // Wire name: 'access_connector_id' AccessConnectorId string `json:"access_connector_id"` // The Databricks internal ID that represents this managed identity. - // Wire name: 'credential_id' CredentialId string `json:"credential_id,omitempty"` // The Azure resource ID of the managed identity. Use the format, // `/subscriptions/{guid}/resourceGroups/{rg-name}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identity-name}` @@ -795,83 +316,44 @@ type AzureManagedIdentityResponse struct { // identities, the access_connector_id is used to identify the identity. If // this field is not provided, then we assume the AzureManagedIdentity is // using the system-assigned identity. - // Wire name: 'managed_identity_id' ManagedIdentityId string `json:"managed_identity_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *AzureManagedIdentityResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &azureManagedIdentityResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := azureManagedIdentityResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *AzureManagedIdentityResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st AzureManagedIdentityResponse) MarshalJSON() ([]byte, error) { - pb, err := azureManagedIdentityResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s AzureManagedIdentityResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type AzureQueueStorage struct { // Unique identifier included in the name of file events managed cloud // resources. - // Wire name: 'managed_resource_id' ManagedResourceId string `json:"managed_resource_id,omitempty"` // The AQS queue url in the format https://{storage // account}.queue.core.windows.net/{queue name} REQUIRED for provided_aqs. - // Wire name: 'queue_url' QueueUrl string `json:"queue_url,omitempty"` // The resource group for the queue, event grid subscription, and external // location storage account. ONLY REQUIRED for locations with a service // principal storage credential - // Wire name: 'resource_group' ResourceGroup string `json:"resource_group,omitempty"` // OPTIONAL: The subscription id for the queue, event grid subscription, and // external location storage account. REQUIRED for locations with a service // principal storage credential - // Wire name: 'subscription_id' SubscriptionId string `json:"subscription_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *AzureQueueStorage) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &azureQueueStoragePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := azureQueueStorageFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *AzureQueueStorage) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st AzureQueueStorage) MarshalJSON() ([]byte, error) { - pb, err := azureQueueStorageToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s AzureQueueStorage) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The Azure service principal configuration. Only applicable when purpose is @@ -879,242 +361,106 @@ func (st AzureQueueStorage) MarshalJSON() ([]byte, error) { type AzureServicePrincipal struct { // The application ID of the application registration within the referenced // AAD tenant. - // Wire name: 'application_id' ApplicationId string `json:"application_id"` // The client secret generated for the above app ID in AAD. - // Wire name: 'client_secret' ClientSecret string `json:"client_secret"` // The directory ID corresponding to the Azure Active Directory (AAD) tenant // of the application. - // Wire name: 'directory_id' DirectoryId string `json:"directory_id"` } -func (st *AzureServicePrincipal) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &azureServicePrincipalPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := azureServicePrincipalFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st AzureServicePrincipal) MarshalJSON() ([]byte, error) { - pb, err := azureServicePrincipalToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Azure temporary credentials for API authentication. Read more at // https://docs.microsoft.com/en-us/rest/api/storageservices/create-user-delegation-sas type AzureUserDelegationSas struct { // The signed URI (SAS Token) used to access blob services for a given path - // Wire name: 'sas_token' SasToken string `json:"sas_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *AzureUserDelegationSas) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &azureUserDelegationSasPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := azureUserDelegationSasFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *AzureUserDelegationSas) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st AzureUserDelegationSas) MarshalJSON() ([]byte, error) { - pb, err := azureUserDelegationSasToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s AzureUserDelegationSas) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Cancel refresh type CancelRefreshRequest struct { // ID of the refresh. - RefreshId string `json:"-" tf:"-"` + RefreshId string `json:"-" url:"-"` // Full name of the table. - TableName string `json:"-" tf:"-"` -} - -func (st *CancelRefreshRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &cancelRefreshRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := cancelRefreshRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CancelRefreshRequest) MarshalJSON() ([]byte, error) { - pb, err := cancelRefreshRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + TableName string `json:"-" url:"-"` } type CancelRefreshResponse struct { } -func (st *CancelRefreshResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &cancelRefreshResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := cancelRefreshResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CancelRefreshResponse) MarshalJSON() ([]byte, error) { - pb, err := cancelRefreshResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type CatalogInfo struct { // Indicates whether the principal is limited to retrieving metadata for the // associated object through the BROWSE privilege when include_browse is // enabled in the request. - // Wire name: 'browse_only' BrowseOnly bool `json:"browse_only,omitempty"` // The type of the catalog. - // Wire name: 'catalog_type' CatalogType CatalogType `json:"catalog_type,omitempty"` // User-provided free-form text description. - // Wire name: 'comment' Comment string `json:"comment,omitempty"` // The name of the connection to an external data source. - // Wire name: 'connection_name' ConnectionName string `json:"connection_name,omitempty"` // Time at which this catalog was created, in epoch milliseconds. - // Wire name: 'created_at' CreatedAt int64 `json:"created_at,omitempty"` // Username of catalog creator. - // Wire name: 'created_by' CreatedBy string `json:"created_by,omitempty"` - // Wire name: 'effective_predictive_optimization_flag' EffectivePredictiveOptimizationFlag *EffectivePredictiveOptimizationFlag `json:"effective_predictive_optimization_flag,omitempty"` // Whether predictive optimization should be enabled for this object and // objects under it. - // Wire name: 'enable_predictive_optimization' EnablePredictiveOptimization EnablePredictiveOptimization `json:"enable_predictive_optimization,omitempty"` // The full name of the catalog. Corresponds with the name field. - // Wire name: 'full_name' FullName string `json:"full_name,omitempty"` // Whether the current securable is accessible from all workspaces or a // specific set of workspaces. - // Wire name: 'isolation_mode' IsolationMode CatalogIsolationMode `json:"isolation_mode,omitempty"` // Unique identifier of parent metastore. - // Wire name: 'metastore_id' MetastoreId string `json:"metastore_id,omitempty"` // Name of catalog. - // Wire name: 'name' Name string `json:"name,omitempty"` // A map of key-value properties attached to the securable. - // Wire name: 'options' Options map[string]string `json:"options,omitempty"` // Username of current owner of catalog. - // Wire name: 'owner' Owner string `json:"owner,omitempty"` // A map of key-value properties attached to the securable. - // Wire name: 'properties' Properties map[string]string `json:"properties,omitempty"` // The name of delta sharing provider. // // A Delta Sharing catalog is a catalog that is based on a Delta share on a // remote sharing server. - // Wire name: 'provider_name' ProviderName string `json:"provider_name,omitempty"` // Status of an asynchronously provisioned resource. - // Wire name: 'provisioning_info' ProvisioningInfo *ProvisioningInfo `json:"provisioning_info,omitempty"` // The type of Unity Catalog securable. - // Wire name: 'securable_type' SecurableType SecurableType `json:"securable_type,omitempty"` // The name of the share under the share provider. - // Wire name: 'share_name' ShareName string `json:"share_name,omitempty"` // Storage Location URL (full path) for managed tables within catalog. - // Wire name: 'storage_location' StorageLocation string `json:"storage_location,omitempty"` // Storage root URL for managed tables within catalog. - // Wire name: 'storage_root' StorageRoot string `json:"storage_root,omitempty"` // Time at which this catalog was last modified, in epoch milliseconds. - // Wire name: 'updated_at' UpdatedAt int64 `json:"updated_at,omitempty"` // Username of user who last modified catalog. - // Wire name: 'updated_by' UpdatedBy string `json:"updated_by,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CatalogInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &catalogInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := catalogInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CatalogInfo) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CatalogInfo) MarshalJSON() ([]byte, error) { - pb, err := catalogInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CatalogInfo) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CatalogIsolationMode string @@ -1211,144 +557,68 @@ func (f *CatalogType) Type() string { // https://developers.cloudflare.com/r2/api/s3/tokens/ type CloudflareApiToken struct { // The access key ID associated with the API token. - // Wire name: 'access_key_id' AccessKeyId string `json:"access_key_id"` // The ID of the account associated with the API token. - // Wire name: 'account_id' AccountId string `json:"account_id"` // The secret access token generated for the above access key ID. - // Wire name: 'secret_access_key' SecretAccessKey string `json:"secret_access_key"` } -func (st *CloudflareApiToken) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &cloudflareApiTokenPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := cloudflareApiTokenFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CloudflareApiToken) MarshalJSON() ([]byte, error) { - pb, err := cloudflareApiTokenToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type ColumnInfo struct { // User-provided free-form text description. - // Wire name: 'comment' Comment string `json:"comment,omitempty"` - // Wire name: 'mask' Mask *ColumnMask `json:"mask,omitempty"` // Name of Column. - // Wire name: 'name' Name string `json:"name,omitempty"` // Whether field may be Null (default: true). - // Wire name: 'nullable' Nullable bool `json:"nullable,omitempty"` // Partition index for column. - // Wire name: 'partition_index' PartitionIndex int `json:"partition_index,omitempty"` // Ordinal position of column (starting at position 0). - // Wire name: 'position' Position int `json:"position,omitempty"` // Format of IntervalType. - // Wire name: 'type_interval_type' TypeIntervalType string `json:"type_interval_type,omitempty"` // Full data type specification, JSON-serialized. - // Wire name: 'type_json' TypeJson string `json:"type_json,omitempty"` - // Wire name: 'type_name' TypeName ColumnTypeName `json:"type_name,omitempty"` // Digits of precision; required for DecimalTypes. - // Wire name: 'type_precision' TypePrecision int `json:"type_precision,omitempty"` // Digits to right of decimal; Required for DecimalTypes. - // Wire name: 'type_scale' TypeScale int `json:"type_scale,omitempty"` // Full data type specification as SQL/catalogString text. - // Wire name: 'type_text' TypeText string `json:"type_text,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ColumnInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &columnInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := columnInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ColumnInfo) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ColumnInfo) MarshalJSON() ([]byte, error) { - pb, err := columnInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ColumnInfo) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ColumnMask struct { // The full name of the column mask SQL UDF. - // Wire name: 'function_name' FunctionName string `json:"function_name,omitempty"` // The list of additional table columns to be passed as input to the column // mask function. The first arg of the mask function should be of the type // of the column being masked and the types of the rest of the args should // match the types of columns in 'using_column_names'. - // Wire name: 'using_column_names' UsingColumnNames []string `json:"using_column_names,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ColumnMask) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &columnMaskPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := columnMaskFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ColumnMask) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ColumnMask) MarshalJSON() ([]byte, error) { - pb, err := columnMaskToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ColumnMask) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ColumnTypeName string @@ -1456,86 +726,51 @@ func (f *ColumnTypeName) Type() string { type ConnectionInfo struct { // User-provided free-form text description. - // Wire name: 'comment' Comment string `json:"comment,omitempty"` // Unique identifier of the Connection. - // Wire name: 'connection_id' ConnectionId string `json:"connection_id,omitempty"` // The type of connection. - // Wire name: 'connection_type' ConnectionType ConnectionType `json:"connection_type,omitempty"` // Time at which this connection was created, in epoch milliseconds. - // Wire name: 'created_at' CreatedAt int64 `json:"created_at,omitempty"` // Username of connection creator. - // Wire name: 'created_by' CreatedBy string `json:"created_by,omitempty"` // The type of credential. - // Wire name: 'credential_type' CredentialType CredentialType `json:"credential_type,omitempty"` // Full name of connection. - // Wire name: 'full_name' FullName string `json:"full_name,omitempty"` // Unique identifier of parent metastore. - // Wire name: 'metastore_id' MetastoreId string `json:"metastore_id,omitempty"` // Name of the connection. - // Wire name: 'name' Name string `json:"name,omitempty"` // A map of key-value properties attached to the securable. - // Wire name: 'options' Options map[string]string `json:"options,omitempty"` // Username of current owner of the connection. - // Wire name: 'owner' Owner string `json:"owner,omitempty"` // A map of key-value properties attached to the securable. - // Wire name: 'properties' Properties map[string]string `json:"properties,omitempty"` // Status of an asynchronously provisioned resource. - // Wire name: 'provisioning_info' ProvisioningInfo *ProvisioningInfo `json:"provisioning_info,omitempty"` // If the connection is read only. - // Wire name: 'read_only' ReadOnly bool `json:"read_only,omitempty"` // The type of Unity Catalog securable. - // Wire name: 'securable_type' SecurableType SecurableType `json:"securable_type,omitempty"` // Time at which this connection was updated, in epoch milliseconds. - // Wire name: 'updated_at' UpdatedAt int64 `json:"updated_at,omitempty"` // Username of user who last modified connection. - // Wire name: 'updated_by' UpdatedBy string `json:"updated_by,omitempty"` // URL of the remote data source, extracted from options. - // Wire name: 'url' Url string `json:"url,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ConnectionInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &connectionInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := connectionInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ConnectionInfo) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ConnectionInfo) MarshalJSON() ([]byte, error) { - pb, err := connectionInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ConnectionInfo) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Next Id: 33 @@ -1634,370 +869,211 @@ func (f *ConnectionType) Type() string { // ONLINE_CONTINUOUS_UPDATE or the ONLINE_UPDATING_PIPELINE_RESOURCES state. type ContinuousUpdateStatus struct { // Progress of the initial data synchronization. - // Wire name: 'initial_pipeline_sync_progress' InitialPipelineSyncProgress *PipelineProgress `json:"initial_pipeline_sync_progress,omitempty"` // The last source table Delta version that was synced to the online table. // Note that this Delta version may not be completely synced to the online // table yet. - // Wire name: 'last_processed_commit_version' LastProcessedCommitVersion int64 `json:"last_processed_commit_version,omitempty"` // The timestamp of the last time any data was synchronized from the source // table to the online table. - // Wire name: 'timestamp' Timestamp string `json:"timestamp,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ContinuousUpdateStatus) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &continuousUpdateStatusPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := continuousUpdateStatusFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ContinuousUpdateStatus) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ContinuousUpdateStatus) MarshalJSON() ([]byte, error) { - pb, err := continuousUpdateStatusToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ContinuousUpdateStatus) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreateCatalog struct { // User-provided free-form text description. - // Wire name: 'comment' Comment string `json:"comment,omitempty"` // The name of the connection to an external data source. - // Wire name: 'connection_name' ConnectionName string `json:"connection_name,omitempty"` // Name of catalog. - // Wire name: 'name' Name string `json:"name"` // A map of key-value properties attached to the securable. - // Wire name: 'options' Options map[string]string `json:"options,omitempty"` // A map of key-value properties attached to the securable. - // Wire name: 'properties' Properties map[string]string `json:"properties,omitempty"` // The name of delta sharing provider. // // A Delta Sharing catalog is a catalog that is based on a Delta share on a // remote sharing server. - // Wire name: 'provider_name' ProviderName string `json:"provider_name,omitempty"` // The name of the share under the share provider. - // Wire name: 'share_name' ShareName string `json:"share_name,omitempty"` // Storage root URL for managed tables within catalog. - // Wire name: 'storage_root' StorageRoot string `json:"storage_root,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateCatalog) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createCatalogPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createCatalogFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateCatalog) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateCatalog) MarshalJSON() ([]byte, error) { - pb, err := createCatalogToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateCatalog) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreateConnection struct { // User-provided free-form text description. - // Wire name: 'comment' Comment string `json:"comment,omitempty"` // The type of connection. - // Wire name: 'connection_type' ConnectionType ConnectionType `json:"connection_type"` // Name of the connection. - // Wire name: 'name' Name string `json:"name"` // A map of key-value properties attached to the securable. - // Wire name: 'options' Options map[string]string `json:"options"` // A map of key-value properties attached to the securable. - // Wire name: 'properties' Properties map[string]string `json:"properties,omitempty"` // If the connection is read only. - // Wire name: 'read_only' ReadOnly bool `json:"read_only,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateConnection) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createConnectionPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createConnectionFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateConnection) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateConnection) MarshalJSON() ([]byte, error) { - pb, err := createConnectionToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateConnection) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreateCredentialRequest struct { // The AWS IAM role configuration. - // Wire name: 'aws_iam_role' AwsIamRole *AwsIamRole `json:"aws_iam_role,omitempty"` // The Azure managed identity configuration. - // Wire name: 'azure_managed_identity' AzureManagedIdentity *AzureManagedIdentity `json:"azure_managed_identity,omitempty"` // The Azure service principal configuration. - // Wire name: 'azure_service_principal' AzureServicePrincipal *AzureServicePrincipal `json:"azure_service_principal,omitempty"` // Comment associated with the credential. - // Wire name: 'comment' Comment string `json:"comment,omitempty"` // The Databricks managed GCP service account configuration. - // Wire name: 'databricks_gcp_service_account' DatabricksGcpServiceAccount *DatabricksGcpServiceAccount `json:"databricks_gcp_service_account,omitempty"` // The credential name. The name must be unique among storage and service // credentials within the metastore. - // Wire name: 'name' Name string `json:"name"` // Indicates the purpose of the credential. - // Wire name: 'purpose' Purpose CredentialPurpose `json:"purpose,omitempty"` // Whether the credential is usable only for read operations. Only // applicable when purpose is **STORAGE**. - // Wire name: 'read_only' ReadOnly bool `json:"read_only,omitempty"` // Optional. Supplying true to this argument skips validation of the created // set of credentials. - // Wire name: 'skip_validation' SkipValidation bool `json:"skip_validation,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateCredentialRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createCredentialRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createCredentialRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateCredentialRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateCredentialRequest) MarshalJSON() ([]byte, error) { - pb, err := createCredentialRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateCredentialRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreateExternalLocation struct { // User-provided free-form text description. - // Wire name: 'comment' Comment string `json:"comment,omitempty"` // Name of the storage credential used with this location. - // Wire name: 'credential_name' CredentialName string `json:"credential_name"` // [Create:OPT Update:OPT] Whether to enable file events on this external // location. - // Wire name: 'enable_file_events' EnableFileEvents bool `json:"enable_file_events,omitempty"` // Encryption options that apply to clients connecting to cloud storage. - // Wire name: 'encryption_details' EncryptionDetails *EncryptionDetails `json:"encryption_details,omitempty"` // Indicates whether fallback mode is enabled for this external location. // When fallback mode is enabled, the access to the location falls back to // cluster credentials if UC credentials are not sufficient. - // Wire name: 'fallback' Fallback bool `json:"fallback,omitempty"` // [Create:OPT Update:OPT] File event queue settings. - // Wire name: 'file_event_queue' FileEventQueue *FileEventQueue `json:"file_event_queue,omitempty"` // Name of the external location. - // Wire name: 'name' Name string `json:"name"` // Indicates whether the external location is read-only. - // Wire name: 'read_only' ReadOnly bool `json:"read_only,omitempty"` // Skips validation of the storage credential associated with the external // location. - // Wire name: 'skip_validation' SkipValidation bool `json:"skip_validation,omitempty"` // Path URL of the external location. - // Wire name: 'url' Url string `json:"url"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateExternalLocation) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createExternalLocationPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createExternalLocationFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateExternalLocation) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateExternalLocation) MarshalJSON() ([]byte, error) { - pb, err := createExternalLocationToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateExternalLocation) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreateFunction struct { // Name of parent catalog. - // Wire name: 'catalog_name' CatalogName string `json:"catalog_name"` // User-provided free-form text description. - // Wire name: 'comment' Comment string `json:"comment,omitempty"` // Scalar function return data type. - // Wire name: 'data_type' DataType ColumnTypeName `json:"data_type"` // External function language. - // Wire name: 'external_language' ExternalLanguage string `json:"external_language,omitempty"` // External function name. - // Wire name: 'external_name' ExternalName string `json:"external_name,omitempty"` // Pretty printed function data type. - // Wire name: 'full_data_type' FullDataType string `json:"full_data_type"` - // Wire name: 'input_params' InputParams FunctionParameterInfos `json:"input_params"` // Whether the function is deterministic. - // Wire name: 'is_deterministic' IsDeterministic bool `json:"is_deterministic"` // Function null call. - // Wire name: 'is_null_call' IsNullCall bool `json:"is_null_call"` // Name of function, relative to parent schema. - // Wire name: 'name' Name string `json:"name"` // Function parameter style. **S** is the value for SQL. - // Wire name: 'parameter_style' ParameterStyle CreateFunctionParameterStyle `json:"parameter_style"` // JSON-serialized key-value pair map, encoded (escaped) as a string. - // Wire name: 'properties' Properties string `json:"properties,omitempty"` // Table function return parameters. - // Wire name: 'return_params' ReturnParams *FunctionParameterInfos `json:"return_params,omitempty"` // Function language. When **EXTERNAL** is used, the language of the routine // function should be specified in the __external_language__ field, and the // __return_params__ of the function cannot be used (as **TABLE** return // type is not supported), and the __sql_data_access__ field must be // **NO_SQL**. - // Wire name: 'routine_body' RoutineBody CreateFunctionRoutineBody `json:"routine_body"` // Function body. - // Wire name: 'routine_definition' RoutineDefinition string `json:"routine_definition"` // Function dependencies. - // Wire name: 'routine_dependencies' RoutineDependencies *DependencyList `json:"routine_dependencies,omitempty"` // Name of parent schema relative to its parent catalog. - // Wire name: 'schema_name' SchemaName string `json:"schema_name"` // Function security type. - // Wire name: 'security_type' SecurityType CreateFunctionSecurityType `json:"security_type"` // Specific name of the function; Reserved for future use. - // Wire name: 'specific_name' SpecificName string `json:"specific_name"` // Function SQL data access. - // Wire name: 'sql_data_access' SqlDataAccess CreateFunctionSqlDataAccess `json:"sql_data_access"` // List of schemes whose objects can be referenced without qualification. - // Wire name: 'sql_path' SqlPath string `json:"sql_path,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateFunction) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createFunctionPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createFunctionFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateFunction) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateFunction) MarshalJSON() ([]byte, error) { - pb, err := createFunctionToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateFunction) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Function parameter style. **S** is the value for SQL. @@ -2037,35 +1113,9 @@ func (f *CreateFunctionParameterStyle) Type() string { type CreateFunctionRequest struct { // Partial __FunctionInfo__ specifying the function to be created. - // Wire name: 'function_info' FunctionInfo CreateFunction `json:"function_info"` } -func (st *CreateFunctionRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createFunctionRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createFunctionRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CreateFunctionRequest) MarshalJSON() ([]byte, error) { - pb, err := createFunctionRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Function language. When **EXTERNAL** is used, the language of the routine // function should be specified in the __external_language__ field, and the // __return_params__ of the function cannot be used (as **TABLE** return type is @@ -2185,424 +1235,194 @@ func (f *CreateFunctionSqlDataAccess) Type() string { type CreateMetastore struct { // The user-specified name of the metastore. - // Wire name: 'name' Name string `json:"name"` // Cloud region which the metastore serves (e.g., `us-west-2`, `westus`). - // Wire name: 'region' Region string `json:"region,omitempty"` // The storage root URL for metastore - // Wire name: 'storage_root' StorageRoot string `json:"storage_root,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateMetastore) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createMetastorePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createMetastoreFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateMetastore) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateMetastore) MarshalJSON() ([]byte, error) { - pb, err := createMetastoreToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateMetastore) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreateMetastoreAssignment struct { // The name of the default catalog in the metastore. This field is // deprecated. Please use "Default Namespace API" to configure the default // catalog for a Databricks workspace. - // Wire name: 'default_catalog_name' DefaultCatalogName string `json:"default_catalog_name"` // The unique ID of the metastore. - // Wire name: 'metastore_id' MetastoreId string `json:"metastore_id"` // A workspace ID. - WorkspaceId int64 `json:"-" tf:"-"` -} - -func (st *CreateMetastoreAssignment) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createMetastoreAssignmentPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createMetastoreAssignmentFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CreateMetastoreAssignment) MarshalJSON() ([]byte, error) { - pb, err := createMetastoreAssignmentToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + WorkspaceId int64 `json:"-" url:"-"` } type CreateMonitor struct { // The directory to store monitoring assets (e.g. dashboard, metric tables). - // Wire name: 'assets_dir' AssetsDir string `json:"assets_dir"` // Name of the baseline table from which drift metrics are computed from. // Columns in the monitored table should also be present in the baseline // table. - // Wire name: 'baseline_table_name' BaselineTableName string `json:"baseline_table_name,omitempty"` // Custom metrics to compute on the monitored table. These can be aggregate // metrics, derived metrics (from already computed aggregate metrics), or // drift metrics (comparing metrics across time windows). - // Wire name: 'custom_metrics' CustomMetrics []MonitorMetric `json:"custom_metrics,omitempty"` // The data classification config for the monitor. - // Wire name: 'data_classification_config' DataClassificationConfig *MonitorDataClassificationConfig `json:"data_classification_config,omitempty"` // Configuration for monitoring inference logs. - // Wire name: 'inference_log' InferenceLog *MonitorInferenceLog `json:"inference_log,omitempty"` // The notification settings for the monitor. - // Wire name: 'notifications' Notifications *MonitorNotifications `json:"notifications,omitempty"` // Schema where output metric tables are created. - // Wire name: 'output_schema_name' OutputSchemaName string `json:"output_schema_name"` // The schedule for automatically updating and refreshing metric tables. - // Wire name: 'schedule' Schedule *MonitorCronSchedule `json:"schedule,omitempty"` // Whether to skip creating a default dashboard summarizing data quality // metrics. - // Wire name: 'skip_builtin_dashboard' SkipBuiltinDashboard bool `json:"skip_builtin_dashboard,omitempty"` // List of column expressions to slice data with for targeted analysis. The // data is grouped by each expression independently, resulting in a separate // slice for each predicate and its complements. For high-cardinality // columns, only the top 100 unique values by frequency will generate // slices. - // Wire name: 'slicing_exprs' SlicingExprs []string `json:"slicing_exprs,omitempty"` // Configuration for monitoring snapshot tables. - // Wire name: 'snapshot' Snapshot *MonitorSnapshot `json:"snapshot,omitempty"` // Full name of the table. - TableName string `json:"-" tf:"-"` + TableName string `json:"-" url:"-"` // Configuration for monitoring time series tables. - // Wire name: 'time_series' TimeSeries *MonitorTimeSeries `json:"time_series,omitempty"` // Optional argument to specify the warehouse for dashboard creation. If not // specified, the first running warehouse will be used. - // Wire name: 'warehouse_id' WarehouseId string `json:"warehouse_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateMonitor) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createMonitorPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createMonitorFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateMonitor) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateMonitor) MarshalJSON() ([]byte, error) { - pb, err := createMonitorToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateMonitor) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Create an Online Table type CreateOnlineTableRequest struct { // Online Table information. - // Wire name: 'table' Table OnlineTable `json:"table"` } -func (st *CreateOnlineTableRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createOnlineTableRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createOnlineTableRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CreateOnlineTableRequest) MarshalJSON() ([]byte, error) { - pb, err := createOnlineTableRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type CreateRegisteredModelRequest struct { // The name of the catalog where the schema and the registered model reside - // Wire name: 'catalog_name' CatalogName string `json:"catalog_name"` // The comment attached to the registered model - // Wire name: 'comment' Comment string `json:"comment,omitempty"` // The name of the registered model - // Wire name: 'name' Name string `json:"name"` // The name of the schema where the registered model resides - // Wire name: 'schema_name' SchemaName string `json:"schema_name"` // The storage location on the cloud under which model version data files // are stored - // Wire name: 'storage_location' StorageLocation string `json:"storage_location,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateRegisteredModelRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createRegisteredModelRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createRegisteredModelRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateRegisteredModelRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateRegisteredModelRequest) MarshalJSON() ([]byte, error) { - pb, err := createRegisteredModelRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateRegisteredModelRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreateResponse struct { } -func (st *CreateResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CreateResponse) MarshalJSON() ([]byte, error) { - pb, err := createResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type CreateSchema struct { // Name of parent catalog. - // Wire name: 'catalog_name' CatalogName string `json:"catalog_name"` // User-provided free-form text description. - // Wire name: 'comment' Comment string `json:"comment,omitempty"` // Name of schema, relative to parent catalog. - // Wire name: 'name' Name string `json:"name"` // A map of key-value properties attached to the securable. - // Wire name: 'properties' Properties map[string]string `json:"properties,omitempty"` // Storage root URL for managed tables within schema. - // Wire name: 'storage_root' StorageRoot string `json:"storage_root,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateSchema) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createSchemaPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createSchemaFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateSchema) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateSchema) MarshalJSON() ([]byte, error) { - pb, err := createSchemaToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateSchema) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreateStorageCredential struct { // The AWS IAM role configuration. - // Wire name: 'aws_iam_role' AwsIamRole *AwsIamRoleRequest `json:"aws_iam_role,omitempty"` // The Azure managed identity configuration. - // Wire name: 'azure_managed_identity' AzureManagedIdentity *AzureManagedIdentityRequest `json:"azure_managed_identity,omitempty"` // The Azure service principal configuration. - // Wire name: 'azure_service_principal' AzureServicePrincipal *AzureServicePrincipal `json:"azure_service_principal,omitempty"` // The Cloudflare API token configuration. - // Wire name: 'cloudflare_api_token' CloudflareApiToken *CloudflareApiToken `json:"cloudflare_api_token,omitempty"` // Comment associated with the credential. - // Wire name: 'comment' Comment string `json:"comment,omitempty"` // The Databricks managed GCP service account configuration. - // Wire name: 'databricks_gcp_service_account' DatabricksGcpServiceAccount *DatabricksGcpServiceAccountRequest `json:"databricks_gcp_service_account,omitempty"` // The credential name. The name must be unique among storage and service // credentials within the metastore. - // Wire name: 'name' Name string `json:"name"` // Whether the credential is usable only for read operations. Only // applicable when purpose is **STORAGE**. - // Wire name: 'read_only' ReadOnly bool `json:"read_only,omitempty"` // Supplying true to this argument skips validation of the created // credential. - // Wire name: 'skip_validation' SkipValidation bool `json:"skip_validation,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateStorageCredential) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createStorageCredentialPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createStorageCredentialFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateStorageCredential) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateStorageCredential) MarshalJSON() ([]byte, error) { - pb, err := createStorageCredentialToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateStorageCredential) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreateTableConstraint struct { // A table constraint, as defined by *one* of the following fields being // set: __primary_key_constraint__, __foreign_key_constraint__, // __named_table_constraint__. - // Wire name: 'constraint' Constraint TableConstraint `json:"constraint"` // The full name of the table referenced by the constraint. - // Wire name: 'full_name_arg' FullNameArg string `json:"full_name_arg"` } -func (st *CreateTableConstraint) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createTableConstraintPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createTableConstraintFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CreateTableConstraint) MarshalJSON() ([]byte, error) { - pb, err := createTableConstraintToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type CreateVolumeRequestContent struct { // The name of the catalog where the schema and the volume are - // Wire name: 'catalog_name' CatalogName string `json:"catalog_name"` // The comment attached to the volume - // Wire name: 'comment' Comment string `json:"comment,omitempty"` // The name of the volume - // Wire name: 'name' Name string `json:"name"` // The name of the schema where the volume is - // Wire name: 'schema_name' SchemaName string `json:"schema_name"` // The storage location on the cloud - // Wire name: 'storage_location' StorageLocation string `json:"storage_location,omitempty"` // The type of the volume. An external volume is located in the specified // external location. A managed volume is located in the default location @@ -2610,123 +1430,70 @@ type CreateVolumeRequestContent struct { // Metastore. [Learn more] // // [Learn more]: https://docs.databricks.com/aws/en/volumes/managed-vs-external - // Wire name: 'volume_type' VolumeType VolumeType `json:"volume_type"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateVolumeRequestContent) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createVolumeRequestContentPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createVolumeRequestContentFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateVolumeRequestContent) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateVolumeRequestContent) MarshalJSON() ([]byte, error) { - pb, err := createVolumeRequestContentToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateVolumeRequestContent) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CredentialInfo struct { // The AWS IAM role configuration. - // Wire name: 'aws_iam_role' AwsIamRole *AwsIamRole `json:"aws_iam_role,omitempty"` // The Azure managed identity configuration. - // Wire name: 'azure_managed_identity' AzureManagedIdentity *AzureManagedIdentity `json:"azure_managed_identity,omitempty"` // The Azure service principal configuration. - // Wire name: 'azure_service_principal' AzureServicePrincipal *AzureServicePrincipal `json:"azure_service_principal,omitempty"` // Comment associated with the credential. - // Wire name: 'comment' Comment string `json:"comment,omitempty"` // Time at which this credential was created, in epoch milliseconds. - // Wire name: 'created_at' CreatedAt int64 `json:"created_at,omitempty"` // Username of credential creator. - // Wire name: 'created_by' CreatedBy string `json:"created_by,omitempty"` // The Databricks managed GCP service account configuration. - // Wire name: 'databricks_gcp_service_account' DatabricksGcpServiceAccount *DatabricksGcpServiceAccount `json:"databricks_gcp_service_account,omitempty"` // The full name of the credential. - // Wire name: 'full_name' FullName string `json:"full_name,omitempty"` // The unique identifier of the credential. - // Wire name: 'id' Id string `json:"id,omitempty"` // Whether the current securable is accessible from all workspaces or a // specific set of workspaces. - // Wire name: 'isolation_mode' IsolationMode IsolationMode `json:"isolation_mode,omitempty"` // Unique identifier of the parent metastore. - // Wire name: 'metastore_id' MetastoreId string `json:"metastore_id,omitempty"` // The credential name. The name must be unique among storage and service // credentials within the metastore. - // Wire name: 'name' Name string `json:"name,omitempty"` // Username of current owner of credential. - // Wire name: 'owner' Owner string `json:"owner,omitempty"` // Indicates the purpose of the credential. - // Wire name: 'purpose' Purpose CredentialPurpose `json:"purpose,omitempty"` // Whether the credential is usable only for read operations. Only // applicable when purpose is **STORAGE**. - // Wire name: 'read_only' ReadOnly bool `json:"read_only,omitempty"` // Time at which this credential was last modified, in epoch milliseconds. - // Wire name: 'updated_at' UpdatedAt int64 `json:"updated_at,omitempty"` // Username of user who last modified the credential. - // Wire name: 'updated_by' UpdatedBy string `json:"updated_by,omitempty"` // Whether this credential is the current metastore's root storage // credential. Only applicable when purpose is **STORAGE**. - // Wire name: 'used_for_managed_storage' UsedForManagedStorage bool `json:"used_for_managed_storage,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CredentialInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &credentialInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := credentialInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CredentialInfo) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CredentialInfo) MarshalJSON() ([]byte, error) { - pb, err := credentialInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CredentialInfo) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CredentialPurpose string @@ -2836,38 +1603,19 @@ func (f *CredentialType) Type() string { type CredentialValidationResult struct { // Error message would exist when the result does not equal to **PASS**. - // Wire name: 'message' Message string `json:"message,omitempty"` // The results of the tested operation. - // Wire name: 'result' Result ValidateCredentialResult `json:"result,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CredentialValidationResult) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &credentialValidationResultPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := credentialValidationResultFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CredentialValidationResult) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CredentialValidationResult) MarshalJSON() ([]byte, error) { - pb, err := credentialValidationResultToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CredentialValidationResult) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Data source format @@ -2975,41 +1723,21 @@ func (f *DataSourceFormat) Type() string { // account. type DatabricksGcpServiceAccount struct { // The Databricks internal ID that represents this managed identity. - // Wire name: 'credential_id' CredentialId string `json:"credential_id,omitempty"` // The email of the service account. - // Wire name: 'email' Email string `json:"email,omitempty"` // The ID that represents the private key for this Service Account - // Wire name: 'private_key_id' PrivateKeyId string `json:"private_key_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DatabricksGcpServiceAccount) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &databricksGcpServiceAccountPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := databricksGcpServiceAccountFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DatabricksGcpServiceAccount) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DatabricksGcpServiceAccount) MarshalJSON() ([]byte, error) { - pb, err := databricksGcpServiceAccountToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DatabricksGcpServiceAccount) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // GCP long-lived credential. Databricks-created Google Cloud Storage service @@ -3017,300 +1745,105 @@ func (st DatabricksGcpServiceAccount) MarshalJSON() ([]byte, error) { type DatabricksGcpServiceAccountRequest struct { } -func (st *DatabricksGcpServiceAccountRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &databricksGcpServiceAccountRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := databricksGcpServiceAccountRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DatabricksGcpServiceAccountRequest) MarshalJSON() ([]byte, error) { - pb, err := databricksGcpServiceAccountRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // GCP long-lived credential. Databricks-created Google Cloud Storage service // account. type DatabricksGcpServiceAccountResponse struct { // The Databricks internal ID that represents this managed identity. - // Wire name: 'credential_id' CredentialId string `json:"credential_id,omitempty"` // The email of the service account. - // Wire name: 'email' Email string `json:"email,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DatabricksGcpServiceAccountResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &databricksGcpServiceAccountResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := databricksGcpServiceAccountResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DatabricksGcpServiceAccountResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DatabricksGcpServiceAccountResponse) MarshalJSON() ([]byte, error) { - pb, err := databricksGcpServiceAccountResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DatabricksGcpServiceAccountResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Delete a metastore assignment type DeleteAccountMetastoreAssignmentRequest struct { // Unity Catalog metastore ID - MetastoreId string `json:"-" tf:"-"` + MetastoreId string `json:"-" url:"-"` // Workspace ID. - WorkspaceId int64 `json:"-" tf:"-"` -} - -func (st *DeleteAccountMetastoreAssignmentRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteAccountMetastoreAssignmentRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteAccountMetastoreAssignmentRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteAccountMetastoreAssignmentRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteAccountMetastoreAssignmentRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + WorkspaceId int64 `json:"-" url:"-"` } // Delete a metastore type DeleteAccountMetastoreRequest struct { // Force deletion even if the metastore is not empty. Default is false. - Force bool `json:"-" tf:"-"` + Force bool `json:"-" url:"force,omitempty"` // Unity Catalog metastore ID - MetastoreId string `json:"-" tf:"-"` + MetastoreId string `json:"-" url:"-"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DeleteAccountMetastoreRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteAccountMetastoreRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteAccountMetastoreRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DeleteAccountMetastoreRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DeleteAccountMetastoreRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteAccountMetastoreRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DeleteAccountMetastoreRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Delete a storage credential type DeleteAccountStorageCredentialRequest struct { // Force deletion even if the Storage Credential is not empty. Default is // false. - Force bool `json:"-" tf:"-"` + Force bool `json:"-" url:"force,omitempty"` // Unity Catalog metastore ID - MetastoreId string `json:"-" tf:"-"` + MetastoreId string `json:"-" url:"-"` // Name of the storage credential. - StorageCredentialName string `json:"-" tf:"-"` + StorageCredentialName string `json:"-" url:"-"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DeleteAccountStorageCredentialRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteAccountStorageCredentialRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteAccountStorageCredentialRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DeleteAccountStorageCredentialRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DeleteAccountStorageCredentialRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteAccountStorageCredentialRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DeleteAccountStorageCredentialRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Delete a Registered Model Alias type DeleteAliasRequest struct { // The name of the alias - Alias string `json:"-" tf:"-"` + Alias string `json:"-" url:"-"` // The three-level (fully qualified) name of the registered model - FullName string `json:"-" tf:"-"` -} - -func (st *DeleteAliasRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteAliasRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteAliasRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteAliasRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteAliasRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + FullName string `json:"-" url:"-"` } type DeleteAliasResponse struct { } -func (st *DeleteAliasResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteAliasResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteAliasResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteAliasResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteAliasResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Delete a catalog type DeleteCatalogRequest struct { // Force deletion even if the catalog is not empty. - Force bool `json:"-" tf:"-"` + Force bool `json:"-" url:"force,omitempty"` // The name of the catalog. - Name string `json:"-" tf:"-"` + Name string `json:"-" url:"-"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DeleteCatalogRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteCatalogRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteCatalogRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DeleteCatalogRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DeleteCatalogRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteCatalogRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DeleteCatalogRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Delete a connection type DeleteConnectionRequest struct { // The name of the connection to be deleted. - Name string `json:"-" tf:"-"` -} - -func (st *DeleteConnectionRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteConnectionRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteConnectionRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteConnectionRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteConnectionRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Name string `json:"-" url:"-"` } // Delete a credential @@ -3318,359 +1851,124 @@ type DeleteCredentialRequest struct { // Force an update even if there are dependent services (when purpose is // **SERVICE**) or dependent external locations and external tables (when // purpose is **STORAGE**). - Force bool `json:"-" tf:"-"` + Force bool `json:"-" url:"force,omitempty"` // Name of the credential. - NameArg string `json:"-" tf:"-"` + NameArg string `json:"-" url:"-"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DeleteCredentialRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteCredentialRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteCredentialRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DeleteCredentialRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DeleteCredentialRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteCredentialRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DeleteCredentialRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type DeleteCredentialResponse struct { } -func (st *DeleteCredentialResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteCredentialResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteCredentialResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteCredentialResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteCredentialResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Delete an external location type DeleteExternalLocationRequest struct { // Force deletion even if there are dependent external tables or mounts. - Force bool `json:"-" tf:"-"` + Force bool `json:"-" url:"force,omitempty"` // Name of the external location. - Name string `json:"-" tf:"-"` + Name string `json:"-" url:"-"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DeleteExternalLocationRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteExternalLocationRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteExternalLocationRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DeleteExternalLocationRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DeleteExternalLocationRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteExternalLocationRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DeleteExternalLocationRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Delete a function type DeleteFunctionRequest struct { // Force deletion even if the function is notempty. - Force bool `json:"-" tf:"-"` + Force bool `json:"-" url:"force,omitempty"` // The fully-qualified name of the function (of the form // __catalog_name__.__schema_name__.__function__name__). - Name string `json:"-" tf:"-"` + Name string `json:"-" url:"-"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DeleteFunctionRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteFunctionRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteFunctionRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DeleteFunctionRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DeleteFunctionRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteFunctionRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DeleteFunctionRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Delete a metastore type DeleteMetastoreRequest struct { // Force deletion even if the metastore is not empty. Default is false. - Force bool `json:"-" tf:"-"` + Force bool `json:"-" url:"force,omitempty"` // Unique ID of the metastore. - Id string `json:"-" tf:"-"` + Id string `json:"-" url:"-"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DeleteMetastoreRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteMetastoreRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteMetastoreRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DeleteMetastoreRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DeleteMetastoreRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteMetastoreRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DeleteMetastoreRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Delete a Model Version type DeleteModelVersionRequest struct { // The three-level (fully qualified) name of the model version - FullName string `json:"-" tf:"-"` + FullName string `json:"-" url:"-"` // The integer version number of the model version - Version int `json:"-" tf:"-"` -} - -func (st *DeleteModelVersionRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteModelVersionRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteModelVersionRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteModelVersionRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteModelVersionRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Version int `json:"-" url:"-"` } // Delete an Online Table type DeleteOnlineTableRequest struct { // Full three-part (catalog, schema, table) name of the table. - Name string `json:"-" tf:"-"` -} - -func (st *DeleteOnlineTableRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteOnlineTableRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteOnlineTableRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteOnlineTableRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteOnlineTableRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Name string `json:"-" url:"-"` } // Delete a table monitor type DeleteQualityMonitorRequest struct { // Full name of the table. - TableName string `json:"-" tf:"-"` -} - -func (st *DeleteQualityMonitorRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteQualityMonitorRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteQualityMonitorRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteQualityMonitorRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteQualityMonitorRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + TableName string `json:"-" url:"-"` } // Delete a Registered Model type DeleteRegisteredModelRequest struct { // The three-level (fully qualified) name of the registered model - FullName string `json:"-" tf:"-"` -} - -func (st *DeleteRegisteredModelRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteRegisteredModelRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteRegisteredModelRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteRegisteredModelRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteRegisteredModelRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + FullName string `json:"-" url:"-"` } type DeleteResponse struct { } -func (st *DeleteResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Delete a schema type DeleteSchemaRequest struct { // Force deletion even if the schema is not empty. - Force bool `json:"-" tf:"-"` + Force bool `json:"-" url:"force,omitempty"` // Full name of the schema. - FullName string `json:"-" tf:"-"` + FullName string `json:"-" url:"-"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DeleteSchemaRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteSchemaRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteSchemaRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DeleteSchemaRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DeleteSchemaRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteSchemaRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DeleteSchemaRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Delete a credential @@ -3678,36 +1976,19 @@ type DeleteStorageCredentialRequest struct { // Force an update even if there are dependent external locations or // external tables (when purpose is **STORAGE**) or dependent services (when // purpose is **SERVICE**). - Force bool `json:"-" tf:"-"` + Force bool `json:"-" url:"force,omitempty"` // Name of the storage credential. - Name string `json:"-" tf:"-"` + Name string `json:"-" url:"-"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DeleteStorageCredentialRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteStorageCredentialRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteStorageCredentialRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DeleteStorageCredentialRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DeleteStorageCredentialRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteStorageCredentialRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DeleteStorageCredentialRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Delete a table constraint @@ -3715,98 +1996,23 @@ type DeleteTableConstraintRequest struct { // If true, try deleting all child constraints of the current constraint. If // false, reject this operation if the current constraint has any child // constraints. - Cascade bool `json:"-" tf:"-"` + Cascade bool `json:"-" url:"cascade"` // The name of the constraint to delete. - ConstraintName string `json:"-" tf:"-"` + ConstraintName string `json:"-" url:"constraint_name"` // Full name of the table referenced by the constraint. - FullName string `json:"-" tf:"-"` -} - -func (st *DeleteTableConstraintRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteTableConstraintRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteTableConstraintRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteTableConstraintRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteTableConstraintRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + FullName string `json:"-" url:"-"` } // Delete a table type DeleteTableRequest struct { // Full name of the table. - FullName string `json:"-" tf:"-"` -} - -func (st *DeleteTableRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteTableRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteTableRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteTableRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteTableRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + FullName string `json:"-" url:"-"` } // Delete a Volume type DeleteVolumeRequest struct { // The three-level (fully qualified) name of the volume - Name string `json:"-" tf:"-"` -} - -func (st *DeleteVolumeRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteVolumeRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteVolumeRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteVolumeRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteVolumeRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Name string `json:"-" url:"-"` } // Properties pertaining to the current state of the delta table as given by the @@ -3814,35 +2020,9 @@ func (st DeleteVolumeRequest) MarshalJSON() ([]byte, error) { // __TableInfo.properties__. type DeltaRuntimePropertiesKvPairs struct { // A map of key-value properties attached to the securable. - // Wire name: 'delta_runtime_properties' DeltaRuntimeProperties map[string]string `json:"delta_runtime_properties"` } -func (st *DeltaRuntimePropertiesKvPairs) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deltaRuntimePropertiesKvPairsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deltaRuntimePropertiesKvPairsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeltaRuntimePropertiesKvPairs) MarshalJSON() ([]byte, error) { - pb, err := deltaRuntimePropertiesKvPairsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type DeltaSharingScopeEnum string const DeltaSharingScopeEnumInternal DeltaSharingScopeEnum = `INTERNAL` @@ -3884,210 +2064,68 @@ func (f *DeltaSharingScopeEnum) Type() string { // field must be defined. type Dependency struct { // A function that is dependent on a SQL object. - // Wire name: 'function' Function *FunctionDependency `json:"function,omitempty"` // A table that is dependent on a SQL object. - // Wire name: 'table' Table *TableDependency `json:"table,omitempty"` } -func (st *Dependency) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &dependencyPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := dependencyFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st Dependency) MarshalJSON() ([]byte, error) { - pb, err := dependencyToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // A list of dependencies. type DependencyList struct { // Array of dependencies. - // Wire name: 'dependencies' Dependencies []Dependency `json:"dependencies,omitempty"` } -func (st *DependencyList) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &dependencyListPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := dependencyListFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DependencyList) MarshalJSON() ([]byte, error) { - pb, err := dependencyListToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Disable a system schema type DisableRequest struct { // The metastore ID under which the system schema lives. - MetastoreId string `json:"-" tf:"-"` + MetastoreId string `json:"-" url:"-"` // Full name of the system schema. - SchemaName string `json:"-" tf:"-"` -} - -func (st *DisableRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &disableRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := disableRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DisableRequest) MarshalJSON() ([]byte, error) { - pb, err := disableRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + SchemaName string `json:"-" url:"-"` } type DisableResponse struct { } -func (st *DisableResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &disableResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := disableResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DisableResponse) MarshalJSON() ([]byte, error) { - pb, err := disableResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type EffectivePermissionsList struct { // Opaque token to retrieve the next page of results. Absent if there are no // more pages. __page_token__ should be set to this value for the next // request (for the next page of results). - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` // The privileges conveyed to each principal (either directly or via // inheritance) - // Wire name: 'privilege_assignments' PrivilegeAssignments []EffectivePrivilegeAssignment `json:"privilege_assignments,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *EffectivePermissionsList) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &effectivePermissionsListPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := effectivePermissionsListFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *EffectivePermissionsList) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st EffectivePermissionsList) MarshalJSON() ([]byte, error) { - pb, err := effectivePermissionsListToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s EffectivePermissionsList) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type EffectivePredictiveOptimizationFlag struct { // The name of the object from which the flag was inherited. If there was no // inheritance, this field is left blank. - // Wire name: 'inherited_from_name' InheritedFromName string `json:"inherited_from_name,omitempty"` // The type of the object from which the flag was inherited. If there was no // inheritance, this field is left blank. - // Wire name: 'inherited_from_type' InheritedFromType EffectivePredictiveOptimizationFlagInheritedFromType `json:"inherited_from_type,omitempty"` // Whether predictive optimization should be enabled for this object and // objects under it. - // Wire name: 'value' Value EnablePredictiveOptimization `json:"value"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *EffectivePredictiveOptimizationFlag) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &effectivePredictiveOptimizationFlagPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := effectivePredictiveOptimizationFlagFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *EffectivePredictiveOptimizationFlag) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st EffectivePredictiveOptimizationFlag) MarshalJSON() ([]byte, error) { - pb, err := effectivePredictiveOptimizationFlagToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s EffectivePredictiveOptimizationFlag) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The type of the object from which the flag was inherited. If there was no @@ -4133,80 +2171,41 @@ type EffectivePrivilege struct { // The full name of the object that conveys this privilege via inheritance. // This field is omitted when privilege is not inherited (it's assigned to // the securable itself). - // Wire name: 'inherited_from_name' InheritedFromName string `json:"inherited_from_name,omitempty"` // The type of the object that conveys this privilege via inheritance. This // field is omitted when privilege is not inherited (it's assigned to the // securable itself). - // Wire name: 'inherited_from_type' InheritedFromType SecurableType `json:"inherited_from_type,omitempty"` // The privilege assigned to the principal. - // Wire name: 'privilege' Privilege Privilege `json:"privilege,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *EffectivePrivilege) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &effectivePrivilegePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := effectivePrivilegeFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *EffectivePrivilege) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st EffectivePrivilege) MarshalJSON() ([]byte, error) { - pb, err := effectivePrivilegeToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s EffectivePrivilege) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type EffectivePrivilegeAssignment struct { // The principal (user email address or group name). - // Wire name: 'principal' Principal string `json:"principal,omitempty"` // The privileges conveyed to the principal (either directly or via // inheritance). - // Wire name: 'privileges' Privileges []EffectivePrivilege `json:"privileges,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *EffectivePrivilegeAssignment) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &effectivePrivilegeAssignmentPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := effectivePrivilegeAssignmentFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *EffectivePrivilegeAssignment) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st EffectivePrivilegeAssignment) MarshalJSON() ([]byte, error) { - pb, err := effectivePrivilegeAssignmentToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s EffectivePrivilegeAssignment) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type EnablePredictiveOptimization string @@ -4251,220 +2250,91 @@ func (f *EnablePredictiveOptimization) Type() string { type EnableRequest struct { // the catalog for which the system schema is to enabled in - // Wire name: 'catalog_name' CatalogName string `json:"catalog_name,omitempty"` // The metastore ID under which the system schema lives. - MetastoreId string `json:"-" tf:"-"` + MetastoreId string `json:"-" url:"-"` // Full name of the system schema. - SchemaName string `json:"-" tf:"-"` + SchemaName string `json:"-" url:"-"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *EnableRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &enableRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := enableRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *EnableRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st EnableRequest) MarshalJSON() ([]byte, error) { - pb, err := enableRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s EnableRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type EnableResponse struct { } -func (st *EnableResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &enableResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := enableResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st EnableResponse) MarshalJSON() ([]byte, error) { - pb, err := enableResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Encryption options that apply to clients connecting to cloud storage. type EncryptionDetails struct { // Server-Side Encryption properties for clients communicating with AWS s3. - // Wire name: 'sse_encryption_details' SseEncryptionDetails *SseEncryptionDetails `json:"sse_encryption_details,omitempty"` } -func (st *EncryptionDetails) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &encryptionDetailsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := encryptionDetailsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st EncryptionDetails) MarshalJSON() ([]byte, error) { - pb, err := encryptionDetailsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Get boolean reflecting if table exists type ExistsRequest struct { // Full name of the table. - FullName string `json:"-" tf:"-"` -} - -func (st *ExistsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &existsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := existsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ExistsRequest) MarshalJSON() ([]byte, error) { - pb, err := existsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + FullName string `json:"-" url:"-"` } type ExternalLocationInfo struct { // Indicates whether the principal is limited to retrieving metadata for the // associated object through the BROWSE privilege when include_browse is // enabled in the request. - // Wire name: 'browse_only' BrowseOnly bool `json:"browse_only,omitempty"` // User-provided free-form text description. - // Wire name: 'comment' Comment string `json:"comment,omitempty"` // Time at which this external location was created, in epoch milliseconds. - // Wire name: 'created_at' CreatedAt int64 `json:"created_at,omitempty"` // Username of external location creator. - // Wire name: 'created_by' CreatedBy string `json:"created_by,omitempty"` // Unique ID of the location's storage credential. - // Wire name: 'credential_id' CredentialId string `json:"credential_id,omitempty"` // Name of the storage credential used with this location. - // Wire name: 'credential_name' CredentialName string `json:"credential_name,omitempty"` // [Create:OPT Update:OPT] Whether to enable file events on this external // location. - // Wire name: 'enable_file_events' EnableFileEvents bool `json:"enable_file_events,omitempty"` // Encryption options that apply to clients connecting to cloud storage. - // Wire name: 'encryption_details' EncryptionDetails *EncryptionDetails `json:"encryption_details,omitempty"` // Indicates whether fallback mode is enabled for this external location. // When fallback mode is enabled, the access to the location falls back to // cluster credentials if UC credentials are not sufficient. - // Wire name: 'fallback' Fallback bool `json:"fallback,omitempty"` // [Create:OPT Update:OPT] File event queue settings. - // Wire name: 'file_event_queue' FileEventQueue *FileEventQueue `json:"file_event_queue,omitempty"` - // Wire name: 'isolation_mode' IsolationMode IsolationMode `json:"isolation_mode,omitempty"` // Unique identifier of metastore hosting the external location. - // Wire name: 'metastore_id' MetastoreId string `json:"metastore_id,omitempty"` // Name of the external location. - // Wire name: 'name' Name string `json:"name,omitempty"` // The owner of the external location. - // Wire name: 'owner' Owner string `json:"owner,omitempty"` // Indicates whether the external location is read-only. - // Wire name: 'read_only' ReadOnly bool `json:"read_only,omitempty"` // Time at which external location this was last modified, in epoch // milliseconds. - // Wire name: 'updated_at' UpdatedAt int64 `json:"updated_at,omitempty"` // Username of user who last modified the external location. - // Wire name: 'updated_by' UpdatedBy string `json:"updated_by,omitempty"` // Path URL of the external location. - // Wire name: 'url' Url string `json:"url,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ExternalLocationInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &externalLocationInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := externalLocationInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ExternalLocationInfo) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ExternalLocationInfo) MarshalJSON() ([]byte, error) { - pb, err := externalLocationInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ExternalLocationInfo) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Detailed status of an online table. Shown if the online table is in the @@ -4474,286 +2344,133 @@ type FailedStatus struct { // Note that this Delta version may only be partially synced to the online // table. Only populated if the table is still online and available for // serving. - // Wire name: 'last_processed_commit_version' LastProcessedCommitVersion int64 `json:"last_processed_commit_version,omitempty"` // The timestamp of the last time any data was synchronized from the source // table to the online table. Only populated if the table is still online // and available for serving. - // Wire name: 'timestamp' Timestamp string `json:"timestamp,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *FailedStatus) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &failedStatusPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := failedStatusFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *FailedStatus) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st FailedStatus) MarshalJSON() ([]byte, error) { - pb, err := failedStatusToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s FailedStatus) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type FileEventQueue struct { - - // Wire name: 'managed_aqs' ManagedAqs *AzureQueueStorage `json:"managed_aqs,omitempty"` - // Wire name: 'managed_pubsub' ManagedPubsub *GcpPubsub `json:"managed_pubsub,omitempty"` - // Wire name: 'managed_sqs' ManagedSqs *AwsSqsQueue `json:"managed_sqs,omitempty"` - // Wire name: 'provided_aqs' ProvidedAqs *AzureQueueStorage `json:"provided_aqs,omitempty"` - // Wire name: 'provided_pubsub' ProvidedPubsub *GcpPubsub `json:"provided_pubsub,omitempty"` - // Wire name: 'provided_sqs' ProvidedSqs *AwsSqsQueue `json:"provided_sqs,omitempty"` } -func (st *FileEventQueue) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &fileEventQueuePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := fileEventQueueFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st FileEventQueue) MarshalJSON() ([]byte, error) { - pb, err := fileEventQueueToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type ForeignKeyConstraint struct { // Column names for this constraint. - // Wire name: 'child_columns' ChildColumns []string `json:"child_columns"` // The name of the constraint. - // Wire name: 'name' Name string `json:"name"` // Column names for this constraint. - // Wire name: 'parent_columns' ParentColumns []string `json:"parent_columns"` // The full name of the parent constraint. - // Wire name: 'parent_table' ParentTable string `json:"parent_table"` } -func (st *ForeignKeyConstraint) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &foreignKeyConstraintPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := foreignKeyConstraintFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ForeignKeyConstraint) MarshalJSON() ([]byte, error) { - pb, err := foreignKeyConstraintToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // A function that is dependent on a SQL object. type FunctionDependency struct { // Full name of the dependent function, in the form of // __catalog_name__.__schema_name__.__function_name__. - // Wire name: 'function_full_name' FunctionFullName string `json:"function_full_name"` } -func (st *FunctionDependency) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &functionDependencyPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := functionDependencyFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st FunctionDependency) MarshalJSON() ([]byte, error) { - pb, err := functionDependencyToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type FunctionInfo struct { // Indicates whether the principal is limited to retrieving metadata for the // associated object through the BROWSE privilege when include_browse is // enabled in the request. - // Wire name: 'browse_only' BrowseOnly bool `json:"browse_only,omitempty"` // Name of parent catalog. - // Wire name: 'catalog_name' CatalogName string `json:"catalog_name,omitempty"` // User-provided free-form text description. - // Wire name: 'comment' Comment string `json:"comment,omitempty"` // Time at which this function was created, in epoch milliseconds. - // Wire name: 'created_at' CreatedAt int64 `json:"created_at,omitempty"` // Username of function creator. - // Wire name: 'created_by' CreatedBy string `json:"created_by,omitempty"` // Scalar function return data type. - // Wire name: 'data_type' DataType ColumnTypeName `json:"data_type,omitempty"` // External function language. - // Wire name: 'external_language' ExternalLanguage string `json:"external_language,omitempty"` // External function name. - // Wire name: 'external_name' ExternalName string `json:"external_name,omitempty"` // Pretty printed function data type. - // Wire name: 'full_data_type' FullDataType string `json:"full_data_type,omitempty"` // Full name of function, in form of // __catalog_name__.__schema_name__.__function__name__ - // Wire name: 'full_name' FullName string `json:"full_name,omitempty"` // Id of Function, relative to parent schema. - // Wire name: 'function_id' FunctionId string `json:"function_id,omitempty"` - // Wire name: 'input_params' InputParams *FunctionParameterInfos `json:"input_params,omitempty"` // Whether the function is deterministic. - // Wire name: 'is_deterministic' IsDeterministic bool `json:"is_deterministic,omitempty"` // Function null call. - // Wire name: 'is_null_call' IsNullCall bool `json:"is_null_call,omitempty"` // Unique identifier of parent metastore. - // Wire name: 'metastore_id' MetastoreId string `json:"metastore_id,omitempty"` // Name of function, relative to parent schema. - // Wire name: 'name' Name string `json:"name,omitempty"` // Username of current owner of function. - // Wire name: 'owner' Owner string `json:"owner,omitempty"` // Function parameter style. **S** is the value for SQL. - // Wire name: 'parameter_style' ParameterStyle FunctionInfoParameterStyle `json:"parameter_style,omitempty"` // JSON-serialized key-value pair map, encoded (escaped) as a string. - // Wire name: 'properties' Properties string `json:"properties,omitempty"` // Table function return parameters. - // Wire name: 'return_params' ReturnParams *FunctionParameterInfos `json:"return_params,omitempty"` // Function language. When **EXTERNAL** is used, the language of the routine // function should be specified in the __external_language__ field, and the // __return_params__ of the function cannot be used (as **TABLE** return // type is not supported), and the __sql_data_access__ field must be // **NO_SQL**. - // Wire name: 'routine_body' RoutineBody FunctionInfoRoutineBody `json:"routine_body,omitempty"` // Function body. - // Wire name: 'routine_definition' RoutineDefinition string `json:"routine_definition,omitempty"` // Function dependencies. - // Wire name: 'routine_dependencies' RoutineDependencies *DependencyList `json:"routine_dependencies,omitempty"` // Name of parent schema relative to its parent catalog. - // Wire name: 'schema_name' SchemaName string `json:"schema_name,omitempty"` // Function security type. - // Wire name: 'security_type' SecurityType FunctionInfoSecurityType `json:"security_type,omitempty"` // Specific name of the function; Reserved for future use. - // Wire name: 'specific_name' SpecificName string `json:"specific_name,omitempty"` // Function SQL data access. - // Wire name: 'sql_data_access' SqlDataAccess FunctionInfoSqlDataAccess `json:"sql_data_access,omitempty"` // List of schemes whose objects can be referenced without qualification. - // Wire name: 'sql_path' SqlPath string `json:"sql_path,omitempty"` // Time at which this function was created, in epoch milliseconds. - // Wire name: 'updated_at' UpdatedAt int64 `json:"updated_at,omitempty"` // Username of user who last modified function. - // Wire name: 'updated_by' UpdatedBy string `json:"updated_by,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *FunctionInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &functionInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := functionInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *FunctionInfo) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st FunctionInfo) MarshalJSON() ([]byte, error) { - pb, err := functionInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s FunctionInfo) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Function parameter style. **S** is the value for SQL. @@ -4910,102 +2627,47 @@ func (f *FunctionInfoSqlDataAccess) Type() string { type FunctionParameterInfo struct { // User-provided free-form text description. - // Wire name: 'comment' Comment string `json:"comment,omitempty"` // Name of parameter. - // Wire name: 'name' Name string `json:"name"` // Default value of the parameter. - // Wire name: 'parameter_default' ParameterDefault string `json:"parameter_default,omitempty"` // The mode of the function parameter. - // Wire name: 'parameter_mode' ParameterMode FunctionParameterMode `json:"parameter_mode,omitempty"` // The type of function parameter. - // Wire name: 'parameter_type' ParameterType FunctionParameterType `json:"parameter_type,omitempty"` // Ordinal position of column (starting at position 0). - // Wire name: 'position' Position int `json:"position"` // Format of IntervalType. - // Wire name: 'type_interval_type' TypeIntervalType string `json:"type_interval_type,omitempty"` // Full data type spec, JSON-serialized. - // Wire name: 'type_json' TypeJson string `json:"type_json,omitempty"` - // Wire name: 'type_name' TypeName ColumnTypeName `json:"type_name"` // Digits of precision; required on Create for DecimalTypes. - // Wire name: 'type_precision' TypePrecision int `json:"type_precision,omitempty"` // Digits to right of decimal; Required on Create for DecimalTypes. - // Wire name: 'type_scale' TypeScale int `json:"type_scale,omitempty"` // Full data type spec, SQL/catalogString text. - // Wire name: 'type_text' TypeText string `json:"type_text"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *FunctionParameterInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &functionParameterInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := functionParameterInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *FunctionParameterInfo) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st FunctionParameterInfo) MarshalJSON() ([]byte, error) { - pb, err := functionParameterInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s FunctionParameterInfo) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type FunctionParameterInfos struct { // The array of __FunctionParameterInfo__ definitions of the function's // parameters. - // Wire name: 'parameters' Parameters []FunctionParameterInfo `json:"parameters,omitempty"` } -func (st *FunctionParameterInfos) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &functionParameterInfosPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := functionParameterInfosFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st FunctionParameterInfos) MarshalJSON() ([]byte, error) { - pb, err := functionParameterInfosToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // The mode of the function parameter. type FunctionParameterMode string @@ -5082,75 +2744,37 @@ func (f *FunctionParameterType) Type() string { // GCP temporary credentials for API authentication. Read more at // https://developers.google.com/identity/protocols/oauth2/service-account type GcpOauthToken struct { - - // Wire name: 'oauth_token' OauthToken string `json:"oauth_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GcpOauthToken) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &gcpOauthTokenPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := gcpOauthTokenFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GcpOauthToken) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GcpOauthToken) MarshalJSON() ([]byte, error) { - pb, err := gcpOauthTokenToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GcpOauthToken) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type GcpPubsub struct { // Unique identifier included in the name of file events managed cloud // resources. - // Wire name: 'managed_resource_id' ManagedResourceId string `json:"managed_resource_id,omitempty"` // The Pub/Sub subscription name in the format // projects/{project}/subscriptions/{subscription name} REQUIRED for // provided_pubsub. - // Wire name: 'subscription_name' SubscriptionName string `json:"subscription_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GcpPubsub) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &gcpPubsubPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := gcpPubsubFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GcpPubsub) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GcpPubsub) MarshalJSON() ([]byte, error) { - pb, err := gcpPubsubToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GcpPubsub) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The Azure cloud options to customize the requested temporary credential @@ -5158,327 +2782,104 @@ type GenerateTemporaryServiceCredentialAzureOptions struct { // The resources to which the temporary Azure credential should apply. These // resources are the scopes that are passed to the token provider (see // https://learn.microsoft.com/python/api/azure-core/azure.core.credentials.tokencredential?view=azure-python) - // Wire name: 'resources' Resources []string `json:"resources,omitempty"` } -func (st *GenerateTemporaryServiceCredentialAzureOptions) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &generateTemporaryServiceCredentialAzureOptionsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := generateTemporaryServiceCredentialAzureOptionsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GenerateTemporaryServiceCredentialAzureOptions) MarshalJSON() ([]byte, error) { - pb, err := generateTemporaryServiceCredentialAzureOptionsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // The GCP cloud options to customize the requested temporary credential type GenerateTemporaryServiceCredentialGcpOptions struct { // The scopes to which the temporary GCP credential should apply. These // resources are the scopes that are passed to the token provider (see // https://google-auth.readthedocs.io/en/latest/reference/google.auth.html#google.auth.credentials.Credentials) - // Wire name: 'scopes' Scopes []string `json:"scopes,omitempty"` } -func (st *GenerateTemporaryServiceCredentialGcpOptions) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &generateTemporaryServiceCredentialGcpOptionsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := generateTemporaryServiceCredentialGcpOptionsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GenerateTemporaryServiceCredentialGcpOptions) MarshalJSON() ([]byte, error) { - pb, err := generateTemporaryServiceCredentialGcpOptionsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type GenerateTemporaryServiceCredentialRequest struct { // The Azure cloud options to customize the requested temporary credential - // Wire name: 'azure_options' AzureOptions *GenerateTemporaryServiceCredentialAzureOptions `json:"azure_options,omitempty"` // The name of the service credential used to generate a temporary // credential - // Wire name: 'credential_name' CredentialName string `json:"credential_name"` // The GCP cloud options to customize the requested temporary credential - // Wire name: 'gcp_options' GcpOptions *GenerateTemporaryServiceCredentialGcpOptions `json:"gcp_options,omitempty"` } -func (st *GenerateTemporaryServiceCredentialRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &generateTemporaryServiceCredentialRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := generateTemporaryServiceCredentialRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GenerateTemporaryServiceCredentialRequest) MarshalJSON() ([]byte, error) { - pb, err := generateTemporaryServiceCredentialRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type GenerateTemporaryTableCredentialRequest struct { // The operation performed against the table data, either READ or // READ_WRITE. If READ_WRITE is specified, the credentials returned will // have write permissions, otherwise, it will be read only. - // Wire name: 'operation' Operation TableOperation `json:"operation,omitempty"` // UUID of the table to read or write. - // Wire name: 'table_id' TableId string `json:"table_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GenerateTemporaryTableCredentialRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &generateTemporaryTableCredentialRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := generateTemporaryTableCredentialRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GenerateTemporaryTableCredentialRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GenerateTemporaryTableCredentialRequest) MarshalJSON() ([]byte, error) { - pb, err := generateTemporaryTableCredentialRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GenerateTemporaryTableCredentialRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type GenerateTemporaryTableCredentialResponse struct { // AWS temporary credentials for API authentication. Read more at // https://docs.aws.amazon.com/STS/latest/APIReference/API_Credentials.html. - // Wire name: 'aws_temp_credentials' AwsTempCredentials *AwsCredentials `json:"aws_temp_credentials,omitempty"` // Azure Active Directory token, essentially the Oauth token for Azure // Service Principal or Managed Identity. Read more at // https://learn.microsoft.com/en-us/azure/databricks/dev-tools/api/latest/aad/service-prin-aad-token - // Wire name: 'azure_aad' AzureAad *AzureActiveDirectoryToken `json:"azure_aad,omitempty"` // Azure temporary credentials for API authentication. Read more at // https://docs.microsoft.com/en-us/rest/api/storageservices/create-user-delegation-sas - // Wire name: 'azure_user_delegation_sas' AzureUserDelegationSas *AzureUserDelegationSas `json:"azure_user_delegation_sas,omitempty"` // Server time when the credential will expire, in epoch milliseconds. The // API client is advised to cache the credential given this expiration time. - // Wire name: 'expiration_time' ExpirationTime int64 `json:"expiration_time,omitempty"` // GCP temporary credentials for API authentication. Read more at // https://developers.google.com/identity/protocols/oauth2/service-account - // Wire name: 'gcp_oauth_token' GcpOauthToken *GcpOauthToken `json:"gcp_oauth_token,omitempty"` // R2 temporary credentials for API authentication. Read more at // https://developers.cloudflare.com/r2/api/s3/tokens/. - // Wire name: 'r2_temp_credentials' R2TempCredentials *R2Credentials `json:"r2_temp_credentials,omitempty"` // The URL of the storage path accessible by the temporary credential. - // Wire name: 'url' Url string `json:"url,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GenerateTemporaryTableCredentialResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &generateTemporaryTableCredentialResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := generateTemporaryTableCredentialResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GenerateTemporaryTableCredentialResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GenerateTemporaryTableCredentialResponse) MarshalJSON() ([]byte, error) { - pb, err := generateTemporaryTableCredentialResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GenerateTemporaryTableCredentialResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Gets the metastore assignment for a workspace type GetAccountMetastoreAssignmentRequest struct { // Workspace ID. - WorkspaceId int64 `json:"-" tf:"-"` -} - -func (st *GetAccountMetastoreAssignmentRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getAccountMetastoreAssignmentRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getAccountMetastoreAssignmentRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetAccountMetastoreAssignmentRequest) MarshalJSON() ([]byte, error) { - pb, err := getAccountMetastoreAssignmentRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + WorkspaceId int64 `json:"-" url:"-"` } // Get a metastore type GetAccountMetastoreRequest struct { // Unity Catalog metastore ID - MetastoreId string `json:"-" tf:"-"` -} - -func (st *GetAccountMetastoreRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getAccountMetastoreRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getAccountMetastoreRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetAccountMetastoreRequest) MarshalJSON() ([]byte, error) { - pb, err := getAccountMetastoreRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + MetastoreId string `json:"-" url:"-"` } // Gets the named storage credential type GetAccountStorageCredentialRequest struct { // Unity Catalog metastore ID - MetastoreId string `json:"-" tf:"-"` + MetastoreId string `json:"-" url:"-"` // Name of the storage credential. - StorageCredentialName string `json:"-" tf:"-"` -} - -func (st *GetAccountStorageCredentialRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getAccountStorageCredentialRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getAccountStorageCredentialRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetAccountStorageCredentialRequest) MarshalJSON() ([]byte, error) { - pb, err := getAccountStorageCredentialRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + StorageCredentialName string `json:"-" url:"-"` } // Get an artifact allowlist type GetArtifactAllowlistRequest struct { // The artifact type of the allowlist. - ArtifactType ArtifactType `json:"-" tf:"-"` -} - -func (st *GetArtifactAllowlistRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getArtifactAllowlistRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getArtifactAllowlistRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetArtifactAllowlistRequest) MarshalJSON() ([]byte, error) { - pb, err := getArtifactAllowlistRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + ArtifactType ArtifactType `json:"-" url:"-"` } // Get securable workspace bindings @@ -5489,214 +2890,87 @@ type GetBindingsRequest struct { // server configured value; - When set to a value less than 0, an invalid // parameter error is returned; - If not set, all the workspace bindings are // returned (not recommended). - MaxResults int `json:"-" tf:"-"` + MaxResults int `json:"-" url:"max_results,omitempty"` // Opaque pagination token to go to next page based on previous query. - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` // The name of the securable. - SecurableName string `json:"-" tf:"-"` + SecurableName string `json:"-" url:"-"` // The type of the securable to bind to a workspace (catalog, // storage_credential, credential, or external_location). - SecurableType string `json:"-" tf:"-"` + SecurableType string `json:"-" url:"-"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetBindingsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getBindingsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getBindingsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetBindingsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetBindingsRequest) MarshalJSON() ([]byte, error) { - pb, err := getBindingsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetBindingsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get Model Version By Alias type GetByAliasRequest struct { // The name of the alias - Alias string `json:"-" tf:"-"` + Alias string `json:"-" url:"-"` // The three-level (fully qualified) name of the registered model - FullName string `json:"-" tf:"-"` + FullName string `json:"-" url:"-"` // Whether to include aliases associated with the model version in the // response - IncludeAliases bool `json:"-" tf:"-"` + IncludeAliases bool `json:"-" url:"include_aliases,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetByAliasRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getByAliasRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getByAliasRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetByAliasRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetByAliasRequest) MarshalJSON() ([]byte, error) { - pb, err := getByAliasRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetByAliasRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get a catalog type GetCatalogRequest struct { // Whether to include catalogs in the response for which the principal can // only access selective metadata for - IncludeBrowse bool `json:"-" tf:"-"` + IncludeBrowse bool `json:"-" url:"include_browse,omitempty"` // The name of the catalog. - Name string `json:"-" tf:"-"` + Name string `json:"-" url:"-"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetCatalogRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getCatalogRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getCatalogRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetCatalogRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetCatalogRequest) MarshalJSON() ([]byte, error) { - pb, err := getCatalogRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetCatalogRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type GetCatalogWorkspaceBindingsResponse struct { // A list of workspace IDs - // Wire name: 'workspaces' Workspaces []int64 `json:"workspaces,omitempty"` } -func (st *GetCatalogWorkspaceBindingsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getCatalogWorkspaceBindingsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getCatalogWorkspaceBindingsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetCatalogWorkspaceBindingsResponse) MarshalJSON() ([]byte, error) { - pb, err := getCatalogWorkspaceBindingsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Get a connection type GetConnectionRequest struct { // Name of the connection. - Name string `json:"-" tf:"-"` -} - -func (st *GetConnectionRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getConnectionRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getConnectionRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetConnectionRequest) MarshalJSON() ([]byte, error) { - pb, err := getConnectionRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Name string `json:"-" url:"-"` } // Get a credential type GetCredentialRequest struct { // Name of the credential. - NameArg string `json:"-" tf:"-"` -} - -func (st *GetCredentialRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getCredentialRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getCredentialRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetCredentialRequest) MarshalJSON() ([]byte, error) { - pb, err := getCredentialRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + NameArg string `json:"-" url:"-"` } // Get effective permissions type GetEffectiveRequest struct { // Full name of securable. - FullName string `json:"-" tf:"-"` + FullName string `json:"-" url:"-"` // Specifies the maximum number of privileges to return (page length). Every // EffectivePrivilegeAssignment present in a single page response is // guaranteed to contain all the effective privileges granted on (or @@ -5709,120 +2983,69 @@ type GetEffectiveRequest struct { // one complete EffectivePrivilegeAssignment in a single page response) - // greater than (or equal to) 150: page length is the minimum of this value // and a server configured value - MaxResults int `json:"-" tf:"-"` + MaxResults int `json:"-" url:"max_results,omitempty"` // Opaque token for the next page of results (pagination). - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` // If provided, only the effective permissions for the specified principal // (user or group) are returned. - Principal string `json:"-" tf:"-"` + Principal string `json:"-" url:"principal,omitempty"` // Type of securable. - SecurableType string `json:"-" tf:"-"` + SecurableType string `json:"-" url:"-"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetEffectiveRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getEffectiveRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getEffectiveRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetEffectiveRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetEffectiveRequest) MarshalJSON() ([]byte, error) { - pb, err := getEffectiveRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetEffectiveRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get an external location type GetExternalLocationRequest struct { // Whether to include external locations in the response for which the // principal can only access selective metadata for - IncludeBrowse bool `json:"-" tf:"-"` + IncludeBrowse bool `json:"-" url:"include_browse,omitempty"` // Name of the external location. - Name string `json:"-" tf:"-"` + Name string `json:"-" url:"-"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetExternalLocationRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getExternalLocationRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getExternalLocationRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetExternalLocationRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetExternalLocationRequest) MarshalJSON() ([]byte, error) { - pb, err := getExternalLocationRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetExternalLocationRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get a function type GetFunctionRequest struct { // Whether to include functions in the response for which the principal can // only access selective metadata for - IncludeBrowse bool `json:"-" tf:"-"` + IncludeBrowse bool `json:"-" url:"include_browse,omitempty"` // The fully-qualified name of the function (of the form // __catalog_name__.__schema_name__.__function__name__). - Name string `json:"-" tf:"-"` + Name string `json:"-" url:"-"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetFunctionRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getFunctionRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getFunctionRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetFunctionRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetFunctionRequest) MarshalJSON() ([]byte, error) { - pb, err := getFunctionRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetFunctionRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get permissions type GetGrantRequest struct { // Full name of securable. - FullName string `json:"-" tf:"-"` + FullName string `json:"-" url:"-"` // Specifies the maximum number of privileges to return (page length). Every // PrivilegeAssignment present in a single page response is guaranteed to // contain all the privileges granted on the requested Securable for the @@ -5835,619 +3058,259 @@ type GetGrantRequest struct { // PrivilegeAssignment in a single page response) - greater than (or equal // to) 150: page length is the minimum of this value and a server configured // value - MaxResults int `json:"-" tf:"-"` + MaxResults int `json:"-" url:"max_results,omitempty"` // Opaque pagination token to go to next page based on previous query. - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` // If provided, only the permissions for the specified principal (user or // group) are returned. - Principal string `json:"-" tf:"-"` + Principal string `json:"-" url:"principal,omitempty"` // Type of securable. - SecurableType string `json:"-" tf:"-"` + SecurableType string `json:"-" url:"-"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetGrantRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getGrantRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getGrantRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetGrantRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetGrantRequest) MarshalJSON() ([]byte, error) { - pb, err := getGrantRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetGrantRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get a metastore type GetMetastoreRequest struct { // Unique ID of the metastore. - Id string `json:"-" tf:"-"` -} - -func (st *GetMetastoreRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getMetastoreRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getMetastoreRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetMetastoreRequest) MarshalJSON() ([]byte, error) { - pb, err := getMetastoreRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Id string `json:"-" url:"-"` } type GetMetastoreSummaryResponse struct { // Cloud vendor of the metastore home shard (e.g., `aws`, `azure`, `gcp`). - // Wire name: 'cloud' Cloud string `json:"cloud,omitempty"` // Time at which this metastore was created, in epoch milliseconds. - // Wire name: 'created_at' CreatedAt int64 `json:"created_at,omitempty"` // Username of metastore creator. - // Wire name: 'created_by' CreatedBy string `json:"created_by,omitempty"` // Unique identifier of the metastore's (Default) Data Access Configuration. - // Wire name: 'default_data_access_config_id' DefaultDataAccessConfigId string `json:"default_data_access_config_id,omitempty"` // The organization name of a Delta Sharing entity, to be used in // Databricks-to-Databricks Delta Sharing as the official name. - // Wire name: 'delta_sharing_organization_name' DeltaSharingOrganizationName string `json:"delta_sharing_organization_name,omitempty"` // The lifetime of delta sharing recipient token in seconds. - // Wire name: 'delta_sharing_recipient_token_lifetime_in_seconds' DeltaSharingRecipientTokenLifetimeInSeconds int64 `json:"delta_sharing_recipient_token_lifetime_in_seconds,omitempty"` // The scope of Delta Sharing enabled for the metastore. - // Wire name: 'delta_sharing_scope' DeltaSharingScope DeltaSharingScopeEnum `json:"delta_sharing_scope,omitempty"` // Whether to allow non-DBR clients to directly access entities under the // metastore. - // Wire name: 'external_access_enabled' ExternalAccessEnabled bool `json:"external_access_enabled,omitempty"` // Globally unique metastore ID across clouds and regions, of the form // `cloud:region:metastore_id`. - // Wire name: 'global_metastore_id' GlobalMetastoreId string `json:"global_metastore_id,omitempty"` // Unique identifier of metastore. - // Wire name: 'metastore_id' MetastoreId string `json:"metastore_id,omitempty"` // The user-specified name of the metastore. - // Wire name: 'name' Name string `json:"name,omitempty"` // The owner of the metastore. - // Wire name: 'owner' Owner string `json:"owner,omitempty"` // Privilege model version of the metastore, of the form `major.minor` // (e.g., `1.0`). - // Wire name: 'privilege_model_version' PrivilegeModelVersion string `json:"privilege_model_version,omitempty"` // Cloud region which the metastore serves (e.g., `us-west-2`, `westus`). - // Wire name: 'region' Region string `json:"region,omitempty"` // The storage root URL for metastore - // Wire name: 'storage_root' StorageRoot string `json:"storage_root,omitempty"` // UUID of storage credential to access the metastore storage_root. - // Wire name: 'storage_root_credential_id' StorageRootCredentialId string `json:"storage_root_credential_id,omitempty"` // Name of the storage credential to access the metastore storage_root. - // Wire name: 'storage_root_credential_name' StorageRootCredentialName string `json:"storage_root_credential_name,omitempty"` // Time at which the metastore was last modified, in epoch milliseconds. - // Wire name: 'updated_at' UpdatedAt int64 `json:"updated_at,omitempty"` // Username of user who last modified the metastore. - // Wire name: 'updated_by' UpdatedBy string `json:"updated_by,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetMetastoreSummaryResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getMetastoreSummaryResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getMetastoreSummaryResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetMetastoreSummaryResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetMetastoreSummaryResponse) MarshalJSON() ([]byte, error) { - pb, err := getMetastoreSummaryResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetMetastoreSummaryResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get a Model Version type GetModelVersionRequest struct { // The three-level (fully qualified) name of the model version - FullName string `json:"-" tf:"-"` + FullName string `json:"-" url:"-"` // Whether to include aliases associated with the model version in the // response - IncludeAliases bool `json:"-" tf:"-"` + IncludeAliases bool `json:"-" url:"include_aliases,omitempty"` // Whether to include model versions in the response for which the principal // can only access selective metadata for - IncludeBrowse bool `json:"-" tf:"-"` + IncludeBrowse bool `json:"-" url:"include_browse,omitempty"` // The integer version number of the model version - Version int `json:"-" tf:"-"` + Version int `json:"-" url:"-"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetModelVersionRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getModelVersionRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getModelVersionRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetModelVersionRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetModelVersionRequest) MarshalJSON() ([]byte, error) { - pb, err := getModelVersionRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetModelVersionRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get an Online Table type GetOnlineTableRequest struct { // Full three-part (catalog, schema, table) name of the table. - Name string `json:"-" tf:"-"` -} - -func (st *GetOnlineTableRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getOnlineTableRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getOnlineTableRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetOnlineTableRequest) MarshalJSON() ([]byte, error) { - pb, err := getOnlineTableRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Name string `json:"-" url:"-"` } type GetPermissionsResponse struct { // Opaque token to retrieve the next page of results. Absent if there are no // more pages. __page_token__ should be set to this value for the next // request (for the next page of results). - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` // The privileges assigned to each principal - // Wire name: 'privilege_assignments' PrivilegeAssignments []PrivilegeAssignment `json:"privilege_assignments,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetPermissionsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getPermissionsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getPermissionsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetPermissionsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetPermissionsResponse) MarshalJSON() ([]byte, error) { - pb, err := getPermissionsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetPermissionsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get a table monitor type GetQualityMonitorRequest struct { // Full name of the table. - TableName string `json:"-" tf:"-"` -} - -func (st *GetQualityMonitorRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getQualityMonitorRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getQualityMonitorRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetQualityMonitorRequest) MarshalJSON() ([]byte, error) { - pb, err := getQualityMonitorRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + TableName string `json:"-" url:"-"` } // Get information for a single resource quota. type GetQuotaRequest struct { // Full name of the parent resource. Provide the metastore ID if the parent // is a metastore. - ParentFullName string `json:"-" tf:"-"` + ParentFullName string `json:"-" url:"-"` // Securable type of the quota parent. - ParentSecurableType string `json:"-" tf:"-"` + ParentSecurableType string `json:"-" url:"-"` // Name of the quota. Follows the pattern of the quota type, with "-quota" // added as a suffix. - QuotaName string `json:"-" tf:"-"` -} - -func (st *GetQuotaRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getQuotaRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getQuotaRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetQuotaRequest) MarshalJSON() ([]byte, error) { - pb, err := getQuotaRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + QuotaName string `json:"-" url:"-"` } type GetQuotaResponse struct { // The returned QuotaInfo. - // Wire name: 'quota_info' QuotaInfo *QuotaInfo `json:"quota_info,omitempty"` } -func (st *GetQuotaResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getQuotaResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getQuotaResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetQuotaResponse) MarshalJSON() ([]byte, error) { - pb, err := getQuotaResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Get refresh type GetRefreshRequest struct { // ID of the refresh. - RefreshId string `json:"-" tf:"-"` + RefreshId string `json:"-" url:"-"` // Full name of the table. - TableName string `json:"-" tf:"-"` -} - -func (st *GetRefreshRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getRefreshRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getRefreshRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetRefreshRequest) MarshalJSON() ([]byte, error) { - pb, err := getRefreshRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + TableName string `json:"-" url:"-"` } // Get a Registered Model type GetRegisteredModelRequest struct { // The three-level (fully qualified) name of the registered model - FullName string `json:"-" tf:"-"` + FullName string `json:"-" url:"-"` // Whether to include registered model aliases in the response - IncludeAliases bool `json:"-" tf:"-"` + IncludeAliases bool `json:"-" url:"include_aliases,omitempty"` // Whether to include registered models in the response for which the // principal can only access selective metadata for - IncludeBrowse bool `json:"-" tf:"-"` + IncludeBrowse bool `json:"-" url:"include_browse,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetRegisteredModelRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getRegisteredModelRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getRegisteredModelRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetRegisteredModelRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetRegisteredModelRequest) MarshalJSON() ([]byte, error) { - pb, err := getRegisteredModelRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetRegisteredModelRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get a schema type GetSchemaRequest struct { // Full name of the schema. - FullName string `json:"-" tf:"-"` + FullName string `json:"-" url:"-"` // Whether to include schemas in the response for which the principal can // only access selective metadata for - IncludeBrowse bool `json:"-" tf:"-"` + IncludeBrowse bool `json:"-" url:"include_browse,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetSchemaRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getSchemaRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getSchemaRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetSchemaRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetSchemaRequest) MarshalJSON() ([]byte, error) { - pb, err := getSchemaRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetSchemaRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get a credential type GetStorageCredentialRequest struct { // Name of the storage credential. - Name string `json:"-" tf:"-"` -} - -func (st *GetStorageCredentialRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getStorageCredentialRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getStorageCredentialRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetStorageCredentialRequest) MarshalJSON() ([]byte, error) { - pb, err := getStorageCredentialRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Name string `json:"-" url:"-"` } // Get a table type GetTableRequest struct { // Full name of the table. - FullName string `json:"-" tf:"-"` + FullName string `json:"-" url:"-"` // Whether to include tables in the response for which the principal can // only access selective metadata for - IncludeBrowse bool `json:"-" tf:"-"` + IncludeBrowse bool `json:"-" url:"include_browse,omitempty"` // Whether delta metadata should be included in the response. - IncludeDeltaMetadata bool `json:"-" tf:"-"` + IncludeDeltaMetadata bool `json:"-" url:"include_delta_metadata,omitempty"` // Whether to include a manifest containing capabilities the table has. - IncludeManifestCapabilities bool `json:"-" tf:"-"` + IncludeManifestCapabilities bool `json:"-" url:"include_manifest_capabilities,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetTableRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getTableRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getTableRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetTableRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetTableRequest) MarshalJSON() ([]byte, error) { - pb, err := getTableRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetTableRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get catalog workspace bindings type GetWorkspaceBindingRequest struct { // The name of the catalog. - Name string `json:"-" tf:"-"` -} - -func (st *GetWorkspaceBindingRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getWorkspaceBindingRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getWorkspaceBindingRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetWorkspaceBindingRequest) MarshalJSON() ([]byte, error) { - pb, err := getWorkspaceBindingRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Name string `json:"-" url:"-"` } type GetWorkspaceBindingsResponse struct { // List of workspace bindings - // Wire name: 'bindings' Bindings []WorkspaceBinding `json:"bindings,omitempty"` // Opaque token to retrieve the next page of results. Absent if there are no // more pages. __page_token__ should be set to this value for the next // request (for the next page of results). - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetWorkspaceBindingsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getWorkspaceBindingsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getWorkspaceBindingsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetWorkspaceBindingsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetWorkspaceBindingsResponse) MarshalJSON() ([]byte, error) { - pb, err := getWorkspaceBindingsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetWorkspaceBindingsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type IsolationMode string @@ -6490,133 +3353,30 @@ func (f *IsolationMode) Type() string { // Get all workspaces assigned to a metastore type ListAccountMetastoreAssignmentsRequest struct { // Unity Catalog metastore ID - MetastoreId string `json:"-" tf:"-"` -} - -func (st *ListAccountMetastoreAssignmentsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listAccountMetastoreAssignmentsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listAccountMetastoreAssignmentsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ListAccountMetastoreAssignmentsRequest) MarshalJSON() ([]byte, error) { - pb, err := listAccountMetastoreAssignmentsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + MetastoreId string `json:"-" url:"-"` } // The list of workspaces to which the given metastore is assigned. type ListAccountMetastoreAssignmentsResponse struct { - - // Wire name: 'workspace_ids' WorkspaceIds []int64 `json:"workspace_ids,omitempty"` } -func (st *ListAccountMetastoreAssignmentsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listAccountMetastoreAssignmentsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listAccountMetastoreAssignmentsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ListAccountMetastoreAssignmentsResponse) MarshalJSON() ([]byte, error) { - pb, err := listAccountMetastoreAssignmentsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Get all storage credentials assigned to a metastore type ListAccountStorageCredentialsRequest struct { // Unity Catalog metastore ID - MetastoreId string `json:"-" tf:"-"` -} - -func (st *ListAccountStorageCredentialsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listAccountStorageCredentialsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listAccountStorageCredentialsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ListAccountStorageCredentialsRequest) MarshalJSON() ([]byte, error) { - pb, err := listAccountStorageCredentialsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + MetastoreId string `json:"-" url:"-"` } type ListAccountStorageCredentialsResponse struct { // An array of metastore storage credentials. - // Wire name: 'storage_credentials' StorageCredentials []StorageCredentialInfo `json:"storage_credentials,omitempty"` } -func (st *ListAccountStorageCredentialsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listAccountStorageCredentialsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listAccountStorageCredentialsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ListAccountStorageCredentialsResponse) MarshalJSON() ([]byte, error) { - pb, err := listAccountStorageCredentialsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // List catalogs type ListCatalogsRequest struct { // Whether to include catalogs in the response for which the principal can // only access selective metadata for - IncludeBrowse bool `json:"-" tf:"-"` + IncludeBrowse bool `json:"-" url:"include_browse,omitempty"` // Maximum number of catalogs to return. - when set to 0, the page length is // set to a server configured value (recommended); - when set to a value // greater than 0, the page length is the minimum of this value and a server @@ -6626,74 +3386,38 @@ type ListCatalogsRequest struct { // the specified max_results size, even zero. The only definitive indication // that no further catalogs can be fetched is when the next_page_token is // unset from the response. - MaxResults int `json:"-" tf:"-"` + MaxResults int `json:"-" url:"max_results,omitempty"` // Opaque pagination token to go to next page based on previous query. - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListCatalogsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listCatalogsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listCatalogsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListCatalogsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListCatalogsRequest) MarshalJSON() ([]byte, error) { - pb, err := listCatalogsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListCatalogsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListCatalogsResponse struct { // An array of catalog information objects. - // Wire name: 'catalogs' Catalogs []CatalogInfo `json:"catalogs,omitempty"` // Opaque token to retrieve the next page of results. Absent if there are no // more pages. __page_token__ should be set to this value for the next // request (for the next page of results). - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListCatalogsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listCatalogsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listCatalogsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListCatalogsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListCatalogsResponse) MarshalJSON() ([]byte, error) { - pb, err := listCatalogsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListCatalogsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // List connections @@ -6704,74 +3428,38 @@ type ListConnectionsRequest struct { // when set to 0, the page length is set to a server configured value // (recommended); - when set to a value less than 0, an invalid parameter // error is returned; - MaxResults int `json:"-" tf:"-"` + MaxResults int `json:"-" url:"max_results,omitempty"` // Opaque pagination token to go to next page based on previous query. - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListConnectionsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listConnectionsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listConnectionsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListConnectionsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListConnectionsRequest) MarshalJSON() ([]byte, error) { - pb, err := listConnectionsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListConnectionsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListConnectionsResponse struct { // An array of connection information objects. - // Wire name: 'connections' Connections []ConnectionInfo `json:"connections,omitempty"` // Opaque token to retrieve the next page of results. Absent if there are no // more pages. __page_token__ should be set to this value for the next // request (for the next page of results). - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListConnectionsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listConnectionsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listConnectionsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListConnectionsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListConnectionsResponse) MarshalJSON() ([]byte, error) { - pb, err := listConnectionsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListConnectionsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // List credentials @@ -6781,242 +3469,133 @@ type ListCredentialsRequest struct { // is the minimum of this value and a server-configured value. - When set to // 0, the page length is set to a server-configured value (recommended). - // When set to a value less than 0, an invalid parameter error is returned. - MaxResults int `json:"-" tf:"-"` + MaxResults int `json:"-" url:"max_results,omitempty"` // Opaque token to retrieve the next page of results. - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` // Return only credentials for the specified purpose. - Purpose CredentialPurpose `json:"-" tf:"-"` + Purpose CredentialPurpose `json:"-" url:"purpose,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListCredentialsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listCredentialsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listCredentialsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListCredentialsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListCredentialsRequest) MarshalJSON() ([]byte, error) { - pb, err := listCredentialsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListCredentialsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListCredentialsResponse struct { - - // Wire name: 'credentials' Credentials []CredentialInfo `json:"credentials,omitempty"` // Opaque token to retrieve the next page of results. Absent if there are no // more pages. __page_token__ should be set to this value for the next // request (for the next page of results). - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListCredentialsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listCredentialsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listCredentialsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListCredentialsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListCredentialsResponse) MarshalJSON() ([]byte, error) { - pb, err := listCredentialsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListCredentialsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // List external locations type ListExternalLocationsRequest struct { // Whether to include external locations in the response for which the // principal can only access selective metadata for - IncludeBrowse bool `json:"-" tf:"-"` + IncludeBrowse bool `json:"-" url:"include_browse,omitempty"` // Maximum number of external locations to return. If not set, all the // external locations are returned (not recommended). - when set to a value // greater than 0, the page length is the minimum of this value and a server // configured value; - when set to 0, the page length is set to a server // configured value (recommended); - when set to a value less than 0, an // invalid parameter error is returned; - MaxResults int `json:"-" tf:"-"` + MaxResults int `json:"-" url:"max_results,omitempty"` // Opaque pagination token to go to next page based on previous query. - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListExternalLocationsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listExternalLocationsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listExternalLocationsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListExternalLocationsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListExternalLocationsRequest) MarshalJSON() ([]byte, error) { - pb, err := listExternalLocationsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListExternalLocationsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListExternalLocationsResponse struct { // An array of external locations. - // Wire name: 'external_locations' ExternalLocations []ExternalLocationInfo `json:"external_locations,omitempty"` // Opaque token to retrieve the next page of results. Absent if there are no // more pages. __page_token__ should be set to this value for the next // request (for the next page of results). - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListExternalLocationsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listExternalLocationsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listExternalLocationsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListExternalLocationsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListExternalLocationsResponse) MarshalJSON() ([]byte, error) { - pb, err := listExternalLocationsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListExternalLocationsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // List functions type ListFunctionsRequest struct { // Name of parent catalog for functions of interest. - CatalogName string `json:"-" tf:"-"` + CatalogName string `json:"-" url:"catalog_name"` // Whether to include functions in the response for which the principal can // only access selective metadata for - IncludeBrowse bool `json:"-" tf:"-"` + IncludeBrowse bool `json:"-" url:"include_browse,omitempty"` // Maximum number of functions to return. If not set, all the functions are // returned (not recommended). - when set to a value greater than 0, the // page length is the minimum of this value and a server configured value; - // when set to 0, the page length is set to a server configured value // (recommended); - when set to a value less than 0, an invalid parameter // error is returned; - MaxResults int `json:"-" tf:"-"` + MaxResults int `json:"-" url:"max_results,omitempty"` // Opaque pagination token to go to next page based on previous query. - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` // Parent schema of functions. - SchemaName string `json:"-" tf:"-"` + SchemaName string `json:"-" url:"schema_name"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListFunctionsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listFunctionsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listFunctionsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListFunctionsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListFunctionsRequest) MarshalJSON() ([]byte, error) { - pb, err := listFunctionsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListFunctionsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListFunctionsResponse struct { // An array of function information objects. - // Wire name: 'functions' Functions []FunctionInfo `json:"functions,omitempty"` // Opaque token to retrieve the next page of results. Absent if there are no // more pages. __page_token__ should be set to this value for the next // request (for the next page of results). - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListFunctionsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listFunctionsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listFunctionsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListFunctionsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListFunctionsResponse) MarshalJSON() ([]byte, error) { - pb, err := listFunctionsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListFunctionsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // List metastores @@ -7030,84 +3609,48 @@ type ListMetastoresRequest struct { // might be less than the specified max_results size, even zero. The only // definitive indication that no further metastores can be fetched is when // the next_page_token is unset from the response. - MaxResults int `json:"-" tf:"-"` + MaxResults int `json:"-" url:"max_results,omitempty"` // Opaque pagination token to go to next page based on previous query. - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListMetastoresRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listMetastoresRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listMetastoresRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListMetastoresRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListMetastoresRequest) MarshalJSON() ([]byte, error) { - pb, err := listMetastoresRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListMetastoresRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListMetastoresResponse struct { // An array of metastore information objects. - // Wire name: 'metastores' Metastores []MetastoreInfo `json:"metastores,omitempty"` // Opaque token to retrieve the next page of results. Absent if there are no // more pages. __page_token__ should be set to this value for the next // request (for the next page of results). - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListMetastoresResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listMetastoresResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listMetastoresResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListMetastoresResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListMetastoresResponse) MarshalJSON() ([]byte, error) { - pb, err := listMetastoresResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListMetastoresResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // List Model Versions type ListModelVersionsRequest struct { // The full three-level name of the registered model under which to list // model versions - FullName string `json:"-" tf:"-"` + FullName string `json:"-" url:"-"` // Whether to include model versions in the response for which the principal // can only access selective metadata for - IncludeBrowse bool `json:"-" tf:"-"` + IncludeBrowse bool `json:"-" url:"include_browse,omitempty"` // Maximum number of model versions to return. If not set, the page length // is set to a server configured value (100, as of 1/3/2024). - when set to // a value greater than 0, the page length is the minimum of this value and @@ -7115,188 +3658,90 @@ type ListModelVersionsRequest struct { // page length is set to a server configured value (100, as of 1/3/2024) // (recommended); - when set to a value less than 0, an invalid parameter // error is returned; - MaxResults int `json:"-" tf:"-"` + MaxResults int `json:"-" url:"max_results,omitempty"` // Opaque pagination token to go to next page based on previous query. - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListModelVersionsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listModelVersionsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listModelVersionsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListModelVersionsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListModelVersionsRequest) MarshalJSON() ([]byte, error) { - pb, err := listModelVersionsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListModelVersionsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListModelVersionsResponse struct { - - // Wire name: 'model_versions' ModelVersions []ModelVersionInfo `json:"model_versions,omitempty"` // Opaque token to retrieve the next page of results. Absent if there are no // more pages. __page_token__ should be set to this value for the next // request (for the next page of results). - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListModelVersionsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listModelVersionsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listModelVersionsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListModelVersionsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListModelVersionsResponse) MarshalJSON() ([]byte, error) { - pb, err := listModelVersionsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListModelVersionsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // List all resource quotas under a metastore. type ListQuotasRequest struct { // The number of quotas to return. - MaxResults int `json:"-" tf:"-"` + MaxResults int `json:"-" url:"max_results,omitempty"` // Opaque token for the next page of results. - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListQuotasRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listQuotasRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listQuotasRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListQuotasRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListQuotasRequest) MarshalJSON() ([]byte, error) { - pb, err := listQuotasRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListQuotasRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListQuotasResponse struct { // Opaque token to retrieve the next page of results. Absent if there are no // more pages. __page_token__ should be set to this value for the next // request. - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` // An array of returned QuotaInfos. - // Wire name: 'quotas' Quotas []QuotaInfo `json:"quotas,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListQuotasResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listQuotasResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listQuotasResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListQuotasResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListQuotasResponse) MarshalJSON() ([]byte, error) { - pb, err := listQuotasResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListQuotasResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // List refreshes type ListRefreshesRequest struct { // Full name of the table. - TableName string `json:"-" tf:"-"` -} - -func (st *ListRefreshesRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listRefreshesRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listRefreshesRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ListRefreshesRequest) MarshalJSON() ([]byte, error) { - pb, err := listRefreshesRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + TableName string `json:"-" url:"-"` } // List Registered Models type ListRegisteredModelsRequest struct { // The identifier of the catalog under which to list registered models. If // specified, schema_name must be specified. - CatalogName string `json:"-" tf:"-"` + CatalogName string `json:"-" url:"catalog_name,omitempty"` // Whether to include registered models in the response for which the // principal can only access selective metadata for - IncludeBrowse bool `json:"-" tf:"-"` + IncludeBrowse bool `json:"-" url:"include_browse,omitempty"` // Max number of registered models to return. // // If both catalog and schema are specified: - when max_results is not @@ -7314,159 +3759,87 @@ type ListRegisteredModelsRequest struct { // 4/2/2024); - when set to 0, the page length is set to a server configured // value (100, as of 4/2/2024); - when set to a value less than 0, an // invalid parameter error is returned; - MaxResults int `json:"-" tf:"-"` + MaxResults int `json:"-" url:"max_results,omitempty"` // Opaque token to send for the next page of results (pagination). - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` // The identifier of the schema under which to list registered models. If // specified, catalog_name must be specified. - SchemaName string `json:"-" tf:"-"` + SchemaName string `json:"-" url:"schema_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListRegisteredModelsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listRegisteredModelsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listRegisteredModelsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListRegisteredModelsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListRegisteredModelsRequest) MarshalJSON() ([]byte, error) { - pb, err := listRegisteredModelsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListRegisteredModelsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListRegisteredModelsResponse struct { // Opaque token for pagination. Omitted if there are no more results. // page_token should be set to this value for fetching the next page. - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` - // Wire name: 'registered_models' RegisteredModels []RegisteredModelInfo `json:"registered_models,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListRegisteredModelsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listRegisteredModelsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listRegisteredModelsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListRegisteredModelsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListRegisteredModelsResponse) MarshalJSON() ([]byte, error) { - pb, err := listRegisteredModelsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListRegisteredModelsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // List schemas type ListSchemasRequest struct { // Parent catalog for schemas of interest. - CatalogName string `json:"-" tf:"-"` + CatalogName string `json:"-" url:"catalog_name"` // Whether to include schemas in the response for which the principal can // only access selective metadata for - IncludeBrowse bool `json:"-" tf:"-"` + IncludeBrowse bool `json:"-" url:"include_browse,omitempty"` // Maximum number of schemas to return. If not set, all the schemas are // returned (not recommended). - when set to a value greater than 0, the // page length is the minimum of this value and a server configured value; - // when set to 0, the page length is set to a server configured value // (recommended); - when set to a value less than 0, an invalid parameter // error is returned; - MaxResults int `json:"-" tf:"-"` + MaxResults int `json:"-" url:"max_results,omitempty"` // Opaque pagination token to go to next page based on previous query. - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListSchemasRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listSchemasRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listSchemasRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListSchemasRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListSchemasRequest) MarshalJSON() ([]byte, error) { - pb, err := listSchemasRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListSchemasRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListSchemasResponse struct { // Opaque token to retrieve the next page of results. Absent if there are no // more pages. __page_token__ should be set to this value for the next // request (for the next page of results). - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` // An array of schema information objects. - // Wire name: 'schemas' Schemas []SchemaInfo `json:"schemas,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListSchemasResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listSchemasResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listSchemasResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListSchemasResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListSchemasResponse) MarshalJSON() ([]byte, error) { - pb, err := listSchemasResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListSchemasResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // List credentials @@ -7477,82 +3850,46 @@ type ListStorageCredentialsRequest struct { // configured value; - when set to 0, the page length is set to a server // configured value (recommended); - when set to a value less than 0, an // invalid parameter error is returned; - MaxResults int `json:"-" tf:"-"` + MaxResults int `json:"-" url:"max_results,omitempty"` // Opaque pagination token to go to next page based on previous query. - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListStorageCredentialsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listStorageCredentialsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listStorageCredentialsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListStorageCredentialsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListStorageCredentialsRequest) MarshalJSON() ([]byte, error) { - pb, err := listStorageCredentialsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListStorageCredentialsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListStorageCredentialsResponse struct { // Opaque token to retrieve the next page of results. Absent if there are no // more pages. __page_token__ should be set to this value for the next // request (for the next page of results). - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` - // Wire name: 'storage_credentials' StorageCredentials []StorageCredentialInfo `json:"storage_credentials,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListStorageCredentialsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listStorageCredentialsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listStorageCredentialsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListStorageCredentialsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListStorageCredentialsResponse) MarshalJSON() ([]byte, error) { - pb, err := listStorageCredentialsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListStorageCredentialsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // List table summaries type ListSummariesRequest struct { // Name of parent catalog for tables of interest. - CatalogName string `json:"-" tf:"-"` + CatalogName string `json:"-" url:"catalog_name"` // Whether to include a manifest containing capabilities the table has. - IncludeManifestCapabilities bool `json:"-" tf:"-"` + IncludeManifestCapabilities bool `json:"-" url:"include_manifest_capabilities,omitempty"` // Maximum number of summaries for tables to return. If not set, the page // length is set to a server configured value (10000, as of 1/5/2024). - // when set to a value greater than 0, the page length is the minimum of @@ -7560,42 +3897,25 @@ type ListSummariesRequest struct { // set to 0, the page length is set to a server configured value (10000, as // of 1/5/2024) (recommended); - when set to a value less than 0, an invalid // parameter error is returned; - MaxResults int `json:"-" tf:"-"` + MaxResults int `json:"-" url:"max_results,omitempty"` // Opaque pagination token to go to next page based on previous query. - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` // A sql LIKE pattern (% and _) for schema names. All schemas will be // returned if not set or empty. - SchemaNamePattern string `json:"-" tf:"-"` + SchemaNamePattern string `json:"-" url:"schema_name_pattern,omitempty"` // A sql LIKE pattern (% and _) for table names. All tables will be returned // if not set or empty. - TableNamePattern string `json:"-" tf:"-"` + TableNamePattern string `json:"-" url:"table_name_pattern,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListSummariesRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listSummariesRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listSummariesRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListSummariesRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListSummariesRequest) MarshalJSON() ([]byte, error) { - pb, err := listSummariesRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListSummariesRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // List system schemas @@ -7606,219 +3926,128 @@ type ListSystemSchemasRequest struct { // configured value; - When set to a value less than 0, an invalid parameter // error is returned; - If not set, all the schemas are returned (not // recommended). - MaxResults int `json:"-" tf:"-"` + MaxResults int `json:"-" url:"max_results,omitempty"` // The ID for the metastore in which the system schema resides. - MetastoreId string `json:"-" tf:"-"` + MetastoreId string `json:"-" url:"-"` // Opaque pagination token to go to next page based on previous query. - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListSystemSchemasRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listSystemSchemasRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listSystemSchemasRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListSystemSchemasRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListSystemSchemasRequest) MarshalJSON() ([]byte, error) { - pb, err := listSystemSchemasRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListSystemSchemasRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListSystemSchemasResponse struct { // Opaque token to retrieve the next page of results. Absent if there are no // more pages. __page_token__ should be set to this value for the next // request (for the next page of results). - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` // An array of system schema information objects. - // Wire name: 'schemas' Schemas []SystemSchemaInfo `json:"schemas,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListSystemSchemasResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listSystemSchemasResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listSystemSchemasResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListSystemSchemasResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListSystemSchemasResponse) MarshalJSON() ([]byte, error) { - pb, err := listSystemSchemasResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListSystemSchemasResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListTableSummariesResponse struct { // Opaque token to retrieve the next page of results. Absent if there are no // more pages. __page_token__ should be set to this value for the next // request (for the next page of results). - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` // List of table summaries. - // Wire name: 'tables' Tables []TableSummary `json:"tables,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListTableSummariesResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listTableSummariesResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listTableSummariesResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListTableSummariesResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListTableSummariesResponse) MarshalJSON() ([]byte, error) { - pb, err := listTableSummariesResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListTableSummariesResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // List tables type ListTablesRequest struct { // Name of parent catalog for tables of interest. - CatalogName string `json:"-" tf:"-"` + CatalogName string `json:"-" url:"catalog_name"` // Whether to include tables in the response for which the principal can // only access selective metadata for - IncludeBrowse bool `json:"-" tf:"-"` + IncludeBrowse bool `json:"-" url:"include_browse,omitempty"` // Whether delta metadata should be included in the response. - IncludeDeltaMetadata bool `json:"-" tf:"-"` + IncludeDeltaMetadata bool `json:"-" url:"include_delta_metadata,omitempty"` // Whether to include a manifest containing capabilities the table has. - IncludeManifestCapabilities bool `json:"-" tf:"-"` + IncludeManifestCapabilities bool `json:"-" url:"include_manifest_capabilities,omitempty"` // Maximum number of tables to return. If not set, all the tables are // returned (not recommended). - when set to a value greater than 0, the // page length is the minimum of this value and a server configured value; - // when set to 0, the page length is set to a server configured value // (recommended); - when set to a value less than 0, an invalid parameter // error is returned; - MaxResults int `json:"-" tf:"-"` + MaxResults int `json:"-" url:"max_results,omitempty"` // Whether to omit the columns of the table from the response or not. - OmitColumns bool `json:"-" tf:"-"` + OmitColumns bool `json:"-" url:"omit_columns,omitempty"` // Whether to omit the properties of the table from the response or not. - OmitProperties bool `json:"-" tf:"-"` + OmitProperties bool `json:"-" url:"omit_properties,omitempty"` // Whether to omit the username of the table (e.g. owner, updated_by, // created_by) from the response or not. - OmitUsername bool `json:"-" tf:"-"` + OmitUsername bool `json:"-" url:"omit_username,omitempty"` // Opaque token to send for the next page of results (pagination). - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` // Parent schema of tables. - SchemaName string `json:"-" tf:"-"` + SchemaName string `json:"-" url:"schema_name"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListTablesRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listTablesRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listTablesRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListTablesRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListTablesRequest) MarshalJSON() ([]byte, error) { - pb, err := listTablesRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListTablesRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListTablesResponse struct { // Opaque token to retrieve the next page of results. Absent if there are no // more pages. __page_token__ should be set to this value for the next // request (for the next page of results). - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` // An array of table information objects. - // Wire name: 'tables' Tables []TableInfo `json:"tables,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListTablesResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listTablesResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listTablesResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListTablesResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListTablesResponse) MarshalJSON() ([]byte, error) { - pb, err := listTablesResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListTablesResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // List Volumes type ListVolumesRequest struct { // The identifier of the catalog - CatalogName string `json:"-" tf:"-"` + CatalogName string `json:"-" url:"catalog_name"` // Whether to include volumes in the response for which the principal can // only access selective metadata for - IncludeBrowse bool `json:"-" tf:"-"` + IncludeBrowse bool `json:"-" url:"include_browse,omitempty"` // Maximum number of volumes to return (page length). // // If not set, the page length is set to a server configured value (10000, @@ -7831,77 +4060,41 @@ type ListVolumesRequest struct { // Note: this parameter controls only the maximum number of volumes to // return. The actual number of volumes returned in a page may be smaller // than this value, including 0, even if there are more pages. - MaxResults int `json:"-" tf:"-"` + MaxResults int `json:"-" url:"max_results,omitempty"` // Opaque token returned by a previous request. It must be included in the // request to retrieve the next page of results (pagination). - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` // The identifier of the schema - SchemaName string `json:"-" tf:"-"` + SchemaName string `json:"-" url:"schema_name"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListVolumesRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listVolumesRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listVolumesRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListVolumesRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListVolumesRequest) MarshalJSON() ([]byte, error) { - pb, err := listVolumesRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListVolumesRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListVolumesResponseContent struct { // Opaque token to retrieve the next page of results. Absent if there are no // more pages. __page_token__ should be set to this value for the next // request to retrieve the next page of results. - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` - // Wire name: 'volumes' Volumes []VolumeInfo `json:"volumes,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListVolumesResponseContent) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listVolumesResponseContentPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listVolumesResponseContentFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListVolumesResponseContent) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListVolumesResponseContent) MarshalJSON() ([]byte, error) { - pb, err := listVolumesResponseContentToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListVolumesResponseContent) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The artifact pattern matching type @@ -7941,231 +4134,139 @@ func (f *MatchType) Type() string { type MetastoreAssignment struct { // The name of the default catalog in the metastore. - // Wire name: 'default_catalog_name' DefaultCatalogName string `json:"default_catalog_name,omitempty"` // The unique ID of the metastore. - // Wire name: 'metastore_id' MetastoreId string `json:"metastore_id"` // The unique ID of the Databricks workspace. - // Wire name: 'workspace_id' WorkspaceId int64 `json:"workspace_id"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *MetastoreAssignment) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &metastoreAssignmentPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := metastoreAssignmentFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *MetastoreAssignment) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st MetastoreAssignment) MarshalJSON() ([]byte, error) { - pb, err := metastoreAssignmentToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s MetastoreAssignment) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type MetastoreInfo struct { // Cloud vendor of the metastore home shard (e.g., `aws`, `azure`, `gcp`). - // Wire name: 'cloud' Cloud string `json:"cloud,omitempty"` // Time at which this metastore was created, in epoch milliseconds. - // Wire name: 'created_at' CreatedAt int64 `json:"created_at,omitempty"` // Username of metastore creator. - // Wire name: 'created_by' CreatedBy string `json:"created_by,omitempty"` // Unique identifier of the metastore's (Default) Data Access Configuration. - // Wire name: 'default_data_access_config_id' DefaultDataAccessConfigId string `json:"default_data_access_config_id,omitempty"` // The organization name of a Delta Sharing entity, to be used in // Databricks-to-Databricks Delta Sharing as the official name. - // Wire name: 'delta_sharing_organization_name' DeltaSharingOrganizationName string `json:"delta_sharing_organization_name,omitempty"` // The lifetime of delta sharing recipient token in seconds. - // Wire name: 'delta_sharing_recipient_token_lifetime_in_seconds' DeltaSharingRecipientTokenLifetimeInSeconds int64 `json:"delta_sharing_recipient_token_lifetime_in_seconds,omitempty"` // The scope of Delta Sharing enabled for the metastore. - // Wire name: 'delta_sharing_scope' DeltaSharingScope DeltaSharingScopeEnum `json:"delta_sharing_scope,omitempty"` // Whether to allow non-DBR clients to directly access entities under the // metastore. - // Wire name: 'external_access_enabled' ExternalAccessEnabled bool `json:"external_access_enabled,omitempty"` // Globally unique metastore ID across clouds and regions, of the form // `cloud:region:metastore_id`. - // Wire name: 'global_metastore_id' GlobalMetastoreId string `json:"global_metastore_id,omitempty"` // Unique identifier of metastore. - // Wire name: 'metastore_id' MetastoreId string `json:"metastore_id,omitempty"` // The user-specified name of the metastore. - // Wire name: 'name' Name string `json:"name,omitempty"` // The owner of the metastore. - // Wire name: 'owner' Owner string `json:"owner,omitempty"` // Privilege model version of the metastore, of the form `major.minor` // (e.g., `1.0`). - // Wire name: 'privilege_model_version' PrivilegeModelVersion string `json:"privilege_model_version,omitempty"` // Cloud region which the metastore serves (e.g., `us-west-2`, `westus`). - // Wire name: 'region' Region string `json:"region,omitempty"` // The storage root URL for metastore - // Wire name: 'storage_root' StorageRoot string `json:"storage_root,omitempty"` // UUID of storage credential to access the metastore storage_root. - // Wire name: 'storage_root_credential_id' StorageRootCredentialId string `json:"storage_root_credential_id,omitempty"` // Name of the storage credential to access the metastore storage_root. - // Wire name: 'storage_root_credential_name' StorageRootCredentialName string `json:"storage_root_credential_name,omitempty"` // Time at which the metastore was last modified, in epoch milliseconds. - // Wire name: 'updated_at' UpdatedAt int64 `json:"updated_at,omitempty"` // Username of user who last modified the metastore. - // Wire name: 'updated_by' UpdatedBy string `json:"updated_by,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *MetastoreInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &metastoreInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := metastoreInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *MetastoreInfo) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st MetastoreInfo) MarshalJSON() ([]byte, error) { - pb, err := metastoreInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s MetastoreInfo) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ModelVersionInfo struct { // List of aliases associated with the model version - // Wire name: 'aliases' Aliases []RegisteredModelAlias `json:"aliases,omitempty"` // Indicates whether the principal is limited to retrieving metadata for the // associated object through the BROWSE privilege when include_browse is // enabled in the request. - // Wire name: 'browse_only' BrowseOnly bool `json:"browse_only,omitempty"` // The name of the catalog containing the model version - // Wire name: 'catalog_name' CatalogName string `json:"catalog_name,omitempty"` // The comment attached to the model version - // Wire name: 'comment' Comment string `json:"comment,omitempty"` - // Wire name: 'created_at' CreatedAt int64 `json:"created_at,omitempty"` // The identifier of the user who created the model version - // Wire name: 'created_by' CreatedBy string `json:"created_by,omitempty"` // The unique identifier of the model version - // Wire name: 'id' Id string `json:"id,omitempty"` // The unique identifier of the metastore containing the model version - // Wire name: 'metastore_id' MetastoreId string `json:"metastore_id,omitempty"` // The name of the parent registered model of the model version, relative to // parent schema - // Wire name: 'model_name' ModelName string `json:"model_name,omitempty"` // Model version dependencies, for feature-store packaged models - // Wire name: 'model_version_dependencies' ModelVersionDependencies *DependencyList `json:"model_version_dependencies,omitempty"` // MLflow run ID used when creating the model version, if ``source`` was // generated by an experiment run stored in an MLflow tracking server - // Wire name: 'run_id' RunId string `json:"run_id,omitempty"` // ID of the Databricks workspace containing the MLflow run that generated // this model version, if applicable - // Wire name: 'run_workspace_id' RunWorkspaceId int `json:"run_workspace_id,omitempty"` // The name of the schema containing the model version, relative to parent // catalog - // Wire name: 'schema_name' SchemaName string `json:"schema_name,omitempty"` // URI indicating the location of the source artifacts (files) for the model // version - // Wire name: 'source' Source string `json:"source,omitempty"` // Current status of the model version. Newly created model versions start // in PENDING_REGISTRATION status, then move to READY status once the model // version files are uploaded and the model version is finalized. Only model // versions in READY status can be loaded for inference or served. - // Wire name: 'status' Status ModelVersionInfoStatus `json:"status,omitempty"` // The storage location on the cloud under which model version data files // are stored - // Wire name: 'storage_location' StorageLocation string `json:"storage_location,omitempty"` - // Wire name: 'updated_at' UpdatedAt int64 `json:"updated_at,omitempty"` // The identifier of the user who updated the model version last time - // Wire name: 'updated_by' UpdatedBy string `json:"updated_by,omitempty"` // Integer model version number, used to reference the model version in API // requests. - // Wire name: 'version' Version int `json:"version,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ModelVersionInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &modelVersionInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := modelVersionInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ModelVersionInfo) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ModelVersionInfo) MarshalJSON() ([]byte, error) { - pb, err := modelVersionInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ModelVersionInfo) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Current status of the model version. Newly created model versions start in @@ -8214,44 +4315,16 @@ func (f *ModelVersionInfoStatus) Type() string { type MonitorCronSchedule struct { // Read only field that indicates whether a schedule is paused or not. - // Wire name: 'pause_status' PauseStatus MonitorCronSchedulePauseStatus `json:"pause_status,omitempty"` // The expression that determines when to run the monitor. See [examples]. // // [examples]: https://www.quartz-scheduler.org/documentation/quartz-2.3.0/tutorials/crontrigger.html - // Wire name: 'quartz_cron_expression' QuartzCronExpression string `json:"quartz_cron_expression"` // The timezone id (e.g., ``"PST"``) in which to evaluate the quartz // expression. - // Wire name: 'timezone_id' TimezoneId string `json:"timezone_id"` } -func (st *MonitorCronSchedule) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &monitorCronSchedulePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := monitorCronScheduleFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st MonitorCronSchedule) MarshalJSON() ([]byte, error) { - pb, err := monitorCronScheduleToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Read only field that indicates whether a schedule is paused or not. type MonitorCronSchedulePauseStatus string @@ -8292,96 +4365,46 @@ func (f *MonitorCronSchedulePauseStatus) Type() string { type MonitorDataClassificationConfig struct { // Whether data classification is enabled. - // Wire name: 'enabled' Enabled bool `json:"enabled,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *MonitorDataClassificationConfig) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &monitorDataClassificationConfigPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := monitorDataClassificationConfigFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *MonitorDataClassificationConfig) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st MonitorDataClassificationConfig) MarshalJSON() ([]byte, error) { - pb, err := monitorDataClassificationConfigToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s MonitorDataClassificationConfig) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type MonitorDestination struct { // The list of email addresses to send the notification to. A maximum of 5 // email addresses is supported. - // Wire name: 'email_addresses' EmailAddresses []string `json:"email_addresses,omitempty"` } -func (st *MonitorDestination) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &monitorDestinationPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := monitorDestinationFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st MonitorDestination) MarshalJSON() ([]byte, error) { - pb, err := monitorDestinationToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type MonitorInferenceLog struct { // Granularities for aggregating data into time windows based on their // timestamp. Currently the following static granularities are supported: // {``"5 minutes"``, ``"30 minutes"``, ``"1 hour"``, ``"1 day"``, ``" // week(s)"``, ``"1 month"``, ``"1 year"``}. - // Wire name: 'granularities' Granularities []string `json:"granularities"` // Optional column that contains the ground truth for the prediction. - // Wire name: 'label_col' LabelCol string `json:"label_col,omitempty"` // Column that contains the id of the model generating the predictions. // Metrics will be computed per model id by default, and also across all // model ids. - // Wire name: 'model_id_col' ModelIdCol string `json:"model_id_col"` // Column that contains the output/prediction from the model. - // Wire name: 'prediction_col' PredictionCol string `json:"prediction_col"` // Optional column that contains the prediction probabilities for each class // in a classification problem type. The values in this column should be a // map, mapping each class label to the prediction probability for a given // sample. The map should be of PySpark MapType(). - // Wire name: 'prediction_proba_col' PredictionProbaCol string `json:"prediction_proba_col,omitempty"` // Problem type the model aims to solve. Determines the type of // model-quality metrics that will be computed. - // Wire name: 'problem_type' ProblemType MonitorInferenceLogProblemType `json:"problem_type"` // Column that contains the timestamps of requests. The column must be one // of the following: - A ``TimestampType`` column - A column whose values @@ -8389,35 +4412,17 @@ type MonitorInferenceLog struct { // [function]. // // [function]: https://spark.apache.org/docs/latest/api/python/reference/pyspark.sql/api/pyspark.sql.functions.to_timestamp.html - // Wire name: 'timestamp_col' TimestampCol string `json:"timestamp_col"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *MonitorInferenceLog) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &monitorInferenceLogPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := monitorInferenceLogFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *MonitorInferenceLog) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st MonitorInferenceLog) MarshalJSON() ([]byte, error) { - pb, err := monitorInferenceLogToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s MonitorInferenceLog) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Problem type the model aims to solve. Determines the type of model-quality @@ -8461,99 +4466,64 @@ func (f *MonitorInferenceLogProblemType) Type() string { type MonitorInfo struct { // The directory to store monitoring assets (e.g. dashboard, metric tables). - // Wire name: 'assets_dir' AssetsDir string `json:"assets_dir,omitempty"` // Name of the baseline table from which drift metrics are computed from. // Columns in the monitored table should also be present in the baseline // table. - // Wire name: 'baseline_table_name' BaselineTableName string `json:"baseline_table_name,omitempty"` // Custom metrics to compute on the monitored table. These can be aggregate // metrics, derived metrics (from already computed aggregate metrics), or // drift metrics (comparing metrics across time windows). - // Wire name: 'custom_metrics' CustomMetrics []MonitorMetric `json:"custom_metrics,omitempty"` // Id of dashboard that visualizes the computed metrics. This can be empty // if the monitor is in PENDING state. - // Wire name: 'dashboard_id' DashboardId string `json:"dashboard_id,omitempty"` // The data classification config for the monitor. - // Wire name: 'data_classification_config' DataClassificationConfig *MonitorDataClassificationConfig `json:"data_classification_config,omitempty"` // The full name of the drift metrics table. Format: // __catalog_name__.__schema_name__.__table_name__. - // Wire name: 'drift_metrics_table_name' DriftMetricsTableName string `json:"drift_metrics_table_name"` // Configuration for monitoring inference logs. - // Wire name: 'inference_log' InferenceLog *MonitorInferenceLog `json:"inference_log,omitempty"` // The latest failure message of the monitor (if any). - // Wire name: 'latest_monitor_failure_msg' LatestMonitorFailureMsg string `json:"latest_monitor_failure_msg,omitempty"` // The version of the monitor config (e.g. 1,2,3). If negative, the monitor // may be corrupted. - // Wire name: 'monitor_version' MonitorVersion string `json:"monitor_version"` // The notification settings for the monitor. - // Wire name: 'notifications' Notifications *MonitorNotifications `json:"notifications,omitempty"` // Schema where output metric tables are created. - // Wire name: 'output_schema_name' OutputSchemaName string `json:"output_schema_name,omitempty"` // The full name of the profile metrics table. Format: // __catalog_name__.__schema_name__.__table_name__. - // Wire name: 'profile_metrics_table_name' ProfileMetricsTableName string `json:"profile_metrics_table_name"` // The schedule for automatically updating and refreshing metric tables. - // Wire name: 'schedule' Schedule *MonitorCronSchedule `json:"schedule,omitempty"` // List of column expressions to slice data with for targeted analysis. The // data is grouped by each expression independently, resulting in a separate // slice for each predicate and its complements. For high-cardinality // columns, only the top 100 unique values by frequency will generate // slices. - // Wire name: 'slicing_exprs' SlicingExprs []string `json:"slicing_exprs,omitempty"` // Configuration for monitoring snapshot tables. - // Wire name: 'snapshot' Snapshot *MonitorSnapshot `json:"snapshot,omitempty"` // The status of the monitor. - // Wire name: 'status' Status MonitorInfoStatus `json:"status"` // The full name of the table to monitor. Format: // __catalog_name__.__schema_name__.__table_name__. - // Wire name: 'table_name' TableName string `json:"table_name"` // Configuration for monitoring time series tables. - // Wire name: 'time_series' TimeSeries *MonitorTimeSeries `json:"time_series,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *MonitorInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &monitorInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := monitorInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *MonitorInfo) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st MonitorInfo) MarshalJSON() ([]byte, error) { - pb, err := monitorInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s MonitorInfo) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The status of the monitor. @@ -8608,18 +4578,14 @@ type MonitorMetric struct { // metric. See [create metric definition]. // // [create metric definition]: https://docs.databricks.com/en/lakehouse-monitoring/custom-metrics.html#create-definition - // Wire name: 'definition' Definition string `json:"definition"` // A list of column names in the input table the metric should be computed // for. Can use ``":table"`` to indicate that the metric needs information // from multiple columns. - // Wire name: 'input_columns' InputColumns []string `json:"input_columns"` // Name of the metric in the output tables. - // Wire name: 'name' Name string `json:"name"` // The output type of the custom metric. - // Wire name: 'output_data_type' OutputDataType string `json:"output_data_type"` // Can only be one of ``"CUSTOM_METRIC_TYPE_AGGREGATE"``, // ``"CUSTOM_METRIC_TYPE_DERIVED"``, or ``"CUSTOM_METRIC_TYPE_DRIFT"``. The @@ -8631,35 +4597,9 @@ type MonitorMetric struct { // table - CUSTOM_METRIC_TYPE_DERIVED: depend on previously computed // aggregate metrics - CUSTOM_METRIC_TYPE_DRIFT: depend on previously // computed aggregate or derived metrics - // Wire name: 'type' Type MonitorMetricType `json:"type"` } -func (st *MonitorMetric) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &monitorMetricPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := monitorMetricFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st MonitorMetric) MarshalJSON() ([]byte, error) { - pb, err := monitorMetricToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Can only be one of “"CUSTOM_METRIC_TYPE_AGGREGATE"“, // “"CUSTOM_METRIC_TYPE_DERIVED"“, or “"CUSTOM_METRIC_TYPE_DRIFT"“. The // “"CUSTOM_METRIC_TYPE_AGGREGATE"“ and “"CUSTOM_METRIC_TYPE_DERIVED"“ @@ -8712,88 +4652,38 @@ func (f *MonitorMetricType) Type() string { type MonitorNotifications struct { // Who to send notifications to on monitor failure. - // Wire name: 'on_failure' OnFailure *MonitorDestination `json:"on_failure,omitempty"` // Who to send notifications to when new data classification tags are // detected. - // Wire name: 'on_new_classification_tag_detected' OnNewClassificationTagDetected *MonitorDestination `json:"on_new_classification_tag_detected,omitempty"` } -func (st *MonitorNotifications) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &monitorNotificationsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := monitorNotificationsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st MonitorNotifications) MarshalJSON() ([]byte, error) { - pb, err := monitorNotificationsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type MonitorRefreshInfo struct { // Time at which refresh operation completed (milliseconds since 1/1/1970 // UTC). - // Wire name: 'end_time_ms' EndTimeMs int64 `json:"end_time_ms,omitempty"` // An optional message to give insight into the current state of the job // (e.g. FAILURE messages). - // Wire name: 'message' Message string `json:"message,omitempty"` // Unique id of the refresh operation. - // Wire name: 'refresh_id' RefreshId int64 `json:"refresh_id"` // Time at which refresh operation was initiated (milliseconds since // 1/1/1970 UTC). - // Wire name: 'start_time_ms' StartTimeMs int64 `json:"start_time_ms"` // The current state of the refresh. - // Wire name: 'state' State MonitorRefreshInfoState `json:"state"` // The method by which the refresh was triggered. - // Wire name: 'trigger' Trigger MonitorRefreshInfoTrigger `json:"trigger,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *MonitorRefreshInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &monitorRefreshInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := monitorRefreshInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *MonitorRefreshInfo) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st MonitorRefreshInfo) MarshalJSON() ([]byte, error) { - pb, err := monitorRefreshInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s MonitorRefreshInfo) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The current state of the refresh. @@ -8883,69 +4773,17 @@ func (f *MonitorRefreshInfoTrigger) Type() string { type MonitorRefreshListResponse struct { // List of refreshes. - // Wire name: 'refreshes' Refreshes []MonitorRefreshInfo `json:"refreshes,omitempty"` } -func (st *MonitorRefreshListResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &monitorRefreshListResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := monitorRefreshListResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st MonitorRefreshListResponse) MarshalJSON() ([]byte, error) { - pb, err := monitorRefreshListResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type MonitorSnapshot struct { } -func (st *MonitorSnapshot) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &monitorSnapshotPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := monitorSnapshotFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st MonitorSnapshot) MarshalJSON() ([]byte, error) { - pb, err := monitorSnapshotToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type MonitorTimeSeries struct { // Granularities for aggregating data into time windows based on their // timestamp. Currently the following static granularities are supported: // {``"5 minutes"``, ``"30 minutes"``, ``"1 hour"``, ``"1 day"``, ``" // week(s)"``, ``"1 month"``, ``"1 year"``}. - // Wire name: 'granularities' Granularities []string `json:"granularities"` // Column that contains the timestamps of requests. The column must be one // of the following: - A ``TimestampType`` column - A column whose values @@ -8953,113 +4791,39 @@ type MonitorTimeSeries struct { // [function]. // // [function]: https://spark.apache.org/docs/latest/api/python/reference/pyspark.sql/api/pyspark.sql.functions.to_timestamp.html - // Wire name: 'timestamp_col' TimestampCol string `json:"timestamp_col"` } -func (st *MonitorTimeSeries) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &monitorTimeSeriesPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := monitorTimeSeriesFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st MonitorTimeSeries) MarshalJSON() ([]byte, error) { - pb, err := monitorTimeSeriesToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type NamedTableConstraint struct { // The name of the constraint. - // Wire name: 'name' Name string `json:"name"` } -func (st *NamedTableConstraint) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &namedTableConstraintPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := namedTableConstraintFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st NamedTableConstraint) MarshalJSON() ([]byte, error) { - pb, err := namedTableConstraintToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Online Table information. type OnlineTable struct { // Full three-part (catalog, schema, table) name of the table. - // Wire name: 'name' Name string `json:"name,omitempty"` // Specification of the online table. - // Wire name: 'spec' Spec *OnlineTableSpec `json:"spec,omitempty"` // Online Table data synchronization status - // Wire name: 'status' Status *OnlineTableStatus `json:"status,omitempty"` // Data serving REST API URL for this table - // Wire name: 'table_serving_url' TableServingUrl string `json:"table_serving_url,omitempty"` // The provisioning state of the online table entity in Unity Catalog. This // is distinct from the state of the data synchronization pipeline (i.e. the // table may be in "ACTIVE" but the pipeline may be in "PROVISIONING" as it // runs asynchronously). - // Wire name: 'unity_catalog_provisioning_state' UnityCatalogProvisioningState ProvisioningInfoState `json:"unity_catalog_provisioning_state,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *OnlineTable) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &onlineTablePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := onlineTableFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *OnlineTable) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st OnlineTable) MarshalJSON() ([]byte, error) { - pb, err := onlineTableToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s OnlineTable) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Specification of an online table. @@ -9071,114 +4835,40 @@ type OnlineTableSpec struct { // the source table and there are no incremental updates. This mode is // useful for syncing views or tables without CDFs to online tables. Note // that the full-copy pipeline only supports "triggered" scheduling policy. - // Wire name: 'perform_full_copy' PerformFullCopy bool `json:"perform_full_copy,omitempty"` // ID of the associated pipeline. Generated by the server - cannot be set by // the caller. - // Wire name: 'pipeline_id' PipelineId string `json:"pipeline_id,omitempty"` // Primary Key columns to be used for data insert/update in the destination. - // Wire name: 'primary_key_columns' PrimaryKeyColumns []string `json:"primary_key_columns,omitempty"` // Pipeline runs continuously after generating the initial data. - // Wire name: 'run_continuously' RunContinuously *OnlineTableSpecContinuousSchedulingPolicy `json:"run_continuously,omitempty"` // Pipeline stops after generating the initial data and can be triggered // later (manually, through a cron job or through data triggers) - // Wire name: 'run_triggered' RunTriggered *OnlineTableSpecTriggeredSchedulingPolicy `json:"run_triggered,omitempty"` // Three-part (catalog, schema, table) name of the source Delta table. - // Wire name: 'source_table_full_name' SourceTableFullName string `json:"source_table_full_name,omitempty"` // Time series key to deduplicate (tie-break) rows with the same primary // key. - // Wire name: 'timeseries_key' TimeseriesKey string `json:"timeseries_key,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *OnlineTableSpec) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &onlineTableSpecPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := onlineTableSpecFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *OnlineTableSpec) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st OnlineTableSpec) MarshalJSON() ([]byte, error) { - pb, err := onlineTableSpecToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s OnlineTableSpec) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type OnlineTableSpecContinuousSchedulingPolicy struct { } -func (st *OnlineTableSpecContinuousSchedulingPolicy) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &onlineTableSpecContinuousSchedulingPolicyPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := onlineTableSpecContinuousSchedulingPolicyFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st OnlineTableSpecContinuousSchedulingPolicy) MarshalJSON() ([]byte, error) { - pb, err := onlineTableSpecContinuousSchedulingPolicyToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type OnlineTableSpecTriggeredSchedulingPolicy struct { } -func (st *OnlineTableSpecTriggeredSchedulingPolicy) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &onlineTableSpecTriggeredSchedulingPolicyPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := onlineTableSpecTriggeredSchedulingPolicyFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st OnlineTableSpecTriggeredSchedulingPolicy) MarshalJSON() ([]byte, error) { - pb, err := onlineTableSpecTriggeredSchedulingPolicyToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // The state of an online table. type OnlineTableState string @@ -9248,180 +4938,87 @@ func (f *OnlineTableState) Type() string { type OnlineTableStatus struct { // Detailed status of an online table. Shown if the online table is in the // ONLINE_CONTINUOUS_UPDATE or the ONLINE_UPDATING_PIPELINE_RESOURCES state. - // Wire name: 'continuous_update_status' ContinuousUpdateStatus *ContinuousUpdateStatus `json:"continuous_update_status,omitempty"` // The state of the online table. - // Wire name: 'detailed_state' DetailedState OnlineTableState `json:"detailed_state,omitempty"` // Detailed status of an online table. Shown if the online table is in the // OFFLINE_FAILED or the ONLINE_PIPELINE_FAILED state. - // Wire name: 'failed_status' FailedStatus *FailedStatus `json:"failed_status,omitempty"` // A text description of the current state of the online table. - // Wire name: 'message' Message string `json:"message,omitempty"` // Detailed status of an online table. Shown if the online table is in the // PROVISIONING_PIPELINE_RESOURCES or the PROVISIONING_INITIAL_SNAPSHOT // state. - // Wire name: 'provisioning_status' ProvisioningStatus *ProvisioningStatus `json:"provisioning_status,omitempty"` // Detailed status of an online table. Shown if the online table is in the // ONLINE_TRIGGERED_UPDATE or the ONLINE_NO_PENDING_UPDATE state. - // Wire name: 'triggered_update_status' TriggeredUpdateStatus *TriggeredUpdateStatus `json:"triggered_update_status,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *OnlineTableStatus) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &onlineTableStatusPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := onlineTableStatusFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *OnlineTableStatus) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st OnlineTableStatus) MarshalJSON() ([]byte, error) { - pb, err := onlineTableStatusToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s OnlineTableStatus) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type PermissionsChange struct { // The set of privileges to add. - // Wire name: 'add' Add []Privilege `json:"add,omitempty"` // The principal whose privileges we are changing. - // Wire name: 'principal' Principal string `json:"principal,omitempty"` // The set of privileges to remove. - // Wire name: 'remove' Remove []Privilege `json:"remove,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *PermissionsChange) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &permissionsChangePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := permissionsChangeFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *PermissionsChange) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st PermissionsChange) MarshalJSON() ([]byte, error) { - pb, err := permissionsChangeToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s PermissionsChange) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Progress information of the Online Table data synchronization pipeline. type PipelineProgress struct { // The estimated time remaining to complete this update in seconds. - // Wire name: 'estimated_completion_time_seconds' EstimatedCompletionTimeSeconds float64 `json:"estimated_completion_time_seconds,omitempty"` // The source table Delta version that was last processed by the pipeline. // The pipeline may not have completely processed this version yet. - // Wire name: 'latest_version_currently_processing' LatestVersionCurrentlyProcessing int64 `json:"latest_version_currently_processing,omitempty"` // The completion ratio of this update. This is a number between 0 and 1. - // Wire name: 'sync_progress_completion' SyncProgressCompletion float64 `json:"sync_progress_completion,omitempty"` // The number of rows that have been synced in this update. - // Wire name: 'synced_row_count' SyncedRowCount int64 `json:"synced_row_count,omitempty"` // The total number of rows that need to be synced in this update. This // number may be an estimate. - // Wire name: 'total_row_count' TotalRowCount int64 `json:"total_row_count,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *PipelineProgress) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &pipelineProgressPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := pipelineProgressFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *PipelineProgress) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st PipelineProgress) MarshalJSON() ([]byte, error) { - pb, err := pipelineProgressToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s PipelineProgress) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type PrimaryKeyConstraint struct { // Column names for this constraint. - // Wire name: 'child_columns' ChildColumns []string `json:"child_columns"` // The name of the constraint. - // Wire name: 'name' Name string `json:"name"` // Column names that represent a timeseries. - // Wire name: 'timeseries_columns' TimeseriesColumns []string `json:"timeseries_columns,omitempty"` } -func (st *PrimaryKeyConstraint) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &primaryKeyConstraintPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := primaryKeyConstraintFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st PrimaryKeyConstraint) MarshalJSON() ([]byte, error) { - pb, err := primaryKeyConstraintToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type Privilege string const PrivilegeAccess Privilege = `ACCESS` @@ -9602,72 +5199,27 @@ func (f *Privilege) Type() string { type PrivilegeAssignment struct { // The principal (user email address or group name). - // Wire name: 'principal' Principal string `json:"principal,omitempty"` // The privileges assigned to the principal. - // Wire name: 'privileges' Privileges []Privilege `json:"privileges,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *PrivilegeAssignment) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &privilegeAssignmentPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := privilegeAssignmentFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *PrivilegeAssignment) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st PrivilegeAssignment) MarshalJSON() ([]byte, error) { - pb, err := privilegeAssignmentToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s PrivilegeAssignment) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Status of an asynchronously provisioned resource. type ProvisioningInfo struct { // The provisioning state of the resource. - // Wire name: 'state' State ProvisioningInfoState `json:"state,omitempty"` } -func (st *ProvisioningInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &provisioningInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := provisioningInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ProvisioningInfo) MarshalJSON() ([]byte, error) { - pb, err := provisioningInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type ProvisioningInfoState string const ProvisioningInfoStateActive ProvisioningInfoState = `ACTIVE` @@ -9722,376 +5274,178 @@ func (f *ProvisioningInfoState) Type() string { type ProvisioningStatus struct { // Details about initial data synchronization. Only populated when in the // PROVISIONING_INITIAL_SNAPSHOT state. - // Wire name: 'initial_pipeline_sync_progress' InitialPipelineSyncProgress *PipelineProgress `json:"initial_pipeline_sync_progress,omitempty"` } -func (st *ProvisioningStatus) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &provisioningStatusPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := provisioningStatusFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ProvisioningStatus) MarshalJSON() ([]byte, error) { - pb, err := provisioningStatusToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type QuotaInfo struct { // The timestamp that indicates when the quota count was last updated. - // Wire name: 'last_refreshed_at' LastRefreshedAt int64 `json:"last_refreshed_at,omitempty"` // Name of the parent resource. Returns metastore ID if the parent is a // metastore. - // Wire name: 'parent_full_name' ParentFullName string `json:"parent_full_name,omitempty"` // The quota parent securable type. - // Wire name: 'parent_securable_type' ParentSecurableType SecurableType `json:"parent_securable_type,omitempty"` // The current usage of the resource quota. - // Wire name: 'quota_count' QuotaCount int `json:"quota_count,omitempty"` // The current limit of the resource quota. - // Wire name: 'quota_limit' QuotaLimit int `json:"quota_limit,omitempty"` // The name of the quota. - // Wire name: 'quota_name' QuotaName string `json:"quota_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *QuotaInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := "aInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := quotaInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *QuotaInfo) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st QuotaInfo) MarshalJSON() ([]byte, error) { - pb, err := quotaInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s QuotaInfo) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // R2 temporary credentials for API authentication. Read more at // https://developers.cloudflare.com/r2/api/s3/tokens/. type R2Credentials struct { // The access key ID that identifies the temporary credentials. - // Wire name: 'access_key_id' AccessKeyId string `json:"access_key_id,omitempty"` // The secret access key associated with the access key. - // Wire name: 'secret_access_key' SecretAccessKey string `json:"secret_access_key,omitempty"` // The generated JWT that users must pass to use the temporary credentials. - // Wire name: 'session_token' SessionToken string `json:"session_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *R2Credentials) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &r2CredentialsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := r2CredentialsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *R2Credentials) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st R2Credentials) MarshalJSON() ([]byte, error) { - pb, err := r2CredentialsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s R2Credentials) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get a Volume type ReadVolumeRequest struct { // Whether to include volumes in the response for which the principal can // only access selective metadata for - IncludeBrowse bool `json:"-" tf:"-"` + IncludeBrowse bool `json:"-" url:"include_browse,omitempty"` // The three-level (fully qualified) name of the volume - Name string `json:"-" tf:"-"` + Name string `json:"-" url:"-"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ReadVolumeRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &readVolumeRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := readVolumeRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ReadVolumeRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ReadVolumeRequest) MarshalJSON() ([]byte, error) { - pb, err := readVolumeRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ReadVolumeRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type RegenerateDashboardRequest struct { // Full name of the table. - TableName string `json:"-" tf:"-"` + TableName string `json:"-" url:"-"` // Optional argument to specify the warehouse for dashboard regeneration. If // not specified, the first running warehouse will be used. - // Wire name: 'warehouse_id' WarehouseId string `json:"warehouse_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *RegenerateDashboardRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := ®enerateDashboardRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := regenerateDashboardRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *RegenerateDashboardRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st RegenerateDashboardRequest) MarshalJSON() ([]byte, error) { - pb, err := regenerateDashboardRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s RegenerateDashboardRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type RegenerateDashboardResponse struct { // Id of the regenerated monitoring dashboard. - // Wire name: 'dashboard_id' DashboardId string `json:"dashboard_id,omitempty"` // The directory where the regenerated dashboard is stored. - // Wire name: 'parent_folder' ParentFolder string `json:"parent_folder,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *RegenerateDashboardResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := ®enerateDashboardResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := regenerateDashboardResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *RegenerateDashboardResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st RegenerateDashboardResponse) MarshalJSON() ([]byte, error) { - pb, err := regenerateDashboardResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s RegenerateDashboardResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Registered model alias. type RegisteredModelAlias struct { // Name of the alias, e.g. 'champion' or 'latest_stable' - // Wire name: 'alias_name' AliasName string `json:"alias_name,omitempty"` // Integer version number of the model version to which this alias points. - // Wire name: 'version_num' VersionNum int `json:"version_num,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *RegisteredModelAlias) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := ®isteredModelAliasPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := registeredModelAliasFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *RegisteredModelAlias) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st RegisteredModelAlias) MarshalJSON() ([]byte, error) { - pb, err := registeredModelAliasToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s RegisteredModelAlias) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type RegisteredModelInfo struct { // List of aliases associated with the registered model - // Wire name: 'aliases' Aliases []RegisteredModelAlias `json:"aliases,omitempty"` // Indicates whether the principal is limited to retrieving metadata for the // associated object through the BROWSE privilege when include_browse is // enabled in the request. - // Wire name: 'browse_only' BrowseOnly bool `json:"browse_only,omitempty"` // The name of the catalog where the schema and the registered model reside - // Wire name: 'catalog_name' CatalogName string `json:"catalog_name,omitempty"` // The comment attached to the registered model - // Wire name: 'comment' Comment string `json:"comment,omitempty"` // Creation timestamp of the registered model in milliseconds since the Unix // epoch - // Wire name: 'created_at' CreatedAt int64 `json:"created_at,omitempty"` // The identifier of the user who created the registered model - // Wire name: 'created_by' CreatedBy string `json:"created_by,omitempty"` // The three-level (fully qualified) name of the registered model - // Wire name: 'full_name' FullName string `json:"full_name,omitempty"` // The unique identifier of the metastore - // Wire name: 'metastore_id' MetastoreId string `json:"metastore_id,omitempty"` // The name of the registered model - // Wire name: 'name' Name string `json:"name,omitempty"` // The identifier of the user who owns the registered model - // Wire name: 'owner' Owner string `json:"owner,omitempty"` // The name of the schema where the registered model resides - // Wire name: 'schema_name' SchemaName string `json:"schema_name,omitempty"` // The storage location on the cloud under which model version data files // are stored - // Wire name: 'storage_location' StorageLocation string `json:"storage_location,omitempty"` // Last-update timestamp of the registered model in milliseconds since the // Unix epoch - // Wire name: 'updated_at' UpdatedAt int64 `json:"updated_at,omitempty"` // The identifier of the user who updated the registered model last time - // Wire name: 'updated_by' UpdatedBy string `json:"updated_by,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` -} - -func (st *RegisteredModelInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := ®isteredModelInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := registeredModelInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st RegisteredModelInfo) MarshalJSON() ([]byte, error) { - pb, err := registeredModelInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + ForceSendFields []string `json:"-" url:"-"` } -// Queue a metric refresh for a monitor -type RunRefreshRequest struct { - // Full name of the table. - TableName string `json:"-" tf:"-"` +func (s *RegisteredModelInfo) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st *RunRefreshRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &runRefreshRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := runRefreshRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s RegisteredModelInfo) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } -func (st RunRefreshRequest) MarshalJSON() ([]byte, error) { - pb, err := runRefreshRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +// Queue a metric refresh for a monitor +type RunRefreshRequest struct { + // Full name of the table. + TableName string `json:"-" url:"-"` } // Next ID: 40 @@ -10099,87 +5453,52 @@ type SchemaInfo struct { // Indicates whether the principal is limited to retrieving metadata for the // associated object through the BROWSE privilege when include_browse is // enabled in the request. - // Wire name: 'browse_only' BrowseOnly bool `json:"browse_only,omitempty"` // Name of parent catalog. - // Wire name: 'catalog_name' CatalogName string `json:"catalog_name,omitempty"` // The type of the parent catalog. - // Wire name: 'catalog_type' CatalogType CatalogType `json:"catalog_type,omitempty"` // User-provided free-form text description. - // Wire name: 'comment' Comment string `json:"comment,omitempty"` // Time at which this schema was created, in epoch milliseconds. - // Wire name: 'created_at' CreatedAt int64 `json:"created_at,omitempty"` // Username of schema creator. - // Wire name: 'created_by' CreatedBy string `json:"created_by,omitempty"` - // Wire name: 'effective_predictive_optimization_flag' EffectivePredictiveOptimizationFlag *EffectivePredictiveOptimizationFlag `json:"effective_predictive_optimization_flag,omitempty"` // Whether predictive optimization should be enabled for this object and // objects under it. - // Wire name: 'enable_predictive_optimization' EnablePredictiveOptimization EnablePredictiveOptimization `json:"enable_predictive_optimization,omitempty"` // Full name of schema, in form of __catalog_name__.__schema_name__. - // Wire name: 'full_name' FullName string `json:"full_name,omitempty"` // Unique identifier of parent metastore. - // Wire name: 'metastore_id' MetastoreId string `json:"metastore_id,omitempty"` // Name of schema, relative to parent catalog. - // Wire name: 'name' Name string `json:"name,omitempty"` // Username of current owner of schema. - // Wire name: 'owner' Owner string `json:"owner,omitempty"` // A map of key-value properties attached to the securable. - // Wire name: 'properties' Properties map[string]string `json:"properties,omitempty"` // The unique identifier of the schema. - // Wire name: 'schema_id' SchemaId string `json:"schema_id,omitempty"` // Storage location for managed tables within schema. - // Wire name: 'storage_location' StorageLocation string `json:"storage_location,omitempty"` // Storage root URL for managed tables within schema. - // Wire name: 'storage_root' StorageRoot string `json:"storage_root,omitempty"` // Time at which this schema was created, in epoch milliseconds. - // Wire name: 'updated_at' UpdatedAt int64 `json:"updated_at,omitempty"` // Username of user who last modified schema. - // Wire name: 'updated_by' UpdatedBy string `json:"updated_by,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *SchemaInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &schemaInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := schemaInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *SchemaInfo) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st SchemaInfo) MarshalJSON() ([]byte, error) { - pb, err := schemaInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s SchemaInfo) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The type of Unity Catalog securable. @@ -10270,123 +5589,55 @@ func (f *SecurableType) Type() string { type SetArtifactAllowlist struct { // A list of allowed artifact match patterns. - // Wire name: 'artifact_matchers' ArtifactMatchers []ArtifactMatcher `json:"artifact_matchers"` // The artifact type of the allowlist. - ArtifactType ArtifactType `json:"-" tf:"-"` + ArtifactType ArtifactType `json:"-" url:"-"` // Time at which this artifact allowlist was set, in epoch milliseconds. - // Wire name: 'created_at' CreatedAt int64 `json:"created_at,omitempty"` // Username of the user who set the artifact allowlist. - // Wire name: 'created_by' CreatedBy string `json:"created_by,omitempty"` // Unique identifier of parent metastore. - // Wire name: 'metastore_id' MetastoreId string `json:"metastore_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *SetArtifactAllowlist) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &setArtifactAllowlistPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := setArtifactAllowlistFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *SetArtifactAllowlist) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st SetArtifactAllowlist) MarshalJSON() ([]byte, error) { - pb, err := setArtifactAllowlistToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s SetArtifactAllowlist) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type SetRegisteredModelAliasRequest struct { // The name of the alias - // Wire name: 'alias' - Alias string `json:"alias"` + Alias string `json:"alias" url:"-"` // Full name of the registered model - // Wire name: 'full_name' - FullName string `json:"full_name"` + FullName string `json:"full_name" url:"-"` // The version number of the model version to which the alias points - // Wire name: 'version_num' VersionNum int `json:"version_num"` } -func (st *SetRegisteredModelAliasRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &setRegisteredModelAliasRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := setRegisteredModelAliasRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st SetRegisteredModelAliasRequest) MarshalJSON() ([]byte, error) { - pb, err := setRegisteredModelAliasRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Server-Side Encryption properties for clients communicating with AWS s3. type SseEncryptionDetails struct { // Sets the value of the 'x-amz-server-side-encryption' header in S3 // request. - // Wire name: 'algorithm' Algorithm SseEncryptionDetailsAlgorithm `json:"algorithm,omitempty"` // Optional. The ARN of the SSE-KMS key used with the S3 location, when // algorithm = "SSE-KMS". Sets the value of the // 'x-amz-server-side-encryption-aws-kms-key-id' header. - // Wire name: 'aws_kms_key_arn' AwsKmsKeyArn string `json:"aws_kms_key_arn,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *SseEncryptionDetails) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &sseEncryptionDetailsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := sseEncryptionDetailsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *SseEncryptionDetails) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st SseEncryptionDetails) MarshalJSON() ([]byte, error) { - pb, err := sseEncryptionDetailsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s SseEncryptionDetails) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type SseEncryptionDetailsAlgorithm string @@ -10428,371 +5679,187 @@ func (f *SseEncryptionDetailsAlgorithm) Type() string { type StorageCredentialInfo struct { // The AWS IAM role configuration. - // Wire name: 'aws_iam_role' AwsIamRole *AwsIamRoleResponse `json:"aws_iam_role,omitempty"` // The Azure managed identity configuration. - // Wire name: 'azure_managed_identity' AzureManagedIdentity *AzureManagedIdentityResponse `json:"azure_managed_identity,omitempty"` // The Azure service principal configuration. - // Wire name: 'azure_service_principal' AzureServicePrincipal *AzureServicePrincipal `json:"azure_service_principal,omitempty"` // The Cloudflare API token configuration. - // Wire name: 'cloudflare_api_token' CloudflareApiToken *CloudflareApiToken `json:"cloudflare_api_token,omitempty"` // Comment associated with the credential. - // Wire name: 'comment' Comment string `json:"comment,omitempty"` // Time at which this credential was created, in epoch milliseconds. - // Wire name: 'created_at' CreatedAt int64 `json:"created_at,omitempty"` // Username of credential creator. - // Wire name: 'created_by' CreatedBy string `json:"created_by,omitempty"` // The Databricks managed GCP service account configuration. - // Wire name: 'databricks_gcp_service_account' DatabricksGcpServiceAccount *DatabricksGcpServiceAccountResponse `json:"databricks_gcp_service_account,omitempty"` // The full name of the credential. - // Wire name: 'full_name' FullName string `json:"full_name,omitempty"` // The unique identifier of the credential. - // Wire name: 'id' Id string `json:"id,omitempty"` // Whether the current securable is accessible from all workspaces or a // specific set of workspaces. - // Wire name: 'isolation_mode' IsolationMode IsolationMode `json:"isolation_mode,omitempty"` // Unique identifier of the parent metastore. - // Wire name: 'metastore_id' MetastoreId string `json:"metastore_id,omitempty"` // The credential name. The name must be unique among storage and service // credentials within the metastore. - // Wire name: 'name' Name string `json:"name,omitempty"` // Username of current owner of credential. - // Wire name: 'owner' Owner string `json:"owner,omitempty"` // Whether the credential is usable only for read operations. Only // applicable when purpose is **STORAGE**. - // Wire name: 'read_only' ReadOnly bool `json:"read_only,omitempty"` // Time at which this credential was last modified, in epoch milliseconds. - // Wire name: 'updated_at' UpdatedAt int64 `json:"updated_at,omitempty"` // Username of user who last modified the credential. - // Wire name: 'updated_by' UpdatedBy string `json:"updated_by,omitempty"` // Whether this credential is the current metastore's root storage // credential. Only applicable when purpose is **STORAGE**. - // Wire name: 'used_for_managed_storage' UsedForManagedStorage bool `json:"used_for_managed_storage,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *StorageCredentialInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &storageCredentialInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := storageCredentialInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *StorageCredentialInfo) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st StorageCredentialInfo) MarshalJSON() ([]byte, error) { - pb, err := storageCredentialInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s StorageCredentialInfo) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type SystemSchemaInfo struct { // Name of the system schema. - // Wire name: 'schema' Schema string `json:"schema"` // The current state of enablement for the system schema. An empty string // means the system schema is available and ready for opt-in. Possible // values: AVAILABLE | ENABLE_INITIALIZED | ENABLE_COMPLETED | // DISABLE_INITIALIZED | UNAVAILABLE - // Wire name: 'state' State string `json:"state"` } -func (st *SystemSchemaInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &systemSchemaInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := systemSchemaInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st SystemSchemaInfo) MarshalJSON() ([]byte, error) { - pb, err := systemSchemaInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // A table constraint, as defined by *one* of the following fields being set: // __primary_key_constraint__, __foreign_key_constraint__, // __named_table_constraint__. type TableConstraint struct { - - // Wire name: 'foreign_key_constraint' ForeignKeyConstraint *ForeignKeyConstraint `json:"foreign_key_constraint,omitempty"` - // Wire name: 'named_table_constraint' NamedTableConstraint *NamedTableConstraint `json:"named_table_constraint,omitempty"` - // Wire name: 'primary_key_constraint' PrimaryKeyConstraint *PrimaryKeyConstraint `json:"primary_key_constraint,omitempty"` } -func (st *TableConstraint) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &tableConstraintPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := tableConstraintFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st TableConstraint) MarshalJSON() ([]byte, error) { - pb, err := tableConstraintToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // A table that is dependent on a SQL object. type TableDependency struct { // Full name of the dependent table, in the form of // __catalog_name__.__schema_name__.__table_name__. - // Wire name: 'table_full_name' TableFullName string `json:"table_full_name"` } -func (st *TableDependency) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &tableDependencyPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := tableDependencyFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st TableDependency) MarshalJSON() ([]byte, error) { - pb, err := tableDependencyToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type TableExistsResponse struct { // Whether the table exists or not. - // Wire name: 'table_exists' TableExists bool `json:"table_exists,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *TableExistsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &tableExistsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := tableExistsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *TableExistsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st TableExistsResponse) MarshalJSON() ([]byte, error) { - pb, err := tableExistsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s TableExistsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type TableInfo struct { // The AWS access point to use when accesing s3 for this external location. - // Wire name: 'access_point' AccessPoint string `json:"access_point,omitempty"` // Indicates whether the principal is limited to retrieving metadata for the // associated object through the BROWSE privilege when include_browse is // enabled in the request. - // Wire name: 'browse_only' BrowseOnly bool `json:"browse_only,omitempty"` // Name of parent catalog. - // Wire name: 'catalog_name' CatalogName string `json:"catalog_name,omitempty"` // The array of __ColumnInfo__ definitions of the table's columns. - // Wire name: 'columns' Columns []ColumnInfo `json:"columns,omitempty"` // User-provided free-form text description. - // Wire name: 'comment' Comment string `json:"comment,omitempty"` // Time at which this table was created, in epoch milliseconds. - // Wire name: 'created_at' CreatedAt int64 `json:"created_at,omitempty"` // Username of table creator. - // Wire name: 'created_by' CreatedBy string `json:"created_by,omitempty"` // Unique ID of the Data Access Configuration to use with the table data. - // Wire name: 'data_access_configuration_id' DataAccessConfigurationId string `json:"data_access_configuration_id,omitempty"` // Data source format - // Wire name: 'data_source_format' DataSourceFormat DataSourceFormat `json:"data_source_format,omitempty"` // Time at which this table was deleted, in epoch milliseconds. Field is // omitted if table is not deleted. - // Wire name: 'deleted_at' DeletedAt int64 `json:"deleted_at,omitempty"` // Information pertaining to current state of the delta table. - // Wire name: 'delta_runtime_properties_kvpairs' DeltaRuntimePropertiesKvpairs *DeltaRuntimePropertiesKvPairs `json:"delta_runtime_properties_kvpairs,omitempty"` - // Wire name: 'effective_predictive_optimization_flag' EffectivePredictiveOptimizationFlag *EffectivePredictiveOptimizationFlag `json:"effective_predictive_optimization_flag,omitempty"` - // Wire name: 'enable_predictive_optimization' EnablePredictiveOptimization EnablePredictiveOptimization `json:"enable_predictive_optimization,omitempty"` // Encryption options that apply to clients connecting to cloud storage. - // Wire name: 'encryption_details' EncryptionDetails *EncryptionDetails `json:"encryption_details,omitempty"` // Full name of table, in form of // __catalog_name__.__schema_name__.__table_name__ - // Wire name: 'full_name' FullName string `json:"full_name,omitempty"` // Unique identifier of parent metastore. - // Wire name: 'metastore_id' MetastoreId string `json:"metastore_id,omitempty"` // Name of table, relative to parent schema. - // Wire name: 'name' Name string `json:"name,omitempty"` // Username of current owner of table. - // Wire name: 'owner' Owner string `json:"owner,omitempty"` // The pipeline ID of the table. Applicable for tables created by pipelines // (Materialized View, Streaming Table, etc.). - // Wire name: 'pipeline_id' PipelineId string `json:"pipeline_id,omitempty"` // A map of key-value properties attached to the securable. - // Wire name: 'properties' Properties map[string]string `json:"properties,omitempty"` - // Wire name: 'row_filter' RowFilter *TableRowFilter `json:"row_filter,omitempty"` // Name of parent schema relative to its parent catalog. - // Wire name: 'schema_name' SchemaName string `json:"schema_name,omitempty"` // List of schemes whose objects can be referenced without qualification. - // Wire name: 'sql_path' SqlPath string `json:"sql_path,omitempty"` // Name of the storage credential, when a storage credential is configured // for use with this table. - // Wire name: 'storage_credential_name' StorageCredentialName string `json:"storage_credential_name,omitempty"` // Storage root URL for table (for **MANAGED**, **EXTERNAL** tables) - // Wire name: 'storage_location' StorageLocation string `json:"storage_location,omitempty"` // List of table constraints. Note: this field is not set in the output of // the __listTables__ API. - // Wire name: 'table_constraints' TableConstraints []TableConstraint `json:"table_constraints,omitempty"` // The unique identifier of the table. - // Wire name: 'table_id' TableId string `json:"table_id,omitempty"` - // Wire name: 'table_type' TableType TableType `json:"table_type,omitempty"` // Time at which this table was last modified, in epoch milliseconds. - // Wire name: 'updated_at' UpdatedAt int64 `json:"updated_at,omitempty"` // Username of user who last modified the table. - // Wire name: 'updated_by' UpdatedBy string `json:"updated_by,omitempty"` // View definition SQL (when __table_type__ is **VIEW**, // **MATERIALIZED_VIEW**, or **STREAMING_TABLE**) - // Wire name: 'view_definition' ViewDefinition string `json:"view_definition,omitempty"` // View dependencies (when table_type == **VIEW** or **MATERIALIZED_VIEW**, // **STREAMING_TABLE**) - when DependencyList is None, the dependency is not // provided; - when DependencyList is an empty list, the dependency is // provided but is empty; - when DependencyList is not an empty list, // dependencies are provided and recorded. - // Wire name: 'view_dependencies' ViewDependencies *DependencyList `json:"view_dependencies,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *TableInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &tableInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := tableInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *TableInfo) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st TableInfo) MarshalJSON() ([]byte, error) { - pb, err := tableInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s TableInfo) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type TableOperation string @@ -10834,74 +5901,28 @@ func (f *TableOperation) Type() string { type TableRowFilter struct { // The full name of the row filter SQL UDF. - // Wire name: 'function_name' FunctionName string `json:"function_name"` // The list of table columns to be passed as input to the row filter // function. The column types should match the types of the filter function // arguments. - // Wire name: 'input_column_names' InputColumnNames []string `json:"input_column_names"` } -func (st *TableRowFilter) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &tableRowFilterPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := tableRowFilterFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st TableRowFilter) MarshalJSON() ([]byte, error) { - pb, err := tableRowFilterToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type TableSummary struct { // The full name of the table. - // Wire name: 'full_name' FullName string `json:"full_name,omitempty"` - // Wire name: 'table_type' TableType TableType `json:"table_type,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *TableSummary) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &tableSummaryPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := tableSummaryFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *TableSummary) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st TableSummary) MarshalJSON() ([]byte, error) { - pb, err := tableSummaryToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s TableSummary) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type TableType string @@ -10961,85 +5982,45 @@ func (f *TableType) Type() string { type TagKeyValue struct { // name of the tag - // Wire name: 'key' Key string `json:"key,omitempty"` // value of the tag associated with the key, could be optional - // Wire name: 'value' Value string `json:"value,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *TagKeyValue) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &tagKeyValuePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := tagKeyValueFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *TagKeyValue) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st TagKeyValue) MarshalJSON() ([]byte, error) { - pb, err := tagKeyValueToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s TagKeyValue) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type TemporaryCredentials struct { // AWS temporary credentials for API authentication. Read more at // https://docs.aws.amazon.com/STS/latest/APIReference/API_Credentials.html. - // Wire name: 'aws_temp_credentials' AwsTempCredentials *AwsCredentials `json:"aws_temp_credentials,omitempty"` // Azure Active Directory token, essentially the Oauth token for Azure // Service Principal or Managed Identity. Read more at // https://learn.microsoft.com/en-us/azure/databricks/dev-tools/api/latest/aad/service-prin-aad-token - // Wire name: 'azure_aad' AzureAad *AzureActiveDirectoryToken `json:"azure_aad,omitempty"` // Server time when the credential will expire, in epoch milliseconds. The // API client is advised to cache the credential given this expiration time. - // Wire name: 'expiration_time' ExpirationTime int64 `json:"expiration_time,omitempty"` // GCP temporary credentials for API authentication. Read more at // https://developers.google.com/identity/protocols/oauth2/service-account - // Wire name: 'gcp_oauth_token' GcpOauthToken *GcpOauthToken `json:"gcp_oauth_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *TemporaryCredentials) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &temporaryCredentialsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := temporaryCredentialsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *TemporaryCredentials) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st TemporaryCredentials) MarshalJSON() ([]byte, error) { - pb, err := temporaryCredentialsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s TemporaryCredentials) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Detailed status of an online table. Shown if the online table is in the @@ -11048,1183 +6029,543 @@ type TriggeredUpdateStatus struct { // The last source table Delta version that was synced to the online table. // Note that this Delta version may not be completely synced to the online // table yet. - // Wire name: 'last_processed_commit_version' LastProcessedCommitVersion int64 `json:"last_processed_commit_version,omitempty"` // The timestamp of the last time any data was synchronized from the source // table to the online table. - // Wire name: 'timestamp' Timestamp string `json:"timestamp,omitempty"` // Progress of the active data synchronization pipeline. - // Wire name: 'triggered_update_progress' TriggeredUpdateProgress *PipelineProgress `json:"triggered_update_progress,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *TriggeredUpdateStatus) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &triggeredUpdateStatusPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := triggeredUpdateStatusFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *TriggeredUpdateStatus) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st TriggeredUpdateStatus) MarshalJSON() ([]byte, error) { - pb, err := triggeredUpdateStatusToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s TriggeredUpdateStatus) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Delete an assignment type UnassignRequest struct { // Query for the ID of the metastore to delete. - MetastoreId string `json:"-" tf:"-"` + MetastoreId string `json:"-" url:"metastore_id"` // A workspace ID. - WorkspaceId int64 `json:"-" tf:"-"` -} - -func (st *UnassignRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &unassignRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := unassignRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UnassignRequest) MarshalJSON() ([]byte, error) { - pb, err := unassignRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + WorkspaceId int64 `json:"-" url:"-"` } type UnassignResponse struct { } -func (st *UnassignResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &unassignResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := unassignResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UnassignResponse) MarshalJSON() ([]byte, error) { - pb, err := unassignResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type UpdateAssignmentResponse struct { } -func (st *UpdateAssignmentResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateAssignmentResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateAssignmentResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateAssignmentResponse) MarshalJSON() ([]byte, error) { - pb, err := updateAssignmentResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type UpdateCatalog struct { // User-provided free-form text description. - // Wire name: 'comment' Comment string `json:"comment,omitempty"` // Whether predictive optimization should be enabled for this object and // objects under it. - // Wire name: 'enable_predictive_optimization' EnablePredictiveOptimization EnablePredictiveOptimization `json:"enable_predictive_optimization,omitempty"` // Whether the current securable is accessible from all workspaces or a // specific set of workspaces. - // Wire name: 'isolation_mode' IsolationMode CatalogIsolationMode `json:"isolation_mode,omitempty"` // The name of the catalog. - Name string `json:"-" tf:"-"` + Name string `json:"-" url:"-"` // New name for the catalog. - // Wire name: 'new_name' NewName string `json:"new_name,omitempty"` // A map of key-value properties attached to the securable. - // Wire name: 'options' Options map[string]string `json:"options,omitempty"` // Username of current owner of catalog. - // Wire name: 'owner' Owner string `json:"owner,omitempty"` // A map of key-value properties attached to the securable. - // Wire name: 'properties' Properties map[string]string `json:"properties,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *UpdateCatalog) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateCatalogPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateCatalogFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *UpdateCatalog) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st UpdateCatalog) MarshalJSON() ([]byte, error) { - pb, err := updateCatalogToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s UpdateCatalog) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type UpdateCatalogWorkspaceBindingsResponse struct { // A list of workspace IDs - // Wire name: 'workspaces' Workspaces []int64 `json:"workspaces,omitempty"` } -func (st *UpdateCatalogWorkspaceBindingsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateCatalogWorkspaceBindingsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateCatalogWorkspaceBindingsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateCatalogWorkspaceBindingsResponse) MarshalJSON() ([]byte, error) { - pb, err := updateCatalogWorkspaceBindingsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type UpdateConnection struct { // Name of the connection. - Name string `json:"-" tf:"-"` + Name string `json:"-" url:"-"` // New name for the connection. - // Wire name: 'new_name' NewName string `json:"new_name,omitempty"` // A map of key-value properties attached to the securable. - // Wire name: 'options' Options map[string]string `json:"options"` // Username of current owner of the connection. - // Wire name: 'owner' Owner string `json:"owner,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *UpdateConnection) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateConnectionPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateConnectionFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *UpdateConnection) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st UpdateConnection) MarshalJSON() ([]byte, error) { - pb, err := updateConnectionToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s UpdateConnection) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type UpdateCredentialRequest struct { // The AWS IAM role configuration. - // Wire name: 'aws_iam_role' AwsIamRole *AwsIamRole `json:"aws_iam_role,omitempty"` // The Azure managed identity configuration. - // Wire name: 'azure_managed_identity' AzureManagedIdentity *AzureManagedIdentity `json:"azure_managed_identity,omitempty"` // The Azure service principal configuration. - // Wire name: 'azure_service_principal' AzureServicePrincipal *AzureServicePrincipal `json:"azure_service_principal,omitempty"` // Comment associated with the credential. - // Wire name: 'comment' Comment string `json:"comment,omitempty"` // The Databricks managed GCP service account configuration. - // Wire name: 'databricks_gcp_service_account' DatabricksGcpServiceAccount *DatabricksGcpServiceAccount `json:"databricks_gcp_service_account,omitempty"` // Force an update even if there are dependent services (when purpose is // **SERVICE**) or dependent external locations and external tables (when // purpose is **STORAGE**). - // Wire name: 'force' Force bool `json:"force,omitempty"` // Whether the current securable is accessible from all workspaces or a // specific set of workspaces. - // Wire name: 'isolation_mode' IsolationMode IsolationMode `json:"isolation_mode,omitempty"` // Name of the credential. - NameArg string `json:"-" tf:"-"` + NameArg string `json:"-" url:"-"` // New name of credential. - // Wire name: 'new_name' NewName string `json:"new_name,omitempty"` // Username of current owner of credential. - // Wire name: 'owner' Owner string `json:"owner,omitempty"` // Whether the credential is usable only for read operations. Only // applicable when purpose is **STORAGE**. - // Wire name: 'read_only' ReadOnly bool `json:"read_only,omitempty"` // Supply true to this argument to skip validation of the updated // credential. - // Wire name: 'skip_validation' SkipValidation bool `json:"skip_validation,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *UpdateCredentialRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateCredentialRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateCredentialRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *UpdateCredentialRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st UpdateCredentialRequest) MarshalJSON() ([]byte, error) { - pb, err := updateCredentialRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s UpdateCredentialRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type UpdateExternalLocation struct { // User-provided free-form text description. - // Wire name: 'comment' Comment string `json:"comment,omitempty"` // Name of the storage credential used with this location. - // Wire name: 'credential_name' CredentialName string `json:"credential_name,omitempty"` // [Create:OPT Update:OPT] Whether to enable file events on this external // location. - // Wire name: 'enable_file_events' EnableFileEvents bool `json:"enable_file_events,omitempty"` // Encryption options that apply to clients connecting to cloud storage. - // Wire name: 'encryption_details' EncryptionDetails *EncryptionDetails `json:"encryption_details,omitempty"` // Indicates whether fallback mode is enabled for this external location. // When fallback mode is enabled, the access to the location falls back to // cluster credentials if UC credentials are not sufficient. - // Wire name: 'fallback' Fallback bool `json:"fallback,omitempty"` // [Create:OPT Update:OPT] File event queue settings. - // Wire name: 'file_event_queue' FileEventQueue *FileEventQueue `json:"file_event_queue,omitempty"` // Force update even if changing url invalidates dependent external tables // or mounts. - // Wire name: 'force' Force bool `json:"force,omitempty"` - // Wire name: 'isolation_mode' IsolationMode IsolationMode `json:"isolation_mode,omitempty"` // Name of the external location. - Name string `json:"-" tf:"-"` + Name string `json:"-" url:"-"` // New name for the external location. - // Wire name: 'new_name' NewName string `json:"new_name,omitempty"` // The owner of the external location. - // Wire name: 'owner' Owner string `json:"owner,omitempty"` // Indicates whether the external location is read-only. - // Wire name: 'read_only' ReadOnly bool `json:"read_only,omitempty"` // Skips validation of the storage credential associated with the external // location. - // Wire name: 'skip_validation' SkipValidation bool `json:"skip_validation,omitempty"` // Path URL of the external location. - // Wire name: 'url' Url string `json:"url,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *UpdateExternalLocation) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateExternalLocationPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateExternalLocationFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *UpdateExternalLocation) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st UpdateExternalLocation) MarshalJSON() ([]byte, error) { - pb, err := updateExternalLocationToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s UpdateExternalLocation) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type UpdateFunction struct { // The fully-qualified name of the function (of the form // __catalog_name__.__schema_name__.__function__name__). - Name string `json:"-" tf:"-"` + Name string `json:"-" url:"-"` // Username of current owner of function. - // Wire name: 'owner' Owner string `json:"owner,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *UpdateFunction) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateFunctionPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateFunctionFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *UpdateFunction) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st UpdateFunction) MarshalJSON() ([]byte, error) { - pb, err := updateFunctionToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s UpdateFunction) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type UpdateMetastore struct { // The organization name of a Delta Sharing entity, to be used in // Databricks-to-Databricks Delta Sharing as the official name. - // Wire name: 'delta_sharing_organization_name' DeltaSharingOrganizationName string `json:"delta_sharing_organization_name,omitempty"` // The lifetime of delta sharing recipient token in seconds. - // Wire name: 'delta_sharing_recipient_token_lifetime_in_seconds' DeltaSharingRecipientTokenLifetimeInSeconds int64 `json:"delta_sharing_recipient_token_lifetime_in_seconds,omitempty"` // The scope of Delta Sharing enabled for the metastore. - // Wire name: 'delta_sharing_scope' DeltaSharingScope DeltaSharingScopeEnum `json:"delta_sharing_scope,omitempty"` // Unique ID of the metastore. - Id string `json:"-" tf:"-"` + Id string `json:"-" url:"-"` // New name for the metastore. - // Wire name: 'new_name' NewName string `json:"new_name,omitempty"` // The owner of the metastore. - // Wire name: 'owner' Owner string `json:"owner,omitempty"` // Privilege model version of the metastore, of the form `major.minor` // (e.g., `1.0`). - // Wire name: 'privilege_model_version' PrivilegeModelVersion string `json:"privilege_model_version,omitempty"` // UUID of storage credential to access the metastore storage_root. - // Wire name: 'storage_root_credential_id' StorageRootCredentialId string `json:"storage_root_credential_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *UpdateMetastore) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateMetastorePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateMetastoreFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *UpdateMetastore) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st UpdateMetastore) MarshalJSON() ([]byte, error) { - pb, err := updateMetastoreToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s UpdateMetastore) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type UpdateMetastoreAssignment struct { // The name of the default catalog in the metastore. This field is // deprecated. Please use "Default Namespace API" to configure the default // catalog for a Databricks workspace. - // Wire name: 'default_catalog_name' DefaultCatalogName string `json:"default_catalog_name,omitempty"` // The unique ID of the metastore. - // Wire name: 'metastore_id' MetastoreId string `json:"metastore_id,omitempty"` // A workspace ID. - WorkspaceId int64 `json:"-" tf:"-"` + WorkspaceId int64 `json:"-" url:"-"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *UpdateMetastoreAssignment) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateMetastoreAssignmentPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateMetastoreAssignmentFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *UpdateMetastoreAssignment) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st UpdateMetastoreAssignment) MarshalJSON() ([]byte, error) { - pb, err := updateMetastoreAssignmentToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s UpdateMetastoreAssignment) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type UpdateModelVersionRequest struct { // The comment attached to the model version - // Wire name: 'comment' Comment string `json:"comment,omitempty"` // The three-level (fully qualified) name of the model version - FullName string `json:"-" tf:"-"` + FullName string `json:"-" url:"-"` // The integer version number of the model version - Version int `json:"-" tf:"-"` + Version int `json:"-" url:"-"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *UpdateModelVersionRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateModelVersionRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateModelVersionRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *UpdateModelVersionRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st UpdateModelVersionRequest) MarshalJSON() ([]byte, error) { - pb, err := updateModelVersionRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s UpdateModelVersionRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type UpdateMonitor struct { // Name of the baseline table from which drift metrics are computed from. // Columns in the monitored table should also be present in the baseline // table. - // Wire name: 'baseline_table_name' BaselineTableName string `json:"baseline_table_name,omitempty"` // Custom metrics to compute on the monitored table. These can be aggregate // metrics, derived metrics (from already computed aggregate metrics), or // drift metrics (comparing metrics across time windows). - // Wire name: 'custom_metrics' CustomMetrics []MonitorMetric `json:"custom_metrics,omitempty"` // Id of dashboard that visualizes the computed metrics. This can be empty // if the monitor is in PENDING state. - // Wire name: 'dashboard_id' DashboardId string `json:"dashboard_id,omitempty"` // The data classification config for the monitor. - // Wire name: 'data_classification_config' DataClassificationConfig *MonitorDataClassificationConfig `json:"data_classification_config,omitempty"` // Configuration for monitoring inference logs. - // Wire name: 'inference_log' InferenceLog *MonitorInferenceLog `json:"inference_log,omitempty"` // The notification settings for the monitor. - // Wire name: 'notifications' Notifications *MonitorNotifications `json:"notifications,omitempty"` // Schema where output metric tables are created. - // Wire name: 'output_schema_name' OutputSchemaName string `json:"output_schema_name"` // The schedule for automatically updating and refreshing metric tables. - // Wire name: 'schedule' Schedule *MonitorCronSchedule `json:"schedule,omitempty"` // List of column expressions to slice data with for targeted analysis. The // data is grouped by each expression independently, resulting in a separate // slice for each predicate and its complements. For high-cardinality // columns, only the top 100 unique values by frequency will generate // slices. - // Wire name: 'slicing_exprs' SlicingExprs []string `json:"slicing_exprs,omitempty"` // Configuration for monitoring snapshot tables. - // Wire name: 'snapshot' Snapshot *MonitorSnapshot `json:"snapshot,omitempty"` // Full name of the table. - TableName string `json:"-" tf:"-"` + TableName string `json:"-" url:"-"` // Configuration for monitoring time series tables. - // Wire name: 'time_series' TimeSeries *MonitorTimeSeries `json:"time_series,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *UpdateMonitor) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateMonitorPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateMonitorFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *UpdateMonitor) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st UpdateMonitor) MarshalJSON() ([]byte, error) { - pb, err := updateMonitorToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s UpdateMonitor) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type UpdatePermissions struct { // Array of permissions change objects. - // Wire name: 'changes' Changes []PermissionsChange `json:"changes,omitempty"` // Full name of securable. - FullName string `json:"-" tf:"-"` + FullName string `json:"-" url:"-"` // Type of securable. - SecurableType string `json:"-" tf:"-"` -} - -func (st *UpdatePermissions) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updatePermissionsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updatePermissionsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdatePermissions) MarshalJSON() ([]byte, error) { - pb, err := updatePermissionsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + SecurableType string `json:"-" url:"-"` } type UpdatePermissionsResponse struct { // The privileges assigned to each principal - // Wire name: 'privilege_assignments' PrivilegeAssignments []PrivilegeAssignment `json:"privilege_assignments,omitempty"` } -func (st *UpdatePermissionsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updatePermissionsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updatePermissionsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdatePermissionsResponse) MarshalJSON() ([]byte, error) { - pb, err := updatePermissionsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type UpdateRegisteredModelRequest struct { // The comment attached to the registered model - // Wire name: 'comment' Comment string `json:"comment,omitempty"` // The three-level (fully qualified) name of the registered model - FullName string `json:"-" tf:"-"` + FullName string `json:"-" url:"-"` // New name for the registered model. - // Wire name: 'new_name' NewName string `json:"new_name,omitempty"` // The identifier of the user who owns the registered model - // Wire name: 'owner' Owner string `json:"owner,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *UpdateRegisteredModelRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateRegisteredModelRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateRegisteredModelRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *UpdateRegisteredModelRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st UpdateRegisteredModelRequest) MarshalJSON() ([]byte, error) { - pb, err := updateRegisteredModelRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s UpdateRegisteredModelRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type UpdateResponse struct { } -func (st *UpdateResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateResponse) MarshalJSON() ([]byte, error) { - pb, err := updateResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type UpdateSchema struct { // User-provided free-form text description. - // Wire name: 'comment' Comment string `json:"comment,omitempty"` // Whether predictive optimization should be enabled for this object and // objects under it. - // Wire name: 'enable_predictive_optimization' EnablePredictiveOptimization EnablePredictiveOptimization `json:"enable_predictive_optimization,omitempty"` // Full name of the schema. - FullName string `json:"-" tf:"-"` + FullName string `json:"-" url:"-"` // New name for the schema. - // Wire name: 'new_name' NewName string `json:"new_name,omitempty"` // Username of current owner of schema. - // Wire name: 'owner' Owner string `json:"owner,omitempty"` // A map of key-value properties attached to the securable. - // Wire name: 'properties' Properties map[string]string `json:"properties,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *UpdateSchema) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateSchemaPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateSchemaFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *UpdateSchema) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st UpdateSchema) MarshalJSON() ([]byte, error) { - pb, err := updateSchemaToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s UpdateSchema) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type UpdateStorageCredential struct { // The AWS IAM role configuration. - // Wire name: 'aws_iam_role' AwsIamRole *AwsIamRoleRequest `json:"aws_iam_role,omitempty"` // The Azure managed identity configuration. - // Wire name: 'azure_managed_identity' AzureManagedIdentity *AzureManagedIdentityResponse `json:"azure_managed_identity,omitempty"` // The Azure service principal configuration. - // Wire name: 'azure_service_principal' AzureServicePrincipal *AzureServicePrincipal `json:"azure_service_principal,omitempty"` // The Cloudflare API token configuration. - // Wire name: 'cloudflare_api_token' CloudflareApiToken *CloudflareApiToken `json:"cloudflare_api_token,omitempty"` // Comment associated with the credential. - // Wire name: 'comment' Comment string `json:"comment,omitempty"` // The Databricks managed GCP service account configuration. - // Wire name: 'databricks_gcp_service_account' DatabricksGcpServiceAccount *DatabricksGcpServiceAccountRequest `json:"databricks_gcp_service_account,omitempty"` // Force update even if there are dependent external locations or external // tables. - // Wire name: 'force' Force bool `json:"force,omitempty"` // Whether the current securable is accessible from all workspaces or a // specific set of workspaces. - // Wire name: 'isolation_mode' IsolationMode IsolationMode `json:"isolation_mode,omitempty"` // Name of the storage credential. - Name string `json:"-" tf:"-"` + Name string `json:"-" url:"-"` // New name for the storage credential. - // Wire name: 'new_name' NewName string `json:"new_name,omitempty"` // Username of current owner of credential. - // Wire name: 'owner' Owner string `json:"owner,omitempty"` // Whether the credential is usable only for read operations. Only // applicable when purpose is **STORAGE**. - // Wire name: 'read_only' ReadOnly bool `json:"read_only,omitempty"` // Supplying true to this argument skips validation of the updated // credential. - // Wire name: 'skip_validation' SkipValidation bool `json:"skip_validation,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *UpdateStorageCredential) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateStorageCredentialPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateStorageCredentialFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *UpdateStorageCredential) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st UpdateStorageCredential) MarshalJSON() ([]byte, error) { - pb, err := updateStorageCredentialToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s UpdateStorageCredential) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Update a table owner. type UpdateTableRequest struct { // Full name of the table. - FullName string `json:"-" tf:"-"` + FullName string `json:"-" url:"-"` - // Wire name: 'owner' Owner string `json:"owner,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *UpdateTableRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateTableRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateTableRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *UpdateTableRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st UpdateTableRequest) MarshalJSON() ([]byte, error) { - pb, err := updateTableRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s UpdateTableRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type UpdateVolumeRequestContent struct { // The comment attached to the volume - // Wire name: 'comment' Comment string `json:"comment,omitempty"` // The three-level (fully qualified) name of the volume - Name string `json:"-" tf:"-"` + Name string `json:"-" url:"-"` // New name for the volume. - // Wire name: 'new_name' NewName string `json:"new_name,omitempty"` // The identifier of the user who owns the volume - // Wire name: 'owner' Owner string `json:"owner,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *UpdateVolumeRequestContent) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateVolumeRequestContentPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateVolumeRequestContentFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *UpdateVolumeRequestContent) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st UpdateVolumeRequestContent) MarshalJSON() ([]byte, error) { - pb, err := updateVolumeRequestContentToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s UpdateVolumeRequestContent) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type UpdateWorkspaceBindings struct { // A list of workspace IDs. - // Wire name: 'assign_workspaces' AssignWorkspaces []int64 `json:"assign_workspaces,omitempty"` // The name of the catalog. - Name string `json:"-" tf:"-"` + Name string `json:"-" url:"-"` // A list of workspace IDs. - // Wire name: 'unassign_workspaces' UnassignWorkspaces []int64 `json:"unassign_workspaces,omitempty"` } -func (st *UpdateWorkspaceBindings) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateWorkspaceBindingsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateWorkspaceBindingsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateWorkspaceBindings) MarshalJSON() ([]byte, error) { - pb, err := updateWorkspaceBindingsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type UpdateWorkspaceBindingsParameters struct { // List of workspace bindings. - // Wire name: 'add' Add []WorkspaceBinding `json:"add,omitempty"` // List of workspace bindings. - // Wire name: 'remove' Remove []WorkspaceBinding `json:"remove,omitempty"` // The name of the securable. - SecurableName string `json:"-" tf:"-"` + SecurableName string `json:"-" url:"-"` // The type of the securable to bind to a workspace (catalog, // storage_credential, credential, or external_location). - SecurableType string `json:"-" tf:"-"` -} - -func (st *UpdateWorkspaceBindingsParameters) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateWorkspaceBindingsParametersPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateWorkspaceBindingsParametersFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateWorkspaceBindingsParameters) MarshalJSON() ([]byte, error) { - pb, err := updateWorkspaceBindingsParametersToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + SecurableType string `json:"-" url:"-"` } // A list of workspace IDs that are bound to the securable type UpdateWorkspaceBindingsResponse struct { // List of workspace bindings. - // Wire name: 'bindings' Bindings []WorkspaceBinding `json:"bindings,omitempty"` } -func (st *UpdateWorkspaceBindingsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateWorkspaceBindingsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateWorkspaceBindingsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateWorkspaceBindingsResponse) MarshalJSON() ([]byte, error) { - pb, err := updateWorkspaceBindingsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Next ID: 17 type ValidateCredentialRequest struct { // The AWS IAM role configuration - // Wire name: 'aws_iam_role' AwsIamRole *AwsIamRole `json:"aws_iam_role,omitempty"` // The Azure managed identity configuration. - // Wire name: 'azure_managed_identity' AzureManagedIdentity *AzureManagedIdentity `json:"azure_managed_identity,omitempty"` // Required. The name of an existing credential or long-lived cloud // credential to validate. - // Wire name: 'credential_name' CredentialName string `json:"credential_name,omitempty"` // GCP long-lived credential. Databricks-created Google Cloud Storage // service account. - // Wire name: 'databricks_gcp_service_account' DatabricksGcpServiceAccount *DatabricksGcpServiceAccount `json:"databricks_gcp_service_account,omitempty"` // The name of an existing external location to validate. Only applicable // for storage credentials (purpose is **STORAGE**.) - // Wire name: 'external_location_name' ExternalLocationName string `json:"external_location_name,omitempty"` // The purpose of the credential. This should only be used when the // credential is specified. - // Wire name: 'purpose' Purpose CredentialPurpose `json:"purpose,omitempty"` // Whether the credential is only usable for read operations. Only // applicable for storage credentials (purpose is **STORAGE**.) - // Wire name: 'read_only' ReadOnly bool `json:"read_only,omitempty"` // The external location url to validate. Only applicable when purpose is // **STORAGE**. - // Wire name: 'url' Url string `json:"url,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ValidateCredentialRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &validateCredentialRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := validateCredentialRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ValidateCredentialRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ValidateCredentialRequest) MarshalJSON() ([]byte, error) { - pb, err := validateCredentialRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ValidateCredentialRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ValidateCredentialResponse struct { // Whether the tested location is a directory in cloud storage. Only // applicable for when purpose is **STORAGE**. - // Wire name: 'isDir' IsDir bool `json:"isDir,omitempty"` // The results of the validation check. - // Wire name: 'results' Results []CredentialValidationResult `json:"results,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ValidateCredentialResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &validateCredentialResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := validateCredentialResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ValidateCredentialResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ValidateCredentialResponse) MarshalJSON() ([]byte, error) { - pb, err := validateCredentialResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ValidateCredentialResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // A enum represents the result of the file operation @@ -12270,135 +6611,70 @@ func (f *ValidateCredentialResult) Type() string { type ValidateStorageCredential struct { // The AWS IAM role configuration. - // Wire name: 'aws_iam_role' AwsIamRole *AwsIamRoleRequest `json:"aws_iam_role,omitempty"` // The Azure managed identity configuration. - // Wire name: 'azure_managed_identity' AzureManagedIdentity *AzureManagedIdentityRequest `json:"azure_managed_identity,omitempty"` // The Azure service principal configuration. - // Wire name: 'azure_service_principal' AzureServicePrincipal *AzureServicePrincipal `json:"azure_service_principal,omitempty"` // The Cloudflare API token configuration. - // Wire name: 'cloudflare_api_token' CloudflareApiToken *CloudflareApiToken `json:"cloudflare_api_token,omitempty"` // The Databricks created GCP service account configuration. - // Wire name: 'databricks_gcp_service_account' DatabricksGcpServiceAccount *DatabricksGcpServiceAccountRequest `json:"databricks_gcp_service_account,omitempty"` // The name of an existing external location to validate. - // Wire name: 'external_location_name' ExternalLocationName string `json:"external_location_name,omitempty"` // Whether the storage credential is only usable for read operations. - // Wire name: 'read_only' ReadOnly bool `json:"read_only,omitempty"` // Required. The name of an existing credential or long-lived cloud // credential to validate. - // Wire name: 'storage_credential_name' StorageCredentialName string `json:"storage_credential_name,omitempty"` // The external location url to validate. - // Wire name: 'url' Url string `json:"url,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ValidateStorageCredential) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &validateStorageCredentialPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := validateStorageCredentialFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ValidateStorageCredential) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ValidateStorageCredential) MarshalJSON() ([]byte, error) { - pb, err := validateStorageCredentialToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ValidateStorageCredential) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ValidateStorageCredentialResponse struct { // Whether the tested location is a directory in cloud storage. - // Wire name: 'isDir' IsDir bool `json:"isDir,omitempty"` // The results of the validation check. - // Wire name: 'results' Results []ValidationResult `json:"results,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ValidateStorageCredentialResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &validateStorageCredentialResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := validateStorageCredentialResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ValidateStorageCredentialResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ValidateStorageCredentialResponse) MarshalJSON() ([]byte, error) { - pb, err := validateStorageCredentialResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ValidateStorageCredentialResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ValidationResult struct { // Error message would exist when the result does not equal to **PASS**. - // Wire name: 'message' Message string `json:"message,omitempty"` // The operation tested. - // Wire name: 'operation' Operation ValidationResultOperation `json:"operation,omitempty"` // The results of the tested operation. - // Wire name: 'result' Result ValidationResultResult `json:"result,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ValidationResult) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &validationResultPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := validationResultFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ValidationResult) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ValidationResult) MarshalJSON() ([]byte, error) { - pb, err := validationResultToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ValidationResult) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // A enum represents the file operation performed on the external location with @@ -12492,54 +6768,38 @@ func (f *ValidationResultResult) Type() string { type VolumeInfo struct { // The AWS access point to use when accesing s3 for this external location. - // Wire name: 'access_point' AccessPoint string `json:"access_point,omitempty"` // Indicates whether the principal is limited to retrieving metadata for the // associated object through the BROWSE privilege when include_browse is // enabled in the request. - // Wire name: 'browse_only' BrowseOnly bool `json:"browse_only,omitempty"` // The name of the catalog where the schema and the volume are - // Wire name: 'catalog_name' CatalogName string `json:"catalog_name,omitempty"` // The comment attached to the volume - // Wire name: 'comment' Comment string `json:"comment,omitempty"` - // Wire name: 'created_at' CreatedAt int64 `json:"created_at,omitempty"` // The identifier of the user who created the volume - // Wire name: 'created_by' CreatedBy string `json:"created_by,omitempty"` // Encryption options that apply to clients connecting to cloud storage. - // Wire name: 'encryption_details' EncryptionDetails *EncryptionDetails `json:"encryption_details,omitempty"` // The three-level (fully qualified) name of the volume - // Wire name: 'full_name' FullName string `json:"full_name,omitempty"` // The unique identifier of the metastore - // Wire name: 'metastore_id' MetastoreId string `json:"metastore_id,omitempty"` // The name of the volume - // Wire name: 'name' Name string `json:"name,omitempty"` // The identifier of the user who owns the volume - // Wire name: 'owner' Owner string `json:"owner,omitempty"` // The name of the schema where the volume is - // Wire name: 'schema_name' SchemaName string `json:"schema_name,omitempty"` // The storage location on the cloud - // Wire name: 'storage_location' StorageLocation string `json:"storage_location,omitempty"` - // Wire name: 'updated_at' UpdatedAt int64 `json:"updated_at,omitempty"` // The identifier of the user who updated the volume last time - // Wire name: 'updated_by' UpdatedBy string `json:"updated_by,omitempty"` // The unique identifier of the volume - // Wire name: 'volume_id' VolumeId string `json:"volume_id,omitempty"` // The type of the volume. An external volume is located in the specified // external location. A managed volume is located in the default location @@ -12547,35 +6807,17 @@ type VolumeInfo struct { // Metastore. [Learn more] // // [Learn more]: https://docs.databricks.com/aws/en/volumes/managed-vs-external - // Wire name: 'volume_type' VolumeType VolumeType `json:"volume_type,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *VolumeInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &volumeInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := volumeInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *VolumeInfo) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st VolumeInfo) MarshalJSON() ([]byte, error) { - pb, err := volumeInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s VolumeInfo) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The type of the volume. An external volume is located in the specified @@ -12623,38 +6865,11 @@ func (f *VolumeType) Type() string { type WorkspaceBinding struct { // One of READ_WRITE/READ_ONLY. Default is READ_WRITE. - // Wire name: 'binding_type' BindingType WorkspaceBindingBindingType `json:"binding_type,omitempty"` // Required - // Wire name: 'workspace_id' WorkspaceId int64 `json:"workspace_id"` } -func (st *WorkspaceBinding) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &workspaceBindingPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := workspaceBindingFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st WorkspaceBinding) MarshalJSON() ([]byte, error) { - pb, err := workspaceBindingToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Using `BINDING_TYPE_` prefix here to avoid conflict with `TableOperation` // enum in `credentials_common.proto`. type WorkspaceBindingBindingType string diff --git a/service/cleanrooms/impl.go b/service/cleanrooms/impl.go index 35f3c1c2d..2ed4383cd 100755 --- a/service/cleanrooms/impl.go +++ b/service/cleanrooms/impl.go @@ -18,96 +18,34 @@ type cleanRoomAssetsImpl struct { } func (a *cleanRoomAssetsImpl) Create(ctx context.Context, request CreateCleanRoomAssetRequest) (*CleanRoomAsset, error) { - - requestPb, pbErr := createCleanRoomAssetRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var cleanRoomAssetPb cleanRoomAssetPb - path := fmt.Sprintf("/api/2.0/clean-rooms/%v/assets", requestPb.CleanRoomName) + var cleanRoomAsset CleanRoomAsset + path := fmt.Sprintf("/api/2.0/clean-rooms/%v/assets", request.CleanRoomName) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb).Asset, - &cleanRoomAssetPb, - ) - if err != nil { - return nil, err - } - resp, err := cleanRoomAssetFromPb(&cleanRoomAssetPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.Asset, &cleanRoomAsset) + return &cleanRoomAsset, err } func (a *cleanRoomAssetsImpl) Delete(ctx context.Context, request DeleteCleanRoomAssetRequest) error { - - requestPb, pbErr := deleteCleanRoomAssetRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteCleanRoomAssetResponsePb deleteCleanRoomAssetResponsePb - path := fmt.Sprintf("/api/2.0/clean-rooms/%v/assets/%v/%v", requestPb.CleanRoomName, requestPb.AssetType, requestPb.Name) + var deleteCleanRoomAssetResponse DeleteCleanRoomAssetResponse + path := fmt.Sprintf("/api/2.0/clean-rooms/%v/assets/%v/%v", request.CleanRoomName, request.AssetType, request.Name) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteCleanRoomAssetResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteCleanRoomAssetResponse) return err } func (a *cleanRoomAssetsImpl) Get(ctx context.Context, request GetCleanRoomAssetRequest) (*CleanRoomAsset, error) { - - requestPb, pbErr := getCleanRoomAssetRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var cleanRoomAssetPb cleanRoomAssetPb - path := fmt.Sprintf("/api/2.0/clean-rooms/%v/assets/%v/%v", requestPb.CleanRoomName, requestPb.AssetType, requestPb.Name) + var cleanRoomAsset CleanRoomAsset + path := fmt.Sprintf("/api/2.0/clean-rooms/%v/assets/%v/%v", request.CleanRoomName, request.AssetType, request.Name) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &cleanRoomAssetPb, - ) - if err != nil { - return nil, err - } - resp, err := cleanRoomAssetFromPb(&cleanRoomAssetPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &cleanRoomAsset) + return &cleanRoomAsset, err } // List assets. @@ -142,68 +80,24 @@ func (a *cleanRoomAssetsImpl) ListAll(ctx context.Context, request ListCleanRoom } func (a *cleanRoomAssetsImpl) internalList(ctx context.Context, request ListCleanRoomAssetsRequest) (*ListCleanRoomAssetsResponse, error) { - - requestPb, pbErr := listCleanRoomAssetsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listCleanRoomAssetsResponsePb listCleanRoomAssetsResponsePb - path := fmt.Sprintf("/api/2.0/clean-rooms/%v/assets", requestPb.CleanRoomName) + var listCleanRoomAssetsResponse ListCleanRoomAssetsResponse + path := fmt.Sprintf("/api/2.0/clean-rooms/%v/assets", request.CleanRoomName) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listCleanRoomAssetsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listCleanRoomAssetsResponseFromPb(&listCleanRoomAssetsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listCleanRoomAssetsResponse) + return &listCleanRoomAssetsResponse, err } func (a *cleanRoomAssetsImpl) Update(ctx context.Context, request UpdateCleanRoomAssetRequest) (*CleanRoomAsset, error) { - - requestPb, pbErr := updateCleanRoomAssetRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var cleanRoomAssetPb cleanRoomAssetPb - path := fmt.Sprintf("/api/2.0/clean-rooms/%v/assets/%v/%v", requestPb.CleanRoomName, requestPb.AssetType, requestPb.Name) + var cleanRoomAsset CleanRoomAsset + path := fmt.Sprintf("/api/2.0/clean-rooms/%v/assets/%v/%v", request.CleanRoomName, request.AssetType, request.Name) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb).Asset, - &cleanRoomAssetPb, - ) - if err != nil { - return nil, err - } - resp, err := cleanRoomAssetFromPb(&cleanRoomAssetPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.Asset, &cleanRoomAsset) + return &cleanRoomAsset, err } // unexported type that holds implementations of just CleanRoomTaskRuns API methods @@ -243,35 +137,13 @@ func (a *cleanRoomTaskRunsImpl) ListAll(ctx context.Context, request ListCleanRo } func (a *cleanRoomTaskRunsImpl) internalList(ctx context.Context, request ListCleanRoomNotebookTaskRunsRequest) (*ListCleanRoomNotebookTaskRunsResponse, error) { - - requestPb, pbErr := listCleanRoomNotebookTaskRunsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listCleanRoomNotebookTaskRunsResponsePb listCleanRoomNotebookTaskRunsResponsePb - path := fmt.Sprintf("/api/2.0/clean-rooms/%v/runs", requestPb.CleanRoomName) + var listCleanRoomNotebookTaskRunsResponse ListCleanRoomNotebookTaskRunsResponse + path := fmt.Sprintf("/api/2.0/clean-rooms/%v/runs", request.CleanRoomName) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listCleanRoomNotebookTaskRunsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listCleanRoomNotebookTaskRunsResponseFromPb(&listCleanRoomNotebookTaskRunsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listCleanRoomNotebookTaskRunsResponse) + return &listCleanRoomNotebookTaskRunsResponse, err } // unexported type that holds implementations of just CleanRooms API methods @@ -280,129 +152,45 @@ type cleanRoomsImpl struct { } func (a *cleanRoomsImpl) Create(ctx context.Context, request CreateCleanRoomRequest) (*CleanRoom, error) { - - requestPb, pbErr := createCleanRoomRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var cleanRoomPb cleanRoomPb + var cleanRoom CleanRoom path := "/api/2.0/clean-rooms" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb).CleanRoom, - &cleanRoomPb, - ) - if err != nil { - return nil, err - } - resp, err := cleanRoomFromPb(&cleanRoomPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.CleanRoom, &cleanRoom) + return &cleanRoom, err } func (a *cleanRoomsImpl) CreateOutputCatalog(ctx context.Context, request CreateCleanRoomOutputCatalogRequest) (*CreateCleanRoomOutputCatalogResponse, error) { - - requestPb, pbErr := createCleanRoomOutputCatalogRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var createCleanRoomOutputCatalogResponsePb createCleanRoomOutputCatalogResponsePb - path := fmt.Sprintf("/api/2.0/clean-rooms/%v/output-catalogs", requestPb.CleanRoomName) + var createCleanRoomOutputCatalogResponse CreateCleanRoomOutputCatalogResponse + path := fmt.Sprintf("/api/2.0/clean-rooms/%v/output-catalogs", request.CleanRoomName) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb).OutputCatalog, - &createCleanRoomOutputCatalogResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := createCleanRoomOutputCatalogResponseFromPb(&createCleanRoomOutputCatalogResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.OutputCatalog, &createCleanRoomOutputCatalogResponse) + return &createCleanRoomOutputCatalogResponse, err } func (a *cleanRoomsImpl) Delete(ctx context.Context, request DeleteCleanRoomRequest) error { - - requestPb, pbErr := deleteCleanRoomRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteResponsePb deleteResponsePb - path := fmt.Sprintf("/api/2.0/clean-rooms/%v", requestPb.Name) + var deleteResponse DeleteResponse + path := fmt.Sprintf("/api/2.0/clean-rooms/%v", request.Name) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteResponse) return err } func (a *cleanRoomsImpl) Get(ctx context.Context, request GetCleanRoomRequest) (*CleanRoom, error) { - - requestPb, pbErr := getCleanRoomRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var cleanRoomPb cleanRoomPb - path := fmt.Sprintf("/api/2.0/clean-rooms/%v", requestPb.Name) + var cleanRoom CleanRoom + path := fmt.Sprintf("/api/2.0/clean-rooms/%v", request.Name) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &cleanRoomPb, - ) - if err != nil { - return nil, err - } - resp, err := cleanRoomFromPb(&cleanRoomPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &cleanRoom) + return &cleanRoom, err } // Get a list of all clean rooms of the metastore. Only clean rooms the caller @@ -439,66 +227,22 @@ func (a *cleanRoomsImpl) ListAll(ctx context.Context, request ListCleanRoomsRequ } func (a *cleanRoomsImpl) internalList(ctx context.Context, request ListCleanRoomsRequest) (*ListCleanRoomsResponse, error) { - - requestPb, pbErr := listCleanRoomsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listCleanRoomsResponsePb listCleanRoomsResponsePb + var listCleanRoomsResponse ListCleanRoomsResponse path := "/api/2.0/clean-rooms" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listCleanRoomsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listCleanRoomsResponseFromPb(&listCleanRoomsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listCleanRoomsResponse) + return &listCleanRoomsResponse, err } func (a *cleanRoomsImpl) Update(ctx context.Context, request UpdateCleanRoomRequest) (*CleanRoom, error) { - - requestPb, pbErr := updateCleanRoomRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var cleanRoomPb cleanRoomPb - path := fmt.Sprintf("/api/2.0/clean-rooms/%v", requestPb.Name) + var cleanRoom CleanRoom + path := fmt.Sprintf("/api/2.0/clean-rooms/%v", request.Name) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &cleanRoomPb, - ) - if err != nil { - return nil, err - } - resp, err := cleanRoomFromPb(&cleanRoomPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &cleanRoom) + return &cleanRoom, err } diff --git a/service/cleanrooms/internal.go b/service/cleanrooms/internal.go deleted file mode 100755 index 9d4b5cccc..000000000 --- a/service/cleanrooms/internal.go +++ /dev/null @@ -1,1365 +0,0 @@ -// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. - -package cleanrooms - -import ( - "fmt" - "strings" - "time" - - "github.com/databricks/databricks-sdk-go/marshal" - "github.com/databricks/databricks-sdk-go/service/catalog" - "github.com/databricks/databricks-sdk-go/service/jobs" - "github.com/databricks/databricks-sdk-go/service/settings" - "github.com/databricks/databricks-sdk-go/service/sharing" -) - -func cleanRoomToPb(st *CleanRoom) (*cleanRoomPb, error) { - if st == nil { - return nil, nil - } - pb := &cleanRoomPb{} - pb.AccessRestricted = st.AccessRestricted - pb.Comment = st.Comment - pb.CreatedAt = st.CreatedAt - pb.LocalCollaboratorAlias = st.LocalCollaboratorAlias - pb.Name = st.Name - pb.OutputCatalog = st.OutputCatalog - pb.Owner = st.Owner - pb.RemoteDetailedInfo = st.RemoteDetailedInfo - pb.Status = st.Status - pb.UpdatedAt = st.UpdatedAt - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type cleanRoomPb struct { - AccessRestricted CleanRoomAccessRestricted `json:"access_restricted,omitempty"` - Comment string `json:"comment,omitempty"` - CreatedAt int64 `json:"created_at,omitempty"` - LocalCollaboratorAlias string `json:"local_collaborator_alias,omitempty"` - Name string `json:"name,omitempty"` - OutputCatalog *CleanRoomOutputCatalog `json:"output_catalog,omitempty"` - Owner string `json:"owner,omitempty"` - RemoteDetailedInfo *CleanRoomRemoteDetail `json:"remote_detailed_info,omitempty"` - Status CleanRoomStatusEnum `json:"status,omitempty"` - UpdatedAt int64 `json:"updated_at,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func cleanRoomFromPb(pb *cleanRoomPb) (*CleanRoom, error) { - if pb == nil { - return nil, nil - } - st := &CleanRoom{} - st.AccessRestricted = pb.AccessRestricted - st.Comment = pb.Comment - st.CreatedAt = pb.CreatedAt - st.LocalCollaboratorAlias = pb.LocalCollaboratorAlias - st.Name = pb.Name - st.OutputCatalog = pb.OutputCatalog - st.Owner = pb.Owner - st.RemoteDetailedInfo = pb.RemoteDetailedInfo - st.Status = pb.Status - st.UpdatedAt = pb.UpdatedAt - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *cleanRoomPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st cleanRoomPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func cleanRoomAssetToPb(st *CleanRoomAsset) (*cleanRoomAssetPb, error) { - if st == nil { - return nil, nil - } - pb := &cleanRoomAssetPb{} - pb.AddedAt = st.AddedAt - pb.AssetType = st.AssetType - pb.CleanRoomName = st.CleanRoomName - pb.ForeignTable = st.ForeignTable - pb.ForeignTableLocalDetails = st.ForeignTableLocalDetails - pb.Name = st.Name - pb.Notebook = st.Notebook - pb.OwnerCollaboratorAlias = st.OwnerCollaboratorAlias - pb.Status = st.Status - pb.Table = st.Table - pb.TableLocalDetails = st.TableLocalDetails - pb.View = st.View - pb.ViewLocalDetails = st.ViewLocalDetails - pb.VolumeLocalDetails = st.VolumeLocalDetails - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type cleanRoomAssetPb struct { - AddedAt int64 `json:"added_at,omitempty"` - AssetType CleanRoomAssetAssetType `json:"asset_type,omitempty"` - CleanRoomName string `json:"clean_room_name,omitempty"` - ForeignTable *CleanRoomAssetForeignTable `json:"foreign_table,omitempty"` - ForeignTableLocalDetails *CleanRoomAssetForeignTableLocalDetails `json:"foreign_table_local_details,omitempty"` - Name string `json:"name,omitempty"` - Notebook *CleanRoomAssetNotebook `json:"notebook,omitempty"` - OwnerCollaboratorAlias string `json:"owner_collaborator_alias,omitempty"` - Status CleanRoomAssetStatusEnum `json:"status,omitempty"` - Table *CleanRoomAssetTable `json:"table,omitempty"` - TableLocalDetails *CleanRoomAssetTableLocalDetails `json:"table_local_details,omitempty"` - View *CleanRoomAssetView `json:"view,omitempty"` - ViewLocalDetails *CleanRoomAssetViewLocalDetails `json:"view_local_details,omitempty"` - VolumeLocalDetails *CleanRoomAssetVolumeLocalDetails `json:"volume_local_details,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func cleanRoomAssetFromPb(pb *cleanRoomAssetPb) (*CleanRoomAsset, error) { - if pb == nil { - return nil, nil - } - st := &CleanRoomAsset{} - st.AddedAt = pb.AddedAt - st.AssetType = pb.AssetType - st.CleanRoomName = pb.CleanRoomName - st.ForeignTable = pb.ForeignTable - st.ForeignTableLocalDetails = pb.ForeignTableLocalDetails - st.Name = pb.Name - st.Notebook = pb.Notebook - st.OwnerCollaboratorAlias = pb.OwnerCollaboratorAlias - st.Status = pb.Status - st.Table = pb.Table - st.TableLocalDetails = pb.TableLocalDetails - st.View = pb.View - st.ViewLocalDetails = pb.ViewLocalDetails - st.VolumeLocalDetails = pb.VolumeLocalDetails - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *cleanRoomAssetPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st cleanRoomAssetPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func cleanRoomAssetForeignTableToPb(st *CleanRoomAssetForeignTable) (*cleanRoomAssetForeignTablePb, error) { - if st == nil { - return nil, nil - } - pb := &cleanRoomAssetForeignTablePb{} - pb.Columns = st.Columns - - return pb, nil -} - -type cleanRoomAssetForeignTablePb struct { - Columns []catalog.ColumnInfo `json:"columns,omitempty"` -} - -func cleanRoomAssetForeignTableFromPb(pb *cleanRoomAssetForeignTablePb) (*CleanRoomAssetForeignTable, error) { - if pb == nil { - return nil, nil - } - st := &CleanRoomAssetForeignTable{} - st.Columns = pb.Columns - - return st, nil -} - -func cleanRoomAssetForeignTableLocalDetailsToPb(st *CleanRoomAssetForeignTableLocalDetails) (*cleanRoomAssetForeignTableLocalDetailsPb, error) { - if st == nil { - return nil, nil - } - pb := &cleanRoomAssetForeignTableLocalDetailsPb{} - pb.LocalName = st.LocalName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type cleanRoomAssetForeignTableLocalDetailsPb struct { - LocalName string `json:"local_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func cleanRoomAssetForeignTableLocalDetailsFromPb(pb *cleanRoomAssetForeignTableLocalDetailsPb) (*CleanRoomAssetForeignTableLocalDetails, error) { - if pb == nil { - return nil, nil - } - st := &CleanRoomAssetForeignTableLocalDetails{} - st.LocalName = pb.LocalName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *cleanRoomAssetForeignTableLocalDetailsPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st cleanRoomAssetForeignTableLocalDetailsPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func cleanRoomAssetNotebookToPb(st *CleanRoomAssetNotebook) (*cleanRoomAssetNotebookPb, error) { - if st == nil { - return nil, nil - } - pb := &cleanRoomAssetNotebookPb{} - pb.Etag = st.Etag - pb.NotebookContent = st.NotebookContent - pb.ReviewState = st.ReviewState - pb.Reviews = st.Reviews - pb.RunnerCollaboratorAliases = st.RunnerCollaboratorAliases - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type cleanRoomAssetNotebookPb struct { - Etag string `json:"etag,omitempty"` - NotebookContent string `json:"notebook_content,omitempty"` - ReviewState CleanRoomNotebookReviewNotebookReviewState `json:"review_state,omitempty"` - Reviews []CleanRoomNotebookReview `json:"reviews,omitempty"` - RunnerCollaboratorAliases []string `json:"runner_collaborator_aliases,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func cleanRoomAssetNotebookFromPb(pb *cleanRoomAssetNotebookPb) (*CleanRoomAssetNotebook, error) { - if pb == nil { - return nil, nil - } - st := &CleanRoomAssetNotebook{} - st.Etag = pb.Etag - st.NotebookContent = pb.NotebookContent - st.ReviewState = pb.ReviewState - st.Reviews = pb.Reviews - st.RunnerCollaboratorAliases = pb.RunnerCollaboratorAliases - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *cleanRoomAssetNotebookPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st cleanRoomAssetNotebookPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func cleanRoomAssetTableToPb(st *CleanRoomAssetTable) (*cleanRoomAssetTablePb, error) { - if st == nil { - return nil, nil - } - pb := &cleanRoomAssetTablePb{} - pb.Columns = st.Columns - - return pb, nil -} - -type cleanRoomAssetTablePb struct { - Columns []catalog.ColumnInfo `json:"columns,omitempty"` -} - -func cleanRoomAssetTableFromPb(pb *cleanRoomAssetTablePb) (*CleanRoomAssetTable, error) { - if pb == nil { - return nil, nil - } - st := &CleanRoomAssetTable{} - st.Columns = pb.Columns - - return st, nil -} - -func cleanRoomAssetTableLocalDetailsToPb(st *CleanRoomAssetTableLocalDetails) (*cleanRoomAssetTableLocalDetailsPb, error) { - if st == nil { - return nil, nil - } - pb := &cleanRoomAssetTableLocalDetailsPb{} - pb.LocalName = st.LocalName - pb.Partitions = st.Partitions - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type cleanRoomAssetTableLocalDetailsPb struct { - LocalName string `json:"local_name,omitempty"` - Partitions []sharing.Partition `json:"partitions,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func cleanRoomAssetTableLocalDetailsFromPb(pb *cleanRoomAssetTableLocalDetailsPb) (*CleanRoomAssetTableLocalDetails, error) { - if pb == nil { - return nil, nil - } - st := &CleanRoomAssetTableLocalDetails{} - st.LocalName = pb.LocalName - st.Partitions = pb.Partitions - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *cleanRoomAssetTableLocalDetailsPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st cleanRoomAssetTableLocalDetailsPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func cleanRoomAssetViewToPb(st *CleanRoomAssetView) (*cleanRoomAssetViewPb, error) { - if st == nil { - return nil, nil - } - pb := &cleanRoomAssetViewPb{} - pb.Columns = st.Columns - - return pb, nil -} - -type cleanRoomAssetViewPb struct { - Columns []catalog.ColumnInfo `json:"columns,omitempty"` -} - -func cleanRoomAssetViewFromPb(pb *cleanRoomAssetViewPb) (*CleanRoomAssetView, error) { - if pb == nil { - return nil, nil - } - st := &CleanRoomAssetView{} - st.Columns = pb.Columns - - return st, nil -} - -func cleanRoomAssetViewLocalDetailsToPb(st *CleanRoomAssetViewLocalDetails) (*cleanRoomAssetViewLocalDetailsPb, error) { - if st == nil { - return nil, nil - } - pb := &cleanRoomAssetViewLocalDetailsPb{} - pb.LocalName = st.LocalName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type cleanRoomAssetViewLocalDetailsPb struct { - LocalName string `json:"local_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func cleanRoomAssetViewLocalDetailsFromPb(pb *cleanRoomAssetViewLocalDetailsPb) (*CleanRoomAssetViewLocalDetails, error) { - if pb == nil { - return nil, nil - } - st := &CleanRoomAssetViewLocalDetails{} - st.LocalName = pb.LocalName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *cleanRoomAssetViewLocalDetailsPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st cleanRoomAssetViewLocalDetailsPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func cleanRoomAssetVolumeLocalDetailsToPb(st *CleanRoomAssetVolumeLocalDetails) (*cleanRoomAssetVolumeLocalDetailsPb, error) { - if st == nil { - return nil, nil - } - pb := &cleanRoomAssetVolumeLocalDetailsPb{} - pb.LocalName = st.LocalName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type cleanRoomAssetVolumeLocalDetailsPb struct { - LocalName string `json:"local_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func cleanRoomAssetVolumeLocalDetailsFromPb(pb *cleanRoomAssetVolumeLocalDetailsPb) (*CleanRoomAssetVolumeLocalDetails, error) { - if pb == nil { - return nil, nil - } - st := &CleanRoomAssetVolumeLocalDetails{} - st.LocalName = pb.LocalName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *cleanRoomAssetVolumeLocalDetailsPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st cleanRoomAssetVolumeLocalDetailsPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func cleanRoomCollaboratorToPb(st *CleanRoomCollaborator) (*cleanRoomCollaboratorPb, error) { - if st == nil { - return nil, nil - } - pb := &cleanRoomCollaboratorPb{} - pb.CollaboratorAlias = st.CollaboratorAlias - pb.DisplayName = st.DisplayName - pb.GlobalMetastoreId = st.GlobalMetastoreId - pb.InviteRecipientEmail = st.InviteRecipientEmail - pb.InviteRecipientWorkspaceId = st.InviteRecipientWorkspaceId - pb.OrganizationName = st.OrganizationName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type cleanRoomCollaboratorPb struct { - CollaboratorAlias string `json:"collaborator_alias"` - DisplayName string `json:"display_name,omitempty"` - GlobalMetastoreId string `json:"global_metastore_id,omitempty"` - InviteRecipientEmail string `json:"invite_recipient_email,omitempty"` - InviteRecipientWorkspaceId int64 `json:"invite_recipient_workspace_id,omitempty"` - OrganizationName string `json:"organization_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func cleanRoomCollaboratorFromPb(pb *cleanRoomCollaboratorPb) (*CleanRoomCollaborator, error) { - if pb == nil { - return nil, nil - } - st := &CleanRoomCollaborator{} - st.CollaboratorAlias = pb.CollaboratorAlias - st.DisplayName = pb.DisplayName - st.GlobalMetastoreId = pb.GlobalMetastoreId - st.InviteRecipientEmail = pb.InviteRecipientEmail - st.InviteRecipientWorkspaceId = pb.InviteRecipientWorkspaceId - st.OrganizationName = pb.OrganizationName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *cleanRoomCollaboratorPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st cleanRoomCollaboratorPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func cleanRoomNotebookReviewToPb(st *CleanRoomNotebookReview) (*cleanRoomNotebookReviewPb, error) { - if st == nil { - return nil, nil - } - pb := &cleanRoomNotebookReviewPb{} - pb.Comment = st.Comment - pb.CreatedAtMillis = st.CreatedAtMillis - pb.ReviewState = st.ReviewState - pb.ReviewSubReason = st.ReviewSubReason - pb.ReviewerCollaboratorAlias = st.ReviewerCollaboratorAlias - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type cleanRoomNotebookReviewPb struct { - Comment string `json:"comment,omitempty"` - CreatedAtMillis int64 `json:"created_at_millis,omitempty"` - ReviewState CleanRoomNotebookReviewNotebookReviewState `json:"review_state,omitempty"` - ReviewSubReason CleanRoomNotebookReviewNotebookReviewSubReason `json:"review_sub_reason,omitempty"` - ReviewerCollaboratorAlias string `json:"reviewer_collaborator_alias,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func cleanRoomNotebookReviewFromPb(pb *cleanRoomNotebookReviewPb) (*CleanRoomNotebookReview, error) { - if pb == nil { - return nil, nil - } - st := &CleanRoomNotebookReview{} - st.Comment = pb.Comment - st.CreatedAtMillis = pb.CreatedAtMillis - st.ReviewState = pb.ReviewState - st.ReviewSubReason = pb.ReviewSubReason - st.ReviewerCollaboratorAlias = pb.ReviewerCollaboratorAlias - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *cleanRoomNotebookReviewPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st cleanRoomNotebookReviewPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func cleanRoomNotebookTaskRunToPb(st *CleanRoomNotebookTaskRun) (*cleanRoomNotebookTaskRunPb, error) { - if st == nil { - return nil, nil - } - pb := &cleanRoomNotebookTaskRunPb{} - pb.CollaboratorJobRunInfo = st.CollaboratorJobRunInfo - pb.NotebookEtag = st.NotebookEtag - pb.NotebookJobRunState = st.NotebookJobRunState - pb.NotebookName = st.NotebookName - pb.NotebookUpdatedAt = st.NotebookUpdatedAt - pb.OutputSchemaExpirationTime = st.OutputSchemaExpirationTime - pb.OutputSchemaName = st.OutputSchemaName - pb.RunDuration = st.RunDuration - pb.StartTime = st.StartTime - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type cleanRoomNotebookTaskRunPb struct { - CollaboratorJobRunInfo *CollaboratorJobRunInfo `json:"collaborator_job_run_info,omitempty"` - NotebookEtag string `json:"notebook_etag,omitempty"` - NotebookJobRunState *jobs.CleanRoomTaskRunState `json:"notebook_job_run_state,omitempty"` - NotebookName string `json:"notebook_name,omitempty"` - NotebookUpdatedAt int64 `json:"notebook_updated_at,omitempty"` - OutputSchemaExpirationTime int64 `json:"output_schema_expiration_time,omitempty"` - OutputSchemaName string `json:"output_schema_name,omitempty"` - RunDuration int64 `json:"run_duration,omitempty"` - StartTime int64 `json:"start_time,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func cleanRoomNotebookTaskRunFromPb(pb *cleanRoomNotebookTaskRunPb) (*CleanRoomNotebookTaskRun, error) { - if pb == nil { - return nil, nil - } - st := &CleanRoomNotebookTaskRun{} - st.CollaboratorJobRunInfo = pb.CollaboratorJobRunInfo - st.NotebookEtag = pb.NotebookEtag - st.NotebookJobRunState = pb.NotebookJobRunState - st.NotebookName = pb.NotebookName - st.NotebookUpdatedAt = pb.NotebookUpdatedAt - st.OutputSchemaExpirationTime = pb.OutputSchemaExpirationTime - st.OutputSchemaName = pb.OutputSchemaName - st.RunDuration = pb.RunDuration - st.StartTime = pb.StartTime - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *cleanRoomNotebookTaskRunPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st cleanRoomNotebookTaskRunPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func cleanRoomOutputCatalogToPb(st *CleanRoomOutputCatalog) (*cleanRoomOutputCatalogPb, error) { - if st == nil { - return nil, nil - } - pb := &cleanRoomOutputCatalogPb{} - pb.CatalogName = st.CatalogName - pb.Status = st.Status - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type cleanRoomOutputCatalogPb struct { - CatalogName string `json:"catalog_name,omitempty"` - Status CleanRoomOutputCatalogOutputCatalogStatus `json:"status,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func cleanRoomOutputCatalogFromPb(pb *cleanRoomOutputCatalogPb) (*CleanRoomOutputCatalog, error) { - if pb == nil { - return nil, nil - } - st := &CleanRoomOutputCatalog{} - st.CatalogName = pb.CatalogName - st.Status = pb.Status - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *cleanRoomOutputCatalogPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st cleanRoomOutputCatalogPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func cleanRoomRemoteDetailToPb(st *CleanRoomRemoteDetail) (*cleanRoomRemoteDetailPb, error) { - if st == nil { - return nil, nil - } - pb := &cleanRoomRemoteDetailPb{} - pb.CentralCleanRoomId = st.CentralCleanRoomId - pb.CloudVendor = st.CloudVendor - pb.Collaborators = st.Collaborators - pb.ComplianceSecurityProfile = st.ComplianceSecurityProfile - pb.Creator = st.Creator - pb.EgressNetworkPolicy = st.EgressNetworkPolicy - pb.Region = st.Region - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type cleanRoomRemoteDetailPb struct { - CentralCleanRoomId string `json:"central_clean_room_id,omitempty"` - CloudVendor string `json:"cloud_vendor,omitempty"` - Collaborators []CleanRoomCollaborator `json:"collaborators,omitempty"` - ComplianceSecurityProfile *ComplianceSecurityProfile `json:"compliance_security_profile,omitempty"` - Creator *CleanRoomCollaborator `json:"creator,omitempty"` - EgressNetworkPolicy *settings.EgressNetworkPolicy `json:"egress_network_policy,omitempty"` - Region string `json:"region,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func cleanRoomRemoteDetailFromPb(pb *cleanRoomRemoteDetailPb) (*CleanRoomRemoteDetail, error) { - if pb == nil { - return nil, nil - } - st := &CleanRoomRemoteDetail{} - st.CentralCleanRoomId = pb.CentralCleanRoomId - st.CloudVendor = pb.CloudVendor - st.Collaborators = pb.Collaborators - st.ComplianceSecurityProfile = pb.ComplianceSecurityProfile - st.Creator = pb.Creator - st.EgressNetworkPolicy = pb.EgressNetworkPolicy - st.Region = pb.Region - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *cleanRoomRemoteDetailPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st cleanRoomRemoteDetailPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func collaboratorJobRunInfoToPb(st *CollaboratorJobRunInfo) (*collaboratorJobRunInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &collaboratorJobRunInfoPb{} - pb.CollaboratorAlias = st.CollaboratorAlias - pb.CollaboratorJobId = st.CollaboratorJobId - pb.CollaboratorJobRunId = st.CollaboratorJobRunId - pb.CollaboratorTaskRunId = st.CollaboratorTaskRunId - pb.CollaboratorWorkspaceId = st.CollaboratorWorkspaceId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type collaboratorJobRunInfoPb struct { - CollaboratorAlias string `json:"collaborator_alias,omitempty"` - CollaboratorJobId int64 `json:"collaborator_job_id,omitempty"` - CollaboratorJobRunId int64 `json:"collaborator_job_run_id,omitempty"` - CollaboratorTaskRunId int64 `json:"collaborator_task_run_id,omitempty"` - CollaboratorWorkspaceId int64 `json:"collaborator_workspace_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func collaboratorJobRunInfoFromPb(pb *collaboratorJobRunInfoPb) (*CollaboratorJobRunInfo, error) { - if pb == nil { - return nil, nil - } - st := &CollaboratorJobRunInfo{} - st.CollaboratorAlias = pb.CollaboratorAlias - st.CollaboratorJobId = pb.CollaboratorJobId - st.CollaboratorJobRunId = pb.CollaboratorJobRunId - st.CollaboratorTaskRunId = pb.CollaboratorTaskRunId - st.CollaboratorWorkspaceId = pb.CollaboratorWorkspaceId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *collaboratorJobRunInfoPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st collaboratorJobRunInfoPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func complianceSecurityProfileToPb(st *ComplianceSecurityProfile) (*complianceSecurityProfilePb, error) { - if st == nil { - return nil, nil - } - pb := &complianceSecurityProfilePb{} - pb.ComplianceStandards = st.ComplianceStandards - pb.IsEnabled = st.IsEnabled - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type complianceSecurityProfilePb struct { - ComplianceStandards []settings.ComplianceStandard `json:"compliance_standards,omitempty"` - IsEnabled bool `json:"is_enabled,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func complianceSecurityProfileFromPb(pb *complianceSecurityProfilePb) (*ComplianceSecurityProfile, error) { - if pb == nil { - return nil, nil - } - st := &ComplianceSecurityProfile{} - st.ComplianceStandards = pb.ComplianceStandards - st.IsEnabled = pb.IsEnabled - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *complianceSecurityProfilePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st complianceSecurityProfilePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createCleanRoomAssetRequestToPb(st *CreateCleanRoomAssetRequest) (*createCleanRoomAssetRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &createCleanRoomAssetRequestPb{} - pb.Asset = st.Asset - pb.CleanRoomName = st.CleanRoomName - - return pb, nil -} - -type createCleanRoomAssetRequestPb struct { - Asset CleanRoomAsset `json:"asset"` - CleanRoomName string `json:"-" url:"-"` -} - -func createCleanRoomAssetRequestFromPb(pb *createCleanRoomAssetRequestPb) (*CreateCleanRoomAssetRequest, error) { - if pb == nil { - return nil, nil - } - st := &CreateCleanRoomAssetRequest{} - st.Asset = pb.Asset - st.CleanRoomName = pb.CleanRoomName - - return st, nil -} - -func createCleanRoomOutputCatalogRequestToPb(st *CreateCleanRoomOutputCatalogRequest) (*createCleanRoomOutputCatalogRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &createCleanRoomOutputCatalogRequestPb{} - pb.CleanRoomName = st.CleanRoomName - pb.OutputCatalog = st.OutputCatalog - - return pb, nil -} - -type createCleanRoomOutputCatalogRequestPb struct { - CleanRoomName string `json:"-" url:"-"` - OutputCatalog CleanRoomOutputCatalog `json:"output_catalog"` -} - -func createCleanRoomOutputCatalogRequestFromPb(pb *createCleanRoomOutputCatalogRequestPb) (*CreateCleanRoomOutputCatalogRequest, error) { - if pb == nil { - return nil, nil - } - st := &CreateCleanRoomOutputCatalogRequest{} - st.CleanRoomName = pb.CleanRoomName - st.OutputCatalog = pb.OutputCatalog - - return st, nil -} - -func createCleanRoomOutputCatalogResponseToPb(st *CreateCleanRoomOutputCatalogResponse) (*createCleanRoomOutputCatalogResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &createCleanRoomOutputCatalogResponsePb{} - pb.OutputCatalog = st.OutputCatalog - - return pb, nil -} - -type createCleanRoomOutputCatalogResponsePb struct { - OutputCatalog *CleanRoomOutputCatalog `json:"output_catalog,omitempty"` -} - -func createCleanRoomOutputCatalogResponseFromPb(pb *createCleanRoomOutputCatalogResponsePb) (*CreateCleanRoomOutputCatalogResponse, error) { - if pb == nil { - return nil, nil - } - st := &CreateCleanRoomOutputCatalogResponse{} - st.OutputCatalog = pb.OutputCatalog - - return st, nil -} - -func createCleanRoomRequestToPb(st *CreateCleanRoomRequest) (*createCleanRoomRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &createCleanRoomRequestPb{} - pb.CleanRoom = st.CleanRoom - - return pb, nil -} - -type createCleanRoomRequestPb struct { - CleanRoom CleanRoom `json:"clean_room"` -} - -func createCleanRoomRequestFromPb(pb *createCleanRoomRequestPb) (*CreateCleanRoomRequest, error) { - if pb == nil { - return nil, nil - } - st := &CreateCleanRoomRequest{} - st.CleanRoom = pb.CleanRoom - - return st, nil -} - -func deleteCleanRoomAssetRequestToPb(st *DeleteCleanRoomAssetRequest) (*deleteCleanRoomAssetRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteCleanRoomAssetRequestPb{} - pb.AssetType = st.AssetType - pb.CleanRoomName = st.CleanRoomName - pb.Name = st.Name - - return pb, nil -} - -type deleteCleanRoomAssetRequestPb struct { - AssetType CleanRoomAssetAssetType `json:"-" url:"-"` - CleanRoomName string `json:"-" url:"-"` - Name string `json:"-" url:"-"` -} - -func deleteCleanRoomAssetRequestFromPb(pb *deleteCleanRoomAssetRequestPb) (*DeleteCleanRoomAssetRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteCleanRoomAssetRequest{} - st.AssetType = pb.AssetType - st.CleanRoomName = pb.CleanRoomName - st.Name = pb.Name - - return st, nil -} - -func deleteCleanRoomAssetResponseToPb(st *DeleteCleanRoomAssetResponse) (*deleteCleanRoomAssetResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteCleanRoomAssetResponsePb{} - - return pb, nil -} - -type deleteCleanRoomAssetResponsePb struct { -} - -func deleteCleanRoomAssetResponseFromPb(pb *deleteCleanRoomAssetResponsePb) (*DeleteCleanRoomAssetResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteCleanRoomAssetResponse{} - - return st, nil -} - -func deleteCleanRoomRequestToPb(st *DeleteCleanRoomRequest) (*deleteCleanRoomRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteCleanRoomRequestPb{} - pb.Name = st.Name - - return pb, nil -} - -type deleteCleanRoomRequestPb struct { - Name string `json:"-" url:"-"` -} - -func deleteCleanRoomRequestFromPb(pb *deleteCleanRoomRequestPb) (*DeleteCleanRoomRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteCleanRoomRequest{} - st.Name = pb.Name - - return st, nil -} - -func deleteResponseToPb(st *DeleteResponse) (*deleteResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteResponsePb{} - - return pb, nil -} - -type deleteResponsePb struct { -} - -func deleteResponseFromPb(pb *deleteResponsePb) (*DeleteResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteResponse{} - - return st, nil -} - -func getCleanRoomAssetRequestToPb(st *GetCleanRoomAssetRequest) (*getCleanRoomAssetRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getCleanRoomAssetRequestPb{} - pb.AssetType = st.AssetType - pb.CleanRoomName = st.CleanRoomName - pb.Name = st.Name - - return pb, nil -} - -type getCleanRoomAssetRequestPb struct { - AssetType CleanRoomAssetAssetType `json:"-" url:"-"` - CleanRoomName string `json:"-" url:"-"` - Name string `json:"-" url:"-"` -} - -func getCleanRoomAssetRequestFromPb(pb *getCleanRoomAssetRequestPb) (*GetCleanRoomAssetRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetCleanRoomAssetRequest{} - st.AssetType = pb.AssetType - st.CleanRoomName = pb.CleanRoomName - st.Name = pb.Name - - return st, nil -} - -func getCleanRoomRequestToPb(st *GetCleanRoomRequest) (*getCleanRoomRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getCleanRoomRequestPb{} - pb.Name = st.Name - - return pb, nil -} - -type getCleanRoomRequestPb struct { - Name string `json:"-" url:"-"` -} - -func getCleanRoomRequestFromPb(pb *getCleanRoomRequestPb) (*GetCleanRoomRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetCleanRoomRequest{} - st.Name = pb.Name - - return st, nil -} - -func listCleanRoomAssetsRequestToPb(st *ListCleanRoomAssetsRequest) (*listCleanRoomAssetsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listCleanRoomAssetsRequestPb{} - pb.CleanRoomName = st.CleanRoomName - pb.PageToken = st.PageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listCleanRoomAssetsRequestPb struct { - CleanRoomName string `json:"-" url:"-"` - PageToken string `json:"-" url:"page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listCleanRoomAssetsRequestFromPb(pb *listCleanRoomAssetsRequestPb) (*ListCleanRoomAssetsRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListCleanRoomAssetsRequest{} - st.CleanRoomName = pb.CleanRoomName - st.PageToken = pb.PageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listCleanRoomAssetsRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listCleanRoomAssetsRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listCleanRoomAssetsResponseToPb(st *ListCleanRoomAssetsResponse) (*listCleanRoomAssetsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listCleanRoomAssetsResponsePb{} - pb.Assets = st.Assets - pb.NextPageToken = st.NextPageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listCleanRoomAssetsResponsePb struct { - Assets []CleanRoomAsset `json:"assets,omitempty"` - NextPageToken string `json:"next_page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listCleanRoomAssetsResponseFromPb(pb *listCleanRoomAssetsResponsePb) (*ListCleanRoomAssetsResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListCleanRoomAssetsResponse{} - st.Assets = pb.Assets - st.NextPageToken = pb.NextPageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listCleanRoomAssetsResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listCleanRoomAssetsResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listCleanRoomNotebookTaskRunsRequestToPb(st *ListCleanRoomNotebookTaskRunsRequest) (*listCleanRoomNotebookTaskRunsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listCleanRoomNotebookTaskRunsRequestPb{} - pb.CleanRoomName = st.CleanRoomName - pb.NotebookName = st.NotebookName - pb.PageSize = st.PageSize - pb.PageToken = st.PageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listCleanRoomNotebookTaskRunsRequestPb struct { - CleanRoomName string `json:"-" url:"-"` - NotebookName string `json:"-" url:"notebook_name,omitempty"` - PageSize int `json:"-" url:"page_size,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listCleanRoomNotebookTaskRunsRequestFromPb(pb *listCleanRoomNotebookTaskRunsRequestPb) (*ListCleanRoomNotebookTaskRunsRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListCleanRoomNotebookTaskRunsRequest{} - st.CleanRoomName = pb.CleanRoomName - st.NotebookName = pb.NotebookName - st.PageSize = pb.PageSize - st.PageToken = pb.PageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listCleanRoomNotebookTaskRunsRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listCleanRoomNotebookTaskRunsRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listCleanRoomNotebookTaskRunsResponseToPb(st *ListCleanRoomNotebookTaskRunsResponse) (*listCleanRoomNotebookTaskRunsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listCleanRoomNotebookTaskRunsResponsePb{} - pb.NextPageToken = st.NextPageToken - pb.Runs = st.Runs - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listCleanRoomNotebookTaskRunsResponsePb struct { - NextPageToken string `json:"next_page_token,omitempty"` - Runs []CleanRoomNotebookTaskRun `json:"runs,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listCleanRoomNotebookTaskRunsResponseFromPb(pb *listCleanRoomNotebookTaskRunsResponsePb) (*ListCleanRoomNotebookTaskRunsResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListCleanRoomNotebookTaskRunsResponse{} - st.NextPageToken = pb.NextPageToken - st.Runs = pb.Runs - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listCleanRoomNotebookTaskRunsResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listCleanRoomNotebookTaskRunsResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listCleanRoomsRequestToPb(st *ListCleanRoomsRequest) (*listCleanRoomsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listCleanRoomsRequestPb{} - pb.PageSize = st.PageSize - pb.PageToken = st.PageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listCleanRoomsRequestPb struct { - PageSize int `json:"-" url:"page_size,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listCleanRoomsRequestFromPb(pb *listCleanRoomsRequestPb) (*ListCleanRoomsRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListCleanRoomsRequest{} - st.PageSize = pb.PageSize - st.PageToken = pb.PageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listCleanRoomsRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listCleanRoomsRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listCleanRoomsResponseToPb(st *ListCleanRoomsResponse) (*listCleanRoomsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listCleanRoomsResponsePb{} - pb.CleanRooms = st.CleanRooms - pb.NextPageToken = st.NextPageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listCleanRoomsResponsePb struct { - CleanRooms []CleanRoom `json:"clean_rooms,omitempty"` - NextPageToken string `json:"next_page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listCleanRoomsResponseFromPb(pb *listCleanRoomsResponsePb) (*ListCleanRoomsResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListCleanRoomsResponse{} - st.CleanRooms = pb.CleanRooms - st.NextPageToken = pb.NextPageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listCleanRoomsResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listCleanRoomsResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func updateCleanRoomAssetRequestToPb(st *UpdateCleanRoomAssetRequest) (*updateCleanRoomAssetRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &updateCleanRoomAssetRequestPb{} - pb.Asset = st.Asset - pb.AssetType = st.AssetType - pb.CleanRoomName = st.CleanRoomName - pb.Name = st.Name - - return pb, nil -} - -type updateCleanRoomAssetRequestPb struct { - Asset CleanRoomAsset `json:"asset"` - AssetType CleanRoomAssetAssetType `json:"-" url:"-"` - CleanRoomName string `json:"-" url:"-"` - Name string `json:"-" url:"-"` -} - -func updateCleanRoomAssetRequestFromPb(pb *updateCleanRoomAssetRequestPb) (*UpdateCleanRoomAssetRequest, error) { - if pb == nil { - return nil, nil - } - st := &UpdateCleanRoomAssetRequest{} - st.Asset = pb.Asset - st.AssetType = pb.AssetType - st.CleanRoomName = pb.CleanRoomName - st.Name = pb.Name - - return st, nil -} - -func updateCleanRoomRequestToPb(st *UpdateCleanRoomRequest) (*updateCleanRoomRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &updateCleanRoomRequestPb{} - pb.CleanRoom = st.CleanRoom - pb.Name = st.Name - - return pb, nil -} - -type updateCleanRoomRequestPb struct { - CleanRoom *CleanRoom `json:"clean_room,omitempty"` - Name string `json:"-" url:"-"` -} - -func updateCleanRoomRequestFromPb(pb *updateCleanRoomRequestPb) (*UpdateCleanRoomRequest, error) { - if pb == nil { - return nil, nil - } - st := &UpdateCleanRoomRequest{} - st.CleanRoom = pb.CleanRoom - st.Name = pb.Name - - return st, nil -} - -func durationToPb(d *time.Duration) (*string, error) { - if d == nil { - return nil, nil - } - s := fmt.Sprintf("%.9fs", d.Seconds()) - return &s, nil -} - -func durationFromPb(s *string) (*time.Duration, error) { - if s == nil { - return nil, nil - } - d, err := time.ParseDuration(*s) - if err != nil { - return nil, err - } - return &d, nil -} - -func timestampToPb(t *time.Time) (*string, error) { - if t == nil { - return nil, nil - } - s := t.Format(time.RFC3339) - return &s, nil -} - -func timestampFromPb(s *string) (*time.Time, error) { - if s == nil { - return nil, nil - } - t, err := time.Parse(time.RFC3339, *s) - if err != nil { - return nil, err - } - return &t, nil -} - -func fieldMaskToPb(fm *[]string) (*string, error) { - if fm == nil { - return nil, nil - } - s := strings.Join(*fm, ",") - return &s, nil -} - -func fieldMaskFromPb(s *string) (*[]string, error) { - if s == nil { - return nil, nil - } - fm := strings.Split(*s, ",") - return &fm, nil -} diff --git a/service/cleanrooms/model.go b/service/cleanrooms/model.go index 2392e8076..a197fc105 100755 --- a/service/cleanrooms/model.go +++ b/service/cleanrooms/model.go @@ -3,9 +3,9 @@ package cleanrooms import ( - "encoding/json" "fmt" + "github.com/databricks/databricks-sdk-go/marshal" "github.com/databricks/databricks-sdk-go/service/catalog" "github.com/databricks/databricks-sdk-go/service/jobs" "github.com/databricks/databricks-sdk-go/service/settings" @@ -16,70 +16,43 @@ type CleanRoom struct { // Whether clean room access is restricted due to [CSP] // // [CSP]: https://docs.databricks.com/en/security/privacy/security-profile.html - // Wire name: 'access_restricted' AccessRestricted CleanRoomAccessRestricted `json:"access_restricted,omitempty"` - // Wire name: 'comment' Comment string `json:"comment,omitempty"` // When the clean room was created, in epoch milliseconds. - // Wire name: 'created_at' CreatedAt int64 `json:"created_at,omitempty"` // The alias of the collaborator tied to the local clean room. - // Wire name: 'local_collaborator_alias' LocalCollaboratorAlias string `json:"local_collaborator_alias,omitempty"` // The name of the clean room. It should follow [UC securable naming // requirements]. // // [UC securable naming requirements]: https://docs.databricks.com/en/data-governance/unity-catalog/index.html#securable-object-naming-requirements - // Wire name: 'name' Name string `json:"name,omitempty"` // Output catalog of the clean room. It is an output only field. Output // catalog is manipulated using the separate CreateCleanRoomOutputCatalog // API. - // Wire name: 'output_catalog' OutputCatalog *CleanRoomOutputCatalog `json:"output_catalog,omitempty"` // This is Databricks username of the owner of the local clean room // securable for permission management. - // Wire name: 'owner' Owner string `json:"owner,omitempty"` // Central clean room details. During creation, users need to specify // cloud_vendor, region, and collaborators.global_metastore_id. This field // will not be filled in the ListCleanRooms call. - // Wire name: 'remote_detailed_info' RemoteDetailedInfo *CleanRoomRemoteDetail `json:"remote_detailed_info,omitempty"` // Clean room status. - // Wire name: 'status' Status CleanRoomStatusEnum `json:"status,omitempty"` // When the clean room was last updated, in epoch milliseconds. - // Wire name: 'updated_at' UpdatedAt int64 `json:"updated_at,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CleanRoom) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &cleanRoomPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := cleanRoomFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CleanRoom) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CleanRoom) MarshalJSON() ([]byte, error) { - pb, err := cleanRoomToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CleanRoom) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CleanRoomAccessRestricted string @@ -122,22 +95,17 @@ func (f *CleanRoomAccessRestricted) Type() string { // Metadata of the clean room asset type CleanRoomAsset struct { // When the asset is added to the clean room, in epoch milliseconds. - // Wire name: 'added_at' AddedAt int64 `json:"added_at,omitempty"` // The type of the asset. - // Wire name: 'asset_type' AssetType CleanRoomAssetAssetType `json:"asset_type,omitempty"` // The name of the clean room this asset belongs to. This is an output-only // field to ensure proper resource identification. - // Wire name: 'clean_room_name' CleanRoomName string `json:"clean_room_name,omitempty"` // Foreign table details available to all collaborators of the clean room. // Present if and only if **asset_type** is **FOREIGN_TABLE** - // Wire name: 'foreign_table' ForeignTable *CleanRoomAssetForeignTable `json:"foreign_table,omitempty"` // Local details for a foreign that are only available to its owner. Present // if and only if **asset_type** is **FOREIGN_TABLE** - // Wire name: 'foreign_table_local_details' ForeignTableLocalDetails *CleanRoomAssetForeignTableLocalDetails `json:"foreign_table_local_details,omitempty"` // A fully qualified name that uniquely identifies the asset within the // clean room. This is also the name displayed in the clean room UI. @@ -146,65 +114,39 @@ type CleanRoomAsset struct { // *shared_catalog*.*shared_schema*.*asset_name* // // For notebooks, the name is the notebook file name. - // Wire name: 'name' Name string `json:"name,omitempty"` // Notebook details available to all collaborators of the clean room. // Present if and only if **asset_type** is **NOTEBOOK_FILE** - // Wire name: 'notebook' Notebook *CleanRoomAssetNotebook `json:"notebook,omitempty"` // The alias of the collaborator who owns this asset - // Wire name: 'owner_collaborator_alias' OwnerCollaboratorAlias string `json:"owner_collaborator_alias,omitempty"` // Status of the asset - // Wire name: 'status' Status CleanRoomAssetStatusEnum `json:"status,omitempty"` // Table details available to all collaborators of the clean room. Present // if and only if **asset_type** is **TABLE** - // Wire name: 'table' Table *CleanRoomAssetTable `json:"table,omitempty"` // Local details for a table that are only available to its owner. Present // if and only if **asset_type** is **TABLE** - // Wire name: 'table_local_details' TableLocalDetails *CleanRoomAssetTableLocalDetails `json:"table_local_details,omitempty"` // View details available to all collaborators of the clean room. Present if // and only if **asset_type** is **VIEW** - // Wire name: 'view' View *CleanRoomAssetView `json:"view,omitempty"` // Local details for a view that are only available to its owner. Present if // and only if **asset_type** is **VIEW** - // Wire name: 'view_local_details' ViewLocalDetails *CleanRoomAssetViewLocalDetails `json:"view_local_details,omitempty"` // Local details for a volume that are only available to its owner. Present // if and only if **asset_type** is **VOLUME** - // Wire name: 'volume_local_details' VolumeLocalDetails *CleanRoomAssetVolumeLocalDetails `json:"volume_local_details,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CleanRoomAsset) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &cleanRoomAssetPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := cleanRoomAssetFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CleanRoomAsset) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CleanRoomAsset) MarshalJSON() ([]byte, error) { - pb, err := cleanRoomAssetToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CleanRoomAsset) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CleanRoomAssetAssetType string @@ -255,113 +197,47 @@ func (f *CleanRoomAssetAssetType) Type() string { type CleanRoomAssetForeignTable struct { // The metadata information of the columns in the foreign table - // Wire name: 'columns' Columns []catalog.ColumnInfo `json:"columns,omitempty"` } -func (st *CleanRoomAssetForeignTable) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &cleanRoomAssetForeignTablePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := cleanRoomAssetForeignTableFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CleanRoomAssetForeignTable) MarshalJSON() ([]byte, error) { - pb, err := cleanRoomAssetForeignTableToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type CleanRoomAssetForeignTableLocalDetails struct { // The fully qualified name of the foreign table in its owner's local // metastore, in the format of *catalog*.*schema*.*foreign_table_name* - // Wire name: 'local_name' LocalName string `json:"local_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CleanRoomAssetForeignTableLocalDetails) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &cleanRoomAssetForeignTableLocalDetailsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := cleanRoomAssetForeignTableLocalDetailsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CleanRoomAssetForeignTableLocalDetails) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CleanRoomAssetForeignTableLocalDetails) MarshalJSON() ([]byte, error) { - pb, err := cleanRoomAssetForeignTableLocalDetailsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CleanRoomAssetForeignTableLocalDetails) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CleanRoomAssetNotebook struct { // Server generated etag that represents the notebook version. - // Wire name: 'etag' Etag string `json:"etag,omitempty"` // Base 64 representation of the notebook contents. This is the same format // as returned by :method:workspace/export with the format of **HTML**. - // Wire name: 'notebook_content' NotebookContent string `json:"notebook_content,omitempty"` // top-level status derived from all reviews - // Wire name: 'review_state' ReviewState CleanRoomNotebookReviewNotebookReviewState `json:"review_state,omitempty"` // All existing approvals or rejections - // Wire name: 'reviews' Reviews []CleanRoomNotebookReview `json:"reviews,omitempty"` // collaborators that can run the notebook - // Wire name: 'runner_collaborator_aliases' RunnerCollaboratorAliases []string `json:"runner_collaborator_aliases,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CleanRoomAssetNotebook) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &cleanRoomAssetNotebookPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := cleanRoomAssetNotebookFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CleanRoomAssetNotebook) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CleanRoomAssetNotebook) MarshalJSON() ([]byte, error) { - pb, err := cleanRoomAssetNotebookToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CleanRoomAssetNotebook) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CleanRoomAssetStatusEnum string @@ -406,169 +282,62 @@ func (f *CleanRoomAssetStatusEnum) Type() string { type CleanRoomAssetTable struct { // The metadata information of the columns in the table - // Wire name: 'columns' Columns []catalog.ColumnInfo `json:"columns,omitempty"` } -func (st *CleanRoomAssetTable) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &cleanRoomAssetTablePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := cleanRoomAssetTableFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CleanRoomAssetTable) MarshalJSON() ([]byte, error) { - pb, err := cleanRoomAssetTableToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type CleanRoomAssetTableLocalDetails struct { // The fully qualified name of the table in its owner's local metastore, in // the format of *catalog*.*schema*.*table_name* - // Wire name: 'local_name' LocalName string `json:"local_name,omitempty"` // Partition filtering specification for a shared table. - // Wire name: 'partitions' Partitions []sharing.Partition `json:"partitions,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CleanRoomAssetTableLocalDetails) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &cleanRoomAssetTableLocalDetailsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := cleanRoomAssetTableLocalDetailsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CleanRoomAssetTableLocalDetails) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CleanRoomAssetTableLocalDetails) MarshalJSON() ([]byte, error) { - pb, err := cleanRoomAssetTableLocalDetailsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CleanRoomAssetTableLocalDetails) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CleanRoomAssetView struct { // The metadata information of the columns in the view - // Wire name: 'columns' Columns []catalog.ColumnInfo `json:"columns,omitempty"` } -func (st *CleanRoomAssetView) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &cleanRoomAssetViewPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := cleanRoomAssetViewFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CleanRoomAssetView) MarshalJSON() ([]byte, error) { - pb, err := cleanRoomAssetViewToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type CleanRoomAssetViewLocalDetails struct { // The fully qualified name of the view in its owner's local metastore, in // the format of *catalog*.*schema*.*view_name* - // Wire name: 'local_name' LocalName string `json:"local_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CleanRoomAssetViewLocalDetails) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &cleanRoomAssetViewLocalDetailsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := cleanRoomAssetViewLocalDetailsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CleanRoomAssetViewLocalDetails) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CleanRoomAssetViewLocalDetails) MarshalJSON() ([]byte, error) { - pb, err := cleanRoomAssetViewLocalDetailsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CleanRoomAssetViewLocalDetails) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CleanRoomAssetVolumeLocalDetails struct { // The fully qualified name of the volume in its owner's local metastore, in // the format of *catalog*.*schema*.*volume_name* - // Wire name: 'local_name' LocalName string `json:"local_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CleanRoomAssetVolumeLocalDetails) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &cleanRoomAssetVolumeLocalDetailsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := cleanRoomAssetVolumeLocalDetailsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CleanRoomAssetVolumeLocalDetails) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CleanRoomAssetVolumeLocalDetails) MarshalJSON() ([]byte, error) { - pb, err := cleanRoomAssetVolumeLocalDetailsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CleanRoomAssetVolumeLocalDetails) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Publicly visible clean room collaborator. @@ -580,106 +349,61 @@ type CleanRoomCollaborator struct { // requirements]. // // [UC securable naming requirements]: https://docs.databricks.com/en/data-governance/unity-catalog/index.html#securable-object-naming-requirements - // Wire name: 'collaborator_alias' CollaboratorAlias string `json:"collaborator_alias"` // Generated display name for the collaborator. In the case of a single // metastore clean room, it is the clean room name. For x-metastore clean // rooms, it is the organization name of the metastore. It is not restricted // to these values and could change in the future - // Wire name: 'display_name' DisplayName string `json:"display_name,omitempty"` // The global Unity Catalog metastore id of the collaborator. The identifier // is of format cloud:region:metastore-uuid. - // Wire name: 'global_metastore_id' GlobalMetastoreId string `json:"global_metastore_id,omitempty"` // Email of the user who is receiving the clean room "invitation". It should // be empty for the creator of the clean room, and non-empty for the // invitees of the clean room. It is only returned in the output when clean // room creator calls GET - // Wire name: 'invite_recipient_email' InviteRecipientEmail string `json:"invite_recipient_email,omitempty"` // Workspace ID of the user who is receiving the clean room "invitation". // Must be specified if invite_recipient_email is specified. It should be // empty when the collaborator is the creator of the clean room. - // Wire name: 'invite_recipient_workspace_id' InviteRecipientWorkspaceId int64 `json:"invite_recipient_workspace_id,omitempty"` // [Organization // name](:method:metastores/list#metastores-delta_sharing_organization_name) // configured in the metastore - // Wire name: 'organization_name' OrganizationName string `json:"organization_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CleanRoomCollaborator) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &cleanRoomCollaboratorPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := cleanRoomCollaboratorFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CleanRoomCollaborator) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CleanRoomCollaborator) MarshalJSON() ([]byte, error) { - pb, err := cleanRoomCollaboratorToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CleanRoomCollaborator) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CleanRoomNotebookReview struct { // review comment - // Wire name: 'comment' Comment string `json:"comment,omitempty"` // timestamp of when the review was submitted - // Wire name: 'created_at_millis' CreatedAtMillis int64 `json:"created_at_millis,omitempty"` // review outcome - // Wire name: 'review_state' ReviewState CleanRoomNotebookReviewNotebookReviewState `json:"review_state,omitempty"` // specified when the review was not explicitly made by a user - // Wire name: 'review_sub_reason' ReviewSubReason CleanRoomNotebookReviewNotebookReviewSubReason `json:"review_sub_reason,omitempty"` // collaborator alias of the reviewer - // Wire name: 'reviewer_collaborator_alias' ReviewerCollaboratorAlias string `json:"reviewer_collaborator_alias,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CleanRoomNotebookReview) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &cleanRoomNotebookReviewPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := cleanRoomNotebookReviewFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CleanRoomNotebookReview) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CleanRoomNotebookReview) MarshalJSON() ([]byte, error) { - pb, err := cleanRoomNotebookReviewToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CleanRoomNotebookReview) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CleanRoomNotebookReviewNotebookReviewState string @@ -765,62 +489,36 @@ type CleanRoomNotebookTaskRun struct { // only included in the LIST API. if the task was run within the same // workspace the API is being called. If the task run was in a different // workspace under the same metastore, only the workspace_id is included. - // Wire name: 'collaborator_job_run_info' CollaboratorJobRunInfo *CollaboratorJobRunInfo `json:"collaborator_job_run_info,omitempty"` // Etag of the notebook executed in this task run, used to identify the // notebook version. - // Wire name: 'notebook_etag' NotebookEtag string `json:"notebook_etag,omitempty"` // State of the task run. - // Wire name: 'notebook_job_run_state' NotebookJobRunState *jobs.CleanRoomTaskRunState `json:"notebook_job_run_state,omitempty"` // Asset name of the notebook executed in this task run. - // Wire name: 'notebook_name' NotebookName string `json:"notebook_name,omitempty"` // The timestamp of when the notebook was last updated. - // Wire name: 'notebook_updated_at' NotebookUpdatedAt int64 `json:"notebook_updated_at,omitempty"` // Expiration time of the output schema of the task run (if any), in epoch // milliseconds. - // Wire name: 'output_schema_expiration_time' OutputSchemaExpirationTime int64 `json:"output_schema_expiration_time,omitempty"` // Name of the output schema associated with the clean rooms notebook task // run. - // Wire name: 'output_schema_name' OutputSchemaName string `json:"output_schema_name,omitempty"` // Duration of the task run, in milliseconds. - // Wire name: 'run_duration' RunDuration int64 `json:"run_duration,omitempty"` // When the task run started, in epoch milliseconds. - // Wire name: 'start_time' StartTime int64 `json:"start_time,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CleanRoomNotebookTaskRun) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &cleanRoomNotebookTaskRunPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := cleanRoomNotebookTaskRunFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CleanRoomNotebookTaskRun) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CleanRoomNotebookTaskRun) MarshalJSON() ([]byte, error) { - pb, err := cleanRoomNotebookTaskRunToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CleanRoomNotebookTaskRun) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CleanRoomOutputCatalog struct { @@ -828,38 +526,19 @@ type CleanRoomOutputCatalog struct { // naming requirements]. The field will always exist if status is CREATED. // // [UC securable naming requirements]: https://docs.databricks.com/en/data-governance/unity-catalog/index.html#securable-object-naming-requirements - // Wire name: 'catalog_name' CatalogName string `json:"catalog_name,omitempty"` - // Wire name: 'status' Status CleanRoomOutputCatalogOutputCatalogStatus `json:"status,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CleanRoomOutputCatalog) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &cleanRoomOutputCatalogPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := cleanRoomOutputCatalogFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CleanRoomOutputCatalog) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CleanRoomOutputCatalog) MarshalJSON() ([]byte, error) { - pb, err := cleanRoomOutputCatalogToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CleanRoomOutputCatalog) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CleanRoomOutputCatalogOutputCatalogStatus string @@ -905,10 +584,8 @@ func (f *CleanRoomOutputCatalogOutputCatalogStatus) Type() string { // Publicly visible central clean room details. type CleanRoomRemoteDetail struct { // Central clean room ID. - // Wire name: 'central_clean_room_id' CentralCleanRoomId string `json:"central_clean_room_id,omitempty"` // Cloud vendor (aws,azure,gcp) of the central clean room. - // Wire name: 'cloud_vendor' CloudVendor string `json:"cloud_vendor,omitempty"` // Collaborators in the central clean room. There should one and only one // collaborator in the list that satisfies the owner condition: @@ -917,48 +594,26 @@ type CleanRoomRemoteDetail struct { // CreateCleanRoom). // // 2. Its invite_recipient_email is empty. - // Wire name: 'collaborators' Collaborators []CleanRoomCollaborator `json:"collaborators,omitempty"` // The compliance security profile used to process regulated data following // compliance standards. - // Wire name: 'compliance_security_profile' ComplianceSecurityProfile *ComplianceSecurityProfile `json:"compliance_security_profile,omitempty"` // Collaborator who creates the clean room. - // Wire name: 'creator' Creator *CleanRoomCollaborator `json:"creator,omitempty"` // Egress network policy to apply to the central clean room workspace. - // Wire name: 'egress_network_policy' EgressNetworkPolicy *settings.EgressNetworkPolicy `json:"egress_network_policy,omitempty"` // Region of the central clean room. - // Wire name: 'region' Region string `json:"region,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CleanRoomRemoteDetail) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &cleanRoomRemoteDetailPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := cleanRoomRemoteDetailFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CleanRoomRemoteDetail) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CleanRoomRemoteDetail) MarshalJSON() ([]byte, error) { - pb, err := cleanRoomRemoteDetailToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CleanRoomRemoteDetail) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CleanRoomStatusEnum string @@ -1006,47 +661,25 @@ func (f *CleanRoomStatusEnum) Type() string { type CollaboratorJobRunInfo struct { // Alias of the collaborator that triggered the task run. - // Wire name: 'collaborator_alias' CollaboratorAlias string `json:"collaborator_alias,omitempty"` // Job ID of the task run in the collaborator's workspace. - // Wire name: 'collaborator_job_id' CollaboratorJobId int64 `json:"collaborator_job_id,omitempty"` // Job run ID of the task run in the collaborator's workspace. - // Wire name: 'collaborator_job_run_id' CollaboratorJobRunId int64 `json:"collaborator_job_run_id,omitempty"` // Task run ID of the task run in the collaborator's workspace. - // Wire name: 'collaborator_task_run_id' CollaboratorTaskRunId int64 `json:"collaborator_task_run_id,omitempty"` // ID of the collaborator's workspace that triggered the task run. - // Wire name: 'collaborator_workspace_id' CollaboratorWorkspaceId int64 `json:"collaborator_workspace_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CollaboratorJobRunInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &collaboratorJobRunInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := collaboratorJobRunInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CollaboratorJobRunInfo) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CollaboratorJobRunInfo) MarshalJSON() ([]byte, error) { - pb, err := collaboratorJobRunInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CollaboratorJobRunInfo) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The compliance security profile used to process regulated data following @@ -1054,205 +687,55 @@ func (st CollaboratorJobRunInfo) MarshalJSON() ([]byte, error) { type ComplianceSecurityProfile struct { // The list of compliance standards that the compliance security profile is // configured to enforce. - // Wire name: 'compliance_standards' ComplianceStandards []settings.ComplianceStandard `json:"compliance_standards,omitempty"` // Whether the compliance security profile is enabled. - // Wire name: 'is_enabled' IsEnabled bool `json:"is_enabled,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ComplianceSecurityProfile) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &complianceSecurityProfilePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := complianceSecurityProfileFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ComplianceSecurityProfile) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ComplianceSecurityProfile) MarshalJSON() ([]byte, error) { - pb, err := complianceSecurityProfileToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ComplianceSecurityProfile) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Create an asset type CreateCleanRoomAssetRequest struct { // Metadata of the clean room asset - // Wire name: 'asset' Asset CleanRoomAsset `json:"asset"` // Name of the clean room. - CleanRoomName string `json:"-" tf:"-"` -} - -func (st *CreateCleanRoomAssetRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createCleanRoomAssetRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createCleanRoomAssetRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CreateCleanRoomAssetRequest) MarshalJSON() ([]byte, error) { - pb, err := createCleanRoomAssetRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + CleanRoomName string `json:"-" url:"-"` } // Create an output catalog type CreateCleanRoomOutputCatalogRequest struct { // Name of the clean room. - CleanRoomName string `json:"-" tf:"-"` + CleanRoomName string `json:"-" url:"-"` - // Wire name: 'output_catalog' OutputCatalog CleanRoomOutputCatalog `json:"output_catalog"` } -func (st *CreateCleanRoomOutputCatalogRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createCleanRoomOutputCatalogRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createCleanRoomOutputCatalogRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CreateCleanRoomOutputCatalogRequest) MarshalJSON() ([]byte, error) { - pb, err := createCleanRoomOutputCatalogRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type CreateCleanRoomOutputCatalogResponse struct { - - // Wire name: 'output_catalog' OutputCatalog *CleanRoomOutputCatalog `json:"output_catalog,omitempty"` } -func (st *CreateCleanRoomOutputCatalogResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createCleanRoomOutputCatalogResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createCleanRoomOutputCatalogResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CreateCleanRoomOutputCatalogResponse) MarshalJSON() ([]byte, error) { - pb, err := createCleanRoomOutputCatalogResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Create a clean room type CreateCleanRoomRequest struct { - - // Wire name: 'clean_room' CleanRoom CleanRoom `json:"clean_room"` } -func (st *CreateCleanRoomRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createCleanRoomRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createCleanRoomRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CreateCleanRoomRequest) MarshalJSON() ([]byte, error) { - pb, err := createCleanRoomRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Delete an asset type DeleteCleanRoomAssetRequest struct { // The type of the asset. - AssetType CleanRoomAssetAssetType `json:"-" tf:"-"` + AssetType CleanRoomAssetAssetType `json:"-" url:"-"` // Name of the clean room. - CleanRoomName string `json:"-" tf:"-"` + CleanRoomName string `json:"-" url:"-"` // The fully qualified name of the asset, it is same as the name field in // CleanRoomAsset. - Name string `json:"-" tf:"-"` -} - -func (st *DeleteCleanRoomAssetRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteCleanRoomAssetRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteCleanRoomAssetRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteCleanRoomAssetRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteCleanRoomAssetRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Name string `json:"-" url:"-"` } // Response for delete clean room request. Using an empty message since the @@ -1260,390 +743,155 @@ func (st DeleteCleanRoomAssetRequest) MarshalJSON() ([]byte, error) { type DeleteCleanRoomAssetResponse struct { } -func (st *DeleteCleanRoomAssetResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteCleanRoomAssetResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteCleanRoomAssetResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteCleanRoomAssetResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteCleanRoomAssetResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Delete a clean room type DeleteCleanRoomRequest struct { // Name of the clean room. - Name string `json:"-" tf:"-"` -} - -func (st *DeleteCleanRoomRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteCleanRoomRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteCleanRoomRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteCleanRoomRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteCleanRoomRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Name string `json:"-" url:"-"` } type DeleteResponse struct { } -func (st *DeleteResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Get an asset type GetCleanRoomAssetRequest struct { // The type of the asset. - AssetType CleanRoomAssetAssetType `json:"-" tf:"-"` + AssetType CleanRoomAssetAssetType `json:"-" url:"-"` // Name of the clean room. - CleanRoomName string `json:"-" tf:"-"` + CleanRoomName string `json:"-" url:"-"` // The fully qualified name of the asset, it is same as the name field in // CleanRoomAsset. - Name string `json:"-" tf:"-"` -} - -func (st *GetCleanRoomAssetRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getCleanRoomAssetRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getCleanRoomAssetRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetCleanRoomAssetRequest) MarshalJSON() ([]byte, error) { - pb, err := getCleanRoomAssetRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Name string `json:"-" url:"-"` } // Get a clean room type GetCleanRoomRequest struct { - Name string `json:"-" tf:"-"` -} - -func (st *GetCleanRoomRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getCleanRoomRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getCleanRoomRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetCleanRoomRequest) MarshalJSON() ([]byte, error) { - pb, err := getCleanRoomRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Name string `json:"-" url:"-"` } // List assets type ListCleanRoomAssetsRequest struct { // Name of the clean room. - CleanRoomName string `json:"-" tf:"-"` + CleanRoomName string `json:"-" url:"-"` // Opaque pagination token to go to next page based on previous query. - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListCleanRoomAssetsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listCleanRoomAssetsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listCleanRoomAssetsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListCleanRoomAssetsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListCleanRoomAssetsRequest) MarshalJSON() ([]byte, error) { - pb, err := listCleanRoomAssetsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListCleanRoomAssetsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListCleanRoomAssetsResponse struct { // Assets in the clean room. - // Wire name: 'assets' Assets []CleanRoomAsset `json:"assets,omitempty"` // Opaque token to retrieve the next page of results. Absent if there are no // more pages. page_token should be set to this value for the next request // (for the next page of results). - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListCleanRoomAssetsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listCleanRoomAssetsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listCleanRoomAssetsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListCleanRoomAssetsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListCleanRoomAssetsResponse) MarshalJSON() ([]byte, error) { - pb, err := listCleanRoomAssetsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListCleanRoomAssetsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // List notebook task runs type ListCleanRoomNotebookTaskRunsRequest struct { // Name of the clean room. - CleanRoomName string `json:"-" tf:"-"` + CleanRoomName string `json:"-" url:"-"` // Notebook name - NotebookName string `json:"-" tf:"-"` + NotebookName string `json:"-" url:"notebook_name,omitempty"` // The maximum number of task runs to return. Currently ignored - all runs // will be returned. - PageSize int `json:"-" tf:"-"` + PageSize int `json:"-" url:"page_size,omitempty"` // Opaque pagination token to go to next page based on previous query. - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListCleanRoomNotebookTaskRunsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listCleanRoomNotebookTaskRunsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listCleanRoomNotebookTaskRunsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListCleanRoomNotebookTaskRunsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListCleanRoomNotebookTaskRunsRequest) MarshalJSON() ([]byte, error) { - pb, err := listCleanRoomNotebookTaskRunsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListCleanRoomNotebookTaskRunsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListCleanRoomNotebookTaskRunsResponse struct { // Opaque token to retrieve the next page of results. Absent if there are no // more pages. page_token should be set to this value for the next request // (for the next page of results). - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` // Name of the clean room. - // Wire name: 'runs' Runs []CleanRoomNotebookTaskRun `json:"runs,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListCleanRoomNotebookTaskRunsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listCleanRoomNotebookTaskRunsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listCleanRoomNotebookTaskRunsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListCleanRoomNotebookTaskRunsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListCleanRoomNotebookTaskRunsResponse) MarshalJSON() ([]byte, error) { - pb, err := listCleanRoomNotebookTaskRunsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListCleanRoomNotebookTaskRunsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // List clean rooms type ListCleanRoomsRequest struct { // Maximum number of clean rooms to return (i.e., the page length). Defaults // to 100. - PageSize int `json:"-" tf:"-"` + PageSize int `json:"-" url:"page_size,omitempty"` // Opaque pagination token to go to next page based on previous query. - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListCleanRoomsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listCleanRoomsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listCleanRoomsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListCleanRoomsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListCleanRoomsRequest) MarshalJSON() ([]byte, error) { - pb, err := listCleanRoomsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListCleanRoomsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListCleanRoomsResponse struct { - - // Wire name: 'clean_rooms' CleanRooms []CleanRoom `json:"clean_rooms,omitempty"` // Opaque token to retrieve the next page of results. Absent if there are no // more pages. page_token should be set to this value for the next request // (for the next page of results). - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListCleanRoomsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listCleanRoomsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listCleanRoomsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListCleanRoomsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListCleanRoomsResponse) MarshalJSON() ([]byte, error) { - pb, err := listCleanRoomsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListCleanRoomsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Update an asset type UpdateCleanRoomAssetRequest struct { // Metadata of the clean room asset - // Wire name: 'asset' Asset CleanRoomAsset `json:"asset"` // The type of the asset. - AssetType CleanRoomAssetAssetType `json:"-" tf:"-"` + AssetType CleanRoomAssetAssetType `json:"-" url:"-"` // Name of the clean room. - CleanRoomName string `json:"-" tf:"-"` + CleanRoomName string `json:"-" url:"-"` // A fully qualified name that uniquely identifies the asset within the // clean room. This is also the name displayed in the clean room UI. // @@ -1651,63 +899,11 @@ type UpdateCleanRoomAssetRequest struct { // *shared_catalog*.*shared_schema*.*asset_name* // // For notebooks, the name is the notebook file name. - Name string `json:"-" tf:"-"` -} - -func (st *UpdateCleanRoomAssetRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateCleanRoomAssetRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateCleanRoomAssetRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateCleanRoomAssetRequest) MarshalJSON() ([]byte, error) { - pb, err := updateCleanRoomAssetRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Name string `json:"-" url:"-"` } type UpdateCleanRoomRequest struct { - - // Wire name: 'clean_room' CleanRoom *CleanRoom `json:"clean_room,omitempty"` // Name of the clean room. - Name string `json:"-" tf:"-"` -} - -func (st *UpdateCleanRoomRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateCleanRoomRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateCleanRoomRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateCleanRoomRequest) MarshalJSON() ([]byte, error) { - pb, err := updateCleanRoomRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Name string `json:"-" url:"-"` } diff --git a/service/compute/impl.go b/service/compute/impl.go index 0ceb7f79c..350ed12f9 100755 --- a/service/compute/impl.go +++ b/service/compute/impl.go @@ -18,190 +18,66 @@ type clusterPoliciesImpl struct { } func (a *clusterPoliciesImpl) Create(ctx context.Context, request CreatePolicy) (*CreatePolicyResponse, error) { - - requestPb, pbErr := createPolicyToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var createPolicyResponsePb createPolicyResponsePb + var createPolicyResponse CreatePolicyResponse path := "/api/2.0/policies/clusters/create" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &createPolicyResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := createPolicyResponseFromPb(&createPolicyResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &createPolicyResponse) + return &createPolicyResponse, err } func (a *clusterPoliciesImpl) Delete(ctx context.Context, request DeletePolicy) error { - - requestPb, pbErr := deletePolicyToPb(&request) - if pbErr != nil { - return pbErr - } - - var deletePolicyResponsePb deletePolicyResponsePb + var deletePolicyResponse DeletePolicyResponse path := "/api/2.0/policies/clusters/delete" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &deletePolicyResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &deletePolicyResponse) return err } func (a *clusterPoliciesImpl) Edit(ctx context.Context, request EditPolicy) error { - - requestPb, pbErr := editPolicyToPb(&request) - if pbErr != nil { - return pbErr - } - - var editPolicyResponsePb editPolicyResponsePb + var editPolicyResponse EditPolicyResponse path := "/api/2.0/policies/clusters/edit" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &editPolicyResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &editPolicyResponse) return err } func (a *clusterPoliciesImpl) Get(ctx context.Context, request GetClusterPolicyRequest) (*Policy, error) { - - requestPb, pbErr := getClusterPolicyRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var policyPb policyPb + var policy Policy path := "/api/2.0/policies/clusters/get" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &policyPb, - ) - if err != nil { - return nil, err - } - resp, err := policyFromPb(&policyPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &policy) + return &policy, err } func (a *clusterPoliciesImpl) GetPermissionLevels(ctx context.Context, request GetClusterPolicyPermissionLevelsRequest) (*GetClusterPolicyPermissionLevelsResponse, error) { - - requestPb, pbErr := getClusterPolicyPermissionLevelsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var getClusterPolicyPermissionLevelsResponsePb getClusterPolicyPermissionLevelsResponsePb - path := fmt.Sprintf("/api/2.0/permissions/cluster-policies/%v/permissionLevels", requestPb.ClusterPolicyId) + var getClusterPolicyPermissionLevelsResponse GetClusterPolicyPermissionLevelsResponse + path := fmt.Sprintf("/api/2.0/permissions/cluster-policies/%v/permissionLevels", request.ClusterPolicyId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &getClusterPolicyPermissionLevelsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := getClusterPolicyPermissionLevelsResponseFromPb(&getClusterPolicyPermissionLevelsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getClusterPolicyPermissionLevelsResponse) + return &getClusterPolicyPermissionLevelsResponse, err } func (a *clusterPoliciesImpl) GetPermissions(ctx context.Context, request GetClusterPolicyPermissionsRequest) (*ClusterPolicyPermissions, error) { - - requestPb, pbErr := getClusterPolicyPermissionsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var clusterPolicyPermissionsPb clusterPolicyPermissionsPb - path := fmt.Sprintf("/api/2.0/permissions/cluster-policies/%v", requestPb.ClusterPolicyId) + var clusterPolicyPermissions ClusterPolicyPermissions + path := fmt.Sprintf("/api/2.0/permissions/cluster-policies/%v", request.ClusterPolicyId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &clusterPolicyPermissionsPb, - ) - if err != nil { - return nil, err - } - resp, err := clusterPolicyPermissionsFromPb(&clusterPolicyPermissionsPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &clusterPolicyPermissions) + return &clusterPolicyPermissions, err } // Returns a list of policies accessible by the requesting user. @@ -230,101 +106,35 @@ func (a *clusterPoliciesImpl) ListAll(ctx context.Context, request ListClusterPo } func (a *clusterPoliciesImpl) internalList(ctx context.Context, request ListClusterPoliciesRequest) (*ListPoliciesResponse, error) { - - requestPb, pbErr := listClusterPoliciesRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listPoliciesResponsePb listPoliciesResponsePb + var listPoliciesResponse ListPoliciesResponse path := "/api/2.0/policies/clusters/list" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listPoliciesResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listPoliciesResponseFromPb(&listPoliciesResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listPoliciesResponse) + return &listPoliciesResponse, err } func (a *clusterPoliciesImpl) SetPermissions(ctx context.Context, request ClusterPolicyPermissionsRequest) (*ClusterPolicyPermissions, error) { - - requestPb, pbErr := clusterPolicyPermissionsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var clusterPolicyPermissionsPb clusterPolicyPermissionsPb - path := fmt.Sprintf("/api/2.0/permissions/cluster-policies/%v", requestPb.ClusterPolicyId) + var clusterPolicyPermissions ClusterPolicyPermissions + path := fmt.Sprintf("/api/2.0/permissions/cluster-policies/%v", request.ClusterPolicyId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPut, - path, - headers, - queryParams, - (*requestPb), - &clusterPolicyPermissionsPb, - ) - if err != nil { - return nil, err - } - resp, err := clusterPolicyPermissionsFromPb(&clusterPolicyPermissionsPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &clusterPolicyPermissions) + return &clusterPolicyPermissions, err } func (a *clusterPoliciesImpl) UpdatePermissions(ctx context.Context, request ClusterPolicyPermissionsRequest) (*ClusterPolicyPermissions, error) { - - requestPb, pbErr := clusterPolicyPermissionsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var clusterPolicyPermissionsPb clusterPolicyPermissionsPb - path := fmt.Sprintf("/api/2.0/permissions/cluster-policies/%v", requestPb.ClusterPolicyId) + var clusterPolicyPermissions ClusterPolicyPermissions + path := fmt.Sprintf("/api/2.0/permissions/cluster-policies/%v", request.ClusterPolicyId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &clusterPolicyPermissionsPb, - ) - if err != nil { - return nil, err - } - resp, err := clusterPolicyPermissionsFromPb(&clusterPolicyPermissionsPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &clusterPolicyPermissions) + return &clusterPolicyPermissions, err } // unexported type that holds implementations of just Clusters API methods @@ -333,122 +143,46 @@ type clustersImpl struct { } func (a *clustersImpl) ChangeOwner(ctx context.Context, request ChangeClusterOwner) error { - - requestPb, pbErr := changeClusterOwnerToPb(&request) - if pbErr != nil { - return pbErr - } - - var changeClusterOwnerResponsePb changeClusterOwnerResponsePb + var changeClusterOwnerResponse ChangeClusterOwnerResponse path := "/api/2.1/clusters/change-owner" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &changeClusterOwnerResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &changeClusterOwnerResponse) return err } func (a *clustersImpl) Create(ctx context.Context, request CreateCluster) (*CreateClusterResponse, error) { - - requestPb, pbErr := createClusterToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var createClusterResponsePb createClusterResponsePb + var createClusterResponse CreateClusterResponse path := "/api/2.1/clusters/create" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &createClusterResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := createClusterResponseFromPb(&createClusterResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &createClusterResponse) + return &createClusterResponse, err } func (a *clustersImpl) Delete(ctx context.Context, request DeleteCluster) error { - - requestPb, pbErr := deleteClusterToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteClusterResponsePb deleteClusterResponsePb + var deleteClusterResponse DeleteClusterResponse path := "/api/2.1/clusters/delete" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &deleteClusterResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &deleteClusterResponse) return err } func (a *clustersImpl) Edit(ctx context.Context, request EditCluster) error { - - requestPb, pbErr := editClusterToPb(&request) - if pbErr != nil { - return pbErr - } - - var editClusterResponsePb editClusterResponsePb + var editClusterResponse EditClusterResponse path := "/api/2.1/clusters/edit" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &editClusterResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &editClusterResponse) return err } @@ -490,132 +224,44 @@ func (a *clustersImpl) EventsAll(ctx context.Context, request GetEvents) ([]Clus } func (a *clustersImpl) internalEvents(ctx context.Context, request GetEvents) (*GetEventsResponse, error) { - - requestPb, pbErr := getEventsToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var getEventsResponsePb getEventsResponsePb + var getEventsResponse GetEventsResponse path := "/api/2.1/clusters/events" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &getEventsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := getEventsResponseFromPb(&getEventsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &getEventsResponse) + return &getEventsResponse, err } func (a *clustersImpl) Get(ctx context.Context, request GetClusterRequest) (*ClusterDetails, error) { - - requestPb, pbErr := getClusterRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var clusterDetailsPb clusterDetailsPb + var clusterDetails ClusterDetails path := "/api/2.1/clusters/get" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &clusterDetailsPb, - ) - if err != nil { - return nil, err - } - resp, err := clusterDetailsFromPb(&clusterDetailsPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &clusterDetails) + return &clusterDetails, err } func (a *clustersImpl) GetPermissionLevels(ctx context.Context, request GetClusterPermissionLevelsRequest) (*GetClusterPermissionLevelsResponse, error) { - - requestPb, pbErr := getClusterPermissionLevelsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var getClusterPermissionLevelsResponsePb getClusterPermissionLevelsResponsePb - path := fmt.Sprintf("/api/2.0/permissions/clusters/%v/permissionLevels", requestPb.ClusterId) + var getClusterPermissionLevelsResponse GetClusterPermissionLevelsResponse + path := fmt.Sprintf("/api/2.0/permissions/clusters/%v/permissionLevels", request.ClusterId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &getClusterPermissionLevelsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := getClusterPermissionLevelsResponseFromPb(&getClusterPermissionLevelsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getClusterPermissionLevelsResponse) + return &getClusterPermissionLevelsResponse, err } func (a *clustersImpl) GetPermissions(ctx context.Context, request GetClusterPermissionsRequest) (*ClusterPermissions, error) { - - requestPb, pbErr := getClusterPermissionsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var clusterPermissionsPb clusterPermissionsPb - path := fmt.Sprintf("/api/2.0/permissions/clusters/%v", requestPb.ClusterId) + var clusterPermissions ClusterPermissions + path := fmt.Sprintf("/api/2.0/permissions/clusters/%v", request.ClusterId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &clusterPermissionsPb, - ) - if err != nil { - return nil, err - } - resp, err := clusterPermissionsFromPb(&clusterPermissionsPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &clusterPermissions) + return &clusterPermissions, err } // Return information about all pinned and active clusters, and all clusters @@ -654,385 +300,142 @@ func (a *clustersImpl) ListAll(ctx context.Context, request ListClustersRequest) } func (a *clustersImpl) internalList(ctx context.Context, request ListClustersRequest) (*ListClustersResponse, error) { - - requestPb, pbErr := listClustersRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listClustersResponsePb listClustersResponsePb + var listClustersResponse ListClustersResponse path := "/api/2.1/clusters/list" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listClustersResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listClustersResponseFromPb(&listClustersResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listClustersResponse) + return &listClustersResponse, err } func (a *clustersImpl) ListNodeTypes(ctx context.Context) (*ListNodeTypesResponse, error) { - - var listNodeTypesResponsePb listNodeTypesResponsePb + var listNodeTypesResponse ListNodeTypesResponse path := "/api/2.1/clusters/list-node-types" headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - nil, - nil, - &listNodeTypesResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listNodeTypesResponseFromPb(&listNodeTypesResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, nil, nil, &listNodeTypesResponse) + return &listNodeTypesResponse, err } func (a *clustersImpl) ListZones(ctx context.Context) (*ListAvailableZonesResponse, error) { - - var listAvailableZonesResponsePb listAvailableZonesResponsePb + var listAvailableZonesResponse ListAvailableZonesResponse path := "/api/2.1/clusters/list-zones" headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - nil, - nil, - &listAvailableZonesResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listAvailableZonesResponseFromPb(&listAvailableZonesResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, nil, nil, &listAvailableZonesResponse) + return &listAvailableZonesResponse, err } func (a *clustersImpl) PermanentDelete(ctx context.Context, request PermanentDeleteCluster) error { - - requestPb, pbErr := permanentDeleteClusterToPb(&request) - if pbErr != nil { - return pbErr - } - - var permanentDeleteClusterResponsePb permanentDeleteClusterResponsePb + var permanentDeleteClusterResponse PermanentDeleteClusterResponse path := "/api/2.1/clusters/permanent-delete" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &permanentDeleteClusterResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &permanentDeleteClusterResponse) return err } func (a *clustersImpl) Pin(ctx context.Context, request PinCluster) error { - - requestPb, pbErr := pinClusterToPb(&request) - if pbErr != nil { - return pbErr - } - - var pinClusterResponsePb pinClusterResponsePb + var pinClusterResponse PinClusterResponse path := "/api/2.1/clusters/pin" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &pinClusterResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &pinClusterResponse) return err } func (a *clustersImpl) Resize(ctx context.Context, request ResizeCluster) error { - - requestPb, pbErr := resizeClusterToPb(&request) - if pbErr != nil { - return pbErr - } - - var resizeClusterResponsePb resizeClusterResponsePb + var resizeClusterResponse ResizeClusterResponse path := "/api/2.1/clusters/resize" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &resizeClusterResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &resizeClusterResponse) return err } func (a *clustersImpl) Restart(ctx context.Context, request RestartCluster) error { - - requestPb, pbErr := restartClusterToPb(&request) - if pbErr != nil { - return pbErr - } - - var restartClusterResponsePb restartClusterResponsePb + var restartClusterResponse RestartClusterResponse path := "/api/2.1/clusters/restart" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &restartClusterResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &restartClusterResponse) return err } func (a *clustersImpl) SetPermissions(ctx context.Context, request ClusterPermissionsRequest) (*ClusterPermissions, error) { - - requestPb, pbErr := clusterPermissionsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var clusterPermissionsPb clusterPermissionsPb - path := fmt.Sprintf("/api/2.0/permissions/clusters/%v", requestPb.ClusterId) + var clusterPermissions ClusterPermissions + path := fmt.Sprintf("/api/2.0/permissions/clusters/%v", request.ClusterId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPut, - path, - headers, - queryParams, - (*requestPb), - &clusterPermissionsPb, - ) - if err != nil { - return nil, err - } - resp, err := clusterPermissionsFromPb(&clusterPermissionsPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &clusterPermissions) + return &clusterPermissions, err } func (a *clustersImpl) SparkVersions(ctx context.Context) (*GetSparkVersionsResponse, error) { - - var getSparkVersionsResponsePb getSparkVersionsResponsePb + var getSparkVersionsResponse GetSparkVersionsResponse path := "/api/2.1/clusters/spark-versions" headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - nil, - nil, - &getSparkVersionsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := getSparkVersionsResponseFromPb(&getSparkVersionsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, nil, nil, &getSparkVersionsResponse) + return &getSparkVersionsResponse, err } func (a *clustersImpl) Start(ctx context.Context, request StartCluster) error { - - requestPb, pbErr := startClusterToPb(&request) - if pbErr != nil { - return pbErr - } - - var startClusterResponsePb startClusterResponsePb + var startClusterResponse StartClusterResponse path := "/api/2.1/clusters/start" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &startClusterResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &startClusterResponse) return err } func (a *clustersImpl) Unpin(ctx context.Context, request UnpinCluster) error { - - requestPb, pbErr := unpinClusterToPb(&request) - if pbErr != nil { - return pbErr - } - - var unpinClusterResponsePb unpinClusterResponsePb + var unpinClusterResponse UnpinClusterResponse path := "/api/2.1/clusters/unpin" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &unpinClusterResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &unpinClusterResponse) return err } func (a *clustersImpl) Update(ctx context.Context, request UpdateCluster) error { - - requestPb, pbErr := updateClusterToPb(&request) - if pbErr != nil { - return pbErr - } - - var updateClusterResponsePb updateClusterResponsePb + var updateClusterResponse UpdateClusterResponse path := "/api/2.1/clusters/update" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &updateClusterResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &updateClusterResponse) return err } func (a *clustersImpl) UpdatePermissions(ctx context.Context, request ClusterPermissionsRequest) (*ClusterPermissions, error) { - - requestPb, pbErr := clusterPermissionsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var clusterPermissionsPb clusterPermissionsPb - path := fmt.Sprintf("/api/2.0/permissions/clusters/%v", requestPb.ClusterId) + var clusterPermissions ClusterPermissions + path := fmt.Sprintf("/api/2.0/permissions/clusters/%v", request.ClusterId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &clusterPermissionsPb, - ) - if err != nil { - return nil, err - } - resp, err := clusterPermissionsFromPb(&clusterPermissionsPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &clusterPermissions) + return &clusterPermissions, err } // unexported type that holds implementations of just CommandExecution API methods @@ -1041,191 +444,67 @@ type commandExecutionImpl struct { } func (a *commandExecutionImpl) Cancel(ctx context.Context, request CancelCommand) error { - - requestPb, pbErr := cancelCommandToPb(&request) - if pbErr != nil { - return pbErr - } - - var cancelResponsePb cancelResponsePb + var cancelResponse CancelResponse path := "/api/1.2/commands/cancel" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &cancelResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &cancelResponse) return err } func (a *commandExecutionImpl) CommandStatus(ctx context.Context, request CommandStatusRequest) (*CommandStatusResponse, error) { - - requestPb, pbErr := commandStatusRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var commandStatusResponsePb commandStatusResponsePb + var commandStatusResponse CommandStatusResponse path := "/api/1.2/commands/status" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &commandStatusResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := commandStatusResponseFromPb(&commandStatusResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &commandStatusResponse) + return &commandStatusResponse, err } func (a *commandExecutionImpl) ContextStatus(ctx context.Context, request ContextStatusRequest) (*ContextStatusResponse, error) { - - requestPb, pbErr := contextStatusRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var contextStatusResponsePb contextStatusResponsePb + var contextStatusResponse ContextStatusResponse path := "/api/1.2/contexts/status" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &contextStatusResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := contextStatusResponseFromPb(&contextStatusResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &contextStatusResponse) + return &contextStatusResponse, err } func (a *commandExecutionImpl) Create(ctx context.Context, request CreateContext) (*Created, error) { - - requestPb, pbErr := createContextToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var createdPb createdPb + var created Created path := "/api/1.2/contexts/create" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &createdPb, - ) - if err != nil { - return nil, err - } - resp, err := createdFromPb(&createdPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &created) + return &created, err } func (a *commandExecutionImpl) Destroy(ctx context.Context, request DestroyContext) error { - - requestPb, pbErr := destroyContextToPb(&request) - if pbErr != nil { - return pbErr - } - - var destroyResponsePb destroyResponsePb + var destroyResponse DestroyResponse path := "/api/1.2/contexts/destroy" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &destroyResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &destroyResponse) return err } func (a *commandExecutionImpl) Execute(ctx context.Context, request Command) (*Created, error) { - - requestPb, pbErr := commandToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var createdPb createdPb + var created Created path := "/api/1.2/commands/execute" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &createdPb, - ) - if err != nil { - return nil, err - } - resp, err := createdFromPb(&createdPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &created) + return &created, err } // unexported type that holds implementations of just GlobalInitScripts API methods @@ -1234,96 +513,34 @@ type globalInitScriptsImpl struct { } func (a *globalInitScriptsImpl) Create(ctx context.Context, request GlobalInitScriptCreateRequest) (*CreateResponse, error) { - - requestPb, pbErr := globalInitScriptCreateRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var createResponsePb createResponsePb + var createResponse CreateResponse path := "/api/2.0/global-init-scripts" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &createResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := createResponseFromPb(&createResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &createResponse) + return &createResponse, err } func (a *globalInitScriptsImpl) Delete(ctx context.Context, request DeleteGlobalInitScriptRequest) error { - - requestPb, pbErr := deleteGlobalInitScriptRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteResponsePb deleteResponsePb - path := fmt.Sprintf("/api/2.0/global-init-scripts/%v", requestPb.ScriptId) + var deleteResponse DeleteResponse + path := fmt.Sprintf("/api/2.0/global-init-scripts/%v", request.ScriptId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteResponse) return err } func (a *globalInitScriptsImpl) Get(ctx context.Context, request GetGlobalInitScriptRequest) (*GlobalInitScriptDetailsWithContent, error) { - - requestPb, pbErr := getGlobalInitScriptRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var globalInitScriptDetailsWithContentPb globalInitScriptDetailsWithContentPb - path := fmt.Sprintf("/api/2.0/global-init-scripts/%v", requestPb.ScriptId) + var globalInitScriptDetailsWithContent GlobalInitScriptDetailsWithContent + path := fmt.Sprintf("/api/2.0/global-init-scripts/%v", request.ScriptId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &globalInitScriptDetailsWithContentPb, - ) - if err != nil { - return nil, err - } - resp, err := globalInitScriptDetailsWithContentFromPb(&globalInitScriptDetailsWithContentPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &globalInitScriptDetailsWithContent) + return &globalInitScriptDetailsWithContent, err } // Get a list of all global init scripts for this workspace. This returns all @@ -1359,58 +576,23 @@ func (a *globalInitScriptsImpl) ListAll(ctx context.Context) ([]GlobalInitScript } func (a *globalInitScriptsImpl) internalList(ctx context.Context) (*ListGlobalInitScriptsResponse, error) { - - var listGlobalInitScriptsResponsePb listGlobalInitScriptsResponsePb + var listGlobalInitScriptsResponse ListGlobalInitScriptsResponse path := "/api/2.0/global-init-scripts" headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - nil, - nil, - &listGlobalInitScriptsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listGlobalInitScriptsResponseFromPb(&listGlobalInitScriptsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, nil, nil, &listGlobalInitScriptsResponse) + return &listGlobalInitScriptsResponse, err } func (a *globalInitScriptsImpl) Update(ctx context.Context, request GlobalInitScriptUpdateRequest) error { - - requestPb, pbErr := globalInitScriptUpdateRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var updateResponsePb updateResponsePb - path := fmt.Sprintf("/api/2.0/global-init-scripts/%v", requestPb.ScriptId) + var updateResponse UpdateResponse + path := fmt.Sprintf("/api/2.0/global-init-scripts/%v", request.ScriptId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &updateResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &updateResponse) return err } @@ -1420,190 +602,66 @@ type instancePoolsImpl struct { } func (a *instancePoolsImpl) Create(ctx context.Context, request CreateInstancePool) (*CreateInstancePoolResponse, error) { - - requestPb, pbErr := createInstancePoolToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var createInstancePoolResponsePb createInstancePoolResponsePb + var createInstancePoolResponse CreateInstancePoolResponse path := "/api/2.0/instance-pools/create" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &createInstancePoolResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := createInstancePoolResponseFromPb(&createInstancePoolResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &createInstancePoolResponse) + return &createInstancePoolResponse, err } func (a *instancePoolsImpl) Delete(ctx context.Context, request DeleteInstancePool) error { - - requestPb, pbErr := deleteInstancePoolToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteInstancePoolResponsePb deleteInstancePoolResponsePb + var deleteInstancePoolResponse DeleteInstancePoolResponse path := "/api/2.0/instance-pools/delete" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &deleteInstancePoolResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &deleteInstancePoolResponse) return err } func (a *instancePoolsImpl) Edit(ctx context.Context, request EditInstancePool) error { - - requestPb, pbErr := editInstancePoolToPb(&request) - if pbErr != nil { - return pbErr - } - - var editInstancePoolResponsePb editInstancePoolResponsePb + var editInstancePoolResponse EditInstancePoolResponse path := "/api/2.0/instance-pools/edit" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &editInstancePoolResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &editInstancePoolResponse) return err } func (a *instancePoolsImpl) Get(ctx context.Context, request GetInstancePoolRequest) (*GetInstancePool, error) { - - requestPb, pbErr := getInstancePoolRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var getInstancePoolPb getInstancePoolPb + var getInstancePool GetInstancePool path := "/api/2.0/instance-pools/get" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &getInstancePoolPb, - ) - if err != nil { - return nil, err - } - resp, err := getInstancePoolFromPb(&getInstancePoolPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getInstancePool) + return &getInstancePool, err } func (a *instancePoolsImpl) GetPermissionLevels(ctx context.Context, request GetInstancePoolPermissionLevelsRequest) (*GetInstancePoolPermissionLevelsResponse, error) { - - requestPb, pbErr := getInstancePoolPermissionLevelsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var getInstancePoolPermissionLevelsResponsePb getInstancePoolPermissionLevelsResponsePb - path := fmt.Sprintf("/api/2.0/permissions/instance-pools/%v/permissionLevels", requestPb.InstancePoolId) + var getInstancePoolPermissionLevelsResponse GetInstancePoolPermissionLevelsResponse + path := fmt.Sprintf("/api/2.0/permissions/instance-pools/%v/permissionLevels", request.InstancePoolId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &getInstancePoolPermissionLevelsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := getInstancePoolPermissionLevelsResponseFromPb(&getInstancePoolPermissionLevelsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getInstancePoolPermissionLevelsResponse) + return &getInstancePoolPermissionLevelsResponse, err } func (a *instancePoolsImpl) GetPermissions(ctx context.Context, request GetInstancePoolPermissionsRequest) (*InstancePoolPermissions, error) { - - requestPb, pbErr := getInstancePoolPermissionsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var instancePoolPermissionsPb instancePoolPermissionsPb - path := fmt.Sprintf("/api/2.0/permissions/instance-pools/%v", requestPb.InstancePoolId) + var instancePoolPermissions InstancePoolPermissions + path := fmt.Sprintf("/api/2.0/permissions/instance-pools/%v", request.InstancePoolId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &instancePoolPermissionsPb, - ) - if err != nil { - return nil, err - } - resp, err := instancePoolPermissionsFromPb(&instancePoolPermissionsPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &instancePoolPermissions) + return &instancePoolPermissions, err } // Gets a list of instance pools with their statistics. @@ -1633,96 +691,35 @@ func (a *instancePoolsImpl) ListAll(ctx context.Context) ([]InstancePoolAndStats } func (a *instancePoolsImpl) internalList(ctx context.Context) (*ListInstancePools, error) { - - var listInstancePoolsPb listInstancePoolsPb + var listInstancePools ListInstancePools path := "/api/2.0/instance-pools/list" headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - nil, - nil, - &listInstancePoolsPb, - ) - if err != nil { - return nil, err - } - resp, err := listInstancePoolsFromPb(&listInstancePoolsPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, nil, nil, &listInstancePools) + return &listInstancePools, err } func (a *instancePoolsImpl) SetPermissions(ctx context.Context, request InstancePoolPermissionsRequest) (*InstancePoolPermissions, error) { - - requestPb, pbErr := instancePoolPermissionsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var instancePoolPermissionsPb instancePoolPermissionsPb - path := fmt.Sprintf("/api/2.0/permissions/instance-pools/%v", requestPb.InstancePoolId) + var instancePoolPermissions InstancePoolPermissions + path := fmt.Sprintf("/api/2.0/permissions/instance-pools/%v", request.InstancePoolId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPut, - path, - headers, - queryParams, - (*requestPb), - &instancePoolPermissionsPb, - ) - if err != nil { - return nil, err - } - resp, err := instancePoolPermissionsFromPb(&instancePoolPermissionsPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &instancePoolPermissions) + return &instancePoolPermissions, err } func (a *instancePoolsImpl) UpdatePermissions(ctx context.Context, request InstancePoolPermissionsRequest) (*InstancePoolPermissions, error) { - - requestPb, pbErr := instancePoolPermissionsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var instancePoolPermissionsPb instancePoolPermissionsPb - path := fmt.Sprintf("/api/2.0/permissions/instance-pools/%v", requestPb.InstancePoolId) + var instancePoolPermissions InstancePoolPermissions + path := fmt.Sprintf("/api/2.0/permissions/instance-pools/%v", request.InstancePoolId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &instancePoolPermissionsPb, - ) - if err != nil { - return nil, err - } - resp, err := instancePoolPermissionsFromPb(&instancePoolPermissionsPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &instancePoolPermissions) + return &instancePoolPermissions, err } // unexported type that holds implementations of just InstanceProfiles API methods @@ -1731,60 +728,24 @@ type instanceProfilesImpl struct { } func (a *instanceProfilesImpl) Add(ctx context.Context, request AddInstanceProfile) error { - - requestPb, pbErr := addInstanceProfileToPb(&request) - if pbErr != nil { - return pbErr - } - - var addResponsePb addResponsePb + var addResponse AddResponse path := "/api/2.0/instance-profiles/add" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &addResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &addResponse) return err } func (a *instanceProfilesImpl) Edit(ctx context.Context, request InstanceProfile) error { - - requestPb, pbErr := instanceProfileToPb(&request) - if pbErr != nil { - return pbErr - } - - var editResponsePb editResponsePb + var editResponse EditResponse path := "/api/2.0/instance-profiles/edit" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &editResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &editResponse) return err } @@ -1819,58 +780,23 @@ func (a *instanceProfilesImpl) ListAll(ctx context.Context) ([]InstanceProfile, } func (a *instanceProfilesImpl) internalList(ctx context.Context) (*ListInstanceProfilesResponse, error) { - - var listInstanceProfilesResponsePb listInstanceProfilesResponsePb + var listInstanceProfilesResponse ListInstanceProfilesResponse path := "/api/2.0/instance-profiles/list" headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - nil, - nil, - &listInstanceProfilesResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listInstanceProfilesResponseFromPb(&listInstanceProfilesResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, nil, nil, &listInstanceProfilesResponse) + return &listInstanceProfilesResponse, err } func (a *instanceProfilesImpl) Remove(ctx context.Context, request RemoveInstanceProfile) error { - - requestPb, pbErr := removeInstanceProfileToPb(&request) - if pbErr != nil { - return pbErr - } - - var removeResponsePb removeResponsePb + var removeResponse RemoveResponse path := "/api/2.0/instance-profiles/remove" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &removeResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &removeResponse) return err } @@ -1908,30 +834,13 @@ func (a *librariesImpl) AllClusterStatusesAll(ctx context.Context) ([]ClusterLib } func (a *librariesImpl) internalAllClusterStatuses(ctx context.Context) (*ListAllClusterLibraryStatusesResponse, error) { - - var listAllClusterLibraryStatusesResponsePb listAllClusterLibraryStatusesResponsePb + var listAllClusterLibraryStatusesResponse ListAllClusterLibraryStatusesResponse path := "/api/2.0/libraries/all-cluster-statuses" headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - nil, - nil, - &listAllClusterLibraryStatusesResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listAllClusterLibraryStatusesResponseFromPb(&listAllClusterLibraryStatusesResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, nil, nil, &listAllClusterLibraryStatusesResponse) + return &listAllClusterLibraryStatusesResponse, err } // Get the status of libraries on a cluster. A status is returned for all @@ -1972,92 +881,34 @@ func (a *librariesImpl) ClusterStatusAll(ctx context.Context, request ClusterSta } func (a *librariesImpl) internalClusterStatus(ctx context.Context, request ClusterStatus) (*ClusterLibraryStatuses, error) { - - requestPb, pbErr := clusterStatusToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var clusterLibraryStatusesPb clusterLibraryStatusesPb + var clusterLibraryStatuses ClusterLibraryStatuses path := "/api/2.0/libraries/cluster-status" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &clusterLibraryStatusesPb, - ) - if err != nil { - return nil, err - } - resp, err := clusterLibraryStatusesFromPb(&clusterLibraryStatusesPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &clusterLibraryStatuses) + return &clusterLibraryStatuses, err } func (a *librariesImpl) Install(ctx context.Context, request InstallLibraries) error { - - requestPb, pbErr := installLibrariesToPb(&request) - if pbErr != nil { - return pbErr - } - - var installLibrariesResponsePb installLibrariesResponsePb + var installLibrariesResponse InstallLibrariesResponse path := "/api/2.0/libraries/install" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &installLibrariesResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &installLibrariesResponse) return err } func (a *librariesImpl) Uninstall(ctx context.Context, request UninstallLibraries) error { - - requestPb, pbErr := uninstallLibrariesToPb(&request) - if pbErr != nil { - return pbErr - } - - var uninstallLibrariesResponsePb uninstallLibrariesResponsePb + var uninstallLibrariesResponse UninstallLibrariesResponse path := "/api/2.0/libraries/uninstall" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &uninstallLibrariesResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &uninstallLibrariesResponse) return err } @@ -2067,68 +918,24 @@ type policyComplianceForClustersImpl struct { } func (a *policyComplianceForClustersImpl) EnforceCompliance(ctx context.Context, request EnforceClusterComplianceRequest) (*EnforceClusterComplianceResponse, error) { - - requestPb, pbErr := enforceClusterComplianceRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var enforceClusterComplianceResponsePb enforceClusterComplianceResponsePb + var enforceClusterComplianceResponse EnforceClusterComplianceResponse path := "/api/2.0/policies/clusters/enforce-compliance" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &enforceClusterComplianceResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := enforceClusterComplianceResponseFromPb(&enforceClusterComplianceResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &enforceClusterComplianceResponse) + return &enforceClusterComplianceResponse, err } func (a *policyComplianceForClustersImpl) GetCompliance(ctx context.Context, request GetClusterComplianceRequest) (*GetClusterComplianceResponse, error) { - - requestPb, pbErr := getClusterComplianceRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var getClusterComplianceResponsePb getClusterComplianceResponsePb + var getClusterComplianceResponse GetClusterComplianceResponse path := "/api/2.0/policies/clusters/get-compliance" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &getClusterComplianceResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := getClusterComplianceResponseFromPb(&getClusterComplianceResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getClusterComplianceResponse) + return &getClusterComplianceResponse, err } // Returns the policy compliance status of all clusters that use a given policy. @@ -2167,35 +974,13 @@ func (a *policyComplianceForClustersImpl) ListComplianceAll(ctx context.Context, } func (a *policyComplianceForClustersImpl) internalListCompliance(ctx context.Context, request ListClusterCompliancesRequest) (*ListClusterCompliancesResponse, error) { - - requestPb, pbErr := listClusterCompliancesRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listClusterCompliancesResponsePb listClusterCompliancesResponsePb + var listClusterCompliancesResponse ListClusterCompliancesResponse path := "/api/2.0/policies/clusters/list-compliance" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listClusterCompliancesResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listClusterCompliancesResponseFromPb(&listClusterCompliancesResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listClusterCompliancesResponse) + return &listClusterCompliancesResponse, err } // unexported type that holds implementations of just PolicyFamilies API methods @@ -2204,35 +989,13 @@ type policyFamiliesImpl struct { } func (a *policyFamiliesImpl) Get(ctx context.Context, request GetPolicyFamilyRequest) (*PolicyFamily, error) { - - requestPb, pbErr := getPolicyFamilyRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var policyFamilyPb policyFamilyPb - path := fmt.Sprintf("/api/2.0/policy-families/%v", requestPb.PolicyFamilyId) + var policyFamily PolicyFamily + path := fmt.Sprintf("/api/2.0/policy-families/%v", request.PolicyFamilyId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &policyFamilyPb, - ) - if err != nil { - return nil, err - } - resp, err := policyFamilyFromPb(&policyFamilyPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &policyFamily) + return &policyFamily, err } // Returns the list of policy definition types available to use at their latest @@ -2269,33 +1032,11 @@ func (a *policyFamiliesImpl) ListAll(ctx context.Context, request ListPolicyFami } func (a *policyFamiliesImpl) internalList(ctx context.Context, request ListPolicyFamiliesRequest) (*ListPolicyFamiliesResponse, error) { - - requestPb, pbErr := listPolicyFamiliesRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listPolicyFamiliesResponsePb listPolicyFamiliesResponsePb + var listPolicyFamiliesResponse ListPolicyFamiliesResponse path := "/api/2.0/policy-families" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listPolicyFamiliesResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listPolicyFamiliesResponseFromPb(&listPolicyFamiliesResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listPolicyFamiliesResponse) + return &listPolicyFamiliesResponse, err } diff --git a/service/compute/internal.go b/service/compute/internal.go deleted file mode 100755 index 9032895f9..000000000 --- a/service/compute/internal.go +++ /dev/null @@ -1,7178 +0,0 @@ -// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. - -package compute - -import ( - "fmt" - "strings" - "time" - - "github.com/databricks/databricks-sdk-go/marshal" -) - -func addInstanceProfileToPb(st *AddInstanceProfile) (*addInstanceProfilePb, error) { - if st == nil { - return nil, nil - } - pb := &addInstanceProfilePb{} - pb.IamRoleArn = st.IamRoleArn - pb.InstanceProfileArn = st.InstanceProfileArn - pb.IsMetaInstanceProfile = st.IsMetaInstanceProfile - pb.SkipValidation = st.SkipValidation - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type addInstanceProfilePb struct { - IamRoleArn string `json:"iam_role_arn,omitempty"` - InstanceProfileArn string `json:"instance_profile_arn"` - IsMetaInstanceProfile bool `json:"is_meta_instance_profile,omitempty"` - SkipValidation bool `json:"skip_validation,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func addInstanceProfileFromPb(pb *addInstanceProfilePb) (*AddInstanceProfile, error) { - if pb == nil { - return nil, nil - } - st := &AddInstanceProfile{} - st.IamRoleArn = pb.IamRoleArn - st.InstanceProfileArn = pb.InstanceProfileArn - st.IsMetaInstanceProfile = pb.IsMetaInstanceProfile - st.SkipValidation = pb.SkipValidation - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *addInstanceProfilePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st addInstanceProfilePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func addResponseToPb(st *AddResponse) (*addResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &addResponsePb{} - - return pb, nil -} - -type addResponsePb struct { -} - -func addResponseFromPb(pb *addResponsePb) (*AddResponse, error) { - if pb == nil { - return nil, nil - } - st := &AddResponse{} - - return st, nil -} - -func adlsgen2InfoToPb(st *Adlsgen2Info) (*adlsgen2InfoPb, error) { - if st == nil { - return nil, nil - } - pb := &adlsgen2InfoPb{} - pb.Destination = st.Destination - - return pb, nil -} - -type adlsgen2InfoPb struct { - Destination string `json:"destination"` -} - -func adlsgen2InfoFromPb(pb *adlsgen2InfoPb) (*Adlsgen2Info, error) { - if pb == nil { - return nil, nil - } - st := &Adlsgen2Info{} - st.Destination = pb.Destination - - return st, nil -} - -func autoScaleToPb(st *AutoScale) (*autoScalePb, error) { - if st == nil { - return nil, nil - } - pb := &autoScalePb{} - pb.MaxWorkers = st.MaxWorkers - pb.MinWorkers = st.MinWorkers - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type autoScalePb struct { - MaxWorkers int `json:"max_workers,omitempty"` - MinWorkers int `json:"min_workers,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func autoScaleFromPb(pb *autoScalePb) (*AutoScale, error) { - if pb == nil { - return nil, nil - } - st := &AutoScale{} - st.MaxWorkers = pb.MaxWorkers - st.MinWorkers = pb.MinWorkers - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *autoScalePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st autoScalePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func awsAttributesToPb(st *AwsAttributes) (*awsAttributesPb, error) { - if st == nil { - return nil, nil - } - pb := &awsAttributesPb{} - pb.Availability = st.Availability - pb.EbsVolumeCount = st.EbsVolumeCount - pb.EbsVolumeIops = st.EbsVolumeIops - pb.EbsVolumeSize = st.EbsVolumeSize - pb.EbsVolumeThroughput = st.EbsVolumeThroughput - pb.EbsVolumeType = st.EbsVolumeType - pb.FirstOnDemand = st.FirstOnDemand - pb.InstanceProfileArn = st.InstanceProfileArn - pb.SpotBidPricePercent = st.SpotBidPricePercent - pb.ZoneId = st.ZoneId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type awsAttributesPb struct { - Availability AwsAvailability `json:"availability,omitempty"` - EbsVolumeCount int `json:"ebs_volume_count,omitempty"` - EbsVolumeIops int `json:"ebs_volume_iops,omitempty"` - EbsVolumeSize int `json:"ebs_volume_size,omitempty"` - EbsVolumeThroughput int `json:"ebs_volume_throughput,omitempty"` - EbsVolumeType EbsVolumeType `json:"ebs_volume_type,omitempty"` - FirstOnDemand int `json:"first_on_demand,omitempty"` - InstanceProfileArn string `json:"instance_profile_arn,omitempty"` - SpotBidPricePercent int `json:"spot_bid_price_percent,omitempty"` - ZoneId string `json:"zone_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func awsAttributesFromPb(pb *awsAttributesPb) (*AwsAttributes, error) { - if pb == nil { - return nil, nil - } - st := &AwsAttributes{} - st.Availability = pb.Availability - st.EbsVolumeCount = pb.EbsVolumeCount - st.EbsVolumeIops = pb.EbsVolumeIops - st.EbsVolumeSize = pb.EbsVolumeSize - st.EbsVolumeThroughput = pb.EbsVolumeThroughput - st.EbsVolumeType = pb.EbsVolumeType - st.FirstOnDemand = pb.FirstOnDemand - st.InstanceProfileArn = pb.InstanceProfileArn - st.SpotBidPricePercent = pb.SpotBidPricePercent - st.ZoneId = pb.ZoneId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *awsAttributesPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st awsAttributesPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func azureAttributesToPb(st *AzureAttributes) (*azureAttributesPb, error) { - if st == nil { - return nil, nil - } - pb := &azureAttributesPb{} - pb.Availability = st.Availability - pb.FirstOnDemand = st.FirstOnDemand - pb.LogAnalyticsInfo = st.LogAnalyticsInfo - pb.SpotBidMaxPrice = st.SpotBidMaxPrice - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type azureAttributesPb struct { - Availability AzureAvailability `json:"availability,omitempty"` - FirstOnDemand int `json:"first_on_demand,omitempty"` - LogAnalyticsInfo *LogAnalyticsInfo `json:"log_analytics_info,omitempty"` - SpotBidMaxPrice float64 `json:"spot_bid_max_price,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func azureAttributesFromPb(pb *azureAttributesPb) (*AzureAttributes, error) { - if pb == nil { - return nil, nil - } - st := &AzureAttributes{} - st.Availability = pb.Availability - st.FirstOnDemand = pb.FirstOnDemand - st.LogAnalyticsInfo = pb.LogAnalyticsInfo - st.SpotBidMaxPrice = pb.SpotBidMaxPrice - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *azureAttributesPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st azureAttributesPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func cancelCommandToPb(st *CancelCommand) (*cancelCommandPb, error) { - if st == nil { - return nil, nil - } - pb := &cancelCommandPb{} - pb.ClusterId = st.ClusterId - pb.CommandId = st.CommandId - pb.ContextId = st.ContextId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type cancelCommandPb struct { - ClusterId string `json:"clusterId,omitempty"` - CommandId string `json:"commandId,omitempty"` - ContextId string `json:"contextId,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func cancelCommandFromPb(pb *cancelCommandPb) (*CancelCommand, error) { - if pb == nil { - return nil, nil - } - st := &CancelCommand{} - st.ClusterId = pb.ClusterId - st.CommandId = pb.CommandId - st.ContextId = pb.ContextId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *cancelCommandPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st cancelCommandPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func cancelResponseToPb(st *CancelResponse) (*cancelResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &cancelResponsePb{} - - return pb, nil -} - -type cancelResponsePb struct { -} - -func cancelResponseFromPb(pb *cancelResponsePb) (*CancelResponse, error) { - if pb == nil { - return nil, nil - } - st := &CancelResponse{} - - return st, nil -} - -func changeClusterOwnerToPb(st *ChangeClusterOwner) (*changeClusterOwnerPb, error) { - if st == nil { - return nil, nil - } - pb := &changeClusterOwnerPb{} - pb.ClusterId = st.ClusterId - pb.OwnerUsername = st.OwnerUsername - - return pb, nil -} - -type changeClusterOwnerPb struct { - ClusterId string `json:"cluster_id"` - OwnerUsername string `json:"owner_username"` -} - -func changeClusterOwnerFromPb(pb *changeClusterOwnerPb) (*ChangeClusterOwner, error) { - if pb == nil { - return nil, nil - } - st := &ChangeClusterOwner{} - st.ClusterId = pb.ClusterId - st.OwnerUsername = pb.OwnerUsername - - return st, nil -} - -func changeClusterOwnerResponseToPb(st *ChangeClusterOwnerResponse) (*changeClusterOwnerResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &changeClusterOwnerResponsePb{} - - return pb, nil -} - -type changeClusterOwnerResponsePb struct { -} - -func changeClusterOwnerResponseFromPb(pb *changeClusterOwnerResponsePb) (*ChangeClusterOwnerResponse, error) { - if pb == nil { - return nil, nil - } - st := &ChangeClusterOwnerResponse{} - - return st, nil -} - -func clientsTypesToPb(st *ClientsTypes) (*clientsTypesPb, error) { - if st == nil { - return nil, nil - } - pb := &clientsTypesPb{} - pb.Jobs = st.Jobs - pb.Notebooks = st.Notebooks - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type clientsTypesPb struct { - Jobs bool `json:"jobs,omitempty"` - Notebooks bool `json:"notebooks,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func clientsTypesFromPb(pb *clientsTypesPb) (*ClientsTypes, error) { - if pb == nil { - return nil, nil - } - st := &ClientsTypes{} - st.Jobs = pb.Jobs - st.Notebooks = pb.Notebooks - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *clientsTypesPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st clientsTypesPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func cloneClusterToPb(st *CloneCluster) (*cloneClusterPb, error) { - if st == nil { - return nil, nil - } - pb := &cloneClusterPb{} - pb.SourceClusterId = st.SourceClusterId - - return pb, nil -} - -type cloneClusterPb struct { - SourceClusterId string `json:"source_cluster_id"` -} - -func cloneClusterFromPb(pb *cloneClusterPb) (*CloneCluster, error) { - if pb == nil { - return nil, nil - } - st := &CloneCluster{} - st.SourceClusterId = pb.SourceClusterId - - return st, nil -} - -func cloudProviderNodeInfoToPb(st *CloudProviderNodeInfo) (*cloudProviderNodeInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &cloudProviderNodeInfoPb{} - pb.Status = st.Status - - return pb, nil -} - -type cloudProviderNodeInfoPb struct { - Status []CloudProviderNodeStatus `json:"status,omitempty"` -} - -func cloudProviderNodeInfoFromPb(pb *cloudProviderNodeInfoPb) (*CloudProviderNodeInfo, error) { - if pb == nil { - return nil, nil - } - st := &CloudProviderNodeInfo{} - st.Status = pb.Status - - return st, nil -} - -func clusterAccessControlRequestToPb(st *ClusterAccessControlRequest) (*clusterAccessControlRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &clusterAccessControlRequestPb{} - pb.GroupName = st.GroupName - pb.PermissionLevel = st.PermissionLevel - pb.ServicePrincipalName = st.ServicePrincipalName - pb.UserName = st.UserName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type clusterAccessControlRequestPb struct { - GroupName string `json:"group_name,omitempty"` - PermissionLevel ClusterPermissionLevel `json:"permission_level,omitempty"` - ServicePrincipalName string `json:"service_principal_name,omitempty"` - UserName string `json:"user_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func clusterAccessControlRequestFromPb(pb *clusterAccessControlRequestPb) (*ClusterAccessControlRequest, error) { - if pb == nil { - return nil, nil - } - st := &ClusterAccessControlRequest{} - st.GroupName = pb.GroupName - st.PermissionLevel = pb.PermissionLevel - st.ServicePrincipalName = pb.ServicePrincipalName - st.UserName = pb.UserName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *clusterAccessControlRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st clusterAccessControlRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func clusterAccessControlResponseToPb(st *ClusterAccessControlResponse) (*clusterAccessControlResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &clusterAccessControlResponsePb{} - pb.AllPermissions = st.AllPermissions - pb.DisplayName = st.DisplayName - pb.GroupName = st.GroupName - pb.ServicePrincipalName = st.ServicePrincipalName - pb.UserName = st.UserName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type clusterAccessControlResponsePb struct { - AllPermissions []ClusterPermission `json:"all_permissions,omitempty"` - DisplayName string `json:"display_name,omitempty"` - GroupName string `json:"group_name,omitempty"` - ServicePrincipalName string `json:"service_principal_name,omitempty"` - UserName string `json:"user_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func clusterAccessControlResponseFromPb(pb *clusterAccessControlResponsePb) (*ClusterAccessControlResponse, error) { - if pb == nil { - return nil, nil - } - st := &ClusterAccessControlResponse{} - st.AllPermissions = pb.AllPermissions - st.DisplayName = pb.DisplayName - st.GroupName = pb.GroupName - st.ServicePrincipalName = pb.ServicePrincipalName - st.UserName = pb.UserName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *clusterAccessControlResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st clusterAccessControlResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func clusterAttributesToPb(st *ClusterAttributes) (*clusterAttributesPb, error) { - if st == nil { - return nil, nil - } - pb := &clusterAttributesPb{} - pb.AutoterminationMinutes = st.AutoterminationMinutes - pb.AwsAttributes = st.AwsAttributes - pb.AzureAttributes = st.AzureAttributes - pb.ClusterLogConf = st.ClusterLogConf - pb.ClusterName = st.ClusterName - pb.CustomTags = st.CustomTags - pb.DataSecurityMode = st.DataSecurityMode - pb.DockerImage = st.DockerImage - pb.DriverInstancePoolId = st.DriverInstancePoolId - pb.DriverNodeTypeId = st.DriverNodeTypeId - pb.EnableElasticDisk = st.EnableElasticDisk - pb.EnableLocalDiskEncryption = st.EnableLocalDiskEncryption - pb.GcpAttributes = st.GcpAttributes - pb.InitScripts = st.InitScripts - pb.InstancePoolId = st.InstancePoolId - pb.IsSingleNode = st.IsSingleNode - pb.Kind = st.Kind - pb.NodeTypeId = st.NodeTypeId - pb.PolicyId = st.PolicyId - pb.RemoteDiskThroughput = st.RemoteDiskThroughput - pb.RuntimeEngine = st.RuntimeEngine - pb.SingleUserName = st.SingleUserName - pb.SparkConf = st.SparkConf - pb.SparkEnvVars = st.SparkEnvVars - pb.SparkVersion = st.SparkVersion - pb.SshPublicKeys = st.SshPublicKeys - pb.TotalInitialRemoteDiskSize = st.TotalInitialRemoteDiskSize - pb.UseMlRuntime = st.UseMlRuntime - pb.WorkloadType = st.WorkloadType - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type clusterAttributesPb struct { - AutoterminationMinutes int `json:"autotermination_minutes,omitempty"` - AwsAttributes *AwsAttributes `json:"aws_attributes,omitempty"` - AzureAttributes *AzureAttributes `json:"azure_attributes,omitempty"` - ClusterLogConf *ClusterLogConf `json:"cluster_log_conf,omitempty"` - ClusterName string `json:"cluster_name,omitempty"` - CustomTags map[string]string `json:"custom_tags,omitempty"` - DataSecurityMode DataSecurityMode `json:"data_security_mode,omitempty"` - DockerImage *DockerImage `json:"docker_image,omitempty"` - DriverInstancePoolId string `json:"driver_instance_pool_id,omitempty"` - DriverNodeTypeId string `json:"driver_node_type_id,omitempty"` - EnableElasticDisk bool `json:"enable_elastic_disk,omitempty"` - EnableLocalDiskEncryption bool `json:"enable_local_disk_encryption,omitempty"` - GcpAttributes *GcpAttributes `json:"gcp_attributes,omitempty"` - InitScripts []InitScriptInfo `json:"init_scripts,omitempty"` - InstancePoolId string `json:"instance_pool_id,omitempty"` - IsSingleNode bool `json:"is_single_node,omitempty"` - Kind Kind `json:"kind,omitempty"` - NodeTypeId string `json:"node_type_id,omitempty"` - PolicyId string `json:"policy_id,omitempty"` - RemoteDiskThroughput int `json:"remote_disk_throughput,omitempty"` - RuntimeEngine RuntimeEngine `json:"runtime_engine,omitempty"` - SingleUserName string `json:"single_user_name,omitempty"` - SparkConf map[string]string `json:"spark_conf,omitempty"` - SparkEnvVars map[string]string `json:"spark_env_vars,omitempty"` - SparkVersion string `json:"spark_version"` - SshPublicKeys []string `json:"ssh_public_keys,omitempty"` - TotalInitialRemoteDiskSize int `json:"total_initial_remote_disk_size,omitempty"` - UseMlRuntime bool `json:"use_ml_runtime,omitempty"` - WorkloadType *WorkloadType `json:"workload_type,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func clusterAttributesFromPb(pb *clusterAttributesPb) (*ClusterAttributes, error) { - if pb == nil { - return nil, nil - } - st := &ClusterAttributes{} - st.AutoterminationMinutes = pb.AutoterminationMinutes - st.AwsAttributes = pb.AwsAttributes - st.AzureAttributes = pb.AzureAttributes - st.ClusterLogConf = pb.ClusterLogConf - st.ClusterName = pb.ClusterName - st.CustomTags = pb.CustomTags - st.DataSecurityMode = pb.DataSecurityMode - st.DockerImage = pb.DockerImage - st.DriverInstancePoolId = pb.DriverInstancePoolId - st.DriverNodeTypeId = pb.DriverNodeTypeId - st.EnableElasticDisk = pb.EnableElasticDisk - st.EnableLocalDiskEncryption = pb.EnableLocalDiskEncryption - st.GcpAttributes = pb.GcpAttributes - st.InitScripts = pb.InitScripts - st.InstancePoolId = pb.InstancePoolId - st.IsSingleNode = pb.IsSingleNode - st.Kind = pb.Kind - st.NodeTypeId = pb.NodeTypeId - st.PolicyId = pb.PolicyId - st.RemoteDiskThroughput = pb.RemoteDiskThroughput - st.RuntimeEngine = pb.RuntimeEngine - st.SingleUserName = pb.SingleUserName - st.SparkConf = pb.SparkConf - st.SparkEnvVars = pb.SparkEnvVars - st.SparkVersion = pb.SparkVersion - st.SshPublicKeys = pb.SshPublicKeys - st.TotalInitialRemoteDiskSize = pb.TotalInitialRemoteDiskSize - st.UseMlRuntime = pb.UseMlRuntime - st.WorkloadType = pb.WorkloadType - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *clusterAttributesPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st clusterAttributesPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func clusterComplianceToPb(st *ClusterCompliance) (*clusterCompliancePb, error) { - if st == nil { - return nil, nil - } - pb := &clusterCompliancePb{} - pb.ClusterId = st.ClusterId - pb.IsCompliant = st.IsCompliant - pb.Violations = st.Violations - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type clusterCompliancePb struct { - ClusterId string `json:"cluster_id"` - IsCompliant bool `json:"is_compliant,omitempty"` - Violations map[string]string `json:"violations,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func clusterComplianceFromPb(pb *clusterCompliancePb) (*ClusterCompliance, error) { - if pb == nil { - return nil, nil - } - st := &ClusterCompliance{} - st.ClusterId = pb.ClusterId - st.IsCompliant = pb.IsCompliant - st.Violations = pb.Violations - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *clusterCompliancePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st clusterCompliancePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func clusterDetailsToPb(st *ClusterDetails) (*clusterDetailsPb, error) { - if st == nil { - return nil, nil - } - pb := &clusterDetailsPb{} - pb.Autoscale = st.Autoscale - pb.AutoterminationMinutes = st.AutoterminationMinutes - pb.AwsAttributes = st.AwsAttributes - pb.AzureAttributes = st.AzureAttributes - pb.ClusterCores = st.ClusterCores - pb.ClusterId = st.ClusterId - pb.ClusterLogConf = st.ClusterLogConf - pb.ClusterLogStatus = st.ClusterLogStatus - pb.ClusterMemoryMb = st.ClusterMemoryMb - pb.ClusterName = st.ClusterName - pb.ClusterSource = st.ClusterSource - pb.CreatorUserName = st.CreatorUserName - pb.CustomTags = st.CustomTags - pb.DataSecurityMode = st.DataSecurityMode - pb.DefaultTags = st.DefaultTags - pb.DockerImage = st.DockerImage - pb.Driver = st.Driver - pb.DriverInstancePoolId = st.DriverInstancePoolId - pb.DriverNodeTypeId = st.DriverNodeTypeId - pb.EnableElasticDisk = st.EnableElasticDisk - pb.EnableLocalDiskEncryption = st.EnableLocalDiskEncryption - pb.Executors = st.Executors - pb.GcpAttributes = st.GcpAttributes - pb.InitScripts = st.InitScripts - pb.InstancePoolId = st.InstancePoolId - pb.IsSingleNode = st.IsSingleNode - pb.JdbcPort = st.JdbcPort - pb.Kind = st.Kind - pb.LastRestartedTime = st.LastRestartedTime - pb.LastStateLossTime = st.LastStateLossTime - pb.NodeTypeId = st.NodeTypeId - pb.NumWorkers = st.NumWorkers - pb.PolicyId = st.PolicyId - pb.RemoteDiskThroughput = st.RemoteDiskThroughput - pb.RuntimeEngine = st.RuntimeEngine - pb.SingleUserName = st.SingleUserName - pb.SparkConf = st.SparkConf - pb.SparkContextId = st.SparkContextId - pb.SparkEnvVars = st.SparkEnvVars - pb.SparkVersion = st.SparkVersion - pb.Spec = st.Spec - pb.SshPublicKeys = st.SshPublicKeys - pb.StartTime = st.StartTime - pb.State = st.State - pb.StateMessage = st.StateMessage - pb.TerminatedTime = st.TerminatedTime - pb.TerminationReason = st.TerminationReason - pb.TotalInitialRemoteDiskSize = st.TotalInitialRemoteDiskSize - pb.UseMlRuntime = st.UseMlRuntime - pb.WorkloadType = st.WorkloadType - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type clusterDetailsPb struct { - Autoscale *AutoScale `json:"autoscale,omitempty"` - AutoterminationMinutes int `json:"autotermination_minutes,omitempty"` - AwsAttributes *AwsAttributes `json:"aws_attributes,omitempty"` - AzureAttributes *AzureAttributes `json:"azure_attributes,omitempty"` - ClusterCores float64 `json:"cluster_cores,omitempty"` - ClusterId string `json:"cluster_id,omitempty"` - ClusterLogConf *ClusterLogConf `json:"cluster_log_conf,omitempty"` - ClusterLogStatus *LogSyncStatus `json:"cluster_log_status,omitempty"` - ClusterMemoryMb int64 `json:"cluster_memory_mb,omitempty"` - ClusterName string `json:"cluster_name,omitempty"` - ClusterSource ClusterSource `json:"cluster_source,omitempty"` - CreatorUserName string `json:"creator_user_name,omitempty"` - CustomTags map[string]string `json:"custom_tags,omitempty"` - DataSecurityMode DataSecurityMode `json:"data_security_mode,omitempty"` - DefaultTags map[string]string `json:"default_tags,omitempty"` - DockerImage *DockerImage `json:"docker_image,omitempty"` - Driver *SparkNode `json:"driver,omitempty"` - DriverInstancePoolId string `json:"driver_instance_pool_id,omitempty"` - DriverNodeTypeId string `json:"driver_node_type_id,omitempty"` - EnableElasticDisk bool `json:"enable_elastic_disk,omitempty"` - EnableLocalDiskEncryption bool `json:"enable_local_disk_encryption,omitempty"` - Executors []SparkNode `json:"executors,omitempty"` - GcpAttributes *GcpAttributes `json:"gcp_attributes,omitempty"` - InitScripts []InitScriptInfo `json:"init_scripts,omitempty"` - InstancePoolId string `json:"instance_pool_id,omitempty"` - IsSingleNode bool `json:"is_single_node,omitempty"` - JdbcPort int `json:"jdbc_port,omitempty"` - Kind Kind `json:"kind,omitempty"` - LastRestartedTime int64 `json:"last_restarted_time,omitempty"` - LastStateLossTime int64 `json:"last_state_loss_time,omitempty"` - NodeTypeId string `json:"node_type_id,omitempty"` - NumWorkers int `json:"num_workers,omitempty"` - PolicyId string `json:"policy_id,omitempty"` - RemoteDiskThroughput int `json:"remote_disk_throughput,omitempty"` - RuntimeEngine RuntimeEngine `json:"runtime_engine,omitempty"` - SingleUserName string `json:"single_user_name,omitempty"` - SparkConf map[string]string `json:"spark_conf,omitempty"` - SparkContextId int64 `json:"spark_context_id,omitempty"` - SparkEnvVars map[string]string `json:"spark_env_vars,omitempty"` - SparkVersion string `json:"spark_version,omitempty"` - Spec *ClusterSpec `json:"spec,omitempty"` - SshPublicKeys []string `json:"ssh_public_keys,omitempty"` - StartTime int64 `json:"start_time,omitempty"` - State State `json:"state,omitempty"` - StateMessage string `json:"state_message,omitempty"` - TerminatedTime int64 `json:"terminated_time,omitempty"` - TerminationReason *TerminationReason `json:"termination_reason,omitempty"` - TotalInitialRemoteDiskSize int `json:"total_initial_remote_disk_size,omitempty"` - UseMlRuntime bool `json:"use_ml_runtime,omitempty"` - WorkloadType *WorkloadType `json:"workload_type,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func clusterDetailsFromPb(pb *clusterDetailsPb) (*ClusterDetails, error) { - if pb == nil { - return nil, nil - } - st := &ClusterDetails{} - st.Autoscale = pb.Autoscale - st.AutoterminationMinutes = pb.AutoterminationMinutes - st.AwsAttributes = pb.AwsAttributes - st.AzureAttributes = pb.AzureAttributes - st.ClusterCores = pb.ClusterCores - st.ClusterId = pb.ClusterId - st.ClusterLogConf = pb.ClusterLogConf - st.ClusterLogStatus = pb.ClusterLogStatus - st.ClusterMemoryMb = pb.ClusterMemoryMb - st.ClusterName = pb.ClusterName - st.ClusterSource = pb.ClusterSource - st.CreatorUserName = pb.CreatorUserName - st.CustomTags = pb.CustomTags - st.DataSecurityMode = pb.DataSecurityMode - st.DefaultTags = pb.DefaultTags - st.DockerImage = pb.DockerImage - st.Driver = pb.Driver - st.DriverInstancePoolId = pb.DriverInstancePoolId - st.DriverNodeTypeId = pb.DriverNodeTypeId - st.EnableElasticDisk = pb.EnableElasticDisk - st.EnableLocalDiskEncryption = pb.EnableLocalDiskEncryption - st.Executors = pb.Executors - st.GcpAttributes = pb.GcpAttributes - st.InitScripts = pb.InitScripts - st.InstancePoolId = pb.InstancePoolId - st.IsSingleNode = pb.IsSingleNode - st.JdbcPort = pb.JdbcPort - st.Kind = pb.Kind - st.LastRestartedTime = pb.LastRestartedTime - st.LastStateLossTime = pb.LastStateLossTime - st.NodeTypeId = pb.NodeTypeId - st.NumWorkers = pb.NumWorkers - st.PolicyId = pb.PolicyId - st.RemoteDiskThroughput = pb.RemoteDiskThroughput - st.RuntimeEngine = pb.RuntimeEngine - st.SingleUserName = pb.SingleUserName - st.SparkConf = pb.SparkConf - st.SparkContextId = pb.SparkContextId - st.SparkEnvVars = pb.SparkEnvVars - st.SparkVersion = pb.SparkVersion - st.Spec = pb.Spec - st.SshPublicKeys = pb.SshPublicKeys - st.StartTime = pb.StartTime - st.State = pb.State - st.StateMessage = pb.StateMessage - st.TerminatedTime = pb.TerminatedTime - st.TerminationReason = pb.TerminationReason - st.TotalInitialRemoteDiskSize = pb.TotalInitialRemoteDiskSize - st.UseMlRuntime = pb.UseMlRuntime - st.WorkloadType = pb.WorkloadType - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *clusterDetailsPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st clusterDetailsPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func clusterEventToPb(st *ClusterEvent) (*clusterEventPb, error) { - if st == nil { - return nil, nil - } - pb := &clusterEventPb{} - pb.ClusterId = st.ClusterId - pb.DataPlaneEventDetails = st.DataPlaneEventDetails - pb.Details = st.Details - pb.Timestamp = st.Timestamp - pb.Type = st.Type - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type clusterEventPb struct { - ClusterId string `json:"cluster_id"` - DataPlaneEventDetails *DataPlaneEventDetails `json:"data_plane_event_details,omitempty"` - Details *EventDetails `json:"details,omitempty"` - Timestamp int64 `json:"timestamp,omitempty"` - Type EventType `json:"type,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func clusterEventFromPb(pb *clusterEventPb) (*ClusterEvent, error) { - if pb == nil { - return nil, nil - } - st := &ClusterEvent{} - st.ClusterId = pb.ClusterId - st.DataPlaneEventDetails = pb.DataPlaneEventDetails - st.Details = pb.Details - st.Timestamp = pb.Timestamp - st.Type = pb.Type - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *clusterEventPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st clusterEventPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func clusterLibraryStatusesToPb(st *ClusterLibraryStatuses) (*clusterLibraryStatusesPb, error) { - if st == nil { - return nil, nil - } - pb := &clusterLibraryStatusesPb{} - pb.ClusterId = st.ClusterId - pb.LibraryStatuses = st.LibraryStatuses - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type clusterLibraryStatusesPb struct { - ClusterId string `json:"cluster_id,omitempty"` - LibraryStatuses []LibraryFullStatus `json:"library_statuses,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func clusterLibraryStatusesFromPb(pb *clusterLibraryStatusesPb) (*ClusterLibraryStatuses, error) { - if pb == nil { - return nil, nil - } - st := &ClusterLibraryStatuses{} - st.ClusterId = pb.ClusterId - st.LibraryStatuses = pb.LibraryStatuses - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *clusterLibraryStatusesPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st clusterLibraryStatusesPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func clusterLogConfToPb(st *ClusterLogConf) (*clusterLogConfPb, error) { - if st == nil { - return nil, nil - } - pb := &clusterLogConfPb{} - pb.Dbfs = st.Dbfs - pb.S3 = st.S3 - pb.Volumes = st.Volumes - - return pb, nil -} - -type clusterLogConfPb struct { - Dbfs *DbfsStorageInfo `json:"dbfs,omitempty"` - S3 *S3StorageInfo `json:"s3,omitempty"` - Volumes *VolumesStorageInfo `json:"volumes,omitempty"` -} - -func clusterLogConfFromPb(pb *clusterLogConfPb) (*ClusterLogConf, error) { - if pb == nil { - return nil, nil - } - st := &ClusterLogConf{} - st.Dbfs = pb.Dbfs - st.S3 = pb.S3 - st.Volumes = pb.Volumes - - return st, nil -} - -func clusterPermissionToPb(st *ClusterPermission) (*clusterPermissionPb, error) { - if st == nil { - return nil, nil - } - pb := &clusterPermissionPb{} - pb.Inherited = st.Inherited - pb.InheritedFromObject = st.InheritedFromObject - pb.PermissionLevel = st.PermissionLevel - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type clusterPermissionPb struct { - Inherited bool `json:"inherited,omitempty"` - InheritedFromObject []string `json:"inherited_from_object,omitempty"` - PermissionLevel ClusterPermissionLevel `json:"permission_level,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func clusterPermissionFromPb(pb *clusterPermissionPb) (*ClusterPermission, error) { - if pb == nil { - return nil, nil - } - st := &ClusterPermission{} - st.Inherited = pb.Inherited - st.InheritedFromObject = pb.InheritedFromObject - st.PermissionLevel = pb.PermissionLevel - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *clusterPermissionPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st clusterPermissionPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func clusterPermissionsToPb(st *ClusterPermissions) (*clusterPermissionsPb, error) { - if st == nil { - return nil, nil - } - pb := &clusterPermissionsPb{} - pb.AccessControlList = st.AccessControlList - pb.ObjectId = st.ObjectId - pb.ObjectType = st.ObjectType - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type clusterPermissionsPb struct { - AccessControlList []ClusterAccessControlResponse `json:"access_control_list,omitempty"` - ObjectId string `json:"object_id,omitempty"` - ObjectType string `json:"object_type,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func clusterPermissionsFromPb(pb *clusterPermissionsPb) (*ClusterPermissions, error) { - if pb == nil { - return nil, nil - } - st := &ClusterPermissions{} - st.AccessControlList = pb.AccessControlList - st.ObjectId = pb.ObjectId - st.ObjectType = pb.ObjectType - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *clusterPermissionsPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st clusterPermissionsPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func clusterPermissionsDescriptionToPb(st *ClusterPermissionsDescription) (*clusterPermissionsDescriptionPb, error) { - if st == nil { - return nil, nil - } - pb := &clusterPermissionsDescriptionPb{} - pb.Description = st.Description - pb.PermissionLevel = st.PermissionLevel - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type clusterPermissionsDescriptionPb struct { - Description string `json:"description,omitempty"` - PermissionLevel ClusterPermissionLevel `json:"permission_level,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func clusterPermissionsDescriptionFromPb(pb *clusterPermissionsDescriptionPb) (*ClusterPermissionsDescription, error) { - if pb == nil { - return nil, nil - } - st := &ClusterPermissionsDescription{} - st.Description = pb.Description - st.PermissionLevel = pb.PermissionLevel - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *clusterPermissionsDescriptionPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st clusterPermissionsDescriptionPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func clusterPermissionsRequestToPb(st *ClusterPermissionsRequest) (*clusterPermissionsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &clusterPermissionsRequestPb{} - pb.AccessControlList = st.AccessControlList - pb.ClusterId = st.ClusterId - - return pb, nil -} - -type clusterPermissionsRequestPb struct { - AccessControlList []ClusterAccessControlRequest `json:"access_control_list,omitempty"` - ClusterId string `json:"-" url:"-"` -} - -func clusterPermissionsRequestFromPb(pb *clusterPermissionsRequestPb) (*ClusterPermissionsRequest, error) { - if pb == nil { - return nil, nil - } - st := &ClusterPermissionsRequest{} - st.AccessControlList = pb.AccessControlList - st.ClusterId = pb.ClusterId - - return st, nil -} - -func clusterPolicyAccessControlRequestToPb(st *ClusterPolicyAccessControlRequest) (*clusterPolicyAccessControlRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &clusterPolicyAccessControlRequestPb{} - pb.GroupName = st.GroupName - pb.PermissionLevel = st.PermissionLevel - pb.ServicePrincipalName = st.ServicePrincipalName - pb.UserName = st.UserName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type clusterPolicyAccessControlRequestPb struct { - GroupName string `json:"group_name,omitempty"` - PermissionLevel ClusterPolicyPermissionLevel `json:"permission_level,omitempty"` - ServicePrincipalName string `json:"service_principal_name,omitempty"` - UserName string `json:"user_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func clusterPolicyAccessControlRequestFromPb(pb *clusterPolicyAccessControlRequestPb) (*ClusterPolicyAccessControlRequest, error) { - if pb == nil { - return nil, nil - } - st := &ClusterPolicyAccessControlRequest{} - st.GroupName = pb.GroupName - st.PermissionLevel = pb.PermissionLevel - st.ServicePrincipalName = pb.ServicePrincipalName - st.UserName = pb.UserName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *clusterPolicyAccessControlRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st clusterPolicyAccessControlRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func clusterPolicyAccessControlResponseToPb(st *ClusterPolicyAccessControlResponse) (*clusterPolicyAccessControlResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &clusterPolicyAccessControlResponsePb{} - pb.AllPermissions = st.AllPermissions - pb.DisplayName = st.DisplayName - pb.GroupName = st.GroupName - pb.ServicePrincipalName = st.ServicePrincipalName - pb.UserName = st.UserName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type clusterPolicyAccessControlResponsePb struct { - AllPermissions []ClusterPolicyPermission `json:"all_permissions,omitempty"` - DisplayName string `json:"display_name,omitempty"` - GroupName string `json:"group_name,omitempty"` - ServicePrincipalName string `json:"service_principal_name,omitempty"` - UserName string `json:"user_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func clusterPolicyAccessControlResponseFromPb(pb *clusterPolicyAccessControlResponsePb) (*ClusterPolicyAccessControlResponse, error) { - if pb == nil { - return nil, nil - } - st := &ClusterPolicyAccessControlResponse{} - st.AllPermissions = pb.AllPermissions - st.DisplayName = pb.DisplayName - st.GroupName = pb.GroupName - st.ServicePrincipalName = pb.ServicePrincipalName - st.UserName = pb.UserName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *clusterPolicyAccessControlResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st clusterPolicyAccessControlResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func clusterPolicyPermissionToPb(st *ClusterPolicyPermission) (*clusterPolicyPermissionPb, error) { - if st == nil { - return nil, nil - } - pb := &clusterPolicyPermissionPb{} - pb.Inherited = st.Inherited - pb.InheritedFromObject = st.InheritedFromObject - pb.PermissionLevel = st.PermissionLevel - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type clusterPolicyPermissionPb struct { - Inherited bool `json:"inherited,omitempty"` - InheritedFromObject []string `json:"inherited_from_object,omitempty"` - PermissionLevel ClusterPolicyPermissionLevel `json:"permission_level,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func clusterPolicyPermissionFromPb(pb *clusterPolicyPermissionPb) (*ClusterPolicyPermission, error) { - if pb == nil { - return nil, nil - } - st := &ClusterPolicyPermission{} - st.Inherited = pb.Inherited - st.InheritedFromObject = pb.InheritedFromObject - st.PermissionLevel = pb.PermissionLevel - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *clusterPolicyPermissionPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st clusterPolicyPermissionPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func clusterPolicyPermissionsToPb(st *ClusterPolicyPermissions) (*clusterPolicyPermissionsPb, error) { - if st == nil { - return nil, nil - } - pb := &clusterPolicyPermissionsPb{} - pb.AccessControlList = st.AccessControlList - pb.ObjectId = st.ObjectId - pb.ObjectType = st.ObjectType - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type clusterPolicyPermissionsPb struct { - AccessControlList []ClusterPolicyAccessControlResponse `json:"access_control_list,omitempty"` - ObjectId string `json:"object_id,omitempty"` - ObjectType string `json:"object_type,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func clusterPolicyPermissionsFromPb(pb *clusterPolicyPermissionsPb) (*ClusterPolicyPermissions, error) { - if pb == nil { - return nil, nil - } - st := &ClusterPolicyPermissions{} - st.AccessControlList = pb.AccessControlList - st.ObjectId = pb.ObjectId - st.ObjectType = pb.ObjectType - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *clusterPolicyPermissionsPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st clusterPolicyPermissionsPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func clusterPolicyPermissionsDescriptionToPb(st *ClusterPolicyPermissionsDescription) (*clusterPolicyPermissionsDescriptionPb, error) { - if st == nil { - return nil, nil - } - pb := &clusterPolicyPermissionsDescriptionPb{} - pb.Description = st.Description - pb.PermissionLevel = st.PermissionLevel - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type clusterPolicyPermissionsDescriptionPb struct { - Description string `json:"description,omitempty"` - PermissionLevel ClusterPolicyPermissionLevel `json:"permission_level,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func clusterPolicyPermissionsDescriptionFromPb(pb *clusterPolicyPermissionsDescriptionPb) (*ClusterPolicyPermissionsDescription, error) { - if pb == nil { - return nil, nil - } - st := &ClusterPolicyPermissionsDescription{} - st.Description = pb.Description - st.PermissionLevel = pb.PermissionLevel - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *clusterPolicyPermissionsDescriptionPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st clusterPolicyPermissionsDescriptionPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func clusterPolicyPermissionsRequestToPb(st *ClusterPolicyPermissionsRequest) (*clusterPolicyPermissionsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &clusterPolicyPermissionsRequestPb{} - pb.AccessControlList = st.AccessControlList - pb.ClusterPolicyId = st.ClusterPolicyId - - return pb, nil -} - -type clusterPolicyPermissionsRequestPb struct { - AccessControlList []ClusterPolicyAccessControlRequest `json:"access_control_list,omitempty"` - ClusterPolicyId string `json:"-" url:"-"` -} - -func clusterPolicyPermissionsRequestFromPb(pb *clusterPolicyPermissionsRequestPb) (*ClusterPolicyPermissionsRequest, error) { - if pb == nil { - return nil, nil - } - st := &ClusterPolicyPermissionsRequest{} - st.AccessControlList = pb.AccessControlList - st.ClusterPolicyId = pb.ClusterPolicyId - - return st, nil -} - -func clusterSettingsChangeToPb(st *ClusterSettingsChange) (*clusterSettingsChangePb, error) { - if st == nil { - return nil, nil - } - pb := &clusterSettingsChangePb{} - pb.Field = st.Field - pb.NewValue = st.NewValue - pb.PreviousValue = st.PreviousValue - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type clusterSettingsChangePb struct { - Field string `json:"field,omitempty"` - NewValue string `json:"new_value,omitempty"` - PreviousValue string `json:"previous_value,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func clusterSettingsChangeFromPb(pb *clusterSettingsChangePb) (*ClusterSettingsChange, error) { - if pb == nil { - return nil, nil - } - st := &ClusterSettingsChange{} - st.Field = pb.Field - st.NewValue = pb.NewValue - st.PreviousValue = pb.PreviousValue - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *clusterSettingsChangePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st clusterSettingsChangePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func clusterSizeToPb(st *ClusterSize) (*clusterSizePb, error) { - if st == nil { - return nil, nil - } - pb := &clusterSizePb{} - pb.Autoscale = st.Autoscale - pb.NumWorkers = st.NumWorkers - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type clusterSizePb struct { - Autoscale *AutoScale `json:"autoscale,omitempty"` - NumWorkers int `json:"num_workers,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func clusterSizeFromPb(pb *clusterSizePb) (*ClusterSize, error) { - if pb == nil { - return nil, nil - } - st := &ClusterSize{} - st.Autoscale = pb.Autoscale - st.NumWorkers = pb.NumWorkers - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *clusterSizePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st clusterSizePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func clusterSpecToPb(st *ClusterSpec) (*clusterSpecPb, error) { - if st == nil { - return nil, nil - } - pb := &clusterSpecPb{} - pb.ApplyPolicyDefaultValues = st.ApplyPolicyDefaultValues - pb.Autoscale = st.Autoscale - pb.AutoterminationMinutes = st.AutoterminationMinutes - pb.AwsAttributes = st.AwsAttributes - pb.AzureAttributes = st.AzureAttributes - pb.ClusterLogConf = st.ClusterLogConf - pb.ClusterName = st.ClusterName - pb.CustomTags = st.CustomTags - pb.DataSecurityMode = st.DataSecurityMode - pb.DockerImage = st.DockerImage - pb.DriverInstancePoolId = st.DriverInstancePoolId - pb.DriverNodeTypeId = st.DriverNodeTypeId - pb.EnableElasticDisk = st.EnableElasticDisk - pb.EnableLocalDiskEncryption = st.EnableLocalDiskEncryption - pb.GcpAttributes = st.GcpAttributes - pb.InitScripts = st.InitScripts - pb.InstancePoolId = st.InstancePoolId - pb.IsSingleNode = st.IsSingleNode - pb.Kind = st.Kind - pb.NodeTypeId = st.NodeTypeId - pb.NumWorkers = st.NumWorkers - pb.PolicyId = st.PolicyId - pb.RemoteDiskThroughput = st.RemoteDiskThroughput - pb.RuntimeEngine = st.RuntimeEngine - pb.SingleUserName = st.SingleUserName - pb.SparkConf = st.SparkConf - pb.SparkEnvVars = st.SparkEnvVars - pb.SparkVersion = st.SparkVersion - pb.SshPublicKeys = st.SshPublicKeys - pb.TotalInitialRemoteDiskSize = st.TotalInitialRemoteDiskSize - pb.UseMlRuntime = st.UseMlRuntime - pb.WorkloadType = st.WorkloadType - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type clusterSpecPb struct { - ApplyPolicyDefaultValues bool `json:"apply_policy_default_values,omitempty"` - Autoscale *AutoScale `json:"autoscale,omitempty"` - AutoterminationMinutes int `json:"autotermination_minutes,omitempty"` - AwsAttributes *AwsAttributes `json:"aws_attributes,omitempty"` - AzureAttributes *AzureAttributes `json:"azure_attributes,omitempty"` - ClusterLogConf *ClusterLogConf `json:"cluster_log_conf,omitempty"` - ClusterName string `json:"cluster_name,omitempty"` - CustomTags map[string]string `json:"custom_tags,omitempty"` - DataSecurityMode DataSecurityMode `json:"data_security_mode,omitempty"` - DockerImage *DockerImage `json:"docker_image,omitempty"` - DriverInstancePoolId string `json:"driver_instance_pool_id,omitempty"` - DriverNodeTypeId string `json:"driver_node_type_id,omitempty"` - EnableElasticDisk bool `json:"enable_elastic_disk,omitempty"` - EnableLocalDiskEncryption bool `json:"enable_local_disk_encryption,omitempty"` - GcpAttributes *GcpAttributes `json:"gcp_attributes,omitempty"` - InitScripts []InitScriptInfo `json:"init_scripts,omitempty"` - InstancePoolId string `json:"instance_pool_id,omitempty"` - IsSingleNode bool `json:"is_single_node,omitempty"` - Kind Kind `json:"kind,omitempty"` - NodeTypeId string `json:"node_type_id,omitempty"` - NumWorkers int `json:"num_workers,omitempty"` - PolicyId string `json:"policy_id,omitempty"` - RemoteDiskThroughput int `json:"remote_disk_throughput,omitempty"` - RuntimeEngine RuntimeEngine `json:"runtime_engine,omitempty"` - SingleUserName string `json:"single_user_name,omitempty"` - SparkConf map[string]string `json:"spark_conf,omitempty"` - SparkEnvVars map[string]string `json:"spark_env_vars,omitempty"` - SparkVersion string `json:"spark_version,omitempty"` - SshPublicKeys []string `json:"ssh_public_keys,omitempty"` - TotalInitialRemoteDiskSize int `json:"total_initial_remote_disk_size,omitempty"` - UseMlRuntime bool `json:"use_ml_runtime,omitempty"` - WorkloadType *WorkloadType `json:"workload_type,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func clusterSpecFromPb(pb *clusterSpecPb) (*ClusterSpec, error) { - if pb == nil { - return nil, nil - } - st := &ClusterSpec{} - st.ApplyPolicyDefaultValues = pb.ApplyPolicyDefaultValues - st.Autoscale = pb.Autoscale - st.AutoterminationMinutes = pb.AutoterminationMinutes - st.AwsAttributes = pb.AwsAttributes - st.AzureAttributes = pb.AzureAttributes - st.ClusterLogConf = pb.ClusterLogConf - st.ClusterName = pb.ClusterName - st.CustomTags = pb.CustomTags - st.DataSecurityMode = pb.DataSecurityMode - st.DockerImage = pb.DockerImage - st.DriverInstancePoolId = pb.DriverInstancePoolId - st.DriverNodeTypeId = pb.DriverNodeTypeId - st.EnableElasticDisk = pb.EnableElasticDisk - st.EnableLocalDiskEncryption = pb.EnableLocalDiskEncryption - st.GcpAttributes = pb.GcpAttributes - st.InitScripts = pb.InitScripts - st.InstancePoolId = pb.InstancePoolId - st.IsSingleNode = pb.IsSingleNode - st.Kind = pb.Kind - st.NodeTypeId = pb.NodeTypeId - st.NumWorkers = pb.NumWorkers - st.PolicyId = pb.PolicyId - st.RemoteDiskThroughput = pb.RemoteDiskThroughput - st.RuntimeEngine = pb.RuntimeEngine - st.SingleUserName = pb.SingleUserName - st.SparkConf = pb.SparkConf - st.SparkEnvVars = pb.SparkEnvVars - st.SparkVersion = pb.SparkVersion - st.SshPublicKeys = pb.SshPublicKeys - st.TotalInitialRemoteDiskSize = pb.TotalInitialRemoteDiskSize - st.UseMlRuntime = pb.UseMlRuntime - st.WorkloadType = pb.WorkloadType - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *clusterSpecPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st clusterSpecPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func clusterStatusToPb(st *ClusterStatus) (*clusterStatusPb, error) { - if st == nil { - return nil, nil - } - pb := &clusterStatusPb{} - pb.ClusterId = st.ClusterId - - return pb, nil -} - -type clusterStatusPb struct { - ClusterId string `json:"-" url:"cluster_id"` -} - -func clusterStatusFromPb(pb *clusterStatusPb) (*ClusterStatus, error) { - if pb == nil { - return nil, nil - } - st := &ClusterStatus{} - st.ClusterId = pb.ClusterId - - return st, nil -} - -func commandToPb(st *Command) (*commandPb, error) { - if st == nil { - return nil, nil - } - pb := &commandPb{} - pb.ClusterId = st.ClusterId - pb.Command = st.Command - pb.ContextId = st.ContextId - pb.Language = st.Language - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type commandPb struct { - ClusterId string `json:"clusterId,omitempty"` - Command string `json:"command,omitempty"` - ContextId string `json:"contextId,omitempty"` - Language Language `json:"language,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func commandFromPb(pb *commandPb) (*Command, error) { - if pb == nil { - return nil, nil - } - st := &Command{} - st.ClusterId = pb.ClusterId - st.Command = pb.Command - st.ContextId = pb.ContextId - st.Language = pb.Language - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *commandPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st commandPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func commandStatusRequestToPb(st *CommandStatusRequest) (*commandStatusRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &commandStatusRequestPb{} - pb.ClusterId = st.ClusterId - pb.CommandId = st.CommandId - pb.ContextId = st.ContextId - - return pb, nil -} - -type commandStatusRequestPb struct { - ClusterId string `json:"-" url:"clusterId"` - CommandId string `json:"-" url:"commandId"` - ContextId string `json:"-" url:"contextId"` -} - -func commandStatusRequestFromPb(pb *commandStatusRequestPb) (*CommandStatusRequest, error) { - if pb == nil { - return nil, nil - } - st := &CommandStatusRequest{} - st.ClusterId = pb.ClusterId - st.CommandId = pb.CommandId - st.ContextId = pb.ContextId - - return st, nil -} - -func commandStatusResponseToPb(st *CommandStatusResponse) (*commandStatusResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &commandStatusResponsePb{} - pb.Id = st.Id - pb.Results = st.Results - pb.Status = st.Status - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type commandStatusResponsePb struct { - Id string `json:"id,omitempty"` - Results *Results `json:"results,omitempty"` - Status CommandStatus `json:"status,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func commandStatusResponseFromPb(pb *commandStatusResponsePb) (*CommandStatusResponse, error) { - if pb == nil { - return nil, nil - } - st := &CommandStatusResponse{} - st.Id = pb.Id - st.Results = pb.Results - st.Status = pb.Status - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *commandStatusResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st commandStatusResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func contextStatusRequestToPb(st *ContextStatusRequest) (*contextStatusRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &contextStatusRequestPb{} - pb.ClusterId = st.ClusterId - pb.ContextId = st.ContextId - - return pb, nil -} - -type contextStatusRequestPb struct { - ClusterId string `json:"-" url:"clusterId"` - ContextId string `json:"-" url:"contextId"` -} - -func contextStatusRequestFromPb(pb *contextStatusRequestPb) (*ContextStatusRequest, error) { - if pb == nil { - return nil, nil - } - st := &ContextStatusRequest{} - st.ClusterId = pb.ClusterId - st.ContextId = pb.ContextId - - return st, nil -} - -func contextStatusResponseToPb(st *ContextStatusResponse) (*contextStatusResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &contextStatusResponsePb{} - pb.Id = st.Id - pb.Status = st.Status - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type contextStatusResponsePb struct { - Id string `json:"id,omitempty"` - Status ContextStatus `json:"status,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func contextStatusResponseFromPb(pb *contextStatusResponsePb) (*ContextStatusResponse, error) { - if pb == nil { - return nil, nil - } - st := &ContextStatusResponse{} - st.Id = pb.Id - st.Status = pb.Status - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *contextStatusResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st contextStatusResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createClusterToPb(st *CreateCluster) (*createClusterPb, error) { - if st == nil { - return nil, nil - } - pb := &createClusterPb{} - pb.ApplyPolicyDefaultValues = st.ApplyPolicyDefaultValues - pb.Autoscale = st.Autoscale - pb.AutoterminationMinutes = st.AutoterminationMinutes - pb.AwsAttributes = st.AwsAttributes - pb.AzureAttributes = st.AzureAttributes - pb.CloneFrom = st.CloneFrom - pb.ClusterLogConf = st.ClusterLogConf - pb.ClusterName = st.ClusterName - pb.CustomTags = st.CustomTags - pb.DataSecurityMode = st.DataSecurityMode - pb.DockerImage = st.DockerImage - pb.DriverInstancePoolId = st.DriverInstancePoolId - pb.DriverNodeTypeId = st.DriverNodeTypeId - pb.EnableElasticDisk = st.EnableElasticDisk - pb.EnableLocalDiskEncryption = st.EnableLocalDiskEncryption - pb.GcpAttributes = st.GcpAttributes - pb.InitScripts = st.InitScripts - pb.InstancePoolId = st.InstancePoolId - pb.IsSingleNode = st.IsSingleNode - pb.Kind = st.Kind - pb.NodeTypeId = st.NodeTypeId - pb.NumWorkers = st.NumWorkers - pb.PolicyId = st.PolicyId - pb.RemoteDiskThroughput = st.RemoteDiskThroughput - pb.RuntimeEngine = st.RuntimeEngine - pb.SingleUserName = st.SingleUserName - pb.SparkConf = st.SparkConf - pb.SparkEnvVars = st.SparkEnvVars - pb.SparkVersion = st.SparkVersion - pb.SshPublicKeys = st.SshPublicKeys - pb.TotalInitialRemoteDiskSize = st.TotalInitialRemoteDiskSize - pb.UseMlRuntime = st.UseMlRuntime - pb.WorkloadType = st.WorkloadType - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createClusterPb struct { - ApplyPolicyDefaultValues bool `json:"apply_policy_default_values,omitempty"` - Autoscale *AutoScale `json:"autoscale,omitempty"` - AutoterminationMinutes int `json:"autotermination_minutes,omitempty"` - AwsAttributes *AwsAttributes `json:"aws_attributes,omitempty"` - AzureAttributes *AzureAttributes `json:"azure_attributes,omitempty"` - CloneFrom *CloneCluster `json:"clone_from,omitempty"` - ClusterLogConf *ClusterLogConf `json:"cluster_log_conf,omitempty"` - ClusterName string `json:"cluster_name,omitempty"` - CustomTags map[string]string `json:"custom_tags,omitempty"` - DataSecurityMode DataSecurityMode `json:"data_security_mode,omitempty"` - DockerImage *DockerImage `json:"docker_image,omitempty"` - DriverInstancePoolId string `json:"driver_instance_pool_id,omitempty"` - DriverNodeTypeId string `json:"driver_node_type_id,omitempty"` - EnableElasticDisk bool `json:"enable_elastic_disk,omitempty"` - EnableLocalDiskEncryption bool `json:"enable_local_disk_encryption,omitempty"` - GcpAttributes *GcpAttributes `json:"gcp_attributes,omitempty"` - InitScripts []InitScriptInfo `json:"init_scripts,omitempty"` - InstancePoolId string `json:"instance_pool_id,omitempty"` - IsSingleNode bool `json:"is_single_node,omitempty"` - Kind Kind `json:"kind,omitempty"` - NodeTypeId string `json:"node_type_id,omitempty"` - NumWorkers int `json:"num_workers,omitempty"` - PolicyId string `json:"policy_id,omitempty"` - RemoteDiskThroughput int `json:"remote_disk_throughput,omitempty"` - RuntimeEngine RuntimeEngine `json:"runtime_engine,omitempty"` - SingleUserName string `json:"single_user_name,omitempty"` - SparkConf map[string]string `json:"spark_conf,omitempty"` - SparkEnvVars map[string]string `json:"spark_env_vars,omitempty"` - SparkVersion string `json:"spark_version"` - SshPublicKeys []string `json:"ssh_public_keys,omitempty"` - TotalInitialRemoteDiskSize int `json:"total_initial_remote_disk_size,omitempty"` - UseMlRuntime bool `json:"use_ml_runtime,omitempty"` - WorkloadType *WorkloadType `json:"workload_type,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createClusterFromPb(pb *createClusterPb) (*CreateCluster, error) { - if pb == nil { - return nil, nil - } - st := &CreateCluster{} - st.ApplyPolicyDefaultValues = pb.ApplyPolicyDefaultValues - st.Autoscale = pb.Autoscale - st.AutoterminationMinutes = pb.AutoterminationMinutes - st.AwsAttributes = pb.AwsAttributes - st.AzureAttributes = pb.AzureAttributes - st.CloneFrom = pb.CloneFrom - st.ClusterLogConf = pb.ClusterLogConf - st.ClusterName = pb.ClusterName - st.CustomTags = pb.CustomTags - st.DataSecurityMode = pb.DataSecurityMode - st.DockerImage = pb.DockerImage - st.DriverInstancePoolId = pb.DriverInstancePoolId - st.DriverNodeTypeId = pb.DriverNodeTypeId - st.EnableElasticDisk = pb.EnableElasticDisk - st.EnableLocalDiskEncryption = pb.EnableLocalDiskEncryption - st.GcpAttributes = pb.GcpAttributes - st.InitScripts = pb.InitScripts - st.InstancePoolId = pb.InstancePoolId - st.IsSingleNode = pb.IsSingleNode - st.Kind = pb.Kind - st.NodeTypeId = pb.NodeTypeId - st.NumWorkers = pb.NumWorkers - st.PolicyId = pb.PolicyId - st.RemoteDiskThroughput = pb.RemoteDiskThroughput - st.RuntimeEngine = pb.RuntimeEngine - st.SingleUserName = pb.SingleUserName - st.SparkConf = pb.SparkConf - st.SparkEnvVars = pb.SparkEnvVars - st.SparkVersion = pb.SparkVersion - st.SshPublicKeys = pb.SshPublicKeys - st.TotalInitialRemoteDiskSize = pb.TotalInitialRemoteDiskSize - st.UseMlRuntime = pb.UseMlRuntime - st.WorkloadType = pb.WorkloadType - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createClusterPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createClusterPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createClusterResponseToPb(st *CreateClusterResponse) (*createClusterResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &createClusterResponsePb{} - pb.ClusterId = st.ClusterId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createClusterResponsePb struct { - ClusterId string `json:"cluster_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createClusterResponseFromPb(pb *createClusterResponsePb) (*CreateClusterResponse, error) { - if pb == nil { - return nil, nil - } - st := &CreateClusterResponse{} - st.ClusterId = pb.ClusterId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createClusterResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createClusterResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createContextToPb(st *CreateContext) (*createContextPb, error) { - if st == nil { - return nil, nil - } - pb := &createContextPb{} - pb.ClusterId = st.ClusterId - pb.Language = st.Language - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createContextPb struct { - ClusterId string `json:"clusterId,omitempty"` - Language Language `json:"language,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createContextFromPb(pb *createContextPb) (*CreateContext, error) { - if pb == nil { - return nil, nil - } - st := &CreateContext{} - st.ClusterId = pb.ClusterId - st.Language = pb.Language - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createContextPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createContextPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createInstancePoolToPb(st *CreateInstancePool) (*createInstancePoolPb, error) { - if st == nil { - return nil, nil - } - pb := &createInstancePoolPb{} - pb.AwsAttributes = st.AwsAttributes - pb.AzureAttributes = st.AzureAttributes - pb.CustomTags = st.CustomTags - pb.DiskSpec = st.DiskSpec - pb.EnableElasticDisk = st.EnableElasticDisk - pb.GcpAttributes = st.GcpAttributes - pb.IdleInstanceAutoterminationMinutes = st.IdleInstanceAutoterminationMinutes - pb.InstancePoolName = st.InstancePoolName - pb.MaxCapacity = st.MaxCapacity - pb.MinIdleInstances = st.MinIdleInstances - pb.NodeTypeId = st.NodeTypeId - pb.PreloadedDockerImages = st.PreloadedDockerImages - pb.PreloadedSparkVersions = st.PreloadedSparkVersions - pb.RemoteDiskThroughput = st.RemoteDiskThroughput - pb.TotalInitialRemoteDiskSize = st.TotalInitialRemoteDiskSize - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createInstancePoolPb struct { - AwsAttributes *InstancePoolAwsAttributes `json:"aws_attributes,omitempty"` - AzureAttributes *InstancePoolAzureAttributes `json:"azure_attributes,omitempty"` - CustomTags map[string]string `json:"custom_tags,omitempty"` - DiskSpec *DiskSpec `json:"disk_spec,omitempty"` - EnableElasticDisk bool `json:"enable_elastic_disk,omitempty"` - GcpAttributes *InstancePoolGcpAttributes `json:"gcp_attributes,omitempty"` - IdleInstanceAutoterminationMinutes int `json:"idle_instance_autotermination_minutes,omitempty"` - InstancePoolName string `json:"instance_pool_name"` - MaxCapacity int `json:"max_capacity,omitempty"` - MinIdleInstances int `json:"min_idle_instances,omitempty"` - NodeTypeId string `json:"node_type_id"` - PreloadedDockerImages []DockerImage `json:"preloaded_docker_images,omitempty"` - PreloadedSparkVersions []string `json:"preloaded_spark_versions,omitempty"` - RemoteDiskThroughput int `json:"remote_disk_throughput,omitempty"` - TotalInitialRemoteDiskSize int `json:"total_initial_remote_disk_size,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createInstancePoolFromPb(pb *createInstancePoolPb) (*CreateInstancePool, error) { - if pb == nil { - return nil, nil - } - st := &CreateInstancePool{} - st.AwsAttributes = pb.AwsAttributes - st.AzureAttributes = pb.AzureAttributes - st.CustomTags = pb.CustomTags - st.DiskSpec = pb.DiskSpec - st.EnableElasticDisk = pb.EnableElasticDisk - st.GcpAttributes = pb.GcpAttributes - st.IdleInstanceAutoterminationMinutes = pb.IdleInstanceAutoterminationMinutes - st.InstancePoolName = pb.InstancePoolName - st.MaxCapacity = pb.MaxCapacity - st.MinIdleInstances = pb.MinIdleInstances - st.NodeTypeId = pb.NodeTypeId - st.PreloadedDockerImages = pb.PreloadedDockerImages - st.PreloadedSparkVersions = pb.PreloadedSparkVersions - st.RemoteDiskThroughput = pb.RemoteDiskThroughput - st.TotalInitialRemoteDiskSize = pb.TotalInitialRemoteDiskSize - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createInstancePoolPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createInstancePoolPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createInstancePoolResponseToPb(st *CreateInstancePoolResponse) (*createInstancePoolResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &createInstancePoolResponsePb{} - pb.InstancePoolId = st.InstancePoolId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createInstancePoolResponsePb struct { - InstancePoolId string `json:"instance_pool_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createInstancePoolResponseFromPb(pb *createInstancePoolResponsePb) (*CreateInstancePoolResponse, error) { - if pb == nil { - return nil, nil - } - st := &CreateInstancePoolResponse{} - st.InstancePoolId = pb.InstancePoolId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createInstancePoolResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createInstancePoolResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createPolicyToPb(st *CreatePolicy) (*createPolicyPb, error) { - if st == nil { - return nil, nil - } - pb := &createPolicyPb{} - pb.Definition = st.Definition - pb.Description = st.Description - pb.Libraries = st.Libraries - pb.MaxClustersPerUser = st.MaxClustersPerUser - pb.Name = st.Name - pb.PolicyFamilyDefinitionOverrides = st.PolicyFamilyDefinitionOverrides - pb.PolicyFamilyId = st.PolicyFamilyId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createPolicyPb struct { - Definition string `json:"definition,omitempty"` - Description string `json:"description,omitempty"` - Libraries []Library `json:"libraries,omitempty"` - MaxClustersPerUser int64 `json:"max_clusters_per_user,omitempty"` - Name string `json:"name,omitempty"` - PolicyFamilyDefinitionOverrides string `json:"policy_family_definition_overrides,omitempty"` - PolicyFamilyId string `json:"policy_family_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createPolicyFromPb(pb *createPolicyPb) (*CreatePolicy, error) { - if pb == nil { - return nil, nil - } - st := &CreatePolicy{} - st.Definition = pb.Definition - st.Description = pb.Description - st.Libraries = pb.Libraries - st.MaxClustersPerUser = pb.MaxClustersPerUser - st.Name = pb.Name - st.PolicyFamilyDefinitionOverrides = pb.PolicyFamilyDefinitionOverrides - st.PolicyFamilyId = pb.PolicyFamilyId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createPolicyPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createPolicyPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createPolicyResponseToPb(st *CreatePolicyResponse) (*createPolicyResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &createPolicyResponsePb{} - pb.PolicyId = st.PolicyId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createPolicyResponsePb struct { - PolicyId string `json:"policy_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createPolicyResponseFromPb(pb *createPolicyResponsePb) (*CreatePolicyResponse, error) { - if pb == nil { - return nil, nil - } - st := &CreatePolicyResponse{} - st.PolicyId = pb.PolicyId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createPolicyResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createPolicyResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createResponseToPb(st *CreateResponse) (*createResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &createResponsePb{} - pb.ScriptId = st.ScriptId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createResponsePb struct { - ScriptId string `json:"script_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createResponseFromPb(pb *createResponsePb) (*CreateResponse, error) { - if pb == nil { - return nil, nil - } - st := &CreateResponse{} - st.ScriptId = pb.ScriptId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createdToPb(st *Created) (*createdPb, error) { - if st == nil { - return nil, nil - } - pb := &createdPb{} - pb.Id = st.Id - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createdPb struct { - Id string `json:"id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createdFromPb(pb *createdPb) (*Created, error) { - if pb == nil { - return nil, nil - } - st := &Created{} - st.Id = pb.Id - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createdPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createdPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func customPolicyTagToPb(st *CustomPolicyTag) (*customPolicyTagPb, error) { - if st == nil { - return nil, nil - } - pb := &customPolicyTagPb{} - pb.Key = st.Key - pb.Value = st.Value - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type customPolicyTagPb struct { - Key string `json:"key"` - Value string `json:"value,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func customPolicyTagFromPb(pb *customPolicyTagPb) (*CustomPolicyTag, error) { - if pb == nil { - return nil, nil - } - st := &CustomPolicyTag{} - st.Key = pb.Key - st.Value = pb.Value - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *customPolicyTagPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st customPolicyTagPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func dataPlaneEventDetailsToPb(st *DataPlaneEventDetails) (*dataPlaneEventDetailsPb, error) { - if st == nil { - return nil, nil - } - pb := &dataPlaneEventDetailsPb{} - pb.EventType = st.EventType - pb.ExecutorFailures = st.ExecutorFailures - pb.HostId = st.HostId - pb.Timestamp = st.Timestamp - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type dataPlaneEventDetailsPb struct { - EventType DataPlaneEventDetailsEventType `json:"event_type,omitempty"` - ExecutorFailures int `json:"executor_failures,omitempty"` - HostId string `json:"host_id,omitempty"` - Timestamp int64 `json:"timestamp,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func dataPlaneEventDetailsFromPb(pb *dataPlaneEventDetailsPb) (*DataPlaneEventDetails, error) { - if pb == nil { - return nil, nil - } - st := &DataPlaneEventDetails{} - st.EventType = pb.EventType - st.ExecutorFailures = pb.ExecutorFailures - st.HostId = pb.HostId - st.Timestamp = pb.Timestamp - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *dataPlaneEventDetailsPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st dataPlaneEventDetailsPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func dbfsStorageInfoToPb(st *DbfsStorageInfo) (*dbfsStorageInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &dbfsStorageInfoPb{} - pb.Destination = st.Destination - - return pb, nil -} - -type dbfsStorageInfoPb struct { - Destination string `json:"destination"` -} - -func dbfsStorageInfoFromPb(pb *dbfsStorageInfoPb) (*DbfsStorageInfo, error) { - if pb == nil { - return nil, nil - } - st := &DbfsStorageInfo{} - st.Destination = pb.Destination - - return st, nil -} - -func deleteClusterToPb(st *DeleteCluster) (*deleteClusterPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteClusterPb{} - pb.ClusterId = st.ClusterId - - return pb, nil -} - -type deleteClusterPb struct { - ClusterId string `json:"cluster_id"` -} - -func deleteClusterFromPb(pb *deleteClusterPb) (*DeleteCluster, error) { - if pb == nil { - return nil, nil - } - st := &DeleteCluster{} - st.ClusterId = pb.ClusterId - - return st, nil -} - -func deleteClusterResponseToPb(st *DeleteClusterResponse) (*deleteClusterResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteClusterResponsePb{} - - return pb, nil -} - -type deleteClusterResponsePb struct { -} - -func deleteClusterResponseFromPb(pb *deleteClusterResponsePb) (*DeleteClusterResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteClusterResponse{} - - return st, nil -} - -func deleteGlobalInitScriptRequestToPb(st *DeleteGlobalInitScriptRequest) (*deleteGlobalInitScriptRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteGlobalInitScriptRequestPb{} - pb.ScriptId = st.ScriptId - - return pb, nil -} - -type deleteGlobalInitScriptRequestPb struct { - ScriptId string `json:"-" url:"-"` -} - -func deleteGlobalInitScriptRequestFromPb(pb *deleteGlobalInitScriptRequestPb) (*DeleteGlobalInitScriptRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteGlobalInitScriptRequest{} - st.ScriptId = pb.ScriptId - - return st, nil -} - -func deleteInstancePoolToPb(st *DeleteInstancePool) (*deleteInstancePoolPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteInstancePoolPb{} - pb.InstancePoolId = st.InstancePoolId - - return pb, nil -} - -type deleteInstancePoolPb struct { - InstancePoolId string `json:"instance_pool_id"` -} - -func deleteInstancePoolFromPb(pb *deleteInstancePoolPb) (*DeleteInstancePool, error) { - if pb == nil { - return nil, nil - } - st := &DeleteInstancePool{} - st.InstancePoolId = pb.InstancePoolId - - return st, nil -} - -func deleteInstancePoolResponseToPb(st *DeleteInstancePoolResponse) (*deleteInstancePoolResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteInstancePoolResponsePb{} - - return pb, nil -} - -type deleteInstancePoolResponsePb struct { -} - -func deleteInstancePoolResponseFromPb(pb *deleteInstancePoolResponsePb) (*DeleteInstancePoolResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteInstancePoolResponse{} - - return st, nil -} - -func deletePolicyToPb(st *DeletePolicy) (*deletePolicyPb, error) { - if st == nil { - return nil, nil - } - pb := &deletePolicyPb{} - pb.PolicyId = st.PolicyId - - return pb, nil -} - -type deletePolicyPb struct { - PolicyId string `json:"policy_id"` -} - -func deletePolicyFromPb(pb *deletePolicyPb) (*DeletePolicy, error) { - if pb == nil { - return nil, nil - } - st := &DeletePolicy{} - st.PolicyId = pb.PolicyId - - return st, nil -} - -func deletePolicyResponseToPb(st *DeletePolicyResponse) (*deletePolicyResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deletePolicyResponsePb{} - - return pb, nil -} - -type deletePolicyResponsePb struct { -} - -func deletePolicyResponseFromPb(pb *deletePolicyResponsePb) (*DeletePolicyResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeletePolicyResponse{} - - return st, nil -} - -func deleteResponseToPb(st *DeleteResponse) (*deleteResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteResponsePb{} - - return pb, nil -} - -type deleteResponsePb struct { -} - -func deleteResponseFromPb(pb *deleteResponsePb) (*DeleteResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteResponse{} - - return st, nil -} - -func destroyContextToPb(st *DestroyContext) (*destroyContextPb, error) { - if st == nil { - return nil, nil - } - pb := &destroyContextPb{} - pb.ClusterId = st.ClusterId - pb.ContextId = st.ContextId - - return pb, nil -} - -type destroyContextPb struct { - ClusterId string `json:"clusterId"` - ContextId string `json:"contextId"` -} - -func destroyContextFromPb(pb *destroyContextPb) (*DestroyContext, error) { - if pb == nil { - return nil, nil - } - st := &DestroyContext{} - st.ClusterId = pb.ClusterId - st.ContextId = pb.ContextId - - return st, nil -} - -func destroyResponseToPb(st *DestroyResponse) (*destroyResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &destroyResponsePb{} - - return pb, nil -} - -type destroyResponsePb struct { -} - -func destroyResponseFromPb(pb *destroyResponsePb) (*DestroyResponse, error) { - if pb == nil { - return nil, nil - } - st := &DestroyResponse{} - - return st, nil -} - -func diskSpecToPb(st *DiskSpec) (*diskSpecPb, error) { - if st == nil { - return nil, nil - } - pb := &diskSpecPb{} - pb.DiskCount = st.DiskCount - pb.DiskIops = st.DiskIops - pb.DiskSize = st.DiskSize - pb.DiskThroughput = st.DiskThroughput - pb.DiskType = st.DiskType - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type diskSpecPb struct { - DiskCount int `json:"disk_count,omitempty"` - DiskIops int `json:"disk_iops,omitempty"` - DiskSize int `json:"disk_size,omitempty"` - DiskThroughput int `json:"disk_throughput,omitempty"` - DiskType *DiskType `json:"disk_type,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func diskSpecFromPb(pb *diskSpecPb) (*DiskSpec, error) { - if pb == nil { - return nil, nil - } - st := &DiskSpec{} - st.DiskCount = pb.DiskCount - st.DiskIops = pb.DiskIops - st.DiskSize = pb.DiskSize - st.DiskThroughput = pb.DiskThroughput - st.DiskType = pb.DiskType - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *diskSpecPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st diskSpecPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func diskTypeToPb(st *DiskType) (*diskTypePb, error) { - if st == nil { - return nil, nil - } - pb := &diskTypePb{} - pb.AzureDiskVolumeType = st.AzureDiskVolumeType - pb.EbsVolumeType = st.EbsVolumeType - - return pb, nil -} - -type diskTypePb struct { - AzureDiskVolumeType DiskTypeAzureDiskVolumeType `json:"azure_disk_volume_type,omitempty"` - EbsVolumeType DiskTypeEbsVolumeType `json:"ebs_volume_type,omitempty"` -} - -func diskTypeFromPb(pb *diskTypePb) (*DiskType, error) { - if pb == nil { - return nil, nil - } - st := &DiskType{} - st.AzureDiskVolumeType = pb.AzureDiskVolumeType - st.EbsVolumeType = pb.EbsVolumeType - - return st, nil -} - -func dockerBasicAuthToPb(st *DockerBasicAuth) (*dockerBasicAuthPb, error) { - if st == nil { - return nil, nil - } - pb := &dockerBasicAuthPb{} - pb.Password = st.Password - pb.Username = st.Username - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type dockerBasicAuthPb struct { - Password string `json:"password,omitempty"` - Username string `json:"username,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func dockerBasicAuthFromPb(pb *dockerBasicAuthPb) (*DockerBasicAuth, error) { - if pb == nil { - return nil, nil - } - st := &DockerBasicAuth{} - st.Password = pb.Password - st.Username = pb.Username - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *dockerBasicAuthPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st dockerBasicAuthPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func dockerImageToPb(st *DockerImage) (*dockerImagePb, error) { - if st == nil { - return nil, nil - } - pb := &dockerImagePb{} - pb.BasicAuth = st.BasicAuth - pb.Url = st.Url - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type dockerImagePb struct { - BasicAuth *DockerBasicAuth `json:"basic_auth,omitempty"` - Url string `json:"url,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func dockerImageFromPb(pb *dockerImagePb) (*DockerImage, error) { - if pb == nil { - return nil, nil - } - st := &DockerImage{} - st.BasicAuth = pb.BasicAuth - st.Url = pb.Url - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *dockerImagePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st dockerImagePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func editClusterToPb(st *EditCluster) (*editClusterPb, error) { - if st == nil { - return nil, nil - } - pb := &editClusterPb{} - pb.ApplyPolicyDefaultValues = st.ApplyPolicyDefaultValues - pb.Autoscale = st.Autoscale - pb.AutoterminationMinutes = st.AutoterminationMinutes - pb.AwsAttributes = st.AwsAttributes - pb.AzureAttributes = st.AzureAttributes - pb.ClusterId = st.ClusterId - pb.ClusterLogConf = st.ClusterLogConf - pb.ClusterName = st.ClusterName - pb.CustomTags = st.CustomTags - pb.DataSecurityMode = st.DataSecurityMode - pb.DockerImage = st.DockerImage - pb.DriverInstancePoolId = st.DriverInstancePoolId - pb.DriverNodeTypeId = st.DriverNodeTypeId - pb.EnableElasticDisk = st.EnableElasticDisk - pb.EnableLocalDiskEncryption = st.EnableLocalDiskEncryption - pb.GcpAttributes = st.GcpAttributes - pb.InitScripts = st.InitScripts - pb.InstancePoolId = st.InstancePoolId - pb.IsSingleNode = st.IsSingleNode - pb.Kind = st.Kind - pb.NodeTypeId = st.NodeTypeId - pb.NumWorkers = st.NumWorkers - pb.PolicyId = st.PolicyId - pb.RemoteDiskThroughput = st.RemoteDiskThroughput - pb.RuntimeEngine = st.RuntimeEngine - pb.SingleUserName = st.SingleUserName - pb.SparkConf = st.SparkConf - pb.SparkEnvVars = st.SparkEnvVars - pb.SparkVersion = st.SparkVersion - pb.SshPublicKeys = st.SshPublicKeys - pb.TotalInitialRemoteDiskSize = st.TotalInitialRemoteDiskSize - pb.UseMlRuntime = st.UseMlRuntime - pb.WorkloadType = st.WorkloadType - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type editClusterPb struct { - ApplyPolicyDefaultValues bool `json:"apply_policy_default_values,omitempty"` - Autoscale *AutoScale `json:"autoscale,omitempty"` - AutoterminationMinutes int `json:"autotermination_minutes,omitempty"` - AwsAttributes *AwsAttributes `json:"aws_attributes,omitempty"` - AzureAttributes *AzureAttributes `json:"azure_attributes,omitempty"` - ClusterId string `json:"cluster_id"` - ClusterLogConf *ClusterLogConf `json:"cluster_log_conf,omitempty"` - ClusterName string `json:"cluster_name,omitempty"` - CustomTags map[string]string `json:"custom_tags,omitempty"` - DataSecurityMode DataSecurityMode `json:"data_security_mode,omitempty"` - DockerImage *DockerImage `json:"docker_image,omitempty"` - DriverInstancePoolId string `json:"driver_instance_pool_id,omitempty"` - DriverNodeTypeId string `json:"driver_node_type_id,omitempty"` - EnableElasticDisk bool `json:"enable_elastic_disk,omitempty"` - EnableLocalDiskEncryption bool `json:"enable_local_disk_encryption,omitempty"` - GcpAttributes *GcpAttributes `json:"gcp_attributes,omitempty"` - InitScripts []InitScriptInfo `json:"init_scripts,omitempty"` - InstancePoolId string `json:"instance_pool_id,omitempty"` - IsSingleNode bool `json:"is_single_node,omitempty"` - Kind Kind `json:"kind,omitempty"` - NodeTypeId string `json:"node_type_id,omitempty"` - NumWorkers int `json:"num_workers,omitempty"` - PolicyId string `json:"policy_id,omitempty"` - RemoteDiskThroughput int `json:"remote_disk_throughput,omitempty"` - RuntimeEngine RuntimeEngine `json:"runtime_engine,omitempty"` - SingleUserName string `json:"single_user_name,omitempty"` - SparkConf map[string]string `json:"spark_conf,omitempty"` - SparkEnvVars map[string]string `json:"spark_env_vars,omitempty"` - SparkVersion string `json:"spark_version"` - SshPublicKeys []string `json:"ssh_public_keys,omitempty"` - TotalInitialRemoteDiskSize int `json:"total_initial_remote_disk_size,omitempty"` - UseMlRuntime bool `json:"use_ml_runtime,omitempty"` - WorkloadType *WorkloadType `json:"workload_type,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func editClusterFromPb(pb *editClusterPb) (*EditCluster, error) { - if pb == nil { - return nil, nil - } - st := &EditCluster{} - st.ApplyPolicyDefaultValues = pb.ApplyPolicyDefaultValues - st.Autoscale = pb.Autoscale - st.AutoterminationMinutes = pb.AutoterminationMinutes - st.AwsAttributes = pb.AwsAttributes - st.AzureAttributes = pb.AzureAttributes - st.ClusterId = pb.ClusterId - st.ClusterLogConf = pb.ClusterLogConf - st.ClusterName = pb.ClusterName - st.CustomTags = pb.CustomTags - st.DataSecurityMode = pb.DataSecurityMode - st.DockerImage = pb.DockerImage - st.DriverInstancePoolId = pb.DriverInstancePoolId - st.DriverNodeTypeId = pb.DriverNodeTypeId - st.EnableElasticDisk = pb.EnableElasticDisk - st.EnableLocalDiskEncryption = pb.EnableLocalDiskEncryption - st.GcpAttributes = pb.GcpAttributes - st.InitScripts = pb.InitScripts - st.InstancePoolId = pb.InstancePoolId - st.IsSingleNode = pb.IsSingleNode - st.Kind = pb.Kind - st.NodeTypeId = pb.NodeTypeId - st.NumWorkers = pb.NumWorkers - st.PolicyId = pb.PolicyId - st.RemoteDiskThroughput = pb.RemoteDiskThroughput - st.RuntimeEngine = pb.RuntimeEngine - st.SingleUserName = pb.SingleUserName - st.SparkConf = pb.SparkConf - st.SparkEnvVars = pb.SparkEnvVars - st.SparkVersion = pb.SparkVersion - st.SshPublicKeys = pb.SshPublicKeys - st.TotalInitialRemoteDiskSize = pb.TotalInitialRemoteDiskSize - st.UseMlRuntime = pb.UseMlRuntime - st.WorkloadType = pb.WorkloadType - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *editClusterPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st editClusterPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func editClusterResponseToPb(st *EditClusterResponse) (*editClusterResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &editClusterResponsePb{} - - return pb, nil -} - -type editClusterResponsePb struct { -} - -func editClusterResponseFromPb(pb *editClusterResponsePb) (*EditClusterResponse, error) { - if pb == nil { - return nil, nil - } - st := &EditClusterResponse{} - - return st, nil -} - -func editInstancePoolToPb(st *EditInstancePool) (*editInstancePoolPb, error) { - if st == nil { - return nil, nil - } - pb := &editInstancePoolPb{} - pb.CustomTags = st.CustomTags - pb.IdleInstanceAutoterminationMinutes = st.IdleInstanceAutoterminationMinutes - pb.InstancePoolId = st.InstancePoolId - pb.InstancePoolName = st.InstancePoolName - pb.MaxCapacity = st.MaxCapacity - pb.MinIdleInstances = st.MinIdleInstances - pb.NodeTypeId = st.NodeTypeId - pb.RemoteDiskThroughput = st.RemoteDiskThroughput - pb.TotalInitialRemoteDiskSize = st.TotalInitialRemoteDiskSize - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type editInstancePoolPb struct { - CustomTags map[string]string `json:"custom_tags,omitempty"` - IdleInstanceAutoterminationMinutes int `json:"idle_instance_autotermination_minutes,omitempty"` - InstancePoolId string `json:"instance_pool_id"` - InstancePoolName string `json:"instance_pool_name"` - MaxCapacity int `json:"max_capacity,omitempty"` - MinIdleInstances int `json:"min_idle_instances,omitempty"` - NodeTypeId string `json:"node_type_id"` - RemoteDiskThroughput int `json:"remote_disk_throughput,omitempty"` - TotalInitialRemoteDiskSize int `json:"total_initial_remote_disk_size,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func editInstancePoolFromPb(pb *editInstancePoolPb) (*EditInstancePool, error) { - if pb == nil { - return nil, nil - } - st := &EditInstancePool{} - st.CustomTags = pb.CustomTags - st.IdleInstanceAutoterminationMinutes = pb.IdleInstanceAutoterminationMinutes - st.InstancePoolId = pb.InstancePoolId - st.InstancePoolName = pb.InstancePoolName - st.MaxCapacity = pb.MaxCapacity - st.MinIdleInstances = pb.MinIdleInstances - st.NodeTypeId = pb.NodeTypeId - st.RemoteDiskThroughput = pb.RemoteDiskThroughput - st.TotalInitialRemoteDiskSize = pb.TotalInitialRemoteDiskSize - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *editInstancePoolPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st editInstancePoolPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func editInstancePoolResponseToPb(st *EditInstancePoolResponse) (*editInstancePoolResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &editInstancePoolResponsePb{} - - return pb, nil -} - -type editInstancePoolResponsePb struct { -} - -func editInstancePoolResponseFromPb(pb *editInstancePoolResponsePb) (*EditInstancePoolResponse, error) { - if pb == nil { - return nil, nil - } - st := &EditInstancePoolResponse{} - - return st, nil -} - -func editPolicyToPb(st *EditPolicy) (*editPolicyPb, error) { - if st == nil { - return nil, nil - } - pb := &editPolicyPb{} - pb.Definition = st.Definition - pb.Description = st.Description - pb.Libraries = st.Libraries - pb.MaxClustersPerUser = st.MaxClustersPerUser - pb.Name = st.Name - pb.PolicyFamilyDefinitionOverrides = st.PolicyFamilyDefinitionOverrides - pb.PolicyFamilyId = st.PolicyFamilyId - pb.PolicyId = st.PolicyId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type editPolicyPb struct { - Definition string `json:"definition,omitempty"` - Description string `json:"description,omitempty"` - Libraries []Library `json:"libraries,omitempty"` - MaxClustersPerUser int64 `json:"max_clusters_per_user,omitempty"` - Name string `json:"name,omitempty"` - PolicyFamilyDefinitionOverrides string `json:"policy_family_definition_overrides,omitempty"` - PolicyFamilyId string `json:"policy_family_id,omitempty"` - PolicyId string `json:"policy_id"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func editPolicyFromPb(pb *editPolicyPb) (*EditPolicy, error) { - if pb == nil { - return nil, nil - } - st := &EditPolicy{} - st.Definition = pb.Definition - st.Description = pb.Description - st.Libraries = pb.Libraries - st.MaxClustersPerUser = pb.MaxClustersPerUser - st.Name = pb.Name - st.PolicyFamilyDefinitionOverrides = pb.PolicyFamilyDefinitionOverrides - st.PolicyFamilyId = pb.PolicyFamilyId - st.PolicyId = pb.PolicyId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *editPolicyPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st editPolicyPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func editPolicyResponseToPb(st *EditPolicyResponse) (*editPolicyResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &editPolicyResponsePb{} - - return pb, nil -} - -type editPolicyResponsePb struct { -} - -func editPolicyResponseFromPb(pb *editPolicyResponsePb) (*EditPolicyResponse, error) { - if pb == nil { - return nil, nil - } - st := &EditPolicyResponse{} - - return st, nil -} - -func editResponseToPb(st *EditResponse) (*editResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &editResponsePb{} - - return pb, nil -} - -type editResponsePb struct { -} - -func editResponseFromPb(pb *editResponsePb) (*EditResponse, error) { - if pb == nil { - return nil, nil - } - st := &EditResponse{} - - return st, nil -} - -func enforceClusterComplianceRequestToPb(st *EnforceClusterComplianceRequest) (*enforceClusterComplianceRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &enforceClusterComplianceRequestPb{} - pb.ClusterId = st.ClusterId - pb.ValidateOnly = st.ValidateOnly - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type enforceClusterComplianceRequestPb struct { - ClusterId string `json:"cluster_id"` - ValidateOnly bool `json:"validate_only,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func enforceClusterComplianceRequestFromPb(pb *enforceClusterComplianceRequestPb) (*EnforceClusterComplianceRequest, error) { - if pb == nil { - return nil, nil - } - st := &EnforceClusterComplianceRequest{} - st.ClusterId = pb.ClusterId - st.ValidateOnly = pb.ValidateOnly - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *enforceClusterComplianceRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st enforceClusterComplianceRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func enforceClusterComplianceResponseToPb(st *EnforceClusterComplianceResponse) (*enforceClusterComplianceResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &enforceClusterComplianceResponsePb{} - pb.Changes = st.Changes - pb.HasChanges = st.HasChanges - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type enforceClusterComplianceResponsePb struct { - Changes []ClusterSettingsChange `json:"changes,omitempty"` - HasChanges bool `json:"has_changes,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func enforceClusterComplianceResponseFromPb(pb *enforceClusterComplianceResponsePb) (*EnforceClusterComplianceResponse, error) { - if pb == nil { - return nil, nil - } - st := &EnforceClusterComplianceResponse{} - st.Changes = pb.Changes - st.HasChanges = pb.HasChanges - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *enforceClusterComplianceResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st enforceClusterComplianceResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func environmentToPb(st *Environment) (*environmentPb, error) { - if st == nil { - return nil, nil - } - pb := &environmentPb{} - pb.Client = st.Client - pb.Dependencies = st.Dependencies - pb.EnvironmentVersion = st.EnvironmentVersion - pb.JarDependencies = st.JarDependencies - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type environmentPb struct { - Client string `json:"client,omitempty"` - Dependencies []string `json:"dependencies,omitempty"` - EnvironmentVersion string `json:"environment_version,omitempty"` - JarDependencies []string `json:"jar_dependencies,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func environmentFromPb(pb *environmentPb) (*Environment, error) { - if pb == nil { - return nil, nil - } - st := &Environment{} - st.Client = pb.Client - st.Dependencies = pb.Dependencies - st.EnvironmentVersion = pb.EnvironmentVersion - st.JarDependencies = pb.JarDependencies - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *environmentPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st environmentPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func eventDetailsToPb(st *EventDetails) (*eventDetailsPb, error) { - if st == nil { - return nil, nil - } - pb := &eventDetailsPb{} - pb.Attributes = st.Attributes - pb.Cause = st.Cause - pb.ClusterSize = st.ClusterSize - pb.CurrentNumVcpus = st.CurrentNumVcpus - pb.CurrentNumWorkers = st.CurrentNumWorkers - pb.DidNotExpandReason = st.DidNotExpandReason - pb.DiskSize = st.DiskSize - pb.DriverStateMessage = st.DriverStateMessage - pb.EnableTerminationForNodeBlocklisted = st.EnableTerminationForNodeBlocklisted - pb.FreeSpace = st.FreeSpace - pb.InitScripts = st.InitScripts - pb.InstanceId = st.InstanceId - pb.JobRunName = st.JobRunName - pb.PreviousAttributes = st.PreviousAttributes - pb.PreviousClusterSize = st.PreviousClusterSize - pb.PreviousDiskSize = st.PreviousDiskSize - pb.Reason = st.Reason - pb.TargetNumVcpus = st.TargetNumVcpus - pb.TargetNumWorkers = st.TargetNumWorkers - pb.User = st.User - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type eventDetailsPb struct { - Attributes *ClusterAttributes `json:"attributes,omitempty"` - Cause EventDetailsCause `json:"cause,omitempty"` - ClusterSize *ClusterSize `json:"cluster_size,omitempty"` - CurrentNumVcpus int `json:"current_num_vcpus,omitempty"` - CurrentNumWorkers int `json:"current_num_workers,omitempty"` - DidNotExpandReason string `json:"did_not_expand_reason,omitempty"` - DiskSize int64 `json:"disk_size,omitempty"` - DriverStateMessage string `json:"driver_state_message,omitempty"` - EnableTerminationForNodeBlocklisted bool `json:"enable_termination_for_node_blocklisted,omitempty"` - FreeSpace int64 `json:"free_space,omitempty"` - InitScripts *InitScriptEventDetails `json:"init_scripts,omitempty"` - InstanceId string `json:"instance_id,omitempty"` - JobRunName string `json:"job_run_name,omitempty"` - PreviousAttributes *ClusterAttributes `json:"previous_attributes,omitempty"` - PreviousClusterSize *ClusterSize `json:"previous_cluster_size,omitempty"` - PreviousDiskSize int64 `json:"previous_disk_size,omitempty"` - Reason *TerminationReason `json:"reason,omitempty"` - TargetNumVcpus int `json:"target_num_vcpus,omitempty"` - TargetNumWorkers int `json:"target_num_workers,omitempty"` - User string `json:"user,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func eventDetailsFromPb(pb *eventDetailsPb) (*EventDetails, error) { - if pb == nil { - return nil, nil - } - st := &EventDetails{} - st.Attributes = pb.Attributes - st.Cause = pb.Cause - st.ClusterSize = pb.ClusterSize - st.CurrentNumVcpus = pb.CurrentNumVcpus - st.CurrentNumWorkers = pb.CurrentNumWorkers - st.DidNotExpandReason = pb.DidNotExpandReason - st.DiskSize = pb.DiskSize - st.DriverStateMessage = pb.DriverStateMessage - st.EnableTerminationForNodeBlocklisted = pb.EnableTerminationForNodeBlocklisted - st.FreeSpace = pb.FreeSpace - st.InitScripts = pb.InitScripts - st.InstanceId = pb.InstanceId - st.JobRunName = pb.JobRunName - st.PreviousAttributes = pb.PreviousAttributes - st.PreviousClusterSize = pb.PreviousClusterSize - st.PreviousDiskSize = pb.PreviousDiskSize - st.Reason = pb.Reason - st.TargetNumVcpus = pb.TargetNumVcpus - st.TargetNumWorkers = pb.TargetNumWorkers - st.User = pb.User - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *eventDetailsPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st eventDetailsPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func gcpAttributesToPb(st *GcpAttributes) (*gcpAttributesPb, error) { - if st == nil { - return nil, nil - } - pb := &gcpAttributesPb{} - pb.Availability = st.Availability - pb.BootDiskSize = st.BootDiskSize - pb.GoogleServiceAccount = st.GoogleServiceAccount - pb.LocalSsdCount = st.LocalSsdCount - pb.UsePreemptibleExecutors = st.UsePreemptibleExecutors - pb.ZoneId = st.ZoneId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type gcpAttributesPb struct { - Availability GcpAvailability `json:"availability,omitempty"` - BootDiskSize int `json:"boot_disk_size,omitempty"` - GoogleServiceAccount string `json:"google_service_account,omitempty"` - LocalSsdCount int `json:"local_ssd_count,omitempty"` - UsePreemptibleExecutors bool `json:"use_preemptible_executors,omitempty"` - ZoneId string `json:"zone_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func gcpAttributesFromPb(pb *gcpAttributesPb) (*GcpAttributes, error) { - if pb == nil { - return nil, nil - } - st := &GcpAttributes{} - st.Availability = pb.Availability - st.BootDiskSize = pb.BootDiskSize - st.GoogleServiceAccount = pb.GoogleServiceAccount - st.LocalSsdCount = pb.LocalSsdCount - st.UsePreemptibleExecutors = pb.UsePreemptibleExecutors - st.ZoneId = pb.ZoneId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *gcpAttributesPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st gcpAttributesPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func gcsStorageInfoToPb(st *GcsStorageInfo) (*gcsStorageInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &gcsStorageInfoPb{} - pb.Destination = st.Destination - - return pb, nil -} - -type gcsStorageInfoPb struct { - Destination string `json:"destination"` -} - -func gcsStorageInfoFromPb(pb *gcsStorageInfoPb) (*GcsStorageInfo, error) { - if pb == nil { - return nil, nil - } - st := &GcsStorageInfo{} - st.Destination = pb.Destination - - return st, nil -} - -func getClusterComplianceRequestToPb(st *GetClusterComplianceRequest) (*getClusterComplianceRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getClusterComplianceRequestPb{} - pb.ClusterId = st.ClusterId - - return pb, nil -} - -type getClusterComplianceRequestPb struct { - ClusterId string `json:"-" url:"cluster_id"` -} - -func getClusterComplianceRequestFromPb(pb *getClusterComplianceRequestPb) (*GetClusterComplianceRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetClusterComplianceRequest{} - st.ClusterId = pb.ClusterId - - return st, nil -} - -func getClusterComplianceResponseToPb(st *GetClusterComplianceResponse) (*getClusterComplianceResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &getClusterComplianceResponsePb{} - pb.IsCompliant = st.IsCompliant - pb.Violations = st.Violations - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getClusterComplianceResponsePb struct { - IsCompliant bool `json:"is_compliant,omitempty"` - Violations map[string]string `json:"violations,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getClusterComplianceResponseFromPb(pb *getClusterComplianceResponsePb) (*GetClusterComplianceResponse, error) { - if pb == nil { - return nil, nil - } - st := &GetClusterComplianceResponse{} - st.IsCompliant = pb.IsCompliant - st.Violations = pb.Violations - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getClusterComplianceResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getClusterComplianceResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getClusterPermissionLevelsRequestToPb(st *GetClusterPermissionLevelsRequest) (*getClusterPermissionLevelsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getClusterPermissionLevelsRequestPb{} - pb.ClusterId = st.ClusterId - - return pb, nil -} - -type getClusterPermissionLevelsRequestPb struct { - ClusterId string `json:"-" url:"-"` -} - -func getClusterPermissionLevelsRequestFromPb(pb *getClusterPermissionLevelsRequestPb) (*GetClusterPermissionLevelsRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetClusterPermissionLevelsRequest{} - st.ClusterId = pb.ClusterId - - return st, nil -} - -func getClusterPermissionLevelsResponseToPb(st *GetClusterPermissionLevelsResponse) (*getClusterPermissionLevelsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &getClusterPermissionLevelsResponsePb{} - pb.PermissionLevels = st.PermissionLevels - - return pb, nil -} - -type getClusterPermissionLevelsResponsePb struct { - PermissionLevels []ClusterPermissionsDescription `json:"permission_levels,omitempty"` -} - -func getClusterPermissionLevelsResponseFromPb(pb *getClusterPermissionLevelsResponsePb) (*GetClusterPermissionLevelsResponse, error) { - if pb == nil { - return nil, nil - } - st := &GetClusterPermissionLevelsResponse{} - st.PermissionLevels = pb.PermissionLevels - - return st, nil -} - -func getClusterPermissionsRequestToPb(st *GetClusterPermissionsRequest) (*getClusterPermissionsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getClusterPermissionsRequestPb{} - pb.ClusterId = st.ClusterId - - return pb, nil -} - -type getClusterPermissionsRequestPb struct { - ClusterId string `json:"-" url:"-"` -} - -func getClusterPermissionsRequestFromPb(pb *getClusterPermissionsRequestPb) (*GetClusterPermissionsRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetClusterPermissionsRequest{} - st.ClusterId = pb.ClusterId - - return st, nil -} - -func getClusterPolicyPermissionLevelsRequestToPb(st *GetClusterPolicyPermissionLevelsRequest) (*getClusterPolicyPermissionLevelsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getClusterPolicyPermissionLevelsRequestPb{} - pb.ClusterPolicyId = st.ClusterPolicyId - - return pb, nil -} - -type getClusterPolicyPermissionLevelsRequestPb struct { - ClusterPolicyId string `json:"-" url:"-"` -} - -func getClusterPolicyPermissionLevelsRequestFromPb(pb *getClusterPolicyPermissionLevelsRequestPb) (*GetClusterPolicyPermissionLevelsRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetClusterPolicyPermissionLevelsRequest{} - st.ClusterPolicyId = pb.ClusterPolicyId - - return st, nil -} - -func getClusterPolicyPermissionLevelsResponseToPb(st *GetClusterPolicyPermissionLevelsResponse) (*getClusterPolicyPermissionLevelsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &getClusterPolicyPermissionLevelsResponsePb{} - pb.PermissionLevels = st.PermissionLevels - - return pb, nil -} - -type getClusterPolicyPermissionLevelsResponsePb struct { - PermissionLevels []ClusterPolicyPermissionsDescription `json:"permission_levels,omitempty"` -} - -func getClusterPolicyPermissionLevelsResponseFromPb(pb *getClusterPolicyPermissionLevelsResponsePb) (*GetClusterPolicyPermissionLevelsResponse, error) { - if pb == nil { - return nil, nil - } - st := &GetClusterPolicyPermissionLevelsResponse{} - st.PermissionLevels = pb.PermissionLevels - - return st, nil -} - -func getClusterPolicyPermissionsRequestToPb(st *GetClusterPolicyPermissionsRequest) (*getClusterPolicyPermissionsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getClusterPolicyPermissionsRequestPb{} - pb.ClusterPolicyId = st.ClusterPolicyId - - return pb, nil -} - -type getClusterPolicyPermissionsRequestPb struct { - ClusterPolicyId string `json:"-" url:"-"` -} - -func getClusterPolicyPermissionsRequestFromPb(pb *getClusterPolicyPermissionsRequestPb) (*GetClusterPolicyPermissionsRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetClusterPolicyPermissionsRequest{} - st.ClusterPolicyId = pb.ClusterPolicyId - - return st, nil -} - -func getClusterPolicyRequestToPb(st *GetClusterPolicyRequest) (*getClusterPolicyRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getClusterPolicyRequestPb{} - pb.PolicyId = st.PolicyId - - return pb, nil -} - -type getClusterPolicyRequestPb struct { - PolicyId string `json:"-" url:"policy_id"` -} - -func getClusterPolicyRequestFromPb(pb *getClusterPolicyRequestPb) (*GetClusterPolicyRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetClusterPolicyRequest{} - st.PolicyId = pb.PolicyId - - return st, nil -} - -func getClusterRequestToPb(st *GetClusterRequest) (*getClusterRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getClusterRequestPb{} - pb.ClusterId = st.ClusterId - - return pb, nil -} - -type getClusterRequestPb struct { - ClusterId string `json:"-" url:"cluster_id"` -} - -func getClusterRequestFromPb(pb *getClusterRequestPb) (*GetClusterRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetClusterRequest{} - st.ClusterId = pb.ClusterId - - return st, nil -} - -func getEventsToPb(st *GetEvents) (*getEventsPb, error) { - if st == nil { - return nil, nil - } - pb := &getEventsPb{} - pb.ClusterId = st.ClusterId - pb.EndTime = st.EndTime - pb.EventTypes = st.EventTypes - pb.Limit = st.Limit - pb.Offset = st.Offset - pb.Order = st.Order - pb.PageSize = st.PageSize - pb.PageToken = st.PageToken - pb.StartTime = st.StartTime - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getEventsPb struct { - ClusterId string `json:"cluster_id"` - EndTime int64 `json:"end_time,omitempty"` - EventTypes []EventType `json:"event_types,omitempty"` - Limit int64 `json:"limit,omitempty"` - Offset int64 `json:"offset,omitempty"` - Order GetEventsOrder `json:"order,omitempty"` - PageSize int `json:"page_size,omitempty"` - PageToken string `json:"page_token,omitempty"` - StartTime int64 `json:"start_time,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getEventsFromPb(pb *getEventsPb) (*GetEvents, error) { - if pb == nil { - return nil, nil - } - st := &GetEvents{} - st.ClusterId = pb.ClusterId - st.EndTime = pb.EndTime - st.EventTypes = pb.EventTypes - st.Limit = pb.Limit - st.Offset = pb.Offset - st.Order = pb.Order - st.PageSize = pb.PageSize - st.PageToken = pb.PageToken - st.StartTime = pb.StartTime - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getEventsPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getEventsPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getEventsResponseToPb(st *GetEventsResponse) (*getEventsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &getEventsResponsePb{} - pb.Events = st.Events - pb.NextPage = st.NextPage - pb.NextPageToken = st.NextPageToken - pb.PrevPageToken = st.PrevPageToken - pb.TotalCount = st.TotalCount - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getEventsResponsePb struct { - Events []ClusterEvent `json:"events,omitempty"` - NextPage *GetEvents `json:"next_page,omitempty"` - NextPageToken string `json:"next_page_token,omitempty"` - PrevPageToken string `json:"prev_page_token,omitempty"` - TotalCount int64 `json:"total_count,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getEventsResponseFromPb(pb *getEventsResponsePb) (*GetEventsResponse, error) { - if pb == nil { - return nil, nil - } - st := &GetEventsResponse{} - st.Events = pb.Events - st.NextPage = pb.NextPage - st.NextPageToken = pb.NextPageToken - st.PrevPageToken = pb.PrevPageToken - st.TotalCount = pb.TotalCount - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getEventsResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getEventsResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getGlobalInitScriptRequestToPb(st *GetGlobalInitScriptRequest) (*getGlobalInitScriptRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getGlobalInitScriptRequestPb{} - pb.ScriptId = st.ScriptId - - return pb, nil -} - -type getGlobalInitScriptRequestPb struct { - ScriptId string `json:"-" url:"-"` -} - -func getGlobalInitScriptRequestFromPb(pb *getGlobalInitScriptRequestPb) (*GetGlobalInitScriptRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetGlobalInitScriptRequest{} - st.ScriptId = pb.ScriptId - - return st, nil -} - -func getInstancePoolToPb(st *GetInstancePool) (*getInstancePoolPb, error) { - if st == nil { - return nil, nil - } - pb := &getInstancePoolPb{} - pb.AwsAttributes = st.AwsAttributes - pb.AzureAttributes = st.AzureAttributes - pb.CustomTags = st.CustomTags - pb.DefaultTags = st.DefaultTags - pb.DiskSpec = st.DiskSpec - pb.EnableElasticDisk = st.EnableElasticDisk - pb.GcpAttributes = st.GcpAttributes - pb.IdleInstanceAutoterminationMinutes = st.IdleInstanceAutoterminationMinutes - pb.InstancePoolId = st.InstancePoolId - pb.InstancePoolName = st.InstancePoolName - pb.MaxCapacity = st.MaxCapacity - pb.MinIdleInstances = st.MinIdleInstances - pb.NodeTypeId = st.NodeTypeId - pb.PreloadedDockerImages = st.PreloadedDockerImages - pb.PreloadedSparkVersions = st.PreloadedSparkVersions - pb.RemoteDiskThroughput = st.RemoteDiskThroughput - pb.State = st.State - pb.Stats = st.Stats - pb.Status = st.Status - pb.TotalInitialRemoteDiskSize = st.TotalInitialRemoteDiskSize - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getInstancePoolPb struct { - AwsAttributes *InstancePoolAwsAttributes `json:"aws_attributes,omitempty"` - AzureAttributes *InstancePoolAzureAttributes `json:"azure_attributes,omitempty"` - CustomTags map[string]string `json:"custom_tags,omitempty"` - DefaultTags map[string]string `json:"default_tags,omitempty"` - DiskSpec *DiskSpec `json:"disk_spec,omitempty"` - EnableElasticDisk bool `json:"enable_elastic_disk,omitempty"` - GcpAttributes *InstancePoolGcpAttributes `json:"gcp_attributes,omitempty"` - IdleInstanceAutoterminationMinutes int `json:"idle_instance_autotermination_minutes,omitempty"` - InstancePoolId string `json:"instance_pool_id"` - InstancePoolName string `json:"instance_pool_name,omitempty"` - MaxCapacity int `json:"max_capacity,omitempty"` - MinIdleInstances int `json:"min_idle_instances,omitempty"` - NodeTypeId string `json:"node_type_id,omitempty"` - PreloadedDockerImages []DockerImage `json:"preloaded_docker_images,omitempty"` - PreloadedSparkVersions []string `json:"preloaded_spark_versions,omitempty"` - RemoteDiskThroughput int `json:"remote_disk_throughput,omitempty"` - State InstancePoolState `json:"state,omitempty"` - Stats *InstancePoolStats `json:"stats,omitempty"` - Status *InstancePoolStatus `json:"status,omitempty"` - TotalInitialRemoteDiskSize int `json:"total_initial_remote_disk_size,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getInstancePoolFromPb(pb *getInstancePoolPb) (*GetInstancePool, error) { - if pb == nil { - return nil, nil - } - st := &GetInstancePool{} - st.AwsAttributes = pb.AwsAttributes - st.AzureAttributes = pb.AzureAttributes - st.CustomTags = pb.CustomTags - st.DefaultTags = pb.DefaultTags - st.DiskSpec = pb.DiskSpec - st.EnableElasticDisk = pb.EnableElasticDisk - st.GcpAttributes = pb.GcpAttributes - st.IdleInstanceAutoterminationMinutes = pb.IdleInstanceAutoterminationMinutes - st.InstancePoolId = pb.InstancePoolId - st.InstancePoolName = pb.InstancePoolName - st.MaxCapacity = pb.MaxCapacity - st.MinIdleInstances = pb.MinIdleInstances - st.NodeTypeId = pb.NodeTypeId - st.PreloadedDockerImages = pb.PreloadedDockerImages - st.PreloadedSparkVersions = pb.PreloadedSparkVersions - st.RemoteDiskThroughput = pb.RemoteDiskThroughput - st.State = pb.State - st.Stats = pb.Stats - st.Status = pb.Status - st.TotalInitialRemoteDiskSize = pb.TotalInitialRemoteDiskSize - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getInstancePoolPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getInstancePoolPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getInstancePoolPermissionLevelsRequestToPb(st *GetInstancePoolPermissionLevelsRequest) (*getInstancePoolPermissionLevelsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getInstancePoolPermissionLevelsRequestPb{} - pb.InstancePoolId = st.InstancePoolId - - return pb, nil -} - -type getInstancePoolPermissionLevelsRequestPb struct { - InstancePoolId string `json:"-" url:"-"` -} - -func getInstancePoolPermissionLevelsRequestFromPb(pb *getInstancePoolPermissionLevelsRequestPb) (*GetInstancePoolPermissionLevelsRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetInstancePoolPermissionLevelsRequest{} - st.InstancePoolId = pb.InstancePoolId - - return st, nil -} - -func getInstancePoolPermissionLevelsResponseToPb(st *GetInstancePoolPermissionLevelsResponse) (*getInstancePoolPermissionLevelsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &getInstancePoolPermissionLevelsResponsePb{} - pb.PermissionLevels = st.PermissionLevels - - return pb, nil -} - -type getInstancePoolPermissionLevelsResponsePb struct { - PermissionLevels []InstancePoolPermissionsDescription `json:"permission_levels,omitempty"` -} - -func getInstancePoolPermissionLevelsResponseFromPb(pb *getInstancePoolPermissionLevelsResponsePb) (*GetInstancePoolPermissionLevelsResponse, error) { - if pb == nil { - return nil, nil - } - st := &GetInstancePoolPermissionLevelsResponse{} - st.PermissionLevels = pb.PermissionLevels - - return st, nil -} - -func getInstancePoolPermissionsRequestToPb(st *GetInstancePoolPermissionsRequest) (*getInstancePoolPermissionsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getInstancePoolPermissionsRequestPb{} - pb.InstancePoolId = st.InstancePoolId - - return pb, nil -} - -type getInstancePoolPermissionsRequestPb struct { - InstancePoolId string `json:"-" url:"-"` -} - -func getInstancePoolPermissionsRequestFromPb(pb *getInstancePoolPermissionsRequestPb) (*GetInstancePoolPermissionsRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetInstancePoolPermissionsRequest{} - st.InstancePoolId = pb.InstancePoolId - - return st, nil -} - -func getInstancePoolRequestToPb(st *GetInstancePoolRequest) (*getInstancePoolRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getInstancePoolRequestPb{} - pb.InstancePoolId = st.InstancePoolId - - return pb, nil -} - -type getInstancePoolRequestPb struct { - InstancePoolId string `json:"-" url:"instance_pool_id"` -} - -func getInstancePoolRequestFromPb(pb *getInstancePoolRequestPb) (*GetInstancePoolRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetInstancePoolRequest{} - st.InstancePoolId = pb.InstancePoolId - - return st, nil -} - -func getPolicyFamilyRequestToPb(st *GetPolicyFamilyRequest) (*getPolicyFamilyRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getPolicyFamilyRequestPb{} - pb.PolicyFamilyId = st.PolicyFamilyId - pb.Version = st.Version - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getPolicyFamilyRequestPb struct { - PolicyFamilyId string `json:"-" url:"-"` - Version int64 `json:"-" url:"version,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getPolicyFamilyRequestFromPb(pb *getPolicyFamilyRequestPb) (*GetPolicyFamilyRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetPolicyFamilyRequest{} - st.PolicyFamilyId = pb.PolicyFamilyId - st.Version = pb.Version - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getPolicyFamilyRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getPolicyFamilyRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getSparkVersionsResponseToPb(st *GetSparkVersionsResponse) (*getSparkVersionsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &getSparkVersionsResponsePb{} - pb.Versions = st.Versions - - return pb, nil -} - -type getSparkVersionsResponsePb struct { - Versions []SparkVersion `json:"versions,omitempty"` -} - -func getSparkVersionsResponseFromPb(pb *getSparkVersionsResponsePb) (*GetSparkVersionsResponse, error) { - if pb == nil { - return nil, nil - } - st := &GetSparkVersionsResponse{} - st.Versions = pb.Versions - - return st, nil -} - -func globalInitScriptCreateRequestToPb(st *GlobalInitScriptCreateRequest) (*globalInitScriptCreateRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &globalInitScriptCreateRequestPb{} - pb.Enabled = st.Enabled - pb.Name = st.Name - pb.Position = st.Position - pb.Script = st.Script - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type globalInitScriptCreateRequestPb struct { - Enabled bool `json:"enabled,omitempty"` - Name string `json:"name"` - Position int `json:"position,omitempty"` - Script string `json:"script"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func globalInitScriptCreateRequestFromPb(pb *globalInitScriptCreateRequestPb) (*GlobalInitScriptCreateRequest, error) { - if pb == nil { - return nil, nil - } - st := &GlobalInitScriptCreateRequest{} - st.Enabled = pb.Enabled - st.Name = pb.Name - st.Position = pb.Position - st.Script = pb.Script - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *globalInitScriptCreateRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st globalInitScriptCreateRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func globalInitScriptDetailsToPb(st *GlobalInitScriptDetails) (*globalInitScriptDetailsPb, error) { - if st == nil { - return nil, nil - } - pb := &globalInitScriptDetailsPb{} - pb.CreatedAt = st.CreatedAt - pb.CreatedBy = st.CreatedBy - pb.Enabled = st.Enabled - pb.Name = st.Name - pb.Position = st.Position - pb.ScriptId = st.ScriptId - pb.UpdatedAt = st.UpdatedAt - pb.UpdatedBy = st.UpdatedBy - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type globalInitScriptDetailsPb struct { - CreatedAt int `json:"created_at,omitempty"` - CreatedBy string `json:"created_by,omitempty"` - Enabled bool `json:"enabled,omitempty"` - Name string `json:"name,omitempty"` - Position int `json:"position,omitempty"` - ScriptId string `json:"script_id,omitempty"` - UpdatedAt int `json:"updated_at,omitempty"` - UpdatedBy string `json:"updated_by,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func globalInitScriptDetailsFromPb(pb *globalInitScriptDetailsPb) (*GlobalInitScriptDetails, error) { - if pb == nil { - return nil, nil - } - st := &GlobalInitScriptDetails{} - st.CreatedAt = pb.CreatedAt - st.CreatedBy = pb.CreatedBy - st.Enabled = pb.Enabled - st.Name = pb.Name - st.Position = pb.Position - st.ScriptId = pb.ScriptId - st.UpdatedAt = pb.UpdatedAt - st.UpdatedBy = pb.UpdatedBy - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *globalInitScriptDetailsPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st globalInitScriptDetailsPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func globalInitScriptDetailsWithContentToPb(st *GlobalInitScriptDetailsWithContent) (*globalInitScriptDetailsWithContentPb, error) { - if st == nil { - return nil, nil - } - pb := &globalInitScriptDetailsWithContentPb{} - pb.CreatedAt = st.CreatedAt - pb.CreatedBy = st.CreatedBy - pb.Enabled = st.Enabled - pb.Name = st.Name - pb.Position = st.Position - pb.Script = st.Script - pb.ScriptId = st.ScriptId - pb.UpdatedAt = st.UpdatedAt - pb.UpdatedBy = st.UpdatedBy - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type globalInitScriptDetailsWithContentPb struct { - CreatedAt int `json:"created_at,omitempty"` - CreatedBy string `json:"created_by,omitempty"` - Enabled bool `json:"enabled,omitempty"` - Name string `json:"name,omitempty"` - Position int `json:"position,omitempty"` - Script string `json:"script,omitempty"` - ScriptId string `json:"script_id,omitempty"` - UpdatedAt int `json:"updated_at,omitempty"` - UpdatedBy string `json:"updated_by,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func globalInitScriptDetailsWithContentFromPb(pb *globalInitScriptDetailsWithContentPb) (*GlobalInitScriptDetailsWithContent, error) { - if pb == nil { - return nil, nil - } - st := &GlobalInitScriptDetailsWithContent{} - st.CreatedAt = pb.CreatedAt - st.CreatedBy = pb.CreatedBy - st.Enabled = pb.Enabled - st.Name = pb.Name - st.Position = pb.Position - st.Script = pb.Script - st.ScriptId = pb.ScriptId - st.UpdatedAt = pb.UpdatedAt - st.UpdatedBy = pb.UpdatedBy - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *globalInitScriptDetailsWithContentPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st globalInitScriptDetailsWithContentPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func globalInitScriptUpdateRequestToPb(st *GlobalInitScriptUpdateRequest) (*globalInitScriptUpdateRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &globalInitScriptUpdateRequestPb{} - pb.Enabled = st.Enabled - pb.Name = st.Name - pb.Position = st.Position - pb.Script = st.Script - pb.ScriptId = st.ScriptId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type globalInitScriptUpdateRequestPb struct { - Enabled bool `json:"enabled,omitempty"` - Name string `json:"name"` - Position int `json:"position,omitempty"` - Script string `json:"script"` - ScriptId string `json:"-" url:"-"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func globalInitScriptUpdateRequestFromPb(pb *globalInitScriptUpdateRequestPb) (*GlobalInitScriptUpdateRequest, error) { - if pb == nil { - return nil, nil - } - st := &GlobalInitScriptUpdateRequest{} - st.Enabled = pb.Enabled - st.Name = pb.Name - st.Position = pb.Position - st.Script = pb.Script - st.ScriptId = pb.ScriptId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *globalInitScriptUpdateRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st globalInitScriptUpdateRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func initScriptEventDetailsToPb(st *InitScriptEventDetails) (*initScriptEventDetailsPb, error) { - if st == nil { - return nil, nil - } - pb := &initScriptEventDetailsPb{} - pb.Cluster = st.Cluster - pb.Global = st.Global - pb.ReportedForNode = st.ReportedForNode - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type initScriptEventDetailsPb struct { - Cluster []InitScriptInfoAndExecutionDetails `json:"cluster,omitempty"` - Global []InitScriptInfoAndExecutionDetails `json:"global,omitempty"` - ReportedForNode string `json:"reported_for_node,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func initScriptEventDetailsFromPb(pb *initScriptEventDetailsPb) (*InitScriptEventDetails, error) { - if pb == nil { - return nil, nil - } - st := &InitScriptEventDetails{} - st.Cluster = pb.Cluster - st.Global = pb.Global - st.ReportedForNode = pb.ReportedForNode - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *initScriptEventDetailsPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st initScriptEventDetailsPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func initScriptInfoToPb(st *InitScriptInfo) (*initScriptInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &initScriptInfoPb{} - pb.Abfss = st.Abfss - pb.Dbfs = st.Dbfs - pb.File = st.File - pb.Gcs = st.Gcs - pb.S3 = st.S3 - pb.Volumes = st.Volumes - pb.Workspace = st.Workspace - - return pb, nil -} - -type initScriptInfoPb struct { - Abfss *Adlsgen2Info `json:"abfss,omitempty"` - Dbfs *DbfsStorageInfo `json:"dbfs,omitempty"` - File *LocalFileInfo `json:"file,omitempty"` - Gcs *GcsStorageInfo `json:"gcs,omitempty"` - S3 *S3StorageInfo `json:"s3,omitempty"` - Volumes *VolumesStorageInfo `json:"volumes,omitempty"` - Workspace *WorkspaceStorageInfo `json:"workspace,omitempty"` -} - -func initScriptInfoFromPb(pb *initScriptInfoPb) (*InitScriptInfo, error) { - if pb == nil { - return nil, nil - } - st := &InitScriptInfo{} - st.Abfss = pb.Abfss - st.Dbfs = pb.Dbfs - st.File = pb.File - st.Gcs = pb.Gcs - st.S3 = pb.S3 - st.Volumes = pb.Volumes - st.Workspace = pb.Workspace - - return st, nil -} - -func initScriptInfoAndExecutionDetailsToPb(st *InitScriptInfoAndExecutionDetails) (*initScriptInfoAndExecutionDetailsPb, error) { - if st == nil { - return nil, nil - } - pb := &initScriptInfoAndExecutionDetailsPb{} - pb.Abfss = st.Abfss - pb.Dbfs = st.Dbfs - pb.ErrorMessage = st.ErrorMessage - pb.ExecutionDurationSeconds = st.ExecutionDurationSeconds - pb.File = st.File - pb.Gcs = st.Gcs - pb.S3 = st.S3 - pb.Status = st.Status - pb.Volumes = st.Volumes - pb.Workspace = st.Workspace - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type initScriptInfoAndExecutionDetailsPb struct { - Abfss *Adlsgen2Info `json:"abfss,omitempty"` - Dbfs *DbfsStorageInfo `json:"dbfs,omitempty"` - ErrorMessage string `json:"error_message,omitempty"` - ExecutionDurationSeconds int `json:"execution_duration_seconds,omitempty"` - File *LocalFileInfo `json:"file,omitempty"` - Gcs *GcsStorageInfo `json:"gcs,omitempty"` - S3 *S3StorageInfo `json:"s3,omitempty"` - Status InitScriptExecutionDetailsInitScriptExecutionStatus `json:"status,omitempty"` - Volumes *VolumesStorageInfo `json:"volumes,omitempty"` - Workspace *WorkspaceStorageInfo `json:"workspace,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func initScriptInfoAndExecutionDetailsFromPb(pb *initScriptInfoAndExecutionDetailsPb) (*InitScriptInfoAndExecutionDetails, error) { - if pb == nil { - return nil, nil - } - st := &InitScriptInfoAndExecutionDetails{} - st.Abfss = pb.Abfss - st.Dbfs = pb.Dbfs - st.ErrorMessage = pb.ErrorMessage - st.ExecutionDurationSeconds = pb.ExecutionDurationSeconds - st.File = pb.File - st.Gcs = pb.Gcs - st.S3 = pb.S3 - st.Status = pb.Status - st.Volumes = pb.Volumes - st.Workspace = pb.Workspace - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *initScriptInfoAndExecutionDetailsPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st initScriptInfoAndExecutionDetailsPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func installLibrariesToPb(st *InstallLibraries) (*installLibrariesPb, error) { - if st == nil { - return nil, nil - } - pb := &installLibrariesPb{} - pb.ClusterId = st.ClusterId - pb.Libraries = st.Libraries - - return pb, nil -} - -type installLibrariesPb struct { - ClusterId string `json:"cluster_id"` - Libraries []Library `json:"libraries"` -} - -func installLibrariesFromPb(pb *installLibrariesPb) (*InstallLibraries, error) { - if pb == nil { - return nil, nil - } - st := &InstallLibraries{} - st.ClusterId = pb.ClusterId - st.Libraries = pb.Libraries - - return st, nil -} - -func installLibrariesResponseToPb(st *InstallLibrariesResponse) (*installLibrariesResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &installLibrariesResponsePb{} - - return pb, nil -} - -type installLibrariesResponsePb struct { -} - -func installLibrariesResponseFromPb(pb *installLibrariesResponsePb) (*InstallLibrariesResponse, error) { - if pb == nil { - return nil, nil - } - st := &InstallLibrariesResponse{} - - return st, nil -} - -func instancePoolAccessControlRequestToPb(st *InstancePoolAccessControlRequest) (*instancePoolAccessControlRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &instancePoolAccessControlRequestPb{} - pb.GroupName = st.GroupName - pb.PermissionLevel = st.PermissionLevel - pb.ServicePrincipalName = st.ServicePrincipalName - pb.UserName = st.UserName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type instancePoolAccessControlRequestPb struct { - GroupName string `json:"group_name,omitempty"` - PermissionLevel InstancePoolPermissionLevel `json:"permission_level,omitempty"` - ServicePrincipalName string `json:"service_principal_name,omitempty"` - UserName string `json:"user_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func instancePoolAccessControlRequestFromPb(pb *instancePoolAccessControlRequestPb) (*InstancePoolAccessControlRequest, error) { - if pb == nil { - return nil, nil - } - st := &InstancePoolAccessControlRequest{} - st.GroupName = pb.GroupName - st.PermissionLevel = pb.PermissionLevel - st.ServicePrincipalName = pb.ServicePrincipalName - st.UserName = pb.UserName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *instancePoolAccessControlRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st instancePoolAccessControlRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func instancePoolAccessControlResponseToPb(st *InstancePoolAccessControlResponse) (*instancePoolAccessControlResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &instancePoolAccessControlResponsePb{} - pb.AllPermissions = st.AllPermissions - pb.DisplayName = st.DisplayName - pb.GroupName = st.GroupName - pb.ServicePrincipalName = st.ServicePrincipalName - pb.UserName = st.UserName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type instancePoolAccessControlResponsePb struct { - AllPermissions []InstancePoolPermission `json:"all_permissions,omitempty"` - DisplayName string `json:"display_name,omitempty"` - GroupName string `json:"group_name,omitempty"` - ServicePrincipalName string `json:"service_principal_name,omitempty"` - UserName string `json:"user_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func instancePoolAccessControlResponseFromPb(pb *instancePoolAccessControlResponsePb) (*InstancePoolAccessControlResponse, error) { - if pb == nil { - return nil, nil - } - st := &InstancePoolAccessControlResponse{} - st.AllPermissions = pb.AllPermissions - st.DisplayName = pb.DisplayName - st.GroupName = pb.GroupName - st.ServicePrincipalName = pb.ServicePrincipalName - st.UserName = pb.UserName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *instancePoolAccessControlResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st instancePoolAccessControlResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func instancePoolAndStatsToPb(st *InstancePoolAndStats) (*instancePoolAndStatsPb, error) { - if st == nil { - return nil, nil - } - pb := &instancePoolAndStatsPb{} - pb.AwsAttributes = st.AwsAttributes - pb.AzureAttributes = st.AzureAttributes - pb.CustomTags = st.CustomTags - pb.DefaultTags = st.DefaultTags - pb.DiskSpec = st.DiskSpec - pb.EnableElasticDisk = st.EnableElasticDisk - pb.GcpAttributes = st.GcpAttributes - pb.IdleInstanceAutoterminationMinutes = st.IdleInstanceAutoterminationMinutes - pb.InstancePoolId = st.InstancePoolId - pb.InstancePoolName = st.InstancePoolName - pb.MaxCapacity = st.MaxCapacity - pb.MinIdleInstances = st.MinIdleInstances - pb.NodeTypeId = st.NodeTypeId - pb.PreloadedDockerImages = st.PreloadedDockerImages - pb.PreloadedSparkVersions = st.PreloadedSparkVersions - pb.RemoteDiskThroughput = st.RemoteDiskThroughput - pb.State = st.State - pb.Stats = st.Stats - pb.Status = st.Status - pb.TotalInitialRemoteDiskSize = st.TotalInitialRemoteDiskSize - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type instancePoolAndStatsPb struct { - AwsAttributes *InstancePoolAwsAttributes `json:"aws_attributes,omitempty"` - AzureAttributes *InstancePoolAzureAttributes `json:"azure_attributes,omitempty"` - CustomTags map[string]string `json:"custom_tags,omitempty"` - DefaultTags map[string]string `json:"default_tags,omitempty"` - DiskSpec *DiskSpec `json:"disk_spec,omitempty"` - EnableElasticDisk bool `json:"enable_elastic_disk,omitempty"` - GcpAttributes *InstancePoolGcpAttributes `json:"gcp_attributes,omitempty"` - IdleInstanceAutoterminationMinutes int `json:"idle_instance_autotermination_minutes,omitempty"` - InstancePoolId string `json:"instance_pool_id,omitempty"` - InstancePoolName string `json:"instance_pool_name,omitempty"` - MaxCapacity int `json:"max_capacity,omitempty"` - MinIdleInstances int `json:"min_idle_instances,omitempty"` - NodeTypeId string `json:"node_type_id,omitempty"` - PreloadedDockerImages []DockerImage `json:"preloaded_docker_images,omitempty"` - PreloadedSparkVersions []string `json:"preloaded_spark_versions,omitempty"` - RemoteDiskThroughput int `json:"remote_disk_throughput,omitempty"` - State InstancePoolState `json:"state,omitempty"` - Stats *InstancePoolStats `json:"stats,omitempty"` - Status *InstancePoolStatus `json:"status,omitempty"` - TotalInitialRemoteDiskSize int `json:"total_initial_remote_disk_size,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func instancePoolAndStatsFromPb(pb *instancePoolAndStatsPb) (*InstancePoolAndStats, error) { - if pb == nil { - return nil, nil - } - st := &InstancePoolAndStats{} - st.AwsAttributes = pb.AwsAttributes - st.AzureAttributes = pb.AzureAttributes - st.CustomTags = pb.CustomTags - st.DefaultTags = pb.DefaultTags - st.DiskSpec = pb.DiskSpec - st.EnableElasticDisk = pb.EnableElasticDisk - st.GcpAttributes = pb.GcpAttributes - st.IdleInstanceAutoterminationMinutes = pb.IdleInstanceAutoterminationMinutes - st.InstancePoolId = pb.InstancePoolId - st.InstancePoolName = pb.InstancePoolName - st.MaxCapacity = pb.MaxCapacity - st.MinIdleInstances = pb.MinIdleInstances - st.NodeTypeId = pb.NodeTypeId - st.PreloadedDockerImages = pb.PreloadedDockerImages - st.PreloadedSparkVersions = pb.PreloadedSparkVersions - st.RemoteDiskThroughput = pb.RemoteDiskThroughput - st.State = pb.State - st.Stats = pb.Stats - st.Status = pb.Status - st.TotalInitialRemoteDiskSize = pb.TotalInitialRemoteDiskSize - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *instancePoolAndStatsPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st instancePoolAndStatsPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func instancePoolAwsAttributesToPb(st *InstancePoolAwsAttributes) (*instancePoolAwsAttributesPb, error) { - if st == nil { - return nil, nil - } - pb := &instancePoolAwsAttributesPb{} - pb.Availability = st.Availability - pb.SpotBidPricePercent = st.SpotBidPricePercent - pb.ZoneId = st.ZoneId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type instancePoolAwsAttributesPb struct { - Availability InstancePoolAwsAttributesAvailability `json:"availability,omitempty"` - SpotBidPricePercent int `json:"spot_bid_price_percent,omitempty"` - ZoneId string `json:"zone_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func instancePoolAwsAttributesFromPb(pb *instancePoolAwsAttributesPb) (*InstancePoolAwsAttributes, error) { - if pb == nil { - return nil, nil - } - st := &InstancePoolAwsAttributes{} - st.Availability = pb.Availability - st.SpotBidPricePercent = pb.SpotBidPricePercent - st.ZoneId = pb.ZoneId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *instancePoolAwsAttributesPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st instancePoolAwsAttributesPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func instancePoolAzureAttributesToPb(st *InstancePoolAzureAttributes) (*instancePoolAzureAttributesPb, error) { - if st == nil { - return nil, nil - } - pb := &instancePoolAzureAttributesPb{} - pb.Availability = st.Availability - pb.SpotBidMaxPrice = st.SpotBidMaxPrice - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type instancePoolAzureAttributesPb struct { - Availability InstancePoolAzureAttributesAvailability `json:"availability,omitempty"` - SpotBidMaxPrice float64 `json:"spot_bid_max_price,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func instancePoolAzureAttributesFromPb(pb *instancePoolAzureAttributesPb) (*InstancePoolAzureAttributes, error) { - if pb == nil { - return nil, nil - } - st := &InstancePoolAzureAttributes{} - st.Availability = pb.Availability - st.SpotBidMaxPrice = pb.SpotBidMaxPrice - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *instancePoolAzureAttributesPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st instancePoolAzureAttributesPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func instancePoolGcpAttributesToPb(st *InstancePoolGcpAttributes) (*instancePoolGcpAttributesPb, error) { - if st == nil { - return nil, nil - } - pb := &instancePoolGcpAttributesPb{} - pb.GcpAvailability = st.GcpAvailability - pb.LocalSsdCount = st.LocalSsdCount - pb.ZoneId = st.ZoneId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type instancePoolGcpAttributesPb struct { - GcpAvailability GcpAvailability `json:"gcp_availability,omitempty"` - LocalSsdCount int `json:"local_ssd_count,omitempty"` - ZoneId string `json:"zone_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func instancePoolGcpAttributesFromPb(pb *instancePoolGcpAttributesPb) (*InstancePoolGcpAttributes, error) { - if pb == nil { - return nil, nil - } - st := &InstancePoolGcpAttributes{} - st.GcpAvailability = pb.GcpAvailability - st.LocalSsdCount = pb.LocalSsdCount - st.ZoneId = pb.ZoneId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *instancePoolGcpAttributesPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st instancePoolGcpAttributesPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func instancePoolPermissionToPb(st *InstancePoolPermission) (*instancePoolPermissionPb, error) { - if st == nil { - return nil, nil - } - pb := &instancePoolPermissionPb{} - pb.Inherited = st.Inherited - pb.InheritedFromObject = st.InheritedFromObject - pb.PermissionLevel = st.PermissionLevel - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type instancePoolPermissionPb struct { - Inherited bool `json:"inherited,omitempty"` - InheritedFromObject []string `json:"inherited_from_object,omitempty"` - PermissionLevel InstancePoolPermissionLevel `json:"permission_level,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func instancePoolPermissionFromPb(pb *instancePoolPermissionPb) (*InstancePoolPermission, error) { - if pb == nil { - return nil, nil - } - st := &InstancePoolPermission{} - st.Inherited = pb.Inherited - st.InheritedFromObject = pb.InheritedFromObject - st.PermissionLevel = pb.PermissionLevel - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *instancePoolPermissionPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st instancePoolPermissionPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func instancePoolPermissionsToPb(st *InstancePoolPermissions) (*instancePoolPermissionsPb, error) { - if st == nil { - return nil, nil - } - pb := &instancePoolPermissionsPb{} - pb.AccessControlList = st.AccessControlList - pb.ObjectId = st.ObjectId - pb.ObjectType = st.ObjectType - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type instancePoolPermissionsPb struct { - AccessControlList []InstancePoolAccessControlResponse `json:"access_control_list,omitempty"` - ObjectId string `json:"object_id,omitempty"` - ObjectType string `json:"object_type,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func instancePoolPermissionsFromPb(pb *instancePoolPermissionsPb) (*InstancePoolPermissions, error) { - if pb == nil { - return nil, nil - } - st := &InstancePoolPermissions{} - st.AccessControlList = pb.AccessControlList - st.ObjectId = pb.ObjectId - st.ObjectType = pb.ObjectType - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *instancePoolPermissionsPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st instancePoolPermissionsPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func instancePoolPermissionsDescriptionToPb(st *InstancePoolPermissionsDescription) (*instancePoolPermissionsDescriptionPb, error) { - if st == nil { - return nil, nil - } - pb := &instancePoolPermissionsDescriptionPb{} - pb.Description = st.Description - pb.PermissionLevel = st.PermissionLevel - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type instancePoolPermissionsDescriptionPb struct { - Description string `json:"description,omitempty"` - PermissionLevel InstancePoolPermissionLevel `json:"permission_level,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func instancePoolPermissionsDescriptionFromPb(pb *instancePoolPermissionsDescriptionPb) (*InstancePoolPermissionsDescription, error) { - if pb == nil { - return nil, nil - } - st := &InstancePoolPermissionsDescription{} - st.Description = pb.Description - st.PermissionLevel = pb.PermissionLevel - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *instancePoolPermissionsDescriptionPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st instancePoolPermissionsDescriptionPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func instancePoolPermissionsRequestToPb(st *InstancePoolPermissionsRequest) (*instancePoolPermissionsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &instancePoolPermissionsRequestPb{} - pb.AccessControlList = st.AccessControlList - pb.InstancePoolId = st.InstancePoolId - - return pb, nil -} - -type instancePoolPermissionsRequestPb struct { - AccessControlList []InstancePoolAccessControlRequest `json:"access_control_list,omitempty"` - InstancePoolId string `json:"-" url:"-"` -} - -func instancePoolPermissionsRequestFromPb(pb *instancePoolPermissionsRequestPb) (*InstancePoolPermissionsRequest, error) { - if pb == nil { - return nil, nil - } - st := &InstancePoolPermissionsRequest{} - st.AccessControlList = pb.AccessControlList - st.InstancePoolId = pb.InstancePoolId - - return st, nil -} - -func instancePoolStatsToPb(st *InstancePoolStats) (*instancePoolStatsPb, error) { - if st == nil { - return nil, nil - } - pb := &instancePoolStatsPb{} - pb.IdleCount = st.IdleCount - pb.PendingIdleCount = st.PendingIdleCount - pb.PendingUsedCount = st.PendingUsedCount - pb.UsedCount = st.UsedCount - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type instancePoolStatsPb struct { - IdleCount int `json:"idle_count,omitempty"` - PendingIdleCount int `json:"pending_idle_count,omitempty"` - PendingUsedCount int `json:"pending_used_count,omitempty"` - UsedCount int `json:"used_count,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func instancePoolStatsFromPb(pb *instancePoolStatsPb) (*InstancePoolStats, error) { - if pb == nil { - return nil, nil - } - st := &InstancePoolStats{} - st.IdleCount = pb.IdleCount - st.PendingIdleCount = pb.PendingIdleCount - st.PendingUsedCount = pb.PendingUsedCount - st.UsedCount = pb.UsedCount - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *instancePoolStatsPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st instancePoolStatsPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func instancePoolStatusToPb(st *InstancePoolStatus) (*instancePoolStatusPb, error) { - if st == nil { - return nil, nil - } - pb := &instancePoolStatusPb{} - pb.PendingInstanceErrors = st.PendingInstanceErrors - - return pb, nil -} - -type instancePoolStatusPb struct { - PendingInstanceErrors []PendingInstanceError `json:"pending_instance_errors,omitempty"` -} - -func instancePoolStatusFromPb(pb *instancePoolStatusPb) (*InstancePoolStatus, error) { - if pb == nil { - return nil, nil - } - st := &InstancePoolStatus{} - st.PendingInstanceErrors = pb.PendingInstanceErrors - - return st, nil -} - -func instanceProfileToPb(st *InstanceProfile) (*instanceProfilePb, error) { - if st == nil { - return nil, nil - } - pb := &instanceProfilePb{} - pb.IamRoleArn = st.IamRoleArn - pb.InstanceProfileArn = st.InstanceProfileArn - pb.IsMetaInstanceProfile = st.IsMetaInstanceProfile - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type instanceProfilePb struct { - IamRoleArn string `json:"iam_role_arn,omitempty"` - InstanceProfileArn string `json:"instance_profile_arn"` - IsMetaInstanceProfile bool `json:"is_meta_instance_profile,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func instanceProfileFromPb(pb *instanceProfilePb) (*InstanceProfile, error) { - if pb == nil { - return nil, nil - } - st := &InstanceProfile{} - st.IamRoleArn = pb.IamRoleArn - st.InstanceProfileArn = pb.InstanceProfileArn - st.IsMetaInstanceProfile = pb.IsMetaInstanceProfile - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *instanceProfilePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st instanceProfilePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func libraryToPb(st *Library) (*libraryPb, error) { - if st == nil { - return nil, nil - } - pb := &libraryPb{} - pb.Cran = st.Cran - pb.Egg = st.Egg - pb.Jar = st.Jar - pb.Maven = st.Maven - pb.Pypi = st.Pypi - pb.Requirements = st.Requirements - pb.Whl = st.Whl - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type libraryPb struct { - Cran *RCranLibrary `json:"cran,omitempty"` - Egg string `json:"egg,omitempty"` - Jar string `json:"jar,omitempty"` - Maven *MavenLibrary `json:"maven,omitempty"` - Pypi *PythonPyPiLibrary `json:"pypi,omitempty"` - Requirements string `json:"requirements,omitempty"` - Whl string `json:"whl,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func libraryFromPb(pb *libraryPb) (*Library, error) { - if pb == nil { - return nil, nil - } - st := &Library{} - st.Cran = pb.Cran - st.Egg = pb.Egg - st.Jar = pb.Jar - st.Maven = pb.Maven - st.Pypi = pb.Pypi - st.Requirements = pb.Requirements - st.Whl = pb.Whl - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *libraryPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st libraryPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func libraryFullStatusToPb(st *LibraryFullStatus) (*libraryFullStatusPb, error) { - if st == nil { - return nil, nil - } - pb := &libraryFullStatusPb{} - pb.IsLibraryForAllClusters = st.IsLibraryForAllClusters - pb.Library = st.Library - pb.Messages = st.Messages - pb.Status = st.Status - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type libraryFullStatusPb struct { - IsLibraryForAllClusters bool `json:"is_library_for_all_clusters,omitempty"` - Library *Library `json:"library,omitempty"` - Messages []string `json:"messages,omitempty"` - Status LibraryInstallStatus `json:"status,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func libraryFullStatusFromPb(pb *libraryFullStatusPb) (*LibraryFullStatus, error) { - if pb == nil { - return nil, nil - } - st := &LibraryFullStatus{} - st.IsLibraryForAllClusters = pb.IsLibraryForAllClusters - st.Library = pb.Library - st.Messages = pb.Messages - st.Status = pb.Status - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *libraryFullStatusPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st libraryFullStatusPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listAllClusterLibraryStatusesResponseToPb(st *ListAllClusterLibraryStatusesResponse) (*listAllClusterLibraryStatusesResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listAllClusterLibraryStatusesResponsePb{} - pb.Statuses = st.Statuses - - return pb, nil -} - -type listAllClusterLibraryStatusesResponsePb struct { - Statuses []ClusterLibraryStatuses `json:"statuses,omitempty"` -} - -func listAllClusterLibraryStatusesResponseFromPb(pb *listAllClusterLibraryStatusesResponsePb) (*ListAllClusterLibraryStatusesResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListAllClusterLibraryStatusesResponse{} - st.Statuses = pb.Statuses - - return st, nil -} - -func listAvailableZonesResponseToPb(st *ListAvailableZonesResponse) (*listAvailableZonesResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listAvailableZonesResponsePb{} - pb.DefaultZone = st.DefaultZone - pb.Zones = st.Zones - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listAvailableZonesResponsePb struct { - DefaultZone string `json:"default_zone,omitempty"` - Zones []string `json:"zones,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listAvailableZonesResponseFromPb(pb *listAvailableZonesResponsePb) (*ListAvailableZonesResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListAvailableZonesResponse{} - st.DefaultZone = pb.DefaultZone - st.Zones = pb.Zones - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listAvailableZonesResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listAvailableZonesResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listClusterCompliancesRequestToPb(st *ListClusterCompliancesRequest) (*listClusterCompliancesRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listClusterCompliancesRequestPb{} - pb.PageSize = st.PageSize - pb.PageToken = st.PageToken - pb.PolicyId = st.PolicyId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listClusterCompliancesRequestPb struct { - PageSize int `json:"-" url:"page_size,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - PolicyId string `json:"-" url:"policy_id"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listClusterCompliancesRequestFromPb(pb *listClusterCompliancesRequestPb) (*ListClusterCompliancesRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListClusterCompliancesRequest{} - st.PageSize = pb.PageSize - st.PageToken = pb.PageToken - st.PolicyId = pb.PolicyId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listClusterCompliancesRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listClusterCompliancesRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listClusterCompliancesResponseToPb(st *ListClusterCompliancesResponse) (*listClusterCompliancesResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listClusterCompliancesResponsePb{} - pb.Clusters = st.Clusters - pb.NextPageToken = st.NextPageToken - pb.PrevPageToken = st.PrevPageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listClusterCompliancesResponsePb struct { - Clusters []ClusterCompliance `json:"clusters,omitempty"` - NextPageToken string `json:"next_page_token,omitempty"` - PrevPageToken string `json:"prev_page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listClusterCompliancesResponseFromPb(pb *listClusterCompliancesResponsePb) (*ListClusterCompliancesResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListClusterCompliancesResponse{} - st.Clusters = pb.Clusters - st.NextPageToken = pb.NextPageToken - st.PrevPageToken = pb.PrevPageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listClusterCompliancesResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listClusterCompliancesResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listClusterPoliciesRequestToPb(st *ListClusterPoliciesRequest) (*listClusterPoliciesRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listClusterPoliciesRequestPb{} - pb.SortColumn = st.SortColumn - pb.SortOrder = st.SortOrder - - return pb, nil -} - -type listClusterPoliciesRequestPb struct { - SortColumn ListSortColumn `json:"-" url:"sort_column,omitempty"` - SortOrder ListSortOrder `json:"-" url:"sort_order,omitempty"` -} - -func listClusterPoliciesRequestFromPb(pb *listClusterPoliciesRequestPb) (*ListClusterPoliciesRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListClusterPoliciesRequest{} - st.SortColumn = pb.SortColumn - st.SortOrder = pb.SortOrder - - return st, nil -} - -func listClustersFilterByToPb(st *ListClustersFilterBy) (*listClustersFilterByPb, error) { - if st == nil { - return nil, nil - } - pb := &listClustersFilterByPb{} - pb.ClusterSources = st.ClusterSources - pb.ClusterStates = st.ClusterStates - pb.IsPinned = st.IsPinned - pb.PolicyId = st.PolicyId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listClustersFilterByPb struct { - ClusterSources []ClusterSource `json:"cluster_sources,omitempty" url:"cluster_sources,omitempty"` - ClusterStates []State `json:"cluster_states,omitempty" url:"cluster_states,omitempty"` - IsPinned bool `json:"is_pinned,omitempty" url:"is_pinned,omitempty"` - PolicyId string `json:"policy_id,omitempty" url:"policy_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listClustersFilterByFromPb(pb *listClustersFilterByPb) (*ListClustersFilterBy, error) { - if pb == nil { - return nil, nil - } - st := &ListClustersFilterBy{} - st.ClusterSources = pb.ClusterSources - st.ClusterStates = pb.ClusterStates - st.IsPinned = pb.IsPinned - st.PolicyId = pb.PolicyId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listClustersFilterByPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listClustersFilterByPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listClustersRequestToPb(st *ListClustersRequest) (*listClustersRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listClustersRequestPb{} - pb.FilterBy = st.FilterBy - pb.PageSize = st.PageSize - pb.PageToken = st.PageToken - pb.SortBy = st.SortBy - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listClustersRequestPb struct { - FilterBy *ListClustersFilterBy `json:"-" url:"filter_by,omitempty"` - PageSize int `json:"-" url:"page_size,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - SortBy *ListClustersSortBy `json:"-" url:"sort_by,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listClustersRequestFromPb(pb *listClustersRequestPb) (*ListClustersRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListClustersRequest{} - st.FilterBy = pb.FilterBy - st.PageSize = pb.PageSize - st.PageToken = pb.PageToken - st.SortBy = pb.SortBy - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listClustersRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listClustersRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listClustersResponseToPb(st *ListClustersResponse) (*listClustersResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listClustersResponsePb{} - pb.Clusters = st.Clusters - pb.NextPageToken = st.NextPageToken - pb.PrevPageToken = st.PrevPageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listClustersResponsePb struct { - Clusters []ClusterDetails `json:"clusters,omitempty"` - NextPageToken string `json:"next_page_token,omitempty"` - PrevPageToken string `json:"prev_page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listClustersResponseFromPb(pb *listClustersResponsePb) (*ListClustersResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListClustersResponse{} - st.Clusters = pb.Clusters - st.NextPageToken = pb.NextPageToken - st.PrevPageToken = pb.PrevPageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listClustersResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listClustersResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listClustersSortByToPb(st *ListClustersSortBy) (*listClustersSortByPb, error) { - if st == nil { - return nil, nil - } - pb := &listClustersSortByPb{} - pb.Direction = st.Direction - pb.Field = st.Field - - return pb, nil -} - -type listClustersSortByPb struct { - Direction ListClustersSortByDirection `json:"direction,omitempty" url:"direction,omitempty"` - Field ListClustersSortByField `json:"field,omitempty" url:"field,omitempty"` -} - -func listClustersSortByFromPb(pb *listClustersSortByPb) (*ListClustersSortBy, error) { - if pb == nil { - return nil, nil - } - st := &ListClustersSortBy{} - st.Direction = pb.Direction - st.Field = pb.Field - - return st, nil -} - -func listGlobalInitScriptsResponseToPb(st *ListGlobalInitScriptsResponse) (*listGlobalInitScriptsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listGlobalInitScriptsResponsePb{} - pb.Scripts = st.Scripts - - return pb, nil -} - -type listGlobalInitScriptsResponsePb struct { - Scripts []GlobalInitScriptDetails `json:"scripts,omitempty"` -} - -func listGlobalInitScriptsResponseFromPb(pb *listGlobalInitScriptsResponsePb) (*ListGlobalInitScriptsResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListGlobalInitScriptsResponse{} - st.Scripts = pb.Scripts - - return st, nil -} - -func listInstancePoolsToPb(st *ListInstancePools) (*listInstancePoolsPb, error) { - if st == nil { - return nil, nil - } - pb := &listInstancePoolsPb{} - pb.InstancePools = st.InstancePools - - return pb, nil -} - -type listInstancePoolsPb struct { - InstancePools []InstancePoolAndStats `json:"instance_pools,omitempty"` -} - -func listInstancePoolsFromPb(pb *listInstancePoolsPb) (*ListInstancePools, error) { - if pb == nil { - return nil, nil - } - st := &ListInstancePools{} - st.InstancePools = pb.InstancePools - - return st, nil -} - -func listInstanceProfilesResponseToPb(st *ListInstanceProfilesResponse) (*listInstanceProfilesResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listInstanceProfilesResponsePb{} - pb.InstanceProfiles = st.InstanceProfiles - - return pb, nil -} - -type listInstanceProfilesResponsePb struct { - InstanceProfiles []InstanceProfile `json:"instance_profiles,omitempty"` -} - -func listInstanceProfilesResponseFromPb(pb *listInstanceProfilesResponsePb) (*ListInstanceProfilesResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListInstanceProfilesResponse{} - st.InstanceProfiles = pb.InstanceProfiles - - return st, nil -} - -func listNodeTypesResponseToPb(st *ListNodeTypesResponse) (*listNodeTypesResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listNodeTypesResponsePb{} - pb.NodeTypes = st.NodeTypes - - return pb, nil -} - -type listNodeTypesResponsePb struct { - NodeTypes []NodeType `json:"node_types,omitempty"` -} - -func listNodeTypesResponseFromPb(pb *listNodeTypesResponsePb) (*ListNodeTypesResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListNodeTypesResponse{} - st.NodeTypes = pb.NodeTypes - - return st, nil -} - -func listPoliciesResponseToPb(st *ListPoliciesResponse) (*listPoliciesResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listPoliciesResponsePb{} - pb.Policies = st.Policies - - return pb, nil -} - -type listPoliciesResponsePb struct { - Policies []Policy `json:"policies,omitempty"` -} - -func listPoliciesResponseFromPb(pb *listPoliciesResponsePb) (*ListPoliciesResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListPoliciesResponse{} - st.Policies = pb.Policies - - return st, nil -} - -func listPolicyFamiliesRequestToPb(st *ListPolicyFamiliesRequest) (*listPolicyFamiliesRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listPolicyFamiliesRequestPb{} - pb.MaxResults = st.MaxResults - pb.PageToken = st.PageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listPolicyFamiliesRequestPb struct { - MaxResults int64 `json:"-" url:"max_results,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listPolicyFamiliesRequestFromPb(pb *listPolicyFamiliesRequestPb) (*ListPolicyFamiliesRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListPolicyFamiliesRequest{} - st.MaxResults = pb.MaxResults - st.PageToken = pb.PageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listPolicyFamiliesRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listPolicyFamiliesRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listPolicyFamiliesResponseToPb(st *ListPolicyFamiliesResponse) (*listPolicyFamiliesResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listPolicyFamiliesResponsePb{} - pb.NextPageToken = st.NextPageToken - pb.PolicyFamilies = st.PolicyFamilies - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listPolicyFamiliesResponsePb struct { - NextPageToken string `json:"next_page_token,omitempty"` - PolicyFamilies []PolicyFamily `json:"policy_families,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listPolicyFamiliesResponseFromPb(pb *listPolicyFamiliesResponsePb) (*ListPolicyFamiliesResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListPolicyFamiliesResponse{} - st.NextPageToken = pb.NextPageToken - st.PolicyFamilies = pb.PolicyFamilies - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listPolicyFamiliesResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listPolicyFamiliesResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func localFileInfoToPb(st *LocalFileInfo) (*localFileInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &localFileInfoPb{} - pb.Destination = st.Destination - - return pb, nil -} - -type localFileInfoPb struct { - Destination string `json:"destination"` -} - -func localFileInfoFromPb(pb *localFileInfoPb) (*LocalFileInfo, error) { - if pb == nil { - return nil, nil - } - st := &LocalFileInfo{} - st.Destination = pb.Destination - - return st, nil -} - -func logAnalyticsInfoToPb(st *LogAnalyticsInfo) (*logAnalyticsInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &logAnalyticsInfoPb{} - pb.LogAnalyticsPrimaryKey = st.LogAnalyticsPrimaryKey - pb.LogAnalyticsWorkspaceId = st.LogAnalyticsWorkspaceId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type logAnalyticsInfoPb struct { - LogAnalyticsPrimaryKey string `json:"log_analytics_primary_key,omitempty"` - LogAnalyticsWorkspaceId string `json:"log_analytics_workspace_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func logAnalyticsInfoFromPb(pb *logAnalyticsInfoPb) (*LogAnalyticsInfo, error) { - if pb == nil { - return nil, nil - } - st := &LogAnalyticsInfo{} - st.LogAnalyticsPrimaryKey = pb.LogAnalyticsPrimaryKey - st.LogAnalyticsWorkspaceId = pb.LogAnalyticsWorkspaceId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *logAnalyticsInfoPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st logAnalyticsInfoPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func logSyncStatusToPb(st *LogSyncStatus) (*logSyncStatusPb, error) { - if st == nil { - return nil, nil - } - pb := &logSyncStatusPb{} - pb.LastAttempted = st.LastAttempted - pb.LastException = st.LastException - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type logSyncStatusPb struct { - LastAttempted int64 `json:"last_attempted,omitempty"` - LastException string `json:"last_exception,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func logSyncStatusFromPb(pb *logSyncStatusPb) (*LogSyncStatus, error) { - if pb == nil { - return nil, nil - } - st := &LogSyncStatus{} - st.LastAttempted = pb.LastAttempted - st.LastException = pb.LastException - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *logSyncStatusPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st logSyncStatusPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -type mapAnyPb MapAny - -func mapAnyToPb(st *MapAny) (*mapAnyPb, error) { - if st == nil { - return nil, nil - } - stPb := mapAnyPb(*st) - return &stPb, nil -} - -func mapAnyFromPb(stPb *mapAnyPb) (*MapAny, error) { - if stPb == nil { - return nil, nil - } - st := MapAny(*stPb) - return &st, nil -} - -func mavenLibraryToPb(st *MavenLibrary) (*mavenLibraryPb, error) { - if st == nil { - return nil, nil - } - pb := &mavenLibraryPb{} - pb.Coordinates = st.Coordinates - pb.Exclusions = st.Exclusions - pb.Repo = st.Repo - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type mavenLibraryPb struct { - Coordinates string `json:"coordinates"` - Exclusions []string `json:"exclusions,omitempty"` - Repo string `json:"repo,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func mavenLibraryFromPb(pb *mavenLibraryPb) (*MavenLibrary, error) { - if pb == nil { - return nil, nil - } - st := &MavenLibrary{} - st.Coordinates = pb.Coordinates - st.Exclusions = pb.Exclusions - st.Repo = pb.Repo - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *mavenLibraryPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st mavenLibraryPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func nodeInstanceTypeToPb(st *NodeInstanceType) (*nodeInstanceTypePb, error) { - if st == nil { - return nil, nil - } - pb := &nodeInstanceTypePb{} - pb.InstanceTypeId = st.InstanceTypeId - pb.LocalDiskSizeGb = st.LocalDiskSizeGb - pb.LocalDisks = st.LocalDisks - pb.LocalNvmeDiskSizeGb = st.LocalNvmeDiskSizeGb - pb.LocalNvmeDisks = st.LocalNvmeDisks - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type nodeInstanceTypePb struct { - InstanceTypeId string `json:"instance_type_id"` - LocalDiskSizeGb int `json:"local_disk_size_gb,omitempty"` - LocalDisks int `json:"local_disks,omitempty"` - LocalNvmeDiskSizeGb int `json:"local_nvme_disk_size_gb,omitempty"` - LocalNvmeDisks int `json:"local_nvme_disks,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func nodeInstanceTypeFromPb(pb *nodeInstanceTypePb) (*NodeInstanceType, error) { - if pb == nil { - return nil, nil - } - st := &NodeInstanceType{} - st.InstanceTypeId = pb.InstanceTypeId - st.LocalDiskSizeGb = pb.LocalDiskSizeGb - st.LocalDisks = pb.LocalDisks - st.LocalNvmeDiskSizeGb = pb.LocalNvmeDiskSizeGb - st.LocalNvmeDisks = pb.LocalNvmeDisks - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *nodeInstanceTypePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st nodeInstanceTypePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func nodeTypeToPb(st *NodeType) (*nodeTypePb, error) { - if st == nil { - return nil, nil - } - pb := &nodeTypePb{} - pb.Category = st.Category - pb.Description = st.Description - pb.DisplayOrder = st.DisplayOrder - pb.InstanceTypeId = st.InstanceTypeId - pb.IsDeprecated = st.IsDeprecated - pb.IsEncryptedInTransit = st.IsEncryptedInTransit - pb.IsGraviton = st.IsGraviton - pb.IsHidden = st.IsHidden - pb.IsIoCacheEnabled = st.IsIoCacheEnabled - pb.MemoryMb = st.MemoryMb - pb.NodeInfo = st.NodeInfo - pb.NodeInstanceType = st.NodeInstanceType - pb.NodeTypeId = st.NodeTypeId - pb.NumCores = st.NumCores - pb.NumGpus = st.NumGpus - pb.PhotonDriverCapable = st.PhotonDriverCapable - pb.PhotonWorkerCapable = st.PhotonWorkerCapable - pb.SupportClusterTags = st.SupportClusterTags - pb.SupportEbsVolumes = st.SupportEbsVolumes - pb.SupportPortForwarding = st.SupportPortForwarding - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type nodeTypePb struct { - Category string `json:"category"` - Description string `json:"description"` - DisplayOrder int `json:"display_order,omitempty"` - InstanceTypeId string `json:"instance_type_id"` - IsDeprecated bool `json:"is_deprecated,omitempty"` - IsEncryptedInTransit bool `json:"is_encrypted_in_transit,omitempty"` - IsGraviton bool `json:"is_graviton,omitempty"` - IsHidden bool `json:"is_hidden,omitempty"` - IsIoCacheEnabled bool `json:"is_io_cache_enabled,omitempty"` - MemoryMb int `json:"memory_mb"` - NodeInfo *CloudProviderNodeInfo `json:"node_info,omitempty"` - NodeInstanceType *NodeInstanceType `json:"node_instance_type,omitempty"` - NodeTypeId string `json:"node_type_id"` - NumCores float64 `json:"num_cores"` - NumGpus int `json:"num_gpus,omitempty"` - PhotonDriverCapable bool `json:"photon_driver_capable,omitempty"` - PhotonWorkerCapable bool `json:"photon_worker_capable,omitempty"` - SupportClusterTags bool `json:"support_cluster_tags,omitempty"` - SupportEbsVolumes bool `json:"support_ebs_volumes,omitempty"` - SupportPortForwarding bool `json:"support_port_forwarding,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func nodeTypeFromPb(pb *nodeTypePb) (*NodeType, error) { - if pb == nil { - return nil, nil - } - st := &NodeType{} - st.Category = pb.Category - st.Description = pb.Description - st.DisplayOrder = pb.DisplayOrder - st.InstanceTypeId = pb.InstanceTypeId - st.IsDeprecated = pb.IsDeprecated - st.IsEncryptedInTransit = pb.IsEncryptedInTransit - st.IsGraviton = pb.IsGraviton - st.IsHidden = pb.IsHidden - st.IsIoCacheEnabled = pb.IsIoCacheEnabled - st.MemoryMb = pb.MemoryMb - st.NodeInfo = pb.NodeInfo - st.NodeInstanceType = pb.NodeInstanceType - st.NodeTypeId = pb.NodeTypeId - st.NumCores = pb.NumCores - st.NumGpus = pb.NumGpus - st.PhotonDriverCapable = pb.PhotonDriverCapable - st.PhotonWorkerCapable = pb.PhotonWorkerCapable - st.SupportClusterTags = pb.SupportClusterTags - st.SupportEbsVolumes = pb.SupportEbsVolumes - st.SupportPortForwarding = pb.SupportPortForwarding - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *nodeTypePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st nodeTypePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func pendingInstanceErrorToPb(st *PendingInstanceError) (*pendingInstanceErrorPb, error) { - if st == nil { - return nil, nil - } - pb := &pendingInstanceErrorPb{} - pb.InstanceId = st.InstanceId - pb.Message = st.Message - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type pendingInstanceErrorPb struct { - InstanceId string `json:"instance_id,omitempty"` - Message string `json:"message,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func pendingInstanceErrorFromPb(pb *pendingInstanceErrorPb) (*PendingInstanceError, error) { - if pb == nil { - return nil, nil - } - st := &PendingInstanceError{} - st.InstanceId = pb.InstanceId - st.Message = pb.Message - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *pendingInstanceErrorPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st pendingInstanceErrorPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func permanentDeleteClusterToPb(st *PermanentDeleteCluster) (*permanentDeleteClusterPb, error) { - if st == nil { - return nil, nil - } - pb := &permanentDeleteClusterPb{} - pb.ClusterId = st.ClusterId - - return pb, nil -} - -type permanentDeleteClusterPb struct { - ClusterId string `json:"cluster_id"` -} - -func permanentDeleteClusterFromPb(pb *permanentDeleteClusterPb) (*PermanentDeleteCluster, error) { - if pb == nil { - return nil, nil - } - st := &PermanentDeleteCluster{} - st.ClusterId = pb.ClusterId - - return st, nil -} - -func permanentDeleteClusterResponseToPb(st *PermanentDeleteClusterResponse) (*permanentDeleteClusterResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &permanentDeleteClusterResponsePb{} - - return pb, nil -} - -type permanentDeleteClusterResponsePb struct { -} - -func permanentDeleteClusterResponseFromPb(pb *permanentDeleteClusterResponsePb) (*PermanentDeleteClusterResponse, error) { - if pb == nil { - return nil, nil - } - st := &PermanentDeleteClusterResponse{} - - return st, nil -} - -func pinClusterToPb(st *PinCluster) (*pinClusterPb, error) { - if st == nil { - return nil, nil - } - pb := &pinClusterPb{} - pb.ClusterId = st.ClusterId - - return pb, nil -} - -type pinClusterPb struct { - ClusterId string `json:"cluster_id"` -} - -func pinClusterFromPb(pb *pinClusterPb) (*PinCluster, error) { - if pb == nil { - return nil, nil - } - st := &PinCluster{} - st.ClusterId = pb.ClusterId - - return st, nil -} - -func pinClusterResponseToPb(st *PinClusterResponse) (*pinClusterResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &pinClusterResponsePb{} - - return pb, nil -} - -type pinClusterResponsePb struct { -} - -func pinClusterResponseFromPb(pb *pinClusterResponsePb) (*PinClusterResponse, error) { - if pb == nil { - return nil, nil - } - st := &PinClusterResponse{} - - return st, nil -} - -func policyToPb(st *Policy) (*policyPb, error) { - if st == nil { - return nil, nil - } - pb := &policyPb{} - pb.CreatedAtTimestamp = st.CreatedAtTimestamp - pb.CreatorUserName = st.CreatorUserName - pb.Definition = st.Definition - pb.Description = st.Description - pb.IsDefault = st.IsDefault - pb.Libraries = st.Libraries - pb.MaxClustersPerUser = st.MaxClustersPerUser - pb.Name = st.Name - pb.PolicyFamilyDefinitionOverrides = st.PolicyFamilyDefinitionOverrides - pb.PolicyFamilyId = st.PolicyFamilyId - pb.PolicyId = st.PolicyId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type policyPb struct { - CreatedAtTimestamp int64 `json:"created_at_timestamp,omitempty"` - CreatorUserName string `json:"creator_user_name,omitempty"` - Definition string `json:"definition,omitempty"` - Description string `json:"description,omitempty"` - IsDefault bool `json:"is_default,omitempty"` - Libraries []Library `json:"libraries,omitempty"` - MaxClustersPerUser int64 `json:"max_clusters_per_user,omitempty"` - Name string `json:"name,omitempty"` - PolicyFamilyDefinitionOverrides string `json:"policy_family_definition_overrides,omitempty"` - PolicyFamilyId string `json:"policy_family_id,omitempty"` - PolicyId string `json:"policy_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func policyFromPb(pb *policyPb) (*Policy, error) { - if pb == nil { - return nil, nil - } - st := &Policy{} - st.CreatedAtTimestamp = pb.CreatedAtTimestamp - st.CreatorUserName = pb.CreatorUserName - st.Definition = pb.Definition - st.Description = pb.Description - st.IsDefault = pb.IsDefault - st.Libraries = pb.Libraries - st.MaxClustersPerUser = pb.MaxClustersPerUser - st.Name = pb.Name - st.PolicyFamilyDefinitionOverrides = pb.PolicyFamilyDefinitionOverrides - st.PolicyFamilyId = pb.PolicyFamilyId - st.PolicyId = pb.PolicyId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *policyPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st policyPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func policyFamilyToPb(st *PolicyFamily) (*policyFamilyPb, error) { - if st == nil { - return nil, nil - } - pb := &policyFamilyPb{} - pb.Definition = st.Definition - pb.Description = st.Description - pb.Name = st.Name - pb.PolicyFamilyId = st.PolicyFamilyId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type policyFamilyPb struct { - Definition string `json:"definition,omitempty"` - Description string `json:"description,omitempty"` - Name string `json:"name,omitempty"` - PolicyFamilyId string `json:"policy_family_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func policyFamilyFromPb(pb *policyFamilyPb) (*PolicyFamily, error) { - if pb == nil { - return nil, nil - } - st := &PolicyFamily{} - st.Definition = pb.Definition - st.Description = pb.Description - st.Name = pb.Name - st.PolicyFamilyId = pb.PolicyFamilyId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *policyFamilyPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st policyFamilyPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func pythonPyPiLibraryToPb(st *PythonPyPiLibrary) (*pythonPyPiLibraryPb, error) { - if st == nil { - return nil, nil - } - pb := &pythonPyPiLibraryPb{} - pb.Package = st.Package - pb.Repo = st.Repo - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type pythonPyPiLibraryPb struct { - Package string `json:"package"` - Repo string `json:"repo,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func pythonPyPiLibraryFromPb(pb *pythonPyPiLibraryPb) (*PythonPyPiLibrary, error) { - if pb == nil { - return nil, nil - } - st := &PythonPyPiLibrary{} - st.Package = pb.Package - st.Repo = pb.Repo - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *pythonPyPiLibraryPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st pythonPyPiLibraryPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func rCranLibraryToPb(st *RCranLibrary) (*rCranLibraryPb, error) { - if st == nil { - return nil, nil - } - pb := &rCranLibraryPb{} - pb.Package = st.Package - pb.Repo = st.Repo - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type rCranLibraryPb struct { - Package string `json:"package"` - Repo string `json:"repo,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func rCranLibraryFromPb(pb *rCranLibraryPb) (*RCranLibrary, error) { - if pb == nil { - return nil, nil - } - st := &RCranLibrary{} - st.Package = pb.Package - st.Repo = pb.Repo - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *rCranLibraryPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st rCranLibraryPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func removeInstanceProfileToPb(st *RemoveInstanceProfile) (*removeInstanceProfilePb, error) { - if st == nil { - return nil, nil - } - pb := &removeInstanceProfilePb{} - pb.InstanceProfileArn = st.InstanceProfileArn - - return pb, nil -} - -type removeInstanceProfilePb struct { - InstanceProfileArn string `json:"instance_profile_arn"` -} - -func removeInstanceProfileFromPb(pb *removeInstanceProfilePb) (*RemoveInstanceProfile, error) { - if pb == nil { - return nil, nil - } - st := &RemoveInstanceProfile{} - st.InstanceProfileArn = pb.InstanceProfileArn - - return st, nil -} - -func removeResponseToPb(st *RemoveResponse) (*removeResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &removeResponsePb{} - - return pb, nil -} - -type removeResponsePb struct { -} - -func removeResponseFromPb(pb *removeResponsePb) (*RemoveResponse, error) { - if pb == nil { - return nil, nil - } - st := &RemoveResponse{} - - return st, nil -} - -func resizeClusterToPb(st *ResizeCluster) (*resizeClusterPb, error) { - if st == nil { - return nil, nil - } - pb := &resizeClusterPb{} - pb.Autoscale = st.Autoscale - pb.ClusterId = st.ClusterId - pb.NumWorkers = st.NumWorkers - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type resizeClusterPb struct { - Autoscale *AutoScale `json:"autoscale,omitempty"` - ClusterId string `json:"cluster_id"` - NumWorkers int `json:"num_workers,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func resizeClusterFromPb(pb *resizeClusterPb) (*ResizeCluster, error) { - if pb == nil { - return nil, nil - } - st := &ResizeCluster{} - st.Autoscale = pb.Autoscale - st.ClusterId = pb.ClusterId - st.NumWorkers = pb.NumWorkers - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *resizeClusterPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st resizeClusterPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func resizeClusterResponseToPb(st *ResizeClusterResponse) (*resizeClusterResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &resizeClusterResponsePb{} - - return pb, nil -} - -type resizeClusterResponsePb struct { -} - -func resizeClusterResponseFromPb(pb *resizeClusterResponsePb) (*ResizeClusterResponse, error) { - if pb == nil { - return nil, nil - } - st := &ResizeClusterResponse{} - - return st, nil -} - -func restartClusterToPb(st *RestartCluster) (*restartClusterPb, error) { - if st == nil { - return nil, nil - } - pb := &restartClusterPb{} - pb.ClusterId = st.ClusterId - pb.RestartUser = st.RestartUser - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type restartClusterPb struct { - ClusterId string `json:"cluster_id"` - RestartUser string `json:"restart_user,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func restartClusterFromPb(pb *restartClusterPb) (*RestartCluster, error) { - if pb == nil { - return nil, nil - } - st := &RestartCluster{} - st.ClusterId = pb.ClusterId - st.RestartUser = pb.RestartUser - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *restartClusterPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st restartClusterPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func restartClusterResponseToPb(st *RestartClusterResponse) (*restartClusterResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &restartClusterResponsePb{} - - return pb, nil -} - -type restartClusterResponsePb struct { -} - -func restartClusterResponseFromPb(pb *restartClusterResponsePb) (*RestartClusterResponse, error) { - if pb == nil { - return nil, nil - } - st := &RestartClusterResponse{} - - return st, nil -} - -func resultsToPb(st *Results) (*resultsPb, error) { - if st == nil { - return nil, nil - } - pb := &resultsPb{} - pb.Cause = st.Cause - pb.Data = st.Data - pb.FileName = st.FileName - pb.FileNames = st.FileNames - pb.IsJsonSchema = st.IsJsonSchema - pb.Pos = st.Pos - pb.ResultType = st.ResultType - pb.Schema = st.Schema - pb.Summary = st.Summary - pb.Truncated = st.Truncated - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type resultsPb struct { - Cause string `json:"cause,omitempty"` - Data any `json:"data,omitempty"` - FileName string `json:"fileName,omitempty"` - FileNames []string `json:"fileNames,omitempty"` - IsJsonSchema bool `json:"isJsonSchema,omitempty"` - Pos int `json:"pos,omitempty"` - ResultType ResultType `json:"resultType,omitempty"` - Schema []map[string]any `json:"schema,omitempty"` - Summary string `json:"summary,omitempty"` - Truncated bool `json:"truncated,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func resultsFromPb(pb *resultsPb) (*Results, error) { - if pb == nil { - return nil, nil - } - st := &Results{} - st.Cause = pb.Cause - st.Data = pb.Data - st.FileName = pb.FileName - st.FileNames = pb.FileNames - st.IsJsonSchema = pb.IsJsonSchema - st.Pos = pb.Pos - st.ResultType = pb.ResultType - st.Schema = pb.Schema - st.Summary = pb.Summary - st.Truncated = pb.Truncated - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *resultsPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st resultsPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func s3StorageInfoToPb(st *S3StorageInfo) (*s3StorageInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &s3StorageInfoPb{} - pb.CannedAcl = st.CannedAcl - pb.Destination = st.Destination - pb.EnableEncryption = st.EnableEncryption - pb.EncryptionType = st.EncryptionType - pb.Endpoint = st.Endpoint - pb.KmsKey = st.KmsKey - pb.Region = st.Region - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type s3StorageInfoPb struct { - CannedAcl string `json:"canned_acl,omitempty"` - Destination string `json:"destination"` - EnableEncryption bool `json:"enable_encryption,omitempty"` - EncryptionType string `json:"encryption_type,omitempty"` - Endpoint string `json:"endpoint,omitempty"` - KmsKey string `json:"kms_key,omitempty"` - Region string `json:"region,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func s3StorageInfoFromPb(pb *s3StorageInfoPb) (*S3StorageInfo, error) { - if pb == nil { - return nil, nil - } - st := &S3StorageInfo{} - st.CannedAcl = pb.CannedAcl - st.Destination = pb.Destination - st.EnableEncryption = pb.EnableEncryption - st.EncryptionType = pb.EncryptionType - st.Endpoint = pb.Endpoint - st.KmsKey = pb.KmsKey - st.Region = pb.Region - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *s3StorageInfoPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st s3StorageInfoPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func sparkNodeToPb(st *SparkNode) (*sparkNodePb, error) { - if st == nil { - return nil, nil - } - pb := &sparkNodePb{} - pb.HostPrivateIp = st.HostPrivateIp - pb.InstanceId = st.InstanceId - pb.NodeAwsAttributes = st.NodeAwsAttributes - pb.NodeId = st.NodeId - pb.PrivateIp = st.PrivateIp - pb.PublicDns = st.PublicDns - pb.StartTimestamp = st.StartTimestamp - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type sparkNodePb struct { - HostPrivateIp string `json:"host_private_ip,omitempty"` - InstanceId string `json:"instance_id,omitempty"` - NodeAwsAttributes *SparkNodeAwsAttributes `json:"node_aws_attributes,omitempty"` - NodeId string `json:"node_id,omitempty"` - PrivateIp string `json:"private_ip,omitempty"` - PublicDns string `json:"public_dns,omitempty"` - StartTimestamp int64 `json:"start_timestamp,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func sparkNodeFromPb(pb *sparkNodePb) (*SparkNode, error) { - if pb == nil { - return nil, nil - } - st := &SparkNode{} - st.HostPrivateIp = pb.HostPrivateIp - st.InstanceId = pb.InstanceId - st.NodeAwsAttributes = pb.NodeAwsAttributes - st.NodeId = pb.NodeId - st.PrivateIp = pb.PrivateIp - st.PublicDns = pb.PublicDns - st.StartTimestamp = pb.StartTimestamp - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *sparkNodePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st sparkNodePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func sparkNodeAwsAttributesToPb(st *SparkNodeAwsAttributes) (*sparkNodeAwsAttributesPb, error) { - if st == nil { - return nil, nil - } - pb := &sparkNodeAwsAttributesPb{} - pb.IsSpot = st.IsSpot - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type sparkNodeAwsAttributesPb struct { - IsSpot bool `json:"is_spot,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func sparkNodeAwsAttributesFromPb(pb *sparkNodeAwsAttributesPb) (*SparkNodeAwsAttributes, error) { - if pb == nil { - return nil, nil - } - st := &SparkNodeAwsAttributes{} - st.IsSpot = pb.IsSpot - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *sparkNodeAwsAttributesPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st sparkNodeAwsAttributesPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func sparkVersionToPb(st *SparkVersion) (*sparkVersionPb, error) { - if st == nil { - return nil, nil - } - pb := &sparkVersionPb{} - pb.Key = st.Key - pb.Name = st.Name - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type sparkVersionPb struct { - Key string `json:"key,omitempty"` - Name string `json:"name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func sparkVersionFromPb(pb *sparkVersionPb) (*SparkVersion, error) { - if pb == nil { - return nil, nil - } - st := &SparkVersion{} - st.Key = pb.Key - st.Name = pb.Name - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *sparkVersionPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st sparkVersionPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func startClusterToPb(st *StartCluster) (*startClusterPb, error) { - if st == nil { - return nil, nil - } - pb := &startClusterPb{} - pb.ClusterId = st.ClusterId - - return pb, nil -} - -type startClusterPb struct { - ClusterId string `json:"cluster_id"` -} - -func startClusterFromPb(pb *startClusterPb) (*StartCluster, error) { - if pb == nil { - return nil, nil - } - st := &StartCluster{} - st.ClusterId = pb.ClusterId - - return st, nil -} - -func startClusterResponseToPb(st *StartClusterResponse) (*startClusterResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &startClusterResponsePb{} - - return pb, nil -} - -type startClusterResponsePb struct { -} - -func startClusterResponseFromPb(pb *startClusterResponsePb) (*StartClusterResponse, error) { - if pb == nil { - return nil, nil - } - st := &StartClusterResponse{} - - return st, nil -} - -func terminationReasonToPb(st *TerminationReason) (*terminationReasonPb, error) { - if st == nil { - return nil, nil - } - pb := &terminationReasonPb{} - pb.Code = st.Code - pb.Parameters = st.Parameters - pb.Type = st.Type - - return pb, nil -} - -type terminationReasonPb struct { - Code TerminationReasonCode `json:"code,omitempty"` - Parameters map[string]string `json:"parameters,omitempty"` - Type TerminationReasonType `json:"type,omitempty"` -} - -func terminationReasonFromPb(pb *terminationReasonPb) (*TerminationReason, error) { - if pb == nil { - return nil, nil - } - st := &TerminationReason{} - st.Code = pb.Code - st.Parameters = pb.Parameters - st.Type = pb.Type - - return st, nil -} - -func uninstallLibrariesToPb(st *UninstallLibraries) (*uninstallLibrariesPb, error) { - if st == nil { - return nil, nil - } - pb := &uninstallLibrariesPb{} - pb.ClusterId = st.ClusterId - pb.Libraries = st.Libraries - - return pb, nil -} - -type uninstallLibrariesPb struct { - ClusterId string `json:"cluster_id"` - Libraries []Library `json:"libraries"` -} - -func uninstallLibrariesFromPb(pb *uninstallLibrariesPb) (*UninstallLibraries, error) { - if pb == nil { - return nil, nil - } - st := &UninstallLibraries{} - st.ClusterId = pb.ClusterId - st.Libraries = pb.Libraries - - return st, nil -} - -func uninstallLibrariesResponseToPb(st *UninstallLibrariesResponse) (*uninstallLibrariesResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &uninstallLibrariesResponsePb{} - - return pb, nil -} - -type uninstallLibrariesResponsePb struct { -} - -func uninstallLibrariesResponseFromPb(pb *uninstallLibrariesResponsePb) (*UninstallLibrariesResponse, error) { - if pb == nil { - return nil, nil - } - st := &UninstallLibrariesResponse{} - - return st, nil -} - -func unpinClusterToPb(st *UnpinCluster) (*unpinClusterPb, error) { - if st == nil { - return nil, nil - } - pb := &unpinClusterPb{} - pb.ClusterId = st.ClusterId - - return pb, nil -} - -type unpinClusterPb struct { - ClusterId string `json:"cluster_id"` -} - -func unpinClusterFromPb(pb *unpinClusterPb) (*UnpinCluster, error) { - if pb == nil { - return nil, nil - } - st := &UnpinCluster{} - st.ClusterId = pb.ClusterId - - return st, nil -} - -func unpinClusterResponseToPb(st *UnpinClusterResponse) (*unpinClusterResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &unpinClusterResponsePb{} - - return pb, nil -} - -type unpinClusterResponsePb struct { -} - -func unpinClusterResponseFromPb(pb *unpinClusterResponsePb) (*UnpinClusterResponse, error) { - if pb == nil { - return nil, nil - } - st := &UnpinClusterResponse{} - - return st, nil -} - -func updateClusterToPb(st *UpdateCluster) (*updateClusterPb, error) { - if st == nil { - return nil, nil - } - pb := &updateClusterPb{} - pb.Cluster = st.Cluster - pb.ClusterId = st.ClusterId - pb.UpdateMask = st.UpdateMask - - return pb, nil -} - -type updateClusterPb struct { - Cluster *UpdateClusterResource `json:"cluster,omitempty"` - ClusterId string `json:"cluster_id"` - UpdateMask string `json:"update_mask"` -} - -func updateClusterFromPb(pb *updateClusterPb) (*UpdateCluster, error) { - if pb == nil { - return nil, nil - } - st := &UpdateCluster{} - st.Cluster = pb.Cluster - st.ClusterId = pb.ClusterId - st.UpdateMask = pb.UpdateMask - - return st, nil -} - -func updateClusterResourceToPb(st *UpdateClusterResource) (*updateClusterResourcePb, error) { - if st == nil { - return nil, nil - } - pb := &updateClusterResourcePb{} - pb.Autoscale = st.Autoscale - pb.AutoterminationMinutes = st.AutoterminationMinutes - pb.AwsAttributes = st.AwsAttributes - pb.AzureAttributes = st.AzureAttributes - pb.ClusterLogConf = st.ClusterLogConf - pb.ClusterName = st.ClusterName - pb.CustomTags = st.CustomTags - pb.DataSecurityMode = st.DataSecurityMode - pb.DockerImage = st.DockerImage - pb.DriverInstancePoolId = st.DriverInstancePoolId - pb.DriverNodeTypeId = st.DriverNodeTypeId - pb.EnableElasticDisk = st.EnableElasticDisk - pb.EnableLocalDiskEncryption = st.EnableLocalDiskEncryption - pb.GcpAttributes = st.GcpAttributes - pb.InitScripts = st.InitScripts - pb.InstancePoolId = st.InstancePoolId - pb.IsSingleNode = st.IsSingleNode - pb.Kind = st.Kind - pb.NodeTypeId = st.NodeTypeId - pb.NumWorkers = st.NumWorkers - pb.PolicyId = st.PolicyId - pb.RemoteDiskThroughput = st.RemoteDiskThroughput - pb.RuntimeEngine = st.RuntimeEngine - pb.SingleUserName = st.SingleUserName - pb.SparkConf = st.SparkConf - pb.SparkEnvVars = st.SparkEnvVars - pb.SparkVersion = st.SparkVersion - pb.SshPublicKeys = st.SshPublicKeys - pb.TotalInitialRemoteDiskSize = st.TotalInitialRemoteDiskSize - pb.UseMlRuntime = st.UseMlRuntime - pb.WorkloadType = st.WorkloadType - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type updateClusterResourcePb struct { - Autoscale *AutoScale `json:"autoscale,omitempty"` - AutoterminationMinutes int `json:"autotermination_minutes,omitempty"` - AwsAttributes *AwsAttributes `json:"aws_attributes,omitempty"` - AzureAttributes *AzureAttributes `json:"azure_attributes,omitempty"` - ClusterLogConf *ClusterLogConf `json:"cluster_log_conf,omitempty"` - ClusterName string `json:"cluster_name,omitempty"` - CustomTags map[string]string `json:"custom_tags,omitempty"` - DataSecurityMode DataSecurityMode `json:"data_security_mode,omitempty"` - DockerImage *DockerImage `json:"docker_image,omitempty"` - DriverInstancePoolId string `json:"driver_instance_pool_id,omitempty"` - DriverNodeTypeId string `json:"driver_node_type_id,omitempty"` - EnableElasticDisk bool `json:"enable_elastic_disk,omitempty"` - EnableLocalDiskEncryption bool `json:"enable_local_disk_encryption,omitempty"` - GcpAttributes *GcpAttributes `json:"gcp_attributes,omitempty"` - InitScripts []InitScriptInfo `json:"init_scripts,omitempty"` - InstancePoolId string `json:"instance_pool_id,omitempty"` - IsSingleNode bool `json:"is_single_node,omitempty"` - Kind Kind `json:"kind,omitempty"` - NodeTypeId string `json:"node_type_id,omitempty"` - NumWorkers int `json:"num_workers,omitempty"` - PolicyId string `json:"policy_id,omitempty"` - RemoteDiskThroughput int `json:"remote_disk_throughput,omitempty"` - RuntimeEngine RuntimeEngine `json:"runtime_engine,omitempty"` - SingleUserName string `json:"single_user_name,omitempty"` - SparkConf map[string]string `json:"spark_conf,omitempty"` - SparkEnvVars map[string]string `json:"spark_env_vars,omitempty"` - SparkVersion string `json:"spark_version,omitempty"` - SshPublicKeys []string `json:"ssh_public_keys,omitempty"` - TotalInitialRemoteDiskSize int `json:"total_initial_remote_disk_size,omitempty"` - UseMlRuntime bool `json:"use_ml_runtime,omitempty"` - WorkloadType *WorkloadType `json:"workload_type,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func updateClusterResourceFromPb(pb *updateClusterResourcePb) (*UpdateClusterResource, error) { - if pb == nil { - return nil, nil - } - st := &UpdateClusterResource{} - st.Autoscale = pb.Autoscale - st.AutoterminationMinutes = pb.AutoterminationMinutes - st.AwsAttributes = pb.AwsAttributes - st.AzureAttributes = pb.AzureAttributes - st.ClusterLogConf = pb.ClusterLogConf - st.ClusterName = pb.ClusterName - st.CustomTags = pb.CustomTags - st.DataSecurityMode = pb.DataSecurityMode - st.DockerImage = pb.DockerImage - st.DriverInstancePoolId = pb.DriverInstancePoolId - st.DriverNodeTypeId = pb.DriverNodeTypeId - st.EnableElasticDisk = pb.EnableElasticDisk - st.EnableLocalDiskEncryption = pb.EnableLocalDiskEncryption - st.GcpAttributes = pb.GcpAttributes - st.InitScripts = pb.InitScripts - st.InstancePoolId = pb.InstancePoolId - st.IsSingleNode = pb.IsSingleNode - st.Kind = pb.Kind - st.NodeTypeId = pb.NodeTypeId - st.NumWorkers = pb.NumWorkers - st.PolicyId = pb.PolicyId - st.RemoteDiskThroughput = pb.RemoteDiskThroughput - st.RuntimeEngine = pb.RuntimeEngine - st.SingleUserName = pb.SingleUserName - st.SparkConf = pb.SparkConf - st.SparkEnvVars = pb.SparkEnvVars - st.SparkVersion = pb.SparkVersion - st.SshPublicKeys = pb.SshPublicKeys - st.TotalInitialRemoteDiskSize = pb.TotalInitialRemoteDiskSize - st.UseMlRuntime = pb.UseMlRuntime - st.WorkloadType = pb.WorkloadType - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *updateClusterResourcePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st updateClusterResourcePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func updateClusterResponseToPb(st *UpdateClusterResponse) (*updateClusterResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &updateClusterResponsePb{} - - return pb, nil -} - -type updateClusterResponsePb struct { -} - -func updateClusterResponseFromPb(pb *updateClusterResponsePb) (*UpdateClusterResponse, error) { - if pb == nil { - return nil, nil - } - st := &UpdateClusterResponse{} - - return st, nil -} - -func updateResponseToPb(st *UpdateResponse) (*updateResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &updateResponsePb{} - - return pb, nil -} - -type updateResponsePb struct { -} - -func updateResponseFromPb(pb *updateResponsePb) (*UpdateResponse, error) { - if pb == nil { - return nil, nil - } - st := &UpdateResponse{} - - return st, nil -} - -func volumesStorageInfoToPb(st *VolumesStorageInfo) (*volumesStorageInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &volumesStorageInfoPb{} - pb.Destination = st.Destination - - return pb, nil -} - -type volumesStorageInfoPb struct { - Destination string `json:"destination"` -} - -func volumesStorageInfoFromPb(pb *volumesStorageInfoPb) (*VolumesStorageInfo, error) { - if pb == nil { - return nil, nil - } - st := &VolumesStorageInfo{} - st.Destination = pb.Destination - - return st, nil -} - -func workloadTypeToPb(st *WorkloadType) (*workloadTypePb, error) { - if st == nil { - return nil, nil - } - pb := &workloadTypePb{} - pb.Clients = st.Clients - - return pb, nil -} - -type workloadTypePb struct { - Clients ClientsTypes `json:"clients"` -} - -func workloadTypeFromPb(pb *workloadTypePb) (*WorkloadType, error) { - if pb == nil { - return nil, nil - } - st := &WorkloadType{} - st.Clients = pb.Clients - - return st, nil -} - -func workspaceStorageInfoToPb(st *WorkspaceStorageInfo) (*workspaceStorageInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &workspaceStorageInfoPb{} - pb.Destination = st.Destination - - return pb, nil -} - -type workspaceStorageInfoPb struct { - Destination string `json:"destination"` -} - -func workspaceStorageInfoFromPb(pb *workspaceStorageInfoPb) (*WorkspaceStorageInfo, error) { - if pb == nil { - return nil, nil - } - st := &WorkspaceStorageInfo{} - st.Destination = pb.Destination - - return st, nil -} - -func durationToPb(d *time.Duration) (*string, error) { - if d == nil { - return nil, nil - } - s := fmt.Sprintf("%.9fs", d.Seconds()) - return &s, nil -} - -func durationFromPb(s *string) (*time.Duration, error) { - if s == nil { - return nil, nil - } - d, err := time.ParseDuration(*s) - if err != nil { - return nil, err - } - return &d, nil -} - -func timestampToPb(t *time.Time) (*string, error) { - if t == nil { - return nil, nil - } - s := t.Format(time.RFC3339) - return &s, nil -} - -func timestampFromPb(s *string) (*time.Time, error) { - if s == nil { - return nil, nil - } - t, err := time.Parse(time.RFC3339, *s) - if err != nil { - return nil, err - } - return &t, nil -} - -func fieldMaskToPb(fm *[]string) (*string, error) { - if fm == nil { - return nil, nil - } - s := strings.Join(*fm, ",") - return &s, nil -} - -func fieldMaskFromPb(s *string) (*[]string, error) { - if s == nil { - return nil, nil - } - fm := strings.Split(*s, ",") - return &fm, nil -} diff --git a/service/compute/model.go b/service/compute/model.go index caddb038a..93b0bbfc0 100755 --- a/service/compute/model.go +++ b/service/compute/model.go @@ -3,8 +3,9 @@ package compute import ( - "encoding/json" "fmt" + + "github.com/databricks/databricks-sdk-go/marshal" ) type AddInstanceProfile struct { @@ -16,18 +17,15 @@ type AddInstanceProfile struct { // Otherwise, this field is optional. // // [Databricks SQL Serverless]: https://docs.databricks.com/sql/admin/serverless.html - // Wire name: 'iam_role_arn' IamRoleArn string `json:"iam_role_arn,omitempty"` // The AWS ARN of the instance profile to register with Databricks. This // field is required. - // Wire name: 'instance_profile_arn' InstanceProfileArn string `json:"instance_profile_arn"` // Boolean flag indicating whether the instance profile should only be used // in credential passthrough scenarios. If true, it means the instance // profile contains an meta IAM role which could assume a wide range of // roles. Therefore it should always be used with authorization. This field // is optional, the default value is `false`. - // Wire name: 'is_meta_instance_profile' IsMetaInstanceProfile bool `json:"is_meta_instance_profile,omitempty"` // By default, Databricks validates that it has sufficient permissions to // launch instances with the instance profile. This validation uses AWS @@ -36,136 +34,48 @@ type AddInstanceProfile struct { // “Your requested instance type is not supported in your requested // availability zone”), you can pass this flag to skip the validation and // forcibly add the instance profile. - // Wire name: 'skip_validation' SkipValidation bool `json:"skip_validation,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *AddInstanceProfile) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &addInstanceProfilePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := addInstanceProfileFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *AddInstanceProfile) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st AddInstanceProfile) MarshalJSON() ([]byte, error) { - pb, err := addInstanceProfileToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s AddInstanceProfile) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type AddResponse struct { } -func (st *AddResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &addResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := addResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st AddResponse) MarshalJSON() ([]byte, error) { - pb, err := addResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // A storage location in Adls Gen2 type Adlsgen2Info struct { // abfss destination, e.g. // `abfss://@.dfs.core.windows.net/`. - // Wire name: 'destination' Destination string `json:"destination"` } -func (st *Adlsgen2Info) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &adlsgen2InfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := adlsgen2InfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st Adlsgen2Info) MarshalJSON() ([]byte, error) { - pb, err := adlsgen2InfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type AutoScale struct { // The maximum number of workers to which the cluster can scale up when // overloaded. Note that `max_workers` must be strictly greater than // `min_workers`. - // Wire name: 'max_workers' MaxWorkers int `json:"max_workers,omitempty"` // The minimum number of workers to which the cluster can scale down when // underutilized. It is also the initial number of workers the cluster will // have after creation. - // Wire name: 'min_workers' MinWorkers int `json:"min_workers,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *AutoScale) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &autoScalePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := autoScaleFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *AutoScale) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st AutoScale) MarshalJSON() ([]byte, error) { - pb, err := autoScaleToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s AutoScale) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Attributes set during cluster creation which are related to Amazon Web @@ -176,7 +86,6 @@ type AwsAttributes struct { // // Note: If `first_on_demand` is zero, this availability type will be used // for the entire cluster. - // Wire name: 'availability' Availability AwsAvailability `json:"availability,omitempty"` // The number of volumes launched for each instance. Users can choose up to // 10 volumes. This feature is only enabled for supported node types. Legacy @@ -194,25 +103,20 @@ type AwsAttributes struct { // // Please note that if EBS volumes are specified, then the Spark // configuration `spark.local.dir` will be overridden. - // Wire name: 'ebs_volume_count' EbsVolumeCount int `json:"ebs_volume_count,omitempty"` // If using gp3 volumes, what IOPS to use for the disk. If this is not set, // the maximum performance of a gp2 volume with the same volume size will be // used. - // Wire name: 'ebs_volume_iops' EbsVolumeIops int `json:"ebs_volume_iops,omitempty"` // The size of each EBS volume (in GiB) launched for each instance. For // general purpose SSD, this value must be within the range 100 - 4096. For // throughput optimized HDD, this value must be within the range 500 - 4096. - // Wire name: 'ebs_volume_size' EbsVolumeSize int `json:"ebs_volume_size,omitempty"` // If using gp3 volumes, what throughput to use for the disk. If this is not // set, the maximum performance of a gp2 volume with the same volume size // will be used. - // Wire name: 'ebs_volume_throughput' EbsVolumeThroughput int `json:"ebs_volume_throughput,omitempty"` // The type of EBS volumes that will be launched with this cluster. - // Wire name: 'ebs_volume_type' EbsVolumeType EbsVolumeType `json:"ebs_volume_type,omitempty"` // The first `first_on_demand` nodes of the cluster will be placed on // on-demand instances. If this value is greater than 0, the cluster driver @@ -223,7 +127,6 @@ type AwsAttributes struct { // instances and the remainder will be placed on `availability` instances. // Note that this value does not affect cluster size and cannot currently be // mutated over the lifetime of a cluster. - // Wire name: 'first_on_demand' FirstOnDemand int `json:"first_on_demand,omitempty"` // Nodes for this cluster will only be placed on AWS instances with this // instance profile. If ommitted, nodes will be placed on instances without @@ -231,7 +134,6 @@ type AwsAttributes struct { // added to the Databricks environment by an account administrator. // // This feature may only be available to certain customer plans. - // Wire name: 'instance_profile_arn' InstanceProfileArn string `json:"instance_profile_arn,omitempty"` // The bid price for AWS spot instances, as a percentage of the // corresponding instance type's on-demand price. For example, if this field @@ -243,7 +145,6 @@ type AwsAttributes struct { // instances whose bid price percentage matches this field will be // considered. Note that, for safety, we enforce this field to be no more // than 10000. - // Wire name: 'spot_bid_price_percent' SpotBidPricePercent int `json:"spot_bid_price_percent,omitempty"` // Identifier for the availability zone/datacenter in which the cluster // resides. This string will be of a form like "us-west-2a". The provided @@ -257,35 +158,17 @@ type AwsAttributes struct { // // The list of available zones as well as the default value can be found by // using the `List Zones` method. - // Wire name: 'zone_id' ZoneId string `json:"zone_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *AwsAttributes) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &awsAttributesPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := awsAttributesFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *AwsAttributes) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st AwsAttributes) MarshalJSON() ([]byte, error) { - pb, err := awsAttributesToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s AwsAttributes) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Availability type used for all subsequent nodes past the `first_on_demand` @@ -338,7 +221,6 @@ type AzureAttributes struct { // Availability type used for all subsequent nodes past the // `first_on_demand` ones. Note: If `first_on_demand` is zero, this // availability type will be used for the entire cluster. - // Wire name: 'availability' Availability AzureAvailability `json:"availability,omitempty"` // The first `first_on_demand` nodes of the cluster will be placed on // on-demand instances. This value should be greater than 0, to make sure @@ -349,45 +231,25 @@ type AzureAttributes struct { // instances and the remainder will be placed on `availability` instances. // Note that this value does not affect cluster size and cannot currently be // mutated over the lifetime of a cluster. - // Wire name: 'first_on_demand' FirstOnDemand int `json:"first_on_demand,omitempty"` // Defines values necessary to configure and run Azure Log Analytics agent - // Wire name: 'log_analytics_info' LogAnalyticsInfo *LogAnalyticsInfo `json:"log_analytics_info,omitempty"` // The max bid price to be used for Azure spot instances. The Max price for // the bid cannot be higher than the on-demand price of the instance. If not // specified, the default value is -1, which specifies that the instance // cannot be evicted on the basis of price, and only on the basis of // availability. Further, the value should > 0 or -1. - // Wire name: 'spot_bid_max_price' SpotBidMaxPrice float64 `json:"spot_bid_max_price,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *AzureAttributes) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &azureAttributesPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := azureAttributesFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *AzureAttributes) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st AzureAttributes) MarshalJSON() ([]byte, error) { - pb, err := azureAttributesToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s AzureAttributes) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Availability type used for all subsequent nodes past the `first_on_demand` @@ -434,232 +296,62 @@ func (f *AzureAvailability) Type() string { } type CancelCommand struct { - - // Wire name: 'clusterId' ClusterId string `json:"clusterId,omitempty"` - // Wire name: 'commandId' CommandId string `json:"commandId,omitempty"` - // Wire name: 'contextId' ContextId string `json:"contextId,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CancelCommand) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &cancelCommandPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := cancelCommandFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CancelCommand) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CancelCommand) MarshalJSON() ([]byte, error) { - pb, err := cancelCommandToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CancelCommand) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CancelResponse struct { } -func (st *CancelResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &cancelResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := cancelResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CancelResponse) MarshalJSON() ([]byte, error) { - pb, err := cancelResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type ChangeClusterOwner struct { - - // Wire name: 'cluster_id' ClusterId string `json:"cluster_id"` // New owner of the cluster_id after this RPC. - // Wire name: 'owner_username' OwnerUsername string `json:"owner_username"` } -func (st *ChangeClusterOwner) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &changeClusterOwnerPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := changeClusterOwnerFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ChangeClusterOwner) MarshalJSON() ([]byte, error) { - pb, err := changeClusterOwnerToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type ChangeClusterOwnerResponse struct { } -func (st *ChangeClusterOwnerResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &changeClusterOwnerResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := changeClusterOwnerResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ChangeClusterOwnerResponse) MarshalJSON() ([]byte, error) { - pb, err := changeClusterOwnerResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type ClientsTypes struct { // With jobs set, the cluster can be used for jobs - // Wire name: 'jobs' Jobs bool `json:"jobs,omitempty"` // With notebooks set, this cluster can be used for notebooks - // Wire name: 'notebooks' Notebooks bool `json:"notebooks,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ClientsTypes) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &clientsTypesPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := clientsTypesFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ClientsTypes) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ClientsTypes) MarshalJSON() ([]byte, error) { - pb, err := clientsTypesToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ClientsTypes) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CloneCluster struct { // The cluster that is being cloned. - // Wire name: 'source_cluster_id' SourceClusterId string `json:"source_cluster_id"` } -func (st *CloneCluster) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &cloneClusterPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := cloneClusterFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CloneCluster) MarshalJSON() ([]byte, error) { - pb, err := cloneClusterToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type CloudProviderNodeInfo struct { // Status as reported by the cloud provider - // Wire name: 'status' Status []CloudProviderNodeStatus `json:"status,omitempty"` } -func (st *CloudProviderNodeInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &cloudProviderNodeInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := cloudProviderNodeInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CloudProviderNodeInfo) MarshalJSON() ([]byte, error) { - pb, err := cloudProviderNodeInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type CloudProviderNodeStatus string const CloudProviderNodeStatusNotAvailableInRegion CloudProviderNodeStatus = `NotAvailableInRegion` @@ -699,89 +391,46 @@ func (f *CloudProviderNodeStatus) Type() string { type ClusterAccessControlRequest struct { // name of the group - // Wire name: 'group_name' GroupName string `json:"group_name,omitempty"` // Permission level - // Wire name: 'permission_level' PermissionLevel ClusterPermissionLevel `json:"permission_level,omitempty"` // application ID of a service principal - // Wire name: 'service_principal_name' ServicePrincipalName string `json:"service_principal_name,omitempty"` // name of the user - // Wire name: 'user_name' UserName string `json:"user_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ClusterAccessControlRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &clusterAccessControlRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := clusterAccessControlRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ClusterAccessControlRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ClusterAccessControlRequest) MarshalJSON() ([]byte, error) { - pb, err := clusterAccessControlRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ClusterAccessControlRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ClusterAccessControlResponse struct { // All permissions. - // Wire name: 'all_permissions' AllPermissions []ClusterPermission `json:"all_permissions,omitempty"` // Display name of the user or service principal. - // Wire name: 'display_name' DisplayName string `json:"display_name,omitempty"` // name of the group - // Wire name: 'group_name' GroupName string `json:"group_name,omitempty"` // Name of the service principal. - // Wire name: 'service_principal_name' ServicePrincipalName string `json:"service_principal_name,omitempty"` // name of the user - // Wire name: 'user_name' UserName string `json:"user_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ClusterAccessControlResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &clusterAccessControlResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := clusterAccessControlResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ClusterAccessControlResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ClusterAccessControlResponse) MarshalJSON() ([]byte, error) { - pb, err := clusterAccessControlResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ClusterAccessControlResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Common set of attributes set during cluster creation. These attributes cannot @@ -792,15 +441,12 @@ type ClusterAttributes struct { // terminated. If specified, the threshold must be between 10 and 10000 // minutes. Users can also set this value to 0 to explicitly disable // automatic termination. - // Wire name: 'autotermination_minutes' AutoterminationMinutes int `json:"autotermination_minutes,omitempty"` // Attributes related to clusters running on Amazon Web Services. If not // specified at cluster creation, a set of default values will be used. - // Wire name: 'aws_attributes' AwsAttributes *AwsAttributes `json:"aws_attributes,omitempty"` // Attributes related to clusters running on Microsoft Azure. If not // specified at cluster creation, a set of default values will be used. - // Wire name: 'azure_attributes' AzureAttributes *AzureAttributes `json:"azure_attributes,omitempty"` // The configuration for delivering spark logs to a long-term storage // destination. Three kinds of destinations (DBFS, S3 and Unity Catalog @@ -809,13 +455,11 @@ type ClusterAttributes struct { // destination every `5 mins`. The destination of driver logs is // `$destination/$clusterId/driver`, while the destination of executor logs // is `$destination/$clusterId/executor`. - // Wire name: 'cluster_log_conf' ClusterLogConf *ClusterLogConf `json:"cluster_log_conf,omitempty"` // Cluster name requested by the user. This doesn't have to be unique. If // not specified at creation, the cluster name will be an empty string. For // job clusters, the cluster name is automatically set based on the job and // job run IDs. - // Wire name: 'cluster_name' ClusterName string `json:"cluster_name,omitempty"` // Additional tags for cluster resources. Databricks will tag all cluster // resources (e.g., AWS instances and EBS volumes) with these tags in @@ -825,7 +469,6 @@ type ClusterAttributes struct { // // - Clusters can only reuse cloud resources if the resources' tags are a // subset of the cluster tags - // Wire name: 'custom_tags' CustomTags map[string]string `json:"custom_tags,omitempty"` // Data security mode decides what data governance model to use when // accessing data from a cluster. @@ -856,15 +499,12 @@ type ClusterAttributes struct { // `LEGACY_SINGLE_USER`: This mode is for users migrating from legacy // Passthrough on standard clusters. * `LEGACY_SINGLE_USER_STANDARD`: This // mode provides a way that doesn’t have UC nor passthrough enabled. - // Wire name: 'data_security_mode' DataSecurityMode DataSecurityMode `json:"data_security_mode,omitempty"` // Custom docker image BYOC - // Wire name: 'docker_image' DockerImage *DockerImage `json:"docker_image,omitempty"` // The optional ID of the instance pool for the driver of the cluster // belongs. The pool cluster uses the instance pool with id // (instance_pool_id) if the driver pool is not assigned. - // Wire name: 'driver_instance_pool_id' DriverInstancePoolId string `json:"driver_instance_pool_id,omitempty"` // The node type of the Spark driver. Note that this field is optional; if // unset, the driver node type will be set as the same value as @@ -874,35 +514,28 @@ type ClusterAttributes struct { // virtual_cluster_size is set. If both driver_node_type_id, node_type_id, // and virtual_cluster_size are specified, driver_node_type_id and // node_type_id take precedence. - // Wire name: 'driver_node_type_id' DriverNodeTypeId string `json:"driver_node_type_id,omitempty"` // Autoscaling Local Storage: when enabled, this cluster will dynamically // acquire additional disk space when its Spark workers are running low on // disk space. This feature requires specific AWS permissions to function // correctly - refer to the User Guide for more details. - // Wire name: 'enable_elastic_disk' EnableElasticDisk bool `json:"enable_elastic_disk,omitempty"` // Whether to enable LUKS on cluster VMs' local disks - // Wire name: 'enable_local_disk_encryption' EnableLocalDiskEncryption bool `json:"enable_local_disk_encryption,omitempty"` // Attributes related to clusters running on Google Cloud Platform. If not // specified at cluster creation, a set of default values will be used. - // Wire name: 'gcp_attributes' GcpAttributes *GcpAttributes `json:"gcp_attributes,omitempty"` // The configuration for storing init scripts. Any number of destinations // can be specified. The scripts are executed sequentially in the order // provided. If `cluster_log_conf` is specified, init script logs are sent // to `//init_scripts`. - // Wire name: 'init_scripts' InitScripts []InitScriptInfo `json:"init_scripts,omitempty"` // The optional ID of the instance pool to which the cluster belongs. - // Wire name: 'instance_pool_id' InstancePoolId string `json:"instance_pool_id,omitempty"` // This field can only be used when `kind = CLASSIC_PREVIEW`. // // When set to true, Databricks will automatically set single node related // `custom_tags`, `spark_conf`, and `num_workers` - // Wire name: 'is_single_node' IsSingleNode bool `json:"is_single_node,omitempty"` // The kind of compute described by this compute specification. // @@ -921,21 +554,17 @@ type ClusterAttributes struct { // CLASSIC_PREVIEW`. // // [simple form]: https://docs.databricks.com/compute/simple-form.html - // Wire name: 'kind' Kind Kind `json:"kind,omitempty"` // This field encodes, through a single value, the resources available to // each of the Spark nodes in this cluster. For example, the Spark nodes can // be provisioned and optimized for memory or compute intensive workloads. A // list of available node types can be retrieved by using the // :method:clusters/listNodeTypes API call. - // Wire name: 'node_type_id' NodeTypeId string `json:"node_type_id,omitempty"` // The ID of the cluster policy used to create the cluster if applicable. - // Wire name: 'policy_id' PolicyId string `json:"policy_id,omitempty"` // If set, what the configurable throughput (in Mb/s) for the remote disk // is. Currently only supported for GCP HYPERDISK_BALANCED disks. - // Wire name: 'remote_disk_throughput' RemoteDiskThroughput int `json:"remote_disk_throughput,omitempty"` // Determines the cluster's runtime engine, either standard or Photon. // @@ -945,17 +574,14 @@ type ClusterAttributes struct { // // If left unspecified, the runtime engine defaults to standard unless the // spark_version contains -photon-, in which case Photon will be used. - // Wire name: 'runtime_engine' RuntimeEngine RuntimeEngine `json:"runtime_engine,omitempty"` // Single user name if data_security_mode is `SINGLE_USER` - // Wire name: 'single_user_name' SingleUserName string `json:"single_user_name,omitempty"` // An object containing a set of optional, user-specified Spark // configuration key-value pairs. Users can also pass in a string of extra // JVM options to the driver and the executors via // `spark.driver.extraJavaOptions` and `spark.executor.extraJavaOptions` // respectively. - // Wire name: 'spark_conf' SparkConf map[string]string `json:"spark_conf,omitempty"` // An object containing a set of optional, user-specified environment // variable key-value pairs. Please note that key-value pair of the form @@ -970,102 +596,59 @@ type ClusterAttributes struct { // Example Spark environment variables: `{"SPARK_WORKER_MEMORY": "28000m", // "SPARK_LOCAL_DIRS": "/local_disk0"}` or `{"SPARK_DAEMON_JAVA_OPTS": // "$SPARK_DAEMON_JAVA_OPTS -Dspark.shuffle.service.enabled=true"}` - // Wire name: 'spark_env_vars' SparkEnvVars map[string]string `json:"spark_env_vars,omitempty"` // The Spark version of the cluster, e.g. `3.3.x-scala2.11`. A list of // available Spark versions can be retrieved by using the // :method:clusters/sparkVersions API call. - // Wire name: 'spark_version' SparkVersion string `json:"spark_version"` // SSH public key contents that will be added to each Spark node in this // cluster. The corresponding private keys can be used to login with the // user name `ubuntu` on port `2200`. Up to 10 keys can be specified. - // Wire name: 'ssh_public_keys' SshPublicKeys []string `json:"ssh_public_keys,omitempty"` // If set, what the total initial volume size (in GB) of the remote disks // should be. Currently only supported for GCP HYPERDISK_BALANCED disks. - // Wire name: 'total_initial_remote_disk_size' TotalInitialRemoteDiskSize int `json:"total_initial_remote_disk_size,omitempty"` // This field can only be used when `kind = CLASSIC_PREVIEW`. // // `effective_spark_version` is determined by `spark_version` (DBR release), // this field `use_ml_runtime`, and whether `node_type_id` is gpu node or // not. - // Wire name: 'use_ml_runtime' UseMlRuntime bool `json:"use_ml_runtime,omitempty"` // Cluster Attributes showing for clusters workload types. - // Wire name: 'workload_type' WorkloadType *WorkloadType `json:"workload_type,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ClusterAttributes) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &clusterAttributesPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := clusterAttributesFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ClusterAttributes) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ClusterAttributes) MarshalJSON() ([]byte, error) { - pb, err := clusterAttributesToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ClusterAttributes) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ClusterCompliance struct { // Canonical unique identifier for a cluster. - // Wire name: 'cluster_id' ClusterId string `json:"cluster_id"` // Whether this cluster is in compliance with the latest version of its // policy. - // Wire name: 'is_compliant' IsCompliant bool `json:"is_compliant,omitempty"` // An object containing key-value mappings representing the first 200 policy // validation errors. The keys indicate the path where the policy validation // error is occurring. The values indicate an error message describing the // policy validation error. - // Wire name: 'violations' Violations map[string]string `json:"violations,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ClusterCompliance) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &clusterCompliancePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := clusterComplianceFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ClusterCompliance) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ClusterCompliance) MarshalJSON() ([]byte, error) { - pb, err := clusterComplianceToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ClusterCompliance) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Describes all of the metadata about a single Spark cluster in Databricks. @@ -1073,31 +656,25 @@ type ClusterDetails struct { // Parameters needed in order to automatically scale clusters up and down // based on load. Note: autoscaling works best with DB runtime versions 3.0 // or later. - // Wire name: 'autoscale' Autoscale *AutoScale `json:"autoscale,omitempty"` // Automatically terminates the cluster after it is inactive for this time // in minutes. If not set, this cluster will not be automatically // terminated. If specified, the threshold must be between 10 and 10000 // minutes. Users can also set this value to 0 to explicitly disable // automatic termination. - // Wire name: 'autotermination_minutes' AutoterminationMinutes int `json:"autotermination_minutes,omitempty"` // Attributes related to clusters running on Amazon Web Services. If not // specified at cluster creation, a set of default values will be used. - // Wire name: 'aws_attributes' AwsAttributes *AwsAttributes `json:"aws_attributes,omitempty"` // Attributes related to clusters running on Microsoft Azure. If not // specified at cluster creation, a set of default values will be used. - // Wire name: 'azure_attributes' AzureAttributes *AzureAttributes `json:"azure_attributes,omitempty"` // Number of CPU cores available for this cluster. Note that this can be // fractional, e.g. 7.5 cores, since certain node types are configured to // share cores between Spark nodes on the same instance. - // Wire name: 'cluster_cores' ClusterCores float64 `json:"cluster_cores,omitempty"` // Canonical identifier for the cluster. This id is retained during cluster // restarts and resizes, while each new cluster has a globally unique id. - // Wire name: 'cluster_id' ClusterId string `json:"cluster_id,omitempty"` // The configuration for delivering spark logs to a long-term storage // destination. Three kinds of destinations (DBFS, S3 and Unity Catalog @@ -1106,27 +683,21 @@ type ClusterDetails struct { // destination every `5 mins`. The destination of driver logs is // `$destination/$clusterId/driver`, while the destination of executor logs // is `$destination/$clusterId/executor`. - // Wire name: 'cluster_log_conf' ClusterLogConf *ClusterLogConf `json:"cluster_log_conf,omitempty"` // Cluster log delivery status. - // Wire name: 'cluster_log_status' ClusterLogStatus *LogSyncStatus `json:"cluster_log_status,omitempty"` // Total amount of cluster memory, in megabytes - // Wire name: 'cluster_memory_mb' ClusterMemoryMb int64 `json:"cluster_memory_mb,omitempty"` // Cluster name requested by the user. This doesn't have to be unique. If // not specified at creation, the cluster name will be an empty string. For // job clusters, the cluster name is automatically set based on the job and // job run IDs. - // Wire name: 'cluster_name' ClusterName string `json:"cluster_name,omitempty"` // Determines whether the cluster was created by a user through the UI, // created by the Databricks Jobs Scheduler, or through an API request. - // Wire name: 'cluster_source' ClusterSource ClusterSource `json:"cluster_source,omitempty"` // Creator user name. The field won't be included in the response if the // user has already been deleted. - // Wire name: 'creator_user_name' CreatorUserName string `json:"creator_user_name,omitempty"` // Additional tags for cluster resources. Databricks will tag all cluster // resources (e.g., AWS instances and EBS volumes) with these tags in @@ -1136,7 +707,6 @@ type ClusterDetails struct { // // - Clusters can only reuse cloud resources if the resources' tags are a // subset of the cluster tags - // Wire name: 'custom_tags' CustomTags map[string]string `json:"custom_tags,omitempty"` // Data security mode decides what data governance model to use when // accessing data from a cluster. @@ -1167,7 +737,6 @@ type ClusterDetails struct { // `LEGACY_SINGLE_USER`: This mode is for users migrating from legacy // Passthrough on standard clusters. * `LEGACY_SINGLE_USER_STANDARD`: This // mode provides a way that doesn’t have UC nor passthrough enabled. - // Wire name: 'data_security_mode' DataSecurityMode DataSecurityMode `json:"data_security_mode,omitempty"` // Tags that are added by Databricks regardless of any `custom_tags`, // including: @@ -1181,20 +750,16 @@ type ClusterDetails struct { // - ClusterId: // // - Name: - // Wire name: 'default_tags' DefaultTags map[string]string `json:"default_tags,omitempty"` // Custom docker image BYOC - // Wire name: 'docker_image' DockerImage *DockerImage `json:"docker_image,omitempty"` // Node on which the Spark driver resides. The driver node contains the // Spark master and the Databricks application that manages the per-notebook // Spark REPLs. - // Wire name: 'driver' Driver *SparkNode `json:"driver,omitempty"` // The optional ID of the instance pool for the driver of the cluster // belongs. The pool cluster uses the instance pool with id // (instance_pool_id) if the driver pool is not assigned. - // Wire name: 'driver_instance_pool_id' DriverInstancePoolId string `json:"driver_instance_pool_id,omitempty"` // The node type of the Spark driver. Note that this field is optional; if // unset, the driver node type will be set as the same value as @@ -1204,42 +769,33 @@ type ClusterDetails struct { // virtual_cluster_size is set. If both driver_node_type_id, node_type_id, // and virtual_cluster_size are specified, driver_node_type_id and // node_type_id take precedence. - // Wire name: 'driver_node_type_id' DriverNodeTypeId string `json:"driver_node_type_id,omitempty"` // Autoscaling Local Storage: when enabled, this cluster will dynamically // acquire additional disk space when its Spark workers are running low on // disk space. This feature requires specific AWS permissions to function // correctly - refer to the User Guide for more details. - // Wire name: 'enable_elastic_disk' EnableElasticDisk bool `json:"enable_elastic_disk,omitempty"` // Whether to enable LUKS on cluster VMs' local disks - // Wire name: 'enable_local_disk_encryption' EnableLocalDiskEncryption bool `json:"enable_local_disk_encryption,omitempty"` // Nodes on which the Spark executors reside. - // Wire name: 'executors' Executors []SparkNode `json:"executors,omitempty"` // Attributes related to clusters running on Google Cloud Platform. If not // specified at cluster creation, a set of default values will be used. - // Wire name: 'gcp_attributes' GcpAttributes *GcpAttributes `json:"gcp_attributes,omitempty"` // The configuration for storing init scripts. Any number of destinations // can be specified. The scripts are executed sequentially in the order // provided. If `cluster_log_conf` is specified, init script logs are sent // to `//init_scripts`. - // Wire name: 'init_scripts' InitScripts []InitScriptInfo `json:"init_scripts,omitempty"` // The optional ID of the instance pool to which the cluster belongs. - // Wire name: 'instance_pool_id' InstancePoolId string `json:"instance_pool_id,omitempty"` // This field can only be used when `kind = CLASSIC_PREVIEW`. // // When set to true, Databricks will automatically set single node related // `custom_tags`, `spark_conf`, and `num_workers` - // Wire name: 'is_single_node' IsSingleNode bool `json:"is_single_node,omitempty"` // Port on which Spark JDBC server is listening, in the driver nod. No // service will be listeningon on this port in executor nodes. - // Wire name: 'jdbc_port' JdbcPort int `json:"jdbc_port,omitempty"` // The kind of compute described by this compute specification. // @@ -1258,21 +814,17 @@ type ClusterDetails struct { // CLASSIC_PREVIEW`. // // [simple form]: https://docs.databricks.com/compute/simple-form.html - // Wire name: 'kind' Kind Kind `json:"kind,omitempty"` // the timestamp that the cluster was started/restarted - // Wire name: 'last_restarted_time' LastRestartedTime int64 `json:"last_restarted_time,omitempty"` // Time when the cluster driver last lost its state (due to a restart or // driver failure). - // Wire name: 'last_state_loss_time' LastStateLossTime int64 `json:"last_state_loss_time,omitempty"` // This field encodes, through a single value, the resources available to // each of the Spark nodes in this cluster. For example, the Spark nodes can // be provisioned and optimized for memory or compute intensive workloads. A // list of available node types can be retrieved by using the // :method:clusters/listNodeTypes API call. - // Wire name: 'node_type_id' NodeTypeId string `json:"node_type_id,omitempty"` // Number of worker nodes that this cluster should have. A cluster has one // Spark Driver and `num_workers` Executors for a total of `num_workers` + 1 @@ -1284,14 +836,11 @@ type ClusterDetails struct { // field will immediately be updated to reflect the target size of 10 // workers, whereas the workers listed in `spark_info` will gradually // increase from 5 to 10 as the new nodes are provisioned. - // Wire name: 'num_workers' NumWorkers int `json:"num_workers,omitempty"` // The ID of the cluster policy used to create the cluster if applicable. - // Wire name: 'policy_id' PolicyId string `json:"policy_id,omitempty"` // If set, what the configurable throughput (in Mb/s) for the remote disk // is. Currently only supported for GCP HYPERDISK_BALANCED disks. - // Wire name: 'remote_disk_throughput' RemoteDiskThroughput int `json:"remote_disk_throughput,omitempty"` // Determines the cluster's runtime engine, either standard or Photon. // @@ -1301,22 +850,18 @@ type ClusterDetails struct { // // If left unspecified, the runtime engine defaults to standard unless the // spark_version contains -photon-, in which case Photon will be used. - // Wire name: 'runtime_engine' RuntimeEngine RuntimeEngine `json:"runtime_engine,omitempty"` // Single user name if data_security_mode is `SINGLE_USER` - // Wire name: 'single_user_name' SingleUserName string `json:"single_user_name,omitempty"` // An object containing a set of optional, user-specified Spark // configuration key-value pairs. Users can also pass in a string of extra // JVM options to the driver and the executors via // `spark.driver.extraJavaOptions` and `spark.executor.extraJavaOptions` // respectively. - // Wire name: 'spark_conf' SparkConf map[string]string `json:"spark_conf,omitempty"` // A canonical SparkContext identifier. This value *does* change when the // Spark driver restarts. The pair `(cluster_id, spark_context_id)` is a // globally unique identifier over all Spark contexts. - // Wire name: 'spark_context_id' SparkContextId int64 `json:"spark_context_id,omitempty"` // An object containing a set of optional, user-specified environment // variable key-value pairs. Please note that key-value pair of the form @@ -1331,249 +876,129 @@ type ClusterDetails struct { // Example Spark environment variables: `{"SPARK_WORKER_MEMORY": "28000m", // "SPARK_LOCAL_DIRS": "/local_disk0"}` or `{"SPARK_DAEMON_JAVA_OPTS": // "$SPARK_DAEMON_JAVA_OPTS -Dspark.shuffle.service.enabled=true"}` - // Wire name: 'spark_env_vars' SparkEnvVars map[string]string `json:"spark_env_vars,omitempty"` // The Spark version of the cluster, e.g. `3.3.x-scala2.11`. A list of // available Spark versions can be retrieved by using the // :method:clusters/sparkVersions API call. - // Wire name: 'spark_version' SparkVersion string `json:"spark_version,omitempty"` // The spec contains a snapshot of the latest user specified settings that // were used to create/edit the cluster. Note: not included in the response // of the ListClusters API. - // Wire name: 'spec' Spec *ClusterSpec `json:"spec,omitempty"` // SSH public key contents that will be added to each Spark node in this // cluster. The corresponding private keys can be used to login with the // user name `ubuntu` on port `2200`. Up to 10 keys can be specified. - // Wire name: 'ssh_public_keys' SshPublicKeys []string `json:"ssh_public_keys,omitempty"` // Time (in epoch milliseconds) when the cluster creation request was // received (when the cluster entered a `PENDING` state). - // Wire name: 'start_time' StartTime int64 `json:"start_time,omitempty"` // Current state of the cluster. - // Wire name: 'state' State State `json:"state,omitempty"` // A message associated with the most recent state transition (e.g., the // reason why the cluster entered a `TERMINATED` state). - // Wire name: 'state_message' StateMessage string `json:"state_message,omitempty"` // Time (in epoch milliseconds) when the cluster was terminated, if // applicable. - // Wire name: 'terminated_time' TerminatedTime int64 `json:"terminated_time,omitempty"` // Information about why the cluster was terminated. This field only appears // when the cluster is in a `TERMINATING` or `TERMINATED` state. - // Wire name: 'termination_reason' TerminationReason *TerminationReason `json:"termination_reason,omitempty"` // If set, what the total initial volume size (in GB) of the remote disks // should be. Currently only supported for GCP HYPERDISK_BALANCED disks. - // Wire name: 'total_initial_remote_disk_size' TotalInitialRemoteDiskSize int `json:"total_initial_remote_disk_size,omitempty"` // This field can only be used when `kind = CLASSIC_PREVIEW`. // // `effective_spark_version` is determined by `spark_version` (DBR release), // this field `use_ml_runtime`, and whether `node_type_id` is gpu node or // not. - // Wire name: 'use_ml_runtime' UseMlRuntime bool `json:"use_ml_runtime,omitempty"` // Cluster Attributes showing for clusters workload types. - // Wire name: 'workload_type' WorkloadType *WorkloadType `json:"workload_type,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ClusterDetails) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &clusterDetailsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := clusterDetailsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ClusterDetails) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ClusterDetails) MarshalJSON() ([]byte, error) { - pb, err := clusterDetailsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ClusterDetails) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ClusterEvent struct { - - // Wire name: 'cluster_id' ClusterId string `json:"cluster_id"` - // Wire name: 'data_plane_event_details' DataPlaneEventDetails *DataPlaneEventDetails `json:"data_plane_event_details,omitempty"` - // Wire name: 'details' Details *EventDetails `json:"details,omitempty"` // The timestamp when the event occurred, stored as the number of // milliseconds since the Unix epoch. If not provided, this will be assigned // by the Timeline service. - // Wire name: 'timestamp' Timestamp int64 `json:"timestamp,omitempty"` - // Wire name: 'type' Type EventType `json:"type,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ClusterEvent) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &clusterEventPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := clusterEventFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ClusterEvent) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ClusterEvent) MarshalJSON() ([]byte, error) { - pb, err := clusterEventToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ClusterEvent) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ClusterLibraryStatuses struct { // Unique identifier for the cluster. - // Wire name: 'cluster_id' ClusterId string `json:"cluster_id,omitempty"` // Status of all libraries on the cluster. - // Wire name: 'library_statuses' LibraryStatuses []LibraryFullStatus `json:"library_statuses,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ClusterLibraryStatuses) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &clusterLibraryStatusesPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := clusterLibraryStatusesFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ClusterLibraryStatuses) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ClusterLibraryStatuses) MarshalJSON() ([]byte, error) { - pb, err := clusterLibraryStatusesToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ClusterLibraryStatuses) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Cluster log delivery config type ClusterLogConf struct { // destination needs to be provided. e.g. `{ "dbfs" : { "destination" : // "dbfs:/home/cluster_log" } }` - // Wire name: 'dbfs' Dbfs *DbfsStorageInfo `json:"dbfs,omitempty"` // destination and either the region or endpoint need to be provided. e.g. // `{ "s3": { "destination" : "s3://cluster_log_bucket/prefix", "region" : // "us-west-2" } }` Cluster iam role is used to access s3, please make sure // the cluster iam role in `instance_profile_arn` has permission to write // data to the s3 destination. - // Wire name: 's3' S3 *S3StorageInfo `json:"s3,omitempty"` // destination needs to be provided, e.g. `{ "volumes": { "destination": // "/Volumes/catalog/schema/volume/cluster_log" } }` - // Wire name: 'volumes' Volumes *VolumesStorageInfo `json:"volumes,omitempty"` } -func (st *ClusterLogConf) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &clusterLogConfPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := clusterLogConfFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ClusterLogConf) MarshalJSON() ([]byte, error) { - pb, err := clusterLogConfToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type ClusterPermission struct { - - // Wire name: 'inherited' Inherited bool `json:"inherited,omitempty"` - // Wire name: 'inherited_from_object' InheritedFromObject []string `json:"inherited_from_object,omitempty"` // Permission level - // Wire name: 'permission_level' PermissionLevel ClusterPermissionLevel `json:"permission_level,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ClusterPermission) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &clusterPermissionPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := clusterPermissionFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ClusterPermission) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ClusterPermission) MarshalJSON() ([]byte, error) { - pb, err := clusterPermissionToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ClusterPermission) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Permission level @@ -1618,237 +1043,105 @@ func (f *ClusterPermissionLevel) Type() string { } type ClusterPermissions struct { - - // Wire name: 'access_control_list' AccessControlList []ClusterAccessControlResponse `json:"access_control_list,omitempty"` - // Wire name: 'object_id' ObjectId string `json:"object_id,omitempty"` - // Wire name: 'object_type' ObjectType string `json:"object_type,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ClusterPermissions) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &clusterPermissionsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := clusterPermissionsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ClusterPermissions) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ClusterPermissions) MarshalJSON() ([]byte, error) { - pb, err := clusterPermissionsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ClusterPermissions) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ClusterPermissionsDescription struct { - - // Wire name: 'description' Description string `json:"description,omitempty"` // Permission level - // Wire name: 'permission_level' PermissionLevel ClusterPermissionLevel `json:"permission_level,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ClusterPermissionsDescription) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &clusterPermissionsDescriptionPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := clusterPermissionsDescriptionFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ClusterPermissionsDescription) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ClusterPermissionsDescription) MarshalJSON() ([]byte, error) { - pb, err := clusterPermissionsDescriptionToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ClusterPermissionsDescription) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ClusterPermissionsRequest struct { - - // Wire name: 'access_control_list' AccessControlList []ClusterAccessControlRequest `json:"access_control_list,omitempty"` // The cluster for which to get or manage permissions. - ClusterId string `json:"-" tf:"-"` -} - -func (st *ClusterPermissionsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &clusterPermissionsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := clusterPermissionsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ClusterPermissionsRequest) MarshalJSON() ([]byte, error) { - pb, err := clusterPermissionsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + ClusterId string `json:"-" url:"-"` } type ClusterPolicyAccessControlRequest struct { // name of the group - // Wire name: 'group_name' GroupName string `json:"group_name,omitempty"` // Permission level - // Wire name: 'permission_level' PermissionLevel ClusterPolicyPermissionLevel `json:"permission_level,omitempty"` // application ID of a service principal - // Wire name: 'service_principal_name' ServicePrincipalName string `json:"service_principal_name,omitempty"` // name of the user - // Wire name: 'user_name' UserName string `json:"user_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ClusterPolicyAccessControlRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &clusterPolicyAccessControlRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := clusterPolicyAccessControlRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ClusterPolicyAccessControlRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ClusterPolicyAccessControlRequest) MarshalJSON() ([]byte, error) { - pb, err := clusterPolicyAccessControlRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ClusterPolicyAccessControlRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ClusterPolicyAccessControlResponse struct { // All permissions. - // Wire name: 'all_permissions' AllPermissions []ClusterPolicyPermission `json:"all_permissions,omitempty"` // Display name of the user or service principal. - // Wire name: 'display_name' DisplayName string `json:"display_name,omitempty"` // name of the group - // Wire name: 'group_name' GroupName string `json:"group_name,omitempty"` // Name of the service principal. - // Wire name: 'service_principal_name' ServicePrincipalName string `json:"service_principal_name,omitempty"` // name of the user - // Wire name: 'user_name' UserName string `json:"user_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ClusterPolicyAccessControlResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &clusterPolicyAccessControlResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := clusterPolicyAccessControlResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ClusterPolicyAccessControlResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ClusterPolicyAccessControlResponse) MarshalJSON() ([]byte, error) { - pb, err := clusterPolicyAccessControlResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ClusterPolicyAccessControlResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ClusterPolicyPermission struct { - - // Wire name: 'inherited' Inherited bool `json:"inherited,omitempty"` - // Wire name: 'inherited_from_object' InheritedFromObject []string `json:"inherited_from_object,omitempty"` // Permission level - // Wire name: 'permission_level' PermissionLevel ClusterPolicyPermissionLevel `json:"permission_level,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ClusterPolicyPermission) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &clusterPolicyPermissionPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := clusterPolicyPermissionFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ClusterPolicyPermission) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ClusterPolicyPermission) MarshalJSON() ([]byte, error) { - pb, err := clusterPolicyPermissionToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ClusterPolicyPermission) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Permission level @@ -1887,165 +1180,76 @@ func (f *ClusterPolicyPermissionLevel) Type() string { } type ClusterPolicyPermissions struct { - - // Wire name: 'access_control_list' AccessControlList []ClusterPolicyAccessControlResponse `json:"access_control_list,omitempty"` - // Wire name: 'object_id' ObjectId string `json:"object_id,omitempty"` - // Wire name: 'object_type' ObjectType string `json:"object_type,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ClusterPolicyPermissions) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &clusterPolicyPermissionsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := clusterPolicyPermissionsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ClusterPolicyPermissions) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ClusterPolicyPermissions) MarshalJSON() ([]byte, error) { - pb, err := clusterPolicyPermissionsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ClusterPolicyPermissions) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ClusterPolicyPermissionsDescription struct { - - // Wire name: 'description' Description string `json:"description,omitempty"` // Permission level - // Wire name: 'permission_level' PermissionLevel ClusterPolicyPermissionLevel `json:"permission_level,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ClusterPolicyPermissionsDescription) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &clusterPolicyPermissionsDescriptionPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := clusterPolicyPermissionsDescriptionFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ClusterPolicyPermissionsDescription) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ClusterPolicyPermissionsDescription) MarshalJSON() ([]byte, error) { - pb, err := clusterPolicyPermissionsDescriptionToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ClusterPolicyPermissionsDescription) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ClusterPolicyPermissionsRequest struct { - - // Wire name: 'access_control_list' AccessControlList []ClusterPolicyAccessControlRequest `json:"access_control_list,omitempty"` // The cluster policy for which to get or manage permissions. - ClusterPolicyId string `json:"-" tf:"-"` -} - -func (st *ClusterPolicyPermissionsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &clusterPolicyPermissionsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := clusterPolicyPermissionsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ClusterPolicyPermissionsRequest) MarshalJSON() ([]byte, error) { - pb, err := clusterPolicyPermissionsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + ClusterPolicyId string `json:"-" url:"-"` } // Represents a change to the cluster settings required for the cluster to // become compliant with its policy. type ClusterSettingsChange struct { // The field where this change would be made. - // Wire name: 'field' Field string `json:"field,omitempty"` // The new value of this field after enforcing policy compliance (either a // number, a boolean, or a string) converted to a string. This is intended // to be read by a human. The typed new value of this field can be retrieved // by reading the settings field in the API response. - // Wire name: 'new_value' NewValue string `json:"new_value,omitempty"` // The previous value of this field before enforcing policy compliance // (either a number, a boolean, or a string) converted to a string. This is // intended to be read by a human. The type of the field can be retrieved by // reading the settings field in the API response. - // Wire name: 'previous_value' PreviousValue string `json:"previous_value,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ClusterSettingsChange) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &clusterSettingsChangePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := clusterSettingsChangeFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ClusterSettingsChange) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ClusterSettingsChange) MarshalJSON() ([]byte, error) { - pb, err := clusterSettingsChangeToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ClusterSettingsChange) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ClusterSize struct { // Parameters needed in order to automatically scale clusters up and down // based on load. Note: autoscaling works best with DB runtime versions 3.0 // or later. - // Wire name: 'autoscale' Autoscale *AutoScale `json:"autoscale,omitempty"` // Number of worker nodes that this cluster should have. A cluster has one // Spark Driver and `num_workers` Executors for a total of `num_workers` + 1 @@ -2057,35 +1261,17 @@ type ClusterSize struct { // field will immediately be updated to reflect the target size of 10 // workers, whereas the workers listed in `spark_info` will gradually // increase from 5 to 10 as the new nodes are provisioned. - // Wire name: 'num_workers' NumWorkers int `json:"num_workers,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ClusterSize) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &clusterSizePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := clusterSizeFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ClusterSize) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ClusterSize) MarshalJSON() ([]byte, error) { - pb, err := clusterSizeToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ClusterSize) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Determines whether the cluster was created by a user through the UI, created @@ -2149,27 +1335,22 @@ type ClusterSpec struct { // When set to true, fixed and default values from the policy will be used // for fields that are omitted. When set to false, only fixed values from // the policy will be applied. - // Wire name: 'apply_policy_default_values' ApplyPolicyDefaultValues bool `json:"apply_policy_default_values,omitempty"` // Parameters needed in order to automatically scale clusters up and down // based on load. Note: autoscaling works best with DB runtime versions 3.0 // or later. - // Wire name: 'autoscale' Autoscale *AutoScale `json:"autoscale,omitempty"` // Automatically terminates the cluster after it is inactive for this time // in minutes. If not set, this cluster will not be automatically // terminated. If specified, the threshold must be between 10 and 10000 // minutes. Users can also set this value to 0 to explicitly disable // automatic termination. - // Wire name: 'autotermination_minutes' AutoterminationMinutes int `json:"autotermination_minutes,omitempty"` // Attributes related to clusters running on Amazon Web Services. If not // specified at cluster creation, a set of default values will be used. - // Wire name: 'aws_attributes' AwsAttributes *AwsAttributes `json:"aws_attributes,omitempty"` // Attributes related to clusters running on Microsoft Azure. If not // specified at cluster creation, a set of default values will be used. - // Wire name: 'azure_attributes' AzureAttributes *AzureAttributes `json:"azure_attributes,omitempty"` // The configuration for delivering spark logs to a long-term storage // destination. Three kinds of destinations (DBFS, S3 and Unity Catalog @@ -2178,13 +1359,11 @@ type ClusterSpec struct { // destination every `5 mins`. The destination of driver logs is // `$destination/$clusterId/driver`, while the destination of executor logs // is `$destination/$clusterId/executor`. - // Wire name: 'cluster_log_conf' ClusterLogConf *ClusterLogConf `json:"cluster_log_conf,omitempty"` // Cluster name requested by the user. This doesn't have to be unique. If // not specified at creation, the cluster name will be an empty string. For // job clusters, the cluster name is automatically set based on the job and // job run IDs. - // Wire name: 'cluster_name' ClusterName string `json:"cluster_name,omitempty"` // Additional tags for cluster resources. Databricks will tag all cluster // resources (e.g., AWS instances and EBS volumes) with these tags in @@ -2194,7 +1373,6 @@ type ClusterSpec struct { // // - Clusters can only reuse cloud resources if the resources' tags are a // subset of the cluster tags - // Wire name: 'custom_tags' CustomTags map[string]string `json:"custom_tags,omitempty"` // Data security mode decides what data governance model to use when // accessing data from a cluster. @@ -2225,15 +1403,12 @@ type ClusterSpec struct { // `LEGACY_SINGLE_USER`: This mode is for users migrating from legacy // Passthrough on standard clusters. * `LEGACY_SINGLE_USER_STANDARD`: This // mode provides a way that doesn’t have UC nor passthrough enabled. - // Wire name: 'data_security_mode' DataSecurityMode DataSecurityMode `json:"data_security_mode,omitempty"` // Custom docker image BYOC - // Wire name: 'docker_image' DockerImage *DockerImage `json:"docker_image,omitempty"` // The optional ID of the instance pool for the driver of the cluster // belongs. The pool cluster uses the instance pool with id // (instance_pool_id) if the driver pool is not assigned. - // Wire name: 'driver_instance_pool_id' DriverInstancePoolId string `json:"driver_instance_pool_id,omitempty"` // The node type of the Spark driver. Note that this field is optional; if // unset, the driver node type will be set as the same value as @@ -2243,35 +1418,28 @@ type ClusterSpec struct { // virtual_cluster_size is set. If both driver_node_type_id, node_type_id, // and virtual_cluster_size are specified, driver_node_type_id and // node_type_id take precedence. - // Wire name: 'driver_node_type_id' DriverNodeTypeId string `json:"driver_node_type_id,omitempty"` // Autoscaling Local Storage: when enabled, this cluster will dynamically // acquire additional disk space when its Spark workers are running low on // disk space. This feature requires specific AWS permissions to function // correctly - refer to the User Guide for more details. - // Wire name: 'enable_elastic_disk' EnableElasticDisk bool `json:"enable_elastic_disk,omitempty"` // Whether to enable LUKS on cluster VMs' local disks - // Wire name: 'enable_local_disk_encryption' EnableLocalDiskEncryption bool `json:"enable_local_disk_encryption,omitempty"` // Attributes related to clusters running on Google Cloud Platform. If not // specified at cluster creation, a set of default values will be used. - // Wire name: 'gcp_attributes' GcpAttributes *GcpAttributes `json:"gcp_attributes,omitempty"` // The configuration for storing init scripts. Any number of destinations // can be specified. The scripts are executed sequentially in the order // provided. If `cluster_log_conf` is specified, init script logs are sent // to `//init_scripts`. - // Wire name: 'init_scripts' InitScripts []InitScriptInfo `json:"init_scripts,omitempty"` // The optional ID of the instance pool to which the cluster belongs. - // Wire name: 'instance_pool_id' InstancePoolId string `json:"instance_pool_id,omitempty"` // This field can only be used when `kind = CLASSIC_PREVIEW`. // // When set to true, Databricks will automatically set single node related // `custom_tags`, `spark_conf`, and `num_workers` - // Wire name: 'is_single_node' IsSingleNode bool `json:"is_single_node,omitempty"` // The kind of compute described by this compute specification. // @@ -2290,14 +1458,12 @@ type ClusterSpec struct { // CLASSIC_PREVIEW`. // // [simple form]: https://docs.databricks.com/compute/simple-form.html - // Wire name: 'kind' Kind Kind `json:"kind,omitempty"` // This field encodes, through a single value, the resources available to // each of the Spark nodes in this cluster. For example, the Spark nodes can // be provisioned and optimized for memory or compute intensive workloads. A // list of available node types can be retrieved by using the // :method:clusters/listNodeTypes API call. - // Wire name: 'node_type_id' NodeTypeId string `json:"node_type_id,omitempty"` // Number of worker nodes that this cluster should have. A cluster has one // Spark Driver and `num_workers` Executors for a total of `num_workers` + 1 @@ -2309,14 +1475,11 @@ type ClusterSpec struct { // field will immediately be updated to reflect the target size of 10 // workers, whereas the workers listed in `spark_info` will gradually // increase from 5 to 10 as the new nodes are provisioned. - // Wire name: 'num_workers' NumWorkers int `json:"num_workers,omitempty"` // The ID of the cluster policy used to create the cluster if applicable. - // Wire name: 'policy_id' PolicyId string `json:"policy_id,omitempty"` // If set, what the configurable throughput (in Mb/s) for the remote disk // is. Currently only supported for GCP HYPERDISK_BALANCED disks. - // Wire name: 'remote_disk_throughput' RemoteDiskThroughput int `json:"remote_disk_throughput,omitempty"` // Determines the cluster's runtime engine, either standard or Photon. // @@ -2326,17 +1489,14 @@ type ClusterSpec struct { // // If left unspecified, the runtime engine defaults to standard unless the // spark_version contains -photon-, in which case Photon will be used. - // Wire name: 'runtime_engine' RuntimeEngine RuntimeEngine `json:"runtime_engine,omitempty"` // Single user name if data_security_mode is `SINGLE_USER` - // Wire name: 'single_user_name' SingleUserName string `json:"single_user_name,omitempty"` // An object containing a set of optional, user-specified Spark // configuration key-value pairs. Users can also pass in a string of extra // JVM options to the driver and the executors via // `spark.driver.extraJavaOptions` and `spark.executor.extraJavaOptions` // respectively. - // Wire name: 'spark_conf' SparkConf map[string]string `json:"spark_conf,omitempty"` // An object containing a set of optional, user-specified environment // variable key-value pairs. Please note that key-value pair of the form @@ -2351,132 +1511,63 @@ type ClusterSpec struct { // Example Spark environment variables: `{"SPARK_WORKER_MEMORY": "28000m", // "SPARK_LOCAL_DIRS": "/local_disk0"}` or `{"SPARK_DAEMON_JAVA_OPTS": // "$SPARK_DAEMON_JAVA_OPTS -Dspark.shuffle.service.enabled=true"}` - // Wire name: 'spark_env_vars' SparkEnvVars map[string]string `json:"spark_env_vars,omitempty"` // The Spark version of the cluster, e.g. `3.3.x-scala2.11`. A list of // available Spark versions can be retrieved by using the // :method:clusters/sparkVersions API call. - // Wire name: 'spark_version' SparkVersion string `json:"spark_version,omitempty"` // SSH public key contents that will be added to each Spark node in this // cluster. The corresponding private keys can be used to login with the // user name `ubuntu` on port `2200`. Up to 10 keys can be specified. - // Wire name: 'ssh_public_keys' SshPublicKeys []string `json:"ssh_public_keys,omitempty"` // If set, what the total initial volume size (in GB) of the remote disks // should be. Currently only supported for GCP HYPERDISK_BALANCED disks. - // Wire name: 'total_initial_remote_disk_size' TotalInitialRemoteDiskSize int `json:"total_initial_remote_disk_size,omitempty"` // This field can only be used when `kind = CLASSIC_PREVIEW`. // // `effective_spark_version` is determined by `spark_version` (DBR release), // this field `use_ml_runtime`, and whether `node_type_id` is gpu node or // not. - // Wire name: 'use_ml_runtime' UseMlRuntime bool `json:"use_ml_runtime,omitempty"` // Cluster Attributes showing for clusters workload types. - // Wire name: 'workload_type' WorkloadType *WorkloadType `json:"workload_type,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ClusterSpec) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &clusterSpecPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := clusterSpecFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ClusterSpec) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ClusterSpec) MarshalJSON() ([]byte, error) { - pb, err := clusterSpecToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ClusterSpec) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get status type ClusterStatus struct { // Unique identifier of the cluster whose status should be retrieved. - ClusterId string `json:"-" tf:"-"` -} - -func (st *ClusterStatus) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &clusterStatusPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := clusterStatusFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ClusterStatus) MarshalJSON() ([]byte, error) { - pb, err := clusterStatusToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + ClusterId string `json:"-" url:"cluster_id"` } type Command struct { // Running cluster id - // Wire name: 'clusterId' ClusterId string `json:"clusterId,omitempty"` // Executable code - // Wire name: 'command' Command string `json:"command,omitempty"` // Running context id - // Wire name: 'contextId' ContextId string `json:"contextId,omitempty"` - // Wire name: 'language' Language Language `json:"language,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *Command) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &commandPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := commandFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *Command) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st Command) MarshalJSON() ([]byte, error) { - pb, err := commandToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s Command) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CommandStatus string @@ -2530,75 +1621,29 @@ func (f *CommandStatus) Type() string { // Get command info type CommandStatusRequest struct { - ClusterId string `json:"-" tf:"-"` + ClusterId string `json:"-" url:"clusterId"` - CommandId string `json:"-" tf:"-"` + CommandId string `json:"-" url:"commandId"` - ContextId string `json:"-" tf:"-"` -} - -func (st *CommandStatusRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &commandStatusRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := commandStatusRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CommandStatusRequest) MarshalJSON() ([]byte, error) { - pb, err := commandStatusRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + ContextId string `json:"-" url:"contextId"` } type CommandStatusResponse struct { - - // Wire name: 'id' Id string `json:"id,omitempty"` - // Wire name: 'results' Results *Results `json:"results,omitempty"` - // Wire name: 'status' Status CommandStatus `json:"status,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CommandStatusResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &commandStatusResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := commandStatusResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CommandStatusResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CommandStatusResponse) MarshalJSON() ([]byte, error) { - pb, err := commandStatusResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CommandStatusResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ContextStatus string @@ -2643,101 +1688,50 @@ func (f *ContextStatus) Type() string { // Get status type ContextStatusRequest struct { - ClusterId string `json:"-" tf:"-"` - - ContextId string `json:"-" tf:"-"` -} - -func (st *ContextStatusRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &contextStatusRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := contextStatusRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} + ClusterId string `json:"-" url:"clusterId"` -func (st ContextStatusRequest) MarshalJSON() ([]byte, error) { - pb, err := contextStatusRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + ContextId string `json:"-" url:"contextId"` } type ContextStatusResponse struct { - - // Wire name: 'id' Id string `json:"id,omitempty"` - // Wire name: 'status' Status ContextStatus `json:"status,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ContextStatusResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &contextStatusResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := contextStatusResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ContextStatusResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ContextStatusResponse) MarshalJSON() ([]byte, error) { - pb, err := contextStatusResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ContextStatusResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreateCluster struct { // When set to true, fixed and default values from the policy will be used // for fields that are omitted. When set to false, only fixed values from // the policy will be applied. - // Wire name: 'apply_policy_default_values' ApplyPolicyDefaultValues bool `json:"apply_policy_default_values,omitempty"` // Parameters needed in order to automatically scale clusters up and down // based on load. Note: autoscaling works best with DB runtime versions 3.0 // or later. - // Wire name: 'autoscale' Autoscale *AutoScale `json:"autoscale,omitempty"` // Automatically terminates the cluster after it is inactive for this time // in minutes. If not set, this cluster will not be automatically // terminated. If specified, the threshold must be between 10 and 10000 // minutes. Users can also set this value to 0 to explicitly disable // automatic termination. - // Wire name: 'autotermination_minutes' AutoterminationMinutes int `json:"autotermination_minutes,omitempty"` // Attributes related to clusters running on Amazon Web Services. If not // specified at cluster creation, a set of default values will be used. - // Wire name: 'aws_attributes' AwsAttributes *AwsAttributes `json:"aws_attributes,omitempty"` // Attributes related to clusters running on Microsoft Azure. If not // specified at cluster creation, a set of default values will be used. - // Wire name: 'azure_attributes' AzureAttributes *AzureAttributes `json:"azure_attributes,omitempty"` // When specified, this clones libraries from a source cluster during the // creation of a new cluster. - // Wire name: 'clone_from' CloneFrom *CloneCluster `json:"clone_from,omitempty"` // The configuration for delivering spark logs to a long-term storage // destination. Three kinds of destinations (DBFS, S3 and Unity Catalog @@ -2746,13 +1740,11 @@ type CreateCluster struct { // destination every `5 mins`. The destination of driver logs is // `$destination/$clusterId/driver`, while the destination of executor logs // is `$destination/$clusterId/executor`. - // Wire name: 'cluster_log_conf' ClusterLogConf *ClusterLogConf `json:"cluster_log_conf,omitempty"` // Cluster name requested by the user. This doesn't have to be unique. If // not specified at creation, the cluster name will be an empty string. For // job clusters, the cluster name is automatically set based on the job and // job run IDs. - // Wire name: 'cluster_name' ClusterName string `json:"cluster_name,omitempty"` // Additional tags for cluster resources. Databricks will tag all cluster // resources (e.g., AWS instances and EBS volumes) with these tags in @@ -2762,7 +1754,6 @@ type CreateCluster struct { // // - Clusters can only reuse cloud resources if the resources' tags are a // subset of the cluster tags - // Wire name: 'custom_tags' CustomTags map[string]string `json:"custom_tags,omitempty"` // Data security mode decides what data governance model to use when // accessing data from a cluster. @@ -2793,15 +1784,12 @@ type CreateCluster struct { // `LEGACY_SINGLE_USER`: This mode is for users migrating from legacy // Passthrough on standard clusters. * `LEGACY_SINGLE_USER_STANDARD`: This // mode provides a way that doesn’t have UC nor passthrough enabled. - // Wire name: 'data_security_mode' DataSecurityMode DataSecurityMode `json:"data_security_mode,omitempty"` // Custom docker image BYOC - // Wire name: 'docker_image' DockerImage *DockerImage `json:"docker_image,omitempty"` // The optional ID of the instance pool for the driver of the cluster // belongs. The pool cluster uses the instance pool with id // (instance_pool_id) if the driver pool is not assigned. - // Wire name: 'driver_instance_pool_id' DriverInstancePoolId string `json:"driver_instance_pool_id,omitempty"` // The node type of the Spark driver. Note that this field is optional; if // unset, the driver node type will be set as the same value as @@ -2811,35 +1799,28 @@ type CreateCluster struct { // virtual_cluster_size is set. If both driver_node_type_id, node_type_id, // and virtual_cluster_size are specified, driver_node_type_id and // node_type_id take precedence. - // Wire name: 'driver_node_type_id' DriverNodeTypeId string `json:"driver_node_type_id,omitempty"` // Autoscaling Local Storage: when enabled, this cluster will dynamically // acquire additional disk space when its Spark workers are running low on // disk space. This feature requires specific AWS permissions to function // correctly - refer to the User Guide for more details. - // Wire name: 'enable_elastic_disk' EnableElasticDisk bool `json:"enable_elastic_disk,omitempty"` // Whether to enable LUKS on cluster VMs' local disks - // Wire name: 'enable_local_disk_encryption' EnableLocalDiskEncryption bool `json:"enable_local_disk_encryption,omitempty"` // Attributes related to clusters running on Google Cloud Platform. If not // specified at cluster creation, a set of default values will be used. - // Wire name: 'gcp_attributes' GcpAttributes *GcpAttributes `json:"gcp_attributes,omitempty"` // The configuration for storing init scripts. Any number of destinations // can be specified. The scripts are executed sequentially in the order // provided. If `cluster_log_conf` is specified, init script logs are sent // to `//init_scripts`. - // Wire name: 'init_scripts' InitScripts []InitScriptInfo `json:"init_scripts,omitempty"` // The optional ID of the instance pool to which the cluster belongs. - // Wire name: 'instance_pool_id' InstancePoolId string `json:"instance_pool_id,omitempty"` // This field can only be used when `kind = CLASSIC_PREVIEW`. // // When set to true, Databricks will automatically set single node related // `custom_tags`, `spark_conf`, and `num_workers` - // Wire name: 'is_single_node' IsSingleNode bool `json:"is_single_node,omitempty"` // The kind of compute described by this compute specification. // @@ -2858,14 +1839,12 @@ type CreateCluster struct { // CLASSIC_PREVIEW`. // // [simple form]: https://docs.databricks.com/compute/simple-form.html - // Wire name: 'kind' Kind Kind `json:"kind,omitempty"` // This field encodes, through a single value, the resources available to // each of the Spark nodes in this cluster. For example, the Spark nodes can // be provisioned and optimized for memory or compute intensive workloads. A // list of available node types can be retrieved by using the // :method:clusters/listNodeTypes API call. - // Wire name: 'node_type_id' NodeTypeId string `json:"node_type_id,omitempty"` // Number of worker nodes that this cluster should have. A cluster has one // Spark Driver and `num_workers` Executors for a total of `num_workers` + 1 @@ -2877,14 +1856,11 @@ type CreateCluster struct { // field will immediately be updated to reflect the target size of 10 // workers, whereas the workers listed in `spark_info` will gradually // increase from 5 to 10 as the new nodes are provisioned. - // Wire name: 'num_workers' NumWorkers int `json:"num_workers,omitempty"` // The ID of the cluster policy used to create the cluster if applicable. - // Wire name: 'policy_id' PolicyId string `json:"policy_id,omitempty"` // If set, what the configurable throughput (in Mb/s) for the remote disk // is. Currently only supported for GCP HYPERDISK_BALANCED disks. - // Wire name: 'remote_disk_throughput' RemoteDiskThroughput int `json:"remote_disk_throughput,omitempty"` // Determines the cluster's runtime engine, either standard or Photon. // @@ -2894,17 +1870,14 @@ type CreateCluster struct { // // If left unspecified, the runtime engine defaults to standard unless the // spark_version contains -photon-, in which case Photon will be used. - // Wire name: 'runtime_engine' RuntimeEngine RuntimeEngine `json:"runtime_engine,omitempty"` // Single user name if data_security_mode is `SINGLE_USER` - // Wire name: 'single_user_name' SingleUserName string `json:"single_user_name,omitempty"` // An object containing a set of optional, user-specified Spark // configuration key-value pairs. Users can also pass in a string of extra // JVM options to the driver and the executors via // `spark.driver.extraJavaOptions` and `spark.executor.extraJavaOptions` // respectively. - // Wire name: 'spark_conf' SparkConf map[string]string `json:"spark_conf,omitempty"` // An object containing a set of optional, user-specified environment // variable key-value pairs. Please note that key-value pair of the form @@ -2919,160 +1892,93 @@ type CreateCluster struct { // Example Spark environment variables: `{"SPARK_WORKER_MEMORY": "28000m", // "SPARK_LOCAL_DIRS": "/local_disk0"}` or `{"SPARK_DAEMON_JAVA_OPTS": // "$SPARK_DAEMON_JAVA_OPTS -Dspark.shuffle.service.enabled=true"}` - // Wire name: 'spark_env_vars' SparkEnvVars map[string]string `json:"spark_env_vars,omitempty"` // The Spark version of the cluster, e.g. `3.3.x-scala2.11`. A list of // available Spark versions can be retrieved by using the // :method:clusters/sparkVersions API call. - // Wire name: 'spark_version' SparkVersion string `json:"spark_version"` // SSH public key contents that will be added to each Spark node in this // cluster. The corresponding private keys can be used to login with the // user name `ubuntu` on port `2200`. Up to 10 keys can be specified. - // Wire name: 'ssh_public_keys' SshPublicKeys []string `json:"ssh_public_keys,omitempty"` // If set, what the total initial volume size (in GB) of the remote disks // should be. Currently only supported for GCP HYPERDISK_BALANCED disks. - // Wire name: 'total_initial_remote_disk_size' TotalInitialRemoteDiskSize int `json:"total_initial_remote_disk_size,omitempty"` // This field can only be used when `kind = CLASSIC_PREVIEW`. // // `effective_spark_version` is determined by `spark_version` (DBR release), // this field `use_ml_runtime`, and whether `node_type_id` is gpu node or // not. - // Wire name: 'use_ml_runtime' UseMlRuntime bool `json:"use_ml_runtime,omitempty"` // Cluster Attributes showing for clusters workload types. - // Wire name: 'workload_type' WorkloadType *WorkloadType `json:"workload_type,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateCluster) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createClusterPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createClusterFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateCluster) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateCluster) MarshalJSON() ([]byte, error) { - pb, err := createClusterToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateCluster) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreateClusterResponse struct { - - // Wire name: 'cluster_id' ClusterId string `json:"cluster_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateClusterResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createClusterResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createClusterResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateClusterResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateClusterResponse) MarshalJSON() ([]byte, error) { - pb, err := createClusterResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateClusterResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreateContext struct { // Running cluster id - // Wire name: 'clusterId' ClusterId string `json:"clusterId,omitempty"` - // Wire name: 'language' Language Language `json:"language,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateContext) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createContextPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createContextFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateContext) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateContext) MarshalJSON() ([]byte, error) { - pb, err := createContextToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateContext) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreateInstancePool struct { // Attributes related to instance pools running on Amazon Web Services. If // not specified at pool creation, a set of default values will be used. - // Wire name: 'aws_attributes' AwsAttributes *InstancePoolAwsAttributes `json:"aws_attributes,omitempty"` // Attributes related to instance pools running on Azure. If not specified // at pool creation, a set of default values will be used. - // Wire name: 'azure_attributes' AzureAttributes *InstancePoolAzureAttributes `json:"azure_attributes,omitempty"` // Additional tags for pool resources. Databricks will tag all pool // resources (e.g., AWS instances and EBS volumes) with these tags in // addition to `default_tags`. Notes: // // - Currently, Databricks allows at most 45 custom tags - // Wire name: 'custom_tags' CustomTags map[string]string `json:"custom_tags,omitempty"` // Defines the specification of the disks that will be attached to all spark // containers. - // Wire name: 'disk_spec' DiskSpec *DiskSpec `json:"disk_spec,omitempty"` // Autoscaling Local Storage: when enabled, this instances in this pool will // dynamically acquire additional disk space when its Spark workers are // running low on disk space. In AWS, this feature requires specific AWS // permissions to function correctly - refer to the User Guide for more // details. - // Wire name: 'enable_elastic_disk' EnableElasticDisk bool `json:"enable_elastic_disk,omitempty"` // Attributes related to instance pools running on Google Cloud Platform. If // not specified at pool creation, a set of default values will be used. - // Wire name: 'gcp_attributes' GcpAttributes *InstancePoolGcpAttributes `json:"gcp_attributes,omitempty"` // Automatically terminates the extra instances in the pool cache after they // are inactive for this time in minutes if min_idle_instances requirement @@ -3081,104 +1987,60 @@ type CreateInstancePool struct { // threshold must be between 0 and 10000 minutes. Users can also set this // value to 0 to instantly remove idle instances from the cache if min cache // size could still hold. - // Wire name: 'idle_instance_autotermination_minutes' IdleInstanceAutoterminationMinutes int `json:"idle_instance_autotermination_minutes,omitempty"` // Pool name requested by the user. Pool name must be unique. Length must be // between 1 and 100 characters. - // Wire name: 'instance_pool_name' InstancePoolName string `json:"instance_pool_name"` // Maximum number of outstanding instances to keep in the pool, including // both instances used by clusters and idle instances. Clusters that require // further instance provisioning will fail during upsize requests. - // Wire name: 'max_capacity' MaxCapacity int `json:"max_capacity,omitempty"` // Minimum number of idle instances to keep in the instance pool - // Wire name: 'min_idle_instances' MinIdleInstances int `json:"min_idle_instances,omitempty"` // This field encodes, through a single value, the resources available to // each of the Spark nodes in this cluster. For example, the Spark nodes can // be provisioned and optimized for memory or compute intensive workloads. A // list of available node types can be retrieved by using the // :method:clusters/listNodeTypes API call. - // Wire name: 'node_type_id' NodeTypeId string `json:"node_type_id"` // Custom Docker Image BYOC - // Wire name: 'preloaded_docker_images' PreloadedDockerImages []DockerImage `json:"preloaded_docker_images,omitempty"` // A list containing at most one preloaded Spark image version for the pool. // Pool-backed clusters started with the preloaded Spark version will start // faster. A list of available Spark versions can be retrieved by using the // :method:clusters/sparkVersions API call. - // Wire name: 'preloaded_spark_versions' PreloadedSparkVersions []string `json:"preloaded_spark_versions,omitempty"` // If set, what the configurable throughput (in Mb/s) for the remote disk // is. Currently only supported for GCP HYPERDISK_BALANCED types. - // Wire name: 'remote_disk_throughput' RemoteDiskThroughput int `json:"remote_disk_throughput,omitempty"` // If set, what the total initial volume size (in GB) of the remote disks // should be. Currently only supported for GCP HYPERDISK_BALANCED types. - // Wire name: 'total_initial_remote_disk_size' TotalInitialRemoteDiskSize int `json:"total_initial_remote_disk_size,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateInstancePool) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createInstancePoolPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createInstancePoolFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateInstancePool) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateInstancePool) MarshalJSON() ([]byte, error) { - pb, err := createInstancePoolToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateInstancePool) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreateInstancePoolResponse struct { // The ID of the created instance pool. - // Wire name: 'instance_pool_id' InstancePoolId string `json:"instance_pool_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateInstancePoolResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createInstancePoolResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createInstancePoolResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateInstancePoolResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateInstancePoolResponse) MarshalJSON() ([]byte, error) { - pb, err := createInstancePoolResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateInstancePoolResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreatePolicy struct { @@ -3186,22 +2048,17 @@ type CreatePolicy struct { // Definition Language]. // // [Databricks Cluster Policy Definition Language]: https://docs.databricks.com/administration-guide/clusters/policy-definition.html - // Wire name: 'definition' Definition string `json:"definition,omitempty"` // Additional human-readable description of the cluster policy. - // Wire name: 'description' Description string `json:"description,omitempty"` // A list of libraries to be installed on the next cluster restart that uses // this policy. The maximum number of libraries is 500. - // Wire name: 'libraries' Libraries []Library `json:"libraries,omitempty"` // Max number of clusters per user that can be active using this policy. If // not present, there is no max limit. - // Wire name: 'max_clusters_per_user' MaxClustersPerUser int64 `json:"max_clusters_per_user,omitempty"` // Cluster Policy name requested by the user. This has to be unique. Length // must be between 1 and 100 characters. - // Wire name: 'name' Name string `json:"name,omitempty"` // Policy definition JSON document expressed in [Databricks Policy // Definition Language]. The JSON document must be passed as a string and @@ -3212,7 +2069,6 @@ type CreatePolicy struct { // policy definition. // // [Databricks Policy Definition Language]: https://docs.databricks.com/administration-guide/clusters/policy-definition.html - // Wire name: 'policy_family_definition_overrides' PolicyFamilyDefinitionOverrides string `json:"policy_family_definition_overrides,omitempty"` // ID of the policy family. The cluster policy's policy definition inherits // the policy family's policy definition. @@ -3220,214 +2076,100 @@ type CreatePolicy struct { // Cannot be used with `definition`. Use // `policy_family_definition_overrides` instead to customize the policy // definition. - // Wire name: 'policy_family_id' PolicyFamilyId string `json:"policy_family_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreatePolicy) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createPolicyPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createPolicyFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreatePolicy) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreatePolicy) MarshalJSON() ([]byte, error) { - pb, err := createPolicyToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreatePolicy) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreatePolicyResponse struct { // Canonical unique identifier for the cluster policy. - // Wire name: 'policy_id' PolicyId string `json:"policy_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreatePolicyResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createPolicyResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createPolicyResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreatePolicyResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreatePolicyResponse) MarshalJSON() ([]byte, error) { - pb, err := createPolicyResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreatePolicyResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreateResponse struct { // The global init script ID. - // Wire name: 'script_id' ScriptId string `json:"script_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateResponse) MarshalJSON() ([]byte, error) { - pb, err := createResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type Created struct { - - // Wire name: 'id' Id string `json:"id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *Created) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createdPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createdFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *Created) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st Created) MarshalJSON() ([]byte, error) { - pb, err := createdToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s Created) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CustomPolicyTag struct { // The key of the tag. - Must be unique among all custom tags of the same // policy - Cannot be “budget-policy-name”, “budget-policy-id” or // "budget-policy-resolution-result" - these tags are preserved. - // Wire name: 'key' Key string `json:"key"` // The value of the tag. - // Wire name: 'value' Value string `json:"value,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CustomPolicyTag) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &customPolicyTagPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := customPolicyTagFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CustomPolicyTag) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CustomPolicyTag) MarshalJSON() ([]byte, error) { - pb, err := customPolicyTagToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CustomPolicyTag) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type DataPlaneEventDetails struct { - - // Wire name: 'event_type' EventType DataPlaneEventDetailsEventType `json:"event_type,omitempty"` - // Wire name: 'executor_failures' ExecutorFailures int `json:"executor_failures,omitempty"` - // Wire name: 'host_id' HostId string `json:"host_id,omitempty"` - // Wire name: 'timestamp' Timestamp int64 `json:"timestamp,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DataPlaneEventDetails) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &dataPlaneEventDetailsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := dataPlaneEventDetailsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DataPlaneEventDetails) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DataPlaneEventDetails) MarshalJSON() ([]byte, error) { - pb, err := dataPlaneEventDetailsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DataPlaneEventDetails) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type DataPlaneEventDetailsEventType string @@ -3579,333 +2321,51 @@ func (f *DataSecurityMode) Type() string { // A storage location in DBFS type DbfsStorageInfo struct { // dbfs destination, e.g. `dbfs:/my/path` - // Wire name: 'destination' Destination string `json:"destination"` } -func (st *DbfsStorageInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &dbfsStorageInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := dbfsStorageInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DbfsStorageInfo) MarshalJSON() ([]byte, error) { - pb, err := dbfsStorageInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type DeleteCluster struct { // The cluster to be terminated. - // Wire name: 'cluster_id' ClusterId string `json:"cluster_id"` } -func (st *DeleteCluster) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteClusterPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteClusterFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteCluster) MarshalJSON() ([]byte, error) { - pb, err := deleteClusterToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type DeleteClusterResponse struct { } -func (st *DeleteClusterResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteClusterResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteClusterResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteClusterResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteClusterResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Delete init script type DeleteGlobalInitScriptRequest struct { // The ID of the global init script. - ScriptId string `json:"-" tf:"-"` -} - -func (st *DeleteGlobalInitScriptRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteGlobalInitScriptRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteGlobalInitScriptRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteGlobalInitScriptRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteGlobalInitScriptRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + ScriptId string `json:"-" url:"-"` } type DeleteInstancePool struct { // The instance pool to be terminated. - // Wire name: 'instance_pool_id' InstancePoolId string `json:"instance_pool_id"` } -func (st *DeleteInstancePool) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteInstancePoolPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteInstancePoolFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteInstancePool) MarshalJSON() ([]byte, error) { - pb, err := deleteInstancePoolToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type DeleteInstancePoolResponse struct { } -func (st *DeleteInstancePoolResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteInstancePoolResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteInstancePoolResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteInstancePoolResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteInstancePoolResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type DeletePolicy struct { // The ID of the policy to delete. - // Wire name: 'policy_id' PolicyId string `json:"policy_id"` } -func (st *DeletePolicy) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deletePolicyPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deletePolicyFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeletePolicy) MarshalJSON() ([]byte, error) { - pb, err := deletePolicyToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type DeletePolicyResponse struct { } -func (st *DeletePolicyResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deletePolicyResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deletePolicyResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeletePolicyResponse) MarshalJSON() ([]byte, error) { - pb, err := deletePolicyResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type DeleteResponse struct { } -func (st *DeleteResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type DestroyContext struct { - - // Wire name: 'clusterId' ClusterId string `json:"clusterId"` - // Wire name: 'contextId' ContextId string `json:"contextId"` } -func (st *DestroyContext) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &destroyContextPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := destroyContextFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DestroyContext) MarshalJSON() ([]byte, error) { - pb, err := destroyContextToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type DestroyResponse struct { } -func (st *DestroyResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &destroyResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := destroyResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DestroyResponse) MarshalJSON() ([]byte, error) { - pb, err := destroyResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Describes the disks that are launched for each instance in the spark cluster. // For example, if the cluster has 3 instances, each instance is configured to // launch 2 disks, 100 GiB each, then Databricks will launch a total of 6 disks, @@ -3927,10 +2387,8 @@ type DiskSpec struct { // // Disks will be mounted at: - For AWS: `/ebs0`, `/ebs1`, and etc. - For // Azure: `/remote_volume0`, `/remote_volume1`, and etc. - // Wire name: 'disk_count' DiskCount int `json:"disk_count,omitempty"` - // Wire name: 'disk_iops' DiskIops int `json:"disk_iops,omitempty"` // The size of each disk (in GiB) launched for each instance. Values must // fall into the supported range for a particular instance type. @@ -3940,80 +2398,33 @@ type DiskSpec struct { // // For Azure: - Premium LRS (SSD): 1 - 1023 GiB - Standard LRS (HDD): 1- // 1023 GiB - // Wire name: 'disk_size' DiskSize int `json:"disk_size,omitempty"` - // Wire name: 'disk_throughput' DiskThroughput int `json:"disk_throughput,omitempty"` // The type of disks that will be launched with this cluster. - // Wire name: 'disk_type' DiskType *DiskType `json:"disk_type,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DiskSpec) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &diskSpecPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := diskSpecFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DiskSpec) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DiskSpec) MarshalJSON() ([]byte, error) { - pb, err := diskSpecToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DiskSpec) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Describes the disk type. type DiskType struct { // All Azure Disk types that Databricks supports. See // https://docs.microsoft.com/en-us/azure/storage/storage-about-disks-and-vhds-linux#types-of-disks - // Wire name: 'azure_disk_volume_type' AzureDiskVolumeType DiskTypeAzureDiskVolumeType `json:"azure_disk_volume_type,omitempty"` // All EBS volume types that Databricks supports. See // https://aws.amazon.com/ebs/details/ for details. - // Wire name: 'ebs_volume_type' EbsVolumeType DiskTypeEbsVolumeType `json:"ebs_volume_type,omitempty"` } -func (st *DiskType) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &diskTypePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := diskTypeFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DiskType) MarshalJSON() ([]byte, error) { - pb, err := diskTypeToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // All Azure Disk types that Databricks supports. See // https://docs.microsoft.com/en-us/azure/storage/storage-about-disks-and-vhds-linux#types-of-disks type DiskTypeAzureDiskVolumeType string @@ -4094,74 +2505,36 @@ func (f *DiskTypeEbsVolumeType) Type() string { type DockerBasicAuth struct { // Password of the user - // Wire name: 'password' Password string `json:"password,omitempty"` // Name of the user - // Wire name: 'username' Username string `json:"username,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DockerBasicAuth) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &dockerBasicAuthPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := dockerBasicAuthFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DockerBasicAuth) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DockerBasicAuth) MarshalJSON() ([]byte, error) { - pb, err := dockerBasicAuthToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DockerBasicAuth) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type DockerImage struct { // Basic auth with username and password - // Wire name: 'basic_auth' BasicAuth *DockerBasicAuth `json:"basic_auth,omitempty"` // URL of the docker image. - // Wire name: 'url' Url string `json:"url,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DockerImage) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &dockerImagePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := dockerImageFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DockerImage) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DockerImage) MarshalJSON() ([]byte, error) { - pb, err := dockerImageToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DockerImage) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // All EBS volume types that Databricks supports. See @@ -4207,30 +2580,24 @@ type EditCluster struct { // When set to true, fixed and default values from the policy will be used // for fields that are omitted. When set to false, only fixed values from // the policy will be applied. - // Wire name: 'apply_policy_default_values' ApplyPolicyDefaultValues bool `json:"apply_policy_default_values,omitempty"` // Parameters needed in order to automatically scale clusters up and down // based on load. Note: autoscaling works best with DB runtime versions 3.0 // or later. - // Wire name: 'autoscale' Autoscale *AutoScale `json:"autoscale,omitempty"` // Automatically terminates the cluster after it is inactive for this time // in minutes. If not set, this cluster will not be automatically // terminated. If specified, the threshold must be between 10 and 10000 // minutes. Users can also set this value to 0 to explicitly disable // automatic termination. - // Wire name: 'autotermination_minutes' AutoterminationMinutes int `json:"autotermination_minutes,omitempty"` // Attributes related to clusters running on Amazon Web Services. If not // specified at cluster creation, a set of default values will be used. - // Wire name: 'aws_attributes' AwsAttributes *AwsAttributes `json:"aws_attributes,omitempty"` // Attributes related to clusters running on Microsoft Azure. If not // specified at cluster creation, a set of default values will be used. - // Wire name: 'azure_attributes' AzureAttributes *AzureAttributes `json:"azure_attributes,omitempty"` // ID of the cluster - // Wire name: 'cluster_id' ClusterId string `json:"cluster_id"` // The configuration for delivering spark logs to a long-term storage // destination. Three kinds of destinations (DBFS, S3 and Unity Catalog @@ -4239,13 +2606,11 @@ type EditCluster struct { // destination every `5 mins`. The destination of driver logs is // `$destination/$clusterId/driver`, while the destination of executor logs // is `$destination/$clusterId/executor`. - // Wire name: 'cluster_log_conf' ClusterLogConf *ClusterLogConf `json:"cluster_log_conf,omitempty"` // Cluster name requested by the user. This doesn't have to be unique. If // not specified at creation, the cluster name will be an empty string. For // job clusters, the cluster name is automatically set based on the job and // job run IDs. - // Wire name: 'cluster_name' ClusterName string `json:"cluster_name,omitempty"` // Additional tags for cluster resources. Databricks will tag all cluster // resources (e.g., AWS instances and EBS volumes) with these tags in @@ -4255,7 +2620,6 @@ type EditCluster struct { // // - Clusters can only reuse cloud resources if the resources' tags are a // subset of the cluster tags - // Wire name: 'custom_tags' CustomTags map[string]string `json:"custom_tags,omitempty"` // Data security mode decides what data governance model to use when // accessing data from a cluster. @@ -4286,15 +2650,12 @@ type EditCluster struct { // `LEGACY_SINGLE_USER`: This mode is for users migrating from legacy // Passthrough on standard clusters. * `LEGACY_SINGLE_USER_STANDARD`: This // mode provides a way that doesn’t have UC nor passthrough enabled. - // Wire name: 'data_security_mode' DataSecurityMode DataSecurityMode `json:"data_security_mode,omitempty"` // Custom docker image BYOC - // Wire name: 'docker_image' DockerImage *DockerImage `json:"docker_image,omitempty"` // The optional ID of the instance pool for the driver of the cluster // belongs. The pool cluster uses the instance pool with id // (instance_pool_id) if the driver pool is not assigned. - // Wire name: 'driver_instance_pool_id' DriverInstancePoolId string `json:"driver_instance_pool_id,omitempty"` // The node type of the Spark driver. Note that this field is optional; if // unset, the driver node type will be set as the same value as @@ -4304,35 +2665,28 @@ type EditCluster struct { // virtual_cluster_size is set. If both driver_node_type_id, node_type_id, // and virtual_cluster_size are specified, driver_node_type_id and // node_type_id take precedence. - // Wire name: 'driver_node_type_id' DriverNodeTypeId string `json:"driver_node_type_id,omitempty"` // Autoscaling Local Storage: when enabled, this cluster will dynamically // acquire additional disk space when its Spark workers are running low on // disk space. This feature requires specific AWS permissions to function // correctly - refer to the User Guide for more details. - // Wire name: 'enable_elastic_disk' EnableElasticDisk bool `json:"enable_elastic_disk,omitempty"` // Whether to enable LUKS on cluster VMs' local disks - // Wire name: 'enable_local_disk_encryption' EnableLocalDiskEncryption bool `json:"enable_local_disk_encryption,omitempty"` // Attributes related to clusters running on Google Cloud Platform. If not // specified at cluster creation, a set of default values will be used. - // Wire name: 'gcp_attributes' GcpAttributes *GcpAttributes `json:"gcp_attributes,omitempty"` // The configuration for storing init scripts. Any number of destinations // can be specified. The scripts are executed sequentially in the order // provided. If `cluster_log_conf` is specified, init script logs are sent // to `//init_scripts`. - // Wire name: 'init_scripts' InitScripts []InitScriptInfo `json:"init_scripts,omitempty"` // The optional ID of the instance pool to which the cluster belongs. - // Wire name: 'instance_pool_id' InstancePoolId string `json:"instance_pool_id,omitempty"` // This field can only be used when `kind = CLASSIC_PREVIEW`. // // When set to true, Databricks will automatically set single node related // `custom_tags`, `spark_conf`, and `num_workers` - // Wire name: 'is_single_node' IsSingleNode bool `json:"is_single_node,omitempty"` // The kind of compute described by this compute specification. // @@ -4351,14 +2705,12 @@ type EditCluster struct { // CLASSIC_PREVIEW`. // // [simple form]: https://docs.databricks.com/compute/simple-form.html - // Wire name: 'kind' Kind Kind `json:"kind,omitempty"` // This field encodes, through a single value, the resources available to // each of the Spark nodes in this cluster. For example, the Spark nodes can // be provisioned and optimized for memory or compute intensive workloads. A // list of available node types can be retrieved by using the // :method:clusters/listNodeTypes API call. - // Wire name: 'node_type_id' NodeTypeId string `json:"node_type_id,omitempty"` // Number of worker nodes that this cluster should have. A cluster has one // Spark Driver and `num_workers` Executors for a total of `num_workers` + 1 @@ -4370,14 +2722,11 @@ type EditCluster struct { // field will immediately be updated to reflect the target size of 10 // workers, whereas the workers listed in `spark_info` will gradually // increase from 5 to 10 as the new nodes are provisioned. - // Wire name: 'num_workers' NumWorkers int `json:"num_workers,omitempty"` // The ID of the cluster policy used to create the cluster if applicable. - // Wire name: 'policy_id' PolicyId string `json:"policy_id,omitempty"` // If set, what the configurable throughput (in Mb/s) for the remote disk // is. Currently only supported for GCP HYPERDISK_BALANCED disks. - // Wire name: 'remote_disk_throughput' RemoteDiskThroughput int `json:"remote_disk_throughput,omitempty"` // Determines the cluster's runtime engine, either standard or Photon. // @@ -4387,17 +2736,14 @@ type EditCluster struct { // // If left unspecified, the runtime engine defaults to standard unless the // spark_version contains -photon-, in which case Photon will be used. - // Wire name: 'runtime_engine' RuntimeEngine RuntimeEngine `json:"runtime_engine,omitempty"` // Single user name if data_security_mode is `SINGLE_USER` - // Wire name: 'single_user_name' SingleUserName string `json:"single_user_name,omitempty"` // An object containing a set of optional, user-specified Spark // configuration key-value pairs. Users can also pass in a string of extra // JVM options to the driver and the executors via // `spark.driver.extraJavaOptions` and `spark.executor.extraJavaOptions` // respectively. - // Wire name: 'spark_conf' SparkConf map[string]string `json:"spark_conf,omitempty"` // An object containing a set of optional, user-specified environment // variable key-value pairs. Please note that key-value pair of the form @@ -4412,96 +2758,47 @@ type EditCluster struct { // Example Spark environment variables: `{"SPARK_WORKER_MEMORY": "28000m", // "SPARK_LOCAL_DIRS": "/local_disk0"}` or `{"SPARK_DAEMON_JAVA_OPTS": // "$SPARK_DAEMON_JAVA_OPTS -Dspark.shuffle.service.enabled=true"}` - // Wire name: 'spark_env_vars' SparkEnvVars map[string]string `json:"spark_env_vars,omitempty"` // The Spark version of the cluster, e.g. `3.3.x-scala2.11`. A list of // available Spark versions can be retrieved by using the // :method:clusters/sparkVersions API call. - // Wire name: 'spark_version' SparkVersion string `json:"spark_version"` // SSH public key contents that will be added to each Spark node in this // cluster. The corresponding private keys can be used to login with the // user name `ubuntu` on port `2200`. Up to 10 keys can be specified. - // Wire name: 'ssh_public_keys' SshPublicKeys []string `json:"ssh_public_keys,omitempty"` // If set, what the total initial volume size (in GB) of the remote disks // should be. Currently only supported for GCP HYPERDISK_BALANCED disks. - // Wire name: 'total_initial_remote_disk_size' TotalInitialRemoteDiskSize int `json:"total_initial_remote_disk_size,omitempty"` // This field can only be used when `kind = CLASSIC_PREVIEW`. // // `effective_spark_version` is determined by `spark_version` (DBR release), // this field `use_ml_runtime`, and whether `node_type_id` is gpu node or // not. - // Wire name: 'use_ml_runtime' UseMlRuntime bool `json:"use_ml_runtime,omitempty"` // Cluster Attributes showing for clusters workload types. - // Wire name: 'workload_type' WorkloadType *WorkloadType `json:"workload_type,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *EditCluster) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &editClusterPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := editClusterFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *EditCluster) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st EditCluster) MarshalJSON() ([]byte, error) { - pb, err := editClusterToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s EditCluster) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type EditClusterResponse struct { } -func (st *EditClusterResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &editClusterResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := editClusterResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st EditClusterResponse) MarshalJSON() ([]byte, error) { - pb, err := editClusterResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type EditInstancePool struct { // Additional tags for pool resources. Databricks will tag all pool // resources (e.g., AWS instances and EBS volumes) with these tags in // addition to `default_tags`. Notes: // // - Currently, Databricks allows at most 45 custom tags - // Wire name: 'custom_tags' CustomTags map[string]string `json:"custom_tags,omitempty"` // Automatically terminates the extra instances in the pool cache after they // are inactive for this time in minutes if min_idle_instances requirement @@ -4510,116 +2807,61 @@ type EditInstancePool struct { // threshold must be between 0 and 10000 minutes. Users can also set this // value to 0 to instantly remove idle instances from the cache if min cache // size could still hold. - // Wire name: 'idle_instance_autotermination_minutes' IdleInstanceAutoterminationMinutes int `json:"idle_instance_autotermination_minutes,omitempty"` // Instance pool ID - // Wire name: 'instance_pool_id' InstancePoolId string `json:"instance_pool_id"` // Pool name requested by the user. Pool name must be unique. Length must be // between 1 and 100 characters. - // Wire name: 'instance_pool_name' InstancePoolName string `json:"instance_pool_name"` // Maximum number of outstanding instances to keep in the pool, including // both instances used by clusters and idle instances. Clusters that require // further instance provisioning will fail during upsize requests. - // Wire name: 'max_capacity' MaxCapacity int `json:"max_capacity,omitempty"` // Minimum number of idle instances to keep in the instance pool - // Wire name: 'min_idle_instances' MinIdleInstances int `json:"min_idle_instances,omitempty"` // This field encodes, through a single value, the resources available to // each of the Spark nodes in this cluster. For example, the Spark nodes can // be provisioned and optimized for memory or compute intensive workloads. A // list of available node types can be retrieved by using the // :method:clusters/listNodeTypes API call. - // Wire name: 'node_type_id' NodeTypeId string `json:"node_type_id"` // If set, what the configurable throughput (in Mb/s) for the remote disk // is. Currently only supported for GCP HYPERDISK_BALANCED types. - // Wire name: 'remote_disk_throughput' RemoteDiskThroughput int `json:"remote_disk_throughput,omitempty"` // If set, what the total initial volume size (in GB) of the remote disks // should be. Currently only supported for GCP HYPERDISK_BALANCED types. - // Wire name: 'total_initial_remote_disk_size' TotalInitialRemoteDiskSize int `json:"total_initial_remote_disk_size,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *EditInstancePool) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &editInstancePoolPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := editInstancePoolFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *EditInstancePool) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st EditInstancePool) MarshalJSON() ([]byte, error) { - pb, err := editInstancePoolToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s EditInstancePool) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type EditInstancePoolResponse struct { } -func (st *EditInstancePoolResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &editInstancePoolResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := editInstancePoolResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st EditInstancePoolResponse) MarshalJSON() ([]byte, error) { - pb, err := editInstancePoolResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type EditPolicy struct { // Policy definition document expressed in [Databricks Cluster Policy // Definition Language]. // // [Databricks Cluster Policy Definition Language]: https://docs.databricks.com/administration-guide/clusters/policy-definition.html - // Wire name: 'definition' Definition string `json:"definition,omitempty"` // Additional human-readable description of the cluster policy. - // Wire name: 'description' Description string `json:"description,omitempty"` // A list of libraries to be installed on the next cluster restart that uses // this policy. The maximum number of libraries is 500. - // Wire name: 'libraries' Libraries []Library `json:"libraries,omitempty"` // Max number of clusters per user that can be active using this policy. If // not present, there is no max limit. - // Wire name: 'max_clusters_per_user' MaxClustersPerUser int64 `json:"max_clusters_per_user,omitempty"` // Cluster Policy name requested by the user. This has to be unique. Length // must be between 1 and 100 characters. - // Wire name: 'name' Name string `json:"name,omitempty"` // Policy definition JSON document expressed in [Databricks Policy // Definition Language]. The JSON document must be passed as a string and @@ -4630,7 +2872,6 @@ type EditPolicy struct { // policy definition. // // [Databricks Policy Definition Language]: https://docs.databricks.com/administration-guide/clusters/policy-definition.html - // Wire name: 'policy_family_definition_overrides' PolicyFamilyDefinitionOverrides string `json:"policy_family_definition_overrides,omitempty"` // ID of the policy family. The cluster policy's policy definition inherits // the policy family's policy definition. @@ -4638,169 +2879,62 @@ type EditPolicy struct { // Cannot be used with `definition`. Use // `policy_family_definition_overrides` instead to customize the policy // definition. - // Wire name: 'policy_family_id' PolicyFamilyId string `json:"policy_family_id,omitempty"` // The ID of the policy to update. - // Wire name: 'policy_id' PolicyId string `json:"policy_id"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *EditPolicy) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &editPolicyPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := editPolicyFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *EditPolicy) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st EditPolicy) MarshalJSON() ([]byte, error) { - pb, err := editPolicyToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s EditPolicy) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type EditPolicyResponse struct { } -func (st *EditPolicyResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &editPolicyResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := editPolicyResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st EditPolicyResponse) MarshalJSON() ([]byte, error) { - pb, err := editPolicyResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type EditResponse struct { } -func (st *EditResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &editResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := editResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st EditResponse) MarshalJSON() ([]byte, error) { - pb, err := editResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type EnforceClusterComplianceRequest struct { // The ID of the cluster you want to enforce policy compliance on. - // Wire name: 'cluster_id' ClusterId string `json:"cluster_id"` // If set, previews the changes that would be made to a cluster to enforce // compliance but does not update the cluster. - // Wire name: 'validate_only' ValidateOnly bool `json:"validate_only,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *EnforceClusterComplianceRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &enforceClusterComplianceRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := enforceClusterComplianceRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *EnforceClusterComplianceRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st EnforceClusterComplianceRequest) MarshalJSON() ([]byte, error) { - pb, err := enforceClusterComplianceRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s EnforceClusterComplianceRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type EnforceClusterComplianceResponse struct { // A list of changes that have been made to the cluster settings for the // cluster to become compliant with its policy. - // Wire name: 'changes' Changes []ClusterSettingsChange `json:"changes,omitempty"` // Whether any changes have been made to the cluster settings for the // cluster to become compliant with its policy. - // Wire name: 'has_changes' HasChanges bool `json:"has_changes,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *EnforceClusterComplianceResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &enforceClusterComplianceResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := enforceClusterComplianceResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *EnforceClusterComplianceResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st EnforceClusterComplianceResponse) MarshalJSON() ([]byte, error) { - pb, err := enforceClusterComplianceResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s EnforceClusterComplianceResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The environment entity used to preserve serverless environment side panel, @@ -4809,7 +2943,6 @@ func (st EnforceClusterComplianceResponse) MarshalJSON() ([]byte, error) { // dependencies are supported. type Environment struct { // Use `environment_version` instead. - // Wire name: 'client' Client string `json:"client,omitempty"` // List of pip dependencies, as supported by the version of pip in this // environment. Each dependency is a valid pip requirements file line per @@ -4817,142 +2950,85 @@ type Environment struct { // Allowed dependencies include a requirement specifier, an archive URL, a // local project path (such as WSFS or UC Volumes in Databricks), or a VCS // project URL. - // Wire name: 'dependencies' Dependencies []string `json:"dependencies,omitempty"` // Required. Environment version used by the environment. Each version comes // with a specific Python version and a set of Python packages. The version // is a string, consisting of an integer. - // Wire name: 'environment_version' EnvironmentVersion string `json:"environment_version,omitempty"` // List of jar dependencies, should be string representing volume paths. For // example: `/Volumes/path/to/test.jar`. - // Wire name: 'jar_dependencies' JarDependencies []string `json:"jar_dependencies,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *Environment) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &environmentPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := environmentFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *Environment) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st Environment) MarshalJSON() ([]byte, error) { - pb, err := environmentToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s Environment) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type EventDetails struct { // * For created clusters, the attributes of the cluster. * For edited // clusters, the new attributes of the cluster. - // Wire name: 'attributes' Attributes *ClusterAttributes `json:"attributes,omitempty"` // The cause of a change in target size. - // Wire name: 'cause' Cause EventDetailsCause `json:"cause,omitempty"` // The actual cluster size that was set in the cluster creation or edit. - // Wire name: 'cluster_size' ClusterSize *ClusterSize `json:"cluster_size,omitempty"` // The current number of vCPUs in the cluster. - // Wire name: 'current_num_vcpus' CurrentNumVcpus int `json:"current_num_vcpus,omitempty"` // The current number of nodes in the cluster. - // Wire name: 'current_num_workers' CurrentNumWorkers int `json:"current_num_workers,omitempty"` - // Wire name: 'did_not_expand_reason' DidNotExpandReason string `json:"did_not_expand_reason,omitempty"` // Current disk size in bytes - // Wire name: 'disk_size' DiskSize int64 `json:"disk_size,omitempty"` // More details about the change in driver's state - // Wire name: 'driver_state_message' DriverStateMessage string `json:"driver_state_message,omitempty"` // Whether or not a blocklisted node should be terminated. For // ClusterEventType NODE_BLACKLISTED. - // Wire name: 'enable_termination_for_node_blocklisted' EnableTerminationForNodeBlocklisted bool `json:"enable_termination_for_node_blocklisted,omitempty"` - // Wire name: 'free_space' FreeSpace int64 `json:"free_space,omitempty"` // List of global and cluster init scripts associated with this cluster // event. - // Wire name: 'init_scripts' InitScripts *InitScriptEventDetails `json:"init_scripts,omitempty"` // Instance Id where the event originated from - // Wire name: 'instance_id' InstanceId string `json:"instance_id,omitempty"` // Unique identifier of the specific job run associated with this cluster // event * For clusters created for jobs, this will be the same as the // cluster name - // Wire name: 'job_run_name' JobRunName string `json:"job_run_name,omitempty"` // The cluster attributes before a cluster was edited. - // Wire name: 'previous_attributes' PreviousAttributes *ClusterAttributes `json:"previous_attributes,omitempty"` // The size of the cluster before an edit or resize. - // Wire name: 'previous_cluster_size' PreviousClusterSize *ClusterSize `json:"previous_cluster_size,omitempty"` // Previous disk size in bytes - // Wire name: 'previous_disk_size' PreviousDiskSize int64 `json:"previous_disk_size,omitempty"` // A termination reason: * On a TERMINATED event, this is the reason of the // termination. * On a RESIZE_COMPLETE event, this indicates the reason that // we failed to acquire some nodes. - // Wire name: 'reason' Reason *TerminationReason `json:"reason,omitempty"` // The targeted number of vCPUs in the cluster. - // Wire name: 'target_num_vcpus' TargetNumVcpus int `json:"target_num_vcpus,omitempty"` // The targeted number of nodes in the cluster. - // Wire name: 'target_num_workers' TargetNumWorkers int `json:"target_num_workers,omitempty"` // The user that caused the event to occur. (Empty if it was done by the // control plane.) - // Wire name: 'user' User string `json:"user,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *EventDetails) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &eventDetailsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := eventDetailsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *EventDetails) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st EventDetails) MarshalJSON() ([]byte, error) { - pb, err := eventDetailsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s EventDetails) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The cause of a change in target size. @@ -5125,16 +3201,13 @@ type GcpAttributes struct { // This field determines whether the spark executors will be scheduled to // run on preemptible VMs, on-demand VMs, or preemptible VMs with a fallback // to on-demand VMs if the former is unavailable. - // Wire name: 'availability' Availability GcpAvailability `json:"availability,omitempty"` // Boot disk size in GB - // Wire name: 'boot_disk_size' BootDiskSize int `json:"boot_disk_size,omitempty"` // If provided, the cluster will impersonate the google service account when // accessing gcloud services (like GCS). The google service account must // have previously been added to the Databricks environment by an account // administrator. - // Wire name: 'google_service_account' GoogleServiceAccount string `json:"google_service_account,omitempty"` // If provided, each node (workers and driver) in the cluster will have this // number of local SSDs attached. Each local SSD is 375GB in size. Refer to @@ -5142,13 +3215,11 @@ type GcpAttributes struct { // instance type. // // [GCP documentation]: https://cloud.google.com/compute/docs/disks/local-ssd#choose_number_local_ssds - // Wire name: 'local_ssd_count' LocalSsdCount int `json:"local_ssd_count,omitempty"` // This field determines whether the spark executors will be scheduled to // run on preemptible VMs (when set to true) versus standard compute engine // VMs (when set to false; default). Note: Soon to be deprecated, use the // 'availability' field instead. - // Wire name: 'use_preemptible_executors' UsePreemptibleExecutors bool `json:"use_preemptible_executors,omitempty"` // Identifier for the availability zone in which the cluster resides. This // can be one of the following: - "HA" => High availability, spread nodes @@ -5157,35 +3228,17 @@ type GcpAttributes struct { // on. - A GCP availability zone => Pick One of the available zones for // (machine type + region) from // https://cloud.google.com/compute/docs/regions-zones. - // Wire name: 'zone_id' ZoneId string `json:"zone_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GcpAttributes) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &gcpAttributesPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := gcpAttributesFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GcpAttributes) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GcpAttributes) MarshalJSON() ([]byte, error) { - pb, err := gcpAttributesToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GcpAttributes) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // This field determines whether the instance pool will contain preemptible VMs, @@ -5234,426 +3287,128 @@ func (f *GcpAvailability) Type() string { // A storage location in Google Cloud Platform's GCS type GcsStorageInfo struct { // GCS destination/URI, e.g. `gs://my-bucket/some-prefix` - // Wire name: 'destination' Destination string `json:"destination"` } -func (st *GcsStorageInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &gcsStorageInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := gcsStorageInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GcsStorageInfo) MarshalJSON() ([]byte, error) { - pb, err := gcsStorageInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Get cluster policy compliance type GetClusterComplianceRequest struct { // The ID of the cluster to get the compliance status - ClusterId string `json:"-" tf:"-"` -} - -func (st *GetClusterComplianceRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getClusterComplianceRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getClusterComplianceRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetClusterComplianceRequest) MarshalJSON() ([]byte, error) { - pb, err := getClusterComplianceRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + ClusterId string `json:"-" url:"cluster_id"` } type GetClusterComplianceResponse struct { // Whether the cluster is compliant with its policy or not. Clusters could // be out of compliance if the policy was updated after the cluster was last // edited. - // Wire name: 'is_compliant' IsCompliant bool `json:"is_compliant,omitempty"` // An object containing key-value mappings representing the first 200 policy // validation errors. The keys indicate the path where the policy validation // error is occurring. The values indicate an error message describing the // policy validation error. - // Wire name: 'violations' Violations map[string]string `json:"violations,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetClusterComplianceResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getClusterComplianceResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getClusterComplianceResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetClusterComplianceResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetClusterComplianceResponse) MarshalJSON() ([]byte, error) { - pb, err := getClusterComplianceResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetClusterComplianceResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get cluster permission levels type GetClusterPermissionLevelsRequest struct { // The cluster for which to get or manage permissions. - ClusterId string `json:"-" tf:"-"` -} - -func (st *GetClusterPermissionLevelsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getClusterPermissionLevelsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getClusterPermissionLevelsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetClusterPermissionLevelsRequest) MarshalJSON() ([]byte, error) { - pb, err := getClusterPermissionLevelsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + ClusterId string `json:"-" url:"-"` } type GetClusterPermissionLevelsResponse struct { // Specific permission levels - // Wire name: 'permission_levels' PermissionLevels []ClusterPermissionsDescription `json:"permission_levels,omitempty"` } -func (st *GetClusterPermissionLevelsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getClusterPermissionLevelsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getClusterPermissionLevelsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetClusterPermissionLevelsResponse) MarshalJSON() ([]byte, error) { - pb, err := getClusterPermissionLevelsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Get cluster permissions type GetClusterPermissionsRequest struct { // The cluster for which to get or manage permissions. - ClusterId string `json:"-" tf:"-"` -} - -func (st *GetClusterPermissionsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getClusterPermissionsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getClusterPermissionsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetClusterPermissionsRequest) MarshalJSON() ([]byte, error) { - pb, err := getClusterPermissionsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + ClusterId string `json:"-" url:"-"` } // Get cluster policy permission levels type GetClusterPolicyPermissionLevelsRequest struct { // The cluster policy for which to get or manage permissions. - ClusterPolicyId string `json:"-" tf:"-"` -} - -func (st *GetClusterPolicyPermissionLevelsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getClusterPolicyPermissionLevelsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getClusterPolicyPermissionLevelsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetClusterPolicyPermissionLevelsRequest) MarshalJSON() ([]byte, error) { - pb, err := getClusterPolicyPermissionLevelsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + ClusterPolicyId string `json:"-" url:"-"` } type GetClusterPolicyPermissionLevelsResponse struct { // Specific permission levels - // Wire name: 'permission_levels' PermissionLevels []ClusterPolicyPermissionsDescription `json:"permission_levels,omitempty"` } -func (st *GetClusterPolicyPermissionLevelsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getClusterPolicyPermissionLevelsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getClusterPolicyPermissionLevelsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetClusterPolicyPermissionLevelsResponse) MarshalJSON() ([]byte, error) { - pb, err := getClusterPolicyPermissionLevelsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Get cluster policy permissions type GetClusterPolicyPermissionsRequest struct { // The cluster policy for which to get or manage permissions. - ClusterPolicyId string `json:"-" tf:"-"` -} - -func (st *GetClusterPolicyPermissionsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getClusterPolicyPermissionsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getClusterPolicyPermissionsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetClusterPolicyPermissionsRequest) MarshalJSON() ([]byte, error) { - pb, err := getClusterPolicyPermissionsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + ClusterPolicyId string `json:"-" url:"-"` } // Get a cluster policy type GetClusterPolicyRequest struct { // Canonical unique identifier for the Cluster Policy. - PolicyId string `json:"-" tf:"-"` -} - -func (st *GetClusterPolicyRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getClusterPolicyRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getClusterPolicyRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetClusterPolicyRequest) MarshalJSON() ([]byte, error) { - pb, err := getClusterPolicyRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + PolicyId string `json:"-" url:"policy_id"` } // Get cluster info type GetClusterRequest struct { // The cluster about which to retrieve information. - ClusterId string `json:"-" tf:"-"` -} - -func (st *GetClusterRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getClusterRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getClusterRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetClusterRequest) MarshalJSON() ([]byte, error) { - pb, err := getClusterRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + ClusterId string `json:"-" url:"cluster_id"` } type GetEvents struct { // The ID of the cluster to retrieve events about. - // Wire name: 'cluster_id' ClusterId string `json:"cluster_id"` // The end time in epoch milliseconds. If empty, returns events up to the // current time. - // Wire name: 'end_time' EndTime int64 `json:"end_time,omitempty"` // An optional set of event types to filter on. If empty, all event types // are returned. - // Wire name: 'event_types' EventTypes []EventType `json:"event_types,omitempty"` // Deprecated: use page_token in combination with page_size instead. // // The maximum number of events to include in a page of events. Defaults to // 50, and maximum allowed value is 500. - // Wire name: 'limit' Limit int64 `json:"limit,omitempty"` // Deprecated: use page_token in combination with page_size instead. // // The offset in the result set. Defaults to 0 (no offset). When an offset // is specified and the results are requested in descending order, the // end_time field is required. - // Wire name: 'offset' Offset int64 `json:"offset,omitempty"` // The order to list events in; either "ASC" or "DESC". Defaults to "DESC". - // Wire name: 'order' Order GetEventsOrder `json:"order,omitempty"` // The maximum number of events to include in a page of events. The server // may further constrain the maximum number of results returned in a single // page. If the page_size is empty or 0, the server will decide the number // of results to be returned. The field has to be in the range [0,500]. If // the value is outside the range, the server enforces 0 or 500. - // Wire name: 'page_size' PageSize int `json:"page_size,omitempty"` // Use next_page_token or prev_page_token returned from the previous request // to list the next or previous page of events respectively. If page_token // is empty, the first page is returned. - // Wire name: 'page_token' PageToken string `json:"page_token,omitempty"` // The start time in epoch milliseconds. If empty, returns events starting // from the beginning of time. - // Wire name: 'start_time' StartTime int64 `json:"start_time,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetEvents) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getEventsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getEventsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetEvents) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetEvents) MarshalJSON() ([]byte, error) { - pb, err := getEventsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetEvents) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type GetEventsOrder string @@ -5694,106 +3449,55 @@ func (f *GetEventsOrder) Type() string { } type GetEventsResponse struct { - - // Wire name: 'events' Events []ClusterEvent `json:"events,omitempty"` // Deprecated: use next_page_token or prev_page_token instead. // // The parameters required to retrieve the next page of events. Omitted if // there are no more events to read. - // Wire name: 'next_page' NextPage *GetEvents `json:"next_page,omitempty"` // This field represents the pagination token to retrieve the next page of // results. If the value is "", it means no further results for the request. - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` // This field represents the pagination token to retrieve the previous page // of results. If the value is "", it means no further results for the // request. - // Wire name: 'prev_page_token' PrevPageToken string `json:"prev_page_token,omitempty"` // Deprecated: Returns 0 when request uses page_token. Will start returning // zero when request uses offset/limit soon. // // The total number of events filtered by the start_time, end_time, and // event_types. - // Wire name: 'total_count' TotalCount int64 `json:"total_count,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetEventsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getEventsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getEventsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetEventsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetEventsResponse) MarshalJSON() ([]byte, error) { - pb, err := getEventsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetEventsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get an init script type GetGlobalInitScriptRequest struct { // The ID of the global init script. - ScriptId string `json:"-" tf:"-"` -} - -func (st *GetGlobalInitScriptRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getGlobalInitScriptRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getGlobalInitScriptRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetGlobalInitScriptRequest) MarshalJSON() ([]byte, error) { - pb, err := getGlobalInitScriptRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + ScriptId string `json:"-" url:"-"` } type GetInstancePool struct { // Attributes related to instance pools running on Amazon Web Services. If // not specified at pool creation, a set of default values will be used. - // Wire name: 'aws_attributes' AwsAttributes *InstancePoolAwsAttributes `json:"aws_attributes,omitempty"` // Attributes related to instance pools running on Azure. If not specified // at pool creation, a set of default values will be used. - // Wire name: 'azure_attributes' AzureAttributes *InstancePoolAzureAttributes `json:"azure_attributes,omitempty"` // Additional tags for pool resources. Databricks will tag all pool // resources (e.g., AWS instances and EBS volumes) with these tags in // addition to `default_tags`. Notes: // // - Currently, Databricks allows at most 45 custom tags - // Wire name: 'custom_tags' CustomTags map[string]string `json:"custom_tags,omitempty"` // Tags that are added by Databricks regardless of any ``custom_tags``, // including: @@ -5805,22 +3509,18 @@ type GetInstancePool struct { // - InstancePoolName: // // - InstancePoolId: - // Wire name: 'default_tags' DefaultTags map[string]string `json:"default_tags,omitempty"` // Defines the specification of the disks that will be attached to all spark // containers. - // Wire name: 'disk_spec' DiskSpec *DiskSpec `json:"disk_spec,omitempty"` // Autoscaling Local Storage: when enabled, this instances in this pool will // dynamically acquire additional disk space when its Spark workers are // running low on disk space. In AWS, this feature requires specific AWS // permissions to function correctly - refer to the User Guide for more // details. - // Wire name: 'enable_elastic_disk' EnableElasticDisk bool `json:"enable_elastic_disk,omitempty"` // Attributes related to instance pools running on Google Cloud Platform. If // not specified at pool creation, a set of default values will be used. - // Wire name: 'gcp_attributes' GcpAttributes *InstancePoolGcpAttributes `json:"gcp_attributes,omitempty"` // Automatically terminates the extra instances in the pool cache after they // are inactive for this time in minutes if min_idle_instances requirement @@ -5829,282 +3529,106 @@ type GetInstancePool struct { // threshold must be between 0 and 10000 minutes. Users can also set this // value to 0 to instantly remove idle instances from the cache if min cache // size could still hold. - // Wire name: 'idle_instance_autotermination_minutes' IdleInstanceAutoterminationMinutes int `json:"idle_instance_autotermination_minutes,omitempty"` // Canonical unique identifier for the pool. - // Wire name: 'instance_pool_id' InstancePoolId string `json:"instance_pool_id"` // Pool name requested by the user. Pool name must be unique. Length must be // between 1 and 100 characters. - // Wire name: 'instance_pool_name' InstancePoolName string `json:"instance_pool_name,omitempty"` // Maximum number of outstanding instances to keep in the pool, including // both instances used by clusters and idle instances. Clusters that require // further instance provisioning will fail during upsize requests. - // Wire name: 'max_capacity' MaxCapacity int `json:"max_capacity,omitempty"` // Minimum number of idle instances to keep in the instance pool - // Wire name: 'min_idle_instances' MinIdleInstances int `json:"min_idle_instances,omitempty"` // This field encodes, through a single value, the resources available to // each of the Spark nodes in this cluster. For example, the Spark nodes can // be provisioned and optimized for memory or compute intensive workloads. A // list of available node types can be retrieved by using the // :method:clusters/listNodeTypes API call. - // Wire name: 'node_type_id' NodeTypeId string `json:"node_type_id,omitempty"` // Custom Docker Image BYOC - // Wire name: 'preloaded_docker_images' PreloadedDockerImages []DockerImage `json:"preloaded_docker_images,omitempty"` // A list containing at most one preloaded Spark image version for the pool. // Pool-backed clusters started with the preloaded Spark version will start // faster. A list of available Spark versions can be retrieved by using the // :method:clusters/sparkVersions API call. - // Wire name: 'preloaded_spark_versions' PreloadedSparkVersions []string `json:"preloaded_spark_versions,omitempty"` // If set, what the configurable throughput (in Mb/s) for the remote disk // is. Currently only supported for GCP HYPERDISK_BALANCED types. - // Wire name: 'remote_disk_throughput' RemoteDiskThroughput int `json:"remote_disk_throughput,omitempty"` // Current state of the instance pool. - // Wire name: 'state' State InstancePoolState `json:"state,omitempty"` // Usage statistics about the instance pool. - // Wire name: 'stats' Stats *InstancePoolStats `json:"stats,omitempty"` // Status of failed pending instances in the pool. - // Wire name: 'status' Status *InstancePoolStatus `json:"status,omitempty"` // If set, what the total initial volume size (in GB) of the remote disks // should be. Currently only supported for GCP HYPERDISK_BALANCED types. - // Wire name: 'total_initial_remote_disk_size' TotalInitialRemoteDiskSize int `json:"total_initial_remote_disk_size,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetInstancePool) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getInstancePoolPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getInstancePoolFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetInstancePool) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetInstancePool) MarshalJSON() ([]byte, error) { - pb, err := getInstancePoolToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - -// Get instance pool permission levels -type GetInstancePoolPermissionLevelsRequest struct { - // The instance pool for which to get or manage permissions. - InstancePoolId string `json:"-" tf:"-"` -} - -func (st *GetInstancePoolPermissionLevelsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getInstancePoolPermissionLevelsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getInstancePoolPermissionLevelsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s GetInstancePool) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } -func (st GetInstancePoolPermissionLevelsRequest) MarshalJSON() ([]byte, error) { - pb, err := getInstancePoolPermissionLevelsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +// Get instance pool permission levels +type GetInstancePoolPermissionLevelsRequest struct { + // The instance pool for which to get or manage permissions. + InstancePoolId string `json:"-" url:"-"` } type GetInstancePoolPermissionLevelsResponse struct { // Specific permission levels - // Wire name: 'permission_levels' PermissionLevels []InstancePoolPermissionsDescription `json:"permission_levels,omitempty"` } -func (st *GetInstancePoolPermissionLevelsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getInstancePoolPermissionLevelsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getInstancePoolPermissionLevelsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetInstancePoolPermissionLevelsResponse) MarshalJSON() ([]byte, error) { - pb, err := getInstancePoolPermissionLevelsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Get instance pool permissions type GetInstancePoolPermissionsRequest struct { // The instance pool for which to get or manage permissions. - InstancePoolId string `json:"-" tf:"-"` -} - -func (st *GetInstancePoolPermissionsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getInstancePoolPermissionsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getInstancePoolPermissionsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetInstancePoolPermissionsRequest) MarshalJSON() ([]byte, error) { - pb, err := getInstancePoolPermissionsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + InstancePoolId string `json:"-" url:"-"` } // Get instance pool information type GetInstancePoolRequest struct { // The canonical unique identifier for the instance pool. - InstancePoolId string `json:"-" tf:"-"` -} - -func (st *GetInstancePoolRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getInstancePoolRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getInstancePoolRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetInstancePoolRequest) MarshalJSON() ([]byte, error) { - pb, err := getInstancePoolRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + InstancePoolId string `json:"-" url:"instance_pool_id"` } // Get policy family information type GetPolicyFamilyRequest struct { // The family ID about which to retrieve information. - PolicyFamilyId string `json:"-" tf:"-"` + PolicyFamilyId string `json:"-" url:"-"` // The version number for the family to fetch. Defaults to the latest // version. - Version int64 `json:"-" tf:"-"` + Version int64 `json:"-" url:"version,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetPolicyFamilyRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getPolicyFamilyRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getPolicyFamilyRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetPolicyFamilyRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetPolicyFamilyRequest) MarshalJSON() ([]byte, error) { - pb, err := getPolicyFamilyRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetPolicyFamilyRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type GetSparkVersionsResponse struct { // All the available Spark versions. - // Wire name: 'versions' Versions []SparkVersion `json:"versions,omitempty"` } -func (st *GetSparkVersionsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getSparkVersionsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getSparkVersionsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetSparkVersionsResponse) MarshalJSON() ([]byte, error) { - pb, err := getSparkVersionsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type GlobalInitScriptCreateRequest struct { // Specifies whether the script is enabled. The script runs only if enabled. - // Wire name: 'enabled' Enabled bool `json:"enabled,omitempty"` // The name of the script - // Wire name: 'name' Name string `json:"name"` // The position of a global init script, where 0 represents the first script // to run, 1 is the second script to run, in ascending order. @@ -6117,163 +3641,91 @@ type GlobalInitScriptCreateRequest struct { // position. If an explicit position value conflicts with an existing script // value, your request succeeds, but the original script at that position // and all later scripts have their positions incremented by 1. - // Wire name: 'position' Position int `json:"position,omitempty"` // The Base64-encoded content of the script. - // Wire name: 'script' Script string `json:"script"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GlobalInitScriptCreateRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &globalInitScriptCreateRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := globalInitScriptCreateRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GlobalInitScriptCreateRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GlobalInitScriptCreateRequest) MarshalJSON() ([]byte, error) { - pb, err := globalInitScriptCreateRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GlobalInitScriptCreateRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type GlobalInitScriptDetails struct { // Time when the script was created, represented as a Unix timestamp in // milliseconds. - // Wire name: 'created_at' CreatedAt int `json:"created_at,omitempty"` // The username of the user who created the script. - // Wire name: 'created_by' CreatedBy string `json:"created_by,omitempty"` // Specifies whether the script is enabled. The script runs only if enabled. - // Wire name: 'enabled' Enabled bool `json:"enabled,omitempty"` // The name of the script - // Wire name: 'name' Name string `json:"name,omitempty"` // The position of a script, where 0 represents the first script to run, 1 // is the second script to run, in ascending order. - // Wire name: 'position' Position int `json:"position,omitempty"` // The global init script ID. - // Wire name: 'script_id' ScriptId string `json:"script_id,omitempty"` // Time when the script was updated, represented as a Unix timestamp in // milliseconds. - // Wire name: 'updated_at' UpdatedAt int `json:"updated_at,omitempty"` // The username of the user who last updated the script - // Wire name: 'updated_by' UpdatedBy string `json:"updated_by,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GlobalInitScriptDetails) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &globalInitScriptDetailsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := globalInitScriptDetailsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GlobalInitScriptDetails) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GlobalInitScriptDetails) MarshalJSON() ([]byte, error) { - pb, err := globalInitScriptDetailsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GlobalInitScriptDetails) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type GlobalInitScriptDetailsWithContent struct { // Time when the script was created, represented as a Unix timestamp in // milliseconds. - // Wire name: 'created_at' CreatedAt int `json:"created_at,omitempty"` // The username of the user who created the script. - // Wire name: 'created_by' CreatedBy string `json:"created_by,omitempty"` // Specifies whether the script is enabled. The script runs only if enabled. - // Wire name: 'enabled' Enabled bool `json:"enabled,omitempty"` // The name of the script - // Wire name: 'name' Name string `json:"name,omitempty"` // The position of a script, where 0 represents the first script to run, 1 // is the second script to run, in ascending order. - // Wire name: 'position' Position int `json:"position,omitempty"` // The Base64-encoded content of the script. - // Wire name: 'script' Script string `json:"script,omitempty"` // The global init script ID. - // Wire name: 'script_id' ScriptId string `json:"script_id,omitempty"` // Time when the script was updated, represented as a Unix timestamp in // milliseconds. - // Wire name: 'updated_at' UpdatedAt int `json:"updated_at,omitempty"` // The username of the user who last updated the script - // Wire name: 'updated_by' UpdatedBy string `json:"updated_by,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GlobalInitScriptDetailsWithContent) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &globalInitScriptDetailsWithContentPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := globalInitScriptDetailsWithContentFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GlobalInitScriptDetailsWithContent) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GlobalInitScriptDetailsWithContent) MarshalJSON() ([]byte, error) { - pb, err := globalInitScriptDetailsWithContentToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GlobalInitScriptDetailsWithContent) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type GlobalInitScriptUpdateRequest struct { // Specifies whether the script is enabled. The script runs only if enabled. - // Wire name: 'enabled' Enabled bool `json:"enabled,omitempty"` // The name of the script - // Wire name: 'name' Name string `json:"name"` // The position of a script, where 0 represents the first script to run, 1 // is the second script to run, in ascending order. To move the script to @@ -6287,48 +3739,27 @@ type GlobalInitScriptUpdateRequest struct { // If an explicit position value conflicts with an existing script, your // request succeeds, but the original script at that position and all later // scripts have their positions incremented by 1. - // Wire name: 'position' Position int `json:"position,omitempty"` // The Base64-encoded content of the script. - // Wire name: 'script' Script string `json:"script"` // The ID of the global init script. - ScriptId string `json:"-" tf:"-"` + ScriptId string `json:"-" url:"-"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GlobalInitScriptUpdateRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &globalInitScriptUpdateRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := globalInitScriptUpdateRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GlobalInitScriptUpdateRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GlobalInitScriptUpdateRequest) MarshalJSON() ([]byte, error) { - pb, err := globalInitScriptUpdateRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GlobalInitScriptUpdateRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type InitScriptEventDetails struct { // The cluster scoped init scripts associated with this cluster event. - // Wire name: 'cluster' Cluster []InitScriptInfoAndExecutionDetails `json:"cluster,omitempty"` // The global init scripts associated with this cluster event. - // Wire name: 'global' Global []InitScriptInfoAndExecutionDetails `json:"global,omitempty"` // The private ip of the node we are reporting init script execution details // for (we will select the execution details from only one node rather than @@ -6336,35 +3767,17 @@ type InitScriptEventDetails struct { // details small) // // This should only be defined for the INIT_SCRIPTS_FINISHED event - // Wire name: 'reported_for_node' ReportedForNode string `json:"reported_for_node,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *InitScriptEventDetails) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &initScriptEventDetailsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := initScriptEventDetailsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *InitScriptEventDetails) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st InitScriptEventDetails) MarshalJSON() ([]byte, error) { - pb, err := initScriptEventDetailsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s InitScriptEventDetails) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Result of attempted script execution @@ -6424,298 +3837,141 @@ func (f *InitScriptExecutionDetailsInitScriptExecutionStatus) Type() string { type InitScriptInfo struct { // destination needs to be provided, e.g. // `abfss://@.dfs.core.windows.net/` - // Wire name: 'abfss' Abfss *Adlsgen2Info `json:"abfss,omitempty"` // destination needs to be provided. e.g. `{ "dbfs": { "destination" : // "dbfs:/home/cluster_log" } }` - // Wire name: 'dbfs' Dbfs *DbfsStorageInfo `json:"dbfs,omitempty"` // destination needs to be provided, e.g. `{ "file": { "destination": // "file:/my/local/file.sh" } }` - // Wire name: 'file' File *LocalFileInfo `json:"file,omitempty"` // destination needs to be provided, e.g. `{ "gcs": { "destination": // "gs://my-bucket/file.sh" } }` - // Wire name: 'gcs' Gcs *GcsStorageInfo `json:"gcs,omitempty"` // destination and either the region or endpoint need to be provided. e.g. // `{ \"s3\": { \"destination\": \"s3://cluster_log_bucket/prefix\", // \"region\": \"us-west-2\" } }` Cluster iam role is used to access s3, // please make sure the cluster iam role in `instance_profile_arn` has // permission to write data to the s3 destination. - // Wire name: 's3' S3 *S3StorageInfo `json:"s3,omitempty"` // destination needs to be provided. e.g. `{ \"volumes\" : { \"destination\" // : \"/Volumes/my-init.sh\" } }` - // Wire name: 'volumes' Volumes *VolumesStorageInfo `json:"volumes,omitempty"` // destination needs to be provided, e.g. `{ "workspace": { "destination": // "/cluster-init-scripts/setup-datadog.sh" } }` - // Wire name: 'workspace' Workspace *WorkspaceStorageInfo `json:"workspace,omitempty"` } -func (st *InitScriptInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &initScriptInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := initScriptInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st InitScriptInfo) MarshalJSON() ([]byte, error) { - pb, err := initScriptInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type InitScriptInfoAndExecutionDetails struct { // destination needs to be provided, e.g. // `abfss://@.dfs.core.windows.net/` - // Wire name: 'abfss' Abfss *Adlsgen2Info `json:"abfss,omitempty"` // destination needs to be provided. e.g. `{ "dbfs": { "destination" : // "dbfs:/home/cluster_log" } }` - // Wire name: 'dbfs' Dbfs *DbfsStorageInfo `json:"dbfs,omitempty"` // Additional details regarding errors (such as a file not found message if // the status is FAILED_FETCH). This field should only be used to provide // *additional* information to the status field, not duplicate it. - // Wire name: 'error_message' ErrorMessage string `json:"error_message,omitempty"` // The number duration of the script execution in seconds - // Wire name: 'execution_duration_seconds' ExecutionDurationSeconds int `json:"execution_duration_seconds,omitempty"` // destination needs to be provided, e.g. `{ "file": { "destination": // "file:/my/local/file.sh" } }` - // Wire name: 'file' File *LocalFileInfo `json:"file,omitempty"` // destination needs to be provided, e.g. `{ "gcs": { "destination": // "gs://my-bucket/file.sh" } }` - // Wire name: 'gcs' Gcs *GcsStorageInfo `json:"gcs,omitempty"` // destination and either the region or endpoint need to be provided. e.g. // `{ \"s3\": { \"destination\": \"s3://cluster_log_bucket/prefix\", // \"region\": \"us-west-2\" } }` Cluster iam role is used to access s3, // please make sure the cluster iam role in `instance_profile_arn` has // permission to write data to the s3 destination. - // Wire name: 's3' S3 *S3StorageInfo `json:"s3,omitempty"` // The current status of the script - // Wire name: 'status' Status InitScriptExecutionDetailsInitScriptExecutionStatus `json:"status,omitempty"` // destination needs to be provided. e.g. `{ \"volumes\" : { \"destination\" // : \"/Volumes/my-init.sh\" } }` - // Wire name: 'volumes' Volumes *VolumesStorageInfo `json:"volumes,omitempty"` // destination needs to be provided, e.g. `{ "workspace": { "destination": // "/cluster-init-scripts/setup-datadog.sh" } }` - // Wire name: 'workspace' Workspace *WorkspaceStorageInfo `json:"workspace,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *InitScriptInfoAndExecutionDetails) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &initScriptInfoAndExecutionDetailsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := initScriptInfoAndExecutionDetailsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *InitScriptInfoAndExecutionDetails) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st InitScriptInfoAndExecutionDetails) MarshalJSON() ([]byte, error) { - pb, err := initScriptInfoAndExecutionDetailsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s InitScriptInfoAndExecutionDetails) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type InstallLibraries struct { // Unique identifier for the cluster on which to install these libraries. - // Wire name: 'cluster_id' ClusterId string `json:"cluster_id"` // The libraries to install. - // Wire name: 'libraries' Libraries []Library `json:"libraries"` } -func (st *InstallLibraries) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &installLibrariesPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := installLibrariesFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st InstallLibraries) MarshalJSON() ([]byte, error) { - pb, err := installLibrariesToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type InstallLibrariesResponse struct { } -func (st *InstallLibrariesResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &installLibrariesResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := installLibrariesResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st InstallLibrariesResponse) MarshalJSON() ([]byte, error) { - pb, err := installLibrariesResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type InstancePoolAccessControlRequest struct { // name of the group - // Wire name: 'group_name' GroupName string `json:"group_name,omitempty"` // Permission level - // Wire name: 'permission_level' PermissionLevel InstancePoolPermissionLevel `json:"permission_level,omitempty"` // application ID of a service principal - // Wire name: 'service_principal_name' ServicePrincipalName string `json:"service_principal_name,omitempty"` // name of the user - // Wire name: 'user_name' UserName string `json:"user_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *InstancePoolAccessControlRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &instancePoolAccessControlRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := instancePoolAccessControlRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *InstancePoolAccessControlRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st InstancePoolAccessControlRequest) MarshalJSON() ([]byte, error) { - pb, err := instancePoolAccessControlRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s InstancePoolAccessControlRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type InstancePoolAccessControlResponse struct { // All permissions. - // Wire name: 'all_permissions' AllPermissions []InstancePoolPermission `json:"all_permissions,omitempty"` // Display name of the user or service principal. - // Wire name: 'display_name' DisplayName string `json:"display_name,omitempty"` // name of the group - // Wire name: 'group_name' GroupName string `json:"group_name,omitempty"` // Name of the service principal. - // Wire name: 'service_principal_name' ServicePrincipalName string `json:"service_principal_name,omitempty"` // name of the user - // Wire name: 'user_name' UserName string `json:"user_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *InstancePoolAccessControlResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &instancePoolAccessControlResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := instancePoolAccessControlResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *InstancePoolAccessControlResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st InstancePoolAccessControlResponse) MarshalJSON() ([]byte, error) { - pb, err := instancePoolAccessControlResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s InstancePoolAccessControlResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type InstancePoolAndStats struct { // Attributes related to instance pools running on Amazon Web Services. If // not specified at pool creation, a set of default values will be used. - // Wire name: 'aws_attributes' AwsAttributes *InstancePoolAwsAttributes `json:"aws_attributes,omitempty"` // Attributes related to instance pools running on Azure. If not specified // at pool creation, a set of default values will be used. - // Wire name: 'azure_attributes' AzureAttributes *InstancePoolAzureAttributes `json:"azure_attributes,omitempty"` // Additional tags for pool resources. Databricks will tag all pool // resources (e.g., AWS instances and EBS volumes) with these tags in // addition to `default_tags`. Notes: // // - Currently, Databricks allows at most 45 custom tags - // Wire name: 'custom_tags' CustomTags map[string]string `json:"custom_tags,omitempty"` // Tags that are added by Databricks regardless of any ``custom_tags``, // including: @@ -6727,22 +3983,18 @@ type InstancePoolAndStats struct { // - InstancePoolName: // // - InstancePoolId: - // Wire name: 'default_tags' DefaultTags map[string]string `json:"default_tags,omitempty"` // Defines the specification of the disks that will be attached to all spark // containers. - // Wire name: 'disk_spec' DiskSpec *DiskSpec `json:"disk_spec,omitempty"` // Autoscaling Local Storage: when enabled, this instances in this pool will // dynamically acquire additional disk space when its Spark workers are // running low on disk space. In AWS, this feature requires specific AWS // permissions to function correctly - refer to the User Guide for more // details. - // Wire name: 'enable_elastic_disk' EnableElasticDisk bool `json:"enable_elastic_disk,omitempty"` // Attributes related to instance pools running on Google Cloud Platform. If // not specified at pool creation, a set of default values will be used. - // Wire name: 'gcp_attributes' GcpAttributes *InstancePoolGcpAttributes `json:"gcp_attributes,omitempty"` // Automatically terminates the extra instances in the pool cache after they // are inactive for this time in minutes if min_idle_instances requirement @@ -6751,90 +4003,59 @@ type InstancePoolAndStats struct { // threshold must be between 0 and 10000 minutes. Users can also set this // value to 0 to instantly remove idle instances from the cache if min cache // size could still hold. - // Wire name: 'idle_instance_autotermination_minutes' IdleInstanceAutoterminationMinutes int `json:"idle_instance_autotermination_minutes,omitempty"` // Canonical unique identifier for the pool. - // Wire name: 'instance_pool_id' InstancePoolId string `json:"instance_pool_id,omitempty"` // Pool name requested by the user. Pool name must be unique. Length must be // between 1 and 100 characters. - // Wire name: 'instance_pool_name' InstancePoolName string `json:"instance_pool_name,omitempty"` // Maximum number of outstanding instances to keep in the pool, including // both instances used by clusters and idle instances. Clusters that require // further instance provisioning will fail during upsize requests. - // Wire name: 'max_capacity' MaxCapacity int `json:"max_capacity,omitempty"` // Minimum number of idle instances to keep in the instance pool - // Wire name: 'min_idle_instances' MinIdleInstances int `json:"min_idle_instances,omitempty"` // This field encodes, through a single value, the resources available to // each of the Spark nodes in this cluster. For example, the Spark nodes can // be provisioned and optimized for memory or compute intensive workloads. A // list of available node types can be retrieved by using the // :method:clusters/listNodeTypes API call. - // Wire name: 'node_type_id' NodeTypeId string `json:"node_type_id,omitempty"` // Custom Docker Image BYOC - // Wire name: 'preloaded_docker_images' PreloadedDockerImages []DockerImage `json:"preloaded_docker_images,omitempty"` // A list containing at most one preloaded Spark image version for the pool. // Pool-backed clusters started with the preloaded Spark version will start // faster. A list of available Spark versions can be retrieved by using the // :method:clusters/sparkVersions API call. - // Wire name: 'preloaded_spark_versions' PreloadedSparkVersions []string `json:"preloaded_spark_versions,omitempty"` // If set, what the configurable throughput (in Mb/s) for the remote disk // is. Currently only supported for GCP HYPERDISK_BALANCED types. - // Wire name: 'remote_disk_throughput' RemoteDiskThroughput int `json:"remote_disk_throughput,omitempty"` // Current state of the instance pool. - // Wire name: 'state' State InstancePoolState `json:"state,omitempty"` // Usage statistics about the instance pool. - // Wire name: 'stats' Stats *InstancePoolStats `json:"stats,omitempty"` // Status of failed pending instances in the pool. - // Wire name: 'status' Status *InstancePoolStatus `json:"status,omitempty"` // If set, what the total initial volume size (in GB) of the remote disks // should be. Currently only supported for GCP HYPERDISK_BALANCED types. - // Wire name: 'total_initial_remote_disk_size' TotalInitialRemoteDiskSize int `json:"total_initial_remote_disk_size,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *InstancePoolAndStats) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &instancePoolAndStatsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := instancePoolAndStatsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *InstancePoolAndStats) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st InstancePoolAndStats) MarshalJSON() ([]byte, error) { - pb, err := instancePoolAndStatsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s InstancePoolAndStats) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Attributes set during instance pool creation which are related to Amazon Web // Services. type InstancePoolAwsAttributes struct { // Availability type used for the spot nodes. - // Wire name: 'availability' Availability InstancePoolAwsAttributesAvailability `json:"availability,omitempty"` // Calculates the bid price for AWS spot instances, as a percentage of the // corresponding instance type's on-demand price. For example, if this field @@ -6846,7 +4067,6 @@ type InstancePoolAwsAttributes struct { // instances whose bid price percentage matches this field will be // considered. Note that, for safety, we enforce this field to be no more // than 10000. - // Wire name: 'spot_bid_price_percent' SpotBidPricePercent int `json:"spot_bid_price_percent,omitempty"` // Identifier for the availability zone/datacenter in which the cluster // resides. This string will be of a form like "us-west-2a". The provided @@ -6856,35 +4076,17 @@ type InstancePoolAwsAttributes struct { // optional field at cluster creation, and if not specified, a default zone // will be used. The list of available zones as well as the default value // can be found by using the `List Zones` method. - // Wire name: 'zone_id' ZoneId string `json:"zone_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *InstancePoolAwsAttributes) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &instancePoolAwsAttributesPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := instancePoolAwsAttributesFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *InstancePoolAwsAttributes) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st InstancePoolAwsAttributes) MarshalJSON() ([]byte, error) { - pb, err := instancePoolAwsAttributesToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s InstancePoolAwsAttributes) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The set of AWS availability types supported when setting up nodes for a @@ -6929,7 +4131,6 @@ func (f *InstancePoolAwsAttributesAvailability) Type() string { // Attributes set during instance pool creation which are related to Azure. type InstancePoolAzureAttributes struct { // Availability type used for the spot nodes. - // Wire name: 'availability' Availability InstancePoolAzureAttributesAvailability `json:"availability,omitempty"` // With variable pricing, you have option to set a max price, in US dollars // (USD) For example, the value 2 would be a max price of $2.00 USD per @@ -6937,35 +4138,17 @@ type InstancePoolAzureAttributes struct { // price. The price for the VM will be the current price for spot or the // price for a standard VM, which ever is less, as long as there is capacity // and quota available. - // Wire name: 'spot_bid_max_price' SpotBidMaxPrice float64 `json:"spot_bid_max_price,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *InstancePoolAzureAttributes) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &instancePoolAzureAttributesPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := instancePoolAzureAttributesFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *InstancePoolAzureAttributes) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st InstancePoolAzureAttributes) MarshalJSON() ([]byte, error) { - pb, err := instancePoolAzureAttributesToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s InstancePoolAzureAttributes) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The set of Azure availability types supported when setting up nodes for a @@ -7012,7 +4195,6 @@ type InstancePoolGcpAttributes struct { // This field determines whether the instance pool will contain preemptible // VMs, on-demand VMs, or preemptible VMs with a fallback to on-demand VMs // if the former is unavailable. - // Wire name: 'gcp_availability' GcpAvailability GcpAvailability `json:"gcp_availability,omitempty"` // If provided, each node in the instance pool will have this number of // local SSDs attached. Each local SSD is 375GB in size. Refer to [GCP @@ -7020,7 +4202,6 @@ type InstancePoolGcpAttributes struct { // type. // // [GCP documentation]: https://cloud.google.com/compute/docs/disks/local-ssd#choose_number_local_ssds - // Wire name: 'local_ssd_count' LocalSsdCount int `json:"local_ssd_count,omitempty"` // Identifier for the availability zone/datacenter in which the cluster // resides. This string will be of a form like "us-west1-a". The provided @@ -7038,74 +4219,35 @@ type InstancePoolGcpAttributes struct { // // If empty, Databricks picks an availability zone to schedule the cluster // on. - // Wire name: 'zone_id' ZoneId string `json:"zone_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *InstancePoolGcpAttributes) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &instancePoolGcpAttributesPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := instancePoolGcpAttributesFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *InstancePoolGcpAttributes) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st InstancePoolGcpAttributes) MarshalJSON() ([]byte, error) { - pb, err := instancePoolGcpAttributesToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s InstancePoolGcpAttributes) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type InstancePoolPermission struct { - - // Wire name: 'inherited' Inherited bool `json:"inherited,omitempty"` - // Wire name: 'inherited_from_object' InheritedFromObject []string `json:"inherited_from_object,omitempty"` // Permission level - // Wire name: 'permission_level' PermissionLevel InstancePoolPermissionLevel `json:"permission_level,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *InstancePoolPermission) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &instancePoolPermissionPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := instancePoolPermissionFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *InstancePoolPermission) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st InstancePoolPermission) MarshalJSON() ([]byte, error) { - pb, err := instancePoolPermissionToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s InstancePoolPermission) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Permission level @@ -7147,111 +4289,43 @@ func (f *InstancePoolPermissionLevel) Type() string { } type InstancePoolPermissions struct { - - // Wire name: 'access_control_list' AccessControlList []InstancePoolAccessControlResponse `json:"access_control_list,omitempty"` - // Wire name: 'object_id' ObjectId string `json:"object_id,omitempty"` - // Wire name: 'object_type' ObjectType string `json:"object_type,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *InstancePoolPermissions) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &instancePoolPermissionsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := instancePoolPermissionsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *InstancePoolPermissions) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st InstancePoolPermissions) MarshalJSON() ([]byte, error) { - pb, err := instancePoolPermissionsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s InstancePoolPermissions) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type InstancePoolPermissionsDescription struct { - - // Wire name: 'description' Description string `json:"description,omitempty"` // Permission level - // Wire name: 'permission_level' PermissionLevel InstancePoolPermissionLevel `json:"permission_level,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *InstancePoolPermissionsDescription) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &instancePoolPermissionsDescriptionPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := instancePoolPermissionsDescriptionFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *InstancePoolPermissionsDescription) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st InstancePoolPermissionsDescription) MarshalJSON() ([]byte, error) { - pb, err := instancePoolPermissionsDescriptionToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s InstancePoolPermissionsDescription) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type InstancePoolPermissionsRequest struct { - - // Wire name: 'access_control_list' AccessControlList []InstancePoolAccessControlRequest `json:"access_control_list,omitempty"` // The instance pool for which to get or manage permissions. - InstancePoolId string `json:"-" tf:"-"` -} - -func (st *InstancePoolPermissionsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &instancePoolPermissionsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := instancePoolPermissionsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st InstancePoolPermissionsRequest) MarshalJSON() ([]byte, error) { - pb, err := instancePoolPermissionsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + InstancePoolId string `json:"-" url:"-"` } // The state of a Cluster. The current allowable state transitions are as @@ -7301,44 +4375,23 @@ func (f *InstancePoolState) Type() string { type InstancePoolStats struct { // Number of active instances in the pool that are NOT part of a cluster. - // Wire name: 'idle_count' IdleCount int `json:"idle_count,omitempty"` // Number of pending instances in the pool that are NOT part of a cluster. - // Wire name: 'pending_idle_count' PendingIdleCount int `json:"pending_idle_count,omitempty"` // Number of pending instances in the pool that are part of a cluster. - // Wire name: 'pending_used_count' PendingUsedCount int `json:"pending_used_count,omitempty"` // Number of active instances in the pool that are part of a cluster. - // Wire name: 'used_count' UsedCount int `json:"used_count,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *InstancePoolStats) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &instancePoolStatsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := instancePoolStatsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *InstancePoolStats) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st InstancePoolStats) MarshalJSON() ([]byte, error) { - pb, err := instancePoolStatsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s InstancePoolStats) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type InstancePoolStatus struct { @@ -7346,35 +4399,9 @@ type InstancePoolStatus struct { // pending_instance_errors follows FIFO with maximum length of the min_idle // of the pool. The pending_instance_errors is emptied once the number of // exiting available instances reaches the min_idle of the pool. - // Wire name: 'pending_instance_errors' PendingInstanceErrors []PendingInstanceError `json:"pending_instance_errors,omitempty"` } -func (st *InstancePoolStatus) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &instancePoolStatusPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := instancePoolStatusFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st InstancePoolStatus) MarshalJSON() ([]byte, error) { - pb, err := instancePoolStatusToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type InstanceProfile struct { // The AWS IAM role ARN of the role associated with the instance profile. // This field is required if your role name and instance profile name do not @@ -7384,46 +4411,26 @@ type InstanceProfile struct { // Otherwise, this field is optional. // // [Databricks SQL Serverless]: https://docs.databricks.com/sql/admin/serverless.html - // Wire name: 'iam_role_arn' IamRoleArn string `json:"iam_role_arn,omitempty"` // The AWS ARN of the instance profile to register with Databricks. This // field is required. - // Wire name: 'instance_profile_arn' InstanceProfileArn string `json:"instance_profile_arn"` // Boolean flag indicating whether the instance profile should only be used // in credential passthrough scenarios. If true, it means the instance // profile contains an meta IAM role which could assume a wide range of // roles. Therefore it should always be used with authorization. This field // is optional, the default value is `false`. - // Wire name: 'is_meta_instance_profile' IsMetaInstanceProfile bool `json:"is_meta_instance_profile,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *InstanceProfile) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &instanceProfilePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := instanceProfileFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *InstanceProfile) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st InstanceProfile) MarshalJSON() ([]byte, error) { - pb, err := instanceProfileToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s InstanceProfile) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The kind of compute described by this compute specification. @@ -7522,12 +4529,10 @@ func (f *Language) Type() string { type Library struct { // Specification of a CRAN library to be installed as part of the library - // Wire name: 'cran' Cran *RCranLibrary `json:"cran,omitempty"` // Deprecated. URI of the egg library to install. Installing Python egg // files is deprecated and is not supported in Databricks Runtime 14.0 and // above. - // Wire name: 'egg' Egg string `json:"egg,omitempty"` // URI of the JAR library to install. Supported URIs include Workspace // paths, Unity Catalog Volumes paths, and S3 URIs. For example: `{ "jar": @@ -7536,21 +4541,17 @@ type Library struct { // "s3://my-bucket/library.jar" }`. If S3 is used, please make sure the // cluster has read access on the library. You may need to launch the // cluster with an IAM role to access the S3 URI. - // Wire name: 'jar' Jar string `json:"jar,omitempty"` // Specification of a maven library to be installed. For example: `{ // "coordinates": "org.jsoup:jsoup:1.7.2" }` - // Wire name: 'maven' Maven *MavenLibrary `json:"maven,omitempty"` // Specification of a PyPi library to be installed. For example: `{ // "package": "simplejson" }` - // Wire name: 'pypi' Pypi *PythonPyPiLibrary `json:"pypi,omitempty"` // URI of the requirements.txt file to install. Only Workspace paths and // Unity Catalog Volumes paths are supported. For example: `{ // "requirements": "/Workspace/path/to/requirements.txt" }` or `{ // "requirements" : "/Volumes/path/to/requirements.txt" }` - // Wire name: 'requirements' Requirements string `json:"requirements,omitempty"` // URI of the wheel library to install. Supported URIs include Workspace // paths, Unity Catalog Volumes paths, and S3 URIs. For example: `{ "whl": @@ -7559,80 +4560,41 @@ type Library struct { // "s3://my-bucket/library.whl" }`. If S3 is used, please make sure the // cluster has read access on the library. You may need to launch the // cluster with an IAM role to access the S3 URI. - // Wire name: 'whl' Whl string `json:"whl,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *Library) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &libraryPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := libraryFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *Library) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st Library) MarshalJSON() ([]byte, error) { - pb, err := libraryToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s Library) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The status of the library on a specific cluster. type LibraryFullStatus struct { // Whether the library was set to be installed on all clusters via the // libraries UI. - // Wire name: 'is_library_for_all_clusters' IsLibraryForAllClusters bool `json:"is_library_for_all_clusters,omitempty"` // Unique identifier for the library. - // Wire name: 'library' Library *Library `json:"library,omitempty"` // All the info and warning messages that have occurred so far for this // library. - // Wire name: 'messages' Messages []string `json:"messages,omitempty"` // Status of installing the library on the cluster. - // Wire name: 'status' Status LibraryInstallStatus `json:"status,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *LibraryFullStatus) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &libraryFullStatusPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := libraryFullStatusFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *LibraryFullStatus) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st LibraryFullStatus) MarshalJSON() ([]byte, error) { - pb, err := libraryFullStatusToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s LibraryFullStatus) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The status of a library on a specific cluster. @@ -7693,70 +4655,25 @@ func (f *LibraryInstallStatus) Type() string { type ListAllClusterLibraryStatusesResponse struct { // A list of cluster statuses. - // Wire name: 'statuses' Statuses []ClusterLibraryStatuses `json:"statuses,omitempty"` } -func (st *ListAllClusterLibraryStatusesResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listAllClusterLibraryStatusesResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listAllClusterLibraryStatusesResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ListAllClusterLibraryStatusesResponse) MarshalJSON() ([]byte, error) { - pb, err := listAllClusterLibraryStatusesResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type ListAvailableZonesResponse struct { // The availability zone if no ``zone_id`` is provided in the cluster // creation request. - // Wire name: 'default_zone' DefaultZone string `json:"default_zone,omitempty"` // The list of available zones (e.g., ['us-west-2c', 'us-east-2']). - // Wire name: 'zones' Zones []string `json:"zones,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListAvailableZonesResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listAvailableZonesResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listAvailableZonesResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListAvailableZonesResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListAvailableZonesResponse) MarshalJSON() ([]byte, error) { - pb, err := listAvailableZonesResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListAvailableZonesResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // List cluster policy compliance @@ -7764,81 +4681,44 @@ type ListClusterCompliancesRequest struct { // Use this field to specify the maximum number of results to be returned by // the server. The server may further constrain the maximum number of // results returned in a single page. - PageSize int `json:"-" tf:"-"` + PageSize int `json:"-" url:"page_size,omitempty"` // A page token that can be used to navigate to the next page or previous // page as returned by `next_page_token` or `prev_page_token`. - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` // Canonical unique identifier for the cluster policy. - PolicyId string `json:"-" tf:"-"` + PolicyId string `json:"-" url:"policy_id"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListClusterCompliancesRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listClusterCompliancesRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listClusterCompliancesRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListClusterCompliancesRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListClusterCompliancesRequest) MarshalJSON() ([]byte, error) { - pb, err := listClusterCompliancesRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListClusterCompliancesRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListClusterCompliancesResponse struct { // A list of clusters and their policy compliance statuses. - // Wire name: 'clusters' Clusters []ClusterCompliance `json:"clusters,omitempty"` // This field represents the pagination token to retrieve the next page of // results. If the value is "", it means no further results for the request. - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` // This field represents the pagination token to retrieve the previous page // of results. If the value is "", it means no further results for the // request. - // Wire name: 'prev_page_token' PrevPageToken string `json:"prev_page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListClusterCompliancesResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listClusterCompliancesResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listClusterCompliancesResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListClusterCompliancesResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListClusterCompliancesResponse) MarshalJSON() ([]byte, error) { - pb, err := listClusterCompliancesResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListClusterCompliancesResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // List cluster policies @@ -7846,197 +4726,86 @@ type ListClusterPoliciesRequest struct { // The cluster policy attribute to sort by. * `POLICY_CREATION_TIME` - Sort // result list by policy creation time. * `POLICY_NAME` - Sort result list // by policy name. - SortColumn ListSortColumn `json:"-" tf:"-"` + SortColumn ListSortColumn `json:"-" url:"sort_column,omitempty"` // The order in which the policies get listed. * `DESC` - Sort result list // in descending order. * `ASC` - Sort result list in ascending order. - SortOrder ListSortOrder `json:"-" tf:"-"` -} - -func (st *ListClusterPoliciesRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listClusterPoliciesRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listClusterPoliciesRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ListClusterPoliciesRequest) MarshalJSON() ([]byte, error) { - pb, err := listClusterPoliciesRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + SortOrder ListSortOrder `json:"-" url:"sort_order,omitempty"` } type ListClustersFilterBy struct { // The source of cluster creation. - // Wire name: 'cluster_sources' - ClusterSources []ClusterSource `json:"cluster_sources,omitempty"` + ClusterSources []ClusterSource `json:"cluster_sources,omitempty" url:"cluster_sources,omitempty"` // The current state of the clusters. - // Wire name: 'cluster_states' - ClusterStates []State `json:"cluster_states,omitempty"` + ClusterStates []State `json:"cluster_states,omitempty" url:"cluster_states,omitempty"` // Whether the clusters are pinned or not. - // Wire name: 'is_pinned' - IsPinned bool `json:"is_pinned,omitempty"` + IsPinned bool `json:"is_pinned,omitempty" url:"is_pinned,omitempty"` // The ID of the cluster policy used to create the cluster if applicable. - // Wire name: 'policy_id' - PolicyId string `json:"policy_id,omitempty"` + PolicyId string `json:"policy_id,omitempty" url:"policy_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListClustersFilterBy) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listClustersFilterByPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listClustersFilterByFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListClustersFilterBy) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListClustersFilterBy) MarshalJSON() ([]byte, error) { - pb, err := listClustersFilterByToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListClustersFilterBy) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // List clusters type ListClustersRequest struct { // Filters to apply to the list of clusters. - FilterBy *ListClustersFilterBy `json:"-" tf:"-"` + FilterBy *ListClustersFilterBy `json:"-" url:"filter_by,omitempty"` // Use this field to specify the maximum number of results to be returned by // the server. The server may further constrain the maximum number of // results returned in a single page. - PageSize int `json:"-" tf:"-"` + PageSize int `json:"-" url:"page_size,omitempty"` // Use next_page_token or prev_page_token returned from the previous request // to list the next or previous page of clusters respectively. - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` // Sort the list of clusters by a specific criteria. - SortBy *ListClustersSortBy `json:"-" tf:"-"` + SortBy *ListClustersSortBy `json:"-" url:"sort_by,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListClustersRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listClustersRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listClustersRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListClustersRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListClustersRequest) MarshalJSON() ([]byte, error) { - pb, err := listClustersRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListClustersRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListClustersResponse struct { - - // Wire name: 'clusters' Clusters []ClusterDetails `json:"clusters,omitempty"` // This field represents the pagination token to retrieve the next page of // results. If the value is "", it means no further results for the request. - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` // This field represents the pagination token to retrieve the previous page // of results. If the value is "", it means no further results for the // request. - // Wire name: 'prev_page_token' PrevPageToken string `json:"prev_page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListClustersResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listClustersResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listClustersResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListClustersResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListClustersResponse) MarshalJSON() ([]byte, error) { - pb, err := listClustersResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListClustersResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListClustersSortBy struct { // The direction to sort by. - // Wire name: 'direction' - Direction ListClustersSortByDirection `json:"direction,omitempty"` + Direction ListClustersSortByDirection `json:"direction,omitempty" url:"direction,omitempty"` // The sorting criteria. By default, clusters are sorted by 3 columns from // highest to lowest precedence: cluster state, pinned or unpinned, then // cluster name. - // Wire name: 'field' - Field ListClustersSortByField `json:"field,omitempty"` -} - -func (st *ListClustersSortBy) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listClustersSortByPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listClustersSortByFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ListClustersSortBy) MarshalJSON() ([]byte, error) { - pb, err := listClustersSortByToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Field ListClustersSortByField `json:"field,omitempty" url:"field,omitempty"` } type ListClustersSortByDirection string @@ -8114,230 +4883,62 @@ func (f *ListClustersSortByField) Type() string { } type ListGlobalInitScriptsResponse struct { - - // Wire name: 'scripts' Scripts []GlobalInitScriptDetails `json:"scripts,omitempty"` } -func (st *ListGlobalInitScriptsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listGlobalInitScriptsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listGlobalInitScriptsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ListGlobalInitScriptsResponse) MarshalJSON() ([]byte, error) { - pb, err := listGlobalInitScriptsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type ListInstancePools struct { - - // Wire name: 'instance_pools' InstancePools []InstancePoolAndStats `json:"instance_pools,omitempty"` } -func (st *ListInstancePools) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listInstancePoolsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listInstancePoolsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ListInstancePools) MarshalJSON() ([]byte, error) { - pb, err := listInstancePoolsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type ListInstanceProfilesResponse struct { // A list of instance profiles that the user can access. - // Wire name: 'instance_profiles' InstanceProfiles []InstanceProfile `json:"instance_profiles,omitempty"` } -func (st *ListInstanceProfilesResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listInstanceProfilesResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listInstanceProfilesResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ListInstanceProfilesResponse) MarshalJSON() ([]byte, error) { - pb, err := listInstanceProfilesResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type ListNodeTypesResponse struct { // The list of available Spark node types. - // Wire name: 'node_types' NodeTypes []NodeType `json:"node_types,omitempty"` } -func (st *ListNodeTypesResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listNodeTypesResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listNodeTypesResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ListNodeTypesResponse) MarshalJSON() ([]byte, error) { - pb, err := listNodeTypesResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type ListPoliciesResponse struct { // List of policies. - // Wire name: 'policies' Policies []Policy `json:"policies,omitempty"` } -func (st *ListPoliciesResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listPoliciesResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listPoliciesResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ListPoliciesResponse) MarshalJSON() ([]byte, error) { - pb, err := listPoliciesResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // List policy families type ListPolicyFamiliesRequest struct { // Maximum number of policy families to return. - MaxResults int64 `json:"-" tf:"-"` + MaxResults int64 `json:"-" url:"max_results,omitempty"` // A token that can be used to get the next page of results. - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListPolicyFamiliesRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listPolicyFamiliesRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listPolicyFamiliesRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListPolicyFamiliesRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListPolicyFamiliesRequest) MarshalJSON() ([]byte, error) { - pb, err := listPolicyFamiliesRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListPolicyFamiliesRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListPolicyFamiliesResponse struct { // A token that can be used to get the next page of results. If not present, // there are no more results to show. - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` // List of policy families. - // Wire name: 'policy_families' PolicyFamilies []PolicyFamily `json:"policy_families,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListPolicyFamiliesResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listPolicyFamiliesResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listPolicyFamiliesResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListPolicyFamiliesResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListPolicyFamiliesResponse) MarshalJSON() ([]byte, error) { - pb, err := listPolicyFamiliesResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListPolicyFamiliesResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListSortColumn string @@ -8416,154 +5017,69 @@ func (f *ListSortOrder) Type() string { type LocalFileInfo struct { // local file destination, e.g. `file:/my/local/file.sh` - // Wire name: 'destination' Destination string `json:"destination"` } -func (st *LocalFileInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &localFileInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := localFileInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st LocalFileInfo) MarshalJSON() ([]byte, error) { - pb, err := localFileInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type LogAnalyticsInfo struct { - - // Wire name: 'log_analytics_primary_key' LogAnalyticsPrimaryKey string `json:"log_analytics_primary_key,omitempty"` - // Wire name: 'log_analytics_workspace_id' LogAnalyticsWorkspaceId string `json:"log_analytics_workspace_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *LogAnalyticsInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &logAnalyticsInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := logAnalyticsInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *LogAnalyticsInfo) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st LogAnalyticsInfo) MarshalJSON() ([]byte, error) { - pb, err := logAnalyticsInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s LogAnalyticsInfo) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The log delivery status type LogSyncStatus struct { // The timestamp of last attempt. If the last attempt fails, // `last_exception` will contain the exception in the last attempt. - // Wire name: 'last_attempted' LastAttempted int64 `json:"last_attempted,omitempty"` // The exception thrown in the last attempt, it would be null (omitted in // the response) if there is no exception in last attempted. - // Wire name: 'last_exception' LastException string `json:"last_exception,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *LogSyncStatus) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &logSyncStatusPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := logSyncStatusFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *LogSyncStatus) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st LogSyncStatus) MarshalJSON() ([]byte, error) { - pb, err := logSyncStatusToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s LogSyncStatus) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type MapAny map[string]any type MavenLibrary struct { // Gradle-style maven coordinates. For example: "org.jsoup:jsoup:1.7.2". - // Wire name: 'coordinates' Coordinates string `json:"coordinates"` // List of dependences to exclude. For example: `["slf4j:slf4j", // "*:hadoop-client"]`. // // Maven dependency exclusions: // https://maven.apache.org/guides/introduction/introduction-to-optional-and-excludes-dependencies.html. - // Wire name: 'exclusions' Exclusions []string `json:"exclusions,omitempty"` // Maven repo to install the Maven package from. If omitted, both Maven // Central Repository and Spark Packages are searched. - // Wire name: 'repo' Repo string `json:"repo,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *MavenLibrary) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &mavenLibraryPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := mavenLibraryFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *MavenLibrary) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st MavenLibrary) MarshalJSON() ([]byte, error) { - pb, err := mavenLibraryToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s MavenLibrary) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // This structure embodies the machine type that hosts spark containers Note: @@ -8571,49 +5087,27 @@ func (st MavenLibrary) MarshalJSON() ([]byte, error) { // case we want to send it over the wire in the future (which is likely) type NodeInstanceType struct { // Unique identifier across instance types - // Wire name: 'instance_type_id' InstanceTypeId string `json:"instance_type_id"` // Size of the individual local disks attached to this instance (i.e. per // local disk). - // Wire name: 'local_disk_size_gb' LocalDiskSizeGb int `json:"local_disk_size_gb,omitempty"` // Number of local disks that are present on this instance. - // Wire name: 'local_disks' LocalDisks int `json:"local_disks,omitempty"` // Size of the individual local nvme disks attached to this instance (i.e. // per local disk). - // Wire name: 'local_nvme_disk_size_gb' LocalNvmeDiskSizeGb int `json:"local_nvme_disk_size_gb,omitempty"` // Number of local nvme disks that are present on this instance. - // Wire name: 'local_nvme_disks' LocalNvmeDisks int `json:"local_nvme_disks,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *NodeInstanceType) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &nodeInstanceTypePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := nodeInstanceTypeFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *NodeInstanceType) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st NodeInstanceType) MarshalJSON() ([]byte, error) { - pb, err := nodeInstanceTypeToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s NodeInstanceType) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // A description of a Spark node type including both the dimensions of the node @@ -8621,292 +5115,124 @@ func (st NodeInstanceType) MarshalJSON() ([]byte, error) { type NodeType struct { // A descriptive category for this node type. Examples include "Memory // Optimized" and "Compute Optimized". - // Wire name: 'category' Category string `json:"category"` // A string description associated with this node type, e.g., "r3.xlarge". - // Wire name: 'description' Description string `json:"description"` // An optional hint at the display order of node types in the UI. Within a // node type category, lowest numbers come first. - // Wire name: 'display_order' DisplayOrder int `json:"display_order,omitempty"` // An identifier for the type of hardware that this node runs on, e.g., // "r3.2xlarge" in AWS. - // Wire name: 'instance_type_id' InstanceTypeId string `json:"instance_type_id"` // Whether the node type is deprecated. Non-deprecated node types offer // greater performance. - // Wire name: 'is_deprecated' IsDeprecated bool `json:"is_deprecated,omitempty"` // AWS specific, whether this instance supports encryption in transit, used // for hipaa and pci workloads. - // Wire name: 'is_encrypted_in_transit' IsEncryptedInTransit bool `json:"is_encrypted_in_transit,omitempty"` // Whether this is an Arm-based instance. - // Wire name: 'is_graviton' IsGraviton bool `json:"is_graviton,omitempty"` // Whether this node is hidden from presentation in the UI. - // Wire name: 'is_hidden' IsHidden bool `json:"is_hidden,omitempty"` // Whether this node comes with IO cache enabled by default. - // Wire name: 'is_io_cache_enabled' IsIoCacheEnabled bool `json:"is_io_cache_enabled,omitempty"` // Memory (in MB) available for this node type. - // Wire name: 'memory_mb' MemoryMb int `json:"memory_mb"` // A collection of node type info reported by the cloud provider - // Wire name: 'node_info' NodeInfo *CloudProviderNodeInfo `json:"node_info,omitempty"` // The NodeInstanceType object corresponding to instance_type_id - // Wire name: 'node_instance_type' NodeInstanceType *NodeInstanceType `json:"node_instance_type,omitempty"` // Unique identifier for this node type. - // Wire name: 'node_type_id' NodeTypeId string `json:"node_type_id"` // Number of CPU cores available for this node type. Note that this can be // fractional, e.g., 2.5 cores, if the the number of cores on a machine // instance is not divisible by the number of Spark nodes on that machine. - // Wire name: 'num_cores' NumCores float64 `json:"num_cores"` // Number of GPUs available for this node type. - // Wire name: 'num_gpus' NumGpus int `json:"num_gpus,omitempty"` - // Wire name: 'photon_driver_capable' PhotonDriverCapable bool `json:"photon_driver_capable,omitempty"` - // Wire name: 'photon_worker_capable' PhotonWorkerCapable bool `json:"photon_worker_capable,omitempty"` // Whether this node type support cluster tags. - // Wire name: 'support_cluster_tags' SupportClusterTags bool `json:"support_cluster_tags,omitempty"` // Whether this node type support EBS volumes. EBS volumes is disabled for // node types that we could place multiple corresponding containers on the // same hosting instance. - // Wire name: 'support_ebs_volumes' SupportEbsVolumes bool `json:"support_ebs_volumes,omitempty"` // Whether this node type supports port forwarding. - // Wire name: 'support_port_forwarding' SupportPortForwarding bool `json:"support_port_forwarding,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *NodeType) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &nodeTypePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := nodeTypeFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *NodeType) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st NodeType) MarshalJSON() ([]byte, error) { - pb, err := nodeTypeToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s NodeType) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Error message of a failed pending instances type PendingInstanceError struct { - - // Wire name: 'instance_id' InstanceId string `json:"instance_id,omitempty"` - // Wire name: 'message' Message string `json:"message,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *PendingInstanceError) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &pendingInstanceErrorPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := pendingInstanceErrorFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *PendingInstanceError) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st PendingInstanceError) MarshalJSON() ([]byte, error) { - pb, err := pendingInstanceErrorToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s PendingInstanceError) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type PermanentDeleteCluster struct { // The cluster to be deleted. - // Wire name: 'cluster_id' ClusterId string `json:"cluster_id"` } -func (st *PermanentDeleteCluster) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &permanentDeleteClusterPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := permanentDeleteClusterFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st PermanentDeleteCluster) MarshalJSON() ([]byte, error) { - pb, err := permanentDeleteClusterToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type PermanentDeleteClusterResponse struct { } -func (st *PermanentDeleteClusterResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &permanentDeleteClusterResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := permanentDeleteClusterResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st PermanentDeleteClusterResponse) MarshalJSON() ([]byte, error) { - pb, err := permanentDeleteClusterResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type PinCluster struct { - - // Wire name: 'cluster_id' ClusterId string `json:"cluster_id"` } -func (st *PinCluster) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &pinClusterPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := pinClusterFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st PinCluster) MarshalJSON() ([]byte, error) { - pb, err := pinClusterToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type PinClusterResponse struct { } -func (st *PinClusterResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &pinClusterResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := pinClusterResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st PinClusterResponse) MarshalJSON() ([]byte, error) { - pb, err := pinClusterResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Describes a Cluster Policy entity. type Policy struct { // Creation time. The timestamp (in millisecond) when this Cluster Policy // was created. - // Wire name: 'created_at_timestamp' CreatedAtTimestamp int64 `json:"created_at_timestamp,omitempty"` // Creator user name. The field won't be included in the response if the // user has already been deleted. - // Wire name: 'creator_user_name' CreatorUserName string `json:"creator_user_name,omitempty"` // Policy definition document expressed in [Databricks Cluster Policy // Definition Language]. // // [Databricks Cluster Policy Definition Language]: https://docs.databricks.com/administration-guide/clusters/policy-definition.html - // Wire name: 'definition' Definition string `json:"definition,omitempty"` // Additional human-readable description of the cluster policy. - // Wire name: 'description' Description string `json:"description,omitempty"` // If true, policy is a default policy created and managed by Databricks. // Default policies cannot be deleted, and their policy families cannot be // changed. - // Wire name: 'is_default' IsDefault bool `json:"is_default,omitempty"` // A list of libraries to be installed on the next cluster restart that uses // this policy. The maximum number of libraries is 500. - // Wire name: 'libraries' Libraries []Library `json:"libraries,omitempty"` // Max number of clusters per user that can be active using this policy. If // not present, there is no max limit. - // Wire name: 'max_clusters_per_user' MaxClustersPerUser int64 `json:"max_clusters_per_user,omitempty"` // Cluster Policy name requested by the user. This has to be unique. Length // must be between 1 and 100 characters. - // Wire name: 'name' Name string `json:"name,omitempty"` // Policy definition JSON document expressed in [Databricks Policy // Definition Language]. The JSON document must be passed as a string and @@ -8917,7 +5243,6 @@ type Policy struct { // policy definition. // // [Databricks Policy Definition Language]: https://docs.databricks.com/administration-guide/clusters/policy-definition.html - // Wire name: 'policy_family_definition_overrides' PolicyFamilyDefinitionOverrides string `json:"policy_family_definition_overrides,omitempty"` // ID of the policy family. The cluster policy's policy definition inherits // the policy family's policy definition. @@ -8925,38 +5250,19 @@ type Policy struct { // Cannot be used with `definition`. Use // `policy_family_definition_overrides` instead to customize the policy // definition. - // Wire name: 'policy_family_id' PolicyFamilyId string `json:"policy_family_id,omitempty"` // Canonical unique identifier for the Cluster Policy. - // Wire name: 'policy_id' PolicyId string `json:"policy_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *Policy) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &policyPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := policyFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *Policy) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st Policy) MarshalJSON() ([]byte, error) { - pb, err := policyToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s Policy) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type PolicyFamily struct { @@ -8964,189 +5270,77 @@ type PolicyFamily struct { // Definition Language]. // // [Databricks Cluster Policy Definition Language]: https://docs.databricks.com/administration-guide/clusters/policy-definition.html - // Wire name: 'definition' Definition string `json:"definition,omitempty"` // Human-readable description of the purpose of the policy family. - // Wire name: 'description' Description string `json:"description,omitempty"` // Name of the policy family. - // Wire name: 'name' Name string `json:"name,omitempty"` // Unique identifier for the policy family. - // Wire name: 'policy_family_id' PolicyFamilyId string `json:"policy_family_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *PolicyFamily) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &policyFamilyPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := policyFamilyFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *PolicyFamily) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st PolicyFamily) MarshalJSON() ([]byte, error) { - pb, err := policyFamilyToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s PolicyFamily) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type PythonPyPiLibrary struct { // The name of the pypi package to install. An optional exact version // specification is also supported. Examples: "simplejson" and // "simplejson==3.8.0". - // Wire name: 'package' Package string `json:"package"` // The repository where the package can be found. If not specified, the // default pip index is used. - // Wire name: 'repo' Repo string `json:"repo,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *PythonPyPiLibrary) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &pythonPyPiLibraryPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := pythonPyPiLibraryFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *PythonPyPiLibrary) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st PythonPyPiLibrary) MarshalJSON() ([]byte, error) { - pb, err := pythonPyPiLibraryToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s PythonPyPiLibrary) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type RCranLibrary struct { // The name of the CRAN package to install. - // Wire name: 'package' Package string `json:"package"` // The repository where the package can be found. If not specified, the // default CRAN repo is used. - // Wire name: 'repo' Repo string `json:"repo,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *RCranLibrary) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &rCranLibraryPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := rCranLibraryFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *RCranLibrary) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st RCranLibrary) MarshalJSON() ([]byte, error) { - pb, err := rCranLibraryToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s RCranLibrary) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type RemoveInstanceProfile struct { // The ARN of the instance profile to remove. This field is required. - // Wire name: 'instance_profile_arn' InstanceProfileArn string `json:"instance_profile_arn"` } -func (st *RemoveInstanceProfile) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &removeInstanceProfilePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := removeInstanceProfileFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st RemoveInstanceProfile) MarshalJSON() ([]byte, error) { - pb, err := removeInstanceProfileToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type RemoveResponse struct { } -func (st *RemoveResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &removeResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := removeResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st RemoveResponse) MarshalJSON() ([]byte, error) { - pb, err := removeResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type ResizeCluster struct { // Parameters needed in order to automatically scale clusters up and down // based on load. Note: autoscaling works best with DB runtime versions 3.0 // or later. - // Wire name: 'autoscale' Autoscale *AutoScale `json:"autoscale,omitempty"` // The cluster to be resized. - // Wire name: 'cluster_id' ClusterId string `json:"cluster_id"` // Number of worker nodes that this cluster should have. A cluster has one // Spark Driver and `num_workers` Executors for a total of `num_workers` + 1 @@ -9158,129 +5352,42 @@ type ResizeCluster struct { // field will immediately be updated to reflect the target size of 10 // workers, whereas the workers listed in `spark_info` will gradually // increase from 5 to 10 as the new nodes are provisioned. - // Wire name: 'num_workers' NumWorkers int `json:"num_workers,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ResizeCluster) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &resizeClusterPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := resizeClusterFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ResizeCluster) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ResizeCluster) MarshalJSON() ([]byte, error) { - pb, err := resizeClusterToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ResizeCluster) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ResizeClusterResponse struct { } -func (st *ResizeClusterResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &resizeClusterResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := resizeClusterResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ResizeClusterResponse) MarshalJSON() ([]byte, error) { - pb, err := resizeClusterResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type RestartCluster struct { // The cluster to be started. - // Wire name: 'cluster_id' ClusterId string `json:"cluster_id"` - // Wire name: 'restart_user' RestartUser string `json:"restart_user,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *RestartCluster) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &restartClusterPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := restartClusterFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *RestartCluster) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st RestartCluster) MarshalJSON() ([]byte, error) { - pb, err := restartClusterToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s RestartCluster) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type RestartClusterResponse struct { } -func (st *RestartClusterResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &restartClusterResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := restartClusterResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st RestartClusterResponse) MarshalJSON() ([]byte, error) { - pb, err := restartClusterResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type ResultType string const ResultTypeError ResultType = `error` @@ -9329,63 +5436,36 @@ func (f *ResultType) Type() string { type Results struct { // The cause of the error - // Wire name: 'cause' Cause string `json:"cause,omitempty"` - // Wire name: 'data' Data any `json:"data,omitempty"` // The image filename - // Wire name: 'fileName' FileName string `json:"fileName,omitempty"` - // Wire name: 'fileNames' FileNames []string `json:"fileNames,omitempty"` // true if a JSON schema is returned instead of a string representation of // the Hive type. - // Wire name: 'isJsonSchema' IsJsonSchema bool `json:"isJsonSchema,omitempty"` // internal field used by SDK - // Wire name: 'pos' Pos int `json:"pos,omitempty"` - // Wire name: 'resultType' ResultType ResultType `json:"resultType,omitempty"` // The table schema - // Wire name: 'schema' Schema []map[string]any `json:"schema,omitempty"` // The summary of the error - // Wire name: 'summary' Summary string `json:"summary,omitempty"` // true if partial results are returned. - // Wire name: 'truncated' Truncated bool `json:"truncated,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *Results) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &resultsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := resultsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *Results) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st Results) MarshalJSON() ([]byte, error) { - pb, err := resultsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s Results) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type RuntimeEngine string @@ -9439,151 +5519,85 @@ type S3StorageInfo struct { // controls. If you are using cross account role for writing data, you may // want to set `bucket-owner-full-control` to make bucket owner able to read // the logs. - // Wire name: 'canned_acl' CannedAcl string `json:"canned_acl,omitempty"` // S3 destination, e.g. `s3://my-bucket/some-prefix` Note that logs will be // delivered using cluster iam role, please make sure you set cluster iam // role and the role has write access to the destination. Please also note // that you cannot use AWS keys to deliver logs. - // Wire name: 'destination' Destination string `json:"destination"` // (Optional) Flag to enable server side encryption, `false` by default. - // Wire name: 'enable_encryption' EnableEncryption bool `json:"enable_encryption,omitempty"` // (Optional) The encryption type, it could be `sse-s3` or `sse-kms`. It // will be used only when encryption is enabled and the default type is // `sse-s3`. - // Wire name: 'encryption_type' EncryptionType string `json:"encryption_type,omitempty"` // S3 endpoint, e.g. `https://s3-us-west-2.amazonaws.com`. Either region or // endpoint needs to be set. If both are set, endpoint will be used. - // Wire name: 'endpoint' Endpoint string `json:"endpoint,omitempty"` // (Optional) Kms key which will be used if encryption is enabled and // encryption type is set to `sse-kms`. - // Wire name: 'kms_key' KmsKey string `json:"kms_key,omitempty"` // S3 region, e.g. `us-west-2`. Either region or endpoint needs to be set. // If both are set, endpoint will be used. - // Wire name: 'region' Region string `json:"region,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *S3StorageInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &s3StorageInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := s3StorageInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *S3StorageInfo) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st S3StorageInfo) MarshalJSON() ([]byte, error) { - pb, err := s3StorageInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s S3StorageInfo) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Describes a specific Spark driver or executor. type SparkNode struct { // The private IP address of the host instance. - // Wire name: 'host_private_ip' HostPrivateIp string `json:"host_private_ip,omitempty"` // Globally unique identifier for the host instance from the cloud provider. - // Wire name: 'instance_id' InstanceId string `json:"instance_id,omitempty"` // Attributes specific to AWS for a Spark node. - // Wire name: 'node_aws_attributes' NodeAwsAttributes *SparkNodeAwsAttributes `json:"node_aws_attributes,omitempty"` // Globally unique identifier for this node. - // Wire name: 'node_id' NodeId string `json:"node_id,omitempty"` // Private IP address (typically a 10.x.x.x address) of the Spark node. Note // that this is different from the private IP address of the host instance. - // Wire name: 'private_ip' PrivateIp string `json:"private_ip,omitempty"` // Public DNS address of this node. This address can be used to access the // Spark JDBC server on the driver node. To communicate with the JDBC // server, traffic must be manually authorized by adding security group // rules to the "worker-unmanaged" security group via the AWS console. - // Wire name: 'public_dns' PublicDns string `json:"public_dns,omitempty"` // The timestamp (in millisecond) when the Spark node is launched. - // Wire name: 'start_timestamp' StartTimestamp int64 `json:"start_timestamp,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *SparkNode) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &sparkNodePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := sparkNodeFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *SparkNode) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st SparkNode) MarshalJSON() ([]byte, error) { - pb, err := sparkNodeToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s SparkNode) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Attributes specific to AWS for a Spark node. type SparkNodeAwsAttributes struct { // Whether this node is on an Amazon spot instance. - // Wire name: 'is_spot' IsSpot bool `json:"is_spot,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *SparkNodeAwsAttributes) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &sparkNodeAwsAttributesPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := sparkNodeAwsAttributesFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *SparkNodeAwsAttributes) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st SparkNodeAwsAttributes) MarshalJSON() ([]byte, error) { - pb, err := sparkNodeAwsAttributesToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s SparkNodeAwsAttributes) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type SparkVersion struct { @@ -9592,99 +5606,29 @@ type SparkVersion struct { // Note that the exact Spark version may change over time for a "wildcard" // version (i.e., "2.1.x-scala2.11" is a "wildcard" version) with minor bug // fixes. - // Wire name: 'key' Key string `json:"key,omitempty"` // A descriptive name for this Spark version, for example "Spark 2.1". - // Wire name: 'name' Name string `json:"name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *SparkVersion) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &sparkVersionPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := sparkVersionFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *SparkVersion) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st SparkVersion) MarshalJSON() ([]byte, error) { - pb, err := sparkVersionToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s SparkVersion) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type StartCluster struct { // The cluster to be started. - // Wire name: 'cluster_id' ClusterId string `json:"cluster_id"` } -func (st *StartCluster) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &startClusterPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := startClusterFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st StartCluster) MarshalJSON() ([]byte, error) { - pb, err := startClusterToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type StartClusterResponse struct { } -func (st *StartClusterResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &startClusterResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := startClusterResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st StartClusterResponse) MarshalJSON() ([]byte, error) { - pb, err := startClusterResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // The state of a Cluster. The current allowable state transitions are as // follows: // @@ -9749,42 +5693,14 @@ func (f *State) Type() string { type TerminationReason struct { // status code indicating why the cluster was terminated - // Wire name: 'code' Code TerminationReasonCode `json:"code,omitempty"` // list of parameters that provide additional information about why the // cluster was terminated - // Wire name: 'parameters' Parameters map[string]string `json:"parameters,omitempty"` // type of the termination - // Wire name: 'type' Type TerminationReasonType `json:"type,omitempty"` } -func (st *TerminationReason) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &terminationReasonPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := terminationReasonFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st TerminationReason) MarshalJSON() ([]byte, error) { - pb, err := terminationReasonToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // The status code indicating why the cluster was terminated type TerminationReasonCode string @@ -10379,131 +6295,25 @@ func (f *TerminationReasonType) Type() string { type UninstallLibraries struct { // Unique identifier for the cluster on which to uninstall these libraries. - // Wire name: 'cluster_id' ClusterId string `json:"cluster_id"` // The libraries to uninstall. - // Wire name: 'libraries' Libraries []Library `json:"libraries"` } -func (st *UninstallLibraries) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &uninstallLibrariesPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := uninstallLibrariesFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UninstallLibraries) MarshalJSON() ([]byte, error) { - pb, err := uninstallLibrariesToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type UninstallLibrariesResponse struct { } -func (st *UninstallLibrariesResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &uninstallLibrariesResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := uninstallLibrariesResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UninstallLibrariesResponse) MarshalJSON() ([]byte, error) { - pb, err := uninstallLibrariesResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type UnpinCluster struct { - - // Wire name: 'cluster_id' ClusterId string `json:"cluster_id"` } -func (st *UnpinCluster) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &unpinClusterPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := unpinClusterFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UnpinCluster) MarshalJSON() ([]byte, error) { - pb, err := unpinClusterToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type UnpinClusterResponse struct { } -func (st *UnpinClusterResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &unpinClusterResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := unpinClusterResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UnpinClusterResponse) MarshalJSON() ([]byte, error) { - pb, err := unpinClusterResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type UpdateCluster struct { // The cluster to be updated. - // Wire name: 'cluster' Cluster *UpdateClusterResource `json:"cluster,omitempty"` // ID of the cluster. - // Wire name: 'cluster_id' ClusterId string `json:"cluster_id"` // Used to specify which cluster attributes and size fields to update. See // https://google.aip.dev/161 for more details. @@ -10519,55 +6329,25 @@ type UpdateCluster struct { // always explicitly list the fields being updated and avoid using `*` // wildcards, as it can lead to unintended results if the API changes in the // future. - // Wire name: 'update_mask' UpdateMask string `json:"update_mask"` } -func (st *UpdateCluster) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateClusterPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateClusterFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateCluster) MarshalJSON() ([]byte, error) { - pb, err := updateClusterToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type UpdateClusterResource struct { // Parameters needed in order to automatically scale clusters up and down // based on load. Note: autoscaling works best with DB runtime versions 3.0 // or later. - // Wire name: 'autoscale' Autoscale *AutoScale `json:"autoscale,omitempty"` // Automatically terminates the cluster after it is inactive for this time // in minutes. If not set, this cluster will not be automatically // terminated. If specified, the threshold must be between 10 and 10000 // minutes. Users can also set this value to 0 to explicitly disable // automatic termination. - // Wire name: 'autotermination_minutes' AutoterminationMinutes int `json:"autotermination_minutes,omitempty"` // Attributes related to clusters running on Amazon Web Services. If not // specified at cluster creation, a set of default values will be used. - // Wire name: 'aws_attributes' AwsAttributes *AwsAttributes `json:"aws_attributes,omitempty"` // Attributes related to clusters running on Microsoft Azure. If not // specified at cluster creation, a set of default values will be used. - // Wire name: 'azure_attributes' AzureAttributes *AzureAttributes `json:"azure_attributes,omitempty"` // The configuration for delivering spark logs to a long-term storage // destination. Three kinds of destinations (DBFS, S3 and Unity Catalog @@ -10576,13 +6356,11 @@ type UpdateClusterResource struct { // destination every `5 mins`. The destination of driver logs is // `$destination/$clusterId/driver`, while the destination of executor logs // is `$destination/$clusterId/executor`. - // Wire name: 'cluster_log_conf' ClusterLogConf *ClusterLogConf `json:"cluster_log_conf,omitempty"` // Cluster name requested by the user. This doesn't have to be unique. If // not specified at creation, the cluster name will be an empty string. For // job clusters, the cluster name is automatically set based on the job and // job run IDs. - // Wire name: 'cluster_name' ClusterName string `json:"cluster_name,omitempty"` // Additional tags for cluster resources. Databricks will tag all cluster // resources (e.g., AWS instances and EBS volumes) with these tags in @@ -10592,7 +6370,6 @@ type UpdateClusterResource struct { // // - Clusters can only reuse cloud resources if the resources' tags are a // subset of the cluster tags - // Wire name: 'custom_tags' CustomTags map[string]string `json:"custom_tags,omitempty"` // Data security mode decides what data governance model to use when // accessing data from a cluster. @@ -10623,15 +6400,12 @@ type UpdateClusterResource struct { // `LEGACY_SINGLE_USER`: This mode is for users migrating from legacy // Passthrough on standard clusters. * `LEGACY_SINGLE_USER_STANDARD`: This // mode provides a way that doesn’t have UC nor passthrough enabled. - // Wire name: 'data_security_mode' DataSecurityMode DataSecurityMode `json:"data_security_mode,omitempty"` // Custom docker image BYOC - // Wire name: 'docker_image' DockerImage *DockerImage `json:"docker_image,omitempty"` // The optional ID of the instance pool for the driver of the cluster // belongs. The pool cluster uses the instance pool with id // (instance_pool_id) if the driver pool is not assigned. - // Wire name: 'driver_instance_pool_id' DriverInstancePoolId string `json:"driver_instance_pool_id,omitempty"` // The node type of the Spark driver. Note that this field is optional; if // unset, the driver node type will be set as the same value as @@ -10641,35 +6415,28 @@ type UpdateClusterResource struct { // virtual_cluster_size is set. If both driver_node_type_id, node_type_id, // and virtual_cluster_size are specified, driver_node_type_id and // node_type_id take precedence. - // Wire name: 'driver_node_type_id' DriverNodeTypeId string `json:"driver_node_type_id,omitempty"` // Autoscaling Local Storage: when enabled, this cluster will dynamically // acquire additional disk space when its Spark workers are running low on // disk space. This feature requires specific AWS permissions to function // correctly - refer to the User Guide for more details. - // Wire name: 'enable_elastic_disk' EnableElasticDisk bool `json:"enable_elastic_disk,omitempty"` // Whether to enable LUKS on cluster VMs' local disks - // Wire name: 'enable_local_disk_encryption' EnableLocalDiskEncryption bool `json:"enable_local_disk_encryption,omitempty"` // Attributes related to clusters running on Google Cloud Platform. If not // specified at cluster creation, a set of default values will be used. - // Wire name: 'gcp_attributes' GcpAttributes *GcpAttributes `json:"gcp_attributes,omitempty"` // The configuration for storing init scripts. Any number of destinations // can be specified. The scripts are executed sequentially in the order // provided. If `cluster_log_conf` is specified, init script logs are sent // to `//init_scripts`. - // Wire name: 'init_scripts' InitScripts []InitScriptInfo `json:"init_scripts,omitempty"` // The optional ID of the instance pool to which the cluster belongs. - // Wire name: 'instance_pool_id' InstancePoolId string `json:"instance_pool_id,omitempty"` // This field can only be used when `kind = CLASSIC_PREVIEW`. // // When set to true, Databricks will automatically set single node related // `custom_tags`, `spark_conf`, and `num_workers` - // Wire name: 'is_single_node' IsSingleNode bool `json:"is_single_node,omitempty"` // The kind of compute described by this compute specification. // @@ -10688,14 +6455,12 @@ type UpdateClusterResource struct { // CLASSIC_PREVIEW`. // // [simple form]: https://docs.databricks.com/compute/simple-form.html - // Wire name: 'kind' Kind Kind `json:"kind,omitempty"` // This field encodes, through a single value, the resources available to // each of the Spark nodes in this cluster. For example, the Spark nodes can // be provisioned and optimized for memory or compute intensive workloads. A // list of available node types can be retrieved by using the // :method:clusters/listNodeTypes API call. - // Wire name: 'node_type_id' NodeTypeId string `json:"node_type_id,omitempty"` // Number of worker nodes that this cluster should have. A cluster has one // Spark Driver and `num_workers` Executors for a total of `num_workers` + 1 @@ -10707,14 +6472,11 @@ type UpdateClusterResource struct { // field will immediately be updated to reflect the target size of 10 // workers, whereas the workers listed in `spark_info` will gradually // increase from 5 to 10 as the new nodes are provisioned. - // Wire name: 'num_workers' NumWorkers int `json:"num_workers,omitempty"` // The ID of the cluster policy used to create the cluster if applicable. - // Wire name: 'policy_id' PolicyId string `json:"policy_id,omitempty"` // If set, what the configurable throughput (in Mb/s) for the remote disk // is. Currently only supported for GCP HYPERDISK_BALANCED disks. - // Wire name: 'remote_disk_throughput' RemoteDiskThroughput int `json:"remote_disk_throughput,omitempty"` // Determines the cluster's runtime engine, either standard or Photon. // @@ -10724,17 +6486,14 @@ type UpdateClusterResource struct { // // If left unspecified, the runtime engine defaults to standard unless the // spark_version contains -photon-, in which case Photon will be used. - // Wire name: 'runtime_engine' RuntimeEngine RuntimeEngine `json:"runtime_engine,omitempty"` // Single user name if data_security_mode is `SINGLE_USER` - // Wire name: 'single_user_name' SingleUserName string `json:"single_user_name,omitempty"` // An object containing a set of optional, user-specified Spark // configuration key-value pairs. Users can also pass in a string of extra // JVM options to the driver and the executors via // `spark.driver.extraJavaOptions` and `spark.executor.extraJavaOptions` // respectively. - // Wire name: 'spark_conf' SparkConf map[string]string `json:"spark_conf,omitempty"` // An object containing a set of optional, user-specified environment // variable key-value pairs. Please note that key-value pair of the form @@ -10749,211 +6508,60 @@ type UpdateClusterResource struct { // Example Spark environment variables: `{"SPARK_WORKER_MEMORY": "28000m", // "SPARK_LOCAL_DIRS": "/local_disk0"}` or `{"SPARK_DAEMON_JAVA_OPTS": // "$SPARK_DAEMON_JAVA_OPTS -Dspark.shuffle.service.enabled=true"}` - // Wire name: 'spark_env_vars' SparkEnvVars map[string]string `json:"spark_env_vars,omitempty"` // The Spark version of the cluster, e.g. `3.3.x-scala2.11`. A list of // available Spark versions can be retrieved by using the // :method:clusters/sparkVersions API call. - // Wire name: 'spark_version' SparkVersion string `json:"spark_version,omitempty"` // SSH public key contents that will be added to each Spark node in this // cluster. The corresponding private keys can be used to login with the // user name `ubuntu` on port `2200`. Up to 10 keys can be specified. - // Wire name: 'ssh_public_keys' SshPublicKeys []string `json:"ssh_public_keys,omitempty"` // If set, what the total initial volume size (in GB) of the remote disks // should be. Currently only supported for GCP HYPERDISK_BALANCED disks. - // Wire name: 'total_initial_remote_disk_size' TotalInitialRemoteDiskSize int `json:"total_initial_remote_disk_size,omitempty"` // This field can only be used when `kind = CLASSIC_PREVIEW`. // // `effective_spark_version` is determined by `spark_version` (DBR release), // this field `use_ml_runtime`, and whether `node_type_id` is gpu node or // not. - // Wire name: 'use_ml_runtime' UseMlRuntime bool `json:"use_ml_runtime,omitempty"` // Cluster Attributes showing for clusters workload types. - // Wire name: 'workload_type' WorkloadType *WorkloadType `json:"workload_type,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *UpdateClusterResource) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateClusterResourcePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateClusterResourceFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *UpdateClusterResource) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st UpdateClusterResource) MarshalJSON() ([]byte, error) { - pb, err := updateClusterResourceToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s UpdateClusterResource) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type UpdateClusterResponse struct { } -func (st *UpdateClusterResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateClusterResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateClusterResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateClusterResponse) MarshalJSON() ([]byte, error) { - pb, err := updateClusterResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type UpdateResponse struct { } -func (st *UpdateResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateResponse) MarshalJSON() ([]byte, error) { - pb, err := updateResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // A storage location back by UC Volumes. type VolumesStorageInfo struct { // UC Volumes destination, e.g. // `/Volumes/catalog/schema/vol1/init-scripts/setup-datadog.sh` or // `dbfs:/Volumes/catalog/schema/vol1/init-scripts/setup-datadog.sh` - // Wire name: 'destination' Destination string `json:"destination"` } -func (st *VolumesStorageInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &volumesStorageInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := volumesStorageInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st VolumesStorageInfo) MarshalJSON() ([]byte, error) { - pb, err := volumesStorageInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Cluster Attributes showing for clusters workload types. type WorkloadType struct { // defined what type of clients can use the cluster. E.g. Notebooks, Jobs - // Wire name: 'clients' Clients ClientsTypes `json:"clients"` } -func (st *WorkloadType) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &workloadTypePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := workloadTypeFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st WorkloadType) MarshalJSON() ([]byte, error) { - pb, err := workloadTypeToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // A storage location in Workspace Filesystem (WSFS) type WorkspaceStorageInfo struct { // wsfs destination, e.g. `workspace:/cluster-init-scripts/setup-datadog.sh` - // Wire name: 'destination' Destination string `json:"destination"` } - -func (st *WorkspaceStorageInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &workspaceStorageInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := workspaceStorageInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st WorkspaceStorageInfo) MarshalJSON() ([]byte, error) { - pb, err := workspaceStorageInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} diff --git a/service/dashboards/impl.go b/service/dashboards/impl.go index bb61f6e0d..27dfa1d97 100755 --- a/service/dashboards/impl.go +++ b/service/dashboards/impl.go @@ -18,389 +18,125 @@ type genieImpl struct { } func (a *genieImpl) CreateMessage(ctx context.Context, request GenieCreateConversationMessageRequest) (*GenieMessage, error) { - - requestPb, pbErr := genieCreateConversationMessageRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var genieMessagePb genieMessagePb - path := fmt.Sprintf("/api/2.0/genie/spaces/%v/conversations/%v/messages", requestPb.SpaceId, requestPb.ConversationId) + var genieMessage GenieMessage + path := fmt.Sprintf("/api/2.0/genie/spaces/%v/conversations/%v/messages", request.SpaceId, request.ConversationId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &genieMessagePb, - ) - if err != nil { - return nil, err - } - resp, err := genieMessageFromPb(&genieMessagePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &genieMessage) + return &genieMessage, err } func (a *genieImpl) ExecuteMessageAttachmentQuery(ctx context.Context, request GenieExecuteMessageAttachmentQueryRequest) (*GenieGetMessageQueryResultResponse, error) { - - requestPb, pbErr := genieExecuteMessageAttachmentQueryRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var genieGetMessageQueryResultResponsePb genieGetMessageQueryResultResponsePb - path := fmt.Sprintf("/api/2.0/genie/spaces/%v/conversations/%v/messages/%v/attachments/%v/execute-query", requestPb.SpaceId, requestPb.ConversationId, requestPb.MessageId, requestPb.AttachmentId) + var genieGetMessageQueryResultResponse GenieGetMessageQueryResultResponse + path := fmt.Sprintf("/api/2.0/genie/spaces/%v/conversations/%v/messages/%v/attachments/%v/execute-query", request.SpaceId, request.ConversationId, request.MessageId, request.AttachmentId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - nil, - &genieGetMessageQueryResultResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := genieGetMessageQueryResultResponseFromPb(&genieGetMessageQueryResultResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, nil, &genieGetMessageQueryResultResponse) + return &genieGetMessageQueryResultResponse, err } func (a *genieImpl) ExecuteMessageQuery(ctx context.Context, request GenieExecuteMessageQueryRequest) (*GenieGetMessageQueryResultResponse, error) { - - requestPb, pbErr := genieExecuteMessageQueryRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var genieGetMessageQueryResultResponsePb genieGetMessageQueryResultResponsePb - path := fmt.Sprintf("/api/2.0/genie/spaces/%v/conversations/%v/messages/%v/execute-query", requestPb.SpaceId, requestPb.ConversationId, requestPb.MessageId) + var genieGetMessageQueryResultResponse GenieGetMessageQueryResultResponse + path := fmt.Sprintf("/api/2.0/genie/spaces/%v/conversations/%v/messages/%v/execute-query", request.SpaceId, request.ConversationId, request.MessageId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - nil, - &genieGetMessageQueryResultResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := genieGetMessageQueryResultResponseFromPb(&genieGetMessageQueryResultResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, nil, &genieGetMessageQueryResultResponse) + return &genieGetMessageQueryResultResponse, err } func (a *genieImpl) GenerateDownloadFullQueryResult(ctx context.Context, request GenieGenerateDownloadFullQueryResultRequest) (*GenieGenerateDownloadFullQueryResultResponse, error) { - - requestPb, pbErr := genieGenerateDownloadFullQueryResultRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var genieGenerateDownloadFullQueryResultResponsePb genieGenerateDownloadFullQueryResultResponsePb - path := fmt.Sprintf("/api/2.0/genie/spaces/%v/conversations/%v/messages/%v/attachments/%v/downloads", requestPb.SpaceId, requestPb.ConversationId, requestPb.MessageId, requestPb.AttachmentId) + var genieGenerateDownloadFullQueryResultResponse GenieGenerateDownloadFullQueryResultResponse + path := fmt.Sprintf("/api/2.0/genie/spaces/%v/conversations/%v/messages/%v/attachments/%v/downloads", request.SpaceId, request.ConversationId, request.MessageId, request.AttachmentId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - nil, - &genieGenerateDownloadFullQueryResultResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := genieGenerateDownloadFullQueryResultResponseFromPb(&genieGenerateDownloadFullQueryResultResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, nil, &genieGenerateDownloadFullQueryResultResponse) + return &genieGenerateDownloadFullQueryResultResponse, err } func (a *genieImpl) GetDownloadFullQueryResult(ctx context.Context, request GenieGetDownloadFullQueryResultRequest) (*GenieGetDownloadFullQueryResultResponse, error) { - - requestPb, pbErr := genieGetDownloadFullQueryResultRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var genieGetDownloadFullQueryResultResponsePb genieGetDownloadFullQueryResultResponsePb - path := fmt.Sprintf("/api/2.0/genie/spaces/%v/conversations/%v/messages/%v/attachments/%v/downloads/%v", requestPb.SpaceId, requestPb.ConversationId, requestPb.MessageId, requestPb.AttachmentId, requestPb.DownloadId) + var genieGetDownloadFullQueryResultResponse GenieGetDownloadFullQueryResultResponse + path := fmt.Sprintf("/api/2.0/genie/spaces/%v/conversations/%v/messages/%v/attachments/%v/downloads/%v", request.SpaceId, request.ConversationId, request.MessageId, request.AttachmentId, request.DownloadId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &genieGetDownloadFullQueryResultResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := genieGetDownloadFullQueryResultResponseFromPb(&genieGetDownloadFullQueryResultResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &genieGetDownloadFullQueryResultResponse) + return &genieGetDownloadFullQueryResultResponse, err } func (a *genieImpl) GetMessage(ctx context.Context, request GenieGetConversationMessageRequest) (*GenieMessage, error) { - - requestPb, pbErr := genieGetConversationMessageRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var genieMessagePb genieMessagePb - path := fmt.Sprintf("/api/2.0/genie/spaces/%v/conversations/%v/messages/%v", requestPb.SpaceId, requestPb.ConversationId, requestPb.MessageId) + var genieMessage GenieMessage + path := fmt.Sprintf("/api/2.0/genie/spaces/%v/conversations/%v/messages/%v", request.SpaceId, request.ConversationId, request.MessageId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &genieMessagePb, - ) - if err != nil { - return nil, err - } - resp, err := genieMessageFromPb(&genieMessagePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &genieMessage) + return &genieMessage, err } func (a *genieImpl) GetMessageAttachmentQueryResult(ctx context.Context, request GenieGetMessageAttachmentQueryResultRequest) (*GenieGetMessageQueryResultResponse, error) { - - requestPb, pbErr := genieGetMessageAttachmentQueryResultRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var genieGetMessageQueryResultResponsePb genieGetMessageQueryResultResponsePb - path := fmt.Sprintf("/api/2.0/genie/spaces/%v/conversations/%v/messages/%v/attachments/%v/query-result", requestPb.SpaceId, requestPb.ConversationId, requestPb.MessageId, requestPb.AttachmentId) + var genieGetMessageQueryResultResponse GenieGetMessageQueryResultResponse + path := fmt.Sprintf("/api/2.0/genie/spaces/%v/conversations/%v/messages/%v/attachments/%v/query-result", request.SpaceId, request.ConversationId, request.MessageId, request.AttachmentId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &genieGetMessageQueryResultResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := genieGetMessageQueryResultResponseFromPb(&genieGetMessageQueryResultResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &genieGetMessageQueryResultResponse) + return &genieGetMessageQueryResultResponse, err } func (a *genieImpl) GetMessageQueryResult(ctx context.Context, request GenieGetMessageQueryResultRequest) (*GenieGetMessageQueryResultResponse, error) { - - requestPb, pbErr := genieGetMessageQueryResultRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var genieGetMessageQueryResultResponsePb genieGetMessageQueryResultResponsePb - path := fmt.Sprintf("/api/2.0/genie/spaces/%v/conversations/%v/messages/%v/query-result", requestPb.SpaceId, requestPb.ConversationId, requestPb.MessageId) + var genieGetMessageQueryResultResponse GenieGetMessageQueryResultResponse + path := fmt.Sprintf("/api/2.0/genie/spaces/%v/conversations/%v/messages/%v/query-result", request.SpaceId, request.ConversationId, request.MessageId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &genieGetMessageQueryResultResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := genieGetMessageQueryResultResponseFromPb(&genieGetMessageQueryResultResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &genieGetMessageQueryResultResponse) + return &genieGetMessageQueryResultResponse, err } func (a *genieImpl) GetMessageQueryResultByAttachment(ctx context.Context, request GenieGetQueryResultByAttachmentRequest) (*GenieGetMessageQueryResultResponse, error) { - - requestPb, pbErr := genieGetQueryResultByAttachmentRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var genieGetMessageQueryResultResponsePb genieGetMessageQueryResultResponsePb - path := fmt.Sprintf("/api/2.0/genie/spaces/%v/conversations/%v/messages/%v/query-result/%v", requestPb.SpaceId, requestPb.ConversationId, requestPb.MessageId, requestPb.AttachmentId) + var genieGetMessageQueryResultResponse GenieGetMessageQueryResultResponse + path := fmt.Sprintf("/api/2.0/genie/spaces/%v/conversations/%v/messages/%v/query-result/%v", request.SpaceId, request.ConversationId, request.MessageId, request.AttachmentId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &genieGetMessageQueryResultResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := genieGetMessageQueryResultResponseFromPb(&genieGetMessageQueryResultResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &genieGetMessageQueryResultResponse) + return &genieGetMessageQueryResultResponse, err } func (a *genieImpl) GetSpace(ctx context.Context, request GenieGetSpaceRequest) (*GenieSpace, error) { - - requestPb, pbErr := genieGetSpaceRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var genieSpacePb genieSpacePb - path := fmt.Sprintf("/api/2.0/genie/spaces/%v", requestPb.SpaceId) + var genieSpace GenieSpace + path := fmt.Sprintf("/api/2.0/genie/spaces/%v", request.SpaceId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &genieSpacePb, - ) - if err != nil { - return nil, err - } - resp, err := genieSpaceFromPb(&genieSpacePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &genieSpace) + return &genieSpace, err } func (a *genieImpl) ListSpaces(ctx context.Context, request GenieListSpacesRequest) (*GenieListSpacesResponse, error) { - - requestPb, pbErr := genieListSpacesRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var genieListSpacesResponsePb genieListSpacesResponsePb + var genieListSpacesResponse GenieListSpacesResponse path := "/api/2.0/genie/spaces" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &genieListSpacesResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := genieListSpacesResponseFromPb(&genieListSpacesResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &genieListSpacesResponse) + return &genieListSpacesResponse, err } func (a *genieImpl) StartConversation(ctx context.Context, request GenieStartConversationMessageRequest) (*GenieStartConversationResponse, error) { - - requestPb, pbErr := genieStartConversationMessageRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var genieStartConversationResponsePb genieStartConversationResponsePb - path := fmt.Sprintf("/api/2.0/genie/spaces/%v/start-conversation", requestPb.SpaceId) + var genieStartConversationResponse GenieStartConversationResponse + path := fmt.Sprintf("/api/2.0/genie/spaces/%v/start-conversation", request.SpaceId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &genieStartConversationResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := genieStartConversationResponseFromPb(&genieStartConversationResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &genieStartConversationResponse) + return &genieStartConversationResponse, err } // unexported type that holds implementations of just Lakeview API methods @@ -409,286 +145,96 @@ type lakeviewImpl struct { } func (a *lakeviewImpl) Create(ctx context.Context, request CreateDashboardRequest) (*Dashboard, error) { - - requestPb, pbErr := createDashboardRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var dashboardPb dashboardPb + var dashboard Dashboard path := "/api/2.0/lakeview/dashboards" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb).Dashboard, - &dashboardPb, - ) - if err != nil { - return nil, err - } - resp, err := dashboardFromPb(&dashboardPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.Dashboard, &dashboard) + return &dashboard, err } func (a *lakeviewImpl) CreateSchedule(ctx context.Context, request CreateScheduleRequest) (*Schedule, error) { - - requestPb, pbErr := createScheduleRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var schedulePb schedulePb - path := fmt.Sprintf("/api/2.0/lakeview/dashboards/%v/schedules", requestPb.DashboardId) + var schedule Schedule + path := fmt.Sprintf("/api/2.0/lakeview/dashboards/%v/schedules", request.DashboardId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb).Schedule, - &schedulePb, - ) - if err != nil { - return nil, err - } - resp, err := scheduleFromPb(&schedulePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.Schedule, &schedule) + return &schedule, err } func (a *lakeviewImpl) CreateSubscription(ctx context.Context, request CreateSubscriptionRequest) (*Subscription, error) { - - requestPb, pbErr := createSubscriptionRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var subscriptionPb subscriptionPb - path := fmt.Sprintf("/api/2.0/lakeview/dashboards/%v/schedules/%v/subscriptions", requestPb.DashboardId, requestPb.ScheduleId) + var subscription Subscription + path := fmt.Sprintf("/api/2.0/lakeview/dashboards/%v/schedules/%v/subscriptions", request.DashboardId, request.ScheduleId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb).Subscription, - &subscriptionPb, - ) - if err != nil { - return nil, err - } - resp, err := subscriptionFromPb(&subscriptionPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.Subscription, &subscription) + return &subscription, err } func (a *lakeviewImpl) DeleteSchedule(ctx context.Context, request DeleteScheduleRequest) error { - - requestPb, pbErr := deleteScheduleRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteScheduleResponsePb deleteScheduleResponsePb - path := fmt.Sprintf("/api/2.0/lakeview/dashboards/%v/schedules/%v", requestPb.DashboardId, requestPb.ScheduleId) + var deleteScheduleResponse DeleteScheduleResponse + path := fmt.Sprintf("/api/2.0/lakeview/dashboards/%v/schedules/%v", request.DashboardId, request.ScheduleId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteScheduleResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteScheduleResponse) return err } func (a *lakeviewImpl) DeleteSubscription(ctx context.Context, request DeleteSubscriptionRequest) error { - - requestPb, pbErr := deleteSubscriptionRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteSubscriptionResponsePb deleteSubscriptionResponsePb - path := fmt.Sprintf("/api/2.0/lakeview/dashboards/%v/schedules/%v/subscriptions/%v", requestPb.DashboardId, requestPb.ScheduleId, requestPb.SubscriptionId) + var deleteSubscriptionResponse DeleteSubscriptionResponse + path := fmt.Sprintf("/api/2.0/lakeview/dashboards/%v/schedules/%v/subscriptions/%v", request.DashboardId, request.ScheduleId, request.SubscriptionId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteSubscriptionResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteSubscriptionResponse) return err } func (a *lakeviewImpl) Get(ctx context.Context, request GetDashboardRequest) (*Dashboard, error) { - - requestPb, pbErr := getDashboardRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var dashboardPb dashboardPb - path := fmt.Sprintf("/api/2.0/lakeview/dashboards/%v", requestPb.DashboardId) + var dashboard Dashboard + path := fmt.Sprintf("/api/2.0/lakeview/dashboards/%v", request.DashboardId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &dashboardPb, - ) - if err != nil { - return nil, err - } - resp, err := dashboardFromPb(&dashboardPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &dashboard) + return &dashboard, err } func (a *lakeviewImpl) GetPublished(ctx context.Context, request GetPublishedDashboardRequest) (*PublishedDashboard, error) { - - requestPb, pbErr := getPublishedDashboardRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var publishedDashboardPb publishedDashboardPb - path := fmt.Sprintf("/api/2.0/lakeview/dashboards/%v/published", requestPb.DashboardId) + var publishedDashboard PublishedDashboard + path := fmt.Sprintf("/api/2.0/lakeview/dashboards/%v/published", request.DashboardId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &publishedDashboardPb, - ) - if err != nil { - return nil, err - } - resp, err := publishedDashboardFromPb(&publishedDashboardPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &publishedDashboard) + return &publishedDashboard, err } func (a *lakeviewImpl) GetSchedule(ctx context.Context, request GetScheduleRequest) (*Schedule, error) { - - requestPb, pbErr := getScheduleRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var schedulePb schedulePb - path := fmt.Sprintf("/api/2.0/lakeview/dashboards/%v/schedules/%v", requestPb.DashboardId, requestPb.ScheduleId) + var schedule Schedule + path := fmt.Sprintf("/api/2.0/lakeview/dashboards/%v/schedules/%v", request.DashboardId, request.ScheduleId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &schedulePb, - ) - if err != nil { - return nil, err - } - resp, err := scheduleFromPb(&schedulePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &schedule) + return &schedule, err } func (a *lakeviewImpl) GetSubscription(ctx context.Context, request GetSubscriptionRequest) (*Subscription, error) { - - requestPb, pbErr := getSubscriptionRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var subscriptionPb subscriptionPb - path := fmt.Sprintf("/api/2.0/lakeview/dashboards/%v/schedules/%v/subscriptions/%v", requestPb.DashboardId, requestPb.ScheduleId, requestPb.SubscriptionId) + var subscription Subscription + path := fmt.Sprintf("/api/2.0/lakeview/dashboards/%v/schedules/%v/subscriptions/%v", request.DashboardId, request.ScheduleId, request.SubscriptionId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &subscriptionPb, - ) - if err != nil { - return nil, err - } - resp, err := subscriptionFromPb(&subscriptionPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &subscription) + return &subscription, err } // List dashboards. @@ -723,35 +269,13 @@ func (a *lakeviewImpl) ListAll(ctx context.Context, request ListDashboardsReques } func (a *lakeviewImpl) internalList(ctx context.Context, request ListDashboardsRequest) (*ListDashboardsResponse, error) { - - requestPb, pbErr := listDashboardsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listDashboardsResponsePb listDashboardsResponsePb + var listDashboardsResponse ListDashboardsResponse path := "/api/2.0/lakeview/dashboards" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listDashboardsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listDashboardsResponseFromPb(&listDashboardsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listDashboardsResponse) + return &listDashboardsResponse, err } // List dashboard schedules. @@ -786,35 +310,13 @@ func (a *lakeviewImpl) ListSchedulesAll(ctx context.Context, request ListSchedul } func (a *lakeviewImpl) internalListSchedules(ctx context.Context, request ListSchedulesRequest) (*ListSchedulesResponse, error) { - - requestPb, pbErr := listSchedulesRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listSchedulesResponsePb listSchedulesResponsePb - path := fmt.Sprintf("/api/2.0/lakeview/dashboards/%v/schedules", requestPb.DashboardId) + var listSchedulesResponse ListSchedulesResponse + path := fmt.Sprintf("/api/2.0/lakeview/dashboards/%v/schedules", request.DashboardId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listSchedulesResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listSchedulesResponseFromPb(&listSchedulesResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listSchedulesResponse) + return &listSchedulesResponse, err } // List schedule subscriptions. @@ -849,223 +351,77 @@ func (a *lakeviewImpl) ListSubscriptionsAll(ctx context.Context, request ListSub } func (a *lakeviewImpl) internalListSubscriptions(ctx context.Context, request ListSubscriptionsRequest) (*ListSubscriptionsResponse, error) { - - requestPb, pbErr := listSubscriptionsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listSubscriptionsResponsePb listSubscriptionsResponsePb - path := fmt.Sprintf("/api/2.0/lakeview/dashboards/%v/schedules/%v/subscriptions", requestPb.DashboardId, requestPb.ScheduleId) + var listSubscriptionsResponse ListSubscriptionsResponse + path := fmt.Sprintf("/api/2.0/lakeview/dashboards/%v/schedules/%v/subscriptions", request.DashboardId, request.ScheduleId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listSubscriptionsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listSubscriptionsResponseFromPb(&listSubscriptionsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listSubscriptionsResponse) + return &listSubscriptionsResponse, err } func (a *lakeviewImpl) Migrate(ctx context.Context, request MigrateDashboardRequest) (*Dashboard, error) { - - requestPb, pbErr := migrateDashboardRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var dashboardPb dashboardPb + var dashboard Dashboard path := "/api/2.0/lakeview/dashboards/migrate" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &dashboardPb, - ) - if err != nil { - return nil, err - } - resp, err := dashboardFromPb(&dashboardPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &dashboard) + return &dashboard, err } func (a *lakeviewImpl) Publish(ctx context.Context, request PublishRequest) (*PublishedDashboard, error) { - - requestPb, pbErr := publishRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var publishedDashboardPb publishedDashboardPb - path := fmt.Sprintf("/api/2.0/lakeview/dashboards/%v/published", requestPb.DashboardId) + var publishedDashboard PublishedDashboard + path := fmt.Sprintf("/api/2.0/lakeview/dashboards/%v/published", request.DashboardId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &publishedDashboardPb, - ) - if err != nil { - return nil, err - } - resp, err := publishedDashboardFromPb(&publishedDashboardPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &publishedDashboard) + return &publishedDashboard, err } func (a *lakeviewImpl) Trash(ctx context.Context, request TrashDashboardRequest) error { - - requestPb, pbErr := trashDashboardRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var trashDashboardResponsePb trashDashboardResponsePb - path := fmt.Sprintf("/api/2.0/lakeview/dashboards/%v", requestPb.DashboardId) + var trashDashboardResponse TrashDashboardResponse + path := fmt.Sprintf("/api/2.0/lakeview/dashboards/%v", request.DashboardId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &trashDashboardResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &trashDashboardResponse) return err } func (a *lakeviewImpl) Unpublish(ctx context.Context, request UnpublishDashboardRequest) error { - - requestPb, pbErr := unpublishDashboardRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var unpublishDashboardResponsePb unpublishDashboardResponsePb - path := fmt.Sprintf("/api/2.0/lakeview/dashboards/%v/published", requestPb.DashboardId) + var unpublishDashboardResponse UnpublishDashboardResponse + path := fmt.Sprintf("/api/2.0/lakeview/dashboards/%v/published", request.DashboardId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &unpublishDashboardResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &unpublishDashboardResponse) return err } func (a *lakeviewImpl) Update(ctx context.Context, request UpdateDashboardRequest) (*Dashboard, error) { - - requestPb, pbErr := updateDashboardRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var dashboardPb dashboardPb - path := fmt.Sprintf("/api/2.0/lakeview/dashboards/%v", requestPb.DashboardId) + var dashboard Dashboard + path := fmt.Sprintf("/api/2.0/lakeview/dashboards/%v", request.DashboardId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb).Dashboard, - &dashboardPb, - ) - if err != nil { - return nil, err - } - resp, err := dashboardFromPb(&dashboardPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.Dashboard, &dashboard) + return &dashboard, err } func (a *lakeviewImpl) UpdateSchedule(ctx context.Context, request UpdateScheduleRequest) (*Schedule, error) { - - requestPb, pbErr := updateScheduleRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var schedulePb schedulePb - path := fmt.Sprintf("/api/2.0/lakeview/dashboards/%v/schedules/%v", requestPb.DashboardId, requestPb.ScheduleId) + var schedule Schedule + path := fmt.Sprintf("/api/2.0/lakeview/dashboards/%v/schedules/%v", request.DashboardId, request.ScheduleId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPut, - path, - headers, - queryParams, - (*requestPb).Schedule, - &schedulePb, - ) - if err != nil { - return nil, err - } - resp, err := scheduleFromPb(&schedulePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request.Schedule, &schedule) + return &schedule, err } // unexported type that holds implementations of just LakeviewEmbedded API methods @@ -1074,33 +430,11 @@ type lakeviewEmbeddedImpl struct { } func (a *lakeviewEmbeddedImpl) GetPublishedDashboardTokenInfo(ctx context.Context, request GetPublishedDashboardTokenInfoRequest) (*GetPublishedDashboardTokenInfoResponse, error) { - - requestPb, pbErr := getPublishedDashboardTokenInfoRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var getPublishedDashboardTokenInfoResponsePb getPublishedDashboardTokenInfoResponsePb - path := fmt.Sprintf("/api/2.0/lakeview/dashboards/%v/published/tokeninfo", requestPb.DashboardId) + var getPublishedDashboardTokenInfoResponse GetPublishedDashboardTokenInfoResponse + path := fmt.Sprintf("/api/2.0/lakeview/dashboards/%v/published/tokeninfo", request.DashboardId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &getPublishedDashboardTokenInfoResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := getPublishedDashboardTokenInfoResponseFromPb(&getPublishedDashboardTokenInfoResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getPublishedDashboardTokenInfoResponse) + return &getPublishedDashboardTokenInfoResponse, err } diff --git a/service/dashboards/internal.go b/service/dashboards/internal.go deleted file mode 100755 index d9593a466..000000000 --- a/service/dashboards/internal.go +++ /dev/null @@ -1,2310 +0,0 @@ -// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. - -package dashboards - -import ( - "fmt" - "strings" - "time" - - "github.com/databricks/databricks-sdk-go/marshal" - "github.com/databricks/databricks-sdk-go/service/sql" -) - -func authorizationDetailsToPb(st *AuthorizationDetails) (*authorizationDetailsPb, error) { - if st == nil { - return nil, nil - } - pb := &authorizationDetailsPb{} - pb.GrantRules = st.GrantRules - pb.ResourceLegacyAclPath = st.ResourceLegacyAclPath - pb.ResourceName = st.ResourceName - pb.Type = st.Type - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type authorizationDetailsPb struct { - GrantRules []AuthorizationDetailsGrantRule `json:"grant_rules,omitempty"` - ResourceLegacyAclPath string `json:"resource_legacy_acl_path,omitempty"` - ResourceName string `json:"resource_name,omitempty"` - Type string `json:"type,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func authorizationDetailsFromPb(pb *authorizationDetailsPb) (*AuthorizationDetails, error) { - if pb == nil { - return nil, nil - } - st := &AuthorizationDetails{} - st.GrantRules = pb.GrantRules - st.ResourceLegacyAclPath = pb.ResourceLegacyAclPath - st.ResourceName = pb.ResourceName - st.Type = pb.Type - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *authorizationDetailsPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st authorizationDetailsPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func authorizationDetailsGrantRuleToPb(st *AuthorizationDetailsGrantRule) (*authorizationDetailsGrantRulePb, error) { - if st == nil { - return nil, nil - } - pb := &authorizationDetailsGrantRulePb{} - pb.PermissionSet = st.PermissionSet - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type authorizationDetailsGrantRulePb struct { - PermissionSet string `json:"permission_set,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func authorizationDetailsGrantRuleFromPb(pb *authorizationDetailsGrantRulePb) (*AuthorizationDetailsGrantRule, error) { - if pb == nil { - return nil, nil - } - st := &AuthorizationDetailsGrantRule{} - st.PermissionSet = pb.PermissionSet - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *authorizationDetailsGrantRulePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st authorizationDetailsGrantRulePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createDashboardRequestToPb(st *CreateDashboardRequest) (*createDashboardRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &createDashboardRequestPb{} - pb.Dashboard = st.Dashboard - - return pb, nil -} - -type createDashboardRequestPb struct { - Dashboard Dashboard `json:"dashboard"` -} - -func createDashboardRequestFromPb(pb *createDashboardRequestPb) (*CreateDashboardRequest, error) { - if pb == nil { - return nil, nil - } - st := &CreateDashboardRequest{} - st.Dashboard = pb.Dashboard - - return st, nil -} - -func createScheduleRequestToPb(st *CreateScheduleRequest) (*createScheduleRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &createScheduleRequestPb{} - pb.DashboardId = st.DashboardId - pb.Schedule = st.Schedule - - return pb, nil -} - -type createScheduleRequestPb struct { - DashboardId string `json:"-" url:"-"` - Schedule Schedule `json:"schedule"` -} - -func createScheduleRequestFromPb(pb *createScheduleRequestPb) (*CreateScheduleRequest, error) { - if pb == nil { - return nil, nil - } - st := &CreateScheduleRequest{} - st.DashboardId = pb.DashboardId - st.Schedule = pb.Schedule - - return st, nil -} - -func createSubscriptionRequestToPb(st *CreateSubscriptionRequest) (*createSubscriptionRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &createSubscriptionRequestPb{} - pb.DashboardId = st.DashboardId - pb.ScheduleId = st.ScheduleId - pb.Subscription = st.Subscription - - return pb, nil -} - -type createSubscriptionRequestPb struct { - DashboardId string `json:"-" url:"-"` - ScheduleId string `json:"-" url:"-"` - Subscription Subscription `json:"subscription"` -} - -func createSubscriptionRequestFromPb(pb *createSubscriptionRequestPb) (*CreateSubscriptionRequest, error) { - if pb == nil { - return nil, nil - } - st := &CreateSubscriptionRequest{} - st.DashboardId = pb.DashboardId - st.ScheduleId = pb.ScheduleId - st.Subscription = pb.Subscription - - return st, nil -} - -func cronScheduleToPb(st *CronSchedule) (*cronSchedulePb, error) { - if st == nil { - return nil, nil - } - pb := &cronSchedulePb{} - pb.QuartzCronExpression = st.QuartzCronExpression - pb.TimezoneId = st.TimezoneId - - return pb, nil -} - -type cronSchedulePb struct { - QuartzCronExpression string `json:"quartz_cron_expression"` - TimezoneId string `json:"timezone_id"` -} - -func cronScheduleFromPb(pb *cronSchedulePb) (*CronSchedule, error) { - if pb == nil { - return nil, nil - } - st := &CronSchedule{} - st.QuartzCronExpression = pb.QuartzCronExpression - st.TimezoneId = pb.TimezoneId - - return st, nil -} - -func dashboardToPb(st *Dashboard) (*dashboardPb, error) { - if st == nil { - return nil, nil - } - pb := &dashboardPb{} - pb.CreateTime = st.CreateTime - pb.DashboardId = st.DashboardId - pb.DisplayName = st.DisplayName - pb.Etag = st.Etag - pb.LifecycleState = st.LifecycleState - pb.ParentPath = st.ParentPath - pb.Path = st.Path - pb.SerializedDashboard = st.SerializedDashboard - pb.UpdateTime = st.UpdateTime - pb.WarehouseId = st.WarehouseId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type dashboardPb struct { - CreateTime string `json:"create_time,omitempty"` - DashboardId string `json:"dashboard_id,omitempty"` - DisplayName string `json:"display_name,omitempty"` - Etag string `json:"etag,omitempty"` - LifecycleState LifecycleState `json:"lifecycle_state,omitempty"` - ParentPath string `json:"parent_path,omitempty"` - Path string `json:"path,omitempty"` - SerializedDashboard string `json:"serialized_dashboard,omitempty"` - UpdateTime string `json:"update_time,omitempty"` - WarehouseId string `json:"warehouse_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func dashboardFromPb(pb *dashboardPb) (*Dashboard, error) { - if pb == nil { - return nil, nil - } - st := &Dashboard{} - st.CreateTime = pb.CreateTime - st.DashboardId = pb.DashboardId - st.DisplayName = pb.DisplayName - st.Etag = pb.Etag - st.LifecycleState = pb.LifecycleState - st.ParentPath = pb.ParentPath - st.Path = pb.Path - st.SerializedDashboard = pb.SerializedDashboard - st.UpdateTime = pb.UpdateTime - st.WarehouseId = pb.WarehouseId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *dashboardPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st dashboardPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func deleteScheduleRequestToPb(st *DeleteScheduleRequest) (*deleteScheduleRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteScheduleRequestPb{} - pb.DashboardId = st.DashboardId - pb.Etag = st.Etag - pb.ScheduleId = st.ScheduleId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type deleteScheduleRequestPb struct { - DashboardId string `json:"-" url:"-"` - Etag string `json:"-" url:"etag,omitempty"` - ScheduleId string `json:"-" url:"-"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func deleteScheduleRequestFromPb(pb *deleteScheduleRequestPb) (*DeleteScheduleRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteScheduleRequest{} - st.DashboardId = pb.DashboardId - st.Etag = pb.Etag - st.ScheduleId = pb.ScheduleId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *deleteScheduleRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st deleteScheduleRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func deleteScheduleResponseToPb(st *DeleteScheduleResponse) (*deleteScheduleResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteScheduleResponsePb{} - - return pb, nil -} - -type deleteScheduleResponsePb struct { -} - -func deleteScheduleResponseFromPb(pb *deleteScheduleResponsePb) (*DeleteScheduleResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteScheduleResponse{} - - return st, nil -} - -func deleteSubscriptionRequestToPb(st *DeleteSubscriptionRequest) (*deleteSubscriptionRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteSubscriptionRequestPb{} - pb.DashboardId = st.DashboardId - pb.Etag = st.Etag - pb.ScheduleId = st.ScheduleId - pb.SubscriptionId = st.SubscriptionId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type deleteSubscriptionRequestPb struct { - DashboardId string `json:"-" url:"-"` - Etag string `json:"-" url:"etag,omitempty"` - ScheduleId string `json:"-" url:"-"` - SubscriptionId string `json:"-" url:"-"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func deleteSubscriptionRequestFromPb(pb *deleteSubscriptionRequestPb) (*DeleteSubscriptionRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteSubscriptionRequest{} - st.DashboardId = pb.DashboardId - st.Etag = pb.Etag - st.ScheduleId = pb.ScheduleId - st.SubscriptionId = pb.SubscriptionId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *deleteSubscriptionRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st deleteSubscriptionRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func deleteSubscriptionResponseToPb(st *DeleteSubscriptionResponse) (*deleteSubscriptionResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteSubscriptionResponsePb{} - - return pb, nil -} - -type deleteSubscriptionResponsePb struct { -} - -func deleteSubscriptionResponseFromPb(pb *deleteSubscriptionResponsePb) (*DeleteSubscriptionResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteSubscriptionResponse{} - - return st, nil -} - -func genieAttachmentToPb(st *GenieAttachment) (*genieAttachmentPb, error) { - if st == nil { - return nil, nil - } - pb := &genieAttachmentPb{} - pb.AttachmentId = st.AttachmentId - pb.Query = st.Query - pb.Text = st.Text - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type genieAttachmentPb struct { - AttachmentId string `json:"attachment_id,omitempty"` - Query *GenieQueryAttachment `json:"query,omitempty"` - Text *TextAttachment `json:"text,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func genieAttachmentFromPb(pb *genieAttachmentPb) (*GenieAttachment, error) { - if pb == nil { - return nil, nil - } - st := &GenieAttachment{} - st.AttachmentId = pb.AttachmentId - st.Query = pb.Query - st.Text = pb.Text - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *genieAttachmentPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st genieAttachmentPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func genieConversationToPb(st *GenieConversation) (*genieConversationPb, error) { - if st == nil { - return nil, nil - } - pb := &genieConversationPb{} - pb.ConversationId = st.ConversationId - pb.CreatedTimestamp = st.CreatedTimestamp - pb.Id = st.Id - pb.LastUpdatedTimestamp = st.LastUpdatedTimestamp - pb.SpaceId = st.SpaceId - pb.Title = st.Title - pb.UserId = st.UserId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type genieConversationPb struct { - ConversationId string `json:"conversation_id"` - CreatedTimestamp int64 `json:"created_timestamp,omitempty"` - Id string `json:"id"` - LastUpdatedTimestamp int64 `json:"last_updated_timestamp,omitempty"` - SpaceId string `json:"space_id"` - Title string `json:"title"` - UserId int `json:"user_id"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func genieConversationFromPb(pb *genieConversationPb) (*GenieConversation, error) { - if pb == nil { - return nil, nil - } - st := &GenieConversation{} - st.ConversationId = pb.ConversationId - st.CreatedTimestamp = pb.CreatedTimestamp - st.Id = pb.Id - st.LastUpdatedTimestamp = pb.LastUpdatedTimestamp - st.SpaceId = pb.SpaceId - st.Title = pb.Title - st.UserId = pb.UserId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *genieConversationPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st genieConversationPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func genieCreateConversationMessageRequestToPb(st *GenieCreateConversationMessageRequest) (*genieCreateConversationMessageRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &genieCreateConversationMessageRequestPb{} - pb.Content = st.Content - pb.ConversationId = st.ConversationId - pb.SpaceId = st.SpaceId - - return pb, nil -} - -type genieCreateConversationMessageRequestPb struct { - Content string `json:"content"` - ConversationId string `json:"-" url:"-"` - SpaceId string `json:"-" url:"-"` -} - -func genieCreateConversationMessageRequestFromPb(pb *genieCreateConversationMessageRequestPb) (*GenieCreateConversationMessageRequest, error) { - if pb == nil { - return nil, nil - } - st := &GenieCreateConversationMessageRequest{} - st.Content = pb.Content - st.ConversationId = pb.ConversationId - st.SpaceId = pb.SpaceId - - return st, nil -} - -func genieExecuteMessageAttachmentQueryRequestToPb(st *GenieExecuteMessageAttachmentQueryRequest) (*genieExecuteMessageAttachmentQueryRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &genieExecuteMessageAttachmentQueryRequestPb{} - pb.AttachmentId = st.AttachmentId - pb.ConversationId = st.ConversationId - pb.MessageId = st.MessageId - pb.SpaceId = st.SpaceId - - return pb, nil -} - -type genieExecuteMessageAttachmentQueryRequestPb struct { - AttachmentId string `json:"-" url:"-"` - ConversationId string `json:"-" url:"-"` - MessageId string `json:"-" url:"-"` - SpaceId string `json:"-" url:"-"` -} - -func genieExecuteMessageAttachmentQueryRequestFromPb(pb *genieExecuteMessageAttachmentQueryRequestPb) (*GenieExecuteMessageAttachmentQueryRequest, error) { - if pb == nil { - return nil, nil - } - st := &GenieExecuteMessageAttachmentQueryRequest{} - st.AttachmentId = pb.AttachmentId - st.ConversationId = pb.ConversationId - st.MessageId = pb.MessageId - st.SpaceId = pb.SpaceId - - return st, nil -} - -func genieExecuteMessageQueryRequestToPb(st *GenieExecuteMessageQueryRequest) (*genieExecuteMessageQueryRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &genieExecuteMessageQueryRequestPb{} - pb.ConversationId = st.ConversationId - pb.MessageId = st.MessageId - pb.SpaceId = st.SpaceId - - return pb, nil -} - -type genieExecuteMessageQueryRequestPb struct { - ConversationId string `json:"-" url:"-"` - MessageId string `json:"-" url:"-"` - SpaceId string `json:"-" url:"-"` -} - -func genieExecuteMessageQueryRequestFromPb(pb *genieExecuteMessageQueryRequestPb) (*GenieExecuteMessageQueryRequest, error) { - if pb == nil { - return nil, nil - } - st := &GenieExecuteMessageQueryRequest{} - st.ConversationId = pb.ConversationId - st.MessageId = pb.MessageId - st.SpaceId = pb.SpaceId - - return st, nil -} - -func genieGenerateDownloadFullQueryResultRequestToPb(st *GenieGenerateDownloadFullQueryResultRequest) (*genieGenerateDownloadFullQueryResultRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &genieGenerateDownloadFullQueryResultRequestPb{} - pb.AttachmentId = st.AttachmentId - pb.ConversationId = st.ConversationId - pb.MessageId = st.MessageId - pb.SpaceId = st.SpaceId - - return pb, nil -} - -type genieGenerateDownloadFullQueryResultRequestPb struct { - AttachmentId string `json:"-" url:"-"` - ConversationId string `json:"-" url:"-"` - MessageId string `json:"-" url:"-"` - SpaceId string `json:"-" url:"-"` -} - -func genieGenerateDownloadFullQueryResultRequestFromPb(pb *genieGenerateDownloadFullQueryResultRequestPb) (*GenieGenerateDownloadFullQueryResultRequest, error) { - if pb == nil { - return nil, nil - } - st := &GenieGenerateDownloadFullQueryResultRequest{} - st.AttachmentId = pb.AttachmentId - st.ConversationId = pb.ConversationId - st.MessageId = pb.MessageId - st.SpaceId = pb.SpaceId - - return st, nil -} - -func genieGenerateDownloadFullQueryResultResponseToPb(st *GenieGenerateDownloadFullQueryResultResponse) (*genieGenerateDownloadFullQueryResultResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &genieGenerateDownloadFullQueryResultResponsePb{} - pb.DownloadId = st.DownloadId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type genieGenerateDownloadFullQueryResultResponsePb struct { - DownloadId string `json:"download_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func genieGenerateDownloadFullQueryResultResponseFromPb(pb *genieGenerateDownloadFullQueryResultResponsePb) (*GenieGenerateDownloadFullQueryResultResponse, error) { - if pb == nil { - return nil, nil - } - st := &GenieGenerateDownloadFullQueryResultResponse{} - st.DownloadId = pb.DownloadId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *genieGenerateDownloadFullQueryResultResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st genieGenerateDownloadFullQueryResultResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func genieGetConversationMessageRequestToPb(st *GenieGetConversationMessageRequest) (*genieGetConversationMessageRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &genieGetConversationMessageRequestPb{} - pb.ConversationId = st.ConversationId - pb.MessageId = st.MessageId - pb.SpaceId = st.SpaceId - - return pb, nil -} - -type genieGetConversationMessageRequestPb struct { - ConversationId string `json:"-" url:"-"` - MessageId string `json:"-" url:"-"` - SpaceId string `json:"-" url:"-"` -} - -func genieGetConversationMessageRequestFromPb(pb *genieGetConversationMessageRequestPb) (*GenieGetConversationMessageRequest, error) { - if pb == nil { - return nil, nil - } - st := &GenieGetConversationMessageRequest{} - st.ConversationId = pb.ConversationId - st.MessageId = pb.MessageId - st.SpaceId = pb.SpaceId - - return st, nil -} - -func genieGetDownloadFullQueryResultRequestToPb(st *GenieGetDownloadFullQueryResultRequest) (*genieGetDownloadFullQueryResultRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &genieGetDownloadFullQueryResultRequestPb{} - pb.AttachmentId = st.AttachmentId - pb.ConversationId = st.ConversationId - pb.DownloadId = st.DownloadId - pb.MessageId = st.MessageId - pb.SpaceId = st.SpaceId - - return pb, nil -} - -type genieGetDownloadFullQueryResultRequestPb struct { - AttachmentId string `json:"-" url:"-"` - ConversationId string `json:"-" url:"-"` - DownloadId string `json:"-" url:"-"` - MessageId string `json:"-" url:"-"` - SpaceId string `json:"-" url:"-"` -} - -func genieGetDownloadFullQueryResultRequestFromPb(pb *genieGetDownloadFullQueryResultRequestPb) (*GenieGetDownloadFullQueryResultRequest, error) { - if pb == nil { - return nil, nil - } - st := &GenieGetDownloadFullQueryResultRequest{} - st.AttachmentId = pb.AttachmentId - st.ConversationId = pb.ConversationId - st.DownloadId = pb.DownloadId - st.MessageId = pb.MessageId - st.SpaceId = pb.SpaceId - - return st, nil -} - -func genieGetDownloadFullQueryResultResponseToPb(st *GenieGetDownloadFullQueryResultResponse) (*genieGetDownloadFullQueryResultResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &genieGetDownloadFullQueryResultResponsePb{} - pb.StatementResponse = st.StatementResponse - - return pb, nil -} - -type genieGetDownloadFullQueryResultResponsePb struct { - StatementResponse *sql.StatementResponse `json:"statement_response,omitempty"` -} - -func genieGetDownloadFullQueryResultResponseFromPb(pb *genieGetDownloadFullQueryResultResponsePb) (*GenieGetDownloadFullQueryResultResponse, error) { - if pb == nil { - return nil, nil - } - st := &GenieGetDownloadFullQueryResultResponse{} - st.StatementResponse = pb.StatementResponse - - return st, nil -} - -func genieGetMessageAttachmentQueryResultRequestToPb(st *GenieGetMessageAttachmentQueryResultRequest) (*genieGetMessageAttachmentQueryResultRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &genieGetMessageAttachmentQueryResultRequestPb{} - pb.AttachmentId = st.AttachmentId - pb.ConversationId = st.ConversationId - pb.MessageId = st.MessageId - pb.SpaceId = st.SpaceId - - return pb, nil -} - -type genieGetMessageAttachmentQueryResultRequestPb struct { - AttachmentId string `json:"-" url:"-"` - ConversationId string `json:"-" url:"-"` - MessageId string `json:"-" url:"-"` - SpaceId string `json:"-" url:"-"` -} - -func genieGetMessageAttachmentQueryResultRequestFromPb(pb *genieGetMessageAttachmentQueryResultRequestPb) (*GenieGetMessageAttachmentQueryResultRequest, error) { - if pb == nil { - return nil, nil - } - st := &GenieGetMessageAttachmentQueryResultRequest{} - st.AttachmentId = pb.AttachmentId - st.ConversationId = pb.ConversationId - st.MessageId = pb.MessageId - st.SpaceId = pb.SpaceId - - return st, nil -} - -func genieGetMessageQueryResultRequestToPb(st *GenieGetMessageQueryResultRequest) (*genieGetMessageQueryResultRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &genieGetMessageQueryResultRequestPb{} - pb.ConversationId = st.ConversationId - pb.MessageId = st.MessageId - pb.SpaceId = st.SpaceId - - return pb, nil -} - -type genieGetMessageQueryResultRequestPb struct { - ConversationId string `json:"-" url:"-"` - MessageId string `json:"-" url:"-"` - SpaceId string `json:"-" url:"-"` -} - -func genieGetMessageQueryResultRequestFromPb(pb *genieGetMessageQueryResultRequestPb) (*GenieGetMessageQueryResultRequest, error) { - if pb == nil { - return nil, nil - } - st := &GenieGetMessageQueryResultRequest{} - st.ConversationId = pb.ConversationId - st.MessageId = pb.MessageId - st.SpaceId = pb.SpaceId - - return st, nil -} - -func genieGetMessageQueryResultResponseToPb(st *GenieGetMessageQueryResultResponse) (*genieGetMessageQueryResultResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &genieGetMessageQueryResultResponsePb{} - pb.StatementResponse = st.StatementResponse - - return pb, nil -} - -type genieGetMessageQueryResultResponsePb struct { - StatementResponse *sql.StatementResponse `json:"statement_response,omitempty"` -} - -func genieGetMessageQueryResultResponseFromPb(pb *genieGetMessageQueryResultResponsePb) (*GenieGetMessageQueryResultResponse, error) { - if pb == nil { - return nil, nil - } - st := &GenieGetMessageQueryResultResponse{} - st.StatementResponse = pb.StatementResponse - - return st, nil -} - -func genieGetQueryResultByAttachmentRequestToPb(st *GenieGetQueryResultByAttachmentRequest) (*genieGetQueryResultByAttachmentRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &genieGetQueryResultByAttachmentRequestPb{} - pb.AttachmentId = st.AttachmentId - pb.ConversationId = st.ConversationId - pb.MessageId = st.MessageId - pb.SpaceId = st.SpaceId - - return pb, nil -} - -type genieGetQueryResultByAttachmentRequestPb struct { - AttachmentId string `json:"-" url:"-"` - ConversationId string `json:"-" url:"-"` - MessageId string `json:"-" url:"-"` - SpaceId string `json:"-" url:"-"` -} - -func genieGetQueryResultByAttachmentRequestFromPb(pb *genieGetQueryResultByAttachmentRequestPb) (*GenieGetQueryResultByAttachmentRequest, error) { - if pb == nil { - return nil, nil - } - st := &GenieGetQueryResultByAttachmentRequest{} - st.AttachmentId = pb.AttachmentId - st.ConversationId = pb.ConversationId - st.MessageId = pb.MessageId - st.SpaceId = pb.SpaceId - - return st, nil -} - -func genieGetSpaceRequestToPb(st *GenieGetSpaceRequest) (*genieGetSpaceRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &genieGetSpaceRequestPb{} - pb.SpaceId = st.SpaceId - - return pb, nil -} - -type genieGetSpaceRequestPb struct { - SpaceId string `json:"-" url:"-"` -} - -func genieGetSpaceRequestFromPb(pb *genieGetSpaceRequestPb) (*GenieGetSpaceRequest, error) { - if pb == nil { - return nil, nil - } - st := &GenieGetSpaceRequest{} - st.SpaceId = pb.SpaceId - - return st, nil -} - -func genieListSpacesRequestToPb(st *GenieListSpacesRequest) (*genieListSpacesRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &genieListSpacesRequestPb{} - pb.PageSize = st.PageSize - pb.PageToken = st.PageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type genieListSpacesRequestPb struct { - PageSize int `json:"-" url:"page_size,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func genieListSpacesRequestFromPb(pb *genieListSpacesRequestPb) (*GenieListSpacesRequest, error) { - if pb == nil { - return nil, nil - } - st := &GenieListSpacesRequest{} - st.PageSize = pb.PageSize - st.PageToken = pb.PageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *genieListSpacesRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st genieListSpacesRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func genieListSpacesResponseToPb(st *GenieListSpacesResponse) (*genieListSpacesResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &genieListSpacesResponsePb{} - pb.NextPageToken = st.NextPageToken - pb.Spaces = st.Spaces - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type genieListSpacesResponsePb struct { - NextPageToken string `json:"next_page_token,omitempty"` - Spaces []GenieSpace `json:"spaces,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func genieListSpacesResponseFromPb(pb *genieListSpacesResponsePb) (*GenieListSpacesResponse, error) { - if pb == nil { - return nil, nil - } - st := &GenieListSpacesResponse{} - st.NextPageToken = pb.NextPageToken - st.Spaces = pb.Spaces - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *genieListSpacesResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st genieListSpacesResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func genieMessageToPb(st *GenieMessage) (*genieMessagePb, error) { - if st == nil { - return nil, nil - } - pb := &genieMessagePb{} - pb.Attachments = st.Attachments - pb.Content = st.Content - pb.ConversationId = st.ConversationId - pb.CreatedTimestamp = st.CreatedTimestamp - pb.Error = st.Error - pb.Id = st.Id - pb.LastUpdatedTimestamp = st.LastUpdatedTimestamp - pb.MessageId = st.MessageId - pb.QueryResult = st.QueryResult - pb.SpaceId = st.SpaceId - pb.Status = st.Status - pb.UserId = st.UserId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type genieMessagePb struct { - Attachments []GenieAttachment `json:"attachments,omitempty"` - Content string `json:"content"` - ConversationId string `json:"conversation_id"` - CreatedTimestamp int64 `json:"created_timestamp,omitempty"` - Error *MessageError `json:"error,omitempty"` - Id string `json:"id"` - LastUpdatedTimestamp int64 `json:"last_updated_timestamp,omitempty"` - MessageId string `json:"message_id"` - QueryResult *Result `json:"query_result,omitempty"` - SpaceId string `json:"space_id"` - Status MessageStatus `json:"status,omitempty"` - UserId int64 `json:"user_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func genieMessageFromPb(pb *genieMessagePb) (*GenieMessage, error) { - if pb == nil { - return nil, nil - } - st := &GenieMessage{} - st.Attachments = pb.Attachments - st.Content = pb.Content - st.ConversationId = pb.ConversationId - st.CreatedTimestamp = pb.CreatedTimestamp - st.Error = pb.Error - st.Id = pb.Id - st.LastUpdatedTimestamp = pb.LastUpdatedTimestamp - st.MessageId = pb.MessageId - st.QueryResult = pb.QueryResult - st.SpaceId = pb.SpaceId - st.Status = pb.Status - st.UserId = pb.UserId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *genieMessagePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st genieMessagePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func genieQueryAttachmentToPb(st *GenieQueryAttachment) (*genieQueryAttachmentPb, error) { - if st == nil { - return nil, nil - } - pb := &genieQueryAttachmentPb{} - pb.Description = st.Description - pb.Id = st.Id - pb.LastUpdatedTimestamp = st.LastUpdatedTimestamp - pb.Query = st.Query - pb.QueryResultMetadata = st.QueryResultMetadata - pb.StatementId = st.StatementId - pb.Title = st.Title - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type genieQueryAttachmentPb struct { - Description string `json:"description,omitempty"` - Id string `json:"id,omitempty"` - LastUpdatedTimestamp int64 `json:"last_updated_timestamp,omitempty"` - Query string `json:"query,omitempty"` - QueryResultMetadata *GenieResultMetadata `json:"query_result_metadata,omitempty"` - StatementId string `json:"statement_id,omitempty"` - Title string `json:"title,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func genieQueryAttachmentFromPb(pb *genieQueryAttachmentPb) (*GenieQueryAttachment, error) { - if pb == nil { - return nil, nil - } - st := &GenieQueryAttachment{} - st.Description = pb.Description - st.Id = pb.Id - st.LastUpdatedTimestamp = pb.LastUpdatedTimestamp - st.Query = pb.Query - st.QueryResultMetadata = pb.QueryResultMetadata - st.StatementId = pb.StatementId - st.Title = pb.Title - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *genieQueryAttachmentPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st genieQueryAttachmentPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func genieResultMetadataToPb(st *GenieResultMetadata) (*genieResultMetadataPb, error) { - if st == nil { - return nil, nil - } - pb := &genieResultMetadataPb{} - pb.IsTruncated = st.IsTruncated - pb.RowCount = st.RowCount - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type genieResultMetadataPb struct { - IsTruncated bool `json:"is_truncated,omitempty"` - RowCount int64 `json:"row_count,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func genieResultMetadataFromPb(pb *genieResultMetadataPb) (*GenieResultMetadata, error) { - if pb == nil { - return nil, nil - } - st := &GenieResultMetadata{} - st.IsTruncated = pb.IsTruncated - st.RowCount = pb.RowCount - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *genieResultMetadataPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st genieResultMetadataPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func genieSpaceToPb(st *GenieSpace) (*genieSpacePb, error) { - if st == nil { - return nil, nil - } - pb := &genieSpacePb{} - pb.Description = st.Description - pb.SpaceId = st.SpaceId - pb.Title = st.Title - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type genieSpacePb struct { - Description string `json:"description,omitempty"` - SpaceId string `json:"space_id"` - Title string `json:"title"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func genieSpaceFromPb(pb *genieSpacePb) (*GenieSpace, error) { - if pb == nil { - return nil, nil - } - st := &GenieSpace{} - st.Description = pb.Description - st.SpaceId = pb.SpaceId - st.Title = pb.Title - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *genieSpacePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st genieSpacePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func genieStartConversationMessageRequestToPb(st *GenieStartConversationMessageRequest) (*genieStartConversationMessageRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &genieStartConversationMessageRequestPb{} - pb.Content = st.Content - pb.SpaceId = st.SpaceId - - return pb, nil -} - -type genieStartConversationMessageRequestPb struct { - Content string `json:"content"` - SpaceId string `json:"-" url:"-"` -} - -func genieStartConversationMessageRequestFromPb(pb *genieStartConversationMessageRequestPb) (*GenieStartConversationMessageRequest, error) { - if pb == nil { - return nil, nil - } - st := &GenieStartConversationMessageRequest{} - st.Content = pb.Content - st.SpaceId = pb.SpaceId - - return st, nil -} - -func genieStartConversationResponseToPb(st *GenieStartConversationResponse) (*genieStartConversationResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &genieStartConversationResponsePb{} - pb.Conversation = st.Conversation - pb.ConversationId = st.ConversationId - pb.Message = st.Message - pb.MessageId = st.MessageId - - return pb, nil -} - -type genieStartConversationResponsePb struct { - Conversation *GenieConversation `json:"conversation,omitempty"` - ConversationId string `json:"conversation_id"` - Message *GenieMessage `json:"message,omitempty"` - MessageId string `json:"message_id"` -} - -func genieStartConversationResponseFromPb(pb *genieStartConversationResponsePb) (*GenieStartConversationResponse, error) { - if pb == nil { - return nil, nil - } - st := &GenieStartConversationResponse{} - st.Conversation = pb.Conversation - st.ConversationId = pb.ConversationId - st.Message = pb.Message - st.MessageId = pb.MessageId - - return st, nil -} - -func getDashboardRequestToPb(st *GetDashboardRequest) (*getDashboardRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getDashboardRequestPb{} - pb.DashboardId = st.DashboardId - - return pb, nil -} - -type getDashboardRequestPb struct { - DashboardId string `json:"-" url:"-"` -} - -func getDashboardRequestFromPb(pb *getDashboardRequestPb) (*GetDashboardRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetDashboardRequest{} - st.DashboardId = pb.DashboardId - - return st, nil -} - -func getPublishedDashboardRequestToPb(st *GetPublishedDashboardRequest) (*getPublishedDashboardRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getPublishedDashboardRequestPb{} - pb.DashboardId = st.DashboardId - - return pb, nil -} - -type getPublishedDashboardRequestPb struct { - DashboardId string `json:"-" url:"-"` -} - -func getPublishedDashboardRequestFromPb(pb *getPublishedDashboardRequestPb) (*GetPublishedDashboardRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetPublishedDashboardRequest{} - st.DashboardId = pb.DashboardId - - return st, nil -} - -func getPublishedDashboardTokenInfoRequestToPb(st *GetPublishedDashboardTokenInfoRequest) (*getPublishedDashboardTokenInfoRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getPublishedDashboardTokenInfoRequestPb{} - pb.DashboardId = st.DashboardId - pb.ExternalValue = st.ExternalValue - pb.ExternalViewerId = st.ExternalViewerId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getPublishedDashboardTokenInfoRequestPb struct { - DashboardId string `json:"-" url:"-"` - ExternalValue string `json:"-" url:"external_value,omitempty"` - ExternalViewerId string `json:"-" url:"external_viewer_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getPublishedDashboardTokenInfoRequestFromPb(pb *getPublishedDashboardTokenInfoRequestPb) (*GetPublishedDashboardTokenInfoRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetPublishedDashboardTokenInfoRequest{} - st.DashboardId = pb.DashboardId - st.ExternalValue = pb.ExternalValue - st.ExternalViewerId = pb.ExternalViewerId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getPublishedDashboardTokenInfoRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getPublishedDashboardTokenInfoRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getPublishedDashboardTokenInfoResponseToPb(st *GetPublishedDashboardTokenInfoResponse) (*getPublishedDashboardTokenInfoResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &getPublishedDashboardTokenInfoResponsePb{} - pb.AuthorizationDetails = st.AuthorizationDetails - pb.CustomClaim = st.CustomClaim - pb.Scope = st.Scope - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getPublishedDashboardTokenInfoResponsePb struct { - AuthorizationDetails []AuthorizationDetails `json:"authorization_details,omitempty"` - CustomClaim string `json:"custom_claim,omitempty"` - Scope string `json:"scope,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getPublishedDashboardTokenInfoResponseFromPb(pb *getPublishedDashboardTokenInfoResponsePb) (*GetPublishedDashboardTokenInfoResponse, error) { - if pb == nil { - return nil, nil - } - st := &GetPublishedDashboardTokenInfoResponse{} - st.AuthorizationDetails = pb.AuthorizationDetails - st.CustomClaim = pb.CustomClaim - st.Scope = pb.Scope - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getPublishedDashboardTokenInfoResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getPublishedDashboardTokenInfoResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getScheduleRequestToPb(st *GetScheduleRequest) (*getScheduleRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getScheduleRequestPb{} - pb.DashboardId = st.DashboardId - pb.ScheduleId = st.ScheduleId - - return pb, nil -} - -type getScheduleRequestPb struct { - DashboardId string `json:"-" url:"-"` - ScheduleId string `json:"-" url:"-"` -} - -func getScheduleRequestFromPb(pb *getScheduleRequestPb) (*GetScheduleRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetScheduleRequest{} - st.DashboardId = pb.DashboardId - st.ScheduleId = pb.ScheduleId - - return st, nil -} - -func getSubscriptionRequestToPb(st *GetSubscriptionRequest) (*getSubscriptionRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getSubscriptionRequestPb{} - pb.DashboardId = st.DashboardId - pb.ScheduleId = st.ScheduleId - pb.SubscriptionId = st.SubscriptionId - - return pb, nil -} - -type getSubscriptionRequestPb struct { - DashboardId string `json:"-" url:"-"` - ScheduleId string `json:"-" url:"-"` - SubscriptionId string `json:"-" url:"-"` -} - -func getSubscriptionRequestFromPb(pb *getSubscriptionRequestPb) (*GetSubscriptionRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetSubscriptionRequest{} - st.DashboardId = pb.DashboardId - st.ScheduleId = pb.ScheduleId - st.SubscriptionId = pb.SubscriptionId - - return st, nil -} - -func listDashboardsRequestToPb(st *ListDashboardsRequest) (*listDashboardsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listDashboardsRequestPb{} - pb.PageSize = st.PageSize - pb.PageToken = st.PageToken - pb.ShowTrashed = st.ShowTrashed - pb.View = st.View - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listDashboardsRequestPb struct { - PageSize int `json:"-" url:"page_size,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - ShowTrashed bool `json:"-" url:"show_trashed,omitempty"` - View DashboardView `json:"-" url:"view,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listDashboardsRequestFromPb(pb *listDashboardsRequestPb) (*ListDashboardsRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListDashboardsRequest{} - st.PageSize = pb.PageSize - st.PageToken = pb.PageToken - st.ShowTrashed = pb.ShowTrashed - st.View = pb.View - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listDashboardsRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listDashboardsRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listDashboardsResponseToPb(st *ListDashboardsResponse) (*listDashboardsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listDashboardsResponsePb{} - pb.Dashboards = st.Dashboards - pb.NextPageToken = st.NextPageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listDashboardsResponsePb struct { - Dashboards []Dashboard `json:"dashboards,omitempty"` - NextPageToken string `json:"next_page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listDashboardsResponseFromPb(pb *listDashboardsResponsePb) (*ListDashboardsResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListDashboardsResponse{} - st.Dashboards = pb.Dashboards - st.NextPageToken = pb.NextPageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listDashboardsResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listDashboardsResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listSchedulesRequestToPb(st *ListSchedulesRequest) (*listSchedulesRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listSchedulesRequestPb{} - pb.DashboardId = st.DashboardId - pb.PageSize = st.PageSize - pb.PageToken = st.PageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listSchedulesRequestPb struct { - DashboardId string `json:"-" url:"-"` - PageSize int `json:"-" url:"page_size,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listSchedulesRequestFromPb(pb *listSchedulesRequestPb) (*ListSchedulesRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListSchedulesRequest{} - st.DashboardId = pb.DashboardId - st.PageSize = pb.PageSize - st.PageToken = pb.PageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listSchedulesRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listSchedulesRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listSchedulesResponseToPb(st *ListSchedulesResponse) (*listSchedulesResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listSchedulesResponsePb{} - pb.NextPageToken = st.NextPageToken - pb.Schedules = st.Schedules - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listSchedulesResponsePb struct { - NextPageToken string `json:"next_page_token,omitempty"` - Schedules []Schedule `json:"schedules,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listSchedulesResponseFromPb(pb *listSchedulesResponsePb) (*ListSchedulesResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListSchedulesResponse{} - st.NextPageToken = pb.NextPageToken - st.Schedules = pb.Schedules - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listSchedulesResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listSchedulesResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listSubscriptionsRequestToPb(st *ListSubscriptionsRequest) (*listSubscriptionsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listSubscriptionsRequestPb{} - pb.DashboardId = st.DashboardId - pb.PageSize = st.PageSize - pb.PageToken = st.PageToken - pb.ScheduleId = st.ScheduleId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listSubscriptionsRequestPb struct { - DashboardId string `json:"-" url:"-"` - PageSize int `json:"-" url:"page_size,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - ScheduleId string `json:"-" url:"-"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listSubscriptionsRequestFromPb(pb *listSubscriptionsRequestPb) (*ListSubscriptionsRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListSubscriptionsRequest{} - st.DashboardId = pb.DashboardId - st.PageSize = pb.PageSize - st.PageToken = pb.PageToken - st.ScheduleId = pb.ScheduleId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listSubscriptionsRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listSubscriptionsRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listSubscriptionsResponseToPb(st *ListSubscriptionsResponse) (*listSubscriptionsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listSubscriptionsResponsePb{} - pb.NextPageToken = st.NextPageToken - pb.Subscriptions = st.Subscriptions - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listSubscriptionsResponsePb struct { - NextPageToken string `json:"next_page_token,omitempty"` - Subscriptions []Subscription `json:"subscriptions,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listSubscriptionsResponseFromPb(pb *listSubscriptionsResponsePb) (*ListSubscriptionsResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListSubscriptionsResponse{} - st.NextPageToken = pb.NextPageToken - st.Subscriptions = pb.Subscriptions - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listSubscriptionsResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listSubscriptionsResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func messageErrorToPb(st *MessageError) (*messageErrorPb, error) { - if st == nil { - return nil, nil - } - pb := &messageErrorPb{} - pb.Error = st.Error - pb.Type = st.Type - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type messageErrorPb struct { - Error string `json:"error,omitempty"` - Type MessageErrorType `json:"type,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func messageErrorFromPb(pb *messageErrorPb) (*MessageError, error) { - if pb == nil { - return nil, nil - } - st := &MessageError{} - st.Error = pb.Error - st.Type = pb.Type - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *messageErrorPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st messageErrorPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func migrateDashboardRequestToPb(st *MigrateDashboardRequest) (*migrateDashboardRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &migrateDashboardRequestPb{} - pb.DisplayName = st.DisplayName - pb.ParentPath = st.ParentPath - pb.SourceDashboardId = st.SourceDashboardId - pb.UpdateParameterSyntax = st.UpdateParameterSyntax - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type migrateDashboardRequestPb struct { - DisplayName string `json:"display_name,omitempty"` - ParentPath string `json:"parent_path,omitempty"` - SourceDashboardId string `json:"source_dashboard_id"` - UpdateParameterSyntax bool `json:"update_parameter_syntax,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func migrateDashboardRequestFromPb(pb *migrateDashboardRequestPb) (*MigrateDashboardRequest, error) { - if pb == nil { - return nil, nil - } - st := &MigrateDashboardRequest{} - st.DisplayName = pb.DisplayName - st.ParentPath = pb.ParentPath - st.SourceDashboardId = pb.SourceDashboardId - st.UpdateParameterSyntax = pb.UpdateParameterSyntax - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *migrateDashboardRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st migrateDashboardRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func publishRequestToPb(st *PublishRequest) (*publishRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &publishRequestPb{} - pb.DashboardId = st.DashboardId - pb.EmbedCredentials = st.EmbedCredentials - pb.WarehouseId = st.WarehouseId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type publishRequestPb struct { - DashboardId string `json:"-" url:"-"` - EmbedCredentials bool `json:"embed_credentials,omitempty"` - WarehouseId string `json:"warehouse_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func publishRequestFromPb(pb *publishRequestPb) (*PublishRequest, error) { - if pb == nil { - return nil, nil - } - st := &PublishRequest{} - st.DashboardId = pb.DashboardId - st.EmbedCredentials = pb.EmbedCredentials - st.WarehouseId = pb.WarehouseId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *publishRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st publishRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func publishedDashboardToPb(st *PublishedDashboard) (*publishedDashboardPb, error) { - if st == nil { - return nil, nil - } - pb := &publishedDashboardPb{} - pb.DisplayName = st.DisplayName - pb.EmbedCredentials = st.EmbedCredentials - pb.RevisionCreateTime = st.RevisionCreateTime - pb.WarehouseId = st.WarehouseId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type publishedDashboardPb struct { - DisplayName string `json:"display_name,omitempty"` - EmbedCredentials bool `json:"embed_credentials,omitempty"` - RevisionCreateTime string `json:"revision_create_time,omitempty"` - WarehouseId string `json:"warehouse_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func publishedDashboardFromPb(pb *publishedDashboardPb) (*PublishedDashboard, error) { - if pb == nil { - return nil, nil - } - st := &PublishedDashboard{} - st.DisplayName = pb.DisplayName - st.EmbedCredentials = pb.EmbedCredentials - st.RevisionCreateTime = pb.RevisionCreateTime - st.WarehouseId = pb.WarehouseId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *publishedDashboardPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st publishedDashboardPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func resultToPb(st *Result) (*resultPb, error) { - if st == nil { - return nil, nil - } - pb := &resultPb{} - pb.IsTruncated = st.IsTruncated - pb.RowCount = st.RowCount - pb.StatementId = st.StatementId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type resultPb struct { - IsTruncated bool `json:"is_truncated,omitempty"` - RowCount int64 `json:"row_count,omitempty"` - StatementId string `json:"statement_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func resultFromPb(pb *resultPb) (*Result, error) { - if pb == nil { - return nil, nil - } - st := &Result{} - st.IsTruncated = pb.IsTruncated - st.RowCount = pb.RowCount - st.StatementId = pb.StatementId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *resultPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st resultPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func scheduleToPb(st *Schedule) (*schedulePb, error) { - if st == nil { - return nil, nil - } - pb := &schedulePb{} - pb.CreateTime = st.CreateTime - pb.CronSchedule = st.CronSchedule - pb.DashboardId = st.DashboardId - pb.DisplayName = st.DisplayName - pb.Etag = st.Etag - pb.PauseStatus = st.PauseStatus - pb.ScheduleId = st.ScheduleId - pb.UpdateTime = st.UpdateTime - pb.WarehouseId = st.WarehouseId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type schedulePb struct { - CreateTime string `json:"create_time,omitempty"` - CronSchedule CronSchedule `json:"cron_schedule"` - DashboardId string `json:"dashboard_id,omitempty"` - DisplayName string `json:"display_name,omitempty"` - Etag string `json:"etag,omitempty"` - PauseStatus SchedulePauseStatus `json:"pause_status,omitempty"` - ScheduleId string `json:"schedule_id,omitempty"` - UpdateTime string `json:"update_time,omitempty"` - WarehouseId string `json:"warehouse_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func scheduleFromPb(pb *schedulePb) (*Schedule, error) { - if pb == nil { - return nil, nil - } - st := &Schedule{} - st.CreateTime = pb.CreateTime - st.CronSchedule = pb.CronSchedule - st.DashboardId = pb.DashboardId - st.DisplayName = pb.DisplayName - st.Etag = pb.Etag - st.PauseStatus = pb.PauseStatus - st.ScheduleId = pb.ScheduleId - st.UpdateTime = pb.UpdateTime - st.WarehouseId = pb.WarehouseId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *schedulePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st schedulePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func subscriberToPb(st *Subscriber) (*subscriberPb, error) { - if st == nil { - return nil, nil - } - pb := &subscriberPb{} - pb.DestinationSubscriber = st.DestinationSubscriber - pb.UserSubscriber = st.UserSubscriber - - return pb, nil -} - -type subscriberPb struct { - DestinationSubscriber *SubscriptionSubscriberDestination `json:"destination_subscriber,omitempty"` - UserSubscriber *SubscriptionSubscriberUser `json:"user_subscriber,omitempty"` -} - -func subscriberFromPb(pb *subscriberPb) (*Subscriber, error) { - if pb == nil { - return nil, nil - } - st := &Subscriber{} - st.DestinationSubscriber = pb.DestinationSubscriber - st.UserSubscriber = pb.UserSubscriber - - return st, nil -} - -func subscriptionToPb(st *Subscription) (*subscriptionPb, error) { - if st == nil { - return nil, nil - } - pb := &subscriptionPb{} - pb.CreateTime = st.CreateTime - pb.CreatedByUserId = st.CreatedByUserId - pb.DashboardId = st.DashboardId - pb.Etag = st.Etag - pb.ScheduleId = st.ScheduleId - pb.Subscriber = st.Subscriber - pb.SubscriptionId = st.SubscriptionId - pb.UpdateTime = st.UpdateTime - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type subscriptionPb struct { - CreateTime string `json:"create_time,omitempty"` - CreatedByUserId int64 `json:"created_by_user_id,omitempty"` - DashboardId string `json:"dashboard_id,omitempty"` - Etag string `json:"etag,omitempty"` - ScheduleId string `json:"schedule_id,omitempty"` - Subscriber Subscriber `json:"subscriber"` - SubscriptionId string `json:"subscription_id,omitempty"` - UpdateTime string `json:"update_time,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func subscriptionFromPb(pb *subscriptionPb) (*Subscription, error) { - if pb == nil { - return nil, nil - } - st := &Subscription{} - st.CreateTime = pb.CreateTime - st.CreatedByUserId = pb.CreatedByUserId - st.DashboardId = pb.DashboardId - st.Etag = pb.Etag - st.ScheduleId = pb.ScheduleId - st.Subscriber = pb.Subscriber - st.SubscriptionId = pb.SubscriptionId - st.UpdateTime = pb.UpdateTime - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *subscriptionPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st subscriptionPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func subscriptionSubscriberDestinationToPb(st *SubscriptionSubscriberDestination) (*subscriptionSubscriberDestinationPb, error) { - if st == nil { - return nil, nil - } - pb := &subscriptionSubscriberDestinationPb{} - pb.DestinationId = st.DestinationId - - return pb, nil -} - -type subscriptionSubscriberDestinationPb struct { - DestinationId string `json:"destination_id"` -} - -func subscriptionSubscriberDestinationFromPb(pb *subscriptionSubscriberDestinationPb) (*SubscriptionSubscriberDestination, error) { - if pb == nil { - return nil, nil - } - st := &SubscriptionSubscriberDestination{} - st.DestinationId = pb.DestinationId - - return st, nil -} - -func subscriptionSubscriberUserToPb(st *SubscriptionSubscriberUser) (*subscriptionSubscriberUserPb, error) { - if st == nil { - return nil, nil - } - pb := &subscriptionSubscriberUserPb{} - pb.UserId = st.UserId - - return pb, nil -} - -type subscriptionSubscriberUserPb struct { - UserId int64 `json:"user_id"` -} - -func subscriptionSubscriberUserFromPb(pb *subscriptionSubscriberUserPb) (*SubscriptionSubscriberUser, error) { - if pb == nil { - return nil, nil - } - st := &SubscriptionSubscriberUser{} - st.UserId = pb.UserId - - return st, nil -} - -func textAttachmentToPb(st *TextAttachment) (*textAttachmentPb, error) { - if st == nil { - return nil, nil - } - pb := &textAttachmentPb{} - pb.Content = st.Content - pb.Id = st.Id - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type textAttachmentPb struct { - Content string `json:"content,omitempty"` - Id string `json:"id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func textAttachmentFromPb(pb *textAttachmentPb) (*TextAttachment, error) { - if pb == nil { - return nil, nil - } - st := &TextAttachment{} - st.Content = pb.Content - st.Id = pb.Id - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *textAttachmentPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st textAttachmentPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func trashDashboardRequestToPb(st *TrashDashboardRequest) (*trashDashboardRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &trashDashboardRequestPb{} - pb.DashboardId = st.DashboardId - - return pb, nil -} - -type trashDashboardRequestPb struct { - DashboardId string `json:"-" url:"-"` -} - -func trashDashboardRequestFromPb(pb *trashDashboardRequestPb) (*TrashDashboardRequest, error) { - if pb == nil { - return nil, nil - } - st := &TrashDashboardRequest{} - st.DashboardId = pb.DashboardId - - return st, nil -} - -func trashDashboardResponseToPb(st *TrashDashboardResponse) (*trashDashboardResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &trashDashboardResponsePb{} - - return pb, nil -} - -type trashDashboardResponsePb struct { -} - -func trashDashboardResponseFromPb(pb *trashDashboardResponsePb) (*TrashDashboardResponse, error) { - if pb == nil { - return nil, nil - } - st := &TrashDashboardResponse{} - - return st, nil -} - -func unpublishDashboardRequestToPb(st *UnpublishDashboardRequest) (*unpublishDashboardRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &unpublishDashboardRequestPb{} - pb.DashboardId = st.DashboardId - - return pb, nil -} - -type unpublishDashboardRequestPb struct { - DashboardId string `json:"-" url:"-"` -} - -func unpublishDashboardRequestFromPb(pb *unpublishDashboardRequestPb) (*UnpublishDashboardRequest, error) { - if pb == nil { - return nil, nil - } - st := &UnpublishDashboardRequest{} - st.DashboardId = pb.DashboardId - - return st, nil -} - -func unpublishDashboardResponseToPb(st *UnpublishDashboardResponse) (*unpublishDashboardResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &unpublishDashboardResponsePb{} - - return pb, nil -} - -type unpublishDashboardResponsePb struct { -} - -func unpublishDashboardResponseFromPb(pb *unpublishDashboardResponsePb) (*UnpublishDashboardResponse, error) { - if pb == nil { - return nil, nil - } - st := &UnpublishDashboardResponse{} - - return st, nil -} - -func updateDashboardRequestToPb(st *UpdateDashboardRequest) (*updateDashboardRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &updateDashboardRequestPb{} - pb.Dashboard = st.Dashboard - pb.DashboardId = st.DashboardId - - return pb, nil -} - -type updateDashboardRequestPb struct { - Dashboard Dashboard `json:"dashboard"` - DashboardId string `json:"-" url:"-"` -} - -func updateDashboardRequestFromPb(pb *updateDashboardRequestPb) (*UpdateDashboardRequest, error) { - if pb == nil { - return nil, nil - } - st := &UpdateDashboardRequest{} - st.Dashboard = pb.Dashboard - st.DashboardId = pb.DashboardId - - return st, nil -} - -func updateScheduleRequestToPb(st *UpdateScheduleRequest) (*updateScheduleRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &updateScheduleRequestPb{} - pb.DashboardId = st.DashboardId - pb.Schedule = st.Schedule - pb.ScheduleId = st.ScheduleId - - return pb, nil -} - -type updateScheduleRequestPb struct { - DashboardId string `json:"-" url:"-"` - Schedule Schedule `json:"schedule"` - ScheduleId string `json:"-" url:"-"` -} - -func updateScheduleRequestFromPb(pb *updateScheduleRequestPb) (*UpdateScheduleRequest, error) { - if pb == nil { - return nil, nil - } - st := &UpdateScheduleRequest{} - st.DashboardId = pb.DashboardId - st.Schedule = pb.Schedule - st.ScheduleId = pb.ScheduleId - - return st, nil -} - -func durationToPb(d *time.Duration) (*string, error) { - if d == nil { - return nil, nil - } - s := fmt.Sprintf("%.9fs", d.Seconds()) - return &s, nil -} - -func durationFromPb(s *string) (*time.Duration, error) { - if s == nil { - return nil, nil - } - d, err := time.ParseDuration(*s) - if err != nil { - return nil, err - } - return &d, nil -} - -func timestampToPb(t *time.Time) (*string, error) { - if t == nil { - return nil, nil - } - s := t.Format(time.RFC3339) - return &s, nil -} - -func timestampFromPb(s *string) (*time.Time, error) { - if s == nil { - return nil, nil - } - t, err := time.Parse(time.RFC3339, *s) - if err != nil { - return nil, err - } - return &t, nil -} - -func fieldMaskToPb(fm *[]string) (*string, error) { - if fm == nil { - return nil, nil - } - s := strings.Join(*fm, ",") - return &s, nil -} - -func fieldMaskFromPb(s *string) (*[]string, error) { - if s == nil { - return nil, nil - } - fm := strings.Split(*s, ",") - return &fm, nil -} diff --git a/service/dashboards/model.go b/service/dashboards/model.go index a47beb67a..fd6d8671a 100755 --- a/service/dashboards/model.go +++ b/service/dashboards/model.go @@ -3,262 +3,110 @@ package dashboards import ( - "encoding/json" "fmt" + "github.com/databricks/databricks-sdk-go/marshal" "github.com/databricks/databricks-sdk-go/service/sql" ) type AuthorizationDetails struct { // Represents downscoped permission rules with specific access rights. This // field is specific to `workspace_rule_set` constraint. - // Wire name: 'grant_rules' GrantRules []AuthorizationDetailsGrantRule `json:"grant_rules,omitempty"` // The acl path of the tree store resource resource. - // Wire name: 'resource_legacy_acl_path' ResourceLegacyAclPath string `json:"resource_legacy_acl_path,omitempty"` // The resource name to which the authorization rule applies. This field is // specific to `workspace_rule_set` constraint. Format: // `workspaces/{workspace_id}/dashboards/{dashboard_id}` - // Wire name: 'resource_name' ResourceName string `json:"resource_name,omitempty"` // The type of authorization downscoping policy. Ex: `workspace_rule_set` // defines access rules for a specific workspace resource - // Wire name: 'type' Type string `json:"type,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *AuthorizationDetails) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &authorizationDetailsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := authorizationDetailsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *AuthorizationDetails) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st AuthorizationDetails) MarshalJSON() ([]byte, error) { - pb, err := authorizationDetailsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s AuthorizationDetails) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type AuthorizationDetailsGrantRule struct { // Permission sets for dashboard are defined in // iam-common/rbac-common/permission-sets/definitions/TreeStoreBasePermissionSets // Ex: `permissionSets/dashboard.runner` - // Wire name: 'permission_set' PermissionSet string `json:"permission_set,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *AuthorizationDetailsGrantRule) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &authorizationDetailsGrantRulePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := authorizationDetailsGrantRuleFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *AuthorizationDetailsGrantRule) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st AuthorizationDetailsGrantRule) MarshalJSON() ([]byte, error) { - pb, err := authorizationDetailsGrantRuleToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s AuthorizationDetailsGrantRule) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Create dashboard type CreateDashboardRequest struct { - - // Wire name: 'dashboard' Dashboard Dashboard `json:"dashboard"` } -func (st *CreateDashboardRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createDashboardRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createDashboardRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CreateDashboardRequest) MarshalJSON() ([]byte, error) { - pb, err := createDashboardRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Create dashboard schedule type CreateScheduleRequest struct { // UUID identifying the dashboard to which the schedule belongs. - DashboardId string `json:"-" tf:"-"` + DashboardId string `json:"-" url:"-"` - // Wire name: 'schedule' Schedule Schedule `json:"schedule"` } -func (st *CreateScheduleRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createScheduleRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createScheduleRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CreateScheduleRequest) MarshalJSON() ([]byte, error) { - pb, err := createScheduleRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Create schedule subscription type CreateSubscriptionRequest struct { // UUID identifying the dashboard to which the subscription belongs. - DashboardId string `json:"-" tf:"-"` + DashboardId string `json:"-" url:"-"` // UUID identifying the schedule to which the subscription belongs. - ScheduleId string `json:"-" tf:"-"` + ScheduleId string `json:"-" url:"-"` - // Wire name: 'subscription' Subscription Subscription `json:"subscription"` } -func (st *CreateSubscriptionRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createSubscriptionRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createSubscriptionRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CreateSubscriptionRequest) MarshalJSON() ([]byte, error) { - pb, err := createSubscriptionRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type CronSchedule struct { // A cron expression using quartz syntax. EX: `0 0 8 * * ?` represents // everyday at 8am. See [Cron Trigger] for details. // // [Cron Trigger]: http://www.quartz-scheduler.org/documentation/quartz-2.3.0/tutorials/crontrigger.html - // Wire name: 'quartz_cron_expression' QuartzCronExpression string `json:"quartz_cron_expression"` // A Java timezone id. The schedule will be resolved with respect to this // timezone. See [Java TimeZone] for details. // // [Java TimeZone]: https://docs.oracle.com/javase/7/docs/api/java/util/TimeZone.html - // Wire name: 'timezone_id' TimezoneId string `json:"timezone_id"` } -func (st *CronSchedule) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &cronSchedulePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := cronScheduleFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CronSchedule) MarshalJSON() ([]byte, error) { - pb, err := cronScheduleToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type Dashboard struct { // The timestamp of when the dashboard was created. - // Wire name: 'create_time' CreateTime string `json:"create_time,omitempty"` // UUID identifying the dashboard. - // Wire name: 'dashboard_id' DashboardId string `json:"dashboard_id,omitempty"` // The display name of the dashboard. - // Wire name: 'display_name' DisplayName string `json:"display_name,omitempty"` // The etag for the dashboard. Can be optionally provided on updates to // ensure that the dashboard has not been modified since the last read. This // field is excluded in List Dashboards responses. - // Wire name: 'etag' Etag string `json:"etag,omitempty"` // The state of the dashboard resource. Used for tracking trashed status. - // Wire name: 'lifecycle_state' LifecycleState LifecycleState `json:"lifecycle_state,omitempty"` // The workspace path of the folder containing the dashboard. Includes // leading slash and no trailing slash. This field is excluded in List // Dashboards responses. - // Wire name: 'parent_path' ParentPath string `json:"parent_path,omitempty"` // The workspace path of the dashboard asset, including the file name. // Exported dashboards always have the file extension `.lvdash.json`. This // field is excluded in List Dashboards responses. - // Wire name: 'path' Path string `json:"path,omitempty"` // The contents of the dashboard in serialized string form. This field is // excluded in List Dashboards responses. Use the [get dashboard API] to @@ -267,42 +115,22 @@ type Dashboard struct { // represents the dashboard's layout and components. // // [get dashboard API]: https://docs.databricks.com/api/workspace/lakeview/get - // Wire name: 'serialized_dashboard' SerializedDashboard string `json:"serialized_dashboard,omitempty"` // The timestamp of when the dashboard was last updated by the user. This // field is excluded in List Dashboards responses. - // Wire name: 'update_time' UpdateTime string `json:"update_time,omitempty"` // The warehouse ID used to run the dashboard. - // Wire name: 'warehouse_id' WarehouseId string `json:"warehouse_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *Dashboard) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &dashboardPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := dashboardFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *Dashboard) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st Dashboard) MarshalJSON() ([]byte, error) { - pb, err := dashboardToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s Dashboard) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type DashboardView string @@ -342,790 +170,295 @@ func (f *DashboardView) Type() string { // Delete dashboard schedule type DeleteScheduleRequest struct { // UUID identifying the dashboard to which the schedule belongs. - DashboardId string `json:"-" tf:"-"` + DashboardId string `json:"-" url:"-"` // The etag for the schedule. Optionally, it can be provided to verify that // the schedule has not been modified from its last retrieval. - Etag string `json:"-" tf:"-"` + Etag string `json:"-" url:"etag,omitempty"` // UUID identifying the schedule. - ScheduleId string `json:"-" tf:"-"` + ScheduleId string `json:"-" url:"-"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DeleteScheduleRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteScheduleRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteScheduleRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DeleteScheduleRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DeleteScheduleRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteScheduleRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DeleteScheduleRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type DeleteScheduleResponse struct { } -func (st *DeleteScheduleResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteScheduleResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteScheduleResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteScheduleResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteScheduleResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Delete schedule subscription type DeleteSubscriptionRequest struct { // UUID identifying the dashboard which the subscription belongs. - DashboardId string `json:"-" tf:"-"` + DashboardId string `json:"-" url:"-"` // The etag for the subscription. Can be optionally provided to ensure that // the subscription has not been modified since the last read. - Etag string `json:"-" tf:"-"` + Etag string `json:"-" url:"etag,omitempty"` // UUID identifying the schedule which the subscription belongs. - ScheduleId string `json:"-" tf:"-"` + ScheduleId string `json:"-" url:"-"` // UUID identifying the subscription. - SubscriptionId string `json:"-" tf:"-"` + SubscriptionId string `json:"-" url:"-"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DeleteSubscriptionRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteSubscriptionRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteSubscriptionRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DeleteSubscriptionRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DeleteSubscriptionRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteSubscriptionRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DeleteSubscriptionRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type DeleteSubscriptionResponse struct { } -func (st *DeleteSubscriptionResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteSubscriptionResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteSubscriptionResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteSubscriptionResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteSubscriptionResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Genie AI Response type GenieAttachment struct { // Attachment ID - // Wire name: 'attachment_id' AttachmentId string `json:"attachment_id,omitempty"` // Query Attachment if Genie responds with a SQL query - // Wire name: 'query' Query *GenieQueryAttachment `json:"query,omitempty"` // Text Attachment if Genie responds with text - // Wire name: 'text' Text *TextAttachment `json:"text,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GenieAttachment) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &genieAttachmentPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := genieAttachmentFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GenieAttachment) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GenieAttachment) MarshalJSON() ([]byte, error) { - pb, err := genieAttachmentToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GenieAttachment) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type GenieConversation struct { // Conversation ID - // Wire name: 'conversation_id' ConversationId string `json:"conversation_id"` // Timestamp when the message was created - // Wire name: 'created_timestamp' CreatedTimestamp int64 `json:"created_timestamp,omitempty"` // Conversation ID. Legacy identifier, use conversation_id instead - // Wire name: 'id' Id string `json:"id"` // Timestamp when the message was last updated - // Wire name: 'last_updated_timestamp' LastUpdatedTimestamp int64 `json:"last_updated_timestamp,omitempty"` // Genie space ID - // Wire name: 'space_id' SpaceId string `json:"space_id"` // Conversation title - // Wire name: 'title' Title string `json:"title"` // ID of the user who created the conversation - // Wire name: 'user_id' UserId int `json:"user_id"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GenieConversation) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &genieConversationPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := genieConversationFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GenieConversation) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GenieConversation) MarshalJSON() ([]byte, error) { - pb, err := genieConversationToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GenieConversation) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type GenieCreateConversationMessageRequest struct { // User message content. - // Wire name: 'content' Content string `json:"content"` // The ID associated with the conversation. - ConversationId string `json:"-" tf:"-"` + ConversationId string `json:"-" url:"-"` // The ID associated with the Genie space where the conversation is started. - SpaceId string `json:"-" tf:"-"` -} - -func (st *GenieCreateConversationMessageRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &genieCreateConversationMessageRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := genieCreateConversationMessageRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GenieCreateConversationMessageRequest) MarshalJSON() ([]byte, error) { - pb, err := genieCreateConversationMessageRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + SpaceId string `json:"-" url:"-"` } // Execute message attachment SQL query type GenieExecuteMessageAttachmentQueryRequest struct { // Attachment ID - AttachmentId string `json:"-" tf:"-"` + AttachmentId string `json:"-" url:"-"` // Conversation ID - ConversationId string `json:"-" tf:"-"` + ConversationId string `json:"-" url:"-"` // Message ID - MessageId string `json:"-" tf:"-"` + MessageId string `json:"-" url:"-"` // Genie space ID - SpaceId string `json:"-" tf:"-"` -} - -func (st *GenieExecuteMessageAttachmentQueryRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &genieExecuteMessageAttachmentQueryRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := genieExecuteMessageAttachmentQueryRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GenieExecuteMessageAttachmentQueryRequest) MarshalJSON() ([]byte, error) { - pb, err := genieExecuteMessageAttachmentQueryRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + SpaceId string `json:"-" url:"-"` } // [Deprecated] Execute SQL query in a conversation message type GenieExecuteMessageQueryRequest struct { // Conversation ID - ConversationId string `json:"-" tf:"-"` + ConversationId string `json:"-" url:"-"` // Message ID - MessageId string `json:"-" tf:"-"` + MessageId string `json:"-" url:"-"` // Genie space ID - SpaceId string `json:"-" tf:"-"` -} - -func (st *GenieExecuteMessageQueryRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &genieExecuteMessageQueryRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := genieExecuteMessageQueryRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GenieExecuteMessageQueryRequest) MarshalJSON() ([]byte, error) { - pb, err := genieExecuteMessageQueryRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + SpaceId string `json:"-" url:"-"` } // Generate full query result download type GenieGenerateDownloadFullQueryResultRequest struct { // Attachment ID - AttachmentId string `json:"-" tf:"-"` + AttachmentId string `json:"-" url:"-"` // Conversation ID - ConversationId string `json:"-" tf:"-"` + ConversationId string `json:"-" url:"-"` // Message ID - MessageId string `json:"-" tf:"-"` + MessageId string `json:"-" url:"-"` // Genie space ID - SpaceId string `json:"-" tf:"-"` -} - -func (st *GenieGenerateDownloadFullQueryResultRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &genieGenerateDownloadFullQueryResultRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := genieGenerateDownloadFullQueryResultRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GenieGenerateDownloadFullQueryResultRequest) MarshalJSON() ([]byte, error) { - pb, err := genieGenerateDownloadFullQueryResultRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + SpaceId string `json:"-" url:"-"` } type GenieGenerateDownloadFullQueryResultResponse struct { // Download ID. Use this ID to track the download request in subsequent // polling calls - // Wire name: 'download_id' DownloadId string `json:"download_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GenieGenerateDownloadFullQueryResultResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &genieGenerateDownloadFullQueryResultResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := genieGenerateDownloadFullQueryResultResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GenieGenerateDownloadFullQueryResultResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GenieGenerateDownloadFullQueryResultResponse) MarshalJSON() ([]byte, error) { - pb, err := genieGenerateDownloadFullQueryResultResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GenieGenerateDownloadFullQueryResultResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get conversation message type GenieGetConversationMessageRequest struct { // The ID associated with the target conversation. - ConversationId string `json:"-" tf:"-"` + ConversationId string `json:"-" url:"-"` // The ID associated with the target message from the identified // conversation. - MessageId string `json:"-" tf:"-"` + MessageId string `json:"-" url:"-"` // The ID associated with the Genie space where the target conversation is // located. - SpaceId string `json:"-" tf:"-"` -} - -func (st *GenieGetConversationMessageRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &genieGetConversationMessageRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := genieGetConversationMessageRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GenieGetConversationMessageRequest) MarshalJSON() ([]byte, error) { - pb, err := genieGetConversationMessageRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + SpaceId string `json:"-" url:"-"` } // Get download full query result type GenieGetDownloadFullQueryResultRequest struct { // Attachment ID - AttachmentId string `json:"-" tf:"-"` + AttachmentId string `json:"-" url:"-"` // Conversation ID - ConversationId string `json:"-" tf:"-"` + ConversationId string `json:"-" url:"-"` // Download ID. This ID is provided by the [Generate Download // endpoint](:method:genie/generateDownloadFullQueryResult) - DownloadId string `json:"-" tf:"-"` + DownloadId string `json:"-" url:"-"` // Message ID - MessageId string `json:"-" tf:"-"` + MessageId string `json:"-" url:"-"` // Genie space ID - SpaceId string `json:"-" tf:"-"` -} - -func (st *GenieGetDownloadFullQueryResultRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &genieGetDownloadFullQueryResultRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := genieGetDownloadFullQueryResultRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GenieGetDownloadFullQueryResultRequest) MarshalJSON() ([]byte, error) { - pb, err := genieGetDownloadFullQueryResultRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + SpaceId string `json:"-" url:"-"` } type GenieGetDownloadFullQueryResultResponse struct { // SQL Statement Execution response. See [Get status, manifest, and result // first chunk](:method:statementexecution/getstatement) for more details. - // Wire name: 'statement_response' StatementResponse *sql.StatementResponse `json:"statement_response,omitempty"` } -func (st *GenieGetDownloadFullQueryResultResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &genieGetDownloadFullQueryResultResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := genieGetDownloadFullQueryResultResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GenieGetDownloadFullQueryResultResponse) MarshalJSON() ([]byte, error) { - pb, err := genieGetDownloadFullQueryResultResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Get message attachment SQL query result type GenieGetMessageAttachmentQueryResultRequest struct { // Attachment ID - AttachmentId string `json:"-" tf:"-"` + AttachmentId string `json:"-" url:"-"` // Conversation ID - ConversationId string `json:"-" tf:"-"` + ConversationId string `json:"-" url:"-"` // Message ID - MessageId string `json:"-" tf:"-"` + MessageId string `json:"-" url:"-"` // Genie space ID - SpaceId string `json:"-" tf:"-"` -} - -func (st *GenieGetMessageAttachmentQueryResultRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &genieGetMessageAttachmentQueryResultRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := genieGetMessageAttachmentQueryResultRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GenieGetMessageAttachmentQueryResultRequest) MarshalJSON() ([]byte, error) { - pb, err := genieGetMessageAttachmentQueryResultRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + SpaceId string `json:"-" url:"-"` } // [Deprecated] Get conversation message SQL query result type GenieGetMessageQueryResultRequest struct { // Conversation ID - ConversationId string `json:"-" tf:"-"` + ConversationId string `json:"-" url:"-"` // Message ID - MessageId string `json:"-" tf:"-"` + MessageId string `json:"-" url:"-"` // Genie space ID - SpaceId string `json:"-" tf:"-"` -} - -func (st *GenieGetMessageQueryResultRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &genieGetMessageQueryResultRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := genieGetMessageQueryResultRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GenieGetMessageQueryResultRequest) MarshalJSON() ([]byte, error) { - pb, err := genieGetMessageQueryResultRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + SpaceId string `json:"-" url:"-"` } type GenieGetMessageQueryResultResponse struct { // SQL Statement Execution response. See [Get status, manifest, and result // first chunk](:method:statementexecution/getstatement) for more details. - // Wire name: 'statement_response' StatementResponse *sql.StatementResponse `json:"statement_response,omitempty"` } -func (st *GenieGetMessageQueryResultResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &genieGetMessageQueryResultResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := genieGetMessageQueryResultResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GenieGetMessageQueryResultResponse) MarshalJSON() ([]byte, error) { - pb, err := genieGetMessageQueryResultResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // [Deprecated] Get conversation message SQL query result type GenieGetQueryResultByAttachmentRequest struct { // Attachment ID - AttachmentId string `json:"-" tf:"-"` + AttachmentId string `json:"-" url:"-"` // Conversation ID - ConversationId string `json:"-" tf:"-"` + ConversationId string `json:"-" url:"-"` // Message ID - MessageId string `json:"-" tf:"-"` + MessageId string `json:"-" url:"-"` // Genie space ID - SpaceId string `json:"-" tf:"-"` -} - -func (st *GenieGetQueryResultByAttachmentRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &genieGetQueryResultByAttachmentRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := genieGetQueryResultByAttachmentRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GenieGetQueryResultByAttachmentRequest) MarshalJSON() ([]byte, error) { - pb, err := genieGetQueryResultByAttachmentRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + SpaceId string `json:"-" url:"-"` } // Get Genie Space type GenieGetSpaceRequest struct { // The ID associated with the Genie space - SpaceId string `json:"-" tf:"-"` -} - -func (st *GenieGetSpaceRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &genieGetSpaceRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := genieGetSpaceRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GenieGetSpaceRequest) MarshalJSON() ([]byte, error) { - pb, err := genieGetSpaceRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + SpaceId string `json:"-" url:"-"` } // List Genie spaces type GenieListSpacesRequest struct { // Maximum number of spaces to return per page - PageSize int `json:"-" tf:"-"` + PageSize int `json:"-" url:"page_size,omitempty"` // Pagination token for getting the next page of results - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GenieListSpacesRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &genieListSpacesRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := genieListSpacesRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GenieListSpacesRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GenieListSpacesRequest) MarshalJSON() ([]byte, error) { - pb, err := genieListSpacesRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GenieListSpacesRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type GenieListSpacesResponse struct { // Token to get the next page of results - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` // List of Genie spaces - // Wire name: 'spaces' Spaces []GenieSpace `json:"spaces,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GenieListSpacesResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &genieListSpacesResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := genieListSpacesResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GenieListSpacesResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GenieListSpacesResponse) MarshalJSON() ([]byte, error) { - pb, err := genieListSpacesResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GenieListSpacesResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type GenieMessage struct { // AI-generated response to the message - // Wire name: 'attachments' Attachments []GenieAttachment `json:"attachments,omitempty"` // User message content - // Wire name: 'content' Content string `json:"content"` // Conversation ID - // Wire name: 'conversation_id' ConversationId string `json:"conversation_id"` // Timestamp when the message was created - // Wire name: 'created_timestamp' CreatedTimestamp int64 `json:"created_timestamp,omitempty"` // Error message if Genie failed to respond to the message - // Wire name: 'error' Error *MessageError `json:"error,omitempty"` // Message ID. Legacy identifier, use message_id instead - // Wire name: 'id' Id string `json:"id"` // Timestamp when the message was last updated - // Wire name: 'last_updated_timestamp' LastUpdatedTimestamp int64 `json:"last_updated_timestamp,omitempty"` // Message ID - // Wire name: 'message_id' MessageId string `json:"message_id"` // The result of SQL query if the message includes a query attachment. // Deprecated. Use `query_result_metadata` in `GenieQueryAttachment` // instead. - // Wire name: 'query_result' QueryResult *Result `json:"query_result,omitempty"` // Genie space ID - // Wire name: 'space_id' SpaceId string `json:"space_id"` // MessageStatus. The possible values are: * `FETCHING_METADATA`: Fetching // metadata from the data sources. * `FILTERING_CONTEXT`: Running smart @@ -1144,450 +477,175 @@ type GenieMessage struct { // Rerun the SQL query result by calling // [executeMessageAttachmentQuery](:method:genie/executeMessageAttachmentQuery) // API. * `CANCELLED`: Message has been cancelled. - // Wire name: 'status' Status MessageStatus `json:"status,omitempty"` // ID of the user who created the message - // Wire name: 'user_id' UserId int64 `json:"user_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GenieMessage) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &genieMessagePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := genieMessageFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GenieMessage) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GenieMessage) MarshalJSON() ([]byte, error) { - pb, err := genieMessageToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GenieMessage) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type GenieQueryAttachment struct { // Description of the query - // Wire name: 'description' Description string `json:"description,omitempty"` - // Wire name: 'id' Id string `json:"id,omitempty"` // Time when the user updated the query last - // Wire name: 'last_updated_timestamp' LastUpdatedTimestamp int64 `json:"last_updated_timestamp,omitempty"` // AI generated SQL query - // Wire name: 'query' Query string `json:"query,omitempty"` // Metadata associated with the query result. - // Wire name: 'query_result_metadata' QueryResultMetadata *GenieResultMetadata `json:"query_result_metadata,omitempty"` // Statement Execution API statement id. Use [Get status, manifest, and // result first chunk](:method:statementexecution/getstatement) to get the // full result data. - // Wire name: 'statement_id' StatementId string `json:"statement_id,omitempty"` // Name of the query - // Wire name: 'title' Title string `json:"title,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GenieQueryAttachment) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &genieQueryAttachmentPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := genieQueryAttachmentFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GenieQueryAttachment) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GenieQueryAttachment) MarshalJSON() ([]byte, error) { - pb, err := genieQueryAttachmentToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GenieQueryAttachment) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type GenieResultMetadata struct { // Indicates whether the result set is truncated. - // Wire name: 'is_truncated' IsTruncated bool `json:"is_truncated,omitempty"` // The number of rows in the result set. - // Wire name: 'row_count' RowCount int64 `json:"row_count,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GenieResultMetadata) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &genieResultMetadataPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := genieResultMetadataFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GenieResultMetadata) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GenieResultMetadata) MarshalJSON() ([]byte, error) { - pb, err := genieResultMetadataToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GenieResultMetadata) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type GenieSpace struct { // Description of the Genie Space - // Wire name: 'description' Description string `json:"description,omitempty"` // Genie space ID - // Wire name: 'space_id' SpaceId string `json:"space_id"` // Title of the Genie Space - // Wire name: 'title' Title string `json:"title"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GenieSpace) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &genieSpacePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := genieSpaceFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GenieSpace) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GenieSpace) MarshalJSON() ([]byte, error) { - pb, err := genieSpaceToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GenieSpace) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type GenieStartConversationMessageRequest struct { // The text of the message that starts the conversation. - // Wire name: 'content' Content string `json:"content"` // The ID associated with the Genie space where you want to start a // conversation. - SpaceId string `json:"-" tf:"-"` -} - -func (st *GenieStartConversationMessageRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &genieStartConversationMessageRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := genieStartConversationMessageRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GenieStartConversationMessageRequest) MarshalJSON() ([]byte, error) { - pb, err := genieStartConversationMessageRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + SpaceId string `json:"-" url:"-"` } type GenieStartConversationResponse struct { - - // Wire name: 'conversation' Conversation *GenieConversation `json:"conversation,omitempty"` // Conversation ID - // Wire name: 'conversation_id' ConversationId string `json:"conversation_id"` - // Wire name: 'message' Message *GenieMessage `json:"message,omitempty"` // Message ID - // Wire name: 'message_id' MessageId string `json:"message_id"` } -func (st *GenieStartConversationResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &genieStartConversationResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := genieStartConversationResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GenieStartConversationResponse) MarshalJSON() ([]byte, error) { - pb, err := genieStartConversationResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Get dashboard type GetDashboardRequest struct { // UUID identifying the dashboard. - DashboardId string `json:"-" tf:"-"` -} - -func (st *GetDashboardRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getDashboardRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getDashboardRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetDashboardRequest) MarshalJSON() ([]byte, error) { - pb, err := getDashboardRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + DashboardId string `json:"-" url:"-"` } // Get published dashboard type GetPublishedDashboardRequest struct { // UUID identifying the published dashboard. - DashboardId string `json:"-" tf:"-"` -} - -func (st *GetPublishedDashboardRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getPublishedDashboardRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getPublishedDashboardRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetPublishedDashboardRequest) MarshalJSON() ([]byte, error) { - pb, err := getPublishedDashboardRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + DashboardId string `json:"-" url:"-"` } // Read an information of a published dashboard to mint an OAuth token. type GetPublishedDashboardTokenInfoRequest struct { // UUID identifying the published dashboard. - DashboardId string `json:"-" tf:"-"` + DashboardId string `json:"-" url:"-"` // Provided external value to be included in the custom claim. - ExternalValue string `json:"-" tf:"-"` + ExternalValue string `json:"-" url:"external_value,omitempty"` // Provided external viewer id to be included in the custom claim. - ExternalViewerId string `json:"-" tf:"-"` + ExternalViewerId string `json:"-" url:"external_viewer_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetPublishedDashboardTokenInfoRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getPublishedDashboardTokenInfoRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getPublishedDashboardTokenInfoRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetPublishedDashboardTokenInfoRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetPublishedDashboardTokenInfoRequest) MarshalJSON() ([]byte, error) { - pb, err := getPublishedDashboardTokenInfoRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetPublishedDashboardTokenInfoRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type GetPublishedDashboardTokenInfoResponse struct { // Authorization constraints for accessing the published dashboard. // Currently includes `workspace_rule_set` and could be enriched with // `unity_catalog_privileges` before oAuth token generation. - // Wire name: 'authorization_details' AuthorizationDetails []AuthorizationDetails `json:"authorization_details,omitempty"` // Custom claim generated from external_value and external_viewer_id. // Format: // `urn:aibi:external_data:::` - // Wire name: 'custom_claim' CustomClaim string `json:"custom_claim,omitempty"` // Scope defining access permissions. - // Wire name: 'scope' Scope string `json:"scope,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetPublishedDashboardTokenInfoResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getPublishedDashboardTokenInfoResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getPublishedDashboardTokenInfoResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetPublishedDashboardTokenInfoResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetPublishedDashboardTokenInfoResponse) MarshalJSON() ([]byte, error) { - pb, err := getPublishedDashboardTokenInfoResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetPublishedDashboardTokenInfoResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get dashboard schedule type GetScheduleRequest struct { // UUID identifying the dashboard to which the schedule belongs. - DashboardId string `json:"-" tf:"-"` + DashboardId string `json:"-" url:"-"` // UUID identifying the schedule. - ScheduleId string `json:"-" tf:"-"` -} - -func (st *GetScheduleRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getScheduleRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getScheduleRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetScheduleRequest) MarshalJSON() ([]byte, error) { - pb, err := getScheduleRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + ScheduleId string `json:"-" url:"-"` } // Get schedule subscription type GetSubscriptionRequest struct { // UUID identifying the dashboard which the subscription belongs. - DashboardId string `json:"-" tf:"-"` + DashboardId string `json:"-" url:"-"` // UUID identifying the schedule which the subscription belongs. - ScheduleId string `json:"-" tf:"-"` + ScheduleId string `json:"-" url:"-"` // UUID identifying the subscription. - SubscriptionId string `json:"-" tf:"-"` -} - -func (st *GetSubscriptionRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getSubscriptionRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getSubscriptionRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetSubscriptionRequest) MarshalJSON() ([]byte, error) { - pb, err := getSubscriptionRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + SubscriptionId string `json:"-" url:"-"` } type LifecycleState string @@ -1630,269 +688,140 @@ func (f *LifecycleState) Type() string { // List dashboards type ListDashboardsRequest struct { // The number of dashboards to return per page. - PageSize int `json:"-" tf:"-"` + PageSize int `json:"-" url:"page_size,omitempty"` // A page token, received from a previous `ListDashboards` call. This token // can be used to retrieve the subsequent page. - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` // The flag to include dashboards located in the trash. If unspecified, only // active dashboards will be returned. - ShowTrashed bool `json:"-" tf:"-"` + ShowTrashed bool `json:"-" url:"show_trashed,omitempty"` // `DASHBOARD_VIEW_BASIC`only includes summary metadata from the dashboard. - View DashboardView `json:"-" tf:"-"` + View DashboardView `json:"-" url:"view,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListDashboardsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listDashboardsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listDashboardsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListDashboardsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListDashboardsRequest) MarshalJSON() ([]byte, error) { - pb, err := listDashboardsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListDashboardsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListDashboardsResponse struct { - - // Wire name: 'dashboards' Dashboards []Dashboard `json:"dashboards,omitempty"` // A token, which can be sent as `page_token` to retrieve the next page. If // this field is omitted, there are no subsequent dashboards. - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListDashboardsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listDashboardsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listDashboardsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListDashboardsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListDashboardsResponse) MarshalJSON() ([]byte, error) { - pb, err := listDashboardsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListDashboardsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // List dashboard schedules type ListSchedulesRequest struct { // UUID identifying the dashboard to which the schedules belongs. - DashboardId string `json:"-" tf:"-"` + DashboardId string `json:"-" url:"-"` // The number of schedules to return per page. - PageSize int `json:"-" tf:"-"` + PageSize int `json:"-" url:"page_size,omitempty"` // A page token, received from a previous `ListSchedules` call. Use this to // retrieve the subsequent page. - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListSchedulesRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listSchedulesRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listSchedulesRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListSchedulesRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListSchedulesRequest) MarshalJSON() ([]byte, error) { - pb, err := listSchedulesRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListSchedulesRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListSchedulesResponse struct { // A token that can be used as a `page_token` in subsequent requests to // retrieve the next page of results. If this field is omitted, there are no // subsequent schedules. - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` - // Wire name: 'schedules' Schedules []Schedule `json:"schedules,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListSchedulesResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listSchedulesResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listSchedulesResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListSchedulesResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListSchedulesResponse) MarshalJSON() ([]byte, error) { - pb, err := listSchedulesResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListSchedulesResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // List schedule subscriptions type ListSubscriptionsRequest struct { // UUID identifying the dashboard which the subscriptions belongs. - DashboardId string `json:"-" tf:"-"` + DashboardId string `json:"-" url:"-"` // The number of subscriptions to return per page. - PageSize int `json:"-" tf:"-"` + PageSize int `json:"-" url:"page_size,omitempty"` // A page token, received from a previous `ListSubscriptions` call. Use this // to retrieve the subsequent page. - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` // UUID identifying the schedule which the subscriptions belongs. - ScheduleId string `json:"-" tf:"-"` + ScheduleId string `json:"-" url:"-"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListSubscriptionsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listSubscriptionsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listSubscriptionsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListSubscriptionsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListSubscriptionsRequest) MarshalJSON() ([]byte, error) { - pb, err := listSubscriptionsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListSubscriptionsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListSubscriptionsResponse struct { // A token that can be used as a `page_token` in subsequent requests to // retrieve the next page of results. If this field is omitted, there are no // subsequent subscriptions. - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` - // Wire name: 'subscriptions' Subscriptions []Subscription `json:"subscriptions,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListSubscriptionsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listSubscriptionsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listSubscriptionsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListSubscriptionsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListSubscriptionsResponse) MarshalJSON() ([]byte, error) { - pb, err := listSubscriptionsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListSubscriptionsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type MessageError struct { - - // Wire name: 'error' Error string `json:"error,omitempty"` - // Wire name: 'type' Type MessageErrorType `json:"type,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *MessageError) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &messageErrorPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := messageErrorFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *MessageError) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st MessageError) MarshalJSON() ([]byte, error) { - pb, err := messageErrorToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s MessageError) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type MessageErrorType string @@ -2182,231 +1111,124 @@ func (f *MessageStatus) Type() string { type MigrateDashboardRequest struct { // Display name for the new Lakeview dashboard. - // Wire name: 'display_name' DisplayName string `json:"display_name,omitempty"` // The workspace path of the folder to contain the migrated Lakeview // dashboard. - // Wire name: 'parent_path' ParentPath string `json:"parent_path,omitempty"` // UUID of the dashboard to be migrated. - // Wire name: 'source_dashboard_id' SourceDashboardId string `json:"source_dashboard_id"` // Flag to indicate if mustache parameter syntax ({{ param }}) should be // auto-updated to named syntax (:param) when converting datasets in the // dashboard. - // Wire name: 'update_parameter_syntax' UpdateParameterSyntax bool `json:"update_parameter_syntax,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *MigrateDashboardRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &migrateDashboardRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := migrateDashboardRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *MigrateDashboardRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st MigrateDashboardRequest) MarshalJSON() ([]byte, error) { - pb, err := migrateDashboardRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s MigrateDashboardRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type PublishRequest struct { // UUID identifying the dashboard to be published. - DashboardId string `json:"-" tf:"-"` + DashboardId string `json:"-" url:"-"` // Flag to indicate if the publisher's credentials should be embedded in the // published dashboard. These embedded credentials will be used to execute // the published dashboard's queries. - // Wire name: 'embed_credentials' EmbedCredentials bool `json:"embed_credentials,omitempty"` // The ID of the warehouse that can be used to override the warehouse which // was set in the draft. - // Wire name: 'warehouse_id' WarehouseId string `json:"warehouse_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *PublishRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &publishRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := publishRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *PublishRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st PublishRequest) MarshalJSON() ([]byte, error) { - pb, err := publishRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s PublishRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type PublishedDashboard struct { // The display name of the published dashboard. - // Wire name: 'display_name' DisplayName string `json:"display_name,omitempty"` // Indicates whether credentials are embedded in the published dashboard. - // Wire name: 'embed_credentials' EmbedCredentials bool `json:"embed_credentials,omitempty"` // The timestamp of when the published dashboard was last revised. - // Wire name: 'revision_create_time' RevisionCreateTime string `json:"revision_create_time,omitempty"` // The warehouse ID used to run the published dashboard. - // Wire name: 'warehouse_id' WarehouseId string `json:"warehouse_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *PublishedDashboard) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &publishedDashboardPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := publishedDashboardFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *PublishedDashboard) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st PublishedDashboard) MarshalJSON() ([]byte, error) { - pb, err := publishedDashboardToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s PublishedDashboard) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type Result struct { // If result is truncated - // Wire name: 'is_truncated' IsTruncated bool `json:"is_truncated,omitempty"` // Row count of the result - // Wire name: 'row_count' RowCount int64 `json:"row_count,omitempty"` // Statement Execution API statement id. Use [Get status, manifest, and // result first chunk](:method:statementexecution/getstatement) to get the // full result data. - // Wire name: 'statement_id' StatementId string `json:"statement_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *Result) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &resultPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := resultFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *Result) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st Result) MarshalJSON() ([]byte, error) { - pb, err := resultToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s Result) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type Schedule struct { // A timestamp indicating when the schedule was created. - // Wire name: 'create_time' CreateTime string `json:"create_time,omitempty"` // The cron expression describing the frequency of the periodic refresh for // this schedule. - // Wire name: 'cron_schedule' CronSchedule CronSchedule `json:"cron_schedule"` // UUID identifying the dashboard to which the schedule belongs. - // Wire name: 'dashboard_id' DashboardId string `json:"dashboard_id,omitempty"` // The display name for schedule. - // Wire name: 'display_name' DisplayName string `json:"display_name,omitempty"` // The etag for the schedule. Must be left empty on create, must be provided // on updates to ensure that the schedule has not been modified since the // last read, and can be optionally provided on delete. - // Wire name: 'etag' Etag string `json:"etag,omitempty"` // The status indicates whether this schedule is paused or not. - // Wire name: 'pause_status' PauseStatus SchedulePauseStatus `json:"pause_status,omitempty"` // UUID identifying the schedule. - // Wire name: 'schedule_id' ScheduleId string `json:"schedule_id,omitempty"` // A timestamp indicating when the schedule was last updated. - // Wire name: 'update_time' UpdateTime string `json:"update_time,omitempty"` // The warehouse id to run the dashboard with for the schedule. - // Wire name: 'warehouse_id' WarehouseId string `json:"warehouse_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *Schedule) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &schedulePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := scheduleFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *Schedule) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st Schedule) MarshalJSON() ([]byte, error) { - pb, err := scheduleToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s Schedule) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type SchedulePauseStatus string @@ -2449,380 +1271,104 @@ func (f *SchedulePauseStatus) Type() string { type Subscriber struct { // The destination to receive the subscription email. This parameter is // mutually exclusive with `user_subscriber`. - // Wire name: 'destination_subscriber' DestinationSubscriber *SubscriptionSubscriberDestination `json:"destination_subscriber,omitempty"` // The user to receive the subscription email. This parameter is mutually // exclusive with `destination_subscriber`. - // Wire name: 'user_subscriber' UserSubscriber *SubscriptionSubscriberUser `json:"user_subscriber,omitempty"` } -func (st *Subscriber) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &subscriberPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := subscriberFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st Subscriber) MarshalJSON() ([]byte, error) { - pb, err := subscriberToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type Subscription struct { // A timestamp indicating when the subscription was created. - // Wire name: 'create_time' CreateTime string `json:"create_time,omitempty"` // UserId of the user who adds subscribers (users or notification // destinations) to the dashboard's schedule. - // Wire name: 'created_by_user_id' CreatedByUserId int64 `json:"created_by_user_id,omitempty"` // UUID identifying the dashboard to which the subscription belongs. - // Wire name: 'dashboard_id' DashboardId string `json:"dashboard_id,omitempty"` // The etag for the subscription. Must be left empty on create, can be // optionally provided on delete to ensure that the subscription has not // been deleted since the last read. - // Wire name: 'etag' Etag string `json:"etag,omitempty"` // UUID identifying the schedule to which the subscription belongs. - // Wire name: 'schedule_id' ScheduleId string `json:"schedule_id,omitempty"` // Subscriber details for users and destinations to be added as subscribers // to the schedule. - // Wire name: 'subscriber' Subscriber Subscriber `json:"subscriber"` // UUID identifying the subscription. - // Wire name: 'subscription_id' SubscriptionId string `json:"subscription_id,omitempty"` // A timestamp indicating when the subscription was last updated. - // Wire name: 'update_time' UpdateTime string `json:"update_time,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *Subscription) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &subscriptionPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := subscriptionFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *Subscription) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st Subscription) MarshalJSON() ([]byte, error) { - pb, err := subscriptionToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s Subscription) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type SubscriptionSubscriberDestination struct { // The canonical identifier of the destination to receive email // notification. - // Wire name: 'destination_id' DestinationId string `json:"destination_id"` } -func (st *SubscriptionSubscriberDestination) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &subscriptionSubscriberDestinationPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := subscriptionSubscriberDestinationFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st SubscriptionSubscriberDestination) MarshalJSON() ([]byte, error) { - pb, err := subscriptionSubscriberDestinationToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type SubscriptionSubscriberUser struct { // UserId of the subscriber. - // Wire name: 'user_id' UserId int64 `json:"user_id"` } -func (st *SubscriptionSubscriberUser) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &subscriptionSubscriberUserPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := subscriptionSubscriberUserFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st SubscriptionSubscriberUser) MarshalJSON() ([]byte, error) { - pb, err := subscriptionSubscriberUserToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type TextAttachment struct { // AI generated message - // Wire name: 'content' Content string `json:"content,omitempty"` - // Wire name: 'id' Id string `json:"id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *TextAttachment) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &textAttachmentPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := textAttachmentFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *TextAttachment) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st TextAttachment) MarshalJSON() ([]byte, error) { - pb, err := textAttachmentToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s TextAttachment) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Trash dashboard type TrashDashboardRequest struct { // UUID identifying the dashboard. - DashboardId string `json:"-" tf:"-"` -} - -func (st *TrashDashboardRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &trashDashboardRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := trashDashboardRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st TrashDashboardRequest) MarshalJSON() ([]byte, error) { - pb, err := trashDashboardRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + DashboardId string `json:"-" url:"-"` } type TrashDashboardResponse struct { } -func (st *TrashDashboardResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &trashDashboardResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := trashDashboardResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st TrashDashboardResponse) MarshalJSON() ([]byte, error) { - pb, err := trashDashboardResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Unpublish dashboard type UnpublishDashboardRequest struct { // UUID identifying the published dashboard. - DashboardId string `json:"-" tf:"-"` -} - -func (st *UnpublishDashboardRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &unpublishDashboardRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := unpublishDashboardRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UnpublishDashboardRequest) MarshalJSON() ([]byte, error) { - pb, err := unpublishDashboardRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + DashboardId string `json:"-" url:"-"` } type UnpublishDashboardResponse struct { } -func (st *UnpublishDashboardResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &unpublishDashboardResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := unpublishDashboardResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UnpublishDashboardResponse) MarshalJSON() ([]byte, error) { - pb, err := unpublishDashboardResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Update dashboard type UpdateDashboardRequest struct { - - // Wire name: 'dashboard' Dashboard Dashboard `json:"dashboard"` // UUID identifying the dashboard. - DashboardId string `json:"-" tf:"-"` -} - -func (st *UpdateDashboardRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateDashboardRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateDashboardRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateDashboardRequest) MarshalJSON() ([]byte, error) { - pb, err := updateDashboardRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + DashboardId string `json:"-" url:"-"` } // Update dashboard schedule type UpdateScheduleRequest struct { // UUID identifying the dashboard to which the schedule belongs. - DashboardId string `json:"-" tf:"-"` + DashboardId string `json:"-" url:"-"` - // Wire name: 'schedule' Schedule Schedule `json:"schedule"` // UUID identifying the schedule. - ScheduleId string `json:"-" tf:"-"` -} - -func (st *UpdateScheduleRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateScheduleRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateScheduleRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateScheduleRequest) MarshalJSON() ([]byte, error) { - pb, err := updateScheduleRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + ScheduleId string `json:"-" url:"-"` } diff --git a/service/database/impl.go b/service/database/impl.go index bdd817bb0..6339731be 100755 --- a/service/database/impl.go +++ b/service/database/impl.go @@ -18,440 +18,148 @@ type databaseImpl struct { } func (a *databaseImpl) CreateDatabaseCatalog(ctx context.Context, request CreateDatabaseCatalogRequest) (*DatabaseCatalog, error) { - - requestPb, pbErr := createDatabaseCatalogRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var databaseCatalogPb databaseCatalogPb + var databaseCatalog DatabaseCatalog path := "/api/2.0/database/catalogs" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb).Catalog, - &databaseCatalogPb, - ) - if err != nil { - return nil, err - } - resp, err := databaseCatalogFromPb(&databaseCatalogPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.Catalog, &databaseCatalog) + return &databaseCatalog, err } func (a *databaseImpl) CreateDatabaseInstance(ctx context.Context, request CreateDatabaseInstanceRequest) (*DatabaseInstance, error) { - - requestPb, pbErr := createDatabaseInstanceRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var databaseInstancePb databaseInstancePb + var databaseInstance DatabaseInstance path := "/api/2.0/database/instances" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb).DatabaseInstance, - &databaseInstancePb, - ) - if err != nil { - return nil, err - } - resp, err := databaseInstanceFromPb(&databaseInstancePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.DatabaseInstance, &databaseInstance) + return &databaseInstance, err } func (a *databaseImpl) CreateDatabaseTable(ctx context.Context, request CreateDatabaseTableRequest) (*DatabaseTable, error) { - - requestPb, pbErr := createDatabaseTableRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var databaseTablePb databaseTablePb + var databaseTable DatabaseTable path := "/api/2.0/database/tables" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb).Table, - &databaseTablePb, - ) - if err != nil { - return nil, err - } - resp, err := databaseTableFromPb(&databaseTablePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.Table, &databaseTable) + return &databaseTable, err } func (a *databaseImpl) CreateSyncedDatabaseTable(ctx context.Context, request CreateSyncedDatabaseTableRequest) (*SyncedDatabaseTable, error) { - - requestPb, pbErr := createSyncedDatabaseTableRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var syncedDatabaseTablePb syncedDatabaseTablePb + var syncedDatabaseTable SyncedDatabaseTable path := "/api/2.0/database/synced_tables" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb).SyncedTable, - &syncedDatabaseTablePb, - ) - if err != nil { - return nil, err - } - resp, err := syncedDatabaseTableFromPb(&syncedDatabaseTablePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.SyncedTable, &syncedDatabaseTable) + return &syncedDatabaseTable, err } func (a *databaseImpl) DeleteDatabaseCatalog(ctx context.Context, request DeleteDatabaseCatalogRequest) error { - - requestPb, pbErr := deleteDatabaseCatalogRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteDatabaseCatalogResponsePb deleteDatabaseCatalogResponsePb - path := fmt.Sprintf("/api/2.0/database/catalogs/%v", requestPb.Name) + var deleteDatabaseCatalogResponse DeleteDatabaseCatalogResponse + path := fmt.Sprintf("/api/2.0/database/catalogs/%v", request.Name) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteDatabaseCatalogResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteDatabaseCatalogResponse) return err } func (a *databaseImpl) DeleteDatabaseInstance(ctx context.Context, request DeleteDatabaseInstanceRequest) error { - - requestPb, pbErr := deleteDatabaseInstanceRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteDatabaseInstanceResponsePb deleteDatabaseInstanceResponsePb - path := fmt.Sprintf("/api/2.0/database/instances/%v", requestPb.Name) + var deleteDatabaseInstanceResponse DeleteDatabaseInstanceResponse + path := fmt.Sprintf("/api/2.0/database/instances/%v", request.Name) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteDatabaseInstanceResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteDatabaseInstanceResponse) return err } func (a *databaseImpl) DeleteDatabaseTable(ctx context.Context, request DeleteDatabaseTableRequest) error { - - requestPb, pbErr := deleteDatabaseTableRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteDatabaseTableResponsePb deleteDatabaseTableResponsePb - path := fmt.Sprintf("/api/2.0/database/tables/%v", requestPb.Name) + var deleteDatabaseTableResponse DeleteDatabaseTableResponse + path := fmt.Sprintf("/api/2.0/database/tables/%v", request.Name) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteDatabaseTableResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteDatabaseTableResponse) return err } func (a *databaseImpl) DeleteSyncedDatabaseTable(ctx context.Context, request DeleteSyncedDatabaseTableRequest) error { - - requestPb, pbErr := deleteSyncedDatabaseTableRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteSyncedDatabaseTableResponsePb deleteSyncedDatabaseTableResponsePb - path := fmt.Sprintf("/api/2.0/database/synced_tables/%v", requestPb.Name) + var deleteSyncedDatabaseTableResponse DeleteSyncedDatabaseTableResponse + path := fmt.Sprintf("/api/2.0/database/synced_tables/%v", request.Name) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteSyncedDatabaseTableResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteSyncedDatabaseTableResponse) return err } func (a *databaseImpl) FindDatabaseInstanceByUid(ctx context.Context, request FindDatabaseInstanceByUidRequest) (*DatabaseInstance, error) { - - requestPb, pbErr := findDatabaseInstanceByUidRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var databaseInstancePb databaseInstancePb + var databaseInstance DatabaseInstance path := "/api/2.0/database/instances:findByUid" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &databaseInstancePb, - ) - if err != nil { - return nil, err - } - resp, err := databaseInstanceFromPb(&databaseInstancePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &databaseInstance) + return &databaseInstance, err } func (a *databaseImpl) GenerateDatabaseCredential(ctx context.Context, request GenerateDatabaseCredentialRequest) (*DatabaseCredential, error) { - - requestPb, pbErr := generateDatabaseCredentialRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var databaseCredentialPb databaseCredentialPb + var databaseCredential DatabaseCredential path := "/api/2.0/database/credentials" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &databaseCredentialPb, - ) - if err != nil { - return nil, err - } - resp, err := databaseCredentialFromPb(&databaseCredentialPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &databaseCredential) + return &databaseCredential, err } func (a *databaseImpl) GetDatabaseCatalog(ctx context.Context, request GetDatabaseCatalogRequest) (*DatabaseCatalog, error) { - - requestPb, pbErr := getDatabaseCatalogRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var databaseCatalogPb databaseCatalogPb - path := fmt.Sprintf("/api/2.0/database/catalogs/%v", requestPb.Name) + var databaseCatalog DatabaseCatalog + path := fmt.Sprintf("/api/2.0/database/catalogs/%v", request.Name) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &databaseCatalogPb, - ) - if err != nil { - return nil, err - } - resp, err := databaseCatalogFromPb(&databaseCatalogPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &databaseCatalog) + return &databaseCatalog, err } func (a *databaseImpl) GetDatabaseInstance(ctx context.Context, request GetDatabaseInstanceRequest) (*DatabaseInstance, error) { - - requestPb, pbErr := getDatabaseInstanceRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var databaseInstancePb databaseInstancePb - path := fmt.Sprintf("/api/2.0/database/instances/%v", requestPb.Name) + var databaseInstance DatabaseInstance + path := fmt.Sprintf("/api/2.0/database/instances/%v", request.Name) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &databaseInstancePb, - ) - if err != nil { - return nil, err - } - resp, err := databaseInstanceFromPb(&databaseInstancePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &databaseInstance) + return &databaseInstance, err } func (a *databaseImpl) GetDatabaseTable(ctx context.Context, request GetDatabaseTableRequest) (*DatabaseTable, error) { - - requestPb, pbErr := getDatabaseTableRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var databaseTablePb databaseTablePb - path := fmt.Sprintf("/api/2.0/database/tables/%v", requestPb.Name) + var databaseTable DatabaseTable + path := fmt.Sprintf("/api/2.0/database/tables/%v", request.Name) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &databaseTablePb, - ) - if err != nil { - return nil, err - } - resp, err := databaseTableFromPb(&databaseTablePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &databaseTable) + return &databaseTable, err } func (a *databaseImpl) GetSyncedDatabaseTable(ctx context.Context, request GetSyncedDatabaseTableRequest) (*SyncedDatabaseTable, error) { - - requestPb, pbErr := getSyncedDatabaseTableRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var syncedDatabaseTablePb syncedDatabaseTablePb - path := fmt.Sprintf("/api/2.0/database/synced_tables/%v", requestPb.Name) + var syncedDatabaseTable SyncedDatabaseTable + path := fmt.Sprintf("/api/2.0/database/synced_tables/%v", request.Name) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &syncedDatabaseTablePb, - ) - if err != nil { - return nil, err - } - resp, err := syncedDatabaseTableFromPb(&syncedDatabaseTablePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &syncedDatabaseTable) + return &syncedDatabaseTable, err } // List Database Instances. @@ -486,69 +194,25 @@ func (a *databaseImpl) ListDatabaseInstancesAll(ctx context.Context, request Lis } func (a *databaseImpl) internalListDatabaseInstances(ctx context.Context, request ListDatabaseInstancesRequest) (*ListDatabaseInstancesResponse, error) { - - requestPb, pbErr := listDatabaseInstancesRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listDatabaseInstancesResponsePb listDatabaseInstancesResponsePb + var listDatabaseInstancesResponse ListDatabaseInstancesResponse path := "/api/2.0/database/instances" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listDatabaseInstancesResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listDatabaseInstancesResponseFromPb(&listDatabaseInstancesResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listDatabaseInstancesResponse) + return &listDatabaseInstancesResponse, err } func (a *databaseImpl) UpdateDatabaseInstance(ctx context.Context, request UpdateDatabaseInstanceRequest) (*DatabaseInstance, error) { - - requestPb, pbErr := updateDatabaseInstanceRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var databaseInstancePb databaseInstancePb - path := fmt.Sprintf("/api/2.0/database/instances/%v", requestPb.Name) + var databaseInstance DatabaseInstance + path := fmt.Sprintf("/api/2.0/database/instances/%v", request.Name) queryParams := make(map[string]any) - if requestPb.UpdateMask != "" { - queryParams["update_mask"] = requestPb.UpdateMask + if request.UpdateMask != "" { + queryParams["update_mask"] = request.UpdateMask } headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb).DatabaseInstance, - &databaseInstancePb, - ) - if err != nil { - return nil, err - } - resp, err := databaseInstanceFromPb(&databaseInstancePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.DatabaseInstance, &databaseInstance) + return &databaseInstance, err } diff --git a/service/database/internal.go b/service/database/internal.go deleted file mode 100755 index f8b0cac0f..000000000 --- a/service/database/internal.go +++ /dev/null @@ -1,1223 +0,0 @@ -// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. - -package database - -import ( - "fmt" - "strings" - "time" - - "github.com/databricks/databricks-sdk-go/marshal" -) - -func createDatabaseCatalogRequestToPb(st *CreateDatabaseCatalogRequest) (*createDatabaseCatalogRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &createDatabaseCatalogRequestPb{} - pb.Catalog = st.Catalog - - return pb, nil -} - -type createDatabaseCatalogRequestPb struct { - Catalog DatabaseCatalog `json:"catalog"` -} - -func createDatabaseCatalogRequestFromPb(pb *createDatabaseCatalogRequestPb) (*CreateDatabaseCatalogRequest, error) { - if pb == nil { - return nil, nil - } - st := &CreateDatabaseCatalogRequest{} - st.Catalog = pb.Catalog - - return st, nil -} - -func createDatabaseInstanceRequestToPb(st *CreateDatabaseInstanceRequest) (*createDatabaseInstanceRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &createDatabaseInstanceRequestPb{} - pb.DatabaseInstance = st.DatabaseInstance - - return pb, nil -} - -type createDatabaseInstanceRequestPb struct { - DatabaseInstance DatabaseInstance `json:"database_instance"` -} - -func createDatabaseInstanceRequestFromPb(pb *createDatabaseInstanceRequestPb) (*CreateDatabaseInstanceRequest, error) { - if pb == nil { - return nil, nil - } - st := &CreateDatabaseInstanceRequest{} - st.DatabaseInstance = pb.DatabaseInstance - - return st, nil -} - -func createDatabaseTableRequestToPb(st *CreateDatabaseTableRequest) (*createDatabaseTableRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &createDatabaseTableRequestPb{} - pb.Table = st.Table - - return pb, nil -} - -type createDatabaseTableRequestPb struct { - Table DatabaseTable `json:"table"` -} - -func createDatabaseTableRequestFromPb(pb *createDatabaseTableRequestPb) (*CreateDatabaseTableRequest, error) { - if pb == nil { - return nil, nil - } - st := &CreateDatabaseTableRequest{} - st.Table = pb.Table - - return st, nil -} - -func createSyncedDatabaseTableRequestToPb(st *CreateSyncedDatabaseTableRequest) (*createSyncedDatabaseTableRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &createSyncedDatabaseTableRequestPb{} - pb.SyncedTable = st.SyncedTable - - return pb, nil -} - -type createSyncedDatabaseTableRequestPb struct { - SyncedTable SyncedDatabaseTable `json:"synced_table"` -} - -func createSyncedDatabaseTableRequestFromPb(pb *createSyncedDatabaseTableRequestPb) (*CreateSyncedDatabaseTableRequest, error) { - if pb == nil { - return nil, nil - } - st := &CreateSyncedDatabaseTableRequest{} - st.SyncedTable = pb.SyncedTable - - return st, nil -} - -func databaseCatalogToPb(st *DatabaseCatalog) (*databaseCatalogPb, error) { - if st == nil { - return nil, nil - } - pb := &databaseCatalogPb{} - pb.CreateDatabaseIfNotExists = st.CreateDatabaseIfNotExists - pb.DatabaseInstanceName = st.DatabaseInstanceName - pb.DatabaseName = st.DatabaseName - pb.Name = st.Name - pb.Uid = st.Uid - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type databaseCatalogPb struct { - CreateDatabaseIfNotExists bool `json:"create_database_if_not_exists,omitempty"` - DatabaseInstanceName string `json:"database_instance_name"` - DatabaseName string `json:"database_name"` - Name string `json:"name"` - Uid string `json:"uid,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func databaseCatalogFromPb(pb *databaseCatalogPb) (*DatabaseCatalog, error) { - if pb == nil { - return nil, nil - } - st := &DatabaseCatalog{} - st.CreateDatabaseIfNotExists = pb.CreateDatabaseIfNotExists - st.DatabaseInstanceName = pb.DatabaseInstanceName - st.DatabaseName = pb.DatabaseName - st.Name = pb.Name - st.Uid = pb.Uid - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *databaseCatalogPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st databaseCatalogPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func databaseCredentialToPb(st *DatabaseCredential) (*databaseCredentialPb, error) { - if st == nil { - return nil, nil - } - pb := &databaseCredentialPb{} - pb.ExpirationTime = st.ExpirationTime - pb.Token = st.Token - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type databaseCredentialPb struct { - ExpirationTime string `json:"expiration_time,omitempty"` - Token string `json:"token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func databaseCredentialFromPb(pb *databaseCredentialPb) (*DatabaseCredential, error) { - if pb == nil { - return nil, nil - } - st := &DatabaseCredential{} - st.ExpirationTime = pb.ExpirationTime - st.Token = pb.Token - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *databaseCredentialPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st databaseCredentialPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func databaseInstanceToPb(st *DatabaseInstance) (*databaseInstancePb, error) { - if st == nil { - return nil, nil - } - pb := &databaseInstancePb{} - pb.Capacity = st.Capacity - pb.CreationTime = st.CreationTime - pb.Creator = st.Creator - pb.EffectiveStopped = st.EffectiveStopped - pb.Name = st.Name - pb.PgVersion = st.PgVersion - pb.ReadWriteDns = st.ReadWriteDns - pb.State = st.State - pb.Stopped = st.Stopped - pb.Uid = st.Uid - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type databaseInstancePb struct { - Capacity string `json:"capacity,omitempty"` - CreationTime string `json:"creation_time,omitempty"` - Creator string `json:"creator,omitempty"` - EffectiveStopped bool `json:"effective_stopped,omitempty"` - Name string `json:"name"` - PgVersion string `json:"pg_version,omitempty"` - ReadWriteDns string `json:"read_write_dns,omitempty"` - State DatabaseInstanceState `json:"state,omitempty"` - Stopped bool `json:"stopped,omitempty"` - Uid string `json:"uid,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func databaseInstanceFromPb(pb *databaseInstancePb) (*DatabaseInstance, error) { - if pb == nil { - return nil, nil - } - st := &DatabaseInstance{} - st.Capacity = pb.Capacity - st.CreationTime = pb.CreationTime - st.Creator = pb.Creator - st.EffectiveStopped = pb.EffectiveStopped - st.Name = pb.Name - st.PgVersion = pb.PgVersion - st.ReadWriteDns = pb.ReadWriteDns - st.State = pb.State - st.Stopped = pb.Stopped - st.Uid = pb.Uid - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *databaseInstancePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st databaseInstancePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func databaseTableToPb(st *DatabaseTable) (*databaseTablePb, error) { - if st == nil { - return nil, nil - } - pb := &databaseTablePb{} - pb.DatabaseInstanceName = st.DatabaseInstanceName - pb.LogicalDatabaseName = st.LogicalDatabaseName - pb.Name = st.Name - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type databaseTablePb struct { - DatabaseInstanceName string `json:"database_instance_name,omitempty"` - LogicalDatabaseName string `json:"logical_database_name,omitempty"` - Name string `json:"name"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func databaseTableFromPb(pb *databaseTablePb) (*DatabaseTable, error) { - if pb == nil { - return nil, nil - } - st := &DatabaseTable{} - st.DatabaseInstanceName = pb.DatabaseInstanceName - st.LogicalDatabaseName = pb.LogicalDatabaseName - st.Name = pb.Name - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *databaseTablePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st databaseTablePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func deleteDatabaseCatalogRequestToPb(st *DeleteDatabaseCatalogRequest) (*deleteDatabaseCatalogRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteDatabaseCatalogRequestPb{} - pb.Name = st.Name - - return pb, nil -} - -type deleteDatabaseCatalogRequestPb struct { - Name string `json:"-" url:"-"` -} - -func deleteDatabaseCatalogRequestFromPb(pb *deleteDatabaseCatalogRequestPb) (*DeleteDatabaseCatalogRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteDatabaseCatalogRequest{} - st.Name = pb.Name - - return st, nil -} - -func deleteDatabaseCatalogResponseToPb(st *DeleteDatabaseCatalogResponse) (*deleteDatabaseCatalogResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteDatabaseCatalogResponsePb{} - - return pb, nil -} - -type deleteDatabaseCatalogResponsePb struct { -} - -func deleteDatabaseCatalogResponseFromPb(pb *deleteDatabaseCatalogResponsePb) (*DeleteDatabaseCatalogResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteDatabaseCatalogResponse{} - - return st, nil -} - -func deleteDatabaseInstanceRequestToPb(st *DeleteDatabaseInstanceRequest) (*deleteDatabaseInstanceRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteDatabaseInstanceRequestPb{} - pb.Force = st.Force - pb.Name = st.Name - pb.Purge = st.Purge - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type deleteDatabaseInstanceRequestPb struct { - Force bool `json:"-" url:"force,omitempty"` - Name string `json:"-" url:"-"` - Purge bool `json:"-" url:"purge,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func deleteDatabaseInstanceRequestFromPb(pb *deleteDatabaseInstanceRequestPb) (*DeleteDatabaseInstanceRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteDatabaseInstanceRequest{} - st.Force = pb.Force - st.Name = pb.Name - st.Purge = pb.Purge - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *deleteDatabaseInstanceRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st deleteDatabaseInstanceRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func deleteDatabaseInstanceResponseToPb(st *DeleteDatabaseInstanceResponse) (*deleteDatabaseInstanceResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteDatabaseInstanceResponsePb{} - - return pb, nil -} - -type deleteDatabaseInstanceResponsePb struct { -} - -func deleteDatabaseInstanceResponseFromPb(pb *deleteDatabaseInstanceResponsePb) (*DeleteDatabaseInstanceResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteDatabaseInstanceResponse{} - - return st, nil -} - -func deleteDatabaseTableRequestToPb(st *DeleteDatabaseTableRequest) (*deleteDatabaseTableRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteDatabaseTableRequestPb{} - pb.Name = st.Name - - return pb, nil -} - -type deleteDatabaseTableRequestPb struct { - Name string `json:"-" url:"-"` -} - -func deleteDatabaseTableRequestFromPb(pb *deleteDatabaseTableRequestPb) (*DeleteDatabaseTableRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteDatabaseTableRequest{} - st.Name = pb.Name - - return st, nil -} - -func deleteDatabaseTableResponseToPb(st *DeleteDatabaseTableResponse) (*deleteDatabaseTableResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteDatabaseTableResponsePb{} - - return pb, nil -} - -type deleteDatabaseTableResponsePb struct { -} - -func deleteDatabaseTableResponseFromPb(pb *deleteDatabaseTableResponsePb) (*DeleteDatabaseTableResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteDatabaseTableResponse{} - - return st, nil -} - -func deleteSyncedDatabaseTableRequestToPb(st *DeleteSyncedDatabaseTableRequest) (*deleteSyncedDatabaseTableRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteSyncedDatabaseTableRequestPb{} - pb.Name = st.Name - - return pb, nil -} - -type deleteSyncedDatabaseTableRequestPb struct { - Name string `json:"-" url:"-"` -} - -func deleteSyncedDatabaseTableRequestFromPb(pb *deleteSyncedDatabaseTableRequestPb) (*DeleteSyncedDatabaseTableRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteSyncedDatabaseTableRequest{} - st.Name = pb.Name - - return st, nil -} - -func deleteSyncedDatabaseTableResponseToPb(st *DeleteSyncedDatabaseTableResponse) (*deleteSyncedDatabaseTableResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteSyncedDatabaseTableResponsePb{} - - return pb, nil -} - -type deleteSyncedDatabaseTableResponsePb struct { -} - -func deleteSyncedDatabaseTableResponseFromPb(pb *deleteSyncedDatabaseTableResponsePb) (*DeleteSyncedDatabaseTableResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteSyncedDatabaseTableResponse{} - - return st, nil -} - -func findDatabaseInstanceByUidRequestToPb(st *FindDatabaseInstanceByUidRequest) (*findDatabaseInstanceByUidRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &findDatabaseInstanceByUidRequestPb{} - pb.Uid = st.Uid - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type findDatabaseInstanceByUidRequestPb struct { - Uid string `json:"-" url:"uid,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func findDatabaseInstanceByUidRequestFromPb(pb *findDatabaseInstanceByUidRequestPb) (*FindDatabaseInstanceByUidRequest, error) { - if pb == nil { - return nil, nil - } - st := &FindDatabaseInstanceByUidRequest{} - st.Uid = pb.Uid - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *findDatabaseInstanceByUidRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st findDatabaseInstanceByUidRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func generateDatabaseCredentialRequestToPb(st *GenerateDatabaseCredentialRequest) (*generateDatabaseCredentialRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &generateDatabaseCredentialRequestPb{} - pb.InstanceNames = st.InstanceNames - pb.RequestId = st.RequestId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type generateDatabaseCredentialRequestPb struct { - InstanceNames []string `json:"instance_names,omitempty"` - RequestId string `json:"request_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func generateDatabaseCredentialRequestFromPb(pb *generateDatabaseCredentialRequestPb) (*GenerateDatabaseCredentialRequest, error) { - if pb == nil { - return nil, nil - } - st := &GenerateDatabaseCredentialRequest{} - st.InstanceNames = pb.InstanceNames - st.RequestId = pb.RequestId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *generateDatabaseCredentialRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st generateDatabaseCredentialRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getDatabaseCatalogRequestToPb(st *GetDatabaseCatalogRequest) (*getDatabaseCatalogRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getDatabaseCatalogRequestPb{} - pb.Name = st.Name - - return pb, nil -} - -type getDatabaseCatalogRequestPb struct { - Name string `json:"-" url:"-"` -} - -func getDatabaseCatalogRequestFromPb(pb *getDatabaseCatalogRequestPb) (*GetDatabaseCatalogRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetDatabaseCatalogRequest{} - st.Name = pb.Name - - return st, nil -} - -func getDatabaseInstanceRequestToPb(st *GetDatabaseInstanceRequest) (*getDatabaseInstanceRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getDatabaseInstanceRequestPb{} - pb.Name = st.Name - - return pb, nil -} - -type getDatabaseInstanceRequestPb struct { - Name string `json:"-" url:"-"` -} - -func getDatabaseInstanceRequestFromPb(pb *getDatabaseInstanceRequestPb) (*GetDatabaseInstanceRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetDatabaseInstanceRequest{} - st.Name = pb.Name - - return st, nil -} - -func getDatabaseTableRequestToPb(st *GetDatabaseTableRequest) (*getDatabaseTableRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getDatabaseTableRequestPb{} - pb.Name = st.Name - - return pb, nil -} - -type getDatabaseTableRequestPb struct { - Name string `json:"-" url:"-"` -} - -func getDatabaseTableRequestFromPb(pb *getDatabaseTableRequestPb) (*GetDatabaseTableRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetDatabaseTableRequest{} - st.Name = pb.Name - - return st, nil -} - -func getSyncedDatabaseTableRequestToPb(st *GetSyncedDatabaseTableRequest) (*getSyncedDatabaseTableRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getSyncedDatabaseTableRequestPb{} - pb.Name = st.Name - - return pb, nil -} - -type getSyncedDatabaseTableRequestPb struct { - Name string `json:"-" url:"-"` -} - -func getSyncedDatabaseTableRequestFromPb(pb *getSyncedDatabaseTableRequestPb) (*GetSyncedDatabaseTableRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetSyncedDatabaseTableRequest{} - st.Name = pb.Name - - return st, nil -} - -func listDatabaseInstancesRequestToPb(st *ListDatabaseInstancesRequest) (*listDatabaseInstancesRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listDatabaseInstancesRequestPb{} - pb.PageSize = st.PageSize - pb.PageToken = st.PageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listDatabaseInstancesRequestPb struct { - PageSize int `json:"-" url:"page_size,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listDatabaseInstancesRequestFromPb(pb *listDatabaseInstancesRequestPb) (*ListDatabaseInstancesRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListDatabaseInstancesRequest{} - st.PageSize = pb.PageSize - st.PageToken = pb.PageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listDatabaseInstancesRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listDatabaseInstancesRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listDatabaseInstancesResponseToPb(st *ListDatabaseInstancesResponse) (*listDatabaseInstancesResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listDatabaseInstancesResponsePb{} - pb.DatabaseInstances = st.DatabaseInstances - pb.NextPageToken = st.NextPageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listDatabaseInstancesResponsePb struct { - DatabaseInstances []DatabaseInstance `json:"database_instances,omitempty"` - NextPageToken string `json:"next_page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listDatabaseInstancesResponseFromPb(pb *listDatabaseInstancesResponsePb) (*ListDatabaseInstancesResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListDatabaseInstancesResponse{} - st.DatabaseInstances = pb.DatabaseInstances - st.NextPageToken = pb.NextPageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listDatabaseInstancesResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listDatabaseInstancesResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func newPipelineSpecToPb(st *NewPipelineSpec) (*newPipelineSpecPb, error) { - if st == nil { - return nil, nil - } - pb := &newPipelineSpecPb{} - pb.StorageCatalog = st.StorageCatalog - pb.StorageSchema = st.StorageSchema - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type newPipelineSpecPb struct { - StorageCatalog string `json:"storage_catalog,omitempty"` - StorageSchema string `json:"storage_schema,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func newPipelineSpecFromPb(pb *newPipelineSpecPb) (*NewPipelineSpec, error) { - if pb == nil { - return nil, nil - } - st := &NewPipelineSpec{} - st.StorageCatalog = pb.StorageCatalog - st.StorageSchema = pb.StorageSchema - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *newPipelineSpecPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st newPipelineSpecPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func syncedDatabaseTableToPb(st *SyncedDatabaseTable) (*syncedDatabaseTablePb, error) { - if st == nil { - return nil, nil - } - pb := &syncedDatabaseTablePb{} - pb.DataSynchronizationStatus = st.DataSynchronizationStatus - pb.DatabaseInstanceName = st.DatabaseInstanceName - pb.LogicalDatabaseName = st.LogicalDatabaseName - pb.Name = st.Name - pb.Spec = st.Spec - pb.UnityCatalogProvisioningState = st.UnityCatalogProvisioningState - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type syncedDatabaseTablePb struct { - DataSynchronizationStatus *SyncedTableStatus `json:"data_synchronization_status,omitempty"` - DatabaseInstanceName string `json:"database_instance_name,omitempty"` - LogicalDatabaseName string `json:"logical_database_name,omitempty"` - Name string `json:"name"` - Spec *SyncedTableSpec `json:"spec,omitempty"` - UnityCatalogProvisioningState ProvisioningInfoState `json:"unity_catalog_provisioning_state,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func syncedDatabaseTableFromPb(pb *syncedDatabaseTablePb) (*SyncedDatabaseTable, error) { - if pb == nil { - return nil, nil - } - st := &SyncedDatabaseTable{} - st.DataSynchronizationStatus = pb.DataSynchronizationStatus - st.DatabaseInstanceName = pb.DatabaseInstanceName - st.LogicalDatabaseName = pb.LogicalDatabaseName - st.Name = pb.Name - st.Spec = pb.Spec - st.UnityCatalogProvisioningState = pb.UnityCatalogProvisioningState - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *syncedDatabaseTablePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st syncedDatabaseTablePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func syncedTableContinuousUpdateStatusToPb(st *SyncedTableContinuousUpdateStatus) (*syncedTableContinuousUpdateStatusPb, error) { - if st == nil { - return nil, nil - } - pb := &syncedTableContinuousUpdateStatusPb{} - pb.InitialPipelineSyncProgress = st.InitialPipelineSyncProgress - pb.LastProcessedCommitVersion = st.LastProcessedCommitVersion - pb.Timestamp = st.Timestamp - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type syncedTableContinuousUpdateStatusPb struct { - InitialPipelineSyncProgress *SyncedTablePipelineProgress `json:"initial_pipeline_sync_progress,omitempty"` - LastProcessedCommitVersion int64 `json:"last_processed_commit_version,omitempty"` - Timestamp string `json:"timestamp,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func syncedTableContinuousUpdateStatusFromPb(pb *syncedTableContinuousUpdateStatusPb) (*SyncedTableContinuousUpdateStatus, error) { - if pb == nil { - return nil, nil - } - st := &SyncedTableContinuousUpdateStatus{} - st.InitialPipelineSyncProgress = pb.InitialPipelineSyncProgress - st.LastProcessedCommitVersion = pb.LastProcessedCommitVersion - st.Timestamp = pb.Timestamp - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *syncedTableContinuousUpdateStatusPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st syncedTableContinuousUpdateStatusPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func syncedTableFailedStatusToPb(st *SyncedTableFailedStatus) (*syncedTableFailedStatusPb, error) { - if st == nil { - return nil, nil - } - pb := &syncedTableFailedStatusPb{} - pb.LastProcessedCommitVersion = st.LastProcessedCommitVersion - pb.Timestamp = st.Timestamp - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type syncedTableFailedStatusPb struct { - LastProcessedCommitVersion int64 `json:"last_processed_commit_version,omitempty"` - Timestamp string `json:"timestamp,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func syncedTableFailedStatusFromPb(pb *syncedTableFailedStatusPb) (*SyncedTableFailedStatus, error) { - if pb == nil { - return nil, nil - } - st := &SyncedTableFailedStatus{} - st.LastProcessedCommitVersion = pb.LastProcessedCommitVersion - st.Timestamp = pb.Timestamp - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *syncedTableFailedStatusPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st syncedTableFailedStatusPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func syncedTablePipelineProgressToPb(st *SyncedTablePipelineProgress) (*syncedTablePipelineProgressPb, error) { - if st == nil { - return nil, nil - } - pb := &syncedTablePipelineProgressPb{} - pb.EstimatedCompletionTimeSeconds = st.EstimatedCompletionTimeSeconds - pb.LatestVersionCurrentlyProcessing = st.LatestVersionCurrentlyProcessing - pb.SyncProgressCompletion = st.SyncProgressCompletion - pb.SyncedRowCount = st.SyncedRowCount - pb.TotalRowCount = st.TotalRowCount - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type syncedTablePipelineProgressPb struct { - EstimatedCompletionTimeSeconds float64 `json:"estimated_completion_time_seconds,omitempty"` - LatestVersionCurrentlyProcessing int64 `json:"latest_version_currently_processing,omitempty"` - SyncProgressCompletion float64 `json:"sync_progress_completion,omitempty"` - SyncedRowCount int64 `json:"synced_row_count,omitempty"` - TotalRowCount int64 `json:"total_row_count,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func syncedTablePipelineProgressFromPb(pb *syncedTablePipelineProgressPb) (*SyncedTablePipelineProgress, error) { - if pb == nil { - return nil, nil - } - st := &SyncedTablePipelineProgress{} - st.EstimatedCompletionTimeSeconds = pb.EstimatedCompletionTimeSeconds - st.LatestVersionCurrentlyProcessing = pb.LatestVersionCurrentlyProcessing - st.SyncProgressCompletion = pb.SyncProgressCompletion - st.SyncedRowCount = pb.SyncedRowCount - st.TotalRowCount = pb.TotalRowCount - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *syncedTablePipelineProgressPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st syncedTablePipelineProgressPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func syncedTableProvisioningStatusToPb(st *SyncedTableProvisioningStatus) (*syncedTableProvisioningStatusPb, error) { - if st == nil { - return nil, nil - } - pb := &syncedTableProvisioningStatusPb{} - pb.InitialPipelineSyncProgress = st.InitialPipelineSyncProgress - - return pb, nil -} - -type syncedTableProvisioningStatusPb struct { - InitialPipelineSyncProgress *SyncedTablePipelineProgress `json:"initial_pipeline_sync_progress,omitempty"` -} - -func syncedTableProvisioningStatusFromPb(pb *syncedTableProvisioningStatusPb) (*SyncedTableProvisioningStatus, error) { - if pb == nil { - return nil, nil - } - st := &SyncedTableProvisioningStatus{} - st.InitialPipelineSyncProgress = pb.InitialPipelineSyncProgress - - return st, nil -} - -func syncedTableSpecToPb(st *SyncedTableSpec) (*syncedTableSpecPb, error) { - if st == nil { - return nil, nil - } - pb := &syncedTableSpecPb{} - pb.CreateDatabaseObjectsIfMissing = st.CreateDatabaseObjectsIfMissing - pb.ExistingPipelineId = st.ExistingPipelineId - pb.NewPipelineSpec = st.NewPipelineSpec - pb.PrimaryKeyColumns = st.PrimaryKeyColumns - pb.SchedulingPolicy = st.SchedulingPolicy - pb.SourceTableFullName = st.SourceTableFullName - pb.TimeseriesKey = st.TimeseriesKey - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type syncedTableSpecPb struct { - CreateDatabaseObjectsIfMissing bool `json:"create_database_objects_if_missing,omitempty"` - ExistingPipelineId string `json:"existing_pipeline_id,omitempty"` - NewPipelineSpec *NewPipelineSpec `json:"new_pipeline_spec,omitempty"` - PrimaryKeyColumns []string `json:"primary_key_columns,omitempty"` - SchedulingPolicy SyncedTableSchedulingPolicy `json:"scheduling_policy,omitempty"` - SourceTableFullName string `json:"source_table_full_name,omitempty"` - TimeseriesKey string `json:"timeseries_key,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func syncedTableSpecFromPb(pb *syncedTableSpecPb) (*SyncedTableSpec, error) { - if pb == nil { - return nil, nil - } - st := &SyncedTableSpec{} - st.CreateDatabaseObjectsIfMissing = pb.CreateDatabaseObjectsIfMissing - st.ExistingPipelineId = pb.ExistingPipelineId - st.NewPipelineSpec = pb.NewPipelineSpec - st.PrimaryKeyColumns = pb.PrimaryKeyColumns - st.SchedulingPolicy = pb.SchedulingPolicy - st.SourceTableFullName = pb.SourceTableFullName - st.TimeseriesKey = pb.TimeseriesKey - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *syncedTableSpecPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st syncedTableSpecPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func syncedTableStatusToPb(st *SyncedTableStatus) (*syncedTableStatusPb, error) { - if st == nil { - return nil, nil - } - pb := &syncedTableStatusPb{} - pb.ContinuousUpdateStatus = st.ContinuousUpdateStatus - pb.DetailedState = st.DetailedState - pb.FailedStatus = st.FailedStatus - pb.Message = st.Message - pb.PipelineId = st.PipelineId - pb.ProvisioningStatus = st.ProvisioningStatus - pb.TriggeredUpdateStatus = st.TriggeredUpdateStatus - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type syncedTableStatusPb struct { - ContinuousUpdateStatus *SyncedTableContinuousUpdateStatus `json:"continuous_update_status,omitempty"` - DetailedState SyncedTableState `json:"detailed_state,omitempty"` - FailedStatus *SyncedTableFailedStatus `json:"failed_status,omitempty"` - Message string `json:"message,omitempty"` - PipelineId string `json:"pipeline_id,omitempty"` - ProvisioningStatus *SyncedTableProvisioningStatus `json:"provisioning_status,omitempty"` - TriggeredUpdateStatus *SyncedTableTriggeredUpdateStatus `json:"triggered_update_status,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func syncedTableStatusFromPb(pb *syncedTableStatusPb) (*SyncedTableStatus, error) { - if pb == nil { - return nil, nil - } - st := &SyncedTableStatus{} - st.ContinuousUpdateStatus = pb.ContinuousUpdateStatus - st.DetailedState = pb.DetailedState - st.FailedStatus = pb.FailedStatus - st.Message = pb.Message - st.PipelineId = pb.PipelineId - st.ProvisioningStatus = pb.ProvisioningStatus - st.TriggeredUpdateStatus = pb.TriggeredUpdateStatus - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *syncedTableStatusPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st syncedTableStatusPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func syncedTableTriggeredUpdateStatusToPb(st *SyncedTableTriggeredUpdateStatus) (*syncedTableTriggeredUpdateStatusPb, error) { - if st == nil { - return nil, nil - } - pb := &syncedTableTriggeredUpdateStatusPb{} - pb.LastProcessedCommitVersion = st.LastProcessedCommitVersion - pb.Timestamp = st.Timestamp - pb.TriggeredUpdateProgress = st.TriggeredUpdateProgress - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type syncedTableTriggeredUpdateStatusPb struct { - LastProcessedCommitVersion int64 `json:"last_processed_commit_version,omitempty"` - Timestamp string `json:"timestamp,omitempty"` - TriggeredUpdateProgress *SyncedTablePipelineProgress `json:"triggered_update_progress,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func syncedTableTriggeredUpdateStatusFromPb(pb *syncedTableTriggeredUpdateStatusPb) (*SyncedTableTriggeredUpdateStatus, error) { - if pb == nil { - return nil, nil - } - st := &SyncedTableTriggeredUpdateStatus{} - st.LastProcessedCommitVersion = pb.LastProcessedCommitVersion - st.Timestamp = pb.Timestamp - st.TriggeredUpdateProgress = pb.TriggeredUpdateProgress - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *syncedTableTriggeredUpdateStatusPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st syncedTableTriggeredUpdateStatusPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func updateDatabaseInstanceRequestToPb(st *UpdateDatabaseInstanceRequest) (*updateDatabaseInstanceRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &updateDatabaseInstanceRequestPb{} - pb.DatabaseInstance = st.DatabaseInstance - pb.Name = st.Name - pb.UpdateMask = st.UpdateMask - - return pb, nil -} - -type updateDatabaseInstanceRequestPb struct { - DatabaseInstance DatabaseInstance `json:"database_instance"` - Name string `json:"-" url:"-"` - UpdateMask string `json:"-" url:"update_mask"` -} - -func updateDatabaseInstanceRequestFromPb(pb *updateDatabaseInstanceRequestPb) (*UpdateDatabaseInstanceRequest, error) { - if pb == nil { - return nil, nil - } - st := &UpdateDatabaseInstanceRequest{} - st.DatabaseInstance = pb.DatabaseInstance - st.Name = pb.Name - st.UpdateMask = pb.UpdateMask - - return st, nil -} - -func durationToPb(d *time.Duration) (*string, error) { - if d == nil { - return nil, nil - } - s := fmt.Sprintf("%.9fs", d.Seconds()) - return &s, nil -} - -func durationFromPb(s *string) (*time.Duration, error) { - if s == nil { - return nil, nil - } - d, err := time.ParseDuration(*s) - if err != nil { - return nil, err - } - return &d, nil -} - -func timestampToPb(t *time.Time) (*string, error) { - if t == nil { - return nil, nil - } - s := t.Format(time.RFC3339) - return &s, nil -} - -func timestampFromPb(s *string) (*time.Time, error) { - if s == nil { - return nil, nil - } - t, err := time.Parse(time.RFC3339, *s) - if err != nil { - return nil, err - } - return &t, nil -} - -func fieldMaskToPb(fm *[]string) (*string, error) { - if fm == nil { - return nil, nil - } - s := strings.Join(*fm, ",") - return &s, nil -} - -func fieldMaskFromPb(s *string) (*[]string, error) { - if s == nil { - return nil, nil - } - fm := strings.Split(*s, ",") - return &fm, nil -} diff --git a/service/database/model.go b/service/database/model.go index 5ffbdcea8..c24a5eeb9 100755 --- a/service/database/model.go +++ b/service/database/model.go @@ -3,284 +3,110 @@ package database import ( - "encoding/json" "fmt" + + "github.com/databricks/databricks-sdk-go/marshal" ) // Create a Database Catalog type CreateDatabaseCatalogRequest struct { - - // Wire name: 'catalog' Catalog DatabaseCatalog `json:"catalog"` } -func (st *CreateDatabaseCatalogRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createDatabaseCatalogRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createDatabaseCatalogRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CreateDatabaseCatalogRequest) MarshalJSON() ([]byte, error) { - pb, err := createDatabaseCatalogRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Create a Database Instance type CreateDatabaseInstanceRequest struct { // A DatabaseInstance represents a logical Postgres instance, comprised of // both compute and storage. - // Wire name: 'database_instance' DatabaseInstance DatabaseInstance `json:"database_instance"` } -func (st *CreateDatabaseInstanceRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createDatabaseInstanceRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createDatabaseInstanceRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CreateDatabaseInstanceRequest) MarshalJSON() ([]byte, error) { - pb, err := createDatabaseInstanceRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Create a Database Table type CreateDatabaseTableRequest struct { // Next field marker: 13 - // Wire name: 'table' Table DatabaseTable `json:"table"` } -func (st *CreateDatabaseTableRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createDatabaseTableRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createDatabaseTableRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CreateDatabaseTableRequest) MarshalJSON() ([]byte, error) { - pb, err := createDatabaseTableRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Create a Synced Database Table type CreateSyncedDatabaseTableRequest struct { // Next field marker: 12 - // Wire name: 'synced_table' SyncedTable SyncedDatabaseTable `json:"synced_table"` } -func (st *CreateSyncedDatabaseTableRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createSyncedDatabaseTableRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createSyncedDatabaseTableRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CreateSyncedDatabaseTableRequest) MarshalJSON() ([]byte, error) { - pb, err := createSyncedDatabaseTableRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type DatabaseCatalog struct { - - // Wire name: 'create_database_if_not_exists' CreateDatabaseIfNotExists bool `json:"create_database_if_not_exists,omitempty"` // The name of the DatabaseInstance housing the database. - // Wire name: 'database_instance_name' DatabaseInstanceName string `json:"database_instance_name"` // The name of the database (in a instance) associated with the catalog. - // Wire name: 'database_name' DatabaseName string `json:"database_name"` // The name of the catalog in UC. - // Wire name: 'name' Name string `json:"name"` - // Wire name: 'uid' Uid string `json:"uid,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DatabaseCatalog) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &databaseCatalogPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := databaseCatalogFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DatabaseCatalog) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DatabaseCatalog) MarshalJSON() ([]byte, error) { - pb, err := databaseCatalogToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DatabaseCatalog) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type DatabaseCredential struct { - - // Wire name: 'expiration_time' ExpirationTime string `json:"expiration_time,omitempty"` - // Wire name: 'token' Token string `json:"token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DatabaseCredential) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &databaseCredentialPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := databaseCredentialFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DatabaseCredential) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DatabaseCredential) MarshalJSON() ([]byte, error) { - pb, err := databaseCredentialToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DatabaseCredential) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // A DatabaseInstance represents a logical Postgres instance, comprised of both // compute and storage. type DatabaseInstance struct { // The sku of the instance. Valid values are "CU_1", "CU_2", "CU_4", "CU_8". - // Wire name: 'capacity' Capacity string `json:"capacity,omitempty"` // The timestamp when the instance was created. - // Wire name: 'creation_time' CreationTime string `json:"creation_time,omitempty"` // The email of the creator of the instance. - // Wire name: 'creator' Creator string `json:"creator,omitempty"` // xref AIP-129. `stopped` is owned by the client, while `effective_stopped` // is owned by the server. `stopped` will only be set in Create/Update // response messages if and only if the user provides the field via the // request. `effective_stopped` on the other hand will always bet set in all // response messages (Create/Update/Get/List). - // Wire name: 'effective_stopped' EffectiveStopped bool `json:"effective_stopped,omitempty"` // The name of the instance. This is the unique identifier for the instance. - // Wire name: 'name' Name string `json:"name"` // The version of Postgres running on the instance. - // Wire name: 'pg_version' PgVersion string `json:"pg_version,omitempty"` // The DNS endpoint to connect to the instance for read+write access. - // Wire name: 'read_write_dns' ReadWriteDns string `json:"read_write_dns,omitempty"` // The current state of the instance. - // Wire name: 'state' State DatabaseInstanceState `json:"state,omitempty"` // Whether the instance is stopped. - // Wire name: 'stopped' Stopped bool `json:"stopped,omitempty"` // An immutable UUID identifier for the instance. - // Wire name: 'uid' Uid string `json:"uid,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DatabaseInstance) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &databaseInstancePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := databaseInstanceFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DatabaseInstance) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DatabaseInstance) MarshalJSON() ([]byte, error) { - pb, err := databaseInstanceToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DatabaseInstance) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type DatabaseInstanceState string @@ -340,7 +166,6 @@ type DatabaseTable struct { // creating database tables in registered catalogs, the database instance // name MUST match that of the registered catalog (or the request will be // rejected). - // Wire name: 'database_instance_name' DatabaseInstanceName string `json:"database_instance_name,omitempty"` // Target Postgres database object (logical database) name for this table. // This field is optional in all scenarios. @@ -356,106 +181,37 @@ type DatabaseTable struct { // this field will allow targeting an arbitrary postgres database. Note that // this has implications for the `create_database_objects_is_missing` field // in `spec`. - // Wire name: 'logical_database_name' LogicalDatabaseName string `json:"logical_database_name,omitempty"` // Full three-part (catalog, schema, table) name of the table. - // Wire name: 'name' Name string `json:"name"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DatabaseTable) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &databaseTablePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := databaseTableFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DatabaseTable) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DatabaseTable) MarshalJSON() ([]byte, error) { - pb, err := databaseTableToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DatabaseTable) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Delete a Database Catalog type DeleteDatabaseCatalogRequest struct { - Name string `json:"-" tf:"-"` -} - -func (st *DeleteDatabaseCatalogRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteDatabaseCatalogRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteDatabaseCatalogRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteDatabaseCatalogRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteDatabaseCatalogRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Name string `json:"-" url:"-"` } type DeleteDatabaseCatalogResponse struct { } -func (st *DeleteDatabaseCatalogResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteDatabaseCatalogResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteDatabaseCatalogResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteDatabaseCatalogResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteDatabaseCatalogResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Delete a Database Instance type DeleteDatabaseInstanceRequest struct { // By default, a instance cannot be deleted if it has descendant instances // created via PITR. If this flag is specified as true, all descendent // instances will be deleted as well. - Force bool `json:"-" tf:"-"` + Force bool `json:"-" url:"force,omitempty"` // Name of the instance to delete. - Name string `json:"-" tf:"-"` + Name string `json:"-" url:"-"` // Note purge=false is in development. If false, the database instance is // soft deleted (implementation pending). Soft deleted instances behave as // if they are deleted, and cannot be used for CRUD operations nor connected @@ -464,441 +220,127 @@ type DeleteDatabaseInstanceRequest struct { // hard deleted and cannot be undeleted. For the time being, setting this // value to true is required to delete an instance (soft delete is not yet // supported). - Purge bool `json:"-" tf:"-"` + Purge bool `json:"-" url:"purge,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DeleteDatabaseInstanceRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteDatabaseInstanceRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteDatabaseInstanceRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DeleteDatabaseInstanceRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DeleteDatabaseInstanceRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteDatabaseInstanceRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DeleteDatabaseInstanceRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type DeleteDatabaseInstanceResponse struct { } -func (st *DeleteDatabaseInstanceResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteDatabaseInstanceResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteDatabaseInstanceResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteDatabaseInstanceResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteDatabaseInstanceResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Delete a Database Table type DeleteDatabaseTableRequest struct { - Name string `json:"-" tf:"-"` -} - -func (st *DeleteDatabaseTableRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteDatabaseTableRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteDatabaseTableRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteDatabaseTableRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteDatabaseTableRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Name string `json:"-" url:"-"` } type DeleteDatabaseTableResponse struct { } -func (st *DeleteDatabaseTableResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteDatabaseTableResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteDatabaseTableResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteDatabaseTableResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteDatabaseTableResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Delete a Synced Database Table type DeleteSyncedDatabaseTableRequest struct { - Name string `json:"-" tf:"-"` -} - -func (st *DeleteSyncedDatabaseTableRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteSyncedDatabaseTableRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteSyncedDatabaseTableRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteSyncedDatabaseTableRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteSyncedDatabaseTableRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Name string `json:"-" url:"-"` } type DeleteSyncedDatabaseTableResponse struct { } -func (st *DeleteSyncedDatabaseTableResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteSyncedDatabaseTableResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteSyncedDatabaseTableResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteSyncedDatabaseTableResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteSyncedDatabaseTableResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Find a Database Instance by uid type FindDatabaseInstanceByUidRequest struct { // UID of the cluster to get. - Uid string `json:"-" tf:"-"` + Uid string `json:"-" url:"uid,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *FindDatabaseInstanceByUidRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &findDatabaseInstanceByUidRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := findDatabaseInstanceByUidRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *FindDatabaseInstanceByUidRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st FindDatabaseInstanceByUidRequest) MarshalJSON() ([]byte, error) { - pb, err := findDatabaseInstanceByUidRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s FindDatabaseInstanceByUidRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Generates a credential that can be used to access database instances type GenerateDatabaseCredentialRequest struct { // Instances to which the token will be scoped. - // Wire name: 'instance_names' InstanceNames []string `json:"instance_names,omitempty"` - // Wire name: 'request_id' RequestId string `json:"request_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GenerateDatabaseCredentialRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &generateDatabaseCredentialRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := generateDatabaseCredentialRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GenerateDatabaseCredentialRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GenerateDatabaseCredentialRequest) MarshalJSON() ([]byte, error) { - pb, err := generateDatabaseCredentialRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GenerateDatabaseCredentialRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get a Database Catalog type GetDatabaseCatalogRequest struct { - Name string `json:"-" tf:"-"` -} - -func (st *GetDatabaseCatalogRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getDatabaseCatalogRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getDatabaseCatalogRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetDatabaseCatalogRequest) MarshalJSON() ([]byte, error) { - pb, err := getDatabaseCatalogRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Name string `json:"-" url:"-"` } // Get a Database Instance type GetDatabaseInstanceRequest struct { // Name of the cluster to get. - Name string `json:"-" tf:"-"` -} - -func (st *GetDatabaseInstanceRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getDatabaseInstanceRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getDatabaseInstanceRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetDatabaseInstanceRequest) MarshalJSON() ([]byte, error) { - pb, err := getDatabaseInstanceRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Name string `json:"-" url:"-"` } // Get a Database Table type GetDatabaseTableRequest struct { - Name string `json:"-" tf:"-"` -} - -func (st *GetDatabaseTableRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getDatabaseTableRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getDatabaseTableRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetDatabaseTableRequest) MarshalJSON() ([]byte, error) { - pb, err := getDatabaseTableRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Name string `json:"-" url:"-"` } // Get a Synced Database Table type GetSyncedDatabaseTableRequest struct { - Name string `json:"-" tf:"-"` -} - -func (st *GetSyncedDatabaseTableRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getSyncedDatabaseTableRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getSyncedDatabaseTableRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetSyncedDatabaseTableRequest) MarshalJSON() ([]byte, error) { - pb, err := getSyncedDatabaseTableRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Name string `json:"-" url:"-"` } // List Database Instances type ListDatabaseInstancesRequest struct { // Upper bound for items returned. - PageSize int `json:"-" tf:"-"` + PageSize int `json:"-" url:"page_size,omitempty"` // Pagination token to go to the next page of Database Instances. Requests // first page if absent. - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListDatabaseInstancesRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listDatabaseInstancesRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listDatabaseInstancesRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListDatabaseInstancesRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListDatabaseInstancesRequest) MarshalJSON() ([]byte, error) { - pb, err := listDatabaseInstancesRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListDatabaseInstancesRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListDatabaseInstancesResponse struct { // List of instances. - // Wire name: 'database_instances' DatabaseInstances []DatabaseInstance `json:"database_instances,omitempty"` // Pagination token to request the next page of instances. - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListDatabaseInstancesResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listDatabaseInstancesResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listDatabaseInstancesResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListDatabaseInstancesResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListDatabaseInstancesResponse) MarshalJSON() ([]byte, error) { - pb, err := listDatabaseInstancesResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListDatabaseInstancesResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Custom fields that user can set for pipeline while creating @@ -908,40 +350,21 @@ type NewPipelineSpec struct { // UC catalog for the pipeline to store intermediate files (checkpoints, // event logs etc). This needs to be a standard catalog where the user has // permissions to create Delta tables. - // Wire name: 'storage_catalog' StorageCatalog string `json:"storage_catalog,omitempty"` // UC schema for the pipeline to store intermediate files (checkpoints, // event logs etc). This needs to be in the standard catalog where the user // has permissions to create Delta tables. - // Wire name: 'storage_schema' StorageSchema string `json:"storage_schema,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *NewPipelineSpec) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &newPipelineSpecPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := newPipelineSpecFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *NewPipelineSpec) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st NewPipelineSpec) MarshalJSON() ([]byte, error) { - pb, err := newPipelineSpecToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s NewPipelineSpec) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ProvisioningInfoState string @@ -996,7 +419,6 @@ func (f *ProvisioningInfoState) Type() string { // Next field marker: 12 type SyncedDatabaseTable struct { // Synced Table data synchronization status - // Wire name: 'data_synchronization_status' DataSynchronizationStatus *SyncedTableStatus `json:"data_synchronization_status,omitempty"` // Name of the target database instance. This is required when creating // synced database tables in standard catalogs. This is optional when @@ -1004,7 +426,6 @@ type SyncedDatabaseTable struct { // specified when creating synced database tables in registered catalogs, // the database instance name MUST match that of the registered catalog (or // the request will be rejected). - // Wire name: 'database_instance_name' DatabaseInstanceName string `json:"database_instance_name,omitempty"` // Target Postgres database object (logical database) name for this table. // This field is optional in all scenarios. @@ -1019,91 +440,50 @@ type SyncedDatabaseTable struct { // name is inferred to be that of the standard catalog. In this scenario, // specifying this field will allow targeting an arbitrary postgres // database. - // Wire name: 'logical_database_name' LogicalDatabaseName string `json:"logical_database_name,omitempty"` // Full three-part (catalog, schema, table) name of the table. - // Wire name: 'name' Name string `json:"name"` // Specification of a synced database table. - // Wire name: 'spec' Spec *SyncedTableSpec `json:"spec,omitempty"` // The provisioning state of the synced table entity in Unity Catalog. This // is distinct from the state of the data synchronization pipeline (i.e. the // table may be in "ACTIVE" but the pipeline may be in "PROVISIONING" as it // runs asynchronously). - // Wire name: 'unity_catalog_provisioning_state' UnityCatalogProvisioningState ProvisioningInfoState `json:"unity_catalog_provisioning_state,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *SyncedDatabaseTable) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &syncedDatabaseTablePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := syncedDatabaseTableFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *SyncedDatabaseTable) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st SyncedDatabaseTable) MarshalJSON() ([]byte, error) { - pb, err := syncedDatabaseTableToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s SyncedDatabaseTable) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Detailed status of a synced table. Shown if the synced table is in the // SYNCED_CONTINUOUS_UPDATE or the SYNCED_UPDATING_PIPELINE_RESOURCES state. type SyncedTableContinuousUpdateStatus struct { // Progress of the initial data synchronization. - // Wire name: 'initial_pipeline_sync_progress' InitialPipelineSyncProgress *SyncedTablePipelineProgress `json:"initial_pipeline_sync_progress,omitempty"` // The last source table Delta version that was synced to the synced table. // Note that this Delta version may not be completely synced to the synced // table yet. - // Wire name: 'last_processed_commit_version' LastProcessedCommitVersion int64 `json:"last_processed_commit_version,omitempty"` // The timestamp of the last time any data was synchronized from the source // table to the synced table. - // Wire name: 'timestamp' Timestamp string `json:"timestamp,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *SyncedTableContinuousUpdateStatus) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &syncedTableContinuousUpdateStatusPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := syncedTableContinuousUpdateStatusFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *SyncedTableContinuousUpdateStatus) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st SyncedTableContinuousUpdateStatus) MarshalJSON() ([]byte, error) { - pb, err := syncedTableContinuousUpdateStatusToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s SyncedTableContinuousUpdateStatus) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Detailed status of a synced table. Shown if the synced table is in the @@ -1113,88 +493,47 @@ type SyncedTableFailedStatus struct { // Note that this Delta version may only be partially synced to the synced // table. Only populated if the table is still synced and available for // serving. - // Wire name: 'last_processed_commit_version' LastProcessedCommitVersion int64 `json:"last_processed_commit_version,omitempty"` // The timestamp of the last time any data was synchronized from the source // table to the synced table. Only populated if the table is still synced // and available for serving. - // Wire name: 'timestamp' Timestamp string `json:"timestamp,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *SyncedTableFailedStatus) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &syncedTableFailedStatusPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := syncedTableFailedStatusFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *SyncedTableFailedStatus) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st SyncedTableFailedStatus) MarshalJSON() ([]byte, error) { - pb, err := syncedTableFailedStatusToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s SyncedTableFailedStatus) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Progress information of the Synced Table data synchronization pipeline. type SyncedTablePipelineProgress struct { // The estimated time remaining to complete this update in seconds. - // Wire name: 'estimated_completion_time_seconds' EstimatedCompletionTimeSeconds float64 `json:"estimated_completion_time_seconds,omitempty"` // The source table Delta version that was last processed by the pipeline. // The pipeline may not have completely processed this version yet. - // Wire name: 'latest_version_currently_processing' LatestVersionCurrentlyProcessing int64 `json:"latest_version_currently_processing,omitempty"` // The completion ratio of this update. This is a number between 0 and 1. - // Wire name: 'sync_progress_completion' SyncProgressCompletion float64 `json:"sync_progress_completion,omitempty"` // The number of rows that have been synced in this update. - // Wire name: 'synced_row_count' SyncedRowCount int64 `json:"synced_row_count,omitempty"` // The total number of rows that need to be synced in this update. This // number may be an estimate. - // Wire name: 'total_row_count' TotalRowCount int64 `json:"total_row_count,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *SyncedTablePipelineProgress) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &syncedTablePipelineProgressPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := syncedTablePipelineProgressFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *SyncedTablePipelineProgress) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st SyncedTablePipelineProgress) MarshalJSON() ([]byte, error) { - pb, err := syncedTablePipelineProgressToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s SyncedTablePipelineProgress) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Detailed status of a synced table. Shown if the synced table is in the @@ -1202,35 +541,9 @@ func (st SyncedTablePipelineProgress) MarshalJSON() ([]byte, error) { type SyncedTableProvisioningStatus struct { // Details about initial data synchronization. Only populated when in the // PROVISIONING_INITIAL_SNAPSHOT state. - // Wire name: 'initial_pipeline_sync_progress' InitialPipelineSyncProgress *SyncedTablePipelineProgress `json:"initial_pipeline_sync_progress,omitempty"` } -func (st *SyncedTableProvisioningStatus) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &syncedTableProvisioningStatusPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := syncedTableProvisioningStatusFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st SyncedTableProvisioningStatus) MarshalJSON() ([]byte, error) { - pb, err := syncedTableProvisioningStatusToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type SyncedTableSchedulingPolicy string const SyncedTableSchedulingPolicyContinuous SyncedTableSchedulingPolicy = `CONTINUOUS` @@ -1275,7 +588,6 @@ func (f *SyncedTableSchedulingPolicy) Type() string { type SyncedTableSpec struct { // If true, the synced table's logical database and schema resources in PG // will be created if they do not already exist. - // Wire name: 'create_database_objects_if_missing' CreateDatabaseObjectsIfMissing bool `json:"create_database_objects_if_missing,omitempty"` // User-specified ID of a pre-existing pipeline to bin pack. This field is // optional, and should be empty if new_pipeline_spec is set. This field @@ -1283,52 +595,29 @@ type SyncedTableSpec struct { // the request. The SyncedTableStatus message will always contain the // effective pipeline ID (either client provided or server generated), // however. - // Wire name: 'existing_pipeline_id' ExistingPipelineId string `json:"existing_pipeline_id,omitempty"` // Spec of new pipeline. Should be empty if pipeline_id / // existing_pipeline_id is set - // Wire name: 'new_pipeline_spec' NewPipelineSpec *NewPipelineSpec `json:"new_pipeline_spec,omitempty"` // Primary Key columns to be used for data insert/update in the destination. - // Wire name: 'primary_key_columns' PrimaryKeyColumns []string `json:"primary_key_columns,omitempty"` // Scheduling policy of the underlying pipeline. - // Wire name: 'scheduling_policy' SchedulingPolicy SyncedTableSchedulingPolicy `json:"scheduling_policy,omitempty"` // Three-part (catalog, schema, table) name of the source Delta table. - // Wire name: 'source_table_full_name' SourceTableFullName string `json:"source_table_full_name,omitempty"` // Time series key to deduplicate (tie-break) rows with the same primary // key. - // Wire name: 'timeseries_key' TimeseriesKey string `json:"timeseries_key,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *SyncedTableSpec) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &syncedTableSpecPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := syncedTableSpecFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *SyncedTableSpec) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st SyncedTableSpec) MarshalJSON() ([]byte, error) { - pb, err := syncedTableSpecToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s SyncedTableSpec) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The state of a synced table. @@ -1400,59 +689,35 @@ func (f *SyncedTableState) Type() string { type SyncedTableStatus struct { // Detailed status of a synced table. Shown if the synced table is in the // SYNCED_CONTINUOUS_UPDATE or the SYNCED_UPDATING_PIPELINE_RESOURCES state. - // Wire name: 'continuous_update_status' ContinuousUpdateStatus *SyncedTableContinuousUpdateStatus `json:"continuous_update_status,omitempty"` // The state of the synced table. - // Wire name: 'detailed_state' DetailedState SyncedTableState `json:"detailed_state,omitempty"` // Detailed status of a synced table. Shown if the synced table is in the // OFFLINE_FAILED or the SYNCED_PIPELINE_FAILED state. - // Wire name: 'failed_status' FailedStatus *SyncedTableFailedStatus `json:"failed_status,omitempty"` // A text description of the current state of the synced table. - // Wire name: 'message' Message string `json:"message,omitempty"` // ID of the associated pipeline. The pipeline ID may have been provided by // the client (in the case of bin packing), or generated by the server (when // creating a new pipeline). - // Wire name: 'pipeline_id' PipelineId string `json:"pipeline_id,omitempty"` // Detailed status of a synced table. Shown if the synced table is in the // PROVISIONING_PIPELINE_RESOURCES or the PROVISIONING_INITIAL_SNAPSHOT // state. - // Wire name: 'provisioning_status' ProvisioningStatus *SyncedTableProvisioningStatus `json:"provisioning_status,omitempty"` // Detailed status of a synced table. Shown if the synced table is in the // SYNCED_TRIGGERED_UPDATE or the SYNCED_NO_PENDING_UPDATE state. - // Wire name: 'triggered_update_status' TriggeredUpdateStatus *SyncedTableTriggeredUpdateStatus `json:"triggered_update_status,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *SyncedTableStatus) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &syncedTableStatusPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := syncedTableStatusFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *SyncedTableStatus) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st SyncedTableStatus) MarshalJSON() ([]byte, error) { - pb, err := syncedTableStatusToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s SyncedTableStatus) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Detailed status of a synced table. Shown if the synced table is in the @@ -1461,77 +726,31 @@ type SyncedTableTriggeredUpdateStatus struct { // The last source table Delta version that was synced to the synced table. // Note that this Delta version may not be completely synced to the synced // table yet. - // Wire name: 'last_processed_commit_version' LastProcessedCommitVersion int64 `json:"last_processed_commit_version,omitempty"` // The timestamp of the last time any data was synchronized from the source // table to the synced table. - // Wire name: 'timestamp' Timestamp string `json:"timestamp,omitempty"` // Progress of the active data synchronization pipeline. - // Wire name: 'triggered_update_progress' TriggeredUpdateProgress *SyncedTablePipelineProgress `json:"triggered_update_progress,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *SyncedTableTriggeredUpdateStatus) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &syncedTableTriggeredUpdateStatusPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := syncedTableTriggeredUpdateStatusFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *SyncedTableTriggeredUpdateStatus) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st SyncedTableTriggeredUpdateStatus) MarshalJSON() ([]byte, error) { - pb, err := syncedTableTriggeredUpdateStatusToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s SyncedTableTriggeredUpdateStatus) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Update a Database Instance type UpdateDatabaseInstanceRequest struct { // A DatabaseInstance represents a logical Postgres instance, comprised of // both compute and storage. - // Wire name: 'database_instance' DatabaseInstance DatabaseInstance `json:"database_instance"` // The name of the instance. This is the unique identifier for the instance. - Name string `json:"-" tf:"-"` + Name string `json:"-" url:"-"` // The list of fields to update. - UpdateMask string `json:"-" tf:"-"` -} - -func (st *UpdateDatabaseInstanceRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateDatabaseInstanceRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateDatabaseInstanceRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateDatabaseInstanceRequest) MarshalJSON() ([]byte, error) { - pb, err := updateDatabaseInstanceRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + UpdateMask string `json:"-" url:"update_mask"` } diff --git a/service/files/impl.go b/service/files/impl.go index 0fd69d6ff..936b620ba 100755 --- a/service/files/impl.go +++ b/service/files/impl.go @@ -20,155 +20,57 @@ type dbfsImpl struct { } func (a *dbfsImpl) AddBlock(ctx context.Context, request AddBlock) error { - - requestPb, pbErr := addBlockToPb(&request) - if pbErr != nil { - return pbErr - } - - var addBlockResponsePb addBlockResponsePb + var addBlockResponse AddBlockResponse path := "/api/2.0/dbfs/add-block" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &addBlockResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &addBlockResponse) return err } func (a *dbfsImpl) Close(ctx context.Context, request Close) error { - - requestPb, pbErr := closeToPb(&request) - if pbErr != nil { - return pbErr - } - - var closeResponsePb closeResponsePb + var closeResponse CloseResponse path := "/api/2.0/dbfs/close" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &closeResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &closeResponse) return err } func (a *dbfsImpl) Create(ctx context.Context, request Create) (*CreateResponse, error) { - - requestPb, pbErr := createToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var createResponsePb createResponsePb + var createResponse CreateResponse path := "/api/2.0/dbfs/create" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &createResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := createResponseFromPb(&createResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &createResponse) + return &createResponse, err } func (a *dbfsImpl) Delete(ctx context.Context, request Delete) error { - - requestPb, pbErr := deleteToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteResponsePb deleteResponsePb + var deleteResponse DeleteResponse path := "/api/2.0/dbfs/delete" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &deleteResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &deleteResponse) return err } func (a *dbfsImpl) GetStatus(ctx context.Context, request GetStatusRequest) (*FileInfo, error) { - - requestPb, pbErr := getStatusRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var fileInfoPb fileInfoPb + var fileInfo FileInfo path := "/api/2.0/dbfs/get-status" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &fileInfoPb, - ) - if err != nil { - return nil, err - } - resp, err := fileInfoFromPb(&fileInfoPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &fileInfo) + return &fileInfo, err } // List the contents of a directory, or details of the file. If the file or @@ -217,154 +119,56 @@ func (a *dbfsImpl) ListAll(ctx context.Context, request ListDbfsRequest) ([]File } func (a *dbfsImpl) internalList(ctx context.Context, request ListDbfsRequest) (*ListStatusResponse, error) { - - requestPb, pbErr := listDbfsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listStatusResponsePb listStatusResponsePb + var listStatusResponse ListStatusResponse path := "/api/2.0/dbfs/list" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listStatusResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listStatusResponseFromPb(&listStatusResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listStatusResponse) + return &listStatusResponse, err } func (a *dbfsImpl) Mkdirs(ctx context.Context, request MkDirs) error { - - requestPb, pbErr := mkDirsToPb(&request) - if pbErr != nil { - return pbErr - } - - var mkDirsResponsePb mkDirsResponsePb + var mkDirsResponse MkDirsResponse path := "/api/2.0/dbfs/mkdirs" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &mkDirsResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &mkDirsResponse) return err } func (a *dbfsImpl) Move(ctx context.Context, request Move) error { - - requestPb, pbErr := moveToPb(&request) - if pbErr != nil { - return pbErr - } - - var moveResponsePb moveResponsePb + var moveResponse MoveResponse path := "/api/2.0/dbfs/move" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &moveResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &moveResponse) return err } func (a *dbfsImpl) Put(ctx context.Context, request Put) error { - - requestPb, pbErr := putToPb(&request) - if pbErr != nil { - return pbErr - } - - var putResponsePb putResponsePb + var putResponse PutResponse path := "/api/2.0/dbfs/put" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &putResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &putResponse) return err } func (a *dbfsImpl) Read(ctx context.Context, request ReadDbfsRequest) (*ReadResponse, error) { - - requestPb, pbErr := readDbfsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var readResponsePb readResponsePb + var readResponse ReadResponse path := "/api/2.0/dbfs/read" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &readResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := readResponseFromPb(&readResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &readResponse) + return &readResponse, err } // unexported type that holds implementations of just Files API methods @@ -373,174 +177,58 @@ type filesImpl struct { } func (a *filesImpl) CreateDirectory(ctx context.Context, request CreateDirectoryRequest) error { - - requestPb, pbErr := createDirectoryRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var createDirectoryResponsePb createDirectoryResponsePb - path := fmt.Sprintf("/api/2.0/fs/directories%v", httpclient.EncodeMultiSegmentPathParameter(requestPb.DirectoryPath)) + var createDirectoryResponse CreateDirectoryResponse + path := fmt.Sprintf("/api/2.0/fs/directories%v", httpclient.EncodeMultiSegmentPathParameter(request.DirectoryPath)) queryParams := make(map[string]any) headers := make(map[string]string) - err := a.client.Do( - ctx, - http.MethodPut, - path, - headers, - queryParams, - nil, - &createDirectoryResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, nil, &createDirectoryResponse) return err } func (a *filesImpl) Delete(ctx context.Context, request DeleteFileRequest) error { - - requestPb, pbErr := deleteFileRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteResponsePb deleteResponsePb - path := fmt.Sprintf("/api/2.0/fs/files%v", httpclient.EncodeMultiSegmentPathParameter(requestPb.FilePath)) + var deleteResponse DeleteResponse + path := fmt.Sprintf("/api/2.0/fs/files%v", httpclient.EncodeMultiSegmentPathParameter(request.FilePath)) queryParams := make(map[string]any) headers := make(map[string]string) - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteResponse) return err } func (a *filesImpl) DeleteDirectory(ctx context.Context, request DeleteDirectoryRequest) error { - - requestPb, pbErr := deleteDirectoryRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteDirectoryResponsePb deleteDirectoryResponsePb - path := fmt.Sprintf("/api/2.0/fs/directories%v", httpclient.EncodeMultiSegmentPathParameter(requestPb.DirectoryPath)) + var deleteDirectoryResponse DeleteDirectoryResponse + path := fmt.Sprintf("/api/2.0/fs/directories%v", httpclient.EncodeMultiSegmentPathParameter(request.DirectoryPath)) queryParams := make(map[string]any) headers := make(map[string]string) - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteDirectoryResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteDirectoryResponse) return err } func (a *filesImpl) Download(ctx context.Context, request DownloadRequest) (*DownloadResponse, error) { - - requestPb, pbErr := downloadRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var downloadResponsePb downloadResponsePb - path := fmt.Sprintf("/api/2.0/fs/files%v", httpclient.EncodeMultiSegmentPathParameter(requestPb.FilePath)) + var downloadResponse DownloadResponse + path := fmt.Sprintf("/api/2.0/fs/files%v", httpclient.EncodeMultiSegmentPathParameter(request.FilePath)) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/octet-stream" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &downloadResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := downloadResponseFromPb(&downloadResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &downloadResponse) + return &downloadResponse, err } func (a *filesImpl) GetDirectoryMetadata(ctx context.Context, request GetDirectoryMetadataRequest) error { - - requestPb, pbErr := getDirectoryMetadataRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var getDirectoryMetadataResponsePb getDirectoryMetadataResponsePb - path := fmt.Sprintf("/api/2.0/fs/directories%v", httpclient.EncodeMultiSegmentPathParameter(requestPb.DirectoryPath)) + var getDirectoryMetadataResponse GetDirectoryMetadataResponse + path := fmt.Sprintf("/api/2.0/fs/directories%v", httpclient.EncodeMultiSegmentPathParameter(request.DirectoryPath)) queryParams := make(map[string]any) headers := make(map[string]string) - err := a.client.Do( - ctx, - http.MethodHead, - path, - headers, - queryParams, - (*requestPb), - &getDirectoryMetadataResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodHead, path, headers, queryParams, request, &getDirectoryMetadataResponse) return err } func (a *filesImpl) GetMetadata(ctx context.Context, request GetMetadataRequest) (*GetMetadataResponse, error) { - - requestPb, pbErr := getMetadataRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var getMetadataResponsePb getMetadataResponsePb - path := fmt.Sprintf("/api/2.0/fs/files%v", httpclient.EncodeMultiSegmentPathParameter(requestPb.FilePath)) + var getMetadataResponse GetMetadataResponse + path := fmt.Sprintf("/api/2.0/fs/files%v", httpclient.EncodeMultiSegmentPathParameter(request.FilePath)) queryParams := make(map[string]any) headers := make(map[string]string) - err := a.client.Do( - ctx, - http.MethodHead, - path, - headers, - queryParams, - (*requestPb), - &getMetadataResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := getMetadataResponseFromPb(&getMetadataResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodHead, path, headers, queryParams, request, &getMetadataResponse) + return &getMetadataResponse, err } // Returns the contents of a directory. If there is no directory at the @@ -577,64 +265,24 @@ func (a *filesImpl) ListDirectoryContentsAll(ctx context.Context, request ListDi } func (a *filesImpl) internalListDirectoryContents(ctx context.Context, request ListDirectoryContentsRequest) (*ListDirectoryResponse, error) { - - requestPb, pbErr := listDirectoryContentsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listDirectoryResponsePb listDirectoryResponsePb - path := fmt.Sprintf("/api/2.0/fs/directories%v", httpclient.EncodeMultiSegmentPathParameter(requestPb.DirectoryPath)) + var listDirectoryResponse ListDirectoryResponse + path := fmt.Sprintf("/api/2.0/fs/directories%v", httpclient.EncodeMultiSegmentPathParameter(request.DirectoryPath)) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listDirectoryResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listDirectoryResponseFromPb(&listDirectoryResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listDirectoryResponse) + return &listDirectoryResponse, err } func (a *filesImpl) Upload(ctx context.Context, request UploadRequest) error { - - requestPb, pbErr := uploadRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var uploadResponsePb uploadResponsePb - path := fmt.Sprintf("/api/2.0/fs/files%v", httpclient.EncodeMultiSegmentPathParameter(requestPb.FilePath)) + var uploadResponse UploadResponse + path := fmt.Sprintf("/api/2.0/fs/files%v", httpclient.EncodeMultiSegmentPathParameter(request.FilePath)) queryParams := make(map[string]any) - if requestPb.Overwrite != false || slices.Contains(requestPb.ForceSendFields, "Overwrite") { - queryParams["overwrite"] = requestPb.Overwrite + if request.Overwrite != false || slices.Contains(request.ForceSendFields, "Overwrite") { + queryParams["overwrite"] = request.Overwrite } headers := make(map[string]string) headers["Content-Type"] = "application/octet-stream" - err := a.client.Do( - ctx, - http.MethodPut, - path, - headers, - queryParams, - (*requestPb).Contents, - &uploadResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request.Contents, &uploadResponse) return err } diff --git a/service/files/internal.go b/service/files/internal.go deleted file mode 100755 index f9369f695..000000000 --- a/service/files/internal.go +++ /dev/null @@ -1,1134 +0,0 @@ -// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. - -package files - -import ( - "fmt" - "io" - "strings" - "time" - - "github.com/databricks/databricks-sdk-go/marshal" -) - -func addBlockToPb(st *AddBlock) (*addBlockPb, error) { - if st == nil { - return nil, nil - } - pb := &addBlockPb{} - pb.Data = st.Data - pb.Handle = st.Handle - - return pb, nil -} - -type addBlockPb struct { - Data string `json:"data"` - Handle int64 `json:"handle"` -} - -func addBlockFromPb(pb *addBlockPb) (*AddBlock, error) { - if pb == nil { - return nil, nil - } - st := &AddBlock{} - st.Data = pb.Data - st.Handle = pb.Handle - - return st, nil -} - -func addBlockResponseToPb(st *AddBlockResponse) (*addBlockResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &addBlockResponsePb{} - - return pb, nil -} - -type addBlockResponsePb struct { -} - -func addBlockResponseFromPb(pb *addBlockResponsePb) (*AddBlockResponse, error) { - if pb == nil { - return nil, nil - } - st := &AddBlockResponse{} - - return st, nil -} - -func closeToPb(st *Close) (*closePb, error) { - if st == nil { - return nil, nil - } - pb := &closePb{} - pb.Handle = st.Handle - - return pb, nil -} - -type closePb struct { - Handle int64 `json:"handle"` -} - -func closeFromPb(pb *closePb) (*Close, error) { - if pb == nil { - return nil, nil - } - st := &Close{} - st.Handle = pb.Handle - - return st, nil -} - -func closeResponseToPb(st *CloseResponse) (*closeResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &closeResponsePb{} - - return pb, nil -} - -type closeResponsePb struct { -} - -func closeResponseFromPb(pb *closeResponsePb) (*CloseResponse, error) { - if pb == nil { - return nil, nil - } - st := &CloseResponse{} - - return st, nil -} - -func createToPb(st *Create) (*createPb, error) { - if st == nil { - return nil, nil - } - pb := &createPb{} - pb.Overwrite = st.Overwrite - pb.Path = st.Path - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createPb struct { - Overwrite bool `json:"overwrite,omitempty"` - Path string `json:"path"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createFromPb(pb *createPb) (*Create, error) { - if pb == nil { - return nil, nil - } - st := &Create{} - st.Overwrite = pb.Overwrite - st.Path = pb.Path - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createDirectoryRequestToPb(st *CreateDirectoryRequest) (*createDirectoryRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &createDirectoryRequestPb{} - pb.DirectoryPath = st.DirectoryPath - - return pb, nil -} - -type createDirectoryRequestPb struct { - DirectoryPath string `json:"-" url:"-"` -} - -func createDirectoryRequestFromPb(pb *createDirectoryRequestPb) (*CreateDirectoryRequest, error) { - if pb == nil { - return nil, nil - } - st := &CreateDirectoryRequest{} - st.DirectoryPath = pb.DirectoryPath - - return st, nil -} - -func createDirectoryResponseToPb(st *CreateDirectoryResponse) (*createDirectoryResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &createDirectoryResponsePb{} - - return pb, nil -} - -type createDirectoryResponsePb struct { -} - -func createDirectoryResponseFromPb(pb *createDirectoryResponsePb) (*CreateDirectoryResponse, error) { - if pb == nil { - return nil, nil - } - st := &CreateDirectoryResponse{} - - return st, nil -} - -func createResponseToPb(st *CreateResponse) (*createResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &createResponsePb{} - pb.Handle = st.Handle - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createResponsePb struct { - Handle int64 `json:"handle,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createResponseFromPb(pb *createResponsePb) (*CreateResponse, error) { - if pb == nil { - return nil, nil - } - st := &CreateResponse{} - st.Handle = pb.Handle - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func deleteToPb(st *Delete) (*deletePb, error) { - if st == nil { - return nil, nil - } - pb := &deletePb{} - pb.Path = st.Path - pb.Recursive = st.Recursive - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type deletePb struct { - Path string `json:"path"` - Recursive bool `json:"recursive,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func deleteFromPb(pb *deletePb) (*Delete, error) { - if pb == nil { - return nil, nil - } - st := &Delete{} - st.Path = pb.Path - st.Recursive = pb.Recursive - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *deletePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st deletePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func deleteDirectoryRequestToPb(st *DeleteDirectoryRequest) (*deleteDirectoryRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteDirectoryRequestPb{} - pb.DirectoryPath = st.DirectoryPath - - return pb, nil -} - -type deleteDirectoryRequestPb struct { - DirectoryPath string `json:"-" url:"-"` -} - -func deleteDirectoryRequestFromPb(pb *deleteDirectoryRequestPb) (*DeleteDirectoryRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteDirectoryRequest{} - st.DirectoryPath = pb.DirectoryPath - - return st, nil -} - -func deleteDirectoryResponseToPb(st *DeleteDirectoryResponse) (*deleteDirectoryResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteDirectoryResponsePb{} - - return pb, nil -} - -type deleteDirectoryResponsePb struct { -} - -func deleteDirectoryResponseFromPb(pb *deleteDirectoryResponsePb) (*DeleteDirectoryResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteDirectoryResponse{} - - return st, nil -} - -func deleteFileRequestToPb(st *DeleteFileRequest) (*deleteFileRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteFileRequestPb{} - pb.FilePath = st.FilePath - - return pb, nil -} - -type deleteFileRequestPb struct { - FilePath string `json:"-" url:"-"` -} - -func deleteFileRequestFromPb(pb *deleteFileRequestPb) (*DeleteFileRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteFileRequest{} - st.FilePath = pb.FilePath - - return st, nil -} - -func deleteResponseToPb(st *DeleteResponse) (*deleteResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteResponsePb{} - - return pb, nil -} - -type deleteResponsePb struct { -} - -func deleteResponseFromPb(pb *deleteResponsePb) (*DeleteResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteResponse{} - - return st, nil -} - -func directoryEntryToPb(st *DirectoryEntry) (*directoryEntryPb, error) { - if st == nil { - return nil, nil - } - pb := &directoryEntryPb{} - pb.FileSize = st.FileSize - pb.IsDirectory = st.IsDirectory - pb.LastModified = st.LastModified - pb.Name = st.Name - pb.Path = st.Path - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type directoryEntryPb struct { - FileSize int64 `json:"file_size,omitempty"` - IsDirectory bool `json:"is_directory,omitempty"` - LastModified int64 `json:"last_modified,omitempty"` - Name string `json:"name,omitempty"` - Path string `json:"path,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func directoryEntryFromPb(pb *directoryEntryPb) (*DirectoryEntry, error) { - if pb == nil { - return nil, nil - } - st := &DirectoryEntry{} - st.FileSize = pb.FileSize - st.IsDirectory = pb.IsDirectory - st.LastModified = pb.LastModified - st.Name = pb.Name - st.Path = pb.Path - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *directoryEntryPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st directoryEntryPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func downloadRequestToPb(st *DownloadRequest) (*downloadRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &downloadRequestPb{} - pb.FilePath = st.FilePath - - return pb, nil -} - -type downloadRequestPb struct { - FilePath string `json:"-" url:"-"` -} - -func downloadRequestFromPb(pb *downloadRequestPb) (*DownloadRequest, error) { - if pb == nil { - return nil, nil - } - st := &DownloadRequest{} - st.FilePath = pb.FilePath - - return st, nil -} - -func downloadResponseToPb(st *DownloadResponse) (*downloadResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &downloadResponsePb{} - pb.ContentLength = st.ContentLength - pb.ContentType = st.ContentType - pb.Contents = st.Contents - pb.LastModified = st.LastModified - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type downloadResponsePb struct { - ContentLength int64 `json:"-" url:"-" header:"content-length,omitempty"` - ContentType string `json:"-" url:"-" header:"content-type,omitempty"` - Contents io.ReadCloser `json:"-"` - LastModified string `json:"-" url:"-" header:"last-modified,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func downloadResponseFromPb(pb *downloadResponsePb) (*DownloadResponse, error) { - if pb == nil { - return nil, nil - } - st := &DownloadResponse{} - st.ContentLength = pb.ContentLength - st.ContentType = pb.ContentType - st.Contents = pb.Contents - st.LastModified = pb.LastModified - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *downloadResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st downloadResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func fileInfoToPb(st *FileInfo) (*fileInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &fileInfoPb{} - pb.FileSize = st.FileSize - pb.IsDir = st.IsDir - pb.ModificationTime = st.ModificationTime - pb.Path = st.Path - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type fileInfoPb struct { - FileSize int64 `json:"file_size,omitempty"` - IsDir bool `json:"is_dir,omitempty"` - ModificationTime int64 `json:"modification_time,omitempty"` - Path string `json:"path,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func fileInfoFromPb(pb *fileInfoPb) (*FileInfo, error) { - if pb == nil { - return nil, nil - } - st := &FileInfo{} - st.FileSize = pb.FileSize - st.IsDir = pb.IsDir - st.ModificationTime = pb.ModificationTime - st.Path = pb.Path - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *fileInfoPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st fileInfoPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getDirectoryMetadataRequestToPb(st *GetDirectoryMetadataRequest) (*getDirectoryMetadataRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getDirectoryMetadataRequestPb{} - pb.DirectoryPath = st.DirectoryPath - - return pb, nil -} - -type getDirectoryMetadataRequestPb struct { - DirectoryPath string `json:"-" url:"-"` -} - -func getDirectoryMetadataRequestFromPb(pb *getDirectoryMetadataRequestPb) (*GetDirectoryMetadataRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetDirectoryMetadataRequest{} - st.DirectoryPath = pb.DirectoryPath - - return st, nil -} - -func getDirectoryMetadataResponseToPb(st *GetDirectoryMetadataResponse) (*getDirectoryMetadataResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &getDirectoryMetadataResponsePb{} - - return pb, nil -} - -type getDirectoryMetadataResponsePb struct { -} - -func getDirectoryMetadataResponseFromPb(pb *getDirectoryMetadataResponsePb) (*GetDirectoryMetadataResponse, error) { - if pb == nil { - return nil, nil - } - st := &GetDirectoryMetadataResponse{} - - return st, nil -} - -func getMetadataRequestToPb(st *GetMetadataRequest) (*getMetadataRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getMetadataRequestPb{} - pb.FilePath = st.FilePath - - return pb, nil -} - -type getMetadataRequestPb struct { - FilePath string `json:"-" url:"-"` -} - -func getMetadataRequestFromPb(pb *getMetadataRequestPb) (*GetMetadataRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetMetadataRequest{} - st.FilePath = pb.FilePath - - return st, nil -} - -func getMetadataResponseToPb(st *GetMetadataResponse) (*getMetadataResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &getMetadataResponsePb{} - pb.ContentLength = st.ContentLength - pb.ContentType = st.ContentType - pb.LastModified = st.LastModified - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getMetadataResponsePb struct { - ContentLength int64 `json:"-" url:"-" header:"content-length,omitempty"` - ContentType string `json:"-" url:"-" header:"content-type,omitempty"` - LastModified string `json:"-" url:"-" header:"last-modified,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getMetadataResponseFromPb(pb *getMetadataResponsePb) (*GetMetadataResponse, error) { - if pb == nil { - return nil, nil - } - st := &GetMetadataResponse{} - st.ContentLength = pb.ContentLength - st.ContentType = pb.ContentType - st.LastModified = pb.LastModified - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getMetadataResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getMetadataResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getStatusRequestToPb(st *GetStatusRequest) (*getStatusRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getStatusRequestPb{} - pb.Path = st.Path - - return pb, nil -} - -type getStatusRequestPb struct { - Path string `json:"-" url:"path"` -} - -func getStatusRequestFromPb(pb *getStatusRequestPb) (*GetStatusRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetStatusRequest{} - st.Path = pb.Path - - return st, nil -} - -func listDbfsRequestToPb(st *ListDbfsRequest) (*listDbfsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listDbfsRequestPb{} - pb.Path = st.Path - - return pb, nil -} - -type listDbfsRequestPb struct { - Path string `json:"-" url:"path"` -} - -func listDbfsRequestFromPb(pb *listDbfsRequestPb) (*ListDbfsRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListDbfsRequest{} - st.Path = pb.Path - - return st, nil -} - -func listDirectoryContentsRequestToPb(st *ListDirectoryContentsRequest) (*listDirectoryContentsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listDirectoryContentsRequestPb{} - pb.DirectoryPath = st.DirectoryPath - pb.PageSize = st.PageSize - pb.PageToken = st.PageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listDirectoryContentsRequestPb struct { - DirectoryPath string `json:"-" url:"-"` - PageSize int64 `json:"-" url:"page_size,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listDirectoryContentsRequestFromPb(pb *listDirectoryContentsRequestPb) (*ListDirectoryContentsRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListDirectoryContentsRequest{} - st.DirectoryPath = pb.DirectoryPath - st.PageSize = pb.PageSize - st.PageToken = pb.PageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listDirectoryContentsRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listDirectoryContentsRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listDirectoryResponseToPb(st *ListDirectoryResponse) (*listDirectoryResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listDirectoryResponsePb{} - pb.Contents = st.Contents - pb.NextPageToken = st.NextPageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listDirectoryResponsePb struct { - Contents []DirectoryEntry `json:"contents,omitempty"` - NextPageToken string `json:"next_page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listDirectoryResponseFromPb(pb *listDirectoryResponsePb) (*ListDirectoryResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListDirectoryResponse{} - st.Contents = pb.Contents - st.NextPageToken = pb.NextPageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listDirectoryResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listDirectoryResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listStatusResponseToPb(st *ListStatusResponse) (*listStatusResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listStatusResponsePb{} - pb.Files = st.Files - - return pb, nil -} - -type listStatusResponsePb struct { - Files []FileInfo `json:"files,omitempty"` -} - -func listStatusResponseFromPb(pb *listStatusResponsePb) (*ListStatusResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListStatusResponse{} - st.Files = pb.Files - - return st, nil -} - -func mkDirsToPb(st *MkDirs) (*mkDirsPb, error) { - if st == nil { - return nil, nil - } - pb := &mkDirsPb{} - pb.Path = st.Path - - return pb, nil -} - -type mkDirsPb struct { - Path string `json:"path"` -} - -func mkDirsFromPb(pb *mkDirsPb) (*MkDirs, error) { - if pb == nil { - return nil, nil - } - st := &MkDirs{} - st.Path = pb.Path - - return st, nil -} - -func mkDirsResponseToPb(st *MkDirsResponse) (*mkDirsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &mkDirsResponsePb{} - - return pb, nil -} - -type mkDirsResponsePb struct { -} - -func mkDirsResponseFromPb(pb *mkDirsResponsePb) (*MkDirsResponse, error) { - if pb == nil { - return nil, nil - } - st := &MkDirsResponse{} - - return st, nil -} - -func moveToPb(st *Move) (*movePb, error) { - if st == nil { - return nil, nil - } - pb := &movePb{} - pb.DestinationPath = st.DestinationPath - pb.SourcePath = st.SourcePath - - return pb, nil -} - -type movePb struct { - DestinationPath string `json:"destination_path"` - SourcePath string `json:"source_path"` -} - -func moveFromPb(pb *movePb) (*Move, error) { - if pb == nil { - return nil, nil - } - st := &Move{} - st.DestinationPath = pb.DestinationPath - st.SourcePath = pb.SourcePath - - return st, nil -} - -func moveResponseToPb(st *MoveResponse) (*moveResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &moveResponsePb{} - - return pb, nil -} - -type moveResponsePb struct { -} - -func moveResponseFromPb(pb *moveResponsePb) (*MoveResponse, error) { - if pb == nil { - return nil, nil - } - st := &MoveResponse{} - - return st, nil -} - -func putToPb(st *Put) (*putPb, error) { - if st == nil { - return nil, nil - } - pb := &putPb{} - pb.Contents = st.Contents - pb.Overwrite = st.Overwrite - pb.Path = st.Path - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type putPb struct { - Contents string `json:"contents,omitempty"` - Overwrite bool `json:"overwrite,omitempty"` - Path string `json:"path"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func putFromPb(pb *putPb) (*Put, error) { - if pb == nil { - return nil, nil - } - st := &Put{} - st.Contents = pb.Contents - st.Overwrite = pb.Overwrite - st.Path = pb.Path - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *putPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st putPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func putResponseToPb(st *PutResponse) (*putResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &putResponsePb{} - - return pb, nil -} - -type putResponsePb struct { -} - -func putResponseFromPb(pb *putResponsePb) (*PutResponse, error) { - if pb == nil { - return nil, nil - } - st := &PutResponse{} - - return st, nil -} - -func readDbfsRequestToPb(st *ReadDbfsRequest) (*readDbfsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &readDbfsRequestPb{} - pb.Length = st.Length - pb.Offset = st.Offset - pb.Path = st.Path - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type readDbfsRequestPb struct { - Length int64 `json:"-" url:"length,omitempty"` - Offset int64 `json:"-" url:"offset,omitempty"` - Path string `json:"-" url:"path"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func readDbfsRequestFromPb(pb *readDbfsRequestPb) (*ReadDbfsRequest, error) { - if pb == nil { - return nil, nil - } - st := &ReadDbfsRequest{} - st.Length = pb.Length - st.Offset = pb.Offset - st.Path = pb.Path - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *readDbfsRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st readDbfsRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func readResponseToPb(st *ReadResponse) (*readResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &readResponsePb{} - pb.BytesRead = st.BytesRead - pb.Data = st.Data - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type readResponsePb struct { - BytesRead int64 `json:"bytes_read,omitempty"` - Data string `json:"data,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func readResponseFromPb(pb *readResponsePb) (*ReadResponse, error) { - if pb == nil { - return nil, nil - } - st := &ReadResponse{} - st.BytesRead = pb.BytesRead - st.Data = pb.Data - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *readResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st readResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func uploadRequestToPb(st *UploadRequest) (*uploadRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &uploadRequestPb{} - pb.Contents = st.Contents - pb.FilePath = st.FilePath - pb.Overwrite = st.Overwrite - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type uploadRequestPb struct { - Contents io.ReadCloser `json:"-"` - FilePath string `json:"-" url:"-"` - Overwrite bool `json:"-" url:"overwrite,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func uploadRequestFromPb(pb *uploadRequestPb) (*UploadRequest, error) { - if pb == nil { - return nil, nil - } - st := &UploadRequest{} - st.Contents = pb.Contents - st.FilePath = pb.FilePath - st.Overwrite = pb.Overwrite - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *uploadRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st uploadRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func uploadResponseToPb(st *UploadResponse) (*uploadResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &uploadResponsePb{} - - return pb, nil -} - -type uploadResponsePb struct { -} - -func uploadResponseFromPb(pb *uploadResponsePb) (*UploadResponse, error) { - if pb == nil { - return nil, nil - } - st := &UploadResponse{} - - return st, nil -} - -func durationToPb(d *time.Duration) (*string, error) { - if d == nil { - return nil, nil - } - s := fmt.Sprintf("%.9fs", d.Seconds()) - return &s, nil -} - -func durationFromPb(s *string) (*time.Duration, error) { - if s == nil { - return nil, nil - } - d, err := time.ParseDuration(*s) - if err != nil { - return nil, err - } - return &d, nil -} - -func timestampToPb(t *time.Time) (*string, error) { - if t == nil { - return nil, nil - } - s := t.Format(time.RFC3339) - return &s, nil -} - -func timestampFromPb(s *string) (*time.Time, error) { - if s == nil { - return nil, nil - } - t, err := time.Parse(time.RFC3339, *s) - if err != nil { - return nil, err - } - return &t, nil -} - -func fieldMaskToPb(fm *[]string) (*string, error) { - if fm == nil { - return nil, nil - } - s := strings.Join(*fm, ",") - return &s, nil -} - -func fieldMaskFromPb(s *string) (*[]string, error) { - if s == nil { - return nil, nil - } - fm := strings.Split(*s, ",") - return &fm, nil -} diff --git a/service/files/model.go b/service/files/model.go index 2f5ac9a69..3c406ade5 100755 --- a/service/files/model.go +++ b/service/files/model.go @@ -3,769 +3,233 @@ package files import ( - "encoding/json" - "fmt" "io" + + "github.com/databricks/databricks-sdk-go/marshal" ) type AddBlock struct { // The base64-encoded data to append to the stream. This has a limit of 1 // MB. - // Wire name: 'data' Data string `json:"data"` // The handle on an open stream. - // Wire name: 'handle' Handle int64 `json:"handle"` } -func (st *AddBlock) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &addBlockPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := addBlockFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st AddBlock) MarshalJSON() ([]byte, error) { - pb, err := addBlockToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type AddBlockResponse struct { } -func (st *AddBlockResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &addBlockResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := addBlockResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st AddBlockResponse) MarshalJSON() ([]byte, error) { - pb, err := addBlockResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type Close struct { // The handle on an open stream. - // Wire name: 'handle' Handle int64 `json:"handle"` } -func (st *Close) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &closePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := closeFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st Close) MarshalJSON() ([]byte, error) { - pb, err := closeToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type CloseResponse struct { } -func (st *CloseResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &closeResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := closeResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CloseResponse) MarshalJSON() ([]byte, error) { - pb, err := closeResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type Create struct { // The flag that specifies whether to overwrite existing file/files. - // Wire name: 'overwrite' Overwrite bool `json:"overwrite,omitempty"` // The path of the new file. The path should be the absolute DBFS path. - // Wire name: 'path' Path string `json:"path"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *Create) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *Create) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st Create) MarshalJSON() ([]byte, error) { - pb, err := createToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s Create) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Create a directory type CreateDirectoryRequest struct { // The absolute path of a directory. - DirectoryPath string `json:"-" tf:"-"` -} - -func (st *CreateDirectoryRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createDirectoryRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createDirectoryRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CreateDirectoryRequest) MarshalJSON() ([]byte, error) { - pb, err := createDirectoryRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + DirectoryPath string `json:"-" url:"-"` } type CreateDirectoryResponse struct { } -func (st *CreateDirectoryResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createDirectoryResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createDirectoryResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CreateDirectoryResponse) MarshalJSON() ([]byte, error) { - pb, err := createDirectoryResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type CreateResponse struct { // Handle which should subsequently be passed into the AddBlock and Close // calls when writing to a file through a stream. - // Wire name: 'handle' Handle int64 `json:"handle,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateResponse) MarshalJSON() ([]byte, error) { - pb, err := createResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type Delete struct { // The path of the file or directory to delete. The path should be the // absolute DBFS path. - // Wire name: 'path' Path string `json:"path"` // Whether or not to recursively delete the directory's contents. Deleting // empty directories can be done without providing the recursive flag. - // Wire name: 'recursive' Recursive bool `json:"recursive,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *Delete) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deletePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *Delete) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st Delete) MarshalJSON() ([]byte, error) { - pb, err := deleteToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s Delete) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Delete a directory type DeleteDirectoryRequest struct { // The absolute path of a directory. - DirectoryPath string `json:"-" tf:"-"` -} - -func (st *DeleteDirectoryRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteDirectoryRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteDirectoryRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteDirectoryRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteDirectoryRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + DirectoryPath string `json:"-" url:"-"` } type DeleteDirectoryResponse struct { } -func (st *DeleteDirectoryResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteDirectoryResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteDirectoryResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteDirectoryResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteDirectoryResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Delete a file type DeleteFileRequest struct { // The absolute path of the file. - FilePath string `json:"-" tf:"-"` -} - -func (st *DeleteFileRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteFileRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteFileRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteFileRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteFileRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + FilePath string `json:"-" url:"-"` } type DeleteResponse struct { } -func (st *DeleteResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type DirectoryEntry struct { // The length of the file in bytes. This field is omitted for directories. - // Wire name: 'file_size' FileSize int64 `json:"file_size,omitempty"` // True if the path is a directory. - // Wire name: 'is_directory' IsDirectory bool `json:"is_directory,omitempty"` // Last modification time of given file in milliseconds since unix epoch. - // Wire name: 'last_modified' LastModified int64 `json:"last_modified,omitempty"` // The name of the file or directory. This is the last component of the // path. - // Wire name: 'name' Name string `json:"name,omitempty"` // The absolute path of the file or directory. - // Wire name: 'path' Path string `json:"path,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DirectoryEntry) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &directoryEntryPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := directoryEntryFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DirectoryEntry) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DirectoryEntry) MarshalJSON() ([]byte, error) { - pb, err := directoryEntryToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DirectoryEntry) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Download a file type DownloadRequest struct { // The absolute path of the file. - FilePath string `json:"-" tf:"-"` -} - -func (st *DownloadRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &downloadRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := downloadRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DownloadRequest) MarshalJSON() ([]byte, error) { - pb, err := downloadRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + FilePath string `json:"-" url:"-"` } type DownloadResponse struct { // The length of the HTTP response body in bytes. - ContentLength int64 `json:"-" tf:"-"` + ContentLength int64 `json:"-" url:"-" header:"content-length,omitempty"` - ContentType string `json:"-" tf:"-"` + ContentType string `json:"-" url:"-" header:"content-type,omitempty"` - Contents io.ReadCloser `json:"-" tf:"-"` + Contents io.ReadCloser `json:"-"` // The last modified time of the file in HTTP-date (RFC 7231) format. - LastModified string `json:"-" tf:"-"` + LastModified string `json:"-" url:"-" header:"last-modified,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DownloadResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &downloadResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := downloadResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DownloadResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DownloadResponse) MarshalJSON() ([]byte, error) { - pb, err := downloadResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DownloadResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type FileInfo struct { // The length of the file in bytes. This field is omitted for directories. - // Wire name: 'file_size' FileSize int64 `json:"file_size,omitempty"` // True if the path is a directory. - // Wire name: 'is_dir' IsDir bool `json:"is_dir,omitempty"` // Last modification time of given file in milliseconds since epoch. - // Wire name: 'modification_time' ModificationTime int64 `json:"modification_time,omitempty"` // The absolute path of the file or directory. - // Wire name: 'path' Path string `json:"path,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *FileInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &fileInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := fileInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *FileInfo) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st FileInfo) MarshalJSON() ([]byte, error) { - pb, err := fileInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s FileInfo) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get directory metadata type GetDirectoryMetadataRequest struct { // The absolute path of a directory. - DirectoryPath string `json:"-" tf:"-"` -} - -func (st *GetDirectoryMetadataRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getDirectoryMetadataRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getDirectoryMetadataRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetDirectoryMetadataRequest) MarshalJSON() ([]byte, error) { - pb, err := getDirectoryMetadataRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + DirectoryPath string `json:"-" url:"-"` } type GetDirectoryMetadataResponse struct { } -func (st *GetDirectoryMetadataResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getDirectoryMetadataResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getDirectoryMetadataResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetDirectoryMetadataResponse) MarshalJSON() ([]byte, error) { - pb, err := getDirectoryMetadataResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Get file metadata type GetMetadataRequest struct { // The absolute path of the file. - FilePath string `json:"-" tf:"-"` -} - -func (st *GetMetadataRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getMetadataRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getMetadataRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetMetadataRequest) MarshalJSON() ([]byte, error) { - pb, err := getMetadataRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + FilePath string `json:"-" url:"-"` } type GetMetadataResponse struct { // The length of the HTTP response body in bytes. - ContentLength int64 `json:"-" tf:"-"` + ContentLength int64 `json:"-" url:"-" header:"content-length,omitempty"` - ContentType string `json:"-" tf:"-"` + ContentType string `json:"-" url:"-" header:"content-type,omitempty"` // The last modified time of the file in HTTP-date (RFC 7231) format. - LastModified string `json:"-" tf:"-"` + LastModified string `json:"-" url:"-" header:"last-modified,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetMetadataResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getMetadataResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getMetadataResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetMetadataResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetMetadataResponse) MarshalJSON() ([]byte, error) { - pb, err := getMetadataResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetMetadataResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get the information of a file or directory type GetStatusRequest struct { // The path of the file or directory. The path should be the absolute DBFS // path. - Path string `json:"-" tf:"-"` -} - -func (st *GetStatusRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getStatusRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getStatusRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetStatusRequest) MarshalJSON() ([]byte, error) { - pb, err := getStatusRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Path string `json:"-" url:"path"` } // List directory contents or file details type ListDbfsRequest struct { // The path of the file or directory. The path should be the absolute DBFS // path. - Path string `json:"-" tf:"-"` -} - -func (st *ListDbfsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listDbfsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listDbfsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ListDbfsRequest) MarshalJSON() ([]byte, error) { - pb, err := listDbfsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Path string `json:"-" url:"path"` } // List directory contents type ListDirectoryContentsRequest struct { // The absolute path of a directory. - DirectoryPath string `json:"-" tf:"-"` + DirectoryPath string `json:"-" url:"-"` // The maximum number of directory entries to return. The response may // contain fewer entries. If the response contains a `next_page_token`, // there may be more entries, even if fewer than `page_size` entries are in @@ -776,7 +240,7 @@ type ListDirectoryContentsRequest struct { // // If unspecified, at most 1000 directory entries will be returned. The // maximum value is 1000. Values above 1000 will be coerced to 1000. - PageSize int64 `json:"-" tf:"-"` + PageSize int64 `json:"-" url:"page_size,omitempty"` // An opaque page token which was the `next_page_token` in the response of // the previous request to list the contents of this directory. Provide this // token to retrieve the next page of directory entries. When providing a @@ -785,431 +249,143 @@ type ListDirectoryContentsRequest struct { // necessary to continue requesting pages of entries until the response // contains no `next_page_token`. Note that the number of entries returned // must not be used to determine when the listing is complete. - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListDirectoryContentsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listDirectoryContentsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listDirectoryContentsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListDirectoryContentsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListDirectoryContentsRequest) MarshalJSON() ([]byte, error) { - pb, err := listDirectoryContentsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListDirectoryContentsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListDirectoryResponse struct { // Array of DirectoryEntry. - // Wire name: 'contents' Contents []DirectoryEntry `json:"contents,omitempty"` // A token, which can be sent as `page_token` to retrieve the next page. - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListDirectoryResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listDirectoryResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listDirectoryResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListDirectoryResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListDirectoryResponse) MarshalJSON() ([]byte, error) { - pb, err := listDirectoryResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListDirectoryResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListStatusResponse struct { // A list of FileInfo's that describe contents of directory or file. See // example above. - // Wire name: 'files' Files []FileInfo `json:"files,omitempty"` } -func (st *ListStatusResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listStatusResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listStatusResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ListStatusResponse) MarshalJSON() ([]byte, error) { - pb, err := listStatusResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type MkDirs struct { // The path of the new directory. The path should be the absolute DBFS path. - // Wire name: 'path' Path string `json:"path"` } -func (st *MkDirs) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &mkDirsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := mkDirsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st MkDirs) MarshalJSON() ([]byte, error) { - pb, err := mkDirsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type MkDirsResponse struct { } -func (st *MkDirsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &mkDirsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := mkDirsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st MkDirsResponse) MarshalJSON() ([]byte, error) { - pb, err := mkDirsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type Move struct { // The destination path of the file or directory. The path should be the // absolute DBFS path. - // Wire name: 'destination_path' DestinationPath string `json:"destination_path"` // The source path of the file or directory. The path should be the absolute // DBFS path. - // Wire name: 'source_path' SourcePath string `json:"source_path"` } -func (st *Move) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &movePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := moveFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st Move) MarshalJSON() ([]byte, error) { - pb, err := moveToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type MoveResponse struct { } -func (st *MoveResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &moveResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := moveResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st MoveResponse) MarshalJSON() ([]byte, error) { - pb, err := moveResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type Put struct { // This parameter might be absent, and instead a posted file will be used. - // Wire name: 'contents' Contents string `json:"contents,omitempty"` // The flag that specifies whether to overwrite existing file/files. - // Wire name: 'overwrite' Overwrite bool `json:"overwrite,omitempty"` // The path of the new file. The path should be the absolute DBFS path. - // Wire name: 'path' Path string `json:"path"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *Put) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &putPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := putFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *Put) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st Put) MarshalJSON() ([]byte, error) { - pb, err := putToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s Put) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type PutResponse struct { } -func (st *PutResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &putResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := putResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st PutResponse) MarshalJSON() ([]byte, error) { - pb, err := putResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Get the contents of a file type ReadDbfsRequest struct { // The number of bytes to read starting from the offset. This has a limit of // 1 MB, and a default value of 0.5 MB. - Length int64 `json:"-" tf:"-"` + Length int64 `json:"-" url:"length,omitempty"` // The offset to read from in bytes. - Offset int64 `json:"-" tf:"-"` + Offset int64 `json:"-" url:"offset,omitempty"` // The path of the file to read. The path should be the absolute DBFS path. - Path string `json:"-" tf:"-"` + Path string `json:"-" url:"path"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ReadDbfsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &readDbfsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := readDbfsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ReadDbfsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ReadDbfsRequest) MarshalJSON() ([]byte, error) { - pb, err := readDbfsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ReadDbfsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ReadResponse struct { // The number of bytes read (could be less than ``length`` if we hit end of // file). This refers to number of bytes read in unencoded version (response // data is base64-encoded). - // Wire name: 'bytes_read' BytesRead int64 `json:"bytes_read,omitempty"` // The base64-encoded contents of the file read. - // Wire name: 'data' Data string `json:"data,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ReadResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &readResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := readResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ReadResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ReadResponse) MarshalJSON() ([]byte, error) { - pb, err := readResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ReadResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Upload a file type UploadRequest struct { - Contents io.ReadCloser `json:"-" tf:"-"` + Contents io.ReadCloser `json:"-"` // The absolute path of the file. - FilePath string `json:"-" tf:"-"` + FilePath string `json:"-" url:"-"` // If true or unspecified, an existing file will be overwritten. If false, // an error will be returned if the path points to an existing file. - Overwrite bool `json:"-" tf:"-"` + Overwrite bool `json:"-" url:"overwrite,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *UploadRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &uploadRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := uploadRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *UploadRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st UploadRequest) MarshalJSON() ([]byte, error) { - pb, err := uploadRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s UploadRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type UploadResponse struct { } - -func (st *UploadResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &uploadResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := uploadResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UploadResponse) MarshalJSON() ([]byte, error) { - pb, err := uploadResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} diff --git a/service/iam/impl.go b/service/iam/impl.go index 878b8abe1..812150b64 100755 --- a/service/iam/impl.go +++ b/service/iam/impl.go @@ -18,35 +18,13 @@ type accessControlImpl struct { } func (a *accessControlImpl) CheckPolicy(ctx context.Context, request CheckPolicyRequest) (*CheckPolicyResponse, error) { - - requestPb, pbErr := checkPolicyRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var checkPolicyResponsePb checkPolicyResponsePb + var checkPolicyResponse CheckPolicyResponse path := "/api/2.0/access-control/check-policy-v2" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &checkPolicyResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := checkPolicyResponseFromPb(&checkPolicyResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &checkPolicyResponse) + return &checkPolicyResponse, err } // unexported type that holds implementations of just AccountAccessControl API methods @@ -55,100 +33,34 @@ type accountAccessControlImpl struct { } func (a *accountAccessControlImpl) GetAssignableRolesForResource(ctx context.Context, request GetAssignableRolesForResourceRequest) (*GetAssignableRolesForResourceResponse, error) { - - requestPb, pbErr := getAssignableRolesForResourceRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var getAssignableRolesForResourceResponsePb getAssignableRolesForResourceResponsePb + var getAssignableRolesForResourceResponse GetAssignableRolesForResourceResponse path := fmt.Sprintf("/api/2.0/preview/accounts/%v/access-control/assignable-roles", a.client.ConfiguredAccountID()) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &getAssignableRolesForResourceResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := getAssignableRolesForResourceResponseFromPb(&getAssignableRolesForResourceResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getAssignableRolesForResourceResponse) + return &getAssignableRolesForResourceResponse, err } func (a *accountAccessControlImpl) GetRuleSet(ctx context.Context, request GetRuleSetRequest) (*RuleSetResponse, error) { - - requestPb, pbErr := getRuleSetRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var ruleSetResponsePb ruleSetResponsePb + var ruleSetResponse RuleSetResponse path := fmt.Sprintf("/api/2.0/preview/accounts/%v/access-control/rule-sets", a.client.ConfiguredAccountID()) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &ruleSetResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := ruleSetResponseFromPb(&ruleSetResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &ruleSetResponse) + return &ruleSetResponse, err } func (a *accountAccessControlImpl) UpdateRuleSet(ctx context.Context, request UpdateRuleSetRequest) (*RuleSetResponse, error) { - - requestPb, pbErr := updateRuleSetRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var ruleSetResponsePb ruleSetResponsePb + var ruleSetResponse RuleSetResponse path := fmt.Sprintf("/api/2.0/preview/accounts/%v/access-control/rule-sets", a.client.ConfiguredAccountID()) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPut, - path, - headers, - queryParams, - (*requestPb), - &ruleSetResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := ruleSetResponseFromPb(&ruleSetResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &ruleSetResponse) + return &ruleSetResponse, err } // unexported type that holds implementations of just AccountAccessControlProxy API methods @@ -157,100 +69,34 @@ type accountAccessControlProxyImpl struct { } func (a *accountAccessControlProxyImpl) GetAssignableRolesForResource(ctx context.Context, request GetAssignableRolesForResourceRequest) (*GetAssignableRolesForResourceResponse, error) { - - requestPb, pbErr := getAssignableRolesForResourceRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var getAssignableRolesForResourceResponsePb getAssignableRolesForResourceResponsePb + var getAssignableRolesForResourceResponse GetAssignableRolesForResourceResponse path := "/api/2.0/preview/accounts/access-control/assignable-roles" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &getAssignableRolesForResourceResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := getAssignableRolesForResourceResponseFromPb(&getAssignableRolesForResourceResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getAssignableRolesForResourceResponse) + return &getAssignableRolesForResourceResponse, err } func (a *accountAccessControlProxyImpl) GetRuleSet(ctx context.Context, request GetRuleSetRequest) (*RuleSetResponse, error) { - - requestPb, pbErr := getRuleSetRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var ruleSetResponsePb ruleSetResponsePb + var ruleSetResponse RuleSetResponse path := "/api/2.0/preview/accounts/access-control/rule-sets" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &ruleSetResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := ruleSetResponseFromPb(&ruleSetResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &ruleSetResponse) + return &ruleSetResponse, err } func (a *accountAccessControlProxyImpl) UpdateRuleSet(ctx context.Context, request UpdateRuleSetRequest) (*RuleSetResponse, error) { - - requestPb, pbErr := updateRuleSetRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var ruleSetResponsePb ruleSetResponsePb + var ruleSetResponse RuleSetResponse path := "/api/2.0/preview/accounts/access-control/rule-sets" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPut, - path, - headers, - queryParams, - (*requestPb), - &ruleSetResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := ruleSetResponseFromPb(&ruleSetResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &ruleSetResponse) + return &ruleSetResponse, err } // unexported type that holds implementations of just AccountGroups API methods @@ -259,95 +105,33 @@ type accountGroupsImpl struct { } func (a *accountGroupsImpl) Create(ctx context.Context, request Group) (*Group, error) { - - requestPb, pbErr := groupToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var groupPb groupPb + var group Group path := fmt.Sprintf("/api/2.0/accounts/%v/scim/v2/Groups", a.client.ConfiguredAccountID()) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &groupPb, - ) - if err != nil { - return nil, err - } - resp, err := groupFromPb(&groupPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &group) + return &group, err } func (a *accountGroupsImpl) Delete(ctx context.Context, request DeleteAccountGroupRequest) error { - - requestPb, pbErr := deleteAccountGroupRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteResponsePb deleteResponsePb - path := fmt.Sprintf("/api/2.0/accounts/%v/scim/v2/Groups/%v", a.client.ConfiguredAccountID(), requestPb.Id) + var deleteResponse DeleteResponse + path := fmt.Sprintf("/api/2.0/accounts/%v/scim/v2/Groups/%v", a.client.ConfiguredAccountID(), request.Id) queryParams := make(map[string]any) headers := make(map[string]string) - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteResponse) return err } func (a *accountGroupsImpl) Get(ctx context.Context, request GetAccountGroupRequest) (*Group, error) { - - requestPb, pbErr := getAccountGroupRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var groupPb groupPb - path := fmt.Sprintf("/api/2.0/accounts/%v/scim/v2/Groups/%v", a.client.ConfiguredAccountID(), requestPb.Id) + var group Group + path := fmt.Sprintf("/api/2.0/accounts/%v/scim/v2/Groups/%v", a.client.ConfiguredAccountID(), request.Id) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &groupPb, - ) - if err != nil { - return nil, err - } - resp, err := groupFromPb(&groupPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &group) + return &group, err } // Gets all details of the groups associated with the Databricks account. @@ -392,90 +176,32 @@ func (a *accountGroupsImpl) ListAll(ctx context.Context, request ListAccountGrou } func (a *accountGroupsImpl) internalList(ctx context.Context, request ListAccountGroupsRequest) (*ListGroupsResponse, error) { - - requestPb, pbErr := listAccountGroupsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listGroupsResponsePb listGroupsResponsePb + var listGroupsResponse ListGroupsResponse path := fmt.Sprintf("/api/2.0/accounts/%v/scim/v2/Groups", a.client.ConfiguredAccountID()) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listGroupsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listGroupsResponseFromPb(&listGroupsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listGroupsResponse) + return &listGroupsResponse, err } func (a *accountGroupsImpl) Patch(ctx context.Context, request PartialUpdate) error { - - requestPb, pbErr := partialUpdateToPb(&request) - if pbErr != nil { - return pbErr - } - - var patchResponsePb patchResponsePb - path := fmt.Sprintf("/api/2.0/accounts/%v/scim/v2/Groups/%v", a.client.ConfiguredAccountID(), requestPb.Id) + var patchResponse PatchResponse + path := fmt.Sprintf("/api/2.0/accounts/%v/scim/v2/Groups/%v", a.client.ConfiguredAccountID(), request.Id) queryParams := make(map[string]any) headers := make(map[string]string) headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &patchResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &patchResponse) return err } func (a *accountGroupsImpl) Update(ctx context.Context, request Group) error { - - requestPb, pbErr := groupToPb(&request) - if pbErr != nil { - return pbErr - } - - var updateResponsePb updateResponsePb - path := fmt.Sprintf("/api/2.0/accounts/%v/scim/v2/Groups/%v", a.client.ConfiguredAccountID(), requestPb.Id) + var updateResponse UpdateResponse + path := fmt.Sprintf("/api/2.0/accounts/%v/scim/v2/Groups/%v", a.client.ConfiguredAccountID(), request.Id) queryParams := make(map[string]any) headers := make(map[string]string) headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPut, - path, - headers, - queryParams, - (*requestPb), - &updateResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &updateResponse) return err } @@ -485,95 +211,33 @@ type accountServicePrincipalsImpl struct { } func (a *accountServicePrincipalsImpl) Create(ctx context.Context, request ServicePrincipal) (*ServicePrincipal, error) { - - requestPb, pbErr := servicePrincipalToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var servicePrincipalPb servicePrincipalPb + var servicePrincipal ServicePrincipal path := fmt.Sprintf("/api/2.0/accounts/%v/scim/v2/ServicePrincipals", a.client.ConfiguredAccountID()) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &servicePrincipalPb, - ) - if err != nil { - return nil, err - } - resp, err := servicePrincipalFromPb(&servicePrincipalPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &servicePrincipal) + return &servicePrincipal, err } func (a *accountServicePrincipalsImpl) Delete(ctx context.Context, request DeleteAccountServicePrincipalRequest) error { - - requestPb, pbErr := deleteAccountServicePrincipalRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteResponsePb deleteResponsePb - path := fmt.Sprintf("/api/2.0/accounts/%v/scim/v2/ServicePrincipals/%v", a.client.ConfiguredAccountID(), requestPb.Id) + var deleteResponse DeleteResponse + path := fmt.Sprintf("/api/2.0/accounts/%v/scim/v2/ServicePrincipals/%v", a.client.ConfiguredAccountID(), request.Id) queryParams := make(map[string]any) headers := make(map[string]string) - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteResponse) return err } func (a *accountServicePrincipalsImpl) Get(ctx context.Context, request GetAccountServicePrincipalRequest) (*ServicePrincipal, error) { - - requestPb, pbErr := getAccountServicePrincipalRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var servicePrincipalPb servicePrincipalPb - path := fmt.Sprintf("/api/2.0/accounts/%v/scim/v2/ServicePrincipals/%v", a.client.ConfiguredAccountID(), requestPb.Id) + var servicePrincipal ServicePrincipal + path := fmt.Sprintf("/api/2.0/accounts/%v/scim/v2/ServicePrincipals/%v", a.client.ConfiguredAccountID(), request.Id) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &servicePrincipalPb, - ) - if err != nil { - return nil, err - } - resp, err := servicePrincipalFromPb(&servicePrincipalPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &servicePrincipal) + return &servicePrincipal, err } // Gets the set of service principals associated with a Databricks account. @@ -618,90 +282,32 @@ func (a *accountServicePrincipalsImpl) ListAll(ctx context.Context, request List } func (a *accountServicePrincipalsImpl) internalList(ctx context.Context, request ListAccountServicePrincipalsRequest) (*ListServicePrincipalResponse, error) { - - requestPb, pbErr := listAccountServicePrincipalsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listServicePrincipalResponsePb listServicePrincipalResponsePb + var listServicePrincipalResponse ListServicePrincipalResponse path := fmt.Sprintf("/api/2.0/accounts/%v/scim/v2/ServicePrincipals", a.client.ConfiguredAccountID()) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listServicePrincipalResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listServicePrincipalResponseFromPb(&listServicePrincipalResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listServicePrincipalResponse) + return &listServicePrincipalResponse, err } func (a *accountServicePrincipalsImpl) Patch(ctx context.Context, request PartialUpdate) error { - - requestPb, pbErr := partialUpdateToPb(&request) - if pbErr != nil { - return pbErr - } - - var patchResponsePb patchResponsePb - path := fmt.Sprintf("/api/2.0/accounts/%v/scim/v2/ServicePrincipals/%v", a.client.ConfiguredAccountID(), requestPb.Id) + var patchResponse PatchResponse + path := fmt.Sprintf("/api/2.0/accounts/%v/scim/v2/ServicePrincipals/%v", a.client.ConfiguredAccountID(), request.Id) queryParams := make(map[string]any) headers := make(map[string]string) headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &patchResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &patchResponse) return err } func (a *accountServicePrincipalsImpl) Update(ctx context.Context, request ServicePrincipal) error { - - requestPb, pbErr := servicePrincipalToPb(&request) - if pbErr != nil { - return pbErr - } - - var updateResponsePb updateResponsePb - path := fmt.Sprintf("/api/2.0/accounts/%v/scim/v2/ServicePrincipals/%v", a.client.ConfiguredAccountID(), requestPb.Id) + var updateResponse UpdateResponse + path := fmt.Sprintf("/api/2.0/accounts/%v/scim/v2/ServicePrincipals/%v", a.client.ConfiguredAccountID(), request.Id) queryParams := make(map[string]any) headers := make(map[string]string) headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPut, - path, - headers, - queryParams, - (*requestPb), - &updateResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &updateResponse) return err } @@ -711,95 +317,33 @@ type accountUsersImpl struct { } func (a *accountUsersImpl) Create(ctx context.Context, request User) (*User, error) { - - requestPb, pbErr := userToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var userPb userPb + var user User path := fmt.Sprintf("/api/2.0/accounts/%v/scim/v2/Users", a.client.ConfiguredAccountID()) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &userPb, - ) - if err != nil { - return nil, err - } - resp, err := userFromPb(&userPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &user) + return &user, err } func (a *accountUsersImpl) Delete(ctx context.Context, request DeleteAccountUserRequest) error { - - requestPb, pbErr := deleteAccountUserRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteResponsePb deleteResponsePb - path := fmt.Sprintf("/api/2.0/accounts/%v/scim/v2/Users/%v", a.client.ConfiguredAccountID(), requestPb.Id) + var deleteResponse DeleteResponse + path := fmt.Sprintf("/api/2.0/accounts/%v/scim/v2/Users/%v", a.client.ConfiguredAccountID(), request.Id) queryParams := make(map[string]any) headers := make(map[string]string) - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteResponse) return err } func (a *accountUsersImpl) Get(ctx context.Context, request GetAccountUserRequest) (*User, error) { - - requestPb, pbErr := getAccountUserRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var userPb userPb - path := fmt.Sprintf("/api/2.0/accounts/%v/scim/v2/Users/%v", a.client.ConfiguredAccountID(), requestPb.Id) + var user User + path := fmt.Sprintf("/api/2.0/accounts/%v/scim/v2/Users/%v", a.client.ConfiguredAccountID(), request.Id) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &userPb, - ) - if err != nil { - return nil, err - } - resp, err := userFromPb(&userPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &user) + return &user, err } // Gets details for all the users associated with a Databricks account. @@ -844,90 +388,32 @@ func (a *accountUsersImpl) ListAll(ctx context.Context, request ListAccountUsers } func (a *accountUsersImpl) internalList(ctx context.Context, request ListAccountUsersRequest) (*ListUsersResponse, error) { - - requestPb, pbErr := listAccountUsersRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listUsersResponsePb listUsersResponsePb + var listUsersResponse ListUsersResponse path := fmt.Sprintf("/api/2.0/accounts/%v/scim/v2/Users", a.client.ConfiguredAccountID()) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listUsersResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listUsersResponseFromPb(&listUsersResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listUsersResponse) + return &listUsersResponse, err } func (a *accountUsersImpl) Patch(ctx context.Context, request PartialUpdate) error { - - requestPb, pbErr := partialUpdateToPb(&request) - if pbErr != nil { - return pbErr - } - - var patchResponsePb patchResponsePb - path := fmt.Sprintf("/api/2.0/accounts/%v/scim/v2/Users/%v", a.client.ConfiguredAccountID(), requestPb.Id) + var patchResponse PatchResponse + path := fmt.Sprintf("/api/2.0/accounts/%v/scim/v2/Users/%v", a.client.ConfiguredAccountID(), request.Id) queryParams := make(map[string]any) headers := make(map[string]string) headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &patchResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &patchResponse) return err } func (a *accountUsersImpl) Update(ctx context.Context, request User) error { - - requestPb, pbErr := userToPb(&request) - if pbErr != nil { - return pbErr - } - - var updateResponsePb updateResponsePb - path := fmt.Sprintf("/api/2.0/accounts/%v/scim/v2/Users/%v", a.client.ConfiguredAccountID(), requestPb.Id) + var updateResponse UpdateResponse + path := fmt.Sprintf("/api/2.0/accounts/%v/scim/v2/Users/%v", a.client.ConfiguredAccountID(), request.Id) queryParams := make(map[string]any) headers := make(map[string]string) headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPut, - path, - headers, - queryParams, - (*requestPb), - &updateResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &updateResponse) return err } @@ -937,30 +423,13 @@ type currentUserImpl struct { } func (a *currentUserImpl) Me(ctx context.Context) (*User, error) { - - var userPb userPb + var user User path := "/api/2.0/preview/scim/v2/Me" headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - nil, - nil, - &userPb, - ) - if err != nil { - return nil, err - } - resp, err := userFromPb(&userPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, nil, nil, &user) + return &user, err } // unexported type that holds implementations of just Groups API methods @@ -969,95 +438,33 @@ type groupsImpl struct { } func (a *groupsImpl) Create(ctx context.Context, request Group) (*Group, error) { - - requestPb, pbErr := groupToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var groupPb groupPb + var group Group path := "/api/2.0/preview/scim/v2/Groups" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &groupPb, - ) - if err != nil { - return nil, err - } - resp, err := groupFromPb(&groupPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &group) + return &group, err } func (a *groupsImpl) Delete(ctx context.Context, request DeleteGroupRequest) error { - - requestPb, pbErr := deleteGroupRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteResponsePb deleteResponsePb - path := fmt.Sprintf("/api/2.0/preview/scim/v2/Groups/%v", requestPb.Id) + var deleteResponse DeleteResponse + path := fmt.Sprintf("/api/2.0/preview/scim/v2/Groups/%v", request.Id) queryParams := make(map[string]any) headers := make(map[string]string) - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteResponse) return err } func (a *groupsImpl) Get(ctx context.Context, request GetGroupRequest) (*Group, error) { - - requestPb, pbErr := getGroupRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var groupPb groupPb - path := fmt.Sprintf("/api/2.0/preview/scim/v2/Groups/%v", requestPb.Id) + var group Group + path := fmt.Sprintf("/api/2.0/preview/scim/v2/Groups/%v", request.Id) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &groupPb, - ) - if err != nil { - return nil, err - } - resp, err := groupFromPb(&groupPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &group) + return &group, err } // Gets all details of the groups associated with the Databricks workspace. @@ -1102,90 +509,32 @@ func (a *groupsImpl) ListAll(ctx context.Context, request ListGroupsRequest) ([] } func (a *groupsImpl) internalList(ctx context.Context, request ListGroupsRequest) (*ListGroupsResponse, error) { - - requestPb, pbErr := listGroupsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listGroupsResponsePb listGroupsResponsePb + var listGroupsResponse ListGroupsResponse path := "/api/2.0/preview/scim/v2/Groups" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listGroupsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listGroupsResponseFromPb(&listGroupsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listGroupsResponse) + return &listGroupsResponse, err } func (a *groupsImpl) Patch(ctx context.Context, request PartialUpdate) error { - - requestPb, pbErr := partialUpdateToPb(&request) - if pbErr != nil { - return pbErr - } - - var patchResponsePb patchResponsePb - path := fmt.Sprintf("/api/2.0/preview/scim/v2/Groups/%v", requestPb.Id) + var patchResponse PatchResponse + path := fmt.Sprintf("/api/2.0/preview/scim/v2/Groups/%v", request.Id) queryParams := make(map[string]any) headers := make(map[string]string) headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &patchResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &patchResponse) return err } func (a *groupsImpl) Update(ctx context.Context, request Group) error { - - requestPb, pbErr := groupToPb(&request) - if pbErr != nil { - return pbErr - } - - var updateResponsePb updateResponsePb - path := fmt.Sprintf("/api/2.0/preview/scim/v2/Groups/%v", requestPb.Id) + var updateResponse UpdateResponse + path := fmt.Sprintf("/api/2.0/preview/scim/v2/Groups/%v", request.Id) queryParams := make(map[string]any) headers := make(map[string]string) headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPut, - path, - headers, - queryParams, - (*requestPb), - &updateResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &updateResponse) return err } @@ -1195,36 +544,14 @@ type permissionMigrationImpl struct { } func (a *permissionMigrationImpl) MigratePermissions(ctx context.Context, request MigratePermissionsRequest) (*MigratePermissionsResponse, error) { - - requestPb, pbErr := migratePermissionsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var migratePermissionsResponsePb migratePermissionsResponsePb + var migratePermissionsResponse MigratePermissionsResponse path := "/api/2.0/permissionmigration" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &migratePermissionsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := migratePermissionsResponseFromPb(&migratePermissionsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &migratePermissionsResponse) + return &migratePermissionsResponse, err } // unexported type that holds implementations of just Permissions API methods @@ -1233,133 +560,45 @@ type permissionsImpl struct { } func (a *permissionsImpl) Get(ctx context.Context, request GetPermissionRequest) (*ObjectPermissions, error) { - - requestPb, pbErr := getPermissionRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var objectPermissionsPb objectPermissionsPb - path := fmt.Sprintf("/api/2.0/permissions/%v/%v", requestPb.RequestObjectType, requestPb.RequestObjectId) + var objectPermissions ObjectPermissions + path := fmt.Sprintf("/api/2.0/permissions/%v/%v", request.RequestObjectType, request.RequestObjectId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &objectPermissionsPb, - ) - if err != nil { - return nil, err - } - resp, err := objectPermissionsFromPb(&objectPermissionsPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &objectPermissions) + return &objectPermissions, err } func (a *permissionsImpl) GetPermissionLevels(ctx context.Context, request GetPermissionLevelsRequest) (*GetPermissionLevelsResponse, error) { - - requestPb, pbErr := getPermissionLevelsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var getPermissionLevelsResponsePb getPermissionLevelsResponsePb - path := fmt.Sprintf("/api/2.0/permissions/%v/%v/permissionLevels", requestPb.RequestObjectType, requestPb.RequestObjectId) + var getPermissionLevelsResponse GetPermissionLevelsResponse + path := fmt.Sprintf("/api/2.0/permissions/%v/%v/permissionLevels", request.RequestObjectType, request.RequestObjectId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &getPermissionLevelsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := getPermissionLevelsResponseFromPb(&getPermissionLevelsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getPermissionLevelsResponse) + return &getPermissionLevelsResponse, err } func (a *permissionsImpl) Set(ctx context.Context, request SetObjectPermissions) (*ObjectPermissions, error) { - - requestPb, pbErr := setObjectPermissionsToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var objectPermissionsPb objectPermissionsPb - path := fmt.Sprintf("/api/2.0/permissions/%v/%v", requestPb.RequestObjectType, requestPb.RequestObjectId) + var objectPermissions ObjectPermissions + path := fmt.Sprintf("/api/2.0/permissions/%v/%v", request.RequestObjectType, request.RequestObjectId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPut, - path, - headers, - queryParams, - (*requestPb), - &objectPermissionsPb, - ) - if err != nil { - return nil, err - } - resp, err := objectPermissionsFromPb(&objectPermissionsPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &objectPermissions) + return &objectPermissions, err } func (a *permissionsImpl) Update(ctx context.Context, request UpdateObjectPermissions) (*ObjectPermissions, error) { - - requestPb, pbErr := updateObjectPermissionsToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var objectPermissionsPb objectPermissionsPb - path := fmt.Sprintf("/api/2.0/permissions/%v/%v", requestPb.RequestObjectType, requestPb.RequestObjectId) + var objectPermissions ObjectPermissions + path := fmt.Sprintf("/api/2.0/permissions/%v/%v", request.RequestObjectType, request.RequestObjectId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &objectPermissionsPb, - ) - if err != nil { - return nil, err - } - resp, err := objectPermissionsFromPb(&objectPermissionsPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &objectPermissions) + return &objectPermissions, err } // unexported type that holds implementations of just ServicePrincipals API methods @@ -1368,95 +607,33 @@ type servicePrincipalsImpl struct { } func (a *servicePrincipalsImpl) Create(ctx context.Context, request ServicePrincipal) (*ServicePrincipal, error) { - - requestPb, pbErr := servicePrincipalToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var servicePrincipalPb servicePrincipalPb + var servicePrincipal ServicePrincipal path := "/api/2.0/preview/scim/v2/ServicePrincipals" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &servicePrincipalPb, - ) - if err != nil { - return nil, err - } - resp, err := servicePrincipalFromPb(&servicePrincipalPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &servicePrincipal) + return &servicePrincipal, err } func (a *servicePrincipalsImpl) Delete(ctx context.Context, request DeleteServicePrincipalRequest) error { - - requestPb, pbErr := deleteServicePrincipalRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteResponsePb deleteResponsePb - path := fmt.Sprintf("/api/2.0/preview/scim/v2/ServicePrincipals/%v", requestPb.Id) + var deleteResponse DeleteResponse + path := fmt.Sprintf("/api/2.0/preview/scim/v2/ServicePrincipals/%v", request.Id) queryParams := make(map[string]any) headers := make(map[string]string) - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteResponse) return err } func (a *servicePrincipalsImpl) Get(ctx context.Context, request GetServicePrincipalRequest) (*ServicePrincipal, error) { - - requestPb, pbErr := getServicePrincipalRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var servicePrincipalPb servicePrincipalPb - path := fmt.Sprintf("/api/2.0/preview/scim/v2/ServicePrincipals/%v", requestPb.Id) + var servicePrincipal ServicePrincipal + path := fmt.Sprintf("/api/2.0/preview/scim/v2/ServicePrincipals/%v", request.Id) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &servicePrincipalPb, - ) - if err != nil { - return nil, err - } - resp, err := servicePrincipalFromPb(&servicePrincipalPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &servicePrincipal) + return &servicePrincipal, err } // Gets the set of service principals associated with a Databricks workspace. @@ -1501,90 +678,32 @@ func (a *servicePrincipalsImpl) ListAll(ctx context.Context, request ListService } func (a *servicePrincipalsImpl) internalList(ctx context.Context, request ListServicePrincipalsRequest) (*ListServicePrincipalResponse, error) { - - requestPb, pbErr := listServicePrincipalsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listServicePrincipalResponsePb listServicePrincipalResponsePb + var listServicePrincipalResponse ListServicePrincipalResponse path := "/api/2.0/preview/scim/v2/ServicePrincipals" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listServicePrincipalResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listServicePrincipalResponseFromPb(&listServicePrincipalResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listServicePrincipalResponse) + return &listServicePrincipalResponse, err } func (a *servicePrincipalsImpl) Patch(ctx context.Context, request PartialUpdate) error { - - requestPb, pbErr := partialUpdateToPb(&request) - if pbErr != nil { - return pbErr - } - - var patchResponsePb patchResponsePb - path := fmt.Sprintf("/api/2.0/preview/scim/v2/ServicePrincipals/%v", requestPb.Id) + var patchResponse PatchResponse + path := fmt.Sprintf("/api/2.0/preview/scim/v2/ServicePrincipals/%v", request.Id) queryParams := make(map[string]any) headers := make(map[string]string) headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &patchResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &patchResponse) return err } func (a *servicePrincipalsImpl) Update(ctx context.Context, request ServicePrincipal) error { - - requestPb, pbErr := servicePrincipalToPb(&request) - if pbErr != nil { - return pbErr - } - - var updateResponsePb updateResponsePb - path := fmt.Sprintf("/api/2.0/preview/scim/v2/ServicePrincipals/%v", requestPb.Id) + var updateResponse UpdateResponse + path := fmt.Sprintf("/api/2.0/preview/scim/v2/ServicePrincipals/%v", request.Id) queryParams := make(map[string]any) headers := make(map[string]string) headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPut, - path, - headers, - queryParams, - (*requestPb), - &updateResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &updateResponse) return err } @@ -1594,149 +713,53 @@ type usersImpl struct { } func (a *usersImpl) Create(ctx context.Context, request User) (*User, error) { - - requestPb, pbErr := userToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var userPb userPb + var user User path := "/api/2.0/preview/scim/v2/Users" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &userPb, - ) - if err != nil { - return nil, err - } - resp, err := userFromPb(&userPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &user) + return &user, err } func (a *usersImpl) Delete(ctx context.Context, request DeleteUserRequest) error { - - requestPb, pbErr := deleteUserRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteResponsePb deleteResponsePb - path := fmt.Sprintf("/api/2.0/preview/scim/v2/Users/%v", requestPb.Id) + var deleteResponse DeleteResponse + path := fmt.Sprintf("/api/2.0/preview/scim/v2/Users/%v", request.Id) queryParams := make(map[string]any) headers := make(map[string]string) - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteResponse) return err } func (a *usersImpl) Get(ctx context.Context, request GetUserRequest) (*User, error) { - - requestPb, pbErr := getUserRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var userPb userPb - path := fmt.Sprintf("/api/2.0/preview/scim/v2/Users/%v", requestPb.Id) + var user User + path := fmt.Sprintf("/api/2.0/preview/scim/v2/Users/%v", request.Id) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &userPb, - ) - if err != nil { - return nil, err - } - resp, err := userFromPb(&userPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &user) + return &user, err } func (a *usersImpl) GetPermissionLevels(ctx context.Context) (*GetPasswordPermissionLevelsResponse, error) { - - var getPasswordPermissionLevelsResponsePb getPasswordPermissionLevelsResponsePb + var getPasswordPermissionLevelsResponse GetPasswordPermissionLevelsResponse path := "/api/2.0/permissions/authorization/passwords/permissionLevels" headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - nil, - nil, - &getPasswordPermissionLevelsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := getPasswordPermissionLevelsResponseFromPb(&getPasswordPermissionLevelsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, nil, nil, &getPasswordPermissionLevelsResponse) + return &getPasswordPermissionLevelsResponse, err } func (a *usersImpl) GetPermissions(ctx context.Context) (*PasswordPermissions, error) { - - var passwordPermissionsPb passwordPermissionsPb + var passwordPermissions PasswordPermissions path := "/api/2.0/permissions/authorization/passwords" headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - nil, - nil, - &passwordPermissionsPb, - ) - if err != nil { - return nil, err - } - resp, err := passwordPermissionsFromPb(&passwordPermissionsPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, nil, nil, &passwordPermissions) + return &passwordPermissions, err } // Gets details for all the users associated with a Databricks workspace. @@ -1781,157 +804,55 @@ func (a *usersImpl) ListAll(ctx context.Context, request ListUsersRequest) ([]Us } func (a *usersImpl) internalList(ctx context.Context, request ListUsersRequest) (*ListUsersResponse, error) { - - requestPb, pbErr := listUsersRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listUsersResponsePb listUsersResponsePb + var listUsersResponse ListUsersResponse path := "/api/2.0/preview/scim/v2/Users" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listUsersResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listUsersResponseFromPb(&listUsersResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listUsersResponse) + return &listUsersResponse, err } func (a *usersImpl) Patch(ctx context.Context, request PartialUpdate) error { - - requestPb, pbErr := partialUpdateToPb(&request) - if pbErr != nil { - return pbErr - } - - var patchResponsePb patchResponsePb - path := fmt.Sprintf("/api/2.0/preview/scim/v2/Users/%v", requestPb.Id) + var patchResponse PatchResponse + path := fmt.Sprintf("/api/2.0/preview/scim/v2/Users/%v", request.Id) queryParams := make(map[string]any) headers := make(map[string]string) headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &patchResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &patchResponse) return err } func (a *usersImpl) SetPermissions(ctx context.Context, request PasswordPermissionsRequest) (*PasswordPermissions, error) { - - requestPb, pbErr := passwordPermissionsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var passwordPermissionsPb passwordPermissionsPb + var passwordPermissions PasswordPermissions path := "/api/2.0/permissions/authorization/passwords" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPut, - path, - headers, - queryParams, - (*requestPb), - &passwordPermissionsPb, - ) - if err != nil { - return nil, err - } - resp, err := passwordPermissionsFromPb(&passwordPermissionsPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &passwordPermissions) + return &passwordPermissions, err } func (a *usersImpl) Update(ctx context.Context, request User) error { - - requestPb, pbErr := userToPb(&request) - if pbErr != nil { - return pbErr - } - - var updateResponsePb updateResponsePb - path := fmt.Sprintf("/api/2.0/preview/scim/v2/Users/%v", requestPb.Id) + var updateResponse UpdateResponse + path := fmt.Sprintf("/api/2.0/preview/scim/v2/Users/%v", request.Id) queryParams := make(map[string]any) headers := make(map[string]string) headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPut, - path, - headers, - queryParams, - (*requestPb), - &updateResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &updateResponse) return err } func (a *usersImpl) UpdatePermissions(ctx context.Context, request PasswordPermissionsRequest) (*PasswordPermissions, error) { - - requestPb, pbErr := passwordPermissionsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var passwordPermissionsPb passwordPermissionsPb + var passwordPermissions PasswordPermissions path := "/api/2.0/permissions/authorization/passwords" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &passwordPermissionsPb, - ) - if err != nil { - return nil, err - } - resp, err := passwordPermissionsFromPb(&passwordPermissionsPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &passwordPermissions) + return &passwordPermissions, err } // unexported type that holds implementations of just WorkspaceAssignment API methods @@ -1940,63 +861,23 @@ type workspaceAssignmentImpl struct { } func (a *workspaceAssignmentImpl) Delete(ctx context.Context, request DeleteWorkspaceAssignmentRequest) error { - - requestPb, pbErr := deleteWorkspaceAssignmentRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteWorkspacePermissionAssignmentResponsePb deleteWorkspacePermissionAssignmentResponsePb - path := fmt.Sprintf("/api/2.0/accounts/%v/workspaces/%v/permissionassignments/principals/%v", a.client.ConfiguredAccountID(), requestPb.WorkspaceId, requestPb.PrincipalId) + var deleteWorkspacePermissionAssignmentResponse DeleteWorkspacePermissionAssignmentResponse + path := fmt.Sprintf("/api/2.0/accounts/%v/workspaces/%v/permissionassignments/principals/%v", a.client.ConfiguredAccountID(), request.WorkspaceId, request.PrincipalId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteWorkspacePermissionAssignmentResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteWorkspacePermissionAssignmentResponse) return err } func (a *workspaceAssignmentImpl) Get(ctx context.Context, request GetWorkspaceAssignmentRequest) (*WorkspacePermissions, error) { - - requestPb, pbErr := getWorkspaceAssignmentRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var workspacePermissionsPb workspacePermissionsPb - path := fmt.Sprintf("/api/2.0/accounts/%v/workspaces/%v/permissionassignments/permissions", a.client.ConfiguredAccountID(), requestPb.WorkspaceId) + var workspacePermissions WorkspacePermissions + path := fmt.Sprintf("/api/2.0/accounts/%v/workspaces/%v/permissionassignments/permissions", a.client.ConfiguredAccountID(), request.WorkspaceId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &workspacePermissionsPb, - ) - if err != nil { - return nil, err - } - resp, err := workspacePermissionsFromPb(&workspacePermissionsPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &workspacePermissions) + return &workspacePermissions, err } // Get the permission assignments for the specified Databricks account and @@ -2027,66 +908,22 @@ func (a *workspaceAssignmentImpl) ListAll(ctx context.Context, request ListWorks } func (a *workspaceAssignmentImpl) internalList(ctx context.Context, request ListWorkspaceAssignmentRequest) (*PermissionAssignments, error) { - - requestPb, pbErr := listWorkspaceAssignmentRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var permissionAssignmentsPb permissionAssignmentsPb - path := fmt.Sprintf("/api/2.0/accounts/%v/workspaces/%v/permissionassignments", a.client.ConfiguredAccountID(), requestPb.WorkspaceId) + var permissionAssignments PermissionAssignments + path := fmt.Sprintf("/api/2.0/accounts/%v/workspaces/%v/permissionassignments", a.client.ConfiguredAccountID(), request.WorkspaceId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &permissionAssignmentsPb, - ) - if err != nil { - return nil, err - } - resp, err := permissionAssignmentsFromPb(&permissionAssignmentsPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &permissionAssignments) + return &permissionAssignments, err } func (a *workspaceAssignmentImpl) Update(ctx context.Context, request UpdateWorkspaceAssignments) (*PermissionAssignment, error) { - - requestPb, pbErr := updateWorkspaceAssignmentsToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var permissionAssignmentPb permissionAssignmentPb - path := fmt.Sprintf("/api/2.0/accounts/%v/workspaces/%v/permissionassignments/principals/%v", a.client.ConfiguredAccountID(), requestPb.WorkspaceId, requestPb.PrincipalId) + var permissionAssignment PermissionAssignment + path := fmt.Sprintf("/api/2.0/accounts/%v/workspaces/%v/permissionassignments/principals/%v", a.client.ConfiguredAccountID(), request.WorkspaceId, request.PrincipalId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPut, - path, - headers, - queryParams, - (*requestPb), - &permissionAssignmentPb, - ) - if err != nil { - return nil, err - } - resp, err := permissionAssignmentFromPb(&permissionAssignmentPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &permissionAssignment) + return &permissionAssignment, err } diff --git a/service/iam/internal.go b/service/iam/internal.go deleted file mode 100755 index 453495444..000000000 --- a/service/iam/internal.go +++ /dev/null @@ -1,2726 +0,0 @@ -// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. - -package iam - -import ( - "fmt" - "strings" - "time" - - "github.com/databricks/databricks-sdk-go/marshal" -) - -func accessControlRequestToPb(st *AccessControlRequest) (*accessControlRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &accessControlRequestPb{} - pb.GroupName = st.GroupName - pb.PermissionLevel = st.PermissionLevel - pb.ServicePrincipalName = st.ServicePrincipalName - pb.UserName = st.UserName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type accessControlRequestPb struct { - GroupName string `json:"group_name,omitempty"` - PermissionLevel PermissionLevel `json:"permission_level,omitempty"` - ServicePrincipalName string `json:"service_principal_name,omitempty"` - UserName string `json:"user_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func accessControlRequestFromPb(pb *accessControlRequestPb) (*AccessControlRequest, error) { - if pb == nil { - return nil, nil - } - st := &AccessControlRequest{} - st.GroupName = pb.GroupName - st.PermissionLevel = pb.PermissionLevel - st.ServicePrincipalName = pb.ServicePrincipalName - st.UserName = pb.UserName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *accessControlRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st accessControlRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func accessControlResponseToPb(st *AccessControlResponse) (*accessControlResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &accessControlResponsePb{} - pb.AllPermissions = st.AllPermissions - pb.DisplayName = st.DisplayName - pb.GroupName = st.GroupName - pb.ServicePrincipalName = st.ServicePrincipalName - pb.UserName = st.UserName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type accessControlResponsePb struct { - AllPermissions []Permission `json:"all_permissions,omitempty"` - DisplayName string `json:"display_name,omitempty"` - GroupName string `json:"group_name,omitempty"` - ServicePrincipalName string `json:"service_principal_name,omitempty"` - UserName string `json:"user_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func accessControlResponseFromPb(pb *accessControlResponsePb) (*AccessControlResponse, error) { - if pb == nil { - return nil, nil - } - st := &AccessControlResponse{} - st.AllPermissions = pb.AllPermissions - st.DisplayName = pb.DisplayName - st.GroupName = pb.GroupName - st.ServicePrincipalName = pb.ServicePrincipalName - st.UserName = pb.UserName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *accessControlResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st accessControlResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func actorToPb(st *Actor) (*actorPb, error) { - if st == nil { - return nil, nil - } - pb := &actorPb{} - pb.ActorId = st.ActorId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type actorPb struct { - ActorId int64 `json:"actor_id,omitempty" url:"actor_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func actorFromPb(pb *actorPb) (*Actor, error) { - if pb == nil { - return nil, nil - } - st := &Actor{} - st.ActorId = pb.ActorId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *actorPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st actorPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func checkPolicyRequestToPb(st *CheckPolicyRequest) (*checkPolicyRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &checkPolicyRequestPb{} - pb.Actor = st.Actor - pb.AuthzIdentity = st.AuthzIdentity - pb.ConsistencyToken = st.ConsistencyToken - pb.Permission = st.Permission - pb.Resource = st.Resource - pb.ResourceInfo = st.ResourceInfo - - return pb, nil -} - -type checkPolicyRequestPb struct { - Actor Actor `json:"-" url:"actor"` - AuthzIdentity RequestAuthzIdentity `json:"-" url:"authz_identity"` - ConsistencyToken ConsistencyToken `json:"-" url:"consistency_token"` - Permission string `json:"-" url:"permission"` - Resource string `json:"-" url:"resource"` - ResourceInfo *ResourceInfo `json:"-" url:"resource_info,omitempty"` -} - -func checkPolicyRequestFromPb(pb *checkPolicyRequestPb) (*CheckPolicyRequest, error) { - if pb == nil { - return nil, nil - } - st := &CheckPolicyRequest{} - st.Actor = pb.Actor - st.AuthzIdentity = pb.AuthzIdentity - st.ConsistencyToken = pb.ConsistencyToken - st.Permission = pb.Permission - st.Resource = pb.Resource - st.ResourceInfo = pb.ResourceInfo - - return st, nil -} - -func checkPolicyResponseToPb(st *CheckPolicyResponse) (*checkPolicyResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &checkPolicyResponsePb{} - pb.ConsistencyToken = st.ConsistencyToken - pb.IsPermitted = st.IsPermitted - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type checkPolicyResponsePb struct { - ConsistencyToken ConsistencyToken `json:"consistency_token"` - IsPermitted bool `json:"is_permitted,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func checkPolicyResponseFromPb(pb *checkPolicyResponsePb) (*CheckPolicyResponse, error) { - if pb == nil { - return nil, nil - } - st := &CheckPolicyResponse{} - st.ConsistencyToken = pb.ConsistencyToken - st.IsPermitted = pb.IsPermitted - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *checkPolicyResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st checkPolicyResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func complexValueToPb(st *ComplexValue) (*complexValuePb, error) { - if st == nil { - return nil, nil - } - pb := &complexValuePb{} - pb.Display = st.Display - pb.Primary = st.Primary - pb.Ref = st.Ref - pb.Type = st.Type - pb.Value = st.Value - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type complexValuePb struct { - Display string `json:"display,omitempty"` - Primary bool `json:"primary,omitempty"` - Ref string `json:"$ref,omitempty"` - Type string `json:"type,omitempty"` - Value string `json:"value,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func complexValueFromPb(pb *complexValuePb) (*ComplexValue, error) { - if pb == nil { - return nil, nil - } - st := &ComplexValue{} - st.Display = pb.Display - st.Primary = pb.Primary - st.Ref = pb.Ref - st.Type = pb.Type - st.Value = pb.Value - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *complexValuePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st complexValuePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func consistencyTokenToPb(st *ConsistencyToken) (*consistencyTokenPb, error) { - if st == nil { - return nil, nil - } - pb := &consistencyTokenPb{} - pb.Value = st.Value - - return pb, nil -} - -type consistencyTokenPb struct { - Value string `json:"value"` -} - -func consistencyTokenFromPb(pb *consistencyTokenPb) (*ConsistencyToken, error) { - if pb == nil { - return nil, nil - } - st := &ConsistencyToken{} - st.Value = pb.Value - - return st, nil -} - -func deleteAccountGroupRequestToPb(st *DeleteAccountGroupRequest) (*deleteAccountGroupRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteAccountGroupRequestPb{} - pb.Id = st.Id - - return pb, nil -} - -type deleteAccountGroupRequestPb struct { - Id string `json:"-" url:"-"` -} - -func deleteAccountGroupRequestFromPb(pb *deleteAccountGroupRequestPb) (*DeleteAccountGroupRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteAccountGroupRequest{} - st.Id = pb.Id - - return st, nil -} - -func deleteAccountServicePrincipalRequestToPb(st *DeleteAccountServicePrincipalRequest) (*deleteAccountServicePrincipalRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteAccountServicePrincipalRequestPb{} - pb.Id = st.Id - - return pb, nil -} - -type deleteAccountServicePrincipalRequestPb struct { - Id string `json:"-" url:"-"` -} - -func deleteAccountServicePrincipalRequestFromPb(pb *deleteAccountServicePrincipalRequestPb) (*DeleteAccountServicePrincipalRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteAccountServicePrincipalRequest{} - st.Id = pb.Id - - return st, nil -} - -func deleteAccountUserRequestToPb(st *DeleteAccountUserRequest) (*deleteAccountUserRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteAccountUserRequestPb{} - pb.Id = st.Id - - return pb, nil -} - -type deleteAccountUserRequestPb struct { - Id string `json:"-" url:"-"` -} - -func deleteAccountUserRequestFromPb(pb *deleteAccountUserRequestPb) (*DeleteAccountUserRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteAccountUserRequest{} - st.Id = pb.Id - - return st, nil -} - -func deleteGroupRequestToPb(st *DeleteGroupRequest) (*deleteGroupRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteGroupRequestPb{} - pb.Id = st.Id - - return pb, nil -} - -type deleteGroupRequestPb struct { - Id string `json:"-" url:"-"` -} - -func deleteGroupRequestFromPb(pb *deleteGroupRequestPb) (*DeleteGroupRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteGroupRequest{} - st.Id = pb.Id - - return st, nil -} - -func deleteResponseToPb(st *DeleteResponse) (*deleteResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteResponsePb{} - - return pb, nil -} - -type deleteResponsePb struct { -} - -func deleteResponseFromPb(pb *deleteResponsePb) (*DeleteResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteResponse{} - - return st, nil -} - -func deleteServicePrincipalRequestToPb(st *DeleteServicePrincipalRequest) (*deleteServicePrincipalRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteServicePrincipalRequestPb{} - pb.Id = st.Id - - return pb, nil -} - -type deleteServicePrincipalRequestPb struct { - Id string `json:"-" url:"-"` -} - -func deleteServicePrincipalRequestFromPb(pb *deleteServicePrincipalRequestPb) (*DeleteServicePrincipalRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteServicePrincipalRequest{} - st.Id = pb.Id - - return st, nil -} - -func deleteUserRequestToPb(st *DeleteUserRequest) (*deleteUserRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteUserRequestPb{} - pb.Id = st.Id - - return pb, nil -} - -type deleteUserRequestPb struct { - Id string `json:"-" url:"-"` -} - -func deleteUserRequestFromPb(pb *deleteUserRequestPb) (*DeleteUserRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteUserRequest{} - st.Id = pb.Id - - return st, nil -} - -func deleteWorkspaceAssignmentRequestToPb(st *DeleteWorkspaceAssignmentRequest) (*deleteWorkspaceAssignmentRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteWorkspaceAssignmentRequestPb{} - pb.PrincipalId = st.PrincipalId - pb.WorkspaceId = st.WorkspaceId - - return pb, nil -} - -type deleteWorkspaceAssignmentRequestPb struct { - PrincipalId int64 `json:"-" url:"-"` - WorkspaceId int64 `json:"-" url:"-"` -} - -func deleteWorkspaceAssignmentRequestFromPb(pb *deleteWorkspaceAssignmentRequestPb) (*DeleteWorkspaceAssignmentRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteWorkspaceAssignmentRequest{} - st.PrincipalId = pb.PrincipalId - st.WorkspaceId = pb.WorkspaceId - - return st, nil -} - -func deleteWorkspacePermissionAssignmentResponseToPb(st *DeleteWorkspacePermissionAssignmentResponse) (*deleteWorkspacePermissionAssignmentResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteWorkspacePermissionAssignmentResponsePb{} - - return pb, nil -} - -type deleteWorkspacePermissionAssignmentResponsePb struct { -} - -func deleteWorkspacePermissionAssignmentResponseFromPb(pb *deleteWorkspacePermissionAssignmentResponsePb) (*DeleteWorkspacePermissionAssignmentResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteWorkspacePermissionAssignmentResponse{} - - return st, nil -} - -func getAccountGroupRequestToPb(st *GetAccountGroupRequest) (*getAccountGroupRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getAccountGroupRequestPb{} - pb.Id = st.Id - - return pb, nil -} - -type getAccountGroupRequestPb struct { - Id string `json:"-" url:"-"` -} - -func getAccountGroupRequestFromPb(pb *getAccountGroupRequestPb) (*GetAccountGroupRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetAccountGroupRequest{} - st.Id = pb.Id - - return st, nil -} - -func getAccountServicePrincipalRequestToPb(st *GetAccountServicePrincipalRequest) (*getAccountServicePrincipalRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getAccountServicePrincipalRequestPb{} - pb.Id = st.Id - - return pb, nil -} - -type getAccountServicePrincipalRequestPb struct { - Id string `json:"-" url:"-"` -} - -func getAccountServicePrincipalRequestFromPb(pb *getAccountServicePrincipalRequestPb) (*GetAccountServicePrincipalRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetAccountServicePrincipalRequest{} - st.Id = pb.Id - - return st, nil -} - -func getAccountUserRequestToPb(st *GetAccountUserRequest) (*getAccountUserRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getAccountUserRequestPb{} - pb.Attributes = st.Attributes - pb.Count = st.Count - pb.ExcludedAttributes = st.ExcludedAttributes - pb.Filter = st.Filter - pb.Id = st.Id - pb.SortBy = st.SortBy - pb.SortOrder = st.SortOrder - pb.StartIndex = st.StartIndex - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getAccountUserRequestPb struct { - Attributes string `json:"-" url:"attributes,omitempty"` - Count int `json:"-" url:"count,omitempty"` - ExcludedAttributes string `json:"-" url:"excludedAttributes,omitempty"` - Filter string `json:"-" url:"filter,omitempty"` - Id string `json:"-" url:"-"` - SortBy string `json:"-" url:"sortBy,omitempty"` - SortOrder GetSortOrder `json:"-" url:"sortOrder,omitempty"` - StartIndex int `json:"-" url:"startIndex,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getAccountUserRequestFromPb(pb *getAccountUserRequestPb) (*GetAccountUserRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetAccountUserRequest{} - st.Attributes = pb.Attributes - st.Count = pb.Count - st.ExcludedAttributes = pb.ExcludedAttributes - st.Filter = pb.Filter - st.Id = pb.Id - st.SortBy = pb.SortBy - st.SortOrder = pb.SortOrder - st.StartIndex = pb.StartIndex - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getAccountUserRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getAccountUserRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getAssignableRolesForResourceRequestToPb(st *GetAssignableRolesForResourceRequest) (*getAssignableRolesForResourceRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getAssignableRolesForResourceRequestPb{} - pb.Resource = st.Resource - - return pb, nil -} - -type getAssignableRolesForResourceRequestPb struct { - Resource string `json:"-" url:"resource"` -} - -func getAssignableRolesForResourceRequestFromPb(pb *getAssignableRolesForResourceRequestPb) (*GetAssignableRolesForResourceRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetAssignableRolesForResourceRequest{} - st.Resource = pb.Resource - - return st, nil -} - -func getAssignableRolesForResourceResponseToPb(st *GetAssignableRolesForResourceResponse) (*getAssignableRolesForResourceResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &getAssignableRolesForResourceResponsePb{} - pb.Roles = st.Roles - - return pb, nil -} - -type getAssignableRolesForResourceResponsePb struct { - Roles []Role `json:"roles,omitempty"` -} - -func getAssignableRolesForResourceResponseFromPb(pb *getAssignableRolesForResourceResponsePb) (*GetAssignableRolesForResourceResponse, error) { - if pb == nil { - return nil, nil - } - st := &GetAssignableRolesForResourceResponse{} - st.Roles = pb.Roles - - return st, nil -} - -func getGroupRequestToPb(st *GetGroupRequest) (*getGroupRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getGroupRequestPb{} - pb.Id = st.Id - - return pb, nil -} - -type getGroupRequestPb struct { - Id string `json:"-" url:"-"` -} - -func getGroupRequestFromPb(pb *getGroupRequestPb) (*GetGroupRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetGroupRequest{} - st.Id = pb.Id - - return st, nil -} - -func getPasswordPermissionLevelsResponseToPb(st *GetPasswordPermissionLevelsResponse) (*getPasswordPermissionLevelsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &getPasswordPermissionLevelsResponsePb{} - pb.PermissionLevels = st.PermissionLevels - - return pb, nil -} - -type getPasswordPermissionLevelsResponsePb struct { - PermissionLevels []PasswordPermissionsDescription `json:"permission_levels,omitempty"` -} - -func getPasswordPermissionLevelsResponseFromPb(pb *getPasswordPermissionLevelsResponsePb) (*GetPasswordPermissionLevelsResponse, error) { - if pb == nil { - return nil, nil - } - st := &GetPasswordPermissionLevelsResponse{} - st.PermissionLevels = pb.PermissionLevels - - return st, nil -} - -func getPermissionLevelsRequestToPb(st *GetPermissionLevelsRequest) (*getPermissionLevelsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getPermissionLevelsRequestPb{} - pb.RequestObjectId = st.RequestObjectId - pb.RequestObjectType = st.RequestObjectType - - return pb, nil -} - -type getPermissionLevelsRequestPb struct { - RequestObjectId string `json:"-" url:"-"` - RequestObjectType string `json:"-" url:"-"` -} - -func getPermissionLevelsRequestFromPb(pb *getPermissionLevelsRequestPb) (*GetPermissionLevelsRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetPermissionLevelsRequest{} - st.RequestObjectId = pb.RequestObjectId - st.RequestObjectType = pb.RequestObjectType - - return st, nil -} - -func getPermissionLevelsResponseToPb(st *GetPermissionLevelsResponse) (*getPermissionLevelsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &getPermissionLevelsResponsePb{} - pb.PermissionLevels = st.PermissionLevels - - return pb, nil -} - -type getPermissionLevelsResponsePb struct { - PermissionLevels []PermissionsDescription `json:"permission_levels,omitempty"` -} - -func getPermissionLevelsResponseFromPb(pb *getPermissionLevelsResponsePb) (*GetPermissionLevelsResponse, error) { - if pb == nil { - return nil, nil - } - st := &GetPermissionLevelsResponse{} - st.PermissionLevels = pb.PermissionLevels - - return st, nil -} - -func getPermissionRequestToPb(st *GetPermissionRequest) (*getPermissionRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getPermissionRequestPb{} - pb.RequestObjectId = st.RequestObjectId - pb.RequestObjectType = st.RequestObjectType - - return pb, nil -} - -type getPermissionRequestPb struct { - RequestObjectId string `json:"-" url:"-"` - RequestObjectType string `json:"-" url:"-"` -} - -func getPermissionRequestFromPb(pb *getPermissionRequestPb) (*GetPermissionRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetPermissionRequest{} - st.RequestObjectId = pb.RequestObjectId - st.RequestObjectType = pb.RequestObjectType - - return st, nil -} - -func getRuleSetRequestToPb(st *GetRuleSetRequest) (*getRuleSetRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getRuleSetRequestPb{} - pb.Etag = st.Etag - pb.Name = st.Name - - return pb, nil -} - -type getRuleSetRequestPb struct { - Etag string `json:"-" url:"etag"` - Name string `json:"-" url:"name"` -} - -func getRuleSetRequestFromPb(pb *getRuleSetRequestPb) (*GetRuleSetRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetRuleSetRequest{} - st.Etag = pb.Etag - st.Name = pb.Name - - return st, nil -} - -func getServicePrincipalRequestToPb(st *GetServicePrincipalRequest) (*getServicePrincipalRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getServicePrincipalRequestPb{} - pb.Id = st.Id - - return pb, nil -} - -type getServicePrincipalRequestPb struct { - Id string `json:"-" url:"-"` -} - -func getServicePrincipalRequestFromPb(pb *getServicePrincipalRequestPb) (*GetServicePrincipalRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetServicePrincipalRequest{} - st.Id = pb.Id - - return st, nil -} - -func getUserRequestToPb(st *GetUserRequest) (*getUserRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getUserRequestPb{} - pb.Attributes = st.Attributes - pb.Count = st.Count - pb.ExcludedAttributes = st.ExcludedAttributes - pb.Filter = st.Filter - pb.Id = st.Id - pb.SortBy = st.SortBy - pb.SortOrder = st.SortOrder - pb.StartIndex = st.StartIndex - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getUserRequestPb struct { - Attributes string `json:"-" url:"attributes,omitempty"` - Count int `json:"-" url:"count,omitempty"` - ExcludedAttributes string `json:"-" url:"excludedAttributes,omitempty"` - Filter string `json:"-" url:"filter,omitempty"` - Id string `json:"-" url:"-"` - SortBy string `json:"-" url:"sortBy,omitempty"` - SortOrder GetSortOrder `json:"-" url:"sortOrder,omitempty"` - StartIndex int `json:"-" url:"startIndex,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getUserRequestFromPb(pb *getUserRequestPb) (*GetUserRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetUserRequest{} - st.Attributes = pb.Attributes - st.Count = pb.Count - st.ExcludedAttributes = pb.ExcludedAttributes - st.Filter = pb.Filter - st.Id = pb.Id - st.SortBy = pb.SortBy - st.SortOrder = pb.SortOrder - st.StartIndex = pb.StartIndex - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getUserRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getUserRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getWorkspaceAssignmentRequestToPb(st *GetWorkspaceAssignmentRequest) (*getWorkspaceAssignmentRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getWorkspaceAssignmentRequestPb{} - pb.WorkspaceId = st.WorkspaceId - - return pb, nil -} - -type getWorkspaceAssignmentRequestPb struct { - WorkspaceId int64 `json:"-" url:"-"` -} - -func getWorkspaceAssignmentRequestFromPb(pb *getWorkspaceAssignmentRequestPb) (*GetWorkspaceAssignmentRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetWorkspaceAssignmentRequest{} - st.WorkspaceId = pb.WorkspaceId - - return st, nil -} - -func grantRuleToPb(st *GrantRule) (*grantRulePb, error) { - if st == nil { - return nil, nil - } - pb := &grantRulePb{} - pb.Principals = st.Principals - pb.Role = st.Role - - return pb, nil -} - -type grantRulePb struct { - Principals []string `json:"principals,omitempty"` - Role string `json:"role"` -} - -func grantRuleFromPb(pb *grantRulePb) (*GrantRule, error) { - if pb == nil { - return nil, nil - } - st := &GrantRule{} - st.Principals = pb.Principals - st.Role = pb.Role - - return st, nil -} - -func groupToPb(st *Group) (*groupPb, error) { - if st == nil { - return nil, nil - } - pb := &groupPb{} - pb.DisplayName = st.DisplayName - pb.Entitlements = st.Entitlements - pb.ExternalId = st.ExternalId - pb.Groups = st.Groups - pb.Id = st.Id - pb.Members = st.Members - pb.Meta = st.Meta - pb.Roles = st.Roles - pb.Schemas = st.Schemas - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type groupPb struct { - DisplayName string `json:"displayName,omitempty"` - Entitlements []ComplexValue `json:"entitlements,omitempty"` - ExternalId string `json:"externalId,omitempty"` - Groups []ComplexValue `json:"groups,omitempty"` - Id string `json:"id,omitempty" url:"-"` - Members []ComplexValue `json:"members,omitempty"` - Meta *ResourceMeta `json:"meta,omitempty"` - Roles []ComplexValue `json:"roles,omitempty"` - Schemas []GroupSchema `json:"schemas,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func groupFromPb(pb *groupPb) (*Group, error) { - if pb == nil { - return nil, nil - } - st := &Group{} - st.DisplayName = pb.DisplayName - st.Entitlements = pb.Entitlements - st.ExternalId = pb.ExternalId - st.Groups = pb.Groups - st.Id = pb.Id - st.Members = pb.Members - st.Meta = pb.Meta - st.Roles = pb.Roles - st.Schemas = pb.Schemas - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *groupPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st groupPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listAccountGroupsRequestToPb(st *ListAccountGroupsRequest) (*listAccountGroupsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listAccountGroupsRequestPb{} - pb.Attributes = st.Attributes - pb.Count = st.Count - pb.ExcludedAttributes = st.ExcludedAttributes - pb.Filter = st.Filter - pb.SortBy = st.SortBy - pb.SortOrder = st.SortOrder - pb.StartIndex = st.StartIndex - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listAccountGroupsRequestPb struct { - Attributes string `json:"-" url:"attributes,omitempty"` - Count int64 `json:"-" url:"count,omitempty"` - ExcludedAttributes string `json:"-" url:"excludedAttributes,omitempty"` - Filter string `json:"-" url:"filter,omitempty"` - SortBy string `json:"-" url:"sortBy,omitempty"` - SortOrder ListSortOrder `json:"-" url:"sortOrder,omitempty"` - StartIndex int64 `json:"-" url:"startIndex,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listAccountGroupsRequestFromPb(pb *listAccountGroupsRequestPb) (*ListAccountGroupsRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListAccountGroupsRequest{} - st.Attributes = pb.Attributes - st.Count = pb.Count - st.ExcludedAttributes = pb.ExcludedAttributes - st.Filter = pb.Filter - st.SortBy = pb.SortBy - st.SortOrder = pb.SortOrder - st.StartIndex = pb.StartIndex - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listAccountGroupsRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listAccountGroupsRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listAccountServicePrincipalsRequestToPb(st *ListAccountServicePrincipalsRequest) (*listAccountServicePrincipalsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listAccountServicePrincipalsRequestPb{} - pb.Attributes = st.Attributes - pb.Count = st.Count - pb.ExcludedAttributes = st.ExcludedAttributes - pb.Filter = st.Filter - pb.SortBy = st.SortBy - pb.SortOrder = st.SortOrder - pb.StartIndex = st.StartIndex - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listAccountServicePrincipalsRequestPb struct { - Attributes string `json:"-" url:"attributes,omitempty"` - Count int64 `json:"-" url:"count,omitempty"` - ExcludedAttributes string `json:"-" url:"excludedAttributes,omitempty"` - Filter string `json:"-" url:"filter,omitempty"` - SortBy string `json:"-" url:"sortBy,omitempty"` - SortOrder ListSortOrder `json:"-" url:"sortOrder,omitempty"` - StartIndex int64 `json:"-" url:"startIndex,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listAccountServicePrincipalsRequestFromPb(pb *listAccountServicePrincipalsRequestPb) (*ListAccountServicePrincipalsRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListAccountServicePrincipalsRequest{} - st.Attributes = pb.Attributes - st.Count = pb.Count - st.ExcludedAttributes = pb.ExcludedAttributes - st.Filter = pb.Filter - st.SortBy = pb.SortBy - st.SortOrder = pb.SortOrder - st.StartIndex = pb.StartIndex - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listAccountServicePrincipalsRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listAccountServicePrincipalsRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listAccountUsersRequestToPb(st *ListAccountUsersRequest) (*listAccountUsersRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listAccountUsersRequestPb{} - pb.Attributes = st.Attributes - pb.Count = st.Count - pb.ExcludedAttributes = st.ExcludedAttributes - pb.Filter = st.Filter - pb.SortBy = st.SortBy - pb.SortOrder = st.SortOrder - pb.StartIndex = st.StartIndex - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listAccountUsersRequestPb struct { - Attributes string `json:"-" url:"attributes,omitempty"` - Count int64 `json:"-" url:"count,omitempty"` - ExcludedAttributes string `json:"-" url:"excludedAttributes,omitempty"` - Filter string `json:"-" url:"filter,omitempty"` - SortBy string `json:"-" url:"sortBy,omitempty"` - SortOrder ListSortOrder `json:"-" url:"sortOrder,omitempty"` - StartIndex int64 `json:"-" url:"startIndex,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listAccountUsersRequestFromPb(pb *listAccountUsersRequestPb) (*ListAccountUsersRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListAccountUsersRequest{} - st.Attributes = pb.Attributes - st.Count = pb.Count - st.ExcludedAttributes = pb.ExcludedAttributes - st.Filter = pb.Filter - st.SortBy = pb.SortBy - st.SortOrder = pb.SortOrder - st.StartIndex = pb.StartIndex - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listAccountUsersRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listAccountUsersRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listGroupsRequestToPb(st *ListGroupsRequest) (*listGroupsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listGroupsRequestPb{} - pb.Attributes = st.Attributes - pb.Count = st.Count - pb.ExcludedAttributes = st.ExcludedAttributes - pb.Filter = st.Filter - pb.SortBy = st.SortBy - pb.SortOrder = st.SortOrder - pb.StartIndex = st.StartIndex - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listGroupsRequestPb struct { - Attributes string `json:"-" url:"attributes,omitempty"` - Count int64 `json:"-" url:"count,omitempty"` - ExcludedAttributes string `json:"-" url:"excludedAttributes,omitempty"` - Filter string `json:"-" url:"filter,omitempty"` - SortBy string `json:"-" url:"sortBy,omitempty"` - SortOrder ListSortOrder `json:"-" url:"sortOrder,omitempty"` - StartIndex int64 `json:"-" url:"startIndex,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listGroupsRequestFromPb(pb *listGroupsRequestPb) (*ListGroupsRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListGroupsRequest{} - st.Attributes = pb.Attributes - st.Count = pb.Count - st.ExcludedAttributes = pb.ExcludedAttributes - st.Filter = pb.Filter - st.SortBy = pb.SortBy - st.SortOrder = pb.SortOrder - st.StartIndex = pb.StartIndex - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listGroupsRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listGroupsRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listGroupsResponseToPb(st *ListGroupsResponse) (*listGroupsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listGroupsResponsePb{} - pb.ItemsPerPage = st.ItemsPerPage - pb.Resources = st.Resources - pb.Schemas = st.Schemas - pb.StartIndex = st.StartIndex - pb.TotalResults = st.TotalResults - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listGroupsResponsePb struct { - ItemsPerPage int64 `json:"itemsPerPage,omitempty"` - Resources []Group `json:"Resources,omitempty"` - Schemas []ListResponseSchema `json:"schemas,omitempty"` - StartIndex int64 `json:"startIndex,omitempty"` - TotalResults int64 `json:"totalResults,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listGroupsResponseFromPb(pb *listGroupsResponsePb) (*ListGroupsResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListGroupsResponse{} - st.ItemsPerPage = pb.ItemsPerPage - st.Resources = pb.Resources - st.Schemas = pb.Schemas - st.StartIndex = pb.StartIndex - st.TotalResults = pb.TotalResults - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listGroupsResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listGroupsResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listServicePrincipalResponseToPb(st *ListServicePrincipalResponse) (*listServicePrincipalResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listServicePrincipalResponsePb{} - pb.ItemsPerPage = st.ItemsPerPage - pb.Resources = st.Resources - pb.Schemas = st.Schemas - pb.StartIndex = st.StartIndex - pb.TotalResults = st.TotalResults - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listServicePrincipalResponsePb struct { - ItemsPerPage int64 `json:"itemsPerPage,omitempty"` - Resources []ServicePrincipal `json:"Resources,omitempty"` - Schemas []ListResponseSchema `json:"schemas,omitempty"` - StartIndex int64 `json:"startIndex,omitempty"` - TotalResults int64 `json:"totalResults,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listServicePrincipalResponseFromPb(pb *listServicePrincipalResponsePb) (*ListServicePrincipalResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListServicePrincipalResponse{} - st.ItemsPerPage = pb.ItemsPerPage - st.Resources = pb.Resources - st.Schemas = pb.Schemas - st.StartIndex = pb.StartIndex - st.TotalResults = pb.TotalResults - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listServicePrincipalResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listServicePrincipalResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listServicePrincipalsRequestToPb(st *ListServicePrincipalsRequest) (*listServicePrincipalsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listServicePrincipalsRequestPb{} - pb.Attributes = st.Attributes - pb.Count = st.Count - pb.ExcludedAttributes = st.ExcludedAttributes - pb.Filter = st.Filter - pb.SortBy = st.SortBy - pb.SortOrder = st.SortOrder - pb.StartIndex = st.StartIndex - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listServicePrincipalsRequestPb struct { - Attributes string `json:"-" url:"attributes,omitempty"` - Count int64 `json:"-" url:"count,omitempty"` - ExcludedAttributes string `json:"-" url:"excludedAttributes,omitempty"` - Filter string `json:"-" url:"filter,omitempty"` - SortBy string `json:"-" url:"sortBy,omitempty"` - SortOrder ListSortOrder `json:"-" url:"sortOrder,omitempty"` - StartIndex int64 `json:"-" url:"startIndex,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listServicePrincipalsRequestFromPb(pb *listServicePrincipalsRequestPb) (*ListServicePrincipalsRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListServicePrincipalsRequest{} - st.Attributes = pb.Attributes - st.Count = pb.Count - st.ExcludedAttributes = pb.ExcludedAttributes - st.Filter = pb.Filter - st.SortBy = pb.SortBy - st.SortOrder = pb.SortOrder - st.StartIndex = pb.StartIndex - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listServicePrincipalsRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listServicePrincipalsRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listUsersRequestToPb(st *ListUsersRequest) (*listUsersRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listUsersRequestPb{} - pb.Attributes = st.Attributes - pb.Count = st.Count - pb.ExcludedAttributes = st.ExcludedAttributes - pb.Filter = st.Filter - pb.SortBy = st.SortBy - pb.SortOrder = st.SortOrder - pb.StartIndex = st.StartIndex - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listUsersRequestPb struct { - Attributes string `json:"-" url:"attributes,omitempty"` - Count int64 `json:"-" url:"count,omitempty"` - ExcludedAttributes string `json:"-" url:"excludedAttributes,omitempty"` - Filter string `json:"-" url:"filter,omitempty"` - SortBy string `json:"-" url:"sortBy,omitempty"` - SortOrder ListSortOrder `json:"-" url:"sortOrder,omitempty"` - StartIndex int64 `json:"-" url:"startIndex,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listUsersRequestFromPb(pb *listUsersRequestPb) (*ListUsersRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListUsersRequest{} - st.Attributes = pb.Attributes - st.Count = pb.Count - st.ExcludedAttributes = pb.ExcludedAttributes - st.Filter = pb.Filter - st.SortBy = pb.SortBy - st.SortOrder = pb.SortOrder - st.StartIndex = pb.StartIndex - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listUsersRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listUsersRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listUsersResponseToPb(st *ListUsersResponse) (*listUsersResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listUsersResponsePb{} - pb.ItemsPerPage = st.ItemsPerPage - pb.Resources = st.Resources - pb.Schemas = st.Schemas - pb.StartIndex = st.StartIndex - pb.TotalResults = st.TotalResults - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listUsersResponsePb struct { - ItemsPerPage int64 `json:"itemsPerPage,omitempty"` - Resources []User `json:"Resources,omitempty"` - Schemas []ListResponseSchema `json:"schemas,omitempty"` - StartIndex int64 `json:"startIndex,omitempty"` - TotalResults int64 `json:"totalResults,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listUsersResponseFromPb(pb *listUsersResponsePb) (*ListUsersResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListUsersResponse{} - st.ItemsPerPage = pb.ItemsPerPage - st.Resources = pb.Resources - st.Schemas = pb.Schemas - st.StartIndex = pb.StartIndex - st.TotalResults = pb.TotalResults - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listUsersResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listUsersResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listWorkspaceAssignmentRequestToPb(st *ListWorkspaceAssignmentRequest) (*listWorkspaceAssignmentRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listWorkspaceAssignmentRequestPb{} - pb.WorkspaceId = st.WorkspaceId - - return pb, nil -} - -type listWorkspaceAssignmentRequestPb struct { - WorkspaceId int64 `json:"-" url:"-"` -} - -func listWorkspaceAssignmentRequestFromPb(pb *listWorkspaceAssignmentRequestPb) (*ListWorkspaceAssignmentRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListWorkspaceAssignmentRequest{} - st.WorkspaceId = pb.WorkspaceId - - return st, nil -} - -func migratePermissionsRequestToPb(st *MigratePermissionsRequest) (*migratePermissionsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &migratePermissionsRequestPb{} - pb.FromWorkspaceGroupName = st.FromWorkspaceGroupName - pb.Size = st.Size - pb.ToAccountGroupName = st.ToAccountGroupName - pb.WorkspaceId = st.WorkspaceId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type migratePermissionsRequestPb struct { - FromWorkspaceGroupName string `json:"from_workspace_group_name"` - Size int `json:"size,omitempty"` - ToAccountGroupName string `json:"to_account_group_name"` - WorkspaceId int64 `json:"workspace_id"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func migratePermissionsRequestFromPb(pb *migratePermissionsRequestPb) (*MigratePermissionsRequest, error) { - if pb == nil { - return nil, nil - } - st := &MigratePermissionsRequest{} - st.FromWorkspaceGroupName = pb.FromWorkspaceGroupName - st.Size = pb.Size - st.ToAccountGroupName = pb.ToAccountGroupName - st.WorkspaceId = pb.WorkspaceId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *migratePermissionsRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st migratePermissionsRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func migratePermissionsResponseToPb(st *MigratePermissionsResponse) (*migratePermissionsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &migratePermissionsResponsePb{} - pb.PermissionsMigrated = st.PermissionsMigrated - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type migratePermissionsResponsePb struct { - PermissionsMigrated int `json:"permissions_migrated,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func migratePermissionsResponseFromPb(pb *migratePermissionsResponsePb) (*MigratePermissionsResponse, error) { - if pb == nil { - return nil, nil - } - st := &MigratePermissionsResponse{} - st.PermissionsMigrated = pb.PermissionsMigrated - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *migratePermissionsResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st migratePermissionsResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func nameToPb(st *Name) (*namePb, error) { - if st == nil { - return nil, nil - } - pb := &namePb{} - pb.FamilyName = st.FamilyName - pb.GivenName = st.GivenName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type namePb struct { - FamilyName string `json:"familyName,omitempty"` - GivenName string `json:"givenName,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func nameFromPb(pb *namePb) (*Name, error) { - if pb == nil { - return nil, nil - } - st := &Name{} - st.FamilyName = pb.FamilyName - st.GivenName = pb.GivenName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *namePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st namePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func objectPermissionsToPb(st *ObjectPermissions) (*objectPermissionsPb, error) { - if st == nil { - return nil, nil - } - pb := &objectPermissionsPb{} - pb.AccessControlList = st.AccessControlList - pb.ObjectId = st.ObjectId - pb.ObjectType = st.ObjectType - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type objectPermissionsPb struct { - AccessControlList []AccessControlResponse `json:"access_control_list,omitempty"` - ObjectId string `json:"object_id,omitempty"` - ObjectType string `json:"object_type,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func objectPermissionsFromPb(pb *objectPermissionsPb) (*ObjectPermissions, error) { - if pb == nil { - return nil, nil - } - st := &ObjectPermissions{} - st.AccessControlList = pb.AccessControlList - st.ObjectId = pb.ObjectId - st.ObjectType = pb.ObjectType - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *objectPermissionsPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st objectPermissionsPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func partialUpdateToPb(st *PartialUpdate) (*partialUpdatePb, error) { - if st == nil { - return nil, nil - } - pb := &partialUpdatePb{} - pb.Id = st.Id - pb.Operations = st.Operations - pb.Schemas = st.Schemas - - return pb, nil -} - -type partialUpdatePb struct { - Id string `json:"-" url:"-"` - Operations []Patch `json:"Operations,omitempty"` - Schemas []PatchSchema `json:"schemas,omitempty"` -} - -func partialUpdateFromPb(pb *partialUpdatePb) (*PartialUpdate, error) { - if pb == nil { - return nil, nil - } - st := &PartialUpdate{} - st.Id = pb.Id - st.Operations = pb.Operations - st.Schemas = pb.Schemas - - return st, nil -} - -func passwordAccessControlRequestToPb(st *PasswordAccessControlRequest) (*passwordAccessControlRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &passwordAccessControlRequestPb{} - pb.GroupName = st.GroupName - pb.PermissionLevel = st.PermissionLevel - pb.ServicePrincipalName = st.ServicePrincipalName - pb.UserName = st.UserName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type passwordAccessControlRequestPb struct { - GroupName string `json:"group_name,omitempty"` - PermissionLevel PasswordPermissionLevel `json:"permission_level,omitempty"` - ServicePrincipalName string `json:"service_principal_name,omitempty"` - UserName string `json:"user_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func passwordAccessControlRequestFromPb(pb *passwordAccessControlRequestPb) (*PasswordAccessControlRequest, error) { - if pb == nil { - return nil, nil - } - st := &PasswordAccessControlRequest{} - st.GroupName = pb.GroupName - st.PermissionLevel = pb.PermissionLevel - st.ServicePrincipalName = pb.ServicePrincipalName - st.UserName = pb.UserName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *passwordAccessControlRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st passwordAccessControlRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func passwordAccessControlResponseToPb(st *PasswordAccessControlResponse) (*passwordAccessControlResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &passwordAccessControlResponsePb{} - pb.AllPermissions = st.AllPermissions - pb.DisplayName = st.DisplayName - pb.GroupName = st.GroupName - pb.ServicePrincipalName = st.ServicePrincipalName - pb.UserName = st.UserName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type passwordAccessControlResponsePb struct { - AllPermissions []PasswordPermission `json:"all_permissions,omitempty"` - DisplayName string `json:"display_name,omitempty"` - GroupName string `json:"group_name,omitempty"` - ServicePrincipalName string `json:"service_principal_name,omitempty"` - UserName string `json:"user_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func passwordAccessControlResponseFromPb(pb *passwordAccessControlResponsePb) (*PasswordAccessControlResponse, error) { - if pb == nil { - return nil, nil - } - st := &PasswordAccessControlResponse{} - st.AllPermissions = pb.AllPermissions - st.DisplayName = pb.DisplayName - st.GroupName = pb.GroupName - st.ServicePrincipalName = pb.ServicePrincipalName - st.UserName = pb.UserName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *passwordAccessControlResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st passwordAccessControlResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func passwordPermissionToPb(st *PasswordPermission) (*passwordPermissionPb, error) { - if st == nil { - return nil, nil - } - pb := &passwordPermissionPb{} - pb.Inherited = st.Inherited - pb.InheritedFromObject = st.InheritedFromObject - pb.PermissionLevel = st.PermissionLevel - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type passwordPermissionPb struct { - Inherited bool `json:"inherited,omitempty"` - InheritedFromObject []string `json:"inherited_from_object,omitempty"` - PermissionLevel PasswordPermissionLevel `json:"permission_level,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func passwordPermissionFromPb(pb *passwordPermissionPb) (*PasswordPermission, error) { - if pb == nil { - return nil, nil - } - st := &PasswordPermission{} - st.Inherited = pb.Inherited - st.InheritedFromObject = pb.InheritedFromObject - st.PermissionLevel = pb.PermissionLevel - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *passwordPermissionPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st passwordPermissionPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func passwordPermissionsToPb(st *PasswordPermissions) (*passwordPermissionsPb, error) { - if st == nil { - return nil, nil - } - pb := &passwordPermissionsPb{} - pb.AccessControlList = st.AccessControlList - pb.ObjectId = st.ObjectId - pb.ObjectType = st.ObjectType - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type passwordPermissionsPb struct { - AccessControlList []PasswordAccessControlResponse `json:"access_control_list,omitempty"` - ObjectId string `json:"object_id,omitempty"` - ObjectType string `json:"object_type,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func passwordPermissionsFromPb(pb *passwordPermissionsPb) (*PasswordPermissions, error) { - if pb == nil { - return nil, nil - } - st := &PasswordPermissions{} - st.AccessControlList = pb.AccessControlList - st.ObjectId = pb.ObjectId - st.ObjectType = pb.ObjectType - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *passwordPermissionsPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st passwordPermissionsPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func passwordPermissionsDescriptionToPb(st *PasswordPermissionsDescription) (*passwordPermissionsDescriptionPb, error) { - if st == nil { - return nil, nil - } - pb := &passwordPermissionsDescriptionPb{} - pb.Description = st.Description - pb.PermissionLevel = st.PermissionLevel - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type passwordPermissionsDescriptionPb struct { - Description string `json:"description,omitempty"` - PermissionLevel PasswordPermissionLevel `json:"permission_level,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func passwordPermissionsDescriptionFromPb(pb *passwordPermissionsDescriptionPb) (*PasswordPermissionsDescription, error) { - if pb == nil { - return nil, nil - } - st := &PasswordPermissionsDescription{} - st.Description = pb.Description - st.PermissionLevel = pb.PermissionLevel - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *passwordPermissionsDescriptionPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st passwordPermissionsDescriptionPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func passwordPermissionsRequestToPb(st *PasswordPermissionsRequest) (*passwordPermissionsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &passwordPermissionsRequestPb{} - pb.AccessControlList = st.AccessControlList - - return pb, nil -} - -type passwordPermissionsRequestPb struct { - AccessControlList []PasswordAccessControlRequest `json:"access_control_list,omitempty"` -} - -func passwordPermissionsRequestFromPb(pb *passwordPermissionsRequestPb) (*PasswordPermissionsRequest, error) { - if pb == nil { - return nil, nil - } - st := &PasswordPermissionsRequest{} - st.AccessControlList = pb.AccessControlList - - return st, nil -} - -func patchToPb(st *Patch) (*patchPb, error) { - if st == nil { - return nil, nil - } - pb := &patchPb{} - pb.Op = st.Op - pb.Path = st.Path - pb.Value = st.Value - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type patchPb struct { - Op PatchOp `json:"op,omitempty"` - Path string `json:"path,omitempty"` - Value any `json:"value,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func patchFromPb(pb *patchPb) (*Patch, error) { - if pb == nil { - return nil, nil - } - st := &Patch{} - st.Op = pb.Op - st.Path = pb.Path - st.Value = pb.Value - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *patchPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st patchPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func patchResponseToPb(st *PatchResponse) (*patchResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &patchResponsePb{} - - return pb, nil -} - -type patchResponsePb struct { -} - -func patchResponseFromPb(pb *patchResponsePb) (*PatchResponse, error) { - if pb == nil { - return nil, nil - } - st := &PatchResponse{} - - return st, nil -} - -func permissionToPb(st *Permission) (*permissionPb, error) { - if st == nil { - return nil, nil - } - pb := &permissionPb{} - pb.Inherited = st.Inherited - pb.InheritedFromObject = st.InheritedFromObject - pb.PermissionLevel = st.PermissionLevel - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type permissionPb struct { - Inherited bool `json:"inherited,omitempty"` - InheritedFromObject []string `json:"inherited_from_object,omitempty"` - PermissionLevel PermissionLevel `json:"permission_level,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func permissionFromPb(pb *permissionPb) (*Permission, error) { - if pb == nil { - return nil, nil - } - st := &Permission{} - st.Inherited = pb.Inherited - st.InheritedFromObject = pb.InheritedFromObject - st.PermissionLevel = pb.PermissionLevel - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *permissionPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st permissionPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func permissionAssignmentToPb(st *PermissionAssignment) (*permissionAssignmentPb, error) { - if st == nil { - return nil, nil - } - pb := &permissionAssignmentPb{} - pb.Error = st.Error - pb.Permissions = st.Permissions - pb.Principal = st.Principal - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type permissionAssignmentPb struct { - Error string `json:"error,omitempty"` - Permissions []WorkspacePermission `json:"permissions,omitempty"` - Principal *PrincipalOutput `json:"principal,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func permissionAssignmentFromPb(pb *permissionAssignmentPb) (*PermissionAssignment, error) { - if pb == nil { - return nil, nil - } - st := &PermissionAssignment{} - st.Error = pb.Error - st.Permissions = pb.Permissions - st.Principal = pb.Principal - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *permissionAssignmentPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st permissionAssignmentPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func permissionAssignmentsToPb(st *PermissionAssignments) (*permissionAssignmentsPb, error) { - if st == nil { - return nil, nil - } - pb := &permissionAssignmentsPb{} - pb.PermissionAssignments = st.PermissionAssignments - - return pb, nil -} - -type permissionAssignmentsPb struct { - PermissionAssignments []PermissionAssignment `json:"permission_assignments,omitempty"` -} - -func permissionAssignmentsFromPb(pb *permissionAssignmentsPb) (*PermissionAssignments, error) { - if pb == nil { - return nil, nil - } - st := &PermissionAssignments{} - st.PermissionAssignments = pb.PermissionAssignments - - return st, nil -} - -func permissionOutputToPb(st *PermissionOutput) (*permissionOutputPb, error) { - if st == nil { - return nil, nil - } - pb := &permissionOutputPb{} - pb.Description = st.Description - pb.PermissionLevel = st.PermissionLevel - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type permissionOutputPb struct { - Description string `json:"description,omitempty"` - PermissionLevel WorkspacePermission `json:"permission_level,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func permissionOutputFromPb(pb *permissionOutputPb) (*PermissionOutput, error) { - if pb == nil { - return nil, nil - } - st := &PermissionOutput{} - st.Description = pb.Description - st.PermissionLevel = pb.PermissionLevel - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *permissionOutputPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st permissionOutputPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func permissionsDescriptionToPb(st *PermissionsDescription) (*permissionsDescriptionPb, error) { - if st == nil { - return nil, nil - } - pb := &permissionsDescriptionPb{} - pb.Description = st.Description - pb.PermissionLevel = st.PermissionLevel - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type permissionsDescriptionPb struct { - Description string `json:"description,omitempty"` - PermissionLevel PermissionLevel `json:"permission_level,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func permissionsDescriptionFromPb(pb *permissionsDescriptionPb) (*PermissionsDescription, error) { - if pb == nil { - return nil, nil - } - st := &PermissionsDescription{} - st.Description = pb.Description - st.PermissionLevel = pb.PermissionLevel - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *permissionsDescriptionPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st permissionsDescriptionPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func principalOutputToPb(st *PrincipalOutput) (*principalOutputPb, error) { - if st == nil { - return nil, nil - } - pb := &principalOutputPb{} - pb.DisplayName = st.DisplayName - pb.GroupName = st.GroupName - pb.PrincipalId = st.PrincipalId - pb.ServicePrincipalName = st.ServicePrincipalName - pb.UserName = st.UserName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type principalOutputPb struct { - DisplayName string `json:"display_name,omitempty"` - GroupName string `json:"group_name,omitempty"` - PrincipalId int64 `json:"principal_id,omitempty"` - ServicePrincipalName string `json:"service_principal_name,omitempty"` - UserName string `json:"user_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func principalOutputFromPb(pb *principalOutputPb) (*PrincipalOutput, error) { - if pb == nil { - return nil, nil - } - st := &PrincipalOutput{} - st.DisplayName = pb.DisplayName - st.GroupName = pb.GroupName - st.PrincipalId = pb.PrincipalId - st.ServicePrincipalName = pb.ServicePrincipalName - st.UserName = pb.UserName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *principalOutputPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st principalOutputPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func resourceInfoToPb(st *ResourceInfo) (*resourceInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &resourceInfoPb{} - pb.Id = st.Id - pb.LegacyAclPath = st.LegacyAclPath - pb.ParentResourceInfo = st.ParentResourceInfo - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type resourceInfoPb struct { - Id string `json:"id" url:"id"` - LegacyAclPath string `json:"legacy_acl_path,omitempty" url:"legacy_acl_path,omitempty"` - ParentResourceInfo *ResourceInfo `json:"parent_resource_info,omitempty" url:"parent_resource_info,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func resourceInfoFromPb(pb *resourceInfoPb) (*ResourceInfo, error) { - if pb == nil { - return nil, nil - } - st := &ResourceInfo{} - st.Id = pb.Id - st.LegacyAclPath = pb.LegacyAclPath - st.ParentResourceInfo = pb.ParentResourceInfo - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *resourceInfoPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st resourceInfoPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func resourceMetaToPb(st *ResourceMeta) (*resourceMetaPb, error) { - if st == nil { - return nil, nil - } - pb := &resourceMetaPb{} - pb.ResourceType = st.ResourceType - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type resourceMetaPb struct { - ResourceType string `json:"resourceType,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func resourceMetaFromPb(pb *resourceMetaPb) (*ResourceMeta, error) { - if pb == nil { - return nil, nil - } - st := &ResourceMeta{} - st.ResourceType = pb.ResourceType - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *resourceMetaPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st resourceMetaPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func roleToPb(st *Role) (*rolePb, error) { - if st == nil { - return nil, nil - } - pb := &rolePb{} - pb.Name = st.Name - - return pb, nil -} - -type rolePb struct { - Name string `json:"name"` -} - -func roleFromPb(pb *rolePb) (*Role, error) { - if pb == nil { - return nil, nil - } - st := &Role{} - st.Name = pb.Name - - return st, nil -} - -func ruleSetResponseToPb(st *RuleSetResponse) (*ruleSetResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &ruleSetResponsePb{} - pb.Etag = st.Etag - pb.GrantRules = st.GrantRules - pb.Name = st.Name - - return pb, nil -} - -type ruleSetResponsePb struct { - Etag string `json:"etag"` - GrantRules []GrantRule `json:"grant_rules,omitempty"` - Name string `json:"name"` -} - -func ruleSetResponseFromPb(pb *ruleSetResponsePb) (*RuleSetResponse, error) { - if pb == nil { - return nil, nil - } - st := &RuleSetResponse{} - st.Etag = pb.Etag - st.GrantRules = pb.GrantRules - st.Name = pb.Name - - return st, nil -} - -func ruleSetUpdateRequestToPb(st *RuleSetUpdateRequest) (*ruleSetUpdateRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &ruleSetUpdateRequestPb{} - pb.Etag = st.Etag - pb.GrantRules = st.GrantRules - pb.Name = st.Name - - return pb, nil -} - -type ruleSetUpdateRequestPb struct { - Etag string `json:"etag"` - GrantRules []GrantRule `json:"grant_rules,omitempty"` - Name string `json:"name"` -} - -func ruleSetUpdateRequestFromPb(pb *ruleSetUpdateRequestPb) (*RuleSetUpdateRequest, error) { - if pb == nil { - return nil, nil - } - st := &RuleSetUpdateRequest{} - st.Etag = pb.Etag - st.GrantRules = pb.GrantRules - st.Name = pb.Name - - return st, nil -} - -func servicePrincipalToPb(st *ServicePrincipal) (*servicePrincipalPb, error) { - if st == nil { - return nil, nil - } - pb := &servicePrincipalPb{} - pb.Active = st.Active - pb.ApplicationId = st.ApplicationId - pb.DisplayName = st.DisplayName - pb.Entitlements = st.Entitlements - pb.ExternalId = st.ExternalId - pb.Groups = st.Groups - pb.Id = st.Id - pb.Roles = st.Roles - pb.Schemas = st.Schemas - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type servicePrincipalPb struct { - Active bool `json:"active,omitempty"` - ApplicationId string `json:"applicationId,omitempty"` - DisplayName string `json:"displayName,omitempty"` - Entitlements []ComplexValue `json:"entitlements,omitempty"` - ExternalId string `json:"externalId,omitempty"` - Groups []ComplexValue `json:"groups,omitempty"` - Id string `json:"id,omitempty" url:"-"` - Roles []ComplexValue `json:"roles,omitempty"` - Schemas []ServicePrincipalSchema `json:"schemas,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func servicePrincipalFromPb(pb *servicePrincipalPb) (*ServicePrincipal, error) { - if pb == nil { - return nil, nil - } - st := &ServicePrincipal{} - st.Active = pb.Active - st.ApplicationId = pb.ApplicationId - st.DisplayName = pb.DisplayName - st.Entitlements = pb.Entitlements - st.ExternalId = pb.ExternalId - st.Groups = pb.Groups - st.Id = pb.Id - st.Roles = pb.Roles - st.Schemas = pb.Schemas - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *servicePrincipalPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st servicePrincipalPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func setObjectPermissionsToPb(st *SetObjectPermissions) (*setObjectPermissionsPb, error) { - if st == nil { - return nil, nil - } - pb := &setObjectPermissionsPb{} - pb.AccessControlList = st.AccessControlList - pb.RequestObjectId = st.RequestObjectId - pb.RequestObjectType = st.RequestObjectType - - return pb, nil -} - -type setObjectPermissionsPb struct { - AccessControlList []AccessControlRequest `json:"access_control_list,omitempty"` - RequestObjectId string `json:"-" url:"-"` - RequestObjectType string `json:"-" url:"-"` -} - -func setObjectPermissionsFromPb(pb *setObjectPermissionsPb) (*SetObjectPermissions, error) { - if pb == nil { - return nil, nil - } - st := &SetObjectPermissions{} - st.AccessControlList = pb.AccessControlList - st.RequestObjectId = pb.RequestObjectId - st.RequestObjectType = pb.RequestObjectType - - return st, nil -} - -func updateObjectPermissionsToPb(st *UpdateObjectPermissions) (*updateObjectPermissionsPb, error) { - if st == nil { - return nil, nil - } - pb := &updateObjectPermissionsPb{} - pb.AccessControlList = st.AccessControlList - pb.RequestObjectId = st.RequestObjectId - pb.RequestObjectType = st.RequestObjectType - - return pb, nil -} - -type updateObjectPermissionsPb struct { - AccessControlList []AccessControlRequest `json:"access_control_list,omitempty"` - RequestObjectId string `json:"-" url:"-"` - RequestObjectType string `json:"-" url:"-"` -} - -func updateObjectPermissionsFromPb(pb *updateObjectPermissionsPb) (*UpdateObjectPermissions, error) { - if pb == nil { - return nil, nil - } - st := &UpdateObjectPermissions{} - st.AccessControlList = pb.AccessControlList - st.RequestObjectId = pb.RequestObjectId - st.RequestObjectType = pb.RequestObjectType - - return st, nil -} - -func updateResponseToPb(st *UpdateResponse) (*updateResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &updateResponsePb{} - - return pb, nil -} - -type updateResponsePb struct { -} - -func updateResponseFromPb(pb *updateResponsePb) (*UpdateResponse, error) { - if pb == nil { - return nil, nil - } - st := &UpdateResponse{} - - return st, nil -} - -func updateRuleSetRequestToPb(st *UpdateRuleSetRequest) (*updateRuleSetRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &updateRuleSetRequestPb{} - pb.Name = st.Name - pb.RuleSet = st.RuleSet - - return pb, nil -} - -type updateRuleSetRequestPb struct { - Name string `json:"name"` - RuleSet RuleSetUpdateRequest `json:"rule_set"` -} - -func updateRuleSetRequestFromPb(pb *updateRuleSetRequestPb) (*UpdateRuleSetRequest, error) { - if pb == nil { - return nil, nil - } - st := &UpdateRuleSetRequest{} - st.Name = pb.Name - st.RuleSet = pb.RuleSet - - return st, nil -} - -func updateWorkspaceAssignmentsToPb(st *UpdateWorkspaceAssignments) (*updateWorkspaceAssignmentsPb, error) { - if st == nil { - return nil, nil - } - pb := &updateWorkspaceAssignmentsPb{} - pb.Permissions = st.Permissions - pb.PrincipalId = st.PrincipalId - pb.WorkspaceId = st.WorkspaceId - - return pb, nil -} - -type updateWorkspaceAssignmentsPb struct { - Permissions []WorkspacePermission `json:"permissions,omitempty"` - PrincipalId int64 `json:"-" url:"-"` - WorkspaceId int64 `json:"-" url:"-"` -} - -func updateWorkspaceAssignmentsFromPb(pb *updateWorkspaceAssignmentsPb) (*UpdateWorkspaceAssignments, error) { - if pb == nil { - return nil, nil - } - st := &UpdateWorkspaceAssignments{} - st.Permissions = pb.Permissions - st.PrincipalId = pb.PrincipalId - st.WorkspaceId = pb.WorkspaceId - - return st, nil -} - -func userToPb(st *User) (*userPb, error) { - if st == nil { - return nil, nil - } - pb := &userPb{} - pb.Active = st.Active - pb.DisplayName = st.DisplayName - pb.Emails = st.Emails - pb.Entitlements = st.Entitlements - pb.ExternalId = st.ExternalId - pb.Groups = st.Groups - pb.Id = st.Id - pb.Name = st.Name - pb.Roles = st.Roles - pb.Schemas = st.Schemas - pb.UserName = st.UserName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type userPb struct { - Active bool `json:"active,omitempty"` - DisplayName string `json:"displayName,omitempty"` - Emails []ComplexValue `json:"emails,omitempty"` - Entitlements []ComplexValue `json:"entitlements,omitempty"` - ExternalId string `json:"externalId,omitempty"` - Groups []ComplexValue `json:"groups,omitempty"` - Id string `json:"id,omitempty" url:"-"` - Name *Name `json:"name,omitempty"` - Roles []ComplexValue `json:"roles,omitempty"` - Schemas []UserSchema `json:"schemas,omitempty"` - UserName string `json:"userName,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func userFromPb(pb *userPb) (*User, error) { - if pb == nil { - return nil, nil - } - st := &User{} - st.Active = pb.Active - st.DisplayName = pb.DisplayName - st.Emails = pb.Emails - st.Entitlements = pb.Entitlements - st.ExternalId = pb.ExternalId - st.Groups = pb.Groups - st.Id = pb.Id - st.Name = pb.Name - st.Roles = pb.Roles - st.Schemas = pb.Schemas - st.UserName = pb.UserName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *userPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st userPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func workspacePermissionsToPb(st *WorkspacePermissions) (*workspacePermissionsPb, error) { - if st == nil { - return nil, nil - } - pb := &workspacePermissionsPb{} - pb.Permissions = st.Permissions - - return pb, nil -} - -type workspacePermissionsPb struct { - Permissions []PermissionOutput `json:"permissions,omitempty"` -} - -func workspacePermissionsFromPb(pb *workspacePermissionsPb) (*WorkspacePermissions, error) { - if pb == nil { - return nil, nil - } - st := &WorkspacePermissions{} - st.Permissions = pb.Permissions - - return st, nil -} - -func durationToPb(d *time.Duration) (*string, error) { - if d == nil { - return nil, nil - } - s := fmt.Sprintf("%.9fs", d.Seconds()) - return &s, nil -} - -func durationFromPb(s *string) (*time.Duration, error) { - if s == nil { - return nil, nil - } - d, err := time.ParseDuration(*s) - if err != nil { - return nil, err - } - return &d, nil -} - -func timestampToPb(t *time.Time) (*string, error) { - if t == nil { - return nil, nil - } - s := t.Format(time.RFC3339) - return &s, nil -} - -func timestampFromPb(s *string) (*time.Time, error) { - if s == nil { - return nil, nil - } - t, err := time.Parse(time.RFC3339, *s) - if err != nil { - return nil, err - } - return &t, nil -} - -func fieldMaskToPb(fm *[]string) (*string, error) { - if fm == nil { - return nil, nil - } - s := strings.Join(*fm, ",") - return &s, nil -} - -func fieldMaskFromPb(s *string) (*[]string, error) { - if s == nil { - return nil, nil - } - fm := strings.Split(*s, ",") - return &fm, nil -} diff --git a/service/iam/model.go b/service/iam/model.go index 1d4a97bff..97fb292cd 100755 --- a/service/iam/model.go +++ b/service/iam/model.go @@ -3,633 +3,202 @@ package iam import ( - "encoding/json" "fmt" + + "github.com/databricks/databricks-sdk-go/marshal" ) type AccessControlRequest struct { // name of the group - // Wire name: 'group_name' GroupName string `json:"group_name,omitempty"` // Permission level - // Wire name: 'permission_level' PermissionLevel PermissionLevel `json:"permission_level,omitempty"` // application ID of a service principal - // Wire name: 'service_principal_name' ServicePrincipalName string `json:"service_principal_name,omitempty"` // name of the user - // Wire name: 'user_name' UserName string `json:"user_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *AccessControlRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &accessControlRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := accessControlRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *AccessControlRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st AccessControlRequest) MarshalJSON() ([]byte, error) { - pb, err := accessControlRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s AccessControlRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type AccessControlResponse struct { // All permissions. - // Wire name: 'all_permissions' AllPermissions []Permission `json:"all_permissions,omitempty"` // Display name of the user or service principal. - // Wire name: 'display_name' DisplayName string `json:"display_name,omitempty"` // name of the group - // Wire name: 'group_name' GroupName string `json:"group_name,omitempty"` // Name of the service principal. - // Wire name: 'service_principal_name' ServicePrincipalName string `json:"service_principal_name,omitempty"` // name of the user - // Wire name: 'user_name' UserName string `json:"user_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *AccessControlResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &accessControlResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := accessControlResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *AccessControlResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st AccessControlResponse) MarshalJSON() ([]byte, error) { - pb, err := accessControlResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s AccessControlResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // represents an identity trying to access a resource - user or a service // principal group can be a principal of a permission set assignment but an // actor is always a user or a service principal type Actor struct { + ActorId int64 `json:"actor_id,omitempty" url:"actor_id,omitempty"` - // Wire name: 'actor_id' - ActorId int64 `json:"actor_id,omitempty"` - - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *Actor) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &actorPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := actorFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *Actor) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st Actor) MarshalJSON() ([]byte, error) { - pb, err := actorToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s Actor) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Check access policy to a resource type CheckPolicyRequest struct { - Actor Actor `json:"-" tf:"-"` + Actor Actor `json:"-" url:"actor"` - AuthzIdentity RequestAuthzIdentity `json:"-" tf:"-"` + AuthzIdentity RequestAuthzIdentity `json:"-" url:"authz_identity"` - ConsistencyToken ConsistencyToken `json:"-" tf:"-"` + ConsistencyToken ConsistencyToken `json:"-" url:"consistency_token"` - Permission string `json:"-" tf:"-"` + Permission string `json:"-" url:"permission"` // Ex: (servicePrincipal/use, // accounts//servicePrincipals/) Ex: // (servicePrincipal.ruleSet/update, // accounts//servicePrincipals//ruleSets/default) - Resource string `json:"-" tf:"-"` + Resource string `json:"-" url:"resource"` - ResourceInfo *ResourceInfo `json:"-" tf:"-"` -} - -func (st *CheckPolicyRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &checkPolicyRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := checkPolicyRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CheckPolicyRequest) MarshalJSON() ([]byte, error) { - pb, err := checkPolicyRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + ResourceInfo *ResourceInfo `json:"-" url:"resource_info,omitempty"` } type CheckPolicyResponse struct { - - // Wire name: 'consistency_token' ConsistencyToken ConsistencyToken `json:"consistency_token"` - // Wire name: 'is_permitted' IsPermitted bool `json:"is_permitted,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CheckPolicyResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &checkPolicyResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := checkPolicyResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CheckPolicyResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CheckPolicyResponse) MarshalJSON() ([]byte, error) { - pb, err := checkPolicyResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CheckPolicyResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ComplexValue struct { - - // Wire name: 'display' Display string `json:"display,omitempty"` - // Wire name: 'primary' Primary bool `json:"primary,omitempty"` - // Wire name: '$ref' Ref string `json:"$ref,omitempty"` - // Wire name: 'type' Type string `json:"type,omitempty"` - // Wire name: 'value' Value string `json:"value,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ComplexValue) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &complexValuePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := complexValueFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ComplexValue) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ComplexValue) MarshalJSON() ([]byte, error) { - pb, err := complexValueToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ComplexValue) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ConsistencyToken struct { - - // Wire name: 'value' Value string `json:"value"` } -func (st *ConsistencyToken) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &consistencyTokenPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := consistencyTokenFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ConsistencyToken) MarshalJSON() ([]byte, error) { - pb, err := consistencyTokenToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Delete a group. type DeleteAccountGroupRequest struct { // Unique ID for a group in the Databricks account. - Id string `json:"-" tf:"-"` -} - -func (st *DeleteAccountGroupRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteAccountGroupRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteAccountGroupRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteAccountGroupRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteAccountGroupRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Id string `json:"-" url:"-"` } // Delete a service principal. type DeleteAccountServicePrincipalRequest struct { // Unique ID for a service principal in the Databricks account. - Id string `json:"-" tf:"-"` -} - -func (st *DeleteAccountServicePrincipalRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteAccountServicePrincipalRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteAccountServicePrincipalRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteAccountServicePrincipalRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteAccountServicePrincipalRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Id string `json:"-" url:"-"` } // Delete a user. type DeleteAccountUserRequest struct { // Unique ID for a user in the Databricks account. - Id string `json:"-" tf:"-"` -} - -func (st *DeleteAccountUserRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteAccountUserRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteAccountUserRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteAccountUserRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteAccountUserRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Id string `json:"-" url:"-"` } // Delete a group. type DeleteGroupRequest struct { // Unique ID for a group in the Databricks workspace. - Id string `json:"-" tf:"-"` -} - -func (st *DeleteGroupRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteGroupRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteGroupRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteGroupRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteGroupRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Id string `json:"-" url:"-"` } type DeleteResponse struct { } -func (st *DeleteResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Delete a service principal. type DeleteServicePrincipalRequest struct { // Unique ID for a service principal in the Databricks workspace. - Id string `json:"-" tf:"-"` -} - -func (st *DeleteServicePrincipalRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteServicePrincipalRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteServicePrincipalRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteServicePrincipalRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteServicePrincipalRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Id string `json:"-" url:"-"` } // Delete a user. type DeleteUserRequest struct { // Unique ID for a user in the Databricks workspace. - Id string `json:"-" tf:"-"` -} - -func (st *DeleteUserRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteUserRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteUserRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteUserRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteUserRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Id string `json:"-" url:"-"` } // Delete permissions assignment type DeleteWorkspaceAssignmentRequest struct { // The ID of the user, service principal, or group. - PrincipalId int64 `json:"-" tf:"-"` + PrincipalId int64 `json:"-" url:"-"` // The workspace ID for the account. - WorkspaceId int64 `json:"-" tf:"-"` -} - -func (st *DeleteWorkspaceAssignmentRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteWorkspaceAssignmentRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteWorkspaceAssignmentRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteWorkspaceAssignmentRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteWorkspaceAssignmentRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + WorkspaceId int64 `json:"-" url:"-"` } type DeleteWorkspacePermissionAssignmentResponse struct { } -func (st *DeleteWorkspacePermissionAssignmentResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteWorkspacePermissionAssignmentResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteWorkspacePermissionAssignmentResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteWorkspacePermissionAssignmentResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteWorkspacePermissionAssignmentResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Get group details. type GetAccountGroupRequest struct { // Unique ID for a group in the Databricks account. - Id string `json:"-" tf:"-"` -} - -func (st *GetAccountGroupRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getAccountGroupRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getAccountGroupRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetAccountGroupRequest) MarshalJSON() ([]byte, error) { - pb, err := getAccountGroupRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Id string `json:"-" url:"-"` } // Get service principal details. type GetAccountServicePrincipalRequest struct { // Unique ID for a service principal in the Databricks account. - Id string `json:"-" tf:"-"` -} - -func (st *GetAccountServicePrincipalRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getAccountServicePrincipalRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getAccountServicePrincipalRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetAccountServicePrincipalRequest) MarshalJSON() ([]byte, error) { - pb, err := getAccountServicePrincipalRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Id string `json:"-" url:"-"` } // Get user details. type GetAccountUserRequest struct { // Comma-separated list of attributes to return in response. - Attributes string `json:"-" tf:"-"` + Attributes string `json:"-" url:"attributes,omitempty"` // Desired number of results per page. Default is 10000. - Count int `json:"-" tf:"-"` + Count int `json:"-" url:"count,omitempty"` // Comma-separated list of attributes to exclude in response. - ExcludedAttributes string `json:"-" tf:"-"` + ExcludedAttributes string `json:"-" url:"excludedAttributes,omitempty"` // Query by which the results have to be filtered. Supported operators are // equals(`eq`), contains(`co`), starts with(`sw`) and not equals(`ne`). // Additionally, simple expressions can be formed using logical operators - @@ -637,43 +206,26 @@ type GetAccountUserRequest struct { // support simple expressions. // // [SCIM RFC]: https://tools.ietf.org/html/rfc7644#section-3.4.2.2 - Filter string `json:"-" tf:"-"` + Filter string `json:"-" url:"filter,omitempty"` // Unique ID for a user in the Databricks account. - Id string `json:"-" tf:"-"` + Id string `json:"-" url:"-"` // Attribute to sort the results. Multi-part paths are supported. For // example, `userName`, `name.givenName`, and `emails`. - SortBy string `json:"-" tf:"-"` + SortBy string `json:"-" url:"sortBy,omitempty"` // The order to sort the results. - SortOrder GetSortOrder `json:"-" tf:"-"` + SortOrder GetSortOrder `json:"-" url:"sortOrder,omitempty"` // Specifies the index of the first result. First item is number 1. - StartIndex int `json:"-" tf:"-"` + StartIndex int `json:"-" url:"startIndex,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetAccountUserRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getAccountUserRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getAccountUserRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetAccountUserRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetAccountUserRequest) MarshalJSON() ([]byte, error) { - pb, err := getAccountUserRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetAccountUserRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get assignable roles for a resource @@ -685,229 +237,50 @@ type GetAssignableRolesForResourceRequest struct { // `resource=accounts//groups/` | A resource name for // the group. `resource=accounts//servicePrincipals/` | A // resource name for the service principal. - Resource string `json:"-" tf:"-"` -} - -func (st *GetAssignableRolesForResourceRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getAssignableRolesForResourceRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getAssignableRolesForResourceRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetAssignableRolesForResourceRequest) MarshalJSON() ([]byte, error) { - pb, err := getAssignableRolesForResourceRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Resource string `json:"-" url:"resource"` } type GetAssignableRolesForResourceResponse struct { - - // Wire name: 'roles' Roles []Role `json:"roles,omitempty"` } -func (st *GetAssignableRolesForResourceResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getAssignableRolesForResourceResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getAssignableRolesForResourceResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetAssignableRolesForResourceResponse) MarshalJSON() ([]byte, error) { - pb, err := getAssignableRolesForResourceResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Get group details. type GetGroupRequest struct { // Unique ID for a group in the Databricks workspace. - Id string `json:"-" tf:"-"` -} - -func (st *GetGroupRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getGroupRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getGroupRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetGroupRequest) MarshalJSON() ([]byte, error) { - pb, err := getGroupRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Id string `json:"-" url:"-"` } type GetPasswordPermissionLevelsResponse struct { // Specific permission levels - // Wire name: 'permission_levels' PermissionLevels []PasswordPermissionsDescription `json:"permission_levels,omitempty"` } -func (st *GetPasswordPermissionLevelsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getPasswordPermissionLevelsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getPasswordPermissionLevelsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetPasswordPermissionLevelsResponse) MarshalJSON() ([]byte, error) { - pb, err := getPasswordPermissionLevelsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Get object permission levels type GetPermissionLevelsRequest struct { - RequestObjectId string `json:"-" tf:"-"` + RequestObjectId string `json:"-" url:"-"` // The type of the request object. Can be one of the following: alerts, // authorization, clusters, cluster-policies, dashboards, dbsql-dashboards, // directories, experiments, files, instance-pools, jobs, notebooks, // pipelines, queries, registered-models, repos, serving-endpoints, or // warehouses. - RequestObjectType string `json:"-" tf:"-"` -} - -func (st *GetPermissionLevelsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getPermissionLevelsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getPermissionLevelsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetPermissionLevelsRequest) MarshalJSON() ([]byte, error) { - pb, err := getPermissionLevelsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + RequestObjectType string `json:"-" url:"-"` } type GetPermissionLevelsResponse struct { // Specific permission levels - // Wire name: 'permission_levels' PermissionLevels []PermissionsDescription `json:"permission_levels,omitempty"` } -func (st *GetPermissionLevelsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getPermissionLevelsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getPermissionLevelsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetPermissionLevelsResponse) MarshalJSON() ([]byte, error) { - pb, err := getPermissionLevelsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Get object permissions type GetPermissionRequest struct { // The id of the request object. - RequestObjectId string `json:"-" tf:"-"` + RequestObjectId string `json:"-" url:"-"` // The type of the request object. Can be one of the following: alerts, // authorization, clusters, cluster-policies, dashboards, dbsql-dashboards, // directories, experiments, files, instance-pools, jobs, notebooks, // pipelines, queries, registered-models, repos, serving-endpoints, or // warehouses. - RequestObjectType string `json:"-" tf:"-"` -} - -func (st *GetPermissionRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getPermissionRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getPermissionRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetPermissionRequest) MarshalJSON() ([]byte, error) { - pb, err := getPermissionRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + RequestObjectType string `json:"-" url:"-"` } // Get a rule set @@ -925,7 +298,7 @@ type GetRuleSetRequest struct { // in GET to indicate no freshness requirements. // `etag=RENUAAABhSweA4NvVmmUYdiU717H3Tgy0UJdor3gE4a+mq/oj9NjAf8ZsQ==` | An // etag encoded a specific version of the rule set to get or to be updated. - Etag string `json:"-" tf:"-"` + Etag string `json:"-" url:"etag"` // The ruleset name associated with the request. // // Examples | Summary :--- | :--- @@ -935,63 +308,13 @@ type GetRuleSetRequest struct { // for a rule set on the group. // `name=accounts//servicePrincipals//ruleSets/default` // | A name for a rule set on the service principal. - Name string `json:"-" tf:"-"` -} - -func (st *GetRuleSetRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getRuleSetRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getRuleSetRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetRuleSetRequest) MarshalJSON() ([]byte, error) { - pb, err := getRuleSetRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Name string `json:"-" url:"name"` } // Get service principal details. type GetServicePrincipalRequest struct { // Unique ID for a service principal in the Databricks workspace. - Id string `json:"-" tf:"-"` -} - -func (st *GetServicePrincipalRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getServicePrincipalRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getServicePrincipalRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetServicePrincipalRequest) MarshalJSON() ([]byte, error) { - pb, err := getServicePrincipalRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Id string `json:"-" url:"-"` } type GetSortOrder string @@ -1034,11 +357,11 @@ func (f *GetSortOrder) Type() string { // Get user details. type GetUserRequest struct { // Comma-separated list of attributes to return in response. - Attributes string `json:"-" tf:"-"` + Attributes string `json:"-" url:"attributes,omitempty"` // Desired number of results per page. - Count int `json:"-" tf:"-"` + Count int `json:"-" url:"count,omitempty"` // Comma-separated list of attributes to exclude in response. - ExcludedAttributes string `json:"-" tf:"-"` + ExcludedAttributes string `json:"-" url:"excludedAttributes,omitempty"` // Query by which the results have to be filtered. Supported operators are // equals(`eq`), contains(`co`), starts with(`sw`) and not equals(`ne`). // Additionally, simple expressions can be formed using logical operators - @@ -1046,74 +369,32 @@ type GetUserRequest struct { // support simple expressions. // // [SCIM RFC]: https://tools.ietf.org/html/rfc7644#section-3.4.2.2 - Filter string `json:"-" tf:"-"` + Filter string `json:"-" url:"filter,omitempty"` // Unique ID for a user in the Databricks workspace. - Id string `json:"-" tf:"-"` + Id string `json:"-" url:"-"` // Attribute to sort the results. Multi-part paths are supported. For // example, `userName`, `name.givenName`, and `emails`. - SortBy string `json:"-" tf:"-"` + SortBy string `json:"-" url:"sortBy,omitempty"` // The order to sort the results. - SortOrder GetSortOrder `json:"-" tf:"-"` + SortOrder GetSortOrder `json:"-" url:"sortOrder,omitempty"` // Specifies the index of the first result. First item is number 1. - StartIndex int `json:"-" tf:"-"` + StartIndex int `json:"-" url:"startIndex,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetUserRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getUserRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getUserRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetUserRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetUserRequest) MarshalJSON() ([]byte, error) { - pb, err := getUserRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetUserRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // List workspace permissions type GetWorkspaceAssignmentRequest struct { // The workspace ID. - WorkspaceId int64 `json:"-" tf:"-"` -} - -func (st *GetWorkspaceAssignmentRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getWorkspaceAssignmentRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getWorkspaceAssignmentRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetWorkspaceAssignmentRequest) MarshalJSON() ([]byte, error) { - pb, err := getWorkspaceAssignmentRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + WorkspaceId int64 `json:"-" url:"-"` } type GrantRule struct { @@ -1122,96 +403,43 @@ type GrantRule struct { // an account group. Each principal has its own identifier format: * // users/ * groups/ * // servicePrincipals/ - // Wire name: 'principals' Principals []string `json:"principals,omitempty"` // Role that is assigned to the list of principals. - // Wire name: 'role' Role string `json:"role"` } -func (st *GrantRule) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &grantRulePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := grantRuleFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GrantRule) MarshalJSON() ([]byte, error) { - pb, err := grantRuleToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type Group struct { // String that represents a human-readable group name - // Wire name: 'displayName' DisplayName string `json:"displayName,omitempty"` // Entitlements assigned to the group. See [assigning entitlements] for a // full list of supported values. // // [assigning entitlements]: https://docs.databricks.com/administration-guide/users-groups/index.html#assigning-entitlements - // Wire name: 'entitlements' Entitlements []ComplexValue `json:"entitlements,omitempty"` - // Wire name: 'externalId' ExternalId string `json:"externalId,omitempty"` - // Wire name: 'groups' Groups []ComplexValue `json:"groups,omitempty"` // Databricks group ID - // Wire name: 'id' - Id string `json:"id,omitempty"` + Id string `json:"id,omitempty" url:"-"` - // Wire name: 'members' Members []ComplexValue `json:"members,omitempty"` // Container for the group identifier. Workspace local versus account. - // Wire name: 'meta' Meta *ResourceMeta `json:"meta,omitempty"` // Corresponds to AWS instance profile/arn role. - // Wire name: 'roles' Roles []ComplexValue `json:"roles,omitempty"` // The schema of the group. - // Wire name: 'schemas' Schemas []GroupSchema `json:"schemas,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *Group) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &groupPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := groupFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *Group) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st Group) MarshalJSON() ([]byte, error) { - pb, err := groupToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s Group) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type GroupSchema string @@ -1251,11 +479,11 @@ func (f *GroupSchema) Type() string { // List group details. type ListAccountGroupsRequest struct { // Comma-separated list of attributes to return in response. - Attributes string `json:"-" tf:"-"` + Attributes string `json:"-" url:"attributes,omitempty"` // Desired number of results per page. Default is 10000. - Count int64 `json:"-" tf:"-"` + Count int64 `json:"-" url:"count,omitempty"` // Comma-separated list of attributes to exclude in response. - ExcludedAttributes string `json:"-" tf:"-"` + ExcludedAttributes string `json:"-" url:"excludedAttributes,omitempty"` // Query by which the results have to be filtered. Supported operators are // equals(`eq`), contains(`co`), starts with(`sw`) and not equals(`ne`). // Additionally, simple expressions can be formed using logical operators - @@ -1263,50 +491,33 @@ type ListAccountGroupsRequest struct { // support simple expressions. // // [SCIM RFC]: https://tools.ietf.org/html/rfc7644#section-3.4.2.2 - Filter string `json:"-" tf:"-"` + Filter string `json:"-" url:"filter,omitempty"` // Attribute to sort the results. - SortBy string `json:"-" tf:"-"` + SortBy string `json:"-" url:"sortBy,omitempty"` // The order to sort the results. - SortOrder ListSortOrder `json:"-" tf:"-"` + SortOrder ListSortOrder `json:"-" url:"sortOrder,omitempty"` // Specifies the index of the first result. First item is number 1. - StartIndex int64 `json:"-" tf:"-"` + StartIndex int64 `json:"-" url:"startIndex,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListAccountGroupsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listAccountGroupsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listAccountGroupsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListAccountGroupsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListAccountGroupsRequest) MarshalJSON() ([]byte, error) { - pb, err := listAccountGroupsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListAccountGroupsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // List service principals. type ListAccountServicePrincipalsRequest struct { // Comma-separated list of attributes to return in response. - Attributes string `json:"-" tf:"-"` + Attributes string `json:"-" url:"attributes,omitempty"` // Desired number of results per page. Default is 10000. - Count int64 `json:"-" tf:"-"` + Count int64 `json:"-" url:"count,omitempty"` // Comma-separated list of attributes to exclude in response. - ExcludedAttributes string `json:"-" tf:"-"` + ExcludedAttributes string `json:"-" url:"excludedAttributes,omitempty"` // Query by which the results have to be filtered. Supported operators are // equals(`eq`), contains(`co`), starts with(`sw`) and not equals(`ne`). // Additionally, simple expressions can be formed using logical operators - @@ -1314,50 +525,33 @@ type ListAccountServicePrincipalsRequest struct { // support simple expressions. // // [SCIM RFC]: https://tools.ietf.org/html/rfc7644#section-3.4.2.2 - Filter string `json:"-" tf:"-"` + Filter string `json:"-" url:"filter,omitempty"` // Attribute to sort the results. - SortBy string `json:"-" tf:"-"` + SortBy string `json:"-" url:"sortBy,omitempty"` // The order to sort the results. - SortOrder ListSortOrder `json:"-" tf:"-"` + SortOrder ListSortOrder `json:"-" url:"sortOrder,omitempty"` // Specifies the index of the first result. First item is number 1. - StartIndex int64 `json:"-" tf:"-"` + StartIndex int64 `json:"-" url:"startIndex,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListAccountServicePrincipalsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listAccountServicePrincipalsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listAccountServicePrincipalsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListAccountServicePrincipalsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListAccountServicePrincipalsRequest) MarshalJSON() ([]byte, error) { - pb, err := listAccountServicePrincipalsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListAccountServicePrincipalsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // List users. type ListAccountUsersRequest struct { // Comma-separated list of attributes to return in response. - Attributes string `json:"-" tf:"-"` + Attributes string `json:"-" url:"attributes,omitempty"` // Desired number of results per page. Default is 10000. - Count int64 `json:"-" tf:"-"` + Count int64 `json:"-" url:"count,omitempty"` // Comma-separated list of attributes to exclude in response. - ExcludedAttributes string `json:"-" tf:"-"` + ExcludedAttributes string `json:"-" url:"excludedAttributes,omitempty"` // Query by which the results have to be filtered. Supported operators are // equals(`eq`), contains(`co`), starts with(`sw`) and not equals(`ne`). // Additionally, simple expressions can be formed using logical operators - @@ -1365,51 +559,34 @@ type ListAccountUsersRequest struct { // support simple expressions. // // [SCIM RFC]: https://tools.ietf.org/html/rfc7644#section-3.4.2.2 - Filter string `json:"-" tf:"-"` + Filter string `json:"-" url:"filter,omitempty"` // Attribute to sort the results. Multi-part paths are supported. For // example, `userName`, `name.givenName`, and `emails`. - SortBy string `json:"-" tf:"-"` + SortBy string `json:"-" url:"sortBy,omitempty"` // The order to sort the results. - SortOrder ListSortOrder `json:"-" tf:"-"` + SortOrder ListSortOrder `json:"-" url:"sortOrder,omitempty"` // Specifies the index of the first result. First item is number 1. - StartIndex int64 `json:"-" tf:"-"` + StartIndex int64 `json:"-" url:"startIndex,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListAccountUsersRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listAccountUsersRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listAccountUsersRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListAccountUsersRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListAccountUsersRequest) MarshalJSON() ([]byte, error) { - pb, err := listAccountUsersRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListAccountUsersRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // List group details. type ListGroupsRequest struct { // Comma-separated list of attributes to return in response. - Attributes string `json:"-" tf:"-"` + Attributes string `json:"-" url:"attributes,omitempty"` // Desired number of results per page. - Count int64 `json:"-" tf:"-"` + Count int64 `json:"-" url:"count,omitempty"` // Comma-separated list of attributes to exclude in response. - ExcludedAttributes string `json:"-" tf:"-"` + ExcludedAttributes string `json:"-" url:"excludedAttributes,omitempty"` // Query by which the results have to be filtered. Supported operators are // equals(`eq`), contains(`co`), starts with(`sw`) and not equals(`ne`). // Additionally, simple expressions can be formed using logical operators - @@ -1417,86 +594,47 @@ type ListGroupsRequest struct { // support simple expressions. // // [SCIM RFC]: https://tools.ietf.org/html/rfc7644#section-3.4.2.2 - Filter string `json:"-" tf:"-"` + Filter string `json:"-" url:"filter,omitempty"` // Attribute to sort the results. - SortBy string `json:"-" tf:"-"` + SortBy string `json:"-" url:"sortBy,omitempty"` // The order to sort the results. - SortOrder ListSortOrder `json:"-" tf:"-"` + SortOrder ListSortOrder `json:"-" url:"sortOrder,omitempty"` // Specifies the index of the first result. First item is number 1. - StartIndex int64 `json:"-" tf:"-"` + StartIndex int64 `json:"-" url:"startIndex,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListGroupsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listGroupsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listGroupsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListGroupsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListGroupsRequest) MarshalJSON() ([]byte, error) { - pb, err := listGroupsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListGroupsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListGroupsResponse struct { // Total results returned in the response. - // Wire name: 'itemsPerPage' ItemsPerPage int64 `json:"itemsPerPage,omitempty"` // User objects returned in the response. - // Wire name: 'Resources' Resources []Group `json:"Resources,omitempty"` // The schema of the service principal. - // Wire name: 'schemas' Schemas []ListResponseSchema `json:"schemas,omitempty"` // Starting index of all the results that matched the request filters. First // item is number 1. - // Wire name: 'startIndex' StartIndex int64 `json:"startIndex,omitempty"` // Total results that match the request filters. - // Wire name: 'totalResults' TotalResults int64 `json:"totalResults,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListGroupsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listGroupsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listGroupsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListGroupsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListGroupsResponse) MarshalJSON() ([]byte, error) { - pb, err := listGroupsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListGroupsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListResponseSchema string @@ -1535,58 +673,36 @@ func (f *ListResponseSchema) Type() string { type ListServicePrincipalResponse struct { // Total results returned in the response. - // Wire name: 'itemsPerPage' ItemsPerPage int64 `json:"itemsPerPage,omitempty"` // User objects returned in the response. - // Wire name: 'Resources' Resources []ServicePrincipal `json:"Resources,omitempty"` // The schema of the List response. - // Wire name: 'schemas' Schemas []ListResponseSchema `json:"schemas,omitempty"` // Starting index of all the results that matched the request filters. First // item is number 1. - // Wire name: 'startIndex' StartIndex int64 `json:"startIndex,omitempty"` // Total results that match the request filters. - // Wire name: 'totalResults' TotalResults int64 `json:"totalResults,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListServicePrincipalResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listServicePrincipalResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listServicePrincipalResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListServicePrincipalResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListServicePrincipalResponse) MarshalJSON() ([]byte, error) { - pb, err := listServicePrincipalResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListServicePrincipalResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // List service principals. type ListServicePrincipalsRequest struct { // Comma-separated list of attributes to return in response. - Attributes string `json:"-" tf:"-"` + Attributes string `json:"-" url:"attributes,omitempty"` // Desired number of results per page. - Count int64 `json:"-" tf:"-"` + Count int64 `json:"-" url:"count,omitempty"` // Comma-separated list of attributes to exclude in response. - ExcludedAttributes string `json:"-" tf:"-"` + ExcludedAttributes string `json:"-" url:"excludedAttributes,omitempty"` // Query by which the results have to be filtered. Supported operators are // equals(`eq`), contains(`co`), starts with(`sw`) and not equals(`ne`). // Additionally, simple expressions can be formed using logical operators - @@ -1594,40 +710,23 @@ type ListServicePrincipalsRequest struct { // support simple expressions. // // [SCIM RFC]: https://tools.ietf.org/html/rfc7644#section-3.4.2.2 - Filter string `json:"-" tf:"-"` + Filter string `json:"-" url:"filter,omitempty"` // Attribute to sort the results. - SortBy string `json:"-" tf:"-"` + SortBy string `json:"-" url:"sortBy,omitempty"` // The order to sort the results. - SortOrder ListSortOrder `json:"-" tf:"-"` + SortOrder ListSortOrder `json:"-" url:"sortOrder,omitempty"` // Specifies the index of the first result. First item is number 1. - StartIndex int64 `json:"-" tf:"-"` + StartIndex int64 `json:"-" url:"startIndex,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListServicePrincipalsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listServicePrincipalsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listServicePrincipalsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListServicePrincipalsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListServicePrincipalsRequest) MarshalJSON() ([]byte, error) { - pb, err := listServicePrincipalsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListServicePrincipalsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListSortOrder string @@ -1670,11 +769,11 @@ func (f *ListSortOrder) Type() string { // List users. type ListUsersRequest struct { // Comma-separated list of attributes to return in response. - Attributes string `json:"-" tf:"-"` + Attributes string `json:"-" url:"attributes,omitempty"` // Desired number of results per page. - Count int64 `json:"-" tf:"-"` + Count int64 `json:"-" url:"count,omitempty"` // Comma-separated list of attributes to exclude in response. - ExcludedAttributes string `json:"-" tf:"-"` + ExcludedAttributes string `json:"-" url:"excludedAttributes,omitempty"` // Query by which the results have to be filtered. Supported operators are // equals(`eq`), contains(`co`), starts with(`sw`) and not equals(`ne`). // Additionally, simple expressions can be formed using logical operators - @@ -1682,432 +781,198 @@ type ListUsersRequest struct { // support simple expressions. // // [SCIM RFC]: https://tools.ietf.org/html/rfc7644#section-3.4.2.2 - Filter string `json:"-" tf:"-"` + Filter string `json:"-" url:"filter,omitempty"` // Attribute to sort the results. Multi-part paths are supported. For // example, `userName`, `name.givenName`, and `emails`. - SortBy string `json:"-" tf:"-"` + SortBy string `json:"-" url:"sortBy,omitempty"` // The order to sort the results. - SortOrder ListSortOrder `json:"-" tf:"-"` + SortOrder ListSortOrder `json:"-" url:"sortOrder,omitempty"` // Specifies the index of the first result. First item is number 1. - StartIndex int64 `json:"-" tf:"-"` + StartIndex int64 `json:"-" url:"startIndex,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListUsersRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listUsersRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listUsersRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListUsersRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListUsersRequest) MarshalJSON() ([]byte, error) { - pb, err := listUsersRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListUsersRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListUsersResponse struct { // Total results returned in the response. - // Wire name: 'itemsPerPage' ItemsPerPage int64 `json:"itemsPerPage,omitempty"` // User objects returned in the response. - // Wire name: 'Resources' Resources []User `json:"Resources,omitempty"` // The schema of the List response. - // Wire name: 'schemas' Schemas []ListResponseSchema `json:"schemas,omitempty"` // Starting index of all the results that matched the request filters. First // item is number 1. - // Wire name: 'startIndex' StartIndex int64 `json:"startIndex,omitempty"` // Total results that match the request filters. - // Wire name: 'totalResults' TotalResults int64 `json:"totalResults,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListUsersResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listUsersResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listUsersResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListUsersResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListUsersResponse) MarshalJSON() ([]byte, error) { - pb, err := listUsersResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListUsersResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get permission assignments type ListWorkspaceAssignmentRequest struct { // The workspace ID for the account. - WorkspaceId int64 `json:"-" tf:"-"` -} - -func (st *ListWorkspaceAssignmentRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listWorkspaceAssignmentRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listWorkspaceAssignmentRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ListWorkspaceAssignmentRequest) MarshalJSON() ([]byte, error) { - pb, err := listWorkspaceAssignmentRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + WorkspaceId int64 `json:"-" url:"-"` } type MigratePermissionsRequest struct { // The name of the workspace group that permissions will be migrated from. - // Wire name: 'from_workspace_group_name' FromWorkspaceGroupName string `json:"from_workspace_group_name"` // The maximum number of permissions that will be migrated. - // Wire name: 'size' Size int `json:"size,omitempty"` // The name of the account group that permissions will be migrated to. - // Wire name: 'to_account_group_name' ToAccountGroupName string `json:"to_account_group_name"` // WorkspaceId of the associated workspace where the permission migration // will occur. - // Wire name: 'workspace_id' WorkspaceId int64 `json:"workspace_id"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *MigratePermissionsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &migratePermissionsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := migratePermissionsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *MigratePermissionsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st MigratePermissionsRequest) MarshalJSON() ([]byte, error) { - pb, err := migratePermissionsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s MigratePermissionsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type MigratePermissionsResponse struct { // Number of permissions migrated. - // Wire name: 'permissions_migrated' PermissionsMigrated int `json:"permissions_migrated,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *MigratePermissionsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &migratePermissionsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := migratePermissionsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *MigratePermissionsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st MigratePermissionsResponse) MarshalJSON() ([]byte, error) { - pb, err := migratePermissionsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s MigratePermissionsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type Name struct { // Family name of the Databricks user. - // Wire name: 'familyName' FamilyName string `json:"familyName,omitempty"` // Given name of the Databricks user. - // Wire name: 'givenName' GivenName string `json:"givenName,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *Name) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &namePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := nameFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *Name) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st Name) MarshalJSON() ([]byte, error) { - pb, err := nameToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s Name) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ObjectPermissions struct { - - // Wire name: 'access_control_list' AccessControlList []AccessControlResponse `json:"access_control_list,omitempty"` - // Wire name: 'object_id' ObjectId string `json:"object_id,omitempty"` - // Wire name: 'object_type' ObjectType string `json:"object_type,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ObjectPermissions) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &objectPermissionsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := objectPermissionsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ObjectPermissions) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ObjectPermissions) MarshalJSON() ([]byte, error) { - pb, err := objectPermissionsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ObjectPermissions) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type PartialUpdate struct { // Unique ID in the Databricks workspace. - Id string `json:"-" tf:"-"` + Id string `json:"-" url:"-"` - // Wire name: 'Operations' Operations []Patch `json:"Operations,omitempty"` // The schema of the patch request. Must be // ["urn:ietf:params:scim:api:messages:2.0:PatchOp"]. - // Wire name: 'schemas' Schemas []PatchSchema `json:"schemas,omitempty"` } -func (st *PartialUpdate) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &partialUpdatePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := partialUpdateFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st PartialUpdate) MarshalJSON() ([]byte, error) { - pb, err := partialUpdateToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type PasswordAccessControlRequest struct { // name of the group - // Wire name: 'group_name' GroupName string `json:"group_name,omitempty"` // Permission level - // Wire name: 'permission_level' PermissionLevel PasswordPermissionLevel `json:"permission_level,omitempty"` // application ID of a service principal - // Wire name: 'service_principal_name' ServicePrincipalName string `json:"service_principal_name,omitempty"` // name of the user - // Wire name: 'user_name' UserName string `json:"user_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *PasswordAccessControlRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &passwordAccessControlRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := passwordAccessControlRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *PasswordAccessControlRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st PasswordAccessControlRequest) MarshalJSON() ([]byte, error) { - pb, err := passwordAccessControlRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s PasswordAccessControlRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type PasswordAccessControlResponse struct { // All permissions. - // Wire name: 'all_permissions' AllPermissions []PasswordPermission `json:"all_permissions,omitempty"` // Display name of the user or service principal. - // Wire name: 'display_name' DisplayName string `json:"display_name,omitempty"` // name of the group - // Wire name: 'group_name' GroupName string `json:"group_name,omitempty"` // Name of the service principal. - // Wire name: 'service_principal_name' ServicePrincipalName string `json:"service_principal_name,omitempty"` // name of the user - // Wire name: 'user_name' UserName string `json:"user_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *PasswordAccessControlResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &passwordAccessControlResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := passwordAccessControlResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *PasswordAccessControlResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st PasswordAccessControlResponse) MarshalJSON() ([]byte, error) { - pb, err := passwordAccessControlResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s PasswordAccessControlResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type PasswordPermission struct { - - // Wire name: 'inherited' Inherited bool `json:"inherited,omitempty"` - // Wire name: 'inherited_from_object' InheritedFromObject []string `json:"inherited_from_object,omitempty"` // Permission level - // Wire name: 'permission_level' PermissionLevel PasswordPermissionLevel `json:"permission_level,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *PasswordPermission) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &passwordPermissionPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := passwordPermissionFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *PasswordPermission) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st PasswordPermission) MarshalJSON() ([]byte, error) { - pb, err := passwordPermissionToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s PasswordPermission) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Permission level @@ -2146,148 +1011,60 @@ func (f *PasswordPermissionLevel) Type() string { } type PasswordPermissions struct { - - // Wire name: 'access_control_list' AccessControlList []PasswordAccessControlResponse `json:"access_control_list,omitempty"` - // Wire name: 'object_id' ObjectId string `json:"object_id,omitempty"` - // Wire name: 'object_type' ObjectType string `json:"object_type,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *PasswordPermissions) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &passwordPermissionsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := passwordPermissionsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *PasswordPermissions) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st PasswordPermissions) MarshalJSON() ([]byte, error) { - pb, err := passwordPermissionsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s PasswordPermissions) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type PasswordPermissionsDescription struct { - - // Wire name: 'description' Description string `json:"description,omitempty"` // Permission level - // Wire name: 'permission_level' PermissionLevel PasswordPermissionLevel `json:"permission_level,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *PasswordPermissionsDescription) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &passwordPermissionsDescriptionPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := passwordPermissionsDescriptionFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *PasswordPermissionsDescription) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st PasswordPermissionsDescription) MarshalJSON() ([]byte, error) { - pb, err := passwordPermissionsDescriptionToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s PasswordPermissionsDescription) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type PasswordPermissionsRequest struct { - - // Wire name: 'access_control_list' AccessControlList []PasswordAccessControlRequest `json:"access_control_list,omitempty"` } -func (st *PasswordPermissionsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &passwordPermissionsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := passwordPermissionsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st PasswordPermissionsRequest) MarshalJSON() ([]byte, error) { - pb, err := passwordPermissionsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type Patch struct { // Type of patch operation. - // Wire name: 'op' Op PatchOp `json:"op,omitempty"` // Selection of patch operation - // Wire name: 'path' Path string `json:"path,omitempty"` // Value to modify - // Wire name: 'value' Value any `json:"value,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *Patch) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &patchPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := patchFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *Patch) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st Patch) MarshalJSON() ([]byte, error) { - pb, err := patchToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s Patch) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Type of patch operation. @@ -2334,31 +1111,6 @@ func (f *PatchOp) Type() string { type PatchResponse struct { } -func (st *PatchResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &patchResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := patchResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st PatchResponse) MarshalJSON() ([]byte, error) { - pb, err := patchResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type PatchSchema string const PatchSchemaUrnIetfParamsScimApiMessages20PatchOp PatchSchema = `urn:ietf:params:scim:api:messages:2.0:PatchOp` @@ -2394,116 +1146,49 @@ func (f *PatchSchema) Type() string { } type Permission struct { - - // Wire name: 'inherited' Inherited bool `json:"inherited,omitempty"` - // Wire name: 'inherited_from_object' InheritedFromObject []string `json:"inherited_from_object,omitempty"` // Permission level - // Wire name: 'permission_level' PermissionLevel PermissionLevel `json:"permission_level,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *Permission) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &permissionPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := permissionFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *Permission) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st Permission) MarshalJSON() ([]byte, error) { - pb, err := permissionToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s Permission) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The output format for existing workspace PermissionAssignment records, which // contains some info for user consumption. type PermissionAssignment struct { // Error response associated with a workspace permission assignment, if any. - // Wire name: 'error' Error string `json:"error,omitempty"` // The permissions level of the principal. - // Wire name: 'permissions' Permissions []WorkspacePermission `json:"permissions,omitempty"` // Information about the principal assigned to the workspace. - // Wire name: 'principal' Principal *PrincipalOutput `json:"principal,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *PermissionAssignment) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &permissionAssignmentPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := permissionAssignmentFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *PermissionAssignment) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st PermissionAssignment) MarshalJSON() ([]byte, error) { - pb, err := permissionAssignmentToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s PermissionAssignment) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type PermissionAssignments struct { // Array of permissions assignments defined for a workspace. - // Wire name: 'permission_assignments' PermissionAssignments []PermissionAssignment `json:"permission_assignments,omitempty"` } -func (st *PermissionAssignments) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &permissionAssignmentsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := permissionAssignmentsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st PermissionAssignments) MarshalJSON() ([]byte, error) { - pb, err := permissionAssignmentsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Permission level type PermissionLevel string @@ -2595,121 +1280,60 @@ func (f *PermissionLevel) Type() string { type PermissionOutput struct { // The results of a permissions query. - // Wire name: 'description' Description string `json:"description,omitempty"` - // Wire name: 'permission_level' PermissionLevel WorkspacePermission `json:"permission_level,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *PermissionOutput) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &permissionOutputPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := permissionOutputFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *PermissionOutput) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st PermissionOutput) MarshalJSON() ([]byte, error) { - pb, err := permissionOutputToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s PermissionOutput) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type PermissionsDescription struct { - - // Wire name: 'description' Description string `json:"description,omitempty"` // Permission level - // Wire name: 'permission_level' PermissionLevel PermissionLevel `json:"permission_level,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *PermissionsDescription) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &permissionsDescriptionPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := permissionsDescriptionFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *PermissionsDescription) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st PermissionsDescription) MarshalJSON() ([]byte, error) { - pb, err := permissionsDescriptionToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s PermissionsDescription) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Information about the principal assigned to the workspace. type PrincipalOutput struct { // The display name of the principal. - // Wire name: 'display_name' DisplayName string `json:"display_name,omitempty"` // The group name of the group. Present only if the principal is a group. - // Wire name: 'group_name' GroupName string `json:"group_name,omitempty"` // The unique, opaque id of the principal. - // Wire name: 'principal_id' PrincipalId int64 `json:"principal_id,omitempty"` // The name of the service principal. Present only if the principal is a // service principal. - // Wire name: 'service_principal_name' ServicePrincipalName string `json:"service_principal_name,omitempty"` // The username of the user. Present only if the principal is a user. - // Wire name: 'user_name' UserName string `json:"user_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *PrincipalOutput) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &principalOutputPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := principalOutputFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *PrincipalOutput) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st PrincipalOutput) MarshalJSON() ([]byte, error) { - pb, err := principalOutputToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s PrincipalOutput) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Defines the identity to be used for authZ of the request on the server side. @@ -2753,109 +1377,45 @@ func (f *RequestAuthzIdentity) Type() string { type ResourceInfo struct { // Id of the current resource. - // Wire name: 'id' - Id string `json:"id"` + Id string `json:"id" url:"id"` // The legacy acl path of the current resource. - // Wire name: 'legacy_acl_path' - LegacyAclPath string `json:"legacy_acl_path,omitempty"` + LegacyAclPath string `json:"legacy_acl_path,omitempty" url:"legacy_acl_path,omitempty"` // Parent resource info for the current resource. The parent may have // another parent. - // Wire name: 'parent_resource_info' - ParentResourceInfo *ResourceInfo `json:"parent_resource_info,omitempty"` + ParentResourceInfo *ResourceInfo `json:"parent_resource_info,omitempty" url:"parent_resource_info,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ResourceInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &resourceInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := resourceInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ResourceInfo) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ResourceInfo) MarshalJSON() ([]byte, error) { - pb, err := resourceInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ResourceInfo) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ResourceMeta struct { // Identifier for group type. Can be local workspace group // (`WorkspaceGroup`) or account group (`Group`). - // Wire name: 'resourceType' ResourceType string `json:"resourceType,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ResourceMeta) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &resourceMetaPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := resourceMetaFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ResourceMeta) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ResourceMeta) MarshalJSON() ([]byte, error) { - pb, err := resourceMetaToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ResourceMeta) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type Role struct { // Role to assign to a principal or a list of principals on a resource. - // Wire name: 'name' Name string `json:"name"` } -func (st *Role) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &rolePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := roleFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st Role) MarshalJSON() ([]byte, error) { - pb, err := roleToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type RuleSetResponse struct { // Identifies the version of the rule set returned. Etag used for // versioning. The response is at least as fresh as the eTag provided. Etag @@ -2866,41 +1426,13 @@ type RuleSetResponse struct { // race conditions that is get an etag from a GET rule set request, and pass // it with the PUT update request to identify the rule set version you are // updating. - // Wire name: 'etag' Etag string `json:"etag"` - // Wire name: 'grant_rules' GrantRules []GrantRule `json:"grant_rules,omitempty"` // Name of the rule set. - // Wire name: 'name' Name string `json:"name"` } -func (st *RuleSetResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &ruleSetResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := ruleSetResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st RuleSetResponse) MarshalJSON() ([]byte, error) { - pb, err := ruleSetResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type RuleSetUpdateRequest struct { // Identifies the version of the rule set returned. Etag used for // versioning. The response is at least as fresh as the eTag provided. Etag @@ -2911,99 +1443,45 @@ type RuleSetUpdateRequest struct { // race conditions that is get an etag from a GET rule set request, and pass // it with the PUT update request to identify the rule set version you are // updating. - // Wire name: 'etag' Etag string `json:"etag"` - // Wire name: 'grant_rules' GrantRules []GrantRule `json:"grant_rules,omitempty"` // Name of the rule set. - // Wire name: 'name' Name string `json:"name"` } -func (st *RuleSetUpdateRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &ruleSetUpdateRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := ruleSetUpdateRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st RuleSetUpdateRequest) MarshalJSON() ([]byte, error) { - pb, err := ruleSetUpdateRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type ServicePrincipal struct { // If this user is active - // Wire name: 'active' Active bool `json:"active,omitempty"` // UUID relating to the service principal - // Wire name: 'applicationId' ApplicationId string `json:"applicationId,omitempty"` // String that represents a concatenation of given and family names. - // Wire name: 'displayName' DisplayName string `json:"displayName,omitempty"` // Entitlements assigned to the service principal. See [assigning // entitlements] for a full list of supported values. // // [assigning entitlements]: https://docs.databricks.com/administration-guide/users-groups/index.html#assigning-entitlements - // Wire name: 'entitlements' Entitlements []ComplexValue `json:"entitlements,omitempty"` - // Wire name: 'externalId' ExternalId string `json:"externalId,omitempty"` - // Wire name: 'groups' Groups []ComplexValue `json:"groups,omitempty"` // Databricks service principal ID. - // Wire name: 'id' - Id string `json:"id,omitempty"` + Id string `json:"id,omitempty" url:"-"` // Corresponds to AWS instance profile/arn role. - // Wire name: 'roles' Roles []ComplexValue `json:"roles,omitempty"` // The schema of the List response. - // Wire name: 'schemas' Schemas []ServicePrincipalSchema `json:"schemas,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ServicePrincipal) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &servicePrincipalPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := servicePrincipalFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ServicePrincipal) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ServicePrincipal) MarshalJSON() ([]byte, error) { - pb, err := servicePrincipalToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ServicePrincipal) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ServicePrincipalSchema string @@ -3041,145 +1519,39 @@ func (f *ServicePrincipalSchema) Type() string { } type SetObjectPermissions struct { - - // Wire name: 'access_control_list' AccessControlList []AccessControlRequest `json:"access_control_list,omitempty"` // The id of the request object. - RequestObjectId string `json:"-" tf:"-"` + RequestObjectId string `json:"-" url:"-"` // The type of the request object. Can be one of the following: alerts, // authorization, clusters, cluster-policies, dashboards, dbsql-dashboards, // directories, experiments, files, instance-pools, jobs, notebooks, // pipelines, queries, registered-models, repos, serving-endpoints, or // warehouses. - RequestObjectType string `json:"-" tf:"-"` -} - -func (st *SetObjectPermissions) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &setObjectPermissionsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := setObjectPermissionsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st SetObjectPermissions) MarshalJSON() ([]byte, error) { - pb, err := setObjectPermissionsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + RequestObjectType string `json:"-" url:"-"` } type UpdateObjectPermissions struct { - - // Wire name: 'access_control_list' AccessControlList []AccessControlRequest `json:"access_control_list,omitempty"` // The id of the request object. - RequestObjectId string `json:"-" tf:"-"` + RequestObjectId string `json:"-" url:"-"` // The type of the request object. Can be one of the following: alerts, // authorization, clusters, cluster-policies, dashboards, dbsql-dashboards, // directories, experiments, files, instance-pools, jobs, notebooks, // pipelines, queries, registered-models, repos, serving-endpoints, or // warehouses. - RequestObjectType string `json:"-" tf:"-"` -} - -func (st *UpdateObjectPermissions) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateObjectPermissionsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateObjectPermissionsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateObjectPermissions) MarshalJSON() ([]byte, error) { - pb, err := updateObjectPermissionsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + RequestObjectType string `json:"-" url:"-"` } type UpdateResponse struct { } -func (st *UpdateResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateResponse) MarshalJSON() ([]byte, error) { - pb, err := updateResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type UpdateRuleSetRequest struct { // Name of the rule set. - // Wire name: 'name' Name string `json:"name"` - // Wire name: 'rule_set' RuleSet RuleSetUpdateRequest `json:"rule_set"` } -func (st *UpdateRuleSetRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateRuleSetRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateRuleSetRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateRuleSetRequest) MarshalJSON() ([]byte, error) { - pb, err := updateRuleSetRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type UpdateWorkspaceAssignments struct { // Array of permissions assignments to update on the workspace. Valid values // are "USER" and "ADMIN" (case-sensitive). If both "USER" and "ADMIN" are @@ -3187,42 +1559,15 @@ type UpdateWorkspaceAssignments struct { // that excluding this field, or providing unsupported values, will have the // same effect as providing an empty list, which will result in the deletion // of all permissions for the principal. - // Wire name: 'permissions' Permissions []WorkspacePermission `json:"permissions,omitempty"` // The ID of the user, service principal, or group. - PrincipalId int64 `json:"-" tf:"-"` + PrincipalId int64 `json:"-" url:"-"` // The workspace ID. - WorkspaceId int64 `json:"-" tf:"-"` -} - -func (st *UpdateWorkspaceAssignments) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateWorkspaceAssignmentsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateWorkspaceAssignmentsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateWorkspaceAssignments) MarshalJSON() ([]byte, error) { - pb, err := updateWorkspaceAssignmentsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + WorkspaceId int64 `json:"-" url:"-"` } type User struct { // If this user is active - // Wire name: 'active' Active bool `json:"active,omitempty"` // String that represents a concatenation of given and family names. For // example `John Smith`. This field cannot be updated through the Workspace @@ -3230,65 +1575,38 @@ type User struct { // update `displayName`. // // [identity federation is enabled]: https://docs.databricks.com/administration-guide/users-groups/best-practices.html#enable-identity-federation - // Wire name: 'displayName' DisplayName string `json:"displayName,omitempty"` // All the emails associated with the Databricks user. - // Wire name: 'emails' Emails []ComplexValue `json:"emails,omitempty"` // Entitlements assigned to the user. See [assigning entitlements] for a // full list of supported values. // // [assigning entitlements]: https://docs.databricks.com/administration-guide/users-groups/index.html#assigning-entitlements - // Wire name: 'entitlements' Entitlements []ComplexValue `json:"entitlements,omitempty"` // External ID is not currently supported. It is reserved for future use. - // Wire name: 'externalId' ExternalId string `json:"externalId,omitempty"` - // Wire name: 'groups' Groups []ComplexValue `json:"groups,omitempty"` // Databricks user ID. - // Wire name: 'id' - Id string `json:"id,omitempty"` + Id string `json:"id,omitempty" url:"-"` - // Wire name: 'name' Name *Name `json:"name,omitempty"` // Corresponds to AWS instance profile/arn role. - // Wire name: 'roles' Roles []ComplexValue `json:"roles,omitempty"` // The schema of the user. - // Wire name: 'schemas' Schemas []UserSchema `json:"schemas,omitempty"` // Email address of the Databricks user. - // Wire name: 'userName' UserName string `json:"userName,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *User) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &userPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := userFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *User) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st User) MarshalJSON() ([]byte, error) { - pb, err := userToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s User) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type UserSchema string @@ -3370,31 +1688,5 @@ func (f *WorkspacePermission) Type() string { type WorkspacePermissions struct { // Array of permissions defined for a workspace. - // Wire name: 'permissions' Permissions []PermissionOutput `json:"permissions,omitempty"` } - -func (st *WorkspacePermissions) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &workspacePermissionsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := workspacePermissionsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st WorkspacePermissions) MarshalJSON() ([]byte, error) { - pb, err := workspacePermissionsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} diff --git a/service/jobs/impl.go b/service/jobs/impl.go index ee6d09758..c3f28e947 100755 --- a/service/jobs/impl.go +++ b/service/jobs/impl.go @@ -18,340 +18,114 @@ type jobsImpl struct { } func (a *jobsImpl) CancelAllRuns(ctx context.Context, request CancelAllRuns) error { - - requestPb, pbErr := cancelAllRunsToPb(&request) - if pbErr != nil { - return pbErr - } - - var cancelAllRunsResponsePb cancelAllRunsResponsePb + var cancelAllRunsResponse CancelAllRunsResponse path := "/api/2.2/jobs/runs/cancel-all" queryParams := make(map[string]any) headers := make(map[string]string) headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &cancelAllRunsResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &cancelAllRunsResponse) return err } func (a *jobsImpl) CancelRun(ctx context.Context, request CancelRun) error { - - requestPb, pbErr := cancelRunToPb(&request) - if pbErr != nil { - return pbErr - } - - var cancelRunResponsePb cancelRunResponsePb + var cancelRunResponse CancelRunResponse path := "/api/2.2/jobs/runs/cancel" queryParams := make(map[string]any) headers := make(map[string]string) headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &cancelRunResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &cancelRunResponse) return err } func (a *jobsImpl) Create(ctx context.Context, request CreateJob) (*CreateResponse, error) { - - requestPb, pbErr := createJobToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var createResponsePb createResponsePb + var createResponse CreateResponse path := "/api/2.2/jobs/create" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &createResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := createResponseFromPb(&createResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &createResponse) + return &createResponse, err } func (a *jobsImpl) Delete(ctx context.Context, request DeleteJob) error { - - requestPb, pbErr := deleteJobToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteResponsePb deleteResponsePb + var deleteResponse DeleteResponse path := "/api/2.2/jobs/delete" queryParams := make(map[string]any) headers := make(map[string]string) headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &deleteResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &deleteResponse) return err } func (a *jobsImpl) DeleteRun(ctx context.Context, request DeleteRun) error { - - requestPb, pbErr := deleteRunToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteRunResponsePb deleteRunResponsePb + var deleteRunResponse DeleteRunResponse path := "/api/2.2/jobs/runs/delete" queryParams := make(map[string]any) headers := make(map[string]string) headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &deleteRunResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &deleteRunResponse) return err } func (a *jobsImpl) ExportRun(ctx context.Context, request ExportRunRequest) (*ExportRunOutput, error) { - - requestPb, pbErr := exportRunRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var exportRunOutputPb exportRunOutputPb + var exportRunOutput ExportRunOutput path := "/api/2.2/jobs/runs/export" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &exportRunOutputPb, - ) - if err != nil { - return nil, err - } - resp, err := exportRunOutputFromPb(&exportRunOutputPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &exportRunOutput) + return &exportRunOutput, err } func (a *jobsImpl) Get(ctx context.Context, request GetJobRequest) (*Job, error) { - - requestPb, pbErr := getJobRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var jobPb jobPb + var job Job path := "/api/2.2/jobs/get" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &jobPb, - ) - if err != nil { - return nil, err - } - resp, err := jobFromPb(&jobPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &job) + return &job, err } func (a *jobsImpl) GetPermissionLevels(ctx context.Context, request GetJobPermissionLevelsRequest) (*GetJobPermissionLevelsResponse, error) { - - requestPb, pbErr := getJobPermissionLevelsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var getJobPermissionLevelsResponsePb getJobPermissionLevelsResponsePb - path := fmt.Sprintf("/api/2.0/permissions/jobs/%v/permissionLevels", requestPb.JobId) + var getJobPermissionLevelsResponse GetJobPermissionLevelsResponse + path := fmt.Sprintf("/api/2.0/permissions/jobs/%v/permissionLevels", request.JobId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &getJobPermissionLevelsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := getJobPermissionLevelsResponseFromPb(&getJobPermissionLevelsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getJobPermissionLevelsResponse) + return &getJobPermissionLevelsResponse, err } func (a *jobsImpl) GetPermissions(ctx context.Context, request GetJobPermissionsRequest) (*JobPermissions, error) { - - requestPb, pbErr := getJobPermissionsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var jobPermissionsPb jobPermissionsPb - path := fmt.Sprintf("/api/2.0/permissions/jobs/%v", requestPb.JobId) + var jobPermissions JobPermissions + path := fmt.Sprintf("/api/2.0/permissions/jobs/%v", request.JobId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &jobPermissionsPb, - ) - if err != nil { - return nil, err - } - resp, err := jobPermissionsFromPb(&jobPermissionsPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &jobPermissions) + return &jobPermissions, err } func (a *jobsImpl) GetRun(ctx context.Context, request GetRunRequest) (*Run, error) { - - requestPb, pbErr := getRunRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var runPb runPb + var run Run path := "/api/2.2/jobs/runs/get" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &runPb, - ) - if err != nil { - return nil, err - } - resp, err := runFromPb(&runPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &run) + return &run, err } func (a *jobsImpl) GetRunOutput(ctx context.Context, request GetRunOutputRequest) (*RunOutput, error) { - - requestPb, pbErr := getRunOutputRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var runOutputPb runOutputPb + var runOutput RunOutput path := "/api/2.2/jobs/runs/get-output" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &runOutputPb, - ) - if err != nil { - return nil, err - } - resp, err := runOutputFromPb(&runOutputPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &runOutput) + return &runOutput, err } // Retrieves a list of jobs. @@ -386,35 +160,13 @@ func (a *jobsImpl) ListAll(ctx context.Context, request ListJobsRequest) ([]Base } func (a *jobsImpl) internalList(ctx context.Context, request ListJobsRequest) (*ListJobsResponse, error) { - - requestPb, pbErr := listJobsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listJobsResponsePb listJobsResponsePb + var listJobsResponse ListJobsResponse path := "/api/2.2/jobs/list" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listJobsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listJobsResponseFromPb(&listJobsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listJobsResponse) + return &listJobsResponse, err } // List runs in descending order by start time. @@ -449,256 +201,88 @@ func (a *jobsImpl) ListRunsAll(ctx context.Context, request ListRunsRequest) ([] } func (a *jobsImpl) internalListRuns(ctx context.Context, request ListRunsRequest) (*ListRunsResponse, error) { - - requestPb, pbErr := listRunsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listRunsResponsePb listRunsResponsePb + var listRunsResponse ListRunsResponse path := "/api/2.2/jobs/runs/list" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listRunsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listRunsResponseFromPb(&listRunsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listRunsResponse) + return &listRunsResponse, err } func (a *jobsImpl) RepairRun(ctx context.Context, request RepairRun) (*RepairRunResponse, error) { - - requestPb, pbErr := repairRunToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var repairRunResponsePb repairRunResponsePb + var repairRunResponse RepairRunResponse path := "/api/2.2/jobs/runs/repair" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &repairRunResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := repairRunResponseFromPb(&repairRunResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &repairRunResponse) + return &repairRunResponse, err } func (a *jobsImpl) Reset(ctx context.Context, request ResetJob) error { - - requestPb, pbErr := resetJobToPb(&request) - if pbErr != nil { - return pbErr - } - - var resetResponsePb resetResponsePb + var resetResponse ResetResponse path := "/api/2.2/jobs/reset" queryParams := make(map[string]any) headers := make(map[string]string) headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &resetResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &resetResponse) return err } func (a *jobsImpl) RunNow(ctx context.Context, request RunNow) (*RunNowResponse, error) { - - requestPb, pbErr := runNowToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var runNowResponsePb runNowResponsePb + var runNowResponse RunNowResponse path := "/api/2.2/jobs/run-now" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &runNowResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := runNowResponseFromPb(&runNowResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &runNowResponse) + return &runNowResponse, err } func (a *jobsImpl) SetPermissions(ctx context.Context, request JobPermissionsRequest) (*JobPermissions, error) { - - requestPb, pbErr := jobPermissionsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var jobPermissionsPb jobPermissionsPb - path := fmt.Sprintf("/api/2.0/permissions/jobs/%v", requestPb.JobId) + var jobPermissions JobPermissions + path := fmt.Sprintf("/api/2.0/permissions/jobs/%v", request.JobId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPut, - path, - headers, - queryParams, - (*requestPb), - &jobPermissionsPb, - ) - if err != nil { - return nil, err - } - resp, err := jobPermissionsFromPb(&jobPermissionsPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &jobPermissions) + return &jobPermissions, err } func (a *jobsImpl) Submit(ctx context.Context, request SubmitRun) (*SubmitRunResponse, error) { - - requestPb, pbErr := submitRunToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var submitRunResponsePb submitRunResponsePb + var submitRunResponse SubmitRunResponse path := "/api/2.2/jobs/runs/submit" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &submitRunResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := submitRunResponseFromPb(&submitRunResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &submitRunResponse) + return &submitRunResponse, err } func (a *jobsImpl) Update(ctx context.Context, request UpdateJob) error { - - requestPb, pbErr := updateJobToPb(&request) - if pbErr != nil { - return pbErr - } - - var updateResponsePb updateResponsePb + var updateResponse UpdateResponse path := "/api/2.2/jobs/update" queryParams := make(map[string]any) headers := make(map[string]string) headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &updateResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &updateResponse) return err } func (a *jobsImpl) UpdatePermissions(ctx context.Context, request JobPermissionsRequest) (*JobPermissions, error) { - - requestPb, pbErr := jobPermissionsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var jobPermissionsPb jobPermissionsPb - path := fmt.Sprintf("/api/2.0/permissions/jobs/%v", requestPb.JobId) + var jobPermissions JobPermissions + path := fmt.Sprintf("/api/2.0/permissions/jobs/%v", request.JobId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &jobPermissionsPb, - ) - if err != nil { - return nil, err - } - resp, err := jobPermissionsFromPb(&jobPermissionsPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &jobPermissions) + return &jobPermissions, err } // unexported type that holds implementations of just PolicyComplianceForJobs API methods @@ -707,68 +291,24 @@ type policyComplianceForJobsImpl struct { } func (a *policyComplianceForJobsImpl) EnforceCompliance(ctx context.Context, request EnforcePolicyComplianceRequest) (*EnforcePolicyComplianceResponse, error) { - - requestPb, pbErr := enforcePolicyComplianceRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var enforcePolicyComplianceResponsePb enforcePolicyComplianceResponsePb + var enforcePolicyComplianceResponse EnforcePolicyComplianceResponse path := "/api/2.0/policies/jobs/enforce-compliance" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &enforcePolicyComplianceResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := enforcePolicyComplianceResponseFromPb(&enforcePolicyComplianceResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &enforcePolicyComplianceResponse) + return &enforcePolicyComplianceResponse, err } func (a *policyComplianceForJobsImpl) GetCompliance(ctx context.Context, request GetPolicyComplianceRequest) (*GetPolicyComplianceResponse, error) { - - requestPb, pbErr := getPolicyComplianceRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var getPolicyComplianceResponsePb getPolicyComplianceResponsePb + var getPolicyComplianceResponse GetPolicyComplianceResponse path := "/api/2.0/policies/jobs/get-compliance" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &getPolicyComplianceResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := getPolicyComplianceResponseFromPb(&getPolicyComplianceResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getPolicyComplianceResponse) + return &getPolicyComplianceResponse, err } // Returns the policy compliance status of all jobs that use a given policy. @@ -809,33 +349,11 @@ func (a *policyComplianceForJobsImpl) ListComplianceAll(ctx context.Context, req } func (a *policyComplianceForJobsImpl) internalListCompliance(ctx context.Context, request ListJobComplianceRequest) (*ListJobComplianceForPolicyResponse, error) { - - requestPb, pbErr := listJobComplianceRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listJobComplianceForPolicyResponsePb listJobComplianceForPolicyResponsePb + var listJobComplianceForPolicyResponse ListJobComplianceForPolicyResponse path := "/api/2.0/policies/jobs/list-compliance" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listJobComplianceForPolicyResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listJobComplianceForPolicyResponseFromPb(&listJobComplianceForPolicyResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listJobComplianceForPolicyResponse) + return &listJobComplianceForPolicyResponse, err } diff --git a/service/jobs/internal.go b/service/jobs/internal.go deleted file mode 100755 index b4bec3aab..000000000 --- a/service/jobs/internal.go +++ /dev/null @@ -1,6564 +0,0 @@ -// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. - -package jobs - -import ( - "fmt" - "strings" - "time" - - "github.com/databricks/databricks-sdk-go/marshal" - "github.com/databricks/databricks-sdk-go/service/compute" -) - -func baseJobToPb(st *BaseJob) (*baseJobPb, error) { - if st == nil { - return nil, nil - } - pb := &baseJobPb{} - pb.CreatedTime = st.CreatedTime - pb.CreatorUserName = st.CreatorUserName - pb.EffectiveBudgetPolicyId = st.EffectiveBudgetPolicyId - pb.HasMore = st.HasMore - pb.JobId = st.JobId - pb.Settings = st.Settings - pb.TriggerState = st.TriggerState - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type baseJobPb struct { - CreatedTime int64 `json:"created_time,omitempty"` - CreatorUserName string `json:"creator_user_name,omitempty"` - EffectiveBudgetPolicyId string `json:"effective_budget_policy_id,omitempty"` - HasMore bool `json:"has_more,omitempty"` - JobId int64 `json:"job_id,omitempty"` - Settings *JobSettings `json:"settings,omitempty"` - TriggerState *TriggerStateProto `json:"trigger_state,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func baseJobFromPb(pb *baseJobPb) (*BaseJob, error) { - if pb == nil { - return nil, nil - } - st := &BaseJob{} - st.CreatedTime = pb.CreatedTime - st.CreatorUserName = pb.CreatorUserName - st.EffectiveBudgetPolicyId = pb.EffectiveBudgetPolicyId - st.HasMore = pb.HasMore - st.JobId = pb.JobId - st.Settings = pb.Settings - st.TriggerState = pb.TriggerState - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *baseJobPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st baseJobPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func baseRunToPb(st *BaseRun) (*baseRunPb, error) { - if st == nil { - return nil, nil - } - pb := &baseRunPb{} - pb.AttemptNumber = st.AttemptNumber - pb.CleanupDuration = st.CleanupDuration - pb.ClusterInstance = st.ClusterInstance - pb.ClusterSpec = st.ClusterSpec - pb.CreatorUserName = st.CreatorUserName - pb.Description = st.Description - pb.EffectivePerformanceTarget = st.EffectivePerformanceTarget - pb.EndTime = st.EndTime - pb.ExecutionDuration = st.ExecutionDuration - pb.GitSource = st.GitSource - pb.HasMore = st.HasMore - pb.JobClusters = st.JobClusters - pb.JobId = st.JobId - pb.JobParameters = st.JobParameters - pb.JobRunId = st.JobRunId - pb.NumberInJob = st.NumberInJob - pb.OriginalAttemptRunId = st.OriginalAttemptRunId - pb.OverridingParameters = st.OverridingParameters - pb.QueueDuration = st.QueueDuration - pb.RepairHistory = st.RepairHistory - pb.RunDuration = st.RunDuration - pb.RunId = st.RunId - pb.RunName = st.RunName - pb.RunPageUrl = st.RunPageUrl - pb.RunType = st.RunType - pb.Schedule = st.Schedule - pb.SetupDuration = st.SetupDuration - pb.StartTime = st.StartTime - pb.State = st.State - pb.Status = st.Status - pb.Tasks = st.Tasks - pb.Trigger = st.Trigger - pb.TriggerInfo = st.TriggerInfo - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type baseRunPb struct { - AttemptNumber int `json:"attempt_number,omitempty"` - CleanupDuration int64 `json:"cleanup_duration,omitempty"` - ClusterInstance *ClusterInstance `json:"cluster_instance,omitempty"` - ClusterSpec *ClusterSpec `json:"cluster_spec,omitempty"` - CreatorUserName string `json:"creator_user_name,omitempty"` - Description string `json:"description,omitempty"` - EffectivePerformanceTarget PerformanceTarget `json:"effective_performance_target,omitempty"` - EndTime int64 `json:"end_time,omitempty"` - ExecutionDuration int64 `json:"execution_duration,omitempty"` - GitSource *GitSource `json:"git_source,omitempty"` - HasMore bool `json:"has_more,omitempty"` - JobClusters []JobCluster `json:"job_clusters,omitempty"` - JobId int64 `json:"job_id,omitempty"` - JobParameters []JobParameter `json:"job_parameters,omitempty"` - JobRunId int64 `json:"job_run_id,omitempty"` - NumberInJob int64 `json:"number_in_job,omitempty"` - OriginalAttemptRunId int64 `json:"original_attempt_run_id,omitempty"` - OverridingParameters *RunParameters `json:"overriding_parameters,omitempty"` - QueueDuration int64 `json:"queue_duration,omitempty"` - RepairHistory []RepairHistoryItem `json:"repair_history,omitempty"` - RunDuration int64 `json:"run_duration,omitempty"` - RunId int64 `json:"run_id,omitempty"` - RunName string `json:"run_name,omitempty"` - RunPageUrl string `json:"run_page_url,omitempty"` - RunType RunType `json:"run_type,omitempty"` - Schedule *CronSchedule `json:"schedule,omitempty"` - SetupDuration int64 `json:"setup_duration,omitempty"` - StartTime int64 `json:"start_time,omitempty"` - State *RunState `json:"state,omitempty"` - Status *RunStatus `json:"status,omitempty"` - Tasks []RunTask `json:"tasks,omitempty"` - Trigger TriggerType `json:"trigger,omitempty"` - TriggerInfo *TriggerInfo `json:"trigger_info,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func baseRunFromPb(pb *baseRunPb) (*BaseRun, error) { - if pb == nil { - return nil, nil - } - st := &BaseRun{} - st.AttemptNumber = pb.AttemptNumber - st.CleanupDuration = pb.CleanupDuration - st.ClusterInstance = pb.ClusterInstance - st.ClusterSpec = pb.ClusterSpec - st.CreatorUserName = pb.CreatorUserName - st.Description = pb.Description - st.EffectivePerformanceTarget = pb.EffectivePerformanceTarget - st.EndTime = pb.EndTime - st.ExecutionDuration = pb.ExecutionDuration - st.GitSource = pb.GitSource - st.HasMore = pb.HasMore - st.JobClusters = pb.JobClusters - st.JobId = pb.JobId - st.JobParameters = pb.JobParameters - st.JobRunId = pb.JobRunId - st.NumberInJob = pb.NumberInJob - st.OriginalAttemptRunId = pb.OriginalAttemptRunId - st.OverridingParameters = pb.OverridingParameters - st.QueueDuration = pb.QueueDuration - st.RepairHistory = pb.RepairHistory - st.RunDuration = pb.RunDuration - st.RunId = pb.RunId - st.RunName = pb.RunName - st.RunPageUrl = pb.RunPageUrl - st.RunType = pb.RunType - st.Schedule = pb.Schedule - st.SetupDuration = pb.SetupDuration - st.StartTime = pb.StartTime - st.State = pb.State - st.Status = pb.Status - st.Tasks = pb.Tasks - st.Trigger = pb.Trigger - st.TriggerInfo = pb.TriggerInfo - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *baseRunPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st baseRunPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func cancelAllRunsToPb(st *CancelAllRuns) (*cancelAllRunsPb, error) { - if st == nil { - return nil, nil - } - pb := &cancelAllRunsPb{} - pb.AllQueuedRuns = st.AllQueuedRuns - pb.JobId = st.JobId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type cancelAllRunsPb struct { - AllQueuedRuns bool `json:"all_queued_runs,omitempty"` - JobId int64 `json:"job_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func cancelAllRunsFromPb(pb *cancelAllRunsPb) (*CancelAllRuns, error) { - if pb == nil { - return nil, nil - } - st := &CancelAllRuns{} - st.AllQueuedRuns = pb.AllQueuedRuns - st.JobId = pb.JobId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *cancelAllRunsPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st cancelAllRunsPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func cancelAllRunsResponseToPb(st *CancelAllRunsResponse) (*cancelAllRunsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &cancelAllRunsResponsePb{} - - return pb, nil -} - -type cancelAllRunsResponsePb struct { -} - -func cancelAllRunsResponseFromPb(pb *cancelAllRunsResponsePb) (*CancelAllRunsResponse, error) { - if pb == nil { - return nil, nil - } - st := &CancelAllRunsResponse{} - - return st, nil -} - -func cancelRunToPb(st *CancelRun) (*cancelRunPb, error) { - if st == nil { - return nil, nil - } - pb := &cancelRunPb{} - pb.RunId = st.RunId - - return pb, nil -} - -type cancelRunPb struct { - RunId int64 `json:"run_id"` -} - -func cancelRunFromPb(pb *cancelRunPb) (*CancelRun, error) { - if pb == nil { - return nil, nil - } - st := &CancelRun{} - st.RunId = pb.RunId - - return st, nil -} - -func cancelRunResponseToPb(st *CancelRunResponse) (*cancelRunResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &cancelRunResponsePb{} - - return pb, nil -} - -type cancelRunResponsePb struct { -} - -func cancelRunResponseFromPb(pb *cancelRunResponsePb) (*CancelRunResponse, error) { - if pb == nil { - return nil, nil - } - st := &CancelRunResponse{} - - return st, nil -} - -func cleanRoomTaskRunStateToPb(st *CleanRoomTaskRunState) (*cleanRoomTaskRunStatePb, error) { - if st == nil { - return nil, nil - } - pb := &cleanRoomTaskRunStatePb{} - pb.LifeCycleState = st.LifeCycleState - pb.ResultState = st.ResultState - - return pb, nil -} - -type cleanRoomTaskRunStatePb struct { - LifeCycleState CleanRoomTaskRunLifeCycleState `json:"life_cycle_state,omitempty"` - ResultState CleanRoomTaskRunResultState `json:"result_state,omitempty"` -} - -func cleanRoomTaskRunStateFromPb(pb *cleanRoomTaskRunStatePb) (*CleanRoomTaskRunState, error) { - if pb == nil { - return nil, nil - } - st := &CleanRoomTaskRunState{} - st.LifeCycleState = pb.LifeCycleState - st.ResultState = pb.ResultState - - return st, nil -} - -func cleanRoomsNotebookTaskToPb(st *CleanRoomsNotebookTask) (*cleanRoomsNotebookTaskPb, error) { - if st == nil { - return nil, nil - } - pb := &cleanRoomsNotebookTaskPb{} - pb.CleanRoomName = st.CleanRoomName - pb.Etag = st.Etag - pb.NotebookBaseParameters = st.NotebookBaseParameters - pb.NotebookName = st.NotebookName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type cleanRoomsNotebookTaskPb struct { - CleanRoomName string `json:"clean_room_name"` - Etag string `json:"etag,omitempty"` - NotebookBaseParameters map[string]string `json:"notebook_base_parameters,omitempty"` - NotebookName string `json:"notebook_name"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func cleanRoomsNotebookTaskFromPb(pb *cleanRoomsNotebookTaskPb) (*CleanRoomsNotebookTask, error) { - if pb == nil { - return nil, nil - } - st := &CleanRoomsNotebookTask{} - st.CleanRoomName = pb.CleanRoomName - st.Etag = pb.Etag - st.NotebookBaseParameters = pb.NotebookBaseParameters - st.NotebookName = pb.NotebookName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *cleanRoomsNotebookTaskPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st cleanRoomsNotebookTaskPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func cleanRoomsNotebookTaskCleanRoomsNotebookTaskOutputToPb(st *CleanRoomsNotebookTaskCleanRoomsNotebookTaskOutput) (*cleanRoomsNotebookTaskCleanRoomsNotebookTaskOutputPb, error) { - if st == nil { - return nil, nil - } - pb := &cleanRoomsNotebookTaskCleanRoomsNotebookTaskOutputPb{} - pb.CleanRoomJobRunState = st.CleanRoomJobRunState - pb.NotebookOutput = st.NotebookOutput - pb.OutputSchemaInfo = st.OutputSchemaInfo - - return pb, nil -} - -type cleanRoomsNotebookTaskCleanRoomsNotebookTaskOutputPb struct { - CleanRoomJobRunState *CleanRoomTaskRunState `json:"clean_room_job_run_state,omitempty"` - NotebookOutput *NotebookOutput `json:"notebook_output,omitempty"` - OutputSchemaInfo *OutputSchemaInfo `json:"output_schema_info,omitempty"` -} - -func cleanRoomsNotebookTaskCleanRoomsNotebookTaskOutputFromPb(pb *cleanRoomsNotebookTaskCleanRoomsNotebookTaskOutputPb) (*CleanRoomsNotebookTaskCleanRoomsNotebookTaskOutput, error) { - if pb == nil { - return nil, nil - } - st := &CleanRoomsNotebookTaskCleanRoomsNotebookTaskOutput{} - st.CleanRoomJobRunState = pb.CleanRoomJobRunState - st.NotebookOutput = pb.NotebookOutput - st.OutputSchemaInfo = pb.OutputSchemaInfo - - return st, nil -} - -func clusterInstanceToPb(st *ClusterInstance) (*clusterInstancePb, error) { - if st == nil { - return nil, nil - } - pb := &clusterInstancePb{} - pb.ClusterId = st.ClusterId - pb.SparkContextId = st.SparkContextId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type clusterInstancePb struct { - ClusterId string `json:"cluster_id,omitempty"` - SparkContextId string `json:"spark_context_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func clusterInstanceFromPb(pb *clusterInstancePb) (*ClusterInstance, error) { - if pb == nil { - return nil, nil - } - st := &ClusterInstance{} - st.ClusterId = pb.ClusterId - st.SparkContextId = pb.SparkContextId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *clusterInstancePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st clusterInstancePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func clusterSpecToPb(st *ClusterSpec) (*clusterSpecPb, error) { - if st == nil { - return nil, nil - } - pb := &clusterSpecPb{} - pb.ExistingClusterId = st.ExistingClusterId - pb.JobClusterKey = st.JobClusterKey - pb.Libraries = st.Libraries - pb.NewCluster = st.NewCluster - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type clusterSpecPb struct { - ExistingClusterId string `json:"existing_cluster_id,omitempty"` - JobClusterKey string `json:"job_cluster_key,omitempty"` - Libraries []compute.Library `json:"libraries,omitempty"` - NewCluster *compute.ClusterSpec `json:"new_cluster,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func clusterSpecFromPb(pb *clusterSpecPb) (*ClusterSpec, error) { - if pb == nil { - return nil, nil - } - st := &ClusterSpec{} - st.ExistingClusterId = pb.ExistingClusterId - st.JobClusterKey = pb.JobClusterKey - st.Libraries = pb.Libraries - st.NewCluster = pb.NewCluster - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *clusterSpecPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st clusterSpecPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func computeConfigToPb(st *ComputeConfig) (*computeConfigPb, error) { - if st == nil { - return nil, nil - } - pb := &computeConfigPb{} - pb.GpuNodePoolId = st.GpuNodePoolId - pb.GpuType = st.GpuType - pb.NumGpus = st.NumGpus - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type computeConfigPb struct { - GpuNodePoolId string `json:"gpu_node_pool_id,omitempty"` - GpuType string `json:"gpu_type,omitempty"` - NumGpus int `json:"num_gpus"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func computeConfigFromPb(pb *computeConfigPb) (*ComputeConfig, error) { - if pb == nil { - return nil, nil - } - st := &ComputeConfig{} - st.GpuNodePoolId = pb.GpuNodePoolId - st.GpuType = pb.GpuType - st.NumGpus = pb.NumGpus - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *computeConfigPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st computeConfigPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func conditionTaskToPb(st *ConditionTask) (*conditionTaskPb, error) { - if st == nil { - return nil, nil - } - pb := &conditionTaskPb{} - pb.Left = st.Left - pb.Op = st.Op - pb.Right = st.Right - - return pb, nil -} - -type conditionTaskPb struct { - Left string `json:"left"` - Op ConditionTaskOp `json:"op"` - Right string `json:"right"` -} - -func conditionTaskFromPb(pb *conditionTaskPb) (*ConditionTask, error) { - if pb == nil { - return nil, nil - } - st := &ConditionTask{} - st.Left = pb.Left - st.Op = pb.Op - st.Right = pb.Right - - return st, nil -} - -func continuousToPb(st *Continuous) (*continuousPb, error) { - if st == nil { - return nil, nil - } - pb := &continuousPb{} - pb.PauseStatus = st.PauseStatus - - return pb, nil -} - -type continuousPb struct { - PauseStatus PauseStatus `json:"pause_status,omitempty"` -} - -func continuousFromPb(pb *continuousPb) (*Continuous, error) { - if pb == nil { - return nil, nil - } - st := &Continuous{} - st.PauseStatus = pb.PauseStatus - - return st, nil -} - -func createJobToPb(st *CreateJob) (*createJobPb, error) { - if st == nil { - return nil, nil - } - pb := &createJobPb{} - pb.AccessControlList = st.AccessControlList - pb.BudgetPolicyId = st.BudgetPolicyId - pb.Continuous = st.Continuous - pb.Deployment = st.Deployment - pb.Description = st.Description - pb.EditMode = st.EditMode - pb.EmailNotifications = st.EmailNotifications - pb.Environments = st.Environments - pb.Format = st.Format - pb.GitSource = st.GitSource - pb.Health = st.Health - pb.JobClusters = st.JobClusters - pb.MaxConcurrentRuns = st.MaxConcurrentRuns - pb.Name = st.Name - pb.NotificationSettings = st.NotificationSettings - pb.Parameters = st.Parameters - pb.PerformanceTarget = st.PerformanceTarget - pb.Queue = st.Queue - pb.RunAs = st.RunAs - pb.Schedule = st.Schedule - pb.Tags = st.Tags - pb.Tasks = st.Tasks - pb.TimeoutSeconds = st.TimeoutSeconds - pb.Trigger = st.Trigger - pb.WebhookNotifications = st.WebhookNotifications - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createJobPb struct { - AccessControlList []JobAccessControlRequest `json:"access_control_list,omitempty"` - BudgetPolicyId string `json:"budget_policy_id,omitempty"` - Continuous *Continuous `json:"continuous,omitempty"` - Deployment *JobDeployment `json:"deployment,omitempty"` - Description string `json:"description,omitempty"` - EditMode JobEditMode `json:"edit_mode,omitempty"` - EmailNotifications *JobEmailNotifications `json:"email_notifications,omitempty"` - Environments []JobEnvironment `json:"environments,omitempty"` - Format Format `json:"format,omitempty"` - GitSource *GitSource `json:"git_source,omitempty"` - Health *JobsHealthRules `json:"health,omitempty"` - JobClusters []JobCluster `json:"job_clusters,omitempty"` - MaxConcurrentRuns int `json:"max_concurrent_runs,omitempty"` - Name string `json:"name,omitempty"` - NotificationSettings *JobNotificationSettings `json:"notification_settings,omitempty"` - Parameters []JobParameterDefinition `json:"parameters,omitempty"` - PerformanceTarget PerformanceTarget `json:"performance_target,omitempty"` - Queue *QueueSettings `json:"queue,omitempty"` - RunAs *JobRunAs `json:"run_as,omitempty"` - Schedule *CronSchedule `json:"schedule,omitempty"` - Tags map[string]string `json:"tags,omitempty"` - Tasks []Task `json:"tasks,omitempty"` - TimeoutSeconds int `json:"timeout_seconds,omitempty"` - Trigger *TriggerSettings `json:"trigger,omitempty"` - WebhookNotifications *WebhookNotifications `json:"webhook_notifications,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createJobFromPb(pb *createJobPb) (*CreateJob, error) { - if pb == nil { - return nil, nil - } - st := &CreateJob{} - st.AccessControlList = pb.AccessControlList - st.BudgetPolicyId = pb.BudgetPolicyId - st.Continuous = pb.Continuous - st.Deployment = pb.Deployment - st.Description = pb.Description - st.EditMode = pb.EditMode - st.EmailNotifications = pb.EmailNotifications - st.Environments = pb.Environments - st.Format = pb.Format - st.GitSource = pb.GitSource - st.Health = pb.Health - st.JobClusters = pb.JobClusters - st.MaxConcurrentRuns = pb.MaxConcurrentRuns - st.Name = pb.Name - st.NotificationSettings = pb.NotificationSettings - st.Parameters = pb.Parameters - st.PerformanceTarget = pb.PerformanceTarget - st.Queue = pb.Queue - st.RunAs = pb.RunAs - st.Schedule = pb.Schedule - st.Tags = pb.Tags - st.Tasks = pb.Tasks - st.TimeoutSeconds = pb.TimeoutSeconds - st.Trigger = pb.Trigger - st.WebhookNotifications = pb.WebhookNotifications - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createJobPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createJobPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createResponseToPb(st *CreateResponse) (*createResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &createResponsePb{} - pb.JobId = st.JobId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createResponsePb struct { - JobId int64 `json:"job_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createResponseFromPb(pb *createResponsePb) (*CreateResponse, error) { - if pb == nil { - return nil, nil - } - st := &CreateResponse{} - st.JobId = pb.JobId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func cronScheduleToPb(st *CronSchedule) (*cronSchedulePb, error) { - if st == nil { - return nil, nil - } - pb := &cronSchedulePb{} - pb.PauseStatus = st.PauseStatus - pb.QuartzCronExpression = st.QuartzCronExpression - pb.TimezoneId = st.TimezoneId - - return pb, nil -} - -type cronSchedulePb struct { - PauseStatus PauseStatus `json:"pause_status,omitempty"` - QuartzCronExpression string `json:"quartz_cron_expression"` - TimezoneId string `json:"timezone_id"` -} - -func cronScheduleFromPb(pb *cronSchedulePb) (*CronSchedule, error) { - if pb == nil { - return nil, nil - } - st := &CronSchedule{} - st.PauseStatus = pb.PauseStatus - st.QuartzCronExpression = pb.QuartzCronExpression - st.TimezoneId = pb.TimezoneId - - return st, nil -} - -func dashboardPageSnapshotToPb(st *DashboardPageSnapshot) (*dashboardPageSnapshotPb, error) { - if st == nil { - return nil, nil - } - pb := &dashboardPageSnapshotPb{} - pb.PageDisplayName = st.PageDisplayName - pb.WidgetErrorDetails = st.WidgetErrorDetails - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type dashboardPageSnapshotPb struct { - PageDisplayName string `json:"page_display_name,omitempty"` - WidgetErrorDetails []WidgetErrorDetail `json:"widget_error_details,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func dashboardPageSnapshotFromPb(pb *dashboardPageSnapshotPb) (*DashboardPageSnapshot, error) { - if pb == nil { - return nil, nil - } - st := &DashboardPageSnapshot{} - st.PageDisplayName = pb.PageDisplayName - st.WidgetErrorDetails = pb.WidgetErrorDetails - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *dashboardPageSnapshotPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st dashboardPageSnapshotPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func dashboardTaskToPb(st *DashboardTask) (*dashboardTaskPb, error) { - if st == nil { - return nil, nil - } - pb := &dashboardTaskPb{} - pb.DashboardId = st.DashboardId - pb.Subscription = st.Subscription - pb.WarehouseId = st.WarehouseId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type dashboardTaskPb struct { - DashboardId string `json:"dashboard_id,omitempty"` - Subscription *Subscription `json:"subscription,omitempty"` - WarehouseId string `json:"warehouse_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func dashboardTaskFromPb(pb *dashboardTaskPb) (*DashboardTask, error) { - if pb == nil { - return nil, nil - } - st := &DashboardTask{} - st.DashboardId = pb.DashboardId - st.Subscription = pb.Subscription - st.WarehouseId = pb.WarehouseId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *dashboardTaskPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st dashboardTaskPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func dashboardTaskOutputToPb(st *DashboardTaskOutput) (*dashboardTaskOutputPb, error) { - if st == nil { - return nil, nil - } - pb := &dashboardTaskOutputPb{} - pb.PageSnapshots = st.PageSnapshots - - return pb, nil -} - -type dashboardTaskOutputPb struct { - PageSnapshots []DashboardPageSnapshot `json:"page_snapshots,omitempty"` -} - -func dashboardTaskOutputFromPb(pb *dashboardTaskOutputPb) (*DashboardTaskOutput, error) { - if pb == nil { - return nil, nil - } - st := &DashboardTaskOutput{} - st.PageSnapshots = pb.PageSnapshots - - return st, nil -} - -func dbtCloudJobRunStepToPb(st *DbtCloudJobRunStep) (*dbtCloudJobRunStepPb, error) { - if st == nil { - return nil, nil - } - pb := &dbtCloudJobRunStepPb{} - pb.Index = st.Index - pb.Logs = st.Logs - pb.Name = st.Name - pb.Status = st.Status - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type dbtCloudJobRunStepPb struct { - Index int `json:"index,omitempty"` - Logs string `json:"logs,omitempty"` - Name string `json:"name,omitempty"` - Status DbtPlatformRunStatus `json:"status,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func dbtCloudJobRunStepFromPb(pb *dbtCloudJobRunStepPb) (*DbtCloudJobRunStep, error) { - if pb == nil { - return nil, nil - } - st := &DbtCloudJobRunStep{} - st.Index = pb.Index - st.Logs = pb.Logs - st.Name = pb.Name - st.Status = pb.Status - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *dbtCloudJobRunStepPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st dbtCloudJobRunStepPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func dbtCloudTaskToPb(st *DbtCloudTask) (*dbtCloudTaskPb, error) { - if st == nil { - return nil, nil - } - pb := &dbtCloudTaskPb{} - pb.ConnectionResourceName = st.ConnectionResourceName - pb.DbtCloudJobId = st.DbtCloudJobId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type dbtCloudTaskPb struct { - ConnectionResourceName string `json:"connection_resource_name,omitempty"` - DbtCloudJobId int64 `json:"dbt_cloud_job_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func dbtCloudTaskFromPb(pb *dbtCloudTaskPb) (*DbtCloudTask, error) { - if pb == nil { - return nil, nil - } - st := &DbtCloudTask{} - st.ConnectionResourceName = pb.ConnectionResourceName - st.DbtCloudJobId = pb.DbtCloudJobId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *dbtCloudTaskPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st dbtCloudTaskPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func dbtCloudTaskOutputToPb(st *DbtCloudTaskOutput) (*dbtCloudTaskOutputPb, error) { - if st == nil { - return nil, nil - } - pb := &dbtCloudTaskOutputPb{} - pb.DbtCloudJobRunId = st.DbtCloudJobRunId - pb.DbtCloudJobRunOutput = st.DbtCloudJobRunOutput - pb.DbtCloudJobRunUrl = st.DbtCloudJobRunUrl - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type dbtCloudTaskOutputPb struct { - DbtCloudJobRunId int64 `json:"dbt_cloud_job_run_id,omitempty"` - DbtCloudJobRunOutput []DbtCloudJobRunStep `json:"dbt_cloud_job_run_output,omitempty"` - DbtCloudJobRunUrl string `json:"dbt_cloud_job_run_url,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func dbtCloudTaskOutputFromPb(pb *dbtCloudTaskOutputPb) (*DbtCloudTaskOutput, error) { - if pb == nil { - return nil, nil - } - st := &DbtCloudTaskOutput{} - st.DbtCloudJobRunId = pb.DbtCloudJobRunId - st.DbtCloudJobRunOutput = pb.DbtCloudJobRunOutput - st.DbtCloudJobRunUrl = pb.DbtCloudJobRunUrl - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *dbtCloudTaskOutputPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st dbtCloudTaskOutputPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func dbtOutputToPb(st *DbtOutput) (*dbtOutputPb, error) { - if st == nil { - return nil, nil - } - pb := &dbtOutputPb{} - pb.ArtifactsHeaders = st.ArtifactsHeaders - pb.ArtifactsLink = st.ArtifactsLink - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type dbtOutputPb struct { - ArtifactsHeaders map[string]string `json:"artifacts_headers,omitempty"` - ArtifactsLink string `json:"artifacts_link,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func dbtOutputFromPb(pb *dbtOutputPb) (*DbtOutput, error) { - if pb == nil { - return nil, nil - } - st := &DbtOutput{} - st.ArtifactsHeaders = pb.ArtifactsHeaders - st.ArtifactsLink = pb.ArtifactsLink - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *dbtOutputPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st dbtOutputPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func dbtPlatformJobRunStepToPb(st *DbtPlatformJobRunStep) (*dbtPlatformJobRunStepPb, error) { - if st == nil { - return nil, nil - } - pb := &dbtPlatformJobRunStepPb{} - pb.Index = st.Index - pb.Logs = st.Logs - pb.LogsTruncated = st.LogsTruncated - pb.Name = st.Name - pb.NameTruncated = st.NameTruncated - pb.Status = st.Status - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type dbtPlatformJobRunStepPb struct { - Index int `json:"index,omitempty"` - Logs string `json:"logs,omitempty"` - LogsTruncated bool `json:"logs_truncated,omitempty"` - Name string `json:"name,omitempty"` - NameTruncated bool `json:"name_truncated,omitempty"` - Status DbtPlatformRunStatus `json:"status,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func dbtPlatformJobRunStepFromPb(pb *dbtPlatformJobRunStepPb) (*DbtPlatformJobRunStep, error) { - if pb == nil { - return nil, nil - } - st := &DbtPlatformJobRunStep{} - st.Index = pb.Index - st.Logs = pb.Logs - st.LogsTruncated = pb.LogsTruncated - st.Name = pb.Name - st.NameTruncated = pb.NameTruncated - st.Status = pb.Status - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *dbtPlatformJobRunStepPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st dbtPlatformJobRunStepPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func dbtPlatformTaskToPb(st *DbtPlatformTask) (*dbtPlatformTaskPb, error) { - if st == nil { - return nil, nil - } - pb := &dbtPlatformTaskPb{} - pb.ConnectionResourceName = st.ConnectionResourceName - pb.DbtPlatformJobId = st.DbtPlatformJobId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type dbtPlatformTaskPb struct { - ConnectionResourceName string `json:"connection_resource_name,omitempty"` - DbtPlatformJobId string `json:"dbt_platform_job_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func dbtPlatformTaskFromPb(pb *dbtPlatformTaskPb) (*DbtPlatformTask, error) { - if pb == nil { - return nil, nil - } - st := &DbtPlatformTask{} - st.ConnectionResourceName = pb.ConnectionResourceName - st.DbtPlatformJobId = pb.DbtPlatformJobId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *dbtPlatformTaskPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st dbtPlatformTaskPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func dbtPlatformTaskOutputToPb(st *DbtPlatformTaskOutput) (*dbtPlatformTaskOutputPb, error) { - if st == nil { - return nil, nil - } - pb := &dbtPlatformTaskOutputPb{} - pb.DbtPlatformJobRunId = st.DbtPlatformJobRunId - pb.DbtPlatformJobRunOutput = st.DbtPlatformJobRunOutput - pb.DbtPlatformJobRunUrl = st.DbtPlatformJobRunUrl - pb.StepsTruncated = st.StepsTruncated - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type dbtPlatformTaskOutputPb struct { - DbtPlatformJobRunId string `json:"dbt_platform_job_run_id,omitempty"` - DbtPlatformJobRunOutput []DbtPlatformJobRunStep `json:"dbt_platform_job_run_output,omitempty"` - DbtPlatformJobRunUrl string `json:"dbt_platform_job_run_url,omitempty"` - StepsTruncated bool `json:"steps_truncated,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func dbtPlatformTaskOutputFromPb(pb *dbtPlatformTaskOutputPb) (*DbtPlatformTaskOutput, error) { - if pb == nil { - return nil, nil - } - st := &DbtPlatformTaskOutput{} - st.DbtPlatformJobRunId = pb.DbtPlatformJobRunId - st.DbtPlatformJobRunOutput = pb.DbtPlatformJobRunOutput - st.DbtPlatformJobRunUrl = pb.DbtPlatformJobRunUrl - st.StepsTruncated = pb.StepsTruncated - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *dbtPlatformTaskOutputPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st dbtPlatformTaskOutputPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func dbtTaskToPb(st *DbtTask) (*dbtTaskPb, error) { - if st == nil { - return nil, nil - } - pb := &dbtTaskPb{} - pb.Catalog = st.Catalog - pb.Commands = st.Commands - pb.ProfilesDirectory = st.ProfilesDirectory - pb.ProjectDirectory = st.ProjectDirectory - pb.Schema = st.Schema - pb.Source = st.Source - pb.WarehouseId = st.WarehouseId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type dbtTaskPb struct { - Catalog string `json:"catalog,omitempty"` - Commands []string `json:"commands"` - ProfilesDirectory string `json:"profiles_directory,omitempty"` - ProjectDirectory string `json:"project_directory,omitempty"` - Schema string `json:"schema,omitempty"` - Source Source `json:"source,omitempty"` - WarehouseId string `json:"warehouse_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func dbtTaskFromPb(pb *dbtTaskPb) (*DbtTask, error) { - if pb == nil { - return nil, nil - } - st := &DbtTask{} - st.Catalog = pb.Catalog - st.Commands = pb.Commands - st.ProfilesDirectory = pb.ProfilesDirectory - st.ProjectDirectory = pb.ProjectDirectory - st.Schema = pb.Schema - st.Source = pb.Source - st.WarehouseId = pb.WarehouseId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *dbtTaskPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st dbtTaskPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func deleteJobToPb(st *DeleteJob) (*deleteJobPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteJobPb{} - pb.JobId = st.JobId - - return pb, nil -} - -type deleteJobPb struct { - JobId int64 `json:"job_id"` -} - -func deleteJobFromPb(pb *deleteJobPb) (*DeleteJob, error) { - if pb == nil { - return nil, nil - } - st := &DeleteJob{} - st.JobId = pb.JobId - - return st, nil -} - -func deleteResponseToPb(st *DeleteResponse) (*deleteResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteResponsePb{} - - return pb, nil -} - -type deleteResponsePb struct { -} - -func deleteResponseFromPb(pb *deleteResponsePb) (*DeleteResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteResponse{} - - return st, nil -} - -func deleteRunToPb(st *DeleteRun) (*deleteRunPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteRunPb{} - pb.RunId = st.RunId - - return pb, nil -} - -type deleteRunPb struct { - RunId int64 `json:"run_id"` -} - -func deleteRunFromPb(pb *deleteRunPb) (*DeleteRun, error) { - if pb == nil { - return nil, nil - } - st := &DeleteRun{} - st.RunId = pb.RunId - - return st, nil -} - -func deleteRunResponseToPb(st *DeleteRunResponse) (*deleteRunResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteRunResponsePb{} - - return pb, nil -} - -type deleteRunResponsePb struct { -} - -func deleteRunResponseFromPb(pb *deleteRunResponsePb) (*DeleteRunResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteRunResponse{} - - return st, nil -} - -func enforcePolicyComplianceForJobResponseJobClusterSettingsChangeToPb(st *EnforcePolicyComplianceForJobResponseJobClusterSettingsChange) (*enforcePolicyComplianceForJobResponseJobClusterSettingsChangePb, error) { - if st == nil { - return nil, nil - } - pb := &enforcePolicyComplianceForJobResponseJobClusterSettingsChangePb{} - pb.Field = st.Field - pb.NewValue = st.NewValue - pb.PreviousValue = st.PreviousValue - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type enforcePolicyComplianceForJobResponseJobClusterSettingsChangePb struct { - Field string `json:"field,omitempty"` - NewValue string `json:"new_value,omitempty"` - PreviousValue string `json:"previous_value,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func enforcePolicyComplianceForJobResponseJobClusterSettingsChangeFromPb(pb *enforcePolicyComplianceForJobResponseJobClusterSettingsChangePb) (*EnforcePolicyComplianceForJobResponseJobClusterSettingsChange, error) { - if pb == nil { - return nil, nil - } - st := &EnforcePolicyComplianceForJobResponseJobClusterSettingsChange{} - st.Field = pb.Field - st.NewValue = pb.NewValue - st.PreviousValue = pb.PreviousValue - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *enforcePolicyComplianceForJobResponseJobClusterSettingsChangePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st enforcePolicyComplianceForJobResponseJobClusterSettingsChangePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func enforcePolicyComplianceRequestToPb(st *EnforcePolicyComplianceRequest) (*enforcePolicyComplianceRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &enforcePolicyComplianceRequestPb{} - pb.JobId = st.JobId - pb.ValidateOnly = st.ValidateOnly - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type enforcePolicyComplianceRequestPb struct { - JobId int64 `json:"job_id"` - ValidateOnly bool `json:"validate_only,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func enforcePolicyComplianceRequestFromPb(pb *enforcePolicyComplianceRequestPb) (*EnforcePolicyComplianceRequest, error) { - if pb == nil { - return nil, nil - } - st := &EnforcePolicyComplianceRequest{} - st.JobId = pb.JobId - st.ValidateOnly = pb.ValidateOnly - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *enforcePolicyComplianceRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st enforcePolicyComplianceRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func enforcePolicyComplianceResponseToPb(st *EnforcePolicyComplianceResponse) (*enforcePolicyComplianceResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &enforcePolicyComplianceResponsePb{} - pb.HasChanges = st.HasChanges - pb.JobClusterChanges = st.JobClusterChanges - pb.Settings = st.Settings - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type enforcePolicyComplianceResponsePb struct { - HasChanges bool `json:"has_changes,omitempty"` - JobClusterChanges []EnforcePolicyComplianceForJobResponseJobClusterSettingsChange `json:"job_cluster_changes,omitempty"` - Settings *JobSettings `json:"settings,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func enforcePolicyComplianceResponseFromPb(pb *enforcePolicyComplianceResponsePb) (*EnforcePolicyComplianceResponse, error) { - if pb == nil { - return nil, nil - } - st := &EnforcePolicyComplianceResponse{} - st.HasChanges = pb.HasChanges - st.JobClusterChanges = pb.JobClusterChanges - st.Settings = pb.Settings - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *enforcePolicyComplianceResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st enforcePolicyComplianceResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func exportRunOutputToPb(st *ExportRunOutput) (*exportRunOutputPb, error) { - if st == nil { - return nil, nil - } - pb := &exportRunOutputPb{} - pb.Views = st.Views - - return pb, nil -} - -type exportRunOutputPb struct { - Views []ViewItem `json:"views,omitempty"` -} - -func exportRunOutputFromPb(pb *exportRunOutputPb) (*ExportRunOutput, error) { - if pb == nil { - return nil, nil - } - st := &ExportRunOutput{} - st.Views = pb.Views - - return st, nil -} - -func exportRunRequestToPb(st *ExportRunRequest) (*exportRunRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &exportRunRequestPb{} - pb.RunId = st.RunId - pb.ViewsToExport = st.ViewsToExport - - return pb, nil -} - -type exportRunRequestPb struct { - RunId int64 `json:"-" url:"run_id"` - ViewsToExport ViewsToExport `json:"-" url:"views_to_export,omitempty"` -} - -func exportRunRequestFromPb(pb *exportRunRequestPb) (*ExportRunRequest, error) { - if pb == nil { - return nil, nil - } - st := &ExportRunRequest{} - st.RunId = pb.RunId - st.ViewsToExport = pb.ViewsToExport - - return st, nil -} - -func fileArrivalTriggerConfigurationToPb(st *FileArrivalTriggerConfiguration) (*fileArrivalTriggerConfigurationPb, error) { - if st == nil { - return nil, nil - } - pb := &fileArrivalTriggerConfigurationPb{} - pb.MinTimeBetweenTriggersSeconds = st.MinTimeBetweenTriggersSeconds - pb.Url = st.Url - pb.WaitAfterLastChangeSeconds = st.WaitAfterLastChangeSeconds - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type fileArrivalTriggerConfigurationPb struct { - MinTimeBetweenTriggersSeconds int `json:"min_time_between_triggers_seconds,omitempty"` - Url string `json:"url"` - WaitAfterLastChangeSeconds int `json:"wait_after_last_change_seconds,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func fileArrivalTriggerConfigurationFromPb(pb *fileArrivalTriggerConfigurationPb) (*FileArrivalTriggerConfiguration, error) { - if pb == nil { - return nil, nil - } - st := &FileArrivalTriggerConfiguration{} - st.MinTimeBetweenTriggersSeconds = pb.MinTimeBetweenTriggersSeconds - st.Url = pb.Url - st.WaitAfterLastChangeSeconds = pb.WaitAfterLastChangeSeconds - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *fileArrivalTriggerConfigurationPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st fileArrivalTriggerConfigurationPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func fileArrivalTriggerStateToPb(st *FileArrivalTriggerState) (*fileArrivalTriggerStatePb, error) { - if st == nil { - return nil, nil - } - pb := &fileArrivalTriggerStatePb{} - pb.UsingFileEvents = st.UsingFileEvents - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type fileArrivalTriggerStatePb struct { - UsingFileEvents bool `json:"using_file_events,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func fileArrivalTriggerStateFromPb(pb *fileArrivalTriggerStatePb) (*FileArrivalTriggerState, error) { - if pb == nil { - return nil, nil - } - st := &FileArrivalTriggerState{} - st.UsingFileEvents = pb.UsingFileEvents - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *fileArrivalTriggerStatePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st fileArrivalTriggerStatePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func forEachStatsToPb(st *ForEachStats) (*forEachStatsPb, error) { - if st == nil { - return nil, nil - } - pb := &forEachStatsPb{} - pb.ErrorMessageStats = st.ErrorMessageStats - pb.TaskRunStats = st.TaskRunStats - - return pb, nil -} - -type forEachStatsPb struct { - ErrorMessageStats []ForEachTaskErrorMessageStats `json:"error_message_stats,omitempty"` - TaskRunStats *ForEachTaskTaskRunStats `json:"task_run_stats,omitempty"` -} - -func forEachStatsFromPb(pb *forEachStatsPb) (*ForEachStats, error) { - if pb == nil { - return nil, nil - } - st := &ForEachStats{} - st.ErrorMessageStats = pb.ErrorMessageStats - st.TaskRunStats = pb.TaskRunStats - - return st, nil -} - -func forEachTaskToPb(st *ForEachTask) (*forEachTaskPb, error) { - if st == nil { - return nil, nil - } - pb := &forEachTaskPb{} - pb.Concurrency = st.Concurrency - pb.Inputs = st.Inputs - pb.Task = st.Task - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type forEachTaskPb struct { - Concurrency int `json:"concurrency,omitempty"` - Inputs string `json:"inputs"` - Task Task `json:"task"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func forEachTaskFromPb(pb *forEachTaskPb) (*ForEachTask, error) { - if pb == nil { - return nil, nil - } - st := &ForEachTask{} - st.Concurrency = pb.Concurrency - st.Inputs = pb.Inputs - st.Task = pb.Task - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *forEachTaskPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st forEachTaskPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func forEachTaskErrorMessageStatsToPb(st *ForEachTaskErrorMessageStats) (*forEachTaskErrorMessageStatsPb, error) { - if st == nil { - return nil, nil - } - pb := &forEachTaskErrorMessageStatsPb{} - pb.Count = st.Count - pb.ErrorMessage = st.ErrorMessage - pb.TerminationCategory = st.TerminationCategory - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type forEachTaskErrorMessageStatsPb struct { - Count int `json:"count,omitempty"` - ErrorMessage string `json:"error_message,omitempty"` - TerminationCategory string `json:"termination_category,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func forEachTaskErrorMessageStatsFromPb(pb *forEachTaskErrorMessageStatsPb) (*ForEachTaskErrorMessageStats, error) { - if pb == nil { - return nil, nil - } - st := &ForEachTaskErrorMessageStats{} - st.Count = pb.Count - st.ErrorMessage = pb.ErrorMessage - st.TerminationCategory = pb.TerminationCategory - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *forEachTaskErrorMessageStatsPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st forEachTaskErrorMessageStatsPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func forEachTaskTaskRunStatsToPb(st *ForEachTaskTaskRunStats) (*forEachTaskTaskRunStatsPb, error) { - if st == nil { - return nil, nil - } - pb := &forEachTaskTaskRunStatsPb{} - pb.ActiveIterations = st.ActiveIterations - pb.CompletedIterations = st.CompletedIterations - pb.FailedIterations = st.FailedIterations - pb.ScheduledIterations = st.ScheduledIterations - pb.SucceededIterations = st.SucceededIterations - pb.TotalIterations = st.TotalIterations - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type forEachTaskTaskRunStatsPb struct { - ActiveIterations int `json:"active_iterations,omitempty"` - CompletedIterations int `json:"completed_iterations,omitempty"` - FailedIterations int `json:"failed_iterations,omitempty"` - ScheduledIterations int `json:"scheduled_iterations,omitempty"` - SucceededIterations int `json:"succeeded_iterations,omitempty"` - TotalIterations int `json:"total_iterations,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func forEachTaskTaskRunStatsFromPb(pb *forEachTaskTaskRunStatsPb) (*ForEachTaskTaskRunStats, error) { - if pb == nil { - return nil, nil - } - st := &ForEachTaskTaskRunStats{} - st.ActiveIterations = pb.ActiveIterations - st.CompletedIterations = pb.CompletedIterations - st.FailedIterations = pb.FailedIterations - st.ScheduledIterations = pb.ScheduledIterations - st.SucceededIterations = pb.SucceededIterations - st.TotalIterations = pb.TotalIterations - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *forEachTaskTaskRunStatsPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st forEachTaskTaskRunStatsPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func genAiComputeTaskToPb(st *GenAiComputeTask) (*genAiComputeTaskPb, error) { - if st == nil { - return nil, nil - } - pb := &genAiComputeTaskPb{} - pb.Command = st.Command - pb.Compute = st.Compute - pb.DlRuntimeImage = st.DlRuntimeImage - pb.MlflowExperimentName = st.MlflowExperimentName - pb.Source = st.Source - pb.TrainingScriptPath = st.TrainingScriptPath - pb.YamlParameters = st.YamlParameters - pb.YamlParametersFilePath = st.YamlParametersFilePath - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type genAiComputeTaskPb struct { - Command string `json:"command,omitempty"` - Compute *ComputeConfig `json:"compute,omitempty"` - DlRuntimeImage string `json:"dl_runtime_image"` - MlflowExperimentName string `json:"mlflow_experiment_name,omitempty"` - Source Source `json:"source,omitempty"` - TrainingScriptPath string `json:"training_script_path,omitempty"` - YamlParameters string `json:"yaml_parameters,omitempty"` - YamlParametersFilePath string `json:"yaml_parameters_file_path,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func genAiComputeTaskFromPb(pb *genAiComputeTaskPb) (*GenAiComputeTask, error) { - if pb == nil { - return nil, nil - } - st := &GenAiComputeTask{} - st.Command = pb.Command - st.Compute = pb.Compute - st.DlRuntimeImage = pb.DlRuntimeImage - st.MlflowExperimentName = pb.MlflowExperimentName - st.Source = pb.Source - st.TrainingScriptPath = pb.TrainingScriptPath - st.YamlParameters = pb.YamlParameters - st.YamlParametersFilePath = pb.YamlParametersFilePath - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *genAiComputeTaskPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st genAiComputeTaskPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getJobPermissionLevelsRequestToPb(st *GetJobPermissionLevelsRequest) (*getJobPermissionLevelsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getJobPermissionLevelsRequestPb{} - pb.JobId = st.JobId - - return pb, nil -} - -type getJobPermissionLevelsRequestPb struct { - JobId string `json:"-" url:"-"` -} - -func getJobPermissionLevelsRequestFromPb(pb *getJobPermissionLevelsRequestPb) (*GetJobPermissionLevelsRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetJobPermissionLevelsRequest{} - st.JobId = pb.JobId - - return st, nil -} - -func getJobPermissionLevelsResponseToPb(st *GetJobPermissionLevelsResponse) (*getJobPermissionLevelsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &getJobPermissionLevelsResponsePb{} - pb.PermissionLevels = st.PermissionLevels - - return pb, nil -} - -type getJobPermissionLevelsResponsePb struct { - PermissionLevels []JobPermissionsDescription `json:"permission_levels,omitempty"` -} - -func getJobPermissionLevelsResponseFromPb(pb *getJobPermissionLevelsResponsePb) (*GetJobPermissionLevelsResponse, error) { - if pb == nil { - return nil, nil - } - st := &GetJobPermissionLevelsResponse{} - st.PermissionLevels = pb.PermissionLevels - - return st, nil -} - -func getJobPermissionsRequestToPb(st *GetJobPermissionsRequest) (*getJobPermissionsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getJobPermissionsRequestPb{} - pb.JobId = st.JobId - - return pb, nil -} - -type getJobPermissionsRequestPb struct { - JobId string `json:"-" url:"-"` -} - -func getJobPermissionsRequestFromPb(pb *getJobPermissionsRequestPb) (*GetJobPermissionsRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetJobPermissionsRequest{} - st.JobId = pb.JobId - - return st, nil -} - -func getJobRequestToPb(st *GetJobRequest) (*getJobRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getJobRequestPb{} - pb.JobId = st.JobId - pb.PageToken = st.PageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getJobRequestPb struct { - JobId int64 `json:"-" url:"job_id"` - PageToken string `json:"-" url:"page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getJobRequestFromPb(pb *getJobRequestPb) (*GetJobRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetJobRequest{} - st.JobId = pb.JobId - st.PageToken = pb.PageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getJobRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getJobRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getPolicyComplianceRequestToPb(st *GetPolicyComplianceRequest) (*getPolicyComplianceRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getPolicyComplianceRequestPb{} - pb.JobId = st.JobId - - return pb, nil -} - -type getPolicyComplianceRequestPb struct { - JobId int64 `json:"-" url:"job_id"` -} - -func getPolicyComplianceRequestFromPb(pb *getPolicyComplianceRequestPb) (*GetPolicyComplianceRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetPolicyComplianceRequest{} - st.JobId = pb.JobId - - return st, nil -} - -func getPolicyComplianceResponseToPb(st *GetPolicyComplianceResponse) (*getPolicyComplianceResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &getPolicyComplianceResponsePb{} - pb.IsCompliant = st.IsCompliant - pb.Violations = st.Violations - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getPolicyComplianceResponsePb struct { - IsCompliant bool `json:"is_compliant,omitempty"` - Violations map[string]string `json:"violations,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getPolicyComplianceResponseFromPb(pb *getPolicyComplianceResponsePb) (*GetPolicyComplianceResponse, error) { - if pb == nil { - return nil, nil - } - st := &GetPolicyComplianceResponse{} - st.IsCompliant = pb.IsCompliant - st.Violations = pb.Violations - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getPolicyComplianceResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getPolicyComplianceResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getRunOutputRequestToPb(st *GetRunOutputRequest) (*getRunOutputRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getRunOutputRequestPb{} - pb.RunId = st.RunId - - return pb, nil -} - -type getRunOutputRequestPb struct { - RunId int64 `json:"-" url:"run_id"` -} - -func getRunOutputRequestFromPb(pb *getRunOutputRequestPb) (*GetRunOutputRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetRunOutputRequest{} - st.RunId = pb.RunId - - return st, nil -} - -func getRunRequestToPb(st *GetRunRequest) (*getRunRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getRunRequestPb{} - pb.IncludeHistory = st.IncludeHistory - pb.IncludeResolvedValues = st.IncludeResolvedValues - pb.PageToken = st.PageToken - pb.RunId = st.RunId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getRunRequestPb struct { - IncludeHistory bool `json:"-" url:"include_history,omitempty"` - IncludeResolvedValues bool `json:"-" url:"include_resolved_values,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - RunId int64 `json:"-" url:"run_id"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getRunRequestFromPb(pb *getRunRequestPb) (*GetRunRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetRunRequest{} - st.IncludeHistory = pb.IncludeHistory - st.IncludeResolvedValues = pb.IncludeResolvedValues - st.PageToken = pb.PageToken - st.RunId = pb.RunId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getRunRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getRunRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func gitSnapshotToPb(st *GitSnapshot) (*gitSnapshotPb, error) { - if st == nil { - return nil, nil - } - pb := &gitSnapshotPb{} - pb.UsedCommit = st.UsedCommit - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type gitSnapshotPb struct { - UsedCommit string `json:"used_commit,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func gitSnapshotFromPb(pb *gitSnapshotPb) (*GitSnapshot, error) { - if pb == nil { - return nil, nil - } - st := &GitSnapshot{} - st.UsedCommit = pb.UsedCommit - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *gitSnapshotPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st gitSnapshotPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func gitSourceToPb(st *GitSource) (*gitSourcePb, error) { - if st == nil { - return nil, nil - } - pb := &gitSourcePb{} - pb.GitBranch = st.GitBranch - pb.GitCommit = st.GitCommit - pb.GitProvider = st.GitProvider - pb.GitSnapshot = st.GitSnapshot - pb.GitTag = st.GitTag - pb.GitUrl = st.GitUrl - pb.JobSource = st.JobSource - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type gitSourcePb struct { - GitBranch string `json:"git_branch,omitempty"` - GitCommit string `json:"git_commit,omitempty"` - GitProvider GitProvider `json:"git_provider"` - GitSnapshot *GitSnapshot `json:"git_snapshot,omitempty"` - GitTag string `json:"git_tag,omitempty"` - GitUrl string `json:"git_url"` - JobSource *JobSource `json:"job_source,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func gitSourceFromPb(pb *gitSourcePb) (*GitSource, error) { - if pb == nil { - return nil, nil - } - st := &GitSource{} - st.GitBranch = pb.GitBranch - st.GitCommit = pb.GitCommit - st.GitProvider = pb.GitProvider - st.GitSnapshot = pb.GitSnapshot - st.GitTag = pb.GitTag - st.GitUrl = pb.GitUrl - st.JobSource = pb.JobSource - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *gitSourcePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st gitSourcePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func jobToPb(st *Job) (*jobPb, error) { - if st == nil { - return nil, nil - } - pb := &jobPb{} - pb.CreatedTime = st.CreatedTime - pb.CreatorUserName = st.CreatorUserName - pb.EffectiveBudgetPolicyId = st.EffectiveBudgetPolicyId - pb.HasMore = st.HasMore - pb.JobId = st.JobId - pb.NextPageToken = st.NextPageToken - pb.RunAsUserName = st.RunAsUserName - pb.Settings = st.Settings - pb.TriggerState = st.TriggerState - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type jobPb struct { - CreatedTime int64 `json:"created_time,omitempty"` - CreatorUserName string `json:"creator_user_name,omitempty"` - EffectiveBudgetPolicyId string `json:"effective_budget_policy_id,omitempty"` - HasMore bool `json:"has_more,omitempty"` - JobId int64 `json:"job_id,omitempty"` - NextPageToken string `json:"next_page_token,omitempty"` - RunAsUserName string `json:"run_as_user_name,omitempty"` - Settings *JobSettings `json:"settings,omitempty"` - TriggerState *TriggerStateProto `json:"trigger_state,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func jobFromPb(pb *jobPb) (*Job, error) { - if pb == nil { - return nil, nil - } - st := &Job{} - st.CreatedTime = pb.CreatedTime - st.CreatorUserName = pb.CreatorUserName - st.EffectiveBudgetPolicyId = pb.EffectiveBudgetPolicyId - st.HasMore = pb.HasMore - st.JobId = pb.JobId - st.NextPageToken = pb.NextPageToken - st.RunAsUserName = pb.RunAsUserName - st.Settings = pb.Settings - st.TriggerState = pb.TriggerState - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *jobPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st jobPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func jobAccessControlRequestToPb(st *JobAccessControlRequest) (*jobAccessControlRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &jobAccessControlRequestPb{} - pb.GroupName = st.GroupName - pb.PermissionLevel = st.PermissionLevel - pb.ServicePrincipalName = st.ServicePrincipalName - pb.UserName = st.UserName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type jobAccessControlRequestPb struct { - GroupName string `json:"group_name,omitempty"` - PermissionLevel JobPermissionLevel `json:"permission_level,omitempty"` - ServicePrincipalName string `json:"service_principal_name,omitempty"` - UserName string `json:"user_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func jobAccessControlRequestFromPb(pb *jobAccessControlRequestPb) (*JobAccessControlRequest, error) { - if pb == nil { - return nil, nil - } - st := &JobAccessControlRequest{} - st.GroupName = pb.GroupName - st.PermissionLevel = pb.PermissionLevel - st.ServicePrincipalName = pb.ServicePrincipalName - st.UserName = pb.UserName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *jobAccessControlRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st jobAccessControlRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func jobAccessControlResponseToPb(st *JobAccessControlResponse) (*jobAccessControlResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &jobAccessControlResponsePb{} - pb.AllPermissions = st.AllPermissions - pb.DisplayName = st.DisplayName - pb.GroupName = st.GroupName - pb.ServicePrincipalName = st.ServicePrincipalName - pb.UserName = st.UserName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type jobAccessControlResponsePb struct { - AllPermissions []JobPermission `json:"all_permissions,omitempty"` - DisplayName string `json:"display_name,omitempty"` - GroupName string `json:"group_name,omitempty"` - ServicePrincipalName string `json:"service_principal_name,omitempty"` - UserName string `json:"user_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func jobAccessControlResponseFromPb(pb *jobAccessControlResponsePb) (*JobAccessControlResponse, error) { - if pb == nil { - return nil, nil - } - st := &JobAccessControlResponse{} - st.AllPermissions = pb.AllPermissions - st.DisplayName = pb.DisplayName - st.GroupName = pb.GroupName - st.ServicePrincipalName = pb.ServicePrincipalName - st.UserName = pb.UserName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *jobAccessControlResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st jobAccessControlResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func jobClusterToPb(st *JobCluster) (*jobClusterPb, error) { - if st == nil { - return nil, nil - } - pb := &jobClusterPb{} - pb.JobClusterKey = st.JobClusterKey - pb.NewCluster = st.NewCluster - - return pb, nil -} - -type jobClusterPb struct { - JobClusterKey string `json:"job_cluster_key"` - NewCluster compute.ClusterSpec `json:"new_cluster"` -} - -func jobClusterFromPb(pb *jobClusterPb) (*JobCluster, error) { - if pb == nil { - return nil, nil - } - st := &JobCluster{} - st.JobClusterKey = pb.JobClusterKey - st.NewCluster = pb.NewCluster - - return st, nil -} - -func jobComplianceToPb(st *JobCompliance) (*jobCompliancePb, error) { - if st == nil { - return nil, nil - } - pb := &jobCompliancePb{} - pb.IsCompliant = st.IsCompliant - pb.JobId = st.JobId - pb.Violations = st.Violations - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type jobCompliancePb struct { - IsCompliant bool `json:"is_compliant,omitempty"` - JobId int64 `json:"job_id"` - Violations map[string]string `json:"violations,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func jobComplianceFromPb(pb *jobCompliancePb) (*JobCompliance, error) { - if pb == nil { - return nil, nil - } - st := &JobCompliance{} - st.IsCompliant = pb.IsCompliant - st.JobId = pb.JobId - st.Violations = pb.Violations - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *jobCompliancePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st jobCompliancePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func jobDeploymentToPb(st *JobDeployment) (*jobDeploymentPb, error) { - if st == nil { - return nil, nil - } - pb := &jobDeploymentPb{} - pb.Kind = st.Kind - pb.MetadataFilePath = st.MetadataFilePath - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type jobDeploymentPb struct { - Kind JobDeploymentKind `json:"kind"` - MetadataFilePath string `json:"metadata_file_path,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func jobDeploymentFromPb(pb *jobDeploymentPb) (*JobDeployment, error) { - if pb == nil { - return nil, nil - } - st := &JobDeployment{} - st.Kind = pb.Kind - st.MetadataFilePath = pb.MetadataFilePath - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *jobDeploymentPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st jobDeploymentPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func jobEmailNotificationsToPb(st *JobEmailNotifications) (*jobEmailNotificationsPb, error) { - if st == nil { - return nil, nil - } - pb := &jobEmailNotificationsPb{} - pb.NoAlertForSkippedRuns = st.NoAlertForSkippedRuns - pb.OnDurationWarningThresholdExceeded = st.OnDurationWarningThresholdExceeded - pb.OnFailure = st.OnFailure - pb.OnStart = st.OnStart - pb.OnStreamingBacklogExceeded = st.OnStreamingBacklogExceeded - pb.OnSuccess = st.OnSuccess - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type jobEmailNotificationsPb struct { - NoAlertForSkippedRuns bool `json:"no_alert_for_skipped_runs,omitempty"` - OnDurationWarningThresholdExceeded []string `json:"on_duration_warning_threshold_exceeded,omitempty"` - OnFailure []string `json:"on_failure,omitempty"` - OnStart []string `json:"on_start,omitempty"` - OnStreamingBacklogExceeded []string `json:"on_streaming_backlog_exceeded,omitempty"` - OnSuccess []string `json:"on_success,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func jobEmailNotificationsFromPb(pb *jobEmailNotificationsPb) (*JobEmailNotifications, error) { - if pb == nil { - return nil, nil - } - st := &JobEmailNotifications{} - st.NoAlertForSkippedRuns = pb.NoAlertForSkippedRuns - st.OnDurationWarningThresholdExceeded = pb.OnDurationWarningThresholdExceeded - st.OnFailure = pb.OnFailure - st.OnStart = pb.OnStart - st.OnStreamingBacklogExceeded = pb.OnStreamingBacklogExceeded - st.OnSuccess = pb.OnSuccess - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *jobEmailNotificationsPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st jobEmailNotificationsPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func jobEnvironmentToPb(st *JobEnvironment) (*jobEnvironmentPb, error) { - if st == nil { - return nil, nil - } - pb := &jobEnvironmentPb{} - pb.EnvironmentKey = st.EnvironmentKey - pb.Spec = st.Spec - - return pb, nil -} - -type jobEnvironmentPb struct { - EnvironmentKey string `json:"environment_key"` - Spec *compute.Environment `json:"spec,omitempty"` -} - -func jobEnvironmentFromPb(pb *jobEnvironmentPb) (*JobEnvironment, error) { - if pb == nil { - return nil, nil - } - st := &JobEnvironment{} - st.EnvironmentKey = pb.EnvironmentKey - st.Spec = pb.Spec - - return st, nil -} - -func jobNotificationSettingsToPb(st *JobNotificationSettings) (*jobNotificationSettingsPb, error) { - if st == nil { - return nil, nil - } - pb := &jobNotificationSettingsPb{} - pb.NoAlertForCanceledRuns = st.NoAlertForCanceledRuns - pb.NoAlertForSkippedRuns = st.NoAlertForSkippedRuns - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type jobNotificationSettingsPb struct { - NoAlertForCanceledRuns bool `json:"no_alert_for_canceled_runs,omitempty"` - NoAlertForSkippedRuns bool `json:"no_alert_for_skipped_runs,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func jobNotificationSettingsFromPb(pb *jobNotificationSettingsPb) (*JobNotificationSettings, error) { - if pb == nil { - return nil, nil - } - st := &JobNotificationSettings{} - st.NoAlertForCanceledRuns = pb.NoAlertForCanceledRuns - st.NoAlertForSkippedRuns = pb.NoAlertForSkippedRuns - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *jobNotificationSettingsPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st jobNotificationSettingsPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func jobParameterToPb(st *JobParameter) (*jobParameterPb, error) { - if st == nil { - return nil, nil - } - pb := &jobParameterPb{} - pb.Default = st.Default - pb.Name = st.Name - pb.Value = st.Value - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type jobParameterPb struct { - Default string `json:"default,omitempty"` - Name string `json:"name,omitempty"` - Value string `json:"value,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func jobParameterFromPb(pb *jobParameterPb) (*JobParameter, error) { - if pb == nil { - return nil, nil - } - st := &JobParameter{} - st.Default = pb.Default - st.Name = pb.Name - st.Value = pb.Value - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *jobParameterPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st jobParameterPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func jobParameterDefinitionToPb(st *JobParameterDefinition) (*jobParameterDefinitionPb, error) { - if st == nil { - return nil, nil - } - pb := &jobParameterDefinitionPb{} - pb.Default = st.Default - pb.Name = st.Name - - return pb, nil -} - -type jobParameterDefinitionPb struct { - Default string `json:"default"` - Name string `json:"name"` -} - -func jobParameterDefinitionFromPb(pb *jobParameterDefinitionPb) (*JobParameterDefinition, error) { - if pb == nil { - return nil, nil - } - st := &JobParameterDefinition{} - st.Default = pb.Default - st.Name = pb.Name - - return st, nil -} - -func jobPermissionToPb(st *JobPermission) (*jobPermissionPb, error) { - if st == nil { - return nil, nil - } - pb := &jobPermissionPb{} - pb.Inherited = st.Inherited - pb.InheritedFromObject = st.InheritedFromObject - pb.PermissionLevel = st.PermissionLevel - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type jobPermissionPb struct { - Inherited bool `json:"inherited,omitempty"` - InheritedFromObject []string `json:"inherited_from_object,omitempty"` - PermissionLevel JobPermissionLevel `json:"permission_level,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func jobPermissionFromPb(pb *jobPermissionPb) (*JobPermission, error) { - if pb == nil { - return nil, nil - } - st := &JobPermission{} - st.Inherited = pb.Inherited - st.InheritedFromObject = pb.InheritedFromObject - st.PermissionLevel = pb.PermissionLevel - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *jobPermissionPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st jobPermissionPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func jobPermissionsToPb(st *JobPermissions) (*jobPermissionsPb, error) { - if st == nil { - return nil, nil - } - pb := &jobPermissionsPb{} - pb.AccessControlList = st.AccessControlList - pb.ObjectId = st.ObjectId - pb.ObjectType = st.ObjectType - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type jobPermissionsPb struct { - AccessControlList []JobAccessControlResponse `json:"access_control_list,omitempty"` - ObjectId string `json:"object_id,omitempty"` - ObjectType string `json:"object_type,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func jobPermissionsFromPb(pb *jobPermissionsPb) (*JobPermissions, error) { - if pb == nil { - return nil, nil - } - st := &JobPermissions{} - st.AccessControlList = pb.AccessControlList - st.ObjectId = pb.ObjectId - st.ObjectType = pb.ObjectType - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *jobPermissionsPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st jobPermissionsPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func jobPermissionsDescriptionToPb(st *JobPermissionsDescription) (*jobPermissionsDescriptionPb, error) { - if st == nil { - return nil, nil - } - pb := &jobPermissionsDescriptionPb{} - pb.Description = st.Description - pb.PermissionLevel = st.PermissionLevel - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type jobPermissionsDescriptionPb struct { - Description string `json:"description,omitempty"` - PermissionLevel JobPermissionLevel `json:"permission_level,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func jobPermissionsDescriptionFromPb(pb *jobPermissionsDescriptionPb) (*JobPermissionsDescription, error) { - if pb == nil { - return nil, nil - } - st := &JobPermissionsDescription{} - st.Description = pb.Description - st.PermissionLevel = pb.PermissionLevel - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *jobPermissionsDescriptionPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st jobPermissionsDescriptionPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func jobPermissionsRequestToPb(st *JobPermissionsRequest) (*jobPermissionsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &jobPermissionsRequestPb{} - pb.AccessControlList = st.AccessControlList - pb.JobId = st.JobId - - return pb, nil -} - -type jobPermissionsRequestPb struct { - AccessControlList []JobAccessControlRequest `json:"access_control_list,omitempty"` - JobId string `json:"-" url:"-"` -} - -func jobPermissionsRequestFromPb(pb *jobPermissionsRequestPb) (*JobPermissionsRequest, error) { - if pb == nil { - return nil, nil - } - st := &JobPermissionsRequest{} - st.AccessControlList = pb.AccessControlList - st.JobId = pb.JobId - - return st, nil -} - -func jobRunAsToPb(st *JobRunAs) (*jobRunAsPb, error) { - if st == nil { - return nil, nil - } - pb := &jobRunAsPb{} - pb.ServicePrincipalName = st.ServicePrincipalName - pb.UserName = st.UserName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type jobRunAsPb struct { - ServicePrincipalName string `json:"service_principal_name,omitempty"` - UserName string `json:"user_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func jobRunAsFromPb(pb *jobRunAsPb) (*JobRunAs, error) { - if pb == nil { - return nil, nil - } - st := &JobRunAs{} - st.ServicePrincipalName = pb.ServicePrincipalName - st.UserName = pb.UserName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *jobRunAsPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st jobRunAsPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func jobSettingsToPb(st *JobSettings) (*jobSettingsPb, error) { - if st == nil { - return nil, nil - } - pb := &jobSettingsPb{} - pb.BudgetPolicyId = st.BudgetPolicyId - pb.Continuous = st.Continuous - pb.Deployment = st.Deployment - pb.Description = st.Description - pb.EditMode = st.EditMode - pb.EmailNotifications = st.EmailNotifications - pb.Environments = st.Environments - pb.Format = st.Format - pb.GitSource = st.GitSource - pb.Health = st.Health - pb.JobClusters = st.JobClusters - pb.MaxConcurrentRuns = st.MaxConcurrentRuns - pb.Name = st.Name - pb.NotificationSettings = st.NotificationSettings - pb.Parameters = st.Parameters - pb.PerformanceTarget = st.PerformanceTarget - pb.Queue = st.Queue - pb.RunAs = st.RunAs - pb.Schedule = st.Schedule - pb.Tags = st.Tags - pb.Tasks = st.Tasks - pb.TimeoutSeconds = st.TimeoutSeconds - pb.Trigger = st.Trigger - pb.WebhookNotifications = st.WebhookNotifications - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type jobSettingsPb struct { - BudgetPolicyId string `json:"budget_policy_id,omitempty"` - Continuous *Continuous `json:"continuous,omitempty"` - Deployment *JobDeployment `json:"deployment,omitempty"` - Description string `json:"description,omitempty"` - EditMode JobEditMode `json:"edit_mode,omitempty"` - EmailNotifications *JobEmailNotifications `json:"email_notifications,omitempty"` - Environments []JobEnvironment `json:"environments,omitempty"` - Format Format `json:"format,omitempty"` - GitSource *GitSource `json:"git_source,omitempty"` - Health *JobsHealthRules `json:"health,omitempty"` - JobClusters []JobCluster `json:"job_clusters,omitempty"` - MaxConcurrentRuns int `json:"max_concurrent_runs,omitempty"` - Name string `json:"name,omitempty"` - NotificationSettings *JobNotificationSettings `json:"notification_settings,omitempty"` - Parameters []JobParameterDefinition `json:"parameters,omitempty"` - PerformanceTarget PerformanceTarget `json:"performance_target,omitempty"` - Queue *QueueSettings `json:"queue,omitempty"` - RunAs *JobRunAs `json:"run_as,omitempty"` - Schedule *CronSchedule `json:"schedule,omitempty"` - Tags map[string]string `json:"tags,omitempty"` - Tasks []Task `json:"tasks,omitempty"` - TimeoutSeconds int `json:"timeout_seconds,omitempty"` - Trigger *TriggerSettings `json:"trigger,omitempty"` - WebhookNotifications *WebhookNotifications `json:"webhook_notifications,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func jobSettingsFromPb(pb *jobSettingsPb) (*JobSettings, error) { - if pb == nil { - return nil, nil - } - st := &JobSettings{} - st.BudgetPolicyId = pb.BudgetPolicyId - st.Continuous = pb.Continuous - st.Deployment = pb.Deployment - st.Description = pb.Description - st.EditMode = pb.EditMode - st.EmailNotifications = pb.EmailNotifications - st.Environments = pb.Environments - st.Format = pb.Format - st.GitSource = pb.GitSource - st.Health = pb.Health - st.JobClusters = pb.JobClusters - st.MaxConcurrentRuns = pb.MaxConcurrentRuns - st.Name = pb.Name - st.NotificationSettings = pb.NotificationSettings - st.Parameters = pb.Parameters - st.PerformanceTarget = pb.PerformanceTarget - st.Queue = pb.Queue - st.RunAs = pb.RunAs - st.Schedule = pb.Schedule - st.Tags = pb.Tags - st.Tasks = pb.Tasks - st.TimeoutSeconds = pb.TimeoutSeconds - st.Trigger = pb.Trigger - st.WebhookNotifications = pb.WebhookNotifications - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *jobSettingsPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st jobSettingsPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func jobSourceToPb(st *JobSource) (*jobSourcePb, error) { - if st == nil { - return nil, nil - } - pb := &jobSourcePb{} - pb.DirtyState = st.DirtyState - pb.ImportFromGitBranch = st.ImportFromGitBranch - pb.JobConfigPath = st.JobConfigPath - - return pb, nil -} - -type jobSourcePb struct { - DirtyState JobSourceDirtyState `json:"dirty_state,omitempty"` - ImportFromGitBranch string `json:"import_from_git_branch"` - JobConfigPath string `json:"job_config_path"` -} - -func jobSourceFromPb(pb *jobSourcePb) (*JobSource, error) { - if pb == nil { - return nil, nil - } - st := &JobSource{} - st.DirtyState = pb.DirtyState - st.ImportFromGitBranch = pb.ImportFromGitBranch - st.JobConfigPath = pb.JobConfigPath - - return st, nil -} - -func jobsHealthRuleToPb(st *JobsHealthRule) (*jobsHealthRulePb, error) { - if st == nil { - return nil, nil - } - pb := &jobsHealthRulePb{} - pb.Metric = st.Metric - pb.Op = st.Op - pb.Value = st.Value - - return pb, nil -} - -type jobsHealthRulePb struct { - Metric JobsHealthMetric `json:"metric"` - Op JobsHealthOperator `json:"op"` - Value int64 `json:"value"` -} - -func jobsHealthRuleFromPb(pb *jobsHealthRulePb) (*JobsHealthRule, error) { - if pb == nil { - return nil, nil - } - st := &JobsHealthRule{} - st.Metric = pb.Metric - st.Op = pb.Op - st.Value = pb.Value - - return st, nil -} - -func jobsHealthRulesToPb(st *JobsHealthRules) (*jobsHealthRulesPb, error) { - if st == nil { - return nil, nil - } - pb := &jobsHealthRulesPb{} - pb.Rules = st.Rules - - return pb, nil -} - -type jobsHealthRulesPb struct { - Rules []JobsHealthRule `json:"rules,omitempty"` -} - -func jobsHealthRulesFromPb(pb *jobsHealthRulesPb) (*JobsHealthRules, error) { - if pb == nil { - return nil, nil - } - st := &JobsHealthRules{} - st.Rules = pb.Rules - - return st, nil -} - -func listJobComplianceForPolicyResponseToPb(st *ListJobComplianceForPolicyResponse) (*listJobComplianceForPolicyResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listJobComplianceForPolicyResponsePb{} - pb.Jobs = st.Jobs - pb.NextPageToken = st.NextPageToken - pb.PrevPageToken = st.PrevPageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listJobComplianceForPolicyResponsePb struct { - Jobs []JobCompliance `json:"jobs,omitempty"` - NextPageToken string `json:"next_page_token,omitempty"` - PrevPageToken string `json:"prev_page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listJobComplianceForPolicyResponseFromPb(pb *listJobComplianceForPolicyResponsePb) (*ListJobComplianceForPolicyResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListJobComplianceForPolicyResponse{} - st.Jobs = pb.Jobs - st.NextPageToken = pb.NextPageToken - st.PrevPageToken = pb.PrevPageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listJobComplianceForPolicyResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listJobComplianceForPolicyResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listJobComplianceRequestToPb(st *ListJobComplianceRequest) (*listJobComplianceRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listJobComplianceRequestPb{} - pb.PageSize = st.PageSize - pb.PageToken = st.PageToken - pb.PolicyId = st.PolicyId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listJobComplianceRequestPb struct { - PageSize int `json:"-" url:"page_size,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - PolicyId string `json:"-" url:"policy_id"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listJobComplianceRequestFromPb(pb *listJobComplianceRequestPb) (*ListJobComplianceRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListJobComplianceRequest{} - st.PageSize = pb.PageSize - st.PageToken = pb.PageToken - st.PolicyId = pb.PolicyId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listJobComplianceRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listJobComplianceRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listJobsRequestToPb(st *ListJobsRequest) (*listJobsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listJobsRequestPb{} - pb.ExpandTasks = st.ExpandTasks - pb.Limit = st.Limit - pb.Name = st.Name - pb.Offset = st.Offset - pb.PageToken = st.PageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listJobsRequestPb struct { - ExpandTasks bool `json:"-" url:"expand_tasks,omitempty"` - Limit int `json:"-" url:"limit,omitempty"` - Name string `json:"-" url:"name,omitempty"` - Offset int `json:"-" url:"offset,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listJobsRequestFromPb(pb *listJobsRequestPb) (*ListJobsRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListJobsRequest{} - st.ExpandTasks = pb.ExpandTasks - st.Limit = pb.Limit - st.Name = pb.Name - st.Offset = pb.Offset - st.PageToken = pb.PageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listJobsRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listJobsRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listJobsResponseToPb(st *ListJobsResponse) (*listJobsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listJobsResponsePb{} - pb.HasMore = st.HasMore - pb.Jobs = st.Jobs - pb.NextPageToken = st.NextPageToken - pb.PrevPageToken = st.PrevPageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listJobsResponsePb struct { - HasMore bool `json:"has_more,omitempty"` - Jobs []BaseJob `json:"jobs,omitempty"` - NextPageToken string `json:"next_page_token,omitempty"` - PrevPageToken string `json:"prev_page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listJobsResponseFromPb(pb *listJobsResponsePb) (*ListJobsResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListJobsResponse{} - st.HasMore = pb.HasMore - st.Jobs = pb.Jobs - st.NextPageToken = pb.NextPageToken - st.PrevPageToken = pb.PrevPageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listJobsResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listJobsResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listRunsRequestToPb(st *ListRunsRequest) (*listRunsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listRunsRequestPb{} - pb.ActiveOnly = st.ActiveOnly - pb.CompletedOnly = st.CompletedOnly - pb.ExpandTasks = st.ExpandTasks - pb.JobId = st.JobId - pb.Limit = st.Limit - pb.Offset = st.Offset - pb.PageToken = st.PageToken - pb.RunType = st.RunType - pb.StartTimeFrom = st.StartTimeFrom - pb.StartTimeTo = st.StartTimeTo - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listRunsRequestPb struct { - ActiveOnly bool `json:"-" url:"active_only,omitempty"` - CompletedOnly bool `json:"-" url:"completed_only,omitempty"` - ExpandTasks bool `json:"-" url:"expand_tasks,omitempty"` - JobId int64 `json:"-" url:"job_id,omitempty"` - Limit int `json:"-" url:"limit,omitempty"` - Offset int `json:"-" url:"offset,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - RunType RunType `json:"-" url:"run_type,omitempty"` - StartTimeFrom int64 `json:"-" url:"start_time_from,omitempty"` - StartTimeTo int64 `json:"-" url:"start_time_to,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listRunsRequestFromPb(pb *listRunsRequestPb) (*ListRunsRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListRunsRequest{} - st.ActiveOnly = pb.ActiveOnly - st.CompletedOnly = pb.CompletedOnly - st.ExpandTasks = pb.ExpandTasks - st.JobId = pb.JobId - st.Limit = pb.Limit - st.Offset = pb.Offset - st.PageToken = pb.PageToken - st.RunType = pb.RunType - st.StartTimeFrom = pb.StartTimeFrom - st.StartTimeTo = pb.StartTimeTo - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listRunsRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listRunsRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listRunsResponseToPb(st *ListRunsResponse) (*listRunsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listRunsResponsePb{} - pb.HasMore = st.HasMore - pb.NextPageToken = st.NextPageToken - pb.PrevPageToken = st.PrevPageToken - pb.Runs = st.Runs - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listRunsResponsePb struct { - HasMore bool `json:"has_more,omitempty"` - NextPageToken string `json:"next_page_token,omitempty"` - PrevPageToken string `json:"prev_page_token,omitempty"` - Runs []BaseRun `json:"runs,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listRunsResponseFromPb(pb *listRunsResponsePb) (*ListRunsResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListRunsResponse{} - st.HasMore = pb.HasMore - st.NextPageToken = pb.NextPageToken - st.PrevPageToken = pb.PrevPageToken - st.Runs = pb.Runs - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listRunsResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listRunsResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func notebookOutputToPb(st *NotebookOutput) (*notebookOutputPb, error) { - if st == nil { - return nil, nil - } - pb := ¬ebookOutputPb{} - pb.Result = st.Result - pb.Truncated = st.Truncated - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type notebookOutputPb struct { - Result string `json:"result,omitempty"` - Truncated bool `json:"truncated,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func notebookOutputFromPb(pb *notebookOutputPb) (*NotebookOutput, error) { - if pb == nil { - return nil, nil - } - st := &NotebookOutput{} - st.Result = pb.Result - st.Truncated = pb.Truncated - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *notebookOutputPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st notebookOutputPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func notebookTaskToPb(st *NotebookTask) (*notebookTaskPb, error) { - if st == nil { - return nil, nil - } - pb := ¬ebookTaskPb{} - pb.BaseParameters = st.BaseParameters - pb.NotebookPath = st.NotebookPath - pb.Source = st.Source - pb.WarehouseId = st.WarehouseId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type notebookTaskPb struct { - BaseParameters map[string]string `json:"base_parameters,omitempty"` - NotebookPath string `json:"notebook_path"` - Source Source `json:"source,omitempty"` - WarehouseId string `json:"warehouse_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func notebookTaskFromPb(pb *notebookTaskPb) (*NotebookTask, error) { - if pb == nil { - return nil, nil - } - st := &NotebookTask{} - st.BaseParameters = pb.BaseParameters - st.NotebookPath = pb.NotebookPath - st.Source = pb.Source - st.WarehouseId = pb.WarehouseId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *notebookTaskPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st notebookTaskPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func outputSchemaInfoToPb(st *OutputSchemaInfo) (*outputSchemaInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &outputSchemaInfoPb{} - pb.CatalogName = st.CatalogName - pb.ExpirationTime = st.ExpirationTime - pb.SchemaName = st.SchemaName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type outputSchemaInfoPb struct { - CatalogName string `json:"catalog_name,omitempty"` - ExpirationTime int64 `json:"expiration_time,omitempty"` - SchemaName string `json:"schema_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func outputSchemaInfoFromPb(pb *outputSchemaInfoPb) (*OutputSchemaInfo, error) { - if pb == nil { - return nil, nil - } - st := &OutputSchemaInfo{} - st.CatalogName = pb.CatalogName - st.ExpirationTime = pb.ExpirationTime - st.SchemaName = pb.SchemaName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *outputSchemaInfoPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st outputSchemaInfoPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func periodicTriggerConfigurationToPb(st *PeriodicTriggerConfiguration) (*periodicTriggerConfigurationPb, error) { - if st == nil { - return nil, nil - } - pb := &periodicTriggerConfigurationPb{} - pb.Interval = st.Interval - pb.Unit = st.Unit - - return pb, nil -} - -type periodicTriggerConfigurationPb struct { - Interval int `json:"interval"` - Unit PeriodicTriggerConfigurationTimeUnit `json:"unit"` -} - -func periodicTriggerConfigurationFromPb(pb *periodicTriggerConfigurationPb) (*PeriodicTriggerConfiguration, error) { - if pb == nil { - return nil, nil - } - st := &PeriodicTriggerConfiguration{} - st.Interval = pb.Interval - st.Unit = pb.Unit - - return st, nil -} - -func pipelineParamsToPb(st *PipelineParams) (*pipelineParamsPb, error) { - if st == nil { - return nil, nil - } - pb := &pipelineParamsPb{} - pb.FullRefresh = st.FullRefresh - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type pipelineParamsPb struct { - FullRefresh bool `json:"full_refresh,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func pipelineParamsFromPb(pb *pipelineParamsPb) (*PipelineParams, error) { - if pb == nil { - return nil, nil - } - st := &PipelineParams{} - st.FullRefresh = pb.FullRefresh - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *pipelineParamsPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st pipelineParamsPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func pipelineTaskToPb(st *PipelineTask) (*pipelineTaskPb, error) { - if st == nil { - return nil, nil - } - pb := &pipelineTaskPb{} - pb.FullRefresh = st.FullRefresh - pb.PipelineId = st.PipelineId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type pipelineTaskPb struct { - FullRefresh bool `json:"full_refresh,omitempty"` - PipelineId string `json:"pipeline_id"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func pipelineTaskFromPb(pb *pipelineTaskPb) (*PipelineTask, error) { - if pb == nil { - return nil, nil - } - st := &PipelineTask{} - st.FullRefresh = pb.FullRefresh - st.PipelineId = pb.PipelineId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *pipelineTaskPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st pipelineTaskPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func powerBiModelToPb(st *PowerBiModel) (*powerBiModelPb, error) { - if st == nil { - return nil, nil - } - pb := &powerBiModelPb{} - pb.AuthenticationMethod = st.AuthenticationMethod - pb.ModelName = st.ModelName - pb.OverwriteExisting = st.OverwriteExisting - pb.StorageMode = st.StorageMode - pb.WorkspaceName = st.WorkspaceName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type powerBiModelPb struct { - AuthenticationMethod AuthenticationMethod `json:"authentication_method,omitempty"` - ModelName string `json:"model_name,omitempty"` - OverwriteExisting bool `json:"overwrite_existing,omitempty"` - StorageMode StorageMode `json:"storage_mode,omitempty"` - WorkspaceName string `json:"workspace_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func powerBiModelFromPb(pb *powerBiModelPb) (*PowerBiModel, error) { - if pb == nil { - return nil, nil - } - st := &PowerBiModel{} - st.AuthenticationMethod = pb.AuthenticationMethod - st.ModelName = pb.ModelName - st.OverwriteExisting = pb.OverwriteExisting - st.StorageMode = pb.StorageMode - st.WorkspaceName = pb.WorkspaceName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *powerBiModelPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st powerBiModelPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func powerBiTableToPb(st *PowerBiTable) (*powerBiTablePb, error) { - if st == nil { - return nil, nil - } - pb := &powerBiTablePb{} - pb.Catalog = st.Catalog - pb.Name = st.Name - pb.Schema = st.Schema - pb.StorageMode = st.StorageMode - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type powerBiTablePb struct { - Catalog string `json:"catalog,omitempty"` - Name string `json:"name,omitempty"` - Schema string `json:"schema,omitempty"` - StorageMode StorageMode `json:"storage_mode,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func powerBiTableFromPb(pb *powerBiTablePb) (*PowerBiTable, error) { - if pb == nil { - return nil, nil - } - st := &PowerBiTable{} - st.Catalog = pb.Catalog - st.Name = pb.Name - st.Schema = pb.Schema - st.StorageMode = pb.StorageMode - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *powerBiTablePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st powerBiTablePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func powerBiTaskToPb(st *PowerBiTask) (*powerBiTaskPb, error) { - if st == nil { - return nil, nil - } - pb := &powerBiTaskPb{} - pb.ConnectionResourceName = st.ConnectionResourceName - pb.PowerBiModel = st.PowerBiModel - pb.RefreshAfterUpdate = st.RefreshAfterUpdate - pb.Tables = st.Tables - pb.WarehouseId = st.WarehouseId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type powerBiTaskPb struct { - ConnectionResourceName string `json:"connection_resource_name,omitempty"` - PowerBiModel *PowerBiModel `json:"power_bi_model,omitempty"` - RefreshAfterUpdate bool `json:"refresh_after_update,omitempty"` - Tables []PowerBiTable `json:"tables,omitempty"` - WarehouseId string `json:"warehouse_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func powerBiTaskFromPb(pb *powerBiTaskPb) (*PowerBiTask, error) { - if pb == nil { - return nil, nil - } - st := &PowerBiTask{} - st.ConnectionResourceName = pb.ConnectionResourceName - st.PowerBiModel = pb.PowerBiModel - st.RefreshAfterUpdate = pb.RefreshAfterUpdate - st.Tables = pb.Tables - st.WarehouseId = pb.WarehouseId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *powerBiTaskPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st powerBiTaskPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func pythonWheelTaskToPb(st *PythonWheelTask) (*pythonWheelTaskPb, error) { - if st == nil { - return nil, nil - } - pb := &pythonWheelTaskPb{} - pb.EntryPoint = st.EntryPoint - pb.NamedParameters = st.NamedParameters - pb.PackageName = st.PackageName - pb.Parameters = st.Parameters - - return pb, nil -} - -type pythonWheelTaskPb struct { - EntryPoint string `json:"entry_point"` - NamedParameters map[string]string `json:"named_parameters,omitempty"` - PackageName string `json:"package_name"` - Parameters []string `json:"parameters,omitempty"` -} - -func pythonWheelTaskFromPb(pb *pythonWheelTaskPb) (*PythonWheelTask, error) { - if pb == nil { - return nil, nil - } - st := &PythonWheelTask{} - st.EntryPoint = pb.EntryPoint - st.NamedParameters = pb.NamedParameters - st.PackageName = pb.PackageName - st.Parameters = pb.Parameters - - return st, nil -} - -func queueDetailsToPb(st *QueueDetails) (*queueDetailsPb, error) { - if st == nil { - return nil, nil - } - pb := &queueDetailsPb{} - pb.Code = st.Code - pb.Message = st.Message - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type queueDetailsPb struct { - Code QueueDetailsCodeCode `json:"code,omitempty"` - Message string `json:"message,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func queueDetailsFromPb(pb *queueDetailsPb) (*QueueDetails, error) { - if pb == nil { - return nil, nil - } - st := &QueueDetails{} - st.Code = pb.Code - st.Message = pb.Message - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *queueDetailsPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st queueDetailsPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func queueSettingsToPb(st *QueueSettings) (*queueSettingsPb, error) { - if st == nil { - return nil, nil - } - pb := &queueSettingsPb{} - pb.Enabled = st.Enabled - - return pb, nil -} - -type queueSettingsPb struct { - Enabled bool `json:"enabled"` -} - -func queueSettingsFromPb(pb *queueSettingsPb) (*QueueSettings, error) { - if pb == nil { - return nil, nil - } - st := &QueueSettings{} - st.Enabled = pb.Enabled - - return st, nil -} - -func repairHistoryItemToPb(st *RepairHistoryItem) (*repairHistoryItemPb, error) { - if st == nil { - return nil, nil - } - pb := &repairHistoryItemPb{} - pb.EffectivePerformanceTarget = st.EffectivePerformanceTarget - pb.EndTime = st.EndTime - pb.Id = st.Id - pb.StartTime = st.StartTime - pb.State = st.State - pb.Status = st.Status - pb.TaskRunIds = st.TaskRunIds - pb.Type = st.Type - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type repairHistoryItemPb struct { - EffectivePerformanceTarget PerformanceTarget `json:"effective_performance_target,omitempty"` - EndTime int64 `json:"end_time,omitempty"` - Id int64 `json:"id,omitempty"` - StartTime int64 `json:"start_time,omitempty"` - State *RunState `json:"state,omitempty"` - Status *RunStatus `json:"status,omitempty"` - TaskRunIds []int64 `json:"task_run_ids,omitempty"` - Type RepairHistoryItemType `json:"type,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func repairHistoryItemFromPb(pb *repairHistoryItemPb) (*RepairHistoryItem, error) { - if pb == nil { - return nil, nil - } - st := &RepairHistoryItem{} - st.EffectivePerformanceTarget = pb.EffectivePerformanceTarget - st.EndTime = pb.EndTime - st.Id = pb.Id - st.StartTime = pb.StartTime - st.State = pb.State - st.Status = pb.Status - st.TaskRunIds = pb.TaskRunIds - st.Type = pb.Type - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *repairHistoryItemPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st repairHistoryItemPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func repairRunToPb(st *RepairRun) (*repairRunPb, error) { - if st == nil { - return nil, nil - } - pb := &repairRunPb{} - pb.DbtCommands = st.DbtCommands - pb.JarParams = st.JarParams - pb.JobParameters = st.JobParameters - pb.LatestRepairId = st.LatestRepairId - pb.NotebookParams = st.NotebookParams - pb.PerformanceTarget = st.PerformanceTarget - pb.PipelineParams = st.PipelineParams - pb.PythonNamedParams = st.PythonNamedParams - pb.PythonParams = st.PythonParams - pb.RerunAllFailedTasks = st.RerunAllFailedTasks - pb.RerunDependentTasks = st.RerunDependentTasks - pb.RerunTasks = st.RerunTasks - pb.RunId = st.RunId - pb.SparkSubmitParams = st.SparkSubmitParams - pb.SqlParams = st.SqlParams - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type repairRunPb struct { - DbtCommands []string `json:"dbt_commands,omitempty"` - JarParams []string `json:"jar_params,omitempty"` - JobParameters map[string]string `json:"job_parameters,omitempty"` - LatestRepairId int64 `json:"latest_repair_id,omitempty"` - NotebookParams map[string]string `json:"notebook_params,omitempty"` - PerformanceTarget PerformanceTarget `json:"performance_target,omitempty"` - PipelineParams *PipelineParams `json:"pipeline_params,omitempty"` - PythonNamedParams map[string]string `json:"python_named_params,omitempty"` - PythonParams []string `json:"python_params,omitempty"` - RerunAllFailedTasks bool `json:"rerun_all_failed_tasks,omitempty"` - RerunDependentTasks bool `json:"rerun_dependent_tasks,omitempty"` - RerunTasks []string `json:"rerun_tasks,omitempty"` - RunId int64 `json:"run_id"` - SparkSubmitParams []string `json:"spark_submit_params,omitempty"` - SqlParams map[string]string `json:"sql_params,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func repairRunFromPb(pb *repairRunPb) (*RepairRun, error) { - if pb == nil { - return nil, nil - } - st := &RepairRun{} - st.DbtCommands = pb.DbtCommands - st.JarParams = pb.JarParams - st.JobParameters = pb.JobParameters - st.LatestRepairId = pb.LatestRepairId - st.NotebookParams = pb.NotebookParams - st.PerformanceTarget = pb.PerformanceTarget - st.PipelineParams = pb.PipelineParams - st.PythonNamedParams = pb.PythonNamedParams - st.PythonParams = pb.PythonParams - st.RerunAllFailedTasks = pb.RerunAllFailedTasks - st.RerunDependentTasks = pb.RerunDependentTasks - st.RerunTasks = pb.RerunTasks - st.RunId = pb.RunId - st.SparkSubmitParams = pb.SparkSubmitParams - st.SqlParams = pb.SqlParams - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *repairRunPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st repairRunPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func repairRunResponseToPb(st *RepairRunResponse) (*repairRunResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &repairRunResponsePb{} - pb.RepairId = st.RepairId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type repairRunResponsePb struct { - RepairId int64 `json:"repair_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func repairRunResponseFromPb(pb *repairRunResponsePb) (*RepairRunResponse, error) { - if pb == nil { - return nil, nil - } - st := &RepairRunResponse{} - st.RepairId = pb.RepairId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *repairRunResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st repairRunResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func resetJobToPb(st *ResetJob) (*resetJobPb, error) { - if st == nil { - return nil, nil - } - pb := &resetJobPb{} - pb.JobId = st.JobId - pb.NewSettings = st.NewSettings - - return pb, nil -} - -type resetJobPb struct { - JobId int64 `json:"job_id"` - NewSettings JobSettings `json:"new_settings"` -} - -func resetJobFromPb(pb *resetJobPb) (*ResetJob, error) { - if pb == nil { - return nil, nil - } - st := &ResetJob{} - st.JobId = pb.JobId - st.NewSettings = pb.NewSettings - - return st, nil -} - -func resetResponseToPb(st *ResetResponse) (*resetResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &resetResponsePb{} - - return pb, nil -} - -type resetResponsePb struct { -} - -func resetResponseFromPb(pb *resetResponsePb) (*ResetResponse, error) { - if pb == nil { - return nil, nil - } - st := &ResetResponse{} - - return st, nil -} - -func resolvedConditionTaskValuesToPb(st *ResolvedConditionTaskValues) (*resolvedConditionTaskValuesPb, error) { - if st == nil { - return nil, nil - } - pb := &resolvedConditionTaskValuesPb{} - pb.Left = st.Left - pb.Right = st.Right - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type resolvedConditionTaskValuesPb struct { - Left string `json:"left,omitempty"` - Right string `json:"right,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func resolvedConditionTaskValuesFromPb(pb *resolvedConditionTaskValuesPb) (*ResolvedConditionTaskValues, error) { - if pb == nil { - return nil, nil - } - st := &ResolvedConditionTaskValues{} - st.Left = pb.Left - st.Right = pb.Right - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *resolvedConditionTaskValuesPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st resolvedConditionTaskValuesPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func resolvedDbtTaskValuesToPb(st *ResolvedDbtTaskValues) (*resolvedDbtTaskValuesPb, error) { - if st == nil { - return nil, nil - } - pb := &resolvedDbtTaskValuesPb{} - pb.Commands = st.Commands - - return pb, nil -} - -type resolvedDbtTaskValuesPb struct { - Commands []string `json:"commands,omitempty"` -} - -func resolvedDbtTaskValuesFromPb(pb *resolvedDbtTaskValuesPb) (*ResolvedDbtTaskValues, error) { - if pb == nil { - return nil, nil - } - st := &ResolvedDbtTaskValues{} - st.Commands = pb.Commands - - return st, nil -} - -func resolvedNotebookTaskValuesToPb(st *ResolvedNotebookTaskValues) (*resolvedNotebookTaskValuesPb, error) { - if st == nil { - return nil, nil - } - pb := &resolvedNotebookTaskValuesPb{} - pb.BaseParameters = st.BaseParameters - - return pb, nil -} - -type resolvedNotebookTaskValuesPb struct { - BaseParameters map[string]string `json:"base_parameters,omitempty"` -} - -func resolvedNotebookTaskValuesFromPb(pb *resolvedNotebookTaskValuesPb) (*ResolvedNotebookTaskValues, error) { - if pb == nil { - return nil, nil - } - st := &ResolvedNotebookTaskValues{} - st.BaseParameters = pb.BaseParameters - - return st, nil -} - -func resolvedParamPairValuesToPb(st *ResolvedParamPairValues) (*resolvedParamPairValuesPb, error) { - if st == nil { - return nil, nil - } - pb := &resolvedParamPairValuesPb{} - pb.Parameters = st.Parameters - - return pb, nil -} - -type resolvedParamPairValuesPb struct { - Parameters map[string]string `json:"parameters,omitempty"` -} - -func resolvedParamPairValuesFromPb(pb *resolvedParamPairValuesPb) (*ResolvedParamPairValues, error) { - if pb == nil { - return nil, nil - } - st := &ResolvedParamPairValues{} - st.Parameters = pb.Parameters - - return st, nil -} - -func resolvedPythonWheelTaskValuesToPb(st *ResolvedPythonWheelTaskValues) (*resolvedPythonWheelTaskValuesPb, error) { - if st == nil { - return nil, nil - } - pb := &resolvedPythonWheelTaskValuesPb{} - pb.NamedParameters = st.NamedParameters - pb.Parameters = st.Parameters - - return pb, nil -} - -type resolvedPythonWheelTaskValuesPb struct { - NamedParameters map[string]string `json:"named_parameters,omitempty"` - Parameters []string `json:"parameters,omitempty"` -} - -func resolvedPythonWheelTaskValuesFromPb(pb *resolvedPythonWheelTaskValuesPb) (*ResolvedPythonWheelTaskValues, error) { - if pb == nil { - return nil, nil - } - st := &ResolvedPythonWheelTaskValues{} - st.NamedParameters = pb.NamedParameters - st.Parameters = pb.Parameters - - return st, nil -} - -func resolvedRunJobTaskValuesToPb(st *ResolvedRunJobTaskValues) (*resolvedRunJobTaskValuesPb, error) { - if st == nil { - return nil, nil - } - pb := &resolvedRunJobTaskValuesPb{} - pb.JobParameters = st.JobParameters - pb.Parameters = st.Parameters - - return pb, nil -} - -type resolvedRunJobTaskValuesPb struct { - JobParameters map[string]string `json:"job_parameters,omitempty"` - Parameters map[string]string `json:"parameters,omitempty"` -} - -func resolvedRunJobTaskValuesFromPb(pb *resolvedRunJobTaskValuesPb) (*ResolvedRunJobTaskValues, error) { - if pb == nil { - return nil, nil - } - st := &ResolvedRunJobTaskValues{} - st.JobParameters = pb.JobParameters - st.Parameters = pb.Parameters - - return st, nil -} - -func resolvedStringParamsValuesToPb(st *ResolvedStringParamsValues) (*resolvedStringParamsValuesPb, error) { - if st == nil { - return nil, nil - } - pb := &resolvedStringParamsValuesPb{} - pb.Parameters = st.Parameters - - return pb, nil -} - -type resolvedStringParamsValuesPb struct { - Parameters []string `json:"parameters,omitempty"` -} - -func resolvedStringParamsValuesFromPb(pb *resolvedStringParamsValuesPb) (*ResolvedStringParamsValues, error) { - if pb == nil { - return nil, nil - } - st := &ResolvedStringParamsValues{} - st.Parameters = pb.Parameters - - return st, nil -} - -func resolvedValuesToPb(st *ResolvedValues) (*resolvedValuesPb, error) { - if st == nil { - return nil, nil - } - pb := &resolvedValuesPb{} - pb.ConditionTask = st.ConditionTask - pb.DbtTask = st.DbtTask - pb.NotebookTask = st.NotebookTask - pb.PythonWheelTask = st.PythonWheelTask - pb.RunJobTask = st.RunJobTask - pb.SimulationTask = st.SimulationTask - pb.SparkJarTask = st.SparkJarTask - pb.SparkPythonTask = st.SparkPythonTask - pb.SparkSubmitTask = st.SparkSubmitTask - pb.SqlTask = st.SqlTask - - return pb, nil -} - -type resolvedValuesPb struct { - ConditionTask *ResolvedConditionTaskValues `json:"condition_task,omitempty"` - DbtTask *ResolvedDbtTaskValues `json:"dbt_task,omitempty"` - NotebookTask *ResolvedNotebookTaskValues `json:"notebook_task,omitempty"` - PythonWheelTask *ResolvedPythonWheelTaskValues `json:"python_wheel_task,omitempty"` - RunJobTask *ResolvedRunJobTaskValues `json:"run_job_task,omitempty"` - SimulationTask *ResolvedParamPairValues `json:"simulation_task,omitempty"` - SparkJarTask *ResolvedStringParamsValues `json:"spark_jar_task,omitempty"` - SparkPythonTask *ResolvedStringParamsValues `json:"spark_python_task,omitempty"` - SparkSubmitTask *ResolvedStringParamsValues `json:"spark_submit_task,omitempty"` - SqlTask *ResolvedParamPairValues `json:"sql_task,omitempty"` -} - -func resolvedValuesFromPb(pb *resolvedValuesPb) (*ResolvedValues, error) { - if pb == nil { - return nil, nil - } - st := &ResolvedValues{} - st.ConditionTask = pb.ConditionTask - st.DbtTask = pb.DbtTask - st.NotebookTask = pb.NotebookTask - st.PythonWheelTask = pb.PythonWheelTask - st.RunJobTask = pb.RunJobTask - st.SimulationTask = pb.SimulationTask - st.SparkJarTask = pb.SparkJarTask - st.SparkPythonTask = pb.SparkPythonTask - st.SparkSubmitTask = pb.SparkSubmitTask - st.SqlTask = pb.SqlTask - - return st, nil -} - -func runToPb(st *Run) (*runPb, error) { - if st == nil { - return nil, nil - } - pb := &runPb{} - pb.AttemptNumber = st.AttemptNumber - pb.CleanupDuration = st.CleanupDuration - pb.ClusterInstance = st.ClusterInstance - pb.ClusterSpec = st.ClusterSpec - pb.CreatorUserName = st.CreatorUserName - pb.Description = st.Description - pb.EffectivePerformanceTarget = st.EffectivePerformanceTarget - pb.EndTime = st.EndTime - pb.ExecutionDuration = st.ExecutionDuration - pb.GitSource = st.GitSource - pb.HasMore = st.HasMore - pb.Iterations = st.Iterations - pb.JobClusters = st.JobClusters - pb.JobId = st.JobId - pb.JobParameters = st.JobParameters - pb.JobRunId = st.JobRunId - pb.NextPageToken = st.NextPageToken - pb.NumberInJob = st.NumberInJob - pb.OriginalAttemptRunId = st.OriginalAttemptRunId - pb.OverridingParameters = st.OverridingParameters - pb.QueueDuration = st.QueueDuration - pb.RepairHistory = st.RepairHistory - pb.RunDuration = st.RunDuration - pb.RunId = st.RunId - pb.RunName = st.RunName - pb.RunPageUrl = st.RunPageUrl - pb.RunType = st.RunType - pb.Schedule = st.Schedule - pb.SetupDuration = st.SetupDuration - pb.StartTime = st.StartTime - pb.State = st.State - pb.Status = st.Status - pb.Tasks = st.Tasks - pb.Trigger = st.Trigger - pb.TriggerInfo = st.TriggerInfo - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type runPb struct { - AttemptNumber int `json:"attempt_number,omitempty"` - CleanupDuration int64 `json:"cleanup_duration,omitempty"` - ClusterInstance *ClusterInstance `json:"cluster_instance,omitempty"` - ClusterSpec *ClusterSpec `json:"cluster_spec,omitempty"` - CreatorUserName string `json:"creator_user_name,omitempty"` - Description string `json:"description,omitempty"` - EffectivePerformanceTarget PerformanceTarget `json:"effective_performance_target,omitempty"` - EndTime int64 `json:"end_time,omitempty"` - ExecutionDuration int64 `json:"execution_duration,omitempty"` - GitSource *GitSource `json:"git_source,omitempty"` - HasMore bool `json:"has_more,omitempty"` - Iterations []RunTask `json:"iterations,omitempty"` - JobClusters []JobCluster `json:"job_clusters,omitempty"` - JobId int64 `json:"job_id,omitempty"` - JobParameters []JobParameter `json:"job_parameters,omitempty"` - JobRunId int64 `json:"job_run_id,omitempty"` - NextPageToken string `json:"next_page_token,omitempty"` - NumberInJob int64 `json:"number_in_job,omitempty"` - OriginalAttemptRunId int64 `json:"original_attempt_run_id,omitempty"` - OverridingParameters *RunParameters `json:"overriding_parameters,omitempty"` - QueueDuration int64 `json:"queue_duration,omitempty"` - RepairHistory []RepairHistoryItem `json:"repair_history,omitempty"` - RunDuration int64 `json:"run_duration,omitempty"` - RunId int64 `json:"run_id,omitempty"` - RunName string `json:"run_name,omitempty"` - RunPageUrl string `json:"run_page_url,omitempty"` - RunType RunType `json:"run_type,omitempty"` - Schedule *CronSchedule `json:"schedule,omitempty"` - SetupDuration int64 `json:"setup_duration,omitempty"` - StartTime int64 `json:"start_time,omitempty"` - State *RunState `json:"state,omitempty"` - Status *RunStatus `json:"status,omitempty"` - Tasks []RunTask `json:"tasks,omitempty"` - Trigger TriggerType `json:"trigger,omitempty"` - TriggerInfo *TriggerInfo `json:"trigger_info,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func runFromPb(pb *runPb) (*Run, error) { - if pb == nil { - return nil, nil - } - st := &Run{} - st.AttemptNumber = pb.AttemptNumber - st.CleanupDuration = pb.CleanupDuration - st.ClusterInstance = pb.ClusterInstance - st.ClusterSpec = pb.ClusterSpec - st.CreatorUserName = pb.CreatorUserName - st.Description = pb.Description - st.EffectivePerformanceTarget = pb.EffectivePerformanceTarget - st.EndTime = pb.EndTime - st.ExecutionDuration = pb.ExecutionDuration - st.GitSource = pb.GitSource - st.HasMore = pb.HasMore - st.Iterations = pb.Iterations - st.JobClusters = pb.JobClusters - st.JobId = pb.JobId - st.JobParameters = pb.JobParameters - st.JobRunId = pb.JobRunId - st.NextPageToken = pb.NextPageToken - st.NumberInJob = pb.NumberInJob - st.OriginalAttemptRunId = pb.OriginalAttemptRunId - st.OverridingParameters = pb.OverridingParameters - st.QueueDuration = pb.QueueDuration - st.RepairHistory = pb.RepairHistory - st.RunDuration = pb.RunDuration - st.RunId = pb.RunId - st.RunName = pb.RunName - st.RunPageUrl = pb.RunPageUrl - st.RunType = pb.RunType - st.Schedule = pb.Schedule - st.SetupDuration = pb.SetupDuration - st.StartTime = pb.StartTime - st.State = pb.State - st.Status = pb.Status - st.Tasks = pb.Tasks - st.Trigger = pb.Trigger - st.TriggerInfo = pb.TriggerInfo - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *runPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st runPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func runConditionTaskToPb(st *RunConditionTask) (*runConditionTaskPb, error) { - if st == nil { - return nil, nil - } - pb := &runConditionTaskPb{} - pb.Left = st.Left - pb.Op = st.Op - pb.Outcome = st.Outcome - pb.Right = st.Right - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type runConditionTaskPb struct { - Left string `json:"left"` - Op ConditionTaskOp `json:"op"` - Outcome string `json:"outcome,omitempty"` - Right string `json:"right"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func runConditionTaskFromPb(pb *runConditionTaskPb) (*RunConditionTask, error) { - if pb == nil { - return nil, nil - } - st := &RunConditionTask{} - st.Left = pb.Left - st.Op = pb.Op - st.Outcome = pb.Outcome - st.Right = pb.Right - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *runConditionTaskPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st runConditionTaskPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func runForEachTaskToPb(st *RunForEachTask) (*runForEachTaskPb, error) { - if st == nil { - return nil, nil - } - pb := &runForEachTaskPb{} - pb.Concurrency = st.Concurrency - pb.Inputs = st.Inputs - pb.Stats = st.Stats - pb.Task = st.Task - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type runForEachTaskPb struct { - Concurrency int `json:"concurrency,omitempty"` - Inputs string `json:"inputs"` - Stats *ForEachStats `json:"stats,omitempty"` - Task Task `json:"task"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func runForEachTaskFromPb(pb *runForEachTaskPb) (*RunForEachTask, error) { - if pb == nil { - return nil, nil - } - st := &RunForEachTask{} - st.Concurrency = pb.Concurrency - st.Inputs = pb.Inputs - st.Stats = pb.Stats - st.Task = pb.Task - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *runForEachTaskPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st runForEachTaskPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func runJobOutputToPb(st *RunJobOutput) (*runJobOutputPb, error) { - if st == nil { - return nil, nil - } - pb := &runJobOutputPb{} - pb.RunId = st.RunId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type runJobOutputPb struct { - RunId int64 `json:"run_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func runJobOutputFromPb(pb *runJobOutputPb) (*RunJobOutput, error) { - if pb == nil { - return nil, nil - } - st := &RunJobOutput{} - st.RunId = pb.RunId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *runJobOutputPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st runJobOutputPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func runJobTaskToPb(st *RunJobTask) (*runJobTaskPb, error) { - if st == nil { - return nil, nil - } - pb := &runJobTaskPb{} - pb.DbtCommands = st.DbtCommands - pb.JarParams = st.JarParams - pb.JobId = st.JobId - pb.JobParameters = st.JobParameters - pb.NotebookParams = st.NotebookParams - pb.PipelineParams = st.PipelineParams - pb.PythonNamedParams = st.PythonNamedParams - pb.PythonParams = st.PythonParams - pb.SparkSubmitParams = st.SparkSubmitParams - pb.SqlParams = st.SqlParams - - return pb, nil -} - -type runJobTaskPb struct { - DbtCommands []string `json:"dbt_commands,omitempty"` - JarParams []string `json:"jar_params,omitempty"` - JobId int64 `json:"job_id"` - JobParameters map[string]string `json:"job_parameters,omitempty"` - NotebookParams map[string]string `json:"notebook_params,omitempty"` - PipelineParams *PipelineParams `json:"pipeline_params,omitempty"` - PythonNamedParams map[string]string `json:"python_named_params,omitempty"` - PythonParams []string `json:"python_params,omitempty"` - SparkSubmitParams []string `json:"spark_submit_params,omitempty"` - SqlParams map[string]string `json:"sql_params,omitempty"` -} - -func runJobTaskFromPb(pb *runJobTaskPb) (*RunJobTask, error) { - if pb == nil { - return nil, nil - } - st := &RunJobTask{} - st.DbtCommands = pb.DbtCommands - st.JarParams = pb.JarParams - st.JobId = pb.JobId - st.JobParameters = pb.JobParameters - st.NotebookParams = pb.NotebookParams - st.PipelineParams = pb.PipelineParams - st.PythonNamedParams = pb.PythonNamedParams - st.PythonParams = pb.PythonParams - st.SparkSubmitParams = pb.SparkSubmitParams - st.SqlParams = pb.SqlParams - - return st, nil -} - -func runNowToPb(st *RunNow) (*runNowPb, error) { - if st == nil { - return nil, nil - } - pb := &runNowPb{} - pb.DbtCommands = st.DbtCommands - pb.IdempotencyToken = st.IdempotencyToken - pb.JarParams = st.JarParams - pb.JobId = st.JobId - pb.JobParameters = st.JobParameters - pb.NotebookParams = st.NotebookParams - pb.Only = st.Only - pb.PerformanceTarget = st.PerformanceTarget - pb.PipelineParams = st.PipelineParams - pb.PythonNamedParams = st.PythonNamedParams - pb.PythonParams = st.PythonParams - pb.Queue = st.Queue - pb.SparkSubmitParams = st.SparkSubmitParams - pb.SqlParams = st.SqlParams - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type runNowPb struct { - DbtCommands []string `json:"dbt_commands,omitempty"` - IdempotencyToken string `json:"idempotency_token,omitempty"` - JarParams []string `json:"jar_params,omitempty"` - JobId int64 `json:"job_id"` - JobParameters map[string]string `json:"job_parameters,omitempty"` - NotebookParams map[string]string `json:"notebook_params,omitempty"` - Only []string `json:"only,omitempty"` - PerformanceTarget PerformanceTarget `json:"performance_target,omitempty"` - PipelineParams *PipelineParams `json:"pipeline_params,omitempty"` - PythonNamedParams map[string]string `json:"python_named_params,omitempty"` - PythonParams []string `json:"python_params,omitempty"` - Queue *QueueSettings `json:"queue,omitempty"` - SparkSubmitParams []string `json:"spark_submit_params,omitempty"` - SqlParams map[string]string `json:"sql_params,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func runNowFromPb(pb *runNowPb) (*RunNow, error) { - if pb == nil { - return nil, nil - } - st := &RunNow{} - st.DbtCommands = pb.DbtCommands - st.IdempotencyToken = pb.IdempotencyToken - st.JarParams = pb.JarParams - st.JobId = pb.JobId - st.JobParameters = pb.JobParameters - st.NotebookParams = pb.NotebookParams - st.Only = pb.Only - st.PerformanceTarget = pb.PerformanceTarget - st.PipelineParams = pb.PipelineParams - st.PythonNamedParams = pb.PythonNamedParams - st.PythonParams = pb.PythonParams - st.Queue = pb.Queue - st.SparkSubmitParams = pb.SparkSubmitParams - st.SqlParams = pb.SqlParams - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *runNowPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st runNowPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func runNowResponseToPb(st *RunNowResponse) (*runNowResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &runNowResponsePb{} - pb.NumberInJob = st.NumberInJob - pb.RunId = st.RunId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type runNowResponsePb struct { - NumberInJob int64 `json:"number_in_job,omitempty"` - RunId int64 `json:"run_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func runNowResponseFromPb(pb *runNowResponsePb) (*RunNowResponse, error) { - if pb == nil { - return nil, nil - } - st := &RunNowResponse{} - st.NumberInJob = pb.NumberInJob - st.RunId = pb.RunId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *runNowResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st runNowResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func runOutputToPb(st *RunOutput) (*runOutputPb, error) { - if st == nil { - return nil, nil - } - pb := &runOutputPb{} - pb.CleanRoomsNotebookOutput = st.CleanRoomsNotebookOutput - pb.DashboardOutput = st.DashboardOutput - pb.DbtCloudOutput = st.DbtCloudOutput - pb.DbtOutput = st.DbtOutput - pb.DbtPlatformOutput = st.DbtPlatformOutput - pb.Error = st.Error - pb.ErrorTrace = st.ErrorTrace - pb.Info = st.Info - pb.Logs = st.Logs - pb.LogsTruncated = st.LogsTruncated - pb.Metadata = st.Metadata - pb.NotebookOutput = st.NotebookOutput - pb.RunJobOutput = st.RunJobOutput - pb.SqlOutput = st.SqlOutput - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type runOutputPb struct { - CleanRoomsNotebookOutput *CleanRoomsNotebookTaskCleanRoomsNotebookTaskOutput `json:"clean_rooms_notebook_output,omitempty"` - DashboardOutput *DashboardTaskOutput `json:"dashboard_output,omitempty"` - DbtCloudOutput *DbtCloudTaskOutput `json:"dbt_cloud_output,omitempty"` - DbtOutput *DbtOutput `json:"dbt_output,omitempty"` - DbtPlatformOutput *DbtPlatformTaskOutput `json:"dbt_platform_output,omitempty"` - Error string `json:"error,omitempty"` - ErrorTrace string `json:"error_trace,omitempty"` - Info string `json:"info,omitempty"` - Logs string `json:"logs,omitempty"` - LogsTruncated bool `json:"logs_truncated,omitempty"` - Metadata *Run `json:"metadata,omitempty"` - NotebookOutput *NotebookOutput `json:"notebook_output,omitempty"` - RunJobOutput *RunJobOutput `json:"run_job_output,omitempty"` - SqlOutput *SqlOutput `json:"sql_output,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func runOutputFromPb(pb *runOutputPb) (*RunOutput, error) { - if pb == nil { - return nil, nil - } - st := &RunOutput{} - st.CleanRoomsNotebookOutput = pb.CleanRoomsNotebookOutput - st.DashboardOutput = pb.DashboardOutput - st.DbtCloudOutput = pb.DbtCloudOutput - st.DbtOutput = pb.DbtOutput - st.DbtPlatformOutput = pb.DbtPlatformOutput - st.Error = pb.Error - st.ErrorTrace = pb.ErrorTrace - st.Info = pb.Info - st.Logs = pb.Logs - st.LogsTruncated = pb.LogsTruncated - st.Metadata = pb.Metadata - st.NotebookOutput = pb.NotebookOutput - st.RunJobOutput = pb.RunJobOutput - st.SqlOutput = pb.SqlOutput - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *runOutputPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st runOutputPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func runParametersToPb(st *RunParameters) (*runParametersPb, error) { - if st == nil { - return nil, nil - } - pb := &runParametersPb{} - pb.DbtCommands = st.DbtCommands - pb.JarParams = st.JarParams - pb.NotebookParams = st.NotebookParams - pb.PipelineParams = st.PipelineParams - pb.PythonNamedParams = st.PythonNamedParams - pb.PythonParams = st.PythonParams - pb.SparkSubmitParams = st.SparkSubmitParams - pb.SqlParams = st.SqlParams - - return pb, nil -} - -type runParametersPb struct { - DbtCommands []string `json:"dbt_commands,omitempty"` - JarParams []string `json:"jar_params,omitempty"` - NotebookParams map[string]string `json:"notebook_params,omitempty"` - PipelineParams *PipelineParams `json:"pipeline_params,omitempty"` - PythonNamedParams map[string]string `json:"python_named_params,omitempty"` - PythonParams []string `json:"python_params,omitempty"` - SparkSubmitParams []string `json:"spark_submit_params,omitempty"` - SqlParams map[string]string `json:"sql_params,omitempty"` -} - -func runParametersFromPb(pb *runParametersPb) (*RunParameters, error) { - if pb == nil { - return nil, nil - } - st := &RunParameters{} - st.DbtCommands = pb.DbtCommands - st.JarParams = pb.JarParams - st.NotebookParams = pb.NotebookParams - st.PipelineParams = pb.PipelineParams - st.PythonNamedParams = pb.PythonNamedParams - st.PythonParams = pb.PythonParams - st.SparkSubmitParams = pb.SparkSubmitParams - st.SqlParams = pb.SqlParams - - return st, nil -} - -func runStateToPb(st *RunState) (*runStatePb, error) { - if st == nil { - return nil, nil - } - pb := &runStatePb{} - pb.LifeCycleState = st.LifeCycleState - pb.QueueReason = st.QueueReason - pb.ResultState = st.ResultState - pb.StateMessage = st.StateMessage - pb.UserCancelledOrTimedout = st.UserCancelledOrTimedout - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type runStatePb struct { - LifeCycleState RunLifeCycleState `json:"life_cycle_state,omitempty"` - QueueReason string `json:"queue_reason,omitempty"` - ResultState RunResultState `json:"result_state,omitempty"` - StateMessage string `json:"state_message,omitempty"` - UserCancelledOrTimedout bool `json:"user_cancelled_or_timedout,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func runStateFromPb(pb *runStatePb) (*RunState, error) { - if pb == nil { - return nil, nil - } - st := &RunState{} - st.LifeCycleState = pb.LifeCycleState - st.QueueReason = pb.QueueReason - st.ResultState = pb.ResultState - st.StateMessage = pb.StateMessage - st.UserCancelledOrTimedout = pb.UserCancelledOrTimedout - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *runStatePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st runStatePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func runStatusToPb(st *RunStatus) (*runStatusPb, error) { - if st == nil { - return nil, nil - } - pb := &runStatusPb{} - pb.QueueDetails = st.QueueDetails - pb.State = st.State - pb.TerminationDetails = st.TerminationDetails - - return pb, nil -} - -type runStatusPb struct { - QueueDetails *QueueDetails `json:"queue_details,omitempty"` - State RunLifecycleStateV2State `json:"state,omitempty"` - TerminationDetails *TerminationDetails `json:"termination_details,omitempty"` -} - -func runStatusFromPb(pb *runStatusPb) (*RunStatus, error) { - if pb == nil { - return nil, nil - } - st := &RunStatus{} - st.QueueDetails = pb.QueueDetails - st.State = pb.State - st.TerminationDetails = pb.TerminationDetails - - return st, nil -} - -func runTaskToPb(st *RunTask) (*runTaskPb, error) { - if st == nil { - return nil, nil - } - pb := &runTaskPb{} - pb.AttemptNumber = st.AttemptNumber - pb.CleanRoomsNotebookTask = st.CleanRoomsNotebookTask - pb.CleanupDuration = st.CleanupDuration - pb.ClusterInstance = st.ClusterInstance - pb.ConditionTask = st.ConditionTask - pb.DashboardTask = st.DashboardTask - pb.DbtCloudTask = st.DbtCloudTask - pb.DbtPlatformTask = st.DbtPlatformTask - pb.DbtTask = st.DbtTask - pb.DependsOn = st.DependsOn - pb.Description = st.Description - pb.Disabled = st.Disabled - pb.EffectivePerformanceTarget = st.EffectivePerformanceTarget - pb.EmailNotifications = st.EmailNotifications - pb.EndTime = st.EndTime - pb.EnvironmentKey = st.EnvironmentKey - pb.ExecutionDuration = st.ExecutionDuration - pb.ExistingClusterId = st.ExistingClusterId - pb.ForEachTask = st.ForEachTask - pb.GenAiComputeTask = st.GenAiComputeTask - pb.GitSource = st.GitSource - pb.JobClusterKey = st.JobClusterKey - pb.Libraries = st.Libraries - pb.NewCluster = st.NewCluster - pb.NotebookTask = st.NotebookTask - pb.NotificationSettings = st.NotificationSettings - pb.PipelineTask = st.PipelineTask - pb.PowerBiTask = st.PowerBiTask - pb.PythonWheelTask = st.PythonWheelTask - pb.QueueDuration = st.QueueDuration - pb.ResolvedValues = st.ResolvedValues - pb.RunDuration = st.RunDuration - pb.RunId = st.RunId - pb.RunIf = st.RunIf - pb.RunJobTask = st.RunJobTask - pb.RunPageUrl = st.RunPageUrl - pb.SetupDuration = st.SetupDuration - pb.SparkJarTask = st.SparkJarTask - pb.SparkPythonTask = st.SparkPythonTask - pb.SparkSubmitTask = st.SparkSubmitTask - pb.SqlTask = st.SqlTask - pb.StartTime = st.StartTime - pb.State = st.State - pb.Status = st.Status - pb.TaskKey = st.TaskKey - pb.TimeoutSeconds = st.TimeoutSeconds - pb.WebhookNotifications = st.WebhookNotifications - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type runTaskPb struct { - AttemptNumber int `json:"attempt_number,omitempty"` - CleanRoomsNotebookTask *CleanRoomsNotebookTask `json:"clean_rooms_notebook_task,omitempty"` - CleanupDuration int64 `json:"cleanup_duration,omitempty"` - ClusterInstance *ClusterInstance `json:"cluster_instance,omitempty"` - ConditionTask *RunConditionTask `json:"condition_task,omitempty"` - DashboardTask *DashboardTask `json:"dashboard_task,omitempty"` - DbtCloudTask *DbtCloudTask `json:"dbt_cloud_task,omitempty"` - DbtPlatformTask *DbtPlatformTask `json:"dbt_platform_task,omitempty"` - DbtTask *DbtTask `json:"dbt_task,omitempty"` - DependsOn []TaskDependency `json:"depends_on,omitempty"` - Description string `json:"description,omitempty"` - Disabled bool `json:"disabled,omitempty"` - EffectivePerformanceTarget PerformanceTarget `json:"effective_performance_target,omitempty"` - EmailNotifications *JobEmailNotifications `json:"email_notifications,omitempty"` - EndTime int64 `json:"end_time,omitempty"` - EnvironmentKey string `json:"environment_key,omitempty"` - ExecutionDuration int64 `json:"execution_duration,omitempty"` - ExistingClusterId string `json:"existing_cluster_id,omitempty"` - ForEachTask *RunForEachTask `json:"for_each_task,omitempty"` - GenAiComputeTask *GenAiComputeTask `json:"gen_ai_compute_task,omitempty"` - GitSource *GitSource `json:"git_source,omitempty"` - JobClusterKey string `json:"job_cluster_key,omitempty"` - Libraries []compute.Library `json:"libraries,omitempty"` - NewCluster *compute.ClusterSpec `json:"new_cluster,omitempty"` - NotebookTask *NotebookTask `json:"notebook_task,omitempty"` - NotificationSettings *TaskNotificationSettings `json:"notification_settings,omitempty"` - PipelineTask *PipelineTask `json:"pipeline_task,omitempty"` - PowerBiTask *PowerBiTask `json:"power_bi_task,omitempty"` - PythonWheelTask *PythonWheelTask `json:"python_wheel_task,omitempty"` - QueueDuration int64 `json:"queue_duration,omitempty"` - ResolvedValues *ResolvedValues `json:"resolved_values,omitempty"` - RunDuration int64 `json:"run_duration,omitempty"` - RunId int64 `json:"run_id,omitempty"` - RunIf RunIf `json:"run_if,omitempty"` - RunJobTask *RunJobTask `json:"run_job_task,omitempty"` - RunPageUrl string `json:"run_page_url,omitempty"` - SetupDuration int64 `json:"setup_duration,omitempty"` - SparkJarTask *SparkJarTask `json:"spark_jar_task,omitempty"` - SparkPythonTask *SparkPythonTask `json:"spark_python_task,omitempty"` - SparkSubmitTask *SparkSubmitTask `json:"spark_submit_task,omitempty"` - SqlTask *SqlTask `json:"sql_task,omitempty"` - StartTime int64 `json:"start_time,omitempty"` - State *RunState `json:"state,omitempty"` - Status *RunStatus `json:"status,omitempty"` - TaskKey string `json:"task_key"` - TimeoutSeconds int `json:"timeout_seconds,omitempty"` - WebhookNotifications *WebhookNotifications `json:"webhook_notifications,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func runTaskFromPb(pb *runTaskPb) (*RunTask, error) { - if pb == nil { - return nil, nil - } - st := &RunTask{} - st.AttemptNumber = pb.AttemptNumber - st.CleanRoomsNotebookTask = pb.CleanRoomsNotebookTask - st.CleanupDuration = pb.CleanupDuration - st.ClusterInstance = pb.ClusterInstance - st.ConditionTask = pb.ConditionTask - st.DashboardTask = pb.DashboardTask - st.DbtCloudTask = pb.DbtCloudTask - st.DbtPlatformTask = pb.DbtPlatformTask - st.DbtTask = pb.DbtTask - st.DependsOn = pb.DependsOn - st.Description = pb.Description - st.Disabled = pb.Disabled - st.EffectivePerformanceTarget = pb.EffectivePerformanceTarget - st.EmailNotifications = pb.EmailNotifications - st.EndTime = pb.EndTime - st.EnvironmentKey = pb.EnvironmentKey - st.ExecutionDuration = pb.ExecutionDuration - st.ExistingClusterId = pb.ExistingClusterId - st.ForEachTask = pb.ForEachTask - st.GenAiComputeTask = pb.GenAiComputeTask - st.GitSource = pb.GitSource - st.JobClusterKey = pb.JobClusterKey - st.Libraries = pb.Libraries - st.NewCluster = pb.NewCluster - st.NotebookTask = pb.NotebookTask - st.NotificationSettings = pb.NotificationSettings - st.PipelineTask = pb.PipelineTask - st.PowerBiTask = pb.PowerBiTask - st.PythonWheelTask = pb.PythonWheelTask - st.QueueDuration = pb.QueueDuration - st.ResolvedValues = pb.ResolvedValues - st.RunDuration = pb.RunDuration - st.RunId = pb.RunId - st.RunIf = pb.RunIf - st.RunJobTask = pb.RunJobTask - st.RunPageUrl = pb.RunPageUrl - st.SetupDuration = pb.SetupDuration - st.SparkJarTask = pb.SparkJarTask - st.SparkPythonTask = pb.SparkPythonTask - st.SparkSubmitTask = pb.SparkSubmitTask - st.SqlTask = pb.SqlTask - st.StartTime = pb.StartTime - st.State = pb.State - st.Status = pb.Status - st.TaskKey = pb.TaskKey - st.TimeoutSeconds = pb.TimeoutSeconds - st.WebhookNotifications = pb.WebhookNotifications - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *runTaskPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st runTaskPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func sparkJarTaskToPb(st *SparkJarTask) (*sparkJarTaskPb, error) { - if st == nil { - return nil, nil - } - pb := &sparkJarTaskPb{} - pb.JarUri = st.JarUri - pb.MainClassName = st.MainClassName - pb.Parameters = st.Parameters - pb.RunAsRepl = st.RunAsRepl - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type sparkJarTaskPb struct { - JarUri string `json:"jar_uri,omitempty"` - MainClassName string `json:"main_class_name,omitempty"` - Parameters []string `json:"parameters,omitempty"` - RunAsRepl bool `json:"run_as_repl,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func sparkJarTaskFromPb(pb *sparkJarTaskPb) (*SparkJarTask, error) { - if pb == nil { - return nil, nil - } - st := &SparkJarTask{} - st.JarUri = pb.JarUri - st.MainClassName = pb.MainClassName - st.Parameters = pb.Parameters - st.RunAsRepl = pb.RunAsRepl - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *sparkJarTaskPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st sparkJarTaskPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func sparkPythonTaskToPb(st *SparkPythonTask) (*sparkPythonTaskPb, error) { - if st == nil { - return nil, nil - } - pb := &sparkPythonTaskPb{} - pb.Parameters = st.Parameters - pb.PythonFile = st.PythonFile - pb.Source = st.Source - - return pb, nil -} - -type sparkPythonTaskPb struct { - Parameters []string `json:"parameters,omitempty"` - PythonFile string `json:"python_file"` - Source Source `json:"source,omitempty"` -} - -func sparkPythonTaskFromPb(pb *sparkPythonTaskPb) (*SparkPythonTask, error) { - if pb == nil { - return nil, nil - } - st := &SparkPythonTask{} - st.Parameters = pb.Parameters - st.PythonFile = pb.PythonFile - st.Source = pb.Source - - return st, nil -} - -func sparkSubmitTaskToPb(st *SparkSubmitTask) (*sparkSubmitTaskPb, error) { - if st == nil { - return nil, nil - } - pb := &sparkSubmitTaskPb{} - pb.Parameters = st.Parameters - - return pb, nil -} - -type sparkSubmitTaskPb struct { - Parameters []string `json:"parameters,omitempty"` -} - -func sparkSubmitTaskFromPb(pb *sparkSubmitTaskPb) (*SparkSubmitTask, error) { - if pb == nil { - return nil, nil - } - st := &SparkSubmitTask{} - st.Parameters = pb.Parameters - - return st, nil -} - -func sqlAlertOutputToPb(st *SqlAlertOutput) (*sqlAlertOutputPb, error) { - if st == nil { - return nil, nil - } - pb := &sqlAlertOutputPb{} - pb.AlertState = st.AlertState - pb.OutputLink = st.OutputLink - pb.QueryText = st.QueryText - pb.SqlStatements = st.SqlStatements - pb.WarehouseId = st.WarehouseId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type sqlAlertOutputPb struct { - AlertState SqlAlertState `json:"alert_state,omitempty"` - OutputLink string `json:"output_link,omitempty"` - QueryText string `json:"query_text,omitempty"` - SqlStatements []SqlStatementOutput `json:"sql_statements,omitempty"` - WarehouseId string `json:"warehouse_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func sqlAlertOutputFromPb(pb *sqlAlertOutputPb) (*SqlAlertOutput, error) { - if pb == nil { - return nil, nil - } - st := &SqlAlertOutput{} - st.AlertState = pb.AlertState - st.OutputLink = pb.OutputLink - st.QueryText = pb.QueryText - st.SqlStatements = pb.SqlStatements - st.WarehouseId = pb.WarehouseId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *sqlAlertOutputPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st sqlAlertOutputPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func sqlDashboardOutputToPb(st *SqlDashboardOutput) (*sqlDashboardOutputPb, error) { - if st == nil { - return nil, nil - } - pb := &sqlDashboardOutputPb{} - pb.WarehouseId = st.WarehouseId - pb.Widgets = st.Widgets - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type sqlDashboardOutputPb struct { - WarehouseId string `json:"warehouse_id,omitempty"` - Widgets []SqlDashboardWidgetOutput `json:"widgets,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func sqlDashboardOutputFromPb(pb *sqlDashboardOutputPb) (*SqlDashboardOutput, error) { - if pb == nil { - return nil, nil - } - st := &SqlDashboardOutput{} - st.WarehouseId = pb.WarehouseId - st.Widgets = pb.Widgets - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *sqlDashboardOutputPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st sqlDashboardOutputPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func sqlDashboardWidgetOutputToPb(st *SqlDashboardWidgetOutput) (*sqlDashboardWidgetOutputPb, error) { - if st == nil { - return nil, nil - } - pb := &sqlDashboardWidgetOutputPb{} - pb.EndTime = st.EndTime - pb.Error = st.Error - pb.OutputLink = st.OutputLink - pb.StartTime = st.StartTime - pb.Status = st.Status - pb.WidgetId = st.WidgetId - pb.WidgetTitle = st.WidgetTitle - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type sqlDashboardWidgetOutputPb struct { - EndTime int64 `json:"end_time,omitempty"` - Error *SqlOutputError `json:"error,omitempty"` - OutputLink string `json:"output_link,omitempty"` - StartTime int64 `json:"start_time,omitempty"` - Status SqlDashboardWidgetOutputStatus `json:"status,omitempty"` - WidgetId string `json:"widget_id,omitempty"` - WidgetTitle string `json:"widget_title,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func sqlDashboardWidgetOutputFromPb(pb *sqlDashboardWidgetOutputPb) (*SqlDashboardWidgetOutput, error) { - if pb == nil { - return nil, nil - } - st := &SqlDashboardWidgetOutput{} - st.EndTime = pb.EndTime - st.Error = pb.Error - st.OutputLink = pb.OutputLink - st.StartTime = pb.StartTime - st.Status = pb.Status - st.WidgetId = pb.WidgetId - st.WidgetTitle = pb.WidgetTitle - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *sqlDashboardWidgetOutputPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st sqlDashboardWidgetOutputPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func sqlOutputToPb(st *SqlOutput) (*sqlOutputPb, error) { - if st == nil { - return nil, nil - } - pb := &sqlOutputPb{} - pb.AlertOutput = st.AlertOutput - pb.DashboardOutput = st.DashboardOutput - pb.QueryOutput = st.QueryOutput - - return pb, nil -} - -type sqlOutputPb struct { - AlertOutput *SqlAlertOutput `json:"alert_output,omitempty"` - DashboardOutput *SqlDashboardOutput `json:"dashboard_output,omitempty"` - QueryOutput *SqlQueryOutput `json:"query_output,omitempty"` -} - -func sqlOutputFromPb(pb *sqlOutputPb) (*SqlOutput, error) { - if pb == nil { - return nil, nil - } - st := &SqlOutput{} - st.AlertOutput = pb.AlertOutput - st.DashboardOutput = pb.DashboardOutput - st.QueryOutput = pb.QueryOutput - - return st, nil -} - -func sqlOutputErrorToPb(st *SqlOutputError) (*sqlOutputErrorPb, error) { - if st == nil { - return nil, nil - } - pb := &sqlOutputErrorPb{} - pb.Message = st.Message - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type sqlOutputErrorPb struct { - Message string `json:"message,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func sqlOutputErrorFromPb(pb *sqlOutputErrorPb) (*SqlOutputError, error) { - if pb == nil { - return nil, nil - } - st := &SqlOutputError{} - st.Message = pb.Message - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *sqlOutputErrorPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st sqlOutputErrorPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func sqlQueryOutputToPb(st *SqlQueryOutput) (*sqlQueryOutputPb, error) { - if st == nil { - return nil, nil - } - pb := &sqlQueryOutputPb{} - pb.EndpointId = st.EndpointId - pb.OutputLink = st.OutputLink - pb.QueryText = st.QueryText - pb.SqlStatements = st.SqlStatements - pb.WarehouseId = st.WarehouseId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type sqlQueryOutputPb struct { - EndpointId string `json:"endpoint_id,omitempty"` - OutputLink string `json:"output_link,omitempty"` - QueryText string `json:"query_text,omitempty"` - SqlStatements []SqlStatementOutput `json:"sql_statements,omitempty"` - WarehouseId string `json:"warehouse_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func sqlQueryOutputFromPb(pb *sqlQueryOutputPb) (*SqlQueryOutput, error) { - if pb == nil { - return nil, nil - } - st := &SqlQueryOutput{} - st.EndpointId = pb.EndpointId - st.OutputLink = pb.OutputLink - st.QueryText = pb.QueryText - st.SqlStatements = pb.SqlStatements - st.WarehouseId = pb.WarehouseId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *sqlQueryOutputPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st sqlQueryOutputPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func sqlStatementOutputToPb(st *SqlStatementOutput) (*sqlStatementOutputPb, error) { - if st == nil { - return nil, nil - } - pb := &sqlStatementOutputPb{} - pb.LookupKey = st.LookupKey - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type sqlStatementOutputPb struct { - LookupKey string `json:"lookup_key,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func sqlStatementOutputFromPb(pb *sqlStatementOutputPb) (*SqlStatementOutput, error) { - if pb == nil { - return nil, nil - } - st := &SqlStatementOutput{} - st.LookupKey = pb.LookupKey - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *sqlStatementOutputPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st sqlStatementOutputPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func sqlTaskToPb(st *SqlTask) (*sqlTaskPb, error) { - if st == nil { - return nil, nil - } - pb := &sqlTaskPb{} - pb.Alert = st.Alert - pb.Dashboard = st.Dashboard - pb.File = st.File - pb.Parameters = st.Parameters - pb.Query = st.Query - pb.WarehouseId = st.WarehouseId - - return pb, nil -} - -type sqlTaskPb struct { - Alert *SqlTaskAlert `json:"alert,omitempty"` - Dashboard *SqlTaskDashboard `json:"dashboard,omitempty"` - File *SqlTaskFile `json:"file,omitempty"` - Parameters map[string]string `json:"parameters,omitempty"` - Query *SqlTaskQuery `json:"query,omitempty"` - WarehouseId string `json:"warehouse_id"` -} - -func sqlTaskFromPb(pb *sqlTaskPb) (*SqlTask, error) { - if pb == nil { - return nil, nil - } - st := &SqlTask{} - st.Alert = pb.Alert - st.Dashboard = pb.Dashboard - st.File = pb.File - st.Parameters = pb.Parameters - st.Query = pb.Query - st.WarehouseId = pb.WarehouseId - - return st, nil -} - -func sqlTaskAlertToPb(st *SqlTaskAlert) (*sqlTaskAlertPb, error) { - if st == nil { - return nil, nil - } - pb := &sqlTaskAlertPb{} - pb.AlertId = st.AlertId - pb.PauseSubscriptions = st.PauseSubscriptions - pb.Subscriptions = st.Subscriptions - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type sqlTaskAlertPb struct { - AlertId string `json:"alert_id"` - PauseSubscriptions bool `json:"pause_subscriptions,omitempty"` - Subscriptions []SqlTaskSubscription `json:"subscriptions,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func sqlTaskAlertFromPb(pb *sqlTaskAlertPb) (*SqlTaskAlert, error) { - if pb == nil { - return nil, nil - } - st := &SqlTaskAlert{} - st.AlertId = pb.AlertId - st.PauseSubscriptions = pb.PauseSubscriptions - st.Subscriptions = pb.Subscriptions - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *sqlTaskAlertPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st sqlTaskAlertPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func sqlTaskDashboardToPb(st *SqlTaskDashboard) (*sqlTaskDashboardPb, error) { - if st == nil { - return nil, nil - } - pb := &sqlTaskDashboardPb{} - pb.CustomSubject = st.CustomSubject - pb.DashboardId = st.DashboardId - pb.PauseSubscriptions = st.PauseSubscriptions - pb.Subscriptions = st.Subscriptions - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type sqlTaskDashboardPb struct { - CustomSubject string `json:"custom_subject,omitempty"` - DashboardId string `json:"dashboard_id"` - PauseSubscriptions bool `json:"pause_subscriptions,omitempty"` - Subscriptions []SqlTaskSubscription `json:"subscriptions,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func sqlTaskDashboardFromPb(pb *sqlTaskDashboardPb) (*SqlTaskDashboard, error) { - if pb == nil { - return nil, nil - } - st := &SqlTaskDashboard{} - st.CustomSubject = pb.CustomSubject - st.DashboardId = pb.DashboardId - st.PauseSubscriptions = pb.PauseSubscriptions - st.Subscriptions = pb.Subscriptions - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *sqlTaskDashboardPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st sqlTaskDashboardPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func sqlTaskFileToPb(st *SqlTaskFile) (*sqlTaskFilePb, error) { - if st == nil { - return nil, nil - } - pb := &sqlTaskFilePb{} - pb.Path = st.Path - pb.Source = st.Source - - return pb, nil -} - -type sqlTaskFilePb struct { - Path string `json:"path"` - Source Source `json:"source,omitempty"` -} - -func sqlTaskFileFromPb(pb *sqlTaskFilePb) (*SqlTaskFile, error) { - if pb == nil { - return nil, nil - } - st := &SqlTaskFile{} - st.Path = pb.Path - st.Source = pb.Source - - return st, nil -} - -func sqlTaskQueryToPb(st *SqlTaskQuery) (*sqlTaskQueryPb, error) { - if st == nil { - return nil, nil - } - pb := &sqlTaskQueryPb{} - pb.QueryId = st.QueryId - - return pb, nil -} - -type sqlTaskQueryPb struct { - QueryId string `json:"query_id"` -} - -func sqlTaskQueryFromPb(pb *sqlTaskQueryPb) (*SqlTaskQuery, error) { - if pb == nil { - return nil, nil - } - st := &SqlTaskQuery{} - st.QueryId = pb.QueryId - - return st, nil -} - -func sqlTaskSubscriptionToPb(st *SqlTaskSubscription) (*sqlTaskSubscriptionPb, error) { - if st == nil { - return nil, nil - } - pb := &sqlTaskSubscriptionPb{} - pb.DestinationId = st.DestinationId - pb.UserName = st.UserName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type sqlTaskSubscriptionPb struct { - DestinationId string `json:"destination_id,omitempty"` - UserName string `json:"user_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func sqlTaskSubscriptionFromPb(pb *sqlTaskSubscriptionPb) (*SqlTaskSubscription, error) { - if pb == nil { - return nil, nil - } - st := &SqlTaskSubscription{} - st.DestinationId = pb.DestinationId - st.UserName = pb.UserName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *sqlTaskSubscriptionPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st sqlTaskSubscriptionPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func submitRunToPb(st *SubmitRun) (*submitRunPb, error) { - if st == nil { - return nil, nil - } - pb := &submitRunPb{} - pb.AccessControlList = st.AccessControlList - pb.BudgetPolicyId = st.BudgetPolicyId - pb.EmailNotifications = st.EmailNotifications - pb.Environments = st.Environments - pb.GitSource = st.GitSource - pb.Health = st.Health - pb.IdempotencyToken = st.IdempotencyToken - pb.NotificationSettings = st.NotificationSettings - pb.Queue = st.Queue - pb.RunAs = st.RunAs - pb.RunName = st.RunName - pb.Tasks = st.Tasks - pb.TimeoutSeconds = st.TimeoutSeconds - pb.WebhookNotifications = st.WebhookNotifications - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type submitRunPb struct { - AccessControlList []JobAccessControlRequest `json:"access_control_list,omitempty"` - BudgetPolicyId string `json:"budget_policy_id,omitempty"` - EmailNotifications *JobEmailNotifications `json:"email_notifications,omitempty"` - Environments []JobEnvironment `json:"environments,omitempty"` - GitSource *GitSource `json:"git_source,omitempty"` - Health *JobsHealthRules `json:"health,omitempty"` - IdempotencyToken string `json:"idempotency_token,omitempty"` - NotificationSettings *JobNotificationSettings `json:"notification_settings,omitempty"` - Queue *QueueSettings `json:"queue,omitempty"` - RunAs *JobRunAs `json:"run_as,omitempty"` - RunName string `json:"run_name,omitempty"` - Tasks []SubmitTask `json:"tasks,omitempty"` - TimeoutSeconds int `json:"timeout_seconds,omitempty"` - WebhookNotifications *WebhookNotifications `json:"webhook_notifications,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func submitRunFromPb(pb *submitRunPb) (*SubmitRun, error) { - if pb == nil { - return nil, nil - } - st := &SubmitRun{} - st.AccessControlList = pb.AccessControlList - st.BudgetPolicyId = pb.BudgetPolicyId - st.EmailNotifications = pb.EmailNotifications - st.Environments = pb.Environments - st.GitSource = pb.GitSource - st.Health = pb.Health - st.IdempotencyToken = pb.IdempotencyToken - st.NotificationSettings = pb.NotificationSettings - st.Queue = pb.Queue - st.RunAs = pb.RunAs - st.RunName = pb.RunName - st.Tasks = pb.Tasks - st.TimeoutSeconds = pb.TimeoutSeconds - st.WebhookNotifications = pb.WebhookNotifications - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *submitRunPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st submitRunPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func submitRunResponseToPb(st *SubmitRunResponse) (*submitRunResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &submitRunResponsePb{} - pb.RunId = st.RunId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type submitRunResponsePb struct { - RunId int64 `json:"run_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func submitRunResponseFromPb(pb *submitRunResponsePb) (*SubmitRunResponse, error) { - if pb == nil { - return nil, nil - } - st := &SubmitRunResponse{} - st.RunId = pb.RunId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *submitRunResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st submitRunResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func submitTaskToPb(st *SubmitTask) (*submitTaskPb, error) { - if st == nil { - return nil, nil - } - pb := &submitTaskPb{} - pb.CleanRoomsNotebookTask = st.CleanRoomsNotebookTask - pb.ConditionTask = st.ConditionTask - pb.DashboardTask = st.DashboardTask - pb.DbtCloudTask = st.DbtCloudTask - pb.DbtPlatformTask = st.DbtPlatformTask - pb.DbtTask = st.DbtTask - pb.DependsOn = st.DependsOn - pb.Description = st.Description - pb.EmailNotifications = st.EmailNotifications - pb.EnvironmentKey = st.EnvironmentKey - pb.ExistingClusterId = st.ExistingClusterId - pb.ForEachTask = st.ForEachTask - pb.GenAiComputeTask = st.GenAiComputeTask - pb.Health = st.Health - pb.Libraries = st.Libraries - pb.NewCluster = st.NewCluster - pb.NotebookTask = st.NotebookTask - pb.NotificationSettings = st.NotificationSettings - pb.PipelineTask = st.PipelineTask - pb.PowerBiTask = st.PowerBiTask - pb.PythonWheelTask = st.PythonWheelTask - pb.RunIf = st.RunIf - pb.RunJobTask = st.RunJobTask - pb.SparkJarTask = st.SparkJarTask - pb.SparkPythonTask = st.SparkPythonTask - pb.SparkSubmitTask = st.SparkSubmitTask - pb.SqlTask = st.SqlTask - pb.TaskKey = st.TaskKey - pb.TimeoutSeconds = st.TimeoutSeconds - pb.WebhookNotifications = st.WebhookNotifications - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type submitTaskPb struct { - CleanRoomsNotebookTask *CleanRoomsNotebookTask `json:"clean_rooms_notebook_task,omitempty"` - ConditionTask *ConditionTask `json:"condition_task,omitempty"` - DashboardTask *DashboardTask `json:"dashboard_task,omitempty"` - DbtCloudTask *DbtCloudTask `json:"dbt_cloud_task,omitempty"` - DbtPlatformTask *DbtPlatformTask `json:"dbt_platform_task,omitempty"` - DbtTask *DbtTask `json:"dbt_task,omitempty"` - DependsOn []TaskDependency `json:"depends_on,omitempty"` - Description string `json:"description,omitempty"` - EmailNotifications *JobEmailNotifications `json:"email_notifications,omitempty"` - EnvironmentKey string `json:"environment_key,omitempty"` - ExistingClusterId string `json:"existing_cluster_id,omitempty"` - ForEachTask *ForEachTask `json:"for_each_task,omitempty"` - GenAiComputeTask *GenAiComputeTask `json:"gen_ai_compute_task,omitempty"` - Health *JobsHealthRules `json:"health,omitempty"` - Libraries []compute.Library `json:"libraries,omitempty"` - NewCluster *compute.ClusterSpec `json:"new_cluster,omitempty"` - NotebookTask *NotebookTask `json:"notebook_task,omitempty"` - NotificationSettings *TaskNotificationSettings `json:"notification_settings,omitempty"` - PipelineTask *PipelineTask `json:"pipeline_task,omitempty"` - PowerBiTask *PowerBiTask `json:"power_bi_task,omitempty"` - PythonWheelTask *PythonWheelTask `json:"python_wheel_task,omitempty"` - RunIf RunIf `json:"run_if,omitempty"` - RunJobTask *RunJobTask `json:"run_job_task,omitempty"` - SparkJarTask *SparkJarTask `json:"spark_jar_task,omitempty"` - SparkPythonTask *SparkPythonTask `json:"spark_python_task,omitempty"` - SparkSubmitTask *SparkSubmitTask `json:"spark_submit_task,omitempty"` - SqlTask *SqlTask `json:"sql_task,omitempty"` - TaskKey string `json:"task_key"` - TimeoutSeconds int `json:"timeout_seconds,omitempty"` - WebhookNotifications *WebhookNotifications `json:"webhook_notifications,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func submitTaskFromPb(pb *submitTaskPb) (*SubmitTask, error) { - if pb == nil { - return nil, nil - } - st := &SubmitTask{} - st.CleanRoomsNotebookTask = pb.CleanRoomsNotebookTask - st.ConditionTask = pb.ConditionTask - st.DashboardTask = pb.DashboardTask - st.DbtCloudTask = pb.DbtCloudTask - st.DbtPlatformTask = pb.DbtPlatformTask - st.DbtTask = pb.DbtTask - st.DependsOn = pb.DependsOn - st.Description = pb.Description - st.EmailNotifications = pb.EmailNotifications - st.EnvironmentKey = pb.EnvironmentKey - st.ExistingClusterId = pb.ExistingClusterId - st.ForEachTask = pb.ForEachTask - st.GenAiComputeTask = pb.GenAiComputeTask - st.Health = pb.Health - st.Libraries = pb.Libraries - st.NewCluster = pb.NewCluster - st.NotebookTask = pb.NotebookTask - st.NotificationSettings = pb.NotificationSettings - st.PipelineTask = pb.PipelineTask - st.PowerBiTask = pb.PowerBiTask - st.PythonWheelTask = pb.PythonWheelTask - st.RunIf = pb.RunIf - st.RunJobTask = pb.RunJobTask - st.SparkJarTask = pb.SparkJarTask - st.SparkPythonTask = pb.SparkPythonTask - st.SparkSubmitTask = pb.SparkSubmitTask - st.SqlTask = pb.SqlTask - st.TaskKey = pb.TaskKey - st.TimeoutSeconds = pb.TimeoutSeconds - st.WebhookNotifications = pb.WebhookNotifications - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *submitTaskPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st submitTaskPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func subscriptionToPb(st *Subscription) (*subscriptionPb, error) { - if st == nil { - return nil, nil - } - pb := &subscriptionPb{} - pb.CustomSubject = st.CustomSubject - pb.Paused = st.Paused - pb.Subscribers = st.Subscribers - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type subscriptionPb struct { - CustomSubject string `json:"custom_subject,omitempty"` - Paused bool `json:"paused,omitempty"` - Subscribers []SubscriptionSubscriber `json:"subscribers,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func subscriptionFromPb(pb *subscriptionPb) (*Subscription, error) { - if pb == nil { - return nil, nil - } - st := &Subscription{} - st.CustomSubject = pb.CustomSubject - st.Paused = pb.Paused - st.Subscribers = pb.Subscribers - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *subscriptionPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st subscriptionPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func subscriptionSubscriberToPb(st *SubscriptionSubscriber) (*subscriptionSubscriberPb, error) { - if st == nil { - return nil, nil - } - pb := &subscriptionSubscriberPb{} - pb.DestinationId = st.DestinationId - pb.UserName = st.UserName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type subscriptionSubscriberPb struct { - DestinationId string `json:"destination_id,omitempty"` - UserName string `json:"user_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func subscriptionSubscriberFromPb(pb *subscriptionSubscriberPb) (*SubscriptionSubscriber, error) { - if pb == nil { - return nil, nil - } - st := &SubscriptionSubscriber{} - st.DestinationId = pb.DestinationId - st.UserName = pb.UserName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *subscriptionSubscriberPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st subscriptionSubscriberPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func tableUpdateTriggerConfigurationToPb(st *TableUpdateTriggerConfiguration) (*tableUpdateTriggerConfigurationPb, error) { - if st == nil { - return nil, nil - } - pb := &tableUpdateTriggerConfigurationPb{} - pb.Condition = st.Condition - pb.MinTimeBetweenTriggersSeconds = st.MinTimeBetweenTriggersSeconds - pb.TableNames = st.TableNames - pb.WaitAfterLastChangeSeconds = st.WaitAfterLastChangeSeconds - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type tableUpdateTriggerConfigurationPb struct { - Condition Condition `json:"condition,omitempty"` - MinTimeBetweenTriggersSeconds int `json:"min_time_between_triggers_seconds,omitempty"` - TableNames []string `json:"table_names,omitempty"` - WaitAfterLastChangeSeconds int `json:"wait_after_last_change_seconds,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func tableUpdateTriggerConfigurationFromPb(pb *tableUpdateTriggerConfigurationPb) (*TableUpdateTriggerConfiguration, error) { - if pb == nil { - return nil, nil - } - st := &TableUpdateTriggerConfiguration{} - st.Condition = pb.Condition - st.MinTimeBetweenTriggersSeconds = pb.MinTimeBetweenTriggersSeconds - st.TableNames = pb.TableNames - st.WaitAfterLastChangeSeconds = pb.WaitAfterLastChangeSeconds - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *tableUpdateTriggerConfigurationPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st tableUpdateTriggerConfigurationPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func taskToPb(st *Task) (*taskPb, error) { - if st == nil { - return nil, nil - } - pb := &taskPb{} - pb.CleanRoomsNotebookTask = st.CleanRoomsNotebookTask - pb.ConditionTask = st.ConditionTask - pb.DashboardTask = st.DashboardTask - pb.DbtCloudTask = st.DbtCloudTask - pb.DbtPlatformTask = st.DbtPlatformTask - pb.DbtTask = st.DbtTask - pb.DependsOn = st.DependsOn - pb.Description = st.Description - pb.DisableAutoOptimization = st.DisableAutoOptimization - pb.EmailNotifications = st.EmailNotifications - pb.EnvironmentKey = st.EnvironmentKey - pb.ExistingClusterId = st.ExistingClusterId - pb.ForEachTask = st.ForEachTask - pb.GenAiComputeTask = st.GenAiComputeTask - pb.Health = st.Health - pb.JobClusterKey = st.JobClusterKey - pb.Libraries = st.Libraries - pb.MaxRetries = st.MaxRetries - pb.MinRetryIntervalMillis = st.MinRetryIntervalMillis - pb.NewCluster = st.NewCluster - pb.NotebookTask = st.NotebookTask - pb.NotificationSettings = st.NotificationSettings - pb.PipelineTask = st.PipelineTask - pb.PowerBiTask = st.PowerBiTask - pb.PythonWheelTask = st.PythonWheelTask - pb.RetryOnTimeout = st.RetryOnTimeout - pb.RunIf = st.RunIf - pb.RunJobTask = st.RunJobTask - pb.SparkJarTask = st.SparkJarTask - pb.SparkPythonTask = st.SparkPythonTask - pb.SparkSubmitTask = st.SparkSubmitTask - pb.SqlTask = st.SqlTask - pb.TaskKey = st.TaskKey - pb.TimeoutSeconds = st.TimeoutSeconds - pb.WebhookNotifications = st.WebhookNotifications - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type taskPb struct { - CleanRoomsNotebookTask *CleanRoomsNotebookTask `json:"clean_rooms_notebook_task,omitempty"` - ConditionTask *ConditionTask `json:"condition_task,omitempty"` - DashboardTask *DashboardTask `json:"dashboard_task,omitempty"` - DbtCloudTask *DbtCloudTask `json:"dbt_cloud_task,omitempty"` - DbtPlatformTask *DbtPlatformTask `json:"dbt_platform_task,omitempty"` - DbtTask *DbtTask `json:"dbt_task,omitempty"` - DependsOn []TaskDependency `json:"depends_on,omitempty"` - Description string `json:"description,omitempty"` - DisableAutoOptimization bool `json:"disable_auto_optimization,omitempty"` - EmailNotifications *TaskEmailNotifications `json:"email_notifications,omitempty"` - EnvironmentKey string `json:"environment_key,omitempty"` - ExistingClusterId string `json:"existing_cluster_id,omitempty"` - ForEachTask *ForEachTask `json:"for_each_task,omitempty"` - GenAiComputeTask *GenAiComputeTask `json:"gen_ai_compute_task,omitempty"` - Health *JobsHealthRules `json:"health,omitempty"` - JobClusterKey string `json:"job_cluster_key,omitempty"` - Libraries []compute.Library `json:"libraries,omitempty"` - MaxRetries int `json:"max_retries,omitempty"` - MinRetryIntervalMillis int `json:"min_retry_interval_millis,omitempty"` - NewCluster *compute.ClusterSpec `json:"new_cluster,omitempty"` - NotebookTask *NotebookTask `json:"notebook_task,omitempty"` - NotificationSettings *TaskNotificationSettings `json:"notification_settings,omitempty"` - PipelineTask *PipelineTask `json:"pipeline_task,omitempty"` - PowerBiTask *PowerBiTask `json:"power_bi_task,omitempty"` - PythonWheelTask *PythonWheelTask `json:"python_wheel_task,omitempty"` - RetryOnTimeout bool `json:"retry_on_timeout,omitempty"` - RunIf RunIf `json:"run_if,omitempty"` - RunJobTask *RunJobTask `json:"run_job_task,omitempty"` - SparkJarTask *SparkJarTask `json:"spark_jar_task,omitempty"` - SparkPythonTask *SparkPythonTask `json:"spark_python_task,omitempty"` - SparkSubmitTask *SparkSubmitTask `json:"spark_submit_task,omitempty"` - SqlTask *SqlTask `json:"sql_task,omitempty"` - TaskKey string `json:"task_key"` - TimeoutSeconds int `json:"timeout_seconds,omitempty"` - WebhookNotifications *WebhookNotifications `json:"webhook_notifications,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func taskFromPb(pb *taskPb) (*Task, error) { - if pb == nil { - return nil, nil - } - st := &Task{} - st.CleanRoomsNotebookTask = pb.CleanRoomsNotebookTask - st.ConditionTask = pb.ConditionTask - st.DashboardTask = pb.DashboardTask - st.DbtCloudTask = pb.DbtCloudTask - st.DbtPlatformTask = pb.DbtPlatformTask - st.DbtTask = pb.DbtTask - st.DependsOn = pb.DependsOn - st.Description = pb.Description - st.DisableAutoOptimization = pb.DisableAutoOptimization - st.EmailNotifications = pb.EmailNotifications - st.EnvironmentKey = pb.EnvironmentKey - st.ExistingClusterId = pb.ExistingClusterId - st.ForEachTask = pb.ForEachTask - st.GenAiComputeTask = pb.GenAiComputeTask - st.Health = pb.Health - st.JobClusterKey = pb.JobClusterKey - st.Libraries = pb.Libraries - st.MaxRetries = pb.MaxRetries - st.MinRetryIntervalMillis = pb.MinRetryIntervalMillis - st.NewCluster = pb.NewCluster - st.NotebookTask = pb.NotebookTask - st.NotificationSettings = pb.NotificationSettings - st.PipelineTask = pb.PipelineTask - st.PowerBiTask = pb.PowerBiTask - st.PythonWheelTask = pb.PythonWheelTask - st.RetryOnTimeout = pb.RetryOnTimeout - st.RunIf = pb.RunIf - st.RunJobTask = pb.RunJobTask - st.SparkJarTask = pb.SparkJarTask - st.SparkPythonTask = pb.SparkPythonTask - st.SparkSubmitTask = pb.SparkSubmitTask - st.SqlTask = pb.SqlTask - st.TaskKey = pb.TaskKey - st.TimeoutSeconds = pb.TimeoutSeconds - st.WebhookNotifications = pb.WebhookNotifications - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *taskPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st taskPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func taskDependencyToPb(st *TaskDependency) (*taskDependencyPb, error) { - if st == nil { - return nil, nil - } - pb := &taskDependencyPb{} - pb.Outcome = st.Outcome - pb.TaskKey = st.TaskKey - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type taskDependencyPb struct { - Outcome string `json:"outcome,omitempty"` - TaskKey string `json:"task_key"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func taskDependencyFromPb(pb *taskDependencyPb) (*TaskDependency, error) { - if pb == nil { - return nil, nil - } - st := &TaskDependency{} - st.Outcome = pb.Outcome - st.TaskKey = pb.TaskKey - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *taskDependencyPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st taskDependencyPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func taskEmailNotificationsToPb(st *TaskEmailNotifications) (*taskEmailNotificationsPb, error) { - if st == nil { - return nil, nil - } - pb := &taskEmailNotificationsPb{} - pb.NoAlertForSkippedRuns = st.NoAlertForSkippedRuns - pb.OnDurationWarningThresholdExceeded = st.OnDurationWarningThresholdExceeded - pb.OnFailure = st.OnFailure - pb.OnStart = st.OnStart - pb.OnStreamingBacklogExceeded = st.OnStreamingBacklogExceeded - pb.OnSuccess = st.OnSuccess - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type taskEmailNotificationsPb struct { - NoAlertForSkippedRuns bool `json:"no_alert_for_skipped_runs,omitempty"` - OnDurationWarningThresholdExceeded []string `json:"on_duration_warning_threshold_exceeded,omitempty"` - OnFailure []string `json:"on_failure,omitempty"` - OnStart []string `json:"on_start,omitempty"` - OnStreamingBacklogExceeded []string `json:"on_streaming_backlog_exceeded,omitempty"` - OnSuccess []string `json:"on_success,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func taskEmailNotificationsFromPb(pb *taskEmailNotificationsPb) (*TaskEmailNotifications, error) { - if pb == nil { - return nil, nil - } - st := &TaskEmailNotifications{} - st.NoAlertForSkippedRuns = pb.NoAlertForSkippedRuns - st.OnDurationWarningThresholdExceeded = pb.OnDurationWarningThresholdExceeded - st.OnFailure = pb.OnFailure - st.OnStart = pb.OnStart - st.OnStreamingBacklogExceeded = pb.OnStreamingBacklogExceeded - st.OnSuccess = pb.OnSuccess - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *taskEmailNotificationsPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st taskEmailNotificationsPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func taskNotificationSettingsToPb(st *TaskNotificationSettings) (*taskNotificationSettingsPb, error) { - if st == nil { - return nil, nil - } - pb := &taskNotificationSettingsPb{} - pb.AlertOnLastAttempt = st.AlertOnLastAttempt - pb.NoAlertForCanceledRuns = st.NoAlertForCanceledRuns - pb.NoAlertForSkippedRuns = st.NoAlertForSkippedRuns - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type taskNotificationSettingsPb struct { - AlertOnLastAttempt bool `json:"alert_on_last_attempt,omitempty"` - NoAlertForCanceledRuns bool `json:"no_alert_for_canceled_runs,omitempty"` - NoAlertForSkippedRuns bool `json:"no_alert_for_skipped_runs,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func taskNotificationSettingsFromPb(pb *taskNotificationSettingsPb) (*TaskNotificationSettings, error) { - if pb == nil { - return nil, nil - } - st := &TaskNotificationSettings{} - st.AlertOnLastAttempt = pb.AlertOnLastAttempt - st.NoAlertForCanceledRuns = pb.NoAlertForCanceledRuns - st.NoAlertForSkippedRuns = pb.NoAlertForSkippedRuns - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *taskNotificationSettingsPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st taskNotificationSettingsPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func terminationDetailsToPb(st *TerminationDetails) (*terminationDetailsPb, error) { - if st == nil { - return nil, nil - } - pb := &terminationDetailsPb{} - pb.Code = st.Code - pb.Message = st.Message - pb.Type = st.Type - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type terminationDetailsPb struct { - Code TerminationCodeCode `json:"code,omitempty"` - Message string `json:"message,omitempty"` - Type TerminationTypeType `json:"type,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func terminationDetailsFromPb(pb *terminationDetailsPb) (*TerminationDetails, error) { - if pb == nil { - return nil, nil - } - st := &TerminationDetails{} - st.Code = pb.Code - st.Message = pb.Message - st.Type = pb.Type - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *terminationDetailsPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st terminationDetailsPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func triggerInfoToPb(st *TriggerInfo) (*triggerInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &triggerInfoPb{} - pb.RunId = st.RunId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type triggerInfoPb struct { - RunId int64 `json:"run_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func triggerInfoFromPb(pb *triggerInfoPb) (*TriggerInfo, error) { - if pb == nil { - return nil, nil - } - st := &TriggerInfo{} - st.RunId = pb.RunId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *triggerInfoPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st triggerInfoPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func triggerSettingsToPb(st *TriggerSettings) (*triggerSettingsPb, error) { - if st == nil { - return nil, nil - } - pb := &triggerSettingsPb{} - pb.FileArrival = st.FileArrival - pb.PauseStatus = st.PauseStatus - pb.Periodic = st.Periodic - pb.Table = st.Table - pb.TableUpdate = st.TableUpdate - - return pb, nil -} - -type triggerSettingsPb struct { - FileArrival *FileArrivalTriggerConfiguration `json:"file_arrival,omitempty"` - PauseStatus PauseStatus `json:"pause_status,omitempty"` - Periodic *PeriodicTriggerConfiguration `json:"periodic,omitempty"` - Table *TableUpdateTriggerConfiguration `json:"table,omitempty"` - TableUpdate *TableUpdateTriggerConfiguration `json:"table_update,omitempty"` -} - -func triggerSettingsFromPb(pb *triggerSettingsPb) (*TriggerSettings, error) { - if pb == nil { - return nil, nil - } - st := &TriggerSettings{} - st.FileArrival = pb.FileArrival - st.PauseStatus = pb.PauseStatus - st.Periodic = pb.Periodic - st.Table = pb.Table - st.TableUpdate = pb.TableUpdate - - return st, nil -} - -func triggerStateProtoToPb(st *TriggerStateProto) (*triggerStateProtoPb, error) { - if st == nil { - return nil, nil - } - pb := &triggerStateProtoPb{} - pb.FileArrival = st.FileArrival - - return pb, nil -} - -type triggerStateProtoPb struct { - FileArrival *FileArrivalTriggerState `json:"file_arrival,omitempty"` -} - -func triggerStateProtoFromPb(pb *triggerStateProtoPb) (*TriggerStateProto, error) { - if pb == nil { - return nil, nil - } - st := &TriggerStateProto{} - st.FileArrival = pb.FileArrival - - return st, nil -} - -func updateJobToPb(st *UpdateJob) (*updateJobPb, error) { - if st == nil { - return nil, nil - } - pb := &updateJobPb{} - pb.FieldsToRemove = st.FieldsToRemove - pb.JobId = st.JobId - pb.NewSettings = st.NewSettings - - return pb, nil -} - -type updateJobPb struct { - FieldsToRemove []string `json:"fields_to_remove,omitempty"` - JobId int64 `json:"job_id"` - NewSettings *JobSettings `json:"new_settings,omitempty"` -} - -func updateJobFromPb(pb *updateJobPb) (*UpdateJob, error) { - if pb == nil { - return nil, nil - } - st := &UpdateJob{} - st.FieldsToRemove = pb.FieldsToRemove - st.JobId = pb.JobId - st.NewSettings = pb.NewSettings - - return st, nil -} - -func updateResponseToPb(st *UpdateResponse) (*updateResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &updateResponsePb{} - - return pb, nil -} - -type updateResponsePb struct { -} - -func updateResponseFromPb(pb *updateResponsePb) (*UpdateResponse, error) { - if pb == nil { - return nil, nil - } - st := &UpdateResponse{} - - return st, nil -} - -func viewItemToPb(st *ViewItem) (*viewItemPb, error) { - if st == nil { - return nil, nil - } - pb := &viewItemPb{} - pb.Content = st.Content - pb.Name = st.Name - pb.Type = st.Type - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type viewItemPb struct { - Content string `json:"content,omitempty"` - Name string `json:"name,omitempty"` - Type ViewType `json:"type,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func viewItemFromPb(pb *viewItemPb) (*ViewItem, error) { - if pb == nil { - return nil, nil - } - st := &ViewItem{} - st.Content = pb.Content - st.Name = pb.Name - st.Type = pb.Type - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *viewItemPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st viewItemPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func webhookToPb(st *Webhook) (*webhookPb, error) { - if st == nil { - return nil, nil - } - pb := &webhookPb{} - pb.Id = st.Id - - return pb, nil -} - -type webhookPb struct { - Id string `json:"id"` -} - -func webhookFromPb(pb *webhookPb) (*Webhook, error) { - if pb == nil { - return nil, nil - } - st := &Webhook{} - st.Id = pb.Id - - return st, nil -} - -func webhookNotificationsToPb(st *WebhookNotifications) (*webhookNotificationsPb, error) { - if st == nil { - return nil, nil - } - pb := &webhookNotificationsPb{} - pb.OnDurationWarningThresholdExceeded = st.OnDurationWarningThresholdExceeded - pb.OnFailure = st.OnFailure - pb.OnStart = st.OnStart - pb.OnStreamingBacklogExceeded = st.OnStreamingBacklogExceeded - pb.OnSuccess = st.OnSuccess - - return pb, nil -} - -type webhookNotificationsPb struct { - OnDurationWarningThresholdExceeded []Webhook `json:"on_duration_warning_threshold_exceeded,omitempty"` - OnFailure []Webhook `json:"on_failure,omitempty"` - OnStart []Webhook `json:"on_start,omitempty"` - OnStreamingBacklogExceeded []Webhook `json:"on_streaming_backlog_exceeded,omitempty"` - OnSuccess []Webhook `json:"on_success,omitempty"` -} - -func webhookNotificationsFromPb(pb *webhookNotificationsPb) (*WebhookNotifications, error) { - if pb == nil { - return nil, nil - } - st := &WebhookNotifications{} - st.OnDurationWarningThresholdExceeded = pb.OnDurationWarningThresholdExceeded - st.OnFailure = pb.OnFailure - st.OnStart = pb.OnStart - st.OnStreamingBacklogExceeded = pb.OnStreamingBacklogExceeded - st.OnSuccess = pb.OnSuccess - - return st, nil -} - -func widgetErrorDetailToPb(st *WidgetErrorDetail) (*widgetErrorDetailPb, error) { - if st == nil { - return nil, nil - } - pb := &widgetErrorDetailPb{} - pb.Message = st.Message - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type widgetErrorDetailPb struct { - Message string `json:"message,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func widgetErrorDetailFromPb(pb *widgetErrorDetailPb) (*WidgetErrorDetail, error) { - if pb == nil { - return nil, nil - } - st := &WidgetErrorDetail{} - st.Message = pb.Message - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *widgetErrorDetailPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st widgetErrorDetailPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func durationToPb(d *time.Duration) (*string, error) { - if d == nil { - return nil, nil - } - s := fmt.Sprintf("%.9fs", d.Seconds()) - return &s, nil -} - -func durationFromPb(s *string) (*time.Duration, error) { - if s == nil { - return nil, nil - } - d, err := time.ParseDuration(*s) - if err != nil { - return nil, err - } - return &d, nil -} - -func timestampToPb(t *time.Time) (*string, error) { - if t == nil { - return nil, nil - } - s := t.Format(time.RFC3339) - return &s, nil -} - -func timestampFromPb(s *string) (*time.Time, error) { - if s == nil { - return nil, nil - } - t, err := time.Parse(time.RFC3339, *s) - if err != nil { - return nil, err - } - return &t, nil -} - -func fieldMaskToPb(fm *[]string) (*string, error) { - if fm == nil { - return nil, nil - } - s := strings.Join(*fm, ",") - return &s, nil -} - -func fieldMaskFromPb(s *string) (*[]string, error) { - if s == nil { - return nil, nil - } - fm := strings.Split(*s, ",") - return &fm, nil -} diff --git a/service/jobs/model.go b/service/jobs/model.go index a1b98d215..5430b2905 100755 --- a/service/jobs/model.go +++ b/service/jobs/model.go @@ -3,9 +3,9 @@ package jobs import ( - "encoding/json" "fmt" + "github.com/databricks/databricks-sdk-go/marshal" "github.com/databricks/databricks-sdk-go/service/compute" ) @@ -49,11 +49,9 @@ func (f *AuthenticationMethod) Type() string { type BaseJob struct { // The time at which this job was created in epoch milliseconds // (milliseconds since 1/1/1970 UTC). - // Wire name: 'created_time' CreatedTime int64 `json:"created_time,omitempty"` // The creator user name. This field won’t be included in the response if // the user has already been deleted. - // Wire name: 'creator_user_name' CreatorUserName string `json:"creator_user_name,omitempty"` // The id of the budget policy used by this job for cost attribution // purposes. This may be set through (in order of precedence): 1. Budget @@ -61,51 +59,29 @@ type BaseJob struct { // details page and Jobs API using `budget_policy_id` 3. Inferred default // based on accessible budget policies of the run_as identity on job // creation or modification. - // Wire name: 'effective_budget_policy_id' EffectiveBudgetPolicyId string `json:"effective_budget_policy_id,omitempty"` // Indicates if the job has more array properties (`tasks`, `job_clusters`) // that are not shown. They can be accessed via :method:jobs/get endpoint. // It is only relevant for API 2.2 :method:jobs/list requests with // `expand_tasks=true`. - // Wire name: 'has_more' HasMore bool `json:"has_more,omitempty"` // The canonical identifier for this job. - // Wire name: 'job_id' JobId int64 `json:"job_id,omitempty"` // Settings for this job and all of its runs. These settings can be updated // using the `resetJob` method. - // Wire name: 'settings' Settings *JobSettings `json:"settings,omitempty"` // State of the trigger associated with the job. - // Wire name: 'trigger_state' TriggerState *TriggerStateProto `json:"trigger_state,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *BaseJob) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &baseJobPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := baseJobFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *BaseJob) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st BaseJob) MarshalJSON() ([]byte, error) { - pb, err := baseJobToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s BaseJob) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type BaseRun struct { @@ -116,30 +92,24 @@ type BaseRun struct { // original attempt’s ID and an incrementing `attempt_number`. Runs are // retried only until they succeed, and the maximum `attempt_number` is the // same as the `max_retries` value for the job. - // Wire name: 'attempt_number' AttemptNumber int `json:"attempt_number,omitempty"` // The time in milliseconds it took to terminate the cluster and clean up // any associated artifacts. The duration of a task run is the sum of the // `setup_duration`, `execution_duration`, and the `cleanup_duration`. The // `cleanup_duration` field is set to 0 for multitask job runs. The total // duration of a multitask job run is the value of the `run_duration` field. - // Wire name: 'cleanup_duration' CleanupDuration int64 `json:"cleanup_duration,omitempty"` // The cluster used for this run. If the run is specified to use a new // cluster, this field is set once the Jobs service has requested a cluster // for the run. - // Wire name: 'cluster_instance' ClusterInstance *ClusterInstance `json:"cluster_instance,omitempty"` // A snapshot of the job’s cluster specification when this run was // created. - // Wire name: 'cluster_spec' ClusterSpec *ClusterSpec `json:"cluster_spec,omitempty"` // The creator user name. This field won’t be included in the response if // the user has already been deleted. - // Wire name: 'creator_user_name' CreatorUserName string `json:"creator_user_name,omitempty"` // Description of the run - // Wire name: 'description' Description string `json:"description,omitempty"` // The actual performance target used by the serverless run during // execution. This can differ from the client-set performance target on the @@ -149,11 +119,9 @@ type BaseRun struct { // * `STANDARD`: Enables cost-efficient execution of serverless workloads. * // `PERFORMANCE_OPTIMIZED`: Prioritizes fast startup and execution times // through rapid scaling and optimized cluster performance. - // Wire name: 'effective_performance_target' EffectivePerformanceTarget PerformanceTarget `json:"effective_performance_target,omitempty"` // The time at which this run ended in epoch milliseconds (milliseconds // since 1/1/1970 UTC). This field is set to 0 if the job is still running. - // Wire name: 'end_time' EndTime int64 `json:"end_time,omitempty"` // The time in milliseconds it took to execute the commands in the JAR or // notebook until they completed, failed, timed out, were cancelled, or @@ -162,7 +130,6 @@ type BaseRun struct { // The `execution_duration` field is set to 0 for multitask job runs. The // total duration of a multitask job run is the value of the `run_duration` // field. - // Wire name: 'execution_duration' ExecutionDuration int64 `json:"execution_duration,omitempty"` // An optional specification for a remote Git repository containing the // source code used by tasks. Version-controlled source code is supported by @@ -174,64 +141,49 @@ type BaseRun struct { // // Note: dbt and SQL File tasks support only version-controlled sources. If // dbt or SQL File tasks are used, `git_source` must be defined on the job. - // Wire name: 'git_source' GitSource *GitSource `json:"git_source,omitempty"` // Indicates if the run has more array properties (`tasks`, `job_clusters`) // that are not shown. They can be accessed via :method:jobs/getrun // endpoint. It is only relevant for API 2.2 :method:jobs/listruns requests // with `expand_tasks=true`. - // Wire name: 'has_more' HasMore bool `json:"has_more,omitempty"` // A list of job cluster specifications that can be shared and reused by // tasks of this job. Libraries cannot be declared in a shared job cluster. // You must declare dependent libraries in task settings. If more than 100 // job clusters are available, you can paginate through them using // :method:jobs/getrun. - // Wire name: 'job_clusters' JobClusters []JobCluster `json:"job_clusters,omitempty"` // The canonical identifier of the job that contains this run. - // Wire name: 'job_id' JobId int64 `json:"job_id,omitempty"` // Job-level parameters used in the run - // Wire name: 'job_parameters' JobParameters []JobParameter `json:"job_parameters,omitempty"` // ID of the job run that this run belongs to. For legacy and single-task // job runs the field is populated with the job run ID. For task runs, the // field is populated with the ID of the job run that the task run belongs // to. - // Wire name: 'job_run_id' JobRunId int64 `json:"job_run_id,omitempty"` // A unique identifier for this job run. This is set to the same value as // `run_id`. - // Wire name: 'number_in_job' NumberInJob int64 `json:"number_in_job,omitempty"` // If this run is a retry of a prior run attempt, this field contains the // run_id of the original attempt; otherwise, it is the same as the run_id. - // Wire name: 'original_attempt_run_id' OriginalAttemptRunId int64 `json:"original_attempt_run_id,omitempty"` // The parameters used for this run. - // Wire name: 'overriding_parameters' OverridingParameters *RunParameters `json:"overriding_parameters,omitempty"` // The time in milliseconds that the run has spent in the queue. - // Wire name: 'queue_duration' QueueDuration int64 `json:"queue_duration,omitempty"` // The repair history of the run. - // Wire name: 'repair_history' RepairHistory []RepairHistoryItem `json:"repair_history,omitempty"` // The time in milliseconds it took the job run and all of its repairs to // finish. - // Wire name: 'run_duration' RunDuration int64 `json:"run_duration,omitempty"` // The canonical identifier of the run. This ID is unique across all runs of // all jobs. - // Wire name: 'run_id' RunId int64 `json:"run_id,omitempty"` // An optional name for the run. The maximum length is 4096 bytes in UTF-8 // encoding. - // Wire name: 'run_name' RunName string `json:"run_name,omitempty"` // The URL to the detail page of the run. - // Wire name: 'run_page_url' RunPageUrl string `json:"run_page_url,omitempty"` // The type of a run. * `JOB_RUN`: Normal job run. A run created with // :method:jobs/runNow. * `WORKFLOW_RUN`: Workflow run. A run created with @@ -239,11 +191,9 @@ type BaseRun struct { // :method:jobs/submit. // // [dbutils.notebook.run]: https://docs.databricks.com/dev-tools/databricks-utils.html#dbutils-workflow - // Wire name: 'run_type' RunType RunType `json:"run_type,omitempty"` // The cron schedule that triggered this run if it was triggered by the // periodic scheduler. - // Wire name: 'schedule' Schedule *CronSchedule `json:"schedule,omitempty"` // The time in milliseconds it took to set up the cluster. For runs that run // on new clusters this is the cluster creation time, for runs that run on @@ -252,26 +202,21 @@ type BaseRun struct { // `cleanup_duration`. The `setup_duration` field is set to 0 for multitask // job runs. The total duration of a multitask job run is the value of the // `run_duration` field. - // Wire name: 'setup_duration' SetupDuration int64 `json:"setup_duration,omitempty"` // The time at which this run was started in epoch milliseconds // (milliseconds since 1/1/1970 UTC). This may not be the time when the job // task starts executing, for example, if the job is scheduled to run on a // new cluster, this is the time the cluster creation call is issued. - // Wire name: 'start_time' StartTime int64 `json:"start_time,omitempty"` // Deprecated. Please use the `status` field instead. - // Wire name: 'state' State *RunState `json:"state,omitempty"` // The current status of the run - // Wire name: 'status' Status *RunStatus `json:"status,omitempty"` // The list of tasks performed by the run. Each task has its own `run_id` // which you can use to call `JobsGetOutput` to retrieve the run resutls. If // more than 100 tasks are available, you can paginate through them using // :method:jobs/getrun. Use the `next_page_token` field at the object root // to determine if more results are available. - // Wire name: 'tasks' Tasks []RunTask `json:"tasks,omitempty"` // The type of trigger that fired this run. // @@ -287,164 +232,50 @@ type BaseRun struct { // update. * `CONTINUOUS_RESTART`: Indicates a run created by user to // manually restart a continuous job run. * `MODEL`: Indicates a run that is // triggered by a model update. - // Wire name: 'trigger' Trigger TriggerType `json:"trigger,omitempty"` // Additional details about what triggered the run - // Wire name: 'trigger_info' TriggerInfo *TriggerInfo `json:"trigger_info,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *BaseRun) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &baseRunPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := baseRunFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *BaseRun) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st BaseRun) MarshalJSON() ([]byte, error) { - pb, err := baseRunToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s BaseRun) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CancelAllRuns struct { // Optional boolean parameter to cancel all queued runs. If no job_id is // provided, all queued runs in the workspace are canceled. - // Wire name: 'all_queued_runs' AllQueuedRuns bool `json:"all_queued_runs,omitempty"` // The canonical identifier of the job to cancel all runs of. - // Wire name: 'job_id' JobId int64 `json:"job_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CancelAllRuns) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &cancelAllRunsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := cancelAllRunsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CancelAllRuns) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CancelAllRuns) MarshalJSON() ([]byte, error) { - pb, err := cancelAllRunsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CancelAllRuns) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CancelAllRunsResponse struct { } -func (st *CancelAllRunsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &cancelAllRunsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := cancelAllRunsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CancelAllRunsResponse) MarshalJSON() ([]byte, error) { - pb, err := cancelAllRunsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type CancelRun struct { // This field is required. - // Wire name: 'run_id' RunId int64 `json:"run_id"` } -func (st *CancelRun) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &cancelRunPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := cancelRunFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CancelRun) MarshalJSON() ([]byte, error) { - pb, err := cancelRunToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type CancelRunResponse struct { } -func (st *CancelRunResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &cancelRunResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := cancelRunResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CancelRunResponse) MarshalJSON() ([]byte, error) { - pb, err := cancelRunResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Copied from elastic-spark-common/api/messages/runs.proto. Using the original // definition to remove coupling with jobs API definition type CleanRoomTaskRunLifeCycleState string @@ -585,121 +416,45 @@ type CleanRoomTaskRunState struct { // A value indicating the run's current lifecycle state. This field is // always available in the response. Note: Additional states might be // introduced in future releases. - // Wire name: 'life_cycle_state' LifeCycleState CleanRoomTaskRunLifeCycleState `json:"life_cycle_state,omitempty"` // A value indicating the run's result. This field is only available for // terminal lifecycle states. Note: Additional states might be introduced in // future releases. - // Wire name: 'result_state' ResultState CleanRoomTaskRunResultState `json:"result_state,omitempty"` } -func (st *CleanRoomTaskRunState) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &cleanRoomTaskRunStatePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := cleanRoomTaskRunStateFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CleanRoomTaskRunState) MarshalJSON() ([]byte, error) { - pb, err := cleanRoomTaskRunStateToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type CleanRoomsNotebookTask struct { // The clean room that the notebook belongs to. - // Wire name: 'clean_room_name' CleanRoomName string `json:"clean_room_name"` // Checksum to validate the freshness of the notebook resource (i.e. the // notebook being run is the latest version). It can be fetched by calling // the :method:cleanroomassets/get API. - // Wire name: 'etag' Etag string `json:"etag,omitempty"` // Base parameters to be used for the clean room notebook job. - // Wire name: 'notebook_base_parameters' NotebookBaseParameters map[string]string `json:"notebook_base_parameters,omitempty"` // Name of the notebook being run. - // Wire name: 'notebook_name' NotebookName string `json:"notebook_name"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CleanRoomsNotebookTask) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &cleanRoomsNotebookTaskPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := cleanRoomsNotebookTaskFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CleanRoomsNotebookTask) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CleanRoomsNotebookTask) MarshalJSON() ([]byte, error) { - pb, err := cleanRoomsNotebookTaskToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CleanRoomsNotebookTask) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CleanRoomsNotebookTaskCleanRoomsNotebookTaskOutput struct { // The run state of the clean rooms notebook task. - // Wire name: 'clean_room_job_run_state' CleanRoomJobRunState *CleanRoomTaskRunState `json:"clean_room_job_run_state,omitempty"` // The notebook output for the clean room run - // Wire name: 'notebook_output' NotebookOutput *NotebookOutput `json:"notebook_output,omitempty"` // Information on how to access the output schema for the clean room run - // Wire name: 'output_schema_info' OutputSchemaInfo *OutputSchemaInfo `json:"output_schema_info,omitempty"` } -func (st *CleanRoomsNotebookTaskCleanRoomsNotebookTaskOutput) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &cleanRoomsNotebookTaskCleanRoomsNotebookTaskOutputPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := cleanRoomsNotebookTaskCleanRoomsNotebookTaskOutputFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CleanRoomsNotebookTaskCleanRoomsNotebookTaskOutput) MarshalJSON() ([]byte, error) { - pb, err := cleanRoomsNotebookTaskCleanRoomsNotebookTaskOutputToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type ClusterInstance struct { // The canonical identifier for the cluster used by a run. This field is // always available for runs on existing clusters. For runs on new clusters, @@ -709,7 +464,6 @@ type ClusterInstance struct { // // The response won’t include this field if the identifier is not // available yet. - // Wire name: 'cluster_id' ClusterId string `json:"cluster_id,omitempty"` // The canonical identifier for the Spark context used by a run. This field // is filled in once the run begins execution. This value can be used to @@ -719,35 +473,17 @@ type ClusterInstance struct { // // The response won’t include this field if the identifier is not // available yet. - // Wire name: 'spark_context_id' SparkContextId string `json:"spark_context_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ClusterInstance) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &clusterInstancePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := clusterInstanceFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ClusterInstance) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ClusterInstance) MarshalJSON() ([]byte, error) { - pb, err := clusterInstanceToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ClusterInstance) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ClusterSpec struct { @@ -755,86 +491,45 @@ type ClusterSpec struct { // all runs. When running jobs or tasks on an existing cluster, you may need // to manually restart the cluster if it stops responding. We suggest // running jobs and tasks on new clusters for greater reliability - // Wire name: 'existing_cluster_id' ExistingClusterId string `json:"existing_cluster_id,omitempty"` // If job_cluster_key, this task is executed reusing the cluster specified // in `job.settings.job_clusters`. - // Wire name: 'job_cluster_key' JobClusterKey string `json:"job_cluster_key,omitempty"` // An optional list of libraries to be installed on the cluster. The default // value is an empty list. - // Wire name: 'libraries' Libraries []compute.Library `json:"libraries,omitempty"` // If new_cluster, a description of a new cluster that is created for each // run. - // Wire name: 'new_cluster' NewCluster *compute.ClusterSpec `json:"new_cluster,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ClusterSpec) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &clusterSpecPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := clusterSpecFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ClusterSpec) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ClusterSpec) MarshalJSON() ([]byte, error) { - pb, err := clusterSpecToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ClusterSpec) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ComputeConfig struct { // IDof the GPU pool to use. - // Wire name: 'gpu_node_pool_id' GpuNodePoolId string `json:"gpu_node_pool_id,omitempty"` // GPU type. - // Wire name: 'gpu_type' GpuType string `json:"gpu_type,omitempty"` // Number of GPUs. - // Wire name: 'num_gpus' NumGpus int `json:"num_gpus"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ComputeConfig) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &computeConfigPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := computeConfigFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ComputeConfig) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ComputeConfig) MarshalJSON() ([]byte, error) { - pb, err := computeConfigToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ComputeConfig) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type Condition string @@ -877,7 +572,6 @@ func (f *Condition) Type() string { type ConditionTask struct { // The left operand of the condition task. Can be either a string value or a // job state or parameter reference. - // Wire name: 'left' Left string `json:"left"` // * `EQUAL_TO`, `NOT_EQUAL` operators perform string comparison of their // operands. This means that `“12.0” == “12”` will evaluate to @@ -889,39 +583,12 @@ type ConditionTask struct { // The boolean comparison to task values can be implemented with operators // `EQUAL_TO`, `NOT_EQUAL`. If a task value was set to a boolean value, it // will be serialized to `“true”` or `“false”` for the comparison. - // Wire name: 'op' Op ConditionTaskOp `json:"op"` // The right operand of the condition task. Can be either a string value or // a job state or parameter reference. - // Wire name: 'right' Right string `json:"right"` } -func (st *ConditionTask) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &conditionTaskPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := conditionTaskFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ConditionTask) MarshalJSON() ([]byte, error) { - pb, err := conditionTaskToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // * `EQUAL_TO`, `NOT_EQUAL` operators perform string comparison of their // operands. This means that `“12.0” == “12”` will evaluate to `false`. // * `GREATER_THAN`, `GREATER_THAN_OR_EQUAL`, `LESS_THAN`, `LESS_THAN_OR_EQUAL` @@ -984,66 +651,33 @@ func (f *ConditionTaskOp) Type() string { type Continuous struct { // Indicate whether the continuous execution of the job is paused or not. // Defaults to UNPAUSED. - // Wire name: 'pause_status' PauseStatus PauseStatus `json:"pause_status,omitempty"` } -func (st *Continuous) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &continuousPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := continuousFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st Continuous) MarshalJSON() ([]byte, error) { - pb, err := continuousToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type CreateJob struct { // List of permissions to set on the job. - // Wire name: 'access_control_list' AccessControlList []JobAccessControlRequest `json:"access_control_list,omitempty"` // The id of the user specified budget policy to use for this job. If not // specified, a default budget policy may be applied when creating or // modifying the job. See `effective_budget_policy_id` for the budget policy // used by this workload. - // Wire name: 'budget_policy_id' BudgetPolicyId string `json:"budget_policy_id,omitempty"` // An optional continuous property for this job. The continuous property // will ensure that there is always one run executing. Only one of // `schedule` and `continuous` can be used. - // Wire name: 'continuous' Continuous *Continuous `json:"continuous,omitempty"` // Deployment information for jobs managed by external sources. - // Wire name: 'deployment' Deployment *JobDeployment `json:"deployment,omitempty"` // An optional description for the job. The maximum length is 27700 // characters in UTF-8 encoding. - // Wire name: 'description' Description string `json:"description,omitempty"` // Edit mode of the job. // // * `UI_LOCKED`: The job is in a locked UI state and cannot be modified. * // `EDITABLE`: The job is in an editable state and can be modified. - // Wire name: 'edit_mode' EditMode JobEditMode `json:"edit_mode,omitempty"` // An optional set of email addresses that is notified when runs of this job // begin or complete as well as when this job is deleted. - // Wire name: 'email_notifications' EmailNotifications *JobEmailNotifications `json:"email_notifications,omitempty"` // A list of task execution environment specifications that can be // referenced by serverless tasks of this job. An environment is required to @@ -1051,12 +685,10 @@ type CreateJob struct { // environment is accessible in the notebook environment panel. For other // serverless tasks, the task environment is required to be specified using // environment_key in the task settings. - // Wire name: 'environments' Environments []JobEnvironment `json:"environments,omitempty"` // Used to tell what is the format of the job. This field is ignored in // Create/Update/Reset calls. When using the Jobs API 2.1 this value is // always set to `"MULTI_TASK"`. - // Wire name: 'format' Format Format `json:"format,omitempty"` // An optional specification for a remote Git repository containing the // source code used by tasks. Version-controlled source code is supported by @@ -1068,15 +700,12 @@ type CreateJob struct { // // Note: dbt and SQL File tasks support only version-controlled sources. If // dbt or SQL File tasks are used, `git_source` must be defined on the job. - // Wire name: 'git_source' GitSource *GitSource `json:"git_source,omitempty"` // An optional set of health rules that can be defined for this job. - // Wire name: 'health' Health *JobsHealthRules `json:"health,omitempty"` // A list of job cluster specifications that can be shared and reused by // tasks of this job. Libraries cannot be declared in a shared job cluster. // You must declare dependent libraries in task settings. - // Wire name: 'job_clusters' JobClusters []JobCluster `json:"job_clusters,omitempty"` // An optional maximum allowed number of concurrent runs of the job. Set // this value if you want to be able to execute multiple runs of the same @@ -1089,19 +718,15 @@ type CreateJob struct { // runs. However, from then on, new runs are skipped unless there are fewer // than 3 active runs. This value cannot exceed 1000. Setting this value to // `0` causes all new runs to be skipped. - // Wire name: 'max_concurrent_runs' MaxConcurrentRuns int `json:"max_concurrent_runs,omitempty"` // An optional name for the job. The maximum length is 4096 bytes in UTF-8 // encoding. - // Wire name: 'name' Name string `json:"name,omitempty"` // Optional notification settings that are used when sending notifications // to each of the `email_notifications` and `webhook_notifications` for this // job. - // Wire name: 'notification_settings' NotificationSettings *JobNotificationSettings `json:"notification_settings,omitempty"` // Job-level parameter definitions - // Wire name: 'parameters' Parameters []JobParameterDefinition `json:"parameters,omitempty"` // The performance mode on a serverless job. This field determines the level // of compute performance or cost-efficiency for the run. @@ -1109,28 +734,23 @@ type CreateJob struct { // * `STANDARD`: Enables cost-efficient execution of serverless workloads. * // `PERFORMANCE_OPTIMIZED`: Prioritizes fast startup and execution times // through rapid scaling and optimized cluster performance. - // Wire name: 'performance_target' PerformanceTarget PerformanceTarget `json:"performance_target,omitempty"` // The queue settings of the job. - // Wire name: 'queue' Queue *QueueSettings `json:"queue,omitempty"` // Write-only setting. Specifies the user or service principal that the job // runs as. If not specified, the job runs as the user who created the job. // // Either `user_name` or `service_principal_name` should be specified. If // not, an error is thrown. - // Wire name: 'run_as' RunAs *JobRunAs `json:"run_as,omitempty"` // An optional periodic schedule for this job. The default behavior is that // the job only runs when triggered by clicking “Run Now” in the Jobs UI // or sending an API request to `runNow`. - // Wire name: 'schedule' Schedule *CronSchedule `json:"schedule,omitempty"` // A map of tags associated with the job. These are forwarded to the cluster // as cluster tags for jobs clusters, and are subject to the same // limitations as cluster tags. A maximum of 25 tags can be added to the // job. - // Wire name: 'tags' Tags map[string]string `json:"tags,omitempty"` // A list of task specifications to be executed by this job. It supports up // to 1000 elements in write endpoints (:method:jobs/create, @@ -1139,446 +759,211 @@ type CreateJob struct { // you can paginate through them using :method:jobs/get. Use the // `next_page_token` field at the object root to determine if more results // are available. - // Wire name: 'tasks' Tasks []Task `json:"tasks,omitempty"` // An optional timeout applied to each run of this job. A value of `0` means // no timeout. - // Wire name: 'timeout_seconds' TimeoutSeconds int `json:"timeout_seconds,omitempty"` // A configuration to trigger a run when certain conditions are met. The // default behavior is that the job runs only when triggered by clicking // “Run Now” in the Jobs UI or sending an API request to `runNow`. - // Wire name: 'trigger' Trigger *TriggerSettings `json:"trigger,omitempty"` // A collection of system notification IDs to notify when runs of this job // begin or complete. - // Wire name: 'webhook_notifications' WebhookNotifications *WebhookNotifications `json:"webhook_notifications,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateJob) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createJobPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createJobFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateJob) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateJob) MarshalJSON() ([]byte, error) { - pb, err := createJobToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateJob) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Job was created successfully type CreateResponse struct { // The canonical identifier for the newly created job. - // Wire name: 'job_id' JobId int64 `json:"job_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateResponse) MarshalJSON() ([]byte, error) { - pb, err := createResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CronSchedule struct { // Indicate whether this schedule is paused or not. - // Wire name: 'pause_status' PauseStatus PauseStatus `json:"pause_status,omitempty"` // A Cron expression using Quartz syntax that describes the schedule for a // job. See [Cron Trigger] for details. This field is required. // // [Cron Trigger]: http://www.quartz-scheduler.org/documentation/quartz-2.3.0/tutorials/crontrigger.html - // Wire name: 'quartz_cron_expression' QuartzCronExpression string `json:"quartz_cron_expression"` // A Java timezone ID. The schedule for a job is resolved with respect to // this timezone. See [Java TimeZone] for details. This field is required. // // [Java TimeZone]: https://docs.oracle.com/javase/7/docs/api/java/util/TimeZone.html - // Wire name: 'timezone_id' TimezoneId string `json:"timezone_id"` } -func (st *CronSchedule) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &cronSchedulePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := cronScheduleFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CronSchedule) MarshalJSON() ([]byte, error) { - pb, err := cronScheduleToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type DashboardPageSnapshot struct { - - // Wire name: 'page_display_name' PageDisplayName string `json:"page_display_name,omitempty"` - // Wire name: 'widget_error_details' WidgetErrorDetails []WidgetErrorDetail `json:"widget_error_details,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DashboardPageSnapshot) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &dashboardPageSnapshotPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := dashboardPageSnapshotFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DashboardPageSnapshot) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DashboardPageSnapshot) MarshalJSON() ([]byte, error) { - pb, err := dashboardPageSnapshotToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DashboardPageSnapshot) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Configures the Lakeview Dashboard job task type. type DashboardTask struct { // The identifier of the dashboard to refresh. - // Wire name: 'dashboard_id' DashboardId string `json:"dashboard_id,omitempty"` // Optional: subscription configuration for sending the dashboard snapshot. - // Wire name: 'subscription' Subscription *Subscription `json:"subscription,omitempty"` // Optional: The warehouse id to execute the dashboard with for the // schedule. If not specified, the default warehouse of the dashboard will // be used. - // Wire name: 'warehouse_id' WarehouseId string `json:"warehouse_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DashboardTask) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &dashboardTaskPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := dashboardTaskFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DashboardTask) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DashboardTask) MarshalJSON() ([]byte, error) { - pb, err := dashboardTaskToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DashboardTask) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type DashboardTaskOutput struct { // Should only be populated for manual PDF download jobs. - // Wire name: 'page_snapshots' PageSnapshots []DashboardPageSnapshot `json:"page_snapshots,omitempty"` } -func (st *DashboardTaskOutput) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &dashboardTaskOutputPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := dashboardTaskOutputFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DashboardTaskOutput) MarshalJSON() ([]byte, error) { - pb, err := dashboardTaskOutputToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Format of response retrieved from dbt Cloud, for inclusion in output // Deprecated in favor of DbtPlatformJobRunStep type DbtCloudJobRunStep struct { // Orders the steps in the job - // Wire name: 'index' Index int `json:"index,omitempty"` // Output of the step - // Wire name: 'logs' Logs string `json:"logs,omitempty"` // Name of the step in the job - // Wire name: 'name' Name string `json:"name,omitempty"` // State of the step - // Wire name: 'status' Status DbtPlatformRunStatus `json:"status,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DbtCloudJobRunStep) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &dbtCloudJobRunStepPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := dbtCloudJobRunStepFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DbtCloudJobRunStep) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DbtCloudJobRunStep) MarshalJSON() ([]byte, error) { - pb, err := dbtCloudJobRunStepToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DbtCloudJobRunStep) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Deprecated in favor of DbtPlatformTask type DbtCloudTask struct { // The resource name of the UC connection that authenticates the dbt Cloud // for this task - // Wire name: 'connection_resource_name' ConnectionResourceName string `json:"connection_resource_name,omitempty"` // Id of the dbt Cloud job to be triggered - // Wire name: 'dbt_cloud_job_id' DbtCloudJobId int64 `json:"dbt_cloud_job_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DbtCloudTask) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &dbtCloudTaskPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := dbtCloudTaskFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DbtCloudTask) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DbtCloudTask) MarshalJSON() ([]byte, error) { - pb, err := dbtCloudTaskToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DbtCloudTask) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Deprecated in favor of DbtPlatformTaskOutput type DbtCloudTaskOutput struct { // Id of the job run in dbt Cloud - // Wire name: 'dbt_cloud_job_run_id' DbtCloudJobRunId int64 `json:"dbt_cloud_job_run_id,omitempty"` // Steps of the job run as received from dbt Cloud - // Wire name: 'dbt_cloud_job_run_output' DbtCloudJobRunOutput []DbtCloudJobRunStep `json:"dbt_cloud_job_run_output,omitempty"` // Url where full run details can be viewed - // Wire name: 'dbt_cloud_job_run_url' DbtCloudJobRunUrl string `json:"dbt_cloud_job_run_url,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DbtCloudTaskOutput) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &dbtCloudTaskOutputPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := dbtCloudTaskOutputFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DbtCloudTaskOutput) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DbtCloudTaskOutput) MarshalJSON() ([]byte, error) { - pb, err := dbtCloudTaskOutputToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DbtCloudTaskOutput) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type DbtOutput struct { // An optional map of headers to send when retrieving the artifact from the // `artifacts_link`. - // Wire name: 'artifacts_headers' ArtifactsHeaders map[string]string `json:"artifacts_headers,omitempty"` // A pre-signed URL to download the (compressed) dbt artifacts. This link is // valid for a limited time (30 minutes). This information is only available // after the run has finished. - // Wire name: 'artifacts_link' ArtifactsLink string `json:"artifacts_link,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DbtOutput) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &dbtOutputPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := dbtOutputFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DbtOutput) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DbtOutput) MarshalJSON() ([]byte, error) { - pb, err := dbtOutputToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DbtOutput) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Format of response retrieved from dbt platform, for inclusion in output type DbtPlatformJobRunStep struct { // Orders the steps in the job - // Wire name: 'index' Index int `json:"index,omitempty"` // Output of the step - // Wire name: 'logs' Logs string `json:"logs,omitempty"` // Whether the logs of this step have been truncated. If true, the logs has // been truncated to 10000 characters. - // Wire name: 'logs_truncated' LogsTruncated bool `json:"logs_truncated,omitempty"` // Name of the step in the job - // Wire name: 'name' Name string `json:"name,omitempty"` // Whether the name of the job has been truncated. If true, the name has // been truncated to 100 characters. - // Wire name: 'name_truncated' NameTruncated bool `json:"name_truncated,omitempty"` // State of the step - // Wire name: 'status' Status DbtPlatformRunStatus `json:"status,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DbtPlatformJobRunStep) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &dbtPlatformJobRunStepPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := dbtPlatformJobRunStepFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DbtPlatformJobRunStep) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DbtPlatformJobRunStep) MarshalJSON() ([]byte, error) { - pb, err := dbtPlatformJobRunStepToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DbtPlatformJobRunStep) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Response enumeration from calling the dbt platform API, for inclusion in @@ -1635,83 +1020,43 @@ func (f *DbtPlatformRunStatus) Type() string { type DbtPlatformTask struct { // The resource name of the UC connection that authenticates the dbt // platform for this task - // Wire name: 'connection_resource_name' ConnectionResourceName string `json:"connection_resource_name,omitempty"` // Id of the dbt platform job to be triggered. Specified as a string for // maximum compatibility with clients. - // Wire name: 'dbt_platform_job_id' DbtPlatformJobId string `json:"dbt_platform_job_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DbtPlatformTask) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &dbtPlatformTaskPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := dbtPlatformTaskFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DbtPlatformTask) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DbtPlatformTask) MarshalJSON() ([]byte, error) { - pb, err := dbtPlatformTaskToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DbtPlatformTask) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type DbtPlatformTaskOutput struct { // Id of the job run in dbt platform. Specified as a string for maximum // compatibility with clients. - // Wire name: 'dbt_platform_job_run_id' DbtPlatformJobRunId string `json:"dbt_platform_job_run_id,omitempty"` // Steps of the job run as received from dbt platform - // Wire name: 'dbt_platform_job_run_output' DbtPlatformJobRunOutput []DbtPlatformJobRunStep `json:"dbt_platform_job_run_output,omitempty"` // Url where full run details can be viewed - // Wire name: 'dbt_platform_job_run_url' DbtPlatformJobRunUrl string `json:"dbt_platform_job_run_url,omitempty"` // Whether the number of steps in the output has been truncated. If true, // the output will contain the first 20 steps of the output. - // Wire name: 'steps_truncated' StepsTruncated bool `json:"steps_truncated,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DbtPlatformTaskOutput) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &dbtPlatformTaskOutputPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := dbtPlatformTaskOutputFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DbtPlatformTaskOutput) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DbtPlatformTaskOutput) MarshalJSON() ([]byte, error) { - pb, err := dbtPlatformTaskOutputToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DbtPlatformTaskOutput) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type DbtTask struct { @@ -1719,26 +1064,21 @@ type DbtTask struct { // 3-level namespace of Unity Catalog (catalog / schema / relation). The // catalog value can only be specified if a warehouse_id is specified. // Requires dbt-databricks >= 1.1.1. - // Wire name: 'catalog' Catalog string `json:"catalog,omitempty"` // A list of dbt commands to execute. All commands must start with `dbt`. // This parameter must not be empty. A maximum of up to 10 commands can be // provided. - // Wire name: 'commands' Commands []string `json:"commands"` // Optional (relative) path to the profiles directory. Can only be specified // if no warehouse_id is specified. If no warehouse_id is specified and this // folder is unset, the root directory is used. - // Wire name: 'profiles_directory' ProfilesDirectory string `json:"profiles_directory,omitempty"` // Path to the project directory. Optional for Git sourced tasks, in which // case if no value is provided, the root of the Git repository is used. - // Wire name: 'project_directory' ProjectDirectory string `json:"project_directory,omitempty"` // Optional schema to write to. This parameter is only used when a // warehouse_id is also provided. If not provided, the `default` schema is // used. - // Wire name: 'schema' Schema string `json:"schema,omitempty"` // Optional location type of the project directory. When set to `WORKSPACE`, // the project will be retrieved from the local Databricks workspace. When @@ -1748,255 +1088,93 @@ type DbtTask struct { // // * `WORKSPACE`: Project is located in Databricks workspace. * `GIT`: // Project is located in cloud Git provider. - // Wire name: 'source' Source Source `json:"source,omitempty"` // ID of the SQL warehouse to connect to. If provided, we automatically // generate and provide the profile and connection details to dbt. It can be // overridden on a per-command basis by using the `--profiles-dir` command // line argument. - // Wire name: 'warehouse_id' WarehouseId string `json:"warehouse_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DbtTask) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &dbtTaskPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := dbtTaskFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DbtTask) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DbtTask) MarshalJSON() ([]byte, error) { - pb, err := dbtTaskToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DbtTask) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type DeleteJob struct { // The canonical identifier of the job to delete. This field is required. - // Wire name: 'job_id' JobId int64 `json:"job_id"` } -func (st *DeleteJob) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteJobPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteJobFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteJob) MarshalJSON() ([]byte, error) { - pb, err := deleteJobToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type DeleteResponse struct { } -func (st *DeleteResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type DeleteRun struct { // ID of the run to delete. - // Wire name: 'run_id' RunId int64 `json:"run_id"` } -func (st *DeleteRun) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteRunPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteRunFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteRun) MarshalJSON() ([]byte, error) { - pb, err := deleteRunToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type DeleteRunResponse struct { } -func (st *DeleteRunResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteRunResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteRunResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteRunResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteRunResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Represents a change to the job cluster's settings that would be required for // the job clusters to become compliant with their policies. type EnforcePolicyComplianceForJobResponseJobClusterSettingsChange struct { // The field where this change would be made, prepended with the job cluster // key. - // Wire name: 'field' Field string `json:"field,omitempty"` // The new value of this field after enforcing policy compliance (either a // number, a boolean, or a string) converted to a string. This is intended // to be read by a human. The typed new value of this field can be retrieved // by reading the settings field in the API response. - // Wire name: 'new_value' NewValue string `json:"new_value,omitempty"` // The previous value of this field before enforcing policy compliance // (either a number, a boolean, or a string) converted to a string. This is // intended to be read by a human. The type of the field can be retrieved by // reading the settings field in the API response. - // Wire name: 'previous_value' PreviousValue string `json:"previous_value,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *EnforcePolicyComplianceForJobResponseJobClusterSettingsChange) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &enforcePolicyComplianceForJobResponseJobClusterSettingsChangePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := enforcePolicyComplianceForJobResponseJobClusterSettingsChangeFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *EnforcePolicyComplianceForJobResponseJobClusterSettingsChange) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st EnforcePolicyComplianceForJobResponseJobClusterSettingsChange) MarshalJSON() ([]byte, error) { - pb, err := enforcePolicyComplianceForJobResponseJobClusterSettingsChangeToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s EnforcePolicyComplianceForJobResponseJobClusterSettingsChange) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type EnforcePolicyComplianceRequest struct { // The ID of the job you want to enforce policy compliance on. - // Wire name: 'job_id' JobId int64 `json:"job_id"` // If set, previews changes made to the job to comply with its policy, but // does not update the job. - // Wire name: 'validate_only' ValidateOnly bool `json:"validate_only,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *EnforcePolicyComplianceRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &enforcePolicyComplianceRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := enforcePolicyComplianceRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *EnforcePolicyComplianceRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st EnforcePolicyComplianceRequest) MarshalJSON() ([]byte, error) { - pb, err := enforcePolicyComplianceRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s EnforcePolicyComplianceRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type EnforcePolicyComplianceResponse struct { // Whether any changes have been made to the job cluster settings for the // job to become compliant with its policies. - // Wire name: 'has_changes' HasChanges bool `json:"has_changes,omitempty"` // A list of job cluster changes that have been made to the job’s cluster // settings in order for all job clusters to become compliant with their // policies. - // Wire name: 'job_cluster_changes' JobClusterChanges []EnforcePolicyComplianceForJobResponseJobClusterSettingsChange `json:"job_cluster_changes,omitempty"` // Updated job settings after policy enforcement. Policy enforcement only // applies to job clusters that are created when running the job (which are @@ -2004,35 +1182,17 @@ type EnforcePolicyComplianceResponse struct { // clusters. Updated job settings are derived by applying policy default // values to the existing job clusters in order to satisfy policy // requirements. - // Wire name: 'settings' Settings *JobSettings `json:"settings,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *EnforcePolicyComplianceResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &enforcePolicyComplianceResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := enforcePolicyComplianceResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *EnforcePolicyComplianceResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st EnforcePolicyComplianceResponse) MarshalJSON() ([]byte, error) { - pb, err := enforcePolicyComplianceResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s EnforcePolicyComplianceResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Run was exported successfully. @@ -2042,310 +1202,131 @@ type ExportRunOutput struct { // script]. // // [Python script]: https://docs.databricks.com/en/_static/examples/extract.py - // Wire name: 'views' Views []ViewItem `json:"views,omitempty"` } -func (st *ExportRunOutput) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &exportRunOutputPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := exportRunOutputFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ExportRunOutput) MarshalJSON() ([]byte, error) { - pb, err := exportRunOutputToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Export and retrieve a job run type ExportRunRequest struct { // The canonical identifier for the run. This field is required. - RunId int64 `json:"-" tf:"-"` + RunId int64 `json:"-" url:"run_id"` // Which views to export (CODE, DASHBOARDS, or ALL). Defaults to CODE. - ViewsToExport ViewsToExport `json:"-" tf:"-"` -} - -func (st *ExportRunRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &exportRunRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := exportRunRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ExportRunRequest) MarshalJSON() ([]byte, error) { - pb, err := exportRunRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + ViewsToExport ViewsToExport `json:"-" url:"views_to_export,omitempty"` } type FileArrivalTriggerConfiguration struct { // If set, the trigger starts a run only after the specified amount of time // passed since the last time the trigger fired. The minimum allowed value // is 60 seconds - // Wire name: 'min_time_between_triggers_seconds' MinTimeBetweenTriggersSeconds int `json:"min_time_between_triggers_seconds,omitempty"` // URL to be monitored for file arrivals. The path must point to the root or // a subpath of the external location. - // Wire name: 'url' Url string `json:"url"` // If set, the trigger starts a run only after no file activity has occurred // for the specified amount of time. This makes it possible to wait for a // batch of incoming files to arrive before triggering a run. The minimum // allowed value is 60 seconds. - // Wire name: 'wait_after_last_change_seconds' WaitAfterLastChangeSeconds int `json:"wait_after_last_change_seconds,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *FileArrivalTriggerConfiguration) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &fileArrivalTriggerConfigurationPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := fileArrivalTriggerConfigurationFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *FileArrivalTriggerConfiguration) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st FileArrivalTriggerConfiguration) MarshalJSON() ([]byte, error) { - pb, err := fileArrivalTriggerConfigurationToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s FileArrivalTriggerConfiguration) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type FileArrivalTriggerState struct { // Indicates whether the trigger leverages file events to detect file // arrivals. - // Wire name: 'using_file_events' UsingFileEvents bool `json:"using_file_events,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *FileArrivalTriggerState) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &fileArrivalTriggerStatePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := fileArrivalTriggerStateFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *FileArrivalTriggerState) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st FileArrivalTriggerState) MarshalJSON() ([]byte, error) { - pb, err := fileArrivalTriggerStateToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s FileArrivalTriggerState) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ForEachStats struct { // Sample of 3 most common error messages occurred during the iteration. - // Wire name: 'error_message_stats' ErrorMessageStats []ForEachTaskErrorMessageStats `json:"error_message_stats,omitempty"` // Describes stats of the iteration. Only latest retries are considered. - // Wire name: 'task_run_stats' TaskRunStats *ForEachTaskTaskRunStats `json:"task_run_stats,omitempty"` } -func (st *ForEachStats) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &forEachStatsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := forEachStatsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ForEachStats) MarshalJSON() ([]byte, error) { - pb, err := forEachStatsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type ForEachTask struct { // An optional maximum allowed number of concurrent runs of the task. Set // this value if you want to be able to execute multiple runs of the task // concurrently. - // Wire name: 'concurrency' Concurrency int `json:"concurrency,omitempty"` // Array for task to iterate on. This can be a JSON string or a reference to // an array parameter. - // Wire name: 'inputs' Inputs string `json:"inputs"` // Configuration for the task that will be run for each element in the array - // Wire name: 'task' Task Task `json:"task"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ForEachTask) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &forEachTaskPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := forEachTaskFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ForEachTask) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ForEachTask) MarshalJSON() ([]byte, error) { - pb, err := forEachTaskToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ForEachTask) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ForEachTaskErrorMessageStats struct { // Describes the count of such error message encountered during the // iterations. - // Wire name: 'count' Count int `json:"count,omitempty"` // Describes the error message occured during the iterations. - // Wire name: 'error_message' ErrorMessage string `json:"error_message,omitempty"` // Describes the termination reason for the error message. - // Wire name: 'termination_category' TerminationCategory string `json:"termination_category,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ForEachTaskErrorMessageStats) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &forEachTaskErrorMessageStatsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := forEachTaskErrorMessageStatsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ForEachTaskErrorMessageStats) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ForEachTaskErrorMessageStats) MarshalJSON() ([]byte, error) { - pb, err := forEachTaskErrorMessageStatsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ForEachTaskErrorMessageStats) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ForEachTaskTaskRunStats struct { // Describes the iteration runs having an active lifecycle state or an // active run sub state. - // Wire name: 'active_iterations' ActiveIterations int `json:"active_iterations,omitempty"` // Describes the number of failed and succeeded iteration runs. - // Wire name: 'completed_iterations' CompletedIterations int `json:"completed_iterations,omitempty"` // Describes the number of failed iteration runs. - // Wire name: 'failed_iterations' FailedIterations int `json:"failed_iterations,omitempty"` // Describes the number of iteration runs that have been scheduled. - // Wire name: 'scheduled_iterations' ScheduledIterations int `json:"scheduled_iterations,omitempty"` // Describes the number of succeeded iteration runs. - // Wire name: 'succeeded_iterations' SucceededIterations int `json:"succeeded_iterations,omitempty"` // Describes the length of the list of items to iterate over. - // Wire name: 'total_iterations' TotalIterations int `json:"total_iterations,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ForEachTaskTaskRunStats) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &forEachTaskTaskRunStatsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := forEachTaskTaskRunStatsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ForEachTaskTaskRunStats) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ForEachTaskTaskRunStats) MarshalJSON() ([]byte, error) { - pb, err := forEachTaskTaskRunStatsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ForEachTaskTaskRunStats) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type Format string @@ -2387,18 +1368,14 @@ func (f *Format) Type() string { type GenAiComputeTask struct { // Command launcher to run the actual script, e.g. bash, python etc. - // Wire name: 'command' Command string `json:"command,omitempty"` - // Wire name: 'compute' Compute *ComputeConfig `json:"compute,omitempty"` // Runtime image - // Wire name: 'dl_runtime_image' DlRuntimeImage string `json:"dl_runtime_image"` // Optional string containing the name of the MLflow experiment to log the // run to. If name is not found, backend will create the mlflow experiment // using the name. - // Wire name: 'mlflow_experiment_name' MlflowExperimentName string `json:"mlflow_experiment_name,omitempty"` // Optional location type of the training script. When set to `WORKSPACE`, // the script will be retrieved from the local Databricks workspace. When @@ -2407,212 +1384,73 @@ type GenAiComputeTask struct { // `git_source` is defined and `WORKSPACE` otherwise. * `WORKSPACE`: Script // is located in Databricks workspace. * `GIT`: Script is located in cloud // Git provider. - // Wire name: 'source' Source Source `json:"source,omitempty"` // The training script file path to be executed. Cloud file URIs (such as // dbfs:/, s3:/, adls:/, gcs:/) and workspace paths are supported. For // python files stored in the Databricks workspace, the path must be // absolute and begin with `/`. For files stored in a remote repository, the // path must be relative. This field is required. - // Wire name: 'training_script_path' TrainingScriptPath string `json:"training_script_path,omitempty"` // Optional string containing model parameters passed to the training script // in yaml format. If present, then the content in yaml_parameters_file_path // will be ignored. - // Wire name: 'yaml_parameters' YamlParameters string `json:"yaml_parameters,omitempty"` // Optional path to a YAML file containing model parameters passed to the // training script. - // Wire name: 'yaml_parameters_file_path' YamlParametersFilePath string `json:"yaml_parameters_file_path,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GenAiComputeTask) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &genAiComputeTaskPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := genAiComputeTaskFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GenAiComputeTask) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GenAiComputeTask) MarshalJSON() ([]byte, error) { - pb, err := genAiComputeTaskToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GenAiComputeTask) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get job permission levels type GetJobPermissionLevelsRequest struct { // The job for which to get or manage permissions. - JobId string `json:"-" tf:"-"` -} - -func (st *GetJobPermissionLevelsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getJobPermissionLevelsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getJobPermissionLevelsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetJobPermissionLevelsRequest) MarshalJSON() ([]byte, error) { - pb, err := getJobPermissionLevelsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + JobId string `json:"-" url:"-"` } type GetJobPermissionLevelsResponse struct { // Specific permission levels - // Wire name: 'permission_levels' PermissionLevels []JobPermissionsDescription `json:"permission_levels,omitempty"` } -func (st *GetJobPermissionLevelsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getJobPermissionLevelsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getJobPermissionLevelsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetJobPermissionLevelsResponse) MarshalJSON() ([]byte, error) { - pb, err := getJobPermissionLevelsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Get job permissions type GetJobPermissionsRequest struct { // The job for which to get or manage permissions. - JobId string `json:"-" tf:"-"` -} - -func (st *GetJobPermissionsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getJobPermissionsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getJobPermissionsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetJobPermissionsRequest) MarshalJSON() ([]byte, error) { - pb, err := getJobPermissionsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + JobId string `json:"-" url:"-"` } // Get a single job type GetJobRequest struct { // The canonical identifier of the job to retrieve information about. This // field is required. - JobId int64 `json:"-" tf:"-"` + JobId int64 `json:"-" url:"job_id"` // Use `next_page_token` returned from the previous GetJob response to // request the next page of the job's array properties. - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetJobRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getJobRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getJobRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetJobRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetJobRequest) MarshalJSON() ([]byte, error) { - pb, err := getJobRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetJobRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get job policy compliance type GetPolicyComplianceRequest struct { // The ID of the job whose compliance status you are requesting. - JobId int64 `json:"-" tf:"-"` -} - -func (st *GetPolicyComplianceRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getPolicyComplianceRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getPolicyComplianceRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetPolicyComplianceRequest) MarshalJSON() ([]byte, error) { - pb, err := getPolicyComplianceRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + JobId int64 `json:"-" url:"job_id"` } type GetPolicyComplianceResponse struct { @@ -2620,114 +1458,53 @@ type GetPolicyComplianceResponse struct { // of compliance if a policy they are using was updated after the job was // last edited and some of its job clusters no longer comply with their // updated policies. - // Wire name: 'is_compliant' IsCompliant bool `json:"is_compliant,omitempty"` // An object containing key-value mappings representing the first 200 policy // validation errors. The keys indicate the path where the policy validation // error is occurring. An identifier for the job cluster is prepended to the // path. The values indicate an error message describing the policy // validation error. - // Wire name: 'violations' Violations map[string]string `json:"violations,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetPolicyComplianceResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getPolicyComplianceResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getPolicyComplianceResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetPolicyComplianceResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetPolicyComplianceResponse) MarshalJSON() ([]byte, error) { - pb, err := getPolicyComplianceResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetPolicyComplianceResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get the output for a single run type GetRunOutputRequest struct { // The canonical identifier for the run. - RunId int64 `json:"-" tf:"-"` -} - -func (st *GetRunOutputRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getRunOutputRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getRunOutputRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetRunOutputRequest) MarshalJSON() ([]byte, error) { - pb, err := getRunOutputRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + RunId int64 `json:"-" url:"run_id"` } // Get a single job run type GetRunRequest struct { // Whether to include the repair history in the response. - IncludeHistory bool `json:"-" tf:"-"` + IncludeHistory bool `json:"-" url:"include_history,omitempty"` // Whether to include resolved parameter values in the response. - IncludeResolvedValues bool `json:"-" tf:"-"` + IncludeResolvedValues bool `json:"-" url:"include_resolved_values,omitempty"` // Use `next_page_token` returned from the previous GetRun response to // request the next page of the run's array properties. - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` // The canonical identifier of the run for which to retrieve the metadata. // This field is required. - RunId int64 `json:"-" tf:"-"` + RunId int64 `json:"-" url:"run_id"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetRunRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getRunRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getRunRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetRunRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetRunRequest) MarshalJSON() ([]byte, error) { - pb, err := getRunRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetRunRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type GitProvider string @@ -2791,35 +1568,17 @@ type GitSnapshot struct { // Commit that was used to execute the run. If git_branch was specified, // this points to the HEAD of the branch at the time of the run; if git_tag // was specified, this points to the commit the tag points to. - // Wire name: 'used_commit' UsedCommit string `json:"used_commit,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GitSnapshot) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &gitSnapshotPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := gitSnapshotFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GitSnapshot) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GitSnapshot) MarshalJSON() ([]byte, error) { - pb, err := gitSnapshotToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GitSnapshot) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // An optional specification for a remote Git repository containing the source @@ -2835,69 +1594,43 @@ func (st GitSnapshot) MarshalJSON() ([]byte, error) { type GitSource struct { // Name of the branch to be checked out and used by this job. This field // cannot be specified in conjunction with git_tag or git_commit. - // Wire name: 'git_branch' GitBranch string `json:"git_branch,omitempty"` // Commit to be checked out and used by this job. This field cannot be // specified in conjunction with git_branch or git_tag. - // Wire name: 'git_commit' GitCommit string `json:"git_commit,omitempty"` // Unique identifier of the service used to host the Git repository. The // value is case insensitive. - // Wire name: 'git_provider' GitProvider GitProvider `json:"git_provider"` // Read-only state of the remote repository at the time the job was run. // This field is only included on job runs. - // Wire name: 'git_snapshot' GitSnapshot *GitSnapshot `json:"git_snapshot,omitempty"` // Name of the tag to be checked out and used by this job. This field cannot // be specified in conjunction with git_branch or git_commit. - // Wire name: 'git_tag' GitTag string `json:"git_tag,omitempty"` // URL of the repository to be cloned by this job. - // Wire name: 'git_url' GitUrl string `json:"git_url"` // The source of the job specification in the remote repository when the job // is source controlled. - // Wire name: 'job_source' JobSource *JobSource `json:"job_source,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GitSource) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &gitSourcePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := gitSourceFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GitSource) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GitSource) MarshalJSON() ([]byte, error) { - pb, err := gitSourceToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GitSource) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Job was retrieved successfully. type Job struct { // The time at which this job was created in epoch milliseconds // (milliseconds since 1/1/1970 UTC). - // Wire name: 'created_time' CreatedTime int64 `json:"created_time,omitempty"` // The creator user name. This field won’t be included in the response if // the user has already been deleted. - // Wire name: 'creator_user_name' CreatorUserName string `json:"creator_user_name,omitempty"` // The id of the budget policy used by this job for cost attribution // purposes. This may be set through (in order of precedence): 1. Budget @@ -2905,19 +1638,15 @@ type Job struct { // details page and Jobs API using `budget_policy_id` 3. Inferred default // based on accessible budget policies of the run_as identity on job // creation or modification. - // Wire name: 'effective_budget_policy_id' EffectiveBudgetPolicyId string `json:"effective_budget_policy_id,omitempty"` // Indicates if the job has more array properties (`tasks`, `job_clusters`) // that are not shown. They can be accessed via :method:jobs/get endpoint. // It is only relevant for API 2.2 :method:jobs/list requests with // `expand_tasks=true`. - // Wire name: 'has_more' HasMore bool `json:"has_more,omitempty"` // The canonical identifier for this job. - // Wire name: 'job_id' JobId int64 `json:"job_id,omitempty"` // A token that can be used to list the next page of array properties. - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` // The email of an active workspace user or the application ID of a service // principal that the job runs as. This value can be changed by setting the @@ -2926,246 +1655,117 @@ type Job struct { // By default, `run_as_user_name` is based on the current job settings and // is set to the creator of the job if job access control is disabled or to // the user with the `is_owner` permission if job access control is enabled. - // Wire name: 'run_as_user_name' RunAsUserName string `json:"run_as_user_name,omitempty"` // Settings for this job and all of its runs. These settings can be updated // using the `resetJob` method. - // Wire name: 'settings' Settings *JobSettings `json:"settings,omitempty"` // State of the trigger associated with the job. - // Wire name: 'trigger_state' TriggerState *TriggerStateProto `json:"trigger_state,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *Job) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &jobPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := jobFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *Job) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st Job) MarshalJSON() ([]byte, error) { - pb, err := jobToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s Job) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type JobAccessControlRequest struct { // name of the group - // Wire name: 'group_name' GroupName string `json:"group_name,omitempty"` // Permission level - // Wire name: 'permission_level' PermissionLevel JobPermissionLevel `json:"permission_level,omitempty"` // application ID of a service principal - // Wire name: 'service_principal_name' ServicePrincipalName string `json:"service_principal_name,omitempty"` // name of the user - // Wire name: 'user_name' UserName string `json:"user_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *JobAccessControlRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &jobAccessControlRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := jobAccessControlRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *JobAccessControlRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st JobAccessControlRequest) MarshalJSON() ([]byte, error) { - pb, err := jobAccessControlRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s JobAccessControlRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type JobAccessControlResponse struct { // All permissions. - // Wire name: 'all_permissions' AllPermissions []JobPermission `json:"all_permissions,omitempty"` // Display name of the user or service principal. - // Wire name: 'display_name' DisplayName string `json:"display_name,omitempty"` // name of the group - // Wire name: 'group_name' GroupName string `json:"group_name,omitempty"` // Name of the service principal. - // Wire name: 'service_principal_name' ServicePrincipalName string `json:"service_principal_name,omitempty"` // name of the user - // Wire name: 'user_name' UserName string `json:"user_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *JobAccessControlResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &jobAccessControlResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := jobAccessControlResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *JobAccessControlResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st JobAccessControlResponse) MarshalJSON() ([]byte, error) { - pb, err := jobAccessControlResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s JobAccessControlResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type JobCluster struct { // A unique name for the job cluster. This field is required and must be // unique within the job. `JobTaskSettings` may refer to this field to // determine which cluster to launch for the task execution. - // Wire name: 'job_cluster_key' JobClusterKey string `json:"job_cluster_key"` // If new_cluster, a description of a cluster that is created for each task. - // Wire name: 'new_cluster' NewCluster compute.ClusterSpec `json:"new_cluster"` } -func (st *JobCluster) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &jobClusterPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := jobClusterFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st JobCluster) MarshalJSON() ([]byte, error) { - pb, err := jobClusterToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type JobCompliance struct { // Whether this job is in compliance with the latest version of its policy. - // Wire name: 'is_compliant' IsCompliant bool `json:"is_compliant,omitempty"` // Canonical unique identifier for a job. - // Wire name: 'job_id' JobId int64 `json:"job_id"` // An object containing key-value mappings representing the first 200 policy // validation errors. The keys indicate the path where the policy validation // error is occurring. An identifier for the job cluster is prepended to the // path. The values indicate an error message describing the policy // validation error. - // Wire name: 'violations' Violations map[string]string `json:"violations,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *JobCompliance) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &jobCompliancePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := jobComplianceFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *JobCompliance) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st JobCompliance) MarshalJSON() ([]byte, error) { - pb, err := jobComplianceToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s JobCompliance) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type JobDeployment struct { // The kind of deployment that manages the job. // // * `BUNDLE`: The job is managed by Databricks Asset Bundle. - // Wire name: 'kind' Kind JobDeploymentKind `json:"kind"` // Path of the file that contains deployment metadata. - // Wire name: 'metadata_file_path' MetadataFilePath string `json:"metadata_file_path,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *JobDeployment) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &jobDeploymentPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := jobDeploymentFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *JobDeployment) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st JobDeployment) MarshalJSON() ([]byte, error) { - pb, err := jobDeploymentToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s JobDeployment) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // * `BUNDLE`: The job is managed by Databricks Asset Bundle. @@ -3251,25 +1851,21 @@ type JobEmailNotifications struct { // If true, do not send email to recipients specified in `on_failure` if the // run is skipped. This field is `deprecated`. Please use the // `notification_settings.no_alert_for_skipped_runs` field. - // Wire name: 'no_alert_for_skipped_runs' NoAlertForSkippedRuns bool `json:"no_alert_for_skipped_runs,omitempty"` // A list of email addresses to be notified when the duration of a run // exceeds the threshold specified for the `RUN_DURATION_SECONDS` metric in // the `health` field. If no rule for the `RUN_DURATION_SECONDS` metric is // specified in the `health` field for the job, notifications are not sent. - // Wire name: 'on_duration_warning_threshold_exceeded' OnDurationWarningThresholdExceeded []string `json:"on_duration_warning_threshold_exceeded,omitempty"` // A list of email addresses to be notified when a run unsuccessfully // completes. A run is considered to have completed unsuccessfully if it // ends with an `INTERNAL_ERROR` `life_cycle_state` or a `FAILED`, or // `TIMED_OUT` result_state. If this is not specified on job creation, // reset, or update the list is empty, and notifications are not sent. - // Wire name: 'on_failure' OnFailure []string `json:"on_failure,omitempty"` // A list of email addresses to be notified when a run begins. If not // specified on job creation, reset, or update, the list is empty, and // notifications are not sent. - // Wire name: 'on_start' OnStart []string `json:"on_start,omitempty"` // A list of email addresses to notify when any streaming backlog thresholds // are exceeded for any stream. Streaming backlog thresholds can be set in @@ -3278,230 +1874,97 @@ type JobEmailNotifications struct { // `STREAMING_BACKLOG_SECONDS`, or `STREAMING_BACKLOG_FILES`. Alerting is // based on the 10-minute average of these metrics. If the issue persists, // notifications are resent every 30 minutes. - // Wire name: 'on_streaming_backlog_exceeded' OnStreamingBacklogExceeded []string `json:"on_streaming_backlog_exceeded,omitempty"` // A list of email addresses to be notified when a run successfully // completes. A run is considered to have completed successfully if it ends // with a `TERMINATED` `life_cycle_state` and a `SUCCESS` result_state. If // not specified on job creation, reset, or update, the list is empty, and // notifications are not sent. - // Wire name: 'on_success' OnSuccess []string `json:"on_success,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *JobEmailNotifications) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &jobEmailNotificationsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := jobEmailNotificationsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *JobEmailNotifications) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st JobEmailNotifications) MarshalJSON() ([]byte, error) { - pb, err := jobEmailNotificationsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s JobEmailNotifications) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type JobEnvironment struct { // The key of an environment. It has to be unique within a job. - // Wire name: 'environment_key' EnvironmentKey string `json:"environment_key"` // The environment entity used to preserve serverless environment side // panel, jobs' environment for non-notebook task, and DLT's environment for // classic and serverless pipelines. In this minimal environment spec, only - // pip dependencies are supported. - // Wire name: 'spec' - Spec *compute.Environment `json:"spec,omitempty"` -} - -func (st *JobEnvironment) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &jobEnvironmentPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := jobEnvironmentFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st JobEnvironment) MarshalJSON() ([]byte, error) { - pb, err := jobEnvironmentToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + // pip dependencies are supported. + Spec *compute.Environment `json:"spec,omitempty"` } type JobNotificationSettings struct { // If true, do not send notifications to recipients specified in // `on_failure` if the run is canceled. - // Wire name: 'no_alert_for_canceled_runs' NoAlertForCanceledRuns bool `json:"no_alert_for_canceled_runs,omitempty"` // If true, do not send notifications to recipients specified in // `on_failure` if the run is skipped. - // Wire name: 'no_alert_for_skipped_runs' NoAlertForSkippedRuns bool `json:"no_alert_for_skipped_runs,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *JobNotificationSettings) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &jobNotificationSettingsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := jobNotificationSettingsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *JobNotificationSettings) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st JobNotificationSettings) MarshalJSON() ([]byte, error) { - pb, err := jobNotificationSettingsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s JobNotificationSettings) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type JobParameter struct { // The optional default value of the parameter - // Wire name: 'default' Default string `json:"default,omitempty"` // The name of the parameter - // Wire name: 'name' Name string `json:"name,omitempty"` // The value used in the run - // Wire name: 'value' Value string `json:"value,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *JobParameter) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &jobParameterPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := jobParameterFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *JobParameter) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st JobParameter) MarshalJSON() ([]byte, error) { - pb, err := jobParameterToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s JobParameter) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type JobParameterDefinition struct { // Default value of the parameter. - // Wire name: 'default' Default string `json:"default"` // The name of the defined parameter. May only contain alphanumeric // characters, `_`, `-`, and `.` - // Wire name: 'name' Name string `json:"name"` } -func (st *JobParameterDefinition) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &jobParameterDefinitionPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := jobParameterDefinitionFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st JobParameterDefinition) MarshalJSON() ([]byte, error) { - pb, err := jobParameterDefinitionToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type JobPermission struct { - - // Wire name: 'inherited' Inherited bool `json:"inherited,omitempty"` - // Wire name: 'inherited_from_object' InheritedFromObject []string `json:"inherited_from_object,omitempty"` // Permission level - // Wire name: 'permission_level' PermissionLevel JobPermissionLevel `json:"permission_level,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *JobPermission) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &jobPermissionPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := jobPermissionFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *JobPermission) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st JobPermission) MarshalJSON() ([]byte, error) { - pb, err := jobPermissionToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s JobPermission) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Permission level @@ -3549,111 +2012,43 @@ func (f *JobPermissionLevel) Type() string { } type JobPermissions struct { - - // Wire name: 'access_control_list' AccessControlList []JobAccessControlResponse `json:"access_control_list,omitempty"` - // Wire name: 'object_id' ObjectId string `json:"object_id,omitempty"` - // Wire name: 'object_type' ObjectType string `json:"object_type,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *JobPermissions) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &jobPermissionsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := jobPermissionsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *JobPermissions) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st JobPermissions) MarshalJSON() ([]byte, error) { - pb, err := jobPermissionsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s JobPermissions) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type JobPermissionsDescription struct { - - // Wire name: 'description' Description string `json:"description,omitempty"` // Permission level - // Wire name: 'permission_level' PermissionLevel JobPermissionLevel `json:"permission_level,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *JobPermissionsDescription) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &jobPermissionsDescriptionPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := jobPermissionsDescriptionFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *JobPermissionsDescription) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st JobPermissionsDescription) MarshalJSON() ([]byte, error) { - pb, err := jobPermissionsDescriptionToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s JobPermissionsDescription) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type JobPermissionsRequest struct { - - // Wire name: 'access_control_list' AccessControlList []JobAccessControlRequest `json:"access_control_list,omitempty"` // The job for which to get or manage permissions. - JobId string `json:"-" tf:"-"` -} - -func (st *JobPermissionsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &jobPermissionsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := jobPermissionsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st JobPermissionsRequest) MarshalJSON() ([]byte, error) { - pb, err := jobPermissionsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + JobId string `json:"-" url:"-"` } // Write-only setting. Specifies the user or service principal that the job runs @@ -3664,39 +2059,20 @@ func (st JobPermissionsRequest) MarshalJSON() ([]byte, error) { type JobRunAs struct { // Application ID of an active service principal. Setting this field // requires the `servicePrincipal/user` role. - // Wire name: 'service_principal_name' ServicePrincipalName string `json:"service_principal_name,omitempty"` // The email of an active workspace user. Non-admin users can only set this // field to their own email. - // Wire name: 'user_name' UserName string `json:"user_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *JobRunAs) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &jobRunAsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := jobRunAsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *JobRunAs) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st JobRunAs) MarshalJSON() ([]byte, error) { - pb, err := jobRunAsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s JobRunAs) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type JobSettings struct { @@ -3704,29 +2080,23 @@ type JobSettings struct { // specified, a default budget policy may be applied when creating or // modifying the job. See `effective_budget_policy_id` for the budget policy // used by this workload. - // Wire name: 'budget_policy_id' BudgetPolicyId string `json:"budget_policy_id,omitempty"` // An optional continuous property for this job. The continuous property // will ensure that there is always one run executing. Only one of // `schedule` and `continuous` can be used. - // Wire name: 'continuous' Continuous *Continuous `json:"continuous,omitempty"` // Deployment information for jobs managed by external sources. - // Wire name: 'deployment' Deployment *JobDeployment `json:"deployment,omitempty"` // An optional description for the job. The maximum length is 27700 // characters in UTF-8 encoding. - // Wire name: 'description' Description string `json:"description,omitempty"` // Edit mode of the job. // // * `UI_LOCKED`: The job is in a locked UI state and cannot be modified. * // `EDITABLE`: The job is in an editable state and can be modified. - // Wire name: 'edit_mode' EditMode JobEditMode `json:"edit_mode,omitempty"` // An optional set of email addresses that is notified when runs of this job // begin or complete as well as when this job is deleted. - // Wire name: 'email_notifications' EmailNotifications *JobEmailNotifications `json:"email_notifications,omitempty"` // A list of task execution environment specifications that can be // referenced by serverless tasks of this job. An environment is required to @@ -3734,12 +2104,10 @@ type JobSettings struct { // environment is accessible in the notebook environment panel. For other // serverless tasks, the task environment is required to be specified using // environment_key in the task settings. - // Wire name: 'environments' Environments []JobEnvironment `json:"environments,omitempty"` // Used to tell what is the format of the job. This field is ignored in // Create/Update/Reset calls. When using the Jobs API 2.1 this value is // always set to `"MULTI_TASK"`. - // Wire name: 'format' Format Format `json:"format,omitempty"` // An optional specification for a remote Git repository containing the // source code used by tasks. Version-controlled source code is supported by @@ -3751,15 +2119,12 @@ type JobSettings struct { // // Note: dbt and SQL File tasks support only version-controlled sources. If // dbt or SQL File tasks are used, `git_source` must be defined on the job. - // Wire name: 'git_source' GitSource *GitSource `json:"git_source,omitempty"` // An optional set of health rules that can be defined for this job. - // Wire name: 'health' Health *JobsHealthRules `json:"health,omitempty"` // A list of job cluster specifications that can be shared and reused by // tasks of this job. Libraries cannot be declared in a shared job cluster. // You must declare dependent libraries in task settings. - // Wire name: 'job_clusters' JobClusters []JobCluster `json:"job_clusters,omitempty"` // An optional maximum allowed number of concurrent runs of the job. Set // this value if you want to be able to execute multiple runs of the same @@ -3772,19 +2137,15 @@ type JobSettings struct { // runs. However, from then on, new runs are skipped unless there are fewer // than 3 active runs. This value cannot exceed 1000. Setting this value to // `0` causes all new runs to be skipped. - // Wire name: 'max_concurrent_runs' MaxConcurrentRuns int `json:"max_concurrent_runs,omitempty"` // An optional name for the job. The maximum length is 4096 bytes in UTF-8 // encoding. - // Wire name: 'name' Name string `json:"name,omitempty"` // Optional notification settings that are used when sending notifications // to each of the `email_notifications` and `webhook_notifications` for this // job. - // Wire name: 'notification_settings' NotificationSettings *JobNotificationSettings `json:"notification_settings,omitempty"` // Job-level parameter definitions - // Wire name: 'parameters' Parameters []JobParameterDefinition `json:"parameters,omitempty"` // The performance mode on a serverless job. This field determines the level // of compute performance or cost-efficiency for the run. @@ -3792,28 +2153,23 @@ type JobSettings struct { // * `STANDARD`: Enables cost-efficient execution of serverless workloads. * // `PERFORMANCE_OPTIMIZED`: Prioritizes fast startup and execution times // through rapid scaling and optimized cluster performance. - // Wire name: 'performance_target' PerformanceTarget PerformanceTarget `json:"performance_target,omitempty"` // The queue settings of the job. - // Wire name: 'queue' Queue *QueueSettings `json:"queue,omitempty"` // Write-only setting. Specifies the user or service principal that the job // runs as. If not specified, the job runs as the user who created the job. // // Either `user_name` or `service_principal_name` should be specified. If // not, an error is thrown. - // Wire name: 'run_as' RunAs *JobRunAs `json:"run_as,omitempty"` // An optional periodic schedule for this job. The default behavior is that // the job only runs when triggered by clicking “Run Now” in the Jobs UI // or sending an API request to `runNow`. - // Wire name: 'schedule' Schedule *CronSchedule `json:"schedule,omitempty"` // A map of tags associated with the job. These are forwarded to the cluster // as cluster tags for jobs clusters, and are subject to the same // limitations as cluster tags. A maximum of 25 tags can be added to the // job. - // Wire name: 'tags' Tags map[string]string `json:"tags,omitempty"` // A list of task specifications to be executed by this job. It supports up // to 1000 elements in write endpoints (:method:jobs/create, @@ -3822,48 +2178,27 @@ type JobSettings struct { // you can paginate through them using :method:jobs/get. Use the // `next_page_token` field at the object root to determine if more results // are available. - // Wire name: 'tasks' Tasks []Task `json:"tasks,omitempty"` // An optional timeout applied to each run of this job. A value of `0` means // no timeout. - // Wire name: 'timeout_seconds' TimeoutSeconds int `json:"timeout_seconds,omitempty"` // A configuration to trigger a run when certain conditions are met. The // default behavior is that the job runs only when triggered by clicking // “Run Now” in the Jobs UI or sending an API request to `runNow`. - // Wire name: 'trigger' Trigger *TriggerSettings `json:"trigger,omitempty"` // A collection of system notification IDs to notify when runs of this job // begin or complete. - // Wire name: 'webhook_notifications' WebhookNotifications *WebhookNotifications `json:"webhook_notifications,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *JobSettings) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &jobSettingsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := jobSettingsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *JobSettings) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st JobSettings) MarshalJSON() ([]byte, error) { - pb, err := jobSettingsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s JobSettings) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The source of the job specification in the remote repository when the job is @@ -3878,41 +2213,13 @@ type JobSource struct { // disconnected from the remote job specification and is allowed for live // edit. Import the remote job specification again from UI to make the job // fully synced. - // Wire name: 'dirty_state' DirtyState JobSourceDirtyState `json:"dirty_state,omitempty"` // Name of the branch which the job is imported from. - // Wire name: 'import_from_git_branch' ImportFromGitBranch string `json:"import_from_git_branch"` // Path of the job YAML file that contains the job specification. - // Wire name: 'job_config_path' JobConfigPath string `json:"job_config_path"` } -func (st *JobSource) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &jobSourcePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := jobSourceFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st JobSource) MarshalJSON() ([]byte, error) { - pb, err := jobSourceToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Dirty state indicates the job is not fully synced with the job specification // in the remote repository. // @@ -4079,116 +2386,41 @@ type JobsHealthRule struct { // across all streams. This metric is in Public Preview. * // `STREAMING_BACKLOG_FILES`: An estimate of the maximum number of // outstanding files across all streams. This metric is in Public Preview. - // Wire name: 'metric' Metric JobsHealthMetric `json:"metric"` // Specifies the operator used to compare the health metric value with the // specified threshold. - // Wire name: 'op' Op JobsHealthOperator `json:"op"` // Specifies the threshold value that the health metric should obey to // satisfy the health rule. - // Wire name: 'value' Value int64 `json:"value"` } -func (st *JobsHealthRule) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &jobsHealthRulePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := jobsHealthRuleFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st JobsHealthRule) MarshalJSON() ([]byte, error) { - pb, err := jobsHealthRuleToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // An optional set of health rules that can be defined for this job. type JobsHealthRules struct { - - // Wire name: 'rules' Rules []JobsHealthRule `json:"rules,omitempty"` } -func (st *JobsHealthRules) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &jobsHealthRulesPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := jobsHealthRulesFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st JobsHealthRules) MarshalJSON() ([]byte, error) { - pb, err := jobsHealthRulesToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type ListJobComplianceForPolicyResponse struct { // A list of jobs and their policy compliance statuses. - // Wire name: 'jobs' Jobs []JobCompliance `json:"jobs,omitempty"` // This field represents the pagination token to retrieve the next page of // results. If this field is not in the response, it means no further // results for the request. - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` // This field represents the pagination token to retrieve the previous page // of results. If this field is not in the response, it means no further // results for the request. - // Wire name: 'prev_page_token' PrevPageToken string `json:"prev_page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListJobComplianceForPolicyResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listJobComplianceForPolicyResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listJobComplianceForPolicyResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListJobComplianceForPolicyResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListJobComplianceForPolicyResponse) MarshalJSON() ([]byte, error) { - pb, err := listJobComplianceForPolicyResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListJobComplianceForPolicyResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // List job policy compliance @@ -4196,39 +2428,22 @@ type ListJobComplianceRequest struct { // Use this field to specify the maximum number of results to be returned by // the server. The server may further constrain the maximum number of // results returned in a single page. - PageSize int `json:"-" tf:"-"` + PageSize int `json:"-" url:"page_size,omitempty"` // A page token that can be used to navigate to the next page or previous // page as returned by `next_page_token` or `prev_page_token`. - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` // Canonical unique identifier for the cluster policy. - PolicyId string `json:"-" tf:"-"` + PolicyId string `json:"-" url:"policy_id"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListJobComplianceRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listJobComplianceRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listJobComplianceRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListJobComplianceRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListJobComplianceRequest) MarshalJSON() ([]byte, error) { - pb, err := listJobComplianceRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListJobComplianceRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // List jobs @@ -4236,92 +2451,54 @@ type ListJobsRequest struct { // Whether to include task and cluster details in the response. Note that // only the first 100 elements will be shown. Use :method:jobs/get to // paginate through all tasks and clusters. - ExpandTasks bool `json:"-" tf:"-"` + ExpandTasks bool `json:"-" url:"expand_tasks,omitempty"` // The number of jobs to return. This value must be greater than 0 and less // or equal to 100. The default value is 20. - Limit int `json:"-" tf:"-"` + Limit int `json:"-" url:"limit,omitempty"` // A filter on the list based on the exact (case insensitive) job name. - Name string `json:"-" tf:"-"` + Name string `json:"-" url:"name,omitempty"` // The offset of the first job to return, relative to the most recently // created job. Deprecated since June 2023. Use `page_token` to iterate // through the pages instead. - Offset int `json:"-" tf:"-"` + Offset int `json:"-" url:"offset,omitempty"` // Use `next_page_token` or `prev_page_token` returned from the previous // request to list the next or previous page of jobs respectively. - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListJobsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listJobsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listJobsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListJobsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListJobsRequest) MarshalJSON() ([]byte, error) { - pb, err := listJobsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListJobsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // List of jobs was retrieved successfully. type ListJobsResponse struct { // If true, additional jobs matching the provided filter are available for // listing. - // Wire name: 'has_more' HasMore bool `json:"has_more,omitempty"` // The list of jobs. Only included in the response if there are jobs to // list. - // Wire name: 'jobs' Jobs []BaseJob `json:"jobs,omitempty"` // A token that can be used to list the next page of jobs (if applicable). - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` // A token that can be used to list the previous page of jobs (if // applicable). - // Wire name: 'prev_page_token' PrevPageToken string `json:"prev_page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListJobsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listJobsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listJobsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListJobsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListJobsResponse) MarshalJSON() ([]byte, error) { - pb, err := listJobsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListJobsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // List job runs @@ -4330,113 +2507,75 @@ type ListRunsRequest struct { // otherwise, lists both active and completed runs. An active run is a run // in the `QUEUED`, `PENDING`, `RUNNING`, or `TERMINATING`. This field // cannot be `true` when completed_only is `true`. - ActiveOnly bool `json:"-" tf:"-"` + ActiveOnly bool `json:"-" url:"active_only,omitempty"` // If completed_only is `true`, only completed runs are included in the // results; otherwise, lists both active and completed runs. This field // cannot be `true` when active_only is `true`. - CompletedOnly bool `json:"-" tf:"-"` + CompletedOnly bool `json:"-" url:"completed_only,omitempty"` // Whether to include task and cluster details in the response. Note that // only the first 100 elements will be shown. Use :method:jobs/getrun to // paginate through all tasks and clusters. - ExpandTasks bool `json:"-" tf:"-"` + ExpandTasks bool `json:"-" url:"expand_tasks,omitempty"` // The job for which to list runs. If omitted, the Jobs service lists runs // from all jobs. - JobId int64 `json:"-" tf:"-"` + JobId int64 `json:"-" url:"job_id,omitempty"` // The number of runs to return. This value must be greater than 0 and less // than 25. The default value is 20. If a request specifies a limit of 0, // the service instead uses the maximum limit. - Limit int `json:"-" tf:"-"` + Limit int `json:"-" url:"limit,omitempty"` // The offset of the first run to return, relative to the most recent run. // Deprecated since June 2023. Use `page_token` to iterate through the pages // instead. - Offset int `json:"-" tf:"-"` + Offset int `json:"-" url:"offset,omitempty"` // Use `next_page_token` or `prev_page_token` returned from the previous // request to list the next or previous page of runs respectively. - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` // The type of runs to return. For a description of run types, see // :method:jobs/getRun. - RunType RunType `json:"-" tf:"-"` + RunType RunType `json:"-" url:"run_type,omitempty"` // Show runs that started _at or after_ this value. The value must be a UTC // timestamp in milliseconds. Can be combined with _start_time_to_ to filter // by a time range. - StartTimeFrom int64 `json:"-" tf:"-"` + StartTimeFrom int64 `json:"-" url:"start_time_from,omitempty"` // Show runs that started _at or before_ this value. The value must be a UTC // timestamp in milliseconds. Can be combined with _start_time_from_ to // filter by a time range. - StartTimeTo int64 `json:"-" tf:"-"` + StartTimeTo int64 `json:"-" url:"start_time_to,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListRunsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listRunsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listRunsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListRunsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListRunsRequest) MarshalJSON() ([]byte, error) { - pb, err := listRunsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListRunsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // List of runs was retrieved successfully. type ListRunsResponse struct { // If true, additional runs matching the provided filter are available for // listing. - // Wire name: 'has_more' HasMore bool `json:"has_more,omitempty"` // A token that can be used to list the next page of runs (if applicable). - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` // A token that can be used to list the previous page of runs (if // applicable). - // Wire name: 'prev_page_token' PrevPageToken string `json:"prev_page_token,omitempty"` // A list of runs, from most recently started to least. Only included in the // response if there are runs to list. - // Wire name: 'runs' Runs []BaseRun `json:"runs,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListRunsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listRunsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listRunsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListRunsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListRunsResponse) MarshalJSON() ([]byte, error) { - pb, err := listRunsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListRunsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type NotebookOutput struct { @@ -4446,38 +2585,19 @@ type NotebookOutput struct { // a larger result, your job can store the results in a cloud storage // service. This field is absent if `dbutils.notebook.exit()` was never // called. - // Wire name: 'result' Result string `json:"result,omitempty"` // Whether or not the result was truncated. - // Wire name: 'truncated' Truncated bool `json:"truncated,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *NotebookOutput) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := ¬ebookOutputPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := notebookOutputFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *NotebookOutput) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st NotebookOutput) MarshalJSON() ([]byte, error) { - pb, err := notebookOutputToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s NotebookOutput) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type NotebookTask struct { @@ -4498,13 +2618,11 @@ type NotebookTask struct { // // [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables // [dbutils.widgets.get]: https://docs.databricks.com/dev-tools/databricks-utils.html#dbutils-widgets - // Wire name: 'base_parameters' BaseParameters map[string]string `json:"base_parameters,omitempty"` // The path of the notebook to be run in the Databricks workspace or remote // repository. For notebooks stored in the Databricks workspace, the path // must be absolute and begin with a slash. For notebooks stored in a remote // repository, the path must be relative. This field is required. - // Wire name: 'notebook_path' NotebookPath string `json:"notebook_path"` // Optional location type of the notebook. When set to `WORKSPACE`, the // notebook will be retrieved from the local Databricks workspace. When set @@ -4513,7 +2631,6 @@ type NotebookTask struct { // `git_source` is defined and `WORKSPACE` otherwise. * `WORKSPACE`: // Notebook is located in Databricks workspace. * `GIT`: Notebook is located // in cloud Git provider. - // Wire name: 'source' Source Source `json:"source,omitempty"` // Optional `warehouse_id` to run the notebook on a SQL warehouse. Classic // SQL warehouses are NOT supported, please use serverless or pro SQL @@ -4521,77 +2638,38 @@ type NotebookTask struct { // // Note that SQL warehouses only support SQL cells; if the notebook contains // non-SQL cells, the run will fail. - // Wire name: 'warehouse_id' WarehouseId string `json:"warehouse_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *NotebookTask) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := ¬ebookTaskPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := notebookTaskFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *NotebookTask) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st NotebookTask) MarshalJSON() ([]byte, error) { - pb, err := notebookTaskToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s NotebookTask) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Stores the catalog name, schema name, and the output schema expiration time // for the clean room run. type OutputSchemaInfo struct { - - // Wire name: 'catalog_name' CatalogName string `json:"catalog_name,omitempty"` // The expiration time for the output schema as a Unix timestamp in // milliseconds. - // Wire name: 'expiration_time' ExpirationTime int64 `json:"expiration_time,omitempty"` - // Wire name: 'schema_name' SchemaName string `json:"schema_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *OutputSchemaInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &outputSchemaInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := outputSchemaInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *OutputSchemaInfo) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st OutputSchemaInfo) MarshalJSON() ([]byte, error) { - pb, err := outputSchemaInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s OutputSchemaInfo) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type PauseStatus string @@ -4674,38 +2752,11 @@ func (f *PerformanceTarget) Type() string { type PeriodicTriggerConfiguration struct { // The interval at which the trigger should run. - // Wire name: 'interval' Interval int `json:"interval"` // The unit of time for the interval. - // Wire name: 'unit' Unit PeriodicTriggerConfigurationTimeUnit `json:"unit"` } -func (st *PeriodicTriggerConfiguration) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &periodicTriggerConfigurationPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := periodicTriggerConfigurationFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st PeriodicTriggerConfiguration) MarshalJSON() ([]byte, error) { - pb, err := periodicTriggerConfigurationToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type PeriodicTriggerConfigurationTimeUnit string const PeriodicTriggerConfigurationTimeUnitDays PeriodicTriggerConfigurationTimeUnit = `DAYS` @@ -4748,251 +2799,120 @@ func (f *PeriodicTriggerConfigurationTimeUnit) Type() string { type PipelineParams struct { // If true, triggers a full refresh on the delta live table. - // Wire name: 'full_refresh' FullRefresh bool `json:"full_refresh,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *PipelineParams) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &pipelineParamsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := pipelineParamsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *PipelineParams) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st PipelineParams) MarshalJSON() ([]byte, error) { - pb, err := pipelineParamsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s PipelineParams) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type PipelineTask struct { // If true, triggers a full refresh on the delta live table. - // Wire name: 'full_refresh' FullRefresh bool `json:"full_refresh,omitempty"` // The full name of the pipeline task to execute. - // Wire name: 'pipeline_id' PipelineId string `json:"pipeline_id"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *PipelineTask) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &pipelineTaskPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := pipelineTaskFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *PipelineTask) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st PipelineTask) MarshalJSON() ([]byte, error) { - pb, err := pipelineTaskToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s PipelineTask) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type PowerBiModel struct { // How the published Power BI model authenticates to Databricks - // Wire name: 'authentication_method' AuthenticationMethod AuthenticationMethod `json:"authentication_method,omitempty"` // The name of the Power BI model - // Wire name: 'model_name' ModelName string `json:"model_name,omitempty"` // Whether to overwrite existing Power BI models - // Wire name: 'overwrite_existing' OverwriteExisting bool `json:"overwrite_existing,omitempty"` // The default storage mode of the Power BI model - // Wire name: 'storage_mode' StorageMode StorageMode `json:"storage_mode,omitempty"` // The name of the Power BI workspace of the model - // Wire name: 'workspace_name' WorkspaceName string `json:"workspace_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *PowerBiModel) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &powerBiModelPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := powerBiModelFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *PowerBiModel) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st PowerBiModel) MarshalJSON() ([]byte, error) { - pb, err := powerBiModelToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s PowerBiModel) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type PowerBiTable struct { // The catalog name in Databricks - // Wire name: 'catalog' Catalog string `json:"catalog,omitempty"` // The table name in Databricks - // Wire name: 'name' Name string `json:"name,omitempty"` // The schema name in Databricks - // Wire name: 'schema' Schema string `json:"schema,omitempty"` // The Power BI storage mode of the table - // Wire name: 'storage_mode' StorageMode StorageMode `json:"storage_mode,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *PowerBiTable) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &powerBiTablePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := powerBiTableFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *PowerBiTable) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st PowerBiTable) MarshalJSON() ([]byte, error) { - pb, err := powerBiTableToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s PowerBiTable) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type PowerBiTask struct { // The resource name of the UC connection to authenticate from Databricks to // Power BI - // Wire name: 'connection_resource_name' ConnectionResourceName string `json:"connection_resource_name,omitempty"` // The semantic model to update - // Wire name: 'power_bi_model' PowerBiModel *PowerBiModel `json:"power_bi_model,omitempty"` // Whether the model should be refreshed after the update - // Wire name: 'refresh_after_update' RefreshAfterUpdate bool `json:"refresh_after_update,omitempty"` // The tables to be exported to Power BI - // Wire name: 'tables' Tables []PowerBiTable `json:"tables,omitempty"` // The SQL warehouse ID to use as the Power BI data source - // Wire name: 'warehouse_id' WarehouseId string `json:"warehouse_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *PowerBiTask) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &powerBiTaskPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := powerBiTaskFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *PowerBiTask) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st PowerBiTask) MarshalJSON() ([]byte, error) { - pb, err := powerBiTaskToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s PowerBiTask) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type PythonWheelTask struct { // Named entry point to use, if it does not exist in the metadata of the // package it executes the function from the package directly using // `$packageName.$entryPoint()` - // Wire name: 'entry_point' EntryPoint string `json:"entry_point"` // Command-line parameters passed to Python wheel task in the form of // `["--name=task", "--data=dbfs:/path/to/data.json"]`. Leave it empty if // `parameters` is not null. - // Wire name: 'named_parameters' NamedParameters map[string]string `json:"named_parameters,omitempty"` // Name of the package to execute - // Wire name: 'package_name' PackageName string `json:"package_name"` // Command-line parameters passed to Python wheel task. Leave it empty if // `named_parameters` is not null. - // Wire name: 'parameters' Parameters []string `json:"parameters,omitempty"` } -func (st *PythonWheelTask) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &pythonWheelTaskPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := pythonWheelTaskFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st PythonWheelTask) MarshalJSON() ([]byte, error) { - pb, err := pythonWheelTaskToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type QueueDetails struct { // The reason for queuing the run. * `ACTIVE_RUNS_LIMIT_REACHED`: The run // was queued due to reaching the workspace limit of active task runs. * @@ -5000,39 +2920,20 @@ type QueueDetails struct { // per-job limit of concurrent job runs. * // `ACTIVE_RUN_JOB_TASKS_LIMIT_REACHED`: The run was queued due to reaching // the workspace limit of active run job tasks. - // Wire name: 'code' Code QueueDetailsCodeCode `json:"code,omitempty"` // A descriptive message with the queuing details. This field is // unstructured, and its exact format is subject to change. - // Wire name: 'message' Message string `json:"message,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *QueueDetails) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &queueDetailsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := queueDetailsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *QueueDetails) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st QueueDetails) MarshalJSON() ([]byte, error) { - pb, err := queueDetailsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s QueueDetails) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The reason for queuing the run. * `ACTIVE_RUNS_LIMIT_REACHED`: The run was @@ -5086,35 +2987,9 @@ func (f *QueueDetailsCodeCode) Type() string { type QueueSettings struct { // If true, enable queueing for the job. This is a required field. - // Wire name: 'enabled' Enabled bool `json:"enabled"` } -func (st *QueueSettings) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &queueSettingsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := queueSettingsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st QueueSettings) MarshalJSON() ([]byte, error) { - pb, err := queueSettingsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type RepairHistoryItem struct { // The actual performance target used by the serverless run during // execution. This can differ from the client-set performance target on the @@ -5124,59 +2999,34 @@ type RepairHistoryItem struct { // * `STANDARD`: Enables cost-efficient execution of serverless workloads. * // `PERFORMANCE_OPTIMIZED`: Prioritizes fast startup and execution times // through rapid scaling and optimized cluster performance. - // Wire name: 'effective_performance_target' EffectivePerformanceTarget PerformanceTarget `json:"effective_performance_target,omitempty"` // The end time of the (repaired) run. - // Wire name: 'end_time' EndTime int64 `json:"end_time,omitempty"` // The ID of the repair. Only returned for the items that represent a repair // in `repair_history`. - // Wire name: 'id' Id int64 `json:"id,omitempty"` // The start time of the (repaired) run. - // Wire name: 'start_time' StartTime int64 `json:"start_time,omitempty"` // Deprecated. Please use the `status` field instead. - // Wire name: 'state' State *RunState `json:"state,omitempty"` // The current status of the run - // Wire name: 'status' Status *RunStatus `json:"status,omitempty"` // The run IDs of the task runs that ran as part of this repair history // item. - // Wire name: 'task_run_ids' TaskRunIds []int64 `json:"task_run_ids,omitempty"` // The repair history item type. Indicates whether a run is the original run // or a repair run. - // Wire name: 'type' Type RepairHistoryItemType `json:"type,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *RepairHistoryItem) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &repairHistoryItemPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := repairHistoryItemFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *RepairHistoryItem) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st RepairHistoryItem) MarshalJSON() ([]byte, error) { - pb, err := repairHistoryItemToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s RepairHistoryItem) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The repair history item type. Indicates whether a run is the original run or @@ -5222,7 +3072,6 @@ type RepairRun struct { // An array of commands to execute for jobs with the dbt task, for example // `"dbt_commands": ["dbt deps", "dbt seed", "dbt deps", "dbt seed", "dbt // run"]` - // Wire name: 'dbt_commands' DbtCommands []string `json:"dbt_commands,omitempty"` // A list of parameters for jobs with Spark JAR tasks, for example // `"jar_params": ["john doe", "35"]`. The parameters are used to invoke the @@ -5236,16 +3085,13 @@ type RepairRun struct { // about job runs. // // [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables - // Wire name: 'jar_params' JarParams []string `json:"jar_params,omitempty"` // Job-level parameters used in the run. for example `"param": // "overriding_val"` - // Wire name: 'job_parameters' JobParameters map[string]string `json:"job_parameters,omitempty"` // The ID of the latest repair. This parameter is not required when // repairing a run for the first time, but must be provided on subsequent // requests to repair the same run. - // Wire name: 'latest_repair_id' LatestRepairId int64 `json:"latest_repair_id,omitempty"` // A map from keys to values for jobs with notebook task, for example // `"notebook_params": {"name": "john doe", "age": "35"}`. The map is passed @@ -5266,7 +3112,6 @@ type RepairRun struct { // // [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables // [dbutils.widgets.get]: https://docs.databricks.com/dev-tools/databricks-utils.html - // Wire name: 'notebook_params' NotebookParams map[string]string `json:"notebook_params,omitempty"` // The performance mode on a serverless job. The performance target // determines the level of compute performance or cost-efficiency for the @@ -5276,13 +3121,10 @@ type RepairRun struct { // * `STANDARD`: Enables cost-efficient execution of serverless workloads. * // `PERFORMANCE_OPTIMIZED`: Prioritizes fast startup and execution times // through rapid scaling and optimized cluster performance. - // Wire name: 'performance_target' PerformanceTarget PerformanceTarget `json:"performance_target,omitempty"` // Controls whether the pipeline should perform a full refresh - // Wire name: 'pipeline_params' PipelineParams *PipelineParams `json:"pipeline_params,omitempty"` - // Wire name: 'python_named_params' PythonNamedParams map[string]string `json:"python_named_params,omitempty"` // A list of parameters for jobs with Python tasks, for example // `"python_params": ["john doe", "35"]`. The parameters are passed to @@ -5301,22 +3143,17 @@ type RepairRun struct { // non-ASCII characters are Chinese, Japanese kanjis, and emojis. // // [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables - // Wire name: 'python_params' PythonParams []string `json:"python_params,omitempty"` // If true, repair all failed tasks. Only one of `rerun_tasks` or // `rerun_all_failed_tasks` can be used. - // Wire name: 'rerun_all_failed_tasks' RerunAllFailedTasks bool `json:"rerun_all_failed_tasks,omitempty"` // If true, repair all tasks that depend on the tasks in `rerun_tasks`, even // if they were previously successful. Can be also used in combination with // `rerun_all_failed_tasks`. - // Wire name: 'rerun_dependent_tasks' RerunDependentTasks bool `json:"rerun_dependent_tasks,omitempty"` // The task keys of the task runs to repair. - // Wire name: 'rerun_tasks' RerunTasks []string `json:"rerun_tasks,omitempty"` // The job run ID of the run to repair. The run must not be in progress. - // Wire name: 'run_id' RunId int64 `json:"run_id"` // A list of parameters for jobs with spark submit task, for example // `"spark_submit_params": ["--class", @@ -5336,429 +3173,120 @@ type RepairRun struct { // non-ASCII characters are Chinese, Japanese kanjis, and emojis. // // [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables - // Wire name: 'spark_submit_params' SparkSubmitParams []string `json:"spark_submit_params,omitempty"` // A map from keys to values for jobs with SQL task, for example // `"sql_params": {"name": "john doe", "age": "35"}`. The SQL alert task // does not support custom parameters. - // Wire name: 'sql_params' SqlParams map[string]string `json:"sql_params,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *RepairRun) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &repairRunPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := repairRunFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *RepairRun) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st RepairRun) MarshalJSON() ([]byte, error) { - pb, err := repairRunToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s RepairRun) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Run repair was initiated. type RepairRunResponse struct { // The ID of the repair. Must be provided in subsequent repairs using the // `latest_repair_id` field to ensure sequential repairs. - // Wire name: 'repair_id' RepairId int64 `json:"repair_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *RepairRunResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &repairRunResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := repairRunResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *RepairRunResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st RepairRunResponse) MarshalJSON() ([]byte, error) { - pb, err := repairRunResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s RepairRunResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ResetJob struct { // The canonical identifier of the job to reset. This field is required. - // Wire name: 'job_id' JobId int64 `json:"job_id"` // The new settings of the job. These settings completely replace the old // settings. // // Changes to the field `JobBaseSettings.timeout_seconds` are applied to // active runs. Changes to other fields are applied to future runs only. - // Wire name: 'new_settings' NewSettings JobSettings `json:"new_settings"` } -func (st *ResetJob) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &resetJobPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := resetJobFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ResetJob) MarshalJSON() ([]byte, error) { - pb, err := resetJobToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type ResetResponse struct { } -func (st *ResetResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &resetResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := resetResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ResetResponse) MarshalJSON() ([]byte, error) { - pb, err := resetResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type ResolvedConditionTaskValues struct { - - // Wire name: 'left' Left string `json:"left,omitempty"` - // Wire name: 'right' Right string `json:"right,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ResolvedConditionTaskValues) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &resolvedConditionTaskValuesPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := resolvedConditionTaskValuesFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ResolvedConditionTaskValues) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ResolvedConditionTaskValues) MarshalJSON() ([]byte, error) { - pb, err := resolvedConditionTaskValuesToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ResolvedConditionTaskValues) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ResolvedDbtTaskValues struct { - - // Wire name: 'commands' Commands []string `json:"commands,omitempty"` } -func (st *ResolvedDbtTaskValues) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &resolvedDbtTaskValuesPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := resolvedDbtTaskValuesFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ResolvedDbtTaskValues) MarshalJSON() ([]byte, error) { - pb, err := resolvedDbtTaskValuesToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type ResolvedNotebookTaskValues struct { - - // Wire name: 'base_parameters' BaseParameters map[string]string `json:"base_parameters,omitempty"` } -func (st *ResolvedNotebookTaskValues) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &resolvedNotebookTaskValuesPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := resolvedNotebookTaskValuesFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ResolvedNotebookTaskValues) MarshalJSON() ([]byte, error) { - pb, err := resolvedNotebookTaskValuesToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type ResolvedParamPairValues struct { - - // Wire name: 'parameters' Parameters map[string]string `json:"parameters,omitempty"` } -func (st *ResolvedParamPairValues) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &resolvedParamPairValuesPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := resolvedParamPairValuesFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ResolvedParamPairValues) MarshalJSON() ([]byte, error) { - pb, err := resolvedParamPairValuesToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type ResolvedPythonWheelTaskValues struct { - - // Wire name: 'named_parameters' NamedParameters map[string]string `json:"named_parameters,omitempty"` - // Wire name: 'parameters' Parameters []string `json:"parameters,omitempty"` } -func (st *ResolvedPythonWheelTaskValues) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &resolvedPythonWheelTaskValuesPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := resolvedPythonWheelTaskValuesFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ResolvedPythonWheelTaskValues) MarshalJSON() ([]byte, error) { - pb, err := resolvedPythonWheelTaskValuesToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type ResolvedRunJobTaskValues struct { - - // Wire name: 'job_parameters' JobParameters map[string]string `json:"job_parameters,omitempty"` - // Wire name: 'parameters' Parameters map[string]string `json:"parameters,omitempty"` } -func (st *ResolvedRunJobTaskValues) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &resolvedRunJobTaskValuesPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := resolvedRunJobTaskValuesFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ResolvedRunJobTaskValues) MarshalJSON() ([]byte, error) { - pb, err := resolvedRunJobTaskValuesToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type ResolvedStringParamsValues struct { - - // Wire name: 'parameters' Parameters []string `json:"parameters,omitempty"` } -func (st *ResolvedStringParamsValues) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &resolvedStringParamsValuesPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := resolvedStringParamsValuesFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ResolvedStringParamsValues) MarshalJSON() ([]byte, error) { - pb, err := resolvedStringParamsValuesToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type ResolvedValues struct { - - // Wire name: 'condition_task' ConditionTask *ResolvedConditionTaskValues `json:"condition_task,omitempty"` - // Wire name: 'dbt_task' DbtTask *ResolvedDbtTaskValues `json:"dbt_task,omitempty"` - // Wire name: 'notebook_task' NotebookTask *ResolvedNotebookTaskValues `json:"notebook_task,omitempty"` - // Wire name: 'python_wheel_task' PythonWheelTask *ResolvedPythonWheelTaskValues `json:"python_wheel_task,omitempty"` - // Wire name: 'run_job_task' RunJobTask *ResolvedRunJobTaskValues `json:"run_job_task,omitempty"` - // Wire name: 'simulation_task' SimulationTask *ResolvedParamPairValues `json:"simulation_task,omitempty"` - // Wire name: 'spark_jar_task' SparkJarTask *ResolvedStringParamsValues `json:"spark_jar_task,omitempty"` - // Wire name: 'spark_python_task' SparkPythonTask *ResolvedStringParamsValues `json:"spark_python_task,omitempty"` - // Wire name: 'spark_submit_task' SparkSubmitTask *ResolvedStringParamsValues `json:"spark_submit_task,omitempty"` - // Wire name: 'sql_task' SqlTask *ResolvedParamPairValues `json:"sql_task,omitempty"` } -func (st *ResolvedValues) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &resolvedValuesPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := resolvedValuesFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ResolvedValues) MarshalJSON() ([]byte, error) { - pb, err := resolvedValuesToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Run was retrieved successfully type Run struct { // The sequence number of this run attempt for a triggered job run. The @@ -5768,30 +3296,24 @@ type Run struct { // original attempt’s ID and an incrementing `attempt_number`. Runs are // retried only until they succeed, and the maximum `attempt_number` is the // same as the `max_retries` value for the job. - // Wire name: 'attempt_number' AttemptNumber int `json:"attempt_number,omitempty"` // The time in milliseconds it took to terminate the cluster and clean up // any associated artifacts. The duration of a task run is the sum of the // `setup_duration`, `execution_duration`, and the `cleanup_duration`. The // `cleanup_duration` field is set to 0 for multitask job runs. The total // duration of a multitask job run is the value of the `run_duration` field. - // Wire name: 'cleanup_duration' CleanupDuration int64 `json:"cleanup_duration,omitempty"` // The cluster used for this run. If the run is specified to use a new // cluster, this field is set once the Jobs service has requested a cluster // for the run. - // Wire name: 'cluster_instance' ClusterInstance *ClusterInstance `json:"cluster_instance,omitempty"` // A snapshot of the job’s cluster specification when this run was // created. - // Wire name: 'cluster_spec' ClusterSpec *ClusterSpec `json:"cluster_spec,omitempty"` // The creator user name. This field won’t be included in the response if // the user has already been deleted. - // Wire name: 'creator_user_name' CreatorUserName string `json:"creator_user_name,omitempty"` // Description of the run - // Wire name: 'description' Description string `json:"description,omitempty"` // The actual performance target used by the serverless run during // execution. This can differ from the client-set performance target on the @@ -5801,11 +3323,9 @@ type Run struct { // * `STANDARD`: Enables cost-efficient execution of serverless workloads. * // `PERFORMANCE_OPTIMIZED`: Prioritizes fast startup and execution times // through rapid scaling and optimized cluster performance. - // Wire name: 'effective_performance_target' EffectivePerformanceTarget PerformanceTarget `json:"effective_performance_target,omitempty"` // The time at which this run ended in epoch milliseconds (milliseconds // since 1/1/1970 UTC). This field is set to 0 if the job is still running. - // Wire name: 'end_time' EndTime int64 `json:"end_time,omitempty"` // The time in milliseconds it took to execute the commands in the JAR or // notebook until they completed, failed, timed out, were cancelled, or @@ -5814,7 +3334,6 @@ type Run struct { // The `execution_duration` field is set to 0 for multitask job runs. The // total duration of a multitask job run is the value of the `run_duration` // field. - // Wire name: 'execution_duration' ExecutionDuration int64 `json:"execution_duration,omitempty"` // An optional specification for a remote Git repository containing the // source code used by tasks. Version-controlled source code is supported by @@ -5826,71 +3345,54 @@ type Run struct { // // Note: dbt and SQL File tasks support only version-controlled sources. If // dbt or SQL File tasks are used, `git_source` must be defined on the job. - // Wire name: 'git_source' GitSource *GitSource `json:"git_source,omitempty"` // Indicates if the run has more array properties (`tasks`, `job_clusters`) // that are not shown. They can be accessed via :method:jobs/getrun // endpoint. It is only relevant for API 2.2 :method:jobs/listruns requests // with `expand_tasks=true`. - // Wire name: 'has_more' HasMore bool `json:"has_more,omitempty"` // Only populated by for-each iterations. The parent for-each task is // located in tasks array. - // Wire name: 'iterations' Iterations []RunTask `json:"iterations,omitempty"` // A list of job cluster specifications that can be shared and reused by // tasks of this job. Libraries cannot be declared in a shared job cluster. // You must declare dependent libraries in task settings. If more than 100 // job clusters are available, you can paginate through them using // :method:jobs/getrun. - // Wire name: 'job_clusters' JobClusters []JobCluster `json:"job_clusters,omitempty"` // The canonical identifier of the job that contains this run. - // Wire name: 'job_id' JobId int64 `json:"job_id,omitempty"` // Job-level parameters used in the run - // Wire name: 'job_parameters' JobParameters []JobParameter `json:"job_parameters,omitempty"` // ID of the job run that this run belongs to. For legacy and single-task // job runs the field is populated with the job run ID. For task runs, the // field is populated with the ID of the job run that the task run belongs // to. - // Wire name: 'job_run_id' JobRunId int64 `json:"job_run_id,omitempty"` // A token that can be used to list the next page of array properties. - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` // A unique identifier for this job run. This is set to the same value as // `run_id`. - // Wire name: 'number_in_job' NumberInJob int64 `json:"number_in_job,omitempty"` // If this run is a retry of a prior run attempt, this field contains the // run_id of the original attempt; otherwise, it is the same as the run_id. - // Wire name: 'original_attempt_run_id' OriginalAttemptRunId int64 `json:"original_attempt_run_id,omitempty"` // The parameters used for this run. - // Wire name: 'overriding_parameters' OverridingParameters *RunParameters `json:"overriding_parameters,omitempty"` // The time in milliseconds that the run has spent in the queue. - // Wire name: 'queue_duration' QueueDuration int64 `json:"queue_duration,omitempty"` // The repair history of the run. - // Wire name: 'repair_history' RepairHistory []RepairHistoryItem `json:"repair_history,omitempty"` // The time in milliseconds it took the job run and all of its repairs to // finish. - // Wire name: 'run_duration' RunDuration int64 `json:"run_duration,omitempty"` // The canonical identifier of the run. This ID is unique across all runs of // all jobs. - // Wire name: 'run_id' RunId int64 `json:"run_id,omitempty"` // An optional name for the run. The maximum length is 4096 bytes in UTF-8 // encoding. - // Wire name: 'run_name' RunName string `json:"run_name,omitempty"` // The URL to the detail page of the run. - // Wire name: 'run_page_url' RunPageUrl string `json:"run_page_url,omitempty"` // The type of a run. * `JOB_RUN`: Normal job run. A run created with // :method:jobs/runNow. * `WORKFLOW_RUN`: Workflow run. A run created with @@ -5898,11 +3400,9 @@ type Run struct { // :method:jobs/submit. // // [dbutils.notebook.run]: https://docs.databricks.com/dev-tools/databricks-utils.html#dbutils-workflow - // Wire name: 'run_type' RunType RunType `json:"run_type,omitempty"` // The cron schedule that triggered this run if it was triggered by the // periodic scheduler. - // Wire name: 'schedule' Schedule *CronSchedule `json:"schedule,omitempty"` // The time in milliseconds it took to set up the cluster. For runs that run // on new clusters this is the cluster creation time, for runs that run on @@ -5911,26 +3411,21 @@ type Run struct { // `cleanup_duration`. The `setup_duration` field is set to 0 for multitask // job runs. The total duration of a multitask job run is the value of the // `run_duration` field. - // Wire name: 'setup_duration' SetupDuration int64 `json:"setup_duration,omitempty"` // The time at which this run was started in epoch milliseconds // (milliseconds since 1/1/1970 UTC). This may not be the time when the job // task starts executing, for example, if the job is scheduled to run on a // new cluster, this is the time the cluster creation call is issued. - // Wire name: 'start_time' StartTime int64 `json:"start_time,omitempty"` // Deprecated. Please use the `status` field instead. - // Wire name: 'state' State *RunState `json:"state,omitempty"` // The current status of the run - // Wire name: 'status' Status *RunStatus `json:"status,omitempty"` // The list of tasks performed by the run. Each task has its own `run_id` // which you can use to call `JobsGetOutput` to retrieve the run resutls. If // more than 100 tasks are available, you can paginate through them using // :method:jobs/getrun. Use the `next_page_token` field at the object root // to determine if more results are available. - // Wire name: 'tasks' Tasks []RunTask `json:"tasks,omitempty"` // The type of trigger that fired this run. // @@ -5946,44 +3441,24 @@ type Run struct { // update. * `CONTINUOUS_RESTART`: Indicates a run created by user to // manually restart a continuous job run. * `MODEL`: Indicates a run that is // triggered by a model update. - // Wire name: 'trigger' Trigger TriggerType `json:"trigger,omitempty"` // Additional details about what triggered the run - // Wire name: 'trigger_info' TriggerInfo *TriggerInfo `json:"trigger_info,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *Run) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &runPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := runFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *Run) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st Run) MarshalJSON() ([]byte, error) { - pb, err := runToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s Run) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type RunConditionTask struct { // The left operand of the condition task. Can be either a string value or a // job state or parameter reference. - // Wire name: 'left' Left string `json:"left"` // * `EQUAL_TO`, `NOT_EQUAL` operators perform string comparison of their // operands. This means that `“12.0” == “12”` will evaluate to @@ -5995,89 +3470,48 @@ type RunConditionTask struct { // The boolean comparison to task values can be implemented with operators // `EQUAL_TO`, `NOT_EQUAL`. If a task value was set to a boolean value, it // will be serialized to `“true”` or `“false”` for the comparison. - // Wire name: 'op' Op ConditionTaskOp `json:"op"` // The condition expression evaluation result. Filled in if the task was // successfully completed. Can be `"true"` or `"false"` - // Wire name: 'outcome' Outcome string `json:"outcome,omitempty"` // The right operand of the condition task. Can be either a string value or // a job state or parameter reference. - // Wire name: 'right' Right string `json:"right"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *RunConditionTask) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &runConditionTaskPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := runConditionTaskFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *RunConditionTask) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st RunConditionTask) MarshalJSON() ([]byte, error) { - pb, err := runConditionTaskToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s RunConditionTask) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type RunForEachTask struct { // An optional maximum allowed number of concurrent runs of the task. Set // this value if you want to be able to execute multiple runs of the task // concurrently. - // Wire name: 'concurrency' Concurrency int `json:"concurrency,omitempty"` // Array for task to iterate on. This can be a JSON string or a reference to // an array parameter. - // Wire name: 'inputs' Inputs string `json:"inputs"` // Read only field. Populated for GetRun and ListRuns RPC calls and stores // the execution stats of an For each task - // Wire name: 'stats' Stats *ForEachStats `json:"stats,omitempty"` // Configuration for the task that will be run for each element in the array - // Wire name: 'task' Task Task `json:"task"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *RunForEachTask) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &runForEachTaskPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := runForEachTaskFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *RunForEachTask) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st RunForEachTask) MarshalJSON() ([]byte, error) { - pb, err := runForEachTaskToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s RunForEachTask) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // An optional value indicating the condition that determines whether the task @@ -6147,42 +3581,23 @@ func (f *RunIf) Type() string { type RunJobOutput struct { // The run id of the triggered job run - // Wire name: 'run_id' RunId int64 `json:"run_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *RunJobOutput) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &runJobOutputPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := runJobOutputFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *RunJobOutput) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st RunJobOutput) MarshalJSON() ([]byte, error) { - pb, err := runJobOutputToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s RunJobOutput) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type RunJobTask struct { // An array of commands to execute for jobs with the dbt task, for example // `"dbt_commands": ["dbt deps", "dbt seed", "dbt deps", "dbt seed", "dbt // run"]` - // Wire name: 'dbt_commands' DbtCommands []string `json:"dbt_commands,omitempty"` // A list of parameters for jobs with Spark JAR tasks, for example // `"jar_params": ["john doe", "35"]`. The parameters are used to invoke the @@ -6196,13 +3611,10 @@ type RunJobTask struct { // about job runs. // // [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables - // Wire name: 'jar_params' JarParams []string `json:"jar_params,omitempty"` // ID of the job to trigger. - // Wire name: 'job_id' JobId int64 `json:"job_id"` // Job-level parameters used to trigger the job. - // Wire name: 'job_parameters' JobParameters map[string]string `json:"job_parameters,omitempty"` // A map from keys to values for jobs with notebook task, for example // `"notebook_params": {"name": "john doe", "age": "35"}`. The map is passed @@ -6223,13 +3635,10 @@ type RunJobTask struct { // // [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables // [dbutils.widgets.get]: https://docs.databricks.com/dev-tools/databricks-utils.html - // Wire name: 'notebook_params' NotebookParams map[string]string `json:"notebook_params,omitempty"` // Controls whether the pipeline should perform a full refresh - // Wire name: 'pipeline_params' PipelineParams *PipelineParams `json:"pipeline_params,omitempty"` - // Wire name: 'python_named_params' PythonNamedParams map[string]string `json:"python_named_params,omitempty"` // A list of parameters for jobs with Python tasks, for example // `"python_params": ["john doe", "35"]`. The parameters are passed to @@ -6248,7 +3657,6 @@ type RunJobTask struct { // non-ASCII characters are Chinese, Japanese kanjis, and emojis. // // [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables - // Wire name: 'python_params' PythonParams []string `json:"python_params,omitempty"` // A list of parameters for jobs with spark submit task, for example // `"spark_submit_params": ["--class", @@ -6268,40 +3676,13 @@ type RunJobTask struct { // non-ASCII characters are Chinese, Japanese kanjis, and emojis. // // [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables - // Wire name: 'spark_submit_params' SparkSubmitParams []string `json:"spark_submit_params,omitempty"` // A map from keys to values for jobs with SQL task, for example // `"sql_params": {"name": "john doe", "age": "35"}`. The SQL alert task // does not support custom parameters. - // Wire name: 'sql_params' SqlParams map[string]string `json:"sql_params,omitempty"` } -func (st *RunJobTask) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &runJobTaskPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := runJobTaskFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st RunJobTask) MarshalJSON() ([]byte, error) { - pb, err := runJobTaskToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // A value indicating the run's lifecycle state. The possible values are: * // `QUEUED`: The run is queued. * `PENDING`: The run is waiting to be executed // while the cluster and execution context are being prepared. * `RUNNING`: The @@ -6447,7 +3828,6 @@ type RunNow struct { // An array of commands to execute for jobs with the dbt task, for example // `"dbt_commands": ["dbt deps", "dbt seed", "dbt deps", "dbt seed", "dbt // run"]` - // Wire name: 'dbt_commands' DbtCommands []string `json:"dbt_commands,omitempty"` // An optional token to guarantee the idempotency of job run requests. If a // run with the provided token already exists, the request does not create a @@ -6463,7 +3843,6 @@ type RunNow struct { // For more information, see [How to ensure idempotency for jobs]. // // [How to ensure idempotency for jobs]: https://kb.databricks.com/jobs/jobs-idempotency.html - // Wire name: 'idempotency_token' IdempotencyToken string `json:"idempotency_token,omitempty"` // A list of parameters for jobs with Spark JAR tasks, for example // `"jar_params": ["john doe", "35"]`. The parameters are used to invoke the @@ -6477,14 +3856,11 @@ type RunNow struct { // about job runs. // // [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables - // Wire name: 'jar_params' JarParams []string `json:"jar_params,omitempty"` // The ID of the job to be executed - // Wire name: 'job_id' JobId int64 `json:"job_id"` // Job-level parameters used in the run. for example `"param": // "overriding_val"` - // Wire name: 'job_parameters' JobParameters map[string]string `json:"job_parameters,omitempty"` // A map from keys to values for jobs with notebook task, for example // `"notebook_params": {"name": "john doe", "age": "35"}`. The map is passed @@ -6505,11 +3881,9 @@ type RunNow struct { // // [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables // [dbutils.widgets.get]: https://docs.databricks.com/dev-tools/databricks-utils.html - // Wire name: 'notebook_params' NotebookParams map[string]string `json:"notebook_params,omitempty"` // A list of task keys to run inside of the job. If this field is not // provided, all tasks in the job will be run. - // Wire name: 'only' Only []string `json:"only,omitempty"` // The performance mode on a serverless job. The performance target // determines the level of compute performance or cost-efficiency for the @@ -6519,13 +3893,10 @@ type RunNow struct { // * `STANDARD`: Enables cost-efficient execution of serverless workloads. * // `PERFORMANCE_OPTIMIZED`: Prioritizes fast startup and execution times // through rapid scaling and optimized cluster performance. - // Wire name: 'performance_target' PerformanceTarget PerformanceTarget `json:"performance_target,omitempty"` // Controls whether the pipeline should perform a full refresh - // Wire name: 'pipeline_params' PipelineParams *PipelineParams `json:"pipeline_params,omitempty"` - // Wire name: 'python_named_params' PythonNamedParams map[string]string `json:"python_named_params,omitempty"` // A list of parameters for jobs with Python tasks, for example // `"python_params": ["john doe", "35"]`. The parameters are passed to @@ -6544,10 +3915,8 @@ type RunNow struct { // non-ASCII characters are Chinese, Japanese kanjis, and emojis. // // [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables - // Wire name: 'python_params' PythonParams []string `json:"python_params,omitempty"` // The queue settings of the run. - // Wire name: 'queue' Queue *QueueSettings `json:"queue,omitempty"` // A list of parameters for jobs with spark submit task, for example // `"spark_submit_params": ["--class", @@ -6567,108 +3936,62 @@ type RunNow struct { // non-ASCII characters are Chinese, Japanese kanjis, and emojis. // // [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables - // Wire name: 'spark_submit_params' SparkSubmitParams []string `json:"spark_submit_params,omitempty"` // A map from keys to values for jobs with SQL task, for example // `"sql_params": {"name": "john doe", "age": "35"}`. The SQL alert task // does not support custom parameters. - // Wire name: 'sql_params' SqlParams map[string]string `json:"sql_params,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *RunNow) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &runNowPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := runNowFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *RunNow) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st RunNow) MarshalJSON() ([]byte, error) { - pb, err := runNowToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s RunNow) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Run was started successfully. type RunNowResponse struct { // A unique identifier for this job run. This is set to the same value as // `run_id`. - // Wire name: 'number_in_job' NumberInJob int64 `json:"number_in_job,omitempty"` // The globally unique ID of the newly triggered run. - // Wire name: 'run_id' RunId int64 `json:"run_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *RunNowResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &runNowResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := runNowResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *RunNowResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st RunNowResponse) MarshalJSON() ([]byte, error) { - pb, err := runNowResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s RunNowResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Run output was retrieved successfully. type RunOutput struct { // The output of a clean rooms notebook task, if available - // Wire name: 'clean_rooms_notebook_output' CleanRoomsNotebookOutput *CleanRoomsNotebookTaskCleanRoomsNotebookTaskOutput `json:"clean_rooms_notebook_output,omitempty"` // The output of a dashboard task, if available - // Wire name: 'dashboard_output' DashboardOutput *DashboardTaskOutput `json:"dashboard_output,omitempty"` // Deprecated in favor of the new dbt_platform_output - // Wire name: 'dbt_cloud_output' DbtCloudOutput *DbtCloudTaskOutput `json:"dbt_cloud_output,omitempty"` // The output of a dbt task, if available. - // Wire name: 'dbt_output' DbtOutput *DbtOutput `json:"dbt_output,omitempty"` - // Wire name: 'dbt_platform_output' DbtPlatformOutput *DbtPlatformTaskOutput `json:"dbt_platform_output,omitempty"` // An error message indicating why a task failed or why output is not // available. The message is unstructured, and its exact format is subject // to change. - // Wire name: 'error' Error string `json:"error,omitempty"` // If there was an error executing the run, this field contains any // available stack traces. - // Wire name: 'error_trace' ErrorTrace string `json:"error_trace,omitempty"` - // Wire name: 'info' Info string `json:"info,omitempty"` // The output from tasks that write to standard streams (stdout/stderr) such // as spark_jar_task, spark_python_task, python_wheel_task. @@ -6677,13 +4000,10 @@ type RunOutput struct { // spark_submit_task. // // Databricks restricts this API to return the last 5 MB of these logs. - // Wire name: 'logs' Logs string `json:"logs,omitempty"` // Whether the logs are truncated. - // Wire name: 'logs_truncated' LogsTruncated bool `json:"logs_truncated,omitempty"` // All details of the run except for its output. - // Wire name: 'metadata' Metadata *Run `json:"metadata,omitempty"` // The output of a notebook task, if available. A notebook task that // terminates (either successfully or with a failure) without calling @@ -6693,48 +4013,27 @@ type RunOutput struct { // the [ClusterLogConf] field to configure log storage for the job cluster. // // [ClusterLogConf]: https://docs.databricks.com/dev-tools/api/latest/clusters.html#clusterlogconf - // Wire name: 'notebook_output' NotebookOutput *NotebookOutput `json:"notebook_output,omitempty"` // The output of a run job task, if available - // Wire name: 'run_job_output' RunJobOutput *RunJobOutput `json:"run_job_output,omitempty"` // The output of a SQL task, if available. - // Wire name: 'sql_output' SqlOutput *SqlOutput `json:"sql_output,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *RunOutput) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &runOutputPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := runOutputFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *RunOutput) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st RunOutput) MarshalJSON() ([]byte, error) { - pb, err := runOutputToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s RunOutput) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type RunParameters struct { // An array of commands to execute for jobs with the dbt task, for example // `"dbt_commands": ["dbt deps", "dbt seed", "dbt deps", "dbt seed", "dbt // run"]` - // Wire name: 'dbt_commands' DbtCommands []string `json:"dbt_commands,omitempty"` // A list of parameters for jobs with Spark JAR tasks, for example // `"jar_params": ["john doe", "35"]`. The parameters are used to invoke the @@ -6748,7 +4047,6 @@ type RunParameters struct { // about job runs. // // [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables - // Wire name: 'jar_params' JarParams []string `json:"jar_params,omitempty"` // A map from keys to values for jobs with notebook task, for example // `"notebook_params": {"name": "john doe", "age": "35"}`. The map is passed @@ -6769,13 +4067,10 @@ type RunParameters struct { // // [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables // [dbutils.widgets.get]: https://docs.databricks.com/dev-tools/databricks-utils.html - // Wire name: 'notebook_params' NotebookParams map[string]string `json:"notebook_params,omitempty"` // Controls whether the pipeline should perform a full refresh - // Wire name: 'pipeline_params' PipelineParams *PipelineParams `json:"pipeline_params,omitempty"` - // Wire name: 'python_named_params' PythonNamedParams map[string]string `json:"python_named_params,omitempty"` // A list of parameters for jobs with Python tasks, for example // `"python_params": ["john doe", "35"]`. The parameters are passed to @@ -6794,7 +4089,6 @@ type RunParameters struct { // non-ASCII characters are Chinese, Japanese kanjis, and emojis. // // [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables - // Wire name: 'python_params' PythonParams []string `json:"python_params,omitempty"` // A list of parameters for jobs with spark submit task, for example // `"spark_submit_params": ["--class", @@ -6814,40 +4108,13 @@ type RunParameters struct { // non-ASCII characters are Chinese, Japanese kanjis, and emojis. // // [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables - // Wire name: 'spark_submit_params' SparkSubmitParams []string `json:"spark_submit_params,omitempty"` // A map from keys to values for jobs with SQL task, for example // `"sql_params": {"name": "john doe", "age": "35"}`. The SQL alert task // does not support custom parameters. - // Wire name: 'sql_params' SqlParams map[string]string `json:"sql_params,omitempty"` } -func (st *RunParameters) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &runParametersPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := runParametersFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st RunParameters) MarshalJSON() ([]byte, error) { - pb, err := runParametersToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // A value indicating the run's result. The possible values are: * `SUCCESS`: // The task completed successfully. * `FAILED`: The task completed with an // error. * `TIMEDOUT`: The run was stopped after reaching the timeout. * @@ -6937,92 +4204,42 @@ type RunState struct { // A value indicating the run's current lifecycle state. This field is // always available in the response. Note: Additional states might be // introduced in future releases. - // Wire name: 'life_cycle_state' LifeCycleState RunLifeCycleState `json:"life_cycle_state,omitempty"` // The reason indicating why the run was queued. - // Wire name: 'queue_reason' QueueReason string `json:"queue_reason,omitempty"` // A value indicating the run's result. This field is only available for // terminal lifecycle states. Note: Additional states might be introduced in // future releases. - // Wire name: 'result_state' ResultState RunResultState `json:"result_state,omitempty"` // A descriptive message for the current state. This field is unstructured, // and its exact format is subject to change. - // Wire name: 'state_message' StateMessage string `json:"state_message,omitempty"` // A value indicating whether a run was canceled manually by a user or by // the scheduler because the run timed out. - // Wire name: 'user_cancelled_or_timedout' UserCancelledOrTimedout bool `json:"user_cancelled_or_timedout,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *RunState) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &runStatePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := runStateFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *RunState) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st RunState) MarshalJSON() ([]byte, error) { - pb, err := runStateToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s RunState) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The current status of the run type RunStatus struct { // If the run was queued, details about the reason for queuing the run. - // Wire name: 'queue_details' QueueDetails *QueueDetails `json:"queue_details,omitempty"` // The current state of the run. - // Wire name: 'state' State RunLifecycleStateV2State `json:"state,omitempty"` // If the run is in a TERMINATING or TERMINATED state, details about the // reason for terminating the run. - // Wire name: 'termination_details' TerminationDetails *TerminationDetails `json:"termination_details,omitempty"` } -func (st *RunStatus) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &runStatusPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := runStatusFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st RunStatus) MarshalJSON() ([]byte, error) { - pb, err := runStatusToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Used when outputting a child run, in GetRun or ListRuns. type RunTask struct { // The sequence number of this run attempt for a triggered job run. The @@ -7032,58 +4249,46 @@ type RunTask struct { // original attempt’s ID and an incrementing `attempt_number`. Runs are // retried only until they succeed, and the maximum `attempt_number` is the // same as the `max_retries` value for the job. - // Wire name: 'attempt_number' AttemptNumber int `json:"attempt_number,omitempty"` // The task runs a [clean rooms] notebook when the // `clean_rooms_notebook_task` field is present. // // [clean rooms]: https://docs.databricks.com/en/clean-rooms/index.html - // Wire name: 'clean_rooms_notebook_task' CleanRoomsNotebookTask *CleanRoomsNotebookTask `json:"clean_rooms_notebook_task,omitempty"` // The time in milliseconds it took to terminate the cluster and clean up // any associated artifacts. The duration of a task run is the sum of the // `setup_duration`, `execution_duration`, and the `cleanup_duration`. The // `cleanup_duration` field is set to 0 for multitask job runs. The total // duration of a multitask job run is the value of the `run_duration` field. - // Wire name: 'cleanup_duration' CleanupDuration int64 `json:"cleanup_duration,omitempty"` // The cluster used for this run. If the run is specified to use a new // cluster, this field is set once the Jobs service has requested a cluster // for the run. - // Wire name: 'cluster_instance' ClusterInstance *ClusterInstance `json:"cluster_instance,omitempty"` // The task evaluates a condition that can be used to control the execution // of other tasks when the `condition_task` field is present. The condition // task does not require a cluster to execute and does not support retries // or notifications. - // Wire name: 'condition_task' ConditionTask *RunConditionTask `json:"condition_task,omitempty"` // The task refreshes a dashboard and sends a snapshot to subscribers. - // Wire name: 'dashboard_task' DashboardTask *DashboardTask `json:"dashboard_task,omitempty"` // Task type for dbt cloud, deprecated in favor of the new name // dbt_platform_task - // Wire name: 'dbt_cloud_task' DbtCloudTask *DbtCloudTask `json:"dbt_cloud_task,omitempty"` - // Wire name: 'dbt_platform_task' DbtPlatformTask *DbtPlatformTask `json:"dbt_platform_task,omitempty"` // The task runs one or more dbt commands when the `dbt_task` field is // present. The dbt task requires both Databricks SQL and the ability to use // a serverless or a pro SQL warehouse. - // Wire name: 'dbt_task' DbtTask *DbtTask `json:"dbt_task,omitempty"` // An optional array of objects specifying the dependency graph of the task. // All tasks specified in this field must complete successfully before // executing this task. The key is `task_key`, and the value is the name // assigned to the dependent task. - // Wire name: 'depends_on' DependsOn []TaskDependency `json:"depends_on,omitempty"` // An optional description for this task. - // Wire name: 'description' Description string `json:"description,omitempty"` // Deprecated, field was never used in production. - // Wire name: 'disabled' Disabled bool `json:"disabled,omitempty"` // The actual performance target used by the serverless run during // execution. This can differ from the client-set performance target on the @@ -7093,20 +4298,16 @@ type RunTask struct { // * `STANDARD`: Enables cost-efficient execution of serverless workloads. * // `PERFORMANCE_OPTIMIZED`: Prioritizes fast startup and execution times // through rapid scaling and optimized cluster performance. - // Wire name: 'effective_performance_target' EffectivePerformanceTarget PerformanceTarget `json:"effective_performance_target,omitempty"` // An optional set of email addresses notified when the task run begins or // completes. The default behavior is to not send any emails. - // Wire name: 'email_notifications' EmailNotifications *JobEmailNotifications `json:"email_notifications,omitempty"` // The time at which this run ended in epoch milliseconds (milliseconds // since 1/1/1970 UTC). This field is set to 0 if the job is still running. - // Wire name: 'end_time' EndTime int64 `json:"end_time,omitempty"` // The key that references an environment spec in a job. This field is // required for Python script, Python wheel and dbt tasks when using // serverless compute. - // Wire name: 'environment_key' EnvironmentKey string `json:"environment_key,omitempty"` // The time in milliseconds it took to execute the commands in the JAR or // notebook until they completed, failed, timed out, were cancelled, or @@ -7115,20 +4316,16 @@ type RunTask struct { // The `execution_duration` field is set to 0 for multitask job runs. The // total duration of a multitask job run is the value of the `run_duration` // field. - // Wire name: 'execution_duration' ExecutionDuration int64 `json:"execution_duration,omitempty"` // If existing_cluster_id, the ID of an existing cluster that is used for // all runs. When running jobs or tasks on an existing cluster, you may need // to manually restart the cluster if it stops responding. We suggest // running jobs and tasks on new clusters for greater reliability - // Wire name: 'existing_cluster_id' ExistingClusterId string `json:"existing_cluster_id,omitempty"` // The task executes a nested task for every input provided when the // `for_each_task` field is present. - // Wire name: 'for_each_task' ForEachTask *RunForEachTask `json:"for_each_task,omitempty"` - // Wire name: 'gen_ai_compute_task' GenAiComputeTask *GenAiComputeTask `json:"gen_ai_compute_task,omitempty"` // An optional specification for a remote Git repository containing the // source code used by tasks. Version-controlled source code is supported by @@ -7138,64 +4335,48 @@ type RunTask struct { // `WORKSPACE` on the task. Note: dbt and SQL File tasks support only // version-controlled sources. If dbt or SQL File tasks are used, // `git_source` must be defined on the job. - // Wire name: 'git_source' GitSource *GitSource `json:"git_source,omitempty"` // If job_cluster_key, this task is executed reusing the cluster specified // in `job.settings.job_clusters`. - // Wire name: 'job_cluster_key' JobClusterKey string `json:"job_cluster_key,omitempty"` // An optional list of libraries to be installed on the cluster. The default // value is an empty list. - // Wire name: 'libraries' Libraries []compute.Library `json:"libraries,omitempty"` // If new_cluster, a description of a new cluster that is created for each // run. - // Wire name: 'new_cluster' NewCluster *compute.ClusterSpec `json:"new_cluster,omitempty"` // The task runs a notebook when the `notebook_task` field is present. - // Wire name: 'notebook_task' NotebookTask *NotebookTask `json:"notebook_task,omitempty"` // Optional notification settings that are used when sending notifications // to each of the `email_notifications` and `webhook_notifications` for this // task run. - // Wire name: 'notification_settings' NotificationSettings *TaskNotificationSettings `json:"notification_settings,omitempty"` // The task triggers a pipeline update when the `pipeline_task` field is // present. Only pipelines configured to use triggered more are supported. - // Wire name: 'pipeline_task' PipelineTask *PipelineTask `json:"pipeline_task,omitempty"` // The task triggers a Power BI semantic model update when the // `power_bi_task` field is present. - // Wire name: 'power_bi_task' PowerBiTask *PowerBiTask `json:"power_bi_task,omitempty"` // The task runs a Python wheel when the `python_wheel_task` field is // present. - // Wire name: 'python_wheel_task' PythonWheelTask *PythonWheelTask `json:"python_wheel_task,omitempty"` // The time in milliseconds that the run has spent in the queue. - // Wire name: 'queue_duration' QueueDuration int64 `json:"queue_duration,omitempty"` // Parameter values including resolved references - // Wire name: 'resolved_values' ResolvedValues *ResolvedValues `json:"resolved_values,omitempty"` // The time in milliseconds it took the job run and all of its repairs to // finish. - // Wire name: 'run_duration' RunDuration int64 `json:"run_duration,omitempty"` // The ID of the task run. - // Wire name: 'run_id' RunId int64 `json:"run_id,omitempty"` // An optional value indicating the condition that determines whether the // task should be run once its dependencies have been completed. When // omitted, defaults to `ALL_SUCCESS`. See :method:jobs/create for a list of // possible values. - // Wire name: 'run_if' RunIf RunIf `json:"run_if,omitempty"` // The task triggers another job when the `run_job_task` field is present. - // Wire name: 'run_job_task' RunJobTask *RunJobTask `json:"run_job_task,omitempty"` - // Wire name: 'run_page_url' RunPageUrl string `json:"run_page_url,omitempty"` // The time in milliseconds it took to set up the cluster. For runs that run // on new clusters this is the cluster creation time, for runs that run on @@ -7204,14 +4385,11 @@ type RunTask struct { // `cleanup_duration`. The `setup_duration` field is set to 0 for multitask // job runs. The total duration of a multitask job run is the value of the // `run_duration` field. - // Wire name: 'setup_duration' SetupDuration int64 `json:"setup_duration,omitempty"` // The task runs a JAR when the `spark_jar_task` field is present. - // Wire name: 'spark_jar_task' SparkJarTask *SparkJarTask `json:"spark_jar_task,omitempty"` // The task runs a Python file when the `spark_python_task` field is // present. - // Wire name: 'spark_python_task' SparkPythonTask *SparkPythonTask `json:"spark_python_task,omitempty"` // (Legacy) The task runs the spark-submit script when the // `spark_submit_task` field is present. This task can run only on new @@ -7231,66 +4409,41 @@ type RunTask struct { // // The `--jars`, `--py-files`, `--files` arguments support DBFS and S3 // paths. - // Wire name: 'spark_submit_task' SparkSubmitTask *SparkSubmitTask `json:"spark_submit_task,omitempty"` // The task runs a SQL query or file, or it refreshes a SQL alert or a // legacy SQL dashboard when the `sql_task` field is present. - // Wire name: 'sql_task' SqlTask *SqlTask `json:"sql_task,omitempty"` // The time at which this run was started in epoch milliseconds // (milliseconds since 1/1/1970 UTC). This may not be the time when the job // task starts executing, for example, if the job is scheduled to run on a // new cluster, this is the time the cluster creation call is issued. - // Wire name: 'start_time' StartTime int64 `json:"start_time,omitempty"` // Deprecated. Please use the `status` field instead. - // Wire name: 'state' State *RunState `json:"state,omitempty"` // The current status of the run - // Wire name: 'status' Status *RunStatus `json:"status,omitempty"` // A unique name for the task. This field is used to refer to this task from // other tasks. This field is required and must be unique within its parent // job. On Update or Reset, this field is used to reference the tasks to be // updated or reset. - // Wire name: 'task_key' TaskKey string `json:"task_key"` // An optional timeout applied to each run of this job task. A value of `0` // means no timeout. - // Wire name: 'timeout_seconds' TimeoutSeconds int `json:"timeout_seconds,omitempty"` // A collection of system notification IDs to notify when the run begins or // completes. The default behavior is to not send any system notifications. // Task webhooks respect the task notification settings. - // Wire name: 'webhook_notifications' WebhookNotifications *WebhookNotifications `json:"webhook_notifications,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *RunTask) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &runTaskPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := runTaskFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *RunTask) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st RunTask) MarshalJSON() ([]byte, error) { - pb, err := runTaskToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s RunTask) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The type of a run. * `JOB_RUN`: Normal job run. A run created with @@ -7394,14 +4547,12 @@ func (f *Source) Type() string { type SparkJarTask struct { // Deprecated since 04/2016. Provide a `jar` through the `libraries` field // instead. For an example, see :method:jobs/create. - // Wire name: 'jar_uri' JarUri string `json:"jar_uri,omitempty"` // The full name of the class containing the main method to be executed. // This class must be contained in a JAR provided as a library. // // The code must use `SparkContext.getOrCreate` to obtain a Spark context; // otherwise, runs of the job fail. - // Wire name: 'main_class_name' MainClassName string `json:"main_class_name,omitempty"` // Parameters passed to the main method. // @@ -7409,38 +4560,19 @@ type SparkJarTask struct { // about job runs. // // [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables - // Wire name: 'parameters' Parameters []string `json:"parameters,omitempty"` // Deprecated. A value of `false` is no longer supported. - // Wire name: 'run_as_repl' RunAsRepl bool `json:"run_as_repl,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *SparkJarTask) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &sparkJarTaskPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := sparkJarTaskFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *SparkJarTask) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st SparkJarTask) MarshalJSON() ([]byte, error) { - pb, err := sparkJarTaskToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s SparkJarTask) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type SparkPythonTask struct { @@ -7450,14 +4582,12 @@ type SparkPythonTask struct { // about job runs. // // [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables - // Wire name: 'parameters' Parameters []string `json:"parameters,omitempty"` // The Python file to be executed. Cloud file URIs (such as dbfs:/, s3:/, // adls:/, gcs:/) and workspace paths are supported. For python files stored // in the Databricks workspace, the path must be absolute and begin with // `/`. For files stored in a remote repository, the path must be relative. // This field is required. - // Wire name: 'python_file' PythonFile string `json:"python_file"` // Optional location type of the Python file. When set to `WORKSPACE` or not // specified, the file will be retrieved from the local Databricks workspace @@ -7468,35 +4598,9 @@ type SparkPythonTask struct { // * `WORKSPACE`: The Python file is located in a Databricks workspace or at // a cloud filesystem URI. * `GIT`: The Python file is located in a remote // Git repository. - // Wire name: 'source' Source Source `json:"source,omitempty"` } -func (st *SparkPythonTask) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &sparkPythonTaskPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := sparkPythonTaskFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st SparkPythonTask) MarshalJSON() ([]byte, error) { - pb, err := sparkPythonTaskToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type SparkSubmitTask struct { // Command-line parameters passed to spark submit. // @@ -7504,83 +4608,35 @@ type SparkSubmitTask struct { // about job runs. // // [Task parameter variables]: https://docs.databricks.com/jobs.html#parameter-variables - // Wire name: 'parameters' Parameters []string `json:"parameters,omitempty"` } -func (st *SparkSubmitTask) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &sparkSubmitTaskPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := sparkSubmitTaskFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st SparkSubmitTask) MarshalJSON() ([]byte, error) { - pb, err := sparkSubmitTaskToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type SqlAlertOutput struct { // The state of the SQL alert. // // * UNKNOWN: alert yet to be evaluated * OK: alert evaluated and did not // fulfill trigger conditions * TRIGGERED: alert evaluated and fulfilled // trigger conditions - // Wire name: 'alert_state' AlertState SqlAlertState `json:"alert_state,omitempty"` // The link to find the output results. - // Wire name: 'output_link' OutputLink string `json:"output_link,omitempty"` // The text of the SQL query. Can Run permission of the SQL query associated // with the SQL alert is required to view this field. - // Wire name: 'query_text' QueryText string `json:"query_text,omitempty"` // Information about SQL statements executed in the run. - // Wire name: 'sql_statements' SqlStatements []SqlStatementOutput `json:"sql_statements,omitempty"` // The canonical identifier of the SQL warehouse. - // Wire name: 'warehouse_id' WarehouseId string `json:"warehouse_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *SqlAlertOutput) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &sqlAlertOutputPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := sqlAlertOutputFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *SqlAlertOutput) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st SqlAlertOutput) MarshalJSON() ([]byte, error) { - pb, err := sqlAlertOutputToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s SqlAlertOutput) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The state of the SQL alert. @@ -7630,89 +4686,46 @@ func (f *SqlAlertState) Type() string { type SqlDashboardOutput struct { // The canonical identifier of the SQL warehouse. - // Wire name: 'warehouse_id' WarehouseId string `json:"warehouse_id,omitempty"` // Widgets executed in the run. Only SQL query based widgets are listed. - // Wire name: 'widgets' Widgets []SqlDashboardWidgetOutput `json:"widgets,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *SqlDashboardOutput) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &sqlDashboardOutputPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := sqlDashboardOutputFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *SqlDashboardOutput) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st SqlDashboardOutput) MarshalJSON() ([]byte, error) { - pb, err := sqlDashboardOutputToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s SqlDashboardOutput) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type SqlDashboardWidgetOutput struct { // Time (in epoch milliseconds) when execution of the SQL widget ends. - // Wire name: 'end_time' EndTime int64 `json:"end_time,omitempty"` // The information about the error when execution fails. - // Wire name: 'error' Error *SqlOutputError `json:"error,omitempty"` // The link to find the output results. - // Wire name: 'output_link' OutputLink string `json:"output_link,omitempty"` // Time (in epoch milliseconds) when execution of the SQL widget starts. - // Wire name: 'start_time' StartTime int64 `json:"start_time,omitempty"` // The execution status of the SQL widget. - // Wire name: 'status' Status SqlDashboardWidgetOutputStatus `json:"status,omitempty"` // The canonical identifier of the SQL widget. - // Wire name: 'widget_id' WidgetId string `json:"widget_id,omitempty"` // The title of the SQL widget. - // Wire name: 'widget_title' WidgetTitle string `json:"widget_title,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *SqlDashboardWidgetOutput) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &sqlDashboardWidgetOutputPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := sqlDashboardWidgetOutputFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *SqlDashboardWidgetOutput) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st SqlDashboardWidgetOutput) MarshalJSON() ([]byte, error) { - pb, err := sqlDashboardWidgetOutputToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s SqlDashboardWidgetOutput) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type SqlDashboardWidgetOutputStatus string @@ -7763,290 +4776,130 @@ func (f *SqlDashboardWidgetOutputStatus) Type() string { type SqlOutput struct { // The output of a SQL alert task, if available. - // Wire name: 'alert_output' AlertOutput *SqlAlertOutput `json:"alert_output,omitempty"` // The output of a SQL dashboard task, if available. - // Wire name: 'dashboard_output' DashboardOutput *SqlDashboardOutput `json:"dashboard_output,omitempty"` // The output of a SQL query task, if available. - // Wire name: 'query_output' QueryOutput *SqlQueryOutput `json:"query_output,omitempty"` } -func (st *SqlOutput) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &sqlOutputPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := sqlOutputFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st SqlOutput) MarshalJSON() ([]byte, error) { - pb, err := sqlOutputToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type SqlOutputError struct { // The error message when execution fails. - // Wire name: 'message' Message string `json:"message,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *SqlOutputError) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &sqlOutputErrorPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := sqlOutputErrorFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *SqlOutputError) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st SqlOutputError) MarshalJSON() ([]byte, error) { - pb, err := sqlOutputErrorToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s SqlOutputError) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type SqlQueryOutput struct { - - // Wire name: 'endpoint_id' EndpointId string `json:"endpoint_id,omitempty"` // The link to find the output results. - // Wire name: 'output_link' OutputLink string `json:"output_link,omitempty"` // The text of the SQL query. Can Run permission of the SQL query is // required to view this field. - // Wire name: 'query_text' QueryText string `json:"query_text,omitempty"` // Information about SQL statements executed in the run. - // Wire name: 'sql_statements' SqlStatements []SqlStatementOutput `json:"sql_statements,omitempty"` // The canonical identifier of the SQL warehouse. - // Wire name: 'warehouse_id' WarehouseId string `json:"warehouse_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *SqlQueryOutput) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &sqlQueryOutputPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := sqlQueryOutputFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *SqlQueryOutput) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st SqlQueryOutput) MarshalJSON() ([]byte, error) { - pb, err := sqlQueryOutputToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s SqlQueryOutput) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type SqlStatementOutput struct { // A key that can be used to look up query details. - // Wire name: 'lookup_key' LookupKey string `json:"lookup_key,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *SqlStatementOutput) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &sqlStatementOutputPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := sqlStatementOutputFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *SqlStatementOutput) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st SqlStatementOutput) MarshalJSON() ([]byte, error) { - pb, err := sqlStatementOutputToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s SqlStatementOutput) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type SqlTask struct { // If alert, indicates that this job must refresh a SQL alert. - // Wire name: 'alert' Alert *SqlTaskAlert `json:"alert,omitempty"` // If dashboard, indicates that this job must refresh a SQL dashboard. - // Wire name: 'dashboard' Dashboard *SqlTaskDashboard `json:"dashboard,omitempty"` // If file, indicates that this job runs a SQL file in a remote Git // repository. - // Wire name: 'file' File *SqlTaskFile `json:"file,omitempty"` // Parameters to be used for each run of this job. The SQL alert task does // not support custom parameters. - // Wire name: 'parameters' Parameters map[string]string `json:"parameters,omitempty"` // If query, indicates that this job must execute a SQL query. - // Wire name: 'query' Query *SqlTaskQuery `json:"query,omitempty"` // The canonical identifier of the SQL warehouse. Recommended to use with // serverless or pro SQL warehouses. Classic SQL warehouses are only // supported for SQL alert, dashboard and query tasks and are limited to // scheduled single-task jobs. - // Wire name: 'warehouse_id' WarehouseId string `json:"warehouse_id"` } -func (st *SqlTask) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &sqlTaskPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := sqlTaskFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st SqlTask) MarshalJSON() ([]byte, error) { - pb, err := sqlTaskToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type SqlTaskAlert struct { // The canonical identifier of the SQL alert. - // Wire name: 'alert_id' AlertId string `json:"alert_id"` // If true, the alert notifications are not sent to subscribers. - // Wire name: 'pause_subscriptions' PauseSubscriptions bool `json:"pause_subscriptions,omitempty"` // If specified, alert notifications are sent to subscribers. - // Wire name: 'subscriptions' Subscriptions []SqlTaskSubscription `json:"subscriptions,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *SqlTaskAlert) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &sqlTaskAlertPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := sqlTaskAlertFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *SqlTaskAlert) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st SqlTaskAlert) MarshalJSON() ([]byte, error) { - pb, err := sqlTaskAlertToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s SqlTaskAlert) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type SqlTaskDashboard struct { // Subject of the email sent to subscribers of this task. - // Wire name: 'custom_subject' CustomSubject string `json:"custom_subject,omitempty"` // The canonical identifier of the SQL dashboard. - // Wire name: 'dashboard_id' DashboardId string `json:"dashboard_id"` // If true, the dashboard snapshot is not taken, and emails are not sent to // subscribers. - // Wire name: 'pause_subscriptions' PauseSubscriptions bool `json:"pause_subscriptions,omitempty"` // If specified, dashboard snapshots are sent to subscriptions. - // Wire name: 'subscriptions' Subscriptions []SqlTaskSubscription `json:"subscriptions,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *SqlTaskDashboard) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &sqlTaskDashboardPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := sqlTaskDashboardFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *SqlTaskDashboard) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st SqlTaskDashboard) MarshalJSON() ([]byte, error) { - pb, err := sqlTaskDashboardToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s SqlTaskDashboard) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type SqlTaskFile struct { // Path of the SQL file. Must be relative if the source is a remote Git // repository and absolute for workspace paths. - // Wire name: 'path' Path string `json:"path"` // Optional location type of the SQL file. When set to `WORKSPACE`, the SQL // file will be retrieved from the local Databricks workspace. When set to @@ -8056,105 +4909,34 @@ type SqlTaskFile struct { // // * `WORKSPACE`: SQL file is located in Databricks workspace. * `GIT`: SQL // file is located in cloud Git provider. - // Wire name: 'source' Source Source `json:"source,omitempty"` } -func (st *SqlTaskFile) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &sqlTaskFilePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := sqlTaskFileFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st SqlTaskFile) MarshalJSON() ([]byte, error) { - pb, err := sqlTaskFileToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type SqlTaskQuery struct { // The canonical identifier of the SQL query. - // Wire name: 'query_id' QueryId string `json:"query_id"` } -func (st *SqlTaskQuery) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &sqlTaskQueryPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := sqlTaskQueryFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st SqlTaskQuery) MarshalJSON() ([]byte, error) { - pb, err := sqlTaskQueryToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type SqlTaskSubscription struct { // The canonical identifier of the destination to receive email // notification. This parameter is mutually exclusive with user_name. You // cannot set both destination_id and user_name for subscription // notifications. - // Wire name: 'destination_id' DestinationId string `json:"destination_id,omitempty"` // The user name to receive the subscription email. This parameter is // mutually exclusive with destination_id. You cannot set both // destination_id and user_name for subscription notifications. - // Wire name: 'user_name' UserName string `json:"user_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *SqlTaskSubscription) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &sqlTaskSubscriptionPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := sqlTaskSubscriptionFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *SqlTaskSubscription) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st SqlTaskSubscription) MarshalJSON() ([]byte, error) { - pb, err := sqlTaskSubscriptionToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s SqlTaskSubscription) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type StorageMode string @@ -8199,19 +4981,15 @@ func (f *StorageMode) Type() string { type SubmitRun struct { // List of permissions to set on the job. - // Wire name: 'access_control_list' AccessControlList []JobAccessControlRequest `json:"access_control_list,omitempty"` // The user specified id of the budget policy to use for this one-time run. // If not specified, the run will be not be attributed to any budget policy. - // Wire name: 'budget_policy_id' BudgetPolicyId string `json:"budget_policy_id,omitempty"` // An optional set of email addresses notified when the run begins or // completes. - // Wire name: 'email_notifications' EmailNotifications *JobEmailNotifications `json:"email_notifications,omitempty"` // A list of task execution environment specifications that can be // referenced by tasks of this run. - // Wire name: 'environments' Environments []JobEnvironment `json:"environments,omitempty"` // An optional specification for a remote Git repository containing the // source code used by tasks. Version-controlled source code is supported by @@ -8223,10 +5001,8 @@ type SubmitRun struct { // // Note: dbt and SQL File tasks support only version-controlled sources. If // dbt or SQL File tasks are used, `git_source` must be defined on the job. - // Wire name: 'git_source' GitSource *GitSource `json:"git_source,omitempty"` // An optional set of health rules that can be defined for this job. - // Wire name: 'health' Health *JobsHealthRules `json:"health,omitempty"` // An optional token that can be used to guarantee the idempotency of job // run requests. If a run with the provided token already exists, the @@ -8243,95 +5019,52 @@ type SubmitRun struct { // For more information, see [How to ensure idempotency for jobs]. // // [How to ensure idempotency for jobs]: https://kb.databricks.com/jobs/jobs-idempotency.html - // Wire name: 'idempotency_token' IdempotencyToken string `json:"idempotency_token,omitempty"` // Optional notification settings that are used when sending notifications // to each of the `email_notifications` and `webhook_notifications` for this // run. - // Wire name: 'notification_settings' NotificationSettings *JobNotificationSettings `json:"notification_settings,omitempty"` // The queue settings of the one-time run. - // Wire name: 'queue' Queue *QueueSettings `json:"queue,omitempty"` // Specifies the user or service principal that the job runs as. If not // specified, the job runs as the user who submits the request. - // Wire name: 'run_as' RunAs *JobRunAs `json:"run_as,omitempty"` // An optional name for the run. The default value is `Untitled`. - // Wire name: 'run_name' RunName string `json:"run_name,omitempty"` - // Wire name: 'tasks' Tasks []SubmitTask `json:"tasks,omitempty"` // An optional timeout applied to each run of this job. A value of `0` means // no timeout. - // Wire name: 'timeout_seconds' TimeoutSeconds int `json:"timeout_seconds,omitempty"` // A collection of system notification IDs to notify when the run begins or // completes. - // Wire name: 'webhook_notifications' WebhookNotifications *WebhookNotifications `json:"webhook_notifications,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *SubmitRun) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &submitRunPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := submitRunFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *SubmitRun) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st SubmitRun) MarshalJSON() ([]byte, error) { - pb, err := submitRunToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s SubmitRun) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Run was created and started successfully. type SubmitRunResponse struct { // The canonical identifier for the newly submitted run. - // Wire name: 'run_id' RunId int64 `json:"run_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *SubmitRunResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &submitRunResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := submitRunResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *SubmitRunResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st SubmitRunResponse) MarshalJSON() ([]byte, error) { - pb, err := submitRunResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s SubmitRunResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type SubmitTask struct { @@ -8339,106 +5072,81 @@ type SubmitTask struct { // `clean_rooms_notebook_task` field is present. // // [clean rooms]: https://docs.databricks.com/en/clean-rooms/index.html - // Wire name: 'clean_rooms_notebook_task' CleanRoomsNotebookTask *CleanRoomsNotebookTask `json:"clean_rooms_notebook_task,omitempty"` // The task evaluates a condition that can be used to control the execution // of other tasks when the `condition_task` field is present. The condition // task does not require a cluster to execute and does not support retries // or notifications. - // Wire name: 'condition_task' ConditionTask *ConditionTask `json:"condition_task,omitempty"` // The task refreshes a dashboard and sends a snapshot to subscribers. - // Wire name: 'dashboard_task' DashboardTask *DashboardTask `json:"dashboard_task,omitempty"` // Task type for dbt cloud, deprecated in favor of the new name // dbt_platform_task - // Wire name: 'dbt_cloud_task' DbtCloudTask *DbtCloudTask `json:"dbt_cloud_task,omitempty"` - // Wire name: 'dbt_platform_task' DbtPlatformTask *DbtPlatformTask `json:"dbt_platform_task,omitempty"` // The task runs one or more dbt commands when the `dbt_task` field is // present. The dbt task requires both Databricks SQL and the ability to use // a serverless or a pro SQL warehouse. - // Wire name: 'dbt_task' DbtTask *DbtTask `json:"dbt_task,omitempty"` // An optional array of objects specifying the dependency graph of the task. // All tasks specified in this field must complete successfully before // executing this task. The key is `task_key`, and the value is the name // assigned to the dependent task. - // Wire name: 'depends_on' DependsOn []TaskDependency `json:"depends_on,omitempty"` // An optional description for this task. - // Wire name: 'description' Description string `json:"description,omitempty"` // An optional set of email addresses notified when the task run begins or // completes. The default behavior is to not send any emails. - // Wire name: 'email_notifications' EmailNotifications *JobEmailNotifications `json:"email_notifications,omitempty"` // The key that references an environment spec in a job. This field is // required for Python script, Python wheel and dbt tasks when using // serverless compute. - // Wire name: 'environment_key' EnvironmentKey string `json:"environment_key,omitempty"` // If existing_cluster_id, the ID of an existing cluster that is used for // all runs. When running jobs or tasks on an existing cluster, you may need // to manually restart the cluster if it stops responding. We suggest // running jobs and tasks on new clusters for greater reliability - // Wire name: 'existing_cluster_id' ExistingClusterId string `json:"existing_cluster_id,omitempty"` // The task executes a nested task for every input provided when the // `for_each_task` field is present. - // Wire name: 'for_each_task' ForEachTask *ForEachTask `json:"for_each_task,omitempty"` - // Wire name: 'gen_ai_compute_task' GenAiComputeTask *GenAiComputeTask `json:"gen_ai_compute_task,omitempty"` // An optional set of health rules that can be defined for this job. - // Wire name: 'health' Health *JobsHealthRules `json:"health,omitempty"` // An optional list of libraries to be installed on the cluster. The default // value is an empty list. - // Wire name: 'libraries' Libraries []compute.Library `json:"libraries,omitempty"` // If new_cluster, a description of a new cluster that is created for each // run. - // Wire name: 'new_cluster' NewCluster *compute.ClusterSpec `json:"new_cluster,omitempty"` // The task runs a notebook when the `notebook_task` field is present. - // Wire name: 'notebook_task' NotebookTask *NotebookTask `json:"notebook_task,omitempty"` // Optional notification settings that are used when sending notifications // to each of the `email_notifications` and `webhook_notifications` for this // task run. - // Wire name: 'notification_settings' NotificationSettings *TaskNotificationSettings `json:"notification_settings,omitempty"` // The task triggers a pipeline update when the `pipeline_task` field is // present. Only pipelines configured to use triggered more are supported. - // Wire name: 'pipeline_task' PipelineTask *PipelineTask `json:"pipeline_task,omitempty"` // The task triggers a Power BI semantic model update when the // `power_bi_task` field is present. - // Wire name: 'power_bi_task' PowerBiTask *PowerBiTask `json:"power_bi_task,omitempty"` // The task runs a Python wheel when the `python_wheel_task` field is // present. - // Wire name: 'python_wheel_task' PythonWheelTask *PythonWheelTask `json:"python_wheel_task,omitempty"` // An optional value indicating the condition that determines whether the // task should be run once its dependencies have been completed. When // omitted, defaults to `ALL_SUCCESS`. See :method:jobs/create for a list of // possible values. - // Wire name: 'run_if' RunIf RunIf `json:"run_if,omitempty"` // The task triggers another job when the `run_job_task` field is present. - // Wire name: 'run_job_task' RunJobTask *RunJobTask `json:"run_job_task,omitempty"` // The task runs a JAR when the `spark_jar_task` field is present. - // Wire name: 'spark_jar_task' SparkJarTask *SparkJarTask `json:"spark_jar_task,omitempty"` // The task runs a Python file when the `spark_python_task` field is // present. - // Wire name: 'spark_python_task' SparkPythonTask *SparkPythonTask `json:"spark_python_task,omitempty"` // (Legacy) The task runs the spark-submit script when the // `spark_submit_task` field is present. This task can run only on new @@ -8458,180 +5166,98 @@ type SubmitTask struct { // // The `--jars`, `--py-files`, `--files` arguments support DBFS and S3 // paths. - // Wire name: 'spark_submit_task' SparkSubmitTask *SparkSubmitTask `json:"spark_submit_task,omitempty"` // The task runs a SQL query or file, or it refreshes a SQL alert or a // legacy SQL dashboard when the `sql_task` field is present. - // Wire name: 'sql_task' SqlTask *SqlTask `json:"sql_task,omitempty"` // A unique name for the task. This field is used to refer to this task from // other tasks. This field is required and must be unique within its parent // job. On Update or Reset, this field is used to reference the tasks to be // updated or reset. - // Wire name: 'task_key' TaskKey string `json:"task_key"` // An optional timeout applied to each run of this job task. A value of `0` // means no timeout. - // Wire name: 'timeout_seconds' TimeoutSeconds int `json:"timeout_seconds,omitempty"` // A collection of system notification IDs to notify when the run begins or // completes. The default behavior is to not send any system notifications. // Task webhooks respect the task notification settings. - // Wire name: 'webhook_notifications' WebhookNotifications *WebhookNotifications `json:"webhook_notifications,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *SubmitTask) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &submitTaskPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := submitTaskFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *SubmitTask) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st SubmitTask) MarshalJSON() ([]byte, error) { - pb, err := submitTaskToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s SubmitTask) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type Subscription struct { // Optional: Allows users to specify a custom subject line on the email sent // to subscribers. - // Wire name: 'custom_subject' CustomSubject string `json:"custom_subject,omitempty"` // When true, the subscription will not send emails. - // Wire name: 'paused' Paused bool `json:"paused,omitempty"` // The list of subscribers to send the snapshot of the dashboard to. - // Wire name: 'subscribers' Subscribers []SubscriptionSubscriber `json:"subscribers,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *Subscription) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &subscriptionPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := subscriptionFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *Subscription) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st Subscription) MarshalJSON() ([]byte, error) { - pb, err := subscriptionToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s Subscription) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type SubscriptionSubscriber struct { // A snapshot of the dashboard will be sent to the destination when the // `destination_id` field is present. - // Wire name: 'destination_id' DestinationId string `json:"destination_id,omitempty"` // A snapshot of the dashboard will be sent to the user's email when the // `user_name` field is present. - // Wire name: 'user_name' UserName string `json:"user_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *SubscriptionSubscriber) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &subscriptionSubscriberPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := subscriptionSubscriberFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *SubscriptionSubscriber) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st SubscriptionSubscriber) MarshalJSON() ([]byte, error) { - pb, err := subscriptionSubscriberToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s SubscriptionSubscriber) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type TableUpdateTriggerConfiguration struct { // The table(s) condition based on which to trigger a job run. - // Wire name: 'condition' Condition Condition `json:"condition,omitempty"` // If set, the trigger starts a run only after the specified amount of time // has passed since the last time the trigger fired. The minimum allowed // value is 60 seconds. - // Wire name: 'min_time_between_triggers_seconds' MinTimeBetweenTriggersSeconds int `json:"min_time_between_triggers_seconds,omitempty"` // A list of Delta tables to monitor for changes. The table name must be in // the format `catalog_name.schema_name.table_name`. - // Wire name: 'table_names' TableNames []string `json:"table_names,omitempty"` // If set, the trigger starts a run only after no table updates have // occurred for the specified time and can be used to wait for a series of // table updates before triggering a run. The minimum allowed value is 60 // seconds. - // Wire name: 'wait_after_last_change_seconds' WaitAfterLastChangeSeconds int `json:"wait_after_last_change_seconds,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *TableUpdateTriggerConfiguration) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &tableUpdateTriggerConfigurationPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := tableUpdateTriggerConfigurationFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *TableUpdateTriggerConfiguration) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st TableUpdateTriggerConfiguration) MarshalJSON() ([]byte, error) { - pb, err := tableUpdateTriggerConfigurationToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s TableUpdateTriggerConfiguration) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type Task struct { @@ -8639,113 +5265,87 @@ type Task struct { // `clean_rooms_notebook_task` field is present. // // [clean rooms]: https://docs.databricks.com/en/clean-rooms/index.html - // Wire name: 'clean_rooms_notebook_task' CleanRoomsNotebookTask *CleanRoomsNotebookTask `json:"clean_rooms_notebook_task,omitempty"` // The task evaluates a condition that can be used to control the execution // of other tasks when the `condition_task` field is present. The condition // task does not require a cluster to execute and does not support retries // or notifications. - // Wire name: 'condition_task' ConditionTask *ConditionTask `json:"condition_task,omitempty"` // The task refreshes a dashboard and sends a snapshot to subscribers. - // Wire name: 'dashboard_task' DashboardTask *DashboardTask `json:"dashboard_task,omitempty"` // Task type for dbt cloud, deprecated in favor of the new name // dbt_platform_task - // Wire name: 'dbt_cloud_task' DbtCloudTask *DbtCloudTask `json:"dbt_cloud_task,omitempty"` - // Wire name: 'dbt_platform_task' DbtPlatformTask *DbtPlatformTask `json:"dbt_platform_task,omitempty"` // The task runs one or more dbt commands when the `dbt_task` field is // present. The dbt task requires both Databricks SQL and the ability to use // a serverless or a pro SQL warehouse. - // Wire name: 'dbt_task' DbtTask *DbtTask `json:"dbt_task,omitempty"` // An optional array of objects specifying the dependency graph of the task. // All tasks specified in this field must complete before executing this // task. The task will run only if the `run_if` condition is true. The key // is `task_key`, and the value is the name assigned to the dependent task. - // Wire name: 'depends_on' DependsOn []TaskDependency `json:"depends_on,omitempty"` // An optional description for this task. - // Wire name: 'description' Description string `json:"description,omitempty"` // An option to disable auto optimization in serverless - // Wire name: 'disable_auto_optimization' DisableAutoOptimization bool `json:"disable_auto_optimization,omitempty"` // An optional set of email addresses that is notified when runs of this // task begin or complete as well as when this task is deleted. The default // behavior is to not send any emails. - // Wire name: 'email_notifications' EmailNotifications *TaskEmailNotifications `json:"email_notifications,omitempty"` // The key that references an environment spec in a job. This field is // required for Python script, Python wheel and dbt tasks when using // serverless compute. - // Wire name: 'environment_key' EnvironmentKey string `json:"environment_key,omitempty"` // If existing_cluster_id, the ID of an existing cluster that is used for // all runs. When running jobs or tasks on an existing cluster, you may need // to manually restart the cluster if it stops responding. We suggest // running jobs and tasks on new clusters for greater reliability - // Wire name: 'existing_cluster_id' ExistingClusterId string `json:"existing_cluster_id,omitempty"` // The task executes a nested task for every input provided when the // `for_each_task` field is present. - // Wire name: 'for_each_task' ForEachTask *ForEachTask `json:"for_each_task,omitempty"` - // Wire name: 'gen_ai_compute_task' GenAiComputeTask *GenAiComputeTask `json:"gen_ai_compute_task,omitempty"` // An optional set of health rules that can be defined for this job. - // Wire name: 'health' Health *JobsHealthRules `json:"health,omitempty"` // If job_cluster_key, this task is executed reusing the cluster specified // in `job.settings.job_clusters`. - // Wire name: 'job_cluster_key' JobClusterKey string `json:"job_cluster_key,omitempty"` // An optional list of libraries to be installed on the cluster. The default // value is an empty list. - // Wire name: 'libraries' Libraries []compute.Library `json:"libraries,omitempty"` // An optional maximum number of times to retry an unsuccessful run. A run // is considered to be unsuccessful if it completes with the `FAILED` // result_state or `INTERNAL_ERROR` `life_cycle_state`. The value `-1` means // to retry indefinitely and the value `0` means to never retry. - // Wire name: 'max_retries' MaxRetries int `json:"max_retries,omitempty"` // An optional minimal interval in milliseconds between the start of the // failed run and the subsequent retry run. The default behavior is that // unsuccessful runs are immediately retried. - // Wire name: 'min_retry_interval_millis' MinRetryIntervalMillis int `json:"min_retry_interval_millis,omitempty"` // If new_cluster, a description of a new cluster that is created for each // run. - // Wire name: 'new_cluster' NewCluster *compute.ClusterSpec `json:"new_cluster,omitempty"` // The task runs a notebook when the `notebook_task` field is present. - // Wire name: 'notebook_task' NotebookTask *NotebookTask `json:"notebook_task,omitempty"` // Optional notification settings that are used when sending notifications // to each of the `email_notifications` and `webhook_notifications` for this // task. - // Wire name: 'notification_settings' NotificationSettings *TaskNotificationSettings `json:"notification_settings,omitempty"` // The task triggers a pipeline update when the `pipeline_task` field is // present. Only pipelines configured to use triggered more are supported. - // Wire name: 'pipeline_task' PipelineTask *PipelineTask `json:"pipeline_task,omitempty"` // The task triggers a Power BI semantic model update when the // `power_bi_task` field is present. - // Wire name: 'power_bi_task' PowerBiTask *PowerBiTask `json:"power_bi_task,omitempty"` // The task runs a Python wheel when the `python_wheel_task` field is // present. - // Wire name: 'python_wheel_task' PythonWheelTask *PythonWheelTask `json:"python_wheel_task,omitempty"` // An optional policy to specify whether to retry a job when it times out. // The default behavior is to not retry on timeout. - // Wire name: 'retry_on_timeout' RetryOnTimeout bool `json:"retry_on_timeout,omitempty"` // An optional value specifying the condition determining whether the task // is run once its dependencies have been completed. @@ -8756,17 +5356,13 @@ type Task struct { // executed * `ALL_DONE`: All dependencies have been completed * // `AT_LEAST_ONE_FAILED`: At least one dependency failed * `ALL_FAILED`: ALl // dependencies have failed - // Wire name: 'run_if' RunIf RunIf `json:"run_if,omitempty"` // The task triggers another job when the `run_job_task` field is present. - // Wire name: 'run_job_task' RunJobTask *RunJobTask `json:"run_job_task,omitempty"` // The task runs a JAR when the `spark_jar_task` field is present. - // Wire name: 'spark_jar_task' SparkJarTask *SparkJarTask `json:"spark_jar_task,omitempty"` // The task runs a Python file when the `spark_python_task` field is // present. - // Wire name: 'spark_python_task' SparkPythonTask *SparkPythonTask `json:"spark_python_task,omitempty"` // (Legacy) The task runs the spark-submit script when the // `spark_submit_task` field is present. This task can run only on new @@ -8786,116 +5382,71 @@ type Task struct { // // The `--jars`, `--py-files`, `--files` arguments support DBFS and S3 // paths. - // Wire name: 'spark_submit_task' SparkSubmitTask *SparkSubmitTask `json:"spark_submit_task,omitempty"` // The task runs a SQL query or file, or it refreshes a SQL alert or a // legacy SQL dashboard when the `sql_task` field is present. - // Wire name: 'sql_task' SqlTask *SqlTask `json:"sql_task,omitempty"` // A unique name for the task. This field is used to refer to this task from // other tasks. This field is required and must be unique within its parent // job. On Update or Reset, this field is used to reference the tasks to be // updated or reset. - // Wire name: 'task_key' TaskKey string `json:"task_key"` // An optional timeout applied to each run of this job task. A value of `0` // means no timeout. - // Wire name: 'timeout_seconds' TimeoutSeconds int `json:"timeout_seconds,omitempty"` // A collection of system notification IDs to notify when runs of this task // begin or complete. The default behavior is to not send any system // notifications. - // Wire name: 'webhook_notifications' WebhookNotifications *WebhookNotifications `json:"webhook_notifications,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *Task) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &taskPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := taskFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *Task) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st Task) MarshalJSON() ([]byte, error) { - pb, err := taskToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s Task) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type TaskDependency struct { // Can only be specified on condition task dependencies. The outcome of the // dependent task that must be met for this task to run. - // Wire name: 'outcome' Outcome string `json:"outcome,omitempty"` // The name of the task this task depends on. - // Wire name: 'task_key' TaskKey string `json:"task_key"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *TaskDependency) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &taskDependencyPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := taskDependencyFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *TaskDependency) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st TaskDependency) MarshalJSON() ([]byte, error) { - pb, err := taskDependencyToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s TaskDependency) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type TaskEmailNotifications struct { // If true, do not send email to recipients specified in `on_failure` if the // run is skipped. This field is `deprecated`. Please use the // `notification_settings.no_alert_for_skipped_runs` field. - // Wire name: 'no_alert_for_skipped_runs' NoAlertForSkippedRuns bool `json:"no_alert_for_skipped_runs,omitempty"` // A list of email addresses to be notified when the duration of a run // exceeds the threshold specified for the `RUN_DURATION_SECONDS` metric in // the `health` field. If no rule for the `RUN_DURATION_SECONDS` metric is // specified in the `health` field for the job, notifications are not sent. - // Wire name: 'on_duration_warning_threshold_exceeded' OnDurationWarningThresholdExceeded []string `json:"on_duration_warning_threshold_exceeded,omitempty"` // A list of email addresses to be notified when a run unsuccessfully // completes. A run is considered to have completed unsuccessfully if it // ends with an `INTERNAL_ERROR` `life_cycle_state` or a `FAILED`, or // `TIMED_OUT` result_state. If this is not specified on job creation, // reset, or update the list is empty, and notifications are not sent. - // Wire name: 'on_failure' OnFailure []string `json:"on_failure,omitempty"` // A list of email addresses to be notified when a run begins. If not // specified on job creation, reset, or update, the list is empty, and // notifications are not sent. - // Wire name: 'on_start' OnStart []string `json:"on_start,omitempty"` // A list of email addresses to notify when any streaming backlog thresholds // are exceeded for any stream. Streaming backlog thresholds can be set in @@ -8904,85 +5455,46 @@ type TaskEmailNotifications struct { // `STREAMING_BACKLOG_SECONDS`, or `STREAMING_BACKLOG_FILES`. Alerting is // based on the 10-minute average of these metrics. If the issue persists, // notifications are resent every 30 minutes. - // Wire name: 'on_streaming_backlog_exceeded' OnStreamingBacklogExceeded []string `json:"on_streaming_backlog_exceeded,omitempty"` // A list of email addresses to be notified when a run successfully // completes. A run is considered to have completed successfully if it ends // with a `TERMINATED` `life_cycle_state` and a `SUCCESS` result_state. If // not specified on job creation, reset, or update, the list is empty, and // notifications are not sent. - // Wire name: 'on_success' OnSuccess []string `json:"on_success,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *TaskEmailNotifications) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &taskEmailNotificationsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := taskEmailNotificationsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *TaskEmailNotifications) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st TaskEmailNotifications) MarshalJSON() ([]byte, error) { - pb, err := taskEmailNotificationsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s TaskEmailNotifications) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type TaskNotificationSettings struct { // If true, do not send notifications to recipients specified in `on_start` // for the retried runs and do not send notifications to recipients // specified in `on_failure` until the last retry of the run. - // Wire name: 'alert_on_last_attempt' AlertOnLastAttempt bool `json:"alert_on_last_attempt,omitempty"` // If true, do not send notifications to recipients specified in // `on_failure` if the run is canceled. - // Wire name: 'no_alert_for_canceled_runs' NoAlertForCanceledRuns bool `json:"no_alert_for_canceled_runs,omitempty"` // If true, do not send notifications to recipients specified in // `on_failure` if the run is skipped. - // Wire name: 'no_alert_for_skipped_runs' NoAlertForSkippedRuns bool `json:"no_alert_for_skipped_runs,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *TaskNotificationSettings) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &taskNotificationSettingsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := taskNotificationSettingsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *TaskNotificationSettings) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st TaskNotificationSettings) MarshalJSON() ([]byte, error) { - pb, err := taskNotificationSettingsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s TaskNotificationSettings) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The code indicates why the run was terminated. Additional codes might be @@ -9233,11 +5745,9 @@ type TerminationDetails struct { // by the user. // // [Link]: https://kb.databricks.com/en_US/notebooks/too-many-execution-contexts-are-open-right-now - // Wire name: 'code' Code TerminationCodeCode `json:"code,omitempty"` // A descriptive message with the termination details. This field is // unstructured and the format might change. - // Wire name: 'message' Message string `json:"message,omitempty"` // * `SUCCESS`: The run terminated without any issues * `INTERNAL_ERROR`: An // error occurred in the Databricks platform. Please look at the [status @@ -9247,35 +5757,17 @@ type TerminationDetails struct { // issue with your cloud provider. // // [status page]: https://status.databricks.com/ - // Wire name: 'type' Type TerminationTypeType `json:"type,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *TerminationDetails) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &terminationDetailsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := terminationDetailsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *TerminationDetails) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st TerminationDetails) MarshalJSON() ([]byte, error) { - pb, err := terminationDetailsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s TerminationDetails) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // * `SUCCESS`: The run terminated without any issues * `INTERNAL_ERROR`: An @@ -9340,111 +5832,36 @@ func (f *TerminationTypeType) Type() string { // Additional details about what triggered the run type TriggerInfo struct { // The run id of the Run Job task run - // Wire name: 'run_id' RunId int64 `json:"run_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *TriggerInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &triggerInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := triggerInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *TriggerInfo) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st TriggerInfo) MarshalJSON() ([]byte, error) { - pb, err := triggerInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s TriggerInfo) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type TriggerSettings struct { // File arrival trigger settings. - // Wire name: 'file_arrival' FileArrival *FileArrivalTriggerConfiguration `json:"file_arrival,omitempty"` // Whether this trigger is paused or not. - // Wire name: 'pause_status' PauseStatus PauseStatus `json:"pause_status,omitempty"` // Periodic trigger settings. - // Wire name: 'periodic' Periodic *PeriodicTriggerConfiguration `json:"periodic,omitempty"` // Old table trigger settings name. Deprecated in favor of `table_update`. - // Wire name: 'table' Table *TableUpdateTriggerConfiguration `json:"table,omitempty"` - // Wire name: 'table_update' TableUpdate *TableUpdateTriggerConfiguration `json:"table_update,omitempty"` } -func (st *TriggerSettings) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &triggerSettingsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := triggerSettingsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st TriggerSettings) MarshalJSON() ([]byte, error) { - pb, err := triggerSettingsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type TriggerStateProto struct { - - // Wire name: 'file_arrival' FileArrival *FileArrivalTriggerState `json:"file_arrival,omitempty"` } -func (st *TriggerStateProto) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &triggerStateProtoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := triggerStateProtoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st TriggerStateProto) MarshalJSON() ([]byte, error) { - pb, err := triggerStateProtoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // The type of trigger that fired this run. // // * `PERIODIC`: Schedules that periodically trigger runs, such as a cron @@ -9528,10 +5945,8 @@ type UpdateJob struct { // Remove top-level fields in the job settings. Removing nested fields is // not supported, except for tasks and job clusters (`tasks/task_1`). This // field is optional. - // Wire name: 'fields_to_remove' FieldsToRemove []string `json:"fields_to_remove,omitempty"` // The canonical identifier of the job to update. This field is required. - // Wire name: 'job_id' JobId int64 `json:"job_id"` // The new settings for the job. // @@ -9544,102 +5959,31 @@ type UpdateJob struct { // // Changes to the field `JobSettings.timeout_seconds` are applied to active // runs. Changes to other fields are applied to future runs only. - // Wire name: 'new_settings' NewSettings *JobSettings `json:"new_settings,omitempty"` } -func (st *UpdateJob) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateJobPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateJobFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateJob) MarshalJSON() ([]byte, error) { - pb, err := updateJobToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type UpdateResponse struct { } -func (st *UpdateResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateResponse) MarshalJSON() ([]byte, error) { - pb, err := updateResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type ViewItem struct { // Content of the view. - // Wire name: 'content' Content string `json:"content,omitempty"` // Name of the view item. In the case of code view, it would be the // notebook’s name. In the case of dashboard view, it would be the // dashboard’s name. - // Wire name: 'name' Name string `json:"name,omitempty"` // Type of the view item. - // Wire name: 'type' Type ViewType `json:"type,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ViewItem) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &viewItemPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := viewItemFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ViewItem) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ViewItem) MarshalJSON() ([]byte, error) { - pb, err := viewItemToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ViewItem) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // * `NOTEBOOK`: Notebook view item. * `DASHBOARD`: Dashboard view item. @@ -9728,50 +6072,20 @@ func (f *ViewsToExport) Type() string { } type Webhook struct { - - // Wire name: 'id' Id string `json:"id"` } -func (st *Webhook) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &webhookPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := webhookFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st Webhook) MarshalJSON() ([]byte, error) { - pb, err := webhookToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type WebhookNotifications struct { // An optional list of system notification IDs to call when the duration of // a run exceeds the threshold specified for the `RUN_DURATION_SECONDS` // metric in the `health` field. A maximum of 3 destinations can be // specified for the `on_duration_warning_threshold_exceeded` property. - // Wire name: 'on_duration_warning_threshold_exceeded' OnDurationWarningThresholdExceeded []Webhook `json:"on_duration_warning_threshold_exceeded,omitempty"` // An optional list of system notification IDs to call when the run fails. A // maximum of 3 destinations can be specified for the `on_failure` property. - // Wire name: 'on_failure' OnFailure []Webhook `json:"on_failure,omitempty"` // An optional list of system notification IDs to call when the run starts. // A maximum of 3 destinations can be specified for the `on_start` property. - // Wire name: 'on_start' OnStart []Webhook `json:"on_start,omitempty"` // An optional list of system notification IDs to call when any streaming // backlog thresholds are exceeded for any stream. Streaming backlog @@ -9781,69 +6095,23 @@ type WebhookNotifications struct { // based on the 10-minute average of these metrics. If the issue persists, // notifications are resent every 30 minutes. A maximum of 3 destinations // can be specified for the `on_streaming_backlog_exceeded` property. - // Wire name: 'on_streaming_backlog_exceeded' OnStreamingBacklogExceeded []Webhook `json:"on_streaming_backlog_exceeded,omitempty"` // An optional list of system notification IDs to call when the run // completes successfully. A maximum of 3 destinations can be specified for // the `on_success` property. - // Wire name: 'on_success' OnSuccess []Webhook `json:"on_success,omitempty"` } -func (st *WebhookNotifications) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &webhookNotificationsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := webhookNotificationsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st WebhookNotifications) MarshalJSON() ([]byte, error) { - pb, err := webhookNotificationsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type WidgetErrorDetail struct { - - // Wire name: 'message' Message string `json:"message,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *WidgetErrorDetail) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &widgetErrorDetailPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := widgetErrorDetailFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *WidgetErrorDetail) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st WidgetErrorDetail) MarshalJSON() ([]byte, error) { - pb, err := widgetErrorDetailToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s WidgetErrorDetail) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } diff --git a/service/marketplace/impl.go b/service/marketplace/impl.go index ce843ca3f..805daa16c 100755 --- a/service/marketplace/impl.go +++ b/service/marketplace/impl.go @@ -49,35 +49,13 @@ func (a *consumerFulfillmentsImpl) GetAll(ctx context.Context, request GetListin } func (a *consumerFulfillmentsImpl) internalGet(ctx context.Context, request GetListingContentMetadataRequest) (*GetListingContentMetadataResponse, error) { - - requestPb, pbErr := getListingContentMetadataRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var getListingContentMetadataResponsePb getListingContentMetadataResponsePb - path := fmt.Sprintf("/api/2.1/marketplace-consumer/listings/%v/content", requestPb.ListingId) + var getListingContentMetadataResponse GetListingContentMetadataResponse + path := fmt.Sprintf("/api/2.1/marketplace-consumer/listings/%v/content", request.ListingId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &getListingContentMetadataResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := getListingContentMetadataResponseFromPb(&getListingContentMetadataResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getListingContentMetadataResponse) + return &getListingContentMetadataResponse, err } // Get all listings fulfillments associated with a listing. A _fulfillment_ is a @@ -120,35 +98,13 @@ func (a *consumerFulfillmentsImpl) ListAll(ctx context.Context, request ListFulf } func (a *consumerFulfillmentsImpl) internalList(ctx context.Context, request ListFulfillmentsRequest) (*ListFulfillmentsResponse, error) { - - requestPb, pbErr := listFulfillmentsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listFulfillmentsResponsePb listFulfillmentsResponsePb - path := fmt.Sprintf("/api/2.1/marketplace-consumer/listings/%v/fulfillments", requestPb.ListingId) + var listFulfillmentsResponse ListFulfillmentsResponse + path := fmt.Sprintf("/api/2.1/marketplace-consumer/listings/%v/fulfillments", request.ListingId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listFulfillmentsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listFulfillmentsResponseFromPb(&listFulfillmentsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listFulfillmentsResponse) + return &listFulfillmentsResponse, err } // unexported type that holds implementations of just ConsumerInstallations API methods @@ -157,63 +113,23 @@ type consumerInstallationsImpl struct { } func (a *consumerInstallationsImpl) Create(ctx context.Context, request CreateInstallationRequest) (*Installation, error) { - - requestPb, pbErr := createInstallationRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var installationPb installationPb - path := fmt.Sprintf("/api/2.1/marketplace-consumer/listings/%v/installations", requestPb.ListingId) + var installation Installation + path := fmt.Sprintf("/api/2.1/marketplace-consumer/listings/%v/installations", request.ListingId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &installationPb, - ) - if err != nil { - return nil, err - } - resp, err := installationFromPb(&installationPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &installation) + return &installation, err } func (a *consumerInstallationsImpl) Delete(ctx context.Context, request DeleteInstallationRequest) error { - - requestPb, pbErr := deleteInstallationRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteInstallationResponsePb deleteInstallationResponsePb - path := fmt.Sprintf("/api/2.1/marketplace-consumer/listings/%v/installations/%v", requestPb.ListingId, requestPb.InstallationId) + var deleteInstallationResponse DeleteInstallationResponse + path := fmt.Sprintf("/api/2.1/marketplace-consumer/listings/%v/installations/%v", request.ListingId, request.InstallationId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteInstallationResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteInstallationResponse) return err } @@ -249,35 +165,13 @@ func (a *consumerInstallationsImpl) ListAll(ctx context.Context, request ListAll } func (a *consumerInstallationsImpl) internalList(ctx context.Context, request ListAllInstallationsRequest) (*ListAllInstallationsResponse, error) { - - requestPb, pbErr := listAllInstallationsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listAllInstallationsResponsePb listAllInstallationsResponsePb + var listAllInstallationsResponse ListAllInstallationsResponse path := "/api/2.1/marketplace-consumer/installations" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listAllInstallationsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listAllInstallationsResponseFromPb(&listAllInstallationsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listAllInstallationsResponse) + return &listAllInstallationsResponse, err } // List all installations for a particular listing. @@ -312,68 +206,24 @@ func (a *consumerInstallationsImpl) ListListingInstallationsAll(ctx context.Cont } func (a *consumerInstallationsImpl) internalListListingInstallations(ctx context.Context, request ListInstallationsRequest) (*ListInstallationsResponse, error) { - - requestPb, pbErr := listInstallationsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listInstallationsResponsePb listInstallationsResponsePb - path := fmt.Sprintf("/api/2.1/marketplace-consumer/listings/%v/installations", requestPb.ListingId) + var listInstallationsResponse ListInstallationsResponse + path := fmt.Sprintf("/api/2.1/marketplace-consumer/listings/%v/installations", request.ListingId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listInstallationsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listInstallationsResponseFromPb(&listInstallationsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listInstallationsResponse) + return &listInstallationsResponse, err } func (a *consumerInstallationsImpl) Update(ctx context.Context, request UpdateInstallationRequest) (*UpdateInstallationResponse, error) { - - requestPb, pbErr := updateInstallationRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var updateInstallationResponsePb updateInstallationResponsePb - path := fmt.Sprintf("/api/2.1/marketplace-consumer/listings/%v/installations/%v", requestPb.ListingId, requestPb.InstallationId) + var updateInstallationResponse UpdateInstallationResponse + path := fmt.Sprintf("/api/2.1/marketplace-consumer/listings/%v/installations/%v", request.ListingId, request.InstallationId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPut, - path, - headers, - queryParams, - (*requestPb), - &updateInstallationResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := updateInstallationResponseFromPb(&updateInstallationResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &updateInstallationResponse) + return &updateInstallationResponse, err } // unexported type that holds implementations of just ConsumerListings API methods @@ -382,67 +232,23 @@ type consumerListingsImpl struct { } func (a *consumerListingsImpl) BatchGet(ctx context.Context, request BatchGetListingsRequest) (*BatchGetListingsResponse, error) { - - requestPb, pbErr := batchGetListingsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var batchGetListingsResponsePb batchGetListingsResponsePb + var batchGetListingsResponse BatchGetListingsResponse path := "/api/2.1/marketplace-consumer/listings:batchGet" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &batchGetListingsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := batchGetListingsResponseFromPb(&batchGetListingsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &batchGetListingsResponse) + return &batchGetListingsResponse, err } func (a *consumerListingsImpl) Get(ctx context.Context, request GetListingRequest) (*GetListingResponse, error) { - - requestPb, pbErr := getListingRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var getListingResponsePb getListingResponsePb - path := fmt.Sprintf("/api/2.1/marketplace-consumer/listings/%v", requestPb.Id) + var getListingResponse GetListingResponse + path := fmt.Sprintf("/api/2.1/marketplace-consumer/listings/%v", request.Id) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &getListingResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := getListingResponseFromPb(&getListingResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getListingResponse) + return &getListingResponse, err } // List all published listings in the Databricks Marketplace that the consumer @@ -479,35 +285,13 @@ func (a *consumerListingsImpl) ListAll(ctx context.Context, request ListListings } func (a *consumerListingsImpl) internalList(ctx context.Context, request ListListingsRequest) (*ListListingsResponse, error) { - - requestPb, pbErr := listListingsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listListingsResponsePb listListingsResponsePb + var listListingsResponse ListListingsResponse path := "/api/2.1/marketplace-consumer/listings" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listListingsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listListingsResponseFromPb(&listListingsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listListingsResponse) + return &listListingsResponse, err } // Search published listings in the Databricks Marketplace that the consumer has @@ -546,35 +330,13 @@ func (a *consumerListingsImpl) SearchAll(ctx context.Context, request SearchList } func (a *consumerListingsImpl) internalSearch(ctx context.Context, request SearchListingsRequest) (*SearchListingsResponse, error) { - - requestPb, pbErr := searchListingsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var searchListingsResponsePb searchListingsResponsePb + var searchListingsResponse SearchListingsResponse path := "/api/2.1/marketplace-consumer/search-listings" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &searchListingsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := searchListingsResponseFromPb(&searchListingsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &searchListingsResponse) + return &searchListingsResponse, err } // unexported type that holds implementations of just ConsumerPersonalizationRequests API methods @@ -583,68 +345,24 @@ type consumerPersonalizationRequestsImpl struct { } func (a *consumerPersonalizationRequestsImpl) Create(ctx context.Context, request CreatePersonalizationRequest) (*CreatePersonalizationRequestResponse, error) { - - requestPb, pbErr := createPersonalizationRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var createPersonalizationRequestResponsePb createPersonalizationRequestResponsePb - path := fmt.Sprintf("/api/2.1/marketplace-consumer/listings/%v/personalization-requests", requestPb.ListingId) + var createPersonalizationRequestResponse CreatePersonalizationRequestResponse + path := fmt.Sprintf("/api/2.1/marketplace-consumer/listings/%v/personalization-requests", request.ListingId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &createPersonalizationRequestResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := createPersonalizationRequestResponseFromPb(&createPersonalizationRequestResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &createPersonalizationRequestResponse) + return &createPersonalizationRequestResponse, err } func (a *consumerPersonalizationRequestsImpl) Get(ctx context.Context, request GetPersonalizationRequestRequest) (*GetPersonalizationRequestResponse, error) { - - requestPb, pbErr := getPersonalizationRequestRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var getPersonalizationRequestResponsePb getPersonalizationRequestResponsePb - path := fmt.Sprintf("/api/2.1/marketplace-consumer/listings/%v/personalization-requests", requestPb.ListingId) + var getPersonalizationRequestResponse GetPersonalizationRequestResponse + path := fmt.Sprintf("/api/2.1/marketplace-consumer/listings/%v/personalization-requests", request.ListingId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &getPersonalizationRequestResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := getPersonalizationRequestResponseFromPb(&getPersonalizationRequestResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getPersonalizationRequestResponse) + return &getPersonalizationRequestResponse, err } // List personalization requests for a consumer across all listings. @@ -679,35 +397,13 @@ func (a *consumerPersonalizationRequestsImpl) ListAll(ctx context.Context, reque } func (a *consumerPersonalizationRequestsImpl) internalList(ctx context.Context, request ListAllPersonalizationRequestsRequest) (*ListAllPersonalizationRequestsResponse, error) { - - requestPb, pbErr := listAllPersonalizationRequestsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listAllPersonalizationRequestsResponsePb listAllPersonalizationRequestsResponsePb + var listAllPersonalizationRequestsResponse ListAllPersonalizationRequestsResponse path := "/api/2.1/marketplace-consumer/personalization-requests" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listAllPersonalizationRequestsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listAllPersonalizationRequestsResponseFromPb(&listAllPersonalizationRequestsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listAllPersonalizationRequestsResponse) + return &listAllPersonalizationRequestsResponse, err } // unexported type that holds implementations of just ConsumerProviders API methods @@ -716,67 +412,23 @@ type consumerProvidersImpl struct { } func (a *consumerProvidersImpl) BatchGet(ctx context.Context, request BatchGetProvidersRequest) (*BatchGetProvidersResponse, error) { - - requestPb, pbErr := batchGetProvidersRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var batchGetProvidersResponsePb batchGetProvidersResponsePb + var batchGetProvidersResponse BatchGetProvidersResponse path := "/api/2.1/marketplace-consumer/providers:batchGet" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &batchGetProvidersResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := batchGetProvidersResponseFromPb(&batchGetProvidersResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &batchGetProvidersResponse) + return &batchGetProvidersResponse, err } func (a *consumerProvidersImpl) Get(ctx context.Context, request GetProviderRequest) (*GetProviderResponse, error) { - - requestPb, pbErr := getProviderRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var getProviderResponsePb getProviderResponsePb - path := fmt.Sprintf("/api/2.1/marketplace-consumer/providers/%v", requestPb.Id) + var getProviderResponse GetProviderResponse + path := fmt.Sprintf("/api/2.1/marketplace-consumer/providers/%v", request.Id) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &getProviderResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := getProviderResponseFromPb(&getProviderResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getProviderResponse) + return &getProviderResponse, err } // List all providers in the Databricks Marketplace with at least one visible @@ -813,35 +465,13 @@ func (a *consumerProvidersImpl) ListAll(ctx context.Context, request ListProvide } func (a *consumerProvidersImpl) internalList(ctx context.Context, request ListProvidersRequest) (*ListProvidersResponse, error) { - - requestPb, pbErr := listProvidersRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listProvidersResponsePb listProvidersResponsePb + var listProvidersResponse ListProvidersResponse path := "/api/2.1/marketplace-consumer/providers" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listProvidersResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listProvidersResponseFromPb(&listProvidersResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listProvidersResponse) + return &listProvidersResponse, err } // unexported type that holds implementations of just ProviderExchangeFilters API methods @@ -850,63 +480,23 @@ type providerExchangeFiltersImpl struct { } func (a *providerExchangeFiltersImpl) Create(ctx context.Context, request CreateExchangeFilterRequest) (*CreateExchangeFilterResponse, error) { - - requestPb, pbErr := createExchangeFilterRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var createExchangeFilterResponsePb createExchangeFilterResponsePb + var createExchangeFilterResponse CreateExchangeFilterResponse path := "/api/2.0/marketplace-exchange/filters" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &createExchangeFilterResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := createExchangeFilterResponseFromPb(&createExchangeFilterResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &createExchangeFilterResponse) + return &createExchangeFilterResponse, err } func (a *providerExchangeFiltersImpl) Delete(ctx context.Context, request DeleteExchangeFilterRequest) error { - - requestPb, pbErr := deleteExchangeFilterRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteExchangeFilterResponsePb deleteExchangeFilterResponsePb - path := fmt.Sprintf("/api/2.0/marketplace-exchange/filters/%v", requestPb.Id) + var deleteExchangeFilterResponse DeleteExchangeFilterResponse + path := fmt.Sprintf("/api/2.0/marketplace-exchange/filters/%v", request.Id) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteExchangeFilterResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteExchangeFilterResponse) return err } @@ -942,68 +532,24 @@ func (a *providerExchangeFiltersImpl) ListAll(ctx context.Context, request ListE } func (a *providerExchangeFiltersImpl) internalList(ctx context.Context, request ListExchangeFiltersRequest) (*ListExchangeFiltersResponse, error) { - - requestPb, pbErr := listExchangeFiltersRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listExchangeFiltersResponsePb listExchangeFiltersResponsePb + var listExchangeFiltersResponse ListExchangeFiltersResponse path := "/api/2.0/marketplace-exchange/filters" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listExchangeFiltersResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listExchangeFiltersResponseFromPb(&listExchangeFiltersResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listExchangeFiltersResponse) + return &listExchangeFiltersResponse, err } func (a *providerExchangeFiltersImpl) Update(ctx context.Context, request UpdateExchangeFilterRequest) (*UpdateExchangeFilterResponse, error) { - - requestPb, pbErr := updateExchangeFilterRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var updateExchangeFilterResponsePb updateExchangeFilterResponsePb - path := fmt.Sprintf("/api/2.0/marketplace-exchange/filters/%v", requestPb.Id) + var updateExchangeFilterResponse UpdateExchangeFilterResponse + path := fmt.Sprintf("/api/2.0/marketplace-exchange/filters/%v", request.Id) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPut, - path, - headers, - queryParams, - (*requestPb), - &updateExchangeFilterResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := updateExchangeFilterResponseFromPb(&updateExchangeFilterResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &updateExchangeFilterResponse) + return &updateExchangeFilterResponse, err } // unexported type that holds implementations of just ProviderExchanges API methods @@ -1012,157 +558,55 @@ type providerExchangesImpl struct { } func (a *providerExchangesImpl) AddListingToExchange(ctx context.Context, request AddExchangeForListingRequest) (*AddExchangeForListingResponse, error) { - - requestPb, pbErr := addExchangeForListingRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var addExchangeForListingResponsePb addExchangeForListingResponsePb + var addExchangeForListingResponse AddExchangeForListingResponse path := "/api/2.0/marketplace-exchange/exchanges-for-listing" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &addExchangeForListingResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := addExchangeForListingResponseFromPb(&addExchangeForListingResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &addExchangeForListingResponse) + return &addExchangeForListingResponse, err } func (a *providerExchangesImpl) Create(ctx context.Context, request CreateExchangeRequest) (*CreateExchangeResponse, error) { - - requestPb, pbErr := createExchangeRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var createExchangeResponsePb createExchangeResponsePb + var createExchangeResponse CreateExchangeResponse path := "/api/2.0/marketplace-exchange/exchanges" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &createExchangeResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := createExchangeResponseFromPb(&createExchangeResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &createExchangeResponse) + return &createExchangeResponse, err } func (a *providerExchangesImpl) Delete(ctx context.Context, request DeleteExchangeRequest) error { - - requestPb, pbErr := deleteExchangeRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteExchangeResponsePb deleteExchangeResponsePb - path := fmt.Sprintf("/api/2.0/marketplace-exchange/exchanges/%v", requestPb.Id) + var deleteExchangeResponse DeleteExchangeResponse + path := fmt.Sprintf("/api/2.0/marketplace-exchange/exchanges/%v", request.Id) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteExchangeResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteExchangeResponse) return err } func (a *providerExchangesImpl) DeleteListingFromExchange(ctx context.Context, request RemoveExchangeForListingRequest) error { - - requestPb, pbErr := removeExchangeForListingRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var removeExchangeForListingResponsePb removeExchangeForListingResponsePb - path := fmt.Sprintf("/api/2.0/marketplace-exchange/exchanges-for-listing/%v", requestPb.Id) + var removeExchangeForListingResponse RemoveExchangeForListingResponse + path := fmt.Sprintf("/api/2.0/marketplace-exchange/exchanges-for-listing/%v", request.Id) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &removeExchangeForListingResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &removeExchangeForListingResponse) return err } func (a *providerExchangesImpl) Get(ctx context.Context, request GetExchangeRequest) (*GetExchangeResponse, error) { - - requestPb, pbErr := getExchangeRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var getExchangeResponsePb getExchangeResponsePb - path := fmt.Sprintf("/api/2.0/marketplace-exchange/exchanges/%v", requestPb.Id) + var getExchangeResponse GetExchangeResponse + path := fmt.Sprintf("/api/2.0/marketplace-exchange/exchanges/%v", request.Id) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &getExchangeResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := getExchangeResponseFromPb(&getExchangeResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getExchangeResponse) + return &getExchangeResponse, err } // List exchanges visible to provider @@ -1197,35 +641,13 @@ func (a *providerExchangesImpl) ListAll(ctx context.Context, request ListExchang } func (a *providerExchangesImpl) internalList(ctx context.Context, request ListExchangesRequest) (*ListExchangesResponse, error) { - - requestPb, pbErr := listExchangesRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listExchangesResponsePb listExchangesResponsePb + var listExchangesResponse ListExchangesResponse path := "/api/2.0/marketplace-exchange/exchanges" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listExchangesResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listExchangesResponseFromPb(&listExchangesResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listExchangesResponse) + return &listExchangesResponse, err } // List exchanges associated with a listing @@ -1260,35 +682,13 @@ func (a *providerExchangesImpl) ListExchangesForListingAll(ctx context.Context, } func (a *providerExchangesImpl) internalListExchangesForListing(ctx context.Context, request ListExchangesForListingRequest) (*ListExchangesForListingResponse, error) { - - requestPb, pbErr := listExchangesForListingRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listExchangesForListingResponsePb listExchangesForListingResponsePb + var listExchangesForListingResponse ListExchangesForListingResponse path := "/api/2.0/marketplace-exchange/exchanges-for-listing" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listExchangesForListingResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listExchangesForListingResponseFromPb(&listExchangesForListingResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listExchangesForListingResponse) + return &listExchangesForListingResponse, err } // List listings associated with an exchange @@ -1323,68 +723,24 @@ func (a *providerExchangesImpl) ListListingsForExchangeAll(ctx context.Context, } func (a *providerExchangesImpl) internalListListingsForExchange(ctx context.Context, request ListListingsForExchangeRequest) (*ListListingsForExchangeResponse, error) { - - requestPb, pbErr := listListingsForExchangeRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listListingsForExchangeResponsePb listListingsForExchangeResponsePb + var listListingsForExchangeResponse ListListingsForExchangeResponse path := "/api/2.0/marketplace-exchange/listings-for-exchange" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listListingsForExchangeResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listListingsForExchangeResponseFromPb(&listListingsForExchangeResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listListingsForExchangeResponse) + return &listListingsForExchangeResponse, err } func (a *providerExchangesImpl) Update(ctx context.Context, request UpdateExchangeRequest) (*UpdateExchangeResponse, error) { - - requestPb, pbErr := updateExchangeRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var updateExchangeResponsePb updateExchangeResponsePb - path := fmt.Sprintf("/api/2.0/marketplace-exchange/exchanges/%v", requestPb.Id) + var updateExchangeResponse UpdateExchangeResponse + path := fmt.Sprintf("/api/2.0/marketplace-exchange/exchanges/%v", request.Id) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPut, - path, - headers, - queryParams, - (*requestPb), - &updateExchangeResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := updateExchangeResponseFromPb(&updateExchangeResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &updateExchangeResponse) + return &updateExchangeResponse, err } // unexported type that holds implementations of just ProviderFiles API methods @@ -1393,96 +749,34 @@ type providerFilesImpl struct { } func (a *providerFilesImpl) Create(ctx context.Context, request CreateFileRequest) (*CreateFileResponse, error) { - - requestPb, pbErr := createFileRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var createFileResponsePb createFileResponsePb + var createFileResponse CreateFileResponse path := "/api/2.0/marketplace-provider/files" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &createFileResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := createFileResponseFromPb(&createFileResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &createFileResponse) + return &createFileResponse, err } func (a *providerFilesImpl) Delete(ctx context.Context, request DeleteFileRequest) error { - - requestPb, pbErr := deleteFileRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteFileResponsePb deleteFileResponsePb - path := fmt.Sprintf("/api/2.0/marketplace-provider/files/%v", requestPb.FileId) + var deleteFileResponse DeleteFileResponse + path := fmt.Sprintf("/api/2.0/marketplace-provider/files/%v", request.FileId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteFileResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteFileResponse) return err } func (a *providerFilesImpl) Get(ctx context.Context, request GetFileRequest) (*GetFileResponse, error) { - - requestPb, pbErr := getFileRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var getFileResponsePb getFileResponsePb - path := fmt.Sprintf("/api/2.0/marketplace-provider/files/%v", requestPb.FileId) + var getFileResponse GetFileResponse + path := fmt.Sprintf("/api/2.0/marketplace-provider/files/%v", request.FileId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &getFileResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := getFileResponseFromPb(&getFileResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getFileResponse) + return &getFileResponse, err } // List files attached to a parent entity. @@ -1517,35 +811,13 @@ func (a *providerFilesImpl) ListAll(ctx context.Context, request ListFilesReques } func (a *providerFilesImpl) internalList(ctx context.Context, request ListFilesRequest) (*ListFilesResponse, error) { - - requestPb, pbErr := listFilesRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listFilesResponsePb listFilesResponsePb + var listFilesResponse ListFilesResponse path := "/api/2.0/marketplace-provider/files" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listFilesResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listFilesResponseFromPb(&listFilesResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listFilesResponse) + return &listFilesResponse, err } // unexported type that holds implementations of just ProviderListings API methods @@ -1554,96 +826,34 @@ type providerListingsImpl struct { } func (a *providerListingsImpl) Create(ctx context.Context, request CreateListingRequest) (*CreateListingResponse, error) { - - requestPb, pbErr := createListingRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var createListingResponsePb createListingResponsePb + var createListingResponse CreateListingResponse path := "/api/2.0/marketplace-provider/listing" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &createListingResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := createListingResponseFromPb(&createListingResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &createListingResponse) + return &createListingResponse, err } func (a *providerListingsImpl) Delete(ctx context.Context, request DeleteListingRequest) error { - - requestPb, pbErr := deleteListingRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteListingResponsePb deleteListingResponsePb - path := fmt.Sprintf("/api/2.0/marketplace-provider/listings/%v", requestPb.Id) + var deleteListingResponse DeleteListingResponse + path := fmt.Sprintf("/api/2.0/marketplace-provider/listings/%v", request.Id) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteListingResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteListingResponse) return err } func (a *providerListingsImpl) Get(ctx context.Context, request GetListingRequest) (*GetListingResponse, error) { - - requestPb, pbErr := getListingRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var getListingResponsePb getListingResponsePb - path := fmt.Sprintf("/api/2.0/marketplace-provider/listings/%v", requestPb.Id) + var getListingResponse GetListingResponse + path := fmt.Sprintf("/api/2.0/marketplace-provider/listings/%v", request.Id) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &getListingResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := getListingResponseFromPb(&getListingResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getListingResponse) + return &getListingResponse, err } // List listings owned by this provider @@ -1678,68 +888,24 @@ func (a *providerListingsImpl) ListAll(ctx context.Context, request GetListingsR } func (a *providerListingsImpl) internalList(ctx context.Context, request GetListingsRequest) (*GetListingsResponse, error) { - - requestPb, pbErr := getListingsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var getListingsResponsePb getListingsResponsePb + var getListingsResponse GetListingsResponse path := "/api/2.0/marketplace-provider/listings" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &getListingsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := getListingsResponseFromPb(&getListingsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getListingsResponse) + return &getListingsResponse, err } func (a *providerListingsImpl) Update(ctx context.Context, request UpdateListingRequest) (*UpdateListingResponse, error) { - - requestPb, pbErr := updateListingRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var updateListingResponsePb updateListingResponsePb - path := fmt.Sprintf("/api/2.0/marketplace-provider/listings/%v", requestPb.Id) + var updateListingResponse UpdateListingResponse + path := fmt.Sprintf("/api/2.0/marketplace-provider/listings/%v", request.Id) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPut, - path, - headers, - queryParams, - (*requestPb), - &updateListingResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := updateListingResponseFromPb(&updateListingResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &updateListingResponse) + return &updateListingResponse, err } // unexported type that holds implementations of just ProviderPersonalizationRequests API methods @@ -1781,68 +947,24 @@ func (a *providerPersonalizationRequestsImpl) ListAll(ctx context.Context, reque } func (a *providerPersonalizationRequestsImpl) internalList(ctx context.Context, request ListAllPersonalizationRequestsRequest) (*ListAllPersonalizationRequestsResponse, error) { - - requestPb, pbErr := listAllPersonalizationRequestsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listAllPersonalizationRequestsResponsePb listAllPersonalizationRequestsResponsePb + var listAllPersonalizationRequestsResponse ListAllPersonalizationRequestsResponse path := "/api/2.0/marketplace-provider/personalization-requests" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listAllPersonalizationRequestsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listAllPersonalizationRequestsResponseFromPb(&listAllPersonalizationRequestsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listAllPersonalizationRequestsResponse) + return &listAllPersonalizationRequestsResponse, err } func (a *providerPersonalizationRequestsImpl) Update(ctx context.Context, request UpdatePersonalizationRequestRequest) (*UpdatePersonalizationRequestResponse, error) { - - requestPb, pbErr := updatePersonalizationRequestRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var updatePersonalizationRequestResponsePb updatePersonalizationRequestResponsePb - path := fmt.Sprintf("/api/2.0/marketplace-provider/listings/%v/personalization-requests/%v/request-status", requestPb.ListingId, requestPb.RequestId) + var updatePersonalizationRequestResponse UpdatePersonalizationRequestResponse + path := fmt.Sprintf("/api/2.0/marketplace-provider/listings/%v/personalization-requests/%v/request-status", request.ListingId, request.RequestId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPut, - path, - headers, - queryParams, - (*requestPb), - &updatePersonalizationRequestResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := updatePersonalizationRequestResponseFromPb(&updatePersonalizationRequestResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &updatePersonalizationRequestResponse) + return &updatePersonalizationRequestResponse, err } // unexported type that holds implementations of just ProviderProviderAnalyticsDashboards API methods @@ -1851,117 +973,44 @@ type providerProviderAnalyticsDashboardsImpl struct { } func (a *providerProviderAnalyticsDashboardsImpl) Create(ctx context.Context) (*ProviderAnalyticsDashboard, error) { - - var providerAnalyticsDashboardPb providerAnalyticsDashboardPb + var providerAnalyticsDashboard ProviderAnalyticsDashboard path := "/api/2.0/marketplace-provider/analytics_dashboard" headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - nil, - nil, - &providerAnalyticsDashboardPb, - ) - if err != nil { - return nil, err - } - resp, err := providerAnalyticsDashboardFromPb(&providerAnalyticsDashboardPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, nil, nil, &providerAnalyticsDashboard) + return &providerAnalyticsDashboard, err } func (a *providerProviderAnalyticsDashboardsImpl) Get(ctx context.Context) (*ListProviderAnalyticsDashboardResponse, error) { - - var listProviderAnalyticsDashboardResponsePb listProviderAnalyticsDashboardResponsePb + var listProviderAnalyticsDashboardResponse ListProviderAnalyticsDashboardResponse path := "/api/2.0/marketplace-provider/analytics_dashboard" headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - nil, - nil, - &listProviderAnalyticsDashboardResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listProviderAnalyticsDashboardResponseFromPb(&listProviderAnalyticsDashboardResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, nil, nil, &listProviderAnalyticsDashboardResponse) + return &listProviderAnalyticsDashboardResponse, err } func (a *providerProviderAnalyticsDashboardsImpl) GetLatestVersion(ctx context.Context) (*GetLatestVersionProviderAnalyticsDashboardResponse, error) { - - var getLatestVersionProviderAnalyticsDashboardResponsePb getLatestVersionProviderAnalyticsDashboardResponsePb + var getLatestVersionProviderAnalyticsDashboardResponse GetLatestVersionProviderAnalyticsDashboardResponse path := "/api/2.0/marketplace-provider/analytics_dashboard/latest" headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - nil, - nil, - &getLatestVersionProviderAnalyticsDashboardResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := getLatestVersionProviderAnalyticsDashboardResponseFromPb(&getLatestVersionProviderAnalyticsDashboardResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, nil, nil, &getLatestVersionProviderAnalyticsDashboardResponse) + return &getLatestVersionProviderAnalyticsDashboardResponse, err } func (a *providerProviderAnalyticsDashboardsImpl) Update(ctx context.Context, request UpdateProviderAnalyticsDashboardRequest) (*UpdateProviderAnalyticsDashboardResponse, error) { - - requestPb, pbErr := updateProviderAnalyticsDashboardRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var updateProviderAnalyticsDashboardResponsePb updateProviderAnalyticsDashboardResponsePb - path := fmt.Sprintf("/api/2.0/marketplace-provider/analytics_dashboard/%v", requestPb.Id) + var updateProviderAnalyticsDashboardResponse UpdateProviderAnalyticsDashboardResponse + path := fmt.Sprintf("/api/2.0/marketplace-provider/analytics_dashboard/%v", request.Id) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPut, - path, - headers, - queryParams, - (*requestPb), - &updateProviderAnalyticsDashboardResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := updateProviderAnalyticsDashboardResponseFromPb(&updateProviderAnalyticsDashboardResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &updateProviderAnalyticsDashboardResponse) + return &updateProviderAnalyticsDashboardResponse, err } // unexported type that holds implementations of just ProviderProviders API methods @@ -1970,96 +1019,34 @@ type providerProvidersImpl struct { } func (a *providerProvidersImpl) Create(ctx context.Context, request CreateProviderRequest) (*CreateProviderResponse, error) { - - requestPb, pbErr := createProviderRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var createProviderResponsePb createProviderResponsePb + var createProviderResponse CreateProviderResponse path := "/api/2.0/marketplace-provider/provider" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &createProviderResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := createProviderResponseFromPb(&createProviderResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &createProviderResponse) + return &createProviderResponse, err } func (a *providerProvidersImpl) Delete(ctx context.Context, request DeleteProviderRequest) error { - - requestPb, pbErr := deleteProviderRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteProviderResponsePb deleteProviderResponsePb - path := fmt.Sprintf("/api/2.0/marketplace-provider/providers/%v", requestPb.Id) + var deleteProviderResponse DeleteProviderResponse + path := fmt.Sprintf("/api/2.0/marketplace-provider/providers/%v", request.Id) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteProviderResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteProviderResponse) return err } func (a *providerProvidersImpl) Get(ctx context.Context, request GetProviderRequest) (*GetProviderResponse, error) { - - requestPb, pbErr := getProviderRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var getProviderResponsePb getProviderResponsePb - path := fmt.Sprintf("/api/2.0/marketplace-provider/providers/%v", requestPb.Id) + var getProviderResponse GetProviderResponse + path := fmt.Sprintf("/api/2.0/marketplace-provider/providers/%v", request.Id) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &getProviderResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := getProviderResponseFromPb(&getProviderResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getProviderResponse) + return &getProviderResponse, err } // List provider profiles for account. @@ -2094,66 +1081,22 @@ func (a *providerProvidersImpl) ListAll(ctx context.Context, request ListProvide } func (a *providerProvidersImpl) internalList(ctx context.Context, request ListProvidersRequest) (*ListProvidersResponse, error) { - - requestPb, pbErr := listProvidersRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listProvidersResponsePb listProvidersResponsePb + var listProvidersResponse ListProvidersResponse path := "/api/2.0/marketplace-provider/providers" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listProvidersResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listProvidersResponseFromPb(&listProvidersResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listProvidersResponse) + return &listProvidersResponse, err } func (a *providerProvidersImpl) Update(ctx context.Context, request UpdateProviderRequest) (*UpdateProviderResponse, error) { - - requestPb, pbErr := updateProviderRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var updateProviderResponsePb updateProviderResponsePb - path := fmt.Sprintf("/api/2.0/marketplace-provider/providers/%v", requestPb.Id) + var updateProviderResponse UpdateProviderResponse + path := fmt.Sprintf("/api/2.0/marketplace-provider/providers/%v", request.Id) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPut, - path, - headers, - queryParams, - (*requestPb), - &updateProviderResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := updateProviderResponseFromPb(&updateProviderResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &updateProviderResponse) + return &updateProviderResponse, err } diff --git a/service/marketplace/internal.go b/service/marketplace/internal.go deleted file mode 100755 index e06540525..000000000 --- a/service/marketplace/internal.go +++ /dev/null @@ -1,4112 +0,0 @@ -// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. - -package marketplace - -import ( - "fmt" - "strings" - "time" - - "github.com/databricks/databricks-sdk-go/marshal" -) - -func addExchangeForListingRequestToPb(st *AddExchangeForListingRequest) (*addExchangeForListingRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &addExchangeForListingRequestPb{} - pb.ExchangeId = st.ExchangeId - pb.ListingId = st.ListingId - - return pb, nil -} - -type addExchangeForListingRequestPb struct { - ExchangeId string `json:"exchange_id"` - ListingId string `json:"listing_id"` -} - -func addExchangeForListingRequestFromPb(pb *addExchangeForListingRequestPb) (*AddExchangeForListingRequest, error) { - if pb == nil { - return nil, nil - } - st := &AddExchangeForListingRequest{} - st.ExchangeId = pb.ExchangeId - st.ListingId = pb.ListingId - - return st, nil -} - -func addExchangeForListingResponseToPb(st *AddExchangeForListingResponse) (*addExchangeForListingResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &addExchangeForListingResponsePb{} - pb.ExchangeForListing = st.ExchangeForListing - - return pb, nil -} - -type addExchangeForListingResponsePb struct { - ExchangeForListing *ExchangeListing `json:"exchange_for_listing,omitempty"` -} - -func addExchangeForListingResponseFromPb(pb *addExchangeForListingResponsePb) (*AddExchangeForListingResponse, error) { - if pb == nil { - return nil, nil - } - st := &AddExchangeForListingResponse{} - st.ExchangeForListing = pb.ExchangeForListing - - return st, nil -} - -func batchGetListingsRequestToPb(st *BatchGetListingsRequest) (*batchGetListingsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &batchGetListingsRequestPb{} - pb.Ids = st.Ids - - return pb, nil -} - -type batchGetListingsRequestPb struct { - Ids []string `json:"-" url:"ids,omitempty"` -} - -func batchGetListingsRequestFromPb(pb *batchGetListingsRequestPb) (*BatchGetListingsRequest, error) { - if pb == nil { - return nil, nil - } - st := &BatchGetListingsRequest{} - st.Ids = pb.Ids - - return st, nil -} - -func batchGetListingsResponseToPb(st *BatchGetListingsResponse) (*batchGetListingsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &batchGetListingsResponsePb{} - pb.Listings = st.Listings - - return pb, nil -} - -type batchGetListingsResponsePb struct { - Listings []Listing `json:"listings,omitempty"` -} - -func batchGetListingsResponseFromPb(pb *batchGetListingsResponsePb) (*BatchGetListingsResponse, error) { - if pb == nil { - return nil, nil - } - st := &BatchGetListingsResponse{} - st.Listings = pb.Listings - - return st, nil -} - -func batchGetProvidersRequestToPb(st *BatchGetProvidersRequest) (*batchGetProvidersRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &batchGetProvidersRequestPb{} - pb.Ids = st.Ids - - return pb, nil -} - -type batchGetProvidersRequestPb struct { - Ids []string `json:"-" url:"ids,omitempty"` -} - -func batchGetProvidersRequestFromPb(pb *batchGetProvidersRequestPb) (*BatchGetProvidersRequest, error) { - if pb == nil { - return nil, nil - } - st := &BatchGetProvidersRequest{} - st.Ids = pb.Ids - - return st, nil -} - -func batchGetProvidersResponseToPb(st *BatchGetProvidersResponse) (*batchGetProvidersResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &batchGetProvidersResponsePb{} - pb.Providers = st.Providers - - return pb, nil -} - -type batchGetProvidersResponsePb struct { - Providers []ProviderInfo `json:"providers,omitempty"` -} - -func batchGetProvidersResponseFromPb(pb *batchGetProvidersResponsePb) (*BatchGetProvidersResponse, error) { - if pb == nil { - return nil, nil - } - st := &BatchGetProvidersResponse{} - st.Providers = pb.Providers - - return st, nil -} - -func consumerTermsToPb(st *ConsumerTerms) (*consumerTermsPb, error) { - if st == nil { - return nil, nil - } - pb := &consumerTermsPb{} - pb.Version = st.Version - - return pb, nil -} - -type consumerTermsPb struct { - Version string `json:"version"` -} - -func consumerTermsFromPb(pb *consumerTermsPb) (*ConsumerTerms, error) { - if pb == nil { - return nil, nil - } - st := &ConsumerTerms{} - st.Version = pb.Version - - return st, nil -} - -func contactInfoToPb(st *ContactInfo) (*contactInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &contactInfoPb{} - pb.Company = st.Company - pb.Email = st.Email - pb.FirstName = st.FirstName - pb.LastName = st.LastName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type contactInfoPb struct { - Company string `json:"company,omitempty"` - Email string `json:"email,omitempty"` - FirstName string `json:"first_name,omitempty"` - LastName string `json:"last_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func contactInfoFromPb(pb *contactInfoPb) (*ContactInfo, error) { - if pb == nil { - return nil, nil - } - st := &ContactInfo{} - st.Company = pb.Company - st.Email = pb.Email - st.FirstName = pb.FirstName - st.LastName = pb.LastName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *contactInfoPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st contactInfoPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createExchangeFilterRequestToPb(st *CreateExchangeFilterRequest) (*createExchangeFilterRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &createExchangeFilterRequestPb{} - pb.Filter = st.Filter - - return pb, nil -} - -type createExchangeFilterRequestPb struct { - Filter ExchangeFilter `json:"filter"` -} - -func createExchangeFilterRequestFromPb(pb *createExchangeFilterRequestPb) (*CreateExchangeFilterRequest, error) { - if pb == nil { - return nil, nil - } - st := &CreateExchangeFilterRequest{} - st.Filter = pb.Filter - - return st, nil -} - -func createExchangeFilterResponseToPb(st *CreateExchangeFilterResponse) (*createExchangeFilterResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &createExchangeFilterResponsePb{} - pb.FilterId = st.FilterId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createExchangeFilterResponsePb struct { - FilterId string `json:"filter_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createExchangeFilterResponseFromPb(pb *createExchangeFilterResponsePb) (*CreateExchangeFilterResponse, error) { - if pb == nil { - return nil, nil - } - st := &CreateExchangeFilterResponse{} - st.FilterId = pb.FilterId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createExchangeFilterResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createExchangeFilterResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createExchangeRequestToPb(st *CreateExchangeRequest) (*createExchangeRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &createExchangeRequestPb{} - pb.Exchange = st.Exchange - - return pb, nil -} - -type createExchangeRequestPb struct { - Exchange Exchange `json:"exchange"` -} - -func createExchangeRequestFromPb(pb *createExchangeRequestPb) (*CreateExchangeRequest, error) { - if pb == nil { - return nil, nil - } - st := &CreateExchangeRequest{} - st.Exchange = pb.Exchange - - return st, nil -} - -func createExchangeResponseToPb(st *CreateExchangeResponse) (*createExchangeResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &createExchangeResponsePb{} - pb.ExchangeId = st.ExchangeId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createExchangeResponsePb struct { - ExchangeId string `json:"exchange_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createExchangeResponseFromPb(pb *createExchangeResponsePb) (*CreateExchangeResponse, error) { - if pb == nil { - return nil, nil - } - st := &CreateExchangeResponse{} - st.ExchangeId = pb.ExchangeId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createExchangeResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createExchangeResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createFileRequestToPb(st *CreateFileRequest) (*createFileRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &createFileRequestPb{} - pb.DisplayName = st.DisplayName - pb.FileParent = st.FileParent - pb.MarketplaceFileType = st.MarketplaceFileType - pb.MimeType = st.MimeType - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createFileRequestPb struct { - DisplayName string `json:"display_name,omitempty"` - FileParent FileParent `json:"file_parent"` - MarketplaceFileType MarketplaceFileType `json:"marketplace_file_type"` - MimeType string `json:"mime_type"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createFileRequestFromPb(pb *createFileRequestPb) (*CreateFileRequest, error) { - if pb == nil { - return nil, nil - } - st := &CreateFileRequest{} - st.DisplayName = pb.DisplayName - st.FileParent = pb.FileParent - st.MarketplaceFileType = pb.MarketplaceFileType - st.MimeType = pb.MimeType - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createFileRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createFileRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createFileResponseToPb(st *CreateFileResponse) (*createFileResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &createFileResponsePb{} - pb.FileInfo = st.FileInfo - pb.UploadUrl = st.UploadUrl - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createFileResponsePb struct { - FileInfo *FileInfo `json:"file_info,omitempty"` - UploadUrl string `json:"upload_url,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createFileResponseFromPb(pb *createFileResponsePb) (*CreateFileResponse, error) { - if pb == nil { - return nil, nil - } - st := &CreateFileResponse{} - st.FileInfo = pb.FileInfo - st.UploadUrl = pb.UploadUrl - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createFileResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createFileResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createInstallationRequestToPb(st *CreateInstallationRequest) (*createInstallationRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &createInstallationRequestPb{} - pb.AcceptedConsumerTerms = st.AcceptedConsumerTerms - pb.CatalogName = st.CatalogName - pb.ListingId = st.ListingId - pb.RecipientType = st.RecipientType - pb.RepoDetail = st.RepoDetail - pb.ShareName = st.ShareName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createInstallationRequestPb struct { - AcceptedConsumerTerms *ConsumerTerms `json:"accepted_consumer_terms,omitempty"` - CatalogName string `json:"catalog_name,omitempty"` - ListingId string `json:"-" url:"-"` - RecipientType DeltaSharingRecipientType `json:"recipient_type,omitempty"` - RepoDetail *RepoInstallation `json:"repo_detail,omitempty"` - ShareName string `json:"share_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createInstallationRequestFromPb(pb *createInstallationRequestPb) (*CreateInstallationRequest, error) { - if pb == nil { - return nil, nil - } - st := &CreateInstallationRequest{} - st.AcceptedConsumerTerms = pb.AcceptedConsumerTerms - st.CatalogName = pb.CatalogName - st.ListingId = pb.ListingId - st.RecipientType = pb.RecipientType - st.RepoDetail = pb.RepoDetail - st.ShareName = pb.ShareName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createInstallationRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createInstallationRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createListingRequestToPb(st *CreateListingRequest) (*createListingRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &createListingRequestPb{} - pb.Listing = st.Listing - - return pb, nil -} - -type createListingRequestPb struct { - Listing Listing `json:"listing"` -} - -func createListingRequestFromPb(pb *createListingRequestPb) (*CreateListingRequest, error) { - if pb == nil { - return nil, nil - } - st := &CreateListingRequest{} - st.Listing = pb.Listing - - return st, nil -} - -func createListingResponseToPb(st *CreateListingResponse) (*createListingResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &createListingResponsePb{} - pb.ListingId = st.ListingId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createListingResponsePb struct { - ListingId string `json:"listing_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createListingResponseFromPb(pb *createListingResponsePb) (*CreateListingResponse, error) { - if pb == nil { - return nil, nil - } - st := &CreateListingResponse{} - st.ListingId = pb.ListingId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createListingResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createListingResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createPersonalizationRequestToPb(st *CreatePersonalizationRequest) (*createPersonalizationRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &createPersonalizationRequestPb{} - pb.AcceptedConsumerTerms = st.AcceptedConsumerTerms - pb.Comment = st.Comment - pb.Company = st.Company - pb.FirstName = st.FirstName - pb.IntendedUse = st.IntendedUse - pb.IsFromLighthouse = st.IsFromLighthouse - pb.LastName = st.LastName - pb.ListingId = st.ListingId - pb.RecipientType = st.RecipientType - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createPersonalizationRequestPb struct { - AcceptedConsumerTerms ConsumerTerms `json:"accepted_consumer_terms"` - Comment string `json:"comment,omitempty"` - Company string `json:"company,omitempty"` - FirstName string `json:"first_name,omitempty"` - IntendedUse string `json:"intended_use"` - IsFromLighthouse bool `json:"is_from_lighthouse,omitempty"` - LastName string `json:"last_name,omitempty"` - ListingId string `json:"-" url:"-"` - RecipientType DeltaSharingRecipientType `json:"recipient_type,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createPersonalizationRequestFromPb(pb *createPersonalizationRequestPb) (*CreatePersonalizationRequest, error) { - if pb == nil { - return nil, nil - } - st := &CreatePersonalizationRequest{} - st.AcceptedConsumerTerms = pb.AcceptedConsumerTerms - st.Comment = pb.Comment - st.Company = pb.Company - st.FirstName = pb.FirstName - st.IntendedUse = pb.IntendedUse - st.IsFromLighthouse = pb.IsFromLighthouse - st.LastName = pb.LastName - st.ListingId = pb.ListingId - st.RecipientType = pb.RecipientType - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createPersonalizationRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createPersonalizationRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createPersonalizationRequestResponseToPb(st *CreatePersonalizationRequestResponse) (*createPersonalizationRequestResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &createPersonalizationRequestResponsePb{} - pb.Id = st.Id - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createPersonalizationRequestResponsePb struct { - Id string `json:"id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createPersonalizationRequestResponseFromPb(pb *createPersonalizationRequestResponsePb) (*CreatePersonalizationRequestResponse, error) { - if pb == nil { - return nil, nil - } - st := &CreatePersonalizationRequestResponse{} - st.Id = pb.Id - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createPersonalizationRequestResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createPersonalizationRequestResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createProviderRequestToPb(st *CreateProviderRequest) (*createProviderRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &createProviderRequestPb{} - pb.Provider = st.Provider - - return pb, nil -} - -type createProviderRequestPb struct { - Provider ProviderInfo `json:"provider"` -} - -func createProviderRequestFromPb(pb *createProviderRequestPb) (*CreateProviderRequest, error) { - if pb == nil { - return nil, nil - } - st := &CreateProviderRequest{} - st.Provider = pb.Provider - - return st, nil -} - -func createProviderResponseToPb(st *CreateProviderResponse) (*createProviderResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &createProviderResponsePb{} - pb.Id = st.Id - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createProviderResponsePb struct { - Id string `json:"id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createProviderResponseFromPb(pb *createProviderResponsePb) (*CreateProviderResponse, error) { - if pb == nil { - return nil, nil - } - st := &CreateProviderResponse{} - st.Id = pb.Id - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createProviderResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createProviderResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func dataRefreshInfoToPb(st *DataRefreshInfo) (*dataRefreshInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &dataRefreshInfoPb{} - pb.Interval = st.Interval - pb.Unit = st.Unit - - return pb, nil -} - -type dataRefreshInfoPb struct { - Interval int64 `json:"interval"` - Unit DataRefresh `json:"unit"` -} - -func dataRefreshInfoFromPb(pb *dataRefreshInfoPb) (*DataRefreshInfo, error) { - if pb == nil { - return nil, nil - } - st := &DataRefreshInfo{} - st.Interval = pb.Interval - st.Unit = pb.Unit - - return st, nil -} - -func deleteExchangeFilterRequestToPb(st *DeleteExchangeFilterRequest) (*deleteExchangeFilterRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteExchangeFilterRequestPb{} - pb.Id = st.Id - - return pb, nil -} - -type deleteExchangeFilterRequestPb struct { - Id string `json:"-" url:"-"` -} - -func deleteExchangeFilterRequestFromPb(pb *deleteExchangeFilterRequestPb) (*DeleteExchangeFilterRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteExchangeFilterRequest{} - st.Id = pb.Id - - return st, nil -} - -func deleteExchangeFilterResponseToPb(st *DeleteExchangeFilterResponse) (*deleteExchangeFilterResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteExchangeFilterResponsePb{} - - return pb, nil -} - -type deleteExchangeFilterResponsePb struct { -} - -func deleteExchangeFilterResponseFromPb(pb *deleteExchangeFilterResponsePb) (*DeleteExchangeFilterResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteExchangeFilterResponse{} - - return st, nil -} - -func deleteExchangeRequestToPb(st *DeleteExchangeRequest) (*deleteExchangeRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteExchangeRequestPb{} - pb.Id = st.Id - - return pb, nil -} - -type deleteExchangeRequestPb struct { - Id string `json:"-" url:"-"` -} - -func deleteExchangeRequestFromPb(pb *deleteExchangeRequestPb) (*DeleteExchangeRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteExchangeRequest{} - st.Id = pb.Id - - return st, nil -} - -func deleteExchangeResponseToPb(st *DeleteExchangeResponse) (*deleteExchangeResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteExchangeResponsePb{} - - return pb, nil -} - -type deleteExchangeResponsePb struct { -} - -func deleteExchangeResponseFromPb(pb *deleteExchangeResponsePb) (*DeleteExchangeResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteExchangeResponse{} - - return st, nil -} - -func deleteFileRequestToPb(st *DeleteFileRequest) (*deleteFileRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteFileRequestPb{} - pb.FileId = st.FileId - - return pb, nil -} - -type deleteFileRequestPb struct { - FileId string `json:"-" url:"-"` -} - -func deleteFileRequestFromPb(pb *deleteFileRequestPb) (*DeleteFileRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteFileRequest{} - st.FileId = pb.FileId - - return st, nil -} - -func deleteFileResponseToPb(st *DeleteFileResponse) (*deleteFileResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteFileResponsePb{} - - return pb, nil -} - -type deleteFileResponsePb struct { -} - -func deleteFileResponseFromPb(pb *deleteFileResponsePb) (*DeleteFileResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteFileResponse{} - - return st, nil -} - -func deleteInstallationRequestToPb(st *DeleteInstallationRequest) (*deleteInstallationRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteInstallationRequestPb{} - pb.InstallationId = st.InstallationId - pb.ListingId = st.ListingId - - return pb, nil -} - -type deleteInstallationRequestPb struct { - InstallationId string `json:"-" url:"-"` - ListingId string `json:"-" url:"-"` -} - -func deleteInstallationRequestFromPb(pb *deleteInstallationRequestPb) (*DeleteInstallationRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteInstallationRequest{} - st.InstallationId = pb.InstallationId - st.ListingId = pb.ListingId - - return st, nil -} - -func deleteInstallationResponseToPb(st *DeleteInstallationResponse) (*deleteInstallationResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteInstallationResponsePb{} - - return pb, nil -} - -type deleteInstallationResponsePb struct { -} - -func deleteInstallationResponseFromPb(pb *deleteInstallationResponsePb) (*DeleteInstallationResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteInstallationResponse{} - - return st, nil -} - -func deleteListingRequestToPb(st *DeleteListingRequest) (*deleteListingRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteListingRequestPb{} - pb.Id = st.Id - - return pb, nil -} - -type deleteListingRequestPb struct { - Id string `json:"-" url:"-"` -} - -func deleteListingRequestFromPb(pb *deleteListingRequestPb) (*DeleteListingRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteListingRequest{} - st.Id = pb.Id - - return st, nil -} - -func deleteListingResponseToPb(st *DeleteListingResponse) (*deleteListingResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteListingResponsePb{} - - return pb, nil -} - -type deleteListingResponsePb struct { -} - -func deleteListingResponseFromPb(pb *deleteListingResponsePb) (*DeleteListingResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteListingResponse{} - - return st, nil -} - -func deleteProviderRequestToPb(st *DeleteProviderRequest) (*deleteProviderRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteProviderRequestPb{} - pb.Id = st.Id - - return pb, nil -} - -type deleteProviderRequestPb struct { - Id string `json:"-" url:"-"` -} - -func deleteProviderRequestFromPb(pb *deleteProviderRequestPb) (*DeleteProviderRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteProviderRequest{} - st.Id = pb.Id - - return st, nil -} - -func deleteProviderResponseToPb(st *DeleteProviderResponse) (*deleteProviderResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteProviderResponsePb{} - - return pb, nil -} - -type deleteProviderResponsePb struct { -} - -func deleteProviderResponseFromPb(pb *deleteProviderResponsePb) (*DeleteProviderResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteProviderResponse{} - - return st, nil -} - -func exchangeToPb(st *Exchange) (*exchangePb, error) { - if st == nil { - return nil, nil - } - pb := &exchangePb{} - pb.Comment = st.Comment - pb.CreatedAt = st.CreatedAt - pb.CreatedBy = st.CreatedBy - pb.Filters = st.Filters - pb.Id = st.Id - pb.LinkedListings = st.LinkedListings - pb.Name = st.Name - pb.UpdatedAt = st.UpdatedAt - pb.UpdatedBy = st.UpdatedBy - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type exchangePb struct { - Comment string `json:"comment,omitempty"` - CreatedAt int64 `json:"created_at,omitempty"` - CreatedBy string `json:"created_by,omitempty"` - Filters []ExchangeFilter `json:"filters,omitempty"` - Id string `json:"id,omitempty"` - LinkedListings []ExchangeListing `json:"linked_listings,omitempty"` - Name string `json:"name"` - UpdatedAt int64 `json:"updated_at,omitempty"` - UpdatedBy string `json:"updated_by,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func exchangeFromPb(pb *exchangePb) (*Exchange, error) { - if pb == nil { - return nil, nil - } - st := &Exchange{} - st.Comment = pb.Comment - st.CreatedAt = pb.CreatedAt - st.CreatedBy = pb.CreatedBy - st.Filters = pb.Filters - st.Id = pb.Id - st.LinkedListings = pb.LinkedListings - st.Name = pb.Name - st.UpdatedAt = pb.UpdatedAt - st.UpdatedBy = pb.UpdatedBy - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *exchangePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st exchangePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func exchangeFilterToPb(st *ExchangeFilter) (*exchangeFilterPb, error) { - if st == nil { - return nil, nil - } - pb := &exchangeFilterPb{} - pb.CreatedAt = st.CreatedAt - pb.CreatedBy = st.CreatedBy - pb.ExchangeId = st.ExchangeId - pb.FilterType = st.FilterType - pb.FilterValue = st.FilterValue - pb.Id = st.Id - pb.Name = st.Name - pb.UpdatedAt = st.UpdatedAt - pb.UpdatedBy = st.UpdatedBy - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type exchangeFilterPb struct { - CreatedAt int64 `json:"created_at,omitempty"` - CreatedBy string `json:"created_by,omitempty"` - ExchangeId string `json:"exchange_id"` - FilterType ExchangeFilterType `json:"filter_type"` - FilterValue string `json:"filter_value"` - Id string `json:"id,omitempty"` - Name string `json:"name,omitempty"` - UpdatedAt int64 `json:"updated_at,omitempty"` - UpdatedBy string `json:"updated_by,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func exchangeFilterFromPb(pb *exchangeFilterPb) (*ExchangeFilter, error) { - if pb == nil { - return nil, nil - } - st := &ExchangeFilter{} - st.CreatedAt = pb.CreatedAt - st.CreatedBy = pb.CreatedBy - st.ExchangeId = pb.ExchangeId - st.FilterType = pb.FilterType - st.FilterValue = pb.FilterValue - st.Id = pb.Id - st.Name = pb.Name - st.UpdatedAt = pb.UpdatedAt - st.UpdatedBy = pb.UpdatedBy - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *exchangeFilterPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st exchangeFilterPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func exchangeListingToPb(st *ExchangeListing) (*exchangeListingPb, error) { - if st == nil { - return nil, nil - } - pb := &exchangeListingPb{} - pb.CreatedAt = st.CreatedAt - pb.CreatedBy = st.CreatedBy - pb.ExchangeId = st.ExchangeId - pb.ExchangeName = st.ExchangeName - pb.Id = st.Id - pb.ListingId = st.ListingId - pb.ListingName = st.ListingName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type exchangeListingPb struct { - CreatedAt int64 `json:"created_at,omitempty"` - CreatedBy string `json:"created_by,omitempty"` - ExchangeId string `json:"exchange_id,omitempty"` - ExchangeName string `json:"exchange_name,omitempty"` - Id string `json:"id,omitempty"` - ListingId string `json:"listing_id,omitempty"` - ListingName string `json:"listing_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func exchangeListingFromPb(pb *exchangeListingPb) (*ExchangeListing, error) { - if pb == nil { - return nil, nil - } - st := &ExchangeListing{} - st.CreatedAt = pb.CreatedAt - st.CreatedBy = pb.CreatedBy - st.ExchangeId = pb.ExchangeId - st.ExchangeName = pb.ExchangeName - st.Id = pb.Id - st.ListingId = pb.ListingId - st.ListingName = pb.ListingName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *exchangeListingPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st exchangeListingPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func fileInfoToPb(st *FileInfo) (*fileInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &fileInfoPb{} - pb.CreatedAt = st.CreatedAt - pb.DisplayName = st.DisplayName - pb.DownloadLink = st.DownloadLink - pb.FileParent = st.FileParent - pb.Id = st.Id - pb.MarketplaceFileType = st.MarketplaceFileType - pb.MimeType = st.MimeType - pb.Status = st.Status - pb.StatusMessage = st.StatusMessage - pb.UpdatedAt = st.UpdatedAt - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type fileInfoPb struct { - CreatedAt int64 `json:"created_at,omitempty"` - DisplayName string `json:"display_name,omitempty"` - DownloadLink string `json:"download_link,omitempty"` - FileParent *FileParent `json:"file_parent,omitempty"` - Id string `json:"id,omitempty"` - MarketplaceFileType MarketplaceFileType `json:"marketplace_file_type,omitempty"` - MimeType string `json:"mime_type,omitempty"` - Status FileStatus `json:"status,omitempty"` - StatusMessage string `json:"status_message,omitempty"` - UpdatedAt int64 `json:"updated_at,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func fileInfoFromPb(pb *fileInfoPb) (*FileInfo, error) { - if pb == nil { - return nil, nil - } - st := &FileInfo{} - st.CreatedAt = pb.CreatedAt - st.DisplayName = pb.DisplayName - st.DownloadLink = pb.DownloadLink - st.FileParent = pb.FileParent - st.Id = pb.Id - st.MarketplaceFileType = pb.MarketplaceFileType - st.MimeType = pb.MimeType - st.Status = pb.Status - st.StatusMessage = pb.StatusMessage - st.UpdatedAt = pb.UpdatedAt - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *fileInfoPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st fileInfoPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func fileParentToPb(st *FileParent) (*fileParentPb, error) { - if st == nil { - return nil, nil - } - pb := &fileParentPb{} - pb.FileParentType = st.FileParentType - pb.ParentId = st.ParentId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type fileParentPb struct { - FileParentType FileParentType `json:"file_parent_type,omitempty"` - ParentId string `json:"parent_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func fileParentFromPb(pb *fileParentPb) (*FileParent, error) { - if pb == nil { - return nil, nil - } - st := &FileParent{} - st.FileParentType = pb.FileParentType - st.ParentId = pb.ParentId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *fileParentPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st fileParentPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getExchangeRequestToPb(st *GetExchangeRequest) (*getExchangeRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getExchangeRequestPb{} - pb.Id = st.Id - - return pb, nil -} - -type getExchangeRequestPb struct { - Id string `json:"-" url:"-"` -} - -func getExchangeRequestFromPb(pb *getExchangeRequestPb) (*GetExchangeRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetExchangeRequest{} - st.Id = pb.Id - - return st, nil -} - -func getExchangeResponseToPb(st *GetExchangeResponse) (*getExchangeResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &getExchangeResponsePb{} - pb.Exchange = st.Exchange - - return pb, nil -} - -type getExchangeResponsePb struct { - Exchange *Exchange `json:"exchange,omitempty"` -} - -func getExchangeResponseFromPb(pb *getExchangeResponsePb) (*GetExchangeResponse, error) { - if pb == nil { - return nil, nil - } - st := &GetExchangeResponse{} - st.Exchange = pb.Exchange - - return st, nil -} - -func getFileRequestToPb(st *GetFileRequest) (*getFileRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getFileRequestPb{} - pb.FileId = st.FileId - - return pb, nil -} - -type getFileRequestPb struct { - FileId string `json:"-" url:"-"` -} - -func getFileRequestFromPb(pb *getFileRequestPb) (*GetFileRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetFileRequest{} - st.FileId = pb.FileId - - return st, nil -} - -func getFileResponseToPb(st *GetFileResponse) (*getFileResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &getFileResponsePb{} - pb.FileInfo = st.FileInfo - - return pb, nil -} - -type getFileResponsePb struct { - FileInfo *FileInfo `json:"file_info,omitempty"` -} - -func getFileResponseFromPb(pb *getFileResponsePb) (*GetFileResponse, error) { - if pb == nil { - return nil, nil - } - st := &GetFileResponse{} - st.FileInfo = pb.FileInfo - - return st, nil -} - -func getLatestVersionProviderAnalyticsDashboardResponseToPb(st *GetLatestVersionProviderAnalyticsDashboardResponse) (*getLatestVersionProviderAnalyticsDashboardResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &getLatestVersionProviderAnalyticsDashboardResponsePb{} - pb.Version = st.Version - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getLatestVersionProviderAnalyticsDashboardResponsePb struct { - Version int64 `json:"version,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getLatestVersionProviderAnalyticsDashboardResponseFromPb(pb *getLatestVersionProviderAnalyticsDashboardResponsePb) (*GetLatestVersionProviderAnalyticsDashboardResponse, error) { - if pb == nil { - return nil, nil - } - st := &GetLatestVersionProviderAnalyticsDashboardResponse{} - st.Version = pb.Version - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getLatestVersionProviderAnalyticsDashboardResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getLatestVersionProviderAnalyticsDashboardResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getListingContentMetadataRequestToPb(st *GetListingContentMetadataRequest) (*getListingContentMetadataRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getListingContentMetadataRequestPb{} - pb.ListingId = st.ListingId - pb.PageSize = st.PageSize - pb.PageToken = st.PageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getListingContentMetadataRequestPb struct { - ListingId string `json:"-" url:"-"` - PageSize int `json:"-" url:"page_size,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getListingContentMetadataRequestFromPb(pb *getListingContentMetadataRequestPb) (*GetListingContentMetadataRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetListingContentMetadataRequest{} - st.ListingId = pb.ListingId - st.PageSize = pb.PageSize - st.PageToken = pb.PageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getListingContentMetadataRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getListingContentMetadataRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getListingContentMetadataResponseToPb(st *GetListingContentMetadataResponse) (*getListingContentMetadataResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &getListingContentMetadataResponsePb{} - pb.NextPageToken = st.NextPageToken - pb.SharedDataObjects = st.SharedDataObjects - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getListingContentMetadataResponsePb struct { - NextPageToken string `json:"next_page_token,omitempty"` - SharedDataObjects []SharedDataObject `json:"shared_data_objects,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getListingContentMetadataResponseFromPb(pb *getListingContentMetadataResponsePb) (*GetListingContentMetadataResponse, error) { - if pb == nil { - return nil, nil - } - st := &GetListingContentMetadataResponse{} - st.NextPageToken = pb.NextPageToken - st.SharedDataObjects = pb.SharedDataObjects - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getListingContentMetadataResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getListingContentMetadataResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getListingRequestToPb(st *GetListingRequest) (*getListingRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getListingRequestPb{} - pb.Id = st.Id - - return pb, nil -} - -type getListingRequestPb struct { - Id string `json:"-" url:"-"` -} - -func getListingRequestFromPb(pb *getListingRequestPb) (*GetListingRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetListingRequest{} - st.Id = pb.Id - - return st, nil -} - -func getListingResponseToPb(st *GetListingResponse) (*getListingResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &getListingResponsePb{} - pb.Listing = st.Listing - - return pb, nil -} - -type getListingResponsePb struct { - Listing *Listing `json:"listing,omitempty"` -} - -func getListingResponseFromPb(pb *getListingResponsePb) (*GetListingResponse, error) { - if pb == nil { - return nil, nil - } - st := &GetListingResponse{} - st.Listing = pb.Listing - - return st, nil -} - -func getListingsRequestToPb(st *GetListingsRequest) (*getListingsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getListingsRequestPb{} - pb.PageSize = st.PageSize - pb.PageToken = st.PageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getListingsRequestPb struct { - PageSize int `json:"-" url:"page_size,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getListingsRequestFromPb(pb *getListingsRequestPb) (*GetListingsRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetListingsRequest{} - st.PageSize = pb.PageSize - st.PageToken = pb.PageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getListingsRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getListingsRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getListingsResponseToPb(st *GetListingsResponse) (*getListingsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &getListingsResponsePb{} - pb.Listings = st.Listings - pb.NextPageToken = st.NextPageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getListingsResponsePb struct { - Listings []Listing `json:"listings,omitempty"` - NextPageToken string `json:"next_page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getListingsResponseFromPb(pb *getListingsResponsePb) (*GetListingsResponse, error) { - if pb == nil { - return nil, nil - } - st := &GetListingsResponse{} - st.Listings = pb.Listings - st.NextPageToken = pb.NextPageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getListingsResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getListingsResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getPersonalizationRequestRequestToPb(st *GetPersonalizationRequestRequest) (*getPersonalizationRequestRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getPersonalizationRequestRequestPb{} - pb.ListingId = st.ListingId - - return pb, nil -} - -type getPersonalizationRequestRequestPb struct { - ListingId string `json:"-" url:"-"` -} - -func getPersonalizationRequestRequestFromPb(pb *getPersonalizationRequestRequestPb) (*GetPersonalizationRequestRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetPersonalizationRequestRequest{} - st.ListingId = pb.ListingId - - return st, nil -} - -func getPersonalizationRequestResponseToPb(st *GetPersonalizationRequestResponse) (*getPersonalizationRequestResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &getPersonalizationRequestResponsePb{} - pb.PersonalizationRequests = st.PersonalizationRequests - - return pb, nil -} - -type getPersonalizationRequestResponsePb struct { - PersonalizationRequests []PersonalizationRequest `json:"personalization_requests,omitempty"` -} - -func getPersonalizationRequestResponseFromPb(pb *getPersonalizationRequestResponsePb) (*GetPersonalizationRequestResponse, error) { - if pb == nil { - return nil, nil - } - st := &GetPersonalizationRequestResponse{} - st.PersonalizationRequests = pb.PersonalizationRequests - - return st, nil -} - -func getProviderRequestToPb(st *GetProviderRequest) (*getProviderRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getProviderRequestPb{} - pb.Id = st.Id - - return pb, nil -} - -type getProviderRequestPb struct { - Id string `json:"-" url:"-"` -} - -func getProviderRequestFromPb(pb *getProviderRequestPb) (*GetProviderRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetProviderRequest{} - st.Id = pb.Id - - return st, nil -} - -func getProviderResponseToPb(st *GetProviderResponse) (*getProviderResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &getProviderResponsePb{} - pb.Provider = st.Provider - - return pb, nil -} - -type getProviderResponsePb struct { - Provider *ProviderInfo `json:"provider,omitempty"` -} - -func getProviderResponseFromPb(pb *getProviderResponsePb) (*GetProviderResponse, error) { - if pb == nil { - return nil, nil - } - st := &GetProviderResponse{} - st.Provider = pb.Provider - - return st, nil -} - -func installationToPb(st *Installation) (*installationPb, error) { - if st == nil { - return nil, nil - } - pb := &installationPb{} - pb.Installation = st.Installation - - return pb, nil -} - -type installationPb struct { - Installation *InstallationDetail `json:"installation,omitempty"` -} - -func installationFromPb(pb *installationPb) (*Installation, error) { - if pb == nil { - return nil, nil - } - st := &Installation{} - st.Installation = pb.Installation - - return st, nil -} - -func installationDetailToPb(st *InstallationDetail) (*installationDetailPb, error) { - if st == nil { - return nil, nil - } - pb := &installationDetailPb{} - pb.CatalogName = st.CatalogName - pb.ErrorMessage = st.ErrorMessage - pb.Id = st.Id - pb.InstalledOn = st.InstalledOn - pb.ListingId = st.ListingId - pb.ListingName = st.ListingName - pb.RecipientType = st.RecipientType - pb.RepoName = st.RepoName - pb.RepoPath = st.RepoPath - pb.ShareName = st.ShareName - pb.Status = st.Status - pb.TokenDetail = st.TokenDetail - pb.Tokens = st.Tokens - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type installationDetailPb struct { - CatalogName string `json:"catalog_name,omitempty"` - ErrorMessage string `json:"error_message,omitempty"` - Id string `json:"id,omitempty"` - InstalledOn int64 `json:"installed_on,omitempty"` - ListingId string `json:"listing_id,omitempty"` - ListingName string `json:"listing_name,omitempty"` - RecipientType DeltaSharingRecipientType `json:"recipient_type,omitempty"` - RepoName string `json:"repo_name,omitempty"` - RepoPath string `json:"repo_path,omitempty"` - ShareName string `json:"share_name,omitempty"` - Status InstallationStatus `json:"status,omitempty"` - TokenDetail *TokenDetail `json:"token_detail,omitempty"` - Tokens []TokenInfo `json:"tokens,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func installationDetailFromPb(pb *installationDetailPb) (*InstallationDetail, error) { - if pb == nil { - return nil, nil - } - st := &InstallationDetail{} - st.CatalogName = pb.CatalogName - st.ErrorMessage = pb.ErrorMessage - st.Id = pb.Id - st.InstalledOn = pb.InstalledOn - st.ListingId = pb.ListingId - st.ListingName = pb.ListingName - st.RecipientType = pb.RecipientType - st.RepoName = pb.RepoName - st.RepoPath = pb.RepoPath - st.ShareName = pb.ShareName - st.Status = pb.Status - st.TokenDetail = pb.TokenDetail - st.Tokens = pb.Tokens - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *installationDetailPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st installationDetailPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listAllInstallationsRequestToPb(st *ListAllInstallationsRequest) (*listAllInstallationsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listAllInstallationsRequestPb{} - pb.PageSize = st.PageSize - pb.PageToken = st.PageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listAllInstallationsRequestPb struct { - PageSize int `json:"-" url:"page_size,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listAllInstallationsRequestFromPb(pb *listAllInstallationsRequestPb) (*ListAllInstallationsRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListAllInstallationsRequest{} - st.PageSize = pb.PageSize - st.PageToken = pb.PageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listAllInstallationsRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listAllInstallationsRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listAllInstallationsResponseToPb(st *ListAllInstallationsResponse) (*listAllInstallationsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listAllInstallationsResponsePb{} - pb.Installations = st.Installations - pb.NextPageToken = st.NextPageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listAllInstallationsResponsePb struct { - Installations []InstallationDetail `json:"installations,omitempty"` - NextPageToken string `json:"next_page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listAllInstallationsResponseFromPb(pb *listAllInstallationsResponsePb) (*ListAllInstallationsResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListAllInstallationsResponse{} - st.Installations = pb.Installations - st.NextPageToken = pb.NextPageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listAllInstallationsResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listAllInstallationsResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listAllPersonalizationRequestsRequestToPb(st *ListAllPersonalizationRequestsRequest) (*listAllPersonalizationRequestsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listAllPersonalizationRequestsRequestPb{} - pb.PageSize = st.PageSize - pb.PageToken = st.PageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listAllPersonalizationRequestsRequestPb struct { - PageSize int `json:"-" url:"page_size,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listAllPersonalizationRequestsRequestFromPb(pb *listAllPersonalizationRequestsRequestPb) (*ListAllPersonalizationRequestsRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListAllPersonalizationRequestsRequest{} - st.PageSize = pb.PageSize - st.PageToken = pb.PageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listAllPersonalizationRequestsRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listAllPersonalizationRequestsRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listAllPersonalizationRequestsResponseToPb(st *ListAllPersonalizationRequestsResponse) (*listAllPersonalizationRequestsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listAllPersonalizationRequestsResponsePb{} - pb.NextPageToken = st.NextPageToken - pb.PersonalizationRequests = st.PersonalizationRequests - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listAllPersonalizationRequestsResponsePb struct { - NextPageToken string `json:"next_page_token,omitempty"` - PersonalizationRequests []PersonalizationRequest `json:"personalization_requests,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listAllPersonalizationRequestsResponseFromPb(pb *listAllPersonalizationRequestsResponsePb) (*ListAllPersonalizationRequestsResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListAllPersonalizationRequestsResponse{} - st.NextPageToken = pb.NextPageToken - st.PersonalizationRequests = pb.PersonalizationRequests - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listAllPersonalizationRequestsResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listAllPersonalizationRequestsResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listExchangeFiltersRequestToPb(st *ListExchangeFiltersRequest) (*listExchangeFiltersRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listExchangeFiltersRequestPb{} - pb.ExchangeId = st.ExchangeId - pb.PageSize = st.PageSize - pb.PageToken = st.PageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listExchangeFiltersRequestPb struct { - ExchangeId string `json:"-" url:"exchange_id"` - PageSize int `json:"-" url:"page_size,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listExchangeFiltersRequestFromPb(pb *listExchangeFiltersRequestPb) (*ListExchangeFiltersRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListExchangeFiltersRequest{} - st.ExchangeId = pb.ExchangeId - st.PageSize = pb.PageSize - st.PageToken = pb.PageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listExchangeFiltersRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listExchangeFiltersRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listExchangeFiltersResponseToPb(st *ListExchangeFiltersResponse) (*listExchangeFiltersResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listExchangeFiltersResponsePb{} - pb.Filters = st.Filters - pb.NextPageToken = st.NextPageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listExchangeFiltersResponsePb struct { - Filters []ExchangeFilter `json:"filters,omitempty"` - NextPageToken string `json:"next_page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listExchangeFiltersResponseFromPb(pb *listExchangeFiltersResponsePb) (*ListExchangeFiltersResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListExchangeFiltersResponse{} - st.Filters = pb.Filters - st.NextPageToken = pb.NextPageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listExchangeFiltersResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listExchangeFiltersResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listExchangesForListingRequestToPb(st *ListExchangesForListingRequest) (*listExchangesForListingRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listExchangesForListingRequestPb{} - pb.ListingId = st.ListingId - pb.PageSize = st.PageSize - pb.PageToken = st.PageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listExchangesForListingRequestPb struct { - ListingId string `json:"-" url:"listing_id"` - PageSize int `json:"-" url:"page_size,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listExchangesForListingRequestFromPb(pb *listExchangesForListingRequestPb) (*ListExchangesForListingRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListExchangesForListingRequest{} - st.ListingId = pb.ListingId - st.PageSize = pb.PageSize - st.PageToken = pb.PageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listExchangesForListingRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listExchangesForListingRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listExchangesForListingResponseToPb(st *ListExchangesForListingResponse) (*listExchangesForListingResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listExchangesForListingResponsePb{} - pb.ExchangeListing = st.ExchangeListing - pb.NextPageToken = st.NextPageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listExchangesForListingResponsePb struct { - ExchangeListing []ExchangeListing `json:"exchange_listing,omitempty"` - NextPageToken string `json:"next_page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listExchangesForListingResponseFromPb(pb *listExchangesForListingResponsePb) (*ListExchangesForListingResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListExchangesForListingResponse{} - st.ExchangeListing = pb.ExchangeListing - st.NextPageToken = pb.NextPageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listExchangesForListingResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listExchangesForListingResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listExchangesRequestToPb(st *ListExchangesRequest) (*listExchangesRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listExchangesRequestPb{} - pb.PageSize = st.PageSize - pb.PageToken = st.PageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listExchangesRequestPb struct { - PageSize int `json:"-" url:"page_size,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listExchangesRequestFromPb(pb *listExchangesRequestPb) (*ListExchangesRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListExchangesRequest{} - st.PageSize = pb.PageSize - st.PageToken = pb.PageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listExchangesRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listExchangesRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listExchangesResponseToPb(st *ListExchangesResponse) (*listExchangesResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listExchangesResponsePb{} - pb.Exchanges = st.Exchanges - pb.NextPageToken = st.NextPageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listExchangesResponsePb struct { - Exchanges []Exchange `json:"exchanges,omitempty"` - NextPageToken string `json:"next_page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listExchangesResponseFromPb(pb *listExchangesResponsePb) (*ListExchangesResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListExchangesResponse{} - st.Exchanges = pb.Exchanges - st.NextPageToken = pb.NextPageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listExchangesResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listExchangesResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listFilesRequestToPb(st *ListFilesRequest) (*listFilesRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listFilesRequestPb{} - pb.FileParent = st.FileParent - pb.PageSize = st.PageSize - pb.PageToken = st.PageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listFilesRequestPb struct { - FileParent FileParent `json:"-" url:"file_parent"` - PageSize int `json:"-" url:"page_size,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listFilesRequestFromPb(pb *listFilesRequestPb) (*ListFilesRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListFilesRequest{} - st.FileParent = pb.FileParent - st.PageSize = pb.PageSize - st.PageToken = pb.PageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listFilesRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listFilesRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listFilesResponseToPb(st *ListFilesResponse) (*listFilesResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listFilesResponsePb{} - pb.FileInfos = st.FileInfos - pb.NextPageToken = st.NextPageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listFilesResponsePb struct { - FileInfos []FileInfo `json:"file_infos,omitempty"` - NextPageToken string `json:"next_page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listFilesResponseFromPb(pb *listFilesResponsePb) (*ListFilesResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListFilesResponse{} - st.FileInfos = pb.FileInfos - st.NextPageToken = pb.NextPageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listFilesResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listFilesResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listFulfillmentsRequestToPb(st *ListFulfillmentsRequest) (*listFulfillmentsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listFulfillmentsRequestPb{} - pb.ListingId = st.ListingId - pb.PageSize = st.PageSize - pb.PageToken = st.PageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listFulfillmentsRequestPb struct { - ListingId string `json:"-" url:"-"` - PageSize int `json:"-" url:"page_size,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listFulfillmentsRequestFromPb(pb *listFulfillmentsRequestPb) (*ListFulfillmentsRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListFulfillmentsRequest{} - st.ListingId = pb.ListingId - st.PageSize = pb.PageSize - st.PageToken = pb.PageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listFulfillmentsRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listFulfillmentsRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listFulfillmentsResponseToPb(st *ListFulfillmentsResponse) (*listFulfillmentsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listFulfillmentsResponsePb{} - pb.Fulfillments = st.Fulfillments - pb.NextPageToken = st.NextPageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listFulfillmentsResponsePb struct { - Fulfillments []ListingFulfillment `json:"fulfillments,omitempty"` - NextPageToken string `json:"next_page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listFulfillmentsResponseFromPb(pb *listFulfillmentsResponsePb) (*ListFulfillmentsResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListFulfillmentsResponse{} - st.Fulfillments = pb.Fulfillments - st.NextPageToken = pb.NextPageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listFulfillmentsResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listFulfillmentsResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listInstallationsRequestToPb(st *ListInstallationsRequest) (*listInstallationsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listInstallationsRequestPb{} - pb.ListingId = st.ListingId - pb.PageSize = st.PageSize - pb.PageToken = st.PageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listInstallationsRequestPb struct { - ListingId string `json:"-" url:"-"` - PageSize int `json:"-" url:"page_size,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listInstallationsRequestFromPb(pb *listInstallationsRequestPb) (*ListInstallationsRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListInstallationsRequest{} - st.ListingId = pb.ListingId - st.PageSize = pb.PageSize - st.PageToken = pb.PageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listInstallationsRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listInstallationsRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listInstallationsResponseToPb(st *ListInstallationsResponse) (*listInstallationsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listInstallationsResponsePb{} - pb.Installations = st.Installations - pb.NextPageToken = st.NextPageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listInstallationsResponsePb struct { - Installations []InstallationDetail `json:"installations,omitempty"` - NextPageToken string `json:"next_page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listInstallationsResponseFromPb(pb *listInstallationsResponsePb) (*ListInstallationsResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListInstallationsResponse{} - st.Installations = pb.Installations - st.NextPageToken = pb.NextPageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listInstallationsResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listInstallationsResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listListingsForExchangeRequestToPb(st *ListListingsForExchangeRequest) (*listListingsForExchangeRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listListingsForExchangeRequestPb{} - pb.ExchangeId = st.ExchangeId - pb.PageSize = st.PageSize - pb.PageToken = st.PageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listListingsForExchangeRequestPb struct { - ExchangeId string `json:"-" url:"exchange_id"` - PageSize int `json:"-" url:"page_size,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listListingsForExchangeRequestFromPb(pb *listListingsForExchangeRequestPb) (*ListListingsForExchangeRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListListingsForExchangeRequest{} - st.ExchangeId = pb.ExchangeId - st.PageSize = pb.PageSize - st.PageToken = pb.PageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listListingsForExchangeRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listListingsForExchangeRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listListingsForExchangeResponseToPb(st *ListListingsForExchangeResponse) (*listListingsForExchangeResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listListingsForExchangeResponsePb{} - pb.ExchangeListings = st.ExchangeListings - pb.NextPageToken = st.NextPageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listListingsForExchangeResponsePb struct { - ExchangeListings []ExchangeListing `json:"exchange_listings,omitempty"` - NextPageToken string `json:"next_page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listListingsForExchangeResponseFromPb(pb *listListingsForExchangeResponsePb) (*ListListingsForExchangeResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListListingsForExchangeResponse{} - st.ExchangeListings = pb.ExchangeListings - st.NextPageToken = pb.NextPageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listListingsForExchangeResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listListingsForExchangeResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listListingsRequestToPb(st *ListListingsRequest) (*listListingsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listListingsRequestPb{} - pb.Assets = st.Assets - pb.Categories = st.Categories - pb.IsFree = st.IsFree - pb.IsPrivateExchange = st.IsPrivateExchange - pb.IsStaffPick = st.IsStaffPick - pb.PageSize = st.PageSize - pb.PageToken = st.PageToken - pb.ProviderIds = st.ProviderIds - pb.Tags = st.Tags - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listListingsRequestPb struct { - Assets []AssetType `json:"-" url:"assets,omitempty"` - Categories []Category `json:"-" url:"categories,omitempty"` - IsFree bool `json:"-" url:"is_free,omitempty"` - IsPrivateExchange bool `json:"-" url:"is_private_exchange,omitempty"` - IsStaffPick bool `json:"-" url:"is_staff_pick,omitempty"` - PageSize int `json:"-" url:"page_size,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - ProviderIds []string `json:"-" url:"provider_ids,omitempty"` - Tags []ListingTag `json:"-" url:"tags,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listListingsRequestFromPb(pb *listListingsRequestPb) (*ListListingsRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListListingsRequest{} - st.Assets = pb.Assets - st.Categories = pb.Categories - st.IsFree = pb.IsFree - st.IsPrivateExchange = pb.IsPrivateExchange - st.IsStaffPick = pb.IsStaffPick - st.PageSize = pb.PageSize - st.PageToken = pb.PageToken - st.ProviderIds = pb.ProviderIds - st.Tags = pb.Tags - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listListingsRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listListingsRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listListingsResponseToPb(st *ListListingsResponse) (*listListingsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listListingsResponsePb{} - pb.Listings = st.Listings - pb.NextPageToken = st.NextPageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listListingsResponsePb struct { - Listings []Listing `json:"listings,omitempty"` - NextPageToken string `json:"next_page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listListingsResponseFromPb(pb *listListingsResponsePb) (*ListListingsResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListListingsResponse{} - st.Listings = pb.Listings - st.NextPageToken = pb.NextPageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listListingsResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listListingsResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listProviderAnalyticsDashboardResponseToPb(st *ListProviderAnalyticsDashboardResponse) (*listProviderAnalyticsDashboardResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listProviderAnalyticsDashboardResponsePb{} - pb.DashboardId = st.DashboardId - pb.Id = st.Id - pb.Version = st.Version - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listProviderAnalyticsDashboardResponsePb struct { - DashboardId string `json:"dashboard_id"` - Id string `json:"id"` - Version int64 `json:"version,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listProviderAnalyticsDashboardResponseFromPb(pb *listProviderAnalyticsDashboardResponsePb) (*ListProviderAnalyticsDashboardResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListProviderAnalyticsDashboardResponse{} - st.DashboardId = pb.DashboardId - st.Id = pb.Id - st.Version = pb.Version - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listProviderAnalyticsDashboardResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listProviderAnalyticsDashboardResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listProvidersRequestToPb(st *ListProvidersRequest) (*listProvidersRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listProvidersRequestPb{} - pb.IsFeatured = st.IsFeatured - pb.PageSize = st.PageSize - pb.PageToken = st.PageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listProvidersRequestPb struct { - IsFeatured bool `json:"-" url:"is_featured,omitempty"` - PageSize int `json:"-" url:"page_size,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listProvidersRequestFromPb(pb *listProvidersRequestPb) (*ListProvidersRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListProvidersRequest{} - st.IsFeatured = pb.IsFeatured - st.PageSize = pb.PageSize - st.PageToken = pb.PageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listProvidersRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listProvidersRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listProvidersResponseToPb(st *ListProvidersResponse) (*listProvidersResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listProvidersResponsePb{} - pb.NextPageToken = st.NextPageToken - pb.Providers = st.Providers - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listProvidersResponsePb struct { - NextPageToken string `json:"next_page_token,omitempty"` - Providers []ProviderInfo `json:"providers,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listProvidersResponseFromPb(pb *listProvidersResponsePb) (*ListProvidersResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListProvidersResponse{} - st.NextPageToken = pb.NextPageToken - st.Providers = pb.Providers - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listProvidersResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listProvidersResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listingToPb(st *Listing) (*listingPb, error) { - if st == nil { - return nil, nil - } - pb := &listingPb{} - pb.Detail = st.Detail - pb.Id = st.Id - pb.Summary = st.Summary - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listingPb struct { - Detail *ListingDetail `json:"detail,omitempty"` - Id string `json:"id,omitempty"` - Summary ListingSummary `json:"summary"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listingFromPb(pb *listingPb) (*Listing, error) { - if pb == nil { - return nil, nil - } - st := &Listing{} - st.Detail = pb.Detail - st.Id = pb.Id - st.Summary = pb.Summary - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listingPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listingPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listingDetailToPb(st *ListingDetail) (*listingDetailPb, error) { - if st == nil { - return nil, nil - } - pb := &listingDetailPb{} - pb.Assets = st.Assets - pb.CollectionDateEnd = st.CollectionDateEnd - pb.CollectionDateStart = st.CollectionDateStart - pb.CollectionGranularity = st.CollectionGranularity - pb.Cost = st.Cost - pb.DataSource = st.DataSource - pb.Description = st.Description - pb.DocumentationLink = st.DocumentationLink - pb.EmbeddedNotebookFileInfos = st.EmbeddedNotebookFileInfos - pb.FileIds = st.FileIds - pb.GeographicalCoverage = st.GeographicalCoverage - pb.License = st.License - pb.PricingModel = st.PricingModel - pb.PrivacyPolicyLink = st.PrivacyPolicyLink - pb.Size = st.Size - pb.SupportLink = st.SupportLink - pb.Tags = st.Tags - pb.TermsOfService = st.TermsOfService - pb.UpdateFrequency = st.UpdateFrequency - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listingDetailPb struct { - Assets []AssetType `json:"assets,omitempty"` - CollectionDateEnd int64 `json:"collection_date_end,omitempty"` - CollectionDateStart int64 `json:"collection_date_start,omitempty"` - CollectionGranularity *DataRefreshInfo `json:"collection_granularity,omitempty"` - Cost Cost `json:"cost,omitempty"` - DataSource string `json:"data_source,omitempty"` - Description string `json:"description,omitempty"` - DocumentationLink string `json:"documentation_link,omitempty"` - EmbeddedNotebookFileInfos []FileInfo `json:"embedded_notebook_file_infos,omitempty"` - FileIds []string `json:"file_ids,omitempty"` - GeographicalCoverage string `json:"geographical_coverage,omitempty"` - License string `json:"license,omitempty"` - PricingModel string `json:"pricing_model,omitempty"` - PrivacyPolicyLink string `json:"privacy_policy_link,omitempty"` - Size float64 `json:"size,omitempty"` - SupportLink string `json:"support_link,omitempty"` - Tags []ListingTag `json:"tags,omitempty"` - TermsOfService string `json:"terms_of_service,omitempty"` - UpdateFrequency *DataRefreshInfo `json:"update_frequency,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listingDetailFromPb(pb *listingDetailPb) (*ListingDetail, error) { - if pb == nil { - return nil, nil - } - st := &ListingDetail{} - st.Assets = pb.Assets - st.CollectionDateEnd = pb.CollectionDateEnd - st.CollectionDateStart = pb.CollectionDateStart - st.CollectionGranularity = pb.CollectionGranularity - st.Cost = pb.Cost - st.DataSource = pb.DataSource - st.Description = pb.Description - st.DocumentationLink = pb.DocumentationLink - st.EmbeddedNotebookFileInfos = pb.EmbeddedNotebookFileInfos - st.FileIds = pb.FileIds - st.GeographicalCoverage = pb.GeographicalCoverage - st.License = pb.License - st.PricingModel = pb.PricingModel - st.PrivacyPolicyLink = pb.PrivacyPolicyLink - st.Size = pb.Size - st.SupportLink = pb.SupportLink - st.Tags = pb.Tags - st.TermsOfService = pb.TermsOfService - st.UpdateFrequency = pb.UpdateFrequency - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listingDetailPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listingDetailPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listingFulfillmentToPb(st *ListingFulfillment) (*listingFulfillmentPb, error) { - if st == nil { - return nil, nil - } - pb := &listingFulfillmentPb{} - pb.FulfillmentType = st.FulfillmentType - pb.ListingId = st.ListingId - pb.RecipientType = st.RecipientType - pb.RepoInfo = st.RepoInfo - pb.ShareInfo = st.ShareInfo - - return pb, nil -} - -type listingFulfillmentPb struct { - FulfillmentType FulfillmentType `json:"fulfillment_type,omitempty"` - ListingId string `json:"listing_id"` - RecipientType DeltaSharingRecipientType `json:"recipient_type,omitempty"` - RepoInfo *RepoInfo `json:"repo_info,omitempty"` - ShareInfo *ShareInfo `json:"share_info,omitempty"` -} - -func listingFulfillmentFromPb(pb *listingFulfillmentPb) (*ListingFulfillment, error) { - if pb == nil { - return nil, nil - } - st := &ListingFulfillment{} - st.FulfillmentType = pb.FulfillmentType - st.ListingId = pb.ListingId - st.RecipientType = pb.RecipientType - st.RepoInfo = pb.RepoInfo - st.ShareInfo = pb.ShareInfo - - return st, nil -} - -func listingSettingToPb(st *ListingSetting) (*listingSettingPb, error) { - if st == nil { - return nil, nil - } - pb := &listingSettingPb{} - pb.Visibility = st.Visibility - - return pb, nil -} - -type listingSettingPb struct { - Visibility Visibility `json:"visibility,omitempty"` -} - -func listingSettingFromPb(pb *listingSettingPb) (*ListingSetting, error) { - if pb == nil { - return nil, nil - } - st := &ListingSetting{} - st.Visibility = pb.Visibility - - return st, nil -} - -func listingSummaryToPb(st *ListingSummary) (*listingSummaryPb, error) { - if st == nil { - return nil, nil - } - pb := &listingSummaryPb{} - pb.Categories = st.Categories - pb.CreatedAt = st.CreatedAt - pb.CreatedBy = st.CreatedBy - pb.CreatedById = st.CreatedById - pb.ExchangeIds = st.ExchangeIds - pb.GitRepo = st.GitRepo - pb.ListingType = st.ListingType - pb.Name = st.Name - pb.ProviderId = st.ProviderId - pb.ProviderRegion = st.ProviderRegion - pb.PublishedAt = st.PublishedAt - pb.PublishedBy = st.PublishedBy - pb.Setting = st.Setting - pb.Share = st.Share - pb.Status = st.Status - pb.Subtitle = st.Subtitle - pb.UpdatedAt = st.UpdatedAt - pb.UpdatedBy = st.UpdatedBy - pb.UpdatedById = st.UpdatedById - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listingSummaryPb struct { - Categories []Category `json:"categories,omitempty"` - CreatedAt int64 `json:"created_at,omitempty"` - CreatedBy string `json:"created_by,omitempty"` - CreatedById int64 `json:"created_by_id,omitempty"` - ExchangeIds []string `json:"exchange_ids,omitempty"` - GitRepo *RepoInfo `json:"git_repo,omitempty"` - ListingType ListingType `json:"listingType"` - Name string `json:"name"` - ProviderId string `json:"provider_id,omitempty"` - ProviderRegion *RegionInfo `json:"provider_region,omitempty"` - PublishedAt int64 `json:"published_at,omitempty"` - PublishedBy string `json:"published_by,omitempty"` - Setting *ListingSetting `json:"setting,omitempty"` - Share *ShareInfo `json:"share,omitempty"` - Status ListingStatus `json:"status,omitempty"` - Subtitle string `json:"subtitle,omitempty"` - UpdatedAt int64 `json:"updated_at,omitempty"` - UpdatedBy string `json:"updated_by,omitempty"` - UpdatedById int64 `json:"updated_by_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listingSummaryFromPb(pb *listingSummaryPb) (*ListingSummary, error) { - if pb == nil { - return nil, nil - } - st := &ListingSummary{} - st.Categories = pb.Categories - st.CreatedAt = pb.CreatedAt - st.CreatedBy = pb.CreatedBy - st.CreatedById = pb.CreatedById - st.ExchangeIds = pb.ExchangeIds - st.GitRepo = pb.GitRepo - st.ListingType = pb.ListingType - st.Name = pb.Name - st.ProviderId = pb.ProviderId - st.ProviderRegion = pb.ProviderRegion - st.PublishedAt = pb.PublishedAt - st.PublishedBy = pb.PublishedBy - st.Setting = pb.Setting - st.Share = pb.Share - st.Status = pb.Status - st.Subtitle = pb.Subtitle - st.UpdatedAt = pb.UpdatedAt - st.UpdatedBy = pb.UpdatedBy - st.UpdatedById = pb.UpdatedById - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listingSummaryPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listingSummaryPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listingTagToPb(st *ListingTag) (*listingTagPb, error) { - if st == nil { - return nil, nil - } - pb := &listingTagPb{} - pb.TagName = st.TagName - pb.TagValues = st.TagValues - - return pb, nil -} - -type listingTagPb struct { - TagName ListingTagType `json:"tag_name,omitempty"` - TagValues []string `json:"tag_values,omitempty"` -} - -func listingTagFromPb(pb *listingTagPb) (*ListingTag, error) { - if pb == nil { - return nil, nil - } - st := &ListingTag{} - st.TagName = pb.TagName - st.TagValues = pb.TagValues - - return st, nil -} - -func personalizationRequestToPb(st *PersonalizationRequest) (*personalizationRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &personalizationRequestPb{} - pb.Comment = st.Comment - pb.ConsumerRegion = st.ConsumerRegion - pb.ContactInfo = st.ContactInfo - pb.CreatedAt = st.CreatedAt - pb.Id = st.Id - pb.IntendedUse = st.IntendedUse - pb.IsFromLighthouse = st.IsFromLighthouse - pb.ListingId = st.ListingId - pb.ListingName = st.ListingName - pb.MetastoreId = st.MetastoreId - pb.ProviderId = st.ProviderId - pb.RecipientType = st.RecipientType - pb.Share = st.Share - pb.Status = st.Status - pb.StatusMessage = st.StatusMessage - pb.UpdatedAt = st.UpdatedAt - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type personalizationRequestPb struct { - Comment string `json:"comment,omitempty"` - ConsumerRegion RegionInfo `json:"consumer_region"` - ContactInfo *ContactInfo `json:"contact_info,omitempty"` - CreatedAt int64 `json:"created_at,omitempty"` - Id string `json:"id,omitempty"` - IntendedUse string `json:"intended_use,omitempty"` - IsFromLighthouse bool `json:"is_from_lighthouse,omitempty"` - ListingId string `json:"listing_id,omitempty"` - ListingName string `json:"listing_name,omitempty"` - MetastoreId string `json:"metastore_id,omitempty"` - ProviderId string `json:"provider_id,omitempty"` - RecipientType DeltaSharingRecipientType `json:"recipient_type,omitempty"` - Share *ShareInfo `json:"share,omitempty"` - Status PersonalizationRequestStatus `json:"status,omitempty"` - StatusMessage string `json:"status_message,omitempty"` - UpdatedAt int64 `json:"updated_at,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func personalizationRequestFromPb(pb *personalizationRequestPb) (*PersonalizationRequest, error) { - if pb == nil { - return nil, nil - } - st := &PersonalizationRequest{} - st.Comment = pb.Comment - st.ConsumerRegion = pb.ConsumerRegion - st.ContactInfo = pb.ContactInfo - st.CreatedAt = pb.CreatedAt - st.Id = pb.Id - st.IntendedUse = pb.IntendedUse - st.IsFromLighthouse = pb.IsFromLighthouse - st.ListingId = pb.ListingId - st.ListingName = pb.ListingName - st.MetastoreId = pb.MetastoreId - st.ProviderId = pb.ProviderId - st.RecipientType = pb.RecipientType - st.Share = pb.Share - st.Status = pb.Status - st.StatusMessage = pb.StatusMessage - st.UpdatedAt = pb.UpdatedAt - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *personalizationRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st personalizationRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func providerAnalyticsDashboardToPb(st *ProviderAnalyticsDashboard) (*providerAnalyticsDashboardPb, error) { - if st == nil { - return nil, nil - } - pb := &providerAnalyticsDashboardPb{} - pb.Id = st.Id - - return pb, nil -} - -type providerAnalyticsDashboardPb struct { - Id string `json:"id"` -} - -func providerAnalyticsDashboardFromPb(pb *providerAnalyticsDashboardPb) (*ProviderAnalyticsDashboard, error) { - if pb == nil { - return nil, nil - } - st := &ProviderAnalyticsDashboard{} - st.Id = pb.Id - - return st, nil -} - -func providerInfoToPb(st *ProviderInfo) (*providerInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &providerInfoPb{} - pb.BusinessContactEmail = st.BusinessContactEmail - pb.CompanyWebsiteLink = st.CompanyWebsiteLink - pb.DarkModeIconFileId = st.DarkModeIconFileId - pb.DarkModeIconFilePath = st.DarkModeIconFilePath - pb.Description = st.Description - pb.IconFileId = st.IconFileId - pb.IconFilePath = st.IconFilePath - pb.Id = st.Id - pb.IsFeatured = st.IsFeatured - pb.Name = st.Name - pb.PrivacyPolicyLink = st.PrivacyPolicyLink - pb.PublishedBy = st.PublishedBy - pb.SupportContactEmail = st.SupportContactEmail - pb.TermOfServiceLink = st.TermOfServiceLink - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type providerInfoPb struct { - BusinessContactEmail string `json:"business_contact_email"` - CompanyWebsiteLink string `json:"company_website_link,omitempty"` - DarkModeIconFileId string `json:"dark_mode_icon_file_id,omitempty"` - DarkModeIconFilePath string `json:"dark_mode_icon_file_path,omitempty"` - Description string `json:"description,omitempty"` - IconFileId string `json:"icon_file_id,omitempty"` - IconFilePath string `json:"icon_file_path,omitempty"` - Id string `json:"id,omitempty"` - IsFeatured bool `json:"is_featured,omitempty"` - Name string `json:"name"` - PrivacyPolicyLink string `json:"privacy_policy_link"` - PublishedBy string `json:"published_by,omitempty"` - SupportContactEmail string `json:"support_contact_email,omitempty"` - TermOfServiceLink string `json:"term_of_service_link"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func providerInfoFromPb(pb *providerInfoPb) (*ProviderInfo, error) { - if pb == nil { - return nil, nil - } - st := &ProviderInfo{} - st.BusinessContactEmail = pb.BusinessContactEmail - st.CompanyWebsiteLink = pb.CompanyWebsiteLink - st.DarkModeIconFileId = pb.DarkModeIconFileId - st.DarkModeIconFilePath = pb.DarkModeIconFilePath - st.Description = pb.Description - st.IconFileId = pb.IconFileId - st.IconFilePath = pb.IconFilePath - st.Id = pb.Id - st.IsFeatured = pb.IsFeatured - st.Name = pb.Name - st.PrivacyPolicyLink = pb.PrivacyPolicyLink - st.PublishedBy = pb.PublishedBy - st.SupportContactEmail = pb.SupportContactEmail - st.TermOfServiceLink = pb.TermOfServiceLink - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *providerInfoPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st providerInfoPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func regionInfoToPb(st *RegionInfo) (*regionInfoPb, error) { - if st == nil { - return nil, nil - } - pb := ®ionInfoPb{} - pb.Cloud = st.Cloud - pb.Region = st.Region - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type regionInfoPb struct { - Cloud string `json:"cloud,omitempty"` - Region string `json:"region,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func regionInfoFromPb(pb *regionInfoPb) (*RegionInfo, error) { - if pb == nil { - return nil, nil - } - st := &RegionInfo{} - st.Cloud = pb.Cloud - st.Region = pb.Region - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *regionInfoPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st regionInfoPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func removeExchangeForListingRequestToPb(st *RemoveExchangeForListingRequest) (*removeExchangeForListingRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &removeExchangeForListingRequestPb{} - pb.Id = st.Id - - return pb, nil -} - -type removeExchangeForListingRequestPb struct { - Id string `json:"-" url:"-"` -} - -func removeExchangeForListingRequestFromPb(pb *removeExchangeForListingRequestPb) (*RemoveExchangeForListingRequest, error) { - if pb == nil { - return nil, nil - } - st := &RemoveExchangeForListingRequest{} - st.Id = pb.Id - - return st, nil -} - -func removeExchangeForListingResponseToPb(st *RemoveExchangeForListingResponse) (*removeExchangeForListingResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &removeExchangeForListingResponsePb{} - - return pb, nil -} - -type removeExchangeForListingResponsePb struct { -} - -func removeExchangeForListingResponseFromPb(pb *removeExchangeForListingResponsePb) (*RemoveExchangeForListingResponse, error) { - if pb == nil { - return nil, nil - } - st := &RemoveExchangeForListingResponse{} - - return st, nil -} - -func repoInfoToPb(st *RepoInfo) (*repoInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &repoInfoPb{} - pb.GitRepoUrl = st.GitRepoUrl - - return pb, nil -} - -type repoInfoPb struct { - GitRepoUrl string `json:"git_repo_url"` -} - -func repoInfoFromPb(pb *repoInfoPb) (*RepoInfo, error) { - if pb == nil { - return nil, nil - } - st := &RepoInfo{} - st.GitRepoUrl = pb.GitRepoUrl - - return st, nil -} - -func repoInstallationToPb(st *RepoInstallation) (*repoInstallationPb, error) { - if st == nil { - return nil, nil - } - pb := &repoInstallationPb{} - pb.RepoName = st.RepoName - pb.RepoPath = st.RepoPath - - return pb, nil -} - -type repoInstallationPb struct { - RepoName string `json:"repo_name"` - RepoPath string `json:"repo_path"` -} - -func repoInstallationFromPb(pb *repoInstallationPb) (*RepoInstallation, error) { - if pb == nil { - return nil, nil - } - st := &RepoInstallation{} - st.RepoName = pb.RepoName - st.RepoPath = pb.RepoPath - - return st, nil -} - -func searchListingsRequestToPb(st *SearchListingsRequest) (*searchListingsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &searchListingsRequestPb{} - pb.Assets = st.Assets - pb.Categories = st.Categories - pb.IsFree = st.IsFree - pb.IsPrivateExchange = st.IsPrivateExchange - pb.PageSize = st.PageSize - pb.PageToken = st.PageToken - pb.ProviderIds = st.ProviderIds - pb.Query = st.Query - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type searchListingsRequestPb struct { - Assets []AssetType `json:"-" url:"assets,omitempty"` - Categories []Category `json:"-" url:"categories,omitempty"` - IsFree bool `json:"-" url:"is_free,omitempty"` - IsPrivateExchange bool `json:"-" url:"is_private_exchange,omitempty"` - PageSize int `json:"-" url:"page_size,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - ProviderIds []string `json:"-" url:"provider_ids,omitempty"` - Query string `json:"-" url:"query"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func searchListingsRequestFromPb(pb *searchListingsRequestPb) (*SearchListingsRequest, error) { - if pb == nil { - return nil, nil - } - st := &SearchListingsRequest{} - st.Assets = pb.Assets - st.Categories = pb.Categories - st.IsFree = pb.IsFree - st.IsPrivateExchange = pb.IsPrivateExchange - st.PageSize = pb.PageSize - st.PageToken = pb.PageToken - st.ProviderIds = pb.ProviderIds - st.Query = pb.Query - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *searchListingsRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st searchListingsRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func searchListingsResponseToPb(st *SearchListingsResponse) (*searchListingsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &searchListingsResponsePb{} - pb.Listings = st.Listings - pb.NextPageToken = st.NextPageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type searchListingsResponsePb struct { - Listings []Listing `json:"listings,omitempty"` - NextPageToken string `json:"next_page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func searchListingsResponseFromPb(pb *searchListingsResponsePb) (*SearchListingsResponse, error) { - if pb == nil { - return nil, nil - } - st := &SearchListingsResponse{} - st.Listings = pb.Listings - st.NextPageToken = pb.NextPageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *searchListingsResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st searchListingsResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func shareInfoToPb(st *ShareInfo) (*shareInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &shareInfoPb{} - pb.Name = st.Name - pb.Type = st.Type - - return pb, nil -} - -type shareInfoPb struct { - Name string `json:"name"` - Type ListingShareType `json:"type"` -} - -func shareInfoFromPb(pb *shareInfoPb) (*ShareInfo, error) { - if pb == nil { - return nil, nil - } - st := &ShareInfo{} - st.Name = pb.Name - st.Type = pb.Type - - return st, nil -} - -func sharedDataObjectToPb(st *SharedDataObject) (*sharedDataObjectPb, error) { - if st == nil { - return nil, nil - } - pb := &sharedDataObjectPb{} - pb.DataObjectType = st.DataObjectType - pb.Name = st.Name - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type sharedDataObjectPb struct { - DataObjectType string `json:"data_object_type,omitempty"` - Name string `json:"name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func sharedDataObjectFromPb(pb *sharedDataObjectPb) (*SharedDataObject, error) { - if pb == nil { - return nil, nil - } - st := &SharedDataObject{} - st.DataObjectType = pb.DataObjectType - st.Name = pb.Name - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *sharedDataObjectPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st sharedDataObjectPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func tokenDetailToPb(st *TokenDetail) (*tokenDetailPb, error) { - if st == nil { - return nil, nil - } - pb := &tokenDetailPb{} - pb.BearerToken = st.BearerToken - pb.Endpoint = st.Endpoint - pb.ExpirationTime = st.ExpirationTime - pb.ShareCredentialsVersion = st.ShareCredentialsVersion - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type tokenDetailPb struct { - BearerToken string `json:"bearerToken,omitempty"` - Endpoint string `json:"endpoint,omitempty"` - ExpirationTime string `json:"expirationTime,omitempty"` - ShareCredentialsVersion int `json:"shareCredentialsVersion,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func tokenDetailFromPb(pb *tokenDetailPb) (*TokenDetail, error) { - if pb == nil { - return nil, nil - } - st := &TokenDetail{} - st.BearerToken = pb.BearerToken - st.Endpoint = pb.Endpoint - st.ExpirationTime = pb.ExpirationTime - st.ShareCredentialsVersion = pb.ShareCredentialsVersion - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *tokenDetailPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st tokenDetailPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func tokenInfoToPb(st *TokenInfo) (*tokenInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &tokenInfoPb{} - pb.ActivationUrl = st.ActivationUrl - pb.CreatedAt = st.CreatedAt - pb.CreatedBy = st.CreatedBy - pb.ExpirationTime = st.ExpirationTime - pb.Id = st.Id - pb.UpdatedAt = st.UpdatedAt - pb.UpdatedBy = st.UpdatedBy - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type tokenInfoPb struct { - ActivationUrl string `json:"activation_url,omitempty"` - CreatedAt int64 `json:"created_at,omitempty"` - CreatedBy string `json:"created_by,omitempty"` - ExpirationTime int64 `json:"expiration_time,omitempty"` - Id string `json:"id,omitempty"` - UpdatedAt int64 `json:"updated_at,omitempty"` - UpdatedBy string `json:"updated_by,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func tokenInfoFromPb(pb *tokenInfoPb) (*TokenInfo, error) { - if pb == nil { - return nil, nil - } - st := &TokenInfo{} - st.ActivationUrl = pb.ActivationUrl - st.CreatedAt = pb.CreatedAt - st.CreatedBy = pb.CreatedBy - st.ExpirationTime = pb.ExpirationTime - st.Id = pb.Id - st.UpdatedAt = pb.UpdatedAt - st.UpdatedBy = pb.UpdatedBy - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *tokenInfoPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st tokenInfoPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func updateExchangeFilterRequestToPb(st *UpdateExchangeFilterRequest) (*updateExchangeFilterRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &updateExchangeFilterRequestPb{} - pb.Filter = st.Filter - pb.Id = st.Id - - return pb, nil -} - -type updateExchangeFilterRequestPb struct { - Filter ExchangeFilter `json:"filter"` - Id string `json:"-" url:"-"` -} - -func updateExchangeFilterRequestFromPb(pb *updateExchangeFilterRequestPb) (*UpdateExchangeFilterRequest, error) { - if pb == nil { - return nil, nil - } - st := &UpdateExchangeFilterRequest{} - st.Filter = pb.Filter - st.Id = pb.Id - - return st, nil -} - -func updateExchangeFilterResponseToPb(st *UpdateExchangeFilterResponse) (*updateExchangeFilterResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &updateExchangeFilterResponsePb{} - pb.Filter = st.Filter - - return pb, nil -} - -type updateExchangeFilterResponsePb struct { - Filter *ExchangeFilter `json:"filter,omitempty"` -} - -func updateExchangeFilterResponseFromPb(pb *updateExchangeFilterResponsePb) (*UpdateExchangeFilterResponse, error) { - if pb == nil { - return nil, nil - } - st := &UpdateExchangeFilterResponse{} - st.Filter = pb.Filter - - return st, nil -} - -func updateExchangeRequestToPb(st *UpdateExchangeRequest) (*updateExchangeRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &updateExchangeRequestPb{} - pb.Exchange = st.Exchange - pb.Id = st.Id - - return pb, nil -} - -type updateExchangeRequestPb struct { - Exchange Exchange `json:"exchange"` - Id string `json:"-" url:"-"` -} - -func updateExchangeRequestFromPb(pb *updateExchangeRequestPb) (*UpdateExchangeRequest, error) { - if pb == nil { - return nil, nil - } - st := &UpdateExchangeRequest{} - st.Exchange = pb.Exchange - st.Id = pb.Id - - return st, nil -} - -func updateExchangeResponseToPb(st *UpdateExchangeResponse) (*updateExchangeResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &updateExchangeResponsePb{} - pb.Exchange = st.Exchange - - return pb, nil -} - -type updateExchangeResponsePb struct { - Exchange *Exchange `json:"exchange,omitempty"` -} - -func updateExchangeResponseFromPb(pb *updateExchangeResponsePb) (*UpdateExchangeResponse, error) { - if pb == nil { - return nil, nil - } - st := &UpdateExchangeResponse{} - st.Exchange = pb.Exchange - - return st, nil -} - -func updateInstallationRequestToPb(st *UpdateInstallationRequest) (*updateInstallationRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &updateInstallationRequestPb{} - pb.Installation = st.Installation - pb.InstallationId = st.InstallationId - pb.ListingId = st.ListingId - pb.RotateToken = st.RotateToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type updateInstallationRequestPb struct { - Installation InstallationDetail `json:"installation"` - InstallationId string `json:"-" url:"-"` - ListingId string `json:"-" url:"-"` - RotateToken bool `json:"rotate_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func updateInstallationRequestFromPb(pb *updateInstallationRequestPb) (*UpdateInstallationRequest, error) { - if pb == nil { - return nil, nil - } - st := &UpdateInstallationRequest{} - st.Installation = pb.Installation - st.InstallationId = pb.InstallationId - st.ListingId = pb.ListingId - st.RotateToken = pb.RotateToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *updateInstallationRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st updateInstallationRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func updateInstallationResponseToPb(st *UpdateInstallationResponse) (*updateInstallationResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &updateInstallationResponsePb{} - pb.Installation = st.Installation - - return pb, nil -} - -type updateInstallationResponsePb struct { - Installation *InstallationDetail `json:"installation,omitempty"` -} - -func updateInstallationResponseFromPb(pb *updateInstallationResponsePb) (*UpdateInstallationResponse, error) { - if pb == nil { - return nil, nil - } - st := &UpdateInstallationResponse{} - st.Installation = pb.Installation - - return st, nil -} - -func updateListingRequestToPb(st *UpdateListingRequest) (*updateListingRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &updateListingRequestPb{} - pb.Id = st.Id - pb.Listing = st.Listing - - return pb, nil -} - -type updateListingRequestPb struct { - Id string `json:"-" url:"-"` - Listing Listing `json:"listing"` -} - -func updateListingRequestFromPb(pb *updateListingRequestPb) (*UpdateListingRequest, error) { - if pb == nil { - return nil, nil - } - st := &UpdateListingRequest{} - st.Id = pb.Id - st.Listing = pb.Listing - - return st, nil -} - -func updateListingResponseToPb(st *UpdateListingResponse) (*updateListingResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &updateListingResponsePb{} - pb.Listing = st.Listing - - return pb, nil -} - -type updateListingResponsePb struct { - Listing *Listing `json:"listing,omitempty"` -} - -func updateListingResponseFromPb(pb *updateListingResponsePb) (*UpdateListingResponse, error) { - if pb == nil { - return nil, nil - } - st := &UpdateListingResponse{} - st.Listing = pb.Listing - - return st, nil -} - -func updatePersonalizationRequestRequestToPb(st *UpdatePersonalizationRequestRequest) (*updatePersonalizationRequestRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &updatePersonalizationRequestRequestPb{} - pb.ListingId = st.ListingId - pb.Reason = st.Reason - pb.RequestId = st.RequestId - pb.Share = st.Share - pb.Status = st.Status - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type updatePersonalizationRequestRequestPb struct { - ListingId string `json:"-" url:"-"` - Reason string `json:"reason,omitempty"` - RequestId string `json:"-" url:"-"` - Share *ShareInfo `json:"share,omitempty"` - Status PersonalizationRequestStatus `json:"status"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func updatePersonalizationRequestRequestFromPb(pb *updatePersonalizationRequestRequestPb) (*UpdatePersonalizationRequestRequest, error) { - if pb == nil { - return nil, nil - } - st := &UpdatePersonalizationRequestRequest{} - st.ListingId = pb.ListingId - st.Reason = pb.Reason - st.RequestId = pb.RequestId - st.Share = pb.Share - st.Status = pb.Status - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *updatePersonalizationRequestRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st updatePersonalizationRequestRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func updatePersonalizationRequestResponseToPb(st *UpdatePersonalizationRequestResponse) (*updatePersonalizationRequestResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &updatePersonalizationRequestResponsePb{} - pb.Request = st.Request - - return pb, nil -} - -type updatePersonalizationRequestResponsePb struct { - Request *PersonalizationRequest `json:"request,omitempty"` -} - -func updatePersonalizationRequestResponseFromPb(pb *updatePersonalizationRequestResponsePb) (*UpdatePersonalizationRequestResponse, error) { - if pb == nil { - return nil, nil - } - st := &UpdatePersonalizationRequestResponse{} - st.Request = pb.Request - - return st, nil -} - -func updateProviderAnalyticsDashboardRequestToPb(st *UpdateProviderAnalyticsDashboardRequest) (*updateProviderAnalyticsDashboardRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &updateProviderAnalyticsDashboardRequestPb{} - pb.Id = st.Id - pb.Version = st.Version - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type updateProviderAnalyticsDashboardRequestPb struct { - Id string `json:"-" url:"-"` - Version int64 `json:"version,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func updateProviderAnalyticsDashboardRequestFromPb(pb *updateProviderAnalyticsDashboardRequestPb) (*UpdateProviderAnalyticsDashboardRequest, error) { - if pb == nil { - return nil, nil - } - st := &UpdateProviderAnalyticsDashboardRequest{} - st.Id = pb.Id - st.Version = pb.Version - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *updateProviderAnalyticsDashboardRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st updateProviderAnalyticsDashboardRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func updateProviderAnalyticsDashboardResponseToPb(st *UpdateProviderAnalyticsDashboardResponse) (*updateProviderAnalyticsDashboardResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &updateProviderAnalyticsDashboardResponsePb{} - pb.DashboardId = st.DashboardId - pb.Id = st.Id - pb.Version = st.Version - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type updateProviderAnalyticsDashboardResponsePb struct { - DashboardId string `json:"dashboard_id"` - Id string `json:"id"` - Version int64 `json:"version,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func updateProviderAnalyticsDashboardResponseFromPb(pb *updateProviderAnalyticsDashboardResponsePb) (*UpdateProviderAnalyticsDashboardResponse, error) { - if pb == nil { - return nil, nil - } - st := &UpdateProviderAnalyticsDashboardResponse{} - st.DashboardId = pb.DashboardId - st.Id = pb.Id - st.Version = pb.Version - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *updateProviderAnalyticsDashboardResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st updateProviderAnalyticsDashboardResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func updateProviderRequestToPb(st *UpdateProviderRequest) (*updateProviderRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &updateProviderRequestPb{} - pb.Id = st.Id - pb.Provider = st.Provider - - return pb, nil -} - -type updateProviderRequestPb struct { - Id string `json:"-" url:"-"` - Provider ProviderInfo `json:"provider"` -} - -func updateProviderRequestFromPb(pb *updateProviderRequestPb) (*UpdateProviderRequest, error) { - if pb == nil { - return nil, nil - } - st := &UpdateProviderRequest{} - st.Id = pb.Id - st.Provider = pb.Provider - - return st, nil -} - -func updateProviderResponseToPb(st *UpdateProviderResponse) (*updateProviderResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &updateProviderResponsePb{} - pb.Provider = st.Provider - - return pb, nil -} - -type updateProviderResponsePb struct { - Provider *ProviderInfo `json:"provider,omitempty"` -} - -func updateProviderResponseFromPb(pb *updateProviderResponsePb) (*UpdateProviderResponse, error) { - if pb == nil { - return nil, nil - } - st := &UpdateProviderResponse{} - st.Provider = pb.Provider - - return st, nil -} - -func durationToPb(d *time.Duration) (*string, error) { - if d == nil { - return nil, nil - } - s := fmt.Sprintf("%.9fs", d.Seconds()) - return &s, nil -} - -func durationFromPb(s *string) (*time.Duration, error) { - if s == nil { - return nil, nil - } - d, err := time.ParseDuration(*s) - if err != nil { - return nil, err - } - return &d, nil -} - -func timestampToPb(t *time.Time) (*string, error) { - if t == nil { - return nil, nil - } - s := t.Format(time.RFC3339) - return &s, nil -} - -func timestampFromPb(s *string) (*time.Time, error) { - if s == nil { - return nil, nil - } - t, err := time.Parse(time.RFC3339, *s) - if err != nil { - return nil, err - } - return &t, nil -} - -func fieldMaskToPb(fm *[]string) (*string, error) { - if fm == nil { - return nil, nil - } - s := strings.Join(*fm, ",") - return &s, nil -} - -func fieldMaskFromPb(s *string) (*[]string, error) { - if s == nil { - return nil, nil - } - fm := strings.Split(*s, ",") - return &fm, nil -} diff --git a/service/marketplace/model.go b/service/marketplace/model.go index ea7d3d48c..34c468304 100755 --- a/service/marketplace/model.go +++ b/service/marketplace/model.go @@ -3,75 +3,21 @@ package marketplace import ( - "encoding/json" "fmt" + + "github.com/databricks/databricks-sdk-go/marshal" ) type AddExchangeForListingRequest struct { - - // Wire name: 'exchange_id' ExchangeId string `json:"exchange_id"` - // Wire name: 'listing_id' ListingId string `json:"listing_id"` } -func (st *AddExchangeForListingRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &addExchangeForListingRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := addExchangeForListingRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st AddExchangeForListingRequest) MarshalJSON() ([]byte, error) { - pb, err := addExchangeForListingRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type AddExchangeForListingResponse struct { - - // Wire name: 'exchange_for_listing' ExchangeForListing *ExchangeListing `json:"exchange_for_listing,omitempty"` } -func (st *AddExchangeForListingResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &addExchangeForListingResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := addExchangeForListingResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st AddExchangeForListingResponse) MarshalJSON() ([]byte, error) { - pb, err := addExchangeForListingResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type AssetType string const AssetTypeAssetTypeApp AssetType = `ASSET_TYPE_APP` @@ -126,126 +72,22 @@ func (f *AssetType) Type() string { // Get one batch of listings. One may specify up to 50 IDs per request. type BatchGetListingsRequest struct { - Ids []string `json:"-" tf:"-"` -} - -func (st *BatchGetListingsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &batchGetListingsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := batchGetListingsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st BatchGetListingsRequest) MarshalJSON() ([]byte, error) { - pb, err := batchGetListingsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Ids []string `json:"-" url:"ids,omitempty"` } type BatchGetListingsResponse struct { - - // Wire name: 'listings' Listings []Listing `json:"listings,omitempty"` } -func (st *BatchGetListingsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &batchGetListingsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := batchGetListingsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st BatchGetListingsResponse) MarshalJSON() ([]byte, error) { - pb, err := batchGetListingsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Get one batch of providers. One may specify up to 50 IDs per request. type BatchGetProvidersRequest struct { - Ids []string `json:"-" tf:"-"` -} - -func (st *BatchGetProvidersRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &batchGetProvidersRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := batchGetProvidersRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st BatchGetProvidersRequest) MarshalJSON() ([]byte, error) { - pb, err := batchGetProvidersRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Ids []string `json:"-" url:"ids,omitempty"` } type BatchGetProvidersResponse struct { - - // Wire name: 'providers' Providers []ProviderInfo `json:"providers,omitempty"` } -func (st *BatchGetProvidersResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &batchGetProvidersResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := batchGetProvidersResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st BatchGetProvidersResponse) MarshalJSON() ([]byte, error) { - pb, err := batchGetProvidersResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type Category string const CategoryAdvertisingAndMarketing Category = `ADVERTISING_AND_MARKETING` @@ -344,78 +186,29 @@ func (f *Category) Type() string { } type ConsumerTerms struct { - - // Wire name: 'version' Version string `json:"version"` } -func (st *ConsumerTerms) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &consumerTermsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := consumerTermsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ConsumerTerms) MarshalJSON() ([]byte, error) { - pb, err := consumerTermsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // contact info for the consumer requesting data or performing a listing // installation type ContactInfo struct { - - // Wire name: 'company' Company string `json:"company,omitempty"` - // Wire name: 'email' Email string `json:"email,omitempty"` - // Wire name: 'first_name' FirstName string `json:"first_name,omitempty"` - // Wire name: 'last_name' LastName string `json:"last_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ContactInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &contactInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := contactInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ContactInfo) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ContactInfo) MarshalJSON() ([]byte, error) { - pb, err := contactInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ContactInfo) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type Cost string @@ -456,474 +249,180 @@ func (f *Cost) Type() string { } type CreateExchangeFilterRequest struct { - - // Wire name: 'filter' Filter ExchangeFilter `json:"filter"` } -func (st *CreateExchangeFilterRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createExchangeFilterRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createExchangeFilterRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CreateExchangeFilterRequest) MarshalJSON() ([]byte, error) { - pb, err := createExchangeFilterRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type CreateExchangeFilterResponse struct { - - // Wire name: 'filter_id' FilterId string `json:"filter_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateExchangeFilterResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createExchangeFilterResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createExchangeFilterResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateExchangeFilterResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateExchangeFilterResponse) MarshalJSON() ([]byte, error) { - pb, err := createExchangeFilterResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateExchangeFilterResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreateExchangeRequest struct { - - // Wire name: 'exchange' Exchange Exchange `json:"exchange"` } -func (st *CreateExchangeRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createExchangeRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createExchangeRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CreateExchangeRequest) MarshalJSON() ([]byte, error) { - pb, err := createExchangeRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type CreateExchangeResponse struct { - - // Wire name: 'exchange_id' ExchangeId string `json:"exchange_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateExchangeResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createExchangeResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createExchangeResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateExchangeResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateExchangeResponse) MarshalJSON() ([]byte, error) { - pb, err := createExchangeResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateExchangeResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreateFileRequest struct { - - // Wire name: 'display_name' DisplayName string `json:"display_name,omitempty"` - // Wire name: 'file_parent' FileParent FileParent `json:"file_parent"` - // Wire name: 'marketplace_file_type' MarketplaceFileType MarketplaceFileType `json:"marketplace_file_type"` - // Wire name: 'mime_type' MimeType string `json:"mime_type"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateFileRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createFileRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createFileRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateFileRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateFileRequest) MarshalJSON() ([]byte, error) { - pb, err := createFileRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateFileRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreateFileResponse struct { - - // Wire name: 'file_info' FileInfo *FileInfo `json:"file_info,omitempty"` // Pre-signed POST URL to blob storage - // Wire name: 'upload_url' UploadUrl string `json:"upload_url,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateFileResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createFileResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createFileResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateFileResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateFileResponse) MarshalJSON() ([]byte, error) { - pb, err := createFileResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateFileResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreateInstallationRequest struct { - - // Wire name: 'accepted_consumer_terms' AcceptedConsumerTerms *ConsumerTerms `json:"accepted_consumer_terms,omitempty"` - // Wire name: 'catalog_name' CatalogName string `json:"catalog_name,omitempty"` - ListingId string `json:"-" tf:"-"` + ListingId string `json:"-" url:"-"` - // Wire name: 'recipient_type' RecipientType DeltaSharingRecipientType `json:"recipient_type,omitempty"` // for git repo installations - // Wire name: 'repo_detail' RepoDetail *RepoInstallation `json:"repo_detail,omitempty"` - // Wire name: 'share_name' ShareName string `json:"share_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateInstallationRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createInstallationRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createInstallationRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateInstallationRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateInstallationRequest) MarshalJSON() ([]byte, error) { - pb, err := createInstallationRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateInstallationRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreateListingRequest struct { - - // Wire name: 'listing' Listing Listing `json:"listing"` } -func (st *CreateListingRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createListingRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createListingRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CreateListingRequest) MarshalJSON() ([]byte, error) { - pb, err := createListingRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type CreateListingResponse struct { - - // Wire name: 'listing_id' ListingId string `json:"listing_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateListingResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createListingResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createListingResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateListingResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateListingResponse) MarshalJSON() ([]byte, error) { - pb, err := createListingResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateListingResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Data request messages also creates a lead (maybe) type CreatePersonalizationRequest struct { - - // Wire name: 'accepted_consumer_terms' AcceptedConsumerTerms ConsumerTerms `json:"accepted_consumer_terms"` - // Wire name: 'comment' Comment string `json:"comment,omitempty"` - // Wire name: 'company' Company string `json:"company,omitempty"` - // Wire name: 'first_name' FirstName string `json:"first_name,omitempty"` - // Wire name: 'intended_use' IntendedUse string `json:"intended_use"` - // Wire name: 'is_from_lighthouse' IsFromLighthouse bool `json:"is_from_lighthouse,omitempty"` - // Wire name: 'last_name' LastName string `json:"last_name,omitempty"` - ListingId string `json:"-" tf:"-"` + ListingId string `json:"-" url:"-"` - // Wire name: 'recipient_type' RecipientType DeltaSharingRecipientType `json:"recipient_type,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreatePersonalizationRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createPersonalizationRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createPersonalizationRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreatePersonalizationRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreatePersonalizationRequest) MarshalJSON() ([]byte, error) { - pb, err := createPersonalizationRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreatePersonalizationRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreatePersonalizationRequestResponse struct { - - // Wire name: 'id' Id string `json:"id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreatePersonalizationRequestResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createPersonalizationRequestResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createPersonalizationRequestResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreatePersonalizationRequestResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreatePersonalizationRequestResponse) MarshalJSON() ([]byte, error) { - pb, err := createPersonalizationRequestResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreatePersonalizationRequestResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreateProviderRequest struct { - - // Wire name: 'provider' Provider ProviderInfo `json:"provider"` } -func (st *CreateProviderRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createProviderRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createProviderRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CreateProviderRequest) MarshalJSON() ([]byte, error) { - pb, err := createProviderRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type CreateProviderResponse struct { - - // Wire name: 'id' Id string `json:"id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateProviderResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createProviderResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createProviderResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateProviderResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateProviderResponse) MarshalJSON() ([]byte, error) { - pb, err := createProviderResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateProviderResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type DataRefresh string @@ -985,389 +484,61 @@ func (f *DataRefresh) Type() string { } type DataRefreshInfo struct { - - // Wire name: 'interval' Interval int64 `json:"interval"` - // Wire name: 'unit' Unit DataRefresh `json:"unit"` } -func (st *DataRefreshInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &dataRefreshInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := dataRefreshInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DataRefreshInfo) MarshalJSON() ([]byte, error) { - pb, err := dataRefreshInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Delete an exchange filter type DeleteExchangeFilterRequest struct { - Id string `json:"-" tf:"-"` -} - -func (st *DeleteExchangeFilterRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteExchangeFilterRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteExchangeFilterRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteExchangeFilterRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteExchangeFilterRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Id string `json:"-" url:"-"` } type DeleteExchangeFilterResponse struct { } -func (st *DeleteExchangeFilterResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteExchangeFilterResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteExchangeFilterResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteExchangeFilterResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteExchangeFilterResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Delete an exchange type DeleteExchangeRequest struct { - Id string `json:"-" tf:"-"` -} - -func (st *DeleteExchangeRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteExchangeRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteExchangeRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteExchangeRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteExchangeRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Id string `json:"-" url:"-"` } type DeleteExchangeResponse struct { } -func (st *DeleteExchangeResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteExchangeResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteExchangeResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteExchangeResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteExchangeResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Delete a file type DeleteFileRequest struct { - FileId string `json:"-" tf:"-"` -} - -func (st *DeleteFileRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteFileRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteFileRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteFileRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteFileRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + FileId string `json:"-" url:"-"` } type DeleteFileResponse struct { } -func (st *DeleteFileResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteFileResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteFileResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteFileResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteFileResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Uninstall from a listing type DeleteInstallationRequest struct { - InstallationId string `json:"-" tf:"-"` - - ListingId string `json:"-" tf:"-"` -} - -func (st *DeleteInstallationRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteInstallationRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteInstallationRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} + InstallationId string `json:"-" url:"-"` -func (st DeleteInstallationRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteInstallationRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + ListingId string `json:"-" url:"-"` } type DeleteInstallationResponse struct { } -func (st *DeleteInstallationResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteInstallationResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteInstallationResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteInstallationResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteInstallationResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Delete a listing type DeleteListingRequest struct { - Id string `json:"-" tf:"-"` -} - -func (st *DeleteListingRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteListingRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteListingRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteListingRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteListingRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Id string `json:"-" url:"-"` } type DeleteListingResponse struct { } -func (st *DeleteListingResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteListingResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteListingResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteListingResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteListingResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Delete provider type DeleteProviderRequest struct { - Id string `json:"-" tf:"-"` -} - -func (st *DeleteProviderRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteProviderRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteProviderRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteProviderRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteProviderRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Id string `json:"-" url:"-"` } type DeleteProviderResponse struct { } -func (st *DeleteProviderResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteProviderResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteProviderResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteProviderResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteProviderResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type DeltaSharingRecipientType string const DeltaSharingRecipientTypeDeltaSharingRecipientTypeDatabricks DeltaSharingRecipientType = `DELTA_SHARING_RECIPIENT_TYPE_DATABRICKS` @@ -1406,117 +577,63 @@ func (f *DeltaSharingRecipientType) Type() string { } type Exchange struct { - - // Wire name: 'comment' Comment string `json:"comment,omitempty"` - // Wire name: 'created_at' CreatedAt int64 `json:"created_at,omitempty"` - // Wire name: 'created_by' CreatedBy string `json:"created_by,omitempty"` - // Wire name: 'filters' Filters []ExchangeFilter `json:"filters,omitempty"` - // Wire name: 'id' Id string `json:"id,omitempty"` - // Wire name: 'linked_listings' LinkedListings []ExchangeListing `json:"linked_listings,omitempty"` - // Wire name: 'name' Name string `json:"name"` - // Wire name: 'updated_at' UpdatedAt int64 `json:"updated_at,omitempty"` - // Wire name: 'updated_by' UpdatedBy string `json:"updated_by,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *Exchange) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &exchangePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := exchangeFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *Exchange) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st Exchange) MarshalJSON() ([]byte, error) { - pb, err := exchangeToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s Exchange) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ExchangeFilter struct { - - // Wire name: 'created_at' CreatedAt int64 `json:"created_at,omitempty"` - // Wire name: 'created_by' CreatedBy string `json:"created_by,omitempty"` - // Wire name: 'exchange_id' ExchangeId string `json:"exchange_id"` - // Wire name: 'filter_type' FilterType ExchangeFilterType `json:"filter_type"` - // Wire name: 'filter_value' FilterValue string `json:"filter_value"` - // Wire name: 'id' Id string `json:"id,omitempty"` - // Wire name: 'name' Name string `json:"name,omitempty"` - // Wire name: 'updated_at' UpdatedAt int64 `json:"updated_at,omitempty"` - // Wire name: 'updated_by' UpdatedBy string `json:"updated_by,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ExchangeFilter) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &exchangeFilterPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := exchangeFilterFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ExchangeFilter) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ExchangeFilter) MarshalJSON() ([]byte, error) { - pb, err := exchangeFilterToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ExchangeFilter) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ExchangeFilterType string @@ -1554,151 +671,78 @@ func (f *ExchangeFilterType) Type() string { } type ExchangeListing struct { - - // Wire name: 'created_at' CreatedAt int64 `json:"created_at,omitempty"` - // Wire name: 'created_by' CreatedBy string `json:"created_by,omitempty"` - // Wire name: 'exchange_id' ExchangeId string `json:"exchange_id,omitempty"` - // Wire name: 'exchange_name' ExchangeName string `json:"exchange_name,omitempty"` - // Wire name: 'id' Id string `json:"id,omitempty"` - // Wire name: 'listing_id' ListingId string `json:"listing_id,omitempty"` - // Wire name: 'listing_name' ListingName string `json:"listing_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ExchangeListing) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &exchangeListingPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := exchangeListingFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ExchangeListing) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ExchangeListing) MarshalJSON() ([]byte, error) { - pb, err := exchangeListingToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ExchangeListing) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type FileInfo struct { - - // Wire name: 'created_at' CreatedAt int64 `json:"created_at,omitempty"` // Name displayed to users for applicable files, e.g. embedded notebooks - // Wire name: 'display_name' DisplayName string `json:"display_name,omitempty"` - // Wire name: 'download_link' DownloadLink string `json:"download_link,omitempty"` - // Wire name: 'file_parent' FileParent *FileParent `json:"file_parent,omitempty"` - // Wire name: 'id' Id string `json:"id,omitempty"` - // Wire name: 'marketplace_file_type' MarketplaceFileType MarketplaceFileType `json:"marketplace_file_type,omitempty"` - // Wire name: 'mime_type' MimeType string `json:"mime_type,omitempty"` - // Wire name: 'status' Status FileStatus `json:"status,omitempty"` // Populated if status is in a failed state with more information on reason // for the failure. - // Wire name: 'status_message' StatusMessage string `json:"status_message,omitempty"` - // Wire name: 'updated_at' UpdatedAt int64 `json:"updated_at,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *FileInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &fileInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := fileInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *FileInfo) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st FileInfo) MarshalJSON() ([]byte, error) { - pb, err := fileInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s FileInfo) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type FileParent struct { - - // Wire name: 'file_parent_type' FileParentType FileParentType `json:"file_parent_type,omitempty"` // TODO make the following fields required - // Wire name: 'parent_id' ParentId string `json:"parent_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *FileParent) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &fileParentPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := fileParentFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *FileParent) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st FileParent) MarshalJSON() ([]byte, error) { - pb, err := fileParentToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s FileParent) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type FileParentType string @@ -1823,582 +867,172 @@ func (f *FulfillmentType) Type() string { // Get an exchange type GetExchangeRequest struct { - Id string `json:"-" tf:"-"` -} - -func (st *GetExchangeRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getExchangeRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getExchangeRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetExchangeRequest) MarshalJSON() ([]byte, error) { - pb, err := getExchangeRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Id string `json:"-" url:"-"` } type GetExchangeResponse struct { - - // Wire name: 'exchange' Exchange *Exchange `json:"exchange,omitempty"` } -func (st *GetExchangeResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getExchangeResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getExchangeResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetExchangeResponse) MarshalJSON() ([]byte, error) { - pb, err := getExchangeResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Get a file type GetFileRequest struct { - FileId string `json:"-" tf:"-"` -} - -func (st *GetFileRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getFileRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getFileRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetFileRequest) MarshalJSON() ([]byte, error) { - pb, err := getFileRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + FileId string `json:"-" url:"-"` } type GetFileResponse struct { - - // Wire name: 'file_info' FileInfo *FileInfo `json:"file_info,omitempty"` } -func (st *GetFileResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getFileResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getFileResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetFileResponse) MarshalJSON() ([]byte, error) { - pb, err := getFileResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type GetLatestVersionProviderAnalyticsDashboardResponse struct { // version here is latest logical version of the dashboard template - // Wire name: 'version' Version int64 `json:"version,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetLatestVersionProviderAnalyticsDashboardResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getLatestVersionProviderAnalyticsDashboardResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getLatestVersionProviderAnalyticsDashboardResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetLatestVersionProviderAnalyticsDashboardResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetLatestVersionProviderAnalyticsDashboardResponse) MarshalJSON() ([]byte, error) { - pb, err := getLatestVersionProviderAnalyticsDashboardResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetLatestVersionProviderAnalyticsDashboardResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get listing content metadata type GetListingContentMetadataRequest struct { - ListingId string `json:"-" tf:"-"` + ListingId string `json:"-" url:"-"` - PageSize int `json:"-" tf:"-"` + PageSize int `json:"-" url:"page_size,omitempty"` - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetListingContentMetadataRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getListingContentMetadataRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getListingContentMetadataRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetListingContentMetadataRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetListingContentMetadataRequest) MarshalJSON() ([]byte, error) { - pb, err := getListingContentMetadataRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetListingContentMetadataRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type GetListingContentMetadataResponse struct { - - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` - // Wire name: 'shared_data_objects' SharedDataObjects []SharedDataObject `json:"shared_data_objects,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetListingContentMetadataResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getListingContentMetadataResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getListingContentMetadataResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetListingContentMetadataResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetListingContentMetadataResponse) MarshalJSON() ([]byte, error) { - pb, err := getListingContentMetadataResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetListingContentMetadataResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get listing type GetListingRequest struct { - Id string `json:"-" tf:"-"` -} - -func (st *GetListingRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getListingRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getListingRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetListingRequest) MarshalJSON() ([]byte, error) { - pb, err := getListingRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Id string `json:"-" url:"-"` } type GetListingResponse struct { - - // Wire name: 'listing' Listing *Listing `json:"listing,omitempty"` } -func (st *GetListingResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getListingResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getListingResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetListingResponse) MarshalJSON() ([]byte, error) { - pb, err := getListingResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // List listings type GetListingsRequest struct { - PageSize int `json:"-" tf:"-"` + PageSize int `json:"-" url:"page_size,omitempty"` - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetListingsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getListingsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getListingsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetListingsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetListingsRequest) MarshalJSON() ([]byte, error) { - pb, err := getListingsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetListingsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type GetListingsResponse struct { - - // Wire name: 'listings' Listings []Listing `json:"listings,omitempty"` - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetListingsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getListingsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getListingsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetListingsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetListingsResponse) MarshalJSON() ([]byte, error) { - pb, err := getListingsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetListingsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get the personalization request for a listing type GetPersonalizationRequestRequest struct { - ListingId string `json:"-" tf:"-"` -} - -func (st *GetPersonalizationRequestRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getPersonalizationRequestRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getPersonalizationRequestRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetPersonalizationRequestRequest) MarshalJSON() ([]byte, error) { - pb, err := getPersonalizationRequestRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + ListingId string `json:"-" url:"-"` } type GetPersonalizationRequestResponse struct { - - // Wire name: 'personalization_requests' PersonalizationRequests []PersonalizationRequest `json:"personalization_requests,omitempty"` } -func (st *GetPersonalizationRequestResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getPersonalizationRequestResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getPersonalizationRequestResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetPersonalizationRequestResponse) MarshalJSON() ([]byte, error) { - pb, err := getPersonalizationRequestResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Get a provider type GetProviderRequest struct { - Id string `json:"-" tf:"-"` -} - -func (st *GetProviderRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getProviderRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getProviderRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetProviderRequest) MarshalJSON() ([]byte, error) { - pb, err := getProviderRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Id string `json:"-" url:"-"` } type GetProviderResponse struct { - - // Wire name: 'provider' Provider *ProviderInfo `json:"provider,omitempty"` } -func (st *GetProviderResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getProviderResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getProviderResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetProviderResponse) MarshalJSON() ([]byte, error) { - pb, err := getProviderResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type Installation struct { - - // Wire name: 'installation' Installation *InstallationDetail `json:"installation,omitempty"` } -func (st *Installation) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &installationPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := installationFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st Installation) MarshalJSON() ([]byte, error) { - pb, err := installationToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type InstallationDetail struct { - - // Wire name: 'catalog_name' CatalogName string `json:"catalog_name,omitempty"` - // Wire name: 'error_message' ErrorMessage string `json:"error_message,omitempty"` - // Wire name: 'id' Id string `json:"id,omitempty"` - // Wire name: 'installed_on' InstalledOn int64 `json:"installed_on,omitempty"` - // Wire name: 'listing_id' ListingId string `json:"listing_id,omitempty"` - // Wire name: 'listing_name' ListingName string `json:"listing_name,omitempty"` - // Wire name: 'recipient_type' RecipientType DeltaSharingRecipientType `json:"recipient_type,omitempty"` - // Wire name: 'repo_name' RepoName string `json:"repo_name,omitempty"` - // Wire name: 'repo_path' RepoPath string `json:"repo_path,omitempty"` - // Wire name: 'share_name' ShareName string `json:"share_name,omitempty"` - // Wire name: 'status' Status InstallationStatus `json:"status,omitempty"` - // Wire name: 'token_detail' TokenDetail *TokenDetail `json:"token_detail,omitempty"` - // Wire name: 'tokens' Tokens []TokenInfo `json:"tokens,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *InstallationDetail) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &installationDetailPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := installationDetailFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *InstallationDetail) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st InstallationDetail) MarshalJSON() ([]byte, error) { - pb, err := installationDetailToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s InstallationDetail) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type InstallationStatus string @@ -2440,933 +1074,469 @@ func (f *InstallationStatus) Type() string { // List all installations type ListAllInstallationsRequest struct { - PageSize int `json:"-" tf:"-"` + PageSize int `json:"-" url:"page_size,omitempty"` - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListAllInstallationsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listAllInstallationsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listAllInstallationsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListAllInstallationsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListAllInstallationsRequest) MarshalJSON() ([]byte, error) { - pb, err := listAllInstallationsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListAllInstallationsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListAllInstallationsResponse struct { - - // Wire name: 'installations' Installations []InstallationDetail `json:"installations,omitempty"` - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListAllInstallationsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listAllInstallationsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listAllInstallationsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListAllInstallationsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListAllInstallationsResponse) MarshalJSON() ([]byte, error) { - pb, err := listAllInstallationsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListAllInstallationsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // List all personalization requests type ListAllPersonalizationRequestsRequest struct { - PageSize int `json:"-" tf:"-"` + PageSize int `json:"-" url:"page_size,omitempty"` - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListAllPersonalizationRequestsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listAllPersonalizationRequestsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listAllPersonalizationRequestsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListAllPersonalizationRequestsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListAllPersonalizationRequestsRequest) MarshalJSON() ([]byte, error) { - pb, err := listAllPersonalizationRequestsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListAllPersonalizationRequestsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListAllPersonalizationRequestsResponse struct { - - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` - // Wire name: 'personalization_requests' PersonalizationRequests []PersonalizationRequest `json:"personalization_requests,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListAllPersonalizationRequestsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listAllPersonalizationRequestsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listAllPersonalizationRequestsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListAllPersonalizationRequestsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListAllPersonalizationRequestsResponse) MarshalJSON() ([]byte, error) { - pb, err := listAllPersonalizationRequestsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListAllPersonalizationRequestsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // List exchange filters type ListExchangeFiltersRequest struct { - ExchangeId string `json:"-" tf:"-"` + ExchangeId string `json:"-" url:"exchange_id"` - PageSize int `json:"-" tf:"-"` + PageSize int `json:"-" url:"page_size,omitempty"` - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListExchangeFiltersRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listExchangeFiltersRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listExchangeFiltersRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListExchangeFiltersRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListExchangeFiltersRequest) MarshalJSON() ([]byte, error) { - pb, err := listExchangeFiltersRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListExchangeFiltersRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListExchangeFiltersResponse struct { - - // Wire name: 'filters' Filters []ExchangeFilter `json:"filters,omitempty"` - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListExchangeFiltersResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listExchangeFiltersResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listExchangeFiltersResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListExchangeFiltersResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListExchangeFiltersResponse) MarshalJSON() ([]byte, error) { - pb, err := listExchangeFiltersResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListExchangeFiltersResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // List exchanges for listing type ListExchangesForListingRequest struct { - ListingId string `json:"-" tf:"-"` + ListingId string `json:"-" url:"listing_id"` - PageSize int `json:"-" tf:"-"` + PageSize int `json:"-" url:"page_size,omitempty"` - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListExchangesForListingRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listExchangesForListingRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listExchangesForListingRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListExchangesForListingRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListExchangesForListingRequest) MarshalJSON() ([]byte, error) { - pb, err := listExchangesForListingRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListExchangesForListingRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListExchangesForListingResponse struct { - - // Wire name: 'exchange_listing' ExchangeListing []ExchangeListing `json:"exchange_listing,omitempty"` - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListExchangesForListingResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listExchangesForListingResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listExchangesForListingResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListExchangesForListingResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListExchangesForListingResponse) MarshalJSON() ([]byte, error) { - pb, err := listExchangesForListingResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListExchangesForListingResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // List exchanges type ListExchangesRequest struct { - PageSize int `json:"-" tf:"-"` + PageSize int `json:"-" url:"page_size,omitempty"` - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListExchangesRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listExchangesRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listExchangesRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListExchangesRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListExchangesRequest) MarshalJSON() ([]byte, error) { - pb, err := listExchangesRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListExchangesRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListExchangesResponse struct { - - // Wire name: 'exchanges' Exchanges []Exchange `json:"exchanges,omitempty"` - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListExchangesResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listExchangesResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listExchangesResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListExchangesResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListExchangesResponse) MarshalJSON() ([]byte, error) { - pb, err := listExchangesResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListExchangesResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // List files type ListFilesRequest struct { - FileParent FileParent `json:"-" tf:"-"` + FileParent FileParent `json:"-" url:"file_parent"` - PageSize int `json:"-" tf:"-"` + PageSize int `json:"-" url:"page_size,omitempty"` - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListFilesRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listFilesRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listFilesRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListFilesRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListFilesRequest) MarshalJSON() ([]byte, error) { - pb, err := listFilesRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListFilesRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListFilesResponse struct { - - // Wire name: 'file_infos' FileInfos []FileInfo `json:"file_infos,omitempty"` - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListFilesResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listFilesResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listFilesResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListFilesResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListFilesResponse) MarshalJSON() ([]byte, error) { - pb, err := listFilesResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListFilesResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // List all listing fulfillments type ListFulfillmentsRequest struct { - ListingId string `json:"-" tf:"-"` + ListingId string `json:"-" url:"-"` - PageSize int `json:"-" tf:"-"` + PageSize int `json:"-" url:"page_size,omitempty"` - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListFulfillmentsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listFulfillmentsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listFulfillmentsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListFulfillmentsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListFulfillmentsRequest) MarshalJSON() ([]byte, error) { - pb, err := listFulfillmentsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListFulfillmentsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListFulfillmentsResponse struct { - - // Wire name: 'fulfillments' Fulfillments []ListingFulfillment `json:"fulfillments,omitempty"` - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListFulfillmentsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listFulfillmentsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listFulfillmentsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListFulfillmentsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListFulfillmentsResponse) MarshalJSON() ([]byte, error) { - pb, err := listFulfillmentsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListFulfillmentsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // List installations for a listing type ListInstallationsRequest struct { - ListingId string `json:"-" tf:"-"` + ListingId string `json:"-" url:"-"` - PageSize int `json:"-" tf:"-"` + PageSize int `json:"-" url:"page_size,omitempty"` - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListInstallationsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listInstallationsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listInstallationsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListInstallationsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListInstallationsRequest) MarshalJSON() ([]byte, error) { - pb, err := listInstallationsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListInstallationsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListInstallationsResponse struct { - - // Wire name: 'installations' Installations []InstallationDetail `json:"installations,omitempty"` - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListInstallationsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listInstallationsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listInstallationsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListInstallationsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListInstallationsResponse) MarshalJSON() ([]byte, error) { - pb, err := listInstallationsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListInstallationsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // List listings for exchange type ListListingsForExchangeRequest struct { - ExchangeId string `json:"-" tf:"-"` + ExchangeId string `json:"-" url:"exchange_id"` - PageSize int `json:"-" tf:"-"` + PageSize int `json:"-" url:"page_size,omitempty"` - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListListingsForExchangeRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listListingsForExchangeRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listListingsForExchangeRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListListingsForExchangeRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListListingsForExchangeRequest) MarshalJSON() ([]byte, error) { - pb, err := listListingsForExchangeRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListListingsForExchangeRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListListingsForExchangeResponse struct { - - // Wire name: 'exchange_listings' ExchangeListings []ExchangeListing `json:"exchange_listings,omitempty"` - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } - -func (st *ListListingsForExchangeResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listListingsForExchangeResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listListingsForExchangeResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil + +func (s *ListListingsForExchangeResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListListingsForExchangeResponse) MarshalJSON() ([]byte, error) { - pb, err := listListingsForExchangeResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListListingsForExchangeResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // List listings type ListListingsRequest struct { // Matches any of the following asset types - Assets []AssetType `json:"-" tf:"-"` + Assets []AssetType `json:"-" url:"assets,omitempty"` // Matches any of the following categories - Categories []Category `json:"-" tf:"-"` + Categories []Category `json:"-" url:"categories,omitempty"` // Filters each listing based on if it is free. - IsFree bool `json:"-" tf:"-"` + IsFree bool `json:"-" url:"is_free,omitempty"` // Filters each listing based on if it is a private exchange. - IsPrivateExchange bool `json:"-" tf:"-"` + IsPrivateExchange bool `json:"-" url:"is_private_exchange,omitempty"` // Filters each listing based on whether it is a staff pick. - IsStaffPick bool `json:"-" tf:"-"` + IsStaffPick bool `json:"-" url:"is_staff_pick,omitempty"` - PageSize int `json:"-" tf:"-"` + PageSize int `json:"-" url:"page_size,omitempty"` - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` // Matches any of the following provider ids - ProviderIds []string `json:"-" tf:"-"` + ProviderIds []string `json:"-" url:"provider_ids,omitempty"` // Matches any of the following tags - Tags []ListingTag `json:"-" tf:"-"` + Tags []ListingTag `json:"-" url:"tags,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListListingsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listListingsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listListingsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListListingsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListListingsRequest) MarshalJSON() ([]byte, error) { - pb, err := listListingsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListListingsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListListingsResponse struct { - - // Wire name: 'listings' Listings []Listing `json:"listings,omitempty"` - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListListingsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listListingsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listListingsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListListingsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListListingsResponse) MarshalJSON() ([]byte, error) { - pb, err := listListingsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListListingsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListProviderAnalyticsDashboardResponse struct { // dashboard_id will be used to open Lakeview dashboard. - // Wire name: 'dashboard_id' DashboardId string `json:"dashboard_id"` - // Wire name: 'id' Id string `json:"id"` - // Wire name: 'version' Version int64 `json:"version,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListProviderAnalyticsDashboardResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listProviderAnalyticsDashboardResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listProviderAnalyticsDashboardResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListProviderAnalyticsDashboardResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListProviderAnalyticsDashboardResponse) MarshalJSON() ([]byte, error) { - pb, err := listProviderAnalyticsDashboardResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListProviderAnalyticsDashboardResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // List providers type ListProvidersRequest struct { - IsFeatured bool `json:"-" tf:"-"` + IsFeatured bool `json:"-" url:"is_featured,omitempty"` - PageSize int `json:"-" tf:"-"` + PageSize int `json:"-" url:"page_size,omitempty"` - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListProvidersRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listProvidersRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listProvidersRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListProvidersRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListProvidersRequest) MarshalJSON() ([]byte, error) { - pb, err := listProvidersRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListProvidersRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListProvidersResponse struct { - - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` - // Wire name: 'providers' Providers []ProviderInfo `json:"providers,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListProvidersResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listProvidersResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listProvidersResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListProvidersResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListProvidersResponse) MarshalJSON() ([]byte, error) { - pb, err := listProvidersResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListProvidersResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type Listing struct { - - // Wire name: 'detail' Detail *ListingDetail `json:"detail,omitempty"` - // Wire name: 'id' Id string `json:"id,omitempty"` - // Wire name: 'summary' Summary ListingSummary `json:"summary"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *Listing) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listingPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listingFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *Listing) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st Listing) MarshalJSON() ([]byte, error) { - pb, err := listingToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s Listing) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListingDetail struct { // Type of assets included in the listing. eg. GIT_REPO, DATA_TABLE, MODEL, // NOTEBOOK - // Wire name: 'assets' Assets []AssetType `json:"assets,omitempty"` // The ending date timestamp for when the data spans - // Wire name: 'collection_date_end' CollectionDateEnd int64 `json:"collection_date_end,omitempty"` // The starting date timestamp for when the data spans - // Wire name: 'collection_date_start' CollectionDateStart int64 `json:"collection_date_start,omitempty"` // Smallest unit of time in the dataset - // Wire name: 'collection_granularity' CollectionGranularity *DataRefreshInfo `json:"collection_granularity,omitempty"` // Whether the dataset is free or paid - // Wire name: 'cost' Cost Cost `json:"cost,omitempty"` // Where/how the data is sourced - // Wire name: 'data_source' DataSource string `json:"data_source,omitempty"` - // Wire name: 'description' Description string `json:"description,omitempty"` - // Wire name: 'documentation_link' DocumentationLink string `json:"documentation_link,omitempty"` - // Wire name: 'embedded_notebook_file_infos' EmbeddedNotebookFileInfos []FileInfo `json:"embedded_notebook_file_infos,omitempty"` - // Wire name: 'file_ids' FileIds []string `json:"file_ids,omitempty"` // Which geo region the listing data is collected from - // Wire name: 'geographical_coverage' GeographicalCoverage string `json:"geographical_coverage,omitempty"` // ID 20, 21 removed don't use License of the data asset - Required for // listings with model based assets - // Wire name: 'license' License string `json:"license,omitempty"` // What the pricing model is (e.g. paid, subscription, paid upfront); should // only be present if cost is paid TODO: Not used yet, should deprecate if // we will never use it - // Wire name: 'pricing_model' PricingModel string `json:"pricing_model,omitempty"` - // Wire name: 'privacy_policy_link' PrivacyPolicyLink string `json:"privacy_policy_link,omitempty"` // size of the dataset in GB - // Wire name: 'size' Size float64 `json:"size,omitempty"` - // Wire name: 'support_link' SupportLink string `json:"support_link,omitempty"` // Listing tags - Simple key value pair to annotate listings. When should I // use tags vs dedicated fields? Using tags avoids the need to add new @@ -3375,117 +1545,39 @@ type ListingDetail struct { // the field is optional and won't need to have NOT NULL integrity check 2. // The value is fairly fixed, static and low cardinality (eg. enums). 3. The // value won't be used in filters or joins with other tables. - // Wire name: 'tags' Tags []ListingTag `json:"tags,omitempty"` - // Wire name: 'terms_of_service' TermsOfService string `json:"terms_of_service,omitempty"` // How often data is updated - // Wire name: 'update_frequency' UpdateFrequency *DataRefreshInfo `json:"update_frequency,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListingDetail) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listingDetailPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listingDetailFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListingDetail) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListingDetail) MarshalJSON() ([]byte, error) { - pb, err := listingDetailToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListingDetail) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListingFulfillment struct { - - // Wire name: 'fulfillment_type' FulfillmentType FulfillmentType `json:"fulfillment_type,omitempty"` - // Wire name: 'listing_id' ListingId string `json:"listing_id"` - // Wire name: 'recipient_type' RecipientType DeltaSharingRecipientType `json:"recipient_type,omitempty"` - // Wire name: 'repo_info' RepoInfo *RepoInfo `json:"repo_info,omitempty"` - // Wire name: 'share_info' ShareInfo *ShareInfo `json:"share_info,omitempty"` } -func (st *ListingFulfillment) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listingFulfillmentPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listingFulfillmentFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ListingFulfillment) MarshalJSON() ([]byte, error) { - pb, err := listingFulfillmentToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type ListingSetting struct { - - // Wire name: 'visibility' Visibility Visibility `json:"visibility,omitempty"` } -func (st *ListingSetting) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listingSettingPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listingSettingFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ListingSetting) MarshalJSON() ([]byte, error) { - pb, err := listingSettingToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type ListingShareType string const ListingShareTypeFull ListingShareType = `FULL` @@ -3568,128 +1660,64 @@ func (f *ListingStatus) Type() string { } type ListingSummary struct { - - // Wire name: 'categories' Categories []Category `json:"categories,omitempty"` - // Wire name: 'created_at' CreatedAt int64 `json:"created_at,omitempty"` - // Wire name: 'created_by' CreatedBy string `json:"created_by,omitempty"` - // Wire name: 'created_by_id' CreatedById int64 `json:"created_by_id,omitempty"` - // Wire name: 'exchange_ids' ExchangeIds []string `json:"exchange_ids,omitempty"` // if a git repo is being created, a listing will be initialized with this // field as opposed to a share - // Wire name: 'git_repo' GitRepo *RepoInfo `json:"git_repo,omitempty"` - // Wire name: 'listingType' ListingType ListingType `json:"listingType"` - // Wire name: 'name' Name string `json:"name"` - // Wire name: 'provider_id' ProviderId string `json:"provider_id,omitempty"` - // Wire name: 'provider_region' ProviderRegion *RegionInfo `json:"provider_region,omitempty"` - // Wire name: 'published_at' PublishedAt int64 `json:"published_at,omitempty"` - // Wire name: 'published_by' PublishedBy string `json:"published_by,omitempty"` - // Wire name: 'setting' Setting *ListingSetting `json:"setting,omitempty"` - // Wire name: 'share' Share *ShareInfo `json:"share,omitempty"` // Enums - // Wire name: 'status' Status ListingStatus `json:"status,omitempty"` - // Wire name: 'subtitle' Subtitle string `json:"subtitle,omitempty"` - // Wire name: 'updated_at' UpdatedAt int64 `json:"updated_at,omitempty"` - // Wire name: 'updated_by' UpdatedBy string `json:"updated_by,omitempty"` - // Wire name: 'updated_by_id' UpdatedById int64 `json:"updated_by_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListingSummary) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listingSummaryPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listingSummaryFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListingSummary) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListingSummary) MarshalJSON() ([]byte, error) { - pb, err := listingSummaryToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListingSummary) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListingTag struct { // Tag name (enum) - // Wire name: 'tag_name' TagName ListingTagType `json:"tag_name,omitempty"` // String representation of the tag value. Values should be string literals // (no complex types) - // Wire name: 'tag_values' TagValues []string `json:"tag_values,omitempty"` } -func (st *ListingTag) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listingTagPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listingTagFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ListingTag) MarshalJSON() ([]byte, error) { - pb, err := listingTagToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type ListingTagType string const ListingTagTypeListingTagTypeLanguage ListingTagType = `LISTING_TAG_TYPE_LANGUAGE` @@ -3805,82 +1833,48 @@ func (f *MarketplaceFileType) Type() string { } type PersonalizationRequest struct { - - // Wire name: 'comment' Comment string `json:"comment,omitempty"` - // Wire name: 'consumer_region' ConsumerRegion RegionInfo `json:"consumer_region"` // contact info for the consumer requesting data or performing a listing // installation - // Wire name: 'contact_info' ContactInfo *ContactInfo `json:"contact_info,omitempty"` - // Wire name: 'created_at' CreatedAt int64 `json:"created_at,omitempty"` - // Wire name: 'id' Id string `json:"id,omitempty"` - // Wire name: 'intended_use' IntendedUse string `json:"intended_use,omitempty"` - // Wire name: 'is_from_lighthouse' IsFromLighthouse bool `json:"is_from_lighthouse,omitempty"` - // Wire name: 'listing_id' ListingId string `json:"listing_id,omitempty"` - // Wire name: 'listing_name' ListingName string `json:"listing_name,omitempty"` - // Wire name: 'metastore_id' MetastoreId string `json:"metastore_id,omitempty"` - // Wire name: 'provider_id' ProviderId string `json:"provider_id,omitempty"` - // Wire name: 'recipient_type' RecipientType DeltaSharingRecipientType `json:"recipient_type,omitempty"` - // Wire name: 'share' Share *ShareInfo `json:"share,omitempty"` - // Wire name: 'status' Status PersonalizationRequestStatus `json:"status,omitempty"` - // Wire name: 'status_message' StatusMessage string `json:"status_message,omitempty"` - // Wire name: 'updated_at' UpdatedAt int64 `json:"updated_at,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *PersonalizationRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &personalizationRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := personalizationRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *PersonalizationRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st PersonalizationRequest) MarshalJSON() ([]byte, error) { - pb, err := personalizationRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s PersonalizationRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type PersonalizationRequestStatus string @@ -3927,993 +1921,335 @@ func (f *PersonalizationRequestStatus) Type() string { } type ProviderAnalyticsDashboard struct { - - // Wire name: 'id' Id string `json:"id"` } -func (st *ProviderAnalyticsDashboard) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &providerAnalyticsDashboardPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := providerAnalyticsDashboardFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ProviderAnalyticsDashboard) MarshalJSON() ([]byte, error) { - pb, err := providerAnalyticsDashboardToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type ProviderInfo struct { - - // Wire name: 'business_contact_email' BusinessContactEmail string `json:"business_contact_email"` - // Wire name: 'company_website_link' CompanyWebsiteLink string `json:"company_website_link,omitempty"` - // Wire name: 'dark_mode_icon_file_id' DarkModeIconFileId string `json:"dark_mode_icon_file_id,omitempty"` - // Wire name: 'dark_mode_icon_file_path' DarkModeIconFilePath string `json:"dark_mode_icon_file_path,omitempty"` - // Wire name: 'description' Description string `json:"description,omitempty"` - // Wire name: 'icon_file_id' IconFileId string `json:"icon_file_id,omitempty"` - // Wire name: 'icon_file_path' IconFilePath string `json:"icon_file_path,omitempty"` - // Wire name: 'id' Id string `json:"id,omitempty"` // is_featured is accessible by consumers only - // Wire name: 'is_featured' IsFeatured bool `json:"is_featured,omitempty"` - // Wire name: 'name' Name string `json:"name"` - // Wire name: 'privacy_policy_link' PrivacyPolicyLink string `json:"privacy_policy_link"` // published_by is only applicable to data aggregators (e.g. Crux) - // Wire name: 'published_by' PublishedBy string `json:"published_by,omitempty"` - // Wire name: 'support_contact_email' SupportContactEmail string `json:"support_contact_email,omitempty"` - // Wire name: 'term_of_service_link' TermOfServiceLink string `json:"term_of_service_link"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ProviderInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &providerInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := providerInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ProviderInfo) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ProviderInfo) MarshalJSON() ([]byte, error) { - pb, err := providerInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ProviderInfo) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type RegionInfo struct { - - // Wire name: 'cloud' Cloud string `json:"cloud,omitempty"` - // Wire name: 'region' Region string `json:"region,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *RegionInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := ®ionInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := regionInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *RegionInfo) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st RegionInfo) MarshalJSON() ([]byte, error) { - pb, err := regionInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s RegionInfo) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Remove an exchange for listing type RemoveExchangeForListingRequest struct { - Id string `json:"-" tf:"-"` -} - -func (st *RemoveExchangeForListingRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &removeExchangeForListingRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := removeExchangeForListingRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st RemoveExchangeForListingRequest) MarshalJSON() ([]byte, error) { - pb, err := removeExchangeForListingRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Id string `json:"-" url:"-"` } type RemoveExchangeForListingResponse struct { } -func (st *RemoveExchangeForListingResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &removeExchangeForListingResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := removeExchangeForListingResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st RemoveExchangeForListingResponse) MarshalJSON() ([]byte, error) { - pb, err := removeExchangeForListingResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type RepoInfo struct { // the git repo url e.g. https://github.com/databrickslabs/dolly.git - // Wire name: 'git_repo_url' GitRepoUrl string `json:"git_repo_url"` } -func (st *RepoInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &repoInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := repoInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st RepoInfo) MarshalJSON() ([]byte, error) { - pb, err := repoInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type RepoInstallation struct { // the user-specified repo name for their installed git repo listing - // Wire name: 'repo_name' RepoName string `json:"repo_name"` // refers to the full url file path that navigates the user to the repo's // entrypoint (e.g. a README.md file, or the repo file view in the unified // UI) should just be a relative path - // Wire name: 'repo_path' RepoPath string `json:"repo_path"` } -func (st *RepoInstallation) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &repoInstallationPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := repoInstallationFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st RepoInstallation) MarshalJSON() ([]byte, error) { - pb, err := repoInstallationToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Search listings type SearchListingsRequest struct { // Matches any of the following asset types - Assets []AssetType `json:"-" tf:"-"` + Assets []AssetType `json:"-" url:"assets,omitempty"` // Matches any of the following categories - Categories []Category `json:"-" tf:"-"` + Categories []Category `json:"-" url:"categories,omitempty"` - IsFree bool `json:"-" tf:"-"` + IsFree bool `json:"-" url:"is_free,omitempty"` - IsPrivateExchange bool `json:"-" tf:"-"` + IsPrivateExchange bool `json:"-" url:"is_private_exchange,omitempty"` - PageSize int `json:"-" tf:"-"` + PageSize int `json:"-" url:"page_size,omitempty"` - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` // Matches any of the following provider ids - ProviderIds []string `json:"-" tf:"-"` + ProviderIds []string `json:"-" url:"provider_ids,omitempty"` // Fuzzy matches query - Query string `json:"-" tf:"-"` + Query string `json:"-" url:"query"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *SearchListingsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &searchListingsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := searchListingsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *SearchListingsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st SearchListingsRequest) MarshalJSON() ([]byte, error) { - pb, err := searchListingsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s SearchListingsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type SearchListingsResponse struct { - - // Wire name: 'listings' Listings []Listing `json:"listings,omitempty"` - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *SearchListingsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &searchListingsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := searchListingsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *SearchListingsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st SearchListingsResponse) MarshalJSON() ([]byte, error) { - pb, err := searchListingsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s SearchListingsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ShareInfo struct { - - // Wire name: 'name' Name string `json:"name"` - // Wire name: 'type' Type ListingShareType `json:"type"` } -func (st *ShareInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &shareInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := shareInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ShareInfo) MarshalJSON() ([]byte, error) { - pb, err := shareInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type SharedDataObject struct { // The type of the data object. Could be one of: TABLE, SCHEMA, // NOTEBOOK_FILE, MODEL, VOLUME - // Wire name: 'data_object_type' DataObjectType string `json:"data_object_type,omitempty"` // Name of the shared object - // Wire name: 'name' Name string `json:"name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *SharedDataObject) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &sharedDataObjectPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := sharedDataObjectFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *SharedDataObject) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st SharedDataObject) MarshalJSON() ([]byte, error) { - pb, err := sharedDataObjectToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s SharedDataObject) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type TokenDetail struct { - - // Wire name: 'bearerToken' BearerToken string `json:"bearerToken,omitempty"` - // Wire name: 'endpoint' Endpoint string `json:"endpoint,omitempty"` - // Wire name: 'expirationTime' ExpirationTime string `json:"expirationTime,omitempty"` // These field names must follow the delta sharing protocol. Original // message: RetrieveToken.Response in // managed-catalog/api/messages/recipient.proto - // Wire name: 'shareCredentialsVersion' ShareCredentialsVersion int `json:"shareCredentialsVersion,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *TokenDetail) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &tokenDetailPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := tokenDetailFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *TokenDetail) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st TokenDetail) MarshalJSON() ([]byte, error) { - pb, err := tokenDetailToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s TokenDetail) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type TokenInfo struct { // Full activation url to retrieve the access token. It will be empty if the // token is already retrieved. - // Wire name: 'activation_url' ActivationUrl string `json:"activation_url,omitempty"` // Time at which this Recipient Token was created, in epoch milliseconds. - // Wire name: 'created_at' CreatedAt int64 `json:"created_at,omitempty"` // Username of Recipient Token creator. - // Wire name: 'created_by' CreatedBy string `json:"created_by,omitempty"` // Expiration timestamp of the token in epoch milliseconds. - // Wire name: 'expiration_time' ExpirationTime int64 `json:"expiration_time,omitempty"` // Unique id of the Recipient Token. - // Wire name: 'id' Id string `json:"id,omitempty"` // Time at which this Recipient Token was updated, in epoch milliseconds. - // Wire name: 'updated_at' UpdatedAt int64 `json:"updated_at,omitempty"` // Username of Recipient Token updater. - // Wire name: 'updated_by' UpdatedBy string `json:"updated_by,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *TokenInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &tokenInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := tokenInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *TokenInfo) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st TokenInfo) MarshalJSON() ([]byte, error) { - pb, err := tokenInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s TokenInfo) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type UpdateExchangeFilterRequest struct { - - // Wire name: 'filter' Filter ExchangeFilter `json:"filter"` - Id string `json:"-" tf:"-"` -} - -func (st *UpdateExchangeFilterRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateExchangeFilterRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateExchangeFilterRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateExchangeFilterRequest) MarshalJSON() ([]byte, error) { - pb, err := updateExchangeFilterRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Id string `json:"-" url:"-"` } type UpdateExchangeFilterResponse struct { - - // Wire name: 'filter' Filter *ExchangeFilter `json:"filter,omitempty"` } -func (st *UpdateExchangeFilterResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateExchangeFilterResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateExchangeFilterResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateExchangeFilterResponse) MarshalJSON() ([]byte, error) { - pb, err := updateExchangeFilterResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type UpdateExchangeRequest struct { - - // Wire name: 'exchange' Exchange Exchange `json:"exchange"` - Id string `json:"-" tf:"-"` -} - -func (st *UpdateExchangeRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateExchangeRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateExchangeRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateExchangeRequest) MarshalJSON() ([]byte, error) { - pb, err := updateExchangeRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Id string `json:"-" url:"-"` } type UpdateExchangeResponse struct { - - // Wire name: 'exchange' Exchange *Exchange `json:"exchange,omitempty"` } -func (st *UpdateExchangeResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateExchangeResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateExchangeResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateExchangeResponse) MarshalJSON() ([]byte, error) { - pb, err := updateExchangeResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type UpdateInstallationRequest struct { - - // Wire name: 'installation' Installation InstallationDetail `json:"installation"` - InstallationId string `json:"-" tf:"-"` + InstallationId string `json:"-" url:"-"` - ListingId string `json:"-" tf:"-"` + ListingId string `json:"-" url:"-"` - // Wire name: 'rotate_token' RotateToken bool `json:"rotate_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *UpdateInstallationRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateInstallationRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateInstallationRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *UpdateInstallationRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st UpdateInstallationRequest) MarshalJSON() ([]byte, error) { - pb, err := updateInstallationRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s UpdateInstallationRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type UpdateInstallationResponse struct { - - // Wire name: 'installation' Installation *InstallationDetail `json:"installation,omitempty"` } -func (st *UpdateInstallationResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateInstallationResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateInstallationResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateInstallationResponse) MarshalJSON() ([]byte, error) { - pb, err := updateInstallationResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type UpdateListingRequest struct { - Id string `json:"-" tf:"-"` + Id string `json:"-" url:"-"` - // Wire name: 'listing' Listing Listing `json:"listing"` } -func (st *UpdateListingRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateListingRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateListingRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateListingRequest) MarshalJSON() ([]byte, error) { - pb, err := updateListingRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type UpdateListingResponse struct { - - // Wire name: 'listing' Listing *Listing `json:"listing,omitempty"` } -func (st *UpdateListingResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateListingResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateListingResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateListingResponse) MarshalJSON() ([]byte, error) { - pb, err := updateListingResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type UpdatePersonalizationRequestRequest struct { - ListingId string `json:"-" tf:"-"` + ListingId string `json:"-" url:"-"` - // Wire name: 'reason' Reason string `json:"reason,omitempty"` - RequestId string `json:"-" tf:"-"` + RequestId string `json:"-" url:"-"` - // Wire name: 'share' Share *ShareInfo `json:"share,omitempty"` - // Wire name: 'status' Status PersonalizationRequestStatus `json:"status"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *UpdatePersonalizationRequestRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updatePersonalizationRequestRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updatePersonalizationRequestRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *UpdatePersonalizationRequestRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st UpdatePersonalizationRequestRequest) MarshalJSON() ([]byte, error) { - pb, err := updatePersonalizationRequestRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s UpdatePersonalizationRequestRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type UpdatePersonalizationRequestResponse struct { - - // Wire name: 'request' Request *PersonalizationRequest `json:"request,omitempty"` } -func (st *UpdatePersonalizationRequestResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updatePersonalizationRequestResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updatePersonalizationRequestResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdatePersonalizationRequestResponse) MarshalJSON() ([]byte, error) { - pb, err := updatePersonalizationRequestResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type UpdateProviderAnalyticsDashboardRequest struct { // id is immutable property and can't be updated. - Id string `json:"-" tf:"-"` + Id string `json:"-" url:"-"` // this is the version of the dashboard template we want to update our user // to current expectation is that it should be equal to latest version of // the dashboard template - // Wire name: 'version' Version int64 `json:"version,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *UpdateProviderAnalyticsDashboardRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateProviderAnalyticsDashboardRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateProviderAnalyticsDashboardRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *UpdateProviderAnalyticsDashboardRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st UpdateProviderAnalyticsDashboardRequest) MarshalJSON() ([]byte, error) { - pb, err := updateProviderAnalyticsDashboardRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s UpdateProviderAnalyticsDashboardRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type UpdateProviderAnalyticsDashboardResponse struct { // this is newly created Lakeview dashboard for the user - // Wire name: 'dashboard_id' DashboardId string `json:"dashboard_id"` // id & version should be the same as the request - // Wire name: 'id' Id string `json:"id"` - // Wire name: 'version' Version int64 `json:"version,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *UpdateProviderAnalyticsDashboardResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateProviderAnalyticsDashboardResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateProviderAnalyticsDashboardResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *UpdateProviderAnalyticsDashboardResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st UpdateProviderAnalyticsDashboardResponse) MarshalJSON() ([]byte, error) { - pb, err := updateProviderAnalyticsDashboardResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s UpdateProviderAnalyticsDashboardResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type UpdateProviderRequest struct { - Id string `json:"-" tf:"-"` + Id string `json:"-" url:"-"` - // Wire name: 'provider' Provider ProviderInfo `json:"provider"` } -func (st *UpdateProviderRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateProviderRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateProviderRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateProviderRequest) MarshalJSON() ([]byte, error) { - pb, err := updateProviderRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type UpdateProviderResponse struct { - - // Wire name: 'provider' Provider *ProviderInfo `json:"provider,omitempty"` } -func (st *UpdateProviderResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateProviderResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateProviderResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateProviderResponse) MarshalJSON() ([]byte, error) { - pb, err := updateProviderResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type Visibility string const VisibilityPrivate Visibility = `PRIVATE` diff --git a/service/ml/impl.go b/service/ml/impl.go index 744521294..0f88594d1 100755 --- a/service/ml/impl.go +++ b/service/ml/impl.go @@ -18,375 +18,131 @@ type experimentsImpl struct { } func (a *experimentsImpl) CreateExperiment(ctx context.Context, request CreateExperiment) (*CreateExperimentResponse, error) { - - requestPb, pbErr := createExperimentToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var createExperimentResponsePb createExperimentResponsePb + var createExperimentResponse CreateExperimentResponse path := "/api/2.0/mlflow/experiments/create" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &createExperimentResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := createExperimentResponseFromPb(&createExperimentResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &createExperimentResponse) + return &createExperimentResponse, err } func (a *experimentsImpl) CreateLoggedModel(ctx context.Context, request CreateLoggedModelRequest) (*CreateLoggedModelResponse, error) { - - requestPb, pbErr := createLoggedModelRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var createLoggedModelResponsePb createLoggedModelResponsePb + var createLoggedModelResponse CreateLoggedModelResponse path := "/api/2.0/mlflow/logged-models" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &createLoggedModelResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := createLoggedModelResponseFromPb(&createLoggedModelResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &createLoggedModelResponse) + return &createLoggedModelResponse, err } func (a *experimentsImpl) CreateRun(ctx context.Context, request CreateRun) (*CreateRunResponse, error) { - - requestPb, pbErr := createRunToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var createRunResponsePb createRunResponsePb + var createRunResponse CreateRunResponse path := "/api/2.0/mlflow/runs/create" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &createRunResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := createRunResponseFromPb(&createRunResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &createRunResponse) + return &createRunResponse, err } func (a *experimentsImpl) DeleteExperiment(ctx context.Context, request DeleteExperiment) error { - - requestPb, pbErr := deleteExperimentToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteExperimentResponsePb deleteExperimentResponsePb + var deleteExperimentResponse DeleteExperimentResponse path := "/api/2.0/mlflow/experiments/delete" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &deleteExperimentResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &deleteExperimentResponse) return err } func (a *experimentsImpl) DeleteLoggedModel(ctx context.Context, request DeleteLoggedModelRequest) error { - - requestPb, pbErr := deleteLoggedModelRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteLoggedModelResponsePb deleteLoggedModelResponsePb - path := fmt.Sprintf("/api/2.0/mlflow/logged-models/%v", requestPb.ModelId) + var deleteLoggedModelResponse DeleteLoggedModelResponse + path := fmt.Sprintf("/api/2.0/mlflow/logged-models/%v", request.ModelId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteLoggedModelResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteLoggedModelResponse) return err } func (a *experimentsImpl) DeleteLoggedModelTag(ctx context.Context, request DeleteLoggedModelTagRequest) error { - - requestPb, pbErr := deleteLoggedModelTagRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteLoggedModelTagResponsePb deleteLoggedModelTagResponsePb - path := fmt.Sprintf("/api/2.0/mlflow/logged-models/%v/tags/%v", requestPb.ModelId, requestPb.TagKey) + var deleteLoggedModelTagResponse DeleteLoggedModelTagResponse + path := fmt.Sprintf("/api/2.0/mlflow/logged-models/%v/tags/%v", request.ModelId, request.TagKey) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteLoggedModelTagResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteLoggedModelTagResponse) return err } func (a *experimentsImpl) DeleteRun(ctx context.Context, request DeleteRun) error { - - requestPb, pbErr := deleteRunToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteRunResponsePb deleteRunResponsePb + var deleteRunResponse DeleteRunResponse path := "/api/2.0/mlflow/runs/delete" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &deleteRunResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &deleteRunResponse) return err } func (a *experimentsImpl) DeleteRuns(ctx context.Context, request DeleteRuns) (*DeleteRunsResponse, error) { - - requestPb, pbErr := deleteRunsToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var deleteRunsResponsePb deleteRunsResponsePb + var deleteRunsResponse DeleteRunsResponse path := "/api/2.0/mlflow/databricks/runs/delete-runs" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &deleteRunsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := deleteRunsResponseFromPb(&deleteRunsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &deleteRunsResponse) + return &deleteRunsResponse, err } func (a *experimentsImpl) DeleteTag(ctx context.Context, request DeleteTag) error { - - requestPb, pbErr := deleteTagToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteTagResponsePb deleteTagResponsePb + var deleteTagResponse DeleteTagResponse path := "/api/2.0/mlflow/runs/delete-tag" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &deleteTagResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &deleteTagResponse) return err } func (a *experimentsImpl) FinalizeLoggedModel(ctx context.Context, request FinalizeLoggedModelRequest) (*FinalizeLoggedModelResponse, error) { - - requestPb, pbErr := finalizeLoggedModelRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var finalizeLoggedModelResponsePb finalizeLoggedModelResponsePb - path := fmt.Sprintf("/api/2.0/mlflow/logged-models/%v", requestPb.ModelId) + var finalizeLoggedModelResponse FinalizeLoggedModelResponse + path := fmt.Sprintf("/api/2.0/mlflow/logged-models/%v", request.ModelId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &finalizeLoggedModelResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := finalizeLoggedModelResponseFromPb(&finalizeLoggedModelResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &finalizeLoggedModelResponse) + return &finalizeLoggedModelResponse, err } func (a *experimentsImpl) GetByName(ctx context.Context, request GetByNameRequest) (*GetExperimentByNameResponse, error) { - - requestPb, pbErr := getByNameRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var getExperimentByNameResponsePb getExperimentByNameResponsePb + var getExperimentByNameResponse GetExperimentByNameResponse path := "/api/2.0/mlflow/experiments/get-by-name" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &getExperimentByNameResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := getExperimentByNameResponseFromPb(&getExperimentByNameResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getExperimentByNameResponse) + return &getExperimentByNameResponse, err } func (a *experimentsImpl) GetExperiment(ctx context.Context, request GetExperimentRequest) (*GetExperimentResponse, error) { - - requestPb, pbErr := getExperimentRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var getExperimentResponsePb getExperimentResponsePb + var getExperimentResponse GetExperimentResponse path := "/api/2.0/mlflow/experiments/get" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &getExperimentResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := getExperimentResponseFromPb(&getExperimentResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getExperimentResponse) + return &getExperimentResponse, err } // Gets a list of all values for the specified metric for a given run. @@ -421,163 +177,53 @@ func (a *experimentsImpl) GetHistoryAll(ctx context.Context, request GetHistoryR } func (a *experimentsImpl) internalGetHistory(ctx context.Context, request GetHistoryRequest) (*GetMetricHistoryResponse, error) { - - requestPb, pbErr := getHistoryRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var getMetricHistoryResponsePb getMetricHistoryResponsePb + var getMetricHistoryResponse GetMetricHistoryResponse path := "/api/2.0/mlflow/metrics/get-history" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &getMetricHistoryResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := getMetricHistoryResponseFromPb(&getMetricHistoryResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getMetricHistoryResponse) + return &getMetricHistoryResponse, err } func (a *experimentsImpl) GetLoggedModel(ctx context.Context, request GetLoggedModelRequest) (*GetLoggedModelResponse, error) { - - requestPb, pbErr := getLoggedModelRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var getLoggedModelResponsePb getLoggedModelResponsePb - path := fmt.Sprintf("/api/2.0/mlflow/logged-models/%v", requestPb.ModelId) + var getLoggedModelResponse GetLoggedModelResponse + path := fmt.Sprintf("/api/2.0/mlflow/logged-models/%v", request.ModelId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &getLoggedModelResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := getLoggedModelResponseFromPb(&getLoggedModelResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getLoggedModelResponse) + return &getLoggedModelResponse, err } func (a *experimentsImpl) GetPermissionLevels(ctx context.Context, request GetExperimentPermissionLevelsRequest) (*GetExperimentPermissionLevelsResponse, error) { - - requestPb, pbErr := getExperimentPermissionLevelsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var getExperimentPermissionLevelsResponsePb getExperimentPermissionLevelsResponsePb - path := fmt.Sprintf("/api/2.0/permissions/experiments/%v/permissionLevels", requestPb.ExperimentId) + var getExperimentPermissionLevelsResponse GetExperimentPermissionLevelsResponse + path := fmt.Sprintf("/api/2.0/permissions/experiments/%v/permissionLevels", request.ExperimentId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &getExperimentPermissionLevelsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := getExperimentPermissionLevelsResponseFromPb(&getExperimentPermissionLevelsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getExperimentPermissionLevelsResponse) + return &getExperimentPermissionLevelsResponse, err } func (a *experimentsImpl) GetPermissions(ctx context.Context, request GetExperimentPermissionsRequest) (*ExperimentPermissions, error) { - - requestPb, pbErr := getExperimentPermissionsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var experimentPermissionsPb experimentPermissionsPb - path := fmt.Sprintf("/api/2.0/permissions/experiments/%v", requestPb.ExperimentId) + var experimentPermissions ExperimentPermissions + path := fmt.Sprintf("/api/2.0/permissions/experiments/%v", request.ExperimentId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &experimentPermissionsPb, - ) - if err != nil { - return nil, err - } - resp, err := experimentPermissionsFromPb(&experimentPermissionsPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &experimentPermissions) + return &experimentPermissions, err } func (a *experimentsImpl) GetRun(ctx context.Context, request GetRunRequest) (*GetRunResponse, error) { - - requestPb, pbErr := getRunRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var getRunResponsePb getRunResponsePb + var getRunResponse GetRunResponse path := "/api/2.0/mlflow/runs/get" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &getRunResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := getRunResponseFromPb(&getRunResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getRunResponse) + return &getRunResponse, err } // List artifacts for a run. Takes an optional `artifact_path` prefix which if @@ -622,35 +268,13 @@ func (a *experimentsImpl) ListArtifactsAll(ctx context.Context, request ListArti } func (a *experimentsImpl) internalListArtifacts(ctx context.Context, request ListArtifactsRequest) (*ListArtifactsResponse, error) { - - requestPb, pbErr := listArtifactsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listArtifactsResponsePb listArtifactsResponsePb + var listArtifactsResponse ListArtifactsResponse path := "/api/2.0/mlflow/artifacts/list" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listArtifactsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listArtifactsResponseFromPb(&listArtifactsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listArtifactsResponse) + return &listArtifactsResponse, err } // Gets a list of all experiments. @@ -685,329 +309,123 @@ func (a *experimentsImpl) ListExperimentsAll(ctx context.Context, request ListEx } func (a *experimentsImpl) internalListExperiments(ctx context.Context, request ListExperimentsRequest) (*ListExperimentsResponse, error) { - - requestPb, pbErr := listExperimentsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listExperimentsResponsePb listExperimentsResponsePb + var listExperimentsResponse ListExperimentsResponse path := "/api/2.0/mlflow/experiments/list" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listExperimentsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listExperimentsResponseFromPb(&listExperimentsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listExperimentsResponse) + return &listExperimentsResponse, err } func (a *experimentsImpl) LogBatch(ctx context.Context, request LogBatch) error { - - requestPb, pbErr := logBatchToPb(&request) - if pbErr != nil { - return pbErr - } - - var logBatchResponsePb logBatchResponsePb + var logBatchResponse LogBatchResponse path := "/api/2.0/mlflow/runs/log-batch" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &logBatchResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &logBatchResponse) return err } func (a *experimentsImpl) LogInputs(ctx context.Context, request LogInputs) error { - - requestPb, pbErr := logInputsToPb(&request) - if pbErr != nil { - return pbErr - } - - var logInputsResponsePb logInputsResponsePb + var logInputsResponse LogInputsResponse path := "/api/2.0/mlflow/runs/log-inputs" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &logInputsResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &logInputsResponse) return err } func (a *experimentsImpl) LogLoggedModelParams(ctx context.Context, request LogLoggedModelParamsRequest) error { - - requestPb, pbErr := logLoggedModelParamsRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var logLoggedModelParamsRequestResponsePb logLoggedModelParamsRequestResponsePb - path := fmt.Sprintf("/api/2.0/mlflow/logged-models/%v/params", requestPb.ModelId) + var logLoggedModelParamsRequestResponse LogLoggedModelParamsRequestResponse + path := fmt.Sprintf("/api/2.0/mlflow/logged-models/%v/params", request.ModelId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &logLoggedModelParamsRequestResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &logLoggedModelParamsRequestResponse) return err } func (a *experimentsImpl) LogMetric(ctx context.Context, request LogMetric) error { - - requestPb, pbErr := logMetricToPb(&request) - if pbErr != nil { - return pbErr - } - - var logMetricResponsePb logMetricResponsePb + var logMetricResponse LogMetricResponse path := "/api/2.0/mlflow/runs/log-metric" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &logMetricResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &logMetricResponse) return err } func (a *experimentsImpl) LogModel(ctx context.Context, request LogModel) error { - - requestPb, pbErr := logModelToPb(&request) - if pbErr != nil { - return pbErr - } - - var logModelResponsePb logModelResponsePb + var logModelResponse LogModelResponse path := "/api/2.0/mlflow/runs/log-model" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &logModelResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &logModelResponse) return err } func (a *experimentsImpl) LogOutputs(ctx context.Context, request LogOutputsRequest) error { - - requestPb, pbErr := logOutputsRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var logOutputsResponsePb logOutputsResponsePb + var logOutputsResponse LogOutputsResponse path := "/api/2.0/mlflow/runs/outputs" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &logOutputsResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &logOutputsResponse) return err } func (a *experimentsImpl) LogParam(ctx context.Context, request LogParam) error { - - requestPb, pbErr := logParamToPb(&request) - if pbErr != nil { - return pbErr - } - - var logParamResponsePb logParamResponsePb + var logParamResponse LogParamResponse path := "/api/2.0/mlflow/runs/log-parameter" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &logParamResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &logParamResponse) return err } func (a *experimentsImpl) RestoreExperiment(ctx context.Context, request RestoreExperiment) error { - - requestPb, pbErr := restoreExperimentToPb(&request) - if pbErr != nil { - return pbErr - } - - var restoreExperimentResponsePb restoreExperimentResponsePb + var restoreExperimentResponse RestoreExperimentResponse path := "/api/2.0/mlflow/experiments/restore" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &restoreExperimentResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &restoreExperimentResponse) return err } func (a *experimentsImpl) RestoreRun(ctx context.Context, request RestoreRun) error { - - requestPb, pbErr := restoreRunToPb(&request) - if pbErr != nil { - return pbErr - } - - var restoreRunResponsePb restoreRunResponsePb + var restoreRunResponse RestoreRunResponse path := "/api/2.0/mlflow/runs/restore" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &restoreRunResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &restoreRunResponse) return err } func (a *experimentsImpl) RestoreRuns(ctx context.Context, request RestoreRuns) (*RestoreRunsResponse, error) { - - requestPb, pbErr := restoreRunsToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var restoreRunsResponsePb restoreRunsResponsePb + var restoreRunsResponse RestoreRunsResponse path := "/api/2.0/mlflow/databricks/runs/restore-runs" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &restoreRunsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := restoreRunsResponseFromPb(&restoreRunsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &restoreRunsResponse) + return &restoreRunsResponse, err } // Searches for experiments that satisfy specified search criteria. @@ -1042,69 +460,25 @@ func (a *experimentsImpl) SearchExperimentsAll(ctx context.Context, request Sear } func (a *experimentsImpl) internalSearchExperiments(ctx context.Context, request SearchExperiments) (*SearchExperimentsResponse, error) { - - requestPb, pbErr := searchExperimentsToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var searchExperimentsResponsePb searchExperimentsResponsePb + var searchExperimentsResponse SearchExperimentsResponse path := "/api/2.0/mlflow/experiments/search" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &searchExperimentsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := searchExperimentsResponseFromPb(&searchExperimentsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &searchExperimentsResponse) + return &searchExperimentsResponse, err } func (a *experimentsImpl) SearchLoggedModels(ctx context.Context, request SearchLoggedModelsRequest) (*SearchLoggedModelsResponse, error) { - - requestPb, pbErr := searchLoggedModelsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var searchLoggedModelsResponsePb searchLoggedModelsResponsePb + var searchLoggedModelsResponse SearchLoggedModelsResponse path := "/api/2.0/mlflow/logged-models/search" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &searchLoggedModelsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := searchLoggedModelsResponseFromPb(&searchLoggedModelsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &searchLoggedModelsResponse) + return &searchLoggedModelsResponse, err } // Searches for runs that satisfy expressions. @@ -1143,251 +517,91 @@ func (a *experimentsImpl) SearchRunsAll(ctx context.Context, request SearchRuns) } func (a *experimentsImpl) internalSearchRuns(ctx context.Context, request SearchRuns) (*SearchRunsResponse, error) { - - requestPb, pbErr := searchRunsToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var searchRunsResponsePb searchRunsResponsePb + var searchRunsResponse SearchRunsResponse path := "/api/2.0/mlflow/runs/search" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &searchRunsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := searchRunsResponseFromPb(&searchRunsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &searchRunsResponse) + return &searchRunsResponse, err } func (a *experimentsImpl) SetExperimentTag(ctx context.Context, request SetExperimentTag) error { - - requestPb, pbErr := setExperimentTagToPb(&request) - if pbErr != nil { - return pbErr - } - - var setExperimentTagResponsePb setExperimentTagResponsePb + var setExperimentTagResponse SetExperimentTagResponse path := "/api/2.0/mlflow/experiments/set-experiment-tag" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &setExperimentTagResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &setExperimentTagResponse) return err } func (a *experimentsImpl) SetLoggedModelTags(ctx context.Context, request SetLoggedModelTagsRequest) error { - - requestPb, pbErr := setLoggedModelTagsRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var setLoggedModelTagsResponsePb setLoggedModelTagsResponsePb - path := fmt.Sprintf("/api/2.0/mlflow/logged-models/%v/tags", requestPb.ModelId) + var setLoggedModelTagsResponse SetLoggedModelTagsResponse + path := fmt.Sprintf("/api/2.0/mlflow/logged-models/%v/tags", request.ModelId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &setLoggedModelTagsResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &setLoggedModelTagsResponse) return err } func (a *experimentsImpl) SetPermissions(ctx context.Context, request ExperimentPermissionsRequest) (*ExperimentPermissions, error) { - - requestPb, pbErr := experimentPermissionsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var experimentPermissionsPb experimentPermissionsPb - path := fmt.Sprintf("/api/2.0/permissions/experiments/%v", requestPb.ExperimentId) + var experimentPermissions ExperimentPermissions + path := fmt.Sprintf("/api/2.0/permissions/experiments/%v", request.ExperimentId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPut, - path, - headers, - queryParams, - (*requestPb), - &experimentPermissionsPb, - ) - if err != nil { - return nil, err - } - resp, err := experimentPermissionsFromPb(&experimentPermissionsPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &experimentPermissions) + return &experimentPermissions, err } func (a *experimentsImpl) SetTag(ctx context.Context, request SetTag) error { - - requestPb, pbErr := setTagToPb(&request) - if pbErr != nil { - return pbErr - } - - var setTagResponsePb setTagResponsePb + var setTagResponse SetTagResponse path := "/api/2.0/mlflow/runs/set-tag" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &setTagResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &setTagResponse) return err } func (a *experimentsImpl) UpdateExperiment(ctx context.Context, request UpdateExperiment) error { - - requestPb, pbErr := updateExperimentToPb(&request) - if pbErr != nil { - return pbErr - } - - var updateExperimentResponsePb updateExperimentResponsePb + var updateExperimentResponse UpdateExperimentResponse path := "/api/2.0/mlflow/experiments/update" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &updateExperimentResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &updateExperimentResponse) return err } func (a *experimentsImpl) UpdatePermissions(ctx context.Context, request ExperimentPermissionsRequest) (*ExperimentPermissions, error) { - - requestPb, pbErr := experimentPermissionsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var experimentPermissionsPb experimentPermissionsPb - path := fmt.Sprintf("/api/2.0/permissions/experiments/%v", requestPb.ExperimentId) + var experimentPermissions ExperimentPermissions + path := fmt.Sprintf("/api/2.0/permissions/experiments/%v", request.ExperimentId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &experimentPermissionsPb, - ) - if err != nil { - return nil, err - } - resp, err := experimentPermissionsFromPb(&experimentPermissionsPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &experimentPermissions) + return &experimentPermissions, err } func (a *experimentsImpl) UpdateRun(ctx context.Context, request UpdateRun) (*UpdateRunResponse, error) { - - requestPb, pbErr := updateRunToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var updateRunResponsePb updateRunResponsePb + var updateRunResponse UpdateRunResponse path := "/api/2.0/mlflow/runs/update" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &updateRunResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := updateRunResponseFromPb(&updateRunResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &updateRunResponse) + return &updateRunResponse, err } // unexported type that holds implementations of just FeatureStore API methods @@ -1396,96 +610,34 @@ type featureStoreImpl struct { } func (a *featureStoreImpl) CreateOnlineStore(ctx context.Context, request CreateOnlineStoreRequest) (*OnlineStore, error) { - - requestPb, pbErr := createOnlineStoreRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var onlineStorePb onlineStorePb + var onlineStore OnlineStore path := "/api/2.0/feature-store/online-stores" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb).OnlineStore, - &onlineStorePb, - ) - if err != nil { - return nil, err - } - resp, err := onlineStoreFromPb(&onlineStorePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.OnlineStore, &onlineStore) + return &onlineStore, err } func (a *featureStoreImpl) DeleteOnlineStore(ctx context.Context, request DeleteOnlineStoreRequest) error { - - requestPb, pbErr := deleteOnlineStoreRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteOnlineStoreResponsePb deleteOnlineStoreResponsePb - path := fmt.Sprintf("/api/2.0/feature-store/online-stores/%v", requestPb.Name) + var deleteOnlineStoreResponse DeleteOnlineStoreResponse + path := fmt.Sprintf("/api/2.0/feature-store/online-stores/%v", request.Name) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteOnlineStoreResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteOnlineStoreResponse) return err } func (a *featureStoreImpl) GetOnlineStore(ctx context.Context, request GetOnlineStoreRequest) (*OnlineStore, error) { - - requestPb, pbErr := getOnlineStoreRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var onlineStorePb onlineStorePb - path := fmt.Sprintf("/api/2.0/feature-store/online-stores/%v", requestPb.Name) + var onlineStore OnlineStore + path := fmt.Sprintf("/api/2.0/feature-store/online-stores/%v", request.Name) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &onlineStorePb, - ) - if err != nil { - return nil, err - } - resp, err := onlineStoreFromPb(&onlineStorePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &onlineStore) + return &onlineStore, err } // List Online Feature Stores. @@ -1520,104 +672,38 @@ func (a *featureStoreImpl) ListOnlineStoresAll(ctx context.Context, request List } func (a *featureStoreImpl) internalListOnlineStores(ctx context.Context, request ListOnlineStoresRequest) (*ListOnlineStoresResponse, error) { - - requestPb, pbErr := listOnlineStoresRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listOnlineStoresResponsePb listOnlineStoresResponsePb + var listOnlineStoresResponse ListOnlineStoresResponse path := "/api/2.0/feature-store/online-stores" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listOnlineStoresResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listOnlineStoresResponseFromPb(&listOnlineStoresResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listOnlineStoresResponse) + return &listOnlineStoresResponse, err } func (a *featureStoreImpl) PublishTable(ctx context.Context, request PublishTableRequest) (*PublishTableResponse, error) { - - requestPb, pbErr := publishTableRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var publishTableResponsePb publishTableResponsePb - path := fmt.Sprintf("/api/2.0/feature-store/tables/%v/publish", requestPb.SourceTableName) + var publishTableResponse PublishTableResponse + path := fmt.Sprintf("/api/2.0/feature-store/tables/%v/publish", request.SourceTableName) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &publishTableResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := publishTableResponseFromPb(&publishTableResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &publishTableResponse) + return &publishTableResponse, err } func (a *featureStoreImpl) UpdateOnlineStore(ctx context.Context, request UpdateOnlineStoreRequest) (*OnlineStore, error) { - - requestPb, pbErr := updateOnlineStoreRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var onlineStorePb onlineStorePb - path := fmt.Sprintf("/api/2.0/feature-store/online-stores/%v", requestPb.Name) + var onlineStore OnlineStore + path := fmt.Sprintf("/api/2.0/feature-store/online-stores/%v", request.Name) queryParams := make(map[string]any) - if requestPb.UpdateMask != "" { - queryParams["update_mask"] = requestPb.UpdateMask + if request.UpdateMask != "" { + queryParams["update_mask"] = request.UpdateMask } headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb).OnlineStore, - &onlineStorePb, - ) - if err != nil { - return nil, err - } - resp, err := onlineStoreFromPb(&onlineStorePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.OnlineStore, &onlineStore) + return &onlineStore, err } // unexported type that holds implementations of just forecasting API methods @@ -1626,68 +712,24 @@ type forecastingImpl struct { } func (a *forecastingImpl) CreateExperiment(ctx context.Context, request CreateForecastingExperimentRequest) (*CreateForecastingExperimentResponse, error) { - - requestPb, pbErr := createForecastingExperimentRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var createForecastingExperimentResponsePb createForecastingExperimentResponsePb + var createForecastingExperimentResponse CreateForecastingExperimentResponse path := "/api/2.0/automl/create-forecasting-experiment" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &createForecastingExperimentResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := createForecastingExperimentResponseFromPb(&createForecastingExperimentResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &createForecastingExperimentResponse) + return &createForecastingExperimentResponse, err } func (a *forecastingImpl) GetExperiment(ctx context.Context, request GetForecastingExperimentRequest) (*ForecastingExperiment, error) { - - requestPb, pbErr := getForecastingExperimentRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var forecastingExperimentPb forecastingExperimentPb - path := fmt.Sprintf("/api/2.0/automl/get-forecasting-experiment/%v", requestPb.ExperimentId) + var forecastingExperiment ForecastingExperiment + path := fmt.Sprintf("/api/2.0/automl/get-forecasting-experiment/%v", request.ExperimentId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &forecastingExperimentPb, - ) - if err != nil { - return nil, err - } - resp, err := forecastingExperimentFromPb(&forecastingExperimentPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &forecastingExperiment) + return &forecastingExperiment, err } // unexported type that holds implementations of just ModelRegistry API methods @@ -1696,396 +738,138 @@ type modelRegistryImpl struct { } func (a *modelRegistryImpl) ApproveTransitionRequest(ctx context.Context, request ApproveTransitionRequest) (*ApproveTransitionRequestResponse, error) { - - requestPb, pbErr := approveTransitionRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var approveTransitionRequestResponsePb approveTransitionRequestResponsePb + var approveTransitionRequestResponse ApproveTransitionRequestResponse path := "/api/2.0/mlflow/transition-requests/approve" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &approveTransitionRequestResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := approveTransitionRequestResponseFromPb(&approveTransitionRequestResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &approveTransitionRequestResponse) + return &approveTransitionRequestResponse, err } func (a *modelRegistryImpl) CreateComment(ctx context.Context, request CreateComment) (*CreateCommentResponse, error) { - - requestPb, pbErr := createCommentToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var createCommentResponsePb createCommentResponsePb + var createCommentResponse CreateCommentResponse path := "/api/2.0/mlflow/comments/create" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &createCommentResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := createCommentResponseFromPb(&createCommentResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &createCommentResponse) + return &createCommentResponse, err } func (a *modelRegistryImpl) CreateModel(ctx context.Context, request CreateModelRequest) (*CreateModelResponse, error) { - - requestPb, pbErr := createModelRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var createModelResponsePb createModelResponsePb + var createModelResponse CreateModelResponse path := "/api/2.0/mlflow/registered-models/create" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &createModelResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := createModelResponseFromPb(&createModelResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &createModelResponse) + return &createModelResponse, err } func (a *modelRegistryImpl) CreateModelVersion(ctx context.Context, request CreateModelVersionRequest) (*CreateModelVersionResponse, error) { - - requestPb, pbErr := createModelVersionRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var createModelVersionResponsePb createModelVersionResponsePb + var createModelVersionResponse CreateModelVersionResponse path := "/api/2.0/mlflow/model-versions/create" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &createModelVersionResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := createModelVersionResponseFromPb(&createModelVersionResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &createModelVersionResponse) + return &createModelVersionResponse, err } func (a *modelRegistryImpl) CreateTransitionRequest(ctx context.Context, request CreateTransitionRequest) (*CreateTransitionRequestResponse, error) { - - requestPb, pbErr := createTransitionRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var createTransitionRequestResponsePb createTransitionRequestResponsePb + var createTransitionRequestResponse CreateTransitionRequestResponse path := "/api/2.0/mlflow/transition-requests/create" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &createTransitionRequestResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := createTransitionRequestResponseFromPb(&createTransitionRequestResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &createTransitionRequestResponse) + return &createTransitionRequestResponse, err } func (a *modelRegistryImpl) CreateWebhook(ctx context.Context, request CreateRegistryWebhook) (*CreateWebhookResponse, error) { - - requestPb, pbErr := createRegistryWebhookToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var createWebhookResponsePb createWebhookResponsePb + var createWebhookResponse CreateWebhookResponse path := "/api/2.0/mlflow/registry-webhooks/create" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &createWebhookResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := createWebhookResponseFromPb(&createWebhookResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &createWebhookResponse) + return &createWebhookResponse, err } func (a *modelRegistryImpl) DeleteComment(ctx context.Context, request DeleteCommentRequest) error { - - requestPb, pbErr := deleteCommentRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteCommentResponsePb deleteCommentResponsePb + var deleteCommentResponse DeleteCommentResponse path := "/api/2.0/mlflow/comments/delete" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteCommentResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteCommentResponse) return err } func (a *modelRegistryImpl) DeleteModel(ctx context.Context, request DeleteModelRequest) error { - - requestPb, pbErr := deleteModelRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteModelResponsePb deleteModelResponsePb + var deleteModelResponse DeleteModelResponse path := "/api/2.0/mlflow/registered-models/delete" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteModelResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteModelResponse) return err } func (a *modelRegistryImpl) DeleteModelTag(ctx context.Context, request DeleteModelTagRequest) error { - - requestPb, pbErr := deleteModelTagRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteModelTagResponsePb deleteModelTagResponsePb + var deleteModelTagResponse DeleteModelTagResponse path := "/api/2.0/mlflow/registered-models/delete-tag" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteModelTagResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteModelTagResponse) return err } func (a *modelRegistryImpl) DeleteModelVersion(ctx context.Context, request DeleteModelVersionRequest) error { - - requestPb, pbErr := deleteModelVersionRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteModelVersionResponsePb deleteModelVersionResponsePb + var deleteModelVersionResponse DeleteModelVersionResponse path := "/api/2.0/mlflow/model-versions/delete" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteModelVersionResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteModelVersionResponse) return err } func (a *modelRegistryImpl) DeleteModelVersionTag(ctx context.Context, request DeleteModelVersionTagRequest) error { - - requestPb, pbErr := deleteModelVersionTagRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteModelVersionTagResponsePb deleteModelVersionTagResponsePb + var deleteModelVersionTagResponse DeleteModelVersionTagResponse path := "/api/2.0/mlflow/model-versions/delete-tag" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteModelVersionTagResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteModelVersionTagResponse) return err } func (a *modelRegistryImpl) DeleteTransitionRequest(ctx context.Context, request DeleteTransitionRequestRequest) error { - - requestPb, pbErr := deleteTransitionRequestRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteTransitionRequestResponsePb deleteTransitionRequestResponsePb + var deleteTransitionRequestResponse DeleteTransitionRequestResponse path := "/api/2.0/mlflow/transition-requests/delete" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteTransitionRequestResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteTransitionRequestResponse) return err } func (a *modelRegistryImpl) DeleteWebhook(ctx context.Context, request DeleteWebhookRequest) error { - - requestPb, pbErr := deleteWebhookRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteWebhookResponsePb deleteWebhookResponsePb + var deleteWebhookResponse DeleteWebhookResponse path := "/api/2.0/mlflow/registry-webhooks/delete" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteWebhookResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteWebhookResponse) return err } @@ -2115,196 +899,64 @@ func (a *modelRegistryImpl) GetLatestVersionsAll(ctx context.Context, request Ge } func (a *modelRegistryImpl) internalGetLatestVersions(ctx context.Context, request GetLatestVersionsRequest) (*GetLatestVersionsResponse, error) { - - requestPb, pbErr := getLatestVersionsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var getLatestVersionsResponsePb getLatestVersionsResponsePb + var getLatestVersionsResponse GetLatestVersionsResponse path := "/api/2.0/mlflow/registered-models/get-latest-versions" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &getLatestVersionsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := getLatestVersionsResponseFromPb(&getLatestVersionsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &getLatestVersionsResponse) + return &getLatestVersionsResponse, err } func (a *modelRegistryImpl) GetModel(ctx context.Context, request GetModelRequest) (*GetModelResponse, error) { - - requestPb, pbErr := getModelRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var getModelResponsePb getModelResponsePb + var getModelResponse GetModelResponse path := "/api/2.0/mlflow/databricks/registered-models/get" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &getModelResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := getModelResponseFromPb(&getModelResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getModelResponse) + return &getModelResponse, err } func (a *modelRegistryImpl) GetModelVersion(ctx context.Context, request GetModelVersionRequest) (*GetModelVersionResponse, error) { - - requestPb, pbErr := getModelVersionRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var getModelVersionResponsePb getModelVersionResponsePb + var getModelVersionResponse GetModelVersionResponse path := "/api/2.0/mlflow/model-versions/get" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &getModelVersionResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := getModelVersionResponseFromPb(&getModelVersionResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getModelVersionResponse) + return &getModelVersionResponse, err } func (a *modelRegistryImpl) GetModelVersionDownloadUri(ctx context.Context, request GetModelVersionDownloadUriRequest) (*GetModelVersionDownloadUriResponse, error) { - - requestPb, pbErr := getModelVersionDownloadUriRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var getModelVersionDownloadUriResponsePb getModelVersionDownloadUriResponsePb + var getModelVersionDownloadUriResponse GetModelVersionDownloadUriResponse path := "/api/2.0/mlflow/model-versions/get-download-uri" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &getModelVersionDownloadUriResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := getModelVersionDownloadUriResponseFromPb(&getModelVersionDownloadUriResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getModelVersionDownloadUriResponse) + return &getModelVersionDownloadUriResponse, err } func (a *modelRegistryImpl) GetPermissionLevels(ctx context.Context, request GetRegisteredModelPermissionLevelsRequest) (*GetRegisteredModelPermissionLevelsResponse, error) { - - requestPb, pbErr := getRegisteredModelPermissionLevelsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var getRegisteredModelPermissionLevelsResponsePb getRegisteredModelPermissionLevelsResponsePb - path := fmt.Sprintf("/api/2.0/permissions/registered-models/%v/permissionLevels", requestPb.RegisteredModelId) + var getRegisteredModelPermissionLevelsResponse GetRegisteredModelPermissionLevelsResponse + path := fmt.Sprintf("/api/2.0/permissions/registered-models/%v/permissionLevels", request.RegisteredModelId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &getRegisteredModelPermissionLevelsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := getRegisteredModelPermissionLevelsResponseFromPb(&getRegisteredModelPermissionLevelsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getRegisteredModelPermissionLevelsResponse) + return &getRegisteredModelPermissionLevelsResponse, err } func (a *modelRegistryImpl) GetPermissions(ctx context.Context, request GetRegisteredModelPermissionsRequest) (*RegisteredModelPermissions, error) { - - requestPb, pbErr := getRegisteredModelPermissionsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var registeredModelPermissionsPb registeredModelPermissionsPb - path := fmt.Sprintf("/api/2.0/permissions/registered-models/%v", requestPb.RegisteredModelId) + var registeredModelPermissions RegisteredModelPermissions + path := fmt.Sprintf("/api/2.0/permissions/registered-models/%v", request.RegisteredModelId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - ®isteredModelPermissionsPb, - ) - if err != nil { - return nil, err - } - resp, err := registeredModelPermissionsFromPb(®isteredModelPermissionsPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, ®isteredModelPermissions) + return ®isteredModelPermissions, err } // Lists all available registered models, up to the limit specified in @@ -2341,35 +993,13 @@ func (a *modelRegistryImpl) ListModelsAll(ctx context.Context, request ListModel } func (a *modelRegistryImpl) internalListModels(ctx context.Context, request ListModelsRequest) (*ListModelsResponse, error) { - - requestPb, pbErr := listModelsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listModelsResponsePb listModelsResponsePb + var listModelsResponse ListModelsResponse path := "/api/2.0/mlflow/registered-models/list" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listModelsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listModelsResponseFromPb(&listModelsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listModelsResponse) + return &listModelsResponse, err } // Gets a list of all open stage transition requests for the model version. @@ -2398,35 +1028,13 @@ func (a *modelRegistryImpl) ListTransitionRequestsAll(ctx context.Context, reque } func (a *modelRegistryImpl) internalListTransitionRequests(ctx context.Context, request ListTransitionRequestsRequest) (*ListTransitionRequestsResponse, error) { - - requestPb, pbErr := listTransitionRequestsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listTransitionRequestsResponsePb listTransitionRequestsResponsePb + var listTransitionRequestsResponse ListTransitionRequestsResponse path := "/api/2.0/mlflow/transition-requests/list" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listTransitionRequestsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listTransitionRequestsResponseFromPb(&listTransitionRequestsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listTransitionRequestsResponse) + return &listTransitionRequestsResponse, err } // **NOTE:** This endpoint is in Public Preview. @@ -2465,101 +1073,35 @@ func (a *modelRegistryImpl) ListWebhooksAll(ctx context.Context, request ListWeb } func (a *modelRegistryImpl) internalListWebhooks(ctx context.Context, request ListWebhooksRequest) (*ListRegistryWebhooks, error) { - - requestPb, pbErr := listWebhooksRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listRegistryWebhooksPb listRegistryWebhooksPb + var listRegistryWebhooks ListRegistryWebhooks path := "/api/2.0/mlflow/registry-webhooks/list" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listRegistryWebhooksPb, - ) - if err != nil { - return nil, err - } - resp, err := listRegistryWebhooksFromPb(&listRegistryWebhooksPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listRegistryWebhooks) + return &listRegistryWebhooks, err } func (a *modelRegistryImpl) RejectTransitionRequest(ctx context.Context, request RejectTransitionRequest) (*RejectTransitionRequestResponse, error) { - - requestPb, pbErr := rejectTransitionRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var rejectTransitionRequestResponsePb rejectTransitionRequestResponsePb + var rejectTransitionRequestResponse RejectTransitionRequestResponse path := "/api/2.0/mlflow/transition-requests/reject" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &rejectTransitionRequestResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := rejectTransitionRequestResponseFromPb(&rejectTransitionRequestResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &rejectTransitionRequestResponse) + return &rejectTransitionRequestResponse, err } func (a *modelRegistryImpl) RenameModel(ctx context.Context, request RenameModelRequest) (*RenameModelResponse, error) { - - requestPb, pbErr := renameModelRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var renameModelResponsePb renameModelResponsePb + var renameModelResponse RenameModelResponse path := "/api/2.0/mlflow/registered-models/rename" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &renameModelResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := renameModelResponseFromPb(&renameModelResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &renameModelResponse) + return &renameModelResponse, err } // Searches for specific model versions based on the supplied __filter__. @@ -2594,35 +1136,13 @@ func (a *modelRegistryImpl) SearchModelVersionsAll(ctx context.Context, request } func (a *modelRegistryImpl) internalSearchModelVersions(ctx context.Context, request SearchModelVersionsRequest) (*SearchModelVersionsResponse, error) { - - requestPb, pbErr := searchModelVersionsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var searchModelVersionsResponsePb searchModelVersionsResponsePb + var searchModelVersionsResponse SearchModelVersionsResponse path := "/api/2.0/mlflow/model-versions/search" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &searchModelVersionsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := searchModelVersionsResponseFromPb(&searchModelVersionsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &searchModelVersionsResponse) + return &searchModelVersionsResponse, err } // Search for registered models based on the specified __filter__. @@ -2657,343 +1177,121 @@ func (a *modelRegistryImpl) SearchModelsAll(ctx context.Context, request SearchM } func (a *modelRegistryImpl) internalSearchModels(ctx context.Context, request SearchModelsRequest) (*SearchModelsResponse, error) { - - requestPb, pbErr := searchModelsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var searchModelsResponsePb searchModelsResponsePb + var searchModelsResponse SearchModelsResponse path := "/api/2.0/mlflow/registered-models/search" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &searchModelsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := searchModelsResponseFromPb(&searchModelsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &searchModelsResponse) + return &searchModelsResponse, err } func (a *modelRegistryImpl) SetModelTag(ctx context.Context, request SetModelTagRequest) error { - - requestPb, pbErr := setModelTagRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var setModelTagResponsePb setModelTagResponsePb + var setModelTagResponse SetModelTagResponse path := "/api/2.0/mlflow/registered-models/set-tag" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &setModelTagResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &setModelTagResponse) return err } func (a *modelRegistryImpl) SetModelVersionTag(ctx context.Context, request SetModelVersionTagRequest) error { - - requestPb, pbErr := setModelVersionTagRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var setModelVersionTagResponsePb setModelVersionTagResponsePb + var setModelVersionTagResponse SetModelVersionTagResponse path := "/api/2.0/mlflow/model-versions/set-tag" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &setModelVersionTagResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &setModelVersionTagResponse) return err } func (a *modelRegistryImpl) SetPermissions(ctx context.Context, request RegisteredModelPermissionsRequest) (*RegisteredModelPermissions, error) { - - requestPb, pbErr := registeredModelPermissionsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var registeredModelPermissionsPb registeredModelPermissionsPb - path := fmt.Sprintf("/api/2.0/permissions/registered-models/%v", requestPb.RegisteredModelId) + var registeredModelPermissions RegisteredModelPermissions + path := fmt.Sprintf("/api/2.0/permissions/registered-models/%v", request.RegisteredModelId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPut, - path, - headers, - queryParams, - (*requestPb), - ®isteredModelPermissionsPb, - ) - if err != nil { - return nil, err - } - resp, err := registeredModelPermissionsFromPb(®isteredModelPermissionsPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, ®isteredModelPermissions) + return ®isteredModelPermissions, err } func (a *modelRegistryImpl) TestRegistryWebhook(ctx context.Context, request TestRegistryWebhookRequest) (*TestRegistryWebhookResponse, error) { - - requestPb, pbErr := testRegistryWebhookRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var testRegistryWebhookResponsePb testRegistryWebhookResponsePb + var testRegistryWebhookResponse TestRegistryWebhookResponse path := "/api/2.0/mlflow/registry-webhooks/test" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &testRegistryWebhookResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := testRegistryWebhookResponseFromPb(&testRegistryWebhookResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &testRegistryWebhookResponse) + return &testRegistryWebhookResponse, err } func (a *modelRegistryImpl) TransitionStage(ctx context.Context, request TransitionModelVersionStageDatabricks) (*TransitionStageResponse, error) { - - requestPb, pbErr := transitionModelVersionStageDatabricksToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var transitionStageResponsePb transitionStageResponsePb + var transitionStageResponse TransitionStageResponse path := "/api/2.0/mlflow/databricks/model-versions/transition-stage" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &transitionStageResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := transitionStageResponseFromPb(&transitionStageResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &transitionStageResponse) + return &transitionStageResponse, err } func (a *modelRegistryImpl) UpdateComment(ctx context.Context, request UpdateComment) (*UpdateCommentResponse, error) { - - requestPb, pbErr := updateCommentToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var updateCommentResponsePb updateCommentResponsePb + var updateCommentResponse UpdateCommentResponse path := "/api/2.0/mlflow/comments/update" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &updateCommentResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := updateCommentResponseFromPb(&updateCommentResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &updateCommentResponse) + return &updateCommentResponse, err } func (a *modelRegistryImpl) UpdateModel(ctx context.Context, request UpdateModelRequest) error { - - requestPb, pbErr := updateModelRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var updateModelResponsePb updateModelResponsePb + var updateModelResponse UpdateModelResponse path := "/api/2.0/mlflow/registered-models/update" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &updateModelResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &updateModelResponse) return err } func (a *modelRegistryImpl) UpdateModelVersion(ctx context.Context, request UpdateModelVersionRequest) error { - - requestPb, pbErr := updateModelVersionRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var updateModelVersionResponsePb updateModelVersionResponsePb + var updateModelVersionResponse UpdateModelVersionResponse path := "/api/2.0/mlflow/model-versions/update" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &updateModelVersionResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &updateModelVersionResponse) return err } func (a *modelRegistryImpl) UpdatePermissions(ctx context.Context, request RegisteredModelPermissionsRequest) (*RegisteredModelPermissions, error) { - - requestPb, pbErr := registeredModelPermissionsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var registeredModelPermissionsPb registeredModelPermissionsPb - path := fmt.Sprintf("/api/2.0/permissions/registered-models/%v", requestPb.RegisteredModelId) + var registeredModelPermissions RegisteredModelPermissions + path := fmt.Sprintf("/api/2.0/permissions/registered-models/%v", request.RegisteredModelId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - ®isteredModelPermissionsPb, - ) - if err != nil { - return nil, err - } - resp, err := registeredModelPermissionsFromPb(®isteredModelPermissionsPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, ®isteredModelPermissions) + return ®isteredModelPermissions, err } func (a *modelRegistryImpl) UpdateWebhook(ctx context.Context, request UpdateRegistryWebhook) error { - - requestPb, pbErr := updateRegistryWebhookToPb(&request) - if pbErr != nil { - return pbErr - } - - var updateWebhookResponsePb updateWebhookResponsePb + var updateWebhookResponse UpdateWebhookResponse path := "/api/2.0/mlflow/registry-webhooks/update" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &updateWebhookResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &updateWebhookResponse) return err } diff --git a/service/ml/internal.go b/service/ml/internal.go deleted file mode 100755 index 19f7a8fd6..000000000 --- a/service/ml/internal.go +++ /dev/null @@ -1,7031 +0,0 @@ -// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. - -package ml - -import ( - "fmt" - "strings" - "time" - - "github.com/databricks/databricks-sdk-go/marshal" -) - -func activityToPb(st *Activity) (*activityPb, error) { - if st == nil { - return nil, nil - } - pb := &activityPb{} - pb.ActivityType = st.ActivityType - pb.Comment = st.Comment - pb.CreationTimestamp = st.CreationTimestamp - pb.FromStage = st.FromStage - pb.Id = st.Id - pb.LastUpdatedTimestamp = st.LastUpdatedTimestamp - pb.SystemComment = st.SystemComment - pb.ToStage = st.ToStage - pb.UserId = st.UserId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type activityPb struct { - ActivityType ActivityType `json:"activity_type,omitempty"` - Comment string `json:"comment,omitempty"` - CreationTimestamp int64 `json:"creation_timestamp,omitempty"` - FromStage Stage `json:"from_stage,omitempty"` - Id string `json:"id,omitempty"` - LastUpdatedTimestamp int64 `json:"last_updated_timestamp,omitempty"` - SystemComment string `json:"system_comment,omitempty"` - ToStage Stage `json:"to_stage,omitempty"` - UserId string `json:"user_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func activityFromPb(pb *activityPb) (*Activity, error) { - if pb == nil { - return nil, nil - } - st := &Activity{} - st.ActivityType = pb.ActivityType - st.Comment = pb.Comment - st.CreationTimestamp = pb.CreationTimestamp - st.FromStage = pb.FromStage - st.Id = pb.Id - st.LastUpdatedTimestamp = pb.LastUpdatedTimestamp - st.SystemComment = pb.SystemComment - st.ToStage = pb.ToStage - st.UserId = pb.UserId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *activityPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st activityPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func approveTransitionRequestToPb(st *ApproveTransitionRequest) (*approveTransitionRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &approveTransitionRequestPb{} - pb.ArchiveExistingVersions = st.ArchiveExistingVersions - pb.Comment = st.Comment - pb.Name = st.Name - pb.Stage = st.Stage - pb.Version = st.Version - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type approveTransitionRequestPb struct { - ArchiveExistingVersions bool `json:"archive_existing_versions"` - Comment string `json:"comment,omitempty"` - Name string `json:"name"` - Stage Stage `json:"stage"` - Version string `json:"version"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func approveTransitionRequestFromPb(pb *approveTransitionRequestPb) (*ApproveTransitionRequest, error) { - if pb == nil { - return nil, nil - } - st := &ApproveTransitionRequest{} - st.ArchiveExistingVersions = pb.ArchiveExistingVersions - st.Comment = pb.Comment - st.Name = pb.Name - st.Stage = pb.Stage - st.Version = pb.Version - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *approveTransitionRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st approveTransitionRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func approveTransitionRequestResponseToPb(st *ApproveTransitionRequestResponse) (*approveTransitionRequestResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &approveTransitionRequestResponsePb{} - pb.Activity = st.Activity - - return pb, nil -} - -type approveTransitionRequestResponsePb struct { - Activity *Activity `json:"activity,omitempty"` -} - -func approveTransitionRequestResponseFromPb(pb *approveTransitionRequestResponsePb) (*ApproveTransitionRequestResponse, error) { - if pb == nil { - return nil, nil - } - st := &ApproveTransitionRequestResponse{} - st.Activity = pb.Activity - - return st, nil -} - -func commentObjectToPb(st *CommentObject) (*commentObjectPb, error) { - if st == nil { - return nil, nil - } - pb := &commentObjectPb{} - pb.AvailableActions = st.AvailableActions - pb.Comment = st.Comment - pb.CreationTimestamp = st.CreationTimestamp - pb.Id = st.Id - pb.LastUpdatedTimestamp = st.LastUpdatedTimestamp - pb.UserId = st.UserId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type commentObjectPb struct { - AvailableActions []CommentActivityAction `json:"available_actions,omitempty"` - Comment string `json:"comment,omitempty"` - CreationTimestamp int64 `json:"creation_timestamp,omitempty"` - Id string `json:"id,omitempty"` - LastUpdatedTimestamp int64 `json:"last_updated_timestamp,omitempty"` - UserId string `json:"user_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func commentObjectFromPb(pb *commentObjectPb) (*CommentObject, error) { - if pb == nil { - return nil, nil - } - st := &CommentObject{} - st.AvailableActions = pb.AvailableActions - st.Comment = pb.Comment - st.CreationTimestamp = pb.CreationTimestamp - st.Id = pb.Id - st.LastUpdatedTimestamp = pb.LastUpdatedTimestamp - st.UserId = pb.UserId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *commentObjectPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st commentObjectPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createCommentToPb(st *CreateComment) (*createCommentPb, error) { - if st == nil { - return nil, nil - } - pb := &createCommentPb{} - pb.Comment = st.Comment - pb.Name = st.Name - pb.Version = st.Version - - return pb, nil -} - -type createCommentPb struct { - Comment string `json:"comment"` - Name string `json:"name"` - Version string `json:"version"` -} - -func createCommentFromPb(pb *createCommentPb) (*CreateComment, error) { - if pb == nil { - return nil, nil - } - st := &CreateComment{} - st.Comment = pb.Comment - st.Name = pb.Name - st.Version = pb.Version - - return st, nil -} - -func createCommentResponseToPb(st *CreateCommentResponse) (*createCommentResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &createCommentResponsePb{} - pb.Comment = st.Comment - - return pb, nil -} - -type createCommentResponsePb struct { - Comment *CommentObject `json:"comment,omitempty"` -} - -func createCommentResponseFromPb(pb *createCommentResponsePb) (*CreateCommentResponse, error) { - if pb == nil { - return nil, nil - } - st := &CreateCommentResponse{} - st.Comment = pb.Comment - - return st, nil -} - -func createExperimentToPb(st *CreateExperiment) (*createExperimentPb, error) { - if st == nil { - return nil, nil - } - pb := &createExperimentPb{} - pb.ArtifactLocation = st.ArtifactLocation - pb.Name = st.Name - pb.Tags = st.Tags - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createExperimentPb struct { - ArtifactLocation string `json:"artifact_location,omitempty"` - Name string `json:"name"` - Tags []ExperimentTag `json:"tags,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createExperimentFromPb(pb *createExperimentPb) (*CreateExperiment, error) { - if pb == nil { - return nil, nil - } - st := &CreateExperiment{} - st.ArtifactLocation = pb.ArtifactLocation - st.Name = pb.Name - st.Tags = pb.Tags - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createExperimentPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createExperimentPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createExperimentResponseToPb(st *CreateExperimentResponse) (*createExperimentResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &createExperimentResponsePb{} - pb.ExperimentId = st.ExperimentId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createExperimentResponsePb struct { - ExperimentId string `json:"experiment_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createExperimentResponseFromPb(pb *createExperimentResponsePb) (*CreateExperimentResponse, error) { - if pb == nil { - return nil, nil - } - st := &CreateExperimentResponse{} - st.ExperimentId = pb.ExperimentId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createExperimentResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createExperimentResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createForecastingExperimentRequestToPb(st *CreateForecastingExperimentRequest) (*createForecastingExperimentRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &createForecastingExperimentRequestPb{} - pb.CustomWeightsColumn = st.CustomWeightsColumn - pb.ExperimentPath = st.ExperimentPath - pb.ForecastGranularity = st.ForecastGranularity - pb.ForecastHorizon = st.ForecastHorizon - pb.FutureFeatureDataPath = st.FutureFeatureDataPath - pb.HolidayRegions = st.HolidayRegions - pb.IncludeFeatures = st.IncludeFeatures - pb.MaxRuntime = st.MaxRuntime - pb.PredictionDataPath = st.PredictionDataPath - pb.PrimaryMetric = st.PrimaryMetric - pb.RegisterTo = st.RegisterTo - pb.SplitColumn = st.SplitColumn - pb.TargetColumn = st.TargetColumn - pb.TimeColumn = st.TimeColumn - pb.TimeseriesIdentifierColumns = st.TimeseriesIdentifierColumns - pb.TrainDataPath = st.TrainDataPath - pb.TrainingFrameworks = st.TrainingFrameworks - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createForecastingExperimentRequestPb struct { - CustomWeightsColumn string `json:"custom_weights_column,omitempty"` - ExperimentPath string `json:"experiment_path,omitempty"` - ForecastGranularity string `json:"forecast_granularity"` - ForecastHorizon int64 `json:"forecast_horizon"` - FutureFeatureDataPath string `json:"future_feature_data_path,omitempty"` - HolidayRegions []string `json:"holiday_regions,omitempty"` - IncludeFeatures []string `json:"include_features,omitempty"` - MaxRuntime int64 `json:"max_runtime,omitempty"` - PredictionDataPath string `json:"prediction_data_path,omitempty"` - PrimaryMetric string `json:"primary_metric,omitempty"` - RegisterTo string `json:"register_to,omitempty"` - SplitColumn string `json:"split_column,omitempty"` - TargetColumn string `json:"target_column"` - TimeColumn string `json:"time_column"` - TimeseriesIdentifierColumns []string `json:"timeseries_identifier_columns,omitempty"` - TrainDataPath string `json:"train_data_path"` - TrainingFrameworks []string `json:"training_frameworks,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createForecastingExperimentRequestFromPb(pb *createForecastingExperimentRequestPb) (*CreateForecastingExperimentRequest, error) { - if pb == nil { - return nil, nil - } - st := &CreateForecastingExperimentRequest{} - st.CustomWeightsColumn = pb.CustomWeightsColumn - st.ExperimentPath = pb.ExperimentPath - st.ForecastGranularity = pb.ForecastGranularity - st.ForecastHorizon = pb.ForecastHorizon - st.FutureFeatureDataPath = pb.FutureFeatureDataPath - st.HolidayRegions = pb.HolidayRegions - st.IncludeFeatures = pb.IncludeFeatures - st.MaxRuntime = pb.MaxRuntime - st.PredictionDataPath = pb.PredictionDataPath - st.PrimaryMetric = pb.PrimaryMetric - st.RegisterTo = pb.RegisterTo - st.SplitColumn = pb.SplitColumn - st.TargetColumn = pb.TargetColumn - st.TimeColumn = pb.TimeColumn - st.TimeseriesIdentifierColumns = pb.TimeseriesIdentifierColumns - st.TrainDataPath = pb.TrainDataPath - st.TrainingFrameworks = pb.TrainingFrameworks - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createForecastingExperimentRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createForecastingExperimentRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createForecastingExperimentResponseToPb(st *CreateForecastingExperimentResponse) (*createForecastingExperimentResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &createForecastingExperimentResponsePb{} - pb.ExperimentId = st.ExperimentId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createForecastingExperimentResponsePb struct { - ExperimentId string `json:"experiment_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createForecastingExperimentResponseFromPb(pb *createForecastingExperimentResponsePb) (*CreateForecastingExperimentResponse, error) { - if pb == nil { - return nil, nil - } - st := &CreateForecastingExperimentResponse{} - st.ExperimentId = pb.ExperimentId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createForecastingExperimentResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createForecastingExperimentResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createLoggedModelRequestToPb(st *CreateLoggedModelRequest) (*createLoggedModelRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &createLoggedModelRequestPb{} - pb.ExperimentId = st.ExperimentId - pb.ModelType = st.ModelType - pb.Name = st.Name - pb.Params = st.Params - pb.SourceRunId = st.SourceRunId - pb.Tags = st.Tags - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createLoggedModelRequestPb struct { - ExperimentId string `json:"experiment_id"` - ModelType string `json:"model_type,omitempty"` - Name string `json:"name,omitempty"` - Params []LoggedModelParameter `json:"params,omitempty"` - SourceRunId string `json:"source_run_id,omitempty"` - Tags []LoggedModelTag `json:"tags,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createLoggedModelRequestFromPb(pb *createLoggedModelRequestPb) (*CreateLoggedModelRequest, error) { - if pb == nil { - return nil, nil - } - st := &CreateLoggedModelRequest{} - st.ExperimentId = pb.ExperimentId - st.ModelType = pb.ModelType - st.Name = pb.Name - st.Params = pb.Params - st.SourceRunId = pb.SourceRunId - st.Tags = pb.Tags - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createLoggedModelRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createLoggedModelRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createLoggedModelResponseToPb(st *CreateLoggedModelResponse) (*createLoggedModelResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &createLoggedModelResponsePb{} - pb.Model = st.Model - - return pb, nil -} - -type createLoggedModelResponsePb struct { - Model *LoggedModel `json:"model,omitempty"` -} - -func createLoggedModelResponseFromPb(pb *createLoggedModelResponsePb) (*CreateLoggedModelResponse, error) { - if pb == nil { - return nil, nil - } - st := &CreateLoggedModelResponse{} - st.Model = pb.Model - - return st, nil -} - -func createModelRequestToPb(st *CreateModelRequest) (*createModelRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &createModelRequestPb{} - pb.Description = st.Description - pb.Name = st.Name - pb.Tags = st.Tags - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createModelRequestPb struct { - Description string `json:"description,omitempty"` - Name string `json:"name"` - Tags []ModelTag `json:"tags,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createModelRequestFromPb(pb *createModelRequestPb) (*CreateModelRequest, error) { - if pb == nil { - return nil, nil - } - st := &CreateModelRequest{} - st.Description = pb.Description - st.Name = pb.Name - st.Tags = pb.Tags - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createModelRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createModelRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createModelResponseToPb(st *CreateModelResponse) (*createModelResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &createModelResponsePb{} - pb.RegisteredModel = st.RegisteredModel - - return pb, nil -} - -type createModelResponsePb struct { - RegisteredModel *Model `json:"registered_model,omitempty"` -} - -func createModelResponseFromPb(pb *createModelResponsePb) (*CreateModelResponse, error) { - if pb == nil { - return nil, nil - } - st := &CreateModelResponse{} - st.RegisteredModel = pb.RegisteredModel - - return st, nil -} - -func createModelVersionRequestToPb(st *CreateModelVersionRequest) (*createModelVersionRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &createModelVersionRequestPb{} - pb.Description = st.Description - pb.Name = st.Name - pb.RunId = st.RunId - pb.RunLink = st.RunLink - pb.Source = st.Source - pb.Tags = st.Tags - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createModelVersionRequestPb struct { - Description string `json:"description,omitempty"` - Name string `json:"name"` - RunId string `json:"run_id,omitempty"` - RunLink string `json:"run_link,omitempty"` - Source string `json:"source"` - Tags []ModelVersionTag `json:"tags,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createModelVersionRequestFromPb(pb *createModelVersionRequestPb) (*CreateModelVersionRequest, error) { - if pb == nil { - return nil, nil - } - st := &CreateModelVersionRequest{} - st.Description = pb.Description - st.Name = pb.Name - st.RunId = pb.RunId - st.RunLink = pb.RunLink - st.Source = pb.Source - st.Tags = pb.Tags - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createModelVersionRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createModelVersionRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createModelVersionResponseToPb(st *CreateModelVersionResponse) (*createModelVersionResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &createModelVersionResponsePb{} - pb.ModelVersion = st.ModelVersion - - return pb, nil -} - -type createModelVersionResponsePb struct { - ModelVersion *ModelVersion `json:"model_version,omitempty"` -} - -func createModelVersionResponseFromPb(pb *createModelVersionResponsePb) (*CreateModelVersionResponse, error) { - if pb == nil { - return nil, nil - } - st := &CreateModelVersionResponse{} - st.ModelVersion = pb.ModelVersion - - return st, nil -} - -func createOnlineStoreRequestToPb(st *CreateOnlineStoreRequest) (*createOnlineStoreRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &createOnlineStoreRequestPb{} - pb.OnlineStore = st.OnlineStore - - return pb, nil -} - -type createOnlineStoreRequestPb struct { - OnlineStore OnlineStore `json:"online_store"` -} - -func createOnlineStoreRequestFromPb(pb *createOnlineStoreRequestPb) (*CreateOnlineStoreRequest, error) { - if pb == nil { - return nil, nil - } - st := &CreateOnlineStoreRequest{} - st.OnlineStore = pb.OnlineStore - - return st, nil -} - -func createRegistryWebhookToPb(st *CreateRegistryWebhook) (*createRegistryWebhookPb, error) { - if st == nil { - return nil, nil - } - pb := &createRegistryWebhookPb{} - pb.Description = st.Description - pb.Events = st.Events - pb.HttpUrlSpec = st.HttpUrlSpec - pb.JobSpec = st.JobSpec - pb.ModelName = st.ModelName - pb.Status = st.Status - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createRegistryWebhookPb struct { - Description string `json:"description,omitempty"` - Events []RegistryWebhookEvent `json:"events"` - HttpUrlSpec *HttpUrlSpec `json:"http_url_spec,omitempty"` - JobSpec *JobSpec `json:"job_spec,omitempty"` - ModelName string `json:"model_name,omitempty"` - Status RegistryWebhookStatus `json:"status,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createRegistryWebhookFromPb(pb *createRegistryWebhookPb) (*CreateRegistryWebhook, error) { - if pb == nil { - return nil, nil - } - st := &CreateRegistryWebhook{} - st.Description = pb.Description - st.Events = pb.Events - st.HttpUrlSpec = pb.HttpUrlSpec - st.JobSpec = pb.JobSpec - st.ModelName = pb.ModelName - st.Status = pb.Status - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createRegistryWebhookPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createRegistryWebhookPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createRunToPb(st *CreateRun) (*createRunPb, error) { - if st == nil { - return nil, nil - } - pb := &createRunPb{} - pb.ExperimentId = st.ExperimentId - pb.RunName = st.RunName - pb.StartTime = st.StartTime - pb.Tags = st.Tags - pb.UserId = st.UserId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createRunPb struct { - ExperimentId string `json:"experiment_id,omitempty"` - RunName string `json:"run_name,omitempty"` - StartTime int64 `json:"start_time,omitempty"` - Tags []RunTag `json:"tags,omitempty"` - UserId string `json:"user_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createRunFromPb(pb *createRunPb) (*CreateRun, error) { - if pb == nil { - return nil, nil - } - st := &CreateRun{} - st.ExperimentId = pb.ExperimentId - st.RunName = pb.RunName - st.StartTime = pb.StartTime - st.Tags = pb.Tags - st.UserId = pb.UserId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createRunPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createRunPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createRunResponseToPb(st *CreateRunResponse) (*createRunResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &createRunResponsePb{} - pb.Run = st.Run - - return pb, nil -} - -type createRunResponsePb struct { - Run *Run `json:"run,omitempty"` -} - -func createRunResponseFromPb(pb *createRunResponsePb) (*CreateRunResponse, error) { - if pb == nil { - return nil, nil - } - st := &CreateRunResponse{} - st.Run = pb.Run - - return st, nil -} - -func createTransitionRequestToPb(st *CreateTransitionRequest) (*createTransitionRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &createTransitionRequestPb{} - pb.Comment = st.Comment - pb.Name = st.Name - pb.Stage = st.Stage - pb.Version = st.Version - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createTransitionRequestPb struct { - Comment string `json:"comment,omitempty"` - Name string `json:"name"` - Stage Stage `json:"stage"` - Version string `json:"version"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createTransitionRequestFromPb(pb *createTransitionRequestPb) (*CreateTransitionRequest, error) { - if pb == nil { - return nil, nil - } - st := &CreateTransitionRequest{} - st.Comment = pb.Comment - st.Name = pb.Name - st.Stage = pb.Stage - st.Version = pb.Version - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createTransitionRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createTransitionRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createTransitionRequestResponseToPb(st *CreateTransitionRequestResponse) (*createTransitionRequestResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &createTransitionRequestResponsePb{} - pb.Request = st.Request - - return pb, nil -} - -type createTransitionRequestResponsePb struct { - Request *TransitionRequest `json:"request,omitempty"` -} - -func createTransitionRequestResponseFromPb(pb *createTransitionRequestResponsePb) (*CreateTransitionRequestResponse, error) { - if pb == nil { - return nil, nil - } - st := &CreateTransitionRequestResponse{} - st.Request = pb.Request - - return st, nil -} - -func createWebhookResponseToPb(st *CreateWebhookResponse) (*createWebhookResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &createWebhookResponsePb{} - pb.Webhook = st.Webhook - - return pb, nil -} - -type createWebhookResponsePb struct { - Webhook *RegistryWebhook `json:"webhook,omitempty"` -} - -func createWebhookResponseFromPb(pb *createWebhookResponsePb) (*CreateWebhookResponse, error) { - if pb == nil { - return nil, nil - } - st := &CreateWebhookResponse{} - st.Webhook = pb.Webhook - - return st, nil -} - -func datasetToPb(st *Dataset) (*datasetPb, error) { - if st == nil { - return nil, nil - } - pb := &datasetPb{} - pb.Digest = st.Digest - pb.Name = st.Name - pb.Profile = st.Profile - pb.Schema = st.Schema - pb.Source = st.Source - pb.SourceType = st.SourceType - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type datasetPb struct { - Digest string `json:"digest"` - Name string `json:"name"` - Profile string `json:"profile,omitempty"` - Schema string `json:"schema,omitempty"` - Source string `json:"source"` - SourceType string `json:"source_type"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func datasetFromPb(pb *datasetPb) (*Dataset, error) { - if pb == nil { - return nil, nil - } - st := &Dataset{} - st.Digest = pb.Digest - st.Name = pb.Name - st.Profile = pb.Profile - st.Schema = pb.Schema - st.Source = pb.Source - st.SourceType = pb.SourceType - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *datasetPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st datasetPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func datasetInputToPb(st *DatasetInput) (*datasetInputPb, error) { - if st == nil { - return nil, nil - } - pb := &datasetInputPb{} - pb.Dataset = st.Dataset - pb.Tags = st.Tags - - return pb, nil -} - -type datasetInputPb struct { - Dataset Dataset `json:"dataset"` - Tags []InputTag `json:"tags,omitempty"` -} - -func datasetInputFromPb(pb *datasetInputPb) (*DatasetInput, error) { - if pb == nil { - return nil, nil - } - st := &DatasetInput{} - st.Dataset = pb.Dataset - st.Tags = pb.Tags - - return st, nil -} - -func deleteCommentRequestToPb(st *DeleteCommentRequest) (*deleteCommentRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteCommentRequestPb{} - pb.Id = st.Id - - return pb, nil -} - -type deleteCommentRequestPb struct { - Id string `json:"-" url:"id"` -} - -func deleteCommentRequestFromPb(pb *deleteCommentRequestPb) (*DeleteCommentRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteCommentRequest{} - st.Id = pb.Id - - return st, nil -} - -func deleteCommentResponseToPb(st *DeleteCommentResponse) (*deleteCommentResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteCommentResponsePb{} - - return pb, nil -} - -type deleteCommentResponsePb struct { -} - -func deleteCommentResponseFromPb(pb *deleteCommentResponsePb) (*DeleteCommentResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteCommentResponse{} - - return st, nil -} - -func deleteExperimentToPb(st *DeleteExperiment) (*deleteExperimentPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteExperimentPb{} - pb.ExperimentId = st.ExperimentId - - return pb, nil -} - -type deleteExperimentPb struct { - ExperimentId string `json:"experiment_id"` -} - -func deleteExperimentFromPb(pb *deleteExperimentPb) (*DeleteExperiment, error) { - if pb == nil { - return nil, nil - } - st := &DeleteExperiment{} - st.ExperimentId = pb.ExperimentId - - return st, nil -} - -func deleteExperimentResponseToPb(st *DeleteExperimentResponse) (*deleteExperimentResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteExperimentResponsePb{} - - return pb, nil -} - -type deleteExperimentResponsePb struct { -} - -func deleteExperimentResponseFromPb(pb *deleteExperimentResponsePb) (*DeleteExperimentResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteExperimentResponse{} - - return st, nil -} - -func deleteLoggedModelRequestToPb(st *DeleteLoggedModelRequest) (*deleteLoggedModelRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteLoggedModelRequestPb{} - pb.ModelId = st.ModelId - - return pb, nil -} - -type deleteLoggedModelRequestPb struct { - ModelId string `json:"-" url:"-"` -} - -func deleteLoggedModelRequestFromPb(pb *deleteLoggedModelRequestPb) (*DeleteLoggedModelRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteLoggedModelRequest{} - st.ModelId = pb.ModelId - - return st, nil -} - -func deleteLoggedModelResponseToPb(st *DeleteLoggedModelResponse) (*deleteLoggedModelResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteLoggedModelResponsePb{} - - return pb, nil -} - -type deleteLoggedModelResponsePb struct { -} - -func deleteLoggedModelResponseFromPb(pb *deleteLoggedModelResponsePb) (*DeleteLoggedModelResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteLoggedModelResponse{} - - return st, nil -} - -func deleteLoggedModelTagRequestToPb(st *DeleteLoggedModelTagRequest) (*deleteLoggedModelTagRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteLoggedModelTagRequestPb{} - pb.ModelId = st.ModelId - pb.TagKey = st.TagKey - - return pb, nil -} - -type deleteLoggedModelTagRequestPb struct { - ModelId string `json:"-" url:"-"` - TagKey string `json:"-" url:"-"` -} - -func deleteLoggedModelTagRequestFromPb(pb *deleteLoggedModelTagRequestPb) (*DeleteLoggedModelTagRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteLoggedModelTagRequest{} - st.ModelId = pb.ModelId - st.TagKey = pb.TagKey - - return st, nil -} - -func deleteLoggedModelTagResponseToPb(st *DeleteLoggedModelTagResponse) (*deleteLoggedModelTagResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteLoggedModelTagResponsePb{} - - return pb, nil -} - -type deleteLoggedModelTagResponsePb struct { -} - -func deleteLoggedModelTagResponseFromPb(pb *deleteLoggedModelTagResponsePb) (*DeleteLoggedModelTagResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteLoggedModelTagResponse{} - - return st, nil -} - -func deleteModelRequestToPb(st *DeleteModelRequest) (*deleteModelRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteModelRequestPb{} - pb.Name = st.Name - - return pb, nil -} - -type deleteModelRequestPb struct { - Name string `json:"-" url:"name"` -} - -func deleteModelRequestFromPb(pb *deleteModelRequestPb) (*DeleteModelRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteModelRequest{} - st.Name = pb.Name - - return st, nil -} - -func deleteModelResponseToPb(st *DeleteModelResponse) (*deleteModelResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteModelResponsePb{} - - return pb, nil -} - -type deleteModelResponsePb struct { -} - -func deleteModelResponseFromPb(pb *deleteModelResponsePb) (*DeleteModelResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteModelResponse{} - - return st, nil -} - -func deleteModelTagRequestToPb(st *DeleteModelTagRequest) (*deleteModelTagRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteModelTagRequestPb{} - pb.Key = st.Key - pb.Name = st.Name - - return pb, nil -} - -type deleteModelTagRequestPb struct { - Key string `json:"-" url:"key"` - Name string `json:"-" url:"name"` -} - -func deleteModelTagRequestFromPb(pb *deleteModelTagRequestPb) (*DeleteModelTagRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteModelTagRequest{} - st.Key = pb.Key - st.Name = pb.Name - - return st, nil -} - -func deleteModelTagResponseToPb(st *DeleteModelTagResponse) (*deleteModelTagResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteModelTagResponsePb{} - - return pb, nil -} - -type deleteModelTagResponsePb struct { -} - -func deleteModelTagResponseFromPb(pb *deleteModelTagResponsePb) (*DeleteModelTagResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteModelTagResponse{} - - return st, nil -} - -func deleteModelVersionRequestToPb(st *DeleteModelVersionRequest) (*deleteModelVersionRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteModelVersionRequestPb{} - pb.Name = st.Name - pb.Version = st.Version - - return pb, nil -} - -type deleteModelVersionRequestPb struct { - Name string `json:"-" url:"name"` - Version string `json:"-" url:"version"` -} - -func deleteModelVersionRequestFromPb(pb *deleteModelVersionRequestPb) (*DeleteModelVersionRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteModelVersionRequest{} - st.Name = pb.Name - st.Version = pb.Version - - return st, nil -} - -func deleteModelVersionResponseToPb(st *DeleteModelVersionResponse) (*deleteModelVersionResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteModelVersionResponsePb{} - - return pb, nil -} - -type deleteModelVersionResponsePb struct { -} - -func deleteModelVersionResponseFromPb(pb *deleteModelVersionResponsePb) (*DeleteModelVersionResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteModelVersionResponse{} - - return st, nil -} - -func deleteModelVersionTagRequestToPb(st *DeleteModelVersionTagRequest) (*deleteModelVersionTagRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteModelVersionTagRequestPb{} - pb.Key = st.Key - pb.Name = st.Name - pb.Version = st.Version - - return pb, nil -} - -type deleteModelVersionTagRequestPb struct { - Key string `json:"-" url:"key"` - Name string `json:"-" url:"name"` - Version string `json:"-" url:"version"` -} - -func deleteModelVersionTagRequestFromPb(pb *deleteModelVersionTagRequestPb) (*DeleteModelVersionTagRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteModelVersionTagRequest{} - st.Key = pb.Key - st.Name = pb.Name - st.Version = pb.Version - - return st, nil -} - -func deleteModelVersionTagResponseToPb(st *DeleteModelVersionTagResponse) (*deleteModelVersionTagResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteModelVersionTagResponsePb{} - - return pb, nil -} - -type deleteModelVersionTagResponsePb struct { -} - -func deleteModelVersionTagResponseFromPb(pb *deleteModelVersionTagResponsePb) (*DeleteModelVersionTagResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteModelVersionTagResponse{} - - return st, nil -} - -func deleteOnlineStoreRequestToPb(st *DeleteOnlineStoreRequest) (*deleteOnlineStoreRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteOnlineStoreRequestPb{} - pb.Name = st.Name - - return pb, nil -} - -type deleteOnlineStoreRequestPb struct { - Name string `json:"-" url:"-"` -} - -func deleteOnlineStoreRequestFromPb(pb *deleteOnlineStoreRequestPb) (*DeleteOnlineStoreRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteOnlineStoreRequest{} - st.Name = pb.Name - - return st, nil -} - -func deleteOnlineStoreResponseToPb(st *DeleteOnlineStoreResponse) (*deleteOnlineStoreResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteOnlineStoreResponsePb{} - - return pb, nil -} - -type deleteOnlineStoreResponsePb struct { -} - -func deleteOnlineStoreResponseFromPb(pb *deleteOnlineStoreResponsePb) (*DeleteOnlineStoreResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteOnlineStoreResponse{} - - return st, nil -} - -func deleteRunToPb(st *DeleteRun) (*deleteRunPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteRunPb{} - pb.RunId = st.RunId - - return pb, nil -} - -type deleteRunPb struct { - RunId string `json:"run_id"` -} - -func deleteRunFromPb(pb *deleteRunPb) (*DeleteRun, error) { - if pb == nil { - return nil, nil - } - st := &DeleteRun{} - st.RunId = pb.RunId - - return st, nil -} - -func deleteRunResponseToPb(st *DeleteRunResponse) (*deleteRunResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteRunResponsePb{} - - return pb, nil -} - -type deleteRunResponsePb struct { -} - -func deleteRunResponseFromPb(pb *deleteRunResponsePb) (*DeleteRunResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteRunResponse{} - - return st, nil -} - -func deleteRunsToPb(st *DeleteRuns) (*deleteRunsPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteRunsPb{} - pb.ExperimentId = st.ExperimentId - pb.MaxRuns = st.MaxRuns - pb.MaxTimestampMillis = st.MaxTimestampMillis - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type deleteRunsPb struct { - ExperimentId string `json:"experiment_id"` - MaxRuns int `json:"max_runs,omitempty"` - MaxTimestampMillis int64 `json:"max_timestamp_millis"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func deleteRunsFromPb(pb *deleteRunsPb) (*DeleteRuns, error) { - if pb == nil { - return nil, nil - } - st := &DeleteRuns{} - st.ExperimentId = pb.ExperimentId - st.MaxRuns = pb.MaxRuns - st.MaxTimestampMillis = pb.MaxTimestampMillis - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *deleteRunsPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st deleteRunsPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func deleteRunsResponseToPb(st *DeleteRunsResponse) (*deleteRunsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteRunsResponsePb{} - pb.RunsDeleted = st.RunsDeleted - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type deleteRunsResponsePb struct { - RunsDeleted int `json:"runs_deleted,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func deleteRunsResponseFromPb(pb *deleteRunsResponsePb) (*DeleteRunsResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteRunsResponse{} - st.RunsDeleted = pb.RunsDeleted - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *deleteRunsResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st deleteRunsResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func deleteTagToPb(st *DeleteTag) (*deleteTagPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteTagPb{} - pb.Key = st.Key - pb.RunId = st.RunId - - return pb, nil -} - -type deleteTagPb struct { - Key string `json:"key"` - RunId string `json:"run_id"` -} - -func deleteTagFromPb(pb *deleteTagPb) (*DeleteTag, error) { - if pb == nil { - return nil, nil - } - st := &DeleteTag{} - st.Key = pb.Key - st.RunId = pb.RunId - - return st, nil -} - -func deleteTagResponseToPb(st *DeleteTagResponse) (*deleteTagResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteTagResponsePb{} - - return pb, nil -} - -type deleteTagResponsePb struct { -} - -func deleteTagResponseFromPb(pb *deleteTagResponsePb) (*DeleteTagResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteTagResponse{} - - return st, nil -} - -func deleteTransitionRequestRequestToPb(st *DeleteTransitionRequestRequest) (*deleteTransitionRequestRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteTransitionRequestRequestPb{} - pb.Comment = st.Comment - pb.Creator = st.Creator - pb.Name = st.Name - pb.Stage = st.Stage - pb.Version = st.Version - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type deleteTransitionRequestRequestPb struct { - Comment string `json:"-" url:"comment,omitempty"` - Creator string `json:"-" url:"creator"` - Name string `json:"-" url:"name"` - Stage DeleteTransitionRequestStage `json:"-" url:"stage"` - Version string `json:"-" url:"version"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func deleteTransitionRequestRequestFromPb(pb *deleteTransitionRequestRequestPb) (*DeleteTransitionRequestRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteTransitionRequestRequest{} - st.Comment = pb.Comment - st.Creator = pb.Creator - st.Name = pb.Name - st.Stage = pb.Stage - st.Version = pb.Version - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *deleteTransitionRequestRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st deleteTransitionRequestRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func deleteTransitionRequestResponseToPb(st *DeleteTransitionRequestResponse) (*deleteTransitionRequestResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteTransitionRequestResponsePb{} - - return pb, nil -} - -type deleteTransitionRequestResponsePb struct { -} - -func deleteTransitionRequestResponseFromPb(pb *deleteTransitionRequestResponsePb) (*DeleteTransitionRequestResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteTransitionRequestResponse{} - - return st, nil -} - -func deleteWebhookRequestToPb(st *DeleteWebhookRequest) (*deleteWebhookRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteWebhookRequestPb{} - pb.Id = st.Id - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type deleteWebhookRequestPb struct { - Id string `json:"-" url:"id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func deleteWebhookRequestFromPb(pb *deleteWebhookRequestPb) (*DeleteWebhookRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteWebhookRequest{} - st.Id = pb.Id - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *deleteWebhookRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st deleteWebhookRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func deleteWebhookResponseToPb(st *DeleteWebhookResponse) (*deleteWebhookResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteWebhookResponsePb{} - - return pb, nil -} - -type deleteWebhookResponsePb struct { -} - -func deleteWebhookResponseFromPb(pb *deleteWebhookResponsePb) (*DeleteWebhookResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteWebhookResponse{} - - return st, nil -} - -func experimentToPb(st *Experiment) (*experimentPb, error) { - if st == nil { - return nil, nil - } - pb := &experimentPb{} - pb.ArtifactLocation = st.ArtifactLocation - pb.CreationTime = st.CreationTime - pb.ExperimentId = st.ExperimentId - pb.LastUpdateTime = st.LastUpdateTime - pb.LifecycleStage = st.LifecycleStage - pb.Name = st.Name - pb.Tags = st.Tags - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type experimentPb struct { - ArtifactLocation string `json:"artifact_location,omitempty"` - CreationTime int64 `json:"creation_time,omitempty"` - ExperimentId string `json:"experiment_id,omitempty"` - LastUpdateTime int64 `json:"last_update_time,omitempty"` - LifecycleStage string `json:"lifecycle_stage,omitempty"` - Name string `json:"name,omitempty"` - Tags []ExperimentTag `json:"tags,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func experimentFromPb(pb *experimentPb) (*Experiment, error) { - if pb == nil { - return nil, nil - } - st := &Experiment{} - st.ArtifactLocation = pb.ArtifactLocation - st.CreationTime = pb.CreationTime - st.ExperimentId = pb.ExperimentId - st.LastUpdateTime = pb.LastUpdateTime - st.LifecycleStage = pb.LifecycleStage - st.Name = pb.Name - st.Tags = pb.Tags - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *experimentPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st experimentPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func experimentAccessControlRequestToPb(st *ExperimentAccessControlRequest) (*experimentAccessControlRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &experimentAccessControlRequestPb{} - pb.GroupName = st.GroupName - pb.PermissionLevel = st.PermissionLevel - pb.ServicePrincipalName = st.ServicePrincipalName - pb.UserName = st.UserName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type experimentAccessControlRequestPb struct { - GroupName string `json:"group_name,omitempty"` - PermissionLevel ExperimentPermissionLevel `json:"permission_level,omitempty"` - ServicePrincipalName string `json:"service_principal_name,omitempty"` - UserName string `json:"user_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func experimentAccessControlRequestFromPb(pb *experimentAccessControlRequestPb) (*ExperimentAccessControlRequest, error) { - if pb == nil { - return nil, nil - } - st := &ExperimentAccessControlRequest{} - st.GroupName = pb.GroupName - st.PermissionLevel = pb.PermissionLevel - st.ServicePrincipalName = pb.ServicePrincipalName - st.UserName = pb.UserName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *experimentAccessControlRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st experimentAccessControlRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func experimentAccessControlResponseToPb(st *ExperimentAccessControlResponse) (*experimentAccessControlResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &experimentAccessControlResponsePb{} - pb.AllPermissions = st.AllPermissions - pb.DisplayName = st.DisplayName - pb.GroupName = st.GroupName - pb.ServicePrincipalName = st.ServicePrincipalName - pb.UserName = st.UserName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type experimentAccessControlResponsePb struct { - AllPermissions []ExperimentPermission `json:"all_permissions,omitempty"` - DisplayName string `json:"display_name,omitempty"` - GroupName string `json:"group_name,omitempty"` - ServicePrincipalName string `json:"service_principal_name,omitempty"` - UserName string `json:"user_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func experimentAccessControlResponseFromPb(pb *experimentAccessControlResponsePb) (*ExperimentAccessControlResponse, error) { - if pb == nil { - return nil, nil - } - st := &ExperimentAccessControlResponse{} - st.AllPermissions = pb.AllPermissions - st.DisplayName = pb.DisplayName - st.GroupName = pb.GroupName - st.ServicePrincipalName = pb.ServicePrincipalName - st.UserName = pb.UserName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *experimentAccessControlResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st experimentAccessControlResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func experimentPermissionToPb(st *ExperimentPermission) (*experimentPermissionPb, error) { - if st == nil { - return nil, nil - } - pb := &experimentPermissionPb{} - pb.Inherited = st.Inherited - pb.InheritedFromObject = st.InheritedFromObject - pb.PermissionLevel = st.PermissionLevel - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type experimentPermissionPb struct { - Inherited bool `json:"inherited,omitempty"` - InheritedFromObject []string `json:"inherited_from_object,omitempty"` - PermissionLevel ExperimentPermissionLevel `json:"permission_level,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func experimentPermissionFromPb(pb *experimentPermissionPb) (*ExperimentPermission, error) { - if pb == nil { - return nil, nil - } - st := &ExperimentPermission{} - st.Inherited = pb.Inherited - st.InheritedFromObject = pb.InheritedFromObject - st.PermissionLevel = pb.PermissionLevel - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *experimentPermissionPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st experimentPermissionPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func experimentPermissionsToPb(st *ExperimentPermissions) (*experimentPermissionsPb, error) { - if st == nil { - return nil, nil - } - pb := &experimentPermissionsPb{} - pb.AccessControlList = st.AccessControlList - pb.ObjectId = st.ObjectId - pb.ObjectType = st.ObjectType - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type experimentPermissionsPb struct { - AccessControlList []ExperimentAccessControlResponse `json:"access_control_list,omitempty"` - ObjectId string `json:"object_id,omitempty"` - ObjectType string `json:"object_type,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func experimentPermissionsFromPb(pb *experimentPermissionsPb) (*ExperimentPermissions, error) { - if pb == nil { - return nil, nil - } - st := &ExperimentPermissions{} - st.AccessControlList = pb.AccessControlList - st.ObjectId = pb.ObjectId - st.ObjectType = pb.ObjectType - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *experimentPermissionsPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st experimentPermissionsPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func experimentPermissionsDescriptionToPb(st *ExperimentPermissionsDescription) (*experimentPermissionsDescriptionPb, error) { - if st == nil { - return nil, nil - } - pb := &experimentPermissionsDescriptionPb{} - pb.Description = st.Description - pb.PermissionLevel = st.PermissionLevel - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type experimentPermissionsDescriptionPb struct { - Description string `json:"description,omitempty"` - PermissionLevel ExperimentPermissionLevel `json:"permission_level,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func experimentPermissionsDescriptionFromPb(pb *experimentPermissionsDescriptionPb) (*ExperimentPermissionsDescription, error) { - if pb == nil { - return nil, nil - } - st := &ExperimentPermissionsDescription{} - st.Description = pb.Description - st.PermissionLevel = pb.PermissionLevel - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *experimentPermissionsDescriptionPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st experimentPermissionsDescriptionPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func experimentPermissionsRequestToPb(st *ExperimentPermissionsRequest) (*experimentPermissionsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &experimentPermissionsRequestPb{} - pb.AccessControlList = st.AccessControlList - pb.ExperimentId = st.ExperimentId - - return pb, nil -} - -type experimentPermissionsRequestPb struct { - AccessControlList []ExperimentAccessControlRequest `json:"access_control_list,omitempty"` - ExperimentId string `json:"-" url:"-"` -} - -func experimentPermissionsRequestFromPb(pb *experimentPermissionsRequestPb) (*ExperimentPermissionsRequest, error) { - if pb == nil { - return nil, nil - } - st := &ExperimentPermissionsRequest{} - st.AccessControlList = pb.AccessControlList - st.ExperimentId = pb.ExperimentId - - return st, nil -} - -func experimentTagToPb(st *ExperimentTag) (*experimentTagPb, error) { - if st == nil { - return nil, nil - } - pb := &experimentTagPb{} - pb.Key = st.Key - pb.Value = st.Value - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type experimentTagPb struct { - Key string `json:"key,omitempty"` - Value string `json:"value,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func experimentTagFromPb(pb *experimentTagPb) (*ExperimentTag, error) { - if pb == nil { - return nil, nil - } - st := &ExperimentTag{} - st.Key = pb.Key - st.Value = pb.Value - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *experimentTagPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st experimentTagPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func fileInfoToPb(st *FileInfo) (*fileInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &fileInfoPb{} - pb.FileSize = st.FileSize - pb.IsDir = st.IsDir - pb.Path = st.Path - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type fileInfoPb struct { - FileSize int64 `json:"file_size,omitempty"` - IsDir bool `json:"is_dir,omitempty"` - Path string `json:"path,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func fileInfoFromPb(pb *fileInfoPb) (*FileInfo, error) { - if pb == nil { - return nil, nil - } - st := &FileInfo{} - st.FileSize = pb.FileSize - st.IsDir = pb.IsDir - st.Path = pb.Path - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *fileInfoPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st fileInfoPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func finalizeLoggedModelRequestToPb(st *FinalizeLoggedModelRequest) (*finalizeLoggedModelRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &finalizeLoggedModelRequestPb{} - pb.ModelId = st.ModelId - pb.Status = st.Status - - return pb, nil -} - -type finalizeLoggedModelRequestPb struct { - ModelId string `json:"-" url:"-"` - Status LoggedModelStatus `json:"status"` -} - -func finalizeLoggedModelRequestFromPb(pb *finalizeLoggedModelRequestPb) (*FinalizeLoggedModelRequest, error) { - if pb == nil { - return nil, nil - } - st := &FinalizeLoggedModelRequest{} - st.ModelId = pb.ModelId - st.Status = pb.Status - - return st, nil -} - -func finalizeLoggedModelResponseToPb(st *FinalizeLoggedModelResponse) (*finalizeLoggedModelResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &finalizeLoggedModelResponsePb{} - pb.Model = st.Model - - return pb, nil -} - -type finalizeLoggedModelResponsePb struct { - Model *LoggedModel `json:"model,omitempty"` -} - -func finalizeLoggedModelResponseFromPb(pb *finalizeLoggedModelResponsePb) (*FinalizeLoggedModelResponse, error) { - if pb == nil { - return nil, nil - } - st := &FinalizeLoggedModelResponse{} - st.Model = pb.Model - - return st, nil -} - -func forecastingExperimentToPb(st *ForecastingExperiment) (*forecastingExperimentPb, error) { - if st == nil { - return nil, nil - } - pb := &forecastingExperimentPb{} - pb.ExperimentId = st.ExperimentId - pb.ExperimentPageUrl = st.ExperimentPageUrl - pb.State = st.State - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type forecastingExperimentPb struct { - ExperimentId string `json:"experiment_id,omitempty"` - ExperimentPageUrl string `json:"experiment_page_url,omitempty"` - State ForecastingExperimentState `json:"state,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func forecastingExperimentFromPb(pb *forecastingExperimentPb) (*ForecastingExperiment, error) { - if pb == nil { - return nil, nil - } - st := &ForecastingExperiment{} - st.ExperimentId = pb.ExperimentId - st.ExperimentPageUrl = pb.ExperimentPageUrl - st.State = pb.State - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *forecastingExperimentPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st forecastingExperimentPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getByNameRequestToPb(st *GetByNameRequest) (*getByNameRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getByNameRequestPb{} - pb.ExperimentName = st.ExperimentName - - return pb, nil -} - -type getByNameRequestPb struct { - ExperimentName string `json:"-" url:"experiment_name"` -} - -func getByNameRequestFromPb(pb *getByNameRequestPb) (*GetByNameRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetByNameRequest{} - st.ExperimentName = pb.ExperimentName - - return st, nil -} - -func getExperimentByNameResponseToPb(st *GetExperimentByNameResponse) (*getExperimentByNameResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &getExperimentByNameResponsePb{} - pb.Experiment = st.Experiment - - return pb, nil -} - -type getExperimentByNameResponsePb struct { - Experiment *Experiment `json:"experiment,omitempty"` -} - -func getExperimentByNameResponseFromPb(pb *getExperimentByNameResponsePb) (*GetExperimentByNameResponse, error) { - if pb == nil { - return nil, nil - } - st := &GetExperimentByNameResponse{} - st.Experiment = pb.Experiment - - return st, nil -} - -func getExperimentPermissionLevelsRequestToPb(st *GetExperimentPermissionLevelsRequest) (*getExperimentPermissionLevelsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getExperimentPermissionLevelsRequestPb{} - pb.ExperimentId = st.ExperimentId - - return pb, nil -} - -type getExperimentPermissionLevelsRequestPb struct { - ExperimentId string `json:"-" url:"-"` -} - -func getExperimentPermissionLevelsRequestFromPb(pb *getExperimentPermissionLevelsRequestPb) (*GetExperimentPermissionLevelsRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetExperimentPermissionLevelsRequest{} - st.ExperimentId = pb.ExperimentId - - return st, nil -} - -func getExperimentPermissionLevelsResponseToPb(st *GetExperimentPermissionLevelsResponse) (*getExperimentPermissionLevelsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &getExperimentPermissionLevelsResponsePb{} - pb.PermissionLevels = st.PermissionLevels - - return pb, nil -} - -type getExperimentPermissionLevelsResponsePb struct { - PermissionLevels []ExperimentPermissionsDescription `json:"permission_levels,omitempty"` -} - -func getExperimentPermissionLevelsResponseFromPb(pb *getExperimentPermissionLevelsResponsePb) (*GetExperimentPermissionLevelsResponse, error) { - if pb == nil { - return nil, nil - } - st := &GetExperimentPermissionLevelsResponse{} - st.PermissionLevels = pb.PermissionLevels - - return st, nil -} - -func getExperimentPermissionsRequestToPb(st *GetExperimentPermissionsRequest) (*getExperimentPermissionsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getExperimentPermissionsRequestPb{} - pb.ExperimentId = st.ExperimentId - - return pb, nil -} - -type getExperimentPermissionsRequestPb struct { - ExperimentId string `json:"-" url:"-"` -} - -func getExperimentPermissionsRequestFromPb(pb *getExperimentPermissionsRequestPb) (*GetExperimentPermissionsRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetExperimentPermissionsRequest{} - st.ExperimentId = pb.ExperimentId - - return st, nil -} - -func getExperimentRequestToPb(st *GetExperimentRequest) (*getExperimentRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getExperimentRequestPb{} - pb.ExperimentId = st.ExperimentId - - return pb, nil -} - -type getExperimentRequestPb struct { - ExperimentId string `json:"-" url:"experiment_id"` -} - -func getExperimentRequestFromPb(pb *getExperimentRequestPb) (*GetExperimentRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetExperimentRequest{} - st.ExperimentId = pb.ExperimentId - - return st, nil -} - -func getExperimentResponseToPb(st *GetExperimentResponse) (*getExperimentResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &getExperimentResponsePb{} - pb.Experiment = st.Experiment - - return pb, nil -} - -type getExperimentResponsePb struct { - Experiment *Experiment `json:"experiment,omitempty"` -} - -func getExperimentResponseFromPb(pb *getExperimentResponsePb) (*GetExperimentResponse, error) { - if pb == nil { - return nil, nil - } - st := &GetExperimentResponse{} - st.Experiment = pb.Experiment - - return st, nil -} - -func getForecastingExperimentRequestToPb(st *GetForecastingExperimentRequest) (*getForecastingExperimentRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getForecastingExperimentRequestPb{} - pb.ExperimentId = st.ExperimentId - - return pb, nil -} - -type getForecastingExperimentRequestPb struct { - ExperimentId string `json:"-" url:"-"` -} - -func getForecastingExperimentRequestFromPb(pb *getForecastingExperimentRequestPb) (*GetForecastingExperimentRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetForecastingExperimentRequest{} - st.ExperimentId = pb.ExperimentId - - return st, nil -} - -func getHistoryRequestToPb(st *GetHistoryRequest) (*getHistoryRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getHistoryRequestPb{} - pb.MaxResults = st.MaxResults - pb.MetricKey = st.MetricKey - pb.PageToken = st.PageToken - pb.RunId = st.RunId - pb.RunUuid = st.RunUuid - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getHistoryRequestPb struct { - MaxResults int `json:"-" url:"max_results,omitempty"` - MetricKey string `json:"-" url:"metric_key"` - PageToken string `json:"-" url:"page_token,omitempty"` - RunId string `json:"-" url:"run_id,omitempty"` - RunUuid string `json:"-" url:"run_uuid,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getHistoryRequestFromPb(pb *getHistoryRequestPb) (*GetHistoryRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetHistoryRequest{} - st.MaxResults = pb.MaxResults - st.MetricKey = pb.MetricKey - st.PageToken = pb.PageToken - st.RunId = pb.RunId - st.RunUuid = pb.RunUuid - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getHistoryRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getHistoryRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getLatestVersionsRequestToPb(st *GetLatestVersionsRequest) (*getLatestVersionsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getLatestVersionsRequestPb{} - pb.Name = st.Name - pb.Stages = st.Stages - - return pb, nil -} - -type getLatestVersionsRequestPb struct { - Name string `json:"name"` - Stages []string `json:"stages,omitempty"` -} - -func getLatestVersionsRequestFromPb(pb *getLatestVersionsRequestPb) (*GetLatestVersionsRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetLatestVersionsRequest{} - st.Name = pb.Name - st.Stages = pb.Stages - - return st, nil -} - -func getLatestVersionsResponseToPb(st *GetLatestVersionsResponse) (*getLatestVersionsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &getLatestVersionsResponsePb{} - pb.ModelVersions = st.ModelVersions - - return pb, nil -} - -type getLatestVersionsResponsePb struct { - ModelVersions []ModelVersion `json:"model_versions,omitempty"` -} - -func getLatestVersionsResponseFromPb(pb *getLatestVersionsResponsePb) (*GetLatestVersionsResponse, error) { - if pb == nil { - return nil, nil - } - st := &GetLatestVersionsResponse{} - st.ModelVersions = pb.ModelVersions - - return st, nil -} - -func getLoggedModelRequestToPb(st *GetLoggedModelRequest) (*getLoggedModelRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getLoggedModelRequestPb{} - pb.ModelId = st.ModelId - - return pb, nil -} - -type getLoggedModelRequestPb struct { - ModelId string `json:"-" url:"-"` -} - -func getLoggedModelRequestFromPb(pb *getLoggedModelRequestPb) (*GetLoggedModelRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetLoggedModelRequest{} - st.ModelId = pb.ModelId - - return st, nil -} - -func getLoggedModelResponseToPb(st *GetLoggedModelResponse) (*getLoggedModelResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &getLoggedModelResponsePb{} - pb.Model = st.Model - - return pb, nil -} - -type getLoggedModelResponsePb struct { - Model *LoggedModel `json:"model,omitempty"` -} - -func getLoggedModelResponseFromPb(pb *getLoggedModelResponsePb) (*GetLoggedModelResponse, error) { - if pb == nil { - return nil, nil - } - st := &GetLoggedModelResponse{} - st.Model = pb.Model - - return st, nil -} - -func getMetricHistoryResponseToPb(st *GetMetricHistoryResponse) (*getMetricHistoryResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &getMetricHistoryResponsePb{} - pb.Metrics = st.Metrics - pb.NextPageToken = st.NextPageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getMetricHistoryResponsePb struct { - Metrics []Metric `json:"metrics,omitempty"` - NextPageToken string `json:"next_page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getMetricHistoryResponseFromPb(pb *getMetricHistoryResponsePb) (*GetMetricHistoryResponse, error) { - if pb == nil { - return nil, nil - } - st := &GetMetricHistoryResponse{} - st.Metrics = pb.Metrics - st.NextPageToken = pb.NextPageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getMetricHistoryResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getMetricHistoryResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getModelRequestToPb(st *GetModelRequest) (*getModelRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getModelRequestPb{} - pb.Name = st.Name - - return pb, nil -} - -type getModelRequestPb struct { - Name string `json:"-" url:"name"` -} - -func getModelRequestFromPb(pb *getModelRequestPb) (*GetModelRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetModelRequest{} - st.Name = pb.Name - - return st, nil -} - -func getModelResponseToPb(st *GetModelResponse) (*getModelResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &getModelResponsePb{} - pb.RegisteredModelDatabricks = st.RegisteredModelDatabricks - - return pb, nil -} - -type getModelResponsePb struct { - RegisteredModelDatabricks *ModelDatabricks `json:"registered_model_databricks,omitempty"` -} - -func getModelResponseFromPb(pb *getModelResponsePb) (*GetModelResponse, error) { - if pb == nil { - return nil, nil - } - st := &GetModelResponse{} - st.RegisteredModelDatabricks = pb.RegisteredModelDatabricks - - return st, nil -} - -func getModelVersionDownloadUriRequestToPb(st *GetModelVersionDownloadUriRequest) (*getModelVersionDownloadUriRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getModelVersionDownloadUriRequestPb{} - pb.Name = st.Name - pb.Version = st.Version - - return pb, nil -} - -type getModelVersionDownloadUriRequestPb struct { - Name string `json:"-" url:"name"` - Version string `json:"-" url:"version"` -} - -func getModelVersionDownloadUriRequestFromPb(pb *getModelVersionDownloadUriRequestPb) (*GetModelVersionDownloadUriRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetModelVersionDownloadUriRequest{} - st.Name = pb.Name - st.Version = pb.Version - - return st, nil -} - -func getModelVersionDownloadUriResponseToPb(st *GetModelVersionDownloadUriResponse) (*getModelVersionDownloadUriResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &getModelVersionDownloadUriResponsePb{} - pb.ArtifactUri = st.ArtifactUri - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getModelVersionDownloadUriResponsePb struct { - ArtifactUri string `json:"artifact_uri,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getModelVersionDownloadUriResponseFromPb(pb *getModelVersionDownloadUriResponsePb) (*GetModelVersionDownloadUriResponse, error) { - if pb == nil { - return nil, nil - } - st := &GetModelVersionDownloadUriResponse{} - st.ArtifactUri = pb.ArtifactUri - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getModelVersionDownloadUriResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getModelVersionDownloadUriResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getModelVersionRequestToPb(st *GetModelVersionRequest) (*getModelVersionRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getModelVersionRequestPb{} - pb.Name = st.Name - pb.Version = st.Version - - return pb, nil -} - -type getModelVersionRequestPb struct { - Name string `json:"-" url:"name"` - Version string `json:"-" url:"version"` -} - -func getModelVersionRequestFromPb(pb *getModelVersionRequestPb) (*GetModelVersionRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetModelVersionRequest{} - st.Name = pb.Name - st.Version = pb.Version - - return st, nil -} - -func getModelVersionResponseToPb(st *GetModelVersionResponse) (*getModelVersionResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &getModelVersionResponsePb{} - pb.ModelVersion = st.ModelVersion - - return pb, nil -} - -type getModelVersionResponsePb struct { - ModelVersion *ModelVersion `json:"model_version,omitempty"` -} - -func getModelVersionResponseFromPb(pb *getModelVersionResponsePb) (*GetModelVersionResponse, error) { - if pb == nil { - return nil, nil - } - st := &GetModelVersionResponse{} - st.ModelVersion = pb.ModelVersion - - return st, nil -} - -func getOnlineStoreRequestToPb(st *GetOnlineStoreRequest) (*getOnlineStoreRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getOnlineStoreRequestPb{} - pb.Name = st.Name - - return pb, nil -} - -type getOnlineStoreRequestPb struct { - Name string `json:"-" url:"-"` -} - -func getOnlineStoreRequestFromPb(pb *getOnlineStoreRequestPb) (*GetOnlineStoreRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetOnlineStoreRequest{} - st.Name = pb.Name - - return st, nil -} - -func getRegisteredModelPermissionLevelsRequestToPb(st *GetRegisteredModelPermissionLevelsRequest) (*getRegisteredModelPermissionLevelsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getRegisteredModelPermissionLevelsRequestPb{} - pb.RegisteredModelId = st.RegisteredModelId - - return pb, nil -} - -type getRegisteredModelPermissionLevelsRequestPb struct { - RegisteredModelId string `json:"-" url:"-"` -} - -func getRegisteredModelPermissionLevelsRequestFromPb(pb *getRegisteredModelPermissionLevelsRequestPb) (*GetRegisteredModelPermissionLevelsRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetRegisteredModelPermissionLevelsRequest{} - st.RegisteredModelId = pb.RegisteredModelId - - return st, nil -} - -func getRegisteredModelPermissionLevelsResponseToPb(st *GetRegisteredModelPermissionLevelsResponse) (*getRegisteredModelPermissionLevelsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &getRegisteredModelPermissionLevelsResponsePb{} - pb.PermissionLevels = st.PermissionLevels - - return pb, nil -} - -type getRegisteredModelPermissionLevelsResponsePb struct { - PermissionLevels []RegisteredModelPermissionsDescription `json:"permission_levels,omitempty"` -} - -func getRegisteredModelPermissionLevelsResponseFromPb(pb *getRegisteredModelPermissionLevelsResponsePb) (*GetRegisteredModelPermissionLevelsResponse, error) { - if pb == nil { - return nil, nil - } - st := &GetRegisteredModelPermissionLevelsResponse{} - st.PermissionLevels = pb.PermissionLevels - - return st, nil -} - -func getRegisteredModelPermissionsRequestToPb(st *GetRegisteredModelPermissionsRequest) (*getRegisteredModelPermissionsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getRegisteredModelPermissionsRequestPb{} - pb.RegisteredModelId = st.RegisteredModelId - - return pb, nil -} - -type getRegisteredModelPermissionsRequestPb struct { - RegisteredModelId string `json:"-" url:"-"` -} - -func getRegisteredModelPermissionsRequestFromPb(pb *getRegisteredModelPermissionsRequestPb) (*GetRegisteredModelPermissionsRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetRegisteredModelPermissionsRequest{} - st.RegisteredModelId = pb.RegisteredModelId - - return st, nil -} - -func getRunRequestToPb(st *GetRunRequest) (*getRunRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getRunRequestPb{} - pb.RunId = st.RunId - pb.RunUuid = st.RunUuid - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getRunRequestPb struct { - RunId string `json:"-" url:"run_id"` - RunUuid string `json:"-" url:"run_uuid,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getRunRequestFromPb(pb *getRunRequestPb) (*GetRunRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetRunRequest{} - st.RunId = pb.RunId - st.RunUuid = pb.RunUuid - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getRunRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getRunRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getRunResponseToPb(st *GetRunResponse) (*getRunResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &getRunResponsePb{} - pb.Run = st.Run - - return pb, nil -} - -type getRunResponsePb struct { - Run *Run `json:"run,omitempty"` -} - -func getRunResponseFromPb(pb *getRunResponsePb) (*GetRunResponse, error) { - if pb == nil { - return nil, nil - } - st := &GetRunResponse{} - st.Run = pb.Run - - return st, nil -} - -func httpUrlSpecToPb(st *HttpUrlSpec) (*httpUrlSpecPb, error) { - if st == nil { - return nil, nil - } - pb := &httpUrlSpecPb{} - pb.Authorization = st.Authorization - pb.EnableSslVerification = st.EnableSslVerification - pb.Secret = st.Secret - pb.Url = st.Url - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type httpUrlSpecPb struct { - Authorization string `json:"authorization,omitempty"` - EnableSslVerification bool `json:"enable_ssl_verification,omitempty"` - Secret string `json:"secret,omitempty"` - Url string `json:"url"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func httpUrlSpecFromPb(pb *httpUrlSpecPb) (*HttpUrlSpec, error) { - if pb == nil { - return nil, nil - } - st := &HttpUrlSpec{} - st.Authorization = pb.Authorization - st.EnableSslVerification = pb.EnableSslVerification - st.Secret = pb.Secret - st.Url = pb.Url - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *httpUrlSpecPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st httpUrlSpecPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func httpUrlSpecWithoutSecretToPb(st *HttpUrlSpecWithoutSecret) (*httpUrlSpecWithoutSecretPb, error) { - if st == nil { - return nil, nil - } - pb := &httpUrlSpecWithoutSecretPb{} - pb.EnableSslVerification = st.EnableSslVerification - pb.Url = st.Url - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type httpUrlSpecWithoutSecretPb struct { - EnableSslVerification bool `json:"enable_ssl_verification,omitempty"` - Url string `json:"url,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func httpUrlSpecWithoutSecretFromPb(pb *httpUrlSpecWithoutSecretPb) (*HttpUrlSpecWithoutSecret, error) { - if pb == nil { - return nil, nil - } - st := &HttpUrlSpecWithoutSecret{} - st.EnableSslVerification = pb.EnableSslVerification - st.Url = pb.Url - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *httpUrlSpecWithoutSecretPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st httpUrlSpecWithoutSecretPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func inputTagToPb(st *InputTag) (*inputTagPb, error) { - if st == nil { - return nil, nil - } - pb := &inputTagPb{} - pb.Key = st.Key - pb.Value = st.Value - - return pb, nil -} - -type inputTagPb struct { - Key string `json:"key"` - Value string `json:"value"` -} - -func inputTagFromPb(pb *inputTagPb) (*InputTag, error) { - if pb == nil { - return nil, nil - } - st := &InputTag{} - st.Key = pb.Key - st.Value = pb.Value - - return st, nil -} - -func jobSpecToPb(st *JobSpec) (*jobSpecPb, error) { - if st == nil { - return nil, nil - } - pb := &jobSpecPb{} - pb.AccessToken = st.AccessToken - pb.JobId = st.JobId - pb.WorkspaceUrl = st.WorkspaceUrl - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type jobSpecPb struct { - AccessToken string `json:"access_token"` - JobId string `json:"job_id"` - WorkspaceUrl string `json:"workspace_url,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func jobSpecFromPb(pb *jobSpecPb) (*JobSpec, error) { - if pb == nil { - return nil, nil - } - st := &JobSpec{} - st.AccessToken = pb.AccessToken - st.JobId = pb.JobId - st.WorkspaceUrl = pb.WorkspaceUrl - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *jobSpecPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st jobSpecPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func jobSpecWithoutSecretToPb(st *JobSpecWithoutSecret) (*jobSpecWithoutSecretPb, error) { - if st == nil { - return nil, nil - } - pb := &jobSpecWithoutSecretPb{} - pb.JobId = st.JobId - pb.WorkspaceUrl = st.WorkspaceUrl - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type jobSpecWithoutSecretPb struct { - JobId string `json:"job_id,omitempty"` - WorkspaceUrl string `json:"workspace_url,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func jobSpecWithoutSecretFromPb(pb *jobSpecWithoutSecretPb) (*JobSpecWithoutSecret, error) { - if pb == nil { - return nil, nil - } - st := &JobSpecWithoutSecret{} - st.JobId = pb.JobId - st.WorkspaceUrl = pb.WorkspaceUrl - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *jobSpecWithoutSecretPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st jobSpecWithoutSecretPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listArtifactsRequestToPb(st *ListArtifactsRequest) (*listArtifactsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listArtifactsRequestPb{} - pb.PageToken = st.PageToken - pb.Path = st.Path - pb.RunId = st.RunId - pb.RunUuid = st.RunUuid - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listArtifactsRequestPb struct { - PageToken string `json:"-" url:"page_token,omitempty"` - Path string `json:"-" url:"path,omitempty"` - RunId string `json:"-" url:"run_id,omitempty"` - RunUuid string `json:"-" url:"run_uuid,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listArtifactsRequestFromPb(pb *listArtifactsRequestPb) (*ListArtifactsRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListArtifactsRequest{} - st.PageToken = pb.PageToken - st.Path = pb.Path - st.RunId = pb.RunId - st.RunUuid = pb.RunUuid - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listArtifactsRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listArtifactsRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listArtifactsResponseToPb(st *ListArtifactsResponse) (*listArtifactsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listArtifactsResponsePb{} - pb.Files = st.Files - pb.NextPageToken = st.NextPageToken - pb.RootUri = st.RootUri - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listArtifactsResponsePb struct { - Files []FileInfo `json:"files,omitempty"` - NextPageToken string `json:"next_page_token,omitempty"` - RootUri string `json:"root_uri,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listArtifactsResponseFromPb(pb *listArtifactsResponsePb) (*ListArtifactsResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListArtifactsResponse{} - st.Files = pb.Files - st.NextPageToken = pb.NextPageToken - st.RootUri = pb.RootUri - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listArtifactsResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listArtifactsResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listExperimentsRequestToPb(st *ListExperimentsRequest) (*listExperimentsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listExperimentsRequestPb{} - pb.MaxResults = st.MaxResults - pb.PageToken = st.PageToken - pb.ViewType = st.ViewType - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listExperimentsRequestPb struct { - MaxResults int64 `json:"-" url:"max_results,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - ViewType ViewType `json:"-" url:"view_type,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listExperimentsRequestFromPb(pb *listExperimentsRequestPb) (*ListExperimentsRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListExperimentsRequest{} - st.MaxResults = pb.MaxResults - st.PageToken = pb.PageToken - st.ViewType = pb.ViewType - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listExperimentsRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listExperimentsRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listExperimentsResponseToPb(st *ListExperimentsResponse) (*listExperimentsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listExperimentsResponsePb{} - pb.Experiments = st.Experiments - pb.NextPageToken = st.NextPageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listExperimentsResponsePb struct { - Experiments []Experiment `json:"experiments,omitempty"` - NextPageToken string `json:"next_page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listExperimentsResponseFromPb(pb *listExperimentsResponsePb) (*ListExperimentsResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListExperimentsResponse{} - st.Experiments = pb.Experiments - st.NextPageToken = pb.NextPageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listExperimentsResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listExperimentsResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listModelsRequestToPb(st *ListModelsRequest) (*listModelsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listModelsRequestPb{} - pb.MaxResults = st.MaxResults - pb.PageToken = st.PageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listModelsRequestPb struct { - MaxResults int `json:"-" url:"max_results,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listModelsRequestFromPb(pb *listModelsRequestPb) (*ListModelsRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListModelsRequest{} - st.MaxResults = pb.MaxResults - st.PageToken = pb.PageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listModelsRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listModelsRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listModelsResponseToPb(st *ListModelsResponse) (*listModelsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listModelsResponsePb{} - pb.NextPageToken = st.NextPageToken - pb.RegisteredModels = st.RegisteredModels - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listModelsResponsePb struct { - NextPageToken string `json:"next_page_token,omitempty"` - RegisteredModels []Model `json:"registered_models,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listModelsResponseFromPb(pb *listModelsResponsePb) (*ListModelsResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListModelsResponse{} - st.NextPageToken = pb.NextPageToken - st.RegisteredModels = pb.RegisteredModels - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listModelsResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listModelsResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listOnlineStoresRequestToPb(st *ListOnlineStoresRequest) (*listOnlineStoresRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listOnlineStoresRequestPb{} - pb.PageSize = st.PageSize - pb.PageToken = st.PageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listOnlineStoresRequestPb struct { - PageSize int `json:"-" url:"page_size,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listOnlineStoresRequestFromPb(pb *listOnlineStoresRequestPb) (*ListOnlineStoresRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListOnlineStoresRequest{} - st.PageSize = pb.PageSize - st.PageToken = pb.PageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listOnlineStoresRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listOnlineStoresRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listOnlineStoresResponseToPb(st *ListOnlineStoresResponse) (*listOnlineStoresResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listOnlineStoresResponsePb{} - pb.NextPageToken = st.NextPageToken - pb.OnlineStores = st.OnlineStores - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listOnlineStoresResponsePb struct { - NextPageToken string `json:"next_page_token,omitempty"` - OnlineStores []OnlineStore `json:"online_stores,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listOnlineStoresResponseFromPb(pb *listOnlineStoresResponsePb) (*ListOnlineStoresResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListOnlineStoresResponse{} - st.NextPageToken = pb.NextPageToken - st.OnlineStores = pb.OnlineStores - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listOnlineStoresResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listOnlineStoresResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listRegistryWebhooksToPb(st *ListRegistryWebhooks) (*listRegistryWebhooksPb, error) { - if st == nil { - return nil, nil - } - pb := &listRegistryWebhooksPb{} - pb.NextPageToken = st.NextPageToken - pb.Webhooks = st.Webhooks - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listRegistryWebhooksPb struct { - NextPageToken string `json:"next_page_token,omitempty"` - Webhooks []RegistryWebhook `json:"webhooks,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listRegistryWebhooksFromPb(pb *listRegistryWebhooksPb) (*ListRegistryWebhooks, error) { - if pb == nil { - return nil, nil - } - st := &ListRegistryWebhooks{} - st.NextPageToken = pb.NextPageToken - st.Webhooks = pb.Webhooks - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listRegistryWebhooksPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listRegistryWebhooksPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listTransitionRequestsRequestToPb(st *ListTransitionRequestsRequest) (*listTransitionRequestsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listTransitionRequestsRequestPb{} - pb.Name = st.Name - pb.Version = st.Version - - return pb, nil -} - -type listTransitionRequestsRequestPb struct { - Name string `json:"-" url:"name"` - Version string `json:"-" url:"version"` -} - -func listTransitionRequestsRequestFromPb(pb *listTransitionRequestsRequestPb) (*ListTransitionRequestsRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListTransitionRequestsRequest{} - st.Name = pb.Name - st.Version = pb.Version - - return st, nil -} - -func listTransitionRequestsResponseToPb(st *ListTransitionRequestsResponse) (*listTransitionRequestsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listTransitionRequestsResponsePb{} - pb.Requests = st.Requests - - return pb, nil -} - -type listTransitionRequestsResponsePb struct { - Requests []Activity `json:"requests,omitempty"` -} - -func listTransitionRequestsResponseFromPb(pb *listTransitionRequestsResponsePb) (*ListTransitionRequestsResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListTransitionRequestsResponse{} - st.Requests = pb.Requests - - return st, nil -} - -func listWebhooksRequestToPb(st *ListWebhooksRequest) (*listWebhooksRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listWebhooksRequestPb{} - pb.Events = st.Events - pb.ModelName = st.ModelName - pb.PageToken = st.PageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listWebhooksRequestPb struct { - Events []RegistryWebhookEvent `json:"-" url:"events,omitempty"` - ModelName string `json:"-" url:"model_name,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listWebhooksRequestFromPb(pb *listWebhooksRequestPb) (*ListWebhooksRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListWebhooksRequest{} - st.Events = pb.Events - st.ModelName = pb.ModelName - st.PageToken = pb.PageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listWebhooksRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listWebhooksRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func logBatchToPb(st *LogBatch) (*logBatchPb, error) { - if st == nil { - return nil, nil - } - pb := &logBatchPb{} - pb.Metrics = st.Metrics - pb.Params = st.Params - pb.RunId = st.RunId - pb.Tags = st.Tags - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type logBatchPb struct { - Metrics []Metric `json:"metrics,omitempty"` - Params []Param `json:"params,omitempty"` - RunId string `json:"run_id,omitempty"` - Tags []RunTag `json:"tags,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func logBatchFromPb(pb *logBatchPb) (*LogBatch, error) { - if pb == nil { - return nil, nil - } - st := &LogBatch{} - st.Metrics = pb.Metrics - st.Params = pb.Params - st.RunId = pb.RunId - st.Tags = pb.Tags - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *logBatchPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st logBatchPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func logBatchResponseToPb(st *LogBatchResponse) (*logBatchResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &logBatchResponsePb{} - - return pb, nil -} - -type logBatchResponsePb struct { -} - -func logBatchResponseFromPb(pb *logBatchResponsePb) (*LogBatchResponse, error) { - if pb == nil { - return nil, nil - } - st := &LogBatchResponse{} - - return st, nil -} - -func logInputsToPb(st *LogInputs) (*logInputsPb, error) { - if st == nil { - return nil, nil - } - pb := &logInputsPb{} - pb.Datasets = st.Datasets - pb.Models = st.Models - pb.RunId = st.RunId - - return pb, nil -} - -type logInputsPb struct { - Datasets []DatasetInput `json:"datasets,omitempty"` - Models []ModelInput `json:"models,omitempty"` - RunId string `json:"run_id"` -} - -func logInputsFromPb(pb *logInputsPb) (*LogInputs, error) { - if pb == nil { - return nil, nil - } - st := &LogInputs{} - st.Datasets = pb.Datasets - st.Models = pb.Models - st.RunId = pb.RunId - - return st, nil -} - -func logInputsResponseToPb(st *LogInputsResponse) (*logInputsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &logInputsResponsePb{} - - return pb, nil -} - -type logInputsResponsePb struct { -} - -func logInputsResponseFromPb(pb *logInputsResponsePb) (*LogInputsResponse, error) { - if pb == nil { - return nil, nil - } - st := &LogInputsResponse{} - - return st, nil -} - -func logLoggedModelParamsRequestToPb(st *LogLoggedModelParamsRequest) (*logLoggedModelParamsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &logLoggedModelParamsRequestPb{} - pb.ModelId = st.ModelId - pb.Params = st.Params - - return pb, nil -} - -type logLoggedModelParamsRequestPb struct { - ModelId string `json:"-" url:"-"` - Params []LoggedModelParameter `json:"params,omitempty"` -} - -func logLoggedModelParamsRequestFromPb(pb *logLoggedModelParamsRequestPb) (*LogLoggedModelParamsRequest, error) { - if pb == nil { - return nil, nil - } - st := &LogLoggedModelParamsRequest{} - st.ModelId = pb.ModelId - st.Params = pb.Params - - return st, nil -} - -func logLoggedModelParamsRequestResponseToPb(st *LogLoggedModelParamsRequestResponse) (*logLoggedModelParamsRequestResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &logLoggedModelParamsRequestResponsePb{} - - return pb, nil -} - -type logLoggedModelParamsRequestResponsePb struct { -} - -func logLoggedModelParamsRequestResponseFromPb(pb *logLoggedModelParamsRequestResponsePb) (*LogLoggedModelParamsRequestResponse, error) { - if pb == nil { - return nil, nil - } - st := &LogLoggedModelParamsRequestResponse{} - - return st, nil -} - -func logMetricToPb(st *LogMetric) (*logMetricPb, error) { - if st == nil { - return nil, nil - } - pb := &logMetricPb{} - pb.DatasetDigest = st.DatasetDigest - pb.DatasetName = st.DatasetName - pb.Key = st.Key - pb.ModelId = st.ModelId - pb.RunId = st.RunId - pb.RunUuid = st.RunUuid - pb.Step = st.Step - pb.Timestamp = st.Timestamp - pb.Value = st.Value - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type logMetricPb struct { - DatasetDigest string `json:"dataset_digest,omitempty"` - DatasetName string `json:"dataset_name,omitempty"` - Key string `json:"key"` - ModelId string `json:"model_id,omitempty"` - RunId string `json:"run_id,omitempty"` - RunUuid string `json:"run_uuid,omitempty"` - Step int64 `json:"step,omitempty"` - Timestamp int64 `json:"timestamp"` - Value float64 `json:"value"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func logMetricFromPb(pb *logMetricPb) (*LogMetric, error) { - if pb == nil { - return nil, nil - } - st := &LogMetric{} - st.DatasetDigest = pb.DatasetDigest - st.DatasetName = pb.DatasetName - st.Key = pb.Key - st.ModelId = pb.ModelId - st.RunId = pb.RunId - st.RunUuid = pb.RunUuid - st.Step = pb.Step - st.Timestamp = pb.Timestamp - st.Value = pb.Value - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *logMetricPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st logMetricPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func logMetricResponseToPb(st *LogMetricResponse) (*logMetricResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &logMetricResponsePb{} - - return pb, nil -} - -type logMetricResponsePb struct { -} - -func logMetricResponseFromPb(pb *logMetricResponsePb) (*LogMetricResponse, error) { - if pb == nil { - return nil, nil - } - st := &LogMetricResponse{} - - return st, nil -} - -func logModelToPb(st *LogModel) (*logModelPb, error) { - if st == nil { - return nil, nil - } - pb := &logModelPb{} - pb.ModelJson = st.ModelJson - pb.RunId = st.RunId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type logModelPb struct { - ModelJson string `json:"model_json,omitempty"` - RunId string `json:"run_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func logModelFromPb(pb *logModelPb) (*LogModel, error) { - if pb == nil { - return nil, nil - } - st := &LogModel{} - st.ModelJson = pb.ModelJson - st.RunId = pb.RunId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *logModelPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st logModelPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func logModelResponseToPb(st *LogModelResponse) (*logModelResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &logModelResponsePb{} - - return pb, nil -} - -type logModelResponsePb struct { -} - -func logModelResponseFromPb(pb *logModelResponsePb) (*LogModelResponse, error) { - if pb == nil { - return nil, nil - } - st := &LogModelResponse{} - - return st, nil -} - -func logOutputsRequestToPb(st *LogOutputsRequest) (*logOutputsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &logOutputsRequestPb{} - pb.Models = st.Models - pb.RunId = st.RunId - - return pb, nil -} - -type logOutputsRequestPb struct { - Models []ModelOutput `json:"models,omitempty"` - RunId string `json:"run_id"` -} - -func logOutputsRequestFromPb(pb *logOutputsRequestPb) (*LogOutputsRequest, error) { - if pb == nil { - return nil, nil - } - st := &LogOutputsRequest{} - st.Models = pb.Models - st.RunId = pb.RunId - - return st, nil -} - -func logOutputsResponseToPb(st *LogOutputsResponse) (*logOutputsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &logOutputsResponsePb{} - - return pb, nil -} - -type logOutputsResponsePb struct { -} - -func logOutputsResponseFromPb(pb *logOutputsResponsePb) (*LogOutputsResponse, error) { - if pb == nil { - return nil, nil - } - st := &LogOutputsResponse{} - - return st, nil -} - -func logParamToPb(st *LogParam) (*logParamPb, error) { - if st == nil { - return nil, nil - } - pb := &logParamPb{} - pb.Key = st.Key - pb.RunId = st.RunId - pb.RunUuid = st.RunUuid - pb.Value = st.Value - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type logParamPb struct { - Key string `json:"key"` - RunId string `json:"run_id,omitempty"` - RunUuid string `json:"run_uuid,omitempty"` - Value string `json:"value"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func logParamFromPb(pb *logParamPb) (*LogParam, error) { - if pb == nil { - return nil, nil - } - st := &LogParam{} - st.Key = pb.Key - st.RunId = pb.RunId - st.RunUuid = pb.RunUuid - st.Value = pb.Value - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *logParamPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st logParamPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func logParamResponseToPb(st *LogParamResponse) (*logParamResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &logParamResponsePb{} - - return pb, nil -} - -type logParamResponsePb struct { -} - -func logParamResponseFromPb(pb *logParamResponsePb) (*LogParamResponse, error) { - if pb == nil { - return nil, nil - } - st := &LogParamResponse{} - - return st, nil -} - -func loggedModelToPb(st *LoggedModel) (*loggedModelPb, error) { - if st == nil { - return nil, nil - } - pb := &loggedModelPb{} - pb.Data = st.Data - pb.Info = st.Info - - return pb, nil -} - -type loggedModelPb struct { - Data *LoggedModelData `json:"data,omitempty"` - Info *LoggedModelInfo `json:"info,omitempty"` -} - -func loggedModelFromPb(pb *loggedModelPb) (*LoggedModel, error) { - if pb == nil { - return nil, nil - } - st := &LoggedModel{} - st.Data = pb.Data - st.Info = pb.Info - - return st, nil -} - -func loggedModelDataToPb(st *LoggedModelData) (*loggedModelDataPb, error) { - if st == nil { - return nil, nil - } - pb := &loggedModelDataPb{} - pb.Metrics = st.Metrics - pb.Params = st.Params - - return pb, nil -} - -type loggedModelDataPb struct { - Metrics []Metric `json:"metrics,omitempty"` - Params []LoggedModelParameter `json:"params,omitempty"` -} - -func loggedModelDataFromPb(pb *loggedModelDataPb) (*LoggedModelData, error) { - if pb == nil { - return nil, nil - } - st := &LoggedModelData{} - st.Metrics = pb.Metrics - st.Params = pb.Params - - return st, nil -} - -func loggedModelInfoToPb(st *LoggedModelInfo) (*loggedModelInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &loggedModelInfoPb{} - pb.ArtifactUri = st.ArtifactUri - pb.CreationTimestampMs = st.CreationTimestampMs - pb.CreatorId = st.CreatorId - pb.ExperimentId = st.ExperimentId - pb.LastUpdatedTimestampMs = st.LastUpdatedTimestampMs - pb.ModelId = st.ModelId - pb.ModelType = st.ModelType - pb.Name = st.Name - pb.SourceRunId = st.SourceRunId - pb.Status = st.Status - pb.StatusMessage = st.StatusMessage - pb.Tags = st.Tags - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type loggedModelInfoPb struct { - ArtifactUri string `json:"artifact_uri,omitempty"` - CreationTimestampMs int64 `json:"creation_timestamp_ms,omitempty"` - CreatorId int64 `json:"creator_id,omitempty"` - ExperimentId string `json:"experiment_id,omitempty"` - LastUpdatedTimestampMs int64 `json:"last_updated_timestamp_ms,omitempty"` - ModelId string `json:"model_id,omitempty"` - ModelType string `json:"model_type,omitempty"` - Name string `json:"name,omitempty"` - SourceRunId string `json:"source_run_id,omitempty"` - Status LoggedModelStatus `json:"status,omitempty"` - StatusMessage string `json:"status_message,omitempty"` - Tags []LoggedModelTag `json:"tags,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func loggedModelInfoFromPb(pb *loggedModelInfoPb) (*LoggedModelInfo, error) { - if pb == nil { - return nil, nil - } - st := &LoggedModelInfo{} - st.ArtifactUri = pb.ArtifactUri - st.CreationTimestampMs = pb.CreationTimestampMs - st.CreatorId = pb.CreatorId - st.ExperimentId = pb.ExperimentId - st.LastUpdatedTimestampMs = pb.LastUpdatedTimestampMs - st.ModelId = pb.ModelId - st.ModelType = pb.ModelType - st.Name = pb.Name - st.SourceRunId = pb.SourceRunId - st.Status = pb.Status - st.StatusMessage = pb.StatusMessage - st.Tags = pb.Tags - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *loggedModelInfoPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st loggedModelInfoPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func loggedModelParameterToPb(st *LoggedModelParameter) (*loggedModelParameterPb, error) { - if st == nil { - return nil, nil - } - pb := &loggedModelParameterPb{} - pb.Key = st.Key - pb.Value = st.Value - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type loggedModelParameterPb struct { - Key string `json:"key,omitempty"` - Value string `json:"value,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func loggedModelParameterFromPb(pb *loggedModelParameterPb) (*LoggedModelParameter, error) { - if pb == nil { - return nil, nil - } - st := &LoggedModelParameter{} - st.Key = pb.Key - st.Value = pb.Value - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *loggedModelParameterPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st loggedModelParameterPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func loggedModelTagToPb(st *LoggedModelTag) (*loggedModelTagPb, error) { - if st == nil { - return nil, nil - } - pb := &loggedModelTagPb{} - pb.Key = st.Key - pb.Value = st.Value - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type loggedModelTagPb struct { - Key string `json:"key,omitempty"` - Value string `json:"value,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func loggedModelTagFromPb(pb *loggedModelTagPb) (*LoggedModelTag, error) { - if pb == nil { - return nil, nil - } - st := &LoggedModelTag{} - st.Key = pb.Key - st.Value = pb.Value - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *loggedModelTagPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st loggedModelTagPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func metricToPb(st *Metric) (*metricPb, error) { - if st == nil { - return nil, nil - } - pb := &metricPb{} - pb.DatasetDigest = st.DatasetDigest - pb.DatasetName = st.DatasetName - pb.Key = st.Key - pb.ModelId = st.ModelId - pb.RunId = st.RunId - pb.Step = st.Step - pb.Timestamp = st.Timestamp - pb.Value = st.Value - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type metricPb struct { - DatasetDigest string `json:"dataset_digest,omitempty"` - DatasetName string `json:"dataset_name,omitempty"` - Key string `json:"key,omitempty"` - ModelId string `json:"model_id,omitempty"` - RunId string `json:"run_id,omitempty"` - Step int64 `json:"step,omitempty"` - Timestamp int64 `json:"timestamp,omitempty"` - Value float64 `json:"value,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func metricFromPb(pb *metricPb) (*Metric, error) { - if pb == nil { - return nil, nil - } - st := &Metric{} - st.DatasetDigest = pb.DatasetDigest - st.DatasetName = pb.DatasetName - st.Key = pb.Key - st.ModelId = pb.ModelId - st.RunId = pb.RunId - st.Step = pb.Step - st.Timestamp = pb.Timestamp - st.Value = pb.Value - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *metricPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st metricPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func modelToPb(st *Model) (*modelPb, error) { - if st == nil { - return nil, nil - } - pb := &modelPb{} - pb.CreationTimestamp = st.CreationTimestamp - pb.Description = st.Description - pb.LastUpdatedTimestamp = st.LastUpdatedTimestamp - pb.LatestVersions = st.LatestVersions - pb.Name = st.Name - pb.Tags = st.Tags - pb.UserId = st.UserId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type modelPb struct { - CreationTimestamp int64 `json:"creation_timestamp,omitempty"` - Description string `json:"description,omitempty"` - LastUpdatedTimestamp int64 `json:"last_updated_timestamp,omitempty"` - LatestVersions []ModelVersion `json:"latest_versions,omitempty"` - Name string `json:"name,omitempty"` - Tags []ModelTag `json:"tags,omitempty"` - UserId string `json:"user_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func modelFromPb(pb *modelPb) (*Model, error) { - if pb == nil { - return nil, nil - } - st := &Model{} - st.CreationTimestamp = pb.CreationTimestamp - st.Description = pb.Description - st.LastUpdatedTimestamp = pb.LastUpdatedTimestamp - st.LatestVersions = pb.LatestVersions - st.Name = pb.Name - st.Tags = pb.Tags - st.UserId = pb.UserId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *modelPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st modelPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func modelDatabricksToPb(st *ModelDatabricks) (*modelDatabricksPb, error) { - if st == nil { - return nil, nil - } - pb := &modelDatabricksPb{} - pb.CreationTimestamp = st.CreationTimestamp - pb.Description = st.Description - pb.Id = st.Id - pb.LastUpdatedTimestamp = st.LastUpdatedTimestamp - pb.LatestVersions = st.LatestVersions - pb.Name = st.Name - pb.PermissionLevel = st.PermissionLevel - pb.Tags = st.Tags - pb.UserId = st.UserId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type modelDatabricksPb struct { - CreationTimestamp int64 `json:"creation_timestamp,omitempty"` - Description string `json:"description,omitempty"` - Id string `json:"id,omitempty"` - LastUpdatedTimestamp int64 `json:"last_updated_timestamp,omitempty"` - LatestVersions []ModelVersion `json:"latest_versions,omitempty"` - Name string `json:"name,omitempty"` - PermissionLevel PermissionLevel `json:"permission_level,omitempty"` - Tags []ModelTag `json:"tags,omitempty"` - UserId string `json:"user_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func modelDatabricksFromPb(pb *modelDatabricksPb) (*ModelDatabricks, error) { - if pb == nil { - return nil, nil - } - st := &ModelDatabricks{} - st.CreationTimestamp = pb.CreationTimestamp - st.Description = pb.Description - st.Id = pb.Id - st.LastUpdatedTimestamp = pb.LastUpdatedTimestamp - st.LatestVersions = pb.LatestVersions - st.Name = pb.Name - st.PermissionLevel = pb.PermissionLevel - st.Tags = pb.Tags - st.UserId = pb.UserId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *modelDatabricksPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st modelDatabricksPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func modelInputToPb(st *ModelInput) (*modelInputPb, error) { - if st == nil { - return nil, nil - } - pb := &modelInputPb{} - pb.ModelId = st.ModelId - - return pb, nil -} - -type modelInputPb struct { - ModelId string `json:"model_id"` -} - -func modelInputFromPb(pb *modelInputPb) (*ModelInput, error) { - if pb == nil { - return nil, nil - } - st := &ModelInput{} - st.ModelId = pb.ModelId - - return st, nil -} - -func modelOutputToPb(st *ModelOutput) (*modelOutputPb, error) { - if st == nil { - return nil, nil - } - pb := &modelOutputPb{} - pb.ModelId = st.ModelId - pb.Step = st.Step - - return pb, nil -} - -type modelOutputPb struct { - ModelId string `json:"model_id"` - Step int64 `json:"step"` -} - -func modelOutputFromPb(pb *modelOutputPb) (*ModelOutput, error) { - if pb == nil { - return nil, nil - } - st := &ModelOutput{} - st.ModelId = pb.ModelId - st.Step = pb.Step - - return st, nil -} - -func modelTagToPb(st *ModelTag) (*modelTagPb, error) { - if st == nil { - return nil, nil - } - pb := &modelTagPb{} - pb.Key = st.Key - pb.Value = st.Value - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type modelTagPb struct { - Key string `json:"key,omitempty"` - Value string `json:"value,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func modelTagFromPb(pb *modelTagPb) (*ModelTag, error) { - if pb == nil { - return nil, nil - } - st := &ModelTag{} - st.Key = pb.Key - st.Value = pb.Value - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *modelTagPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st modelTagPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func modelVersionToPb(st *ModelVersion) (*modelVersionPb, error) { - if st == nil { - return nil, nil - } - pb := &modelVersionPb{} - pb.CreationTimestamp = st.CreationTimestamp - pb.CurrentStage = st.CurrentStage - pb.Description = st.Description - pb.LastUpdatedTimestamp = st.LastUpdatedTimestamp - pb.Name = st.Name - pb.RunId = st.RunId - pb.RunLink = st.RunLink - pb.Source = st.Source - pb.Status = st.Status - pb.StatusMessage = st.StatusMessage - pb.Tags = st.Tags - pb.UserId = st.UserId - pb.Version = st.Version - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type modelVersionPb struct { - CreationTimestamp int64 `json:"creation_timestamp,omitempty"` - CurrentStage string `json:"current_stage,omitempty"` - Description string `json:"description,omitempty"` - LastUpdatedTimestamp int64 `json:"last_updated_timestamp,omitempty"` - Name string `json:"name,omitempty"` - RunId string `json:"run_id,omitempty"` - RunLink string `json:"run_link,omitempty"` - Source string `json:"source,omitempty"` - Status ModelVersionStatus `json:"status,omitempty"` - StatusMessage string `json:"status_message,omitempty"` - Tags []ModelVersionTag `json:"tags,omitempty"` - UserId string `json:"user_id,omitempty"` - Version string `json:"version,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func modelVersionFromPb(pb *modelVersionPb) (*ModelVersion, error) { - if pb == nil { - return nil, nil - } - st := &ModelVersion{} - st.CreationTimestamp = pb.CreationTimestamp - st.CurrentStage = pb.CurrentStage - st.Description = pb.Description - st.LastUpdatedTimestamp = pb.LastUpdatedTimestamp - st.Name = pb.Name - st.RunId = pb.RunId - st.RunLink = pb.RunLink - st.Source = pb.Source - st.Status = pb.Status - st.StatusMessage = pb.StatusMessage - st.Tags = pb.Tags - st.UserId = pb.UserId - st.Version = pb.Version - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *modelVersionPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st modelVersionPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func modelVersionDatabricksToPb(st *ModelVersionDatabricks) (*modelVersionDatabricksPb, error) { - if st == nil { - return nil, nil - } - pb := &modelVersionDatabricksPb{} - pb.CreationTimestamp = st.CreationTimestamp - pb.CurrentStage = st.CurrentStage - pb.Description = st.Description - pb.LastUpdatedTimestamp = st.LastUpdatedTimestamp - pb.Name = st.Name - pb.PermissionLevel = st.PermissionLevel - pb.RunId = st.RunId - pb.RunLink = st.RunLink - pb.Source = st.Source - pb.Status = st.Status - pb.StatusMessage = st.StatusMessage - pb.Tags = st.Tags - pb.UserId = st.UserId - pb.Version = st.Version - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type modelVersionDatabricksPb struct { - CreationTimestamp int64 `json:"creation_timestamp,omitempty"` - CurrentStage Stage `json:"current_stage,omitempty"` - Description string `json:"description,omitempty"` - LastUpdatedTimestamp int64 `json:"last_updated_timestamp,omitempty"` - Name string `json:"name,omitempty"` - PermissionLevel PermissionLevel `json:"permission_level,omitempty"` - RunId string `json:"run_id,omitempty"` - RunLink string `json:"run_link,omitempty"` - Source string `json:"source,omitempty"` - Status Status `json:"status,omitempty"` - StatusMessage string `json:"status_message,omitempty"` - Tags []ModelVersionTag `json:"tags,omitempty"` - UserId string `json:"user_id,omitempty"` - Version string `json:"version,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func modelVersionDatabricksFromPb(pb *modelVersionDatabricksPb) (*ModelVersionDatabricks, error) { - if pb == nil { - return nil, nil - } - st := &ModelVersionDatabricks{} - st.CreationTimestamp = pb.CreationTimestamp - st.CurrentStage = pb.CurrentStage - st.Description = pb.Description - st.LastUpdatedTimestamp = pb.LastUpdatedTimestamp - st.Name = pb.Name - st.PermissionLevel = pb.PermissionLevel - st.RunId = pb.RunId - st.RunLink = pb.RunLink - st.Source = pb.Source - st.Status = pb.Status - st.StatusMessage = pb.StatusMessage - st.Tags = pb.Tags - st.UserId = pb.UserId - st.Version = pb.Version - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *modelVersionDatabricksPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st modelVersionDatabricksPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func modelVersionTagToPb(st *ModelVersionTag) (*modelVersionTagPb, error) { - if st == nil { - return nil, nil - } - pb := &modelVersionTagPb{} - pb.Key = st.Key - pb.Value = st.Value - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type modelVersionTagPb struct { - Key string `json:"key,omitempty"` - Value string `json:"value,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func modelVersionTagFromPb(pb *modelVersionTagPb) (*ModelVersionTag, error) { - if pb == nil { - return nil, nil - } - st := &ModelVersionTag{} - st.Key = pb.Key - st.Value = pb.Value - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *modelVersionTagPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st modelVersionTagPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func onlineStoreToPb(st *OnlineStore) (*onlineStorePb, error) { - if st == nil { - return nil, nil - } - pb := &onlineStorePb{} - pb.Capacity = st.Capacity - pb.CreationTime = st.CreationTime - pb.Creator = st.Creator - pb.Name = st.Name - pb.State = st.State - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type onlineStorePb struct { - Capacity string `json:"capacity,omitempty"` - CreationTime string `json:"creation_time,omitempty"` - Creator string `json:"creator,omitempty"` - Name string `json:"name"` - State OnlineStoreState `json:"state,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func onlineStoreFromPb(pb *onlineStorePb) (*OnlineStore, error) { - if pb == nil { - return nil, nil - } - st := &OnlineStore{} - st.Capacity = pb.Capacity - st.CreationTime = pb.CreationTime - st.Creator = pb.Creator - st.Name = pb.Name - st.State = pb.State - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *onlineStorePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st onlineStorePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func paramToPb(st *Param) (*paramPb, error) { - if st == nil { - return nil, nil - } - pb := ¶mPb{} - pb.Key = st.Key - pb.Value = st.Value - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type paramPb struct { - Key string `json:"key,omitempty"` - Value string `json:"value,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func paramFromPb(pb *paramPb) (*Param, error) { - if pb == nil { - return nil, nil - } - st := &Param{} - st.Key = pb.Key - st.Value = pb.Value - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *paramPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st paramPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func publishSpecToPb(st *PublishSpec) (*publishSpecPb, error) { - if st == nil { - return nil, nil - } - pb := &publishSpecPb{} - pb.OnlineStore = st.OnlineStore - pb.OnlineTableName = st.OnlineTableName - pb.PublishMode = st.PublishMode - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type publishSpecPb struct { - OnlineStore string `json:"online_store"` - OnlineTableName string `json:"online_table_name,omitempty"` - PublishMode PublishSpecPublishMode `json:"publish_mode,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func publishSpecFromPb(pb *publishSpecPb) (*PublishSpec, error) { - if pb == nil { - return nil, nil - } - st := &PublishSpec{} - st.OnlineStore = pb.OnlineStore - st.OnlineTableName = pb.OnlineTableName - st.PublishMode = pb.PublishMode - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *publishSpecPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st publishSpecPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func publishTableRequestToPb(st *PublishTableRequest) (*publishTableRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &publishTableRequestPb{} - pb.PublishSpec = st.PublishSpec - pb.SourceTableName = st.SourceTableName - - return pb, nil -} - -type publishTableRequestPb struct { - PublishSpec PublishSpec `json:"publish_spec"` - SourceTableName string `json:"-" url:"-"` -} - -func publishTableRequestFromPb(pb *publishTableRequestPb) (*PublishTableRequest, error) { - if pb == nil { - return nil, nil - } - st := &PublishTableRequest{} - st.PublishSpec = pb.PublishSpec - st.SourceTableName = pb.SourceTableName - - return st, nil -} - -func publishTableResponseToPb(st *PublishTableResponse) (*publishTableResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &publishTableResponsePb{} - pb.OnlineTableName = st.OnlineTableName - pb.PipelineId = st.PipelineId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type publishTableResponsePb struct { - OnlineTableName string `json:"online_table_name,omitempty"` - PipelineId string `json:"pipeline_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func publishTableResponseFromPb(pb *publishTableResponsePb) (*PublishTableResponse, error) { - if pb == nil { - return nil, nil - } - st := &PublishTableResponse{} - st.OnlineTableName = pb.OnlineTableName - st.PipelineId = pb.PipelineId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *publishTableResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st publishTableResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func registeredModelAccessControlRequestToPb(st *RegisteredModelAccessControlRequest) (*registeredModelAccessControlRequestPb, error) { - if st == nil { - return nil, nil - } - pb := ®isteredModelAccessControlRequestPb{} - pb.GroupName = st.GroupName - pb.PermissionLevel = st.PermissionLevel - pb.ServicePrincipalName = st.ServicePrincipalName - pb.UserName = st.UserName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type registeredModelAccessControlRequestPb struct { - GroupName string `json:"group_name,omitempty"` - PermissionLevel RegisteredModelPermissionLevel `json:"permission_level,omitempty"` - ServicePrincipalName string `json:"service_principal_name,omitempty"` - UserName string `json:"user_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func registeredModelAccessControlRequestFromPb(pb *registeredModelAccessControlRequestPb) (*RegisteredModelAccessControlRequest, error) { - if pb == nil { - return nil, nil - } - st := &RegisteredModelAccessControlRequest{} - st.GroupName = pb.GroupName - st.PermissionLevel = pb.PermissionLevel - st.ServicePrincipalName = pb.ServicePrincipalName - st.UserName = pb.UserName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *registeredModelAccessControlRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st registeredModelAccessControlRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func registeredModelAccessControlResponseToPb(st *RegisteredModelAccessControlResponse) (*registeredModelAccessControlResponsePb, error) { - if st == nil { - return nil, nil - } - pb := ®isteredModelAccessControlResponsePb{} - pb.AllPermissions = st.AllPermissions - pb.DisplayName = st.DisplayName - pb.GroupName = st.GroupName - pb.ServicePrincipalName = st.ServicePrincipalName - pb.UserName = st.UserName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type registeredModelAccessControlResponsePb struct { - AllPermissions []RegisteredModelPermission `json:"all_permissions,omitempty"` - DisplayName string `json:"display_name,omitempty"` - GroupName string `json:"group_name,omitempty"` - ServicePrincipalName string `json:"service_principal_name,omitempty"` - UserName string `json:"user_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func registeredModelAccessControlResponseFromPb(pb *registeredModelAccessControlResponsePb) (*RegisteredModelAccessControlResponse, error) { - if pb == nil { - return nil, nil - } - st := &RegisteredModelAccessControlResponse{} - st.AllPermissions = pb.AllPermissions - st.DisplayName = pb.DisplayName - st.GroupName = pb.GroupName - st.ServicePrincipalName = pb.ServicePrincipalName - st.UserName = pb.UserName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *registeredModelAccessControlResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st registeredModelAccessControlResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func registeredModelPermissionToPb(st *RegisteredModelPermission) (*registeredModelPermissionPb, error) { - if st == nil { - return nil, nil - } - pb := ®isteredModelPermissionPb{} - pb.Inherited = st.Inherited - pb.InheritedFromObject = st.InheritedFromObject - pb.PermissionLevel = st.PermissionLevel - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type registeredModelPermissionPb struct { - Inherited bool `json:"inherited,omitempty"` - InheritedFromObject []string `json:"inherited_from_object,omitempty"` - PermissionLevel RegisteredModelPermissionLevel `json:"permission_level,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func registeredModelPermissionFromPb(pb *registeredModelPermissionPb) (*RegisteredModelPermission, error) { - if pb == nil { - return nil, nil - } - st := &RegisteredModelPermission{} - st.Inherited = pb.Inherited - st.InheritedFromObject = pb.InheritedFromObject - st.PermissionLevel = pb.PermissionLevel - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *registeredModelPermissionPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st registeredModelPermissionPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func registeredModelPermissionsToPb(st *RegisteredModelPermissions) (*registeredModelPermissionsPb, error) { - if st == nil { - return nil, nil - } - pb := ®isteredModelPermissionsPb{} - pb.AccessControlList = st.AccessControlList - pb.ObjectId = st.ObjectId - pb.ObjectType = st.ObjectType - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type registeredModelPermissionsPb struct { - AccessControlList []RegisteredModelAccessControlResponse `json:"access_control_list,omitempty"` - ObjectId string `json:"object_id,omitempty"` - ObjectType string `json:"object_type,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func registeredModelPermissionsFromPb(pb *registeredModelPermissionsPb) (*RegisteredModelPermissions, error) { - if pb == nil { - return nil, nil - } - st := &RegisteredModelPermissions{} - st.AccessControlList = pb.AccessControlList - st.ObjectId = pb.ObjectId - st.ObjectType = pb.ObjectType - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *registeredModelPermissionsPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st registeredModelPermissionsPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func registeredModelPermissionsDescriptionToPb(st *RegisteredModelPermissionsDescription) (*registeredModelPermissionsDescriptionPb, error) { - if st == nil { - return nil, nil - } - pb := ®isteredModelPermissionsDescriptionPb{} - pb.Description = st.Description - pb.PermissionLevel = st.PermissionLevel - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type registeredModelPermissionsDescriptionPb struct { - Description string `json:"description,omitempty"` - PermissionLevel RegisteredModelPermissionLevel `json:"permission_level,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func registeredModelPermissionsDescriptionFromPb(pb *registeredModelPermissionsDescriptionPb) (*RegisteredModelPermissionsDescription, error) { - if pb == nil { - return nil, nil - } - st := &RegisteredModelPermissionsDescription{} - st.Description = pb.Description - st.PermissionLevel = pb.PermissionLevel - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *registeredModelPermissionsDescriptionPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st registeredModelPermissionsDescriptionPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func registeredModelPermissionsRequestToPb(st *RegisteredModelPermissionsRequest) (*registeredModelPermissionsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := ®isteredModelPermissionsRequestPb{} - pb.AccessControlList = st.AccessControlList - pb.RegisteredModelId = st.RegisteredModelId - - return pb, nil -} - -type registeredModelPermissionsRequestPb struct { - AccessControlList []RegisteredModelAccessControlRequest `json:"access_control_list,omitempty"` - RegisteredModelId string `json:"-" url:"-"` -} - -func registeredModelPermissionsRequestFromPb(pb *registeredModelPermissionsRequestPb) (*RegisteredModelPermissionsRequest, error) { - if pb == nil { - return nil, nil - } - st := &RegisteredModelPermissionsRequest{} - st.AccessControlList = pb.AccessControlList - st.RegisteredModelId = pb.RegisteredModelId - - return st, nil -} - -func registryWebhookToPb(st *RegistryWebhook) (*registryWebhookPb, error) { - if st == nil { - return nil, nil - } - pb := ®istryWebhookPb{} - pb.CreationTimestamp = st.CreationTimestamp - pb.Description = st.Description - pb.Events = st.Events - pb.HttpUrlSpec = st.HttpUrlSpec - pb.Id = st.Id - pb.JobSpec = st.JobSpec - pb.LastUpdatedTimestamp = st.LastUpdatedTimestamp - pb.ModelName = st.ModelName - pb.Status = st.Status - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type registryWebhookPb struct { - CreationTimestamp int64 `json:"creation_timestamp,omitempty"` - Description string `json:"description,omitempty"` - Events []RegistryWebhookEvent `json:"events,omitempty"` - HttpUrlSpec *HttpUrlSpecWithoutSecret `json:"http_url_spec,omitempty"` - Id string `json:"id,omitempty"` - JobSpec *JobSpecWithoutSecret `json:"job_spec,omitempty"` - LastUpdatedTimestamp int64 `json:"last_updated_timestamp,omitempty"` - ModelName string `json:"model_name,omitempty"` - Status RegistryWebhookStatus `json:"status,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func registryWebhookFromPb(pb *registryWebhookPb) (*RegistryWebhook, error) { - if pb == nil { - return nil, nil - } - st := &RegistryWebhook{} - st.CreationTimestamp = pb.CreationTimestamp - st.Description = pb.Description - st.Events = pb.Events - st.HttpUrlSpec = pb.HttpUrlSpec - st.Id = pb.Id - st.JobSpec = pb.JobSpec - st.LastUpdatedTimestamp = pb.LastUpdatedTimestamp - st.ModelName = pb.ModelName - st.Status = pb.Status - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *registryWebhookPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st registryWebhookPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func rejectTransitionRequestToPb(st *RejectTransitionRequest) (*rejectTransitionRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &rejectTransitionRequestPb{} - pb.Comment = st.Comment - pb.Name = st.Name - pb.Stage = st.Stage - pb.Version = st.Version - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type rejectTransitionRequestPb struct { - Comment string `json:"comment,omitempty"` - Name string `json:"name"` - Stage Stage `json:"stage"` - Version string `json:"version"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func rejectTransitionRequestFromPb(pb *rejectTransitionRequestPb) (*RejectTransitionRequest, error) { - if pb == nil { - return nil, nil - } - st := &RejectTransitionRequest{} - st.Comment = pb.Comment - st.Name = pb.Name - st.Stage = pb.Stage - st.Version = pb.Version - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *rejectTransitionRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st rejectTransitionRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func rejectTransitionRequestResponseToPb(st *RejectTransitionRequestResponse) (*rejectTransitionRequestResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &rejectTransitionRequestResponsePb{} - pb.Activity = st.Activity - - return pb, nil -} - -type rejectTransitionRequestResponsePb struct { - Activity *Activity `json:"activity,omitempty"` -} - -func rejectTransitionRequestResponseFromPb(pb *rejectTransitionRequestResponsePb) (*RejectTransitionRequestResponse, error) { - if pb == nil { - return nil, nil - } - st := &RejectTransitionRequestResponse{} - st.Activity = pb.Activity - - return st, nil -} - -func renameModelRequestToPb(st *RenameModelRequest) (*renameModelRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &renameModelRequestPb{} - pb.Name = st.Name - pb.NewName = st.NewName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type renameModelRequestPb struct { - Name string `json:"name"` - NewName string `json:"new_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func renameModelRequestFromPb(pb *renameModelRequestPb) (*RenameModelRequest, error) { - if pb == nil { - return nil, nil - } - st := &RenameModelRequest{} - st.Name = pb.Name - st.NewName = pb.NewName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *renameModelRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st renameModelRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func renameModelResponseToPb(st *RenameModelResponse) (*renameModelResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &renameModelResponsePb{} - pb.RegisteredModel = st.RegisteredModel - - return pb, nil -} - -type renameModelResponsePb struct { - RegisteredModel *Model `json:"registered_model,omitempty"` -} - -func renameModelResponseFromPb(pb *renameModelResponsePb) (*RenameModelResponse, error) { - if pb == nil { - return nil, nil - } - st := &RenameModelResponse{} - st.RegisteredModel = pb.RegisteredModel - - return st, nil -} - -func restoreExperimentToPb(st *RestoreExperiment) (*restoreExperimentPb, error) { - if st == nil { - return nil, nil - } - pb := &restoreExperimentPb{} - pb.ExperimentId = st.ExperimentId - - return pb, nil -} - -type restoreExperimentPb struct { - ExperimentId string `json:"experiment_id"` -} - -func restoreExperimentFromPb(pb *restoreExperimentPb) (*RestoreExperiment, error) { - if pb == nil { - return nil, nil - } - st := &RestoreExperiment{} - st.ExperimentId = pb.ExperimentId - - return st, nil -} - -func restoreExperimentResponseToPb(st *RestoreExperimentResponse) (*restoreExperimentResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &restoreExperimentResponsePb{} - - return pb, nil -} - -type restoreExperimentResponsePb struct { -} - -func restoreExperimentResponseFromPb(pb *restoreExperimentResponsePb) (*RestoreExperimentResponse, error) { - if pb == nil { - return nil, nil - } - st := &RestoreExperimentResponse{} - - return st, nil -} - -func restoreRunToPb(st *RestoreRun) (*restoreRunPb, error) { - if st == nil { - return nil, nil - } - pb := &restoreRunPb{} - pb.RunId = st.RunId - - return pb, nil -} - -type restoreRunPb struct { - RunId string `json:"run_id"` -} - -func restoreRunFromPb(pb *restoreRunPb) (*RestoreRun, error) { - if pb == nil { - return nil, nil - } - st := &RestoreRun{} - st.RunId = pb.RunId - - return st, nil -} - -func restoreRunResponseToPb(st *RestoreRunResponse) (*restoreRunResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &restoreRunResponsePb{} - - return pb, nil -} - -type restoreRunResponsePb struct { -} - -func restoreRunResponseFromPb(pb *restoreRunResponsePb) (*RestoreRunResponse, error) { - if pb == nil { - return nil, nil - } - st := &RestoreRunResponse{} - - return st, nil -} - -func restoreRunsToPb(st *RestoreRuns) (*restoreRunsPb, error) { - if st == nil { - return nil, nil - } - pb := &restoreRunsPb{} - pb.ExperimentId = st.ExperimentId - pb.MaxRuns = st.MaxRuns - pb.MinTimestampMillis = st.MinTimestampMillis - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type restoreRunsPb struct { - ExperimentId string `json:"experiment_id"` - MaxRuns int `json:"max_runs,omitempty"` - MinTimestampMillis int64 `json:"min_timestamp_millis"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func restoreRunsFromPb(pb *restoreRunsPb) (*RestoreRuns, error) { - if pb == nil { - return nil, nil - } - st := &RestoreRuns{} - st.ExperimentId = pb.ExperimentId - st.MaxRuns = pb.MaxRuns - st.MinTimestampMillis = pb.MinTimestampMillis - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *restoreRunsPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st restoreRunsPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func restoreRunsResponseToPb(st *RestoreRunsResponse) (*restoreRunsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &restoreRunsResponsePb{} - pb.RunsRestored = st.RunsRestored - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type restoreRunsResponsePb struct { - RunsRestored int `json:"runs_restored,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func restoreRunsResponseFromPb(pb *restoreRunsResponsePb) (*RestoreRunsResponse, error) { - if pb == nil { - return nil, nil - } - st := &RestoreRunsResponse{} - st.RunsRestored = pb.RunsRestored - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *restoreRunsResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st restoreRunsResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func runToPb(st *Run) (*runPb, error) { - if st == nil { - return nil, nil - } - pb := &runPb{} - pb.Data = st.Data - pb.Info = st.Info - pb.Inputs = st.Inputs - - return pb, nil -} - -type runPb struct { - Data *RunData `json:"data,omitempty"` - Info *RunInfo `json:"info,omitempty"` - Inputs *RunInputs `json:"inputs,omitempty"` -} - -func runFromPb(pb *runPb) (*Run, error) { - if pb == nil { - return nil, nil - } - st := &Run{} - st.Data = pb.Data - st.Info = pb.Info - st.Inputs = pb.Inputs - - return st, nil -} - -func runDataToPb(st *RunData) (*runDataPb, error) { - if st == nil { - return nil, nil - } - pb := &runDataPb{} - pb.Metrics = st.Metrics - pb.Params = st.Params - pb.Tags = st.Tags - - return pb, nil -} - -type runDataPb struct { - Metrics []Metric `json:"metrics,omitempty"` - Params []Param `json:"params,omitempty"` - Tags []RunTag `json:"tags,omitempty"` -} - -func runDataFromPb(pb *runDataPb) (*RunData, error) { - if pb == nil { - return nil, nil - } - st := &RunData{} - st.Metrics = pb.Metrics - st.Params = pb.Params - st.Tags = pb.Tags - - return st, nil -} - -func runInfoToPb(st *RunInfo) (*runInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &runInfoPb{} - pb.ArtifactUri = st.ArtifactUri - pb.EndTime = st.EndTime - pb.ExperimentId = st.ExperimentId - pb.LifecycleStage = st.LifecycleStage - pb.RunId = st.RunId - pb.RunName = st.RunName - pb.RunUuid = st.RunUuid - pb.StartTime = st.StartTime - pb.Status = st.Status - pb.UserId = st.UserId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type runInfoPb struct { - ArtifactUri string `json:"artifact_uri,omitempty"` - EndTime int64 `json:"end_time,omitempty"` - ExperimentId string `json:"experiment_id,omitempty"` - LifecycleStage string `json:"lifecycle_stage,omitempty"` - RunId string `json:"run_id,omitempty"` - RunName string `json:"run_name,omitempty"` - RunUuid string `json:"run_uuid,omitempty"` - StartTime int64 `json:"start_time,omitempty"` - Status RunInfoStatus `json:"status,omitempty"` - UserId string `json:"user_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func runInfoFromPb(pb *runInfoPb) (*RunInfo, error) { - if pb == nil { - return nil, nil - } - st := &RunInfo{} - st.ArtifactUri = pb.ArtifactUri - st.EndTime = pb.EndTime - st.ExperimentId = pb.ExperimentId - st.LifecycleStage = pb.LifecycleStage - st.RunId = pb.RunId - st.RunName = pb.RunName - st.RunUuid = pb.RunUuid - st.StartTime = pb.StartTime - st.Status = pb.Status - st.UserId = pb.UserId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *runInfoPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st runInfoPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func runInputsToPb(st *RunInputs) (*runInputsPb, error) { - if st == nil { - return nil, nil - } - pb := &runInputsPb{} - pb.DatasetInputs = st.DatasetInputs - pb.ModelInputs = st.ModelInputs - - return pb, nil -} - -type runInputsPb struct { - DatasetInputs []DatasetInput `json:"dataset_inputs,omitempty"` - ModelInputs []ModelInput `json:"model_inputs,omitempty"` -} - -func runInputsFromPb(pb *runInputsPb) (*RunInputs, error) { - if pb == nil { - return nil, nil - } - st := &RunInputs{} - st.DatasetInputs = pb.DatasetInputs - st.ModelInputs = pb.ModelInputs - - return st, nil -} - -func runTagToPb(st *RunTag) (*runTagPb, error) { - if st == nil { - return nil, nil - } - pb := &runTagPb{} - pb.Key = st.Key - pb.Value = st.Value - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type runTagPb struct { - Key string `json:"key,omitempty"` - Value string `json:"value,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func runTagFromPb(pb *runTagPb) (*RunTag, error) { - if pb == nil { - return nil, nil - } - st := &RunTag{} - st.Key = pb.Key - st.Value = pb.Value - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *runTagPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st runTagPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func searchExperimentsToPb(st *SearchExperiments) (*searchExperimentsPb, error) { - if st == nil { - return nil, nil - } - pb := &searchExperimentsPb{} - pb.Filter = st.Filter - pb.MaxResults = st.MaxResults - pb.OrderBy = st.OrderBy - pb.PageToken = st.PageToken - pb.ViewType = st.ViewType - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type searchExperimentsPb struct { - Filter string `json:"filter,omitempty"` - MaxResults int64 `json:"max_results,omitempty"` - OrderBy []string `json:"order_by,omitempty"` - PageToken string `json:"page_token,omitempty"` - ViewType ViewType `json:"view_type,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func searchExperimentsFromPb(pb *searchExperimentsPb) (*SearchExperiments, error) { - if pb == nil { - return nil, nil - } - st := &SearchExperiments{} - st.Filter = pb.Filter - st.MaxResults = pb.MaxResults - st.OrderBy = pb.OrderBy - st.PageToken = pb.PageToken - st.ViewType = pb.ViewType - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *searchExperimentsPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st searchExperimentsPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func searchExperimentsResponseToPb(st *SearchExperimentsResponse) (*searchExperimentsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &searchExperimentsResponsePb{} - pb.Experiments = st.Experiments - pb.NextPageToken = st.NextPageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type searchExperimentsResponsePb struct { - Experiments []Experiment `json:"experiments,omitempty"` - NextPageToken string `json:"next_page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func searchExperimentsResponseFromPb(pb *searchExperimentsResponsePb) (*SearchExperimentsResponse, error) { - if pb == nil { - return nil, nil - } - st := &SearchExperimentsResponse{} - st.Experiments = pb.Experiments - st.NextPageToken = pb.NextPageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *searchExperimentsResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st searchExperimentsResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func searchLoggedModelsDatasetToPb(st *SearchLoggedModelsDataset) (*searchLoggedModelsDatasetPb, error) { - if st == nil { - return nil, nil - } - pb := &searchLoggedModelsDatasetPb{} - pb.DatasetDigest = st.DatasetDigest - pb.DatasetName = st.DatasetName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type searchLoggedModelsDatasetPb struct { - DatasetDigest string `json:"dataset_digest,omitempty"` - DatasetName string `json:"dataset_name"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func searchLoggedModelsDatasetFromPb(pb *searchLoggedModelsDatasetPb) (*SearchLoggedModelsDataset, error) { - if pb == nil { - return nil, nil - } - st := &SearchLoggedModelsDataset{} - st.DatasetDigest = pb.DatasetDigest - st.DatasetName = pb.DatasetName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *searchLoggedModelsDatasetPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st searchLoggedModelsDatasetPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func searchLoggedModelsOrderByToPb(st *SearchLoggedModelsOrderBy) (*searchLoggedModelsOrderByPb, error) { - if st == nil { - return nil, nil - } - pb := &searchLoggedModelsOrderByPb{} - pb.Ascending = st.Ascending - pb.DatasetDigest = st.DatasetDigest - pb.DatasetName = st.DatasetName - pb.FieldName = st.FieldName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type searchLoggedModelsOrderByPb struct { - Ascending bool `json:"ascending,omitempty"` - DatasetDigest string `json:"dataset_digest,omitempty"` - DatasetName string `json:"dataset_name,omitempty"` - FieldName string `json:"field_name"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func searchLoggedModelsOrderByFromPb(pb *searchLoggedModelsOrderByPb) (*SearchLoggedModelsOrderBy, error) { - if pb == nil { - return nil, nil - } - st := &SearchLoggedModelsOrderBy{} - st.Ascending = pb.Ascending - st.DatasetDigest = pb.DatasetDigest - st.DatasetName = pb.DatasetName - st.FieldName = pb.FieldName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *searchLoggedModelsOrderByPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st searchLoggedModelsOrderByPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func searchLoggedModelsRequestToPb(st *SearchLoggedModelsRequest) (*searchLoggedModelsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &searchLoggedModelsRequestPb{} - pb.Datasets = st.Datasets - pb.ExperimentIds = st.ExperimentIds - pb.Filter = st.Filter - pb.MaxResults = st.MaxResults - pb.OrderBy = st.OrderBy - pb.PageToken = st.PageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type searchLoggedModelsRequestPb struct { - Datasets []SearchLoggedModelsDataset `json:"datasets,omitempty"` - ExperimentIds []string `json:"experiment_ids,omitempty"` - Filter string `json:"filter,omitempty"` - MaxResults int `json:"max_results,omitempty"` - OrderBy []SearchLoggedModelsOrderBy `json:"order_by,omitempty"` - PageToken string `json:"page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func searchLoggedModelsRequestFromPb(pb *searchLoggedModelsRequestPb) (*SearchLoggedModelsRequest, error) { - if pb == nil { - return nil, nil - } - st := &SearchLoggedModelsRequest{} - st.Datasets = pb.Datasets - st.ExperimentIds = pb.ExperimentIds - st.Filter = pb.Filter - st.MaxResults = pb.MaxResults - st.OrderBy = pb.OrderBy - st.PageToken = pb.PageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *searchLoggedModelsRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st searchLoggedModelsRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func searchLoggedModelsResponseToPb(st *SearchLoggedModelsResponse) (*searchLoggedModelsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &searchLoggedModelsResponsePb{} - pb.Models = st.Models - pb.NextPageToken = st.NextPageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type searchLoggedModelsResponsePb struct { - Models []LoggedModel `json:"models,omitempty"` - NextPageToken string `json:"next_page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func searchLoggedModelsResponseFromPb(pb *searchLoggedModelsResponsePb) (*SearchLoggedModelsResponse, error) { - if pb == nil { - return nil, nil - } - st := &SearchLoggedModelsResponse{} - st.Models = pb.Models - st.NextPageToken = pb.NextPageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *searchLoggedModelsResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st searchLoggedModelsResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func searchModelVersionsRequestToPb(st *SearchModelVersionsRequest) (*searchModelVersionsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &searchModelVersionsRequestPb{} - pb.Filter = st.Filter - pb.MaxResults = st.MaxResults - pb.OrderBy = st.OrderBy - pb.PageToken = st.PageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type searchModelVersionsRequestPb struct { - Filter string `json:"-" url:"filter,omitempty"` - MaxResults int `json:"-" url:"max_results,omitempty"` - OrderBy []string `json:"-" url:"order_by,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func searchModelVersionsRequestFromPb(pb *searchModelVersionsRequestPb) (*SearchModelVersionsRequest, error) { - if pb == nil { - return nil, nil - } - st := &SearchModelVersionsRequest{} - st.Filter = pb.Filter - st.MaxResults = pb.MaxResults - st.OrderBy = pb.OrderBy - st.PageToken = pb.PageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *searchModelVersionsRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st searchModelVersionsRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func searchModelVersionsResponseToPb(st *SearchModelVersionsResponse) (*searchModelVersionsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &searchModelVersionsResponsePb{} - pb.ModelVersions = st.ModelVersions - pb.NextPageToken = st.NextPageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type searchModelVersionsResponsePb struct { - ModelVersions []ModelVersion `json:"model_versions,omitempty"` - NextPageToken string `json:"next_page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func searchModelVersionsResponseFromPb(pb *searchModelVersionsResponsePb) (*SearchModelVersionsResponse, error) { - if pb == nil { - return nil, nil - } - st := &SearchModelVersionsResponse{} - st.ModelVersions = pb.ModelVersions - st.NextPageToken = pb.NextPageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *searchModelVersionsResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st searchModelVersionsResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func searchModelsRequestToPb(st *SearchModelsRequest) (*searchModelsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &searchModelsRequestPb{} - pb.Filter = st.Filter - pb.MaxResults = st.MaxResults - pb.OrderBy = st.OrderBy - pb.PageToken = st.PageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type searchModelsRequestPb struct { - Filter string `json:"-" url:"filter,omitempty"` - MaxResults int `json:"-" url:"max_results,omitempty"` - OrderBy []string `json:"-" url:"order_by,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func searchModelsRequestFromPb(pb *searchModelsRequestPb) (*SearchModelsRequest, error) { - if pb == nil { - return nil, nil - } - st := &SearchModelsRequest{} - st.Filter = pb.Filter - st.MaxResults = pb.MaxResults - st.OrderBy = pb.OrderBy - st.PageToken = pb.PageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *searchModelsRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st searchModelsRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func searchModelsResponseToPb(st *SearchModelsResponse) (*searchModelsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &searchModelsResponsePb{} - pb.NextPageToken = st.NextPageToken - pb.RegisteredModels = st.RegisteredModels - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type searchModelsResponsePb struct { - NextPageToken string `json:"next_page_token,omitempty"` - RegisteredModels []Model `json:"registered_models,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func searchModelsResponseFromPb(pb *searchModelsResponsePb) (*SearchModelsResponse, error) { - if pb == nil { - return nil, nil - } - st := &SearchModelsResponse{} - st.NextPageToken = pb.NextPageToken - st.RegisteredModels = pb.RegisteredModels - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *searchModelsResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st searchModelsResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func searchRunsToPb(st *SearchRuns) (*searchRunsPb, error) { - if st == nil { - return nil, nil - } - pb := &searchRunsPb{} - pb.ExperimentIds = st.ExperimentIds - pb.Filter = st.Filter - pb.MaxResults = st.MaxResults - pb.OrderBy = st.OrderBy - pb.PageToken = st.PageToken - pb.RunViewType = st.RunViewType - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type searchRunsPb struct { - ExperimentIds []string `json:"experiment_ids,omitempty"` - Filter string `json:"filter,omitempty"` - MaxResults int `json:"max_results,omitempty"` - OrderBy []string `json:"order_by,omitempty"` - PageToken string `json:"page_token,omitempty"` - RunViewType ViewType `json:"run_view_type,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func searchRunsFromPb(pb *searchRunsPb) (*SearchRuns, error) { - if pb == nil { - return nil, nil - } - st := &SearchRuns{} - st.ExperimentIds = pb.ExperimentIds - st.Filter = pb.Filter - st.MaxResults = pb.MaxResults - st.OrderBy = pb.OrderBy - st.PageToken = pb.PageToken - st.RunViewType = pb.RunViewType - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *searchRunsPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st searchRunsPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func searchRunsResponseToPb(st *SearchRunsResponse) (*searchRunsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &searchRunsResponsePb{} - pb.NextPageToken = st.NextPageToken - pb.Runs = st.Runs - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type searchRunsResponsePb struct { - NextPageToken string `json:"next_page_token,omitempty"` - Runs []Run `json:"runs,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func searchRunsResponseFromPb(pb *searchRunsResponsePb) (*SearchRunsResponse, error) { - if pb == nil { - return nil, nil - } - st := &SearchRunsResponse{} - st.NextPageToken = pb.NextPageToken - st.Runs = pb.Runs - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *searchRunsResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st searchRunsResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func setExperimentTagToPb(st *SetExperimentTag) (*setExperimentTagPb, error) { - if st == nil { - return nil, nil - } - pb := &setExperimentTagPb{} - pb.ExperimentId = st.ExperimentId - pb.Key = st.Key - pb.Value = st.Value - - return pb, nil -} - -type setExperimentTagPb struct { - ExperimentId string `json:"experiment_id"` - Key string `json:"key"` - Value string `json:"value"` -} - -func setExperimentTagFromPb(pb *setExperimentTagPb) (*SetExperimentTag, error) { - if pb == nil { - return nil, nil - } - st := &SetExperimentTag{} - st.ExperimentId = pb.ExperimentId - st.Key = pb.Key - st.Value = pb.Value - - return st, nil -} - -func setExperimentTagResponseToPb(st *SetExperimentTagResponse) (*setExperimentTagResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &setExperimentTagResponsePb{} - - return pb, nil -} - -type setExperimentTagResponsePb struct { -} - -func setExperimentTagResponseFromPb(pb *setExperimentTagResponsePb) (*SetExperimentTagResponse, error) { - if pb == nil { - return nil, nil - } - st := &SetExperimentTagResponse{} - - return st, nil -} - -func setLoggedModelTagsRequestToPb(st *SetLoggedModelTagsRequest) (*setLoggedModelTagsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &setLoggedModelTagsRequestPb{} - pb.ModelId = st.ModelId - pb.Tags = st.Tags - - return pb, nil -} - -type setLoggedModelTagsRequestPb struct { - ModelId string `json:"-" url:"-"` - Tags []LoggedModelTag `json:"tags,omitempty"` -} - -func setLoggedModelTagsRequestFromPb(pb *setLoggedModelTagsRequestPb) (*SetLoggedModelTagsRequest, error) { - if pb == nil { - return nil, nil - } - st := &SetLoggedModelTagsRequest{} - st.ModelId = pb.ModelId - st.Tags = pb.Tags - - return st, nil -} - -func setLoggedModelTagsResponseToPb(st *SetLoggedModelTagsResponse) (*setLoggedModelTagsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &setLoggedModelTagsResponsePb{} - - return pb, nil -} - -type setLoggedModelTagsResponsePb struct { -} - -func setLoggedModelTagsResponseFromPb(pb *setLoggedModelTagsResponsePb) (*SetLoggedModelTagsResponse, error) { - if pb == nil { - return nil, nil - } - st := &SetLoggedModelTagsResponse{} - - return st, nil -} - -func setModelTagRequestToPb(st *SetModelTagRequest) (*setModelTagRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &setModelTagRequestPb{} - pb.Key = st.Key - pb.Name = st.Name - pb.Value = st.Value - - return pb, nil -} - -type setModelTagRequestPb struct { - Key string `json:"key"` - Name string `json:"name"` - Value string `json:"value"` -} - -func setModelTagRequestFromPb(pb *setModelTagRequestPb) (*SetModelTagRequest, error) { - if pb == nil { - return nil, nil - } - st := &SetModelTagRequest{} - st.Key = pb.Key - st.Name = pb.Name - st.Value = pb.Value - - return st, nil -} - -func setModelTagResponseToPb(st *SetModelTagResponse) (*setModelTagResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &setModelTagResponsePb{} - - return pb, nil -} - -type setModelTagResponsePb struct { -} - -func setModelTagResponseFromPb(pb *setModelTagResponsePb) (*SetModelTagResponse, error) { - if pb == nil { - return nil, nil - } - st := &SetModelTagResponse{} - - return st, nil -} - -func setModelVersionTagRequestToPb(st *SetModelVersionTagRequest) (*setModelVersionTagRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &setModelVersionTagRequestPb{} - pb.Key = st.Key - pb.Name = st.Name - pb.Value = st.Value - pb.Version = st.Version - - return pb, nil -} - -type setModelVersionTagRequestPb struct { - Key string `json:"key"` - Name string `json:"name"` - Value string `json:"value"` - Version string `json:"version"` -} - -func setModelVersionTagRequestFromPb(pb *setModelVersionTagRequestPb) (*SetModelVersionTagRequest, error) { - if pb == nil { - return nil, nil - } - st := &SetModelVersionTagRequest{} - st.Key = pb.Key - st.Name = pb.Name - st.Value = pb.Value - st.Version = pb.Version - - return st, nil -} - -func setModelVersionTagResponseToPb(st *SetModelVersionTagResponse) (*setModelVersionTagResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &setModelVersionTagResponsePb{} - - return pb, nil -} - -type setModelVersionTagResponsePb struct { -} - -func setModelVersionTagResponseFromPb(pb *setModelVersionTagResponsePb) (*SetModelVersionTagResponse, error) { - if pb == nil { - return nil, nil - } - st := &SetModelVersionTagResponse{} - - return st, nil -} - -func setTagToPb(st *SetTag) (*setTagPb, error) { - if st == nil { - return nil, nil - } - pb := &setTagPb{} - pb.Key = st.Key - pb.RunId = st.RunId - pb.RunUuid = st.RunUuid - pb.Value = st.Value - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type setTagPb struct { - Key string `json:"key"` - RunId string `json:"run_id,omitempty"` - RunUuid string `json:"run_uuid,omitempty"` - Value string `json:"value"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func setTagFromPb(pb *setTagPb) (*SetTag, error) { - if pb == nil { - return nil, nil - } - st := &SetTag{} - st.Key = pb.Key - st.RunId = pb.RunId - st.RunUuid = pb.RunUuid - st.Value = pb.Value - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *setTagPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st setTagPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func setTagResponseToPb(st *SetTagResponse) (*setTagResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &setTagResponsePb{} - - return pb, nil -} - -type setTagResponsePb struct { -} - -func setTagResponseFromPb(pb *setTagResponsePb) (*SetTagResponse, error) { - if pb == nil { - return nil, nil - } - st := &SetTagResponse{} - - return st, nil -} - -func testRegistryWebhookToPb(st *TestRegistryWebhook) (*testRegistryWebhookPb, error) { - if st == nil { - return nil, nil - } - pb := &testRegistryWebhookPb{} - pb.Body = st.Body - pb.StatusCode = st.StatusCode - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type testRegistryWebhookPb struct { - Body string `json:"body,omitempty"` - StatusCode int `json:"status_code,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func testRegistryWebhookFromPb(pb *testRegistryWebhookPb) (*TestRegistryWebhook, error) { - if pb == nil { - return nil, nil - } - st := &TestRegistryWebhook{} - st.Body = pb.Body - st.StatusCode = pb.StatusCode - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *testRegistryWebhookPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st testRegistryWebhookPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func testRegistryWebhookRequestToPb(st *TestRegistryWebhookRequest) (*testRegistryWebhookRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &testRegistryWebhookRequestPb{} - pb.Event = st.Event - pb.Id = st.Id - - return pb, nil -} - -type testRegistryWebhookRequestPb struct { - Event RegistryWebhookEvent `json:"event,omitempty"` - Id string `json:"id"` -} - -func testRegistryWebhookRequestFromPb(pb *testRegistryWebhookRequestPb) (*TestRegistryWebhookRequest, error) { - if pb == nil { - return nil, nil - } - st := &TestRegistryWebhookRequest{} - st.Event = pb.Event - st.Id = pb.Id - - return st, nil -} - -func testRegistryWebhookResponseToPb(st *TestRegistryWebhookResponse) (*testRegistryWebhookResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &testRegistryWebhookResponsePb{} - pb.Webhook = st.Webhook - - return pb, nil -} - -type testRegistryWebhookResponsePb struct { - Webhook *TestRegistryWebhook `json:"webhook,omitempty"` -} - -func testRegistryWebhookResponseFromPb(pb *testRegistryWebhookResponsePb) (*TestRegistryWebhookResponse, error) { - if pb == nil { - return nil, nil - } - st := &TestRegistryWebhookResponse{} - st.Webhook = pb.Webhook - - return st, nil -} - -func transitionModelVersionStageDatabricksToPb(st *TransitionModelVersionStageDatabricks) (*transitionModelVersionStageDatabricksPb, error) { - if st == nil { - return nil, nil - } - pb := &transitionModelVersionStageDatabricksPb{} - pb.ArchiveExistingVersions = st.ArchiveExistingVersions - pb.Comment = st.Comment - pb.Name = st.Name - pb.Stage = st.Stage - pb.Version = st.Version - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type transitionModelVersionStageDatabricksPb struct { - ArchiveExistingVersions bool `json:"archive_existing_versions"` - Comment string `json:"comment,omitempty"` - Name string `json:"name"` - Stage Stage `json:"stage"` - Version string `json:"version"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func transitionModelVersionStageDatabricksFromPb(pb *transitionModelVersionStageDatabricksPb) (*TransitionModelVersionStageDatabricks, error) { - if pb == nil { - return nil, nil - } - st := &TransitionModelVersionStageDatabricks{} - st.ArchiveExistingVersions = pb.ArchiveExistingVersions - st.Comment = pb.Comment - st.Name = pb.Name - st.Stage = pb.Stage - st.Version = pb.Version - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *transitionModelVersionStageDatabricksPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st transitionModelVersionStageDatabricksPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func transitionRequestToPb(st *TransitionRequest) (*transitionRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &transitionRequestPb{} - pb.AvailableActions = st.AvailableActions - pb.Comment = st.Comment - pb.CreationTimestamp = st.CreationTimestamp - pb.ToStage = st.ToStage - pb.UserId = st.UserId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type transitionRequestPb struct { - AvailableActions []ActivityAction `json:"available_actions,omitempty"` - Comment string `json:"comment,omitempty"` - CreationTimestamp int64 `json:"creation_timestamp,omitempty"` - ToStage Stage `json:"to_stage,omitempty"` - UserId string `json:"user_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func transitionRequestFromPb(pb *transitionRequestPb) (*TransitionRequest, error) { - if pb == nil { - return nil, nil - } - st := &TransitionRequest{} - st.AvailableActions = pb.AvailableActions - st.Comment = pb.Comment - st.CreationTimestamp = pb.CreationTimestamp - st.ToStage = pb.ToStage - st.UserId = pb.UserId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *transitionRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st transitionRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func transitionStageResponseToPb(st *TransitionStageResponse) (*transitionStageResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &transitionStageResponsePb{} - pb.ModelVersion = st.ModelVersion - - return pb, nil -} - -type transitionStageResponsePb struct { - ModelVersion *ModelVersionDatabricks `json:"model_version,omitempty"` -} - -func transitionStageResponseFromPb(pb *transitionStageResponsePb) (*TransitionStageResponse, error) { - if pb == nil { - return nil, nil - } - st := &TransitionStageResponse{} - st.ModelVersion = pb.ModelVersion - - return st, nil -} - -func updateCommentToPb(st *UpdateComment) (*updateCommentPb, error) { - if st == nil { - return nil, nil - } - pb := &updateCommentPb{} - pb.Comment = st.Comment - pb.Id = st.Id - - return pb, nil -} - -type updateCommentPb struct { - Comment string `json:"comment"` - Id string `json:"id"` -} - -func updateCommentFromPb(pb *updateCommentPb) (*UpdateComment, error) { - if pb == nil { - return nil, nil - } - st := &UpdateComment{} - st.Comment = pb.Comment - st.Id = pb.Id - - return st, nil -} - -func updateCommentResponseToPb(st *UpdateCommentResponse) (*updateCommentResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &updateCommentResponsePb{} - pb.Comment = st.Comment - - return pb, nil -} - -type updateCommentResponsePb struct { - Comment *CommentObject `json:"comment,omitempty"` -} - -func updateCommentResponseFromPb(pb *updateCommentResponsePb) (*UpdateCommentResponse, error) { - if pb == nil { - return nil, nil - } - st := &UpdateCommentResponse{} - st.Comment = pb.Comment - - return st, nil -} - -func updateExperimentToPb(st *UpdateExperiment) (*updateExperimentPb, error) { - if st == nil { - return nil, nil - } - pb := &updateExperimentPb{} - pb.ExperimentId = st.ExperimentId - pb.NewName = st.NewName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type updateExperimentPb struct { - ExperimentId string `json:"experiment_id"` - NewName string `json:"new_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func updateExperimentFromPb(pb *updateExperimentPb) (*UpdateExperiment, error) { - if pb == nil { - return nil, nil - } - st := &UpdateExperiment{} - st.ExperimentId = pb.ExperimentId - st.NewName = pb.NewName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *updateExperimentPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st updateExperimentPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func updateExperimentResponseToPb(st *UpdateExperimentResponse) (*updateExperimentResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &updateExperimentResponsePb{} - - return pb, nil -} - -type updateExperimentResponsePb struct { -} - -func updateExperimentResponseFromPb(pb *updateExperimentResponsePb) (*UpdateExperimentResponse, error) { - if pb == nil { - return nil, nil - } - st := &UpdateExperimentResponse{} - - return st, nil -} - -func updateModelRequestToPb(st *UpdateModelRequest) (*updateModelRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &updateModelRequestPb{} - pb.Description = st.Description - pb.Name = st.Name - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type updateModelRequestPb struct { - Description string `json:"description,omitempty"` - Name string `json:"name"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func updateModelRequestFromPb(pb *updateModelRequestPb) (*UpdateModelRequest, error) { - if pb == nil { - return nil, nil - } - st := &UpdateModelRequest{} - st.Description = pb.Description - st.Name = pb.Name - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *updateModelRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st updateModelRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func updateModelResponseToPb(st *UpdateModelResponse) (*updateModelResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &updateModelResponsePb{} - - return pb, nil -} - -type updateModelResponsePb struct { -} - -func updateModelResponseFromPb(pb *updateModelResponsePb) (*UpdateModelResponse, error) { - if pb == nil { - return nil, nil - } - st := &UpdateModelResponse{} - - return st, nil -} - -func updateModelVersionRequestToPb(st *UpdateModelVersionRequest) (*updateModelVersionRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &updateModelVersionRequestPb{} - pb.Description = st.Description - pb.Name = st.Name - pb.Version = st.Version - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type updateModelVersionRequestPb struct { - Description string `json:"description,omitempty"` - Name string `json:"name"` - Version string `json:"version"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func updateModelVersionRequestFromPb(pb *updateModelVersionRequestPb) (*UpdateModelVersionRequest, error) { - if pb == nil { - return nil, nil - } - st := &UpdateModelVersionRequest{} - st.Description = pb.Description - st.Name = pb.Name - st.Version = pb.Version - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *updateModelVersionRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st updateModelVersionRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func updateModelVersionResponseToPb(st *UpdateModelVersionResponse) (*updateModelVersionResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &updateModelVersionResponsePb{} - - return pb, nil -} - -type updateModelVersionResponsePb struct { -} - -func updateModelVersionResponseFromPb(pb *updateModelVersionResponsePb) (*UpdateModelVersionResponse, error) { - if pb == nil { - return nil, nil - } - st := &UpdateModelVersionResponse{} - - return st, nil -} - -func updateOnlineStoreRequestToPb(st *UpdateOnlineStoreRequest) (*updateOnlineStoreRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &updateOnlineStoreRequestPb{} - pb.Name = st.Name - pb.OnlineStore = st.OnlineStore - pb.UpdateMask = st.UpdateMask - - return pb, nil -} - -type updateOnlineStoreRequestPb struct { - Name string `json:"-" url:"-"` - OnlineStore OnlineStore `json:"online_store"` - UpdateMask string `json:"-" url:"update_mask"` -} - -func updateOnlineStoreRequestFromPb(pb *updateOnlineStoreRequestPb) (*UpdateOnlineStoreRequest, error) { - if pb == nil { - return nil, nil - } - st := &UpdateOnlineStoreRequest{} - st.Name = pb.Name - st.OnlineStore = pb.OnlineStore - st.UpdateMask = pb.UpdateMask - - return st, nil -} - -func updateRegistryWebhookToPb(st *UpdateRegistryWebhook) (*updateRegistryWebhookPb, error) { - if st == nil { - return nil, nil - } - pb := &updateRegistryWebhookPb{} - pb.Description = st.Description - pb.Events = st.Events - pb.HttpUrlSpec = st.HttpUrlSpec - pb.Id = st.Id - pb.JobSpec = st.JobSpec - pb.Status = st.Status - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type updateRegistryWebhookPb struct { - Description string `json:"description,omitempty"` - Events []RegistryWebhookEvent `json:"events,omitempty"` - HttpUrlSpec *HttpUrlSpec `json:"http_url_spec,omitempty"` - Id string `json:"id"` - JobSpec *JobSpec `json:"job_spec,omitempty"` - Status RegistryWebhookStatus `json:"status,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func updateRegistryWebhookFromPb(pb *updateRegistryWebhookPb) (*UpdateRegistryWebhook, error) { - if pb == nil { - return nil, nil - } - st := &UpdateRegistryWebhook{} - st.Description = pb.Description - st.Events = pb.Events - st.HttpUrlSpec = pb.HttpUrlSpec - st.Id = pb.Id - st.JobSpec = pb.JobSpec - st.Status = pb.Status - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *updateRegistryWebhookPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st updateRegistryWebhookPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func updateRunToPb(st *UpdateRun) (*updateRunPb, error) { - if st == nil { - return nil, nil - } - pb := &updateRunPb{} - pb.EndTime = st.EndTime - pb.RunId = st.RunId - pb.RunName = st.RunName - pb.RunUuid = st.RunUuid - pb.Status = st.Status - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type updateRunPb struct { - EndTime int64 `json:"end_time,omitempty"` - RunId string `json:"run_id,omitempty"` - RunName string `json:"run_name,omitempty"` - RunUuid string `json:"run_uuid,omitempty"` - Status UpdateRunStatus `json:"status,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func updateRunFromPb(pb *updateRunPb) (*UpdateRun, error) { - if pb == nil { - return nil, nil - } - st := &UpdateRun{} - st.EndTime = pb.EndTime - st.RunId = pb.RunId - st.RunName = pb.RunName - st.RunUuid = pb.RunUuid - st.Status = pb.Status - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *updateRunPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st updateRunPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func updateRunResponseToPb(st *UpdateRunResponse) (*updateRunResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &updateRunResponsePb{} - pb.RunInfo = st.RunInfo - - return pb, nil -} - -type updateRunResponsePb struct { - RunInfo *RunInfo `json:"run_info,omitempty"` -} - -func updateRunResponseFromPb(pb *updateRunResponsePb) (*UpdateRunResponse, error) { - if pb == nil { - return nil, nil - } - st := &UpdateRunResponse{} - st.RunInfo = pb.RunInfo - - return st, nil -} - -func updateWebhookResponseToPb(st *UpdateWebhookResponse) (*updateWebhookResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &updateWebhookResponsePb{} - - return pb, nil -} - -type updateWebhookResponsePb struct { -} - -func updateWebhookResponseFromPb(pb *updateWebhookResponsePb) (*UpdateWebhookResponse, error) { - if pb == nil { - return nil, nil - } - st := &UpdateWebhookResponse{} - - return st, nil -} - -func durationToPb(d *time.Duration) (*string, error) { - if d == nil { - return nil, nil - } - s := fmt.Sprintf("%.9fs", d.Seconds()) - return &s, nil -} - -func durationFromPb(s *string) (*time.Duration, error) { - if s == nil { - return nil, nil - } - d, err := time.ParseDuration(*s) - if err != nil { - return nil, err - } - return &d, nil -} - -func timestampToPb(t *time.Time) (*string, error) { - if t == nil { - return nil, nil - } - s := t.Format(time.RFC3339) - return &s, nil -} - -func timestampFromPb(s *string) (*time.Time, error) { - if s == nil { - return nil, nil - } - t, err := time.Parse(time.RFC3339, *s) - if err != nil { - return nil, err - } - return &t, nil -} - -func fieldMaskToPb(fm *[]string) (*string, error) { - if fm == nil { - return nil, nil - } - s := strings.Join(*fm, ",") - return &s, nil -} - -func fieldMaskFromPb(s *string) (*[]string, error) { - if s == nil { - return nil, nil - } - fm := strings.Split(*s, ",") - return &fm, nil -} diff --git a/service/ml/model.go b/service/ml/model.go index e0684eaff..a395d2f87 100755 --- a/service/ml/model.go +++ b/service/ml/model.go @@ -3,8 +3,9 @@ package ml import ( - "encoding/json" "fmt" + + "github.com/databricks/databricks-sdk-go/marshal" ) // Activity recorded for the action. @@ -23,13 +24,10 @@ type Activity struct { // // * `SYSTEM_TRANSITION`: For events performed as a side effect, such as // archiving existing model versions in a stage. - // Wire name: 'activity_type' ActivityType ActivityType `json:"activity_type,omitempty"` // User-provided comment associated with the activity. - // Wire name: 'comment' Comment string `json:"comment,omitempty"` // Creation time of the object, as a Unix timestamp in milliseconds. - // Wire name: 'creation_timestamp' CreationTimestamp int64 `json:"creation_timestamp,omitempty"` // Source stage of the transition (if the activity is stage transition // related). Valid values are: @@ -41,19 +39,15 @@ type Activity struct { // * `Production`: Production stage. // // * `Archived`: Archived stage. - // Wire name: 'from_stage' FromStage Stage `json:"from_stage,omitempty"` // Unique identifier for the object. - // Wire name: 'id' Id string `json:"id,omitempty"` // Time of the object at last update, as a Unix timestamp in milliseconds. - // Wire name: 'last_updated_timestamp' LastUpdatedTimestamp int64 `json:"last_updated_timestamp,omitempty"` // Comment made by system, for example explaining an activity of type // `SYSTEM_TRANSITION`. It usually describes a side effect, such as a // version being archived as part of another version's stage transition, and // may not be returned for some activity types. - // Wire name: 'system_comment' SystemComment string `json:"system_comment,omitempty"` // Target stage of the transition (if the activity is stage transition // related). Valid values are: @@ -65,38 +59,19 @@ type Activity struct { // * `Production`: Production stage. // // * `Archived`: Archived stage. - // Wire name: 'to_stage' ToStage Stage `json:"to_stage,omitempty"` // The username of the user that created the object. - // Wire name: 'user_id' UserId string `json:"user_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *Activity) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &activityPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := activityFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *Activity) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st Activity) MarshalJSON() ([]byte, error) { - pb, err := activityToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s Activity) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // An action that a user (with sufficient permissions) could take on an @@ -224,13 +199,10 @@ func (f *ActivityType) Type() string { type ApproveTransitionRequest struct { // Specifies whether to archive all current model versions in the target // stage. - // Wire name: 'archive_existing_versions' ArchiveExistingVersions bool `json:"archive_existing_versions"` // User-provided comment on the action. - // Wire name: 'comment' Comment string `json:"comment,omitempty"` // Name of the model. - // Wire name: 'name' Name string `json:"name"` // Target stage of the transition. Valid values are: // @@ -241,71 +213,26 @@ type ApproveTransitionRequest struct { // * `Production`: Production stage. // // * `Archived`: Archived stage. - // Wire name: 'stage' Stage Stage `json:"stage"` // Version of the model. - // Wire name: 'version' Version string `json:"version"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ApproveTransitionRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &approveTransitionRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := approveTransitionRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ApproveTransitionRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ApproveTransitionRequest) MarshalJSON() ([]byte, error) { - pb, err := approveTransitionRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ApproveTransitionRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ApproveTransitionRequestResponse struct { // Activity recorded for the action. - // Wire name: 'activity' Activity *Activity `json:"activity,omitempty"` } -func (st *ApproveTransitionRequestResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &approveTransitionRequestResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := approveTransitionRequestResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ApproveTransitionRequestResponse) MarshalJSON() ([]byte, error) { - pb, err := approveTransitionRequestResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // An action that a user (with sufficient permissions) could take on a comment. // Valid values are: * `EDIT_COMMENT`: Edit the comment // @@ -352,224 +279,103 @@ func (f *CommentActivityAction) Type() string { // Comment details. type CommentObject struct { // Array of actions on the activity allowed for the current viewer. - // Wire name: 'available_actions' AvailableActions []CommentActivityAction `json:"available_actions,omitempty"` // User-provided comment on the action. - // Wire name: 'comment' Comment string `json:"comment,omitempty"` // Creation time of the object, as a Unix timestamp in milliseconds. - // Wire name: 'creation_timestamp' CreationTimestamp int64 `json:"creation_timestamp,omitempty"` // Comment ID - // Wire name: 'id' Id string `json:"id,omitempty"` // Time of the object at last update, as a Unix timestamp in milliseconds. - // Wire name: 'last_updated_timestamp' LastUpdatedTimestamp int64 `json:"last_updated_timestamp,omitempty"` // The username of the user that created the object. - // Wire name: 'user_id' UserId string `json:"user_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CommentObject) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &commentObjectPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := commentObjectFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CommentObject) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CommentObject) MarshalJSON() ([]byte, error) { - pb, err := commentObjectToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CommentObject) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreateComment struct { // User-provided comment on the action. - // Wire name: 'comment' Comment string `json:"comment"` // Name of the model. - // Wire name: 'name' Name string `json:"name"` // Version of the model. - // Wire name: 'version' Version string `json:"version"` } -func (st *CreateComment) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createCommentPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createCommentFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CreateComment) MarshalJSON() ([]byte, error) { - pb, err := createCommentToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type CreateCommentResponse struct { // Comment details. - // Wire name: 'comment' Comment *CommentObject `json:"comment,omitempty"` } -func (st *CreateCommentResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createCommentResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createCommentResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CreateCommentResponse) MarshalJSON() ([]byte, error) { - pb, err := createCommentResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type CreateExperiment struct { // Location where all artifacts for the experiment are stored. If not // provided, the remote server will select an appropriate default. - // Wire name: 'artifact_location' ArtifactLocation string `json:"artifact_location,omitempty"` // Experiment name. - // Wire name: 'name' Name string `json:"name"` // A collection of tags to set on the experiment. Maximum tag size and // number of tags per request depends on the storage backend. All storage // backends are guaranteed to support tag keys up to 250 bytes in size and // tag values up to 5000 bytes in size. All storage backends are also // guaranteed to support up to 20 tags per request. - // Wire name: 'tags' Tags []ExperimentTag `json:"tags,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateExperiment) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createExperimentPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createExperimentFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateExperiment) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateExperiment) MarshalJSON() ([]byte, error) { - pb, err := createExperimentToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateExperiment) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreateExperimentResponse struct { // Unique identifier for the experiment. - // Wire name: 'experiment_id' ExperimentId string `json:"experiment_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateExperimentResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createExperimentResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createExperimentResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateExperimentResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateExperimentResponse) MarshalJSON() ([]byte, error) { - pb, err := createExperimentResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateExperimentResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreateForecastingExperimentRequest struct { // The column in the training table used to customize weights for each time // series. - // Wire name: 'custom_weights_column' CustomWeightsColumn string `json:"custom_weights_column,omitempty"` // The path in the workspace to store the created experiment. - // Wire name: 'experiment_path' ExperimentPath string `json:"experiment_path,omitempty"` // The time interval between consecutive rows in the time series data. // Possible values include: '1 second', '1 minute', '5 minutes', '10 // minutes', '15 minutes', '30 minutes', 'Hourly', 'Daily', 'Weekly', // 'Monthly', 'Quarterly', 'Yearly'. - // Wire name: 'forecast_granularity' ForecastGranularity string `json:"forecast_granularity"` // The number of time steps into the future to make predictions, calculated // as a multiple of forecast_granularity. This value represents how far // ahead the model should forecast. - // Wire name: 'forecast_horizon' ForecastHorizon int64 `json:"forecast_horizon"` // The fully qualified path of a Unity Catalog table, formatted as // catalog_name.schema_name.table_name, used to store future feature data // for predictions. - // Wire name: 'future_feature_data_path' FutureFeatureDataPath string `json:"future_feature_data_path,omitempty"` // The region code(s) to automatically add holiday features. Currently // supports only one region. - // Wire name: 'holiday_regions' HolidayRegions []string `json:"holiday_regions,omitempty"` // Specifies the list of feature columns to include in model training. These // columns must exist in the training data and be of type string, numerical, @@ -577,378 +383,160 @@ type CreateForecastingExperimentRequest struct { // Note: Certain columns are automatically handled: - Automatically // excluded: split_column, target_column, custom_weights_column. - // Automatically included: time_column. - // Wire name: 'include_features' IncludeFeatures []string `json:"include_features,omitempty"` // The maximum duration for the experiment in minutes. The experiment stops // automatically if it exceeds this limit. - // Wire name: 'max_runtime' MaxRuntime int64 `json:"max_runtime,omitempty"` // The fully qualified path of a Unity Catalog table, formatted as // catalog_name.schema_name.table_name, used to store predictions. - // Wire name: 'prediction_data_path' PredictionDataPath string `json:"prediction_data_path,omitempty"` // The evaluation metric used to optimize the forecasting model. - // Wire name: 'primary_metric' PrimaryMetric string `json:"primary_metric,omitempty"` // The fully qualified path of a Unity Catalog model, formatted as // catalog_name.schema_name.model_name, used to store the best model. - // Wire name: 'register_to' RegisterTo string `json:"register_to,omitempty"` // // The column in the training table used for custom data splits. Values // must be 'train', 'validate', or 'test'. - // Wire name: 'split_column' SplitColumn string `json:"split_column,omitempty"` // The column in the input training table used as the prediction target for // model training. The values in this column are used as the ground truth // for model training. - // Wire name: 'target_column' TargetColumn string `json:"target_column"` // The column in the input training table that represents each row's // timestamp. - // Wire name: 'time_column' TimeColumn string `json:"time_column"` // The column in the training table used to group the dataset for predicting // individual time series. - // Wire name: 'timeseries_identifier_columns' TimeseriesIdentifierColumns []string `json:"timeseries_identifier_columns,omitempty"` // The fully qualified path of a Unity Catalog table, formatted as // catalog_name.schema_name.table_name, used as training data for the // forecasting model. - // Wire name: 'train_data_path' TrainDataPath string `json:"train_data_path"` // List of frameworks to include for model tuning. Possible values are // 'Prophet', 'ARIMA', 'DeepAR'. An empty list includes all supported // frameworks. - // Wire name: 'training_frameworks' TrainingFrameworks []string `json:"training_frameworks,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateForecastingExperimentRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createForecastingExperimentRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createForecastingExperimentRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateForecastingExperimentRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateForecastingExperimentRequest) MarshalJSON() ([]byte, error) { - pb, err := createForecastingExperimentRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateForecastingExperimentRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreateForecastingExperimentResponse struct { // The unique ID of the created forecasting experiment - // Wire name: 'experiment_id' ExperimentId string `json:"experiment_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateForecastingExperimentResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createForecastingExperimentResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createForecastingExperimentResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateForecastingExperimentResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateForecastingExperimentResponse) MarshalJSON() ([]byte, error) { - pb, err := createForecastingExperimentResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateForecastingExperimentResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreateLoggedModelRequest struct { // The ID of the experiment that owns the model. - // Wire name: 'experiment_id' ExperimentId string `json:"experiment_id"` // The type of the model, such as ``"Agent"``, ``"Classifier"``, ``"LLM"``. - // Wire name: 'model_type' ModelType string `json:"model_type,omitempty"` // The name of the model (optional). If not specified one will be generated. - // Wire name: 'name' Name string `json:"name,omitempty"` // Parameters attached to the model. - // Wire name: 'params' Params []LoggedModelParameter `json:"params,omitempty"` // The ID of the run that created the model. - // Wire name: 'source_run_id' SourceRunId string `json:"source_run_id,omitempty"` // Tags attached to the model. - // Wire name: 'tags' Tags []LoggedModelTag `json:"tags,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateLoggedModelRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createLoggedModelRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createLoggedModelRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateLoggedModelRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateLoggedModelRequest) MarshalJSON() ([]byte, error) { - pb, err := createLoggedModelRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateLoggedModelRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreateLoggedModelResponse struct { // The newly created logged model. - // Wire name: 'model' Model *LoggedModel `json:"model,omitempty"` } -func (st *CreateLoggedModelResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createLoggedModelResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createLoggedModelResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CreateLoggedModelResponse) MarshalJSON() ([]byte, error) { - pb, err := createLoggedModelResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type CreateModelRequest struct { // Optional description for registered model. - // Wire name: 'description' Description string `json:"description,omitempty"` // Register models under this name - // Wire name: 'name' Name string `json:"name"` // Additional metadata for registered model. - // Wire name: 'tags' Tags []ModelTag `json:"tags,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateModelRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createModelRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createModelRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateModelRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateModelRequest) MarshalJSON() ([]byte, error) { - pb, err := createModelRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateModelRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreateModelResponse struct { - - // Wire name: 'registered_model' RegisteredModel *Model `json:"registered_model,omitempty"` } -func (st *CreateModelResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createModelResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createModelResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CreateModelResponse) MarshalJSON() ([]byte, error) { - pb, err := createModelResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type CreateModelVersionRequest struct { // Optional description for model version. - // Wire name: 'description' Description string `json:"description,omitempty"` // Register model under this name - // Wire name: 'name' Name string `json:"name"` // MLflow run ID for correlation, if `source` was generated by an experiment // run in MLflow tracking server - // Wire name: 'run_id' RunId string `json:"run_id,omitempty"` // MLflow run link - this is the exact link of the run that generated this // model version, potentially hosted at another instance of MLflow. - // Wire name: 'run_link' RunLink string `json:"run_link,omitempty"` // URI indicating the location of the model artifacts. - // Wire name: 'source' Source string `json:"source"` // Additional metadata for model version. - // Wire name: 'tags' Tags []ModelVersionTag `json:"tags,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateModelVersionRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createModelVersionRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createModelVersionRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateModelVersionRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateModelVersionRequest) MarshalJSON() ([]byte, error) { - pb, err := createModelVersionRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateModelVersionRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreateModelVersionResponse struct { // Return new version number generated for this model in registry. - // Wire name: 'model_version' ModelVersion *ModelVersion `json:"model_version,omitempty"` } -func (st *CreateModelVersionResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createModelVersionResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createModelVersionResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CreateModelVersionResponse) MarshalJSON() ([]byte, error) { - pb, err := createModelVersionResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Create an Online Feature Store type CreateOnlineStoreRequest struct { // An OnlineStore is a logical database instance that stores and serves // features online. - // Wire name: 'online_store' OnlineStore OnlineStore `json:"online_store"` } -func (st *CreateOnlineStoreRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createOnlineStoreRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createOnlineStoreRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CreateOnlineStoreRequest) MarshalJSON() ([]byte, error) { - pb, err := createOnlineStoreRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type CreateRegistryWebhook struct { // User-specified description for the webhook. - // Wire name: 'description' Description string `json:"description,omitempty"` // Events that can trigger a registry webhook: * `MODEL_VERSION_CREATED`: A // new model version was created for the associated model. @@ -983,18 +571,14 @@ type CreateRegistryWebhook struct { // // * `TRANSITION_REQUEST_TO_ARCHIVED_CREATED`: A user requested a model // version be archived. - // Wire name: 'events' Events []RegistryWebhookEvent `json:"events"` - // Wire name: 'http_url_spec' HttpUrlSpec *HttpUrlSpec `json:"http_url_spec,omitempty"` - // Wire name: 'job_spec' JobSpec *JobSpec `json:"job_spec,omitempty"` // If model name is not specified, a registry-wide webhook is created that // listens for the specified events across all versions of all registered // models. - // Wire name: 'model_name' ModelName string `json:"model_name,omitempty"` // Enable or disable triggering the webhook, or put the webhook into test // mode. The default is `ACTIVE`: * `ACTIVE`: Webhook is triggered when an @@ -1004,121 +588,53 @@ type CreateRegistryWebhook struct { // // * `TEST_MODE`: Webhook can be triggered through the test endpoint, but is // not triggered on a real event. - // Wire name: 'status' Status RegistryWebhookStatus `json:"status,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateRegistryWebhook) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createRegistryWebhookPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createRegistryWebhookFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateRegistryWebhook) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateRegistryWebhook) MarshalJSON() ([]byte, error) { - pb, err := createRegistryWebhookToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateRegistryWebhook) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreateRun struct { // ID of the associated experiment. - // Wire name: 'experiment_id' ExperimentId string `json:"experiment_id,omitempty"` // The name of the run. - // Wire name: 'run_name' RunName string `json:"run_name,omitempty"` // Unix timestamp in milliseconds of when the run started. - // Wire name: 'start_time' StartTime int64 `json:"start_time,omitempty"` // Additional metadata for run. - // Wire name: 'tags' Tags []RunTag `json:"tags,omitempty"` // ID of the user executing the run. This field is deprecated as of MLflow // 1.0, and will be removed in a future MLflow release. Use 'mlflow.user' // tag instead. - // Wire name: 'user_id' UserId string `json:"user_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateRun) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createRunPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createRunFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateRun) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateRun) MarshalJSON() ([]byte, error) { - pb, err := createRunToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateRun) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreateRunResponse struct { // The newly created run. - // Wire name: 'run' Run *Run `json:"run,omitempty"` } -func (st *CreateRunResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createRunResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createRunResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CreateRunResponse) MarshalJSON() ([]byte, error) { - pb, err := createRunResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type CreateTransitionRequest struct { // User-provided comment on the action. - // Wire name: 'comment' Comment string `json:"comment,omitempty"` // Name of the model. - // Wire name: 'name' Name string `json:"name"` // Target stage of the transition. Valid values are: // @@ -1129,945 +645,231 @@ type CreateTransitionRequest struct { // * `Production`: Production stage. // // * `Archived`: Archived stage. - // Wire name: 'stage' Stage Stage `json:"stage"` // Version of the model. - // Wire name: 'version' Version string `json:"version"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateTransitionRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createTransitionRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createTransitionRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateTransitionRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateTransitionRequest) MarshalJSON() ([]byte, error) { - pb, err := createTransitionRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateTransitionRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreateTransitionRequestResponse struct { // Transition request details. - // Wire name: 'request' Request *TransitionRequest `json:"request,omitempty"` } -func (st *CreateTransitionRequestResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createTransitionRequestResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createTransitionRequestResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CreateTransitionRequestResponse) MarshalJSON() ([]byte, error) { - pb, err := createTransitionRequestResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type CreateWebhookResponse struct { - - // Wire name: 'webhook' Webhook *RegistryWebhook `json:"webhook,omitempty"` } -func (st *CreateWebhookResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createWebhookResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createWebhookResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CreateWebhookResponse) MarshalJSON() ([]byte, error) { - pb, err := createWebhookResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Dataset. Represents a reference to data used for training, testing, or // evaluation during the model development process. type Dataset struct { // Dataset digest, e.g. an md5 hash of the dataset that uniquely identifies // it within datasets of the same name. - // Wire name: 'digest' Digest string `json:"digest"` // The name of the dataset. E.g. “my.uc.table@2” “nyc-taxi-dataset”, // “fantastic-elk-3” - // Wire name: 'name' Name string `json:"name"` // The profile of the dataset. Summary statistics for the dataset, such as // the number of rows in a table, the mean / std / mode of each column in a // table, or the number of elements in an array. - // Wire name: 'profile' Profile string `json:"profile,omitempty"` // The schema of the dataset. E.g., MLflow ColSpec JSON for a dataframe, // MLflow TensorSpec JSON for an ndarray, or another schema format. - // Wire name: 'schema' Schema string `json:"schema,omitempty"` // Source information for the dataset. Note that the source may not exactly // reproduce the dataset if it was transformed / modified before use with // MLflow. - // Wire name: 'source' Source string `json:"source"` // The type of the dataset source, e.g. ‘databricks-uc-table’, // ‘DBFS’, ‘S3’, ... - // Wire name: 'source_type' SourceType string `json:"source_type"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *Dataset) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &datasetPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := datasetFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *Dataset) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st Dataset) MarshalJSON() ([]byte, error) { - pb, err := datasetToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s Dataset) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // DatasetInput. Represents a dataset and input tags. type DatasetInput struct { // The dataset being used as a Run input. - // Wire name: 'dataset' Dataset Dataset `json:"dataset"` // A list of tags for the dataset input, e.g. a “context” tag with value // “training” - // Wire name: 'tags' Tags []InputTag `json:"tags,omitempty"` } -func (st *DatasetInput) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &datasetInputPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := datasetInputFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DatasetInput) MarshalJSON() ([]byte, error) { - pb, err := datasetInputToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Delete a comment type DeleteCommentRequest struct { // Unique identifier of an activity - Id string `json:"-" tf:"-"` -} - -func (st *DeleteCommentRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteCommentRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteCommentRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteCommentRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteCommentRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Id string `json:"-" url:"id"` } type DeleteCommentResponse struct { } -func (st *DeleteCommentResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteCommentResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteCommentResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteCommentResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteCommentResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type DeleteExperiment struct { // ID of the associated experiment. - // Wire name: 'experiment_id' ExperimentId string `json:"experiment_id"` } -func (st *DeleteExperiment) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteExperimentPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteExperimentFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteExperiment) MarshalJSON() ([]byte, error) { - pb, err := deleteExperimentToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type DeleteExperimentResponse struct { } -func (st *DeleteExperimentResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteExperimentResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteExperimentResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteExperimentResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteExperimentResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Delete a logged model type DeleteLoggedModelRequest struct { // The ID of the logged model to delete. - ModelId string `json:"-" tf:"-"` -} - -func (st *DeleteLoggedModelRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteLoggedModelRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteLoggedModelRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteLoggedModelRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteLoggedModelRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + ModelId string `json:"-" url:"-"` } type DeleteLoggedModelResponse struct { } -func (st *DeleteLoggedModelResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteLoggedModelResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteLoggedModelResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteLoggedModelResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteLoggedModelResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Delete a tag on a logged model type DeleteLoggedModelTagRequest struct { // The ID of the logged model to delete the tag from. - ModelId string `json:"-" tf:"-"` + ModelId string `json:"-" url:"-"` // The tag key. - TagKey string `json:"-" tf:"-"` -} - -func (st *DeleteLoggedModelTagRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteLoggedModelTagRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteLoggedModelTagRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteLoggedModelTagRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteLoggedModelTagRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + TagKey string `json:"-" url:"-"` } type DeleteLoggedModelTagResponse struct { } -func (st *DeleteLoggedModelTagResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteLoggedModelTagResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteLoggedModelTagResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteLoggedModelTagResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteLoggedModelTagResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Delete a model type DeleteModelRequest struct { // Registered model unique name identifier. - Name string `json:"-" tf:"-"` -} - -func (st *DeleteModelRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteModelRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteModelRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteModelRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteModelRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Name string `json:"-" url:"name"` } type DeleteModelResponse struct { } -func (st *DeleteModelResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteModelResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteModelResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteModelResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteModelResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Delete a model tag type DeleteModelTagRequest struct { // Name of the tag. The name must be an exact match; wild-card deletion is // not supported. Maximum size is 250 bytes. - Key string `json:"-" tf:"-"` + Key string `json:"-" url:"key"` // Name of the registered model that the tag was logged under. - Name string `json:"-" tf:"-"` -} - -func (st *DeleteModelTagRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteModelTagRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteModelTagRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteModelTagRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteModelTagRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Name string `json:"-" url:"name"` } type DeleteModelTagResponse struct { } -func (st *DeleteModelTagResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteModelTagResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteModelTagResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteModelTagResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteModelTagResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Delete a model version. type DeleteModelVersionRequest struct { // Name of the registered model - Name string `json:"-" tf:"-"` + Name string `json:"-" url:"name"` // Model version number - Version string `json:"-" tf:"-"` + Version string `json:"-" url:"version"` } -func (st *DeleteModelVersionRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteModelVersionRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteModelVersionRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +type DeleteModelVersionResponse struct { } -func (st DeleteModelVersionRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteModelVersionRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +// Delete a model version tag +type DeleteModelVersionTagRequest struct { + // Name of the tag. The name must be an exact match; wild-card deletion is + // not supported. Maximum size is 250 bytes. + Key string `json:"-" url:"key"` + // Name of the registered model that the tag was logged under. + Name string `json:"-" url:"name"` + // Model version number that the tag was logged under. + Version string `json:"-" url:"version"` } -type DeleteModelVersionResponse struct { -} - -func (st *DeleteModelVersionResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteModelVersionResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteModelVersionResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteModelVersionResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteModelVersionResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - -// Delete a model version tag -type DeleteModelVersionTagRequest struct { - // Name of the tag. The name must be an exact match; wild-card deletion is - // not supported. Maximum size is 250 bytes. - Key string `json:"-" tf:"-"` - // Name of the registered model that the tag was logged under. - Name string `json:"-" tf:"-"` - // Model version number that the tag was logged under. - Version string `json:"-" tf:"-"` -} - -func (st *DeleteModelVersionTagRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteModelVersionTagRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteModelVersionTagRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteModelVersionTagRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteModelVersionTagRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - -type DeleteModelVersionTagResponse struct { -} - -func (st *DeleteModelVersionTagResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteModelVersionTagResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteModelVersionTagResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteModelVersionTagResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteModelVersionTagResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +type DeleteModelVersionTagResponse struct { } // Delete an Online Feature Store type DeleteOnlineStoreRequest struct { // Name of the online store to delete. - Name string `json:"-" tf:"-"` -} - -func (st *DeleteOnlineStoreRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteOnlineStoreRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteOnlineStoreRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteOnlineStoreRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteOnlineStoreRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Name string `json:"-" url:"-"` } type DeleteOnlineStoreResponse struct { } -func (st *DeleteOnlineStoreResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteOnlineStoreResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteOnlineStoreResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteOnlineStoreResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteOnlineStoreResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type DeleteRun struct { // ID of the run to delete. - // Wire name: 'run_id' RunId string `json:"run_id"` } -func (st *DeleteRun) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteRunPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteRunFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteRun) MarshalJSON() ([]byte, error) { - pb, err := deleteRunToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type DeleteRunResponse struct { } -func (st *DeleteRunResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteRunResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteRunResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteRunResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteRunResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type DeleteRuns struct { // The ID of the experiment containing the runs to delete. - // Wire name: 'experiment_id' ExperimentId string `json:"experiment_id"` // An optional positive integer indicating the maximum number of runs to // delete. The maximum allowed value for max_runs is 10000. - // Wire name: 'max_runs' MaxRuns int `json:"max_runs,omitempty"` // The maximum creation timestamp in milliseconds since the UNIX epoch for // deleting runs. Only runs created prior to or at this timestamp are // deleted. - // Wire name: 'max_timestamp_millis' MaxTimestampMillis int64 `json:"max_timestamp_millis"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DeleteRuns) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteRunsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteRunsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DeleteRuns) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DeleteRuns) MarshalJSON() ([]byte, error) { - pb, err := deleteRunsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DeleteRuns) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type DeleteRunsResponse struct { // The number of runs deleted. - // Wire name: 'runs_deleted' RunsDeleted int `json:"runs_deleted,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DeleteRunsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteRunsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteRunsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DeleteRunsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DeleteRunsResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteRunsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DeleteRunsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type DeleteTag struct { // Name of the tag. Maximum size is 255 bytes. Must be provided. - // Wire name: 'key' Key string `json:"key"` // ID of the run that the tag was logged under. Must be provided. - // Wire name: 'run_id' RunId string `json:"run_id"` } -func (st *DeleteTag) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteTagPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteTagFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteTag) MarshalJSON() ([]byte, error) { - pb, err := deleteTagToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type DeleteTagResponse struct { } -func (st *DeleteTagResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteTagResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteTagResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteTagResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteTagResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Delete a transition request type DeleteTransitionRequestRequest struct { // User-provided comment on the action. - Comment string `json:"-" tf:"-"` + Comment string `json:"-" url:"comment,omitempty"` // Username of the user who created this request. Of the transition requests // matching the specified details, only the one transition created by this // user will be deleted. - Creator string `json:"-" tf:"-"` + Creator string `json:"-" url:"creator"` // Name of the model. - Name string `json:"-" tf:"-"` + Name string `json:"-" url:"name"` // Target stage of the transition request. Valid values are: // // * `None`: The initial stage of a model version. @@ -2077,66 +879,24 @@ type DeleteTransitionRequestRequest struct { // * `Production`: Production stage. // // * `Archived`: Archived stage. - Stage DeleteTransitionRequestStage `json:"-" tf:"-"` + Stage DeleteTransitionRequestStage `json:"-" url:"stage"` // Version of the model. - Version string `json:"-" tf:"-"` + Version string `json:"-" url:"version"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DeleteTransitionRequestRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteTransitionRequestRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteTransitionRequestRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DeleteTransitionRequestRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DeleteTransitionRequestRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteTransitionRequestRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DeleteTransitionRequestRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type DeleteTransitionRequestResponse struct { } -func (st *DeleteTransitionRequestResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteTransitionRequestResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteTransitionRequestResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteTransitionRequestResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteTransitionRequestResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type DeleteTransitionRequestStage string const DeleteTransitionRequestStageArchived DeleteTransitionRequestStage = `Archived` @@ -2183,241 +943,111 @@ func (f *DeleteTransitionRequestStage) Type() string { // Delete a webhook type DeleteWebhookRequest struct { // Webhook ID required to delete a registry webhook. - Id string `json:"-" tf:"-"` + Id string `json:"-" url:"id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DeleteWebhookRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteWebhookRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteWebhookRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DeleteWebhookRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DeleteWebhookRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteWebhookRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DeleteWebhookRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type DeleteWebhookResponse struct { } -func (st *DeleteWebhookResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteWebhookResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteWebhookResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteWebhookResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteWebhookResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // An experiment and its metadata. type Experiment struct { // Location where artifacts for the experiment are stored. - // Wire name: 'artifact_location' ArtifactLocation string `json:"artifact_location,omitempty"` // Creation time - // Wire name: 'creation_time' CreationTime int64 `json:"creation_time,omitempty"` // Unique identifier for the experiment. - // Wire name: 'experiment_id' ExperimentId string `json:"experiment_id,omitempty"` // Last update time - // Wire name: 'last_update_time' LastUpdateTime int64 `json:"last_update_time,omitempty"` // Current life cycle stage of the experiment: "active" or "deleted". // Deleted experiments are not returned by APIs. - // Wire name: 'lifecycle_stage' LifecycleStage string `json:"lifecycle_stage,omitempty"` // Human readable name that identifies the experiment. - // Wire name: 'name' Name string `json:"name,omitempty"` // Tags: Additional metadata key-value pairs. - // Wire name: 'tags' Tags []ExperimentTag `json:"tags,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *Experiment) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &experimentPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := experimentFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *Experiment) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st Experiment) MarshalJSON() ([]byte, error) { - pb, err := experimentToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s Experiment) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ExperimentAccessControlRequest struct { // name of the group - // Wire name: 'group_name' GroupName string `json:"group_name,omitempty"` // Permission level - // Wire name: 'permission_level' PermissionLevel ExperimentPermissionLevel `json:"permission_level,omitempty"` // application ID of a service principal - // Wire name: 'service_principal_name' ServicePrincipalName string `json:"service_principal_name,omitempty"` // name of the user - // Wire name: 'user_name' UserName string `json:"user_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ExperimentAccessControlRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &experimentAccessControlRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := experimentAccessControlRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ExperimentAccessControlRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ExperimentAccessControlRequest) MarshalJSON() ([]byte, error) { - pb, err := experimentAccessControlRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ExperimentAccessControlRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ExperimentAccessControlResponse struct { // All permissions. - // Wire name: 'all_permissions' AllPermissions []ExperimentPermission `json:"all_permissions,omitempty"` // Display name of the user or service principal. - // Wire name: 'display_name' DisplayName string `json:"display_name,omitempty"` // name of the group - // Wire name: 'group_name' GroupName string `json:"group_name,omitempty"` // Name of the service principal. - // Wire name: 'service_principal_name' ServicePrincipalName string `json:"service_principal_name,omitempty"` // name of the user - // Wire name: 'user_name' UserName string `json:"user_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ExperimentAccessControlResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &experimentAccessControlResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := experimentAccessControlResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ExperimentAccessControlResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ExperimentAccessControlResponse) MarshalJSON() ([]byte, error) { - pb, err := experimentAccessControlResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ExperimentAccessControlResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ExperimentPermission struct { - - // Wire name: 'inherited' Inherited bool `json:"inherited,omitempty"` - // Wire name: 'inherited_from_object' InheritedFromObject []string `json:"inherited_from_object,omitempty"` // Permission level - // Wire name: 'permission_level' PermissionLevel ExperimentPermissionLevel `json:"permission_level,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ExperimentPermission) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &experimentPermissionPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := experimentPermissionFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ExperimentPermission) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ExperimentPermission) MarshalJSON() ([]byte, error) { - pb, err := experimentPermissionToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ExperimentPermission) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Permission level @@ -2462,295 +1092,116 @@ func (f *ExperimentPermissionLevel) Type() string { } type ExperimentPermissions struct { - - // Wire name: 'access_control_list' AccessControlList []ExperimentAccessControlResponse `json:"access_control_list,omitempty"` - // Wire name: 'object_id' ObjectId string `json:"object_id,omitempty"` - // Wire name: 'object_type' ObjectType string `json:"object_type,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ExperimentPermissions) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &experimentPermissionsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := experimentPermissionsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ExperimentPermissions) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ExperimentPermissions) MarshalJSON() ([]byte, error) { - pb, err := experimentPermissionsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ExperimentPermissions) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ExperimentPermissionsDescription struct { - - // Wire name: 'description' Description string `json:"description,omitempty"` // Permission level - // Wire name: 'permission_level' PermissionLevel ExperimentPermissionLevel `json:"permission_level,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ExperimentPermissionsDescription) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &experimentPermissionsDescriptionPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := experimentPermissionsDescriptionFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ExperimentPermissionsDescription) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ExperimentPermissionsDescription) MarshalJSON() ([]byte, error) { - pb, err := experimentPermissionsDescriptionToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ExperimentPermissionsDescription) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ExperimentPermissionsRequest struct { - - // Wire name: 'access_control_list' AccessControlList []ExperimentAccessControlRequest `json:"access_control_list,omitempty"` // The experiment for which to get or manage permissions. - ExperimentId string `json:"-" tf:"-"` -} - -func (st *ExperimentPermissionsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &experimentPermissionsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := experimentPermissionsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ExperimentPermissionsRequest) MarshalJSON() ([]byte, error) { - pb, err := experimentPermissionsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + ExperimentId string `json:"-" url:"-"` } // A tag for an experiment. type ExperimentTag struct { // The tag key. - // Wire name: 'key' Key string `json:"key,omitempty"` // The tag value. - // Wire name: 'value' Value string `json:"value,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ExperimentTag) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &experimentTagPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := experimentTagFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ExperimentTag) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ExperimentTag) MarshalJSON() ([]byte, error) { - pb, err := experimentTagToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ExperimentTag) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Metadata of a single artifact file or directory. type FileInfo struct { // The size in bytes of the file. Unset for directories. - // Wire name: 'file_size' FileSize int64 `json:"file_size,omitempty"` // Whether the path is a directory. - // Wire name: 'is_dir' IsDir bool `json:"is_dir,omitempty"` // The path relative to the root artifact directory run. - // Wire name: 'path' Path string `json:"path,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *FileInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &fileInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := fileInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *FileInfo) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st FileInfo) MarshalJSON() ([]byte, error) { - pb, err := fileInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s FileInfo) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type FinalizeLoggedModelRequest struct { // The ID of the logged model to finalize. - ModelId string `json:"-" tf:"-"` + ModelId string `json:"-" url:"-"` // Whether or not the model is ready for use. // ``"LOGGED_MODEL_UPLOAD_FAILED"`` indicates that something went wrong when // logging the model weights / agent code. - // Wire name: 'status' Status LoggedModelStatus `json:"status"` } -func (st *FinalizeLoggedModelRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &finalizeLoggedModelRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := finalizeLoggedModelRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st FinalizeLoggedModelRequest) MarshalJSON() ([]byte, error) { - pb, err := finalizeLoggedModelRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type FinalizeLoggedModelResponse struct { // The updated logged model. - // Wire name: 'model' Model *LoggedModel `json:"model,omitempty"` } -func (st *FinalizeLoggedModelResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &finalizeLoggedModelResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := finalizeLoggedModelResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st FinalizeLoggedModelResponse) MarshalJSON() ([]byte, error) { - pb, err := finalizeLoggedModelResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Represents a forecasting experiment with its unique identifier, URL, and // state. type ForecastingExperiment struct { // The unique ID for the forecasting experiment. - // Wire name: 'experiment_id' ExperimentId string `json:"experiment_id,omitempty"` // The URL to the forecasting experiment page. - // Wire name: 'experiment_page_url' ExperimentPageUrl string `json:"experiment_page_url,omitempty"` // The current state of the forecasting experiment. - // Wire name: 'state' State ForecastingExperimentState `json:"state,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ForecastingExperiment) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &forecastingExperimentPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := forecastingExperimentFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ForecastingExperiment) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ForecastingExperiment) MarshalJSON() ([]byte, error) { - pb, err := forecastingExperimentToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ForecastingExperiment) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ForecastingExperimentState string @@ -2802,249 +1253,46 @@ func (f *ForecastingExperimentState) Type() string { // Get an experiment by name type GetByNameRequest struct { // Name of the associated experiment. - ExperimentName string `json:"-" tf:"-"` -} - -func (st *GetByNameRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getByNameRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getByNameRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetByNameRequest) MarshalJSON() ([]byte, error) { - pb, err := getByNameRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + ExperimentName string `json:"-" url:"experiment_name"` } type GetExperimentByNameResponse struct { // Experiment details. - // Wire name: 'experiment' Experiment *Experiment `json:"experiment,omitempty"` } -func (st *GetExperimentByNameResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getExperimentByNameResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getExperimentByNameResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetExperimentByNameResponse) MarshalJSON() ([]byte, error) { - pb, err := getExperimentByNameResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Get experiment permission levels type GetExperimentPermissionLevelsRequest struct { // The experiment for which to get or manage permissions. - ExperimentId string `json:"-" tf:"-"` -} - -func (st *GetExperimentPermissionLevelsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getExperimentPermissionLevelsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getExperimentPermissionLevelsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetExperimentPermissionLevelsRequest) MarshalJSON() ([]byte, error) { - pb, err := getExperimentPermissionLevelsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + ExperimentId string `json:"-" url:"-"` } type GetExperimentPermissionLevelsResponse struct { // Specific permission levels - // Wire name: 'permission_levels' PermissionLevels []ExperimentPermissionsDescription `json:"permission_levels,omitempty"` } -func (st *GetExperimentPermissionLevelsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getExperimentPermissionLevelsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getExperimentPermissionLevelsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetExperimentPermissionLevelsResponse) MarshalJSON() ([]byte, error) { - pb, err := getExperimentPermissionLevelsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Get experiment permissions type GetExperimentPermissionsRequest struct { // The experiment for which to get or manage permissions. - ExperimentId string `json:"-" tf:"-"` -} - -func (st *GetExperimentPermissionsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getExperimentPermissionsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getExperimentPermissionsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetExperimentPermissionsRequest) MarshalJSON() ([]byte, error) { - pb, err := getExperimentPermissionsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + ExperimentId string `json:"-" url:"-"` } // Get an experiment type GetExperimentRequest struct { // ID of the associated experiment. - ExperimentId string `json:"-" tf:"-"` -} - -func (st *GetExperimentRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getExperimentRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getExperimentRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetExperimentRequest) MarshalJSON() ([]byte, error) { - pb, err := getExperimentRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + ExperimentId string `json:"-" url:"experiment_id"` } type GetExperimentResponse struct { // Experiment details. - // Wire name: 'experiment' Experiment *Experiment `json:"experiment,omitempty"` } -func (st *GetExperimentResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getExperimentResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getExperimentResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetExperimentResponse) MarshalJSON() ([]byte, error) { - pb, err := getExperimentResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Get a forecasting experiment type GetForecastingExperimentRequest struct { // The unique ID of a forecasting experiment - ExperimentId string `json:"-" tf:"-"` -} - -func (st *GetForecastingExperimentRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getForecastingExperimentRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getForecastingExperimentRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetForecastingExperimentRequest) MarshalJSON() ([]byte, error) { - pb, err := getForecastingExperimentRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + ExperimentId string `json:"-" url:"-"` } // Get metric history for a run @@ -3052,605 +1300,173 @@ type GetHistoryRequest struct { // Maximum number of Metric records to return per paginated request. Default // is set to 25,000. If set higher than 25,000, a request Exception will be // raised. - MaxResults int `json:"-" tf:"-"` + MaxResults int `json:"-" url:"max_results,omitempty"` // Name of the metric. - MetricKey string `json:"-" tf:"-"` + MetricKey string `json:"-" url:"metric_key"` // Token indicating the page of metric histories to fetch. - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` // ID of the run from which to fetch metric values. Must be provided. - RunId string `json:"-" tf:"-"` + RunId string `json:"-" url:"run_id,omitempty"` // [Deprecated, use `run_id` instead] ID of the run from which to fetch // metric values. This field will be removed in a future MLflow version. - RunUuid string `json:"-" tf:"-"` + RunUuid string `json:"-" url:"run_uuid,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetHistoryRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getHistoryRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getHistoryRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetHistoryRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetHistoryRequest) MarshalJSON() ([]byte, error) { - pb, err := getHistoryRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetHistoryRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type GetLatestVersionsRequest struct { // Registered model unique name identifier. - // Wire name: 'name' Name string `json:"name"` // List of stages. - // Wire name: 'stages' Stages []string `json:"stages,omitempty"` } -func (st *GetLatestVersionsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getLatestVersionsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getLatestVersionsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetLatestVersionsRequest) MarshalJSON() ([]byte, error) { - pb, err := getLatestVersionsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type GetLatestVersionsResponse struct { // Latest version models for each requests stage. Only return models with // current `READY` status. If no `stages` provided, returns the latest // version for each stage, including `"None"`. - // Wire name: 'model_versions' ModelVersions []ModelVersion `json:"model_versions,omitempty"` } -func (st *GetLatestVersionsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getLatestVersionsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getLatestVersionsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetLatestVersionsResponse) MarshalJSON() ([]byte, error) { - pb, err := getLatestVersionsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Get a logged model type GetLoggedModelRequest struct { // The ID of the logged model to retrieve. - ModelId string `json:"-" tf:"-"` -} - -func (st *GetLoggedModelRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getLoggedModelRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getLoggedModelRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetLoggedModelRequest) MarshalJSON() ([]byte, error) { - pb, err := getLoggedModelRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + ModelId string `json:"-" url:"-"` } type GetLoggedModelResponse struct { // The retrieved logged model. - // Wire name: 'model' Model *LoggedModel `json:"model,omitempty"` } -func (st *GetLoggedModelResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getLoggedModelResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getLoggedModelResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetLoggedModelResponse) MarshalJSON() ([]byte, error) { - pb, err := getLoggedModelResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type GetMetricHistoryResponse struct { // All logged values for this metric if `max_results` is not specified in // the request or if the total count of metrics returned is less than the // service level pagination threshold. Otherwise, this is one page of // results. - // Wire name: 'metrics' Metrics []Metric `json:"metrics,omitempty"` // A token that can be used to issue a query for the next page of metric // history values. A missing token indicates that no additional metrics are // available to fetch. - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetMetricHistoryResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getMetricHistoryResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getMetricHistoryResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetMetricHistoryResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetMetricHistoryResponse) MarshalJSON() ([]byte, error) { - pb, err := getMetricHistoryResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetMetricHistoryResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get model type GetModelRequest struct { // Registered model unique name identifier. - Name string `json:"-" tf:"-"` -} - -func (st *GetModelRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getModelRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getModelRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetModelRequest) MarshalJSON() ([]byte, error) { - pb, err := getModelRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Name string `json:"-" url:"name"` } type GetModelResponse struct { - - // Wire name: 'registered_model_databricks' RegisteredModelDatabricks *ModelDatabricks `json:"registered_model_databricks,omitempty"` } -func (st *GetModelResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getModelResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getModelResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetModelResponse) MarshalJSON() ([]byte, error) { - pb, err := getModelResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Get a model version URI type GetModelVersionDownloadUriRequest struct { // Name of the registered model - Name string `json:"-" tf:"-"` + Name string `json:"-" url:"name"` // Model version number - Version string `json:"-" tf:"-"` -} - -func (st *GetModelVersionDownloadUriRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getModelVersionDownloadUriRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getModelVersionDownloadUriRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetModelVersionDownloadUriRequest) MarshalJSON() ([]byte, error) { - pb, err := getModelVersionDownloadUriRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Version string `json:"-" url:"version"` } type GetModelVersionDownloadUriResponse struct { // URI corresponding to where artifacts for this model version are stored. - // Wire name: 'artifact_uri' ArtifactUri string `json:"artifact_uri,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetModelVersionDownloadUriResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getModelVersionDownloadUriResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getModelVersionDownloadUriResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetModelVersionDownloadUriResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetModelVersionDownloadUriResponse) MarshalJSON() ([]byte, error) { - pb, err := getModelVersionDownloadUriResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetModelVersionDownloadUriResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get a model version type GetModelVersionRequest struct { // Name of the registered model - Name string `json:"-" tf:"-"` + Name string `json:"-" url:"name"` // Model version number - Version string `json:"-" tf:"-"` -} - -func (st *GetModelVersionRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getModelVersionRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getModelVersionRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetModelVersionRequest) MarshalJSON() ([]byte, error) { - pb, err := getModelVersionRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Version string `json:"-" url:"version"` } type GetModelVersionResponse struct { - - // Wire name: 'model_version' ModelVersion *ModelVersion `json:"model_version,omitempty"` } -func (st *GetModelVersionResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getModelVersionResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getModelVersionResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetModelVersionResponse) MarshalJSON() ([]byte, error) { - pb, err := getModelVersionResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Get an Online Feature Store type GetOnlineStoreRequest struct { // Name of the online store to get. - Name string `json:"-" tf:"-"` -} - -func (st *GetOnlineStoreRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getOnlineStoreRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getOnlineStoreRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetOnlineStoreRequest) MarshalJSON() ([]byte, error) { - pb, err := getOnlineStoreRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Name string `json:"-" url:"-"` } // Get registered model permission levels type GetRegisteredModelPermissionLevelsRequest struct { // The registered model for which to get or manage permissions. - RegisteredModelId string `json:"-" tf:"-"` -} - -func (st *GetRegisteredModelPermissionLevelsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getRegisteredModelPermissionLevelsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getRegisteredModelPermissionLevelsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetRegisteredModelPermissionLevelsRequest) MarshalJSON() ([]byte, error) { - pb, err := getRegisteredModelPermissionLevelsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + RegisteredModelId string `json:"-" url:"-"` } type GetRegisteredModelPermissionLevelsResponse struct { // Specific permission levels - // Wire name: 'permission_levels' PermissionLevels []RegisteredModelPermissionsDescription `json:"permission_levels,omitempty"` } -func (st *GetRegisteredModelPermissionLevelsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getRegisteredModelPermissionLevelsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getRegisteredModelPermissionLevelsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetRegisteredModelPermissionLevelsResponse) MarshalJSON() ([]byte, error) { - pb, err := getRegisteredModelPermissionLevelsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Get registered model permissions type GetRegisteredModelPermissionsRequest struct { // The registered model for which to get or manage permissions. - RegisteredModelId string `json:"-" tf:"-"` -} - -func (st *GetRegisteredModelPermissionsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getRegisteredModelPermissionsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getRegisteredModelPermissionsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetRegisteredModelPermissionsRequest) MarshalJSON() ([]byte, error) { - pb, err := getRegisteredModelPermissionsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + RegisteredModelId string `json:"-" url:"-"` } // Get a run type GetRunRequest struct { // ID of the run to fetch. Must be provided. - RunId string `json:"-" tf:"-"` + RunId string `json:"-" url:"run_id"` // [Deprecated, use `run_id` instead] ID of the run to fetch. This field // will be removed in a future MLflow version. - RunUuid string `json:"-" tf:"-"` + RunUuid string `json:"-" url:"run_uuid,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetRunRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getRunRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getRunRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetRunRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetRunRequest) MarshalJSON() ([]byte, error) { - pb, err := getRunRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetRunRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type GetRunResponse struct { // Run metadata (name, start time, etc) and data (metrics, params, and // tags). - // Wire name: 'run' Run *Run `json:"run,omitempty"` } -func (st *GetRunResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getRunResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getRunResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetRunResponse) MarshalJSON() ([]byte, error) { - pb, err := getRunResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type HttpUrlSpec struct { // Value of the authorization header that should be sent in the request sent // by the wehbook. It should be of the form `" "`. // If set to an empty string, no authorization header will be included in // the request. - // Wire name: 'authorization' Authorization string `json:"authorization,omitempty"` // Enable/disable SSL certificate validation. Default is true. For // self-signed certificates, this field must be false AND the destination @@ -3659,43 +1475,23 @@ type HttpUrlSpec struct { // HMAC-encoded portion of the payload and acknowledge the risk associated // with disabling hostname validation whereby it becomes more likely that // requests can be maliciously routed to an unintended host. - // Wire name: 'enable_ssl_verification' EnableSslVerification bool `json:"enable_ssl_verification,omitempty"` // Shared secret required for HMAC encoding payload. The HMAC-encoded // payload will be sent in the header as: { "X-Databricks-Signature": // $encoded_payload }. - // Wire name: 'secret' Secret string `json:"secret,omitempty"` // External HTTPS URL called on event trigger (by using a POST request). - // Wire name: 'url' Url string `json:"url"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *HttpUrlSpec) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &httpUrlSpecPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := httpUrlSpecFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *HttpUrlSpec) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st HttpUrlSpec) MarshalJSON() ([]byte, error) { - pb, err := httpUrlSpecToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s HttpUrlSpec) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type HttpUrlSpecWithoutSecret struct { @@ -3706,152 +1502,67 @@ type HttpUrlSpecWithoutSecret struct { // HMAC-encoded portion of the payload and acknowledge the risk associated // with disabling hostname validation whereby it becomes more likely that // requests can be maliciously routed to an unintended host. - // Wire name: 'enable_ssl_verification' EnableSslVerification bool `json:"enable_ssl_verification,omitempty"` // External HTTPS URL called on event trigger (by using a POST request). - // Wire name: 'url' Url string `json:"url,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *HttpUrlSpecWithoutSecret) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &httpUrlSpecWithoutSecretPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := httpUrlSpecWithoutSecretFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *HttpUrlSpecWithoutSecret) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st HttpUrlSpecWithoutSecret) MarshalJSON() ([]byte, error) { - pb, err := httpUrlSpecWithoutSecretToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s HttpUrlSpecWithoutSecret) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Tag for a dataset input. type InputTag struct { // The tag key. - // Wire name: 'key' Key string `json:"key"` // The tag value. - // Wire name: 'value' Value string `json:"value"` } -func (st *InputTag) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &inputTagPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := inputTagFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st InputTag) MarshalJSON() ([]byte, error) { - pb, err := inputTagToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type JobSpec struct { // The personal access token used to authorize webhook's job runs. - // Wire name: 'access_token' AccessToken string `json:"access_token"` // ID of the job that the webhook runs. - // Wire name: 'job_id' JobId string `json:"job_id"` // URL of the workspace containing the job that this webhook runs. If not // specified, the job’s workspace URL is assumed to be the same as the // workspace where the webhook is created. - // Wire name: 'workspace_url' WorkspaceUrl string `json:"workspace_url,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *JobSpec) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &jobSpecPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := jobSpecFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *JobSpec) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st JobSpec) MarshalJSON() ([]byte, error) { - pb, err := jobSpecToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s JobSpec) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type JobSpecWithoutSecret struct { // ID of the job that the webhook runs. - // Wire name: 'job_id' JobId string `json:"job_id,omitempty"` // URL of the workspace containing the job that this webhook runs. Defaults // to the workspace URL in which the webhook is created. If not specified, // the job’s workspace is assumed to be the same as the webhook’s. - // Wire name: 'workspace_url' WorkspaceUrl string `json:"workspace_url,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *JobSpecWithoutSecret) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &jobSpecWithoutSecretPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := jobSpecWithoutSecretFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *JobSpecWithoutSecret) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st JobSpecWithoutSecret) MarshalJSON() ([]byte, error) { - pb, err := jobSpecWithoutSecretToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s JobSpecWithoutSecret) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // List artifacts @@ -3862,81 +1573,44 @@ type ListArtifactsRequest struct { // `/api/2.0/fs/directories{directory_path}` for listing artifacts in UC // Volumes, which supports pagination. See [List directory contents | Files // API](/api/workspace/files/listdirectorycontents). - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` // Filter artifacts matching this path (a relative path from the root // artifact directory). - Path string `json:"-" tf:"-"` + Path string `json:"-" url:"path,omitempty"` // ID of the run whose artifacts to list. Must be provided. - RunId string `json:"-" tf:"-"` + RunId string `json:"-" url:"run_id,omitempty"` // [Deprecated, use `run_id` instead] ID of the run whose artifacts to list. // This field will be removed in a future MLflow version. - RunUuid string `json:"-" tf:"-"` + RunUuid string `json:"-" url:"run_uuid,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListArtifactsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listArtifactsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listArtifactsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListArtifactsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListArtifactsRequest) MarshalJSON() ([]byte, error) { - pb, err := listArtifactsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListArtifactsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListArtifactsResponse struct { // The file location and metadata for artifacts. - // Wire name: 'files' Files []FileInfo `json:"files,omitempty"` // The token that can be used to retrieve the next page of artifact results. - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` // The root artifact directory for the run. - // Wire name: 'root_uri' RootUri string `json:"root_uri,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListArtifactsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listArtifactsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listArtifactsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListArtifactsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListArtifactsResponse) MarshalJSON() ([]byte, error) { - pb, err := listArtifactsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListArtifactsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // List experiments @@ -3946,1023 +1620,383 @@ type ListExperimentsRequest struct { // automatically capped at 1000. Callers of this endpoint are encouraged to // pass max_results explicitly and leverage page_token to iterate through // experiments. - MaxResults int64 `json:"-" tf:"-"` + MaxResults int64 `json:"-" url:"max_results,omitempty"` // Token indicating the page of experiments to fetch - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` // Qualifier for type of experiments to be returned. If unspecified, return // only active experiments. - ViewType ViewType `json:"-" tf:"-"` + ViewType ViewType `json:"-" url:"view_type,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListExperimentsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listExperimentsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listExperimentsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListExperimentsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListExperimentsRequest) MarshalJSON() ([]byte, error) { - pb, err := listExperimentsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListExperimentsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListExperimentsResponse struct { // Paginated Experiments beginning with the first item on the requested // page. - // Wire name: 'experiments' Experiments []Experiment `json:"experiments,omitempty"` // Token that can be used to retrieve the next page of experiments. Empty // token means no more experiment is available for retrieval. - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListExperimentsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listExperimentsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listExperimentsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListExperimentsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListExperimentsResponse) MarshalJSON() ([]byte, error) { - pb, err := listExperimentsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListExperimentsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // List models type ListModelsRequest struct { // Maximum number of registered models desired. Max threshold is 1000. - MaxResults int `json:"-" tf:"-"` + MaxResults int `json:"-" url:"max_results,omitempty"` // Pagination token to go to the next page based on a previous query. - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListModelsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listModelsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listModelsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListModelsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListModelsRequest) MarshalJSON() ([]byte, error) { - pb, err := listModelsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListModelsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListModelsResponse struct { // Pagination token to request next page of models for the same query. - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` - // Wire name: 'registered_models' RegisteredModels []Model `json:"registered_models,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListModelsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listModelsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listModelsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListModelsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListModelsResponse) MarshalJSON() ([]byte, error) { - pb, err := listModelsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListModelsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // List Online Feature Stores type ListOnlineStoresRequest struct { // The maximum number of results to return. Defaults to 100 if not // specified. - PageSize int `json:"-" tf:"-"` + PageSize int `json:"-" url:"page_size,omitempty"` // Pagination token to go to the next page based on a previous query. - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListOnlineStoresRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listOnlineStoresRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listOnlineStoresRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListOnlineStoresRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListOnlineStoresRequest) MarshalJSON() ([]byte, error) { - pb, err := listOnlineStoresRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListOnlineStoresRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListOnlineStoresResponse struct { // Pagination token to request the next page of results for this query. - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` // List of online stores. - // Wire name: 'online_stores' OnlineStores []OnlineStore `json:"online_stores,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListOnlineStoresResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listOnlineStoresResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listOnlineStoresResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListOnlineStoresResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListOnlineStoresResponse) MarshalJSON() ([]byte, error) { - pb, err := listOnlineStoresResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListOnlineStoresResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListRegistryWebhooks struct { // Token that can be used to retrieve the next page of artifact results - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` // Array of registry webhooks. - // Wire name: 'webhooks' Webhooks []RegistryWebhook `json:"webhooks,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListRegistryWebhooks) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listRegistryWebhooksPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listRegistryWebhooksFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListRegistryWebhooks) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListRegistryWebhooks) MarshalJSON() ([]byte, error) { - pb, err := listRegistryWebhooksToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListRegistryWebhooks) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // List transition requests type ListTransitionRequestsRequest struct { // Name of the model. - Name string `json:"-" tf:"-"` + Name string `json:"-" url:"name"` // Version of the model. - Version string `json:"-" tf:"-"` -} - -func (st *ListTransitionRequestsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listTransitionRequestsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listTransitionRequestsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ListTransitionRequestsRequest) MarshalJSON() ([]byte, error) { - pb, err := listTransitionRequestsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Version string `json:"-" url:"version"` } type ListTransitionRequestsResponse struct { // Array of open transition requests. - // Wire name: 'requests' Requests []Activity `json:"requests,omitempty"` } -func (st *ListTransitionRequestsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listTransitionRequestsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listTransitionRequestsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ListTransitionRequestsResponse) MarshalJSON() ([]byte, error) { - pb, err := listTransitionRequestsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // List registry webhooks type ListWebhooksRequest struct { // If `events` is specified, any webhook with one or more of the specified // trigger events is included in the output. If `events` is not specified, // webhooks of all event types are included in the output. - Events []RegistryWebhookEvent `json:"-" tf:"-"` + Events []RegistryWebhookEvent `json:"-" url:"events,omitempty"` // If not specified, all webhooks associated with the specified events are // listed, regardless of their associated model. - ModelName string `json:"-" tf:"-"` + ModelName string `json:"-" url:"model_name,omitempty"` // Token indicating the page of artifact results to fetch - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListWebhooksRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listWebhooksRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listWebhooksRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListWebhooksRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListWebhooksRequest) MarshalJSON() ([]byte, error) { - pb, err := listWebhooksRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListWebhooksRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type LogBatch struct { // Metrics to log. A single request can contain up to 1000 metrics, and up // to 1000 metrics, params, and tags in total. - // Wire name: 'metrics' Metrics []Metric `json:"metrics,omitempty"` // Params to log. A single request can contain up to 100 params, and up to // 1000 metrics, params, and tags in total. - // Wire name: 'params' Params []Param `json:"params,omitempty"` // ID of the run to log under - // Wire name: 'run_id' RunId string `json:"run_id,omitempty"` // Tags to log. A single request can contain up to 100 tags, and up to 1000 // metrics, params, and tags in total. - // Wire name: 'tags' Tags []RunTag `json:"tags,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *LogBatch) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &logBatchPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := logBatchFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *LogBatch) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st LogBatch) MarshalJSON() ([]byte, error) { - pb, err := logBatchToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s LogBatch) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type LogBatchResponse struct { } -func (st *LogBatchResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &logBatchResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := logBatchResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st LogBatchResponse) MarshalJSON() ([]byte, error) { - pb, err := logBatchResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type LogInputs struct { // Dataset inputs - // Wire name: 'datasets' Datasets []DatasetInput `json:"datasets,omitempty"` // Model inputs - // Wire name: 'models' Models []ModelInput `json:"models,omitempty"` // ID of the run to log under - // Wire name: 'run_id' RunId string `json:"run_id"` } -func (st *LogInputs) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &logInputsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := logInputsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st LogInputs) MarshalJSON() ([]byte, error) { - pb, err := logInputsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type LogInputsResponse struct { } -func (st *LogInputsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &logInputsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := logInputsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st LogInputsResponse) MarshalJSON() ([]byte, error) { - pb, err := logInputsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type LogLoggedModelParamsRequest struct { // The ID of the logged model to log params for. - ModelId string `json:"-" tf:"-"` + ModelId string `json:"-" url:"-"` // Parameters to attach to the model. - // Wire name: 'params' Params []LoggedModelParameter `json:"params,omitempty"` } -func (st *LogLoggedModelParamsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &logLoggedModelParamsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := logLoggedModelParamsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st LogLoggedModelParamsRequest) MarshalJSON() ([]byte, error) { - pb, err := logLoggedModelParamsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type LogLoggedModelParamsRequestResponse struct { } -func (st *LogLoggedModelParamsRequestResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &logLoggedModelParamsRequestResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := logLoggedModelParamsRequestResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st LogLoggedModelParamsRequestResponse) MarshalJSON() ([]byte, error) { - pb, err := logLoggedModelParamsRequestResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type LogMetric struct { // Dataset digest of the dataset associated with the metric, e.g. an md5 // hash of the dataset that uniquely identifies it within datasets of the // same name. - // Wire name: 'dataset_digest' DatasetDigest string `json:"dataset_digest,omitempty"` // The name of the dataset associated with the metric. E.g. // “my.uc.table@2” “nyc-taxi-dataset”, “fantastic-elk-3” - // Wire name: 'dataset_name' DatasetName string `json:"dataset_name,omitempty"` // Name of the metric. - // Wire name: 'key' Key string `json:"key"` // ID of the logged model associated with the metric, if applicable - // Wire name: 'model_id' ModelId string `json:"model_id,omitempty"` // ID of the run under which to log the metric. Must be provided. - // Wire name: 'run_id' RunId string `json:"run_id,omitempty"` // [Deprecated, use `run_id` instead] ID of the run under which to log the // metric. This field will be removed in a future MLflow version. - // Wire name: 'run_uuid' RunUuid string `json:"run_uuid,omitempty"` // Step at which to log the metric - // Wire name: 'step' Step int64 `json:"step,omitempty"` // Unix timestamp in milliseconds at the time metric was logged. - // Wire name: 'timestamp' Timestamp int64 `json:"timestamp"` // Double value of the metric being logged. - // Wire name: 'value' Value float64 `json:"value"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *LogMetric) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &logMetricPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := logMetricFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *LogMetric) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st LogMetric) MarshalJSON() ([]byte, error) { - pb, err := logMetricToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s LogMetric) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type LogMetricResponse struct { } -func (st *LogMetricResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &logMetricResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := logMetricResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st LogMetricResponse) MarshalJSON() ([]byte, error) { - pb, err := logMetricResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type LogModel struct { // MLmodel file in json format. - // Wire name: 'model_json' ModelJson string `json:"model_json,omitempty"` // ID of the run to log under - // Wire name: 'run_id' RunId string `json:"run_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` -} - -func (st *LogModel) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &logModelPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := logModelFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st LogModel) MarshalJSON() ([]byte, error) { - pb, err := logModelToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + ForceSendFields []string `json:"-" url:"-"` } - -type LogModelResponse struct { -} - -func (st *LogModelResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &logModelResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := logModelResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st LogModelResponse) MarshalJSON() ([]byte, error) { - pb, err := logModelResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - -type LogOutputsRequest struct { - // The model outputs from the Run. - // Wire name: 'models' - Models []ModelOutput `json:"models,omitempty"` - // The ID of the Run from which to log outputs. - // Wire name: 'run_id' - RunId string `json:"run_id"` -} - -func (st *LogOutputsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &logOutputsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := logOutputsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil + +func (s *LogModel) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st LogOutputsRequest) MarshalJSON() ([]byte, error) { - pb, err := logOutputsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s LogModel) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } -type LogOutputsResponse struct { +type LogModelResponse struct { } -func (st *LogOutputsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &logOutputsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := logOutputsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +type LogOutputsRequest struct { + // The model outputs from the Run. + Models []ModelOutput `json:"models,omitempty"` + // The ID of the Run from which to log outputs. + RunId string `json:"run_id"` } -func (st LogOutputsResponse) MarshalJSON() ([]byte, error) { - pb, err := logOutputsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +type LogOutputsResponse struct { } type LogParam struct { // Name of the param. Maximum size is 255 bytes. - // Wire name: 'key' Key string `json:"key"` // ID of the run under which to log the param. Must be provided. - // Wire name: 'run_id' RunId string `json:"run_id,omitempty"` // [Deprecated, use `run_id` instead] ID of the run under which to log the // param. This field will be removed in a future MLflow version. - // Wire name: 'run_uuid' RunUuid string `json:"run_uuid,omitempty"` // String value of the param being logged. Maximum size is 500 bytes. - // Wire name: 'value' Value string `json:"value"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *LogParam) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &logParamPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := logParamFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *LogParam) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st LogParam) MarshalJSON() ([]byte, error) { - pb, err := logParamToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s LogParam) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type LogParamResponse struct { } -func (st *LogParamResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &logParamResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := logParamResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st LogParamResponse) MarshalJSON() ([]byte, error) { - pb, err := logParamResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // A logged model message includes logged model attributes, tags, registration // info, params, and linked run metrics. type LoggedModel struct { // The params and metrics attached to the logged model. - // Wire name: 'data' Data *LoggedModelData `json:"data,omitempty"` // The logged model attributes such as model ID, status, tags, etc. - // Wire name: 'info' Info *LoggedModelInfo `json:"info,omitempty"` } -func (st *LoggedModel) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &loggedModelPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := loggedModelFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st LoggedModel) MarshalJSON() ([]byte, error) { - pb, err := loggedModelToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // A LoggedModelData message includes logged model params and linked metrics. type LoggedModelData struct { // Performance metrics linked to the model. - // Wire name: 'metrics' Metrics []Metric `json:"metrics,omitempty"` // Immutable string key-value pairs of the model. - // Wire name: 'params' Params []LoggedModelParameter `json:"params,omitempty"` } -func (st *LoggedModelData) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &loggedModelDataPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := loggedModelDataFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st LoggedModelData) MarshalJSON() ([]byte, error) { - pb, err := loggedModelDataToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // A LoggedModelInfo includes logged model attributes, tags, and registration // info. type LoggedModelInfo struct { // The URI of the directory where model artifacts are stored. - // Wire name: 'artifact_uri' ArtifactUri string `json:"artifact_uri,omitempty"` // The timestamp when the model was created in milliseconds since the UNIX // epoch. - // Wire name: 'creation_timestamp_ms' CreationTimestampMs int64 `json:"creation_timestamp_ms,omitempty"` // The ID of the user or principal that created the model. - // Wire name: 'creator_id' CreatorId int64 `json:"creator_id,omitempty"` // The ID of the experiment that owns the model. - // Wire name: 'experiment_id' ExperimentId string `json:"experiment_id,omitempty"` // The timestamp when the model was last updated in milliseconds since the // UNIX epoch. - // Wire name: 'last_updated_timestamp_ms' LastUpdatedTimestampMs int64 `json:"last_updated_timestamp_ms,omitempty"` // The unique identifier for the logged model. - // Wire name: 'model_id' ModelId string `json:"model_id,omitempty"` // The type of model, such as ``"Agent"``, ``"Classifier"``, ``"LLM"``. - // Wire name: 'model_type' ModelType string `json:"model_type,omitempty"` // The name of the model. - // Wire name: 'name' Name string `json:"name,omitempty"` // The ID of the run that created the model. - // Wire name: 'source_run_id' SourceRunId string `json:"source_run_id,omitempty"` // The status of whether or not the model is ready for use. - // Wire name: 'status' Status LoggedModelStatus `json:"status,omitempty"` // Details on the current model status. - // Wire name: 'status_message' StatusMessage string `json:"status_message,omitempty"` // Mutable string key-value pairs set on the model. - // Wire name: 'tags' Tags []LoggedModelTag `json:"tags,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *LoggedModelInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &loggedModelInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := loggedModelInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *LoggedModelInfo) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st LoggedModelInfo) MarshalJSON() ([]byte, error) { - pb, err := loggedModelInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s LoggedModelInfo) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Parameter associated with a LoggedModel. type LoggedModelParameter struct { // The key identifying this param. - // Wire name: 'key' Key string `json:"key,omitempty"` // The value of this param. - // Wire name: 'value' Value string `json:"value,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *LoggedModelParameter) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &loggedModelParameterPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := loggedModelParameterFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *LoggedModelParameter) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st LoggedModelParameter) MarshalJSON() ([]byte, error) { - pb, err := loggedModelParameterToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s LoggedModelParameter) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // A LoggedModelStatus enum value represents the status of a logged model. @@ -5009,38 +2043,19 @@ func (f *LoggedModelStatus) Type() string { // Tag for a LoggedModel. type LoggedModelTag struct { // The tag key. - // Wire name: 'key' Key string `json:"key,omitempty"` // The tag value. - // Wire name: 'value' Value string `json:"value,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *LoggedModelTag) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &loggedModelTagPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := loggedModelTagFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *LoggedModelTag) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st LoggedModelTag) MarshalJSON() ([]byte, error) { - pb, err := loggedModelTagToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s LoggedModelTag) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Metric associated with a run, represented as a key-value pair. @@ -5048,349 +2063,171 @@ type Metric struct { // The dataset digest of the dataset associated with the metric, e.g. an md5 // hash of the dataset that uniquely identifies it within datasets of the // same name. - // Wire name: 'dataset_digest' DatasetDigest string `json:"dataset_digest,omitempty"` // The name of the dataset associated with the metric. E.g. // “my.uc.table@2” “nyc-taxi-dataset”, “fantastic-elk-3” - // Wire name: 'dataset_name' DatasetName string `json:"dataset_name,omitempty"` // The key identifying the metric. - // Wire name: 'key' Key string `json:"key,omitempty"` // The ID of the logged model or registered model version associated with // the metric, if applicable. - // Wire name: 'model_id' ModelId string `json:"model_id,omitempty"` // The ID of the run containing the metric. - // Wire name: 'run_id' RunId string `json:"run_id,omitempty"` // The step at which the metric was logged. - // Wire name: 'step' Step int64 `json:"step,omitempty"` // The timestamp at which the metric was recorded. - // Wire name: 'timestamp' Timestamp int64 `json:"timestamp,omitempty"` // The value of the metric. - // Wire name: 'value' Value float64 `json:"value,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *Metric) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &metricPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := metricFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *Metric) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st Metric) MarshalJSON() ([]byte, error) { - pb, err := metricToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s Metric) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type Model struct { // Timestamp recorded when this `registered_model` was created. - // Wire name: 'creation_timestamp' CreationTimestamp int64 `json:"creation_timestamp,omitempty"` // Description of this `registered_model`. - // Wire name: 'description' Description string `json:"description,omitempty"` // Timestamp recorded when metadata for this `registered_model` was last // updated. - // Wire name: 'last_updated_timestamp' LastUpdatedTimestamp int64 `json:"last_updated_timestamp,omitempty"` // Collection of latest model versions for each stage. Only contains models // with current `READY` status. - // Wire name: 'latest_versions' LatestVersions []ModelVersion `json:"latest_versions,omitempty"` // Unique name for the model. - // Wire name: 'name' Name string `json:"name,omitempty"` // Tags: Additional metadata key-value pairs for this `registered_model`. - // Wire name: 'tags' Tags []ModelTag `json:"tags,omitempty"` // User that created this `registered_model` - // Wire name: 'user_id' UserId string `json:"user_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *Model) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &modelPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := modelFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *Model) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st Model) MarshalJSON() ([]byte, error) { - pb, err := modelToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s Model) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ModelDatabricks struct { // Creation time of the object, as a Unix timestamp in milliseconds. - // Wire name: 'creation_timestamp' CreationTimestamp int64 `json:"creation_timestamp,omitempty"` // User-specified description for the object. - // Wire name: 'description' Description string `json:"description,omitempty"` // Unique identifier for the object. - // Wire name: 'id' Id string `json:"id,omitempty"` // Time of the object at last update, as a Unix timestamp in milliseconds. - // Wire name: 'last_updated_timestamp' LastUpdatedTimestamp int64 `json:"last_updated_timestamp,omitempty"` // Array of model versions, each the latest version for its stage. - // Wire name: 'latest_versions' LatestVersions []ModelVersion `json:"latest_versions,omitempty"` // Name of the model. - // Wire name: 'name' Name string `json:"name,omitempty"` // Permission level of the requesting user on the object. For what is // allowed at each level, see [MLflow Model permissions](..). - // Wire name: 'permission_level' PermissionLevel PermissionLevel `json:"permission_level,omitempty"` // Array of tags associated with the model. - // Wire name: 'tags' Tags []ModelTag `json:"tags,omitempty"` // The username of the user that created the object. - // Wire name: 'user_id' UserId string `json:"user_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ModelDatabricks) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &modelDatabricksPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := modelDatabricksFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ModelDatabricks) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ModelDatabricks) MarshalJSON() ([]byte, error) { - pb, err := modelDatabricksToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ModelDatabricks) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Represents a LoggedModel or Registered Model Version input to a Run. type ModelInput struct { // The unique identifier of the model. - // Wire name: 'model_id' ModelId string `json:"model_id"` } -func (st *ModelInput) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &modelInputPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := modelInputFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ModelInput) MarshalJSON() ([]byte, error) { - pb, err := modelInputToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Represents a LoggedModel output of a Run. type ModelOutput struct { // The unique identifier of the model. - // Wire name: 'model_id' ModelId string `json:"model_id"` // The step at which the model was produced. - // Wire name: 'step' Step int64 `json:"step"` } -func (st *ModelOutput) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &modelOutputPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := modelOutputFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ModelOutput) MarshalJSON() ([]byte, error) { - pb, err := modelOutputToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type ModelTag struct { // The tag key. - // Wire name: 'key' Key string `json:"key,omitempty"` // The tag value. - // Wire name: 'value' Value string `json:"value,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ModelTag) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &modelTagPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := modelTagFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ModelTag) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ModelTag) MarshalJSON() ([]byte, error) { - pb, err := modelTagToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ModelTag) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ModelVersion struct { // Timestamp recorded when this `model_version` was created. - // Wire name: 'creation_timestamp' CreationTimestamp int64 `json:"creation_timestamp,omitempty"` // Current stage for this `model_version`. - // Wire name: 'current_stage' CurrentStage string `json:"current_stage,omitempty"` // Description of this `model_version`. - // Wire name: 'description' Description string `json:"description,omitempty"` // Timestamp recorded when metadata for this `model_version` was last // updated. - // Wire name: 'last_updated_timestamp' LastUpdatedTimestamp int64 `json:"last_updated_timestamp,omitempty"` // Unique name of the model - // Wire name: 'name' Name string `json:"name,omitempty"` // MLflow run ID used when creating `model_version`, if `source` was // generated by an experiment run stored in MLflow tracking server. - // Wire name: 'run_id' RunId string `json:"run_id,omitempty"` // Run Link: Direct link to the run that generated this version - // Wire name: 'run_link' RunLink string `json:"run_link,omitempty"` // URI indicating the location of the source model artifacts, used when // creating `model_version` - // Wire name: 'source' Source string `json:"source,omitempty"` // Current status of `model_version` - // Wire name: 'status' Status ModelVersionStatus `json:"status,omitempty"` // Details on current `status`, if it is pending or failed. - // Wire name: 'status_message' StatusMessage string `json:"status_message,omitempty"` // Tags: Additional metadata key-value pairs for this `model_version`. - // Wire name: 'tags' Tags []ModelVersionTag `json:"tags,omitempty"` // User that created this `model_version`. - // Wire name: 'user_id' UserId string `json:"user_id,omitempty"` // Model's version number. - // Wire name: 'version' Version string `json:"version,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ModelVersion) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &modelVersionPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := modelVersionFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ModelVersion) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ModelVersion) MarshalJSON() ([]byte, error) { - pb, err := modelVersionToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ModelVersion) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ModelVersionDatabricks struct { // Creation time of the object, as a Unix timestamp in milliseconds. - // Wire name: 'creation_timestamp' CreationTimestamp int64 `json:"creation_timestamp,omitempty"` // Stage of the model version. Valid values are: // @@ -5401,33 +2238,25 @@ type ModelVersionDatabricks struct { // * `Production`: Production stage. // // * `Archived`: Archived stage. - // Wire name: 'current_stage' CurrentStage Stage `json:"current_stage,omitempty"` // User-specified description for the object. - // Wire name: 'description' Description string `json:"description,omitempty"` // Time of the object at last update, as a Unix timestamp in milliseconds. - // Wire name: 'last_updated_timestamp' LastUpdatedTimestamp int64 `json:"last_updated_timestamp,omitempty"` // Name of the model. - // Wire name: 'name' Name string `json:"name,omitempty"` // Permission level of the requesting user on the object. For what is // allowed at each level, see [MLflow Model permissions](..). - // Wire name: 'permission_level' PermissionLevel PermissionLevel `json:"permission_level,omitempty"` // Unique identifier for the MLflow tracking run associated with the source // model artifacts. - // Wire name: 'run_id' RunId string `json:"run_id,omitempty"` // URL of the run associated with the model artifacts. This field is set at // model version creation time only for model versions whose source run is // from a tracking server that is different from the registry server. - // Wire name: 'run_link' RunLink string `json:"run_link,omitempty"` // URI that indicates the location of the source model artifacts. This is // used when creating the model version. - // Wire name: 'source' Source string `json:"source,omitempty"` // The status of the model version. Valid values are: * // `PENDING_REGISTRATION`: Request to register a new model version is @@ -5437,47 +2266,25 @@ type ModelVersionDatabricks struct { // failed. // // * `READY`: Model version is ready for use. - // Wire name: 'status' Status Status `json:"status,omitempty"` // Details on the current status, for example why registration failed. - // Wire name: 'status_message' StatusMessage string `json:"status_message,omitempty"` // Array of tags that are associated with the model version. - // Wire name: 'tags' Tags []ModelVersionTag `json:"tags,omitempty"` // The username of the user that created the object. - // Wire name: 'user_id' UserId string `json:"user_id,omitempty"` // Version of the model. - // Wire name: 'version' Version string `json:"version,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ModelVersionDatabricks) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &modelVersionDatabricksPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := modelVersionDatabricksFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ModelVersionDatabricks) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ModelVersionDatabricks) MarshalJSON() ([]byte, error) { - pb, err := modelVersionDatabricksToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ModelVersionDatabricks) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Current status of `model_version` @@ -5523,38 +2330,19 @@ func (f *ModelVersionStatus) Type() string { type ModelVersionTag struct { // The tag key. - // Wire name: 'key' Key string `json:"key,omitempty"` // The tag value. - // Wire name: 'value' Value string `json:"value,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ModelVersionTag) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &modelVersionTagPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := modelVersionTagFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ModelVersionTag) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ModelVersionTag) MarshalJSON() ([]byte, error) { - pb, err := modelVersionTagToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ModelVersionTag) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // An OnlineStore is a logical database instance that stores and serves features @@ -5562,48 +2350,26 @@ func (st ModelVersionTag) MarshalJSON() ([]byte, error) { type OnlineStore struct { // The capacity of the online store. Valid values are "CU_1", "CU_2", // "CU_4", "CU_8". - // Wire name: 'capacity' Capacity string `json:"capacity,omitempty"` // The timestamp when the online store was created. - // Wire name: 'creation_time' CreationTime string `json:"creation_time,omitempty"` // The email of the creator of the online store. - // Wire name: 'creator' Creator string `json:"creator,omitempty"` // The name of the online store. This is the unique identifier for the // online store. - // Wire name: 'name' Name string `json:"name"` // The current state of the online store. - // Wire name: 'state' State OnlineStoreState `json:"state,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *OnlineStore) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &onlineStorePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := onlineStoreFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *OnlineStore) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st OnlineStore) MarshalJSON() ([]byte, error) { - pb, err := onlineStoreToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s OnlineStore) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type OnlineStoreState string @@ -5658,38 +2424,19 @@ func (f *OnlineStoreState) Type() string { // Param associated with a run. type Param struct { // Key identifying this param. - // Wire name: 'key' Key string `json:"key,omitempty"` // Value associated with this param. - // Wire name: 'value' Value string `json:"value,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *Param) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := ¶mPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := paramFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *Param) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st Param) MarshalJSON() ([]byte, error) { - pb, err := paramToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s Param) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Permission level of the requesting user on the object. For what is allowed at @@ -5742,44 +2489,24 @@ func (f *PermissionLevel) Type() string { type PublishSpec struct { // The name of the target online store. - // Wire name: 'online_store' OnlineStore string `json:"online_store"` // The full three-part (catalog, schema, table) name of the online table. // Auto-generated if not specified. - // Wire name: 'online_table_name' OnlineTableName string `json:"online_table_name,omitempty"` // The publish mode of the pipeline that syncs the online table with the // source table. Defaults to TRIGGERED if not specified. All publish modes // require the source table to have Change Data Feed (CDF) enabled. - // Wire name: 'publish_mode' PublishMode PublishSpecPublishMode `json:"publish_mode,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *PublishSpec) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &publishSpecPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := publishSpecFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *PublishSpec) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st PublishSpec) MarshalJSON() ([]byte, error) { - pb, err := publishSpecToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s PublishSpec) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type PublishSpecPublishMode string @@ -5821,197 +2548,88 @@ func (f *PublishSpecPublishMode) Type() string { type PublishTableRequest struct { // The specification for publishing the online table from the source table. - // Wire name: 'publish_spec' PublishSpec PublishSpec `json:"publish_spec"` // The full three-part (catalog, schema, table) name of the source table. - SourceTableName string `json:"-" tf:"-"` -} - -func (st *PublishTableRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &publishTableRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := publishTableRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st PublishTableRequest) MarshalJSON() ([]byte, error) { - pb, err := publishTableRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + SourceTableName string `json:"-" url:"-"` } type PublishTableResponse struct { // The full three-part (catalog, schema, table) name of the online table. - // Wire name: 'online_table_name' OnlineTableName string `json:"online_table_name,omitempty"` // The ID of the pipeline that syncs the online table with the source table. - // Wire name: 'pipeline_id' PipelineId string `json:"pipeline_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *PublishTableResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &publishTableResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := publishTableResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *PublishTableResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st PublishTableResponse) MarshalJSON() ([]byte, error) { - pb, err := publishTableResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s PublishTableResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type RegisteredModelAccessControlRequest struct { // name of the group - // Wire name: 'group_name' GroupName string `json:"group_name,omitempty"` // Permission level - // Wire name: 'permission_level' PermissionLevel RegisteredModelPermissionLevel `json:"permission_level,omitempty"` // application ID of a service principal - // Wire name: 'service_principal_name' ServicePrincipalName string `json:"service_principal_name,omitempty"` // name of the user - // Wire name: 'user_name' UserName string `json:"user_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *RegisteredModelAccessControlRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := ®isteredModelAccessControlRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := registeredModelAccessControlRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *RegisteredModelAccessControlRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st RegisteredModelAccessControlRequest) MarshalJSON() ([]byte, error) { - pb, err := registeredModelAccessControlRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s RegisteredModelAccessControlRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type RegisteredModelAccessControlResponse struct { // All permissions. - // Wire name: 'all_permissions' AllPermissions []RegisteredModelPermission `json:"all_permissions,omitempty"` // Display name of the user or service principal. - // Wire name: 'display_name' DisplayName string `json:"display_name,omitempty"` // name of the group - // Wire name: 'group_name' GroupName string `json:"group_name,omitempty"` // Name of the service principal. - // Wire name: 'service_principal_name' ServicePrincipalName string `json:"service_principal_name,omitempty"` // name of the user - // Wire name: 'user_name' UserName string `json:"user_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *RegisteredModelAccessControlResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := ®isteredModelAccessControlResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := registeredModelAccessControlResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *RegisteredModelAccessControlResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st RegisteredModelAccessControlResponse) MarshalJSON() ([]byte, error) { - pb, err := registeredModelAccessControlResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s RegisteredModelAccessControlResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type RegisteredModelPermission struct { - - // Wire name: 'inherited' Inherited bool `json:"inherited,omitempty"` - // Wire name: 'inherited_from_object' InheritedFromObject []string `json:"inherited_from_object,omitempty"` // Permission level - // Wire name: 'permission_level' PermissionLevel RegisteredModelPermissionLevel `json:"permission_level,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *RegisteredModelPermission) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := ®isteredModelPermissionPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := registeredModelPermissionFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *RegisteredModelPermission) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st RegisteredModelPermission) MarshalJSON() ([]byte, error) { - pb, err := registeredModelPermissionToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s RegisteredModelPermission) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Permission level @@ -6062,119 +2680,49 @@ func (f *RegisteredModelPermissionLevel) Type() string { } type RegisteredModelPermissions struct { - - // Wire name: 'access_control_list' AccessControlList []RegisteredModelAccessControlResponse `json:"access_control_list,omitempty"` - // Wire name: 'object_id' ObjectId string `json:"object_id,omitempty"` - // Wire name: 'object_type' ObjectType string `json:"object_type,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *RegisteredModelPermissions) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := ®isteredModelPermissionsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := registeredModelPermissionsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *RegisteredModelPermissions) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st RegisteredModelPermissions) MarshalJSON() ([]byte, error) { - pb, err := registeredModelPermissionsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s RegisteredModelPermissions) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type RegisteredModelPermissionsDescription struct { - - // Wire name: 'description' Description string `json:"description,omitempty"` // Permission level - // Wire name: 'permission_level' PermissionLevel RegisteredModelPermissionLevel `json:"permission_level,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *RegisteredModelPermissionsDescription) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := ®isteredModelPermissionsDescriptionPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := registeredModelPermissionsDescriptionFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *RegisteredModelPermissionsDescription) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st RegisteredModelPermissionsDescription) MarshalJSON() ([]byte, error) { - pb, err := registeredModelPermissionsDescriptionToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s RegisteredModelPermissionsDescription) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type RegisteredModelPermissionsRequest struct { - - // Wire name: 'access_control_list' AccessControlList []RegisteredModelAccessControlRequest `json:"access_control_list,omitempty"` // The registered model for which to get or manage permissions. - RegisteredModelId string `json:"-" tf:"-"` -} - -func (st *RegisteredModelPermissionsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := ®isteredModelPermissionsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := registeredModelPermissionsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st RegisteredModelPermissionsRequest) MarshalJSON() ([]byte, error) { - pb, err := registeredModelPermissionsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + RegisteredModelId string `json:"-" url:"-"` } type RegistryWebhook struct { // Creation time of the object, as a Unix timestamp in milliseconds. - // Wire name: 'creation_timestamp' CreationTimestamp int64 `json:"creation_timestamp,omitempty"` // User-specified description for the webhook. - // Wire name: 'description' Description string `json:"description,omitempty"` // Events that can trigger a registry webhook: * `MODEL_VERSION_CREATED`: A // new model version was created for the associated model. @@ -6209,22 +2757,16 @@ type RegistryWebhook struct { // // * `TRANSITION_REQUEST_TO_ARCHIVED_CREATED`: A user requested a model // version be archived. - // Wire name: 'events' Events []RegistryWebhookEvent `json:"events,omitempty"` - // Wire name: 'http_url_spec' HttpUrlSpec *HttpUrlSpecWithoutSecret `json:"http_url_spec,omitempty"` // Webhook ID - // Wire name: 'id' Id string `json:"id,omitempty"` - // Wire name: 'job_spec' JobSpec *JobSpecWithoutSecret `json:"job_spec,omitempty"` // Time of the object at last update, as a Unix timestamp in milliseconds. - // Wire name: 'last_updated_timestamp' LastUpdatedTimestamp int64 `json:"last_updated_timestamp,omitempty"` // Name of the model whose events would trigger this webhook. - // Wire name: 'model_name' ModelName string `json:"model_name,omitempty"` // Enable or disable triggering the webhook, or put the webhook into test // mode. The default is `ACTIVE`: * `ACTIVE`: Webhook is triggered when an @@ -6234,35 +2776,17 @@ type RegistryWebhook struct { // // * `TEST_MODE`: Webhook can be triggered through the test endpoint, but is // not triggered on a real event. - // Wire name: 'status' Status RegistryWebhookStatus `json:"status,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *RegistryWebhook) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := ®istryWebhookPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := registryWebhookFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *RegistryWebhook) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st RegistryWebhook) MarshalJSON() ([]byte, error) { - pb, err := registryWebhookToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s RegistryWebhook) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type RegistryWebhookEvent string @@ -6386,10 +2910,8 @@ func (f *RegistryWebhookStatus) Type() string { type RejectTransitionRequest struct { // User-provided comment on the action. - // Wire name: 'comment' Comment string `json:"comment,omitempty"` // Name of the model. - // Wire name: 'name' Name string `json:"name"` // Target stage of the transition. Valid values are: // @@ -6400,472 +2922,158 @@ type RejectTransitionRequest struct { // * `Production`: Production stage. // // * `Archived`: Archived stage. - // Wire name: 'stage' Stage Stage `json:"stage"` // Version of the model. - // Wire name: 'version' Version string `json:"version"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *RejectTransitionRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &rejectTransitionRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := rejectTransitionRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *RejectTransitionRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st RejectTransitionRequest) MarshalJSON() ([]byte, error) { - pb, err := rejectTransitionRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s RejectTransitionRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type RejectTransitionRequestResponse struct { // Activity recorded for the action. - // Wire name: 'activity' Activity *Activity `json:"activity,omitempty"` } -func (st *RejectTransitionRequestResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &rejectTransitionRequestResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := rejectTransitionRequestResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st RejectTransitionRequestResponse) MarshalJSON() ([]byte, error) { - pb, err := rejectTransitionRequestResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type RenameModelRequest struct { // Registered model unique name identifier. - // Wire name: 'name' Name string `json:"name"` // If provided, updates the name for this `registered_model`. - // Wire name: 'new_name' NewName string `json:"new_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *RenameModelRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &renameModelRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := renameModelRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *RenameModelRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st RenameModelRequest) MarshalJSON() ([]byte, error) { - pb, err := renameModelRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s RenameModelRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type RenameModelResponse struct { - - // Wire name: 'registered_model' RegisteredModel *Model `json:"registered_model,omitempty"` } -func (st *RenameModelResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &renameModelResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := renameModelResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st RenameModelResponse) MarshalJSON() ([]byte, error) { - pb, err := renameModelResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type RestoreExperiment struct { // ID of the associated experiment. - // Wire name: 'experiment_id' ExperimentId string `json:"experiment_id"` } -func (st *RestoreExperiment) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &restoreExperimentPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := restoreExperimentFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st RestoreExperiment) MarshalJSON() ([]byte, error) { - pb, err := restoreExperimentToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type RestoreExperimentResponse struct { } -func (st *RestoreExperimentResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &restoreExperimentResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := restoreExperimentResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st RestoreExperimentResponse) MarshalJSON() ([]byte, error) { - pb, err := restoreExperimentResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type RestoreRun struct { // ID of the run to restore. - // Wire name: 'run_id' RunId string `json:"run_id"` } -func (st *RestoreRun) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &restoreRunPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := restoreRunFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st RestoreRun) MarshalJSON() ([]byte, error) { - pb, err := restoreRunToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type RestoreRunResponse struct { } -func (st *RestoreRunResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &restoreRunResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := restoreRunResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st RestoreRunResponse) MarshalJSON() ([]byte, error) { - pb, err := restoreRunResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type RestoreRuns struct { // The ID of the experiment containing the runs to restore. - // Wire name: 'experiment_id' ExperimentId string `json:"experiment_id"` // An optional positive integer indicating the maximum number of runs to // restore. The maximum allowed value for max_runs is 10000. - // Wire name: 'max_runs' MaxRuns int `json:"max_runs,omitempty"` // The minimum deletion timestamp in milliseconds since the UNIX epoch for // restoring runs. Only runs deleted no earlier than this timestamp are // restored. - // Wire name: 'min_timestamp_millis' MinTimestampMillis int64 `json:"min_timestamp_millis"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *RestoreRuns) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &restoreRunsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := restoreRunsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *RestoreRuns) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st RestoreRuns) MarshalJSON() ([]byte, error) { - pb, err := restoreRunsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s RestoreRuns) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type RestoreRunsResponse struct { // The number of runs restored. - // Wire name: 'runs_restored' RunsRestored int `json:"runs_restored,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *RestoreRunsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &restoreRunsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := restoreRunsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *RestoreRunsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st RestoreRunsResponse) MarshalJSON() ([]byte, error) { - pb, err := restoreRunsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s RestoreRunsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // A single run. type Run struct { // Run data. - // Wire name: 'data' Data *RunData `json:"data,omitempty"` // Run metadata. - // Wire name: 'info' Info *RunInfo `json:"info,omitempty"` // Run inputs. - // Wire name: 'inputs' Inputs *RunInputs `json:"inputs,omitempty"` } -func (st *Run) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &runPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := runFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st Run) MarshalJSON() ([]byte, error) { - pb, err := runToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Run data (metrics, params, and tags). type RunData struct { // Run metrics. - // Wire name: 'metrics' Metrics []Metric `json:"metrics,omitempty"` // Run parameters. - // Wire name: 'params' Params []Param `json:"params,omitempty"` // Additional metadata key-value pairs. - // Wire name: 'tags' Tags []RunTag `json:"tags,omitempty"` } -func (st *RunData) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &runDataPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := runDataFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st RunData) MarshalJSON() ([]byte, error) { - pb, err := runDataToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Metadata of a single run. type RunInfo struct { // URI of the directory where artifacts should be uploaded. This can be a // local path (starting with "/"), or a distributed file system (DFS) path, // like ``s3://bucket/directory`` or ``dbfs:/my/directory``. If not set, the // local ``./mlruns`` directory is chosen. - // Wire name: 'artifact_uri' ArtifactUri string `json:"artifact_uri,omitempty"` // Unix timestamp of when the run ended in milliseconds. - // Wire name: 'end_time' EndTime int64 `json:"end_time,omitempty"` // The experiment ID. - // Wire name: 'experiment_id' ExperimentId string `json:"experiment_id,omitempty"` // Current life cycle stage of the experiment : OneOf("active", "deleted") - // Wire name: 'lifecycle_stage' LifecycleStage string `json:"lifecycle_stage,omitempty"` // Unique identifier for the run. - // Wire name: 'run_id' RunId string `json:"run_id,omitempty"` // The name of the run. - // Wire name: 'run_name' RunName string `json:"run_name,omitempty"` // [Deprecated, use run_id instead] Unique identifier for the run. This // field will be removed in a future MLflow version. - // Wire name: 'run_uuid' RunUuid string `json:"run_uuid,omitempty"` // Unix timestamp of when the run started in milliseconds. - // Wire name: 'start_time' StartTime int64 `json:"start_time,omitempty"` // Current status of the run. - // Wire name: 'status' Status RunInfoStatus `json:"status,omitempty"` // User who initiated the run. This field is deprecated as of MLflow 1.0, // and will be removed in a future MLflow release. Use 'mlflow.user' tag // instead. - // Wire name: 'user_id' UserId string `json:"user_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *RunInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &runInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := runInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *RunInfo) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st RunInfo) MarshalJSON() ([]byte, error) { - pb, err := runInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s RunInfo) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Status of a run. @@ -6915,247 +3123,120 @@ func (f *RunInfoStatus) Type() string { return "RunInfoStatus" } -// Run inputs. -type RunInputs struct { - // Run metrics. - // Wire name: 'dataset_inputs' - DatasetInputs []DatasetInput `json:"dataset_inputs,omitempty"` - // Model inputs to the Run. - // Wire name: 'model_inputs' - ModelInputs []ModelInput `json:"model_inputs,omitempty"` -} - -func (st *RunInputs) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &runInputsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := runInputsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st RunInputs) MarshalJSON() ([]byte, error) { - pb, err := runInputsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +// Run inputs. +type RunInputs struct { + // Run metrics. + DatasetInputs []DatasetInput `json:"dataset_inputs,omitempty"` + // Model inputs to the Run. + ModelInputs []ModelInput `json:"model_inputs,omitempty"` } // Tag for a run. type RunTag struct { // The tag key. - // Wire name: 'key' Key string `json:"key,omitempty"` // The tag value. - // Wire name: 'value' Value string `json:"value,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *RunTag) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &runTagPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := runTagFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *RunTag) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st RunTag) MarshalJSON() ([]byte, error) { - pb, err := runTagToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s RunTag) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type SearchExperiments struct { // String representing a SQL filter condition (e.g. "name ILIKE // 'my-experiment%'") - // Wire name: 'filter' Filter string `json:"filter,omitempty"` // Maximum number of experiments desired. Max threshold is 3000. - // Wire name: 'max_results' MaxResults int64 `json:"max_results,omitempty"` // List of columns for ordering search results, which can include experiment // name and last updated timestamp with an optional "DESC" or "ASC" // annotation, where "ASC" is the default. Tiebreaks are done by experiment // id DESC. - // Wire name: 'order_by' OrderBy []string `json:"order_by,omitempty"` // Token indicating the page of experiments to fetch - // Wire name: 'page_token' PageToken string `json:"page_token,omitempty"` // Qualifier for type of experiments to be returned. If unspecified, return // only active experiments. - // Wire name: 'view_type' ViewType ViewType `json:"view_type,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *SearchExperiments) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &searchExperimentsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := searchExperimentsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *SearchExperiments) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st SearchExperiments) MarshalJSON() ([]byte, error) { - pb, err := searchExperimentsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s SearchExperiments) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type SearchExperimentsResponse struct { // Experiments that match the search criteria - // Wire name: 'experiments' Experiments []Experiment `json:"experiments,omitempty"` // Token that can be used to retrieve the next page of experiments. An empty // token means that no more experiments are available for retrieval. - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *SearchExperimentsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &searchExperimentsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := searchExperimentsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *SearchExperimentsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st SearchExperimentsResponse) MarshalJSON() ([]byte, error) { - pb, err := searchExperimentsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s SearchExperimentsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type SearchLoggedModelsDataset struct { // The digest of the dataset. - // Wire name: 'dataset_digest' DatasetDigest string `json:"dataset_digest,omitempty"` // The name of the dataset. - // Wire name: 'dataset_name' DatasetName string `json:"dataset_name"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *SearchLoggedModelsDataset) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &searchLoggedModelsDatasetPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := searchLoggedModelsDatasetFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *SearchLoggedModelsDataset) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st SearchLoggedModelsDataset) MarshalJSON() ([]byte, error) { - pb, err := searchLoggedModelsDatasetToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s SearchLoggedModelsDataset) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type SearchLoggedModelsOrderBy struct { // Whether the search results order is ascending or not. - // Wire name: 'ascending' Ascending bool `json:"ascending,omitempty"` // If ``field_name`` refers to a metric, this field specifies the digest of // the dataset associated with the metric. Only metrics associated with the // specified dataset name and digest will be considered for ordering. This // field may only be set if ``dataset_name`` is also set. - // Wire name: 'dataset_digest' DatasetDigest string `json:"dataset_digest,omitempty"` // If ``field_name`` refers to a metric, this field specifies the name of // the dataset associated with the metric. Only metrics associated with the // specified dataset name will be considered for ordering. This field may // only be set if ``field_name`` refers to a metric. - // Wire name: 'dataset_name' DatasetName string `json:"dataset_name,omitempty"` // The name of the field to order by, e.g. "metrics.accuracy". - // Wire name: 'field_name' FieldName string `json:"field_name"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *SearchLoggedModelsOrderBy) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &searchLoggedModelsOrderByPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := searchLoggedModelsOrderByFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *SearchLoggedModelsOrderBy) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st SearchLoggedModelsOrderBy) MarshalJSON() ([]byte, error) { - pb, err := searchLoggedModelsOrderByToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s SearchLoggedModelsOrderBy) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type SearchLoggedModelsRequest struct { @@ -7165,171 +3246,93 @@ type SearchLoggedModelsRequest struct { // > 0.9 on the test_dataset. Metric values from ANY dataset matching the // criteria are considered. If no datasets are specified, then metrics // across all datasets are considered in the filter. - // Wire name: 'datasets' Datasets []SearchLoggedModelsDataset `json:"datasets,omitempty"` // The IDs of the experiments in which to search for logged models. - // Wire name: 'experiment_ids' ExperimentIds []string `json:"experiment_ids,omitempty"` // A filter expression over logged model info and data that allows returning // a subset of logged models. The syntax is a subset of SQL that supports // AND'ing together binary operations. // // Example: ``params.alpha < 0.3 AND metrics.accuracy > 0.9``. - // Wire name: 'filter' Filter string `json:"filter,omitempty"` // The maximum number of Logged Models to return. The maximum limit is 50. - // Wire name: 'max_results' MaxResults int `json:"max_results,omitempty"` // The list of columns for ordering the results, with additional fields for // sorting criteria. - // Wire name: 'order_by' OrderBy []SearchLoggedModelsOrderBy `json:"order_by,omitempty"` // The token indicating the page of logged models to fetch. - // Wire name: 'page_token' PageToken string `json:"page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *SearchLoggedModelsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &searchLoggedModelsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := searchLoggedModelsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *SearchLoggedModelsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st SearchLoggedModelsRequest) MarshalJSON() ([]byte, error) { - pb, err := searchLoggedModelsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s SearchLoggedModelsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type SearchLoggedModelsResponse struct { // Logged models that match the search criteria. - // Wire name: 'models' Models []LoggedModel `json:"models,omitempty"` // The token that can be used to retrieve the next page of logged models. - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *SearchLoggedModelsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &searchLoggedModelsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := searchLoggedModelsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *SearchLoggedModelsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st SearchLoggedModelsResponse) MarshalJSON() ([]byte, error) { - pb, err := searchLoggedModelsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s SearchLoggedModelsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Searches model versions type SearchModelVersionsRequest struct { // String filter condition, like "name='my-model-name'". Must be a single // boolean condition, with string values wrapped in single quotes. - Filter string `json:"-" tf:"-"` + Filter string `json:"-" url:"filter,omitempty"` // Maximum number of models desired. Max threshold is 10K. - MaxResults int `json:"-" tf:"-"` + MaxResults int `json:"-" url:"max_results,omitempty"` // List of columns to be ordered by including model name, version, stage // with an optional "DESC" or "ASC" annotation, where "ASC" is the default. // Tiebreaks are done by latest stage transition timestamp, followed by name // ASC, followed by version DESC. - OrderBy []string `json:"-" tf:"-"` + OrderBy []string `json:"-" url:"order_by,omitempty"` // Pagination token to go to next page based on previous search query. - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *SearchModelVersionsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &searchModelVersionsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := searchModelVersionsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *SearchModelVersionsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st SearchModelVersionsRequest) MarshalJSON() ([]byte, error) { - pb, err := searchModelVersionsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s SearchModelVersionsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type SearchModelVersionsResponse struct { // Models that match the search criteria - // Wire name: 'model_versions' ModelVersions []ModelVersion `json:"model_versions,omitempty"` // Pagination token to request next page of models for the same search // query. - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *SearchModelVersionsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &searchModelVersionsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := searchModelVersionsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *SearchModelVersionsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st SearchModelVersionsResponse) MarshalJSON() ([]byte, error) { - pb, err := searchModelVersionsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s SearchModelVersionsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Search models @@ -7337,83 +3340,46 @@ type SearchModelsRequest struct { // String filter condition, like "name LIKE 'my-model-name'". Interpreted in // the backend automatically as "name LIKE '%my-model-name%'". Single // boolean condition, with string values wrapped in single quotes. - Filter string `json:"-" tf:"-"` + Filter string `json:"-" url:"filter,omitempty"` // Maximum number of models desired. Default is 100. Max threshold is 1000. - MaxResults int `json:"-" tf:"-"` + MaxResults int `json:"-" url:"max_results,omitempty"` // List of columns for ordering search results, which can include model name // and last updated timestamp with an optional "DESC" or "ASC" annotation, // where "ASC" is the default. Tiebreaks are done by model name ASC. - OrderBy []string `json:"-" tf:"-"` + OrderBy []string `json:"-" url:"order_by,omitempty"` // Pagination token to go to the next page based on a previous search query. - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *SearchModelsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &searchModelsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := searchModelsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *SearchModelsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st SearchModelsRequest) MarshalJSON() ([]byte, error) { - pb, err := searchModelsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s SearchModelsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type SearchModelsResponse struct { // Pagination token to request the next page of models. - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` // Registered Models that match the search criteria. - // Wire name: 'registered_models' RegisteredModels []Model `json:"registered_models,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *SearchModelsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &searchModelsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := searchModelsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *SearchModelsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st SearchModelsResponse) MarshalJSON() ([]byte, error) { - pb, err := searchModelsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s SearchModelsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type SearchRuns struct { // List of experiment IDs to search over. - // Wire name: 'experiment_ids' ExperimentIds []string `json:"experiment_ids,omitempty"` // A filter expression over params, metrics, and tags, that allows returning // a subset of runs. The syntax is a subset of SQL that supports ANDing @@ -7427,10 +3393,8 @@ type SearchRuns struct { // and tags."user-name" = 'Tomas'` // // Supported operators are `=`, `!=`, `>`, `>=`, `<`, and `<=`. - // Wire name: 'filter' Filter string `json:"filter,omitempty"` // Maximum number of runs desired. Max threshold is 50000 - // Wire name: 'max_results' MaxResults int `json:"max_results,omitempty"` // List of columns to be ordered by, including attributes, params, metrics, // and tags with an optional `"DESC"` or `"ASC"` annotation, where `"ASC"` @@ -7438,422 +3402,126 @@ type SearchRuns struct { // "metrics.rmse"]`. Tiebreaks are done by start_time `DESC` followed by // `run_id` for runs with the same start time (and this is the default // ordering criterion if order_by is not provided). - // Wire name: 'order_by' OrderBy []string `json:"order_by,omitempty"` // Token for the current page of runs. - // Wire name: 'page_token' PageToken string `json:"page_token,omitempty"` // Whether to display only active, only deleted, or all runs. Defaults to // only active runs. - // Wire name: 'run_view_type' RunViewType ViewType `json:"run_view_type,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *SearchRuns) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &searchRunsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := searchRunsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *SearchRuns) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st SearchRuns) MarshalJSON() ([]byte, error) { - pb, err := searchRunsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s SearchRuns) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type SearchRunsResponse struct { // Token for the next page of runs. - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` // Runs that match the search criteria. - // Wire name: 'runs' Runs []Run `json:"runs,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *SearchRunsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &searchRunsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := searchRunsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *SearchRunsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st SearchRunsResponse) MarshalJSON() ([]byte, error) { - pb, err := searchRunsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s SearchRunsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type SetExperimentTag struct { // ID of the experiment under which to log the tag. Must be provided. - // Wire name: 'experiment_id' ExperimentId string `json:"experiment_id"` // Name of the tag. Keys up to 250 bytes in size are supported. - // Wire name: 'key' Key string `json:"key"` // String value of the tag being logged. Values up to 64KB in size are // supported. - // Wire name: 'value' Value string `json:"value"` } -func (st *SetExperimentTag) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &setExperimentTagPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := setExperimentTagFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st SetExperimentTag) MarshalJSON() ([]byte, error) { - pb, err := setExperimentTagToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type SetExperimentTagResponse struct { } -func (st *SetExperimentTagResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &setExperimentTagResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := setExperimentTagResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st SetExperimentTagResponse) MarshalJSON() ([]byte, error) { - pb, err := setExperimentTagResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type SetLoggedModelTagsRequest struct { // The ID of the logged model to set the tags on. - ModelId string `json:"-" tf:"-"` + ModelId string `json:"-" url:"-"` // The tags to set on the logged model. - // Wire name: 'tags' Tags []LoggedModelTag `json:"tags,omitempty"` } -func (st *SetLoggedModelTagsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &setLoggedModelTagsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := setLoggedModelTagsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st SetLoggedModelTagsRequest) MarshalJSON() ([]byte, error) { - pb, err := setLoggedModelTagsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type SetLoggedModelTagsResponse struct { } -func (st *SetLoggedModelTagsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &setLoggedModelTagsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := setLoggedModelTagsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st SetLoggedModelTagsResponse) MarshalJSON() ([]byte, error) { - pb, err := setLoggedModelTagsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type SetModelTagRequest struct { // Name of the tag. Maximum size depends on storage backend. If a tag with // this name already exists, its preexisting value will be replaced by the // specified `value`. All storage backends are guaranteed to support key // values up to 250 bytes in size. - // Wire name: 'key' Key string `json:"key"` // Unique name of the model. - // Wire name: 'name' Name string `json:"name"` // String value of the tag being logged. Maximum size depends on storage // backend. All storage backends are guaranteed to support key values up to // 5000 bytes in size. - // Wire name: 'value' Value string `json:"value"` } -func (st *SetModelTagRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &setModelTagRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := setModelTagRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st SetModelTagRequest) MarshalJSON() ([]byte, error) { - pb, err := setModelTagRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type SetModelTagResponse struct { } -func (st *SetModelTagResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &setModelTagResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := setModelTagResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st SetModelTagResponse) MarshalJSON() ([]byte, error) { - pb, err := setModelTagResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type SetModelVersionTagRequest struct { // Name of the tag. Maximum size depends on storage backend. If a tag with // this name already exists, its preexisting value will be replaced by the // specified `value`. All storage backends are guaranteed to support key // values up to 250 bytes in size. - // Wire name: 'key' Key string `json:"key"` // Unique name of the model. - // Wire name: 'name' Name string `json:"name"` // String value of the tag being logged. Maximum size depends on storage // backend. All storage backends are guaranteed to support key values up to // 5000 bytes in size. - // Wire name: 'value' Value string `json:"value"` // Model version number. - // Wire name: 'version' Version string `json:"version"` } -func (st *SetModelVersionTagRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &setModelVersionTagRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := setModelVersionTagRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st SetModelVersionTagRequest) MarshalJSON() ([]byte, error) { - pb, err := setModelVersionTagRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type SetModelVersionTagResponse struct { } -func (st *SetModelVersionTagResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &setModelVersionTagResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := setModelVersionTagResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st SetModelVersionTagResponse) MarshalJSON() ([]byte, error) { - pb, err := setModelVersionTagResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type SetTag struct { // Name of the tag. Keys up to 250 bytes in size are supported. - // Wire name: 'key' Key string `json:"key"` // ID of the run under which to log the tag. Must be provided. - // Wire name: 'run_id' RunId string `json:"run_id,omitempty"` // [Deprecated, use `run_id` instead] ID of the run under which to log the // tag. This field will be removed in a future MLflow version. - // Wire name: 'run_uuid' RunUuid string `json:"run_uuid,omitempty"` // String value of the tag being logged. Values up to 64KB in size are // supported. - // Wire name: 'value' Value string `json:"value"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *SetTag) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &setTagPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := setTagFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *SetTag) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st SetTag) MarshalJSON() ([]byte, error) { - pb, err := setTagToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s SetTag) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type SetTagResponse struct { } -func (st *SetTagResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &setTagResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := setTagResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st SetTagResponse) MarshalJSON() ([]byte, error) { - pb, err := setTagResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Stage of the model version. Valid values are: // // * `None`: The initial stage of a model version. @@ -7964,117 +3632,42 @@ func (f *Status) Type() string { // Test webhook response object. type TestRegistryWebhook struct { // Body of the response from the webhook URL - // Wire name: 'body' Body string `json:"body,omitempty"` // Status code returned by the webhook URL - // Wire name: 'status_code' StatusCode int `json:"status_code,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *TestRegistryWebhook) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &testRegistryWebhookPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := testRegistryWebhookFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *TestRegistryWebhook) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st TestRegistryWebhook) MarshalJSON() ([]byte, error) { - pb, err := testRegistryWebhookToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s TestRegistryWebhook) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type TestRegistryWebhookRequest struct { // If `event` is specified, the test trigger uses the specified event. If // `event` is not specified, the test trigger uses a randomly chosen event // associated with the webhook. - // Wire name: 'event' Event RegistryWebhookEvent `json:"event,omitempty"` // Webhook ID - // Wire name: 'id' Id string `json:"id"` } -func (st *TestRegistryWebhookRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &testRegistryWebhookRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := testRegistryWebhookRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st TestRegistryWebhookRequest) MarshalJSON() ([]byte, error) { - pb, err := testRegistryWebhookRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type TestRegistryWebhookResponse struct { // Test webhook response object. - // Wire name: 'webhook' Webhook *TestRegistryWebhook `json:"webhook,omitempty"` } -func (st *TestRegistryWebhookResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &testRegistryWebhookResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := testRegistryWebhookResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st TestRegistryWebhookResponse) MarshalJSON() ([]byte, error) { - pb, err := testRegistryWebhookResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type TransitionModelVersionStageDatabricks struct { // Specifies whether to archive all current model versions in the target // stage. - // Wire name: 'archive_existing_versions' ArchiveExistingVersions bool `json:"archive_existing_versions"` // User-provided comment on the action. - // Wire name: 'comment' Comment string `json:"comment,omitempty"` // Name of the model. - // Wire name: 'name' Name string `json:"name"` // Target stage of the transition. Valid values are: // @@ -8085,50 +3678,28 @@ type TransitionModelVersionStageDatabricks struct { // * `Production`: Production stage. // // * `Archived`: Archived stage. - // Wire name: 'stage' Stage Stage `json:"stage"` // Version of the model. - // Wire name: 'version' Version string `json:"version"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *TransitionModelVersionStageDatabricks) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &transitionModelVersionStageDatabricksPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := transitionModelVersionStageDatabricksFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *TransitionModelVersionStageDatabricks) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st TransitionModelVersionStageDatabricks) MarshalJSON() ([]byte, error) { - pb, err := transitionModelVersionStageDatabricksToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s TransitionModelVersionStageDatabricks) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Transition request details. type TransitionRequest struct { // Array of actions on the activity allowed for the current viewer. - // Wire name: 'available_actions' AvailableActions []ActivityAction `json:"available_actions,omitempty"` // User-provided comment associated with the transition request. - // Wire name: 'comment' Comment string `json:"comment,omitempty"` // Creation time of the object, as a Unix timestamp in milliseconds. - // Wire name: 'creation_timestamp' CreationTimestamp int64 `json:"creation_timestamp,omitempty"` // Target stage of the transition (if the activity is stage transition // related). Valid values are: @@ -8140,373 +3711,114 @@ type TransitionRequest struct { // * `Production`: Production stage. // // * `Archived`: Archived stage. - // Wire name: 'to_stage' ToStage Stage `json:"to_stage,omitempty"` // The username of the user that created the object. - // Wire name: 'user_id' UserId string `json:"user_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *TransitionRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &transitionRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := transitionRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *TransitionRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st TransitionRequest) MarshalJSON() ([]byte, error) { - pb, err := transitionRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s TransitionRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type TransitionStageResponse struct { - - // Wire name: 'model_version' ModelVersion *ModelVersionDatabricks `json:"model_version,omitempty"` } -func (st *TransitionStageResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &transitionStageResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := transitionStageResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st TransitionStageResponse) MarshalJSON() ([]byte, error) { - pb, err := transitionStageResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type UpdateComment struct { // User-provided comment on the action. - // Wire name: 'comment' Comment string `json:"comment"` // Unique identifier of an activity - // Wire name: 'id' Id string `json:"id"` } -func (st *UpdateComment) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateCommentPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateCommentFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateComment) MarshalJSON() ([]byte, error) { - pb, err := updateCommentToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type UpdateCommentResponse struct { // Comment details. - // Wire name: 'comment' Comment *CommentObject `json:"comment,omitempty"` } -func (st *UpdateCommentResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateCommentResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateCommentResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateCommentResponse) MarshalJSON() ([]byte, error) { - pb, err := updateCommentResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type UpdateExperiment struct { // ID of the associated experiment. - // Wire name: 'experiment_id' ExperimentId string `json:"experiment_id"` // If provided, the experiment's name is changed to the new name. The new // name must be unique. - // Wire name: 'new_name' NewName string `json:"new_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *UpdateExperiment) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateExperimentPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateExperimentFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *UpdateExperiment) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st UpdateExperiment) MarshalJSON() ([]byte, error) { - pb, err := updateExperimentToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s UpdateExperiment) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type UpdateExperimentResponse struct { } -func (st *UpdateExperimentResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateExperimentResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateExperimentResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateExperimentResponse) MarshalJSON() ([]byte, error) { - pb, err := updateExperimentResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type UpdateModelRequest struct { // If provided, updates the description for this `registered_model`. - // Wire name: 'description' Description string `json:"description,omitempty"` // Registered model unique name identifier. - // Wire name: 'name' Name string `json:"name"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *UpdateModelRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateModelRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateModelRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *UpdateModelRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st UpdateModelRequest) MarshalJSON() ([]byte, error) { - pb, err := updateModelRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s UpdateModelRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type UpdateModelResponse struct { } -func (st *UpdateModelResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateModelResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateModelResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateModelResponse) MarshalJSON() ([]byte, error) { - pb, err := updateModelResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type UpdateModelVersionRequest struct { // If provided, updates the description for this `registered_model`. - // Wire name: 'description' Description string `json:"description,omitempty"` // Name of the registered model - // Wire name: 'name' Name string `json:"name"` // Model version number - // Wire name: 'version' Version string `json:"version"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *UpdateModelVersionRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateModelVersionRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateModelVersionRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *UpdateModelVersionRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st UpdateModelVersionRequest) MarshalJSON() ([]byte, error) { - pb, err := updateModelVersionRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s UpdateModelVersionRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type UpdateModelVersionResponse struct { } -func (st *UpdateModelVersionResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateModelVersionResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateModelVersionResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateModelVersionResponse) MarshalJSON() ([]byte, error) { - pb, err := updateModelVersionResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Update an Online Feature Store type UpdateOnlineStoreRequest struct { // The name of the online store. This is the unique identifier for the // online store. - Name string `json:"-" tf:"-"` + Name string `json:"-" url:"-"` // An OnlineStore is a logical database instance that stores and serves // features online. - // Wire name: 'online_store' OnlineStore OnlineStore `json:"online_store"` // The list of fields to update. - UpdateMask string `json:"-" tf:"-"` -} - -func (st *UpdateOnlineStoreRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateOnlineStoreRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateOnlineStoreRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateOnlineStoreRequest) MarshalJSON() ([]byte, error) { - pb, err := updateOnlineStoreRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + UpdateMask string `json:"-" url:"update_mask"` } type UpdateRegistryWebhook struct { // User-specified description for the webhook. - // Wire name: 'description' Description string `json:"description,omitempty"` // Events that can trigger a registry webhook: * `MODEL_VERSION_CREATED`: A // new model version was created for the associated model. @@ -8541,16 +3853,12 @@ type UpdateRegistryWebhook struct { // // * `TRANSITION_REQUEST_TO_ARCHIVED_CREATED`: A user requested a model // version be archived. - // Wire name: 'events' Events []RegistryWebhookEvent `json:"events,omitempty"` - // Wire name: 'http_url_spec' HttpUrlSpec *HttpUrlSpec `json:"http_url_spec,omitempty"` // Webhook ID - // Wire name: 'id' Id string `json:"id"` - // Wire name: 'job_spec' JobSpec *JobSpec `json:"job_spec,omitempty"` // Enable or disable triggering the webhook, or put the webhook into test // mode. The default is `ACTIVE`: * `ACTIVE`: Webhook is triggered when an @@ -8560,114 +3868,48 @@ type UpdateRegistryWebhook struct { // // * `TEST_MODE`: Webhook can be triggered through the test endpoint, but is // not triggered on a real event. - // Wire name: 'status' Status RegistryWebhookStatus `json:"status,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *UpdateRegistryWebhook) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateRegistryWebhookPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateRegistryWebhookFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *UpdateRegistryWebhook) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st UpdateRegistryWebhook) MarshalJSON() ([]byte, error) { - pb, err := updateRegistryWebhookToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s UpdateRegistryWebhook) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type UpdateRun struct { // Unix timestamp in milliseconds of when the run ended. - // Wire name: 'end_time' EndTime int64 `json:"end_time,omitempty"` // ID of the run to update. Must be provided. - // Wire name: 'run_id' RunId string `json:"run_id,omitempty"` // Updated name of the run. - // Wire name: 'run_name' RunName string `json:"run_name,omitempty"` // [Deprecated, use `run_id` instead] ID of the run to update. This field // will be removed in a future MLflow version. - // Wire name: 'run_uuid' RunUuid string `json:"run_uuid,omitempty"` // Updated status of the run. - // Wire name: 'status' Status UpdateRunStatus `json:"status,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *UpdateRun) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateRunPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateRunFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *UpdateRun) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st UpdateRun) MarshalJSON() ([]byte, error) { - pb, err := updateRunToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s UpdateRun) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type UpdateRunResponse struct { // Updated metadata of the run. - // Wire name: 'run_info' RunInfo *RunInfo `json:"run_info,omitempty"` } -func (st *UpdateRunResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateRunResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateRunResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateRunResponse) MarshalJSON() ([]byte, error) { - pb, err := updateRunResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Status of a run. type UpdateRunStatus string @@ -8718,31 +3960,6 @@ func (f *UpdateRunStatus) Type() string { type UpdateWebhookResponse struct { } -func (st *UpdateWebhookResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateWebhookResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateWebhookResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateWebhookResponse) MarshalJSON() ([]byte, error) { - pb, err := updateWebhookResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Qualifier for the view type. type ViewType string diff --git a/service/oauth2/impl.go b/service/oauth2/impl.go index ed2dd2b38..0a3876bc6 100755 --- a/service/oauth2/impl.go +++ b/service/oauth2/impl.go @@ -19,99 +19,37 @@ type accountFederationPolicyImpl struct { } func (a *accountFederationPolicyImpl) Create(ctx context.Context, request CreateAccountFederationPolicyRequest) (*FederationPolicy, error) { - - requestPb, pbErr := createAccountFederationPolicyRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var federationPolicyPb federationPolicyPb + var federationPolicy FederationPolicy path := fmt.Sprintf("/api/2.0/accounts/%v/federationPolicies", a.client.ConfiguredAccountID()) queryParams := make(map[string]any) - if requestPb.PolicyId != "" || slices.Contains(requestPb.ForceSendFields, "PolicyId") { - queryParams["policy_id"] = requestPb.PolicyId + if request.PolicyId != "" || slices.Contains(request.ForceSendFields, "PolicyId") { + queryParams["policy_id"] = request.PolicyId } headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb).Policy, - &federationPolicyPb, - ) - if err != nil { - return nil, err - } - resp, err := federationPolicyFromPb(&federationPolicyPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.Policy, &federationPolicy) + return &federationPolicy, err } func (a *accountFederationPolicyImpl) Delete(ctx context.Context, request DeleteAccountFederationPolicyRequest) error { - - requestPb, pbErr := deleteAccountFederationPolicyRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteResponsePb deleteResponsePb - path := fmt.Sprintf("/api/2.0/accounts/%v/federationPolicies/%v", a.client.ConfiguredAccountID(), requestPb.PolicyId) + var deleteResponse DeleteResponse + path := fmt.Sprintf("/api/2.0/accounts/%v/federationPolicies/%v", a.client.ConfiguredAccountID(), request.PolicyId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteResponse) return err } func (a *accountFederationPolicyImpl) Get(ctx context.Context, request GetAccountFederationPolicyRequest) (*FederationPolicy, error) { - - requestPb, pbErr := getAccountFederationPolicyRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var federationPolicyPb federationPolicyPb - path := fmt.Sprintf("/api/2.0/accounts/%v/federationPolicies/%v", a.client.ConfiguredAccountID(), requestPb.PolicyId) + var federationPolicy FederationPolicy + path := fmt.Sprintf("/api/2.0/accounts/%v/federationPolicies/%v", a.client.ConfiguredAccountID(), request.PolicyId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &federationPolicyPb, - ) - if err != nil { - return nil, err - } - resp, err := federationPolicyFromPb(&federationPolicyPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &federationPolicy) + return &federationPolicy, err } // List account federation policies. @@ -146,71 +84,27 @@ func (a *accountFederationPolicyImpl) ListAll(ctx context.Context, request ListA } func (a *accountFederationPolicyImpl) internalList(ctx context.Context, request ListAccountFederationPoliciesRequest) (*ListFederationPoliciesResponse, error) { - - requestPb, pbErr := listAccountFederationPoliciesRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listFederationPoliciesResponsePb listFederationPoliciesResponsePb + var listFederationPoliciesResponse ListFederationPoliciesResponse path := fmt.Sprintf("/api/2.0/accounts/%v/federationPolicies", a.client.ConfiguredAccountID()) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listFederationPoliciesResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listFederationPoliciesResponseFromPb(&listFederationPoliciesResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listFederationPoliciesResponse) + return &listFederationPoliciesResponse, err } func (a *accountFederationPolicyImpl) Update(ctx context.Context, request UpdateAccountFederationPolicyRequest) (*FederationPolicy, error) { - - requestPb, pbErr := updateAccountFederationPolicyRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var federationPolicyPb federationPolicyPb - path := fmt.Sprintf("/api/2.0/accounts/%v/federationPolicies/%v", a.client.ConfiguredAccountID(), requestPb.PolicyId) + var federationPolicy FederationPolicy + path := fmt.Sprintf("/api/2.0/accounts/%v/federationPolicies/%v", a.client.ConfiguredAccountID(), request.PolicyId) queryParams := make(map[string]any) - if requestPb.UpdateMask != "" || slices.Contains(requestPb.ForceSendFields, "UpdateMask") { - queryParams["update_mask"] = requestPb.UpdateMask + if request.UpdateMask != "" || slices.Contains(request.ForceSendFields, "UpdateMask") { + queryParams["update_mask"] = request.UpdateMask } headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb).Policy, - &federationPolicyPb, - ) - if err != nil { - return nil, err - } - resp, err := federationPolicyFromPb(&federationPolicyPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.Policy, &federationPolicy) + return &federationPolicy, err } // unexported type that holds implementations of just CustomAppIntegration API methods @@ -219,96 +113,34 @@ type customAppIntegrationImpl struct { } func (a *customAppIntegrationImpl) Create(ctx context.Context, request CreateCustomAppIntegration) (*CreateCustomAppIntegrationOutput, error) { - - requestPb, pbErr := createCustomAppIntegrationToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var createCustomAppIntegrationOutputPb createCustomAppIntegrationOutputPb + var createCustomAppIntegrationOutput CreateCustomAppIntegrationOutput path := fmt.Sprintf("/api/2.0/accounts/%v/oauth2/custom-app-integrations", a.client.ConfiguredAccountID()) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &createCustomAppIntegrationOutputPb, - ) - if err != nil { - return nil, err - } - resp, err := createCustomAppIntegrationOutputFromPb(&createCustomAppIntegrationOutputPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &createCustomAppIntegrationOutput) + return &createCustomAppIntegrationOutput, err } func (a *customAppIntegrationImpl) Delete(ctx context.Context, request DeleteCustomAppIntegrationRequest) error { - - requestPb, pbErr := deleteCustomAppIntegrationRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteCustomAppIntegrationOutputPb deleteCustomAppIntegrationOutputPb - path := fmt.Sprintf("/api/2.0/accounts/%v/oauth2/custom-app-integrations/%v", a.client.ConfiguredAccountID(), requestPb.IntegrationId) + var deleteCustomAppIntegrationOutput DeleteCustomAppIntegrationOutput + path := fmt.Sprintf("/api/2.0/accounts/%v/oauth2/custom-app-integrations/%v", a.client.ConfiguredAccountID(), request.IntegrationId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteCustomAppIntegrationOutputPb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteCustomAppIntegrationOutput) return err } func (a *customAppIntegrationImpl) Get(ctx context.Context, request GetCustomAppIntegrationRequest) (*GetCustomAppIntegrationOutput, error) { - - requestPb, pbErr := getCustomAppIntegrationRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var getCustomAppIntegrationOutputPb getCustomAppIntegrationOutputPb - path := fmt.Sprintf("/api/2.0/accounts/%v/oauth2/custom-app-integrations/%v", a.client.ConfiguredAccountID(), requestPb.IntegrationId) + var getCustomAppIntegrationOutput GetCustomAppIntegrationOutput + path := fmt.Sprintf("/api/2.0/accounts/%v/oauth2/custom-app-integrations/%v", a.client.ConfiguredAccountID(), request.IntegrationId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &getCustomAppIntegrationOutputPb, - ) - if err != nil { - return nil, err - } - resp, err := getCustomAppIntegrationOutputFromPb(&getCustomAppIntegrationOutputPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getCustomAppIntegrationOutput) + return &getCustomAppIntegrationOutput, err } // Get the list of custom OAuth app integrations for the specified Databricks @@ -345,63 +177,23 @@ func (a *customAppIntegrationImpl) ListAll(ctx context.Context, request ListCust } func (a *customAppIntegrationImpl) internalList(ctx context.Context, request ListCustomAppIntegrationsRequest) (*GetCustomAppIntegrationsOutput, error) { - - requestPb, pbErr := listCustomAppIntegrationsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var getCustomAppIntegrationsOutputPb getCustomAppIntegrationsOutputPb + var getCustomAppIntegrationsOutput GetCustomAppIntegrationsOutput path := fmt.Sprintf("/api/2.0/accounts/%v/oauth2/custom-app-integrations", a.client.ConfiguredAccountID()) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &getCustomAppIntegrationsOutputPb, - ) - if err != nil { - return nil, err - } - resp, err := getCustomAppIntegrationsOutputFromPb(&getCustomAppIntegrationsOutputPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getCustomAppIntegrationsOutput) + return &getCustomAppIntegrationsOutput, err } func (a *customAppIntegrationImpl) Update(ctx context.Context, request UpdateCustomAppIntegration) error { - - requestPb, pbErr := updateCustomAppIntegrationToPb(&request) - if pbErr != nil { - return pbErr - } - - var updateCustomAppIntegrationOutputPb updateCustomAppIntegrationOutputPb - path := fmt.Sprintf("/api/2.0/accounts/%v/oauth2/custom-app-integrations/%v", a.client.ConfiguredAccountID(), requestPb.IntegrationId) + var updateCustomAppIntegrationOutput UpdateCustomAppIntegrationOutput + path := fmt.Sprintf("/api/2.0/accounts/%v/oauth2/custom-app-integrations/%v", a.client.ConfiguredAccountID(), request.IntegrationId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &updateCustomAppIntegrationOutputPb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &updateCustomAppIntegrationOutput) return err } @@ -442,35 +234,13 @@ func (a *oAuthPublishedAppsImpl) ListAll(ctx context.Context, request ListOAuthP } func (a *oAuthPublishedAppsImpl) internalList(ctx context.Context, request ListOAuthPublishedAppsRequest) (*GetPublishedAppsOutput, error) { - - requestPb, pbErr := listOAuthPublishedAppsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var getPublishedAppsOutputPb getPublishedAppsOutputPb + var getPublishedAppsOutput GetPublishedAppsOutput path := fmt.Sprintf("/api/2.0/accounts/%v/oauth2/published-apps", a.client.ConfiguredAccountID()) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &getPublishedAppsOutputPb, - ) - if err != nil { - return nil, err - } - resp, err := getPublishedAppsOutputFromPb(&getPublishedAppsOutputPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getPublishedAppsOutput) + return &getPublishedAppsOutput, err } // unexported type that holds implementations of just PublishedAppIntegration API methods @@ -479,96 +249,34 @@ type publishedAppIntegrationImpl struct { } func (a *publishedAppIntegrationImpl) Create(ctx context.Context, request CreatePublishedAppIntegration) (*CreatePublishedAppIntegrationOutput, error) { - - requestPb, pbErr := createPublishedAppIntegrationToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var createPublishedAppIntegrationOutputPb createPublishedAppIntegrationOutputPb + var createPublishedAppIntegrationOutput CreatePublishedAppIntegrationOutput path := fmt.Sprintf("/api/2.0/accounts/%v/oauth2/published-app-integrations", a.client.ConfiguredAccountID()) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &createPublishedAppIntegrationOutputPb, - ) - if err != nil { - return nil, err - } - resp, err := createPublishedAppIntegrationOutputFromPb(&createPublishedAppIntegrationOutputPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &createPublishedAppIntegrationOutput) + return &createPublishedAppIntegrationOutput, err } func (a *publishedAppIntegrationImpl) Delete(ctx context.Context, request DeletePublishedAppIntegrationRequest) error { - - requestPb, pbErr := deletePublishedAppIntegrationRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deletePublishedAppIntegrationOutputPb deletePublishedAppIntegrationOutputPb - path := fmt.Sprintf("/api/2.0/accounts/%v/oauth2/published-app-integrations/%v", a.client.ConfiguredAccountID(), requestPb.IntegrationId) + var deletePublishedAppIntegrationOutput DeletePublishedAppIntegrationOutput + path := fmt.Sprintf("/api/2.0/accounts/%v/oauth2/published-app-integrations/%v", a.client.ConfiguredAccountID(), request.IntegrationId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deletePublishedAppIntegrationOutputPb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deletePublishedAppIntegrationOutput) return err } func (a *publishedAppIntegrationImpl) Get(ctx context.Context, request GetPublishedAppIntegrationRequest) (*GetPublishedAppIntegrationOutput, error) { - - requestPb, pbErr := getPublishedAppIntegrationRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var getPublishedAppIntegrationOutputPb getPublishedAppIntegrationOutputPb - path := fmt.Sprintf("/api/2.0/accounts/%v/oauth2/published-app-integrations/%v", a.client.ConfiguredAccountID(), requestPb.IntegrationId) + var getPublishedAppIntegrationOutput GetPublishedAppIntegrationOutput + path := fmt.Sprintf("/api/2.0/accounts/%v/oauth2/published-app-integrations/%v", a.client.ConfiguredAccountID(), request.IntegrationId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &getPublishedAppIntegrationOutputPb, - ) - if err != nil { - return nil, err - } - resp, err := getPublishedAppIntegrationOutputFromPb(&getPublishedAppIntegrationOutputPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getPublishedAppIntegrationOutput) + return &getPublishedAppIntegrationOutput, err } // Get the list of published OAuth app integrations for the specified Databricks @@ -605,63 +313,23 @@ func (a *publishedAppIntegrationImpl) ListAll(ctx context.Context, request ListP } func (a *publishedAppIntegrationImpl) internalList(ctx context.Context, request ListPublishedAppIntegrationsRequest) (*GetPublishedAppIntegrationsOutput, error) { - - requestPb, pbErr := listPublishedAppIntegrationsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var getPublishedAppIntegrationsOutputPb getPublishedAppIntegrationsOutputPb + var getPublishedAppIntegrationsOutput GetPublishedAppIntegrationsOutput path := fmt.Sprintf("/api/2.0/accounts/%v/oauth2/published-app-integrations", a.client.ConfiguredAccountID()) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &getPublishedAppIntegrationsOutputPb, - ) - if err != nil { - return nil, err - } - resp, err := getPublishedAppIntegrationsOutputFromPb(&getPublishedAppIntegrationsOutputPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getPublishedAppIntegrationsOutput) + return &getPublishedAppIntegrationsOutput, err } func (a *publishedAppIntegrationImpl) Update(ctx context.Context, request UpdatePublishedAppIntegration) error { - - requestPb, pbErr := updatePublishedAppIntegrationToPb(&request) - if pbErr != nil { - return pbErr - } - - var updatePublishedAppIntegrationOutputPb updatePublishedAppIntegrationOutputPb - path := fmt.Sprintf("/api/2.0/accounts/%v/oauth2/published-app-integrations/%v", a.client.ConfiguredAccountID(), requestPb.IntegrationId) + var updatePublishedAppIntegrationOutput UpdatePublishedAppIntegrationOutput + path := fmt.Sprintf("/api/2.0/accounts/%v/oauth2/published-app-integrations/%v", a.client.ConfiguredAccountID(), request.IntegrationId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &updatePublishedAppIntegrationOutputPb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &updatePublishedAppIntegrationOutput) return err } @@ -671,99 +339,37 @@ type servicePrincipalFederationPolicyImpl struct { } func (a *servicePrincipalFederationPolicyImpl) Create(ctx context.Context, request CreateServicePrincipalFederationPolicyRequest) (*FederationPolicy, error) { - - requestPb, pbErr := createServicePrincipalFederationPolicyRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var federationPolicyPb federationPolicyPb - path := fmt.Sprintf("/api/2.0/accounts/%v/servicePrincipals/%v/federationPolicies", a.client.ConfiguredAccountID(), requestPb.ServicePrincipalId) + var federationPolicy FederationPolicy + path := fmt.Sprintf("/api/2.0/accounts/%v/servicePrincipals/%v/federationPolicies", a.client.ConfiguredAccountID(), request.ServicePrincipalId) queryParams := make(map[string]any) - if requestPb.PolicyId != "" || slices.Contains(requestPb.ForceSendFields, "PolicyId") { - queryParams["policy_id"] = requestPb.PolicyId + if request.PolicyId != "" || slices.Contains(request.ForceSendFields, "PolicyId") { + queryParams["policy_id"] = request.PolicyId } headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb).Policy, - &federationPolicyPb, - ) - if err != nil { - return nil, err - } - resp, err := federationPolicyFromPb(&federationPolicyPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.Policy, &federationPolicy) + return &federationPolicy, err } func (a *servicePrincipalFederationPolicyImpl) Delete(ctx context.Context, request DeleteServicePrincipalFederationPolicyRequest) error { - - requestPb, pbErr := deleteServicePrincipalFederationPolicyRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteResponsePb deleteResponsePb - path := fmt.Sprintf("/api/2.0/accounts/%v/servicePrincipals/%v/federationPolicies/%v", a.client.ConfiguredAccountID(), requestPb.ServicePrincipalId, requestPb.PolicyId) + var deleteResponse DeleteResponse + path := fmt.Sprintf("/api/2.0/accounts/%v/servicePrincipals/%v/federationPolicies/%v", a.client.ConfiguredAccountID(), request.ServicePrincipalId, request.PolicyId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteResponse) return err } func (a *servicePrincipalFederationPolicyImpl) Get(ctx context.Context, request GetServicePrincipalFederationPolicyRequest) (*FederationPolicy, error) { - - requestPb, pbErr := getServicePrincipalFederationPolicyRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var federationPolicyPb federationPolicyPb - path := fmt.Sprintf("/api/2.0/accounts/%v/servicePrincipals/%v/federationPolicies/%v", a.client.ConfiguredAccountID(), requestPb.ServicePrincipalId, requestPb.PolicyId) + var federationPolicy FederationPolicy + path := fmt.Sprintf("/api/2.0/accounts/%v/servicePrincipals/%v/federationPolicies/%v", a.client.ConfiguredAccountID(), request.ServicePrincipalId, request.PolicyId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &federationPolicyPb, - ) - if err != nil { - return nil, err - } - resp, err := federationPolicyFromPb(&federationPolicyPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &federationPolicy) + return &federationPolicy, err } // List account federation policies. @@ -798,71 +404,27 @@ func (a *servicePrincipalFederationPolicyImpl) ListAll(ctx context.Context, requ } func (a *servicePrincipalFederationPolicyImpl) internalList(ctx context.Context, request ListServicePrincipalFederationPoliciesRequest) (*ListFederationPoliciesResponse, error) { - - requestPb, pbErr := listServicePrincipalFederationPoliciesRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listFederationPoliciesResponsePb listFederationPoliciesResponsePb - path := fmt.Sprintf("/api/2.0/accounts/%v/servicePrincipals/%v/federationPolicies", a.client.ConfiguredAccountID(), requestPb.ServicePrincipalId) + var listFederationPoliciesResponse ListFederationPoliciesResponse + path := fmt.Sprintf("/api/2.0/accounts/%v/servicePrincipals/%v/federationPolicies", a.client.ConfiguredAccountID(), request.ServicePrincipalId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listFederationPoliciesResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listFederationPoliciesResponseFromPb(&listFederationPoliciesResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listFederationPoliciesResponse) + return &listFederationPoliciesResponse, err } func (a *servicePrincipalFederationPolicyImpl) Update(ctx context.Context, request UpdateServicePrincipalFederationPolicyRequest) (*FederationPolicy, error) { - - requestPb, pbErr := updateServicePrincipalFederationPolicyRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var federationPolicyPb federationPolicyPb - path := fmt.Sprintf("/api/2.0/accounts/%v/servicePrincipals/%v/federationPolicies/%v", a.client.ConfiguredAccountID(), requestPb.ServicePrincipalId, requestPb.PolicyId) + var federationPolicy FederationPolicy + path := fmt.Sprintf("/api/2.0/accounts/%v/servicePrincipals/%v/federationPolicies/%v", a.client.ConfiguredAccountID(), request.ServicePrincipalId, request.PolicyId) queryParams := make(map[string]any) - if requestPb.UpdateMask != "" || slices.Contains(requestPb.ForceSendFields, "UpdateMask") { - queryParams["update_mask"] = requestPb.UpdateMask + if request.UpdateMask != "" || slices.Contains(request.ForceSendFields, "UpdateMask") { + queryParams["update_mask"] = request.UpdateMask } headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb).Policy, - &federationPolicyPb, - ) - if err != nil { - return nil, err - } - resp, err := federationPolicyFromPb(&federationPolicyPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.Policy, &federationPolicy) + return &federationPolicy, err } // unexported type that holds implementations of just ServicePrincipalSecrets API methods @@ -871,62 +433,22 @@ type servicePrincipalSecretsImpl struct { } func (a *servicePrincipalSecretsImpl) Create(ctx context.Context, request CreateServicePrincipalSecretRequest) (*CreateServicePrincipalSecretResponse, error) { - - requestPb, pbErr := createServicePrincipalSecretRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var createServicePrincipalSecretResponsePb createServicePrincipalSecretResponsePb - path := fmt.Sprintf("/api/2.0/accounts/%v/servicePrincipals/%v/credentials/secrets", a.client.ConfiguredAccountID(), requestPb.ServicePrincipalId) + var createServicePrincipalSecretResponse CreateServicePrincipalSecretResponse + path := fmt.Sprintf("/api/2.0/accounts/%v/servicePrincipals/%v/credentials/secrets", a.client.ConfiguredAccountID(), request.ServicePrincipalId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &createServicePrincipalSecretResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := createServicePrincipalSecretResponseFromPb(&createServicePrincipalSecretResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &createServicePrincipalSecretResponse) + return &createServicePrincipalSecretResponse, err } func (a *servicePrincipalSecretsImpl) Delete(ctx context.Context, request DeleteServicePrincipalSecretRequest) error { - - requestPb, pbErr := deleteServicePrincipalSecretRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteResponsePb deleteResponsePb - path := fmt.Sprintf("/api/2.0/accounts/%v/servicePrincipals/%v/credentials/secrets/%v", a.client.ConfiguredAccountID(), requestPb.ServicePrincipalId, requestPb.SecretId) + var deleteResponse DeleteResponse + path := fmt.Sprintf("/api/2.0/accounts/%v/servicePrincipals/%v/credentials/secrets/%v", a.client.ConfiguredAccountID(), request.ServicePrincipalId, request.SecretId) queryParams := make(map[string]any) headers := make(map[string]string) - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteResponse) return err } @@ -966,33 +488,11 @@ func (a *servicePrincipalSecretsImpl) ListAll(ctx context.Context, request ListS } func (a *servicePrincipalSecretsImpl) internalList(ctx context.Context, request ListServicePrincipalSecretsRequest) (*ListServicePrincipalSecretsResponse, error) { - - requestPb, pbErr := listServicePrincipalSecretsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listServicePrincipalSecretsResponsePb listServicePrincipalSecretsResponsePb - path := fmt.Sprintf("/api/2.0/accounts/%v/servicePrincipals/%v/credentials/secrets", a.client.ConfiguredAccountID(), requestPb.ServicePrincipalId) + var listServicePrincipalSecretsResponse ListServicePrincipalSecretsResponse + path := fmt.Sprintf("/api/2.0/accounts/%v/servicePrincipals/%v/credentials/secrets", a.client.ConfiguredAccountID(), request.ServicePrincipalId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listServicePrincipalSecretsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listServicePrincipalSecretsResponseFromPb(&listServicePrincipalSecretsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listServicePrincipalSecretsResponse) + return &listServicePrincipalSecretsResponse, err } diff --git a/service/oauth2/internal.go b/service/oauth2/internal.go deleted file mode 100755 index 7901ee30e..000000000 --- a/service/oauth2/internal.go +++ /dev/null @@ -1,1691 +0,0 @@ -// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. - -package oauth2 - -import ( - "fmt" - "strings" - "time" - - "github.com/databricks/databricks-sdk-go/marshal" -) - -func createAccountFederationPolicyRequestToPb(st *CreateAccountFederationPolicyRequest) (*createAccountFederationPolicyRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &createAccountFederationPolicyRequestPb{} - pb.Policy = st.Policy - pb.PolicyId = st.PolicyId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createAccountFederationPolicyRequestPb struct { - Policy FederationPolicy `json:"policy"` - PolicyId string `json:"-" url:"policy_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createAccountFederationPolicyRequestFromPb(pb *createAccountFederationPolicyRequestPb) (*CreateAccountFederationPolicyRequest, error) { - if pb == nil { - return nil, nil - } - st := &CreateAccountFederationPolicyRequest{} - st.Policy = pb.Policy - st.PolicyId = pb.PolicyId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createAccountFederationPolicyRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createAccountFederationPolicyRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createCustomAppIntegrationToPb(st *CreateCustomAppIntegration) (*createCustomAppIntegrationPb, error) { - if st == nil { - return nil, nil - } - pb := &createCustomAppIntegrationPb{} - pb.Confidential = st.Confidential - pb.Name = st.Name - pb.RedirectUrls = st.RedirectUrls - pb.Scopes = st.Scopes - pb.TokenAccessPolicy = st.TokenAccessPolicy - pb.UserAuthorizedScopes = st.UserAuthorizedScopes - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createCustomAppIntegrationPb struct { - Confidential bool `json:"confidential,omitempty"` - Name string `json:"name,omitempty"` - RedirectUrls []string `json:"redirect_urls,omitempty"` - Scopes []string `json:"scopes,omitempty"` - TokenAccessPolicy *TokenAccessPolicy `json:"token_access_policy,omitempty"` - UserAuthorizedScopes []string `json:"user_authorized_scopes,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createCustomAppIntegrationFromPb(pb *createCustomAppIntegrationPb) (*CreateCustomAppIntegration, error) { - if pb == nil { - return nil, nil - } - st := &CreateCustomAppIntegration{} - st.Confidential = pb.Confidential - st.Name = pb.Name - st.RedirectUrls = pb.RedirectUrls - st.Scopes = pb.Scopes - st.TokenAccessPolicy = pb.TokenAccessPolicy - st.UserAuthorizedScopes = pb.UserAuthorizedScopes - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createCustomAppIntegrationPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createCustomAppIntegrationPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createCustomAppIntegrationOutputToPb(st *CreateCustomAppIntegrationOutput) (*createCustomAppIntegrationOutputPb, error) { - if st == nil { - return nil, nil - } - pb := &createCustomAppIntegrationOutputPb{} - pb.ClientId = st.ClientId - pb.ClientSecret = st.ClientSecret - pb.IntegrationId = st.IntegrationId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createCustomAppIntegrationOutputPb struct { - ClientId string `json:"client_id,omitempty"` - ClientSecret string `json:"client_secret,omitempty"` - IntegrationId string `json:"integration_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createCustomAppIntegrationOutputFromPb(pb *createCustomAppIntegrationOutputPb) (*CreateCustomAppIntegrationOutput, error) { - if pb == nil { - return nil, nil - } - st := &CreateCustomAppIntegrationOutput{} - st.ClientId = pb.ClientId - st.ClientSecret = pb.ClientSecret - st.IntegrationId = pb.IntegrationId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createCustomAppIntegrationOutputPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createCustomAppIntegrationOutputPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createPublishedAppIntegrationToPb(st *CreatePublishedAppIntegration) (*createPublishedAppIntegrationPb, error) { - if st == nil { - return nil, nil - } - pb := &createPublishedAppIntegrationPb{} - pb.AppId = st.AppId - pb.TokenAccessPolicy = st.TokenAccessPolicy - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createPublishedAppIntegrationPb struct { - AppId string `json:"app_id,omitempty"` - TokenAccessPolicy *TokenAccessPolicy `json:"token_access_policy,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createPublishedAppIntegrationFromPb(pb *createPublishedAppIntegrationPb) (*CreatePublishedAppIntegration, error) { - if pb == nil { - return nil, nil - } - st := &CreatePublishedAppIntegration{} - st.AppId = pb.AppId - st.TokenAccessPolicy = pb.TokenAccessPolicy - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createPublishedAppIntegrationPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createPublishedAppIntegrationPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createPublishedAppIntegrationOutputToPb(st *CreatePublishedAppIntegrationOutput) (*createPublishedAppIntegrationOutputPb, error) { - if st == nil { - return nil, nil - } - pb := &createPublishedAppIntegrationOutputPb{} - pb.IntegrationId = st.IntegrationId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createPublishedAppIntegrationOutputPb struct { - IntegrationId string `json:"integration_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createPublishedAppIntegrationOutputFromPb(pb *createPublishedAppIntegrationOutputPb) (*CreatePublishedAppIntegrationOutput, error) { - if pb == nil { - return nil, nil - } - st := &CreatePublishedAppIntegrationOutput{} - st.IntegrationId = pb.IntegrationId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createPublishedAppIntegrationOutputPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createPublishedAppIntegrationOutputPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createServicePrincipalFederationPolicyRequestToPb(st *CreateServicePrincipalFederationPolicyRequest) (*createServicePrincipalFederationPolicyRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &createServicePrincipalFederationPolicyRequestPb{} - pb.Policy = st.Policy - pb.PolicyId = st.PolicyId - pb.ServicePrincipalId = st.ServicePrincipalId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createServicePrincipalFederationPolicyRequestPb struct { - Policy FederationPolicy `json:"policy"` - PolicyId string `json:"-" url:"policy_id,omitempty"` - ServicePrincipalId int64 `json:"-" url:"-"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createServicePrincipalFederationPolicyRequestFromPb(pb *createServicePrincipalFederationPolicyRequestPb) (*CreateServicePrincipalFederationPolicyRequest, error) { - if pb == nil { - return nil, nil - } - st := &CreateServicePrincipalFederationPolicyRequest{} - st.Policy = pb.Policy - st.PolicyId = pb.PolicyId - st.ServicePrincipalId = pb.ServicePrincipalId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createServicePrincipalFederationPolicyRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createServicePrincipalFederationPolicyRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createServicePrincipalSecretRequestToPb(st *CreateServicePrincipalSecretRequest) (*createServicePrincipalSecretRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &createServicePrincipalSecretRequestPb{} - pb.Lifetime = st.Lifetime - pb.ServicePrincipalId = st.ServicePrincipalId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createServicePrincipalSecretRequestPb struct { - Lifetime string `json:"lifetime,omitempty"` - ServicePrincipalId int64 `json:"-" url:"-"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createServicePrincipalSecretRequestFromPb(pb *createServicePrincipalSecretRequestPb) (*CreateServicePrincipalSecretRequest, error) { - if pb == nil { - return nil, nil - } - st := &CreateServicePrincipalSecretRequest{} - st.Lifetime = pb.Lifetime - st.ServicePrincipalId = pb.ServicePrincipalId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createServicePrincipalSecretRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createServicePrincipalSecretRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createServicePrincipalSecretResponseToPb(st *CreateServicePrincipalSecretResponse) (*createServicePrincipalSecretResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &createServicePrincipalSecretResponsePb{} - pb.CreateTime = st.CreateTime - pb.ExpireTime = st.ExpireTime - pb.Id = st.Id - pb.Secret = st.Secret - pb.SecretHash = st.SecretHash - pb.Status = st.Status - pb.UpdateTime = st.UpdateTime - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createServicePrincipalSecretResponsePb struct { - CreateTime string `json:"create_time,omitempty"` - ExpireTime string `json:"expire_time,omitempty"` - Id string `json:"id,omitempty"` - Secret string `json:"secret,omitempty"` - SecretHash string `json:"secret_hash,omitempty"` - Status string `json:"status,omitempty"` - UpdateTime string `json:"update_time,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createServicePrincipalSecretResponseFromPb(pb *createServicePrincipalSecretResponsePb) (*CreateServicePrincipalSecretResponse, error) { - if pb == nil { - return nil, nil - } - st := &CreateServicePrincipalSecretResponse{} - st.CreateTime = pb.CreateTime - st.ExpireTime = pb.ExpireTime - st.Id = pb.Id - st.Secret = pb.Secret - st.SecretHash = pb.SecretHash - st.Status = pb.Status - st.UpdateTime = pb.UpdateTime - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createServicePrincipalSecretResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createServicePrincipalSecretResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func deleteAccountFederationPolicyRequestToPb(st *DeleteAccountFederationPolicyRequest) (*deleteAccountFederationPolicyRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteAccountFederationPolicyRequestPb{} - pb.PolicyId = st.PolicyId - - return pb, nil -} - -type deleteAccountFederationPolicyRequestPb struct { - PolicyId string `json:"-" url:"-"` -} - -func deleteAccountFederationPolicyRequestFromPb(pb *deleteAccountFederationPolicyRequestPb) (*DeleteAccountFederationPolicyRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteAccountFederationPolicyRequest{} - st.PolicyId = pb.PolicyId - - return st, nil -} - -func deleteCustomAppIntegrationOutputToPb(st *DeleteCustomAppIntegrationOutput) (*deleteCustomAppIntegrationOutputPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteCustomAppIntegrationOutputPb{} - - return pb, nil -} - -type deleteCustomAppIntegrationOutputPb struct { -} - -func deleteCustomAppIntegrationOutputFromPb(pb *deleteCustomAppIntegrationOutputPb) (*DeleteCustomAppIntegrationOutput, error) { - if pb == nil { - return nil, nil - } - st := &DeleteCustomAppIntegrationOutput{} - - return st, nil -} - -func deleteCustomAppIntegrationRequestToPb(st *DeleteCustomAppIntegrationRequest) (*deleteCustomAppIntegrationRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteCustomAppIntegrationRequestPb{} - pb.IntegrationId = st.IntegrationId - - return pb, nil -} - -type deleteCustomAppIntegrationRequestPb struct { - IntegrationId string `json:"-" url:"-"` -} - -func deleteCustomAppIntegrationRequestFromPb(pb *deleteCustomAppIntegrationRequestPb) (*DeleteCustomAppIntegrationRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteCustomAppIntegrationRequest{} - st.IntegrationId = pb.IntegrationId - - return st, nil -} - -func deletePublishedAppIntegrationOutputToPb(st *DeletePublishedAppIntegrationOutput) (*deletePublishedAppIntegrationOutputPb, error) { - if st == nil { - return nil, nil - } - pb := &deletePublishedAppIntegrationOutputPb{} - - return pb, nil -} - -type deletePublishedAppIntegrationOutputPb struct { -} - -func deletePublishedAppIntegrationOutputFromPb(pb *deletePublishedAppIntegrationOutputPb) (*DeletePublishedAppIntegrationOutput, error) { - if pb == nil { - return nil, nil - } - st := &DeletePublishedAppIntegrationOutput{} - - return st, nil -} - -func deletePublishedAppIntegrationRequestToPb(st *DeletePublishedAppIntegrationRequest) (*deletePublishedAppIntegrationRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deletePublishedAppIntegrationRequestPb{} - pb.IntegrationId = st.IntegrationId - - return pb, nil -} - -type deletePublishedAppIntegrationRequestPb struct { - IntegrationId string `json:"-" url:"-"` -} - -func deletePublishedAppIntegrationRequestFromPb(pb *deletePublishedAppIntegrationRequestPb) (*DeletePublishedAppIntegrationRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeletePublishedAppIntegrationRequest{} - st.IntegrationId = pb.IntegrationId - - return st, nil -} - -func deleteResponseToPb(st *DeleteResponse) (*deleteResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteResponsePb{} - - return pb, nil -} - -type deleteResponsePb struct { -} - -func deleteResponseFromPb(pb *deleteResponsePb) (*DeleteResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteResponse{} - - return st, nil -} - -func deleteServicePrincipalFederationPolicyRequestToPb(st *DeleteServicePrincipalFederationPolicyRequest) (*deleteServicePrincipalFederationPolicyRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteServicePrincipalFederationPolicyRequestPb{} - pb.PolicyId = st.PolicyId - pb.ServicePrincipalId = st.ServicePrincipalId - - return pb, nil -} - -type deleteServicePrincipalFederationPolicyRequestPb struct { - PolicyId string `json:"-" url:"-"` - ServicePrincipalId int64 `json:"-" url:"-"` -} - -func deleteServicePrincipalFederationPolicyRequestFromPb(pb *deleteServicePrincipalFederationPolicyRequestPb) (*DeleteServicePrincipalFederationPolicyRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteServicePrincipalFederationPolicyRequest{} - st.PolicyId = pb.PolicyId - st.ServicePrincipalId = pb.ServicePrincipalId - - return st, nil -} - -func deleteServicePrincipalSecretRequestToPb(st *DeleteServicePrincipalSecretRequest) (*deleteServicePrincipalSecretRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteServicePrincipalSecretRequestPb{} - pb.SecretId = st.SecretId - pb.ServicePrincipalId = st.ServicePrincipalId - - return pb, nil -} - -type deleteServicePrincipalSecretRequestPb struct { - SecretId string `json:"-" url:"-"` - ServicePrincipalId int64 `json:"-" url:"-"` -} - -func deleteServicePrincipalSecretRequestFromPb(pb *deleteServicePrincipalSecretRequestPb) (*DeleteServicePrincipalSecretRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteServicePrincipalSecretRequest{} - st.SecretId = pb.SecretId - st.ServicePrincipalId = pb.ServicePrincipalId - - return st, nil -} - -func federationPolicyToPb(st *FederationPolicy) (*federationPolicyPb, error) { - if st == nil { - return nil, nil - } - pb := &federationPolicyPb{} - pb.CreateTime = st.CreateTime - pb.Description = st.Description - pb.Name = st.Name - pb.OidcPolicy = st.OidcPolicy - pb.PolicyId = st.PolicyId - pb.ServicePrincipalId = st.ServicePrincipalId - pb.Uid = st.Uid - pb.UpdateTime = st.UpdateTime - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type federationPolicyPb struct { - CreateTime string `json:"create_time,omitempty"` - Description string `json:"description,omitempty"` - Name string `json:"name,omitempty"` - OidcPolicy *OidcFederationPolicy `json:"oidc_policy,omitempty"` - PolicyId string `json:"policy_id,omitempty"` - ServicePrincipalId int64 `json:"service_principal_id,omitempty"` - Uid string `json:"uid,omitempty"` - UpdateTime string `json:"update_time,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func federationPolicyFromPb(pb *federationPolicyPb) (*FederationPolicy, error) { - if pb == nil { - return nil, nil - } - st := &FederationPolicy{} - st.CreateTime = pb.CreateTime - st.Description = pb.Description - st.Name = pb.Name - st.OidcPolicy = pb.OidcPolicy - st.PolicyId = pb.PolicyId - st.ServicePrincipalId = pb.ServicePrincipalId - st.Uid = pb.Uid - st.UpdateTime = pb.UpdateTime - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *federationPolicyPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st federationPolicyPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getAccountFederationPolicyRequestToPb(st *GetAccountFederationPolicyRequest) (*getAccountFederationPolicyRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getAccountFederationPolicyRequestPb{} - pb.PolicyId = st.PolicyId - - return pb, nil -} - -type getAccountFederationPolicyRequestPb struct { - PolicyId string `json:"-" url:"-"` -} - -func getAccountFederationPolicyRequestFromPb(pb *getAccountFederationPolicyRequestPb) (*GetAccountFederationPolicyRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetAccountFederationPolicyRequest{} - st.PolicyId = pb.PolicyId - - return st, nil -} - -func getCustomAppIntegrationOutputToPb(st *GetCustomAppIntegrationOutput) (*getCustomAppIntegrationOutputPb, error) { - if st == nil { - return nil, nil - } - pb := &getCustomAppIntegrationOutputPb{} - pb.ClientId = st.ClientId - pb.Confidential = st.Confidential - pb.CreateTime = st.CreateTime - pb.CreatedBy = st.CreatedBy - pb.CreatorUsername = st.CreatorUsername - pb.IntegrationId = st.IntegrationId - pb.Name = st.Name - pb.RedirectUrls = st.RedirectUrls - pb.Scopes = st.Scopes - pb.TokenAccessPolicy = st.TokenAccessPolicy - pb.UserAuthorizedScopes = st.UserAuthorizedScopes - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getCustomAppIntegrationOutputPb struct { - ClientId string `json:"client_id,omitempty"` - Confidential bool `json:"confidential,omitempty"` - CreateTime string `json:"create_time,omitempty"` - CreatedBy int64 `json:"created_by,omitempty"` - CreatorUsername string `json:"creator_username,omitempty"` - IntegrationId string `json:"integration_id,omitempty"` - Name string `json:"name,omitempty"` - RedirectUrls []string `json:"redirect_urls,omitempty"` - Scopes []string `json:"scopes,omitempty"` - TokenAccessPolicy *TokenAccessPolicy `json:"token_access_policy,omitempty"` - UserAuthorizedScopes []string `json:"user_authorized_scopes,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getCustomAppIntegrationOutputFromPb(pb *getCustomAppIntegrationOutputPb) (*GetCustomAppIntegrationOutput, error) { - if pb == nil { - return nil, nil - } - st := &GetCustomAppIntegrationOutput{} - st.ClientId = pb.ClientId - st.Confidential = pb.Confidential - st.CreateTime = pb.CreateTime - st.CreatedBy = pb.CreatedBy - st.CreatorUsername = pb.CreatorUsername - st.IntegrationId = pb.IntegrationId - st.Name = pb.Name - st.RedirectUrls = pb.RedirectUrls - st.Scopes = pb.Scopes - st.TokenAccessPolicy = pb.TokenAccessPolicy - st.UserAuthorizedScopes = pb.UserAuthorizedScopes - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getCustomAppIntegrationOutputPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getCustomAppIntegrationOutputPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getCustomAppIntegrationRequestToPb(st *GetCustomAppIntegrationRequest) (*getCustomAppIntegrationRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getCustomAppIntegrationRequestPb{} - pb.IntegrationId = st.IntegrationId - - return pb, nil -} - -type getCustomAppIntegrationRequestPb struct { - IntegrationId string `json:"-" url:"-"` -} - -func getCustomAppIntegrationRequestFromPb(pb *getCustomAppIntegrationRequestPb) (*GetCustomAppIntegrationRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetCustomAppIntegrationRequest{} - st.IntegrationId = pb.IntegrationId - - return st, nil -} - -func getCustomAppIntegrationsOutputToPb(st *GetCustomAppIntegrationsOutput) (*getCustomAppIntegrationsOutputPb, error) { - if st == nil { - return nil, nil - } - pb := &getCustomAppIntegrationsOutputPb{} - pb.Apps = st.Apps - pb.NextPageToken = st.NextPageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getCustomAppIntegrationsOutputPb struct { - Apps []GetCustomAppIntegrationOutput `json:"apps,omitempty"` - NextPageToken string `json:"next_page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getCustomAppIntegrationsOutputFromPb(pb *getCustomAppIntegrationsOutputPb) (*GetCustomAppIntegrationsOutput, error) { - if pb == nil { - return nil, nil - } - st := &GetCustomAppIntegrationsOutput{} - st.Apps = pb.Apps - st.NextPageToken = pb.NextPageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getCustomAppIntegrationsOutputPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getCustomAppIntegrationsOutputPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getPublishedAppIntegrationOutputToPb(st *GetPublishedAppIntegrationOutput) (*getPublishedAppIntegrationOutputPb, error) { - if st == nil { - return nil, nil - } - pb := &getPublishedAppIntegrationOutputPb{} - pb.AppId = st.AppId - pb.CreateTime = st.CreateTime - pb.CreatedBy = st.CreatedBy - pb.IntegrationId = st.IntegrationId - pb.Name = st.Name - pb.TokenAccessPolicy = st.TokenAccessPolicy - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getPublishedAppIntegrationOutputPb struct { - AppId string `json:"app_id,omitempty"` - CreateTime string `json:"create_time,omitempty"` - CreatedBy int64 `json:"created_by,omitempty"` - IntegrationId string `json:"integration_id,omitempty"` - Name string `json:"name,omitempty"` - TokenAccessPolicy *TokenAccessPolicy `json:"token_access_policy,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getPublishedAppIntegrationOutputFromPb(pb *getPublishedAppIntegrationOutputPb) (*GetPublishedAppIntegrationOutput, error) { - if pb == nil { - return nil, nil - } - st := &GetPublishedAppIntegrationOutput{} - st.AppId = pb.AppId - st.CreateTime = pb.CreateTime - st.CreatedBy = pb.CreatedBy - st.IntegrationId = pb.IntegrationId - st.Name = pb.Name - st.TokenAccessPolicy = pb.TokenAccessPolicy - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getPublishedAppIntegrationOutputPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getPublishedAppIntegrationOutputPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getPublishedAppIntegrationRequestToPb(st *GetPublishedAppIntegrationRequest) (*getPublishedAppIntegrationRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getPublishedAppIntegrationRequestPb{} - pb.IntegrationId = st.IntegrationId - - return pb, nil -} - -type getPublishedAppIntegrationRequestPb struct { - IntegrationId string `json:"-" url:"-"` -} - -func getPublishedAppIntegrationRequestFromPb(pb *getPublishedAppIntegrationRequestPb) (*GetPublishedAppIntegrationRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetPublishedAppIntegrationRequest{} - st.IntegrationId = pb.IntegrationId - - return st, nil -} - -func getPublishedAppIntegrationsOutputToPb(st *GetPublishedAppIntegrationsOutput) (*getPublishedAppIntegrationsOutputPb, error) { - if st == nil { - return nil, nil - } - pb := &getPublishedAppIntegrationsOutputPb{} - pb.Apps = st.Apps - pb.NextPageToken = st.NextPageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getPublishedAppIntegrationsOutputPb struct { - Apps []GetPublishedAppIntegrationOutput `json:"apps,omitempty"` - NextPageToken string `json:"next_page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getPublishedAppIntegrationsOutputFromPb(pb *getPublishedAppIntegrationsOutputPb) (*GetPublishedAppIntegrationsOutput, error) { - if pb == nil { - return nil, nil - } - st := &GetPublishedAppIntegrationsOutput{} - st.Apps = pb.Apps - st.NextPageToken = pb.NextPageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getPublishedAppIntegrationsOutputPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getPublishedAppIntegrationsOutputPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getPublishedAppsOutputToPb(st *GetPublishedAppsOutput) (*getPublishedAppsOutputPb, error) { - if st == nil { - return nil, nil - } - pb := &getPublishedAppsOutputPb{} - pb.Apps = st.Apps - pb.NextPageToken = st.NextPageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getPublishedAppsOutputPb struct { - Apps []PublishedAppOutput `json:"apps,omitempty"` - NextPageToken string `json:"next_page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getPublishedAppsOutputFromPb(pb *getPublishedAppsOutputPb) (*GetPublishedAppsOutput, error) { - if pb == nil { - return nil, nil - } - st := &GetPublishedAppsOutput{} - st.Apps = pb.Apps - st.NextPageToken = pb.NextPageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getPublishedAppsOutputPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getPublishedAppsOutputPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getServicePrincipalFederationPolicyRequestToPb(st *GetServicePrincipalFederationPolicyRequest) (*getServicePrincipalFederationPolicyRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getServicePrincipalFederationPolicyRequestPb{} - pb.PolicyId = st.PolicyId - pb.ServicePrincipalId = st.ServicePrincipalId - - return pb, nil -} - -type getServicePrincipalFederationPolicyRequestPb struct { - PolicyId string `json:"-" url:"-"` - ServicePrincipalId int64 `json:"-" url:"-"` -} - -func getServicePrincipalFederationPolicyRequestFromPb(pb *getServicePrincipalFederationPolicyRequestPb) (*GetServicePrincipalFederationPolicyRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetServicePrincipalFederationPolicyRequest{} - st.PolicyId = pb.PolicyId - st.ServicePrincipalId = pb.ServicePrincipalId - - return st, nil -} - -func listAccountFederationPoliciesRequestToPb(st *ListAccountFederationPoliciesRequest) (*listAccountFederationPoliciesRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listAccountFederationPoliciesRequestPb{} - pb.PageSize = st.PageSize - pb.PageToken = st.PageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listAccountFederationPoliciesRequestPb struct { - PageSize int `json:"-" url:"page_size,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listAccountFederationPoliciesRequestFromPb(pb *listAccountFederationPoliciesRequestPb) (*ListAccountFederationPoliciesRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListAccountFederationPoliciesRequest{} - st.PageSize = pb.PageSize - st.PageToken = pb.PageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listAccountFederationPoliciesRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listAccountFederationPoliciesRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listCustomAppIntegrationsRequestToPb(st *ListCustomAppIntegrationsRequest) (*listCustomAppIntegrationsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listCustomAppIntegrationsRequestPb{} - pb.IncludeCreatorUsername = st.IncludeCreatorUsername - pb.PageSize = st.PageSize - pb.PageToken = st.PageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listCustomAppIntegrationsRequestPb struct { - IncludeCreatorUsername bool `json:"-" url:"include_creator_username,omitempty"` - PageSize int `json:"-" url:"page_size,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listCustomAppIntegrationsRequestFromPb(pb *listCustomAppIntegrationsRequestPb) (*ListCustomAppIntegrationsRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListCustomAppIntegrationsRequest{} - st.IncludeCreatorUsername = pb.IncludeCreatorUsername - st.PageSize = pb.PageSize - st.PageToken = pb.PageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listCustomAppIntegrationsRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listCustomAppIntegrationsRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listFederationPoliciesResponseToPb(st *ListFederationPoliciesResponse) (*listFederationPoliciesResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listFederationPoliciesResponsePb{} - pb.NextPageToken = st.NextPageToken - pb.Policies = st.Policies - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listFederationPoliciesResponsePb struct { - NextPageToken string `json:"next_page_token,omitempty"` - Policies []FederationPolicy `json:"policies,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listFederationPoliciesResponseFromPb(pb *listFederationPoliciesResponsePb) (*ListFederationPoliciesResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListFederationPoliciesResponse{} - st.NextPageToken = pb.NextPageToken - st.Policies = pb.Policies - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listFederationPoliciesResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listFederationPoliciesResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listOAuthPublishedAppsRequestToPb(st *ListOAuthPublishedAppsRequest) (*listOAuthPublishedAppsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listOAuthPublishedAppsRequestPb{} - pb.PageSize = st.PageSize - pb.PageToken = st.PageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listOAuthPublishedAppsRequestPb struct { - PageSize int `json:"-" url:"page_size,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listOAuthPublishedAppsRequestFromPb(pb *listOAuthPublishedAppsRequestPb) (*ListOAuthPublishedAppsRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListOAuthPublishedAppsRequest{} - st.PageSize = pb.PageSize - st.PageToken = pb.PageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listOAuthPublishedAppsRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listOAuthPublishedAppsRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listPublishedAppIntegrationsRequestToPb(st *ListPublishedAppIntegrationsRequest) (*listPublishedAppIntegrationsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listPublishedAppIntegrationsRequestPb{} - pb.PageSize = st.PageSize - pb.PageToken = st.PageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listPublishedAppIntegrationsRequestPb struct { - PageSize int `json:"-" url:"page_size,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listPublishedAppIntegrationsRequestFromPb(pb *listPublishedAppIntegrationsRequestPb) (*ListPublishedAppIntegrationsRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListPublishedAppIntegrationsRequest{} - st.PageSize = pb.PageSize - st.PageToken = pb.PageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listPublishedAppIntegrationsRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listPublishedAppIntegrationsRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listServicePrincipalFederationPoliciesRequestToPb(st *ListServicePrincipalFederationPoliciesRequest) (*listServicePrincipalFederationPoliciesRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listServicePrincipalFederationPoliciesRequestPb{} - pb.PageSize = st.PageSize - pb.PageToken = st.PageToken - pb.ServicePrincipalId = st.ServicePrincipalId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listServicePrincipalFederationPoliciesRequestPb struct { - PageSize int `json:"-" url:"page_size,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - ServicePrincipalId int64 `json:"-" url:"-"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listServicePrincipalFederationPoliciesRequestFromPb(pb *listServicePrincipalFederationPoliciesRequestPb) (*ListServicePrincipalFederationPoliciesRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListServicePrincipalFederationPoliciesRequest{} - st.PageSize = pb.PageSize - st.PageToken = pb.PageToken - st.ServicePrincipalId = pb.ServicePrincipalId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listServicePrincipalFederationPoliciesRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listServicePrincipalFederationPoliciesRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listServicePrincipalSecretsRequestToPb(st *ListServicePrincipalSecretsRequest) (*listServicePrincipalSecretsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listServicePrincipalSecretsRequestPb{} - pb.PageToken = st.PageToken - pb.ServicePrincipalId = st.ServicePrincipalId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listServicePrincipalSecretsRequestPb struct { - PageToken string `json:"-" url:"page_token,omitempty"` - ServicePrincipalId int64 `json:"-" url:"-"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listServicePrincipalSecretsRequestFromPb(pb *listServicePrincipalSecretsRequestPb) (*ListServicePrincipalSecretsRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListServicePrincipalSecretsRequest{} - st.PageToken = pb.PageToken - st.ServicePrincipalId = pb.ServicePrincipalId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listServicePrincipalSecretsRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listServicePrincipalSecretsRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listServicePrincipalSecretsResponseToPb(st *ListServicePrincipalSecretsResponse) (*listServicePrincipalSecretsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listServicePrincipalSecretsResponsePb{} - pb.NextPageToken = st.NextPageToken - pb.Secrets = st.Secrets - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listServicePrincipalSecretsResponsePb struct { - NextPageToken string `json:"next_page_token,omitempty"` - Secrets []SecretInfo `json:"secrets,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listServicePrincipalSecretsResponseFromPb(pb *listServicePrincipalSecretsResponsePb) (*ListServicePrincipalSecretsResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListServicePrincipalSecretsResponse{} - st.NextPageToken = pb.NextPageToken - st.Secrets = pb.Secrets - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listServicePrincipalSecretsResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listServicePrincipalSecretsResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func oidcFederationPolicyToPb(st *OidcFederationPolicy) (*oidcFederationPolicyPb, error) { - if st == nil { - return nil, nil - } - pb := &oidcFederationPolicyPb{} - pb.Audiences = st.Audiences - pb.Issuer = st.Issuer - pb.JwksJson = st.JwksJson - pb.JwksUri = st.JwksUri - pb.Subject = st.Subject - pb.SubjectClaim = st.SubjectClaim - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type oidcFederationPolicyPb struct { - Audiences []string `json:"audiences,omitempty"` - Issuer string `json:"issuer,omitempty"` - JwksJson string `json:"jwks_json,omitempty"` - JwksUri string `json:"jwks_uri,omitempty"` - Subject string `json:"subject,omitempty"` - SubjectClaim string `json:"subject_claim,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func oidcFederationPolicyFromPb(pb *oidcFederationPolicyPb) (*OidcFederationPolicy, error) { - if pb == nil { - return nil, nil - } - st := &OidcFederationPolicy{} - st.Audiences = pb.Audiences - st.Issuer = pb.Issuer - st.JwksJson = pb.JwksJson - st.JwksUri = pb.JwksUri - st.Subject = pb.Subject - st.SubjectClaim = pb.SubjectClaim - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *oidcFederationPolicyPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st oidcFederationPolicyPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func publishedAppOutputToPb(st *PublishedAppOutput) (*publishedAppOutputPb, error) { - if st == nil { - return nil, nil - } - pb := &publishedAppOutputPb{} - pb.AppId = st.AppId - pb.ClientId = st.ClientId - pb.Description = st.Description - pb.IsConfidentialClient = st.IsConfidentialClient - pb.Name = st.Name - pb.RedirectUrls = st.RedirectUrls - pb.Scopes = st.Scopes - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type publishedAppOutputPb struct { - AppId string `json:"app_id,omitempty"` - ClientId string `json:"client_id,omitempty"` - Description string `json:"description,omitempty"` - IsConfidentialClient bool `json:"is_confidential_client,omitempty"` - Name string `json:"name,omitempty"` - RedirectUrls []string `json:"redirect_urls,omitempty"` - Scopes []string `json:"scopes,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func publishedAppOutputFromPb(pb *publishedAppOutputPb) (*PublishedAppOutput, error) { - if pb == nil { - return nil, nil - } - st := &PublishedAppOutput{} - st.AppId = pb.AppId - st.ClientId = pb.ClientId - st.Description = pb.Description - st.IsConfidentialClient = pb.IsConfidentialClient - st.Name = pb.Name - st.RedirectUrls = pb.RedirectUrls - st.Scopes = pb.Scopes - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *publishedAppOutputPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st publishedAppOutputPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func secretInfoToPb(st *SecretInfo) (*secretInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &secretInfoPb{} - pb.CreateTime = st.CreateTime - pb.ExpireTime = st.ExpireTime - pb.Id = st.Id - pb.SecretHash = st.SecretHash - pb.Status = st.Status - pb.UpdateTime = st.UpdateTime - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type secretInfoPb struct { - CreateTime string `json:"create_time,omitempty"` - ExpireTime string `json:"expire_time,omitempty"` - Id string `json:"id,omitempty"` - SecretHash string `json:"secret_hash,omitempty"` - Status string `json:"status,omitempty"` - UpdateTime string `json:"update_time,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func secretInfoFromPb(pb *secretInfoPb) (*SecretInfo, error) { - if pb == nil { - return nil, nil - } - st := &SecretInfo{} - st.CreateTime = pb.CreateTime - st.ExpireTime = pb.ExpireTime - st.Id = pb.Id - st.SecretHash = pb.SecretHash - st.Status = pb.Status - st.UpdateTime = pb.UpdateTime - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *secretInfoPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st secretInfoPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func tokenAccessPolicyToPb(st *TokenAccessPolicy) (*tokenAccessPolicyPb, error) { - if st == nil { - return nil, nil - } - pb := &tokenAccessPolicyPb{} - pb.AccessTokenTtlInMinutes = st.AccessTokenTtlInMinutes - pb.RefreshTokenTtlInMinutes = st.RefreshTokenTtlInMinutes - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type tokenAccessPolicyPb struct { - AccessTokenTtlInMinutes int `json:"access_token_ttl_in_minutes,omitempty"` - RefreshTokenTtlInMinutes int `json:"refresh_token_ttl_in_minutes,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func tokenAccessPolicyFromPb(pb *tokenAccessPolicyPb) (*TokenAccessPolicy, error) { - if pb == nil { - return nil, nil - } - st := &TokenAccessPolicy{} - st.AccessTokenTtlInMinutes = pb.AccessTokenTtlInMinutes - st.RefreshTokenTtlInMinutes = pb.RefreshTokenTtlInMinutes - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *tokenAccessPolicyPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st tokenAccessPolicyPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func updateAccountFederationPolicyRequestToPb(st *UpdateAccountFederationPolicyRequest) (*updateAccountFederationPolicyRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &updateAccountFederationPolicyRequestPb{} - pb.Policy = st.Policy - pb.PolicyId = st.PolicyId - pb.UpdateMask = st.UpdateMask - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type updateAccountFederationPolicyRequestPb struct { - Policy FederationPolicy `json:"policy"` - PolicyId string `json:"-" url:"-"` - UpdateMask string `json:"-" url:"update_mask,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func updateAccountFederationPolicyRequestFromPb(pb *updateAccountFederationPolicyRequestPb) (*UpdateAccountFederationPolicyRequest, error) { - if pb == nil { - return nil, nil - } - st := &UpdateAccountFederationPolicyRequest{} - st.Policy = pb.Policy - st.PolicyId = pb.PolicyId - st.UpdateMask = pb.UpdateMask - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *updateAccountFederationPolicyRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st updateAccountFederationPolicyRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func updateCustomAppIntegrationToPb(st *UpdateCustomAppIntegration) (*updateCustomAppIntegrationPb, error) { - if st == nil { - return nil, nil - } - pb := &updateCustomAppIntegrationPb{} - pb.IntegrationId = st.IntegrationId - pb.RedirectUrls = st.RedirectUrls - pb.Scopes = st.Scopes - pb.TokenAccessPolicy = st.TokenAccessPolicy - pb.UserAuthorizedScopes = st.UserAuthorizedScopes - - return pb, nil -} - -type updateCustomAppIntegrationPb struct { - IntegrationId string `json:"-" url:"-"` - RedirectUrls []string `json:"redirect_urls,omitempty"` - Scopes []string `json:"scopes,omitempty"` - TokenAccessPolicy *TokenAccessPolicy `json:"token_access_policy,omitempty"` - UserAuthorizedScopes []string `json:"user_authorized_scopes,omitempty"` -} - -func updateCustomAppIntegrationFromPb(pb *updateCustomAppIntegrationPb) (*UpdateCustomAppIntegration, error) { - if pb == nil { - return nil, nil - } - st := &UpdateCustomAppIntegration{} - st.IntegrationId = pb.IntegrationId - st.RedirectUrls = pb.RedirectUrls - st.Scopes = pb.Scopes - st.TokenAccessPolicy = pb.TokenAccessPolicy - st.UserAuthorizedScopes = pb.UserAuthorizedScopes - - return st, nil -} - -func updateCustomAppIntegrationOutputToPb(st *UpdateCustomAppIntegrationOutput) (*updateCustomAppIntegrationOutputPb, error) { - if st == nil { - return nil, nil - } - pb := &updateCustomAppIntegrationOutputPb{} - - return pb, nil -} - -type updateCustomAppIntegrationOutputPb struct { -} - -func updateCustomAppIntegrationOutputFromPb(pb *updateCustomAppIntegrationOutputPb) (*UpdateCustomAppIntegrationOutput, error) { - if pb == nil { - return nil, nil - } - st := &UpdateCustomAppIntegrationOutput{} - - return st, nil -} - -func updatePublishedAppIntegrationToPb(st *UpdatePublishedAppIntegration) (*updatePublishedAppIntegrationPb, error) { - if st == nil { - return nil, nil - } - pb := &updatePublishedAppIntegrationPb{} - pb.IntegrationId = st.IntegrationId - pb.TokenAccessPolicy = st.TokenAccessPolicy - - return pb, nil -} - -type updatePublishedAppIntegrationPb struct { - IntegrationId string `json:"-" url:"-"` - TokenAccessPolicy *TokenAccessPolicy `json:"token_access_policy,omitempty"` -} - -func updatePublishedAppIntegrationFromPb(pb *updatePublishedAppIntegrationPb) (*UpdatePublishedAppIntegration, error) { - if pb == nil { - return nil, nil - } - st := &UpdatePublishedAppIntegration{} - st.IntegrationId = pb.IntegrationId - st.TokenAccessPolicy = pb.TokenAccessPolicy - - return st, nil -} - -func updatePublishedAppIntegrationOutputToPb(st *UpdatePublishedAppIntegrationOutput) (*updatePublishedAppIntegrationOutputPb, error) { - if st == nil { - return nil, nil - } - pb := &updatePublishedAppIntegrationOutputPb{} - - return pb, nil -} - -type updatePublishedAppIntegrationOutputPb struct { -} - -func updatePublishedAppIntegrationOutputFromPb(pb *updatePublishedAppIntegrationOutputPb) (*UpdatePublishedAppIntegrationOutput, error) { - if pb == nil { - return nil, nil - } - st := &UpdatePublishedAppIntegrationOutput{} - - return st, nil -} - -func updateServicePrincipalFederationPolicyRequestToPb(st *UpdateServicePrincipalFederationPolicyRequest) (*updateServicePrincipalFederationPolicyRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &updateServicePrincipalFederationPolicyRequestPb{} - pb.Policy = st.Policy - pb.PolicyId = st.PolicyId - pb.ServicePrincipalId = st.ServicePrincipalId - pb.UpdateMask = st.UpdateMask - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type updateServicePrincipalFederationPolicyRequestPb struct { - Policy FederationPolicy `json:"policy"` - PolicyId string `json:"-" url:"-"` - ServicePrincipalId int64 `json:"-" url:"-"` - UpdateMask string `json:"-" url:"update_mask,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func updateServicePrincipalFederationPolicyRequestFromPb(pb *updateServicePrincipalFederationPolicyRequestPb) (*UpdateServicePrincipalFederationPolicyRequest, error) { - if pb == nil { - return nil, nil - } - st := &UpdateServicePrincipalFederationPolicyRequest{} - st.Policy = pb.Policy - st.PolicyId = pb.PolicyId - st.ServicePrincipalId = pb.ServicePrincipalId - st.UpdateMask = pb.UpdateMask - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *updateServicePrincipalFederationPolicyRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st updateServicePrincipalFederationPolicyRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func durationToPb(d *time.Duration) (*string, error) { - if d == nil { - return nil, nil - } - s := fmt.Sprintf("%.9fs", d.Seconds()) - return &s, nil -} - -func durationFromPb(s *string) (*time.Duration, error) { - if s == nil { - return nil, nil - } - d, err := time.ParseDuration(*s) - if err != nil { - return nil, err - } - return &d, nil -} - -func timestampToPb(t *time.Time) (*string, error) { - if t == nil { - return nil, nil - } - s := t.Format(time.RFC3339) - return &s, nil -} - -func timestampFromPb(s *string) (*time.Time, error) { - if s == nil { - return nil, nil - } - t, err := time.Parse(time.RFC3339, *s) - if err != nil { - return nil, err - } - return &t, nil -} - -func fieldMaskToPb(fm *[]string) (*string, error) { - if fm == nil { - return nil, nil - } - s := strings.Join(*fm, ",") - return &s, nil -} - -func fieldMaskFromPb(s *string) (*[]string, error) { - if s == nil { - return nil, nil - } - fm := strings.Split(*s, ",") - return &fm, nil -} diff --git a/service/oauth2/model.go b/service/oauth2/model.go index 9434a5293..d8ddc772a 100755 --- a/service/oauth2/model.go +++ b/service/oauth2/model.go @@ -3,585 +3,222 @@ package oauth2 import ( - "encoding/json" - "fmt" + "github.com/databricks/databricks-sdk-go/marshal" ) // Create account federation policy type CreateAccountFederationPolicyRequest struct { - - // Wire name: 'policy' Policy FederationPolicy `json:"policy"` // The identifier for the federation policy. The identifier must contain // only lowercase alphanumeric characters, numbers, hyphens, and slashes. If // unspecified, the id will be assigned by Databricks. - PolicyId string `json:"-" tf:"-"` + PolicyId string `json:"-" url:"policy_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateAccountFederationPolicyRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createAccountFederationPolicyRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createAccountFederationPolicyRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateAccountFederationPolicyRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateAccountFederationPolicyRequest) MarshalJSON() ([]byte, error) { - pb, err := createAccountFederationPolicyRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateAccountFederationPolicyRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreateCustomAppIntegration struct { // This field indicates whether an OAuth client secret is required to // authenticate this client. - // Wire name: 'confidential' Confidential bool `json:"confidential,omitempty"` // Name of the custom OAuth app - // Wire name: 'name' Name string `json:"name,omitempty"` // List of OAuth redirect urls - // Wire name: 'redirect_urls' RedirectUrls []string `json:"redirect_urls,omitempty"` // OAuth scopes granted to the application. Supported scopes: all-apis, sql, // offline_access, openid, profile, email. - // Wire name: 'scopes' Scopes []string `json:"scopes,omitempty"` // Token access policy - // Wire name: 'token_access_policy' TokenAccessPolicy *TokenAccessPolicy `json:"token_access_policy,omitempty"` // Scopes that will need to be consented by end user to mint the access // token. If the user does not authorize the access token will not be // minted. Must be a subset of scopes. - // Wire name: 'user_authorized_scopes' UserAuthorizedScopes []string `json:"user_authorized_scopes,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateCustomAppIntegration) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createCustomAppIntegrationPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createCustomAppIntegrationFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateCustomAppIntegration) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateCustomAppIntegration) MarshalJSON() ([]byte, error) { - pb, err := createCustomAppIntegrationToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateCustomAppIntegration) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreateCustomAppIntegrationOutput struct { // OAuth client-id generated by the Databricks - // Wire name: 'client_id' ClientId string `json:"client_id,omitempty"` // OAuth client-secret generated by the Databricks. If this is a // confidential OAuth app client-secret will be generated. - // Wire name: 'client_secret' ClientSecret string `json:"client_secret,omitempty"` // Unique integration id for the custom OAuth app - // Wire name: 'integration_id' IntegrationId string `json:"integration_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateCustomAppIntegrationOutput) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createCustomAppIntegrationOutputPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createCustomAppIntegrationOutputFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateCustomAppIntegrationOutput) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateCustomAppIntegrationOutput) MarshalJSON() ([]byte, error) { - pb, err := createCustomAppIntegrationOutputToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateCustomAppIntegrationOutput) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreatePublishedAppIntegration struct { // App id of the OAuth published app integration. For example power-bi, // tableau-deskop - // Wire name: 'app_id' AppId string `json:"app_id,omitempty"` // Token access policy - // Wire name: 'token_access_policy' TokenAccessPolicy *TokenAccessPolicy `json:"token_access_policy,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreatePublishedAppIntegration) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createPublishedAppIntegrationPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createPublishedAppIntegrationFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreatePublishedAppIntegration) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreatePublishedAppIntegration) MarshalJSON() ([]byte, error) { - pb, err := createPublishedAppIntegrationToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreatePublishedAppIntegration) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreatePublishedAppIntegrationOutput struct { // Unique integration id for the published OAuth app - // Wire name: 'integration_id' IntegrationId string `json:"integration_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreatePublishedAppIntegrationOutput) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createPublishedAppIntegrationOutputPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createPublishedAppIntegrationOutputFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreatePublishedAppIntegrationOutput) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreatePublishedAppIntegrationOutput) MarshalJSON() ([]byte, error) { - pb, err := createPublishedAppIntegrationOutputToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreatePublishedAppIntegrationOutput) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Create service principal federation policy type CreateServicePrincipalFederationPolicyRequest struct { - - // Wire name: 'policy' Policy FederationPolicy `json:"policy"` // The identifier for the federation policy. The identifier must contain // only lowercase alphanumeric characters, numbers, hyphens, and slashes. If // unspecified, the id will be assigned by Databricks. - PolicyId string `json:"-" tf:"-"` + PolicyId string `json:"-" url:"policy_id,omitempty"` // The service principal id for the federation policy. - ServicePrincipalId int64 `json:"-" tf:"-"` + ServicePrincipalId int64 `json:"-" url:"-"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateServicePrincipalFederationPolicyRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createServicePrincipalFederationPolicyRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createServicePrincipalFederationPolicyRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateServicePrincipalFederationPolicyRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateServicePrincipalFederationPolicyRequest) MarshalJSON() ([]byte, error) { - pb, err := createServicePrincipalFederationPolicyRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateServicePrincipalFederationPolicyRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreateServicePrincipalSecretRequest struct { // The lifetime of the secret in seconds. If this parameter is not provided, // the secret will have a default lifetime of 730 days (63072000s). - // Wire name: 'lifetime' Lifetime string `json:"lifetime,omitempty"` // The service principal ID. - ServicePrincipalId int64 `json:"-" tf:"-"` + ServicePrincipalId int64 `json:"-" url:"-"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateServicePrincipalSecretRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createServicePrincipalSecretRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createServicePrincipalSecretRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateServicePrincipalSecretRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateServicePrincipalSecretRequest) MarshalJSON() ([]byte, error) { - pb, err := createServicePrincipalSecretRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateServicePrincipalSecretRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreateServicePrincipalSecretResponse struct { // UTC time when the secret was created - // Wire name: 'create_time' CreateTime string `json:"create_time,omitempty"` // UTC time when the secret will expire. If the field is not present, the // secret does not expire. - // Wire name: 'expire_time' ExpireTime string `json:"expire_time,omitempty"` // ID of the secret - // Wire name: 'id' Id string `json:"id,omitempty"` // Secret Value - // Wire name: 'secret' Secret string `json:"secret,omitempty"` // Secret Hash - // Wire name: 'secret_hash' SecretHash string `json:"secret_hash,omitempty"` // Status of the secret - // Wire name: 'status' Status string `json:"status,omitempty"` // UTC time when the secret was updated - // Wire name: 'update_time' UpdateTime string `json:"update_time,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateServicePrincipalSecretResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createServicePrincipalSecretResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createServicePrincipalSecretResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateServicePrincipalSecretResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateServicePrincipalSecretResponse) MarshalJSON() ([]byte, error) { - pb, err := createServicePrincipalSecretResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateServicePrincipalSecretResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Delete account federation policy type DeleteAccountFederationPolicyRequest struct { // The identifier for the federation policy. - PolicyId string `json:"-" tf:"-"` -} - -func (st *DeleteAccountFederationPolicyRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteAccountFederationPolicyRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteAccountFederationPolicyRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteAccountFederationPolicyRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteAccountFederationPolicyRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + PolicyId string `json:"-" url:"-"` } type DeleteCustomAppIntegrationOutput struct { } -func (st *DeleteCustomAppIntegrationOutput) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteCustomAppIntegrationOutputPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteCustomAppIntegrationOutputFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteCustomAppIntegrationOutput) MarshalJSON() ([]byte, error) { - pb, err := deleteCustomAppIntegrationOutputToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Delete Custom OAuth App Integration type DeleteCustomAppIntegrationRequest struct { - IntegrationId string `json:"-" tf:"-"` -} - -func (st *DeleteCustomAppIntegrationRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteCustomAppIntegrationRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteCustomAppIntegrationRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteCustomAppIntegrationRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteCustomAppIntegrationRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + IntegrationId string `json:"-" url:"-"` } type DeletePublishedAppIntegrationOutput struct { } -func (st *DeletePublishedAppIntegrationOutput) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deletePublishedAppIntegrationOutputPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deletePublishedAppIntegrationOutputFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeletePublishedAppIntegrationOutput) MarshalJSON() ([]byte, error) { - pb, err := deletePublishedAppIntegrationOutputToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Delete Published OAuth App Integration type DeletePublishedAppIntegrationRequest struct { - IntegrationId string `json:"-" tf:"-"` -} - -func (st *DeletePublishedAppIntegrationRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deletePublishedAppIntegrationRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deletePublishedAppIntegrationRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeletePublishedAppIntegrationRequest) MarshalJSON() ([]byte, error) { - pb, err := deletePublishedAppIntegrationRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + IntegrationId string `json:"-" url:"-"` } type DeleteResponse struct { } -func (st *DeleteResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Delete service principal federation policy type DeleteServicePrincipalFederationPolicyRequest struct { // The identifier for the federation policy. - PolicyId string `json:"-" tf:"-"` + PolicyId string `json:"-" url:"-"` // The service principal id for the federation policy. - ServicePrincipalId int64 `json:"-" tf:"-"` -} - -func (st *DeleteServicePrincipalFederationPolicyRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteServicePrincipalFederationPolicyRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteServicePrincipalFederationPolicyRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteServicePrincipalFederationPolicyRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteServicePrincipalFederationPolicyRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + ServicePrincipalId int64 `json:"-" url:"-"` } // Delete service principal secret type DeleteServicePrincipalSecretRequest struct { // The secret ID. - SecretId string `json:"-" tf:"-"` + SecretId string `json:"-" url:"-"` // The service principal ID. - ServicePrincipalId int64 `json:"-" tf:"-"` -} - -func (st *DeleteServicePrincipalSecretRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteServicePrincipalSecretRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteServicePrincipalSecretRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteServicePrincipalSecretRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteServicePrincipalSecretRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + ServicePrincipalId int64 `json:"-" url:"-"` } type FederationPolicy struct { // Creation time of the federation policy. - // Wire name: 'create_time' CreateTime string `json:"create_time,omitempty"` // Description of the federation policy. - // Wire name: 'description' Description string `json:"description,omitempty"` // Resource name for the federation policy. Example values include // `accounts//federationPolicies/my-federation-policy` for @@ -590,611 +227,275 @@ type FederationPolicy struct { // for Service Principal Federation Policies. Typically an output parameter, // which does not need to be specified in create or update requests. If // specified in a request, must match the value in the request URL. - // Wire name: 'name' Name string `json:"name,omitempty"` // Specifies the policy to use for validating OIDC claims in your federated // tokens. - // Wire name: 'oidc_policy' OidcPolicy *OidcFederationPolicy `json:"oidc_policy,omitempty"` // The ID of the federation policy. - // Wire name: 'policy_id' PolicyId string `json:"policy_id,omitempty"` // The service principal ID that this federation policy applies to. Only set // for service principal federation policies. - // Wire name: 'service_principal_id' ServicePrincipalId int64 `json:"service_principal_id,omitempty"` // Unique, immutable id of the federation policy. - // Wire name: 'uid' Uid string `json:"uid,omitempty"` // Last update time of the federation policy. - // Wire name: 'update_time' UpdateTime string `json:"update_time,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *FederationPolicy) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &federationPolicyPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := federationPolicyFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *FederationPolicy) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st FederationPolicy) MarshalJSON() ([]byte, error) { - pb, err := federationPolicyToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s FederationPolicy) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get account federation policy type GetAccountFederationPolicyRequest struct { // The identifier for the federation policy. - PolicyId string `json:"-" tf:"-"` -} - -func (st *GetAccountFederationPolicyRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getAccountFederationPolicyRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getAccountFederationPolicyRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetAccountFederationPolicyRequest) MarshalJSON() ([]byte, error) { - pb, err := getAccountFederationPolicyRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + PolicyId string `json:"-" url:"-"` } type GetCustomAppIntegrationOutput struct { // The client id of the custom OAuth app - // Wire name: 'client_id' ClientId string `json:"client_id,omitempty"` // This field indicates whether an OAuth client secret is required to // authenticate this client. - // Wire name: 'confidential' Confidential bool `json:"confidential,omitempty"` - // Wire name: 'create_time' CreateTime string `json:"create_time,omitempty"` - // Wire name: 'created_by' CreatedBy int64 `json:"created_by,omitempty"` - // Wire name: 'creator_username' CreatorUsername string `json:"creator_username,omitempty"` // ID of this custom app - // Wire name: 'integration_id' IntegrationId string `json:"integration_id,omitempty"` // The display name of the custom OAuth app - // Wire name: 'name' Name string `json:"name,omitempty"` // List of OAuth redirect urls - // Wire name: 'redirect_urls' RedirectUrls []string `json:"redirect_urls,omitempty"` - // Wire name: 'scopes' Scopes []string `json:"scopes,omitempty"` // Token access policy - // Wire name: 'token_access_policy' TokenAccessPolicy *TokenAccessPolicy `json:"token_access_policy,omitempty"` // Scopes that will need to be consented by end user to mint the access // token. If the user does not authorize the access token will not be // minted. Must be a subset of scopes. - // Wire name: 'user_authorized_scopes' UserAuthorizedScopes []string `json:"user_authorized_scopes,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetCustomAppIntegrationOutput) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getCustomAppIntegrationOutputPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getCustomAppIntegrationOutputFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetCustomAppIntegrationOutput) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetCustomAppIntegrationOutput) MarshalJSON() ([]byte, error) { - pb, err := getCustomAppIntegrationOutputToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetCustomAppIntegrationOutput) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get OAuth Custom App Integration type GetCustomAppIntegrationRequest struct { // The OAuth app integration ID. - IntegrationId string `json:"-" tf:"-"` -} - -func (st *GetCustomAppIntegrationRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getCustomAppIntegrationRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getCustomAppIntegrationRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetCustomAppIntegrationRequest) MarshalJSON() ([]byte, error) { - pb, err := getCustomAppIntegrationRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + IntegrationId string `json:"-" url:"-"` } type GetCustomAppIntegrationsOutput struct { // List of Custom OAuth App Integrations defined for the account. - // Wire name: 'apps' Apps []GetCustomAppIntegrationOutput `json:"apps,omitempty"` - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetCustomAppIntegrationsOutput) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getCustomAppIntegrationsOutputPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getCustomAppIntegrationsOutputFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetCustomAppIntegrationsOutput) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetCustomAppIntegrationsOutput) MarshalJSON() ([]byte, error) { - pb, err := getCustomAppIntegrationsOutputToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetCustomAppIntegrationsOutput) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type GetPublishedAppIntegrationOutput struct { // App-id of the published app integration - // Wire name: 'app_id' AppId string `json:"app_id,omitempty"` - // Wire name: 'create_time' CreateTime string `json:"create_time,omitempty"` - // Wire name: 'created_by' CreatedBy int64 `json:"created_by,omitempty"` // Unique integration id for the published OAuth app - // Wire name: 'integration_id' IntegrationId string `json:"integration_id,omitempty"` // Display name of the published OAuth app - // Wire name: 'name' Name string `json:"name,omitempty"` // Token access policy - // Wire name: 'token_access_policy' TokenAccessPolicy *TokenAccessPolicy `json:"token_access_policy,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetPublishedAppIntegrationOutput) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getPublishedAppIntegrationOutputPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getPublishedAppIntegrationOutputFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetPublishedAppIntegrationOutput) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetPublishedAppIntegrationOutput) MarshalJSON() ([]byte, error) { - pb, err := getPublishedAppIntegrationOutputToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetPublishedAppIntegrationOutput) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get OAuth Published App Integration type GetPublishedAppIntegrationRequest struct { - IntegrationId string `json:"-" tf:"-"` -} - -func (st *GetPublishedAppIntegrationRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getPublishedAppIntegrationRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getPublishedAppIntegrationRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetPublishedAppIntegrationRequest) MarshalJSON() ([]byte, error) { - pb, err := getPublishedAppIntegrationRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + IntegrationId string `json:"-" url:"-"` } type GetPublishedAppIntegrationsOutput struct { // List of Published OAuth App Integrations defined for the account. - // Wire name: 'apps' Apps []GetPublishedAppIntegrationOutput `json:"apps,omitempty"` - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetPublishedAppIntegrationsOutput) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getPublishedAppIntegrationsOutputPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getPublishedAppIntegrationsOutputFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetPublishedAppIntegrationsOutput) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetPublishedAppIntegrationsOutput) MarshalJSON() ([]byte, error) { - pb, err := getPublishedAppIntegrationsOutputToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetPublishedAppIntegrationsOutput) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type GetPublishedAppsOutput struct { // List of Published OAuth Apps. - // Wire name: 'apps' Apps []PublishedAppOutput `json:"apps,omitempty"` // A token that can be used to get the next page of results. If not present, // there are no more results to show. - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetPublishedAppsOutput) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getPublishedAppsOutputPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getPublishedAppsOutputFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetPublishedAppsOutput) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetPublishedAppsOutput) MarshalJSON() ([]byte, error) { - pb, err := getPublishedAppsOutputToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetPublishedAppsOutput) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get service principal federation policy type GetServicePrincipalFederationPolicyRequest struct { // The identifier for the federation policy. - PolicyId string `json:"-" tf:"-"` + PolicyId string `json:"-" url:"-"` // The service principal id for the federation policy. - ServicePrincipalId int64 `json:"-" tf:"-"` -} - -func (st *GetServicePrincipalFederationPolicyRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getServicePrincipalFederationPolicyRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getServicePrincipalFederationPolicyRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetServicePrincipalFederationPolicyRequest) MarshalJSON() ([]byte, error) { - pb, err := getServicePrincipalFederationPolicyRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + ServicePrincipalId int64 `json:"-" url:"-"` } // List account federation policies type ListAccountFederationPoliciesRequest struct { - PageSize int `json:"-" tf:"-"` + PageSize int `json:"-" url:"page_size,omitempty"` - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListAccountFederationPoliciesRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listAccountFederationPoliciesRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listAccountFederationPoliciesRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListAccountFederationPoliciesRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListAccountFederationPoliciesRequest) MarshalJSON() ([]byte, error) { - pb, err := listAccountFederationPoliciesRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListAccountFederationPoliciesRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get custom oauth app integrations type ListCustomAppIntegrationsRequest struct { - IncludeCreatorUsername bool `json:"-" tf:"-"` + IncludeCreatorUsername bool `json:"-" url:"include_creator_username,omitempty"` - PageSize int `json:"-" tf:"-"` + PageSize int `json:"-" url:"page_size,omitempty"` - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListCustomAppIntegrationsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listCustomAppIntegrationsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listCustomAppIntegrationsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListCustomAppIntegrationsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListCustomAppIntegrationsRequest) MarshalJSON() ([]byte, error) { - pb, err := listCustomAppIntegrationsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListCustomAppIntegrationsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListFederationPoliciesResponse struct { - - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` - // Wire name: 'policies' Policies []FederationPolicy `json:"policies,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListFederationPoliciesResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listFederationPoliciesResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listFederationPoliciesResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListFederationPoliciesResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListFederationPoliciesResponse) MarshalJSON() ([]byte, error) { - pb, err := listFederationPoliciesResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListFederationPoliciesResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get all the published OAuth apps type ListOAuthPublishedAppsRequest struct { // The max number of OAuth published apps to return in one page. - PageSize int `json:"-" tf:"-"` + PageSize int `json:"-" url:"page_size,omitempty"` // A token that can be used to get the next page of results. - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListOAuthPublishedAppsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listOAuthPublishedAppsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listOAuthPublishedAppsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListOAuthPublishedAppsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListOAuthPublishedAppsRequest) MarshalJSON() ([]byte, error) { - pb, err := listOAuthPublishedAppsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListOAuthPublishedAppsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get published oauth app integrations type ListPublishedAppIntegrationsRequest struct { - PageSize int `json:"-" tf:"-"` + PageSize int `json:"-" url:"page_size,omitempty"` - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListPublishedAppIntegrationsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listPublishedAppIntegrationsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listPublishedAppIntegrationsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListPublishedAppIntegrationsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListPublishedAppIntegrationsRequest) MarshalJSON() ([]byte, error) { - pb, err := listPublishedAppIntegrationsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListPublishedAppIntegrationsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // List service principal federation policies type ListServicePrincipalFederationPoliciesRequest struct { - PageSize int `json:"-" tf:"-"` + PageSize int `json:"-" url:"page_size,omitempty"` - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` // The service principal id for the federation policy. - ServicePrincipalId int64 `json:"-" tf:"-"` + ServicePrincipalId int64 `json:"-" url:"-"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListServicePrincipalFederationPoliciesRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listServicePrincipalFederationPoliciesRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listServicePrincipalFederationPoliciesRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListServicePrincipalFederationPoliciesRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListServicePrincipalFederationPoliciesRequest) MarshalJSON() ([]byte, error) { - pb, err := listServicePrincipalFederationPoliciesRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListServicePrincipalFederationPoliciesRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // List service principal secrets @@ -1208,72 +509,36 @@ type ListServicePrincipalSecretsRequest struct { // the response contains no `next_page_token`. Note that the number of // entries returned must not be used to determine when the listing is // complete. - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` // The service principal ID. - ServicePrincipalId int64 `json:"-" tf:"-"` + ServicePrincipalId int64 `json:"-" url:"-"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListServicePrincipalSecretsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listServicePrincipalSecretsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listServicePrincipalSecretsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListServicePrincipalSecretsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListServicePrincipalSecretsRequest) MarshalJSON() ([]byte, error) { - pb, err := listServicePrincipalSecretsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListServicePrincipalSecretsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListServicePrincipalSecretsResponse struct { // A token, which can be sent as `page_token` to retrieve the next page. - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` // List of the secrets - // Wire name: 'secrets' Secrets []SecretInfo `json:"secrets,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListServicePrincipalSecretsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listServicePrincipalSecretsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listServicePrincipalSecretsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListServicePrincipalSecretsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListServicePrincipalSecretsResponse) MarshalJSON() ([]byte, error) { - pb, err := listServicePrincipalSecretsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListServicePrincipalSecretsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Specifies the policy to use for validating OIDC claims in your federated @@ -1285,11 +550,9 @@ type OidcFederationPolicy struct { // the token matches at least one audience in the policy, the token is // considered a match. If audiences is unspecified, defaults to your // Databricks account id. - // Wire name: 'audiences' Audiences []string `json:"audiences,omitempty"` // The required token issuer, as specified in the 'iss' claim of federated // tokens. - // Wire name: 'issuer' Issuer string `json:"issuer,omitempty"` // The public keys used to validate the signature of federated tokens, in // JWKS format. Most use cases should not need to specify this field. If @@ -1297,7 +560,6 @@ type OidcFederationPolicy struct { // automatically fetches the public keys from your issuer’s well known // endpoint. Databricks strongly recommends relying on your issuer’s well // known endpoint for discovering public keys. - // Wire name: 'jwks_json' JwksJson string `json:"jwks_json,omitempty"` // URL of the public keys used to validate the signature of federated // tokens, in JWKS format. Most use cases should not need to specify this @@ -1305,402 +567,173 @@ type OidcFederationPolicy struct { // Databricks automatically fetches the public keys from your issuer’s // well known endpoint. Databricks strongly recommends relying on your // issuer’s well known endpoint for discovering public keys. - // Wire name: 'jwks_uri' JwksUri string `json:"jwks_uri,omitempty"` // The required token subject, as specified in the subject claim of // federated tokens. Must be specified for service principal federation // policies. Must not be specified for account federation policies. - // Wire name: 'subject' Subject string `json:"subject,omitempty"` // The claim that contains the subject of the token. If unspecified, the // default value is 'sub'. - // Wire name: 'subject_claim' SubjectClaim string `json:"subject_claim,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *OidcFederationPolicy) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &oidcFederationPolicyPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := oidcFederationPolicyFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *OidcFederationPolicy) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st OidcFederationPolicy) MarshalJSON() ([]byte, error) { - pb, err := oidcFederationPolicyToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s OidcFederationPolicy) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type PublishedAppOutput struct { // Unique ID of the published OAuth app. - // Wire name: 'app_id' AppId string `json:"app_id,omitempty"` // Client ID of the published OAuth app. It is the client_id in the OAuth // flow - // Wire name: 'client_id' ClientId string `json:"client_id,omitempty"` // Description of the published OAuth app. - // Wire name: 'description' Description string `json:"description,omitempty"` // Whether the published OAuth app is a confidential client. It is always // false for published OAuth apps. - // Wire name: 'is_confidential_client' IsConfidentialClient bool `json:"is_confidential_client,omitempty"` // The display name of the published OAuth app. - // Wire name: 'name' Name string `json:"name,omitempty"` // Redirect URLs of the published OAuth app. - // Wire name: 'redirect_urls' RedirectUrls []string `json:"redirect_urls,omitempty"` // Required scopes for the published OAuth app. - // Wire name: 'scopes' Scopes []string `json:"scopes,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *PublishedAppOutput) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &publishedAppOutputPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := publishedAppOutputFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *PublishedAppOutput) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st PublishedAppOutput) MarshalJSON() ([]byte, error) { - pb, err := publishedAppOutputToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s PublishedAppOutput) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type SecretInfo struct { // UTC time when the secret was created - // Wire name: 'create_time' CreateTime string `json:"create_time,omitempty"` // UTC time when the secret will expire. If the field is not present, the // secret does not expire. - // Wire name: 'expire_time' ExpireTime string `json:"expire_time,omitempty"` // ID of the secret - // Wire name: 'id' Id string `json:"id,omitempty"` // Secret Hash - // Wire name: 'secret_hash' SecretHash string `json:"secret_hash,omitempty"` // Status of the secret - // Wire name: 'status' Status string `json:"status,omitempty"` // UTC time when the secret was updated - // Wire name: 'update_time' UpdateTime string `json:"update_time,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *SecretInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &secretInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := secretInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *SecretInfo) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st SecretInfo) MarshalJSON() ([]byte, error) { - pb, err := secretInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s SecretInfo) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type TokenAccessPolicy struct { // access token time to live in minutes - // Wire name: 'access_token_ttl_in_minutes' AccessTokenTtlInMinutes int `json:"access_token_ttl_in_minutes,omitempty"` // refresh token time to live in minutes - // Wire name: 'refresh_token_ttl_in_minutes' RefreshTokenTtlInMinutes int `json:"refresh_token_ttl_in_minutes,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *TokenAccessPolicy) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &tokenAccessPolicyPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := tokenAccessPolicyFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *TokenAccessPolicy) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st TokenAccessPolicy) MarshalJSON() ([]byte, error) { - pb, err := tokenAccessPolicyToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s TokenAccessPolicy) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Update account federation policy type UpdateAccountFederationPolicyRequest struct { - - // Wire name: 'policy' Policy FederationPolicy `json:"policy"` // The identifier for the federation policy. - PolicyId string `json:"-" tf:"-"` + PolicyId string `json:"-" url:"-"` // The field mask specifies which fields of the policy to update. To specify // multiple fields in the field mask, use comma as the separator (no space). // The special value '*' indicates that all fields should be updated (full // replacement). If unspecified, all fields that are set in the policy // provided in the update request will overwrite the corresponding fields in // the existing policy. Example value: 'description,oidc_policy.audiences'. - UpdateMask string `json:"-" tf:"-"` + UpdateMask string `json:"-" url:"update_mask,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *UpdateAccountFederationPolicyRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateAccountFederationPolicyRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateAccountFederationPolicyRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *UpdateAccountFederationPolicyRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st UpdateAccountFederationPolicyRequest) MarshalJSON() ([]byte, error) { - pb, err := updateAccountFederationPolicyRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s UpdateAccountFederationPolicyRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type UpdateCustomAppIntegration struct { - IntegrationId string `json:"-" tf:"-"` + IntegrationId string `json:"-" url:"-"` // List of OAuth redirect urls to be updated in the custom OAuth app // integration - // Wire name: 'redirect_urls' RedirectUrls []string `json:"redirect_urls,omitempty"` // List of OAuth scopes to be updated in the custom OAuth app integration, // similar to redirect URIs this will fully replace the existing values // instead of appending - // Wire name: 'scopes' Scopes []string `json:"scopes,omitempty"` // Token access policy to be updated in the custom OAuth app integration - // Wire name: 'token_access_policy' TokenAccessPolicy *TokenAccessPolicy `json:"token_access_policy,omitempty"` // Scopes that will need to be consented by end user to mint the access // token. If the user does not authorize the access token will not be // minted. Must be a subset of scopes. - // Wire name: 'user_authorized_scopes' UserAuthorizedScopes []string `json:"user_authorized_scopes,omitempty"` } -func (st *UpdateCustomAppIntegration) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateCustomAppIntegrationPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateCustomAppIntegrationFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateCustomAppIntegration) MarshalJSON() ([]byte, error) { - pb, err := updateCustomAppIntegrationToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type UpdateCustomAppIntegrationOutput struct { } -func (st *UpdateCustomAppIntegrationOutput) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateCustomAppIntegrationOutputPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateCustomAppIntegrationOutputFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateCustomAppIntegrationOutput) MarshalJSON() ([]byte, error) { - pb, err := updateCustomAppIntegrationOutputToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type UpdatePublishedAppIntegration struct { - IntegrationId string `json:"-" tf:"-"` + IntegrationId string `json:"-" url:"-"` // Token access policy to be updated in the published OAuth app integration - // Wire name: 'token_access_policy' TokenAccessPolicy *TokenAccessPolicy `json:"token_access_policy,omitempty"` } -func (st *UpdatePublishedAppIntegration) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updatePublishedAppIntegrationPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updatePublishedAppIntegrationFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdatePublishedAppIntegration) MarshalJSON() ([]byte, error) { - pb, err := updatePublishedAppIntegrationToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type UpdatePublishedAppIntegrationOutput struct { } -func (st *UpdatePublishedAppIntegrationOutput) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updatePublishedAppIntegrationOutputPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updatePublishedAppIntegrationOutputFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdatePublishedAppIntegrationOutput) MarshalJSON() ([]byte, error) { - pb, err := updatePublishedAppIntegrationOutputToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Update service principal federation policy type UpdateServicePrincipalFederationPolicyRequest struct { - - // Wire name: 'policy' Policy FederationPolicy `json:"policy"` // The identifier for the federation policy. - PolicyId string `json:"-" tf:"-"` + PolicyId string `json:"-" url:"-"` // The service principal id for the federation policy. - ServicePrincipalId int64 `json:"-" tf:"-"` + ServicePrincipalId int64 `json:"-" url:"-"` // The field mask specifies which fields of the policy to update. To specify // multiple fields in the field mask, use comma as the separator (no space). // The special value '*' indicates that all fields should be updated (full // replacement). If unspecified, all fields that are set in the policy // provided in the update request will overwrite the corresponding fields in // the existing policy. Example value: 'description,oidc_policy.audiences'. - UpdateMask string `json:"-" tf:"-"` - - ForceSendFields []string `json:"-" tf:"-"` -} - -func (st *UpdateServicePrincipalFederationPolicyRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateServicePrincipalFederationPolicyRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateServicePrincipalFederationPolicyRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateServicePrincipalFederationPolicyRequest) MarshalJSON() ([]byte, error) { - pb, err := updateServicePrincipalFederationPolicyRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + UpdateMask string `json:"-" url:"update_mask,omitempty"` + + ForceSendFields []string `json:"-" url:"-"` +} + +func (s *UpdateServicePrincipalFederationPolicyRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s UpdateServicePrincipalFederationPolicyRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } diff --git a/service/pipelines/impl.go b/service/pipelines/impl.go index 80d92bb43..b00bd9651 100755 --- a/service/pipelines/impl.go +++ b/service/pipelines/impl.go @@ -18,192 +18,64 @@ type pipelinesImpl struct { } func (a *pipelinesImpl) Create(ctx context.Context, request CreatePipeline) (*CreatePipelineResponse, error) { - - requestPb, pbErr := createPipelineToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var createPipelineResponsePb createPipelineResponsePb + var createPipelineResponse CreatePipelineResponse path := "/api/2.0/pipelines" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &createPipelineResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := createPipelineResponseFromPb(&createPipelineResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &createPipelineResponse) + return &createPipelineResponse, err } func (a *pipelinesImpl) Delete(ctx context.Context, request DeletePipelineRequest) error { - - requestPb, pbErr := deletePipelineRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deletePipelineResponsePb deletePipelineResponsePb - path := fmt.Sprintf("/api/2.0/pipelines/%v", requestPb.PipelineId) + var deletePipelineResponse DeletePipelineResponse + path := fmt.Sprintf("/api/2.0/pipelines/%v", request.PipelineId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deletePipelineResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deletePipelineResponse) return err } func (a *pipelinesImpl) Get(ctx context.Context, request GetPipelineRequest) (*GetPipelineResponse, error) { - - requestPb, pbErr := getPipelineRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var getPipelineResponsePb getPipelineResponsePb - path := fmt.Sprintf("/api/2.0/pipelines/%v", requestPb.PipelineId) + var getPipelineResponse GetPipelineResponse + path := fmt.Sprintf("/api/2.0/pipelines/%v", request.PipelineId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &getPipelineResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := getPipelineResponseFromPb(&getPipelineResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getPipelineResponse) + return &getPipelineResponse, err } func (a *pipelinesImpl) GetPermissionLevels(ctx context.Context, request GetPipelinePermissionLevelsRequest) (*GetPipelinePermissionLevelsResponse, error) { - - requestPb, pbErr := getPipelinePermissionLevelsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var getPipelinePermissionLevelsResponsePb getPipelinePermissionLevelsResponsePb - path := fmt.Sprintf("/api/2.0/permissions/pipelines/%v/permissionLevels", requestPb.PipelineId) + var getPipelinePermissionLevelsResponse GetPipelinePermissionLevelsResponse + path := fmt.Sprintf("/api/2.0/permissions/pipelines/%v/permissionLevels", request.PipelineId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &getPipelinePermissionLevelsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := getPipelinePermissionLevelsResponseFromPb(&getPipelinePermissionLevelsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getPipelinePermissionLevelsResponse) + return &getPipelinePermissionLevelsResponse, err } func (a *pipelinesImpl) GetPermissions(ctx context.Context, request GetPipelinePermissionsRequest) (*PipelinePermissions, error) { - - requestPb, pbErr := getPipelinePermissionsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var pipelinePermissionsPb pipelinePermissionsPb - path := fmt.Sprintf("/api/2.0/permissions/pipelines/%v", requestPb.PipelineId) + var pipelinePermissions PipelinePermissions + path := fmt.Sprintf("/api/2.0/permissions/pipelines/%v", request.PipelineId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &pipelinePermissionsPb, - ) - if err != nil { - return nil, err - } - resp, err := pipelinePermissionsFromPb(&pipelinePermissionsPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &pipelinePermissions) + return &pipelinePermissions, err } func (a *pipelinesImpl) GetUpdate(ctx context.Context, request GetUpdateRequest) (*GetUpdateResponse, error) { - - requestPb, pbErr := getUpdateRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var getUpdateResponsePb getUpdateResponsePb - path := fmt.Sprintf("/api/2.0/pipelines/%v/updates/%v", requestPb.PipelineId, requestPb.UpdateId) + var getUpdateResponse GetUpdateResponse + path := fmt.Sprintf("/api/2.0/pipelines/%v/updates/%v", request.PipelineId, request.UpdateId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &getUpdateResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := getUpdateResponseFromPb(&getUpdateResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getUpdateResponse) + return &getUpdateResponse, err } // Retrieves events for a pipeline. @@ -238,35 +110,13 @@ func (a *pipelinesImpl) ListPipelineEventsAll(ctx context.Context, request ListP } func (a *pipelinesImpl) internalListPipelineEvents(ctx context.Context, request ListPipelineEventsRequest) (*ListPipelineEventsResponse, error) { - - requestPb, pbErr := listPipelineEventsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listPipelineEventsResponsePb listPipelineEventsResponsePb - path := fmt.Sprintf("/api/2.0/pipelines/%v/events", requestPb.PipelineId) + var listPipelineEventsResponse ListPipelineEventsResponse + path := fmt.Sprintf("/api/2.0/pipelines/%v/events", request.PipelineId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listPipelineEventsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listPipelineEventsResponseFromPb(&listPipelineEventsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listPipelineEventsResponse) + return &listPipelineEventsResponse, err } // Lists pipelines defined in the Delta Live Tables system. @@ -301,221 +151,75 @@ func (a *pipelinesImpl) ListPipelinesAll(ctx context.Context, request ListPipeli } func (a *pipelinesImpl) internalListPipelines(ctx context.Context, request ListPipelinesRequest) (*ListPipelinesResponse, error) { - - requestPb, pbErr := listPipelinesRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listPipelinesResponsePb listPipelinesResponsePb + var listPipelinesResponse ListPipelinesResponse path := "/api/2.0/pipelines" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listPipelinesResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listPipelinesResponseFromPb(&listPipelinesResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listPipelinesResponse) + return &listPipelinesResponse, err } func (a *pipelinesImpl) ListUpdates(ctx context.Context, request ListUpdatesRequest) (*ListUpdatesResponse, error) { - - requestPb, pbErr := listUpdatesRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listUpdatesResponsePb listUpdatesResponsePb - path := fmt.Sprintf("/api/2.0/pipelines/%v/updates", requestPb.PipelineId) + var listUpdatesResponse ListUpdatesResponse + path := fmt.Sprintf("/api/2.0/pipelines/%v/updates", request.PipelineId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listUpdatesResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listUpdatesResponseFromPb(&listUpdatesResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listUpdatesResponse) + return &listUpdatesResponse, err } func (a *pipelinesImpl) SetPermissions(ctx context.Context, request PipelinePermissionsRequest) (*PipelinePermissions, error) { - - requestPb, pbErr := pipelinePermissionsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var pipelinePermissionsPb pipelinePermissionsPb - path := fmt.Sprintf("/api/2.0/permissions/pipelines/%v", requestPb.PipelineId) + var pipelinePermissions PipelinePermissions + path := fmt.Sprintf("/api/2.0/permissions/pipelines/%v", request.PipelineId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPut, - path, - headers, - queryParams, - (*requestPb), - &pipelinePermissionsPb, - ) - if err != nil { - return nil, err - } - resp, err := pipelinePermissionsFromPb(&pipelinePermissionsPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &pipelinePermissions) + return &pipelinePermissions, err } func (a *pipelinesImpl) StartUpdate(ctx context.Context, request StartUpdate) (*StartUpdateResponse, error) { - - requestPb, pbErr := startUpdateToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var startUpdateResponsePb startUpdateResponsePb - path := fmt.Sprintf("/api/2.0/pipelines/%v/updates", requestPb.PipelineId) + var startUpdateResponse StartUpdateResponse + path := fmt.Sprintf("/api/2.0/pipelines/%v/updates", request.PipelineId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &startUpdateResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := startUpdateResponseFromPb(&startUpdateResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &startUpdateResponse) + return &startUpdateResponse, err } func (a *pipelinesImpl) Stop(ctx context.Context, request StopRequest) error { - - requestPb, pbErr := stopRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var stopPipelineResponsePb stopPipelineResponsePb - path := fmt.Sprintf("/api/2.0/pipelines/%v/stop", requestPb.PipelineId) + var stopPipelineResponse StopPipelineResponse + path := fmt.Sprintf("/api/2.0/pipelines/%v/stop", request.PipelineId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - nil, - &stopPipelineResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, nil, &stopPipelineResponse) return err } func (a *pipelinesImpl) Update(ctx context.Context, request EditPipeline) error { - - requestPb, pbErr := editPipelineToPb(&request) - if pbErr != nil { - return pbErr - } - - var editPipelineResponsePb editPipelineResponsePb - path := fmt.Sprintf("/api/2.0/pipelines/%v", requestPb.PipelineId) + var editPipelineResponse EditPipelineResponse + path := fmt.Sprintf("/api/2.0/pipelines/%v", request.PipelineId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPut, - path, - headers, - queryParams, - (*requestPb), - &editPipelineResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &editPipelineResponse) return err } func (a *pipelinesImpl) UpdatePermissions(ctx context.Context, request PipelinePermissionsRequest) (*PipelinePermissions, error) { - - requestPb, pbErr := pipelinePermissionsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var pipelinePermissionsPb pipelinePermissionsPb - path := fmt.Sprintf("/api/2.0/permissions/pipelines/%v", requestPb.PipelineId) + var pipelinePermissions PipelinePermissions + path := fmt.Sprintf("/api/2.0/permissions/pipelines/%v", request.PipelineId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &pipelinePermissionsPb, - ) - if err != nil { - return nil, err - } - resp, err := pipelinePermissionsFromPb(&pipelinePermissionsPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &pipelinePermissions) + return &pipelinePermissions, err } diff --git a/service/pipelines/internal.go b/service/pipelines/internal.go deleted file mode 100755 index 50f3d26b4..000000000 --- a/service/pipelines/internal.go +++ /dev/null @@ -1,2832 +0,0 @@ -// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. - -package pipelines - -import ( - "fmt" - "strings" - "time" - - "github.com/databricks/databricks-sdk-go/marshal" - "github.com/databricks/databricks-sdk-go/service/compute" -) - -func createPipelineToPb(st *CreatePipeline) (*createPipelinePb, error) { - if st == nil { - return nil, nil - } - pb := &createPipelinePb{} - pb.AllowDuplicateNames = st.AllowDuplicateNames - pb.BudgetPolicyId = st.BudgetPolicyId - pb.Catalog = st.Catalog - pb.Channel = st.Channel - pb.Clusters = st.Clusters - pb.Configuration = st.Configuration - pb.Continuous = st.Continuous - pb.Deployment = st.Deployment - pb.Development = st.Development - pb.DryRun = st.DryRun - pb.Edition = st.Edition - pb.Environment = st.Environment - pb.EventLog = st.EventLog - pb.Filters = st.Filters - pb.GatewayDefinition = st.GatewayDefinition - pb.Id = st.Id - pb.IngestionDefinition = st.IngestionDefinition - pb.Libraries = st.Libraries - pb.Name = st.Name - pb.Notifications = st.Notifications - pb.Photon = st.Photon - pb.RestartWindow = st.RestartWindow - pb.RootPath = st.RootPath - pb.RunAs = st.RunAs - pb.Schema = st.Schema - pb.Serverless = st.Serverless - pb.Storage = st.Storage - pb.Tags = st.Tags - pb.Target = st.Target - pb.Trigger = st.Trigger - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createPipelinePb struct { - AllowDuplicateNames bool `json:"allow_duplicate_names,omitempty"` - BudgetPolicyId string `json:"budget_policy_id,omitempty"` - Catalog string `json:"catalog,omitempty"` - Channel string `json:"channel,omitempty"` - Clusters []PipelineCluster `json:"clusters,omitempty"` - Configuration map[string]string `json:"configuration,omitempty"` - Continuous bool `json:"continuous,omitempty"` - Deployment *PipelineDeployment `json:"deployment,omitempty"` - Development bool `json:"development,omitempty"` - DryRun bool `json:"dry_run,omitempty"` - Edition string `json:"edition,omitempty"` - Environment *PipelinesEnvironment `json:"environment,omitempty"` - EventLog *EventLogSpec `json:"event_log,omitempty"` - Filters *Filters `json:"filters,omitempty"` - GatewayDefinition *IngestionGatewayPipelineDefinition `json:"gateway_definition,omitempty"` - Id string `json:"id,omitempty"` - IngestionDefinition *IngestionPipelineDefinition `json:"ingestion_definition,omitempty"` - Libraries []PipelineLibrary `json:"libraries,omitempty"` - Name string `json:"name,omitempty"` - Notifications []Notifications `json:"notifications,omitempty"` - Photon bool `json:"photon,omitempty"` - RestartWindow *RestartWindow `json:"restart_window,omitempty"` - RootPath string `json:"root_path,omitempty"` - RunAs *RunAs `json:"run_as,omitempty"` - Schema string `json:"schema,omitempty"` - Serverless bool `json:"serverless,omitempty"` - Storage string `json:"storage,omitempty"` - Tags map[string]string `json:"tags,omitempty"` - Target string `json:"target,omitempty"` - Trigger *PipelineTrigger `json:"trigger,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createPipelineFromPb(pb *createPipelinePb) (*CreatePipeline, error) { - if pb == nil { - return nil, nil - } - st := &CreatePipeline{} - st.AllowDuplicateNames = pb.AllowDuplicateNames - st.BudgetPolicyId = pb.BudgetPolicyId - st.Catalog = pb.Catalog - st.Channel = pb.Channel - st.Clusters = pb.Clusters - st.Configuration = pb.Configuration - st.Continuous = pb.Continuous - st.Deployment = pb.Deployment - st.Development = pb.Development - st.DryRun = pb.DryRun - st.Edition = pb.Edition - st.Environment = pb.Environment - st.EventLog = pb.EventLog - st.Filters = pb.Filters - st.GatewayDefinition = pb.GatewayDefinition - st.Id = pb.Id - st.IngestionDefinition = pb.IngestionDefinition - st.Libraries = pb.Libraries - st.Name = pb.Name - st.Notifications = pb.Notifications - st.Photon = pb.Photon - st.RestartWindow = pb.RestartWindow - st.RootPath = pb.RootPath - st.RunAs = pb.RunAs - st.Schema = pb.Schema - st.Serverless = pb.Serverless - st.Storage = pb.Storage - st.Tags = pb.Tags - st.Target = pb.Target - st.Trigger = pb.Trigger - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createPipelinePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createPipelinePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createPipelineResponseToPb(st *CreatePipelineResponse) (*createPipelineResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &createPipelineResponsePb{} - pb.EffectiveSettings = st.EffectiveSettings - pb.PipelineId = st.PipelineId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createPipelineResponsePb struct { - EffectiveSettings *PipelineSpec `json:"effective_settings,omitempty"` - PipelineId string `json:"pipeline_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createPipelineResponseFromPb(pb *createPipelineResponsePb) (*CreatePipelineResponse, error) { - if pb == nil { - return nil, nil - } - st := &CreatePipelineResponse{} - st.EffectiveSettings = pb.EffectiveSettings - st.PipelineId = pb.PipelineId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createPipelineResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createPipelineResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func cronTriggerToPb(st *CronTrigger) (*cronTriggerPb, error) { - if st == nil { - return nil, nil - } - pb := &cronTriggerPb{} - pb.QuartzCronSchedule = st.QuartzCronSchedule - pb.TimezoneId = st.TimezoneId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type cronTriggerPb struct { - QuartzCronSchedule string `json:"quartz_cron_schedule,omitempty"` - TimezoneId string `json:"timezone_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func cronTriggerFromPb(pb *cronTriggerPb) (*CronTrigger, error) { - if pb == nil { - return nil, nil - } - st := &CronTrigger{} - st.QuartzCronSchedule = pb.QuartzCronSchedule - st.TimezoneId = pb.TimezoneId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *cronTriggerPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st cronTriggerPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func dataPlaneIdToPb(st *DataPlaneId) (*dataPlaneIdPb, error) { - if st == nil { - return nil, nil - } - pb := &dataPlaneIdPb{} - pb.Instance = st.Instance - pb.SeqNo = st.SeqNo - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type dataPlaneIdPb struct { - Instance string `json:"instance,omitempty"` - SeqNo int64 `json:"seq_no,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func dataPlaneIdFromPb(pb *dataPlaneIdPb) (*DataPlaneId, error) { - if pb == nil { - return nil, nil - } - st := &DataPlaneId{} - st.Instance = pb.Instance - st.SeqNo = pb.SeqNo - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *dataPlaneIdPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st dataPlaneIdPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func deletePipelineRequestToPb(st *DeletePipelineRequest) (*deletePipelineRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deletePipelineRequestPb{} - pb.PipelineId = st.PipelineId - - return pb, nil -} - -type deletePipelineRequestPb struct { - PipelineId string `json:"-" url:"-"` -} - -func deletePipelineRequestFromPb(pb *deletePipelineRequestPb) (*DeletePipelineRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeletePipelineRequest{} - st.PipelineId = pb.PipelineId - - return st, nil -} - -func deletePipelineResponseToPb(st *DeletePipelineResponse) (*deletePipelineResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deletePipelineResponsePb{} - - return pb, nil -} - -type deletePipelineResponsePb struct { -} - -func deletePipelineResponseFromPb(pb *deletePipelineResponsePb) (*DeletePipelineResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeletePipelineResponse{} - - return st, nil -} - -func editPipelineToPb(st *EditPipeline) (*editPipelinePb, error) { - if st == nil { - return nil, nil - } - pb := &editPipelinePb{} - pb.AllowDuplicateNames = st.AllowDuplicateNames - pb.BudgetPolicyId = st.BudgetPolicyId - pb.Catalog = st.Catalog - pb.Channel = st.Channel - pb.Clusters = st.Clusters - pb.Configuration = st.Configuration - pb.Continuous = st.Continuous - pb.Deployment = st.Deployment - pb.Development = st.Development - pb.Edition = st.Edition - pb.Environment = st.Environment - pb.EventLog = st.EventLog - pb.ExpectedLastModified = st.ExpectedLastModified - pb.Filters = st.Filters - pb.GatewayDefinition = st.GatewayDefinition - pb.Id = st.Id - pb.IngestionDefinition = st.IngestionDefinition - pb.Libraries = st.Libraries - pb.Name = st.Name - pb.Notifications = st.Notifications - pb.Photon = st.Photon - pb.PipelineId = st.PipelineId - pb.RestartWindow = st.RestartWindow - pb.RootPath = st.RootPath - pb.RunAs = st.RunAs - pb.Schema = st.Schema - pb.Serverless = st.Serverless - pb.Storage = st.Storage - pb.Tags = st.Tags - pb.Target = st.Target - pb.Trigger = st.Trigger - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type editPipelinePb struct { - AllowDuplicateNames bool `json:"allow_duplicate_names,omitempty"` - BudgetPolicyId string `json:"budget_policy_id,omitempty"` - Catalog string `json:"catalog,omitempty"` - Channel string `json:"channel,omitempty"` - Clusters []PipelineCluster `json:"clusters,omitempty"` - Configuration map[string]string `json:"configuration,omitempty"` - Continuous bool `json:"continuous,omitempty"` - Deployment *PipelineDeployment `json:"deployment,omitempty"` - Development bool `json:"development,omitempty"` - Edition string `json:"edition,omitempty"` - Environment *PipelinesEnvironment `json:"environment,omitempty"` - EventLog *EventLogSpec `json:"event_log,omitempty"` - ExpectedLastModified int64 `json:"expected_last_modified,omitempty"` - Filters *Filters `json:"filters,omitempty"` - GatewayDefinition *IngestionGatewayPipelineDefinition `json:"gateway_definition,omitempty"` - Id string `json:"id,omitempty"` - IngestionDefinition *IngestionPipelineDefinition `json:"ingestion_definition,omitempty"` - Libraries []PipelineLibrary `json:"libraries,omitempty"` - Name string `json:"name,omitempty"` - Notifications []Notifications `json:"notifications,omitempty"` - Photon bool `json:"photon,omitempty"` - PipelineId string `json:"-" url:"-"` - RestartWindow *RestartWindow `json:"restart_window,omitempty"` - RootPath string `json:"root_path,omitempty"` - RunAs *RunAs `json:"run_as,omitempty"` - Schema string `json:"schema,omitempty"` - Serverless bool `json:"serverless,omitempty"` - Storage string `json:"storage,omitempty"` - Tags map[string]string `json:"tags,omitempty"` - Target string `json:"target,omitempty"` - Trigger *PipelineTrigger `json:"trigger,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func editPipelineFromPb(pb *editPipelinePb) (*EditPipeline, error) { - if pb == nil { - return nil, nil - } - st := &EditPipeline{} - st.AllowDuplicateNames = pb.AllowDuplicateNames - st.BudgetPolicyId = pb.BudgetPolicyId - st.Catalog = pb.Catalog - st.Channel = pb.Channel - st.Clusters = pb.Clusters - st.Configuration = pb.Configuration - st.Continuous = pb.Continuous - st.Deployment = pb.Deployment - st.Development = pb.Development - st.Edition = pb.Edition - st.Environment = pb.Environment - st.EventLog = pb.EventLog - st.ExpectedLastModified = pb.ExpectedLastModified - st.Filters = pb.Filters - st.GatewayDefinition = pb.GatewayDefinition - st.Id = pb.Id - st.IngestionDefinition = pb.IngestionDefinition - st.Libraries = pb.Libraries - st.Name = pb.Name - st.Notifications = pb.Notifications - st.Photon = pb.Photon - st.PipelineId = pb.PipelineId - st.RestartWindow = pb.RestartWindow - st.RootPath = pb.RootPath - st.RunAs = pb.RunAs - st.Schema = pb.Schema - st.Serverless = pb.Serverless - st.Storage = pb.Storage - st.Tags = pb.Tags - st.Target = pb.Target - st.Trigger = pb.Trigger - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *editPipelinePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st editPipelinePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func editPipelineResponseToPb(st *EditPipelineResponse) (*editPipelineResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &editPipelineResponsePb{} - - return pb, nil -} - -type editPipelineResponsePb struct { -} - -func editPipelineResponseFromPb(pb *editPipelineResponsePb) (*EditPipelineResponse, error) { - if pb == nil { - return nil, nil - } - st := &EditPipelineResponse{} - - return st, nil -} - -func errorDetailToPb(st *ErrorDetail) (*errorDetailPb, error) { - if st == nil { - return nil, nil - } - pb := &errorDetailPb{} - pb.Exceptions = st.Exceptions - pb.Fatal = st.Fatal - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type errorDetailPb struct { - Exceptions []SerializedException `json:"exceptions,omitempty"` - Fatal bool `json:"fatal,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func errorDetailFromPb(pb *errorDetailPb) (*ErrorDetail, error) { - if pb == nil { - return nil, nil - } - st := &ErrorDetail{} - st.Exceptions = pb.Exceptions - st.Fatal = pb.Fatal - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *errorDetailPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st errorDetailPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func eventLogSpecToPb(st *EventLogSpec) (*eventLogSpecPb, error) { - if st == nil { - return nil, nil - } - pb := &eventLogSpecPb{} - pb.Catalog = st.Catalog - pb.Name = st.Name - pb.Schema = st.Schema - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type eventLogSpecPb struct { - Catalog string `json:"catalog,omitempty"` - Name string `json:"name,omitempty"` - Schema string `json:"schema,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func eventLogSpecFromPb(pb *eventLogSpecPb) (*EventLogSpec, error) { - if pb == nil { - return nil, nil - } - st := &EventLogSpec{} - st.Catalog = pb.Catalog - st.Name = pb.Name - st.Schema = pb.Schema - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *eventLogSpecPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st eventLogSpecPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func fileLibraryToPb(st *FileLibrary) (*fileLibraryPb, error) { - if st == nil { - return nil, nil - } - pb := &fileLibraryPb{} - pb.Path = st.Path - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type fileLibraryPb struct { - Path string `json:"path,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func fileLibraryFromPb(pb *fileLibraryPb) (*FileLibrary, error) { - if pb == nil { - return nil, nil - } - st := &FileLibrary{} - st.Path = pb.Path - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *fileLibraryPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st fileLibraryPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func filtersToPb(st *Filters) (*filtersPb, error) { - if st == nil { - return nil, nil - } - pb := &filtersPb{} - pb.Exclude = st.Exclude - pb.Include = st.Include - - return pb, nil -} - -type filtersPb struct { - Exclude []string `json:"exclude,omitempty"` - Include []string `json:"include,omitempty"` -} - -func filtersFromPb(pb *filtersPb) (*Filters, error) { - if pb == nil { - return nil, nil - } - st := &Filters{} - st.Exclude = pb.Exclude - st.Include = pb.Include - - return st, nil -} - -func getPipelinePermissionLevelsRequestToPb(st *GetPipelinePermissionLevelsRequest) (*getPipelinePermissionLevelsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getPipelinePermissionLevelsRequestPb{} - pb.PipelineId = st.PipelineId - - return pb, nil -} - -type getPipelinePermissionLevelsRequestPb struct { - PipelineId string `json:"-" url:"-"` -} - -func getPipelinePermissionLevelsRequestFromPb(pb *getPipelinePermissionLevelsRequestPb) (*GetPipelinePermissionLevelsRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetPipelinePermissionLevelsRequest{} - st.PipelineId = pb.PipelineId - - return st, nil -} - -func getPipelinePermissionLevelsResponseToPb(st *GetPipelinePermissionLevelsResponse) (*getPipelinePermissionLevelsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &getPipelinePermissionLevelsResponsePb{} - pb.PermissionLevels = st.PermissionLevels - - return pb, nil -} - -type getPipelinePermissionLevelsResponsePb struct { - PermissionLevels []PipelinePermissionsDescription `json:"permission_levels,omitempty"` -} - -func getPipelinePermissionLevelsResponseFromPb(pb *getPipelinePermissionLevelsResponsePb) (*GetPipelinePermissionLevelsResponse, error) { - if pb == nil { - return nil, nil - } - st := &GetPipelinePermissionLevelsResponse{} - st.PermissionLevels = pb.PermissionLevels - - return st, nil -} - -func getPipelinePermissionsRequestToPb(st *GetPipelinePermissionsRequest) (*getPipelinePermissionsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getPipelinePermissionsRequestPb{} - pb.PipelineId = st.PipelineId - - return pb, nil -} - -type getPipelinePermissionsRequestPb struct { - PipelineId string `json:"-" url:"-"` -} - -func getPipelinePermissionsRequestFromPb(pb *getPipelinePermissionsRequestPb) (*GetPipelinePermissionsRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetPipelinePermissionsRequest{} - st.PipelineId = pb.PipelineId - - return st, nil -} - -func getPipelineRequestToPb(st *GetPipelineRequest) (*getPipelineRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getPipelineRequestPb{} - pb.PipelineId = st.PipelineId - - return pb, nil -} - -type getPipelineRequestPb struct { - PipelineId string `json:"-" url:"-"` -} - -func getPipelineRequestFromPb(pb *getPipelineRequestPb) (*GetPipelineRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetPipelineRequest{} - st.PipelineId = pb.PipelineId - - return st, nil -} - -func getPipelineResponseToPb(st *GetPipelineResponse) (*getPipelineResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &getPipelineResponsePb{} - pb.Cause = st.Cause - pb.ClusterId = st.ClusterId - pb.CreatorUserName = st.CreatorUserName - pb.EffectiveBudgetPolicyId = st.EffectiveBudgetPolicyId - pb.Health = st.Health - pb.LastModified = st.LastModified - pb.LatestUpdates = st.LatestUpdates - pb.Name = st.Name - pb.PipelineId = st.PipelineId - pb.RunAsUserName = st.RunAsUserName - pb.Spec = st.Spec - pb.State = st.State - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getPipelineResponsePb struct { - Cause string `json:"cause,omitempty"` - ClusterId string `json:"cluster_id,omitempty"` - CreatorUserName string `json:"creator_user_name,omitempty"` - EffectiveBudgetPolicyId string `json:"effective_budget_policy_id,omitempty"` - Health GetPipelineResponseHealth `json:"health,omitempty"` - LastModified int64 `json:"last_modified,omitempty"` - LatestUpdates []UpdateStateInfo `json:"latest_updates,omitempty"` - Name string `json:"name,omitempty"` - PipelineId string `json:"pipeline_id,omitempty"` - RunAsUserName string `json:"run_as_user_name,omitempty"` - Spec *PipelineSpec `json:"spec,omitempty"` - State PipelineState `json:"state,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getPipelineResponseFromPb(pb *getPipelineResponsePb) (*GetPipelineResponse, error) { - if pb == nil { - return nil, nil - } - st := &GetPipelineResponse{} - st.Cause = pb.Cause - st.ClusterId = pb.ClusterId - st.CreatorUserName = pb.CreatorUserName - st.EffectiveBudgetPolicyId = pb.EffectiveBudgetPolicyId - st.Health = pb.Health - st.LastModified = pb.LastModified - st.LatestUpdates = pb.LatestUpdates - st.Name = pb.Name - st.PipelineId = pb.PipelineId - st.RunAsUserName = pb.RunAsUserName - st.Spec = pb.Spec - st.State = pb.State - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getPipelineResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getPipelineResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getUpdateRequestToPb(st *GetUpdateRequest) (*getUpdateRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getUpdateRequestPb{} - pb.PipelineId = st.PipelineId - pb.UpdateId = st.UpdateId - - return pb, nil -} - -type getUpdateRequestPb struct { - PipelineId string `json:"-" url:"-"` - UpdateId string `json:"-" url:"-"` -} - -func getUpdateRequestFromPb(pb *getUpdateRequestPb) (*GetUpdateRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetUpdateRequest{} - st.PipelineId = pb.PipelineId - st.UpdateId = pb.UpdateId - - return st, nil -} - -func getUpdateResponseToPb(st *GetUpdateResponse) (*getUpdateResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &getUpdateResponsePb{} - pb.Update = st.Update - - return pb, nil -} - -type getUpdateResponsePb struct { - Update *UpdateInfo `json:"update,omitempty"` -} - -func getUpdateResponseFromPb(pb *getUpdateResponsePb) (*GetUpdateResponse, error) { - if pb == nil { - return nil, nil - } - st := &GetUpdateResponse{} - st.Update = pb.Update - - return st, nil -} - -func ingestionConfigToPb(st *IngestionConfig) (*ingestionConfigPb, error) { - if st == nil { - return nil, nil - } - pb := &ingestionConfigPb{} - pb.Report = st.Report - pb.Schema = st.Schema - pb.Table = st.Table - - return pb, nil -} - -type ingestionConfigPb struct { - Report *ReportSpec `json:"report,omitempty"` - Schema *SchemaSpec `json:"schema,omitempty"` - Table *TableSpec `json:"table,omitempty"` -} - -func ingestionConfigFromPb(pb *ingestionConfigPb) (*IngestionConfig, error) { - if pb == nil { - return nil, nil - } - st := &IngestionConfig{} - st.Report = pb.Report - st.Schema = pb.Schema - st.Table = pb.Table - - return st, nil -} - -func ingestionGatewayPipelineDefinitionToPb(st *IngestionGatewayPipelineDefinition) (*ingestionGatewayPipelineDefinitionPb, error) { - if st == nil { - return nil, nil - } - pb := &ingestionGatewayPipelineDefinitionPb{} - pb.ConnectionId = st.ConnectionId - pb.ConnectionName = st.ConnectionName - pb.GatewayStorageCatalog = st.GatewayStorageCatalog - pb.GatewayStorageName = st.GatewayStorageName - pb.GatewayStorageSchema = st.GatewayStorageSchema - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type ingestionGatewayPipelineDefinitionPb struct { - ConnectionId string `json:"connection_id,omitempty"` - ConnectionName string `json:"connection_name"` - GatewayStorageCatalog string `json:"gateway_storage_catalog"` - GatewayStorageName string `json:"gateway_storage_name,omitempty"` - GatewayStorageSchema string `json:"gateway_storage_schema"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func ingestionGatewayPipelineDefinitionFromPb(pb *ingestionGatewayPipelineDefinitionPb) (*IngestionGatewayPipelineDefinition, error) { - if pb == nil { - return nil, nil - } - st := &IngestionGatewayPipelineDefinition{} - st.ConnectionId = pb.ConnectionId - st.ConnectionName = pb.ConnectionName - st.GatewayStorageCatalog = pb.GatewayStorageCatalog - st.GatewayStorageName = pb.GatewayStorageName - st.GatewayStorageSchema = pb.GatewayStorageSchema - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *ingestionGatewayPipelineDefinitionPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st ingestionGatewayPipelineDefinitionPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func ingestionPipelineDefinitionToPb(st *IngestionPipelineDefinition) (*ingestionPipelineDefinitionPb, error) { - if st == nil { - return nil, nil - } - pb := &ingestionPipelineDefinitionPb{} - pb.ConnectionName = st.ConnectionName - pb.IngestionGatewayId = st.IngestionGatewayId - pb.Objects = st.Objects - pb.SourceType = st.SourceType - pb.TableConfiguration = st.TableConfiguration - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type ingestionPipelineDefinitionPb struct { - ConnectionName string `json:"connection_name,omitempty"` - IngestionGatewayId string `json:"ingestion_gateway_id,omitempty"` - Objects []IngestionConfig `json:"objects,omitempty"` - SourceType IngestionSourceType `json:"source_type,omitempty"` - TableConfiguration *TableSpecificConfig `json:"table_configuration,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func ingestionPipelineDefinitionFromPb(pb *ingestionPipelineDefinitionPb) (*IngestionPipelineDefinition, error) { - if pb == nil { - return nil, nil - } - st := &IngestionPipelineDefinition{} - st.ConnectionName = pb.ConnectionName - st.IngestionGatewayId = pb.IngestionGatewayId - st.Objects = pb.Objects - st.SourceType = pb.SourceType - st.TableConfiguration = pb.TableConfiguration - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *ingestionPipelineDefinitionPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st ingestionPipelineDefinitionPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listPipelineEventsRequestToPb(st *ListPipelineEventsRequest) (*listPipelineEventsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listPipelineEventsRequestPb{} - pb.Filter = st.Filter - pb.MaxResults = st.MaxResults - pb.OrderBy = st.OrderBy - pb.PageToken = st.PageToken - pb.PipelineId = st.PipelineId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listPipelineEventsRequestPb struct { - Filter string `json:"-" url:"filter,omitempty"` - MaxResults int `json:"-" url:"max_results,omitempty"` - OrderBy []string `json:"-" url:"order_by,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - PipelineId string `json:"-" url:"-"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listPipelineEventsRequestFromPb(pb *listPipelineEventsRequestPb) (*ListPipelineEventsRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListPipelineEventsRequest{} - st.Filter = pb.Filter - st.MaxResults = pb.MaxResults - st.OrderBy = pb.OrderBy - st.PageToken = pb.PageToken - st.PipelineId = pb.PipelineId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listPipelineEventsRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listPipelineEventsRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listPipelineEventsResponseToPb(st *ListPipelineEventsResponse) (*listPipelineEventsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listPipelineEventsResponsePb{} - pb.Events = st.Events - pb.NextPageToken = st.NextPageToken - pb.PrevPageToken = st.PrevPageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listPipelineEventsResponsePb struct { - Events []PipelineEvent `json:"events,omitempty"` - NextPageToken string `json:"next_page_token,omitempty"` - PrevPageToken string `json:"prev_page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listPipelineEventsResponseFromPb(pb *listPipelineEventsResponsePb) (*ListPipelineEventsResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListPipelineEventsResponse{} - st.Events = pb.Events - st.NextPageToken = pb.NextPageToken - st.PrevPageToken = pb.PrevPageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listPipelineEventsResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listPipelineEventsResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listPipelinesRequestToPb(st *ListPipelinesRequest) (*listPipelinesRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listPipelinesRequestPb{} - pb.Filter = st.Filter - pb.MaxResults = st.MaxResults - pb.OrderBy = st.OrderBy - pb.PageToken = st.PageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listPipelinesRequestPb struct { - Filter string `json:"-" url:"filter,omitempty"` - MaxResults int `json:"-" url:"max_results,omitempty"` - OrderBy []string `json:"-" url:"order_by,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listPipelinesRequestFromPb(pb *listPipelinesRequestPb) (*ListPipelinesRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListPipelinesRequest{} - st.Filter = pb.Filter - st.MaxResults = pb.MaxResults - st.OrderBy = pb.OrderBy - st.PageToken = pb.PageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listPipelinesRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listPipelinesRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listPipelinesResponseToPb(st *ListPipelinesResponse) (*listPipelinesResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listPipelinesResponsePb{} - pb.NextPageToken = st.NextPageToken - pb.Statuses = st.Statuses - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listPipelinesResponsePb struct { - NextPageToken string `json:"next_page_token,omitempty"` - Statuses []PipelineStateInfo `json:"statuses,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listPipelinesResponseFromPb(pb *listPipelinesResponsePb) (*ListPipelinesResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListPipelinesResponse{} - st.NextPageToken = pb.NextPageToken - st.Statuses = pb.Statuses - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listPipelinesResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listPipelinesResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listUpdatesRequestToPb(st *ListUpdatesRequest) (*listUpdatesRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listUpdatesRequestPb{} - pb.MaxResults = st.MaxResults - pb.PageToken = st.PageToken - pb.PipelineId = st.PipelineId - pb.UntilUpdateId = st.UntilUpdateId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listUpdatesRequestPb struct { - MaxResults int `json:"-" url:"max_results,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - PipelineId string `json:"-" url:"-"` - UntilUpdateId string `json:"-" url:"until_update_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listUpdatesRequestFromPb(pb *listUpdatesRequestPb) (*ListUpdatesRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListUpdatesRequest{} - st.MaxResults = pb.MaxResults - st.PageToken = pb.PageToken - st.PipelineId = pb.PipelineId - st.UntilUpdateId = pb.UntilUpdateId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listUpdatesRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listUpdatesRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listUpdatesResponseToPb(st *ListUpdatesResponse) (*listUpdatesResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listUpdatesResponsePb{} - pb.NextPageToken = st.NextPageToken - pb.PrevPageToken = st.PrevPageToken - pb.Updates = st.Updates - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listUpdatesResponsePb struct { - NextPageToken string `json:"next_page_token,omitempty"` - PrevPageToken string `json:"prev_page_token,omitempty"` - Updates []UpdateInfo `json:"updates,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listUpdatesResponseFromPb(pb *listUpdatesResponsePb) (*ListUpdatesResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListUpdatesResponse{} - st.NextPageToken = pb.NextPageToken - st.PrevPageToken = pb.PrevPageToken - st.Updates = pb.Updates - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listUpdatesResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listUpdatesResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func manualTriggerToPb(st *ManualTrigger) (*manualTriggerPb, error) { - if st == nil { - return nil, nil - } - pb := &manualTriggerPb{} - - return pb, nil -} - -type manualTriggerPb struct { -} - -func manualTriggerFromPb(pb *manualTriggerPb) (*ManualTrigger, error) { - if pb == nil { - return nil, nil - } - st := &ManualTrigger{} - - return st, nil -} - -func notebookLibraryToPb(st *NotebookLibrary) (*notebookLibraryPb, error) { - if st == nil { - return nil, nil - } - pb := ¬ebookLibraryPb{} - pb.Path = st.Path - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type notebookLibraryPb struct { - Path string `json:"path,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func notebookLibraryFromPb(pb *notebookLibraryPb) (*NotebookLibrary, error) { - if pb == nil { - return nil, nil - } - st := &NotebookLibrary{} - st.Path = pb.Path - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *notebookLibraryPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st notebookLibraryPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func notificationsToPb(st *Notifications) (*notificationsPb, error) { - if st == nil { - return nil, nil - } - pb := ¬ificationsPb{} - pb.Alerts = st.Alerts - pb.EmailRecipients = st.EmailRecipients - - return pb, nil -} - -type notificationsPb struct { - Alerts []string `json:"alerts,omitempty"` - EmailRecipients []string `json:"email_recipients,omitempty"` -} - -func notificationsFromPb(pb *notificationsPb) (*Notifications, error) { - if pb == nil { - return nil, nil - } - st := &Notifications{} - st.Alerts = pb.Alerts - st.EmailRecipients = pb.EmailRecipients - - return st, nil -} - -func originToPb(st *Origin) (*originPb, error) { - if st == nil { - return nil, nil - } - pb := &originPb{} - pb.BatchId = st.BatchId - pb.Cloud = st.Cloud - pb.ClusterId = st.ClusterId - pb.DatasetName = st.DatasetName - pb.FlowId = st.FlowId - pb.FlowName = st.FlowName - pb.Host = st.Host - pb.MaintenanceId = st.MaintenanceId - pb.MaterializationName = st.MaterializationName - pb.OrgId = st.OrgId - pb.PipelineId = st.PipelineId - pb.PipelineName = st.PipelineName - pb.Region = st.Region - pb.RequestId = st.RequestId - pb.TableId = st.TableId - pb.UcResourceId = st.UcResourceId - pb.UpdateId = st.UpdateId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type originPb struct { - BatchId int64 `json:"batch_id,omitempty"` - Cloud string `json:"cloud,omitempty"` - ClusterId string `json:"cluster_id,omitempty"` - DatasetName string `json:"dataset_name,omitempty"` - FlowId string `json:"flow_id,omitempty"` - FlowName string `json:"flow_name,omitempty"` - Host string `json:"host,omitempty"` - MaintenanceId string `json:"maintenance_id,omitempty"` - MaterializationName string `json:"materialization_name,omitempty"` - OrgId int64 `json:"org_id,omitempty"` - PipelineId string `json:"pipeline_id,omitempty"` - PipelineName string `json:"pipeline_name,omitempty"` - Region string `json:"region,omitempty"` - RequestId string `json:"request_id,omitempty"` - TableId string `json:"table_id,omitempty"` - UcResourceId string `json:"uc_resource_id,omitempty"` - UpdateId string `json:"update_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func originFromPb(pb *originPb) (*Origin, error) { - if pb == nil { - return nil, nil - } - st := &Origin{} - st.BatchId = pb.BatchId - st.Cloud = pb.Cloud - st.ClusterId = pb.ClusterId - st.DatasetName = pb.DatasetName - st.FlowId = pb.FlowId - st.FlowName = pb.FlowName - st.Host = pb.Host - st.MaintenanceId = pb.MaintenanceId - st.MaterializationName = pb.MaterializationName - st.OrgId = pb.OrgId - st.PipelineId = pb.PipelineId - st.PipelineName = pb.PipelineName - st.Region = pb.Region - st.RequestId = pb.RequestId - st.TableId = pb.TableId - st.UcResourceId = pb.UcResourceId - st.UpdateId = pb.UpdateId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *originPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st originPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func pathPatternToPb(st *PathPattern) (*pathPatternPb, error) { - if st == nil { - return nil, nil - } - pb := &pathPatternPb{} - pb.Include = st.Include - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type pathPatternPb struct { - Include string `json:"include,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func pathPatternFromPb(pb *pathPatternPb) (*PathPattern, error) { - if pb == nil { - return nil, nil - } - st := &PathPattern{} - st.Include = pb.Include - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *pathPatternPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st pathPatternPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func pipelineAccessControlRequestToPb(st *PipelineAccessControlRequest) (*pipelineAccessControlRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &pipelineAccessControlRequestPb{} - pb.GroupName = st.GroupName - pb.PermissionLevel = st.PermissionLevel - pb.ServicePrincipalName = st.ServicePrincipalName - pb.UserName = st.UserName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type pipelineAccessControlRequestPb struct { - GroupName string `json:"group_name,omitempty"` - PermissionLevel PipelinePermissionLevel `json:"permission_level,omitempty"` - ServicePrincipalName string `json:"service_principal_name,omitempty"` - UserName string `json:"user_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func pipelineAccessControlRequestFromPb(pb *pipelineAccessControlRequestPb) (*PipelineAccessControlRequest, error) { - if pb == nil { - return nil, nil - } - st := &PipelineAccessControlRequest{} - st.GroupName = pb.GroupName - st.PermissionLevel = pb.PermissionLevel - st.ServicePrincipalName = pb.ServicePrincipalName - st.UserName = pb.UserName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *pipelineAccessControlRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st pipelineAccessControlRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func pipelineAccessControlResponseToPb(st *PipelineAccessControlResponse) (*pipelineAccessControlResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &pipelineAccessControlResponsePb{} - pb.AllPermissions = st.AllPermissions - pb.DisplayName = st.DisplayName - pb.GroupName = st.GroupName - pb.ServicePrincipalName = st.ServicePrincipalName - pb.UserName = st.UserName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type pipelineAccessControlResponsePb struct { - AllPermissions []PipelinePermission `json:"all_permissions,omitempty"` - DisplayName string `json:"display_name,omitempty"` - GroupName string `json:"group_name,omitempty"` - ServicePrincipalName string `json:"service_principal_name,omitempty"` - UserName string `json:"user_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func pipelineAccessControlResponseFromPb(pb *pipelineAccessControlResponsePb) (*PipelineAccessControlResponse, error) { - if pb == nil { - return nil, nil - } - st := &PipelineAccessControlResponse{} - st.AllPermissions = pb.AllPermissions - st.DisplayName = pb.DisplayName - st.GroupName = pb.GroupName - st.ServicePrincipalName = pb.ServicePrincipalName - st.UserName = pb.UserName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *pipelineAccessControlResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st pipelineAccessControlResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func pipelineClusterToPb(st *PipelineCluster) (*pipelineClusterPb, error) { - if st == nil { - return nil, nil - } - pb := &pipelineClusterPb{} - pb.ApplyPolicyDefaultValues = st.ApplyPolicyDefaultValues - pb.Autoscale = st.Autoscale - pb.AwsAttributes = st.AwsAttributes - pb.AzureAttributes = st.AzureAttributes - pb.ClusterLogConf = st.ClusterLogConf - pb.CustomTags = st.CustomTags - pb.DriverInstancePoolId = st.DriverInstancePoolId - pb.DriverNodeTypeId = st.DriverNodeTypeId - pb.EnableLocalDiskEncryption = st.EnableLocalDiskEncryption - pb.GcpAttributes = st.GcpAttributes - pb.InitScripts = st.InitScripts - pb.InstancePoolId = st.InstancePoolId - pb.Label = st.Label - pb.NodeTypeId = st.NodeTypeId - pb.NumWorkers = st.NumWorkers - pb.PolicyId = st.PolicyId - pb.SparkConf = st.SparkConf - pb.SparkEnvVars = st.SparkEnvVars - pb.SshPublicKeys = st.SshPublicKeys - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type pipelineClusterPb struct { - ApplyPolicyDefaultValues bool `json:"apply_policy_default_values,omitempty"` - Autoscale *PipelineClusterAutoscale `json:"autoscale,omitempty"` - AwsAttributes *compute.AwsAttributes `json:"aws_attributes,omitempty"` - AzureAttributes *compute.AzureAttributes `json:"azure_attributes,omitempty"` - ClusterLogConf *compute.ClusterLogConf `json:"cluster_log_conf,omitempty"` - CustomTags map[string]string `json:"custom_tags,omitempty"` - DriverInstancePoolId string `json:"driver_instance_pool_id,omitempty"` - DriverNodeTypeId string `json:"driver_node_type_id,omitempty"` - EnableLocalDiskEncryption bool `json:"enable_local_disk_encryption,omitempty"` - GcpAttributes *compute.GcpAttributes `json:"gcp_attributes,omitempty"` - InitScripts []compute.InitScriptInfo `json:"init_scripts,omitempty"` - InstancePoolId string `json:"instance_pool_id,omitempty"` - Label string `json:"label,omitempty"` - NodeTypeId string `json:"node_type_id,omitempty"` - NumWorkers int `json:"num_workers,omitempty"` - PolicyId string `json:"policy_id,omitempty"` - SparkConf map[string]string `json:"spark_conf,omitempty"` - SparkEnvVars map[string]string `json:"spark_env_vars,omitempty"` - SshPublicKeys []string `json:"ssh_public_keys,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func pipelineClusterFromPb(pb *pipelineClusterPb) (*PipelineCluster, error) { - if pb == nil { - return nil, nil - } - st := &PipelineCluster{} - st.ApplyPolicyDefaultValues = pb.ApplyPolicyDefaultValues - st.Autoscale = pb.Autoscale - st.AwsAttributes = pb.AwsAttributes - st.AzureAttributes = pb.AzureAttributes - st.ClusterLogConf = pb.ClusterLogConf - st.CustomTags = pb.CustomTags - st.DriverInstancePoolId = pb.DriverInstancePoolId - st.DriverNodeTypeId = pb.DriverNodeTypeId - st.EnableLocalDiskEncryption = pb.EnableLocalDiskEncryption - st.GcpAttributes = pb.GcpAttributes - st.InitScripts = pb.InitScripts - st.InstancePoolId = pb.InstancePoolId - st.Label = pb.Label - st.NodeTypeId = pb.NodeTypeId - st.NumWorkers = pb.NumWorkers - st.PolicyId = pb.PolicyId - st.SparkConf = pb.SparkConf - st.SparkEnvVars = pb.SparkEnvVars - st.SshPublicKeys = pb.SshPublicKeys - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *pipelineClusterPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st pipelineClusterPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func pipelineClusterAutoscaleToPb(st *PipelineClusterAutoscale) (*pipelineClusterAutoscalePb, error) { - if st == nil { - return nil, nil - } - pb := &pipelineClusterAutoscalePb{} - pb.MaxWorkers = st.MaxWorkers - pb.MinWorkers = st.MinWorkers - pb.Mode = st.Mode - - return pb, nil -} - -type pipelineClusterAutoscalePb struct { - MaxWorkers int `json:"max_workers"` - MinWorkers int `json:"min_workers"` - Mode PipelineClusterAutoscaleMode `json:"mode,omitempty"` -} - -func pipelineClusterAutoscaleFromPb(pb *pipelineClusterAutoscalePb) (*PipelineClusterAutoscale, error) { - if pb == nil { - return nil, nil - } - st := &PipelineClusterAutoscale{} - st.MaxWorkers = pb.MaxWorkers - st.MinWorkers = pb.MinWorkers - st.Mode = pb.Mode - - return st, nil -} - -func pipelineDeploymentToPb(st *PipelineDeployment) (*pipelineDeploymentPb, error) { - if st == nil { - return nil, nil - } - pb := &pipelineDeploymentPb{} - pb.Kind = st.Kind - pb.MetadataFilePath = st.MetadataFilePath - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type pipelineDeploymentPb struct { - Kind DeploymentKind `json:"kind"` - MetadataFilePath string `json:"metadata_file_path,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func pipelineDeploymentFromPb(pb *pipelineDeploymentPb) (*PipelineDeployment, error) { - if pb == nil { - return nil, nil - } - st := &PipelineDeployment{} - st.Kind = pb.Kind - st.MetadataFilePath = pb.MetadataFilePath - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *pipelineDeploymentPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st pipelineDeploymentPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func pipelineEventToPb(st *PipelineEvent) (*pipelineEventPb, error) { - if st == nil { - return nil, nil - } - pb := &pipelineEventPb{} - pb.Error = st.Error - pb.EventType = st.EventType - pb.Id = st.Id - pb.Level = st.Level - pb.MaturityLevel = st.MaturityLevel - pb.Message = st.Message - pb.Origin = st.Origin - pb.Sequence = st.Sequence - pb.Timestamp = st.Timestamp - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type pipelineEventPb struct { - Error *ErrorDetail `json:"error,omitempty"` - EventType string `json:"event_type,omitempty"` - Id string `json:"id,omitempty"` - Level EventLevel `json:"level,omitempty"` - MaturityLevel MaturityLevel `json:"maturity_level,omitempty"` - Message string `json:"message,omitempty"` - Origin *Origin `json:"origin,omitempty"` - Sequence *Sequencing `json:"sequence,omitempty"` - Timestamp string `json:"timestamp,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func pipelineEventFromPb(pb *pipelineEventPb) (*PipelineEvent, error) { - if pb == nil { - return nil, nil - } - st := &PipelineEvent{} - st.Error = pb.Error - st.EventType = pb.EventType - st.Id = pb.Id - st.Level = pb.Level - st.MaturityLevel = pb.MaturityLevel - st.Message = pb.Message - st.Origin = pb.Origin - st.Sequence = pb.Sequence - st.Timestamp = pb.Timestamp - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *pipelineEventPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st pipelineEventPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func pipelineLibraryToPb(st *PipelineLibrary) (*pipelineLibraryPb, error) { - if st == nil { - return nil, nil - } - pb := &pipelineLibraryPb{} - pb.File = st.File - pb.Glob = st.Glob - pb.Jar = st.Jar - pb.Maven = st.Maven - pb.Notebook = st.Notebook - pb.Whl = st.Whl - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type pipelineLibraryPb struct { - File *FileLibrary `json:"file,omitempty"` - Glob *PathPattern `json:"glob,omitempty"` - Jar string `json:"jar,omitempty"` - Maven *compute.MavenLibrary `json:"maven,omitempty"` - Notebook *NotebookLibrary `json:"notebook,omitempty"` - Whl string `json:"whl,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func pipelineLibraryFromPb(pb *pipelineLibraryPb) (*PipelineLibrary, error) { - if pb == nil { - return nil, nil - } - st := &PipelineLibrary{} - st.File = pb.File - st.Glob = pb.Glob - st.Jar = pb.Jar - st.Maven = pb.Maven - st.Notebook = pb.Notebook - st.Whl = pb.Whl - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *pipelineLibraryPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st pipelineLibraryPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func pipelinePermissionToPb(st *PipelinePermission) (*pipelinePermissionPb, error) { - if st == nil { - return nil, nil - } - pb := &pipelinePermissionPb{} - pb.Inherited = st.Inherited - pb.InheritedFromObject = st.InheritedFromObject - pb.PermissionLevel = st.PermissionLevel - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type pipelinePermissionPb struct { - Inherited bool `json:"inherited,omitempty"` - InheritedFromObject []string `json:"inherited_from_object,omitempty"` - PermissionLevel PipelinePermissionLevel `json:"permission_level,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func pipelinePermissionFromPb(pb *pipelinePermissionPb) (*PipelinePermission, error) { - if pb == nil { - return nil, nil - } - st := &PipelinePermission{} - st.Inherited = pb.Inherited - st.InheritedFromObject = pb.InheritedFromObject - st.PermissionLevel = pb.PermissionLevel - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *pipelinePermissionPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st pipelinePermissionPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func pipelinePermissionsToPb(st *PipelinePermissions) (*pipelinePermissionsPb, error) { - if st == nil { - return nil, nil - } - pb := &pipelinePermissionsPb{} - pb.AccessControlList = st.AccessControlList - pb.ObjectId = st.ObjectId - pb.ObjectType = st.ObjectType - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type pipelinePermissionsPb struct { - AccessControlList []PipelineAccessControlResponse `json:"access_control_list,omitempty"` - ObjectId string `json:"object_id,omitempty"` - ObjectType string `json:"object_type,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func pipelinePermissionsFromPb(pb *pipelinePermissionsPb) (*PipelinePermissions, error) { - if pb == nil { - return nil, nil - } - st := &PipelinePermissions{} - st.AccessControlList = pb.AccessControlList - st.ObjectId = pb.ObjectId - st.ObjectType = pb.ObjectType - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *pipelinePermissionsPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st pipelinePermissionsPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func pipelinePermissionsDescriptionToPb(st *PipelinePermissionsDescription) (*pipelinePermissionsDescriptionPb, error) { - if st == nil { - return nil, nil - } - pb := &pipelinePermissionsDescriptionPb{} - pb.Description = st.Description - pb.PermissionLevel = st.PermissionLevel - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type pipelinePermissionsDescriptionPb struct { - Description string `json:"description,omitempty"` - PermissionLevel PipelinePermissionLevel `json:"permission_level,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func pipelinePermissionsDescriptionFromPb(pb *pipelinePermissionsDescriptionPb) (*PipelinePermissionsDescription, error) { - if pb == nil { - return nil, nil - } - st := &PipelinePermissionsDescription{} - st.Description = pb.Description - st.PermissionLevel = pb.PermissionLevel - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *pipelinePermissionsDescriptionPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st pipelinePermissionsDescriptionPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func pipelinePermissionsRequestToPb(st *PipelinePermissionsRequest) (*pipelinePermissionsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &pipelinePermissionsRequestPb{} - pb.AccessControlList = st.AccessControlList - pb.PipelineId = st.PipelineId - - return pb, nil -} - -type pipelinePermissionsRequestPb struct { - AccessControlList []PipelineAccessControlRequest `json:"access_control_list,omitempty"` - PipelineId string `json:"-" url:"-"` -} - -func pipelinePermissionsRequestFromPb(pb *pipelinePermissionsRequestPb) (*PipelinePermissionsRequest, error) { - if pb == nil { - return nil, nil - } - st := &PipelinePermissionsRequest{} - st.AccessControlList = pb.AccessControlList - st.PipelineId = pb.PipelineId - - return st, nil -} - -func pipelineSpecToPb(st *PipelineSpec) (*pipelineSpecPb, error) { - if st == nil { - return nil, nil - } - pb := &pipelineSpecPb{} - pb.BudgetPolicyId = st.BudgetPolicyId - pb.Catalog = st.Catalog - pb.Channel = st.Channel - pb.Clusters = st.Clusters - pb.Configuration = st.Configuration - pb.Continuous = st.Continuous - pb.Deployment = st.Deployment - pb.Development = st.Development - pb.Edition = st.Edition - pb.Environment = st.Environment - pb.EventLog = st.EventLog - pb.Filters = st.Filters - pb.GatewayDefinition = st.GatewayDefinition - pb.Id = st.Id - pb.IngestionDefinition = st.IngestionDefinition - pb.Libraries = st.Libraries - pb.Name = st.Name - pb.Notifications = st.Notifications - pb.Photon = st.Photon - pb.RestartWindow = st.RestartWindow - pb.RootPath = st.RootPath - pb.Schema = st.Schema - pb.Serverless = st.Serverless - pb.Storage = st.Storage - pb.Tags = st.Tags - pb.Target = st.Target - pb.Trigger = st.Trigger - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type pipelineSpecPb struct { - BudgetPolicyId string `json:"budget_policy_id,omitempty"` - Catalog string `json:"catalog,omitempty"` - Channel string `json:"channel,omitempty"` - Clusters []PipelineCluster `json:"clusters,omitempty"` - Configuration map[string]string `json:"configuration,omitempty"` - Continuous bool `json:"continuous,omitempty"` - Deployment *PipelineDeployment `json:"deployment,omitempty"` - Development bool `json:"development,omitempty"` - Edition string `json:"edition,omitempty"` - Environment *PipelinesEnvironment `json:"environment,omitempty"` - EventLog *EventLogSpec `json:"event_log,omitempty"` - Filters *Filters `json:"filters,omitempty"` - GatewayDefinition *IngestionGatewayPipelineDefinition `json:"gateway_definition,omitempty"` - Id string `json:"id,omitempty"` - IngestionDefinition *IngestionPipelineDefinition `json:"ingestion_definition,omitempty"` - Libraries []PipelineLibrary `json:"libraries,omitempty"` - Name string `json:"name,omitempty"` - Notifications []Notifications `json:"notifications,omitempty"` - Photon bool `json:"photon,omitempty"` - RestartWindow *RestartWindow `json:"restart_window,omitempty"` - RootPath string `json:"root_path,omitempty"` - Schema string `json:"schema,omitempty"` - Serverless bool `json:"serverless,omitempty"` - Storage string `json:"storage,omitempty"` - Tags map[string]string `json:"tags,omitempty"` - Target string `json:"target,omitempty"` - Trigger *PipelineTrigger `json:"trigger,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func pipelineSpecFromPb(pb *pipelineSpecPb) (*PipelineSpec, error) { - if pb == nil { - return nil, nil - } - st := &PipelineSpec{} - st.BudgetPolicyId = pb.BudgetPolicyId - st.Catalog = pb.Catalog - st.Channel = pb.Channel - st.Clusters = pb.Clusters - st.Configuration = pb.Configuration - st.Continuous = pb.Continuous - st.Deployment = pb.Deployment - st.Development = pb.Development - st.Edition = pb.Edition - st.Environment = pb.Environment - st.EventLog = pb.EventLog - st.Filters = pb.Filters - st.GatewayDefinition = pb.GatewayDefinition - st.Id = pb.Id - st.IngestionDefinition = pb.IngestionDefinition - st.Libraries = pb.Libraries - st.Name = pb.Name - st.Notifications = pb.Notifications - st.Photon = pb.Photon - st.RestartWindow = pb.RestartWindow - st.RootPath = pb.RootPath - st.Schema = pb.Schema - st.Serverless = pb.Serverless - st.Storage = pb.Storage - st.Tags = pb.Tags - st.Target = pb.Target - st.Trigger = pb.Trigger - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *pipelineSpecPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st pipelineSpecPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func pipelineStateInfoToPb(st *PipelineStateInfo) (*pipelineStateInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &pipelineStateInfoPb{} - pb.ClusterId = st.ClusterId - pb.CreatorUserName = st.CreatorUserName - pb.Health = st.Health - pb.LatestUpdates = st.LatestUpdates - pb.Name = st.Name - pb.PipelineId = st.PipelineId - pb.RunAsUserName = st.RunAsUserName - pb.State = st.State - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type pipelineStateInfoPb struct { - ClusterId string `json:"cluster_id,omitempty"` - CreatorUserName string `json:"creator_user_name,omitempty"` - Health PipelineStateInfoHealth `json:"health,omitempty"` - LatestUpdates []UpdateStateInfo `json:"latest_updates,omitempty"` - Name string `json:"name,omitempty"` - PipelineId string `json:"pipeline_id,omitempty"` - RunAsUserName string `json:"run_as_user_name,omitempty"` - State PipelineState `json:"state,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func pipelineStateInfoFromPb(pb *pipelineStateInfoPb) (*PipelineStateInfo, error) { - if pb == nil { - return nil, nil - } - st := &PipelineStateInfo{} - st.ClusterId = pb.ClusterId - st.CreatorUserName = pb.CreatorUserName - st.Health = pb.Health - st.LatestUpdates = pb.LatestUpdates - st.Name = pb.Name - st.PipelineId = pb.PipelineId - st.RunAsUserName = pb.RunAsUserName - st.State = pb.State - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *pipelineStateInfoPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st pipelineStateInfoPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func pipelineTriggerToPb(st *PipelineTrigger) (*pipelineTriggerPb, error) { - if st == nil { - return nil, nil - } - pb := &pipelineTriggerPb{} - pb.Cron = st.Cron - pb.Manual = st.Manual - - return pb, nil -} - -type pipelineTriggerPb struct { - Cron *CronTrigger `json:"cron,omitempty"` - Manual *ManualTrigger `json:"manual,omitempty"` -} - -func pipelineTriggerFromPb(pb *pipelineTriggerPb) (*PipelineTrigger, error) { - if pb == nil { - return nil, nil - } - st := &PipelineTrigger{} - st.Cron = pb.Cron - st.Manual = pb.Manual - - return st, nil -} - -func pipelinesEnvironmentToPb(st *PipelinesEnvironment) (*pipelinesEnvironmentPb, error) { - if st == nil { - return nil, nil - } - pb := &pipelinesEnvironmentPb{} - pb.Dependencies = st.Dependencies - - return pb, nil -} - -type pipelinesEnvironmentPb struct { - Dependencies []string `json:"dependencies,omitempty"` -} - -func pipelinesEnvironmentFromPb(pb *pipelinesEnvironmentPb) (*PipelinesEnvironment, error) { - if pb == nil { - return nil, nil - } - st := &PipelinesEnvironment{} - st.Dependencies = pb.Dependencies - - return st, nil -} - -func reportSpecToPb(st *ReportSpec) (*reportSpecPb, error) { - if st == nil { - return nil, nil - } - pb := &reportSpecPb{} - pb.DestinationCatalog = st.DestinationCatalog - pb.DestinationSchema = st.DestinationSchema - pb.DestinationTable = st.DestinationTable - pb.SourceUrl = st.SourceUrl - pb.TableConfiguration = st.TableConfiguration - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type reportSpecPb struct { - DestinationCatalog string `json:"destination_catalog"` - DestinationSchema string `json:"destination_schema"` - DestinationTable string `json:"destination_table,omitempty"` - SourceUrl string `json:"source_url"` - TableConfiguration *TableSpecificConfig `json:"table_configuration,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func reportSpecFromPb(pb *reportSpecPb) (*ReportSpec, error) { - if pb == nil { - return nil, nil - } - st := &ReportSpec{} - st.DestinationCatalog = pb.DestinationCatalog - st.DestinationSchema = pb.DestinationSchema - st.DestinationTable = pb.DestinationTable - st.SourceUrl = pb.SourceUrl - st.TableConfiguration = pb.TableConfiguration - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *reportSpecPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st reportSpecPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func restartWindowToPb(st *RestartWindow) (*restartWindowPb, error) { - if st == nil { - return nil, nil - } - pb := &restartWindowPb{} - pb.DaysOfWeek = st.DaysOfWeek - pb.StartHour = st.StartHour - pb.TimeZoneId = st.TimeZoneId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type restartWindowPb struct { - DaysOfWeek []DayOfWeek `json:"days_of_week,omitempty"` - StartHour int `json:"start_hour"` - TimeZoneId string `json:"time_zone_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func restartWindowFromPb(pb *restartWindowPb) (*RestartWindow, error) { - if pb == nil { - return nil, nil - } - st := &RestartWindow{} - st.DaysOfWeek = pb.DaysOfWeek - st.StartHour = pb.StartHour - st.TimeZoneId = pb.TimeZoneId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *restartWindowPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st restartWindowPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func runAsToPb(st *RunAs) (*runAsPb, error) { - if st == nil { - return nil, nil - } - pb := &runAsPb{} - pb.ServicePrincipalName = st.ServicePrincipalName - pb.UserName = st.UserName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type runAsPb struct { - ServicePrincipalName string `json:"service_principal_name,omitempty"` - UserName string `json:"user_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func runAsFromPb(pb *runAsPb) (*RunAs, error) { - if pb == nil { - return nil, nil - } - st := &RunAs{} - st.ServicePrincipalName = pb.ServicePrincipalName - st.UserName = pb.UserName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *runAsPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st runAsPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func schemaSpecToPb(st *SchemaSpec) (*schemaSpecPb, error) { - if st == nil { - return nil, nil - } - pb := &schemaSpecPb{} - pb.DestinationCatalog = st.DestinationCatalog - pb.DestinationSchema = st.DestinationSchema - pb.SourceCatalog = st.SourceCatalog - pb.SourceSchema = st.SourceSchema - pb.TableConfiguration = st.TableConfiguration - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type schemaSpecPb struct { - DestinationCatalog string `json:"destination_catalog"` - DestinationSchema string `json:"destination_schema"` - SourceCatalog string `json:"source_catalog,omitempty"` - SourceSchema string `json:"source_schema"` - TableConfiguration *TableSpecificConfig `json:"table_configuration,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func schemaSpecFromPb(pb *schemaSpecPb) (*SchemaSpec, error) { - if pb == nil { - return nil, nil - } - st := &SchemaSpec{} - st.DestinationCatalog = pb.DestinationCatalog - st.DestinationSchema = pb.DestinationSchema - st.SourceCatalog = pb.SourceCatalog - st.SourceSchema = pb.SourceSchema - st.TableConfiguration = pb.TableConfiguration - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *schemaSpecPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st schemaSpecPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func sequencingToPb(st *Sequencing) (*sequencingPb, error) { - if st == nil { - return nil, nil - } - pb := &sequencingPb{} - pb.ControlPlaneSeqNo = st.ControlPlaneSeqNo - pb.DataPlaneId = st.DataPlaneId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type sequencingPb struct { - ControlPlaneSeqNo int64 `json:"control_plane_seq_no,omitempty"` - DataPlaneId *DataPlaneId `json:"data_plane_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func sequencingFromPb(pb *sequencingPb) (*Sequencing, error) { - if pb == nil { - return nil, nil - } - st := &Sequencing{} - st.ControlPlaneSeqNo = pb.ControlPlaneSeqNo - st.DataPlaneId = pb.DataPlaneId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *sequencingPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st sequencingPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func serializedExceptionToPb(st *SerializedException) (*serializedExceptionPb, error) { - if st == nil { - return nil, nil - } - pb := &serializedExceptionPb{} - pb.ClassName = st.ClassName - pb.Message = st.Message - pb.Stack = st.Stack - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type serializedExceptionPb struct { - ClassName string `json:"class_name,omitempty"` - Message string `json:"message,omitempty"` - Stack []StackFrame `json:"stack,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func serializedExceptionFromPb(pb *serializedExceptionPb) (*SerializedException, error) { - if pb == nil { - return nil, nil - } - st := &SerializedException{} - st.ClassName = pb.ClassName - st.Message = pb.Message - st.Stack = pb.Stack - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *serializedExceptionPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st serializedExceptionPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func stackFrameToPb(st *StackFrame) (*stackFramePb, error) { - if st == nil { - return nil, nil - } - pb := &stackFramePb{} - pb.DeclaringClass = st.DeclaringClass - pb.FileName = st.FileName - pb.LineNumber = st.LineNumber - pb.MethodName = st.MethodName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type stackFramePb struct { - DeclaringClass string `json:"declaring_class,omitempty"` - FileName string `json:"file_name,omitempty"` - LineNumber int `json:"line_number,omitempty"` - MethodName string `json:"method_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func stackFrameFromPb(pb *stackFramePb) (*StackFrame, error) { - if pb == nil { - return nil, nil - } - st := &StackFrame{} - st.DeclaringClass = pb.DeclaringClass - st.FileName = pb.FileName - st.LineNumber = pb.LineNumber - st.MethodName = pb.MethodName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *stackFramePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st stackFramePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func startUpdateToPb(st *StartUpdate) (*startUpdatePb, error) { - if st == nil { - return nil, nil - } - pb := &startUpdatePb{} - pb.Cause = st.Cause - pb.FullRefresh = st.FullRefresh - pb.FullRefreshSelection = st.FullRefreshSelection - pb.PipelineId = st.PipelineId - pb.RefreshSelection = st.RefreshSelection - pb.ValidateOnly = st.ValidateOnly - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type startUpdatePb struct { - Cause StartUpdateCause `json:"cause,omitempty"` - FullRefresh bool `json:"full_refresh,omitempty"` - FullRefreshSelection []string `json:"full_refresh_selection,omitempty"` - PipelineId string `json:"-" url:"-"` - RefreshSelection []string `json:"refresh_selection,omitempty"` - ValidateOnly bool `json:"validate_only,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func startUpdateFromPb(pb *startUpdatePb) (*StartUpdate, error) { - if pb == nil { - return nil, nil - } - st := &StartUpdate{} - st.Cause = pb.Cause - st.FullRefresh = pb.FullRefresh - st.FullRefreshSelection = pb.FullRefreshSelection - st.PipelineId = pb.PipelineId - st.RefreshSelection = pb.RefreshSelection - st.ValidateOnly = pb.ValidateOnly - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *startUpdatePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st startUpdatePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func startUpdateResponseToPb(st *StartUpdateResponse) (*startUpdateResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &startUpdateResponsePb{} - pb.UpdateId = st.UpdateId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type startUpdateResponsePb struct { - UpdateId string `json:"update_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func startUpdateResponseFromPb(pb *startUpdateResponsePb) (*StartUpdateResponse, error) { - if pb == nil { - return nil, nil - } - st := &StartUpdateResponse{} - st.UpdateId = pb.UpdateId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *startUpdateResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st startUpdateResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func stopPipelineResponseToPb(st *StopPipelineResponse) (*stopPipelineResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &stopPipelineResponsePb{} - - return pb, nil -} - -type stopPipelineResponsePb struct { -} - -func stopPipelineResponseFromPb(pb *stopPipelineResponsePb) (*StopPipelineResponse, error) { - if pb == nil { - return nil, nil - } - st := &StopPipelineResponse{} - - return st, nil -} - -func stopRequestToPb(st *StopRequest) (*stopRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &stopRequestPb{} - pb.PipelineId = st.PipelineId - - return pb, nil -} - -type stopRequestPb struct { - PipelineId string `json:"-" url:"-"` -} - -func stopRequestFromPb(pb *stopRequestPb) (*StopRequest, error) { - if pb == nil { - return nil, nil - } - st := &StopRequest{} - st.PipelineId = pb.PipelineId - - return st, nil -} - -func tableSpecToPb(st *TableSpec) (*tableSpecPb, error) { - if st == nil { - return nil, nil - } - pb := &tableSpecPb{} - pb.DestinationCatalog = st.DestinationCatalog - pb.DestinationSchema = st.DestinationSchema - pb.DestinationTable = st.DestinationTable - pb.SourceCatalog = st.SourceCatalog - pb.SourceSchema = st.SourceSchema - pb.SourceTable = st.SourceTable - pb.TableConfiguration = st.TableConfiguration - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type tableSpecPb struct { - DestinationCatalog string `json:"destination_catalog"` - DestinationSchema string `json:"destination_schema"` - DestinationTable string `json:"destination_table,omitempty"` - SourceCatalog string `json:"source_catalog,omitempty"` - SourceSchema string `json:"source_schema,omitempty"` - SourceTable string `json:"source_table"` - TableConfiguration *TableSpecificConfig `json:"table_configuration,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func tableSpecFromPb(pb *tableSpecPb) (*TableSpec, error) { - if pb == nil { - return nil, nil - } - st := &TableSpec{} - st.DestinationCatalog = pb.DestinationCatalog - st.DestinationSchema = pb.DestinationSchema - st.DestinationTable = pb.DestinationTable - st.SourceCatalog = pb.SourceCatalog - st.SourceSchema = pb.SourceSchema - st.SourceTable = pb.SourceTable - st.TableConfiguration = pb.TableConfiguration - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *tableSpecPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st tableSpecPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func tableSpecificConfigToPb(st *TableSpecificConfig) (*tableSpecificConfigPb, error) { - if st == nil { - return nil, nil - } - pb := &tableSpecificConfigPb{} - pb.ExcludeColumns = st.ExcludeColumns - pb.IncludeColumns = st.IncludeColumns - pb.PrimaryKeys = st.PrimaryKeys - pb.SalesforceIncludeFormulaFields = st.SalesforceIncludeFormulaFields - pb.ScdType = st.ScdType - pb.SequenceBy = st.SequenceBy - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type tableSpecificConfigPb struct { - ExcludeColumns []string `json:"exclude_columns,omitempty"` - IncludeColumns []string `json:"include_columns,omitempty"` - PrimaryKeys []string `json:"primary_keys,omitempty"` - SalesforceIncludeFormulaFields bool `json:"salesforce_include_formula_fields,omitempty"` - ScdType TableSpecificConfigScdType `json:"scd_type,omitempty"` - SequenceBy []string `json:"sequence_by,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func tableSpecificConfigFromPb(pb *tableSpecificConfigPb) (*TableSpecificConfig, error) { - if pb == nil { - return nil, nil - } - st := &TableSpecificConfig{} - st.ExcludeColumns = pb.ExcludeColumns - st.IncludeColumns = pb.IncludeColumns - st.PrimaryKeys = pb.PrimaryKeys - st.SalesforceIncludeFormulaFields = pb.SalesforceIncludeFormulaFields - st.ScdType = pb.ScdType - st.SequenceBy = pb.SequenceBy - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *tableSpecificConfigPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st tableSpecificConfigPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func updateInfoToPb(st *UpdateInfo) (*updateInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &updateInfoPb{} - pb.Cause = st.Cause - pb.ClusterId = st.ClusterId - pb.Config = st.Config - pb.CreationTime = st.CreationTime - pb.FullRefresh = st.FullRefresh - pb.FullRefreshSelection = st.FullRefreshSelection - pb.PipelineId = st.PipelineId - pb.RefreshSelection = st.RefreshSelection - pb.State = st.State - pb.UpdateId = st.UpdateId - pb.ValidateOnly = st.ValidateOnly - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type updateInfoPb struct { - Cause UpdateInfoCause `json:"cause,omitempty"` - ClusterId string `json:"cluster_id,omitempty"` - Config *PipelineSpec `json:"config,omitempty"` - CreationTime int64 `json:"creation_time,omitempty"` - FullRefresh bool `json:"full_refresh,omitempty"` - FullRefreshSelection []string `json:"full_refresh_selection,omitempty"` - PipelineId string `json:"pipeline_id,omitempty"` - RefreshSelection []string `json:"refresh_selection,omitempty"` - State UpdateInfoState `json:"state,omitempty"` - UpdateId string `json:"update_id,omitempty"` - ValidateOnly bool `json:"validate_only,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func updateInfoFromPb(pb *updateInfoPb) (*UpdateInfo, error) { - if pb == nil { - return nil, nil - } - st := &UpdateInfo{} - st.Cause = pb.Cause - st.ClusterId = pb.ClusterId - st.Config = pb.Config - st.CreationTime = pb.CreationTime - st.FullRefresh = pb.FullRefresh - st.FullRefreshSelection = pb.FullRefreshSelection - st.PipelineId = pb.PipelineId - st.RefreshSelection = pb.RefreshSelection - st.State = pb.State - st.UpdateId = pb.UpdateId - st.ValidateOnly = pb.ValidateOnly - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *updateInfoPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st updateInfoPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func updateStateInfoToPb(st *UpdateStateInfo) (*updateStateInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &updateStateInfoPb{} - pb.CreationTime = st.CreationTime - pb.State = st.State - pb.UpdateId = st.UpdateId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type updateStateInfoPb struct { - CreationTime string `json:"creation_time,omitempty"` - State UpdateStateInfoState `json:"state,omitempty"` - UpdateId string `json:"update_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func updateStateInfoFromPb(pb *updateStateInfoPb) (*UpdateStateInfo, error) { - if pb == nil { - return nil, nil - } - st := &UpdateStateInfo{} - st.CreationTime = pb.CreationTime - st.State = pb.State - st.UpdateId = pb.UpdateId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *updateStateInfoPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st updateStateInfoPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func durationToPb(d *time.Duration) (*string, error) { - if d == nil { - return nil, nil - } - s := fmt.Sprintf("%.9fs", d.Seconds()) - return &s, nil -} - -func durationFromPb(s *string) (*time.Duration, error) { - if s == nil { - return nil, nil - } - d, err := time.ParseDuration(*s) - if err != nil { - return nil, err - } - return &d, nil -} - -func timestampToPb(t *time.Time) (*string, error) { - if t == nil { - return nil, nil - } - s := t.Format(time.RFC3339) - return &s, nil -} - -func timestampFromPb(s *string) (*time.Time, error) { - if s == nil { - return nil, nil - } - t, err := time.Parse(time.RFC3339, *s) - if err != nil { - return nil, err - } - return &t, nil -} - -func fieldMaskToPb(fm *[]string) (*string, error) { - if fm == nil { - return nil, nil - } - s := strings.Join(*fm, ",") - return &s, nil -} - -func fieldMaskFromPb(s *string) (*[]string, error) { - if s == nil { - return nil, nil - } - fm := strings.Split(*s, ",") - return &fm, nil -} diff --git a/service/pipelines/model.go b/service/pipelines/model.go index bda6f0aa5..5f2a24c03 100755 --- a/service/pipelines/model.go +++ b/service/pipelines/model.go @@ -3,89 +3,66 @@ package pipelines import ( - "encoding/json" "fmt" + "github.com/databricks/databricks-sdk-go/marshal" "github.com/databricks/databricks-sdk-go/service/compute" ) type CreatePipeline struct { // If false, deployment will fail if name conflicts with that of another // pipeline. - // Wire name: 'allow_duplicate_names' AllowDuplicateNames bool `json:"allow_duplicate_names,omitempty"` // Budget policy of this pipeline. - // Wire name: 'budget_policy_id' BudgetPolicyId string `json:"budget_policy_id,omitempty"` // A catalog in Unity Catalog to publish data from this pipeline to. If // `target` is specified, tables in this pipeline are published to a // `target` schema inside `catalog` (for example, // `catalog`.`target`.`table`). If `target` is not specified, no data is // published to Unity Catalog. - // Wire name: 'catalog' Catalog string `json:"catalog,omitempty"` // DLT Release Channel that specifies which version to use. - // Wire name: 'channel' Channel string `json:"channel,omitempty"` // Cluster settings for this pipeline deployment. - // Wire name: 'clusters' Clusters []PipelineCluster `json:"clusters,omitempty"` // String-String configuration for this pipeline execution. - // Wire name: 'configuration' Configuration map[string]string `json:"configuration,omitempty"` // Whether the pipeline is continuous or triggered. This replaces `trigger`. - // Wire name: 'continuous' Continuous bool `json:"continuous,omitempty"` // Deployment type of this pipeline. - // Wire name: 'deployment' Deployment *PipelineDeployment `json:"deployment,omitempty"` // Whether the pipeline is in Development mode. Defaults to false. - // Wire name: 'development' Development bool `json:"development,omitempty"` - // Wire name: 'dry_run' DryRun bool `json:"dry_run,omitempty"` // Pipeline product edition. - // Wire name: 'edition' Edition string `json:"edition,omitempty"` // Environment specification for this pipeline used to install dependencies. - // Wire name: 'environment' Environment *PipelinesEnvironment `json:"environment,omitempty"` // Event log configuration for this pipeline - // Wire name: 'event_log' EventLog *EventLogSpec `json:"event_log,omitempty"` // Filters on which Pipeline packages to include in the deployed graph. - // Wire name: 'filters' Filters *Filters `json:"filters,omitempty"` // The definition of a gateway pipeline to support change data capture. - // Wire name: 'gateway_definition' GatewayDefinition *IngestionGatewayPipelineDefinition `json:"gateway_definition,omitempty"` // Unique identifier for this pipeline. - // Wire name: 'id' Id string `json:"id,omitempty"` // The configuration for a managed ingestion pipeline. These settings cannot // be used with the 'libraries', 'schema', 'target', or 'catalog' settings. - // Wire name: 'ingestion_definition' IngestionDefinition *IngestionPipelineDefinition `json:"ingestion_definition,omitempty"` // Libraries or code needed by this deployment. - // Wire name: 'libraries' Libraries []PipelineLibrary `json:"libraries,omitempty"` // Friendly identifier for this pipeline. - // Wire name: 'name' Name string `json:"name,omitempty"` // List of notification settings for this pipeline. - // Wire name: 'notifications' Notifications []Notifications `json:"notifications,omitempty"` // Whether Photon is enabled for this pipeline. - // Wire name: 'photon' Photon bool `json:"photon,omitempty"` // Restart window of this pipeline. - // Wire name: 'restart_window' RestartWindow *RestartWindow `json:"restart_window,omitempty"` // Root path for this pipeline. This is used as the root directory when // editing the pipeline in the Databricks user interface and it is added to // sys.path when executing Python sources during pipeline execution. - // Wire name: 'root_path' RootPath string `json:"root_path,omitempty"` // Write-only setting, available only in Create/Update calls. Specifies the // user or service principal that the pipeline runs as. If not specified, @@ -93,167 +70,85 @@ type CreatePipeline struct { // // Only `user_name` or `service_principal_name` can be specified. If both // are specified, an error is thrown. - // Wire name: 'run_as' RunAs *RunAs `json:"run_as,omitempty"` // The default schema (database) where tables are read from or published to. - // Wire name: 'schema' Schema string `json:"schema,omitempty"` // Whether serverless compute is enabled for this pipeline. - // Wire name: 'serverless' Serverless bool `json:"serverless,omitempty"` // DBFS root directory for storing checkpoints and tables. - // Wire name: 'storage' Storage string `json:"storage,omitempty"` // A map of tags associated with the pipeline. These are forwarded to the // cluster as cluster tags, and are therefore subject to the same // limitations. A maximum of 25 tags can be added to the pipeline. - // Wire name: 'tags' Tags map[string]string `json:"tags,omitempty"` // Target schema (database) to add tables in this pipeline to. Exactly one // of `schema` or `target` must be specified. To publish to Unity Catalog, // also specify `catalog`. This legacy field is deprecated for pipeline // creation in favor of the `schema` field. - // Wire name: 'target' Target string `json:"target,omitempty"` // Which pipeline trigger to use. Deprecated: Use `continuous` instead. - // Wire name: 'trigger' Trigger *PipelineTrigger `json:"trigger,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreatePipeline) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createPipelinePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createPipelineFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreatePipeline) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreatePipeline) MarshalJSON() ([]byte, error) { - pb, err := createPipelineToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreatePipeline) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreatePipelineResponse struct { // Only returned when dry_run is true. - // Wire name: 'effective_settings' EffectiveSettings *PipelineSpec `json:"effective_settings,omitempty"` // The unique identifier for the newly created pipeline. Only returned when // dry_run is false. - // Wire name: 'pipeline_id' PipelineId string `json:"pipeline_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreatePipelineResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createPipelineResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createPipelineResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreatePipelineResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreatePipelineResponse) MarshalJSON() ([]byte, error) { - pb, err := createPipelineResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreatePipelineResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CronTrigger struct { - - // Wire name: 'quartz_cron_schedule' QuartzCronSchedule string `json:"quartz_cron_schedule,omitempty"` - // Wire name: 'timezone_id' TimezoneId string `json:"timezone_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CronTrigger) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &cronTriggerPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := cronTriggerFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CronTrigger) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CronTrigger) MarshalJSON() ([]byte, error) { - pb, err := cronTriggerToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CronTrigger) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type DataPlaneId struct { // The instance name of the data plane emitting an event. - // Wire name: 'instance' Instance string `json:"instance,omitempty"` // A sequence number, unique and increasing within the data plane instance. - // Wire name: 'seq_no' SeqNo int64 `json:"seq_no,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DataPlaneId) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &dataPlaneIdPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := dataPlaneIdFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DataPlaneId) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DataPlaneId) MarshalJSON() ([]byte, error) { - pb, err := dataPlaneIdToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DataPlaneId) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Days of week in which the restart is allowed to happen (within a five-hour @@ -313,62 +208,12 @@ func (f *DayOfWeek) Type() string { // Delete a pipeline type DeletePipelineRequest struct { - PipelineId string `json:"-" tf:"-"` -} - -func (st *DeletePipelineRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deletePipelineRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deletePipelineRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeletePipelineRequest) MarshalJSON() ([]byte, error) { - pb, err := deletePipelineRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + PipelineId string `json:"-" url:"-"` } type DeletePipelineResponse struct { } -func (st *DeletePipelineResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deletePipelineResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deletePipelineResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeletePipelineResponse) MarshalJSON() ([]byte, error) { - pb, err := deletePipelineResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // The deployment method that manages the pipeline: - BUNDLE: The pipeline is // managed by a Databricks Asset Bundle. type DeploymentKind string @@ -408,84 +253,61 @@ func (f *DeploymentKind) Type() string { type EditPipeline struct { // If false, deployment will fail if name has changed and conflicts the name // of another pipeline. - // Wire name: 'allow_duplicate_names' AllowDuplicateNames bool `json:"allow_duplicate_names,omitempty"` // Budget policy of this pipeline. - // Wire name: 'budget_policy_id' BudgetPolicyId string `json:"budget_policy_id,omitempty"` // A catalog in Unity Catalog to publish data from this pipeline to. If // `target` is specified, tables in this pipeline are published to a // `target` schema inside `catalog` (for example, // `catalog`.`target`.`table`). If `target` is not specified, no data is // published to Unity Catalog. - // Wire name: 'catalog' Catalog string `json:"catalog,omitempty"` // DLT Release Channel that specifies which version to use. - // Wire name: 'channel' Channel string `json:"channel,omitempty"` // Cluster settings for this pipeline deployment. - // Wire name: 'clusters' Clusters []PipelineCluster `json:"clusters,omitempty"` // String-String configuration for this pipeline execution. - // Wire name: 'configuration' Configuration map[string]string `json:"configuration,omitempty"` // Whether the pipeline is continuous or triggered. This replaces `trigger`. - // Wire name: 'continuous' Continuous bool `json:"continuous,omitempty"` // Deployment type of this pipeline. - // Wire name: 'deployment' Deployment *PipelineDeployment `json:"deployment,omitempty"` // Whether the pipeline is in Development mode. Defaults to false. - // Wire name: 'development' Development bool `json:"development,omitempty"` // Pipeline product edition. - // Wire name: 'edition' Edition string `json:"edition,omitempty"` // Environment specification for this pipeline used to install dependencies. - // Wire name: 'environment' Environment *PipelinesEnvironment `json:"environment,omitempty"` // Event log configuration for this pipeline - // Wire name: 'event_log' EventLog *EventLogSpec `json:"event_log,omitempty"` // If present, the last-modified time of the pipeline settings before the // edit. If the settings were modified after that time, then the request // will fail with a conflict. - // Wire name: 'expected_last_modified' ExpectedLastModified int64 `json:"expected_last_modified,omitempty"` // Filters on which Pipeline packages to include in the deployed graph. - // Wire name: 'filters' Filters *Filters `json:"filters,omitempty"` // The definition of a gateway pipeline to support change data capture. - // Wire name: 'gateway_definition' GatewayDefinition *IngestionGatewayPipelineDefinition `json:"gateway_definition,omitempty"` // Unique identifier for this pipeline. - // Wire name: 'id' Id string `json:"id,omitempty"` // The configuration for a managed ingestion pipeline. These settings cannot // be used with the 'libraries', 'schema', 'target', or 'catalog' settings. - // Wire name: 'ingestion_definition' IngestionDefinition *IngestionPipelineDefinition `json:"ingestion_definition,omitempty"` // Libraries or code needed by this deployment. - // Wire name: 'libraries' Libraries []PipelineLibrary `json:"libraries,omitempty"` // Friendly identifier for this pipeline. - // Wire name: 'name' Name string `json:"name,omitempty"` // List of notification settings for this pipeline. - // Wire name: 'notifications' Notifications []Notifications `json:"notifications,omitempty"` // Whether Photon is enabled for this pipeline. - // Wire name: 'photon' Photon bool `json:"photon,omitempty"` // Unique identifier for this pipeline. - PipelineId string `json:"-" tf:"-"` + PipelineId string `json:"-" url:"-"` // Restart window of this pipeline. - // Wire name: 'restart_window' RestartWindow *RestartWindow `json:"restart_window,omitempty"` // Root path for this pipeline. This is used as the root directory when // editing the pipeline in the Databricks user interface and it is added to // sys.path when executing Python sources during pipeline execution. - // Wire name: 'root_path' RootPath string `json:"root_path,omitempty"` // Write-only setting, available only in Create/Update calls. Specifies the // user or service principal that the pipeline runs as. If not specified, @@ -493,122 +315,54 @@ type EditPipeline struct { // // Only `user_name` or `service_principal_name` can be specified. If both // are specified, an error is thrown. - // Wire name: 'run_as' RunAs *RunAs `json:"run_as,omitempty"` // The default schema (database) where tables are read from or published to. - // Wire name: 'schema' Schema string `json:"schema,omitempty"` // Whether serverless compute is enabled for this pipeline. - // Wire name: 'serverless' Serverless bool `json:"serverless,omitempty"` // DBFS root directory for storing checkpoints and tables. - // Wire name: 'storage' Storage string `json:"storage,omitempty"` // A map of tags associated with the pipeline. These are forwarded to the // cluster as cluster tags, and are therefore subject to the same // limitations. A maximum of 25 tags can be added to the pipeline. - // Wire name: 'tags' Tags map[string]string `json:"tags,omitempty"` // Target schema (database) to add tables in this pipeline to. Exactly one // of `schema` or `target` must be specified. To publish to Unity Catalog, // also specify `catalog`. This legacy field is deprecated for pipeline // creation in favor of the `schema` field. - // Wire name: 'target' Target string `json:"target,omitempty"` // Which pipeline trigger to use. Deprecated: Use `continuous` instead. - // Wire name: 'trigger' Trigger *PipelineTrigger `json:"trigger,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *EditPipeline) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &editPipelinePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := editPipelineFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *EditPipeline) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st EditPipeline) MarshalJSON() ([]byte, error) { - pb, err := editPipelineToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s EditPipeline) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type EditPipelineResponse struct { } -func (st *EditPipelineResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &editPipelineResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := editPipelineResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st EditPipelineResponse) MarshalJSON() ([]byte, error) { - pb, err := editPipelineResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type ErrorDetail struct { // The exception thrown for this error, with its chain of cause. - // Wire name: 'exceptions' Exceptions []SerializedException `json:"exceptions,omitempty"` // Whether this error is considered fatal, that is, unrecoverable. - // Wire name: 'fatal' Fatal bool `json:"fatal,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ErrorDetail) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &errorDetailPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := errorDetailFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ErrorDetail) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ErrorDetail) MarshalJSON() ([]byte, error) { - pb, err := errorDetailToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ErrorDetail) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The severity level of the event. @@ -658,299 +412,104 @@ func (f *EventLevel) Type() string { // Configurable event log parameters. type EventLogSpec struct { // The UC catalog the event log is published under. - // Wire name: 'catalog' Catalog string `json:"catalog,omitempty"` // The name the event log is published to in UC. - // Wire name: 'name' Name string `json:"name,omitempty"` // The UC schema the event log is published under. - // Wire name: 'schema' Schema string `json:"schema,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *EventLogSpec) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &eventLogSpecPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := eventLogSpecFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *EventLogSpec) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st EventLogSpec) MarshalJSON() ([]byte, error) { - pb, err := eventLogSpecToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s EventLogSpec) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type FileLibrary struct { // The absolute path of the source code. - // Wire name: 'path' Path string `json:"path,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *FileLibrary) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &fileLibraryPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := fileLibraryFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *FileLibrary) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st FileLibrary) MarshalJSON() ([]byte, error) { - pb, err := fileLibraryToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s FileLibrary) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type Filters struct { // Paths to exclude. - // Wire name: 'exclude' Exclude []string `json:"exclude,omitempty"` // Paths to include. - // Wire name: 'include' Include []string `json:"include,omitempty"` } -func (st *Filters) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &filtersPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := filtersFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st Filters) MarshalJSON() ([]byte, error) { - pb, err := filtersToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Get pipeline permission levels type GetPipelinePermissionLevelsRequest struct { // The pipeline for which to get or manage permissions. - PipelineId string `json:"-" tf:"-"` -} - -func (st *GetPipelinePermissionLevelsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getPipelinePermissionLevelsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getPipelinePermissionLevelsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetPipelinePermissionLevelsRequest) MarshalJSON() ([]byte, error) { - pb, err := getPipelinePermissionLevelsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + PipelineId string `json:"-" url:"-"` } type GetPipelinePermissionLevelsResponse struct { // Specific permission levels - // Wire name: 'permission_levels' PermissionLevels []PipelinePermissionsDescription `json:"permission_levels,omitempty"` } -func (st *GetPipelinePermissionLevelsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getPipelinePermissionLevelsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getPipelinePermissionLevelsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetPipelinePermissionLevelsResponse) MarshalJSON() ([]byte, error) { - pb, err := getPipelinePermissionLevelsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Get pipeline permissions type GetPipelinePermissionsRequest struct { // The pipeline for which to get or manage permissions. - PipelineId string `json:"-" tf:"-"` -} - -func (st *GetPipelinePermissionsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getPipelinePermissionsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getPipelinePermissionsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetPipelinePermissionsRequest) MarshalJSON() ([]byte, error) { - pb, err := getPipelinePermissionsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + PipelineId string `json:"-" url:"-"` } // Get a pipeline type GetPipelineRequest struct { - PipelineId string `json:"-" tf:"-"` -} - -func (st *GetPipelineRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getPipelineRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getPipelineRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetPipelineRequest) MarshalJSON() ([]byte, error) { - pb, err := getPipelineRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + PipelineId string `json:"-" url:"-"` } type GetPipelineResponse struct { // An optional message detailing the cause of the pipeline state. - // Wire name: 'cause' Cause string `json:"cause,omitempty"` // The ID of the cluster that the pipeline is running on. - // Wire name: 'cluster_id' ClusterId string `json:"cluster_id,omitempty"` // The username of the pipeline creator. - // Wire name: 'creator_user_name' CreatorUserName string `json:"creator_user_name,omitempty"` // Serverless budget policy ID of this pipeline. - // Wire name: 'effective_budget_policy_id' EffectiveBudgetPolicyId string `json:"effective_budget_policy_id,omitempty"` // The health of a pipeline. - // Wire name: 'health' Health GetPipelineResponseHealth `json:"health,omitempty"` // The last time the pipeline settings were modified or created. - // Wire name: 'last_modified' LastModified int64 `json:"last_modified,omitempty"` // Status of the latest updates for the pipeline. Ordered with the newest // update first. - // Wire name: 'latest_updates' LatestUpdates []UpdateStateInfo `json:"latest_updates,omitempty"` // A human friendly identifier for the pipeline, taken from the `spec`. - // Wire name: 'name' Name string `json:"name,omitempty"` // The ID of the pipeline. - // Wire name: 'pipeline_id' PipelineId string `json:"pipeline_id,omitempty"` // Username of the user that the pipeline will run on behalf of. - // Wire name: 'run_as_user_name' RunAsUserName string `json:"run_as_user_name,omitempty"` // The pipeline specification. This field is not returned when called by // `ListPipelines`. - // Wire name: 'spec' Spec *PipelineSpec `json:"spec,omitempty"` // The pipeline state. - // Wire name: 'state' State PipelineState `json:"state,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetPipelineResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getPipelineResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getPipelineResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetPipelineResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetPipelineResponse) MarshalJSON() ([]byte, error) { - pb, err := getPipelineResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetPipelineResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The health of a pipeline. @@ -994,208 +553,85 @@ func (f *GetPipelineResponseHealth) Type() string { // Get a pipeline update type GetUpdateRequest struct { // The ID of the pipeline. - PipelineId string `json:"-" tf:"-"` + PipelineId string `json:"-" url:"-"` // The ID of the update. - UpdateId string `json:"-" tf:"-"` -} - -func (st *GetUpdateRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getUpdateRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getUpdateRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetUpdateRequest) MarshalJSON() ([]byte, error) { - pb, err := getUpdateRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + UpdateId string `json:"-" url:"-"` } type GetUpdateResponse struct { // The current update info. - // Wire name: 'update' Update *UpdateInfo `json:"update,omitempty"` } -func (st *GetUpdateResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getUpdateResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getUpdateResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetUpdateResponse) MarshalJSON() ([]byte, error) { - pb, err := getUpdateResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type IngestionConfig struct { // Select a specific source report. - // Wire name: 'report' Report *ReportSpec `json:"report,omitempty"` // Select all tables from a specific source schema. - // Wire name: 'schema' Schema *SchemaSpec `json:"schema,omitempty"` // Select a specific source table. - // Wire name: 'table' Table *TableSpec `json:"table,omitempty"` } -func (st *IngestionConfig) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &ingestionConfigPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := ingestionConfigFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st IngestionConfig) MarshalJSON() ([]byte, error) { - pb, err := ingestionConfigToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type IngestionGatewayPipelineDefinition struct { // [Deprecated, use connection_name instead] Immutable. The Unity Catalog // connection that this gateway pipeline uses to communicate with the // source. - // Wire name: 'connection_id' ConnectionId string `json:"connection_id,omitempty"` // Immutable. The Unity Catalog connection that this gateway pipeline uses // to communicate with the source. - // Wire name: 'connection_name' ConnectionName string `json:"connection_name"` // Required, Immutable. The name of the catalog for the gateway pipeline's // storage location. - // Wire name: 'gateway_storage_catalog' GatewayStorageCatalog string `json:"gateway_storage_catalog"` // Optional. The Unity Catalog-compatible name for the gateway storage // location. This is the destination to use for the data that is extracted // by the gateway. Delta Live Tables system will automatically create the // storage location under the catalog and schema. - // Wire name: 'gateway_storage_name' GatewayStorageName string `json:"gateway_storage_name,omitempty"` // Required, Immutable. The name of the schema for the gateway pipelines's // storage location. - // Wire name: 'gateway_storage_schema' GatewayStorageSchema string `json:"gateway_storage_schema"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *IngestionGatewayPipelineDefinition) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &ingestionGatewayPipelineDefinitionPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := ingestionGatewayPipelineDefinitionFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *IngestionGatewayPipelineDefinition) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st IngestionGatewayPipelineDefinition) MarshalJSON() ([]byte, error) { - pb, err := ingestionGatewayPipelineDefinitionToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s IngestionGatewayPipelineDefinition) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type IngestionPipelineDefinition struct { // Immutable. The Unity Catalog connection that this ingestion pipeline uses // to communicate with the source. This is used with connectors for // applications like Salesforce, Workday, and so on. - // Wire name: 'connection_name' ConnectionName string `json:"connection_name,omitempty"` // Immutable. Identifier for the gateway that is used by this ingestion // pipeline to communicate with the source database. This is used with // connectors to databases like SQL Server. - // Wire name: 'ingestion_gateway_id' IngestionGatewayId string `json:"ingestion_gateway_id,omitempty"` // Required. Settings specifying tables to replicate and the destination for // the replicated tables. - // Wire name: 'objects' Objects []IngestionConfig `json:"objects,omitempty"` // The type of the foreign source. The source type will be inferred from the // source connection or ingestion gateway. This field is output only and // will be ignored if provided. - // Wire name: 'source_type' SourceType IngestionSourceType `json:"source_type,omitempty"` // Configuration settings to control the ingestion of tables. These settings // are applied to all tables in the pipeline. - // Wire name: 'table_configuration' TableConfiguration *TableSpecificConfig `json:"table_configuration,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *IngestionPipelineDefinition) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &ingestionPipelineDefinitionPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := ingestionPipelineDefinitionFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *IngestionPipelineDefinition) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st IngestionPipelineDefinition) MarshalJSON() ([]byte, error) { - pb, err := ingestionPipelineDefinitionToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s IngestionPipelineDefinition) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type IngestionSourceType string @@ -1277,88 +713,51 @@ type ListPipelineEventsRequest struct { // // Composite expressions are supported, for example: level in ('ERROR', // 'WARN') AND timestamp> '2021-07-22T06:37:33.083Z' - Filter string `json:"-" tf:"-"` + Filter string `json:"-" url:"filter,omitempty"` // Max number of entries to return in a single page. The system may return // fewer than max_results events in a response, even if there are more // events available. - MaxResults int `json:"-" tf:"-"` + MaxResults int `json:"-" url:"max_results,omitempty"` // A string indicating a sort order by timestamp for the results, for // example, ["timestamp asc"]. The sort order can be ascending or // descending. By default, events are returned in descending order by // timestamp. - OrderBy []string `json:"-" tf:"-"` + OrderBy []string `json:"-" url:"order_by,omitempty"` // Page token returned by previous call. This field is mutually exclusive // with all fields in this request except max_results. An error is returned // if any fields other than max_results are set when this field is set. - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` // The pipeline to return events for. - PipelineId string `json:"-" tf:"-"` + PipelineId string `json:"-" url:"-"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListPipelineEventsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listPipelineEventsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listPipelineEventsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListPipelineEventsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListPipelineEventsRequest) MarshalJSON() ([]byte, error) { - pb, err := listPipelineEventsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListPipelineEventsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListPipelineEventsResponse struct { // The list of events matching the request criteria. - // Wire name: 'events' Events []PipelineEvent `json:"events,omitempty"` // If present, a token to fetch the next page of events. - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` // If present, a token to fetch the previous page of events. - // Wire name: 'prev_page_token' PrevPageToken string `json:"prev_page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListPipelineEventsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listPipelineEventsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listPipelineEventsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListPipelineEventsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListPipelineEventsResponse) MarshalJSON() ([]byte, error) { - pb, err := listPipelineEventsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListPipelineEventsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // List pipelines @@ -1372,191 +771,93 @@ type ListPipelinesRequest struct { // '%shopping%'` // // Composite filters are not supported. This field is optional. - Filter string `json:"-" tf:"-"` + Filter string `json:"-" url:"filter,omitempty"` // The maximum number of entries to return in a single page. The system may // return fewer than max_results events in a response, even if there are // more events available. This field is optional. The default value is 25. // The maximum value is 100. An error is returned if the value of // max_results is greater than 100. - MaxResults int `json:"-" tf:"-"` + MaxResults int `json:"-" url:"max_results,omitempty"` // A list of strings specifying the order of results. Supported order_by // fields are id and name. The default is id asc. This field is optional. - OrderBy []string `json:"-" tf:"-"` + OrderBy []string `json:"-" url:"order_by,omitempty"` // Page token returned by previous call - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListPipelinesRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listPipelinesRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listPipelinesRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListPipelinesRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListPipelinesRequest) MarshalJSON() ([]byte, error) { - pb, err := listPipelinesRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListPipelinesRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListPipelinesResponse struct { // If present, a token to fetch the next page of events. - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` // The list of events matching the request criteria. - // Wire name: 'statuses' Statuses []PipelineStateInfo `json:"statuses,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListPipelinesResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listPipelinesResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listPipelinesResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListPipelinesResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListPipelinesResponse) MarshalJSON() ([]byte, error) { - pb, err := listPipelinesResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListPipelinesResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // List pipeline updates type ListUpdatesRequest struct { // Max number of entries to return in a single page. - MaxResults int `json:"-" tf:"-"` + MaxResults int `json:"-" url:"max_results,omitempty"` // Page token returned by previous call - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` // The pipeline to return updates for. - PipelineId string `json:"-" tf:"-"` + PipelineId string `json:"-" url:"-"` // If present, returns updates until and including this update_id. - UntilUpdateId string `json:"-" tf:"-"` + UntilUpdateId string `json:"-" url:"until_update_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListUpdatesRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listUpdatesRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listUpdatesRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListUpdatesRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListUpdatesRequest) MarshalJSON() ([]byte, error) { - pb, err := listUpdatesRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListUpdatesRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListUpdatesResponse struct { // If present, then there are more results, and this a token to be used in a // subsequent request to fetch the next page. - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` // If present, then this token can be used in a subsequent request to fetch // the previous page. - // Wire name: 'prev_page_token' PrevPageToken string `json:"prev_page_token,omitempty"` - // Wire name: 'updates' Updates []UpdateInfo `json:"updates,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListUpdatesResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listUpdatesResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listUpdatesResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListUpdatesResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListUpdatesResponse) MarshalJSON() ([]byte, error) { - pb, err := listUpdatesResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListUpdatesResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ManualTrigger struct { } -func (st *ManualTrigger) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &manualTriggerPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := manualTriggerFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ManualTrigger) MarshalJSON() ([]byte, error) { - pb, err := manualTriggerToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Maturity level for EventDetails. type MaturityLevel string @@ -1600,35 +901,17 @@ func (f *MaturityLevel) Type() string { type NotebookLibrary struct { // The absolute path of the source code. - // Wire name: 'path' Path string `json:"path,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *NotebookLibrary) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := ¬ebookLibraryPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := notebookLibraryFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *NotebookLibrary) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st NotebookLibrary) MarshalJSON() ([]byte, error) { - pb, err := notebookLibraryToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s NotebookLibrary) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type Notifications struct { @@ -1639,257 +922,131 @@ type Notifications struct { // `on-update-failure`: Each time a pipeline update fails. * // `on-update-fatal-failure`: A pipeline update fails with a non-retryable // (fatal) error. * `on-flow-failure`: A single data flow fails. - // Wire name: 'alerts' Alerts []string `json:"alerts,omitempty"` // A list of email addresses notified when a configured alert is triggered. - // Wire name: 'email_recipients' EmailRecipients []string `json:"email_recipients,omitempty"` } -func (st *Notifications) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := ¬ificationsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := notificationsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st Notifications) MarshalJSON() ([]byte, error) { - pb, err := notificationsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type Origin struct { // The id of a batch. Unique within a flow. - // Wire name: 'batch_id' BatchId int64 `json:"batch_id,omitempty"` // The cloud provider, e.g., AWS or Azure. - // Wire name: 'cloud' Cloud string `json:"cloud,omitempty"` // The id of the cluster where an execution happens. Unique within a region. - // Wire name: 'cluster_id' ClusterId string `json:"cluster_id,omitempty"` // The name of a dataset. Unique within a pipeline. - // Wire name: 'dataset_name' DatasetName string `json:"dataset_name,omitempty"` // The id of the flow. Globally unique. Incremental queries will generally // reuse the same id while complete queries will have a new id per update. - // Wire name: 'flow_id' FlowId string `json:"flow_id,omitempty"` // The name of the flow. Not unique. - // Wire name: 'flow_name' FlowName string `json:"flow_name,omitempty"` // The optional host name where the event was triggered - // Wire name: 'host' Host string `json:"host,omitempty"` // The id of a maintenance run. Globally unique. - // Wire name: 'maintenance_id' MaintenanceId string `json:"maintenance_id,omitempty"` // Materialization name. - // Wire name: 'materialization_name' MaterializationName string `json:"materialization_name,omitempty"` // The org id of the user. Unique within a cloud. - // Wire name: 'org_id' OrgId int64 `json:"org_id,omitempty"` // The id of the pipeline. Globally unique. - // Wire name: 'pipeline_id' PipelineId string `json:"pipeline_id,omitempty"` // The name of the pipeline. Not unique. - // Wire name: 'pipeline_name' PipelineName string `json:"pipeline_name,omitempty"` // The cloud region. - // Wire name: 'region' Region string `json:"region,omitempty"` // The id of the request that caused an update. - // Wire name: 'request_id' RequestId string `json:"request_id,omitempty"` // The id of a (delta) table. Globally unique. - // Wire name: 'table_id' TableId string `json:"table_id,omitempty"` // The Unity Catalog id of the MV or ST being updated. - // Wire name: 'uc_resource_id' UcResourceId string `json:"uc_resource_id,omitempty"` // The id of an execution. Globally unique. - // Wire name: 'update_id' UpdateId string `json:"update_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *Origin) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &originPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := originFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *Origin) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st Origin) MarshalJSON() ([]byte, error) { - pb, err := originToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s Origin) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type PathPattern struct { // The source code to include for pipelines - // Wire name: 'include' Include string `json:"include,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *PathPattern) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &pathPatternPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := pathPatternFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *PathPattern) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st PathPattern) MarshalJSON() ([]byte, error) { - pb, err := pathPatternToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s PathPattern) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type PipelineAccessControlRequest struct { // name of the group - // Wire name: 'group_name' GroupName string `json:"group_name,omitempty"` // Permission level - // Wire name: 'permission_level' PermissionLevel PipelinePermissionLevel `json:"permission_level,omitempty"` // application ID of a service principal - // Wire name: 'service_principal_name' ServicePrincipalName string `json:"service_principal_name,omitempty"` // name of the user - // Wire name: 'user_name' UserName string `json:"user_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *PipelineAccessControlRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &pipelineAccessControlRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := pipelineAccessControlRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *PipelineAccessControlRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st PipelineAccessControlRequest) MarshalJSON() ([]byte, error) { - pb, err := pipelineAccessControlRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s PipelineAccessControlRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type PipelineAccessControlResponse struct { // All permissions. - // Wire name: 'all_permissions' AllPermissions []PipelinePermission `json:"all_permissions,omitempty"` // Display name of the user or service principal. - // Wire name: 'display_name' DisplayName string `json:"display_name,omitempty"` // name of the group - // Wire name: 'group_name' GroupName string `json:"group_name,omitempty"` // Name of the service principal. - // Wire name: 'service_principal_name' ServicePrincipalName string `json:"service_principal_name,omitempty"` // name of the user - // Wire name: 'user_name' UserName string `json:"user_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *PipelineAccessControlResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &pipelineAccessControlResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := pipelineAccessControlResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *PipelineAccessControlResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st PipelineAccessControlResponse) MarshalJSON() ([]byte, error) { - pb, err := pipelineAccessControlResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s PipelineAccessControlResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type PipelineCluster struct { // Note: This field won't be persisted. Only API users will check this // field. - // Wire name: 'apply_policy_default_values' ApplyPolicyDefaultValues bool `json:"apply_policy_default_values,omitempty"` // Parameters needed in order to automatically scale clusters up and down // based on load. Note: autoscaling works best with DB runtime versions 3.0 // or later. - // Wire name: 'autoscale' Autoscale *PipelineClusterAutoscale `json:"autoscale,omitempty"` // Attributes related to clusters running on Amazon Web Services. If not // specified at cluster creation, a set of default values will be used. - // Wire name: 'aws_attributes' AwsAttributes *compute.AwsAttributes `json:"aws_attributes,omitempty"` // Attributes related to clusters running on Microsoft Azure. If not // specified at cluster creation, a set of default values will be used. - // Wire name: 'azure_attributes' AzureAttributes *compute.AzureAttributes `json:"azure_attributes,omitempty"` // The configuration for delivering spark logs to a long-term storage // destination. Only dbfs destinations are supported. Only one destination @@ -1897,7 +1054,6 @@ type PipelineCluster struct { // delivered to the destination every `5 mins`. The destination of driver // logs is `$destination/$clusterId/driver`, while the destination of // executor logs is `$destination/$clusterId/executor`. - // Wire name: 'cluster_log_conf' ClusterLogConf *compute.ClusterLogConf `json:"cluster_log_conf,omitempty"` // Additional tags for cluster resources. Databricks will tag all cluster // resources (e.g., AWS instances and EBS volumes) with these tags in @@ -1907,45 +1063,36 @@ type PipelineCluster struct { // // - Clusters can only reuse cloud resources if the resources' tags are a // subset of the cluster tags - // Wire name: 'custom_tags' CustomTags map[string]string `json:"custom_tags,omitempty"` // The optional ID of the instance pool for the driver of the cluster // belongs. The pool cluster uses the instance pool with id // (instance_pool_id) if the driver pool is not assigned. - // Wire name: 'driver_instance_pool_id' DriverInstancePoolId string `json:"driver_instance_pool_id,omitempty"` // The node type of the Spark driver. Note that this field is optional; if // unset, the driver node type will be set as the same value as // `node_type_id` defined above. - // Wire name: 'driver_node_type_id' DriverNodeTypeId string `json:"driver_node_type_id,omitempty"` // Whether to enable local disk encryption for the cluster. - // Wire name: 'enable_local_disk_encryption' EnableLocalDiskEncryption bool `json:"enable_local_disk_encryption,omitempty"` // Attributes related to clusters running on Google Cloud Platform. If not // specified at cluster creation, a set of default values will be used. - // Wire name: 'gcp_attributes' GcpAttributes *compute.GcpAttributes `json:"gcp_attributes,omitempty"` // The configuration for storing init scripts. Any number of destinations // can be specified. The scripts are executed sequentially in the order // provided. If `cluster_log_conf` is specified, init script logs are sent // to `//init_scripts`. - // Wire name: 'init_scripts' InitScripts []compute.InitScriptInfo `json:"init_scripts,omitempty"` // The optional ID of the instance pool to which the cluster belongs. - // Wire name: 'instance_pool_id' InstancePoolId string `json:"instance_pool_id,omitempty"` // A label for the cluster specification, either `default` to configure the // default cluster, or `maintenance` to configure the maintenance cluster. // This field is optional. The default value is `default`. - // Wire name: 'label' Label string `json:"label,omitempty"` // This field encodes, through a single value, the resources available to // each of the Spark nodes in this cluster. For example, the Spark nodes can // be provisioned and optimized for memory or compute intensive workloads. A // list of available node types can be retrieved by using the // :method:clusters/listNodeTypes API call. - // Wire name: 'node_type_id' NodeTypeId string `json:"node_type_id,omitempty"` // Number of worker nodes that this cluster should have. A cluster has one // Spark Driver and `num_workers` Executors for a total of `num_workers` + 1 @@ -1957,15 +1104,12 @@ type PipelineCluster struct { // field will immediately be updated to reflect the target size of 10 // workers, whereas the workers listed in `spark_info` will gradually // increase from 5 to 10 as the new nodes are provisioned. - // Wire name: 'num_workers' NumWorkers int `json:"num_workers,omitempty"` // The ID of the cluster policy used to create the cluster if applicable. - // Wire name: 'policy_id' PolicyId string `json:"policy_id,omitempty"` // An object containing a set of optional, user-specified Spark // configuration key-value pairs. See :method:clusters/create for more // details. - // Wire name: 'spark_conf' SparkConf map[string]string `json:"spark_conf,omitempty"` // An object containing a set of optional, user-specified environment // variable key-value pairs. Please note that key-value pair of the form @@ -1980,86 +1124,39 @@ type PipelineCluster struct { // Example Spark environment variables: `{"SPARK_WORKER_MEMORY": "28000m", // "SPARK_LOCAL_DIRS": "/local_disk0"}` or `{"SPARK_DAEMON_JAVA_OPTS": // "$SPARK_DAEMON_JAVA_OPTS -Dspark.shuffle.service.enabled=true"}` - // Wire name: 'spark_env_vars' SparkEnvVars map[string]string `json:"spark_env_vars,omitempty"` // SSH public key contents that will be added to each Spark node in this // cluster. The corresponding private keys can be used to login with the // user name `ubuntu` on port `2200`. Up to 10 keys can be specified. - // Wire name: 'ssh_public_keys' SshPublicKeys []string `json:"ssh_public_keys,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *PipelineCluster) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &pipelineClusterPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := pipelineClusterFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *PipelineCluster) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st PipelineCluster) MarshalJSON() ([]byte, error) { - pb, err := pipelineClusterToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s PipelineCluster) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type PipelineClusterAutoscale struct { // The maximum number of workers to which the cluster can scale up when // overloaded. `max_workers` must be strictly greater than `min_workers`. - // Wire name: 'max_workers' MaxWorkers int `json:"max_workers"` // The minimum number of workers the cluster can scale down to when // underutilized. It is also the initial number of workers the cluster will // have after creation. - // Wire name: 'min_workers' MinWorkers int `json:"min_workers"` // Databricks Enhanced Autoscaling optimizes cluster utilization by // automatically allocating cluster resources based on workload volume, with // minimal impact to the data processing latency of your pipelines. Enhanced // Autoscaling is available for `updates` clusters only. The legacy // autoscaling feature is used for `maintenance` clusters. - // Wire name: 'mode' Mode PipelineClusterAutoscaleMode `json:"mode,omitempty"` } -func (st *PipelineClusterAutoscale) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &pipelineClusterAutoscalePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := pipelineClusterAutoscaleFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st PipelineClusterAutoscale) MarshalJSON() ([]byte, error) { - pb, err := pipelineClusterAutoscaleToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Databricks Enhanced Autoscaling optimizes cluster utilization by // automatically allocating cluster resources based on workload volume, with // minimal impact to the data processing latency of your pipelines. Enhanced @@ -2104,186 +1201,97 @@ func (f *PipelineClusterAutoscaleMode) Type() string { type PipelineDeployment struct { // The deployment method that manages the pipeline. - // Wire name: 'kind' Kind DeploymentKind `json:"kind"` // The path to the file containing metadata about the deployment. - // Wire name: 'metadata_file_path' MetadataFilePath string `json:"metadata_file_path,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *PipelineDeployment) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &pipelineDeploymentPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := pipelineDeploymentFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *PipelineDeployment) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st PipelineDeployment) MarshalJSON() ([]byte, error) { - pb, err := pipelineDeploymentToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s PipelineDeployment) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type PipelineEvent struct { // Information about an error captured by the event. - // Wire name: 'error' Error *ErrorDetail `json:"error,omitempty"` // The event type. Should always correspond to the details - // Wire name: 'event_type' EventType string `json:"event_type,omitempty"` // A time-based, globally unique id. - // Wire name: 'id' Id string `json:"id,omitempty"` // The severity level of the event. - // Wire name: 'level' Level EventLevel `json:"level,omitempty"` // Maturity level for event_type. - // Wire name: 'maturity_level' MaturityLevel MaturityLevel `json:"maturity_level,omitempty"` // The display message associated with the event. - // Wire name: 'message' Message string `json:"message,omitempty"` // Describes where the event originates from. - // Wire name: 'origin' Origin *Origin `json:"origin,omitempty"` // A sequencing object to identify and order events. - // Wire name: 'sequence' Sequence *Sequencing `json:"sequence,omitempty"` // The time of the event. - // Wire name: 'timestamp' Timestamp string `json:"timestamp,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *PipelineEvent) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &pipelineEventPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := pipelineEventFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *PipelineEvent) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st PipelineEvent) MarshalJSON() ([]byte, error) { - pb, err := pipelineEventToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s PipelineEvent) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type PipelineLibrary struct { // The path to a file that defines a pipeline and is stored in the // Databricks Repos. - // Wire name: 'file' File *FileLibrary `json:"file,omitempty"` // The unified field to include source codes. Each entry can be a notebook // path, a file path, or a folder path that ends `/**`. This field cannot be // used together with `notebook` or `file`. - // Wire name: 'glob' Glob *PathPattern `json:"glob,omitempty"` // URI of the jar to be installed. Currently only DBFS is supported. - // Wire name: 'jar' Jar string `json:"jar,omitempty"` // Specification of a maven library to be installed. - // Wire name: 'maven' Maven *compute.MavenLibrary `json:"maven,omitempty"` // The path to a notebook that defines a pipeline and is stored in the // Databricks workspace. - // Wire name: 'notebook' Notebook *NotebookLibrary `json:"notebook,omitempty"` // URI of the whl to be installed. - // Wire name: 'whl' Whl string `json:"whl,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *PipelineLibrary) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &pipelineLibraryPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := pipelineLibraryFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *PipelineLibrary) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st PipelineLibrary) MarshalJSON() ([]byte, error) { - pb, err := pipelineLibraryToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s PipelineLibrary) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type PipelinePermission struct { - - // Wire name: 'inherited' Inherited bool `json:"inherited,omitempty"` - // Wire name: 'inherited_from_object' InheritedFromObject []string `json:"inherited_from_object,omitempty"` // Permission level - // Wire name: 'permission_level' PermissionLevel PipelinePermissionLevel `json:"permission_level,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *PipelinePermission) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &pipelinePermissionPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := pipelinePermissionFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *PipelinePermission) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st PipelinePermission) MarshalJSON() ([]byte, error) { - pb, err := pipelinePermissionToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s PipelinePermission) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Permission level @@ -2331,234 +1339,122 @@ func (f *PipelinePermissionLevel) Type() string { } type PipelinePermissions struct { - - // Wire name: 'access_control_list' AccessControlList []PipelineAccessControlResponse `json:"access_control_list,omitempty"` - // Wire name: 'object_id' ObjectId string `json:"object_id,omitempty"` - // Wire name: 'object_type' ObjectType string `json:"object_type,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *PipelinePermissions) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &pipelinePermissionsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := pipelinePermissionsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *PipelinePermissions) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st PipelinePermissions) MarshalJSON() ([]byte, error) { - pb, err := pipelinePermissionsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s PipelinePermissions) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type PipelinePermissionsDescription struct { - - // Wire name: 'description' Description string `json:"description,omitempty"` // Permission level - // Wire name: 'permission_level' PermissionLevel PipelinePermissionLevel `json:"permission_level,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *PipelinePermissionsDescription) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &pipelinePermissionsDescriptionPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := pipelinePermissionsDescriptionFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *PipelinePermissionsDescription) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st PipelinePermissionsDescription) MarshalJSON() ([]byte, error) { - pb, err := pipelinePermissionsDescriptionToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s PipelinePermissionsDescription) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type PipelinePermissionsRequest struct { - - // Wire name: 'access_control_list' AccessControlList []PipelineAccessControlRequest `json:"access_control_list,omitempty"` // The pipeline for which to get or manage permissions. - PipelineId string `json:"-" tf:"-"` -} - -func (st *PipelinePermissionsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &pipelinePermissionsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := pipelinePermissionsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st PipelinePermissionsRequest) MarshalJSON() ([]byte, error) { - pb, err := pipelinePermissionsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + PipelineId string `json:"-" url:"-"` } type PipelineSpec struct { // Budget policy of this pipeline. - // Wire name: 'budget_policy_id' BudgetPolicyId string `json:"budget_policy_id,omitempty"` // A catalog in Unity Catalog to publish data from this pipeline to. If // `target` is specified, tables in this pipeline are published to a // `target` schema inside `catalog` (for example, // `catalog`.`target`.`table`). If `target` is not specified, no data is // published to Unity Catalog. - // Wire name: 'catalog' Catalog string `json:"catalog,omitempty"` // DLT Release Channel that specifies which version to use. - // Wire name: 'channel' Channel string `json:"channel,omitempty"` // Cluster settings for this pipeline deployment. - // Wire name: 'clusters' Clusters []PipelineCluster `json:"clusters,omitempty"` // String-String configuration for this pipeline execution. - // Wire name: 'configuration' Configuration map[string]string `json:"configuration,omitempty"` // Whether the pipeline is continuous or triggered. This replaces `trigger`. - // Wire name: 'continuous' Continuous bool `json:"continuous,omitempty"` // Deployment type of this pipeline. - // Wire name: 'deployment' Deployment *PipelineDeployment `json:"deployment,omitempty"` // Whether the pipeline is in Development mode. Defaults to false. - // Wire name: 'development' Development bool `json:"development,omitempty"` // Pipeline product edition. - // Wire name: 'edition' Edition string `json:"edition,omitempty"` // Environment specification for this pipeline used to install dependencies. - // Wire name: 'environment' Environment *PipelinesEnvironment `json:"environment,omitempty"` // Event log configuration for this pipeline - // Wire name: 'event_log' EventLog *EventLogSpec `json:"event_log,omitempty"` // Filters on which Pipeline packages to include in the deployed graph. - // Wire name: 'filters' Filters *Filters `json:"filters,omitempty"` // The definition of a gateway pipeline to support change data capture. - // Wire name: 'gateway_definition' GatewayDefinition *IngestionGatewayPipelineDefinition `json:"gateway_definition,omitempty"` // Unique identifier for this pipeline. - // Wire name: 'id' Id string `json:"id,omitempty"` // The configuration for a managed ingestion pipeline. These settings cannot // be used with the 'libraries', 'schema', 'target', or 'catalog' settings. - // Wire name: 'ingestion_definition' IngestionDefinition *IngestionPipelineDefinition `json:"ingestion_definition,omitempty"` // Libraries or code needed by this deployment. - // Wire name: 'libraries' Libraries []PipelineLibrary `json:"libraries,omitempty"` // Friendly identifier for this pipeline. - // Wire name: 'name' Name string `json:"name,omitempty"` // List of notification settings for this pipeline. - // Wire name: 'notifications' Notifications []Notifications `json:"notifications,omitempty"` // Whether Photon is enabled for this pipeline. - // Wire name: 'photon' Photon bool `json:"photon,omitempty"` // Restart window of this pipeline. - // Wire name: 'restart_window' RestartWindow *RestartWindow `json:"restart_window,omitempty"` // Root path for this pipeline. This is used as the root directory when // editing the pipeline in the Databricks user interface and it is added to // sys.path when executing Python sources during pipeline execution. - // Wire name: 'root_path' RootPath string `json:"root_path,omitempty"` // The default schema (database) where tables are read from or published to. - // Wire name: 'schema' Schema string `json:"schema,omitempty"` // Whether serverless compute is enabled for this pipeline. - // Wire name: 'serverless' Serverless bool `json:"serverless,omitempty"` // DBFS root directory for storing checkpoints and tables. - // Wire name: 'storage' Storage string `json:"storage,omitempty"` // A map of tags associated with the pipeline. These are forwarded to the // cluster as cluster tags, and are therefore subject to the same // limitations. A maximum of 25 tags can be added to the pipeline. - // Wire name: 'tags' Tags map[string]string `json:"tags,omitempty"` // Target schema (database) to add tables in this pipeline to. Exactly one // of `schema` or `target` must be specified. To publish to Unity Catalog, // also specify `catalog`. This legacy field is deprecated for pipeline // creation in favor of the `schema` field. - // Wire name: 'target' Target string `json:"target,omitempty"` // Which pipeline trigger to use. Deprecated: Use `continuous` instead. - // Wire name: 'trigger' Trigger *PipelineTrigger `json:"trigger,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *PipelineSpec) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &pipelineSpecPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := pipelineSpecFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *PipelineSpec) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st PipelineSpec) MarshalJSON() ([]byte, error) { - pb, err := pipelineSpecToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s PipelineSpec) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The pipeline state. @@ -2622,58 +1518,33 @@ func (f *PipelineState) Type() string { type PipelineStateInfo struct { // The unique identifier of the cluster running the pipeline. - // Wire name: 'cluster_id' ClusterId string `json:"cluster_id,omitempty"` // The username of the pipeline creator. - // Wire name: 'creator_user_name' CreatorUserName string `json:"creator_user_name,omitempty"` // The health of a pipeline. - // Wire name: 'health' Health PipelineStateInfoHealth `json:"health,omitempty"` // Status of the latest updates for the pipeline. Ordered with the newest // update first. - // Wire name: 'latest_updates' LatestUpdates []UpdateStateInfo `json:"latest_updates,omitempty"` // The user-friendly name of the pipeline. - // Wire name: 'name' Name string `json:"name,omitempty"` // The unique identifier of the pipeline. - // Wire name: 'pipeline_id' PipelineId string `json:"pipeline_id,omitempty"` // The username that the pipeline runs as. This is a read only value derived // from the pipeline owner. - // Wire name: 'run_as_user_name' RunAsUserName string `json:"run_as_user_name,omitempty"` // The pipeline state. - // Wire name: 'state' State PipelineState `json:"state,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *PipelineStateInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &pipelineStateInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := pipelineStateInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *PipelineStateInfo) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st PipelineStateInfo) MarshalJSON() ([]byte, error) { - pb, err := pipelineStateInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s PipelineStateInfo) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The health of a pipeline. @@ -2715,39 +1586,11 @@ func (f *PipelineStateInfoHealth) Type() string { } type PipelineTrigger struct { - - // Wire name: 'cron' Cron *CronTrigger `json:"cron,omitempty"` - // Wire name: 'manual' Manual *ManualTrigger `json:"manual,omitempty"` } -func (st *PipelineTrigger) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &pipelineTriggerPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := pipelineTriggerFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st PipelineTrigger) MarshalJSON() ([]byte, error) { - pb, err := pipelineTriggerToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // The environment entity used to preserve serverless environment side panel, // jobs' environment for non-notebook task, and DLT's environment for classic // and serverless pipelines. In this minimal environment spec, only pip @@ -2758,126 +1601,58 @@ type PipelinesEnvironment struct { // https://pip.pypa.io/en/stable/reference/requirements-file-format/ Allowed // dependency could be , , (WSFS or Volumes in Databricks), - // Wire name: 'dependencies' Dependencies []string `json:"dependencies,omitempty"` } -func (st *PipelinesEnvironment) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &pipelinesEnvironmentPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := pipelinesEnvironmentFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st PipelinesEnvironment) MarshalJSON() ([]byte, error) { - pb, err := pipelinesEnvironmentToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type ReportSpec struct { // Required. Destination catalog to store table. - // Wire name: 'destination_catalog' DestinationCatalog string `json:"destination_catalog"` // Required. Destination schema to store table. - // Wire name: 'destination_schema' DestinationSchema string `json:"destination_schema"` // Required. Destination table name. The pipeline fails if a table with that // name already exists. - // Wire name: 'destination_table' DestinationTable string `json:"destination_table,omitempty"` // Required. Report URL in the source system. - // Wire name: 'source_url' SourceUrl string `json:"source_url"` // Configuration settings to control the ingestion of tables. These settings // override the table_configuration defined in the // IngestionPipelineDefinition object. - // Wire name: 'table_configuration' TableConfiguration *TableSpecificConfig `json:"table_configuration,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ReportSpec) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &reportSpecPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := reportSpecFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ReportSpec) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ReportSpec) MarshalJSON() ([]byte, error) { - pb, err := reportSpecToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ReportSpec) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type RestartWindow struct { // Days of week in which the restart is allowed to happen (within a // five-hour window starting at start_hour). If not specified all days of // the week will be used. - // Wire name: 'days_of_week' DaysOfWeek []DayOfWeek `json:"days_of_week,omitempty"` // An integer between 0 and 23 denoting the start hour for the restart // window in the 24-hour day. Continuous pipeline restart is triggered only // within a five-hour window starting at this hour. - // Wire name: 'start_hour' StartHour int `json:"start_hour"` // Time zone id of restart window. See // https://docs.databricks.com/sql/language-manual/sql-ref-syntax-aux-conf-mgmt-set-timezone.html // for details. If not specified, UTC will be used. - // Wire name: 'time_zone_id' TimeZoneId string `json:"time_zone_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *RestartWindow) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &restartWindowPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := restartWindowFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *RestartWindow) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st RestartWindow) MarshalJSON() ([]byte, error) { - pb, err := restartWindowToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s RestartWindow) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Write-only setting, available only in Create/Update calls. Specifies the user @@ -2889,260 +1664,137 @@ func (st RestartWindow) MarshalJSON() ([]byte, error) { type RunAs struct { // Application ID of an active service principal. Setting this field // requires the `servicePrincipal/user` role. - // Wire name: 'service_principal_name' ServicePrincipalName string `json:"service_principal_name,omitempty"` // The email of an active workspace user. Users can only set this field to // their own email. - // Wire name: 'user_name' UserName string `json:"user_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *RunAs) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &runAsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := runAsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *RunAs) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st RunAs) MarshalJSON() ([]byte, error) { - pb, err := runAsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s RunAs) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type SchemaSpec struct { // Required. Destination catalog to store tables. - // Wire name: 'destination_catalog' DestinationCatalog string `json:"destination_catalog"` // Required. Destination schema to store tables in. Tables with the same // name as the source tables are created in this destination schema. The // pipeline fails If a table with the same name already exists. - // Wire name: 'destination_schema' DestinationSchema string `json:"destination_schema"` // The source catalog name. Might be optional depending on the type of // source. - // Wire name: 'source_catalog' SourceCatalog string `json:"source_catalog,omitempty"` // Required. Schema name in the source database. - // Wire name: 'source_schema' SourceSchema string `json:"source_schema"` // Configuration settings to control the ingestion of tables. These settings // are applied to all tables in this schema and override the // table_configuration defined in the IngestionPipelineDefinition object. - // Wire name: 'table_configuration' TableConfiguration *TableSpecificConfig `json:"table_configuration,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *SchemaSpec) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &schemaSpecPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := schemaSpecFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *SchemaSpec) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st SchemaSpec) MarshalJSON() ([]byte, error) { - pb, err := schemaSpecToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s SchemaSpec) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type Sequencing struct { // A sequence number, unique and increasing per pipeline. - // Wire name: 'control_plane_seq_no' ControlPlaneSeqNo int64 `json:"control_plane_seq_no,omitempty"` // the ID assigned by the data plane. - // Wire name: 'data_plane_id' DataPlaneId *DataPlaneId `json:"data_plane_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *Sequencing) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &sequencingPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := sequencingFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *Sequencing) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st Sequencing) MarshalJSON() ([]byte, error) { - pb, err := sequencingToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s Sequencing) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type SerializedException struct { // Runtime class of the exception - // Wire name: 'class_name' ClassName string `json:"class_name,omitempty"` // Exception message - // Wire name: 'message' Message string `json:"message,omitempty"` // Stack trace consisting of a list of stack frames - // Wire name: 'stack' Stack []StackFrame `json:"stack,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *SerializedException) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &serializedExceptionPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := serializedExceptionFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *SerializedException) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st SerializedException) MarshalJSON() ([]byte, error) { - pb, err := serializedExceptionToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s SerializedException) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type StackFrame struct { // Class from which the method call originated - // Wire name: 'declaring_class' DeclaringClass string `json:"declaring_class,omitempty"` // File where the method is defined - // Wire name: 'file_name' FileName string `json:"file_name,omitempty"` // Line from which the method was called - // Wire name: 'line_number' LineNumber int `json:"line_number,omitempty"` // Name of the method which was called - // Wire name: 'method_name' MethodName string `json:"method_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *StackFrame) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &stackFramePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := stackFrameFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *StackFrame) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st StackFrame) MarshalJSON() ([]byte, error) { - pb, err := stackFrameToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s StackFrame) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type StartUpdate struct { // What triggered this update. - // Wire name: 'cause' Cause StartUpdateCause `json:"cause,omitempty"` // If true, this update will reset all tables before running. - // Wire name: 'full_refresh' FullRefresh bool `json:"full_refresh,omitempty"` // A list of tables to update with fullRefresh. If both refresh_selection // and full_refresh_selection are empty, this is a full graph update. Full // Refresh on a table means that the states of the table will be reset // before the refresh. - // Wire name: 'full_refresh_selection' FullRefreshSelection []string `json:"full_refresh_selection,omitempty"` - PipelineId string `json:"-" tf:"-"` + PipelineId string `json:"-" url:"-"` // A list of tables to update without fullRefresh. If both refresh_selection // and full_refresh_selection are empty, this is a full graph update. Full // Refresh on a table means that the states of the table will be reset // before the refresh. - // Wire name: 'refresh_selection' RefreshSelection []string `json:"refresh_selection,omitempty"` // If true, this update only validates the correctness of pipeline source // code but does not materialize or publish any datasets. - // Wire name: 'validate_only' ValidateOnly bool `json:"validate_only,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *StartUpdate) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &startUpdatePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := startUpdateFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *StartUpdate) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st StartUpdate) MarshalJSON() ([]byte, error) { - pb, err := startUpdateToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s StartUpdate) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // What triggered this update. @@ -3199,149 +1851,56 @@ func (f *StartUpdateCause) Type() string { } type StartUpdateResponse struct { - - // Wire name: 'update_id' UpdateId string `json:"update_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *StartUpdateResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &startUpdateResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := startUpdateResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *StartUpdateResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st StartUpdateResponse) MarshalJSON() ([]byte, error) { - pb, err := startUpdateResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s StartUpdateResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type StopPipelineResponse struct { } -func (st *StopPipelineResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &stopPipelineResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := stopPipelineResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st StopPipelineResponse) MarshalJSON() ([]byte, error) { - pb, err := stopPipelineResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Stop a pipeline type StopRequest struct { - PipelineId string `json:"-" tf:"-"` -} - -func (st *StopRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &stopRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := stopRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st StopRequest) MarshalJSON() ([]byte, error) { - pb, err := stopRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + PipelineId string `json:"-" url:"-"` } type TableSpec struct { // Required. Destination catalog to store table. - // Wire name: 'destination_catalog' DestinationCatalog string `json:"destination_catalog"` // Required. Destination schema to store table. - // Wire name: 'destination_schema' DestinationSchema string `json:"destination_schema"` // Optional. Destination table name. The pipeline fails if a table with that // name already exists. If not set, the source table name is used. - // Wire name: 'destination_table' DestinationTable string `json:"destination_table,omitempty"` // Source catalog name. Might be optional depending on the type of source. - // Wire name: 'source_catalog' SourceCatalog string `json:"source_catalog,omitempty"` // Schema name in the source database. Might be optional depending on the // type of source. - // Wire name: 'source_schema' SourceSchema string `json:"source_schema,omitempty"` // Required. Table name in the source database. - // Wire name: 'source_table' SourceTable string `json:"source_table"` // Configuration settings to control the ingestion of tables. These settings // override the table_configuration defined in the // IngestionPipelineDefinition object and the SchemaSpec. - // Wire name: 'table_configuration' TableConfiguration *TableSpecificConfig `json:"table_configuration,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *TableSpec) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &tableSpecPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := tableSpecFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *TableSpec) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st TableSpec) MarshalJSON() ([]byte, error) { - pb, err := tableSpecToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s TableSpec) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type TableSpecificConfig struct { @@ -3350,57 +1909,34 @@ type TableSpecificConfig struct { // When specified, all other columns including future ones will be // automatically included for ingestion. This field in mutually exclusive // with `include_columns`. - // Wire name: 'exclude_columns' ExcludeColumns []string `json:"exclude_columns,omitempty"` // A list of column names to be included for the ingestion. When not // specified, all columns except ones in exclude_columns will be included. // Future columns will be automatically included. When specified, all other // future columns will be automatically excluded from ingestion. This field // in mutually exclusive with `exclude_columns`. - // Wire name: 'include_columns' IncludeColumns []string `json:"include_columns,omitempty"` // The primary key of the table used to apply changes. - // Wire name: 'primary_keys' PrimaryKeys []string `json:"primary_keys,omitempty"` // If true, formula fields defined in the table are included in the // ingestion. This setting is only valid for the Salesforce connector - // Wire name: 'salesforce_include_formula_fields' SalesforceIncludeFormulaFields bool `json:"salesforce_include_formula_fields,omitempty"` // The SCD type to use to ingest the table. - // Wire name: 'scd_type' ScdType TableSpecificConfigScdType `json:"scd_type,omitempty"` // The column names specifying the logical order of events in the source // data. Delta Live Tables uses this sequencing to handle change events that // arrive out of order. - // Wire name: 'sequence_by' SequenceBy []string `json:"sequence_by,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *TableSpecificConfig) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &tableSpecificConfigPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := tableSpecificConfigFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *TableSpecificConfig) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st TableSpecificConfig) MarshalJSON() ([]byte, error) { - pb, err := tableSpecificConfigToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s TableSpecificConfig) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The SCD type to use to ingest the table. @@ -3443,73 +1979,45 @@ func (f *TableSpecificConfigScdType) Type() string { type UpdateInfo struct { // What triggered this update. - // Wire name: 'cause' Cause UpdateInfoCause `json:"cause,omitempty"` // The ID of the cluster that the update is running on. - // Wire name: 'cluster_id' ClusterId string `json:"cluster_id,omitempty"` // The pipeline configuration with system defaults applied where unspecified // by the user. Not returned by ListUpdates. - // Wire name: 'config' Config *PipelineSpec `json:"config,omitempty"` // The time when this update was created. - // Wire name: 'creation_time' CreationTime int64 `json:"creation_time,omitempty"` // If true, this update will reset all tables before running. - // Wire name: 'full_refresh' FullRefresh bool `json:"full_refresh,omitempty"` // A list of tables to update with fullRefresh. If both refresh_selection // and full_refresh_selection are empty, this is a full graph update. Full // Refresh on a table means that the states of the table will be reset // before the refresh. - // Wire name: 'full_refresh_selection' FullRefreshSelection []string `json:"full_refresh_selection,omitempty"` // The ID of the pipeline. - // Wire name: 'pipeline_id' PipelineId string `json:"pipeline_id,omitempty"` // A list of tables to update without fullRefresh. If both refresh_selection // and full_refresh_selection are empty, this is a full graph update. Full // Refresh on a table means that the states of the table will be reset // before the refresh. - // Wire name: 'refresh_selection' RefreshSelection []string `json:"refresh_selection,omitempty"` // The update state. - // Wire name: 'state' State UpdateInfoState `json:"state,omitempty"` // The ID of this update. - // Wire name: 'update_id' UpdateId string `json:"update_id,omitempty"` // If true, this update only validates the correctness of pipeline source // code but does not materialize or publish any datasets. - // Wire name: 'validate_only' ValidateOnly bool `json:"validate_only,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *UpdateInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *UpdateInfo) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st UpdateInfo) MarshalJSON() ([]byte, error) { - pb, err := updateInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s UpdateInfo) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // What triggered this update. @@ -3631,42 +2139,21 @@ func (f *UpdateInfoState) Type() string { } type UpdateStateInfo struct { - - // Wire name: 'creation_time' CreationTime string `json:"creation_time,omitempty"` // The update state. - // Wire name: 'state' State UpdateStateInfoState `json:"state,omitempty"` - // Wire name: 'update_id' UpdateId string `json:"update_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *UpdateStateInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateStateInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateStateInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *UpdateStateInfo) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st UpdateStateInfo) MarshalJSON() ([]byte, error) { - pb, err := updateStateInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s UpdateStateInfo) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The update state. diff --git a/service/pkg.go b/service/pkg.go index 36969c447..4a6ca200f 100644 --- a/service/pkg.go +++ b/service/pkg.go @@ -374,8 +374,8 @@ var ( _ *marketplace.ConsumerListingsAPI = nil _ *marketplace.ConsumerPersonalizationRequestsAPI = nil _ *marketplace.ConsumerProvidersAPI = nil - _ *provisioning.CredentialsAPI = nil _ *catalog.CredentialsAPI = nil + _ *provisioning.CredentialsAPI = nil _ *settings.CredentialsManagerAPI = nil _ *settings.CspEnablementAccountAPI = nil _ *iam.CurrentUserAPI = nil diff --git a/service/provisioning/impl.go b/service/provisioning/impl.go index 42336917d..00fe68611 100755 --- a/service/provisioning/impl.go +++ b/service/provisioning/impl.go @@ -16,127 +16,44 @@ type credentialsImpl struct { } func (a *credentialsImpl) Create(ctx context.Context, request CreateCredentialRequest) (*Credential, error) { - - requestPb, pbErr := createCredentialRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var credentialPb credentialPb + var credential Credential path := fmt.Sprintf("/api/2.0/accounts/%v/credentials", a.client.ConfiguredAccountID()) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &credentialPb, - ) - if err != nil { - return nil, err - } - resp, err := credentialFromPb(&credentialPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &credential) + return &credential, err } func (a *credentialsImpl) Delete(ctx context.Context, request DeleteCredentialRequest) error { - - requestPb, pbErr := deleteCredentialRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteResponsePb deleteResponsePb - path := fmt.Sprintf("/api/2.0/accounts/%v/credentials/%v", a.client.ConfiguredAccountID(), requestPb.CredentialsId) + var deleteResponse DeleteResponse + path := fmt.Sprintf("/api/2.0/accounts/%v/credentials/%v", a.client.ConfiguredAccountID(), request.CredentialsId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteResponse) return err } func (a *credentialsImpl) Get(ctx context.Context, request GetCredentialRequest) (*Credential, error) { - - requestPb, pbErr := getCredentialRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var credentialPb credentialPb - path := fmt.Sprintf("/api/2.0/accounts/%v/credentials/%v", a.client.ConfiguredAccountID(), requestPb.CredentialsId) + var credential Credential + path := fmt.Sprintf("/api/2.0/accounts/%v/credentials/%v", a.client.ConfiguredAccountID(), request.CredentialsId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &credentialPb, - ) - if err != nil { - return nil, err - } - resp, err := credentialFromPb(&credentialPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &credential) + return &credential, err } func (a *credentialsImpl) List(ctx context.Context) ([]Credential, error) { - - var credentialListPb []credentialPb + var credentialList []Credential path := fmt.Sprintf("/api/2.0/accounts/%v/credentials", a.client.ConfiguredAccountID()) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - nil, - nil, - &credentialListPb, - ) - if err != nil { - return nil, err - } - var resp []Credential - for _, item := range credentialListPb { - itemResp, err := credentialFromPb(&item) - if err != nil { - return nil, err - } - resp = append(resp, *itemResp) - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, nil, nil, &credentialList) + return credentialList, err } // unexported type that holds implementations of just EncryptionKeys API methods @@ -145,127 +62,44 @@ type encryptionKeysImpl struct { } func (a *encryptionKeysImpl) Create(ctx context.Context, request CreateCustomerManagedKeyRequest) (*CustomerManagedKey, error) { - - requestPb, pbErr := createCustomerManagedKeyRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var customerManagedKeyPb customerManagedKeyPb + var customerManagedKey CustomerManagedKey path := fmt.Sprintf("/api/2.0/accounts/%v/customer-managed-keys", a.client.ConfiguredAccountID()) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &customerManagedKeyPb, - ) - if err != nil { - return nil, err - } - resp, err := customerManagedKeyFromPb(&customerManagedKeyPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &customerManagedKey) + return &customerManagedKey, err } func (a *encryptionKeysImpl) Delete(ctx context.Context, request DeleteEncryptionKeyRequest) error { - - requestPb, pbErr := deleteEncryptionKeyRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteResponsePb deleteResponsePb - path := fmt.Sprintf("/api/2.0/accounts/%v/customer-managed-keys/%v", a.client.ConfiguredAccountID(), requestPb.CustomerManagedKeyId) + var deleteResponse DeleteResponse + path := fmt.Sprintf("/api/2.0/accounts/%v/customer-managed-keys/%v", a.client.ConfiguredAccountID(), request.CustomerManagedKeyId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteResponse) return err } func (a *encryptionKeysImpl) Get(ctx context.Context, request GetEncryptionKeyRequest) (*CustomerManagedKey, error) { - - requestPb, pbErr := getEncryptionKeyRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var customerManagedKeyPb customerManagedKeyPb - path := fmt.Sprintf("/api/2.0/accounts/%v/customer-managed-keys/%v", a.client.ConfiguredAccountID(), requestPb.CustomerManagedKeyId) + var customerManagedKey CustomerManagedKey + path := fmt.Sprintf("/api/2.0/accounts/%v/customer-managed-keys/%v", a.client.ConfiguredAccountID(), request.CustomerManagedKeyId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &customerManagedKeyPb, - ) - if err != nil { - return nil, err - } - resp, err := customerManagedKeyFromPb(&customerManagedKeyPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &customerManagedKey) + return &customerManagedKey, err } func (a *encryptionKeysImpl) List(ctx context.Context) ([]CustomerManagedKey, error) { - - var customerManagedKeyListPb []customerManagedKeyPb + var customerManagedKeyList []CustomerManagedKey path := fmt.Sprintf("/api/2.0/accounts/%v/customer-managed-keys", a.client.ConfiguredAccountID()) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - nil, - nil, - &customerManagedKeyListPb, - ) - if err != nil { - return nil, err - } - var resp []CustomerManagedKey - for _, item := range customerManagedKeyListPb { - itemResp, err := customerManagedKeyFromPb(&item) - if err != nil { - return nil, err - } - resp = append(resp, *itemResp) - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, nil, nil, &customerManagedKeyList) + return customerManagedKeyList, err } // unexported type that holds implementations of just Networks API methods @@ -274,127 +108,44 @@ type networksImpl struct { } func (a *networksImpl) Create(ctx context.Context, request CreateNetworkRequest) (*Network, error) { - - requestPb, pbErr := createNetworkRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var networkPb networkPb + var network Network path := fmt.Sprintf("/api/2.0/accounts/%v/networks", a.client.ConfiguredAccountID()) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &networkPb, - ) - if err != nil { - return nil, err - } - resp, err := networkFromPb(&networkPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &network) + return &network, err } func (a *networksImpl) Delete(ctx context.Context, request DeleteNetworkRequest) error { - - requestPb, pbErr := deleteNetworkRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteResponsePb deleteResponsePb - path := fmt.Sprintf("/api/2.0/accounts/%v/networks/%v", a.client.ConfiguredAccountID(), requestPb.NetworkId) + var deleteResponse DeleteResponse + path := fmt.Sprintf("/api/2.0/accounts/%v/networks/%v", a.client.ConfiguredAccountID(), request.NetworkId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteResponse) return err } func (a *networksImpl) Get(ctx context.Context, request GetNetworkRequest) (*Network, error) { - - requestPb, pbErr := getNetworkRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var networkPb networkPb - path := fmt.Sprintf("/api/2.0/accounts/%v/networks/%v", a.client.ConfiguredAccountID(), requestPb.NetworkId) + var network Network + path := fmt.Sprintf("/api/2.0/accounts/%v/networks/%v", a.client.ConfiguredAccountID(), request.NetworkId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &networkPb, - ) - if err != nil { - return nil, err - } - resp, err := networkFromPb(&networkPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &network) + return &network, err } func (a *networksImpl) List(ctx context.Context) ([]Network, error) { - - var networkListPb []networkPb + var networkList []Network path := fmt.Sprintf("/api/2.0/accounts/%v/networks", a.client.ConfiguredAccountID()) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - nil, - nil, - &networkListPb, - ) - if err != nil { - return nil, err - } - var resp []Network - for _, item := range networkListPb { - itemResp, err := networkFromPb(&item) - if err != nil { - return nil, err - } - resp = append(resp, *itemResp) - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, nil, nil, &networkList) + return networkList, err } // unexported type that holds implementations of just PrivateAccess API methods @@ -403,155 +154,54 @@ type privateAccessImpl struct { } func (a *privateAccessImpl) Create(ctx context.Context, request UpsertPrivateAccessSettingsRequest) (*PrivateAccessSettings, error) { - - requestPb, pbErr := upsertPrivateAccessSettingsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var privateAccessSettingsPb privateAccessSettingsPb + var privateAccessSettings PrivateAccessSettings path := fmt.Sprintf("/api/2.0/accounts/%v/private-access-settings", a.client.ConfiguredAccountID()) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &privateAccessSettingsPb, - ) - if err != nil { - return nil, err - } - resp, err := privateAccessSettingsFromPb(&privateAccessSettingsPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &privateAccessSettings) + return &privateAccessSettings, err } func (a *privateAccessImpl) Delete(ctx context.Context, request DeletePrivateAccesRequest) error { - - requestPb, pbErr := deletePrivateAccesRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteResponsePb deleteResponsePb - path := fmt.Sprintf("/api/2.0/accounts/%v/private-access-settings/%v", a.client.ConfiguredAccountID(), requestPb.PrivateAccessSettingsId) + var deleteResponse DeleteResponse + path := fmt.Sprintf("/api/2.0/accounts/%v/private-access-settings/%v", a.client.ConfiguredAccountID(), request.PrivateAccessSettingsId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteResponse) return err } func (a *privateAccessImpl) Get(ctx context.Context, request GetPrivateAccesRequest) (*PrivateAccessSettings, error) { - - requestPb, pbErr := getPrivateAccesRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var privateAccessSettingsPb privateAccessSettingsPb - path := fmt.Sprintf("/api/2.0/accounts/%v/private-access-settings/%v", a.client.ConfiguredAccountID(), requestPb.PrivateAccessSettingsId) + var privateAccessSettings PrivateAccessSettings + path := fmt.Sprintf("/api/2.0/accounts/%v/private-access-settings/%v", a.client.ConfiguredAccountID(), request.PrivateAccessSettingsId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &privateAccessSettingsPb, - ) - if err != nil { - return nil, err - } - resp, err := privateAccessSettingsFromPb(&privateAccessSettingsPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &privateAccessSettings) + return &privateAccessSettings, err } func (a *privateAccessImpl) List(ctx context.Context) ([]PrivateAccessSettings, error) { - - var privateAccessSettingsListPb []privateAccessSettingsPb + var privateAccessSettingsList []PrivateAccessSettings path := fmt.Sprintf("/api/2.0/accounts/%v/private-access-settings", a.client.ConfiguredAccountID()) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - nil, - nil, - &privateAccessSettingsListPb, - ) - if err != nil { - return nil, err - } - var resp []PrivateAccessSettings - for _, item := range privateAccessSettingsListPb { - itemResp, err := privateAccessSettingsFromPb(&item) - if err != nil { - return nil, err - } - resp = append(resp, *itemResp) - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, nil, nil, &privateAccessSettingsList) + return privateAccessSettingsList, err } func (a *privateAccessImpl) Replace(ctx context.Context, request UpsertPrivateAccessSettingsRequest) error { - - requestPb, pbErr := upsertPrivateAccessSettingsRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var replaceResponsePb replaceResponsePb - path := fmt.Sprintf("/api/2.0/accounts/%v/private-access-settings/%v", a.client.ConfiguredAccountID(), requestPb.PrivateAccessSettingsId) + var replaceResponse ReplaceResponse + path := fmt.Sprintf("/api/2.0/accounts/%v/private-access-settings/%v", a.client.ConfiguredAccountID(), request.PrivateAccessSettingsId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPut, - path, - headers, - queryParams, - (*requestPb), - &replaceResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &replaceResponse) return err } @@ -561,127 +211,44 @@ type storageImpl struct { } func (a *storageImpl) Create(ctx context.Context, request CreateStorageConfigurationRequest) (*StorageConfiguration, error) { - - requestPb, pbErr := createStorageConfigurationRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var storageConfigurationPb storageConfigurationPb + var storageConfiguration StorageConfiguration path := fmt.Sprintf("/api/2.0/accounts/%v/storage-configurations", a.client.ConfiguredAccountID()) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &storageConfigurationPb, - ) - if err != nil { - return nil, err - } - resp, err := storageConfigurationFromPb(&storageConfigurationPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &storageConfiguration) + return &storageConfiguration, err } func (a *storageImpl) Delete(ctx context.Context, request DeleteStorageRequest) error { - - requestPb, pbErr := deleteStorageRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteResponsePb deleteResponsePb - path := fmt.Sprintf("/api/2.0/accounts/%v/storage-configurations/%v", a.client.ConfiguredAccountID(), requestPb.StorageConfigurationId) + var deleteResponse DeleteResponse + path := fmt.Sprintf("/api/2.0/accounts/%v/storage-configurations/%v", a.client.ConfiguredAccountID(), request.StorageConfigurationId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteResponse) return err } func (a *storageImpl) Get(ctx context.Context, request GetStorageRequest) (*StorageConfiguration, error) { - - requestPb, pbErr := getStorageRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var storageConfigurationPb storageConfigurationPb - path := fmt.Sprintf("/api/2.0/accounts/%v/storage-configurations/%v", a.client.ConfiguredAccountID(), requestPb.StorageConfigurationId) + var storageConfiguration StorageConfiguration + path := fmt.Sprintf("/api/2.0/accounts/%v/storage-configurations/%v", a.client.ConfiguredAccountID(), request.StorageConfigurationId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &storageConfigurationPb, - ) - if err != nil { - return nil, err - } - resp, err := storageConfigurationFromPb(&storageConfigurationPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &storageConfiguration) + return &storageConfiguration, err } func (a *storageImpl) List(ctx context.Context) ([]StorageConfiguration, error) { - - var storageConfigurationListPb []storageConfigurationPb + var storageConfigurationList []StorageConfiguration path := fmt.Sprintf("/api/2.0/accounts/%v/storage-configurations", a.client.ConfiguredAccountID()) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - nil, - nil, - &storageConfigurationListPb, - ) - if err != nil { - return nil, err - } - var resp []StorageConfiguration - for _, item := range storageConfigurationListPb { - itemResp, err := storageConfigurationFromPb(&item) - if err != nil { - return nil, err - } - resp = append(resp, *itemResp) - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, nil, nil, &storageConfigurationList) + return storageConfigurationList, err } // unexported type that holds implementations of just VpcEndpoints API methods @@ -690,127 +257,44 @@ type vpcEndpointsImpl struct { } func (a *vpcEndpointsImpl) Create(ctx context.Context, request CreateVpcEndpointRequest) (*VpcEndpoint, error) { - - requestPb, pbErr := createVpcEndpointRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var vpcEndpointPb vpcEndpointPb + var vpcEndpoint VpcEndpoint path := fmt.Sprintf("/api/2.0/accounts/%v/vpc-endpoints", a.client.ConfiguredAccountID()) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &vpcEndpointPb, - ) - if err != nil { - return nil, err - } - resp, err := vpcEndpointFromPb(&vpcEndpointPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &vpcEndpoint) + return &vpcEndpoint, err } func (a *vpcEndpointsImpl) Delete(ctx context.Context, request DeleteVpcEndpointRequest) error { - - requestPb, pbErr := deleteVpcEndpointRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteResponsePb deleteResponsePb - path := fmt.Sprintf("/api/2.0/accounts/%v/vpc-endpoints/%v", a.client.ConfiguredAccountID(), requestPb.VpcEndpointId) + var deleteResponse DeleteResponse + path := fmt.Sprintf("/api/2.0/accounts/%v/vpc-endpoints/%v", a.client.ConfiguredAccountID(), request.VpcEndpointId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteResponse) return err } func (a *vpcEndpointsImpl) Get(ctx context.Context, request GetVpcEndpointRequest) (*VpcEndpoint, error) { - - requestPb, pbErr := getVpcEndpointRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var vpcEndpointPb vpcEndpointPb - path := fmt.Sprintf("/api/2.0/accounts/%v/vpc-endpoints/%v", a.client.ConfiguredAccountID(), requestPb.VpcEndpointId) + var vpcEndpoint VpcEndpoint + path := fmt.Sprintf("/api/2.0/accounts/%v/vpc-endpoints/%v", a.client.ConfiguredAccountID(), request.VpcEndpointId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &vpcEndpointPb, - ) - if err != nil { - return nil, err - } - resp, err := vpcEndpointFromPb(&vpcEndpointPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &vpcEndpoint) + return &vpcEndpoint, err } func (a *vpcEndpointsImpl) List(ctx context.Context) ([]VpcEndpoint, error) { - - var vpcEndpointListPb []vpcEndpointPb + var vpcEndpointList []VpcEndpoint path := fmt.Sprintf("/api/2.0/accounts/%v/vpc-endpoints", a.client.ConfiguredAccountID()) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - nil, - nil, - &vpcEndpointListPb, - ) - if err != nil { - return nil, err - } - var resp []VpcEndpoint - for _, item := range vpcEndpointListPb { - itemResp, err := vpcEndpointFromPb(&item) - if err != nil { - return nil, err - } - resp = append(resp, *itemResp) - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, nil, nil, &vpcEndpointList) + return vpcEndpointList, err } // unexported type that holds implementations of just Workspaces API methods @@ -819,154 +303,53 @@ type workspacesImpl struct { } func (a *workspacesImpl) Create(ctx context.Context, request CreateWorkspaceRequest) (*Workspace, error) { - - requestPb, pbErr := createWorkspaceRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var workspacePb workspacePb + var workspace Workspace path := fmt.Sprintf("/api/2.0/accounts/%v/workspaces", a.client.ConfiguredAccountID()) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &workspacePb, - ) - if err != nil { - return nil, err - } - resp, err := workspaceFromPb(&workspacePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &workspace) + return &workspace, err } func (a *workspacesImpl) Delete(ctx context.Context, request DeleteWorkspaceRequest) error { - - requestPb, pbErr := deleteWorkspaceRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteResponsePb deleteResponsePb - path := fmt.Sprintf("/api/2.0/accounts/%v/workspaces/%v", a.client.ConfiguredAccountID(), requestPb.WorkspaceId) + var deleteResponse DeleteResponse + path := fmt.Sprintf("/api/2.0/accounts/%v/workspaces/%v", a.client.ConfiguredAccountID(), request.WorkspaceId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteResponse) return err } func (a *workspacesImpl) Get(ctx context.Context, request GetWorkspaceRequest) (*Workspace, error) { - - requestPb, pbErr := getWorkspaceRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var workspacePb workspacePb - path := fmt.Sprintf("/api/2.0/accounts/%v/workspaces/%v", a.client.ConfiguredAccountID(), requestPb.WorkspaceId) + var workspace Workspace + path := fmt.Sprintf("/api/2.0/accounts/%v/workspaces/%v", a.client.ConfiguredAccountID(), request.WorkspaceId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &workspacePb, - ) - if err != nil { - return nil, err - } - resp, err := workspaceFromPb(&workspacePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &workspace) + return &workspace, err } func (a *workspacesImpl) List(ctx context.Context) ([]Workspace, error) { - - var workspaceListPb []workspacePb + var workspaceList []Workspace path := fmt.Sprintf("/api/2.0/accounts/%v/workspaces", a.client.ConfiguredAccountID()) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - nil, - nil, - &workspaceListPb, - ) - if err != nil { - return nil, err - } - var resp []Workspace - for _, item := range workspaceListPb { - itemResp, err := workspaceFromPb(&item) - if err != nil { - return nil, err - } - resp = append(resp, *itemResp) - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, nil, nil, &workspaceList) + return workspaceList, err } func (a *workspacesImpl) Update(ctx context.Context, request UpdateWorkspaceRequest) error { - - requestPb, pbErr := updateWorkspaceRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var updateResponsePb updateResponsePb - path := fmt.Sprintf("/api/2.0/accounts/%v/workspaces/%v", a.client.ConfiguredAccountID(), requestPb.WorkspaceId) + var updateResponse UpdateResponse + path := fmt.Sprintf("/api/2.0/accounts/%v/workspaces/%v", a.client.ConfiguredAccountID(), request.WorkspaceId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &updateResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &updateResponse) return err } diff --git a/service/provisioning/internal.go b/service/provisioning/internal.go deleted file mode 100755 index 7521e9631..000000000 --- a/service/provisioning/internal.go +++ /dev/null @@ -1,1991 +0,0 @@ -// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. - -package provisioning - -import ( - "fmt" - "strings" - "time" - - "github.com/databricks/databricks-sdk-go/marshal" -) - -func awsCredentialsToPb(st *AwsCredentials) (*awsCredentialsPb, error) { - if st == nil { - return nil, nil - } - pb := &awsCredentialsPb{} - pb.StsRole = st.StsRole - - return pb, nil -} - -type awsCredentialsPb struct { - StsRole *StsRole `json:"sts_role,omitempty"` -} - -func awsCredentialsFromPb(pb *awsCredentialsPb) (*AwsCredentials, error) { - if pb == nil { - return nil, nil - } - st := &AwsCredentials{} - st.StsRole = pb.StsRole - - return st, nil -} - -func awsKeyInfoToPb(st *AwsKeyInfo) (*awsKeyInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &awsKeyInfoPb{} - pb.KeyAlias = st.KeyAlias - pb.KeyArn = st.KeyArn - pb.KeyRegion = st.KeyRegion - pb.ReuseKeyForClusterVolumes = st.ReuseKeyForClusterVolumes - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type awsKeyInfoPb struct { - KeyAlias string `json:"key_alias,omitempty"` - KeyArn string `json:"key_arn"` - KeyRegion string `json:"key_region"` - ReuseKeyForClusterVolumes bool `json:"reuse_key_for_cluster_volumes,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func awsKeyInfoFromPb(pb *awsKeyInfoPb) (*AwsKeyInfo, error) { - if pb == nil { - return nil, nil - } - st := &AwsKeyInfo{} - st.KeyAlias = pb.KeyAlias - st.KeyArn = pb.KeyArn - st.KeyRegion = pb.KeyRegion - st.ReuseKeyForClusterVolumes = pb.ReuseKeyForClusterVolumes - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *awsKeyInfoPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st awsKeyInfoPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func azureWorkspaceInfoToPb(st *AzureWorkspaceInfo) (*azureWorkspaceInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &azureWorkspaceInfoPb{} - pb.ResourceGroup = st.ResourceGroup - pb.SubscriptionId = st.SubscriptionId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type azureWorkspaceInfoPb struct { - ResourceGroup string `json:"resource_group,omitempty"` - SubscriptionId string `json:"subscription_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func azureWorkspaceInfoFromPb(pb *azureWorkspaceInfoPb) (*AzureWorkspaceInfo, error) { - if pb == nil { - return nil, nil - } - st := &AzureWorkspaceInfo{} - st.ResourceGroup = pb.ResourceGroup - st.SubscriptionId = pb.SubscriptionId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *azureWorkspaceInfoPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st azureWorkspaceInfoPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func cloudResourceContainerToPb(st *CloudResourceContainer) (*cloudResourceContainerPb, error) { - if st == nil { - return nil, nil - } - pb := &cloudResourceContainerPb{} - pb.Gcp = st.Gcp - - return pb, nil -} - -type cloudResourceContainerPb struct { - Gcp *CustomerFacingGcpCloudResourceContainer `json:"gcp,omitempty"` -} - -func cloudResourceContainerFromPb(pb *cloudResourceContainerPb) (*CloudResourceContainer, error) { - if pb == nil { - return nil, nil - } - st := &CloudResourceContainer{} - st.Gcp = pb.Gcp - - return st, nil -} - -func createAwsKeyInfoToPb(st *CreateAwsKeyInfo) (*createAwsKeyInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &createAwsKeyInfoPb{} - pb.KeyAlias = st.KeyAlias - pb.KeyArn = st.KeyArn - pb.ReuseKeyForClusterVolumes = st.ReuseKeyForClusterVolumes - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createAwsKeyInfoPb struct { - KeyAlias string `json:"key_alias,omitempty"` - KeyArn string `json:"key_arn"` - ReuseKeyForClusterVolumes bool `json:"reuse_key_for_cluster_volumes,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createAwsKeyInfoFromPb(pb *createAwsKeyInfoPb) (*CreateAwsKeyInfo, error) { - if pb == nil { - return nil, nil - } - st := &CreateAwsKeyInfo{} - st.KeyAlias = pb.KeyAlias - st.KeyArn = pb.KeyArn - st.ReuseKeyForClusterVolumes = pb.ReuseKeyForClusterVolumes - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createAwsKeyInfoPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createAwsKeyInfoPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createCredentialAwsCredentialsToPb(st *CreateCredentialAwsCredentials) (*createCredentialAwsCredentialsPb, error) { - if st == nil { - return nil, nil - } - pb := &createCredentialAwsCredentialsPb{} - pb.StsRole = st.StsRole - - return pb, nil -} - -type createCredentialAwsCredentialsPb struct { - StsRole *CreateCredentialStsRole `json:"sts_role,omitempty"` -} - -func createCredentialAwsCredentialsFromPb(pb *createCredentialAwsCredentialsPb) (*CreateCredentialAwsCredentials, error) { - if pb == nil { - return nil, nil - } - st := &CreateCredentialAwsCredentials{} - st.StsRole = pb.StsRole - - return st, nil -} - -func createCredentialRequestToPb(st *CreateCredentialRequest) (*createCredentialRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &createCredentialRequestPb{} - pb.AwsCredentials = st.AwsCredentials - pb.CredentialsName = st.CredentialsName - - return pb, nil -} - -type createCredentialRequestPb struct { - AwsCredentials CreateCredentialAwsCredentials `json:"aws_credentials"` - CredentialsName string `json:"credentials_name"` -} - -func createCredentialRequestFromPb(pb *createCredentialRequestPb) (*CreateCredentialRequest, error) { - if pb == nil { - return nil, nil - } - st := &CreateCredentialRequest{} - st.AwsCredentials = pb.AwsCredentials - st.CredentialsName = pb.CredentialsName - - return st, nil -} - -func createCredentialStsRoleToPb(st *CreateCredentialStsRole) (*createCredentialStsRolePb, error) { - if st == nil { - return nil, nil - } - pb := &createCredentialStsRolePb{} - pb.RoleArn = st.RoleArn - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createCredentialStsRolePb struct { - RoleArn string `json:"role_arn,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createCredentialStsRoleFromPb(pb *createCredentialStsRolePb) (*CreateCredentialStsRole, error) { - if pb == nil { - return nil, nil - } - st := &CreateCredentialStsRole{} - st.RoleArn = pb.RoleArn - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createCredentialStsRolePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createCredentialStsRolePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createCustomerManagedKeyRequestToPb(st *CreateCustomerManagedKeyRequest) (*createCustomerManagedKeyRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &createCustomerManagedKeyRequestPb{} - pb.AwsKeyInfo = st.AwsKeyInfo - pb.GcpKeyInfo = st.GcpKeyInfo - pb.UseCases = st.UseCases - - return pb, nil -} - -type createCustomerManagedKeyRequestPb struct { - AwsKeyInfo *CreateAwsKeyInfo `json:"aws_key_info,omitempty"` - GcpKeyInfo *CreateGcpKeyInfo `json:"gcp_key_info,omitempty"` - UseCases []KeyUseCase `json:"use_cases"` -} - -func createCustomerManagedKeyRequestFromPb(pb *createCustomerManagedKeyRequestPb) (*CreateCustomerManagedKeyRequest, error) { - if pb == nil { - return nil, nil - } - st := &CreateCustomerManagedKeyRequest{} - st.AwsKeyInfo = pb.AwsKeyInfo - st.GcpKeyInfo = pb.GcpKeyInfo - st.UseCases = pb.UseCases - - return st, nil -} - -func createGcpKeyInfoToPb(st *CreateGcpKeyInfo) (*createGcpKeyInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &createGcpKeyInfoPb{} - pb.KmsKeyId = st.KmsKeyId - - return pb, nil -} - -type createGcpKeyInfoPb struct { - KmsKeyId string `json:"kms_key_id"` -} - -func createGcpKeyInfoFromPb(pb *createGcpKeyInfoPb) (*CreateGcpKeyInfo, error) { - if pb == nil { - return nil, nil - } - st := &CreateGcpKeyInfo{} - st.KmsKeyId = pb.KmsKeyId - - return st, nil -} - -func createNetworkRequestToPb(st *CreateNetworkRequest) (*createNetworkRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &createNetworkRequestPb{} - pb.GcpNetworkInfo = st.GcpNetworkInfo - pb.NetworkName = st.NetworkName - pb.SecurityGroupIds = st.SecurityGroupIds - pb.SubnetIds = st.SubnetIds - pb.VpcEndpoints = st.VpcEndpoints - pb.VpcId = st.VpcId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createNetworkRequestPb struct { - GcpNetworkInfo *GcpNetworkInfo `json:"gcp_network_info,omitempty"` - NetworkName string `json:"network_name"` - SecurityGroupIds []string `json:"security_group_ids,omitempty"` - SubnetIds []string `json:"subnet_ids,omitempty"` - VpcEndpoints *NetworkVpcEndpoints `json:"vpc_endpoints,omitempty"` - VpcId string `json:"vpc_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createNetworkRequestFromPb(pb *createNetworkRequestPb) (*CreateNetworkRequest, error) { - if pb == nil { - return nil, nil - } - st := &CreateNetworkRequest{} - st.GcpNetworkInfo = pb.GcpNetworkInfo - st.NetworkName = pb.NetworkName - st.SecurityGroupIds = pb.SecurityGroupIds - st.SubnetIds = pb.SubnetIds - st.VpcEndpoints = pb.VpcEndpoints - st.VpcId = pb.VpcId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createNetworkRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createNetworkRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createStorageConfigurationRequestToPb(st *CreateStorageConfigurationRequest) (*createStorageConfigurationRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &createStorageConfigurationRequestPb{} - pb.RootBucketInfo = st.RootBucketInfo - pb.StorageConfigurationName = st.StorageConfigurationName - - return pb, nil -} - -type createStorageConfigurationRequestPb struct { - RootBucketInfo RootBucketInfo `json:"root_bucket_info"` - StorageConfigurationName string `json:"storage_configuration_name"` -} - -func createStorageConfigurationRequestFromPb(pb *createStorageConfigurationRequestPb) (*CreateStorageConfigurationRequest, error) { - if pb == nil { - return nil, nil - } - st := &CreateStorageConfigurationRequest{} - st.RootBucketInfo = pb.RootBucketInfo - st.StorageConfigurationName = pb.StorageConfigurationName - - return st, nil -} - -func createVpcEndpointRequestToPb(st *CreateVpcEndpointRequest) (*createVpcEndpointRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &createVpcEndpointRequestPb{} - pb.AwsVpcEndpointId = st.AwsVpcEndpointId - pb.GcpVpcEndpointInfo = st.GcpVpcEndpointInfo - pb.Region = st.Region - pb.VpcEndpointName = st.VpcEndpointName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createVpcEndpointRequestPb struct { - AwsVpcEndpointId string `json:"aws_vpc_endpoint_id,omitempty"` - GcpVpcEndpointInfo *GcpVpcEndpointInfo `json:"gcp_vpc_endpoint_info,omitempty"` - Region string `json:"region,omitempty"` - VpcEndpointName string `json:"vpc_endpoint_name"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createVpcEndpointRequestFromPb(pb *createVpcEndpointRequestPb) (*CreateVpcEndpointRequest, error) { - if pb == nil { - return nil, nil - } - st := &CreateVpcEndpointRequest{} - st.AwsVpcEndpointId = pb.AwsVpcEndpointId - st.GcpVpcEndpointInfo = pb.GcpVpcEndpointInfo - st.Region = pb.Region - st.VpcEndpointName = pb.VpcEndpointName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createVpcEndpointRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createVpcEndpointRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createWorkspaceRequestToPb(st *CreateWorkspaceRequest) (*createWorkspaceRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &createWorkspaceRequestPb{} - pb.AwsRegion = st.AwsRegion - pb.Cloud = st.Cloud - pb.CloudResourceContainer = st.CloudResourceContainer - pb.CredentialsId = st.CredentialsId - pb.CustomTags = st.CustomTags - pb.DeploymentName = st.DeploymentName - pb.GcpManagedNetworkConfig = st.GcpManagedNetworkConfig - pb.GkeConfig = st.GkeConfig - pb.IsNoPublicIpEnabled = st.IsNoPublicIpEnabled - pb.Location = st.Location - pb.ManagedServicesCustomerManagedKeyId = st.ManagedServicesCustomerManagedKeyId - pb.NetworkId = st.NetworkId - pb.PricingTier = st.PricingTier - pb.PrivateAccessSettingsId = st.PrivateAccessSettingsId - pb.StorageConfigurationId = st.StorageConfigurationId - pb.StorageCustomerManagedKeyId = st.StorageCustomerManagedKeyId - pb.WorkspaceName = st.WorkspaceName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createWorkspaceRequestPb struct { - AwsRegion string `json:"aws_region,omitempty"` - Cloud string `json:"cloud,omitempty"` - CloudResourceContainer *CloudResourceContainer `json:"cloud_resource_container,omitempty"` - CredentialsId string `json:"credentials_id,omitempty"` - CustomTags map[string]string `json:"custom_tags,omitempty"` - DeploymentName string `json:"deployment_name,omitempty"` - GcpManagedNetworkConfig *GcpManagedNetworkConfig `json:"gcp_managed_network_config,omitempty"` - GkeConfig *GkeConfig `json:"gke_config,omitempty"` - IsNoPublicIpEnabled bool `json:"is_no_public_ip_enabled,omitempty"` - Location string `json:"location,omitempty"` - ManagedServicesCustomerManagedKeyId string `json:"managed_services_customer_managed_key_id,omitempty"` - NetworkId string `json:"network_id,omitempty"` - PricingTier PricingTier `json:"pricing_tier,omitempty"` - PrivateAccessSettingsId string `json:"private_access_settings_id,omitempty"` - StorageConfigurationId string `json:"storage_configuration_id,omitempty"` - StorageCustomerManagedKeyId string `json:"storage_customer_managed_key_id,omitempty"` - WorkspaceName string `json:"workspace_name"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createWorkspaceRequestFromPb(pb *createWorkspaceRequestPb) (*CreateWorkspaceRequest, error) { - if pb == nil { - return nil, nil - } - st := &CreateWorkspaceRequest{} - st.AwsRegion = pb.AwsRegion - st.Cloud = pb.Cloud - st.CloudResourceContainer = pb.CloudResourceContainer - st.CredentialsId = pb.CredentialsId - st.CustomTags = pb.CustomTags - st.DeploymentName = pb.DeploymentName - st.GcpManagedNetworkConfig = pb.GcpManagedNetworkConfig - st.GkeConfig = pb.GkeConfig - st.IsNoPublicIpEnabled = pb.IsNoPublicIpEnabled - st.Location = pb.Location - st.ManagedServicesCustomerManagedKeyId = pb.ManagedServicesCustomerManagedKeyId - st.NetworkId = pb.NetworkId - st.PricingTier = pb.PricingTier - st.PrivateAccessSettingsId = pb.PrivateAccessSettingsId - st.StorageConfigurationId = pb.StorageConfigurationId - st.StorageCustomerManagedKeyId = pb.StorageCustomerManagedKeyId - st.WorkspaceName = pb.WorkspaceName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createWorkspaceRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createWorkspaceRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func credentialToPb(st *Credential) (*credentialPb, error) { - if st == nil { - return nil, nil - } - pb := &credentialPb{} - pb.AccountId = st.AccountId - pb.AwsCredentials = st.AwsCredentials - pb.CreationTime = st.CreationTime - pb.CredentialsId = st.CredentialsId - pb.CredentialsName = st.CredentialsName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type credentialPb struct { - AccountId string `json:"account_id,omitempty"` - AwsCredentials *AwsCredentials `json:"aws_credentials,omitempty"` - CreationTime int64 `json:"creation_time,omitempty"` - CredentialsId string `json:"credentials_id,omitempty"` - CredentialsName string `json:"credentials_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func credentialFromPb(pb *credentialPb) (*Credential, error) { - if pb == nil { - return nil, nil - } - st := &Credential{} - st.AccountId = pb.AccountId - st.AwsCredentials = pb.AwsCredentials - st.CreationTime = pb.CreationTime - st.CredentialsId = pb.CredentialsId - st.CredentialsName = pb.CredentialsName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *credentialPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st credentialPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func customerFacingGcpCloudResourceContainerToPb(st *CustomerFacingGcpCloudResourceContainer) (*customerFacingGcpCloudResourceContainerPb, error) { - if st == nil { - return nil, nil - } - pb := &customerFacingGcpCloudResourceContainerPb{} - pb.ProjectId = st.ProjectId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type customerFacingGcpCloudResourceContainerPb struct { - ProjectId string `json:"project_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func customerFacingGcpCloudResourceContainerFromPb(pb *customerFacingGcpCloudResourceContainerPb) (*CustomerFacingGcpCloudResourceContainer, error) { - if pb == nil { - return nil, nil - } - st := &CustomerFacingGcpCloudResourceContainer{} - st.ProjectId = pb.ProjectId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *customerFacingGcpCloudResourceContainerPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st customerFacingGcpCloudResourceContainerPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func customerManagedKeyToPb(st *CustomerManagedKey) (*customerManagedKeyPb, error) { - if st == nil { - return nil, nil - } - pb := &customerManagedKeyPb{} - pb.AccountId = st.AccountId - pb.AwsKeyInfo = st.AwsKeyInfo - pb.CreationTime = st.CreationTime - pb.CustomerManagedKeyId = st.CustomerManagedKeyId - pb.GcpKeyInfo = st.GcpKeyInfo - pb.UseCases = st.UseCases - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type customerManagedKeyPb struct { - AccountId string `json:"account_id,omitempty"` - AwsKeyInfo *AwsKeyInfo `json:"aws_key_info,omitempty"` - CreationTime int64 `json:"creation_time,omitempty"` - CustomerManagedKeyId string `json:"customer_managed_key_id,omitempty"` - GcpKeyInfo *GcpKeyInfo `json:"gcp_key_info,omitempty"` - UseCases []KeyUseCase `json:"use_cases,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func customerManagedKeyFromPb(pb *customerManagedKeyPb) (*CustomerManagedKey, error) { - if pb == nil { - return nil, nil - } - st := &CustomerManagedKey{} - st.AccountId = pb.AccountId - st.AwsKeyInfo = pb.AwsKeyInfo - st.CreationTime = pb.CreationTime - st.CustomerManagedKeyId = pb.CustomerManagedKeyId - st.GcpKeyInfo = pb.GcpKeyInfo - st.UseCases = pb.UseCases - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *customerManagedKeyPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st customerManagedKeyPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func deleteCredentialRequestToPb(st *DeleteCredentialRequest) (*deleteCredentialRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteCredentialRequestPb{} - pb.CredentialsId = st.CredentialsId - - return pb, nil -} - -type deleteCredentialRequestPb struct { - CredentialsId string `json:"-" url:"-"` -} - -func deleteCredentialRequestFromPb(pb *deleteCredentialRequestPb) (*DeleteCredentialRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteCredentialRequest{} - st.CredentialsId = pb.CredentialsId - - return st, nil -} - -func deleteEncryptionKeyRequestToPb(st *DeleteEncryptionKeyRequest) (*deleteEncryptionKeyRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteEncryptionKeyRequestPb{} - pb.CustomerManagedKeyId = st.CustomerManagedKeyId - - return pb, nil -} - -type deleteEncryptionKeyRequestPb struct { - CustomerManagedKeyId string `json:"-" url:"-"` -} - -func deleteEncryptionKeyRequestFromPb(pb *deleteEncryptionKeyRequestPb) (*DeleteEncryptionKeyRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteEncryptionKeyRequest{} - st.CustomerManagedKeyId = pb.CustomerManagedKeyId - - return st, nil -} - -func deleteNetworkRequestToPb(st *DeleteNetworkRequest) (*deleteNetworkRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteNetworkRequestPb{} - pb.NetworkId = st.NetworkId - - return pb, nil -} - -type deleteNetworkRequestPb struct { - NetworkId string `json:"-" url:"-"` -} - -func deleteNetworkRequestFromPb(pb *deleteNetworkRequestPb) (*DeleteNetworkRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteNetworkRequest{} - st.NetworkId = pb.NetworkId - - return st, nil -} - -func deletePrivateAccesRequestToPb(st *DeletePrivateAccesRequest) (*deletePrivateAccesRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deletePrivateAccesRequestPb{} - pb.PrivateAccessSettingsId = st.PrivateAccessSettingsId - - return pb, nil -} - -type deletePrivateAccesRequestPb struct { - PrivateAccessSettingsId string `json:"-" url:"-"` -} - -func deletePrivateAccesRequestFromPb(pb *deletePrivateAccesRequestPb) (*DeletePrivateAccesRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeletePrivateAccesRequest{} - st.PrivateAccessSettingsId = pb.PrivateAccessSettingsId - - return st, nil -} - -func deleteResponseToPb(st *DeleteResponse) (*deleteResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteResponsePb{} - - return pb, nil -} - -type deleteResponsePb struct { -} - -func deleteResponseFromPb(pb *deleteResponsePb) (*DeleteResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteResponse{} - - return st, nil -} - -func deleteStorageRequestToPb(st *DeleteStorageRequest) (*deleteStorageRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteStorageRequestPb{} - pb.StorageConfigurationId = st.StorageConfigurationId - - return pb, nil -} - -type deleteStorageRequestPb struct { - StorageConfigurationId string `json:"-" url:"-"` -} - -func deleteStorageRequestFromPb(pb *deleteStorageRequestPb) (*DeleteStorageRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteStorageRequest{} - st.StorageConfigurationId = pb.StorageConfigurationId - - return st, nil -} - -func deleteVpcEndpointRequestToPb(st *DeleteVpcEndpointRequest) (*deleteVpcEndpointRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteVpcEndpointRequestPb{} - pb.VpcEndpointId = st.VpcEndpointId - - return pb, nil -} - -type deleteVpcEndpointRequestPb struct { - VpcEndpointId string `json:"-" url:"-"` -} - -func deleteVpcEndpointRequestFromPb(pb *deleteVpcEndpointRequestPb) (*DeleteVpcEndpointRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteVpcEndpointRequest{} - st.VpcEndpointId = pb.VpcEndpointId - - return st, nil -} - -func deleteWorkspaceRequestToPb(st *DeleteWorkspaceRequest) (*deleteWorkspaceRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteWorkspaceRequestPb{} - pb.WorkspaceId = st.WorkspaceId - - return pb, nil -} - -type deleteWorkspaceRequestPb struct { - WorkspaceId int64 `json:"-" url:"-"` -} - -func deleteWorkspaceRequestFromPb(pb *deleteWorkspaceRequestPb) (*DeleteWorkspaceRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteWorkspaceRequest{} - st.WorkspaceId = pb.WorkspaceId - - return st, nil -} - -func externalCustomerInfoToPb(st *ExternalCustomerInfo) (*externalCustomerInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &externalCustomerInfoPb{} - pb.AuthoritativeUserEmail = st.AuthoritativeUserEmail - pb.AuthoritativeUserFullName = st.AuthoritativeUserFullName - pb.CustomerName = st.CustomerName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type externalCustomerInfoPb struct { - AuthoritativeUserEmail string `json:"authoritative_user_email,omitempty"` - AuthoritativeUserFullName string `json:"authoritative_user_full_name,omitempty"` - CustomerName string `json:"customer_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func externalCustomerInfoFromPb(pb *externalCustomerInfoPb) (*ExternalCustomerInfo, error) { - if pb == nil { - return nil, nil - } - st := &ExternalCustomerInfo{} - st.AuthoritativeUserEmail = pb.AuthoritativeUserEmail - st.AuthoritativeUserFullName = pb.AuthoritativeUserFullName - st.CustomerName = pb.CustomerName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *externalCustomerInfoPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st externalCustomerInfoPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func gcpKeyInfoToPb(st *GcpKeyInfo) (*gcpKeyInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &gcpKeyInfoPb{} - pb.KmsKeyId = st.KmsKeyId - - return pb, nil -} - -type gcpKeyInfoPb struct { - KmsKeyId string `json:"kms_key_id"` -} - -func gcpKeyInfoFromPb(pb *gcpKeyInfoPb) (*GcpKeyInfo, error) { - if pb == nil { - return nil, nil - } - st := &GcpKeyInfo{} - st.KmsKeyId = pb.KmsKeyId - - return st, nil -} - -func gcpManagedNetworkConfigToPb(st *GcpManagedNetworkConfig) (*gcpManagedNetworkConfigPb, error) { - if st == nil { - return nil, nil - } - pb := &gcpManagedNetworkConfigPb{} - pb.GkeClusterPodIpRange = st.GkeClusterPodIpRange - pb.GkeClusterServiceIpRange = st.GkeClusterServiceIpRange - pb.SubnetCidr = st.SubnetCidr - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type gcpManagedNetworkConfigPb struct { - GkeClusterPodIpRange string `json:"gke_cluster_pod_ip_range,omitempty"` - GkeClusterServiceIpRange string `json:"gke_cluster_service_ip_range,omitempty"` - SubnetCidr string `json:"subnet_cidr,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func gcpManagedNetworkConfigFromPb(pb *gcpManagedNetworkConfigPb) (*GcpManagedNetworkConfig, error) { - if pb == nil { - return nil, nil - } - st := &GcpManagedNetworkConfig{} - st.GkeClusterPodIpRange = pb.GkeClusterPodIpRange - st.GkeClusterServiceIpRange = pb.GkeClusterServiceIpRange - st.SubnetCidr = pb.SubnetCidr - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *gcpManagedNetworkConfigPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st gcpManagedNetworkConfigPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func gcpNetworkInfoToPb(st *GcpNetworkInfo) (*gcpNetworkInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &gcpNetworkInfoPb{} - pb.NetworkProjectId = st.NetworkProjectId - pb.PodIpRangeName = st.PodIpRangeName - pb.ServiceIpRangeName = st.ServiceIpRangeName - pb.SubnetId = st.SubnetId - pb.SubnetRegion = st.SubnetRegion - pb.VpcId = st.VpcId - - return pb, nil -} - -type gcpNetworkInfoPb struct { - NetworkProjectId string `json:"network_project_id"` - PodIpRangeName string `json:"pod_ip_range_name"` - ServiceIpRangeName string `json:"service_ip_range_name"` - SubnetId string `json:"subnet_id"` - SubnetRegion string `json:"subnet_region"` - VpcId string `json:"vpc_id"` -} - -func gcpNetworkInfoFromPb(pb *gcpNetworkInfoPb) (*GcpNetworkInfo, error) { - if pb == nil { - return nil, nil - } - st := &GcpNetworkInfo{} - st.NetworkProjectId = pb.NetworkProjectId - st.PodIpRangeName = pb.PodIpRangeName - st.ServiceIpRangeName = pb.ServiceIpRangeName - st.SubnetId = pb.SubnetId - st.SubnetRegion = pb.SubnetRegion - st.VpcId = pb.VpcId - - return st, nil -} - -func gcpVpcEndpointInfoToPb(st *GcpVpcEndpointInfo) (*gcpVpcEndpointInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &gcpVpcEndpointInfoPb{} - pb.EndpointRegion = st.EndpointRegion - pb.ProjectId = st.ProjectId - pb.PscConnectionId = st.PscConnectionId - pb.PscEndpointName = st.PscEndpointName - pb.ServiceAttachmentId = st.ServiceAttachmentId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type gcpVpcEndpointInfoPb struct { - EndpointRegion string `json:"endpoint_region"` - ProjectId string `json:"project_id"` - PscConnectionId string `json:"psc_connection_id,omitempty"` - PscEndpointName string `json:"psc_endpoint_name"` - ServiceAttachmentId string `json:"service_attachment_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func gcpVpcEndpointInfoFromPb(pb *gcpVpcEndpointInfoPb) (*GcpVpcEndpointInfo, error) { - if pb == nil { - return nil, nil - } - st := &GcpVpcEndpointInfo{} - st.EndpointRegion = pb.EndpointRegion - st.ProjectId = pb.ProjectId - st.PscConnectionId = pb.PscConnectionId - st.PscEndpointName = pb.PscEndpointName - st.ServiceAttachmentId = pb.ServiceAttachmentId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *gcpVpcEndpointInfoPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st gcpVpcEndpointInfoPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getCredentialRequestToPb(st *GetCredentialRequest) (*getCredentialRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getCredentialRequestPb{} - pb.CredentialsId = st.CredentialsId - - return pb, nil -} - -type getCredentialRequestPb struct { - CredentialsId string `json:"-" url:"-"` -} - -func getCredentialRequestFromPb(pb *getCredentialRequestPb) (*GetCredentialRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetCredentialRequest{} - st.CredentialsId = pb.CredentialsId - - return st, nil -} - -func getEncryptionKeyRequestToPb(st *GetEncryptionKeyRequest) (*getEncryptionKeyRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getEncryptionKeyRequestPb{} - pb.CustomerManagedKeyId = st.CustomerManagedKeyId - - return pb, nil -} - -type getEncryptionKeyRequestPb struct { - CustomerManagedKeyId string `json:"-" url:"-"` -} - -func getEncryptionKeyRequestFromPb(pb *getEncryptionKeyRequestPb) (*GetEncryptionKeyRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetEncryptionKeyRequest{} - st.CustomerManagedKeyId = pb.CustomerManagedKeyId - - return st, nil -} - -func getNetworkRequestToPb(st *GetNetworkRequest) (*getNetworkRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getNetworkRequestPb{} - pb.NetworkId = st.NetworkId - - return pb, nil -} - -type getNetworkRequestPb struct { - NetworkId string `json:"-" url:"-"` -} - -func getNetworkRequestFromPb(pb *getNetworkRequestPb) (*GetNetworkRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetNetworkRequest{} - st.NetworkId = pb.NetworkId - - return st, nil -} - -func getPrivateAccesRequestToPb(st *GetPrivateAccesRequest) (*getPrivateAccesRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getPrivateAccesRequestPb{} - pb.PrivateAccessSettingsId = st.PrivateAccessSettingsId - - return pb, nil -} - -type getPrivateAccesRequestPb struct { - PrivateAccessSettingsId string `json:"-" url:"-"` -} - -func getPrivateAccesRequestFromPb(pb *getPrivateAccesRequestPb) (*GetPrivateAccesRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetPrivateAccesRequest{} - st.PrivateAccessSettingsId = pb.PrivateAccessSettingsId - - return st, nil -} - -func getStorageRequestToPb(st *GetStorageRequest) (*getStorageRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getStorageRequestPb{} - pb.StorageConfigurationId = st.StorageConfigurationId - - return pb, nil -} - -type getStorageRequestPb struct { - StorageConfigurationId string `json:"-" url:"-"` -} - -func getStorageRequestFromPb(pb *getStorageRequestPb) (*GetStorageRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetStorageRequest{} - st.StorageConfigurationId = pb.StorageConfigurationId - - return st, nil -} - -func getVpcEndpointRequestToPb(st *GetVpcEndpointRequest) (*getVpcEndpointRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getVpcEndpointRequestPb{} - pb.VpcEndpointId = st.VpcEndpointId - - return pb, nil -} - -type getVpcEndpointRequestPb struct { - VpcEndpointId string `json:"-" url:"-"` -} - -func getVpcEndpointRequestFromPb(pb *getVpcEndpointRequestPb) (*GetVpcEndpointRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetVpcEndpointRequest{} - st.VpcEndpointId = pb.VpcEndpointId - - return st, nil -} - -func getWorkspaceRequestToPb(st *GetWorkspaceRequest) (*getWorkspaceRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getWorkspaceRequestPb{} - pb.WorkspaceId = st.WorkspaceId - - return pb, nil -} - -type getWorkspaceRequestPb struct { - WorkspaceId int64 `json:"-" url:"-"` -} - -func getWorkspaceRequestFromPb(pb *getWorkspaceRequestPb) (*GetWorkspaceRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetWorkspaceRequest{} - st.WorkspaceId = pb.WorkspaceId - - return st, nil -} - -func gkeConfigToPb(st *GkeConfig) (*gkeConfigPb, error) { - if st == nil { - return nil, nil - } - pb := &gkeConfigPb{} - pb.ConnectivityType = st.ConnectivityType - pb.MasterIpRange = st.MasterIpRange - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type gkeConfigPb struct { - ConnectivityType GkeConfigConnectivityType `json:"connectivity_type,omitempty"` - MasterIpRange string `json:"master_ip_range,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func gkeConfigFromPb(pb *gkeConfigPb) (*GkeConfig, error) { - if pb == nil { - return nil, nil - } - st := &GkeConfig{} - st.ConnectivityType = pb.ConnectivityType - st.MasterIpRange = pb.MasterIpRange - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *gkeConfigPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st gkeConfigPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func networkToPb(st *Network) (*networkPb, error) { - if st == nil { - return nil, nil - } - pb := &networkPb{} - pb.AccountId = st.AccountId - pb.CreationTime = st.CreationTime - pb.ErrorMessages = st.ErrorMessages - pb.GcpNetworkInfo = st.GcpNetworkInfo - pb.NetworkId = st.NetworkId - pb.NetworkName = st.NetworkName - pb.SecurityGroupIds = st.SecurityGroupIds - pb.SubnetIds = st.SubnetIds - pb.VpcEndpoints = st.VpcEndpoints - pb.VpcId = st.VpcId - pb.VpcStatus = st.VpcStatus - pb.WarningMessages = st.WarningMessages - pb.WorkspaceId = st.WorkspaceId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type networkPb struct { - AccountId string `json:"account_id,omitempty"` - CreationTime int64 `json:"creation_time,omitempty"` - ErrorMessages []NetworkHealth `json:"error_messages,omitempty"` - GcpNetworkInfo *GcpNetworkInfo `json:"gcp_network_info,omitempty"` - NetworkId string `json:"network_id,omitempty"` - NetworkName string `json:"network_name,omitempty"` - SecurityGroupIds []string `json:"security_group_ids,omitempty"` - SubnetIds []string `json:"subnet_ids,omitempty"` - VpcEndpoints *NetworkVpcEndpoints `json:"vpc_endpoints,omitempty"` - VpcId string `json:"vpc_id,omitempty"` - VpcStatus VpcStatus `json:"vpc_status,omitempty"` - WarningMessages []NetworkWarning `json:"warning_messages,omitempty"` - WorkspaceId int64 `json:"workspace_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func networkFromPb(pb *networkPb) (*Network, error) { - if pb == nil { - return nil, nil - } - st := &Network{} - st.AccountId = pb.AccountId - st.CreationTime = pb.CreationTime - st.ErrorMessages = pb.ErrorMessages - st.GcpNetworkInfo = pb.GcpNetworkInfo - st.NetworkId = pb.NetworkId - st.NetworkName = pb.NetworkName - st.SecurityGroupIds = pb.SecurityGroupIds - st.SubnetIds = pb.SubnetIds - st.VpcEndpoints = pb.VpcEndpoints - st.VpcId = pb.VpcId - st.VpcStatus = pb.VpcStatus - st.WarningMessages = pb.WarningMessages - st.WorkspaceId = pb.WorkspaceId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *networkPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st networkPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func networkHealthToPb(st *NetworkHealth) (*networkHealthPb, error) { - if st == nil { - return nil, nil - } - pb := &networkHealthPb{} - pb.ErrorMessage = st.ErrorMessage - pb.ErrorType = st.ErrorType - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type networkHealthPb struct { - ErrorMessage string `json:"error_message,omitempty"` - ErrorType ErrorType `json:"error_type,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func networkHealthFromPb(pb *networkHealthPb) (*NetworkHealth, error) { - if pb == nil { - return nil, nil - } - st := &NetworkHealth{} - st.ErrorMessage = pb.ErrorMessage - st.ErrorType = pb.ErrorType - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *networkHealthPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st networkHealthPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func networkVpcEndpointsToPb(st *NetworkVpcEndpoints) (*networkVpcEndpointsPb, error) { - if st == nil { - return nil, nil - } - pb := &networkVpcEndpointsPb{} - pb.DataplaneRelay = st.DataplaneRelay - pb.RestApi = st.RestApi - - return pb, nil -} - -type networkVpcEndpointsPb struct { - DataplaneRelay []string `json:"dataplane_relay"` - RestApi []string `json:"rest_api"` -} - -func networkVpcEndpointsFromPb(pb *networkVpcEndpointsPb) (*NetworkVpcEndpoints, error) { - if pb == nil { - return nil, nil - } - st := &NetworkVpcEndpoints{} - st.DataplaneRelay = pb.DataplaneRelay - st.RestApi = pb.RestApi - - return st, nil -} - -func networkWarningToPb(st *NetworkWarning) (*networkWarningPb, error) { - if st == nil { - return nil, nil - } - pb := &networkWarningPb{} - pb.WarningMessage = st.WarningMessage - pb.WarningType = st.WarningType - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type networkWarningPb struct { - WarningMessage string `json:"warning_message,omitempty"` - WarningType WarningType `json:"warning_type,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func networkWarningFromPb(pb *networkWarningPb) (*NetworkWarning, error) { - if pb == nil { - return nil, nil - } - st := &NetworkWarning{} - st.WarningMessage = pb.WarningMessage - st.WarningType = pb.WarningType - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *networkWarningPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st networkWarningPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func privateAccessSettingsToPb(st *PrivateAccessSettings) (*privateAccessSettingsPb, error) { - if st == nil { - return nil, nil - } - pb := &privateAccessSettingsPb{} - pb.AccountId = st.AccountId - pb.AllowedVpcEndpointIds = st.AllowedVpcEndpointIds - pb.PrivateAccessLevel = st.PrivateAccessLevel - pb.PrivateAccessSettingsId = st.PrivateAccessSettingsId - pb.PrivateAccessSettingsName = st.PrivateAccessSettingsName - pb.PublicAccessEnabled = st.PublicAccessEnabled - pb.Region = st.Region - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type privateAccessSettingsPb struct { - AccountId string `json:"account_id,omitempty"` - AllowedVpcEndpointIds []string `json:"allowed_vpc_endpoint_ids,omitempty"` - PrivateAccessLevel PrivateAccessLevel `json:"private_access_level,omitempty"` - PrivateAccessSettingsId string `json:"private_access_settings_id,omitempty"` - PrivateAccessSettingsName string `json:"private_access_settings_name,omitempty"` - PublicAccessEnabled bool `json:"public_access_enabled,omitempty"` - Region string `json:"region,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func privateAccessSettingsFromPb(pb *privateAccessSettingsPb) (*PrivateAccessSettings, error) { - if pb == nil { - return nil, nil - } - st := &PrivateAccessSettings{} - st.AccountId = pb.AccountId - st.AllowedVpcEndpointIds = pb.AllowedVpcEndpointIds - st.PrivateAccessLevel = pb.PrivateAccessLevel - st.PrivateAccessSettingsId = pb.PrivateAccessSettingsId - st.PrivateAccessSettingsName = pb.PrivateAccessSettingsName - st.PublicAccessEnabled = pb.PublicAccessEnabled - st.Region = pb.Region - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *privateAccessSettingsPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st privateAccessSettingsPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func replaceResponseToPb(st *ReplaceResponse) (*replaceResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &replaceResponsePb{} - - return pb, nil -} - -type replaceResponsePb struct { -} - -func replaceResponseFromPb(pb *replaceResponsePb) (*ReplaceResponse, error) { - if pb == nil { - return nil, nil - } - st := &ReplaceResponse{} - - return st, nil -} - -func rootBucketInfoToPb(st *RootBucketInfo) (*rootBucketInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &rootBucketInfoPb{} - pb.BucketName = st.BucketName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type rootBucketInfoPb struct { - BucketName string `json:"bucket_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func rootBucketInfoFromPb(pb *rootBucketInfoPb) (*RootBucketInfo, error) { - if pb == nil { - return nil, nil - } - st := &RootBucketInfo{} - st.BucketName = pb.BucketName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *rootBucketInfoPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st rootBucketInfoPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func storageConfigurationToPb(st *StorageConfiguration) (*storageConfigurationPb, error) { - if st == nil { - return nil, nil - } - pb := &storageConfigurationPb{} - pb.AccountId = st.AccountId - pb.CreationTime = st.CreationTime - pb.RootBucketInfo = st.RootBucketInfo - pb.StorageConfigurationId = st.StorageConfigurationId - pb.StorageConfigurationName = st.StorageConfigurationName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type storageConfigurationPb struct { - AccountId string `json:"account_id,omitempty"` - CreationTime int64 `json:"creation_time,omitempty"` - RootBucketInfo *RootBucketInfo `json:"root_bucket_info,omitempty"` - StorageConfigurationId string `json:"storage_configuration_id,omitempty"` - StorageConfigurationName string `json:"storage_configuration_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func storageConfigurationFromPb(pb *storageConfigurationPb) (*StorageConfiguration, error) { - if pb == nil { - return nil, nil - } - st := &StorageConfiguration{} - st.AccountId = pb.AccountId - st.CreationTime = pb.CreationTime - st.RootBucketInfo = pb.RootBucketInfo - st.StorageConfigurationId = pb.StorageConfigurationId - st.StorageConfigurationName = pb.StorageConfigurationName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *storageConfigurationPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st storageConfigurationPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func stsRoleToPb(st *StsRole) (*stsRolePb, error) { - if st == nil { - return nil, nil - } - pb := &stsRolePb{} - pb.ExternalId = st.ExternalId - pb.RoleArn = st.RoleArn - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type stsRolePb struct { - ExternalId string `json:"external_id,omitempty"` - RoleArn string `json:"role_arn,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func stsRoleFromPb(pb *stsRolePb) (*StsRole, error) { - if pb == nil { - return nil, nil - } - st := &StsRole{} - st.ExternalId = pb.ExternalId - st.RoleArn = pb.RoleArn - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *stsRolePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st stsRolePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func updateResponseToPb(st *UpdateResponse) (*updateResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &updateResponsePb{} - - return pb, nil -} - -type updateResponsePb struct { -} - -func updateResponseFromPb(pb *updateResponsePb) (*UpdateResponse, error) { - if pb == nil { - return nil, nil - } - st := &UpdateResponse{} - - return st, nil -} - -func updateWorkspaceRequestToPb(st *UpdateWorkspaceRequest) (*updateWorkspaceRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &updateWorkspaceRequestPb{} - pb.AwsRegion = st.AwsRegion - pb.CredentialsId = st.CredentialsId - pb.CustomTags = st.CustomTags - pb.ManagedServicesCustomerManagedKeyId = st.ManagedServicesCustomerManagedKeyId - pb.NetworkConnectivityConfigId = st.NetworkConnectivityConfigId - pb.NetworkId = st.NetworkId - pb.PrivateAccessSettingsId = st.PrivateAccessSettingsId - pb.StorageConfigurationId = st.StorageConfigurationId - pb.StorageCustomerManagedKeyId = st.StorageCustomerManagedKeyId - pb.WorkspaceId = st.WorkspaceId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type updateWorkspaceRequestPb struct { - AwsRegion string `json:"aws_region,omitempty"` - CredentialsId string `json:"credentials_id,omitempty"` - CustomTags map[string]string `json:"custom_tags,omitempty"` - ManagedServicesCustomerManagedKeyId string `json:"managed_services_customer_managed_key_id,omitempty"` - NetworkConnectivityConfigId string `json:"network_connectivity_config_id,omitempty"` - NetworkId string `json:"network_id,omitempty"` - PrivateAccessSettingsId string `json:"private_access_settings_id,omitempty"` - StorageConfigurationId string `json:"storage_configuration_id,omitempty"` - StorageCustomerManagedKeyId string `json:"storage_customer_managed_key_id,omitempty"` - WorkspaceId int64 `json:"-" url:"-"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func updateWorkspaceRequestFromPb(pb *updateWorkspaceRequestPb) (*UpdateWorkspaceRequest, error) { - if pb == nil { - return nil, nil - } - st := &UpdateWorkspaceRequest{} - st.AwsRegion = pb.AwsRegion - st.CredentialsId = pb.CredentialsId - st.CustomTags = pb.CustomTags - st.ManagedServicesCustomerManagedKeyId = pb.ManagedServicesCustomerManagedKeyId - st.NetworkConnectivityConfigId = pb.NetworkConnectivityConfigId - st.NetworkId = pb.NetworkId - st.PrivateAccessSettingsId = pb.PrivateAccessSettingsId - st.StorageConfigurationId = pb.StorageConfigurationId - st.StorageCustomerManagedKeyId = pb.StorageCustomerManagedKeyId - st.WorkspaceId = pb.WorkspaceId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *updateWorkspaceRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st updateWorkspaceRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func upsertPrivateAccessSettingsRequestToPb(st *UpsertPrivateAccessSettingsRequest) (*upsertPrivateAccessSettingsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &upsertPrivateAccessSettingsRequestPb{} - pb.AllowedVpcEndpointIds = st.AllowedVpcEndpointIds - pb.PrivateAccessLevel = st.PrivateAccessLevel - pb.PrivateAccessSettingsId = st.PrivateAccessSettingsId - pb.PrivateAccessSettingsName = st.PrivateAccessSettingsName - pb.PublicAccessEnabled = st.PublicAccessEnabled - pb.Region = st.Region - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type upsertPrivateAccessSettingsRequestPb struct { - AllowedVpcEndpointIds []string `json:"allowed_vpc_endpoint_ids,omitempty"` - PrivateAccessLevel PrivateAccessLevel `json:"private_access_level,omitempty"` - PrivateAccessSettingsId string `json:"-" url:"-"` - PrivateAccessSettingsName string `json:"private_access_settings_name"` - PublicAccessEnabled bool `json:"public_access_enabled,omitempty"` - Region string `json:"region"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func upsertPrivateAccessSettingsRequestFromPb(pb *upsertPrivateAccessSettingsRequestPb) (*UpsertPrivateAccessSettingsRequest, error) { - if pb == nil { - return nil, nil - } - st := &UpsertPrivateAccessSettingsRequest{} - st.AllowedVpcEndpointIds = pb.AllowedVpcEndpointIds - st.PrivateAccessLevel = pb.PrivateAccessLevel - st.PrivateAccessSettingsId = pb.PrivateAccessSettingsId - st.PrivateAccessSettingsName = pb.PrivateAccessSettingsName - st.PublicAccessEnabled = pb.PublicAccessEnabled - st.Region = pb.Region - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *upsertPrivateAccessSettingsRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st upsertPrivateAccessSettingsRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func vpcEndpointToPb(st *VpcEndpoint) (*vpcEndpointPb, error) { - if st == nil { - return nil, nil - } - pb := &vpcEndpointPb{} - pb.AccountId = st.AccountId - pb.AwsAccountId = st.AwsAccountId - pb.AwsEndpointServiceId = st.AwsEndpointServiceId - pb.AwsVpcEndpointId = st.AwsVpcEndpointId - pb.GcpVpcEndpointInfo = st.GcpVpcEndpointInfo - pb.Region = st.Region - pb.State = st.State - pb.UseCase = st.UseCase - pb.VpcEndpointId = st.VpcEndpointId - pb.VpcEndpointName = st.VpcEndpointName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type vpcEndpointPb struct { - AccountId string `json:"account_id,omitempty"` - AwsAccountId string `json:"aws_account_id,omitempty"` - AwsEndpointServiceId string `json:"aws_endpoint_service_id,omitempty"` - AwsVpcEndpointId string `json:"aws_vpc_endpoint_id,omitempty"` - GcpVpcEndpointInfo *GcpVpcEndpointInfo `json:"gcp_vpc_endpoint_info,omitempty"` - Region string `json:"region,omitempty"` - State string `json:"state,omitempty"` - UseCase EndpointUseCase `json:"use_case,omitempty"` - VpcEndpointId string `json:"vpc_endpoint_id,omitempty"` - VpcEndpointName string `json:"vpc_endpoint_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func vpcEndpointFromPb(pb *vpcEndpointPb) (*VpcEndpoint, error) { - if pb == nil { - return nil, nil - } - st := &VpcEndpoint{} - st.AccountId = pb.AccountId - st.AwsAccountId = pb.AwsAccountId - st.AwsEndpointServiceId = pb.AwsEndpointServiceId - st.AwsVpcEndpointId = pb.AwsVpcEndpointId - st.GcpVpcEndpointInfo = pb.GcpVpcEndpointInfo - st.Region = pb.Region - st.State = pb.State - st.UseCase = pb.UseCase - st.VpcEndpointId = pb.VpcEndpointId - st.VpcEndpointName = pb.VpcEndpointName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *vpcEndpointPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st vpcEndpointPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func workspaceToPb(st *Workspace) (*workspacePb, error) { - if st == nil { - return nil, nil - } - pb := &workspacePb{} - pb.AccountId = st.AccountId - pb.AwsRegion = st.AwsRegion - pb.AzureWorkspaceInfo = st.AzureWorkspaceInfo - pb.Cloud = st.Cloud - pb.CloudResourceContainer = st.CloudResourceContainer - pb.CreationTime = st.CreationTime - pb.CredentialsId = st.CredentialsId - pb.CustomTags = st.CustomTags - pb.DeploymentName = st.DeploymentName - pb.ExternalCustomerInfo = st.ExternalCustomerInfo - pb.GcpManagedNetworkConfig = st.GcpManagedNetworkConfig - pb.GkeConfig = st.GkeConfig - pb.IsNoPublicIpEnabled = st.IsNoPublicIpEnabled - pb.Location = st.Location - pb.ManagedServicesCustomerManagedKeyId = st.ManagedServicesCustomerManagedKeyId - pb.NetworkId = st.NetworkId - pb.PricingTier = st.PricingTier - pb.PrivateAccessSettingsId = st.PrivateAccessSettingsId - pb.StorageConfigurationId = st.StorageConfigurationId - pb.StorageCustomerManagedKeyId = st.StorageCustomerManagedKeyId - pb.WorkspaceId = st.WorkspaceId - pb.WorkspaceName = st.WorkspaceName - pb.WorkspaceStatus = st.WorkspaceStatus - pb.WorkspaceStatusMessage = st.WorkspaceStatusMessage - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type workspacePb struct { - AccountId string `json:"account_id,omitempty"` - AwsRegion string `json:"aws_region,omitempty"` - AzureWorkspaceInfo *AzureWorkspaceInfo `json:"azure_workspace_info,omitempty"` - Cloud string `json:"cloud,omitempty"` - CloudResourceContainer *CloudResourceContainer `json:"cloud_resource_container,omitempty"` - CreationTime int64 `json:"creation_time,omitempty"` - CredentialsId string `json:"credentials_id,omitempty"` - CustomTags map[string]string `json:"custom_tags,omitempty"` - DeploymentName string `json:"deployment_name,omitempty"` - ExternalCustomerInfo *ExternalCustomerInfo `json:"external_customer_info,omitempty"` - GcpManagedNetworkConfig *GcpManagedNetworkConfig `json:"gcp_managed_network_config,omitempty"` - GkeConfig *GkeConfig `json:"gke_config,omitempty"` - IsNoPublicIpEnabled bool `json:"is_no_public_ip_enabled,omitempty"` - Location string `json:"location,omitempty"` - ManagedServicesCustomerManagedKeyId string `json:"managed_services_customer_managed_key_id,omitempty"` - NetworkId string `json:"network_id,omitempty"` - PricingTier PricingTier `json:"pricing_tier,omitempty"` - PrivateAccessSettingsId string `json:"private_access_settings_id,omitempty"` - StorageConfigurationId string `json:"storage_configuration_id,omitempty"` - StorageCustomerManagedKeyId string `json:"storage_customer_managed_key_id,omitempty"` - WorkspaceId int64 `json:"workspace_id,omitempty"` - WorkspaceName string `json:"workspace_name,omitempty"` - WorkspaceStatus WorkspaceStatus `json:"workspace_status,omitempty"` - WorkspaceStatusMessage string `json:"workspace_status_message,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func workspaceFromPb(pb *workspacePb) (*Workspace, error) { - if pb == nil { - return nil, nil - } - st := &Workspace{} - st.AccountId = pb.AccountId - st.AwsRegion = pb.AwsRegion - st.AzureWorkspaceInfo = pb.AzureWorkspaceInfo - st.Cloud = pb.Cloud - st.CloudResourceContainer = pb.CloudResourceContainer - st.CreationTime = pb.CreationTime - st.CredentialsId = pb.CredentialsId - st.CustomTags = pb.CustomTags - st.DeploymentName = pb.DeploymentName - st.ExternalCustomerInfo = pb.ExternalCustomerInfo - st.GcpManagedNetworkConfig = pb.GcpManagedNetworkConfig - st.GkeConfig = pb.GkeConfig - st.IsNoPublicIpEnabled = pb.IsNoPublicIpEnabled - st.Location = pb.Location - st.ManagedServicesCustomerManagedKeyId = pb.ManagedServicesCustomerManagedKeyId - st.NetworkId = pb.NetworkId - st.PricingTier = pb.PricingTier - st.PrivateAccessSettingsId = pb.PrivateAccessSettingsId - st.StorageConfigurationId = pb.StorageConfigurationId - st.StorageCustomerManagedKeyId = pb.StorageCustomerManagedKeyId - st.WorkspaceId = pb.WorkspaceId - st.WorkspaceName = pb.WorkspaceName - st.WorkspaceStatus = pb.WorkspaceStatus - st.WorkspaceStatusMessage = pb.WorkspaceStatusMessage - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *workspacePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st workspacePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func durationToPb(d *time.Duration) (*string, error) { - if d == nil { - return nil, nil - } - s := fmt.Sprintf("%.9fs", d.Seconds()) - return &s, nil -} - -func durationFromPb(s *string) (*time.Duration, error) { - if s == nil { - return nil, nil - } - d, err := time.ParseDuration(*s) - if err != nil { - return nil, err - } - return &d, nil -} - -func timestampToPb(t *time.Time) (*string, error) { - if t == nil { - return nil, nil - } - s := t.Format(time.RFC3339) - return &s, nil -} - -func timestampFromPb(s *string) (*time.Time, error) { - if s == nil { - return nil, nil - } - t, err := time.Parse(time.RFC3339, *s) - if err != nil { - return nil, err - } - return &t, nil -} - -func fieldMaskToPb(fm *[]string) (*string, error) { - if fm == nil { - return nil, nil - } - s := strings.Join(*fm, ",") - return &s, nil -} - -func fieldMaskFromPb(s *string) (*[]string, error) { - if s == nil { - return nil, nil - } - fm := strings.Split(*s, ",") - return &fm, nil -} diff --git a/service/provisioning/model.go b/service/provisioning/model.go index 6787bae62..56a274570 100755 --- a/service/provisioning/model.go +++ b/service/provisioning/model.go @@ -3,515 +3,199 @@ package provisioning import ( - "encoding/json" "fmt" + + "github.com/databricks/databricks-sdk-go/marshal" ) type AwsCredentials struct { - - // Wire name: 'sts_role' StsRole *StsRole `json:"sts_role,omitempty"` } -func (st *AwsCredentials) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &awsCredentialsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := awsCredentialsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st AwsCredentials) MarshalJSON() ([]byte, error) { - pb, err := awsCredentialsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type AwsKeyInfo struct { // The AWS KMS key alias. - // Wire name: 'key_alias' KeyAlias string `json:"key_alias,omitempty"` // The AWS KMS key's Amazon Resource Name (ARN). - // Wire name: 'key_arn' KeyArn string `json:"key_arn"` // The AWS KMS key region. - // Wire name: 'key_region' KeyRegion string `json:"key_region"` // This field applies only if the `use_cases` property includes `STORAGE`. // If this is set to `true` or omitted, the key is also used to encrypt // cluster EBS volumes. If you do not want to use this key for encrypting // EBS volumes, set to `false`. - // Wire name: 'reuse_key_for_cluster_volumes' ReuseKeyForClusterVolumes bool `json:"reuse_key_for_cluster_volumes,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *AwsKeyInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &awsKeyInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := awsKeyInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *AwsKeyInfo) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st AwsKeyInfo) MarshalJSON() ([]byte, error) { - pb, err := awsKeyInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s AwsKeyInfo) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type AzureWorkspaceInfo struct { // Azure Resource Group name - // Wire name: 'resource_group' ResourceGroup string `json:"resource_group,omitempty"` // Azure Subscription ID - // Wire name: 'subscription_id' SubscriptionId string `json:"subscription_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *AzureWorkspaceInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &azureWorkspaceInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := azureWorkspaceInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *AzureWorkspaceInfo) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st AzureWorkspaceInfo) MarshalJSON() ([]byte, error) { - pb, err := azureWorkspaceInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s AzureWorkspaceInfo) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The general workspace configurations that are specific to cloud providers. type CloudResourceContainer struct { // The general workspace configurations that are specific to Google Cloud. - // Wire name: 'gcp' Gcp *CustomerFacingGcpCloudResourceContainer `json:"gcp,omitempty"` } -func (st *CloudResourceContainer) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &cloudResourceContainerPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := cloudResourceContainerFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CloudResourceContainer) MarshalJSON() ([]byte, error) { - pb, err := cloudResourceContainerToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type CreateAwsKeyInfo struct { // The AWS KMS key alias. - // Wire name: 'key_alias' KeyAlias string `json:"key_alias,omitempty"` // The AWS KMS key's Amazon Resource Name (ARN). Note that the key's AWS // region is inferred from the ARN. - // Wire name: 'key_arn' KeyArn string `json:"key_arn"` // This field applies only if the `use_cases` property includes `STORAGE`. // If this is set to `true` or omitted, the key is also used to encrypt // cluster EBS volumes. To not use this key also for encrypting EBS volumes, // set this to `false`. - // Wire name: 'reuse_key_for_cluster_volumes' ReuseKeyForClusterVolumes bool `json:"reuse_key_for_cluster_volumes,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateAwsKeyInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createAwsKeyInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createAwsKeyInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateAwsKeyInfo) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateAwsKeyInfo) MarshalJSON() ([]byte, error) { - pb, err := createAwsKeyInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateAwsKeyInfo) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreateCredentialAwsCredentials struct { - - // Wire name: 'sts_role' StsRole *CreateCredentialStsRole `json:"sts_role,omitempty"` } -func (st *CreateCredentialAwsCredentials) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createCredentialAwsCredentialsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createCredentialAwsCredentialsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CreateCredentialAwsCredentials) MarshalJSON() ([]byte, error) { - pb, err := createCredentialAwsCredentialsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type CreateCredentialRequest struct { - - // Wire name: 'aws_credentials' AwsCredentials CreateCredentialAwsCredentials `json:"aws_credentials"` // The human-readable name of the credential configuration object. - // Wire name: 'credentials_name' CredentialsName string `json:"credentials_name"` } -func (st *CreateCredentialRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createCredentialRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createCredentialRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CreateCredentialRequest) MarshalJSON() ([]byte, error) { - pb, err := createCredentialRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type CreateCredentialStsRole struct { // The Amazon Resource Name (ARN) of the cross account role. - // Wire name: 'role_arn' RoleArn string `json:"role_arn,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateCredentialStsRole) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createCredentialStsRolePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createCredentialStsRoleFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateCredentialStsRole) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateCredentialStsRole) MarshalJSON() ([]byte, error) { - pb, err := createCredentialStsRoleToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateCredentialStsRole) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreateCustomerManagedKeyRequest struct { - - // Wire name: 'aws_key_info' AwsKeyInfo *CreateAwsKeyInfo `json:"aws_key_info,omitempty"` - // Wire name: 'gcp_key_info' GcpKeyInfo *CreateGcpKeyInfo `json:"gcp_key_info,omitempty"` // The cases that the key can be used for. - // Wire name: 'use_cases' UseCases []KeyUseCase `json:"use_cases"` } -func (st *CreateCustomerManagedKeyRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createCustomerManagedKeyRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createCustomerManagedKeyRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CreateCustomerManagedKeyRequest) MarshalJSON() ([]byte, error) { - pb, err := createCustomerManagedKeyRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type CreateGcpKeyInfo struct { // The GCP KMS key's resource name - // Wire name: 'kms_key_id' KmsKeyId string `json:"kms_key_id"` } -func (st *CreateGcpKeyInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createGcpKeyInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createGcpKeyInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CreateGcpKeyInfo) MarshalJSON() ([]byte, error) { - pb, err := createGcpKeyInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type CreateNetworkRequest struct { // The Google Cloud specific information for this network (for example, the // VPC ID, subnet ID, and secondary IP ranges). - // Wire name: 'gcp_network_info' GcpNetworkInfo *GcpNetworkInfo `json:"gcp_network_info,omitempty"` // The human-readable name of the network configuration. - // Wire name: 'network_name' NetworkName string `json:"network_name"` // IDs of one to five security groups associated with this network. Security // group IDs **cannot** be used in multiple network configurations. - // Wire name: 'security_group_ids' SecurityGroupIds []string `json:"security_group_ids,omitempty"` // IDs of at least two subnets associated with this network. Subnet IDs // **cannot** be used in multiple network configurations. - // Wire name: 'subnet_ids' SubnetIds []string `json:"subnet_ids,omitempty"` // If specified, contains the VPC endpoints used to allow cluster // communication from this VPC over [AWS PrivateLink]. // // [AWS PrivateLink]: https://aws.amazon.com/privatelink/ - // Wire name: 'vpc_endpoints' VpcEndpoints *NetworkVpcEndpoints `json:"vpc_endpoints,omitempty"` // The ID of the VPC associated with this network. VPC IDs can be used in // multiple network configurations. - // Wire name: 'vpc_id' VpcId string `json:"vpc_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateNetworkRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createNetworkRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createNetworkRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateNetworkRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateNetworkRequest) MarshalJSON() ([]byte, error) { - pb, err := createNetworkRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateNetworkRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreateStorageConfigurationRequest struct { // Root S3 bucket information. - // Wire name: 'root_bucket_info' RootBucketInfo RootBucketInfo `json:"root_bucket_info"` // The human-readable name of the storage configuration. - // Wire name: 'storage_configuration_name' StorageConfigurationName string `json:"storage_configuration_name"` } -func (st *CreateStorageConfigurationRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createStorageConfigurationRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createStorageConfigurationRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CreateStorageConfigurationRequest) MarshalJSON() ([]byte, error) { - pb, err := createStorageConfigurationRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type CreateVpcEndpointRequest struct { // The ID of the VPC endpoint object in AWS. - // Wire name: 'aws_vpc_endpoint_id' AwsVpcEndpointId string `json:"aws_vpc_endpoint_id,omitempty"` // The Google Cloud specific information for this Private Service Connect // endpoint. - // Wire name: 'gcp_vpc_endpoint_info' GcpVpcEndpointInfo *GcpVpcEndpointInfo `json:"gcp_vpc_endpoint_info,omitempty"` // The AWS region in which this VPC endpoint object exists. - // Wire name: 'region' Region string `json:"region,omitempty"` // The human-readable name of the storage configuration. - // Wire name: 'vpc_endpoint_name' VpcEndpointName string `json:"vpc_endpoint_name"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateVpcEndpointRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createVpcEndpointRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createVpcEndpointRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateVpcEndpointRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateVpcEndpointRequest) MarshalJSON() ([]byte, error) { - pb, err := createVpcEndpointRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateVpcEndpointRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreateWorkspaceRequest struct { // The AWS region of the workspace's data plane. - // Wire name: 'aws_region' AwsRegion string `json:"aws_region,omitempty"` // The cloud provider which the workspace uses. For Google Cloud workspaces, // always set this field to `gcp`. - // Wire name: 'cloud' Cloud string `json:"cloud,omitempty"` // The general workspace configurations that are specific to cloud // providers. - // Wire name: 'cloud_resource_container' CloudResourceContainer *CloudResourceContainer `json:"cloud_resource_container,omitempty"` // ID of the workspace's credential configuration object. - // Wire name: 'credentials_id' CredentialsId string `json:"credentials_id,omitempty"` // The custom tags key-value pairing that is attached to this workspace. The // key-value pair is a string of utf-8 characters. The value can be an empty // string, with maximum length of 255 characters. The key can be of maximum // length of 127 characters, and cannot be empty. - // Wire name: 'custom_tags' CustomTags map[string]string `json:"custom_tags,omitempty"` // The deployment name defines part of the subdomain for the workspace. The // workspace URL for the web application and REST APIs is @@ -542,7 +226,6 @@ type CreateWorkspaceRequest struct { // // If a new workspace omits this property, the server generates a unique // deployment name for you with the pattern `dbc-xxxxxxxx-xxxx`. - // Wire name: 'deployment_name' DeploymentName string `json:"deployment_name,omitempty"` // The network settings for the workspace. The configurations are only for // Databricks-managed VPCs. It is ignored if you specify a customer-managed @@ -567,33 +250,26 @@ type CreateWorkspaceRequest struct { // for a new workspace]. // // [calculate subnet sizes for a new workspace]: https://docs.gcp.databricks.com/administration-guide/cloud-configurations/gcp/network-sizing.html - // Wire name: 'gcp_managed_network_config' GcpManagedNetworkConfig *GcpManagedNetworkConfig `json:"gcp_managed_network_config,omitempty"` // The configurations for the GKE cluster of a Databricks workspace. - // Wire name: 'gke_config' GkeConfig *GkeConfig `json:"gke_config,omitempty"` // Whether no public IP is enabled for the workspace. - // Wire name: 'is_no_public_ip_enabled' IsNoPublicIpEnabled bool `json:"is_no_public_ip_enabled,omitempty"` // The Google Cloud region of the workspace data plane in your Google // account. For example, `us-east4`. - // Wire name: 'location' Location string `json:"location,omitempty"` // The ID of the workspace's managed services encryption key configuration // object. This is used to help protect and control access to the // workspace's notebooks, secrets, Databricks SQL queries, and query // history. The provided key configuration object property `use_cases` must // contain `MANAGED_SERVICES`. - // Wire name: 'managed_services_customer_managed_key_id' ManagedServicesCustomerManagedKeyId string `json:"managed_services_customer_managed_key_id,omitempty"` - // Wire name: 'network_id' NetworkId string `json:"network_id,omitempty"` // The pricing tier of the workspace. For pricing tier information, see [AWS // Pricing]. // // [AWS Pricing]: https://databricks.com/product/aws-pricing - // Wire name: 'pricing_tier' PricingTier PricingTier `json:"pricing_tier,omitempty"` // ID of the workspace's private access settings object. Only used for // PrivateLink. This ID must be specified for customers using [AWS @@ -606,420 +282,136 @@ type CreateWorkspaceRequest struct { // // [AWS PrivateLink]: https://aws.amazon.com/privatelink/ // [Databricks article about PrivateLink]: https://docs.databricks.com/administration-guide/cloud-configurations/aws/privatelink.html - // Wire name: 'private_access_settings_id' PrivateAccessSettingsId string `json:"private_access_settings_id,omitempty"` // The ID of the workspace's storage configuration object. - // Wire name: 'storage_configuration_id' StorageConfigurationId string `json:"storage_configuration_id,omitempty"` // The ID of the workspace's storage encryption key configuration object. // This is used to encrypt the workspace's root S3 bucket (root DBFS and // system data) and, optionally, cluster EBS volumes. The provided key // configuration object property `use_cases` must contain `STORAGE`. - // Wire name: 'storage_customer_managed_key_id' StorageCustomerManagedKeyId string `json:"storage_customer_managed_key_id,omitempty"` // The workspace's human-readable name. - // Wire name: 'workspace_name' WorkspaceName string `json:"workspace_name"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateWorkspaceRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createWorkspaceRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createWorkspaceRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateWorkspaceRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateWorkspaceRequest) MarshalJSON() ([]byte, error) { - pb, err := createWorkspaceRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateWorkspaceRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type Credential struct { // The Databricks account ID that hosts the credential. - // Wire name: 'account_id' AccountId string `json:"account_id,omitempty"` - // Wire name: 'aws_credentials' AwsCredentials *AwsCredentials `json:"aws_credentials,omitempty"` // Time in epoch milliseconds when the credential was created. - // Wire name: 'creation_time' CreationTime int64 `json:"creation_time,omitempty"` // Databricks credential configuration ID. - // Wire name: 'credentials_id' CredentialsId string `json:"credentials_id,omitempty"` // The human-readable name of the credential configuration object. - // Wire name: 'credentials_name' CredentialsName string `json:"credentials_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *Credential) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &credentialPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := credentialFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *Credential) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st Credential) MarshalJSON() ([]byte, error) { - pb, err := credentialToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s Credential) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The general workspace configurations that are specific to Google Cloud. type CustomerFacingGcpCloudResourceContainer struct { // The Google Cloud project ID, which the workspace uses to instantiate // cloud resources for your workspace. - // Wire name: 'project_id' ProjectId string `json:"project_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CustomerFacingGcpCloudResourceContainer) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &customerFacingGcpCloudResourceContainerPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := customerFacingGcpCloudResourceContainerFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CustomerFacingGcpCloudResourceContainer) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CustomerFacingGcpCloudResourceContainer) MarshalJSON() ([]byte, error) { - pb, err := customerFacingGcpCloudResourceContainerToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CustomerFacingGcpCloudResourceContainer) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CustomerManagedKey struct { // The Databricks account ID that holds the customer-managed key. - // Wire name: 'account_id' AccountId string `json:"account_id,omitempty"` - // Wire name: 'aws_key_info' AwsKeyInfo *AwsKeyInfo `json:"aws_key_info,omitempty"` // Time in epoch milliseconds when the customer key was created. - // Wire name: 'creation_time' CreationTime int64 `json:"creation_time,omitempty"` // ID of the encryption key configuration object. - // Wire name: 'customer_managed_key_id' CustomerManagedKeyId string `json:"customer_managed_key_id,omitempty"` - // Wire name: 'gcp_key_info' GcpKeyInfo *GcpKeyInfo `json:"gcp_key_info,omitempty"` // The cases that the key can be used for. - // Wire name: 'use_cases' UseCases []KeyUseCase `json:"use_cases,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CustomerManagedKey) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &customerManagedKeyPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := customerManagedKeyFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CustomerManagedKey) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CustomerManagedKey) MarshalJSON() ([]byte, error) { - pb, err := customerManagedKeyToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CustomerManagedKey) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Delete credential configuration type DeleteCredentialRequest struct { // Databricks Account API credential configuration ID - CredentialsId string `json:"-" tf:"-"` -} - -func (st *DeleteCredentialRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteCredentialRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteCredentialRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteCredentialRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteCredentialRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + CredentialsId string `json:"-" url:"-"` } // Delete encryption key configuration type DeleteEncryptionKeyRequest struct { // Databricks encryption key configuration ID. - CustomerManagedKeyId string `json:"-" tf:"-"` -} - -func (st *DeleteEncryptionKeyRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteEncryptionKeyRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteEncryptionKeyRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteEncryptionKeyRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteEncryptionKeyRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + CustomerManagedKeyId string `json:"-" url:"-"` } // Delete a network configuration type DeleteNetworkRequest struct { // Databricks Account API network configuration ID. - NetworkId string `json:"-" tf:"-"` -} - -func (st *DeleteNetworkRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteNetworkRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteNetworkRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteNetworkRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteNetworkRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + NetworkId string `json:"-" url:"-"` } // Delete a private access settings object type DeletePrivateAccesRequest struct { // Databricks Account API private access settings ID. - PrivateAccessSettingsId string `json:"-" tf:"-"` -} - -func (st *DeletePrivateAccesRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deletePrivateAccesRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deletePrivateAccesRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeletePrivateAccesRequest) MarshalJSON() ([]byte, error) { - pb, err := deletePrivateAccesRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + PrivateAccessSettingsId string `json:"-" url:"-"` } type DeleteResponse struct { } -func (st *DeleteResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Delete storage configuration type DeleteStorageRequest struct { // Databricks Account API storage configuration ID. - StorageConfigurationId string `json:"-" tf:"-"` -} - -func (st *DeleteStorageRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteStorageRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteStorageRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteStorageRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteStorageRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + StorageConfigurationId string `json:"-" url:"-"` } // Delete VPC endpoint configuration type DeleteVpcEndpointRequest struct { // Databricks VPC endpoint ID. - VpcEndpointId string `json:"-" tf:"-"` -} - -func (st *DeleteVpcEndpointRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteVpcEndpointRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteVpcEndpointRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteVpcEndpointRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteVpcEndpointRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + VpcEndpointId string `json:"-" url:"-"` } // Delete a workspace type DeleteWorkspaceRequest struct { // Workspace ID. - WorkspaceId int64 `json:"-" tf:"-"` -} - -func (st *DeleteWorkspaceRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteWorkspaceRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteWorkspaceRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteWorkspaceRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteWorkspaceRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + WorkspaceId int64 `json:"-" url:"-"` } // This enumeration represents the type of Databricks VPC [endpoint service] @@ -1113,74 +505,28 @@ func (f *ErrorType) Type() string { type ExternalCustomerInfo struct { // Email of the authoritative user. - // Wire name: 'authoritative_user_email' AuthoritativeUserEmail string `json:"authoritative_user_email,omitempty"` // The authoritative user full name. - // Wire name: 'authoritative_user_full_name' AuthoritativeUserFullName string `json:"authoritative_user_full_name,omitempty"` // The legal entity name for the external workspace - // Wire name: 'customer_name' CustomerName string `json:"customer_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ExternalCustomerInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &externalCustomerInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := externalCustomerInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ExternalCustomerInfo) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ExternalCustomerInfo) MarshalJSON() ([]byte, error) { - pb, err := externalCustomerInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ExternalCustomerInfo) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type GcpKeyInfo struct { // The GCP KMS key's resource name - // Wire name: 'kms_key_id' KmsKeyId string `json:"kms_key_id"` } -func (st *GcpKeyInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &gcpKeyInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := gcpKeyInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GcpKeyInfo) MarshalJSON() ([]byte, error) { - pb, err := gcpKeyInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // The network settings for the workspace. The configurations are only for // Databricks-managed VPCs. It is ignored if you specify a customer-managed VPC // in the `network_id` field.", All the IP range configurations must be mutually @@ -1207,362 +553,114 @@ func (st GcpKeyInfo) MarshalJSON() ([]byte, error) { type GcpManagedNetworkConfig struct { // The IP range from which to allocate GKE cluster pods. No bigger than `/9` // and no smaller than `/21`. - // Wire name: 'gke_cluster_pod_ip_range' GkeClusterPodIpRange string `json:"gke_cluster_pod_ip_range,omitempty"` // The IP range from which to allocate GKE cluster services. No bigger than // `/16` and no smaller than `/27`. - // Wire name: 'gke_cluster_service_ip_range' GkeClusterServiceIpRange string `json:"gke_cluster_service_ip_range,omitempty"` // The IP range from which to allocate GKE cluster nodes. No bigger than // `/9` and no smaller than `/29`. - // Wire name: 'subnet_cidr' SubnetCidr string `json:"subnet_cidr,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GcpManagedNetworkConfig) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &gcpManagedNetworkConfigPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := gcpManagedNetworkConfigFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GcpManagedNetworkConfig) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GcpManagedNetworkConfig) MarshalJSON() ([]byte, error) { - pb, err := gcpManagedNetworkConfigToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GcpManagedNetworkConfig) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The Google Cloud specific information for this network (for example, the VPC // ID, subnet ID, and secondary IP ranges). type GcpNetworkInfo struct { // The Google Cloud project ID of the VPC network. - // Wire name: 'network_project_id' NetworkProjectId string `json:"network_project_id"` // The name of the secondary IP range for pods. A Databricks-managed GKE // cluster uses this IP range for its pods. This secondary IP range can be // used by only one workspace. - // Wire name: 'pod_ip_range_name' PodIpRangeName string `json:"pod_ip_range_name"` // The name of the secondary IP range for services. A Databricks-managed GKE // cluster uses this IP range for its services. This secondary IP range can // be used by only one workspace. - // Wire name: 'service_ip_range_name' ServiceIpRangeName string `json:"service_ip_range_name"` // The ID of the subnet associated with this network. - // Wire name: 'subnet_id' SubnetId string `json:"subnet_id"` // The Google Cloud region of the workspace data plane (for example, // `us-east4`). - // Wire name: 'subnet_region' SubnetRegion string `json:"subnet_region"` // The ID of the VPC associated with this network. VPC IDs can be used in // multiple network configurations. - // Wire name: 'vpc_id' VpcId string `json:"vpc_id"` } -func (st *GcpNetworkInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &gcpNetworkInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := gcpNetworkInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GcpNetworkInfo) MarshalJSON() ([]byte, error) { - pb, err := gcpNetworkInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // The Google Cloud specific information for this Private Service Connect // endpoint. type GcpVpcEndpointInfo struct { // Region of the PSC endpoint. - // Wire name: 'endpoint_region' EndpointRegion string `json:"endpoint_region"` // The Google Cloud project ID of the VPC network where the PSC connection // resides. - // Wire name: 'project_id' ProjectId string `json:"project_id"` // The unique ID of this PSC connection. - // Wire name: 'psc_connection_id' PscConnectionId string `json:"psc_connection_id,omitempty"` // The name of the PSC endpoint in the Google Cloud project. - // Wire name: 'psc_endpoint_name' PscEndpointName string `json:"psc_endpoint_name"` // The service attachment this PSC connection connects to. - // Wire name: 'service_attachment_id' ServiceAttachmentId string `json:"service_attachment_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GcpVpcEndpointInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &gcpVpcEndpointInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := gcpVpcEndpointInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GcpVpcEndpointInfo) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GcpVpcEndpointInfo) MarshalJSON() ([]byte, error) { - pb, err := gcpVpcEndpointInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GcpVpcEndpointInfo) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get credential configuration type GetCredentialRequest struct { // Databricks Account API credential configuration ID - CredentialsId string `json:"-" tf:"-"` -} - -func (st *GetCredentialRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getCredentialRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getCredentialRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetCredentialRequest) MarshalJSON() ([]byte, error) { - pb, err := getCredentialRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + CredentialsId string `json:"-" url:"-"` } // Get encryption key configuration type GetEncryptionKeyRequest struct { // Databricks encryption key configuration ID. - CustomerManagedKeyId string `json:"-" tf:"-"` -} - -func (st *GetEncryptionKeyRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getEncryptionKeyRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getEncryptionKeyRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetEncryptionKeyRequest) MarshalJSON() ([]byte, error) { - pb, err := getEncryptionKeyRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + CustomerManagedKeyId string `json:"-" url:"-"` } // Get a network configuration type GetNetworkRequest struct { // Databricks Account API network configuration ID. - NetworkId string `json:"-" tf:"-"` -} - -func (st *GetNetworkRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getNetworkRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getNetworkRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetNetworkRequest) MarshalJSON() ([]byte, error) { - pb, err := getNetworkRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + NetworkId string `json:"-" url:"-"` } // Get a private access settings object type GetPrivateAccesRequest struct { // Databricks Account API private access settings ID. - PrivateAccessSettingsId string `json:"-" tf:"-"` -} - -func (st *GetPrivateAccesRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getPrivateAccesRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getPrivateAccesRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetPrivateAccesRequest) MarshalJSON() ([]byte, error) { - pb, err := getPrivateAccesRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + PrivateAccessSettingsId string `json:"-" url:"-"` } // Get storage configuration type GetStorageRequest struct { // Databricks Account API storage configuration ID. - StorageConfigurationId string `json:"-" tf:"-"` -} - -func (st *GetStorageRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getStorageRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getStorageRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetStorageRequest) MarshalJSON() ([]byte, error) { - pb, err := getStorageRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + StorageConfigurationId string `json:"-" url:"-"` } // Get a VPC endpoint configuration type GetVpcEndpointRequest struct { // Databricks VPC endpoint ID. - VpcEndpointId string `json:"-" tf:"-"` -} - -func (st *GetVpcEndpointRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getVpcEndpointRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getVpcEndpointRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetVpcEndpointRequest) MarshalJSON() ([]byte, error) { - pb, err := getVpcEndpointRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + VpcEndpointId string `json:"-" url:"-"` } // Get a workspace type GetWorkspaceRequest struct { // Workspace ID. - WorkspaceId int64 `json:"-" tf:"-"` -} - -func (st *GetWorkspaceRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getWorkspaceRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getWorkspaceRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetWorkspaceRequest) MarshalJSON() ([]byte, error) { - pb, err := getWorkspaceRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + WorkspaceId int64 `json:"-" url:"-"` } // The configurations for the GKE cluster of a Databricks workspace. @@ -1575,41 +673,22 @@ type GkeConfig struct { // // Set to `PUBLIC_NODE_PUBLIC_MASTER` for a public GKE cluster. The nodes of // a public GKE cluster have public IP addresses. - // Wire name: 'connectivity_type' ConnectivityType GkeConfigConnectivityType `json:"connectivity_type,omitempty"` // The IP range from which to allocate GKE cluster master resources. This // field will be ignored if GKE private cluster is not enabled. // // It must be exactly as big as `/28`. - // Wire name: 'master_ip_range' MasterIpRange string `json:"master_ip_range,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GkeConfig) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &gkeConfigPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := gkeConfigFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GkeConfig) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GkeConfig) MarshalJSON() ([]byte, error) { - pb, err := gkeConfigToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GkeConfig) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Specifies the network connectivity types for the GKE nodes and the GKE master @@ -1702,115 +781,66 @@ func (f *KeyUseCase) Type() string { type Network struct { // The Databricks account ID associated with this network configuration. - // Wire name: 'account_id' AccountId string `json:"account_id,omitempty"` // Time in epoch milliseconds when the network was created. - // Wire name: 'creation_time' CreationTime int64 `json:"creation_time,omitempty"` // Array of error messages about the network configuration. - // Wire name: 'error_messages' ErrorMessages []NetworkHealth `json:"error_messages,omitempty"` // The Google Cloud specific information for this network (for example, the // VPC ID, subnet ID, and secondary IP ranges). - // Wire name: 'gcp_network_info' GcpNetworkInfo *GcpNetworkInfo `json:"gcp_network_info,omitempty"` // The Databricks network configuration ID. - // Wire name: 'network_id' NetworkId string `json:"network_id,omitempty"` // The human-readable name of the network configuration. - // Wire name: 'network_name' NetworkName string `json:"network_name,omitempty"` - // Wire name: 'security_group_ids' SecurityGroupIds []string `json:"security_group_ids,omitempty"` - // Wire name: 'subnet_ids' SubnetIds []string `json:"subnet_ids,omitempty"` // If specified, contains the VPC endpoints used to allow cluster // communication from this VPC over [AWS PrivateLink]. // // [AWS PrivateLink]: https://aws.amazon.com/privatelink/ - // Wire name: 'vpc_endpoints' VpcEndpoints *NetworkVpcEndpoints `json:"vpc_endpoints,omitempty"` // The ID of the VPC associated with this network configuration. VPC IDs can // be used in multiple networks. - // Wire name: 'vpc_id' VpcId string `json:"vpc_id,omitempty"` // The status of this network configuration object in terms of its use in a // workspace: * `UNATTACHED`: Unattached. * `VALID`: Valid. * `BROKEN`: // Broken. * `WARNED`: Warned. - // Wire name: 'vpc_status' VpcStatus VpcStatus `json:"vpc_status,omitempty"` // Array of warning messages about the network configuration. - // Wire name: 'warning_messages' WarningMessages []NetworkWarning `json:"warning_messages,omitempty"` // Workspace ID associated with this network configuration. - // Wire name: 'workspace_id' WorkspaceId int64 `json:"workspace_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *Network) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &networkPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := networkFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *Network) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st Network) MarshalJSON() ([]byte, error) { - pb, err := networkToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s Network) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type NetworkHealth struct { // Details of the error. - // Wire name: 'error_message' ErrorMessage string `json:"error_message,omitempty"` // The AWS resource associated with this error: credentials, VPC, subnet, // security group, or network ACL. - // Wire name: 'error_type' ErrorType ErrorType `json:"error_type,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *NetworkHealth) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &networkHealthPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := networkHealthFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *NetworkHealth) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st NetworkHealth) MarshalJSON() ([]byte, error) { - pb, err := networkHealthToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s NetworkHealth) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // If specified, contains the VPC endpoints used to allow cluster communication @@ -1820,74 +850,28 @@ func (st NetworkHealth) MarshalJSON() ([]byte, error) { type NetworkVpcEndpoints struct { // The VPC endpoint ID used by this network to access the Databricks secure // cluster connectivity relay. - // Wire name: 'dataplane_relay' DataplaneRelay []string `json:"dataplane_relay"` // The VPC endpoint ID used by this network to access the Databricks REST // API. - // Wire name: 'rest_api' RestApi []string `json:"rest_api"` } -func (st *NetworkVpcEndpoints) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &networkVpcEndpointsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := networkVpcEndpointsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st NetworkVpcEndpoints) MarshalJSON() ([]byte, error) { - pb, err := networkVpcEndpointsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type NetworkWarning struct { // Details of the warning. - // Wire name: 'warning_message' WarningMessage string `json:"warning_message,omitempty"` // The AWS resource associated with this warning: a subnet or a security // group. - // Wire name: 'warning_type' WarningType WarningType `json:"warning_type,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *NetworkWarning) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &networkWarningPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := networkWarningFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *NetworkWarning) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st NetworkWarning) MarshalJSON() ([]byte, error) { - pb, err := networkWarningToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s NetworkWarning) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The pricing tier of the workspace. For pricing tier information, see [AWS @@ -1988,10 +972,8 @@ func (f *PrivateAccessLevel) Type() string { type PrivateAccessSettings struct { // The Databricks account ID that hosts the credential. - // Wire name: 'account_id' AccountId string `json:"account_id,omitempty"` // An array of Databricks VPC endpoint IDs. - // Wire name: 'allowed_vpc_endpoint_ids' AllowedVpcEndpointIds []string `json:"allowed_vpc_endpoint_ids,omitempty"` // The private access level controls which VPC endpoints can connect to the // UI or API of any workspace that attaches this private access settings @@ -1999,295 +981,138 @@ type PrivateAccessSettings struct { // that are registered in your Databricks account connect to your workspace. // * `ENDPOINT` level access allows only specified VPC endpoints connect to // your workspace. For details, see `allowed_vpc_endpoint_ids`. - // Wire name: 'private_access_level' PrivateAccessLevel PrivateAccessLevel `json:"private_access_level,omitempty"` // Databricks private access settings ID. - // Wire name: 'private_access_settings_id' PrivateAccessSettingsId string `json:"private_access_settings_id,omitempty"` // The human-readable name of the private access settings object. - // Wire name: 'private_access_settings_name' PrivateAccessSettingsName string `json:"private_access_settings_name,omitempty"` // Determines if the workspace can be accessed over public internet. For // fully private workspaces, you can optionally specify `false`, but only if // you implement both the front-end and the back-end PrivateLink // connections. Otherwise, specify `true`, which means that public access is // enabled. - // Wire name: 'public_access_enabled' PublicAccessEnabled bool `json:"public_access_enabled,omitempty"` // The cloud region for workspaces attached to this private access settings // object. - // Wire name: 'region' Region string `json:"region,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *PrivateAccessSettings) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &privateAccessSettingsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := privateAccessSettingsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *PrivateAccessSettings) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st PrivateAccessSettings) MarshalJSON() ([]byte, error) { - pb, err := privateAccessSettingsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s PrivateAccessSettings) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ReplaceResponse struct { } -func (st *ReplaceResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &replaceResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := replaceResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ReplaceResponse) MarshalJSON() ([]byte, error) { - pb, err := replaceResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Root S3 bucket information. type RootBucketInfo struct { // The name of the S3 bucket. - // Wire name: 'bucket_name' BucketName string `json:"bucket_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *RootBucketInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &rootBucketInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := rootBucketInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *RootBucketInfo) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st RootBucketInfo) MarshalJSON() ([]byte, error) { - pb, err := rootBucketInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s RootBucketInfo) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type StorageConfiguration struct { // The Databricks account ID that hosts the credential. - // Wire name: 'account_id' AccountId string `json:"account_id,omitempty"` // Time in epoch milliseconds when the storage configuration was created. - // Wire name: 'creation_time' CreationTime int64 `json:"creation_time,omitempty"` // Root S3 bucket information. - // Wire name: 'root_bucket_info' RootBucketInfo *RootBucketInfo `json:"root_bucket_info,omitempty"` // Databricks storage configuration ID. - // Wire name: 'storage_configuration_id' StorageConfigurationId string `json:"storage_configuration_id,omitempty"` // The human-readable name of the storage configuration. - // Wire name: 'storage_configuration_name' StorageConfigurationName string `json:"storage_configuration_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *StorageConfiguration) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &storageConfigurationPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := storageConfigurationFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *StorageConfiguration) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st StorageConfiguration) MarshalJSON() ([]byte, error) { - pb, err := storageConfigurationToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s StorageConfiguration) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type StsRole struct { // The external ID that needs to be trusted by the cross-account role. This // is always your Databricks account ID. - // Wire name: 'external_id' ExternalId string `json:"external_id,omitempty"` // The Amazon Resource Name (ARN) of the cross account role. - // Wire name: 'role_arn' RoleArn string `json:"role_arn,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *StsRole) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &stsRolePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := stsRoleFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *StsRole) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st StsRole) MarshalJSON() ([]byte, error) { - pb, err := stsRoleToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s StsRole) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type UpdateResponse struct { } -func (st *UpdateResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateResponse) MarshalJSON() ([]byte, error) { - pb, err := updateResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type UpdateWorkspaceRequest struct { // The AWS region of the workspace's data plane (for example, `us-west-2`). // This parameter is available only for updating failed workspaces. - // Wire name: 'aws_region' AwsRegion string `json:"aws_region,omitempty"` // ID of the workspace's credential configuration object. This parameter is // available for updating both failed and running workspaces. - // Wire name: 'credentials_id' CredentialsId string `json:"credentials_id,omitempty"` // The custom tags key-value pairing that is attached to this workspace. The // key-value pair is a string of utf-8 characters. The value can be an empty // string, with maximum length of 255 characters. The key can be of maximum // length of 127 characters, and cannot be empty. - // Wire name: 'custom_tags' CustomTags map[string]string `json:"custom_tags,omitempty"` // The ID of the workspace's managed services encryption key configuration // object. This parameter is available only for updating failed workspaces. - // Wire name: 'managed_services_customer_managed_key_id' ManagedServicesCustomerManagedKeyId string `json:"managed_services_customer_managed_key_id,omitempty"` - // Wire name: 'network_connectivity_config_id' NetworkConnectivityConfigId string `json:"network_connectivity_config_id,omitempty"` // The ID of the workspace's network configuration object. Used only if you // already use a customer-managed VPC. For failed workspaces only, you can // switch from a Databricks-managed VPC to a customer-managed VPC by // updating the workspace to add a network configuration ID. - // Wire name: 'network_id' NetworkId string `json:"network_id,omitempty"` // The ID of the workspace's private access settings configuration object. // This parameter is available only for updating failed workspaces. - // Wire name: 'private_access_settings_id' PrivateAccessSettingsId string `json:"private_access_settings_id,omitempty"` // The ID of the workspace's storage configuration object. This parameter is // available only for updating failed workspaces. - // Wire name: 'storage_configuration_id' StorageConfigurationId string `json:"storage_configuration_id,omitempty"` // The ID of the key configuration object for workspace storage. This // parameter is available for updating both failed and running workspaces. - // Wire name: 'storage_customer_managed_key_id' StorageCustomerManagedKeyId string `json:"storage_customer_managed_key_id,omitempty"` // Workspace ID. - WorkspaceId int64 `json:"-" tf:"-"` + WorkspaceId int64 `json:"-" url:"-"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *UpdateWorkspaceRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateWorkspaceRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateWorkspaceRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *UpdateWorkspaceRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st UpdateWorkspaceRequest) MarshalJSON() ([]byte, error) { - pb, err := updateWorkspaceRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s UpdateWorkspaceRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type UpsertPrivateAccessSettingsRequest struct { @@ -2305,7 +1130,6 @@ type UpsertPrivateAccessSettingsRequest struct { // public internet, see [IP access lists]. // // [IP access lists]: https://docs.databricks.com/security/network/ip-access-list.html - // Wire name: 'allowed_vpc_endpoint_ids' AllowedVpcEndpointIds []string `json:"allowed_vpc_endpoint_ids,omitempty"` // The private access level controls which VPC endpoints can connect to the // UI or API of any workspace that attaches this private access settings @@ -2313,59 +1137,36 @@ type UpsertPrivateAccessSettingsRequest struct { // that are registered in your Databricks account connect to your workspace. // * `ENDPOINT` level access allows only specified VPC endpoints connect to // your workspace. For details, see `allowed_vpc_endpoint_ids`. - // Wire name: 'private_access_level' PrivateAccessLevel PrivateAccessLevel `json:"private_access_level,omitempty"` // Databricks Account API private access settings ID. - PrivateAccessSettingsId string `json:"-" tf:"-"` + PrivateAccessSettingsId string `json:"-" url:"-"` // The human-readable name of the private access settings object. - // Wire name: 'private_access_settings_name' PrivateAccessSettingsName string `json:"private_access_settings_name"` // Determines if the workspace can be accessed over public internet. For // fully private workspaces, you can optionally specify `false`, but only if // you implement both the front-end and the back-end PrivateLink // connections. Otherwise, specify `true`, which means that public access is // enabled. - // Wire name: 'public_access_enabled' PublicAccessEnabled bool `json:"public_access_enabled,omitempty"` // The cloud region for workspaces associated with this private access // settings object. - // Wire name: 'region' Region string `json:"region"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *UpsertPrivateAccessSettingsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &upsertPrivateAccessSettingsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := upsertPrivateAccessSettingsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *UpsertPrivateAccessSettingsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st UpsertPrivateAccessSettingsRequest) MarshalJSON() ([]byte, error) { - pb, err := upsertPrivateAccessSettingsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s UpsertPrivateAccessSettingsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type VpcEndpoint struct { // The Databricks account ID that hosts the VPC endpoint configuration. - // Wire name: 'account_id' AccountId string `json:"account_id,omitempty"` // The AWS Account in which the VPC endpoint object exists. - // Wire name: 'aws_account_id' AwsAccountId string `json:"aws_account_id,omitempty"` // The ID of the Databricks [endpoint service] that this VPC endpoint is // connected to. For a list of endpoint service IDs for each supported AWS @@ -2373,66 +1174,41 @@ type VpcEndpoint struct { // // [Databricks PrivateLink documentation]: https://docs.databricks.com/administration-guide/cloud-configurations/aws/privatelink.html // [endpoint service]: https://docs.aws.amazon.com/vpc/latest/privatelink/endpoint-service.html - // Wire name: 'aws_endpoint_service_id' AwsEndpointServiceId string `json:"aws_endpoint_service_id,omitempty"` // The ID of the VPC endpoint object in AWS. - // Wire name: 'aws_vpc_endpoint_id' AwsVpcEndpointId string `json:"aws_vpc_endpoint_id,omitempty"` // The Google Cloud specific information for this Private Service Connect // endpoint. - // Wire name: 'gcp_vpc_endpoint_info' GcpVpcEndpointInfo *GcpVpcEndpointInfo `json:"gcp_vpc_endpoint_info,omitempty"` // The AWS region in which this VPC endpoint object exists. - // Wire name: 'region' Region string `json:"region,omitempty"` // The current state (such as `available` or `rejected`) of the VPC // endpoint. Derived from AWS. For the full set of values, see [AWS // DescribeVpcEndpoint documentation]. // // [AWS DescribeVpcEndpoint documentation]: https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-vpc-endpoints.html - // Wire name: 'state' State string `json:"state,omitempty"` // This enumeration represents the type of Databricks VPC [endpoint service] // that was used when creating this VPC endpoint. // // [endpoint service]: https://docs.aws.amazon.com/vpc/latest/privatelink/endpoint-service.html - // Wire name: 'use_case' UseCase EndpointUseCase `json:"use_case,omitempty"` // Databricks VPC endpoint ID. This is the Databricks-specific name of the // VPC endpoint. Do not confuse this with the `aws_vpc_endpoint_id`, which // is the ID within AWS of the VPC endpoint. - // Wire name: 'vpc_endpoint_id' VpcEndpointId string `json:"vpc_endpoint_id,omitempty"` // The human-readable name of the storage configuration. - // Wire name: 'vpc_endpoint_name' VpcEndpointName string `json:"vpc_endpoint_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *VpcEndpoint) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &vpcEndpointPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := vpcEndpointFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *VpcEndpoint) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st VpcEndpoint) MarshalJSON() ([]byte, error) { - pb, err := vpcEndpointToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s VpcEndpoint) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The status of this network configuration object in terms of its use in a @@ -2525,32 +1301,24 @@ func (f *WarningType) Type() string { type Workspace struct { // Databricks account ID. - // Wire name: 'account_id' AccountId string `json:"account_id,omitempty"` // The AWS region of the workspace data plane (for example, `us-west-2`). - // Wire name: 'aws_region' AwsRegion string `json:"aws_region,omitempty"` - // Wire name: 'azure_workspace_info' AzureWorkspaceInfo *AzureWorkspaceInfo `json:"azure_workspace_info,omitempty"` // The cloud name. This field always has the value `gcp`. - // Wire name: 'cloud' Cloud string `json:"cloud,omitempty"` // The general workspace configurations that are specific to cloud // providers. - // Wire name: 'cloud_resource_container' CloudResourceContainer *CloudResourceContainer `json:"cloud_resource_container,omitempty"` // Time in epoch milliseconds when the workspace was created. - // Wire name: 'creation_time' CreationTime int64 `json:"creation_time,omitempty"` // ID of the workspace's credential configuration object. - // Wire name: 'credentials_id' CredentialsId string `json:"credentials_id,omitempty"` // The custom tags key-value pairing that is attached to this workspace. The // key-value pair is a string of utf-8 characters. The value can be an empty // string, with maximum length of 255 characters. The key can be of maximum // length of 127 characters, and cannot be empty. - // Wire name: 'custom_tags' CustomTags map[string]string `json:"custom_tags,omitempty"` // The deployment name defines part of the subdomain for the workspace. The // workspace URL for web application and REST APIs is @@ -2558,12 +1326,10 @@ type Workspace struct { // // This value must be unique across all non-deleted deployments across all // AWS regions. - // Wire name: 'deployment_name' DeploymentName string `json:"deployment_name,omitempty"` // If this workspace is for a external customer, then external_customer_info // is populated. If this workspace is not for a external customer, then // external_customer_info is empty. - // Wire name: 'external_customer_info' ExternalCustomerInfo *ExternalCustomerInfo `json:"external_customer_info,omitempty"` // The network settings for the workspace. The configurations are only for // Databricks-managed VPCs. It is ignored if you specify a customer-managed @@ -2588,30 +1354,23 @@ type Workspace struct { // for a new workspace]. // // [calculate subnet sizes for a new workspace]: https://docs.gcp.databricks.com/administration-guide/cloud-configurations/gcp/network-sizing.html - // Wire name: 'gcp_managed_network_config' GcpManagedNetworkConfig *GcpManagedNetworkConfig `json:"gcp_managed_network_config,omitempty"` // The configurations for the GKE cluster of a Databricks workspace. - // Wire name: 'gke_config' GkeConfig *GkeConfig `json:"gke_config,omitempty"` // Whether no public IP is enabled for the workspace. - // Wire name: 'is_no_public_ip_enabled' IsNoPublicIpEnabled bool `json:"is_no_public_ip_enabled,omitempty"` // The Google Cloud region of the workspace data plane in your Google // account (for example, `us-east4`). - // Wire name: 'location' Location string `json:"location,omitempty"` // ID of the key configuration for encrypting managed services. - // Wire name: 'managed_services_customer_managed_key_id' ManagedServicesCustomerManagedKeyId string `json:"managed_services_customer_managed_key_id,omitempty"` // The network configuration ID that is attached to the workspace. This // field is available only if the network is a customer-managed network. - // Wire name: 'network_id' NetworkId string `json:"network_id,omitempty"` // The pricing tier of the workspace. For pricing tier information, see [AWS // Pricing]. // // [AWS Pricing]: https://databricks.com/product/aws-pricing - // Wire name: 'pricing_tier' PricingTier PricingTier `json:"pricing_tier,omitempty"` // ID of the workspace's private access settings object. Only used for // PrivateLink. You must specify this ID if you are using [AWS PrivateLink] @@ -2623,55 +1382,31 @@ type Workspace struct { // // [AWS PrivateLink]: https://aws.amazon.com/privatelink/ // [Databricks article about PrivateLink]: https://docs.databricks.com/administration-guide/cloud-configurations/aws/privatelink.html - // Wire name: 'private_access_settings_id' PrivateAccessSettingsId string `json:"private_access_settings_id,omitempty"` // ID of the workspace's storage configuration object. - // Wire name: 'storage_configuration_id' StorageConfigurationId string `json:"storage_configuration_id,omitempty"` // ID of the key configuration for encrypting workspace storage. - // Wire name: 'storage_customer_managed_key_id' StorageCustomerManagedKeyId string `json:"storage_customer_managed_key_id,omitempty"` // A unique integer ID for the workspace - // Wire name: 'workspace_id' WorkspaceId int64 `json:"workspace_id,omitempty"` // The human-readable name of the workspace. - // Wire name: 'workspace_name' WorkspaceName string `json:"workspace_name,omitempty"` // The status of the workspace. For workspace creation, usually it is set to // `PROVISIONING` initially. Continue to check the status until the status // is `RUNNING`. - // Wire name: 'workspace_status' WorkspaceStatus WorkspaceStatus `json:"workspace_status,omitempty"` // Message describing the current workspace status. - // Wire name: 'workspace_status_message' WorkspaceStatusMessage string `json:"workspace_status_message,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *Workspace) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &workspacePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := workspaceFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *Workspace) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st Workspace) MarshalJSON() ([]byte, error) { - pb, err := workspaceToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s Workspace) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The status of the workspace. For workspace creation, usually it is set to diff --git a/service/qualitymonitorv2/impl.go b/service/qualitymonitorv2/impl.go index f51a46756..4c38620b5 100755 --- a/service/qualitymonitorv2/impl.go +++ b/service/qualitymonitorv2/impl.go @@ -18,96 +18,34 @@ type qualityMonitorV2Impl struct { } func (a *qualityMonitorV2Impl) CreateQualityMonitor(ctx context.Context, request CreateQualityMonitorRequest) (*QualityMonitor, error) { - - requestPb, pbErr := createQualityMonitorRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var qualityMonitorPb qualityMonitorPb + var qualityMonitor QualityMonitor path := "/api/2.0/quality-monitors" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb).QualityMonitor, - &qualityMonitorPb, - ) - if err != nil { - return nil, err - } - resp, err := qualityMonitorFromPb(&qualityMonitorPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.QualityMonitor, &qualityMonitor) + return &qualityMonitor, err } func (a *qualityMonitorV2Impl) DeleteQualityMonitor(ctx context.Context, request DeleteQualityMonitorRequest) error { - - requestPb, pbErr := deleteQualityMonitorRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteQualityMonitorResponsePb deleteQualityMonitorResponsePb - path := fmt.Sprintf("/api/2.0/quality-monitors/%v/%v", requestPb.ObjectType, requestPb.ObjectId) + var deleteQualityMonitorResponse DeleteQualityMonitorResponse + path := fmt.Sprintf("/api/2.0/quality-monitors/%v/%v", request.ObjectType, request.ObjectId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteQualityMonitorResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteQualityMonitorResponse) return err } func (a *qualityMonitorV2Impl) GetQualityMonitor(ctx context.Context, request GetQualityMonitorRequest) (*QualityMonitor, error) { - - requestPb, pbErr := getQualityMonitorRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var qualityMonitorPb qualityMonitorPb - path := fmt.Sprintf("/api/2.0/quality-monitors/%v/%v", requestPb.ObjectType, requestPb.ObjectId) + var qualityMonitor QualityMonitor + path := fmt.Sprintf("/api/2.0/quality-monitors/%v/%v", request.ObjectType, request.ObjectId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &qualityMonitorPb, - ) - if err != nil { - return nil, err - } - resp, err := qualityMonitorFromPb(&qualityMonitorPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &qualityMonitor) + return &qualityMonitor, err } // (Unimplemented) List quality monitors @@ -142,66 +80,22 @@ func (a *qualityMonitorV2Impl) ListQualityMonitorAll(ctx context.Context, reques } func (a *qualityMonitorV2Impl) internalListQualityMonitor(ctx context.Context, request ListQualityMonitorRequest) (*ListQualityMonitorResponse, error) { - - requestPb, pbErr := listQualityMonitorRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listQualityMonitorResponsePb listQualityMonitorResponsePb + var listQualityMonitorResponse ListQualityMonitorResponse path := "/api/2.0/quality-monitors" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listQualityMonitorResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listQualityMonitorResponseFromPb(&listQualityMonitorResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listQualityMonitorResponse) + return &listQualityMonitorResponse, err } func (a *qualityMonitorV2Impl) UpdateQualityMonitor(ctx context.Context, request UpdateQualityMonitorRequest) (*QualityMonitor, error) { - - requestPb, pbErr := updateQualityMonitorRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var qualityMonitorPb qualityMonitorPb - path := fmt.Sprintf("/api/2.0/quality-monitors/%v/%v", requestPb.ObjectType, requestPb.ObjectId) + var qualityMonitor QualityMonitor + path := fmt.Sprintf("/api/2.0/quality-monitors/%v/%v", request.ObjectType, request.ObjectId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPut, - path, - headers, - queryParams, - (*requestPb).QualityMonitor, - &qualityMonitorPb, - ) - if err != nil { - return nil, err - } - resp, err := qualityMonitorFromPb(&qualityMonitorPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request.QualityMonitor, &qualityMonitor) + return &qualityMonitor, err } diff --git a/service/qualitymonitorv2/internal.go b/service/qualitymonitorv2/internal.go deleted file mode 100755 index 64ef95b52..000000000 --- a/service/qualitymonitorv2/internal.go +++ /dev/null @@ -1,341 +0,0 @@ -// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. - -package qualitymonitorv2 - -import ( - "fmt" - "strings" - "time" - - "github.com/databricks/databricks-sdk-go/marshal" -) - -func anomalyDetectionConfigToPb(st *AnomalyDetectionConfig) (*anomalyDetectionConfigPb, error) { - if st == nil { - return nil, nil - } - pb := &anomalyDetectionConfigPb{} - pb.LastRunId = st.LastRunId - pb.LatestRunStatus = st.LatestRunStatus - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type anomalyDetectionConfigPb struct { - LastRunId string `json:"last_run_id,omitempty"` - LatestRunStatus AnomalyDetectionRunStatus `json:"latest_run_status,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func anomalyDetectionConfigFromPb(pb *anomalyDetectionConfigPb) (*AnomalyDetectionConfig, error) { - if pb == nil { - return nil, nil - } - st := &AnomalyDetectionConfig{} - st.LastRunId = pb.LastRunId - st.LatestRunStatus = pb.LatestRunStatus - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *anomalyDetectionConfigPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st anomalyDetectionConfigPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createQualityMonitorRequestToPb(st *CreateQualityMonitorRequest) (*createQualityMonitorRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &createQualityMonitorRequestPb{} - pb.QualityMonitor = st.QualityMonitor - - return pb, nil -} - -type createQualityMonitorRequestPb struct { - QualityMonitor QualityMonitor `json:"quality_monitor"` -} - -func createQualityMonitorRequestFromPb(pb *createQualityMonitorRequestPb) (*CreateQualityMonitorRequest, error) { - if pb == nil { - return nil, nil - } - st := &CreateQualityMonitorRequest{} - st.QualityMonitor = pb.QualityMonitor - - return st, nil -} - -func deleteQualityMonitorRequestToPb(st *DeleteQualityMonitorRequest) (*deleteQualityMonitorRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteQualityMonitorRequestPb{} - pb.ObjectId = st.ObjectId - pb.ObjectType = st.ObjectType - - return pb, nil -} - -type deleteQualityMonitorRequestPb struct { - ObjectId string `json:"-" url:"-"` - ObjectType string `json:"-" url:"-"` -} - -func deleteQualityMonitorRequestFromPb(pb *deleteQualityMonitorRequestPb) (*DeleteQualityMonitorRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteQualityMonitorRequest{} - st.ObjectId = pb.ObjectId - st.ObjectType = pb.ObjectType - - return st, nil -} - -func deleteQualityMonitorResponseToPb(st *DeleteQualityMonitorResponse) (*deleteQualityMonitorResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteQualityMonitorResponsePb{} - - return pb, nil -} - -type deleteQualityMonitorResponsePb struct { -} - -func deleteQualityMonitorResponseFromPb(pb *deleteQualityMonitorResponsePb) (*DeleteQualityMonitorResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteQualityMonitorResponse{} - - return st, nil -} - -func getQualityMonitorRequestToPb(st *GetQualityMonitorRequest) (*getQualityMonitorRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getQualityMonitorRequestPb{} - pb.ObjectId = st.ObjectId - pb.ObjectType = st.ObjectType - - return pb, nil -} - -type getQualityMonitorRequestPb struct { - ObjectId string `json:"-" url:"-"` - ObjectType string `json:"-" url:"-"` -} - -func getQualityMonitorRequestFromPb(pb *getQualityMonitorRequestPb) (*GetQualityMonitorRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetQualityMonitorRequest{} - st.ObjectId = pb.ObjectId - st.ObjectType = pb.ObjectType - - return st, nil -} - -func listQualityMonitorRequestToPb(st *ListQualityMonitorRequest) (*listQualityMonitorRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listQualityMonitorRequestPb{} - pb.PageSize = st.PageSize - pb.PageToken = st.PageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listQualityMonitorRequestPb struct { - PageSize int `json:"-" url:"page_size,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listQualityMonitorRequestFromPb(pb *listQualityMonitorRequestPb) (*ListQualityMonitorRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListQualityMonitorRequest{} - st.PageSize = pb.PageSize - st.PageToken = pb.PageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listQualityMonitorRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listQualityMonitorRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listQualityMonitorResponseToPb(st *ListQualityMonitorResponse) (*listQualityMonitorResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listQualityMonitorResponsePb{} - pb.NextPageToken = st.NextPageToken - pb.QualityMonitors = st.QualityMonitors - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listQualityMonitorResponsePb struct { - NextPageToken string `json:"next_page_token,omitempty"` - QualityMonitors []QualityMonitor `json:"quality_monitors,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listQualityMonitorResponseFromPb(pb *listQualityMonitorResponsePb) (*ListQualityMonitorResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListQualityMonitorResponse{} - st.NextPageToken = pb.NextPageToken - st.QualityMonitors = pb.QualityMonitors - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listQualityMonitorResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listQualityMonitorResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func qualityMonitorToPb(st *QualityMonitor) (*qualityMonitorPb, error) { - if st == nil { - return nil, nil - } - pb := &qualityMonitorPb{} - pb.AnomalyDetectionConfig = st.AnomalyDetectionConfig - pb.ObjectId = st.ObjectId - pb.ObjectType = st.ObjectType - - return pb, nil -} - -type qualityMonitorPb struct { - AnomalyDetectionConfig *AnomalyDetectionConfig `json:"anomaly_detection_config,omitempty"` - ObjectId string `json:"object_id"` - ObjectType string `json:"object_type"` -} - -func qualityMonitorFromPb(pb *qualityMonitorPb) (*QualityMonitor, error) { - if pb == nil { - return nil, nil - } - st := &QualityMonitor{} - st.AnomalyDetectionConfig = pb.AnomalyDetectionConfig - st.ObjectId = pb.ObjectId - st.ObjectType = pb.ObjectType - - return st, nil -} - -func updateQualityMonitorRequestToPb(st *UpdateQualityMonitorRequest) (*updateQualityMonitorRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &updateQualityMonitorRequestPb{} - pb.ObjectId = st.ObjectId - pb.ObjectType = st.ObjectType - pb.QualityMonitor = st.QualityMonitor - - return pb, nil -} - -type updateQualityMonitorRequestPb struct { - ObjectId string `json:"-" url:"-"` - ObjectType string `json:"-" url:"-"` - QualityMonitor QualityMonitor `json:"quality_monitor"` -} - -func updateQualityMonitorRequestFromPb(pb *updateQualityMonitorRequestPb) (*UpdateQualityMonitorRequest, error) { - if pb == nil { - return nil, nil - } - st := &UpdateQualityMonitorRequest{} - st.ObjectId = pb.ObjectId - st.ObjectType = pb.ObjectType - st.QualityMonitor = pb.QualityMonitor - - return st, nil -} - -func durationToPb(d *time.Duration) (*string, error) { - if d == nil { - return nil, nil - } - s := fmt.Sprintf("%.9fs", d.Seconds()) - return &s, nil -} - -func durationFromPb(s *string) (*time.Duration, error) { - if s == nil { - return nil, nil - } - d, err := time.ParseDuration(*s) - if err != nil { - return nil, err - } - return &d, nil -} - -func timestampToPb(t *time.Time) (*string, error) { - if t == nil { - return nil, nil - } - s := t.Format(time.RFC3339) - return &s, nil -} - -func timestampFromPb(s *string) (*time.Time, error) { - if s == nil { - return nil, nil - } - t, err := time.Parse(time.RFC3339, *s) - if err != nil { - return nil, err - } - return &t, nil -} - -func fieldMaskToPb(fm *[]string) (*string, error) { - if fm == nil { - return nil, nil - } - s := strings.Join(*fm, ",") - return &s, nil -} - -func fieldMaskFromPb(s *string) (*[]string, error) { - if s == nil { - return nil, nil - } - fm := strings.Split(*s, ",") - return &fm, nil -} diff --git a/service/qualitymonitorv2/model.go b/service/qualitymonitorv2/model.go index 18c07347c..17bd86443 100755 --- a/service/qualitymonitorv2/model.go +++ b/service/qualitymonitorv2/model.go @@ -3,44 +3,26 @@ package qualitymonitorv2 import ( - "encoding/json" "fmt" + + "github.com/databricks/databricks-sdk-go/marshal" ) type AnomalyDetectionConfig struct { // Run id of the last run of the workflow - // Wire name: 'last_run_id' LastRunId string `json:"last_run_id,omitempty"` // The status of the last run of the workflow. - // Wire name: 'latest_run_status' LatestRunStatus AnomalyDetectionRunStatus `json:"latest_run_status,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *AnomalyDetectionConfig) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &anomalyDetectionConfigPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := anomalyDetectionConfigFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *AnomalyDetectionConfig) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st AnomalyDetectionConfig) MarshalJSON() ([]byte, error) { - pb, err := anomalyDetectionConfigToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s AnomalyDetectionConfig) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Status of Anomaly Detection Job Run @@ -101,269 +83,75 @@ func (f *AnomalyDetectionRunStatus) Type() string { // Create a quality monitor type CreateQualityMonitorRequest struct { - - // Wire name: 'quality_monitor' QualityMonitor QualityMonitor `json:"quality_monitor"` } -func (st *CreateQualityMonitorRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createQualityMonitorRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createQualityMonitorRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CreateQualityMonitorRequest) MarshalJSON() ([]byte, error) { - pb, err := createQualityMonitorRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Delete a quality monitor type DeleteQualityMonitorRequest struct { // The uuid of the request object. For example, schema id. - ObjectId string `json:"-" tf:"-"` + ObjectId string `json:"-" url:"-"` // The type of the monitored object. Can be one of the following: schema. - ObjectType string `json:"-" tf:"-"` -} - -func (st *DeleteQualityMonitorRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteQualityMonitorRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteQualityMonitorRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteQualityMonitorRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteQualityMonitorRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + ObjectType string `json:"-" url:"-"` } type DeleteQualityMonitorResponse struct { } -func (st *DeleteQualityMonitorResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteQualityMonitorResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteQualityMonitorResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteQualityMonitorResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteQualityMonitorResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Read a quality monitor type GetQualityMonitorRequest struct { // The uuid of the request object. For example, schema id. - ObjectId string `json:"-" tf:"-"` + ObjectId string `json:"-" url:"-"` // The type of the monitored object. Can be one of the following: schema. - ObjectType string `json:"-" tf:"-"` -} - -func (st *GetQualityMonitorRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getQualityMonitorRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getQualityMonitorRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetQualityMonitorRequest) MarshalJSON() ([]byte, error) { - pb, err := getQualityMonitorRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + ObjectType string `json:"-" url:"-"` } // List quality monitors type ListQualityMonitorRequest struct { - PageSize int `json:"-" tf:"-"` + PageSize int `json:"-" url:"page_size,omitempty"` - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListQualityMonitorRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listQualityMonitorRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listQualityMonitorRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListQualityMonitorRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListQualityMonitorRequest) MarshalJSON() ([]byte, error) { - pb, err := listQualityMonitorRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListQualityMonitorRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListQualityMonitorResponse struct { - - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` - // Wire name: 'quality_monitors' QualityMonitors []QualityMonitor `json:"quality_monitors,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListQualityMonitorResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listQualityMonitorResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listQualityMonitorResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListQualityMonitorResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListQualityMonitorResponse) MarshalJSON() ([]byte, error) { - pb, err := listQualityMonitorResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListQualityMonitorResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type QualityMonitor struct { - - // Wire name: 'anomaly_detection_config' AnomalyDetectionConfig *AnomalyDetectionConfig `json:"anomaly_detection_config,omitempty"` // The uuid of the request object. For example, schema id. - // Wire name: 'object_id' ObjectId string `json:"object_id"` // The type of the monitored object. Can be one of the following: schema. - // Wire name: 'object_type' ObjectType string `json:"object_type"` } -func (st *QualityMonitor) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &qualityMonitorPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := qualityMonitorFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st QualityMonitor) MarshalJSON() ([]byte, error) { - pb, err := qualityMonitorToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Update a quality monitor type UpdateQualityMonitorRequest struct { // The uuid of the request object. For example, schema id. - ObjectId string `json:"-" tf:"-"` + ObjectId string `json:"-" url:"-"` // The type of the monitored object. Can be one of the following: schema. - ObjectType string `json:"-" tf:"-"` + ObjectType string `json:"-" url:"-"` - // Wire name: 'quality_monitor' QualityMonitor QualityMonitor `json:"quality_monitor"` } - -func (st *UpdateQualityMonitorRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateQualityMonitorRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateQualityMonitorRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateQualityMonitorRequest) MarshalJSON() ([]byte, error) { - pb, err := updateQualityMonitorRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} diff --git a/service/serving/impl.go b/service/serving/impl.go index ea958d6bd..b4fa2f11f 100755 --- a/service/serving/impl.go +++ b/service/serving/impl.go @@ -22,321 +22,105 @@ type servingEndpointsImpl struct { } func (a *servingEndpointsImpl) BuildLogs(ctx context.Context, request BuildLogsRequest) (*BuildLogsResponse, error) { - - requestPb, pbErr := buildLogsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var buildLogsResponsePb buildLogsResponsePb - path := fmt.Sprintf("/api/2.0/serving-endpoints/%v/served-models/%v/build-logs", requestPb.Name, requestPb.ServedModelName) + var buildLogsResponse BuildLogsResponse + path := fmt.Sprintf("/api/2.0/serving-endpoints/%v/served-models/%v/build-logs", request.Name, request.ServedModelName) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &buildLogsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := buildLogsResponseFromPb(&buildLogsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &buildLogsResponse) + return &buildLogsResponse, err } func (a *servingEndpointsImpl) Create(ctx context.Context, request CreateServingEndpoint) (*ServingEndpointDetailed, error) { - - requestPb, pbErr := createServingEndpointToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var servingEndpointDetailedPb servingEndpointDetailedPb + var servingEndpointDetailed ServingEndpointDetailed path := "/api/2.0/serving-endpoints" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &servingEndpointDetailedPb, - ) - if err != nil { - return nil, err - } - resp, err := servingEndpointDetailedFromPb(&servingEndpointDetailedPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &servingEndpointDetailed) + return &servingEndpointDetailed, err } func (a *servingEndpointsImpl) CreateProvisionedThroughputEndpoint(ctx context.Context, request CreatePtEndpointRequest) (*ServingEndpointDetailed, error) { - - requestPb, pbErr := createPtEndpointRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var servingEndpointDetailedPb servingEndpointDetailedPb + var servingEndpointDetailed ServingEndpointDetailed path := "/api/2.0/serving-endpoints/pt" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &servingEndpointDetailedPb, - ) - if err != nil { - return nil, err - } - resp, err := servingEndpointDetailedFromPb(&servingEndpointDetailedPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &servingEndpointDetailed) + return &servingEndpointDetailed, err } func (a *servingEndpointsImpl) Delete(ctx context.Context, request DeleteServingEndpointRequest) error { - - requestPb, pbErr := deleteServingEndpointRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteResponsePb deleteResponsePb - path := fmt.Sprintf("/api/2.0/serving-endpoints/%v", requestPb.Name) + var deleteResponse DeleteResponse + path := fmt.Sprintf("/api/2.0/serving-endpoints/%v", request.Name) queryParams := make(map[string]any) headers := make(map[string]string) - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteResponse) return err } func (a *servingEndpointsImpl) ExportMetrics(ctx context.Context, request ExportMetricsRequest) (*ExportMetricsResponse, error) { - - requestPb, pbErr := exportMetricsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var exportMetricsResponsePb exportMetricsResponsePb - path := fmt.Sprintf("/api/2.0/serving-endpoints/%v/metrics", requestPb.Name) + var exportMetricsResponse ExportMetricsResponse + path := fmt.Sprintf("/api/2.0/serving-endpoints/%v/metrics", request.Name) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "text/plain" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &exportMetricsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := exportMetricsResponseFromPb(&exportMetricsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &exportMetricsResponse) + return &exportMetricsResponse, err } func (a *servingEndpointsImpl) Get(ctx context.Context, request GetServingEndpointRequest) (*ServingEndpointDetailed, error) { - - requestPb, pbErr := getServingEndpointRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var servingEndpointDetailedPb servingEndpointDetailedPb - path := fmt.Sprintf("/api/2.0/serving-endpoints/%v", requestPb.Name) + var servingEndpointDetailed ServingEndpointDetailed + path := fmt.Sprintf("/api/2.0/serving-endpoints/%v", request.Name) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &servingEndpointDetailedPb, - ) - if err != nil { - return nil, err - } - resp, err := servingEndpointDetailedFromPb(&servingEndpointDetailedPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &servingEndpointDetailed) + return &servingEndpointDetailed, err } func (a *servingEndpointsImpl) GetOpenApi(ctx context.Context, request GetOpenApiRequest) (*GetOpenApiResponse, error) { - - requestPb, pbErr := getOpenApiRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var getOpenApiResponsePb getOpenApiResponsePb - path := fmt.Sprintf("/api/2.0/serving-endpoints/%v/openapi", requestPb.Name) + var getOpenApiResponse GetOpenApiResponse + path := fmt.Sprintf("/api/2.0/serving-endpoints/%v/openapi", request.Name) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "text/plain" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &getOpenApiResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := getOpenApiResponseFromPb(&getOpenApiResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getOpenApiResponse) + return &getOpenApiResponse, err } func (a *servingEndpointsImpl) GetPermissionLevels(ctx context.Context, request GetServingEndpointPermissionLevelsRequest) (*GetServingEndpointPermissionLevelsResponse, error) { - - requestPb, pbErr := getServingEndpointPermissionLevelsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var getServingEndpointPermissionLevelsResponsePb getServingEndpointPermissionLevelsResponsePb - path := fmt.Sprintf("/api/2.0/permissions/serving-endpoints/%v/permissionLevels", requestPb.ServingEndpointId) + var getServingEndpointPermissionLevelsResponse GetServingEndpointPermissionLevelsResponse + path := fmt.Sprintf("/api/2.0/permissions/serving-endpoints/%v/permissionLevels", request.ServingEndpointId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &getServingEndpointPermissionLevelsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := getServingEndpointPermissionLevelsResponseFromPb(&getServingEndpointPermissionLevelsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getServingEndpointPermissionLevelsResponse) + return &getServingEndpointPermissionLevelsResponse, err } func (a *servingEndpointsImpl) GetPermissions(ctx context.Context, request GetServingEndpointPermissionsRequest) (*ServingEndpointPermissions, error) { - - requestPb, pbErr := getServingEndpointPermissionsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var servingEndpointPermissionsPb servingEndpointPermissionsPb - path := fmt.Sprintf("/api/2.0/permissions/serving-endpoints/%v", requestPb.ServingEndpointId) + var servingEndpointPermissions ServingEndpointPermissions + path := fmt.Sprintf("/api/2.0/permissions/serving-endpoints/%v", request.ServingEndpointId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &servingEndpointPermissionsPb, - ) - if err != nil { - return nil, err - } - resp, err := servingEndpointPermissionsFromPb(&servingEndpointPermissionsPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &servingEndpointPermissions) + return &servingEndpointPermissions, err } func (a *servingEndpointsImpl) HttpRequest(ctx context.Context, request ExternalFunctionRequest) (*HttpRequestResponse, error) { - - requestPb, pbErr := externalFunctionRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var httpRequestResponsePb httpRequestResponsePb + var httpRequestResponse HttpRequestResponse path := "/api/2.0/external-function" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "text/plain" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &httpRequestResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := httpRequestResponseFromPb(&httpRequestResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &httpRequestResponse) + return &httpRequestResponse, err } // Get all serving endpoints. @@ -366,326 +150,111 @@ func (a *servingEndpointsImpl) ListAll(ctx context.Context) ([]ServingEndpoint, } func (a *servingEndpointsImpl) internalList(ctx context.Context) (*ListEndpointsResponse, error) { - - var listEndpointsResponsePb listEndpointsResponsePb + var listEndpointsResponse ListEndpointsResponse path := "/api/2.0/serving-endpoints" headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - nil, - nil, - &listEndpointsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listEndpointsResponseFromPb(&listEndpointsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, nil, nil, &listEndpointsResponse) + return &listEndpointsResponse, err } func (a *servingEndpointsImpl) Logs(ctx context.Context, request LogsRequest) (*ServerLogsResponse, error) { - - requestPb, pbErr := logsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var serverLogsResponsePb serverLogsResponsePb - path := fmt.Sprintf("/api/2.0/serving-endpoints/%v/served-models/%v/logs", requestPb.Name, requestPb.ServedModelName) + var serverLogsResponse ServerLogsResponse + path := fmt.Sprintf("/api/2.0/serving-endpoints/%v/served-models/%v/logs", request.Name, request.ServedModelName) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &serverLogsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := serverLogsResponseFromPb(&serverLogsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &serverLogsResponse) + return &serverLogsResponse, err } func (a *servingEndpointsImpl) Patch(ctx context.Context, request PatchServingEndpointTags) (*EndpointTags, error) { - - requestPb, pbErr := patchServingEndpointTagsToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var endpointTagsPb endpointTagsPb - path := fmt.Sprintf("/api/2.0/serving-endpoints/%v/tags", requestPb.Name) + var endpointTags EndpointTags + path := fmt.Sprintf("/api/2.0/serving-endpoints/%v/tags", request.Name) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &endpointTagsPb, - ) - if err != nil { - return nil, err - } - resp, err := endpointTagsFromPb(&endpointTagsPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &endpointTags) + return &endpointTags, err } func (a *servingEndpointsImpl) Put(ctx context.Context, request PutRequest) (*PutResponse, error) { - - requestPb, pbErr := putRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var putResponsePb putResponsePb - path := fmt.Sprintf("/api/2.0/serving-endpoints/%v/rate-limits", requestPb.Name) + var putResponse PutResponse + path := fmt.Sprintf("/api/2.0/serving-endpoints/%v/rate-limits", request.Name) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPut, - path, - headers, - queryParams, - (*requestPb), - &putResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := putResponseFromPb(&putResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &putResponse) + return &putResponse, err } func (a *servingEndpointsImpl) PutAiGateway(ctx context.Context, request PutAiGatewayRequest) (*PutAiGatewayResponse, error) { - - requestPb, pbErr := putAiGatewayRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var putAiGatewayResponsePb putAiGatewayResponsePb - path := fmt.Sprintf("/api/2.0/serving-endpoints/%v/ai-gateway", requestPb.Name) + var putAiGatewayResponse PutAiGatewayResponse + path := fmt.Sprintf("/api/2.0/serving-endpoints/%v/ai-gateway", request.Name) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPut, - path, - headers, - queryParams, - (*requestPb), - &putAiGatewayResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := putAiGatewayResponseFromPb(&putAiGatewayResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &putAiGatewayResponse) + return &putAiGatewayResponse, err } func (a *servingEndpointsImpl) Query(ctx context.Context, request QueryEndpointInput) (*QueryEndpointResponse, error) { - - requestPb, pbErr := queryEndpointInputToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var queryEndpointResponsePb queryEndpointResponsePb - path := fmt.Sprintf("/serving-endpoints/%v/invocations", requestPb.Name) + var queryEndpointResponse QueryEndpointResponse + path := fmt.Sprintf("/serving-endpoints/%v/invocations", request.Name) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &queryEndpointResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := queryEndpointResponseFromPb(&queryEndpointResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &queryEndpointResponse) + return &queryEndpointResponse, err } func (a *servingEndpointsImpl) SetPermissions(ctx context.Context, request ServingEndpointPermissionsRequest) (*ServingEndpointPermissions, error) { - - requestPb, pbErr := servingEndpointPermissionsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var servingEndpointPermissionsPb servingEndpointPermissionsPb - path := fmt.Sprintf("/api/2.0/permissions/serving-endpoints/%v", requestPb.ServingEndpointId) + var servingEndpointPermissions ServingEndpointPermissions + path := fmt.Sprintf("/api/2.0/permissions/serving-endpoints/%v", request.ServingEndpointId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPut, - path, - headers, - queryParams, - (*requestPb), - &servingEndpointPermissionsPb, - ) - if err != nil { - return nil, err - } - resp, err := servingEndpointPermissionsFromPb(&servingEndpointPermissionsPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &servingEndpointPermissions) + return &servingEndpointPermissions, err } func (a *servingEndpointsImpl) UpdateConfig(ctx context.Context, request EndpointCoreConfigInput) (*ServingEndpointDetailed, error) { - - requestPb, pbErr := endpointCoreConfigInputToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var servingEndpointDetailedPb servingEndpointDetailedPb - path := fmt.Sprintf("/api/2.0/serving-endpoints/%v/config", requestPb.Name) + var servingEndpointDetailed ServingEndpointDetailed + path := fmt.Sprintf("/api/2.0/serving-endpoints/%v/config", request.Name) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPut, - path, - headers, - queryParams, - (*requestPb), - &servingEndpointDetailedPb, - ) - if err != nil { - return nil, err - } - resp, err := servingEndpointDetailedFromPb(&servingEndpointDetailedPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &servingEndpointDetailed) + return &servingEndpointDetailed, err } func (a *servingEndpointsImpl) UpdatePermissions(ctx context.Context, request ServingEndpointPermissionsRequest) (*ServingEndpointPermissions, error) { - - requestPb, pbErr := servingEndpointPermissionsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var servingEndpointPermissionsPb servingEndpointPermissionsPb - path := fmt.Sprintf("/api/2.0/permissions/serving-endpoints/%v", requestPb.ServingEndpointId) + var servingEndpointPermissions ServingEndpointPermissions + path := fmt.Sprintf("/api/2.0/permissions/serving-endpoints/%v", request.ServingEndpointId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &servingEndpointPermissionsPb, - ) - if err != nil { - return nil, err - } - resp, err := servingEndpointPermissionsFromPb(&servingEndpointPermissionsPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &servingEndpointPermissions) + return &servingEndpointPermissions, err } func (a *servingEndpointsImpl) UpdateProvisionedThroughputEndpointConfig(ctx context.Context, request UpdateProvisionedThroughputEndpointConfigRequest) (*ServingEndpointDetailed, error) { - - requestPb, pbErr := updateProvisionedThroughputEndpointConfigRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var servingEndpointDetailedPb servingEndpointDetailedPb - path := fmt.Sprintf("/api/2.0/serving-endpoints/pt/%v/config", requestPb.Name) + var servingEndpointDetailed ServingEndpointDetailed + path := fmt.Sprintf("/api/2.0/serving-endpoints/pt/%v/config", request.Name) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPut, - path, - headers, - queryParams, - (*requestPb), - &servingEndpointDetailedPb, - ) - if err != nil { - return nil, err - } - resp, err := servingEndpointDetailedFromPb(&servingEndpointDetailedPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &servingEndpointDetailed) + return &servingEndpointDetailed, err } // unexported type that holds implementations of just ServingEndpointsDataPlane API methods @@ -716,12 +285,6 @@ func (a *servingEndpointsDataPlaneImpl) dataPlaneInfoQuery(ctx context.Context, } func (a *servingEndpointsDataPlaneImpl) Query(ctx context.Context, request QueryEndpointInput) (*QueryEndpointResponse, error) { - - requestPb, pbErr := queryEndpointInputToPb(&request) - if pbErr != nil { - return nil, pbErr - } - dpi, err := a.dataPlaneInfoQuery(ctx, request) if err != nil { return nil, err @@ -739,18 +302,10 @@ func (a *servingEndpointsDataPlaneImpl) Query(ctx context.Context, request Query queryParams := make(map[string]any) opts = append(opts, httpclient.WithQueryParameters(queryParams)) - var queryEndpointResponsePb queryEndpointResponsePb - opts = append(opts, httpclient.WithRequestData(*requestPb)) - opts = append(opts, httpclient.WithResponseUnmarshal(&queryEndpointResponsePb)) + var queryEndpointResponse QueryEndpointResponse + opts = append(opts, httpclient.WithRequestData(request)) + opts = append(opts, httpclient.WithResponseUnmarshal(&queryEndpointResponse)) opts = append(opts, httpclient.WithToken(dpt)) err = a.client.ApiClient().Do(ctx, http.MethodPost, dpi.EndpointUrl, opts...) - if err != nil { - return nil, err - } - resp, err := queryEndpointResponseFromPb(&queryEndpointResponsePb) - if err != nil { - return nil, err - } - - return resp, err + return &queryEndpointResponse, err } diff --git a/service/serving/internal.go b/service/serving/internal.go deleted file mode 100755 index 208d794e2..000000000 --- a/service/serving/internal.go +++ /dev/null @@ -1,3432 +0,0 @@ -// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. - -package serving - -import ( - "fmt" - "io" - "strings" - "time" - - "github.com/databricks/databricks-sdk-go/marshal" -) - -func ai21LabsConfigToPb(st *Ai21LabsConfig) (*ai21LabsConfigPb, error) { - if st == nil { - return nil, nil - } - pb := &ai21LabsConfigPb{} - pb.Ai21labsApiKey = st.Ai21labsApiKey - pb.Ai21labsApiKeyPlaintext = st.Ai21labsApiKeyPlaintext - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type ai21LabsConfigPb struct { - Ai21labsApiKey string `json:"ai21labs_api_key,omitempty"` - Ai21labsApiKeyPlaintext string `json:"ai21labs_api_key_plaintext,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func ai21LabsConfigFromPb(pb *ai21LabsConfigPb) (*Ai21LabsConfig, error) { - if pb == nil { - return nil, nil - } - st := &Ai21LabsConfig{} - st.Ai21labsApiKey = pb.Ai21labsApiKey - st.Ai21labsApiKeyPlaintext = pb.Ai21labsApiKeyPlaintext - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *ai21LabsConfigPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st ai21LabsConfigPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func aiGatewayConfigToPb(st *AiGatewayConfig) (*aiGatewayConfigPb, error) { - if st == nil { - return nil, nil - } - pb := &aiGatewayConfigPb{} - pb.FallbackConfig = st.FallbackConfig - pb.Guardrails = st.Guardrails - pb.InferenceTableConfig = st.InferenceTableConfig - pb.RateLimits = st.RateLimits - pb.UsageTrackingConfig = st.UsageTrackingConfig - - return pb, nil -} - -type aiGatewayConfigPb struct { - FallbackConfig *FallbackConfig `json:"fallback_config,omitempty"` - Guardrails *AiGatewayGuardrails `json:"guardrails,omitempty"` - InferenceTableConfig *AiGatewayInferenceTableConfig `json:"inference_table_config,omitempty"` - RateLimits []AiGatewayRateLimit `json:"rate_limits,omitempty"` - UsageTrackingConfig *AiGatewayUsageTrackingConfig `json:"usage_tracking_config,omitempty"` -} - -func aiGatewayConfigFromPb(pb *aiGatewayConfigPb) (*AiGatewayConfig, error) { - if pb == nil { - return nil, nil - } - st := &AiGatewayConfig{} - st.FallbackConfig = pb.FallbackConfig - st.Guardrails = pb.Guardrails - st.InferenceTableConfig = pb.InferenceTableConfig - st.RateLimits = pb.RateLimits - st.UsageTrackingConfig = pb.UsageTrackingConfig - - return st, nil -} - -func aiGatewayGuardrailParametersToPb(st *AiGatewayGuardrailParameters) (*aiGatewayGuardrailParametersPb, error) { - if st == nil { - return nil, nil - } - pb := &aiGatewayGuardrailParametersPb{} - pb.InvalidKeywords = st.InvalidKeywords - pb.Pii = st.Pii - pb.Safety = st.Safety - pb.ValidTopics = st.ValidTopics - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type aiGatewayGuardrailParametersPb struct { - InvalidKeywords []string `json:"invalid_keywords,omitempty"` - Pii *AiGatewayGuardrailPiiBehavior `json:"pii,omitempty"` - Safety bool `json:"safety,omitempty"` - ValidTopics []string `json:"valid_topics,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func aiGatewayGuardrailParametersFromPb(pb *aiGatewayGuardrailParametersPb) (*AiGatewayGuardrailParameters, error) { - if pb == nil { - return nil, nil - } - st := &AiGatewayGuardrailParameters{} - st.InvalidKeywords = pb.InvalidKeywords - st.Pii = pb.Pii - st.Safety = pb.Safety - st.ValidTopics = pb.ValidTopics - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *aiGatewayGuardrailParametersPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st aiGatewayGuardrailParametersPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func aiGatewayGuardrailPiiBehaviorToPb(st *AiGatewayGuardrailPiiBehavior) (*aiGatewayGuardrailPiiBehaviorPb, error) { - if st == nil { - return nil, nil - } - pb := &aiGatewayGuardrailPiiBehaviorPb{} - pb.Behavior = st.Behavior - - return pb, nil -} - -type aiGatewayGuardrailPiiBehaviorPb struct { - Behavior AiGatewayGuardrailPiiBehaviorBehavior `json:"behavior,omitempty"` -} - -func aiGatewayGuardrailPiiBehaviorFromPb(pb *aiGatewayGuardrailPiiBehaviorPb) (*AiGatewayGuardrailPiiBehavior, error) { - if pb == nil { - return nil, nil - } - st := &AiGatewayGuardrailPiiBehavior{} - st.Behavior = pb.Behavior - - return st, nil -} - -func aiGatewayGuardrailsToPb(st *AiGatewayGuardrails) (*aiGatewayGuardrailsPb, error) { - if st == nil { - return nil, nil - } - pb := &aiGatewayGuardrailsPb{} - pb.Input = st.Input - pb.Output = st.Output - - return pb, nil -} - -type aiGatewayGuardrailsPb struct { - Input *AiGatewayGuardrailParameters `json:"input,omitempty"` - Output *AiGatewayGuardrailParameters `json:"output,omitempty"` -} - -func aiGatewayGuardrailsFromPb(pb *aiGatewayGuardrailsPb) (*AiGatewayGuardrails, error) { - if pb == nil { - return nil, nil - } - st := &AiGatewayGuardrails{} - st.Input = pb.Input - st.Output = pb.Output - - return st, nil -} - -func aiGatewayInferenceTableConfigToPb(st *AiGatewayInferenceTableConfig) (*aiGatewayInferenceTableConfigPb, error) { - if st == nil { - return nil, nil - } - pb := &aiGatewayInferenceTableConfigPb{} - pb.CatalogName = st.CatalogName - pb.Enabled = st.Enabled - pb.SchemaName = st.SchemaName - pb.TableNamePrefix = st.TableNamePrefix - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type aiGatewayInferenceTableConfigPb struct { - CatalogName string `json:"catalog_name,omitempty"` - Enabled bool `json:"enabled,omitempty"` - SchemaName string `json:"schema_name,omitempty"` - TableNamePrefix string `json:"table_name_prefix,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func aiGatewayInferenceTableConfigFromPb(pb *aiGatewayInferenceTableConfigPb) (*AiGatewayInferenceTableConfig, error) { - if pb == nil { - return nil, nil - } - st := &AiGatewayInferenceTableConfig{} - st.CatalogName = pb.CatalogName - st.Enabled = pb.Enabled - st.SchemaName = pb.SchemaName - st.TableNamePrefix = pb.TableNamePrefix - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *aiGatewayInferenceTableConfigPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st aiGatewayInferenceTableConfigPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func aiGatewayRateLimitToPb(st *AiGatewayRateLimit) (*aiGatewayRateLimitPb, error) { - if st == nil { - return nil, nil - } - pb := &aiGatewayRateLimitPb{} - pb.Calls = st.Calls - pb.Key = st.Key - pb.RenewalPeriod = st.RenewalPeriod - - return pb, nil -} - -type aiGatewayRateLimitPb struct { - Calls int64 `json:"calls"` - Key AiGatewayRateLimitKey `json:"key,omitempty"` - RenewalPeriod AiGatewayRateLimitRenewalPeriod `json:"renewal_period"` -} - -func aiGatewayRateLimitFromPb(pb *aiGatewayRateLimitPb) (*AiGatewayRateLimit, error) { - if pb == nil { - return nil, nil - } - st := &AiGatewayRateLimit{} - st.Calls = pb.Calls - st.Key = pb.Key - st.RenewalPeriod = pb.RenewalPeriod - - return st, nil -} - -func aiGatewayUsageTrackingConfigToPb(st *AiGatewayUsageTrackingConfig) (*aiGatewayUsageTrackingConfigPb, error) { - if st == nil { - return nil, nil - } - pb := &aiGatewayUsageTrackingConfigPb{} - pb.Enabled = st.Enabled - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type aiGatewayUsageTrackingConfigPb struct { - Enabled bool `json:"enabled,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func aiGatewayUsageTrackingConfigFromPb(pb *aiGatewayUsageTrackingConfigPb) (*AiGatewayUsageTrackingConfig, error) { - if pb == nil { - return nil, nil - } - st := &AiGatewayUsageTrackingConfig{} - st.Enabled = pb.Enabled - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *aiGatewayUsageTrackingConfigPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st aiGatewayUsageTrackingConfigPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func amazonBedrockConfigToPb(st *AmazonBedrockConfig) (*amazonBedrockConfigPb, error) { - if st == nil { - return nil, nil - } - pb := &amazonBedrockConfigPb{} - pb.AwsAccessKeyId = st.AwsAccessKeyId - pb.AwsAccessKeyIdPlaintext = st.AwsAccessKeyIdPlaintext - pb.AwsRegion = st.AwsRegion - pb.AwsSecretAccessKey = st.AwsSecretAccessKey - pb.AwsSecretAccessKeyPlaintext = st.AwsSecretAccessKeyPlaintext - pb.BedrockProvider = st.BedrockProvider - pb.InstanceProfileArn = st.InstanceProfileArn - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type amazonBedrockConfigPb struct { - AwsAccessKeyId string `json:"aws_access_key_id,omitempty"` - AwsAccessKeyIdPlaintext string `json:"aws_access_key_id_plaintext,omitempty"` - AwsRegion string `json:"aws_region"` - AwsSecretAccessKey string `json:"aws_secret_access_key,omitempty"` - AwsSecretAccessKeyPlaintext string `json:"aws_secret_access_key_plaintext,omitempty"` - BedrockProvider AmazonBedrockConfigBedrockProvider `json:"bedrock_provider"` - InstanceProfileArn string `json:"instance_profile_arn,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func amazonBedrockConfigFromPb(pb *amazonBedrockConfigPb) (*AmazonBedrockConfig, error) { - if pb == nil { - return nil, nil - } - st := &AmazonBedrockConfig{} - st.AwsAccessKeyId = pb.AwsAccessKeyId - st.AwsAccessKeyIdPlaintext = pb.AwsAccessKeyIdPlaintext - st.AwsRegion = pb.AwsRegion - st.AwsSecretAccessKey = pb.AwsSecretAccessKey - st.AwsSecretAccessKeyPlaintext = pb.AwsSecretAccessKeyPlaintext - st.BedrockProvider = pb.BedrockProvider - st.InstanceProfileArn = pb.InstanceProfileArn - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *amazonBedrockConfigPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st amazonBedrockConfigPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func anthropicConfigToPb(st *AnthropicConfig) (*anthropicConfigPb, error) { - if st == nil { - return nil, nil - } - pb := &anthropicConfigPb{} - pb.AnthropicApiKey = st.AnthropicApiKey - pb.AnthropicApiKeyPlaintext = st.AnthropicApiKeyPlaintext - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type anthropicConfigPb struct { - AnthropicApiKey string `json:"anthropic_api_key,omitempty"` - AnthropicApiKeyPlaintext string `json:"anthropic_api_key_plaintext,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func anthropicConfigFromPb(pb *anthropicConfigPb) (*AnthropicConfig, error) { - if pb == nil { - return nil, nil - } - st := &AnthropicConfig{} - st.AnthropicApiKey = pb.AnthropicApiKey - st.AnthropicApiKeyPlaintext = pb.AnthropicApiKeyPlaintext - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *anthropicConfigPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st anthropicConfigPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func apiKeyAuthToPb(st *ApiKeyAuth) (*apiKeyAuthPb, error) { - if st == nil { - return nil, nil - } - pb := &apiKeyAuthPb{} - pb.Key = st.Key - pb.Value = st.Value - pb.ValuePlaintext = st.ValuePlaintext - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type apiKeyAuthPb struct { - Key string `json:"key"` - Value string `json:"value,omitempty"` - ValuePlaintext string `json:"value_plaintext,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func apiKeyAuthFromPb(pb *apiKeyAuthPb) (*ApiKeyAuth, error) { - if pb == nil { - return nil, nil - } - st := &ApiKeyAuth{} - st.Key = pb.Key - st.Value = pb.Value - st.ValuePlaintext = pb.ValuePlaintext - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *apiKeyAuthPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st apiKeyAuthPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func autoCaptureConfigInputToPb(st *AutoCaptureConfigInput) (*autoCaptureConfigInputPb, error) { - if st == nil { - return nil, nil - } - pb := &autoCaptureConfigInputPb{} - pb.CatalogName = st.CatalogName - pb.Enabled = st.Enabled - pb.SchemaName = st.SchemaName - pb.TableNamePrefix = st.TableNamePrefix - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type autoCaptureConfigInputPb struct { - CatalogName string `json:"catalog_name,omitempty"` - Enabled bool `json:"enabled,omitempty"` - SchemaName string `json:"schema_name,omitempty"` - TableNamePrefix string `json:"table_name_prefix,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func autoCaptureConfigInputFromPb(pb *autoCaptureConfigInputPb) (*AutoCaptureConfigInput, error) { - if pb == nil { - return nil, nil - } - st := &AutoCaptureConfigInput{} - st.CatalogName = pb.CatalogName - st.Enabled = pb.Enabled - st.SchemaName = pb.SchemaName - st.TableNamePrefix = pb.TableNamePrefix - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *autoCaptureConfigInputPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st autoCaptureConfigInputPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func autoCaptureConfigOutputToPb(st *AutoCaptureConfigOutput) (*autoCaptureConfigOutputPb, error) { - if st == nil { - return nil, nil - } - pb := &autoCaptureConfigOutputPb{} - pb.CatalogName = st.CatalogName - pb.Enabled = st.Enabled - pb.SchemaName = st.SchemaName - pb.State = st.State - pb.TableNamePrefix = st.TableNamePrefix - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type autoCaptureConfigOutputPb struct { - CatalogName string `json:"catalog_name,omitempty"` - Enabled bool `json:"enabled,omitempty"` - SchemaName string `json:"schema_name,omitempty"` - State *AutoCaptureState `json:"state,omitempty"` - TableNamePrefix string `json:"table_name_prefix,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func autoCaptureConfigOutputFromPb(pb *autoCaptureConfigOutputPb) (*AutoCaptureConfigOutput, error) { - if pb == nil { - return nil, nil - } - st := &AutoCaptureConfigOutput{} - st.CatalogName = pb.CatalogName - st.Enabled = pb.Enabled - st.SchemaName = pb.SchemaName - st.State = pb.State - st.TableNamePrefix = pb.TableNamePrefix - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *autoCaptureConfigOutputPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st autoCaptureConfigOutputPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func autoCaptureStateToPb(st *AutoCaptureState) (*autoCaptureStatePb, error) { - if st == nil { - return nil, nil - } - pb := &autoCaptureStatePb{} - pb.PayloadTable = st.PayloadTable - - return pb, nil -} - -type autoCaptureStatePb struct { - PayloadTable *PayloadTable `json:"payload_table,omitempty"` -} - -func autoCaptureStateFromPb(pb *autoCaptureStatePb) (*AutoCaptureState, error) { - if pb == nil { - return nil, nil - } - st := &AutoCaptureState{} - st.PayloadTable = pb.PayloadTable - - return st, nil -} - -func bearerTokenAuthToPb(st *BearerTokenAuth) (*bearerTokenAuthPb, error) { - if st == nil { - return nil, nil - } - pb := &bearerTokenAuthPb{} - pb.Token = st.Token - pb.TokenPlaintext = st.TokenPlaintext - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type bearerTokenAuthPb struct { - Token string `json:"token,omitempty"` - TokenPlaintext string `json:"token_plaintext,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func bearerTokenAuthFromPb(pb *bearerTokenAuthPb) (*BearerTokenAuth, error) { - if pb == nil { - return nil, nil - } - st := &BearerTokenAuth{} - st.Token = pb.Token - st.TokenPlaintext = pb.TokenPlaintext - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *bearerTokenAuthPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st bearerTokenAuthPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func buildLogsRequestToPb(st *BuildLogsRequest) (*buildLogsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &buildLogsRequestPb{} - pb.Name = st.Name - pb.ServedModelName = st.ServedModelName - - return pb, nil -} - -type buildLogsRequestPb struct { - Name string `json:"-" url:"-"` - ServedModelName string `json:"-" url:"-"` -} - -func buildLogsRequestFromPb(pb *buildLogsRequestPb) (*BuildLogsRequest, error) { - if pb == nil { - return nil, nil - } - st := &BuildLogsRequest{} - st.Name = pb.Name - st.ServedModelName = pb.ServedModelName - - return st, nil -} - -func buildLogsResponseToPb(st *BuildLogsResponse) (*buildLogsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &buildLogsResponsePb{} - pb.Logs = st.Logs - - return pb, nil -} - -type buildLogsResponsePb struct { - Logs string `json:"logs"` -} - -func buildLogsResponseFromPb(pb *buildLogsResponsePb) (*BuildLogsResponse, error) { - if pb == nil { - return nil, nil - } - st := &BuildLogsResponse{} - st.Logs = pb.Logs - - return st, nil -} - -func chatMessageToPb(st *ChatMessage) (*chatMessagePb, error) { - if st == nil { - return nil, nil - } - pb := &chatMessagePb{} - pb.Content = st.Content - pb.Role = st.Role - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type chatMessagePb struct { - Content string `json:"content,omitempty"` - Role ChatMessageRole `json:"role,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func chatMessageFromPb(pb *chatMessagePb) (*ChatMessage, error) { - if pb == nil { - return nil, nil - } - st := &ChatMessage{} - st.Content = pb.Content - st.Role = pb.Role - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *chatMessagePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st chatMessagePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func cohereConfigToPb(st *CohereConfig) (*cohereConfigPb, error) { - if st == nil { - return nil, nil - } - pb := &cohereConfigPb{} - pb.CohereApiBase = st.CohereApiBase - pb.CohereApiKey = st.CohereApiKey - pb.CohereApiKeyPlaintext = st.CohereApiKeyPlaintext - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type cohereConfigPb struct { - CohereApiBase string `json:"cohere_api_base,omitempty"` - CohereApiKey string `json:"cohere_api_key,omitempty"` - CohereApiKeyPlaintext string `json:"cohere_api_key_plaintext,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func cohereConfigFromPb(pb *cohereConfigPb) (*CohereConfig, error) { - if pb == nil { - return nil, nil - } - st := &CohereConfig{} - st.CohereApiBase = pb.CohereApiBase - st.CohereApiKey = pb.CohereApiKey - st.CohereApiKeyPlaintext = pb.CohereApiKeyPlaintext - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *cohereConfigPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st cohereConfigPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createPtEndpointRequestToPb(st *CreatePtEndpointRequest) (*createPtEndpointRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &createPtEndpointRequestPb{} - pb.AiGateway = st.AiGateway - pb.BudgetPolicyId = st.BudgetPolicyId - pb.Config = st.Config - pb.Name = st.Name - pb.Tags = st.Tags - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createPtEndpointRequestPb struct { - AiGateway *AiGatewayConfig `json:"ai_gateway,omitempty"` - BudgetPolicyId string `json:"budget_policy_id,omitempty"` - Config PtEndpointCoreConfig `json:"config"` - Name string `json:"name"` - Tags []EndpointTag `json:"tags,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createPtEndpointRequestFromPb(pb *createPtEndpointRequestPb) (*CreatePtEndpointRequest, error) { - if pb == nil { - return nil, nil - } - st := &CreatePtEndpointRequest{} - st.AiGateway = pb.AiGateway - st.BudgetPolicyId = pb.BudgetPolicyId - st.Config = pb.Config - st.Name = pb.Name - st.Tags = pb.Tags - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createPtEndpointRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createPtEndpointRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createServingEndpointToPb(st *CreateServingEndpoint) (*createServingEndpointPb, error) { - if st == nil { - return nil, nil - } - pb := &createServingEndpointPb{} - pb.AiGateway = st.AiGateway - pb.BudgetPolicyId = st.BudgetPolicyId - pb.Config = st.Config - pb.Name = st.Name - pb.RateLimits = st.RateLimits - pb.RouteOptimized = st.RouteOptimized - pb.Tags = st.Tags - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createServingEndpointPb struct { - AiGateway *AiGatewayConfig `json:"ai_gateway,omitempty"` - BudgetPolicyId string `json:"budget_policy_id,omitempty"` - Config *EndpointCoreConfigInput `json:"config,omitempty"` - Name string `json:"name"` - RateLimits []RateLimit `json:"rate_limits,omitempty"` - RouteOptimized bool `json:"route_optimized,omitempty"` - Tags []EndpointTag `json:"tags,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createServingEndpointFromPb(pb *createServingEndpointPb) (*CreateServingEndpoint, error) { - if pb == nil { - return nil, nil - } - st := &CreateServingEndpoint{} - st.AiGateway = pb.AiGateway - st.BudgetPolicyId = pb.BudgetPolicyId - st.Config = pb.Config - st.Name = pb.Name - st.RateLimits = pb.RateLimits - st.RouteOptimized = pb.RouteOptimized - st.Tags = pb.Tags - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createServingEndpointPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createServingEndpointPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func customProviderConfigToPb(st *CustomProviderConfig) (*customProviderConfigPb, error) { - if st == nil { - return nil, nil - } - pb := &customProviderConfigPb{} - pb.ApiKeyAuth = st.ApiKeyAuth - pb.BearerTokenAuth = st.BearerTokenAuth - pb.CustomProviderUrl = st.CustomProviderUrl - - return pb, nil -} - -type customProviderConfigPb struct { - ApiKeyAuth *ApiKeyAuth `json:"api_key_auth,omitempty"` - BearerTokenAuth *BearerTokenAuth `json:"bearer_token_auth,omitempty"` - CustomProviderUrl string `json:"custom_provider_url"` -} - -func customProviderConfigFromPb(pb *customProviderConfigPb) (*CustomProviderConfig, error) { - if pb == nil { - return nil, nil - } - st := &CustomProviderConfig{} - st.ApiKeyAuth = pb.ApiKeyAuth - st.BearerTokenAuth = pb.BearerTokenAuth - st.CustomProviderUrl = pb.CustomProviderUrl - - return st, nil -} - -func dataPlaneInfoToPb(st *DataPlaneInfo) (*dataPlaneInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &dataPlaneInfoPb{} - pb.AuthorizationDetails = st.AuthorizationDetails - pb.EndpointUrl = st.EndpointUrl - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type dataPlaneInfoPb struct { - AuthorizationDetails string `json:"authorization_details,omitempty"` - EndpointUrl string `json:"endpoint_url,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func dataPlaneInfoFromPb(pb *dataPlaneInfoPb) (*DataPlaneInfo, error) { - if pb == nil { - return nil, nil - } - st := &DataPlaneInfo{} - st.AuthorizationDetails = pb.AuthorizationDetails - st.EndpointUrl = pb.EndpointUrl - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *dataPlaneInfoPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st dataPlaneInfoPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func databricksModelServingConfigToPb(st *DatabricksModelServingConfig) (*databricksModelServingConfigPb, error) { - if st == nil { - return nil, nil - } - pb := &databricksModelServingConfigPb{} - pb.DatabricksApiToken = st.DatabricksApiToken - pb.DatabricksApiTokenPlaintext = st.DatabricksApiTokenPlaintext - pb.DatabricksWorkspaceUrl = st.DatabricksWorkspaceUrl - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type databricksModelServingConfigPb struct { - DatabricksApiToken string `json:"databricks_api_token,omitempty"` - DatabricksApiTokenPlaintext string `json:"databricks_api_token_plaintext,omitempty"` - DatabricksWorkspaceUrl string `json:"databricks_workspace_url"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func databricksModelServingConfigFromPb(pb *databricksModelServingConfigPb) (*DatabricksModelServingConfig, error) { - if pb == nil { - return nil, nil - } - st := &DatabricksModelServingConfig{} - st.DatabricksApiToken = pb.DatabricksApiToken - st.DatabricksApiTokenPlaintext = pb.DatabricksApiTokenPlaintext - st.DatabricksWorkspaceUrl = pb.DatabricksWorkspaceUrl - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *databricksModelServingConfigPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st databricksModelServingConfigPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func dataframeSplitInputToPb(st *DataframeSplitInput) (*dataframeSplitInputPb, error) { - if st == nil { - return nil, nil - } - pb := &dataframeSplitInputPb{} - pb.Columns = st.Columns - pb.Data = st.Data - pb.Index = st.Index - - return pb, nil -} - -type dataframeSplitInputPb struct { - Columns []any `json:"columns,omitempty"` - Data []any `json:"data,omitempty"` - Index []int `json:"index,omitempty"` -} - -func dataframeSplitInputFromPb(pb *dataframeSplitInputPb) (*DataframeSplitInput, error) { - if pb == nil { - return nil, nil - } - st := &DataframeSplitInput{} - st.Columns = pb.Columns - st.Data = pb.Data - st.Index = pb.Index - - return st, nil -} - -func deleteResponseToPb(st *DeleteResponse) (*deleteResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteResponsePb{} - - return pb, nil -} - -type deleteResponsePb struct { -} - -func deleteResponseFromPb(pb *deleteResponsePb) (*DeleteResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteResponse{} - - return st, nil -} - -func deleteServingEndpointRequestToPb(st *DeleteServingEndpointRequest) (*deleteServingEndpointRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteServingEndpointRequestPb{} - pb.Name = st.Name - - return pb, nil -} - -type deleteServingEndpointRequestPb struct { - Name string `json:"-" url:"-"` -} - -func deleteServingEndpointRequestFromPb(pb *deleteServingEndpointRequestPb) (*DeleteServingEndpointRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteServingEndpointRequest{} - st.Name = pb.Name - - return st, nil -} - -func embeddingsV1ResponseEmbeddingElementToPb(st *EmbeddingsV1ResponseEmbeddingElement) (*embeddingsV1ResponseEmbeddingElementPb, error) { - if st == nil { - return nil, nil - } - pb := &embeddingsV1ResponseEmbeddingElementPb{} - pb.Embedding = st.Embedding - pb.Index = st.Index - pb.Object = st.Object - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type embeddingsV1ResponseEmbeddingElementPb struct { - Embedding []float64 `json:"embedding,omitempty"` - Index int `json:"index,omitempty"` - Object EmbeddingsV1ResponseEmbeddingElementObject `json:"object,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func embeddingsV1ResponseEmbeddingElementFromPb(pb *embeddingsV1ResponseEmbeddingElementPb) (*EmbeddingsV1ResponseEmbeddingElement, error) { - if pb == nil { - return nil, nil - } - st := &EmbeddingsV1ResponseEmbeddingElement{} - st.Embedding = pb.Embedding - st.Index = pb.Index - st.Object = pb.Object - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *embeddingsV1ResponseEmbeddingElementPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st embeddingsV1ResponseEmbeddingElementPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func endpointCoreConfigInputToPb(st *EndpointCoreConfigInput) (*endpointCoreConfigInputPb, error) { - if st == nil { - return nil, nil - } - pb := &endpointCoreConfigInputPb{} - pb.AutoCaptureConfig = st.AutoCaptureConfig - pb.Name = st.Name - pb.ServedEntities = st.ServedEntities - pb.ServedModels = st.ServedModels - pb.TrafficConfig = st.TrafficConfig - - return pb, nil -} - -type endpointCoreConfigInputPb struct { - AutoCaptureConfig *AutoCaptureConfigInput `json:"auto_capture_config,omitempty"` - Name string `json:"-" url:"-"` - ServedEntities []ServedEntityInput `json:"served_entities,omitempty"` - ServedModels []ServedModelInput `json:"served_models,omitempty"` - TrafficConfig *TrafficConfig `json:"traffic_config,omitempty"` -} - -func endpointCoreConfigInputFromPb(pb *endpointCoreConfigInputPb) (*EndpointCoreConfigInput, error) { - if pb == nil { - return nil, nil - } - st := &EndpointCoreConfigInput{} - st.AutoCaptureConfig = pb.AutoCaptureConfig - st.Name = pb.Name - st.ServedEntities = pb.ServedEntities - st.ServedModels = pb.ServedModels - st.TrafficConfig = pb.TrafficConfig - - return st, nil -} - -func endpointCoreConfigOutputToPb(st *EndpointCoreConfigOutput) (*endpointCoreConfigOutputPb, error) { - if st == nil { - return nil, nil - } - pb := &endpointCoreConfigOutputPb{} - pb.AutoCaptureConfig = st.AutoCaptureConfig - pb.ConfigVersion = st.ConfigVersion - pb.ServedEntities = st.ServedEntities - pb.ServedModels = st.ServedModels - pb.TrafficConfig = st.TrafficConfig - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type endpointCoreConfigOutputPb struct { - AutoCaptureConfig *AutoCaptureConfigOutput `json:"auto_capture_config,omitempty"` - ConfigVersion int64 `json:"config_version,omitempty"` - ServedEntities []ServedEntityOutput `json:"served_entities,omitempty"` - ServedModels []ServedModelOutput `json:"served_models,omitempty"` - TrafficConfig *TrafficConfig `json:"traffic_config,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func endpointCoreConfigOutputFromPb(pb *endpointCoreConfigOutputPb) (*EndpointCoreConfigOutput, error) { - if pb == nil { - return nil, nil - } - st := &EndpointCoreConfigOutput{} - st.AutoCaptureConfig = pb.AutoCaptureConfig - st.ConfigVersion = pb.ConfigVersion - st.ServedEntities = pb.ServedEntities - st.ServedModels = pb.ServedModels - st.TrafficConfig = pb.TrafficConfig - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *endpointCoreConfigOutputPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st endpointCoreConfigOutputPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func endpointCoreConfigSummaryToPb(st *EndpointCoreConfigSummary) (*endpointCoreConfigSummaryPb, error) { - if st == nil { - return nil, nil - } - pb := &endpointCoreConfigSummaryPb{} - pb.ServedEntities = st.ServedEntities - pb.ServedModels = st.ServedModels - - return pb, nil -} - -type endpointCoreConfigSummaryPb struct { - ServedEntities []ServedEntitySpec `json:"served_entities,omitempty"` - ServedModels []ServedModelSpec `json:"served_models,omitempty"` -} - -func endpointCoreConfigSummaryFromPb(pb *endpointCoreConfigSummaryPb) (*EndpointCoreConfigSummary, error) { - if pb == nil { - return nil, nil - } - st := &EndpointCoreConfigSummary{} - st.ServedEntities = pb.ServedEntities - st.ServedModels = pb.ServedModels - - return st, nil -} - -func endpointPendingConfigToPb(st *EndpointPendingConfig) (*endpointPendingConfigPb, error) { - if st == nil { - return nil, nil - } - pb := &endpointPendingConfigPb{} - pb.AutoCaptureConfig = st.AutoCaptureConfig - pb.ConfigVersion = st.ConfigVersion - pb.ServedEntities = st.ServedEntities - pb.ServedModels = st.ServedModels - pb.StartTime = st.StartTime - pb.TrafficConfig = st.TrafficConfig - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type endpointPendingConfigPb struct { - AutoCaptureConfig *AutoCaptureConfigOutput `json:"auto_capture_config,omitempty"` - ConfigVersion int `json:"config_version,omitempty"` - ServedEntities []ServedEntityOutput `json:"served_entities,omitempty"` - ServedModels []ServedModelOutput `json:"served_models,omitempty"` - StartTime int64 `json:"start_time,omitempty"` - TrafficConfig *TrafficConfig `json:"traffic_config,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func endpointPendingConfigFromPb(pb *endpointPendingConfigPb) (*EndpointPendingConfig, error) { - if pb == nil { - return nil, nil - } - st := &EndpointPendingConfig{} - st.AutoCaptureConfig = pb.AutoCaptureConfig - st.ConfigVersion = pb.ConfigVersion - st.ServedEntities = pb.ServedEntities - st.ServedModels = pb.ServedModels - st.StartTime = pb.StartTime - st.TrafficConfig = pb.TrafficConfig - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *endpointPendingConfigPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st endpointPendingConfigPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func endpointStateToPb(st *EndpointState) (*endpointStatePb, error) { - if st == nil { - return nil, nil - } - pb := &endpointStatePb{} - pb.ConfigUpdate = st.ConfigUpdate - pb.Ready = st.Ready - - return pb, nil -} - -type endpointStatePb struct { - ConfigUpdate EndpointStateConfigUpdate `json:"config_update,omitempty"` - Ready EndpointStateReady `json:"ready,omitempty"` -} - -func endpointStateFromPb(pb *endpointStatePb) (*EndpointState, error) { - if pb == nil { - return nil, nil - } - st := &EndpointState{} - st.ConfigUpdate = pb.ConfigUpdate - st.Ready = pb.Ready - - return st, nil -} - -func endpointTagToPb(st *EndpointTag) (*endpointTagPb, error) { - if st == nil { - return nil, nil - } - pb := &endpointTagPb{} - pb.Key = st.Key - pb.Value = st.Value - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type endpointTagPb struct { - Key string `json:"key"` - Value string `json:"value,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func endpointTagFromPb(pb *endpointTagPb) (*EndpointTag, error) { - if pb == nil { - return nil, nil - } - st := &EndpointTag{} - st.Key = pb.Key - st.Value = pb.Value - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *endpointTagPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st endpointTagPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func endpointTagsToPb(st *EndpointTags) (*endpointTagsPb, error) { - if st == nil { - return nil, nil - } - pb := &endpointTagsPb{} - pb.Tags = st.Tags - - return pb, nil -} - -type endpointTagsPb struct { - Tags []EndpointTag `json:"tags,omitempty"` -} - -func endpointTagsFromPb(pb *endpointTagsPb) (*EndpointTags, error) { - if pb == nil { - return nil, nil - } - st := &EndpointTags{} - st.Tags = pb.Tags - - return st, nil -} - -func exportMetricsRequestToPb(st *ExportMetricsRequest) (*exportMetricsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &exportMetricsRequestPb{} - pb.Name = st.Name - - return pb, nil -} - -type exportMetricsRequestPb struct { - Name string `json:"-" url:"-"` -} - -func exportMetricsRequestFromPb(pb *exportMetricsRequestPb) (*ExportMetricsRequest, error) { - if pb == nil { - return nil, nil - } - st := &ExportMetricsRequest{} - st.Name = pb.Name - - return st, nil -} - -func exportMetricsResponseToPb(st *ExportMetricsResponse) (*exportMetricsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &exportMetricsResponsePb{} - pb.Contents = st.Contents - - return pb, nil -} - -type exportMetricsResponsePb struct { - Contents io.ReadCloser `json:"-"` -} - -func exportMetricsResponseFromPb(pb *exportMetricsResponsePb) (*ExportMetricsResponse, error) { - if pb == nil { - return nil, nil - } - st := &ExportMetricsResponse{} - st.Contents = pb.Contents - - return st, nil -} - -func externalFunctionRequestToPb(st *ExternalFunctionRequest) (*externalFunctionRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &externalFunctionRequestPb{} - pb.ConnectionName = st.ConnectionName - pb.Headers = st.Headers - pb.Json = st.Json - pb.Method = st.Method - pb.Params = st.Params - pb.Path = st.Path - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type externalFunctionRequestPb struct { - ConnectionName string `json:"connection_name"` - Headers string `json:"headers,omitempty"` - Json string `json:"json,omitempty"` - Method ExternalFunctionRequestHttpMethod `json:"method"` - Params string `json:"params,omitempty"` - Path string `json:"path"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func externalFunctionRequestFromPb(pb *externalFunctionRequestPb) (*ExternalFunctionRequest, error) { - if pb == nil { - return nil, nil - } - st := &ExternalFunctionRequest{} - st.ConnectionName = pb.ConnectionName - st.Headers = pb.Headers - st.Json = pb.Json - st.Method = pb.Method - st.Params = pb.Params - st.Path = pb.Path - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *externalFunctionRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st externalFunctionRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func externalModelToPb(st *ExternalModel) (*externalModelPb, error) { - if st == nil { - return nil, nil - } - pb := &externalModelPb{} - pb.Ai21labsConfig = st.Ai21labsConfig - pb.AmazonBedrockConfig = st.AmazonBedrockConfig - pb.AnthropicConfig = st.AnthropicConfig - pb.CohereConfig = st.CohereConfig - pb.CustomProviderConfig = st.CustomProviderConfig - pb.DatabricksModelServingConfig = st.DatabricksModelServingConfig - pb.GoogleCloudVertexAiConfig = st.GoogleCloudVertexAiConfig - pb.Name = st.Name - pb.OpenaiConfig = st.OpenaiConfig - pb.PalmConfig = st.PalmConfig - pb.Provider = st.Provider - pb.Task = st.Task - - return pb, nil -} - -type externalModelPb struct { - Ai21labsConfig *Ai21LabsConfig `json:"ai21labs_config,omitempty"` - AmazonBedrockConfig *AmazonBedrockConfig `json:"amazon_bedrock_config,omitempty"` - AnthropicConfig *AnthropicConfig `json:"anthropic_config,omitempty"` - CohereConfig *CohereConfig `json:"cohere_config,omitempty"` - CustomProviderConfig *CustomProviderConfig `json:"custom_provider_config,omitempty"` - DatabricksModelServingConfig *DatabricksModelServingConfig `json:"databricks_model_serving_config,omitempty"` - GoogleCloudVertexAiConfig *GoogleCloudVertexAiConfig `json:"google_cloud_vertex_ai_config,omitempty"` - Name string `json:"name"` - OpenaiConfig *OpenAiConfig `json:"openai_config,omitempty"` - PalmConfig *PaLmConfig `json:"palm_config,omitempty"` - Provider ExternalModelProvider `json:"provider"` - Task string `json:"task"` -} - -func externalModelFromPb(pb *externalModelPb) (*ExternalModel, error) { - if pb == nil { - return nil, nil - } - st := &ExternalModel{} - st.Ai21labsConfig = pb.Ai21labsConfig - st.AmazonBedrockConfig = pb.AmazonBedrockConfig - st.AnthropicConfig = pb.AnthropicConfig - st.CohereConfig = pb.CohereConfig - st.CustomProviderConfig = pb.CustomProviderConfig - st.DatabricksModelServingConfig = pb.DatabricksModelServingConfig - st.GoogleCloudVertexAiConfig = pb.GoogleCloudVertexAiConfig - st.Name = pb.Name - st.OpenaiConfig = pb.OpenaiConfig - st.PalmConfig = pb.PalmConfig - st.Provider = pb.Provider - st.Task = pb.Task - - return st, nil -} - -func externalModelUsageElementToPb(st *ExternalModelUsageElement) (*externalModelUsageElementPb, error) { - if st == nil { - return nil, nil - } - pb := &externalModelUsageElementPb{} - pb.CompletionTokens = st.CompletionTokens - pb.PromptTokens = st.PromptTokens - pb.TotalTokens = st.TotalTokens - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type externalModelUsageElementPb struct { - CompletionTokens int `json:"completion_tokens,omitempty"` - PromptTokens int `json:"prompt_tokens,omitempty"` - TotalTokens int `json:"total_tokens,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func externalModelUsageElementFromPb(pb *externalModelUsageElementPb) (*ExternalModelUsageElement, error) { - if pb == nil { - return nil, nil - } - st := &ExternalModelUsageElement{} - st.CompletionTokens = pb.CompletionTokens - st.PromptTokens = pb.PromptTokens - st.TotalTokens = pb.TotalTokens - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *externalModelUsageElementPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st externalModelUsageElementPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func fallbackConfigToPb(st *FallbackConfig) (*fallbackConfigPb, error) { - if st == nil { - return nil, nil - } - pb := &fallbackConfigPb{} - pb.Enabled = st.Enabled - - return pb, nil -} - -type fallbackConfigPb struct { - Enabled bool `json:"enabled"` -} - -func fallbackConfigFromPb(pb *fallbackConfigPb) (*FallbackConfig, error) { - if pb == nil { - return nil, nil - } - st := &FallbackConfig{} - st.Enabled = pb.Enabled - - return st, nil -} - -func foundationModelToPb(st *FoundationModel) (*foundationModelPb, error) { - if st == nil { - return nil, nil - } - pb := &foundationModelPb{} - pb.Description = st.Description - pb.DisplayName = st.DisplayName - pb.Docs = st.Docs - pb.Name = st.Name - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type foundationModelPb struct { - Description string `json:"description,omitempty"` - DisplayName string `json:"display_name,omitempty"` - Docs string `json:"docs,omitempty"` - Name string `json:"name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func foundationModelFromPb(pb *foundationModelPb) (*FoundationModel, error) { - if pb == nil { - return nil, nil - } - st := &FoundationModel{} - st.Description = pb.Description - st.DisplayName = pb.DisplayName - st.Docs = pb.Docs - st.Name = pb.Name - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *foundationModelPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st foundationModelPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getOpenApiRequestToPb(st *GetOpenApiRequest) (*getOpenApiRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getOpenApiRequestPb{} - pb.Name = st.Name - - return pb, nil -} - -type getOpenApiRequestPb struct { - Name string `json:"-" url:"-"` -} - -func getOpenApiRequestFromPb(pb *getOpenApiRequestPb) (*GetOpenApiRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetOpenApiRequest{} - st.Name = pb.Name - - return st, nil -} - -func getOpenApiResponseToPb(st *GetOpenApiResponse) (*getOpenApiResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &getOpenApiResponsePb{} - pb.Contents = st.Contents - - return pb, nil -} - -type getOpenApiResponsePb struct { - Contents io.ReadCloser `json:"-"` -} - -func getOpenApiResponseFromPb(pb *getOpenApiResponsePb) (*GetOpenApiResponse, error) { - if pb == nil { - return nil, nil - } - st := &GetOpenApiResponse{} - st.Contents = pb.Contents - - return st, nil -} - -func getServingEndpointPermissionLevelsRequestToPb(st *GetServingEndpointPermissionLevelsRequest) (*getServingEndpointPermissionLevelsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getServingEndpointPermissionLevelsRequestPb{} - pb.ServingEndpointId = st.ServingEndpointId - - return pb, nil -} - -type getServingEndpointPermissionLevelsRequestPb struct { - ServingEndpointId string `json:"-" url:"-"` -} - -func getServingEndpointPermissionLevelsRequestFromPb(pb *getServingEndpointPermissionLevelsRequestPb) (*GetServingEndpointPermissionLevelsRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetServingEndpointPermissionLevelsRequest{} - st.ServingEndpointId = pb.ServingEndpointId - - return st, nil -} - -func getServingEndpointPermissionLevelsResponseToPb(st *GetServingEndpointPermissionLevelsResponse) (*getServingEndpointPermissionLevelsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &getServingEndpointPermissionLevelsResponsePb{} - pb.PermissionLevels = st.PermissionLevels - - return pb, nil -} - -type getServingEndpointPermissionLevelsResponsePb struct { - PermissionLevels []ServingEndpointPermissionsDescription `json:"permission_levels,omitempty"` -} - -func getServingEndpointPermissionLevelsResponseFromPb(pb *getServingEndpointPermissionLevelsResponsePb) (*GetServingEndpointPermissionLevelsResponse, error) { - if pb == nil { - return nil, nil - } - st := &GetServingEndpointPermissionLevelsResponse{} - st.PermissionLevels = pb.PermissionLevels - - return st, nil -} - -func getServingEndpointPermissionsRequestToPb(st *GetServingEndpointPermissionsRequest) (*getServingEndpointPermissionsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getServingEndpointPermissionsRequestPb{} - pb.ServingEndpointId = st.ServingEndpointId - - return pb, nil -} - -type getServingEndpointPermissionsRequestPb struct { - ServingEndpointId string `json:"-" url:"-"` -} - -func getServingEndpointPermissionsRequestFromPb(pb *getServingEndpointPermissionsRequestPb) (*GetServingEndpointPermissionsRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetServingEndpointPermissionsRequest{} - st.ServingEndpointId = pb.ServingEndpointId - - return st, nil -} - -func getServingEndpointRequestToPb(st *GetServingEndpointRequest) (*getServingEndpointRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getServingEndpointRequestPb{} - pb.Name = st.Name - - return pb, nil -} - -type getServingEndpointRequestPb struct { - Name string `json:"-" url:"-"` -} - -func getServingEndpointRequestFromPb(pb *getServingEndpointRequestPb) (*GetServingEndpointRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetServingEndpointRequest{} - st.Name = pb.Name - - return st, nil -} - -func googleCloudVertexAiConfigToPb(st *GoogleCloudVertexAiConfig) (*googleCloudVertexAiConfigPb, error) { - if st == nil { - return nil, nil - } - pb := &googleCloudVertexAiConfigPb{} - pb.PrivateKey = st.PrivateKey - pb.PrivateKeyPlaintext = st.PrivateKeyPlaintext - pb.ProjectId = st.ProjectId - pb.Region = st.Region - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type googleCloudVertexAiConfigPb struct { - PrivateKey string `json:"private_key,omitempty"` - PrivateKeyPlaintext string `json:"private_key_plaintext,omitempty"` - ProjectId string `json:"project_id"` - Region string `json:"region"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func googleCloudVertexAiConfigFromPb(pb *googleCloudVertexAiConfigPb) (*GoogleCloudVertexAiConfig, error) { - if pb == nil { - return nil, nil - } - st := &GoogleCloudVertexAiConfig{} - st.PrivateKey = pb.PrivateKey - st.PrivateKeyPlaintext = pb.PrivateKeyPlaintext - st.ProjectId = pb.ProjectId - st.Region = pb.Region - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *googleCloudVertexAiConfigPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st googleCloudVertexAiConfigPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func httpRequestResponseToPb(st *HttpRequestResponse) (*httpRequestResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &httpRequestResponsePb{} - pb.Contents = st.Contents - - return pb, nil -} - -type httpRequestResponsePb struct { - Contents io.ReadCloser `json:"-"` -} - -func httpRequestResponseFromPb(pb *httpRequestResponsePb) (*HttpRequestResponse, error) { - if pb == nil { - return nil, nil - } - st := &HttpRequestResponse{} - st.Contents = pb.Contents - - return st, nil -} - -func listEndpointsResponseToPb(st *ListEndpointsResponse) (*listEndpointsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listEndpointsResponsePb{} - pb.Endpoints = st.Endpoints - - return pb, nil -} - -type listEndpointsResponsePb struct { - Endpoints []ServingEndpoint `json:"endpoints,omitempty"` -} - -func listEndpointsResponseFromPb(pb *listEndpointsResponsePb) (*ListEndpointsResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListEndpointsResponse{} - st.Endpoints = pb.Endpoints - - return st, nil -} - -func logsRequestToPb(st *LogsRequest) (*logsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &logsRequestPb{} - pb.Name = st.Name - pb.ServedModelName = st.ServedModelName - - return pb, nil -} - -type logsRequestPb struct { - Name string `json:"-" url:"-"` - ServedModelName string `json:"-" url:"-"` -} - -func logsRequestFromPb(pb *logsRequestPb) (*LogsRequest, error) { - if pb == nil { - return nil, nil - } - st := &LogsRequest{} - st.Name = pb.Name - st.ServedModelName = pb.ServedModelName - - return st, nil -} - -func modelDataPlaneInfoToPb(st *ModelDataPlaneInfo) (*modelDataPlaneInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &modelDataPlaneInfoPb{} - pb.QueryInfo = st.QueryInfo - - return pb, nil -} - -type modelDataPlaneInfoPb struct { - QueryInfo *DataPlaneInfo `json:"query_info,omitempty"` -} - -func modelDataPlaneInfoFromPb(pb *modelDataPlaneInfoPb) (*ModelDataPlaneInfo, error) { - if pb == nil { - return nil, nil - } - st := &ModelDataPlaneInfo{} - st.QueryInfo = pb.QueryInfo - - return st, nil -} - -func openAiConfigToPb(st *OpenAiConfig) (*openAiConfigPb, error) { - if st == nil { - return nil, nil - } - pb := &openAiConfigPb{} - pb.MicrosoftEntraClientId = st.MicrosoftEntraClientId - pb.MicrosoftEntraClientSecret = st.MicrosoftEntraClientSecret - pb.MicrosoftEntraClientSecretPlaintext = st.MicrosoftEntraClientSecretPlaintext - pb.MicrosoftEntraTenantId = st.MicrosoftEntraTenantId - pb.OpenaiApiBase = st.OpenaiApiBase - pb.OpenaiApiKey = st.OpenaiApiKey - pb.OpenaiApiKeyPlaintext = st.OpenaiApiKeyPlaintext - pb.OpenaiApiType = st.OpenaiApiType - pb.OpenaiApiVersion = st.OpenaiApiVersion - pb.OpenaiDeploymentName = st.OpenaiDeploymentName - pb.OpenaiOrganization = st.OpenaiOrganization - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type openAiConfigPb struct { - MicrosoftEntraClientId string `json:"microsoft_entra_client_id,omitempty"` - MicrosoftEntraClientSecret string `json:"microsoft_entra_client_secret,omitempty"` - MicrosoftEntraClientSecretPlaintext string `json:"microsoft_entra_client_secret_plaintext,omitempty"` - MicrosoftEntraTenantId string `json:"microsoft_entra_tenant_id,omitempty"` - OpenaiApiBase string `json:"openai_api_base,omitempty"` - OpenaiApiKey string `json:"openai_api_key,omitempty"` - OpenaiApiKeyPlaintext string `json:"openai_api_key_plaintext,omitempty"` - OpenaiApiType string `json:"openai_api_type,omitempty"` - OpenaiApiVersion string `json:"openai_api_version,omitempty"` - OpenaiDeploymentName string `json:"openai_deployment_name,omitempty"` - OpenaiOrganization string `json:"openai_organization,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func openAiConfigFromPb(pb *openAiConfigPb) (*OpenAiConfig, error) { - if pb == nil { - return nil, nil - } - st := &OpenAiConfig{} - st.MicrosoftEntraClientId = pb.MicrosoftEntraClientId - st.MicrosoftEntraClientSecret = pb.MicrosoftEntraClientSecret - st.MicrosoftEntraClientSecretPlaintext = pb.MicrosoftEntraClientSecretPlaintext - st.MicrosoftEntraTenantId = pb.MicrosoftEntraTenantId - st.OpenaiApiBase = pb.OpenaiApiBase - st.OpenaiApiKey = pb.OpenaiApiKey - st.OpenaiApiKeyPlaintext = pb.OpenaiApiKeyPlaintext - st.OpenaiApiType = pb.OpenaiApiType - st.OpenaiApiVersion = pb.OpenaiApiVersion - st.OpenaiDeploymentName = pb.OpenaiDeploymentName - st.OpenaiOrganization = pb.OpenaiOrganization - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *openAiConfigPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st openAiConfigPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func paLmConfigToPb(st *PaLmConfig) (*paLmConfigPb, error) { - if st == nil { - return nil, nil - } - pb := &paLmConfigPb{} - pb.PalmApiKey = st.PalmApiKey - pb.PalmApiKeyPlaintext = st.PalmApiKeyPlaintext - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type paLmConfigPb struct { - PalmApiKey string `json:"palm_api_key,omitempty"` - PalmApiKeyPlaintext string `json:"palm_api_key_plaintext,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func paLmConfigFromPb(pb *paLmConfigPb) (*PaLmConfig, error) { - if pb == nil { - return nil, nil - } - st := &PaLmConfig{} - st.PalmApiKey = pb.PalmApiKey - st.PalmApiKeyPlaintext = pb.PalmApiKeyPlaintext - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *paLmConfigPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st paLmConfigPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func patchServingEndpointTagsToPb(st *PatchServingEndpointTags) (*patchServingEndpointTagsPb, error) { - if st == nil { - return nil, nil - } - pb := &patchServingEndpointTagsPb{} - pb.AddTags = st.AddTags - pb.DeleteTags = st.DeleteTags - pb.Name = st.Name - - return pb, nil -} - -type patchServingEndpointTagsPb struct { - AddTags []EndpointTag `json:"add_tags,omitempty"` - DeleteTags []string `json:"delete_tags,omitempty"` - Name string `json:"-" url:"-"` -} - -func patchServingEndpointTagsFromPb(pb *patchServingEndpointTagsPb) (*PatchServingEndpointTags, error) { - if pb == nil { - return nil, nil - } - st := &PatchServingEndpointTags{} - st.AddTags = pb.AddTags - st.DeleteTags = pb.DeleteTags - st.Name = pb.Name - - return st, nil -} - -func payloadTableToPb(st *PayloadTable) (*payloadTablePb, error) { - if st == nil { - return nil, nil - } - pb := &payloadTablePb{} - pb.Name = st.Name - pb.Status = st.Status - pb.StatusMessage = st.StatusMessage - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type payloadTablePb struct { - Name string `json:"name,omitempty"` - Status string `json:"status,omitempty"` - StatusMessage string `json:"status_message,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func payloadTableFromPb(pb *payloadTablePb) (*PayloadTable, error) { - if pb == nil { - return nil, nil - } - st := &PayloadTable{} - st.Name = pb.Name - st.Status = pb.Status - st.StatusMessage = pb.StatusMessage - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *payloadTablePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st payloadTablePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func ptEndpointCoreConfigToPb(st *PtEndpointCoreConfig) (*ptEndpointCoreConfigPb, error) { - if st == nil { - return nil, nil - } - pb := &ptEndpointCoreConfigPb{} - pb.ServedEntities = st.ServedEntities - pb.TrafficConfig = st.TrafficConfig - - return pb, nil -} - -type ptEndpointCoreConfigPb struct { - ServedEntities []PtServedModel `json:"served_entities,omitempty"` - TrafficConfig *TrafficConfig `json:"traffic_config,omitempty"` -} - -func ptEndpointCoreConfigFromPb(pb *ptEndpointCoreConfigPb) (*PtEndpointCoreConfig, error) { - if pb == nil { - return nil, nil - } - st := &PtEndpointCoreConfig{} - st.ServedEntities = pb.ServedEntities - st.TrafficConfig = pb.TrafficConfig - - return st, nil -} - -func ptServedModelToPb(st *PtServedModel) (*ptServedModelPb, error) { - if st == nil { - return nil, nil - } - pb := &ptServedModelPb{} - pb.EntityName = st.EntityName - pb.EntityVersion = st.EntityVersion - pb.Name = st.Name - pb.ProvisionedModelUnits = st.ProvisionedModelUnits - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type ptServedModelPb struct { - EntityName string `json:"entity_name"` - EntityVersion string `json:"entity_version,omitempty"` - Name string `json:"name,omitempty"` - ProvisionedModelUnits int64 `json:"provisioned_model_units"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func ptServedModelFromPb(pb *ptServedModelPb) (*PtServedModel, error) { - if pb == nil { - return nil, nil - } - st := &PtServedModel{} - st.EntityName = pb.EntityName - st.EntityVersion = pb.EntityVersion - st.Name = pb.Name - st.ProvisionedModelUnits = pb.ProvisionedModelUnits - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *ptServedModelPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st ptServedModelPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func putAiGatewayRequestToPb(st *PutAiGatewayRequest) (*putAiGatewayRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &putAiGatewayRequestPb{} - pb.FallbackConfig = st.FallbackConfig - pb.Guardrails = st.Guardrails - pb.InferenceTableConfig = st.InferenceTableConfig - pb.Name = st.Name - pb.RateLimits = st.RateLimits - pb.UsageTrackingConfig = st.UsageTrackingConfig - - return pb, nil -} - -type putAiGatewayRequestPb struct { - FallbackConfig *FallbackConfig `json:"fallback_config,omitempty"` - Guardrails *AiGatewayGuardrails `json:"guardrails,omitempty"` - InferenceTableConfig *AiGatewayInferenceTableConfig `json:"inference_table_config,omitempty"` - Name string `json:"-" url:"-"` - RateLimits []AiGatewayRateLimit `json:"rate_limits,omitempty"` - UsageTrackingConfig *AiGatewayUsageTrackingConfig `json:"usage_tracking_config,omitempty"` -} - -func putAiGatewayRequestFromPb(pb *putAiGatewayRequestPb) (*PutAiGatewayRequest, error) { - if pb == nil { - return nil, nil - } - st := &PutAiGatewayRequest{} - st.FallbackConfig = pb.FallbackConfig - st.Guardrails = pb.Guardrails - st.InferenceTableConfig = pb.InferenceTableConfig - st.Name = pb.Name - st.RateLimits = pb.RateLimits - st.UsageTrackingConfig = pb.UsageTrackingConfig - - return st, nil -} - -func putAiGatewayResponseToPb(st *PutAiGatewayResponse) (*putAiGatewayResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &putAiGatewayResponsePb{} - pb.FallbackConfig = st.FallbackConfig - pb.Guardrails = st.Guardrails - pb.InferenceTableConfig = st.InferenceTableConfig - pb.RateLimits = st.RateLimits - pb.UsageTrackingConfig = st.UsageTrackingConfig - - return pb, nil -} - -type putAiGatewayResponsePb struct { - FallbackConfig *FallbackConfig `json:"fallback_config,omitempty"` - Guardrails *AiGatewayGuardrails `json:"guardrails,omitempty"` - InferenceTableConfig *AiGatewayInferenceTableConfig `json:"inference_table_config,omitempty"` - RateLimits []AiGatewayRateLimit `json:"rate_limits,omitempty"` - UsageTrackingConfig *AiGatewayUsageTrackingConfig `json:"usage_tracking_config,omitempty"` -} - -func putAiGatewayResponseFromPb(pb *putAiGatewayResponsePb) (*PutAiGatewayResponse, error) { - if pb == nil { - return nil, nil - } - st := &PutAiGatewayResponse{} - st.FallbackConfig = pb.FallbackConfig - st.Guardrails = pb.Guardrails - st.InferenceTableConfig = pb.InferenceTableConfig - st.RateLimits = pb.RateLimits - st.UsageTrackingConfig = pb.UsageTrackingConfig - - return st, nil -} - -func putRequestToPb(st *PutRequest) (*putRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &putRequestPb{} - pb.Name = st.Name - pb.RateLimits = st.RateLimits - - return pb, nil -} - -type putRequestPb struct { - Name string `json:"-" url:"-"` - RateLimits []RateLimit `json:"rate_limits,omitempty"` -} - -func putRequestFromPb(pb *putRequestPb) (*PutRequest, error) { - if pb == nil { - return nil, nil - } - st := &PutRequest{} - st.Name = pb.Name - st.RateLimits = pb.RateLimits - - return st, nil -} - -func putResponseToPb(st *PutResponse) (*putResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &putResponsePb{} - pb.RateLimits = st.RateLimits - - return pb, nil -} - -type putResponsePb struct { - RateLimits []RateLimit `json:"rate_limits,omitempty"` -} - -func putResponseFromPb(pb *putResponsePb) (*PutResponse, error) { - if pb == nil { - return nil, nil - } - st := &PutResponse{} - st.RateLimits = pb.RateLimits - - return st, nil -} - -func queryEndpointInputToPb(st *QueryEndpointInput) (*queryEndpointInputPb, error) { - if st == nil { - return nil, nil - } - pb := &queryEndpointInputPb{} - pb.DataframeRecords = st.DataframeRecords - pb.DataframeSplit = st.DataframeSplit - pb.ExtraParams = st.ExtraParams - pb.Input = st.Input - pb.Inputs = st.Inputs - pb.Instances = st.Instances - pb.MaxTokens = st.MaxTokens - pb.Messages = st.Messages - pb.N = st.N - pb.Name = st.Name - pb.Prompt = st.Prompt - pb.Stop = st.Stop - pb.Stream = st.Stream - pb.Temperature = st.Temperature - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type queryEndpointInputPb struct { - DataframeRecords []any `json:"dataframe_records,omitempty"` - DataframeSplit *DataframeSplitInput `json:"dataframe_split,omitempty"` - ExtraParams map[string]string `json:"extra_params,omitempty"` - Input any `json:"input,omitempty"` - Inputs any `json:"inputs,omitempty"` - Instances []any `json:"instances,omitempty"` - MaxTokens int `json:"max_tokens,omitempty"` - Messages []ChatMessage `json:"messages,omitempty"` - N int `json:"n,omitempty"` - Name string `json:"-" url:"-"` - Prompt any `json:"prompt,omitempty"` - Stop []string `json:"stop,omitempty"` - Stream bool `json:"stream,omitempty"` - Temperature float64 `json:"temperature,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func queryEndpointInputFromPb(pb *queryEndpointInputPb) (*QueryEndpointInput, error) { - if pb == nil { - return nil, nil - } - st := &QueryEndpointInput{} - st.DataframeRecords = pb.DataframeRecords - st.DataframeSplit = pb.DataframeSplit - st.ExtraParams = pb.ExtraParams - st.Input = pb.Input - st.Inputs = pb.Inputs - st.Instances = pb.Instances - st.MaxTokens = pb.MaxTokens - st.Messages = pb.Messages - st.N = pb.N - st.Name = pb.Name - st.Prompt = pb.Prompt - st.Stop = pb.Stop - st.Stream = pb.Stream - st.Temperature = pb.Temperature - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *queryEndpointInputPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st queryEndpointInputPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func queryEndpointResponseToPb(st *QueryEndpointResponse) (*queryEndpointResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &queryEndpointResponsePb{} - pb.Choices = st.Choices - pb.Created = st.Created - pb.Data = st.Data - pb.Id = st.Id - pb.Model = st.Model - pb.Object = st.Object - pb.Predictions = st.Predictions - pb.ServedModelName = st.ServedModelName - pb.Usage = st.Usage - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type queryEndpointResponsePb struct { - Choices []V1ResponseChoiceElement `json:"choices,omitempty"` - Created int64 `json:"created,omitempty"` - Data []EmbeddingsV1ResponseEmbeddingElement `json:"data,omitempty"` - Id string `json:"id,omitempty"` - Model string `json:"model,omitempty"` - Object QueryEndpointResponseObject `json:"object,omitempty"` - Predictions []any `json:"predictions,omitempty"` - ServedModelName string `json:"-" url:"-" header:"served-model-name,omitempty"` - Usage *ExternalModelUsageElement `json:"usage,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func queryEndpointResponseFromPb(pb *queryEndpointResponsePb) (*QueryEndpointResponse, error) { - if pb == nil { - return nil, nil - } - st := &QueryEndpointResponse{} - st.Choices = pb.Choices - st.Created = pb.Created - st.Data = pb.Data - st.Id = pb.Id - st.Model = pb.Model - st.Object = pb.Object - st.Predictions = pb.Predictions - st.ServedModelName = pb.ServedModelName - st.Usage = pb.Usage - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *queryEndpointResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st queryEndpointResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func rateLimitToPb(st *RateLimit) (*rateLimitPb, error) { - if st == nil { - return nil, nil - } - pb := &rateLimitPb{} - pb.Calls = st.Calls - pb.Key = st.Key - pb.RenewalPeriod = st.RenewalPeriod - - return pb, nil -} - -type rateLimitPb struct { - Calls int64 `json:"calls"` - Key RateLimitKey `json:"key,omitempty"` - RenewalPeriod RateLimitRenewalPeriod `json:"renewal_period"` -} - -func rateLimitFromPb(pb *rateLimitPb) (*RateLimit, error) { - if pb == nil { - return nil, nil - } - st := &RateLimit{} - st.Calls = pb.Calls - st.Key = pb.Key - st.RenewalPeriod = pb.RenewalPeriod - - return st, nil -} - -func routeToPb(st *Route) (*routePb, error) { - if st == nil { - return nil, nil - } - pb := &routePb{} - pb.ServedModelName = st.ServedModelName - pb.TrafficPercentage = st.TrafficPercentage - - return pb, nil -} - -type routePb struct { - ServedModelName string `json:"served_model_name"` - TrafficPercentage int `json:"traffic_percentage"` -} - -func routeFromPb(pb *routePb) (*Route, error) { - if pb == nil { - return nil, nil - } - st := &Route{} - st.ServedModelName = pb.ServedModelName - st.TrafficPercentage = pb.TrafficPercentage - - return st, nil -} - -func servedEntityInputToPb(st *ServedEntityInput) (*servedEntityInputPb, error) { - if st == nil { - return nil, nil - } - pb := &servedEntityInputPb{} - pb.EntityName = st.EntityName - pb.EntityVersion = st.EntityVersion - pb.EnvironmentVars = st.EnvironmentVars - pb.ExternalModel = st.ExternalModel - pb.InstanceProfileArn = st.InstanceProfileArn - pb.MaxProvisionedConcurrency = st.MaxProvisionedConcurrency - pb.MaxProvisionedThroughput = st.MaxProvisionedThroughput - pb.MinProvisionedConcurrency = st.MinProvisionedConcurrency - pb.MinProvisionedThroughput = st.MinProvisionedThroughput - pb.Name = st.Name - pb.ProvisionedModelUnits = st.ProvisionedModelUnits - pb.ScaleToZeroEnabled = st.ScaleToZeroEnabled - pb.WorkloadSize = st.WorkloadSize - pb.WorkloadType = st.WorkloadType - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type servedEntityInputPb struct { - EntityName string `json:"entity_name,omitempty"` - EntityVersion string `json:"entity_version,omitempty"` - EnvironmentVars map[string]string `json:"environment_vars,omitempty"` - ExternalModel *ExternalModel `json:"external_model,omitempty"` - InstanceProfileArn string `json:"instance_profile_arn,omitempty"` - MaxProvisionedConcurrency int `json:"max_provisioned_concurrency,omitempty"` - MaxProvisionedThroughput int `json:"max_provisioned_throughput,omitempty"` - MinProvisionedConcurrency int `json:"min_provisioned_concurrency,omitempty"` - MinProvisionedThroughput int `json:"min_provisioned_throughput,omitempty"` - Name string `json:"name,omitempty"` - ProvisionedModelUnits int64 `json:"provisioned_model_units,omitempty"` - ScaleToZeroEnabled bool `json:"scale_to_zero_enabled,omitempty"` - WorkloadSize string `json:"workload_size,omitempty"` - WorkloadType ServingModelWorkloadType `json:"workload_type,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func servedEntityInputFromPb(pb *servedEntityInputPb) (*ServedEntityInput, error) { - if pb == nil { - return nil, nil - } - st := &ServedEntityInput{} - st.EntityName = pb.EntityName - st.EntityVersion = pb.EntityVersion - st.EnvironmentVars = pb.EnvironmentVars - st.ExternalModel = pb.ExternalModel - st.InstanceProfileArn = pb.InstanceProfileArn - st.MaxProvisionedConcurrency = pb.MaxProvisionedConcurrency - st.MaxProvisionedThroughput = pb.MaxProvisionedThroughput - st.MinProvisionedConcurrency = pb.MinProvisionedConcurrency - st.MinProvisionedThroughput = pb.MinProvisionedThroughput - st.Name = pb.Name - st.ProvisionedModelUnits = pb.ProvisionedModelUnits - st.ScaleToZeroEnabled = pb.ScaleToZeroEnabled - st.WorkloadSize = pb.WorkloadSize - st.WorkloadType = pb.WorkloadType - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *servedEntityInputPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st servedEntityInputPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func servedEntityOutputToPb(st *ServedEntityOutput) (*servedEntityOutputPb, error) { - if st == nil { - return nil, nil - } - pb := &servedEntityOutputPb{} - pb.CreationTimestamp = st.CreationTimestamp - pb.Creator = st.Creator - pb.EntityName = st.EntityName - pb.EntityVersion = st.EntityVersion - pb.EnvironmentVars = st.EnvironmentVars - pb.ExternalModel = st.ExternalModel - pb.FoundationModel = st.FoundationModel - pb.InstanceProfileArn = st.InstanceProfileArn - pb.MaxProvisionedConcurrency = st.MaxProvisionedConcurrency - pb.MaxProvisionedThroughput = st.MaxProvisionedThroughput - pb.MinProvisionedConcurrency = st.MinProvisionedConcurrency - pb.MinProvisionedThroughput = st.MinProvisionedThroughput - pb.Name = st.Name - pb.ProvisionedModelUnits = st.ProvisionedModelUnits - pb.ScaleToZeroEnabled = st.ScaleToZeroEnabled - pb.State = st.State - pb.WorkloadSize = st.WorkloadSize - pb.WorkloadType = st.WorkloadType - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type servedEntityOutputPb struct { - CreationTimestamp int64 `json:"creation_timestamp,omitempty"` - Creator string `json:"creator,omitempty"` - EntityName string `json:"entity_name,omitempty"` - EntityVersion string `json:"entity_version,omitempty"` - EnvironmentVars map[string]string `json:"environment_vars,omitempty"` - ExternalModel *ExternalModel `json:"external_model,omitempty"` - FoundationModel *FoundationModel `json:"foundation_model,omitempty"` - InstanceProfileArn string `json:"instance_profile_arn,omitempty"` - MaxProvisionedConcurrency int `json:"max_provisioned_concurrency,omitempty"` - MaxProvisionedThroughput int `json:"max_provisioned_throughput,omitempty"` - MinProvisionedConcurrency int `json:"min_provisioned_concurrency,omitempty"` - MinProvisionedThroughput int `json:"min_provisioned_throughput,omitempty"` - Name string `json:"name,omitempty"` - ProvisionedModelUnits int64 `json:"provisioned_model_units,omitempty"` - ScaleToZeroEnabled bool `json:"scale_to_zero_enabled,omitempty"` - State *ServedModelState `json:"state,omitempty"` - WorkloadSize string `json:"workload_size,omitempty"` - WorkloadType ServingModelWorkloadType `json:"workload_type,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func servedEntityOutputFromPb(pb *servedEntityOutputPb) (*ServedEntityOutput, error) { - if pb == nil { - return nil, nil - } - st := &ServedEntityOutput{} - st.CreationTimestamp = pb.CreationTimestamp - st.Creator = pb.Creator - st.EntityName = pb.EntityName - st.EntityVersion = pb.EntityVersion - st.EnvironmentVars = pb.EnvironmentVars - st.ExternalModel = pb.ExternalModel - st.FoundationModel = pb.FoundationModel - st.InstanceProfileArn = pb.InstanceProfileArn - st.MaxProvisionedConcurrency = pb.MaxProvisionedConcurrency - st.MaxProvisionedThroughput = pb.MaxProvisionedThroughput - st.MinProvisionedConcurrency = pb.MinProvisionedConcurrency - st.MinProvisionedThroughput = pb.MinProvisionedThroughput - st.Name = pb.Name - st.ProvisionedModelUnits = pb.ProvisionedModelUnits - st.ScaleToZeroEnabled = pb.ScaleToZeroEnabled - st.State = pb.State - st.WorkloadSize = pb.WorkloadSize - st.WorkloadType = pb.WorkloadType - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *servedEntityOutputPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st servedEntityOutputPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func servedEntitySpecToPb(st *ServedEntitySpec) (*servedEntitySpecPb, error) { - if st == nil { - return nil, nil - } - pb := &servedEntitySpecPb{} - pb.EntityName = st.EntityName - pb.EntityVersion = st.EntityVersion - pb.ExternalModel = st.ExternalModel - pb.FoundationModel = st.FoundationModel - pb.Name = st.Name - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type servedEntitySpecPb struct { - EntityName string `json:"entity_name,omitempty"` - EntityVersion string `json:"entity_version,omitempty"` - ExternalModel *ExternalModel `json:"external_model,omitempty"` - FoundationModel *FoundationModel `json:"foundation_model,omitempty"` - Name string `json:"name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func servedEntitySpecFromPb(pb *servedEntitySpecPb) (*ServedEntitySpec, error) { - if pb == nil { - return nil, nil - } - st := &ServedEntitySpec{} - st.EntityName = pb.EntityName - st.EntityVersion = pb.EntityVersion - st.ExternalModel = pb.ExternalModel - st.FoundationModel = pb.FoundationModel - st.Name = pb.Name - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *servedEntitySpecPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st servedEntitySpecPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func servedModelInputToPb(st *ServedModelInput) (*servedModelInputPb, error) { - if st == nil { - return nil, nil - } - pb := &servedModelInputPb{} - pb.EnvironmentVars = st.EnvironmentVars - pb.InstanceProfileArn = st.InstanceProfileArn - pb.MaxProvisionedConcurrency = st.MaxProvisionedConcurrency - pb.MaxProvisionedThroughput = st.MaxProvisionedThroughput - pb.MinProvisionedConcurrency = st.MinProvisionedConcurrency - pb.MinProvisionedThroughput = st.MinProvisionedThroughput - pb.ModelName = st.ModelName - pb.ModelVersion = st.ModelVersion - pb.Name = st.Name - pb.ProvisionedModelUnits = st.ProvisionedModelUnits - pb.ScaleToZeroEnabled = st.ScaleToZeroEnabled - pb.WorkloadSize = st.WorkloadSize - pb.WorkloadType = st.WorkloadType - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type servedModelInputPb struct { - EnvironmentVars map[string]string `json:"environment_vars,omitempty"` - InstanceProfileArn string `json:"instance_profile_arn,omitempty"` - MaxProvisionedConcurrency int `json:"max_provisioned_concurrency,omitempty"` - MaxProvisionedThroughput int `json:"max_provisioned_throughput,omitempty"` - MinProvisionedConcurrency int `json:"min_provisioned_concurrency,omitempty"` - MinProvisionedThroughput int `json:"min_provisioned_throughput,omitempty"` - ModelName string `json:"model_name"` - ModelVersion string `json:"model_version"` - Name string `json:"name,omitempty"` - ProvisionedModelUnits int64 `json:"provisioned_model_units,omitempty"` - ScaleToZeroEnabled bool `json:"scale_to_zero_enabled"` - WorkloadSize string `json:"workload_size,omitempty"` - WorkloadType ServedModelInputWorkloadType `json:"workload_type,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func servedModelInputFromPb(pb *servedModelInputPb) (*ServedModelInput, error) { - if pb == nil { - return nil, nil - } - st := &ServedModelInput{} - st.EnvironmentVars = pb.EnvironmentVars - st.InstanceProfileArn = pb.InstanceProfileArn - st.MaxProvisionedConcurrency = pb.MaxProvisionedConcurrency - st.MaxProvisionedThroughput = pb.MaxProvisionedThroughput - st.MinProvisionedConcurrency = pb.MinProvisionedConcurrency - st.MinProvisionedThroughput = pb.MinProvisionedThroughput - st.ModelName = pb.ModelName - st.ModelVersion = pb.ModelVersion - st.Name = pb.Name - st.ProvisionedModelUnits = pb.ProvisionedModelUnits - st.ScaleToZeroEnabled = pb.ScaleToZeroEnabled - st.WorkloadSize = pb.WorkloadSize - st.WorkloadType = pb.WorkloadType - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *servedModelInputPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st servedModelInputPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func servedModelOutputToPb(st *ServedModelOutput) (*servedModelOutputPb, error) { - if st == nil { - return nil, nil - } - pb := &servedModelOutputPb{} - pb.CreationTimestamp = st.CreationTimestamp - pb.Creator = st.Creator - pb.EnvironmentVars = st.EnvironmentVars - pb.InstanceProfileArn = st.InstanceProfileArn - pb.MaxProvisionedConcurrency = st.MaxProvisionedConcurrency - pb.MinProvisionedConcurrency = st.MinProvisionedConcurrency - pb.ModelName = st.ModelName - pb.ModelVersion = st.ModelVersion - pb.Name = st.Name - pb.ProvisionedModelUnits = st.ProvisionedModelUnits - pb.ScaleToZeroEnabled = st.ScaleToZeroEnabled - pb.State = st.State - pb.WorkloadSize = st.WorkloadSize - pb.WorkloadType = st.WorkloadType - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type servedModelOutputPb struct { - CreationTimestamp int64 `json:"creation_timestamp,omitempty"` - Creator string `json:"creator,omitempty"` - EnvironmentVars map[string]string `json:"environment_vars,omitempty"` - InstanceProfileArn string `json:"instance_profile_arn,omitempty"` - MaxProvisionedConcurrency int `json:"max_provisioned_concurrency,omitempty"` - MinProvisionedConcurrency int `json:"min_provisioned_concurrency,omitempty"` - ModelName string `json:"model_name,omitempty"` - ModelVersion string `json:"model_version,omitempty"` - Name string `json:"name,omitempty"` - ProvisionedModelUnits int64 `json:"provisioned_model_units,omitempty"` - ScaleToZeroEnabled bool `json:"scale_to_zero_enabled,omitempty"` - State *ServedModelState `json:"state,omitempty"` - WorkloadSize string `json:"workload_size,omitempty"` - WorkloadType ServingModelWorkloadType `json:"workload_type,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func servedModelOutputFromPb(pb *servedModelOutputPb) (*ServedModelOutput, error) { - if pb == nil { - return nil, nil - } - st := &ServedModelOutput{} - st.CreationTimestamp = pb.CreationTimestamp - st.Creator = pb.Creator - st.EnvironmentVars = pb.EnvironmentVars - st.InstanceProfileArn = pb.InstanceProfileArn - st.MaxProvisionedConcurrency = pb.MaxProvisionedConcurrency - st.MinProvisionedConcurrency = pb.MinProvisionedConcurrency - st.ModelName = pb.ModelName - st.ModelVersion = pb.ModelVersion - st.Name = pb.Name - st.ProvisionedModelUnits = pb.ProvisionedModelUnits - st.ScaleToZeroEnabled = pb.ScaleToZeroEnabled - st.State = pb.State - st.WorkloadSize = pb.WorkloadSize - st.WorkloadType = pb.WorkloadType - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *servedModelOutputPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st servedModelOutputPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func servedModelSpecToPb(st *ServedModelSpec) (*servedModelSpecPb, error) { - if st == nil { - return nil, nil - } - pb := &servedModelSpecPb{} - pb.ModelName = st.ModelName - pb.ModelVersion = st.ModelVersion - pb.Name = st.Name - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type servedModelSpecPb struct { - ModelName string `json:"model_name,omitempty"` - ModelVersion string `json:"model_version,omitempty"` - Name string `json:"name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func servedModelSpecFromPb(pb *servedModelSpecPb) (*ServedModelSpec, error) { - if pb == nil { - return nil, nil - } - st := &ServedModelSpec{} - st.ModelName = pb.ModelName - st.ModelVersion = pb.ModelVersion - st.Name = pb.Name - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *servedModelSpecPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st servedModelSpecPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func servedModelStateToPb(st *ServedModelState) (*servedModelStatePb, error) { - if st == nil { - return nil, nil - } - pb := &servedModelStatePb{} - pb.Deployment = st.Deployment - pb.DeploymentStateMessage = st.DeploymentStateMessage - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type servedModelStatePb struct { - Deployment ServedModelStateDeployment `json:"deployment,omitempty"` - DeploymentStateMessage string `json:"deployment_state_message,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func servedModelStateFromPb(pb *servedModelStatePb) (*ServedModelState, error) { - if pb == nil { - return nil, nil - } - st := &ServedModelState{} - st.Deployment = pb.Deployment - st.DeploymentStateMessage = pb.DeploymentStateMessage - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *servedModelStatePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st servedModelStatePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func serverLogsResponseToPb(st *ServerLogsResponse) (*serverLogsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &serverLogsResponsePb{} - pb.Logs = st.Logs - - return pb, nil -} - -type serverLogsResponsePb struct { - Logs string `json:"logs"` -} - -func serverLogsResponseFromPb(pb *serverLogsResponsePb) (*ServerLogsResponse, error) { - if pb == nil { - return nil, nil - } - st := &ServerLogsResponse{} - st.Logs = pb.Logs - - return st, nil -} - -func servingEndpointToPb(st *ServingEndpoint) (*servingEndpointPb, error) { - if st == nil { - return nil, nil - } - pb := &servingEndpointPb{} - pb.AiGateway = st.AiGateway - pb.BudgetPolicyId = st.BudgetPolicyId - pb.Config = st.Config - pb.CreationTimestamp = st.CreationTimestamp - pb.Creator = st.Creator - pb.Description = st.Description - pb.Id = st.Id - pb.LastUpdatedTimestamp = st.LastUpdatedTimestamp - pb.Name = st.Name - pb.State = st.State - pb.Tags = st.Tags - pb.Task = st.Task - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type servingEndpointPb struct { - AiGateway *AiGatewayConfig `json:"ai_gateway,omitempty"` - BudgetPolicyId string `json:"budget_policy_id,omitempty"` - Config *EndpointCoreConfigSummary `json:"config,omitempty"` - CreationTimestamp int64 `json:"creation_timestamp,omitempty"` - Creator string `json:"creator,omitempty"` - Description string `json:"description,omitempty"` - Id string `json:"id,omitempty"` - LastUpdatedTimestamp int64 `json:"last_updated_timestamp,omitempty"` - Name string `json:"name,omitempty"` - State *EndpointState `json:"state,omitempty"` - Tags []EndpointTag `json:"tags,omitempty"` - Task string `json:"task,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func servingEndpointFromPb(pb *servingEndpointPb) (*ServingEndpoint, error) { - if pb == nil { - return nil, nil - } - st := &ServingEndpoint{} - st.AiGateway = pb.AiGateway - st.BudgetPolicyId = pb.BudgetPolicyId - st.Config = pb.Config - st.CreationTimestamp = pb.CreationTimestamp - st.Creator = pb.Creator - st.Description = pb.Description - st.Id = pb.Id - st.LastUpdatedTimestamp = pb.LastUpdatedTimestamp - st.Name = pb.Name - st.State = pb.State - st.Tags = pb.Tags - st.Task = pb.Task - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *servingEndpointPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st servingEndpointPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func servingEndpointAccessControlRequestToPb(st *ServingEndpointAccessControlRequest) (*servingEndpointAccessControlRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &servingEndpointAccessControlRequestPb{} - pb.GroupName = st.GroupName - pb.PermissionLevel = st.PermissionLevel - pb.ServicePrincipalName = st.ServicePrincipalName - pb.UserName = st.UserName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type servingEndpointAccessControlRequestPb struct { - GroupName string `json:"group_name,omitempty"` - PermissionLevel ServingEndpointPermissionLevel `json:"permission_level,omitempty"` - ServicePrincipalName string `json:"service_principal_name,omitempty"` - UserName string `json:"user_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func servingEndpointAccessControlRequestFromPb(pb *servingEndpointAccessControlRequestPb) (*ServingEndpointAccessControlRequest, error) { - if pb == nil { - return nil, nil - } - st := &ServingEndpointAccessControlRequest{} - st.GroupName = pb.GroupName - st.PermissionLevel = pb.PermissionLevel - st.ServicePrincipalName = pb.ServicePrincipalName - st.UserName = pb.UserName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *servingEndpointAccessControlRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st servingEndpointAccessControlRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func servingEndpointAccessControlResponseToPb(st *ServingEndpointAccessControlResponse) (*servingEndpointAccessControlResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &servingEndpointAccessControlResponsePb{} - pb.AllPermissions = st.AllPermissions - pb.DisplayName = st.DisplayName - pb.GroupName = st.GroupName - pb.ServicePrincipalName = st.ServicePrincipalName - pb.UserName = st.UserName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type servingEndpointAccessControlResponsePb struct { - AllPermissions []ServingEndpointPermission `json:"all_permissions,omitempty"` - DisplayName string `json:"display_name,omitempty"` - GroupName string `json:"group_name,omitempty"` - ServicePrincipalName string `json:"service_principal_name,omitempty"` - UserName string `json:"user_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func servingEndpointAccessControlResponseFromPb(pb *servingEndpointAccessControlResponsePb) (*ServingEndpointAccessControlResponse, error) { - if pb == nil { - return nil, nil - } - st := &ServingEndpointAccessControlResponse{} - st.AllPermissions = pb.AllPermissions - st.DisplayName = pb.DisplayName - st.GroupName = pb.GroupName - st.ServicePrincipalName = pb.ServicePrincipalName - st.UserName = pb.UserName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *servingEndpointAccessControlResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st servingEndpointAccessControlResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func servingEndpointDetailedToPb(st *ServingEndpointDetailed) (*servingEndpointDetailedPb, error) { - if st == nil { - return nil, nil - } - pb := &servingEndpointDetailedPb{} - pb.AiGateway = st.AiGateway - pb.BudgetPolicyId = st.BudgetPolicyId - pb.Config = st.Config - pb.CreationTimestamp = st.CreationTimestamp - pb.Creator = st.Creator - pb.DataPlaneInfo = st.DataPlaneInfo - pb.Description = st.Description - pb.EndpointUrl = st.EndpointUrl - pb.Id = st.Id - pb.LastUpdatedTimestamp = st.LastUpdatedTimestamp - pb.Name = st.Name - pb.PendingConfig = st.PendingConfig - pb.PermissionLevel = st.PermissionLevel - pb.RouteOptimized = st.RouteOptimized - pb.State = st.State - pb.Tags = st.Tags - pb.Task = st.Task - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type servingEndpointDetailedPb struct { - AiGateway *AiGatewayConfig `json:"ai_gateway,omitempty"` - BudgetPolicyId string `json:"budget_policy_id,omitempty"` - Config *EndpointCoreConfigOutput `json:"config,omitempty"` - CreationTimestamp int64 `json:"creation_timestamp,omitempty"` - Creator string `json:"creator,omitempty"` - DataPlaneInfo *ModelDataPlaneInfo `json:"data_plane_info,omitempty"` - Description string `json:"description,omitempty"` - EndpointUrl string `json:"endpoint_url,omitempty"` - Id string `json:"id,omitempty"` - LastUpdatedTimestamp int64 `json:"last_updated_timestamp,omitempty"` - Name string `json:"name,omitempty"` - PendingConfig *EndpointPendingConfig `json:"pending_config,omitempty"` - PermissionLevel ServingEndpointDetailedPermissionLevel `json:"permission_level,omitempty"` - RouteOptimized bool `json:"route_optimized,omitempty"` - State *EndpointState `json:"state,omitempty"` - Tags []EndpointTag `json:"tags,omitempty"` - Task string `json:"task,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func servingEndpointDetailedFromPb(pb *servingEndpointDetailedPb) (*ServingEndpointDetailed, error) { - if pb == nil { - return nil, nil - } - st := &ServingEndpointDetailed{} - st.AiGateway = pb.AiGateway - st.BudgetPolicyId = pb.BudgetPolicyId - st.Config = pb.Config - st.CreationTimestamp = pb.CreationTimestamp - st.Creator = pb.Creator - st.DataPlaneInfo = pb.DataPlaneInfo - st.Description = pb.Description - st.EndpointUrl = pb.EndpointUrl - st.Id = pb.Id - st.LastUpdatedTimestamp = pb.LastUpdatedTimestamp - st.Name = pb.Name - st.PendingConfig = pb.PendingConfig - st.PermissionLevel = pb.PermissionLevel - st.RouteOptimized = pb.RouteOptimized - st.State = pb.State - st.Tags = pb.Tags - st.Task = pb.Task - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *servingEndpointDetailedPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st servingEndpointDetailedPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func servingEndpointPermissionToPb(st *ServingEndpointPermission) (*servingEndpointPermissionPb, error) { - if st == nil { - return nil, nil - } - pb := &servingEndpointPermissionPb{} - pb.Inherited = st.Inherited - pb.InheritedFromObject = st.InheritedFromObject - pb.PermissionLevel = st.PermissionLevel - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type servingEndpointPermissionPb struct { - Inherited bool `json:"inherited,omitempty"` - InheritedFromObject []string `json:"inherited_from_object,omitempty"` - PermissionLevel ServingEndpointPermissionLevel `json:"permission_level,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func servingEndpointPermissionFromPb(pb *servingEndpointPermissionPb) (*ServingEndpointPermission, error) { - if pb == nil { - return nil, nil - } - st := &ServingEndpointPermission{} - st.Inherited = pb.Inherited - st.InheritedFromObject = pb.InheritedFromObject - st.PermissionLevel = pb.PermissionLevel - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *servingEndpointPermissionPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st servingEndpointPermissionPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func servingEndpointPermissionsToPb(st *ServingEndpointPermissions) (*servingEndpointPermissionsPb, error) { - if st == nil { - return nil, nil - } - pb := &servingEndpointPermissionsPb{} - pb.AccessControlList = st.AccessControlList - pb.ObjectId = st.ObjectId - pb.ObjectType = st.ObjectType - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type servingEndpointPermissionsPb struct { - AccessControlList []ServingEndpointAccessControlResponse `json:"access_control_list,omitempty"` - ObjectId string `json:"object_id,omitempty"` - ObjectType string `json:"object_type,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func servingEndpointPermissionsFromPb(pb *servingEndpointPermissionsPb) (*ServingEndpointPermissions, error) { - if pb == nil { - return nil, nil - } - st := &ServingEndpointPermissions{} - st.AccessControlList = pb.AccessControlList - st.ObjectId = pb.ObjectId - st.ObjectType = pb.ObjectType - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *servingEndpointPermissionsPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st servingEndpointPermissionsPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func servingEndpointPermissionsDescriptionToPb(st *ServingEndpointPermissionsDescription) (*servingEndpointPermissionsDescriptionPb, error) { - if st == nil { - return nil, nil - } - pb := &servingEndpointPermissionsDescriptionPb{} - pb.Description = st.Description - pb.PermissionLevel = st.PermissionLevel - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type servingEndpointPermissionsDescriptionPb struct { - Description string `json:"description,omitempty"` - PermissionLevel ServingEndpointPermissionLevel `json:"permission_level,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func servingEndpointPermissionsDescriptionFromPb(pb *servingEndpointPermissionsDescriptionPb) (*ServingEndpointPermissionsDescription, error) { - if pb == nil { - return nil, nil - } - st := &ServingEndpointPermissionsDescription{} - st.Description = pb.Description - st.PermissionLevel = pb.PermissionLevel - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *servingEndpointPermissionsDescriptionPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st servingEndpointPermissionsDescriptionPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func servingEndpointPermissionsRequestToPb(st *ServingEndpointPermissionsRequest) (*servingEndpointPermissionsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &servingEndpointPermissionsRequestPb{} - pb.AccessControlList = st.AccessControlList - pb.ServingEndpointId = st.ServingEndpointId - - return pb, nil -} - -type servingEndpointPermissionsRequestPb struct { - AccessControlList []ServingEndpointAccessControlRequest `json:"access_control_list,omitempty"` - ServingEndpointId string `json:"-" url:"-"` -} - -func servingEndpointPermissionsRequestFromPb(pb *servingEndpointPermissionsRequestPb) (*ServingEndpointPermissionsRequest, error) { - if pb == nil { - return nil, nil - } - st := &ServingEndpointPermissionsRequest{} - st.AccessControlList = pb.AccessControlList - st.ServingEndpointId = pb.ServingEndpointId - - return st, nil -} - -func trafficConfigToPb(st *TrafficConfig) (*trafficConfigPb, error) { - if st == nil { - return nil, nil - } - pb := &trafficConfigPb{} - pb.Routes = st.Routes - - return pb, nil -} - -type trafficConfigPb struct { - Routes []Route `json:"routes,omitempty"` -} - -func trafficConfigFromPb(pb *trafficConfigPb) (*TrafficConfig, error) { - if pb == nil { - return nil, nil - } - st := &TrafficConfig{} - st.Routes = pb.Routes - - return st, nil -} - -func updateProvisionedThroughputEndpointConfigRequestToPb(st *UpdateProvisionedThroughputEndpointConfigRequest) (*updateProvisionedThroughputEndpointConfigRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &updateProvisionedThroughputEndpointConfigRequestPb{} - pb.Config = st.Config - pb.Name = st.Name - - return pb, nil -} - -type updateProvisionedThroughputEndpointConfigRequestPb struct { - Config PtEndpointCoreConfig `json:"config"` - Name string `json:"-" url:"-"` -} - -func updateProvisionedThroughputEndpointConfigRequestFromPb(pb *updateProvisionedThroughputEndpointConfigRequestPb) (*UpdateProvisionedThroughputEndpointConfigRequest, error) { - if pb == nil { - return nil, nil - } - st := &UpdateProvisionedThroughputEndpointConfigRequest{} - st.Config = pb.Config - st.Name = pb.Name - - return st, nil -} - -func v1ResponseChoiceElementToPb(st *V1ResponseChoiceElement) (*v1ResponseChoiceElementPb, error) { - if st == nil { - return nil, nil - } - pb := &v1ResponseChoiceElementPb{} - pb.FinishReason = st.FinishReason - pb.Index = st.Index - pb.Logprobs = st.Logprobs - pb.Message = st.Message - pb.Text = st.Text - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type v1ResponseChoiceElementPb struct { - FinishReason string `json:"finishReason,omitempty"` - Index int `json:"index,omitempty"` - Logprobs int `json:"logprobs,omitempty"` - Message *ChatMessage `json:"message,omitempty"` - Text string `json:"text,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func v1ResponseChoiceElementFromPb(pb *v1ResponseChoiceElementPb) (*V1ResponseChoiceElement, error) { - if pb == nil { - return nil, nil - } - st := &V1ResponseChoiceElement{} - st.FinishReason = pb.FinishReason - st.Index = pb.Index - st.Logprobs = pb.Logprobs - st.Message = pb.Message - st.Text = pb.Text - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *v1ResponseChoiceElementPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st v1ResponseChoiceElementPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func durationToPb(d *time.Duration) (*string, error) { - if d == nil { - return nil, nil - } - s := fmt.Sprintf("%.9fs", d.Seconds()) - return &s, nil -} - -func durationFromPb(s *string) (*time.Duration, error) { - if s == nil { - return nil, nil - } - d, err := time.ParseDuration(*s) - if err != nil { - return nil, err - } - return &d, nil -} - -func timestampToPb(t *time.Time) (*string, error) { - if t == nil { - return nil, nil - } - s := t.Format(time.RFC3339) - return &s, nil -} - -func timestampFromPb(s *string) (*time.Time, error) { - if s == nil { - return nil, nil - } - t, err := time.Parse(time.RFC3339, *s) - if err != nil { - return nil, err - } - return &t, nil -} - -func fieldMaskToPb(fm *[]string) (*string, error) { - if fm == nil { - return nil, nil - } - s := strings.Join(*fm, ",") - return &s, nil -} - -func fieldMaskFromPb(s *string) (*[]string, error) { - if s == nil { - return nil, nil - } - fm := strings.Split(*s, ",") - return &fm, nil -} diff --git a/service/serving/model.go b/service/serving/model.go index 3f4961556..cd3cf0053 100755 --- a/service/serving/model.go +++ b/service/serving/model.go @@ -3,9 +3,10 @@ package serving import ( - "encoding/json" "fmt" "io" + + "github.com/databricks/databricks-sdk-go/marshal" ) type Ai21LabsConfig struct { @@ -13,168 +14,72 @@ type Ai21LabsConfig struct { // prefer to paste your API key directly, see `ai21labs_api_key_plaintext`. // You must provide an API key using one of the following fields: // `ai21labs_api_key` or `ai21labs_api_key_plaintext`. - // Wire name: 'ai21labs_api_key' Ai21labsApiKey string `json:"ai21labs_api_key,omitempty"` // An AI21 Labs API key provided as a plaintext string. If you prefer to // reference your key using Databricks Secrets, see `ai21labs_api_key`. You // must provide an API key using one of the following fields: // `ai21labs_api_key` or `ai21labs_api_key_plaintext`. - // Wire name: 'ai21labs_api_key_plaintext' Ai21labsApiKeyPlaintext string `json:"ai21labs_api_key_plaintext,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *Ai21LabsConfig) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &ai21LabsConfigPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := ai21LabsConfigFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *Ai21LabsConfig) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st Ai21LabsConfig) MarshalJSON() ([]byte, error) { - pb, err := ai21LabsConfigToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s Ai21LabsConfig) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type AiGatewayConfig struct { // Configuration for traffic fallback which auto fallbacks to other served // entities if the request to a served entity fails with certain error // codes, to increase availability. - // Wire name: 'fallback_config' FallbackConfig *FallbackConfig `json:"fallback_config,omitempty"` // Configuration for AI Guardrails to prevent unwanted data and unsafe data // in requests and responses. - // Wire name: 'guardrails' Guardrails *AiGatewayGuardrails `json:"guardrails,omitempty"` // Configuration for payload logging using inference tables. Use these // tables to monitor and audit data being sent to and received from model // APIs and to improve model quality. - // Wire name: 'inference_table_config' InferenceTableConfig *AiGatewayInferenceTableConfig `json:"inference_table_config,omitempty"` // Configuration for rate limits which can be set to limit endpoint traffic. - // Wire name: 'rate_limits' RateLimits []AiGatewayRateLimit `json:"rate_limits,omitempty"` // Configuration to enable usage tracking using system tables. These tables // allow you to monitor operational usage on endpoints and their associated // costs. - // Wire name: 'usage_tracking_config' UsageTrackingConfig *AiGatewayUsageTrackingConfig `json:"usage_tracking_config,omitempty"` } -func (st *AiGatewayConfig) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &aiGatewayConfigPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := aiGatewayConfigFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st AiGatewayConfig) MarshalJSON() ([]byte, error) { - pb, err := aiGatewayConfigToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type AiGatewayGuardrailParameters struct { // List of invalid keywords. AI guardrail uses keyword or string matching to // decide if the keyword exists in the request or response content. - // Wire name: 'invalid_keywords' InvalidKeywords []string `json:"invalid_keywords,omitempty"` // Configuration for guardrail PII filter. - // Wire name: 'pii' Pii *AiGatewayGuardrailPiiBehavior `json:"pii,omitempty"` // Indicates whether the safety filter is enabled. - // Wire name: 'safety' Safety bool `json:"safety,omitempty"` // The list of allowed topics. Given a chat request, this guardrail flags // the request if its topic is not in the allowed topics. - // Wire name: 'valid_topics' ValidTopics []string `json:"valid_topics,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *AiGatewayGuardrailParameters) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &aiGatewayGuardrailParametersPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := aiGatewayGuardrailParametersFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *AiGatewayGuardrailParameters) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st AiGatewayGuardrailParameters) MarshalJSON() ([]byte, error) { - pb, err := aiGatewayGuardrailParametersToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s AiGatewayGuardrailParameters) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type AiGatewayGuardrailPiiBehavior struct { // Configuration for input guardrail filters. - // Wire name: 'behavior' Behavior AiGatewayGuardrailPiiBehaviorBehavior `json:"behavior,omitempty"` } -func (st *AiGatewayGuardrailPiiBehavior) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &aiGatewayGuardrailPiiBehaviorPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := aiGatewayGuardrailPiiBehaviorFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st AiGatewayGuardrailPiiBehavior) MarshalJSON() ([]byte, error) { - pb, err := aiGatewayGuardrailPiiBehaviorToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type AiGatewayGuardrailPiiBehaviorBehavior string const AiGatewayGuardrailPiiBehaviorBehaviorBlock AiGatewayGuardrailPiiBehaviorBehavior = `BLOCK` @@ -214,125 +119,49 @@ func (f *AiGatewayGuardrailPiiBehaviorBehavior) Type() string { type AiGatewayGuardrails struct { // Configuration for input guardrail filters. - // Wire name: 'input' Input *AiGatewayGuardrailParameters `json:"input,omitempty"` // Configuration for output guardrail filters. - // Wire name: 'output' Output *AiGatewayGuardrailParameters `json:"output,omitempty"` } -func (st *AiGatewayGuardrails) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &aiGatewayGuardrailsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := aiGatewayGuardrailsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st AiGatewayGuardrails) MarshalJSON() ([]byte, error) { - pb, err := aiGatewayGuardrailsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type AiGatewayInferenceTableConfig struct { // The name of the catalog in Unity Catalog. Required when enabling // inference tables. NOTE: On update, you have to disable inference table // first in order to change the catalog name. - // Wire name: 'catalog_name' CatalogName string `json:"catalog_name,omitempty"` // Indicates whether the inference table is enabled. - // Wire name: 'enabled' Enabled bool `json:"enabled,omitempty"` // The name of the schema in Unity Catalog. Required when enabling inference // tables. NOTE: On update, you have to disable inference table first in // order to change the schema name. - // Wire name: 'schema_name' SchemaName string `json:"schema_name,omitempty"` // The prefix of the table in Unity Catalog. NOTE: On update, you have to // disable inference table first in order to change the prefix name. - // Wire name: 'table_name_prefix' TableNamePrefix string `json:"table_name_prefix,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *AiGatewayInferenceTableConfig) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &aiGatewayInferenceTableConfigPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := aiGatewayInferenceTableConfigFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *AiGatewayInferenceTableConfig) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st AiGatewayInferenceTableConfig) MarshalJSON() ([]byte, error) { - pb, err := aiGatewayInferenceTableConfigToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s AiGatewayInferenceTableConfig) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type AiGatewayRateLimit struct { // Used to specify how many calls are allowed for a key within the // renewal_period. - // Wire name: 'calls' Calls int64 `json:"calls"` // Key field for a rate limit. Currently, only 'user' and 'endpoint' are // supported, with 'endpoint' being the default if not specified. - // Wire name: 'key' Key AiGatewayRateLimitKey `json:"key,omitempty"` // Renewal period field for a rate limit. Currently, only 'minute' is // supported. - // Wire name: 'renewal_period' RenewalPeriod AiGatewayRateLimitRenewalPeriod `json:"renewal_period"` } -func (st *AiGatewayRateLimit) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &aiGatewayRateLimitPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := aiGatewayRateLimitFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st AiGatewayRateLimit) MarshalJSON() ([]byte, error) { - pb, err := aiGatewayRateLimitToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type AiGatewayRateLimitKey string const AiGatewayRateLimitKeyEndpoint AiGatewayRateLimitKey = `endpoint` @@ -406,35 +235,17 @@ func (f *AiGatewayRateLimitRenewalPeriod) Type() string { type AiGatewayUsageTrackingConfig struct { // Whether to enable usage tracking. - // Wire name: 'enabled' Enabled bool `json:"enabled,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *AiGatewayUsageTrackingConfig) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &aiGatewayUsageTrackingConfigPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := aiGatewayUsageTrackingConfigFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *AiGatewayUsageTrackingConfig) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st AiGatewayUsageTrackingConfig) MarshalJSON() ([]byte, error) { - pb, err := aiGatewayUsageTrackingConfigToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s AiGatewayUsageTrackingConfig) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type AmazonBedrockConfig struct { @@ -443,17 +254,14 @@ type AmazonBedrockConfig struct { // your API key directly, see `aws_access_key_id_plaintext`. You must // provide an API key using one of the following fields: `aws_access_key_id` // or `aws_access_key_id_plaintext`. - // Wire name: 'aws_access_key_id' AwsAccessKeyId string `json:"aws_access_key_id,omitempty"` // An AWS access key ID with permissions to interact with Bedrock services // provided as a plaintext string. If you prefer to reference your key using // Databricks Secrets, see `aws_access_key_id`. You must provide an API key // using one of the following fields: `aws_access_key_id` or // `aws_access_key_id_plaintext`. - // Wire name: 'aws_access_key_id_plaintext' AwsAccessKeyIdPlaintext string `json:"aws_access_key_id_plaintext,omitempty"` // The AWS region to use. Bedrock has to be enabled there. - // Wire name: 'aws_region' AwsRegion string `json:"aws_region"` // The Databricks secret key reference for an AWS secret access key paired // with the access key ID, with permissions to interact with Bedrock @@ -461,7 +269,6 @@ type AmazonBedrockConfig struct { // `aws_secret_access_key_plaintext`. You must provide an API key using one // of the following fields: `aws_secret_access_key` or // `aws_secret_access_key_plaintext`. - // Wire name: 'aws_secret_access_key' AwsSecretAccessKey string `json:"aws_secret_access_key,omitempty"` // An AWS secret access key paired with the access key ID, with permissions // to interact with Bedrock services provided as a plaintext string. If you @@ -469,46 +276,26 @@ type AmazonBedrockConfig struct { // `aws_secret_access_key`. You must provide an API key using one of the // following fields: `aws_secret_access_key` or // `aws_secret_access_key_plaintext`. - // Wire name: 'aws_secret_access_key_plaintext' AwsSecretAccessKeyPlaintext string `json:"aws_secret_access_key_plaintext,omitempty"` // The underlying provider in Amazon Bedrock. Supported values (case // insensitive) include: Anthropic, Cohere, AI21Labs, Amazon. - // Wire name: 'bedrock_provider' BedrockProvider AmazonBedrockConfigBedrockProvider `json:"bedrock_provider"` // ARN of the instance profile that the external model will use to access // AWS resources. You must authenticate using an instance profile or access // keys. If you prefer to authenticate using access keys, see // `aws_access_key_id`, `aws_access_key_id_plaintext`, // `aws_secret_access_key` and `aws_secret_access_key_plaintext`. - // Wire name: 'instance_profile_arn' InstanceProfileArn string `json:"instance_profile_arn,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *AmazonBedrockConfig) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &amazonBedrockConfigPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := amazonBedrockConfigFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *AmazonBedrockConfig) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st AmazonBedrockConfig) MarshalJSON() ([]byte, error) { - pb, err := amazonBedrockConfigToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s AmazonBedrockConfig) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type AmazonBedrockConfigBedrockProvider string @@ -559,346 +346,148 @@ type AnthropicConfig struct { // prefer to paste your API key directly, see `anthropic_api_key_plaintext`. // You must provide an API key using one of the following fields: // `anthropic_api_key` or `anthropic_api_key_plaintext`. - // Wire name: 'anthropic_api_key' AnthropicApiKey string `json:"anthropic_api_key,omitempty"` // The Anthropic API key provided as a plaintext string. If you prefer to // reference your key using Databricks Secrets, see `anthropic_api_key`. You // must provide an API key using one of the following fields: // `anthropic_api_key` or `anthropic_api_key_plaintext`. - // Wire name: 'anthropic_api_key_plaintext' AnthropicApiKeyPlaintext string `json:"anthropic_api_key_plaintext,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *AnthropicConfig) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &anthropicConfigPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := anthropicConfigFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *AnthropicConfig) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st AnthropicConfig) MarshalJSON() ([]byte, error) { - pb, err := anthropicConfigToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s AnthropicConfig) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ApiKeyAuth struct { // The name of the API key parameter used for authentication. - // Wire name: 'key' Key string `json:"key"` // The Databricks secret key reference for an API Key. If you prefer to // paste your token directly, see `value_plaintext`. - // Wire name: 'value' Value string `json:"value,omitempty"` // The API Key provided as a plaintext string. If you prefer to reference // your token using Databricks Secrets, see `value`. - // Wire name: 'value_plaintext' ValuePlaintext string `json:"value_plaintext,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ApiKeyAuth) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &apiKeyAuthPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := apiKeyAuthFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ApiKeyAuth) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ApiKeyAuth) MarshalJSON() ([]byte, error) { - pb, err := apiKeyAuthToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ApiKeyAuth) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type AutoCaptureConfigInput struct { // The name of the catalog in Unity Catalog. NOTE: On update, you cannot // change the catalog name if the inference table is already enabled. - // Wire name: 'catalog_name' CatalogName string `json:"catalog_name,omitempty"` // Indicates whether the inference table is enabled. - // Wire name: 'enabled' Enabled bool `json:"enabled,omitempty"` // The name of the schema in Unity Catalog. NOTE: On update, you cannot // change the schema name if the inference table is already enabled. - // Wire name: 'schema_name' SchemaName string `json:"schema_name,omitempty"` // The prefix of the table in Unity Catalog. NOTE: On update, you cannot // change the prefix name if the inference table is already enabled. - // Wire name: 'table_name_prefix' TableNamePrefix string `json:"table_name_prefix,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *AutoCaptureConfigInput) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &autoCaptureConfigInputPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := autoCaptureConfigInputFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *AutoCaptureConfigInput) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st AutoCaptureConfigInput) MarshalJSON() ([]byte, error) { - pb, err := autoCaptureConfigInputToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s AutoCaptureConfigInput) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type AutoCaptureConfigOutput struct { // The name of the catalog in Unity Catalog. NOTE: On update, you cannot // change the catalog name if the inference table is already enabled. - // Wire name: 'catalog_name' CatalogName string `json:"catalog_name,omitempty"` // Indicates whether the inference table is enabled. - // Wire name: 'enabled' Enabled bool `json:"enabled,omitempty"` // The name of the schema in Unity Catalog. NOTE: On update, you cannot // change the schema name if the inference table is already enabled. - // Wire name: 'schema_name' SchemaName string `json:"schema_name,omitempty"` - // Wire name: 'state' State *AutoCaptureState `json:"state,omitempty"` // The prefix of the table in Unity Catalog. NOTE: On update, you cannot // change the prefix name if the inference table is already enabled. - // Wire name: 'table_name_prefix' TableNamePrefix string `json:"table_name_prefix,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *AutoCaptureConfigOutput) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &autoCaptureConfigOutputPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := autoCaptureConfigOutputFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *AutoCaptureConfigOutput) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st AutoCaptureConfigOutput) MarshalJSON() ([]byte, error) { - pb, err := autoCaptureConfigOutputToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s AutoCaptureConfigOutput) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type AutoCaptureState struct { - - // Wire name: 'payload_table' PayloadTable *PayloadTable `json:"payload_table,omitempty"` } -func (st *AutoCaptureState) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &autoCaptureStatePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := autoCaptureStateFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st AutoCaptureState) MarshalJSON() ([]byte, error) { - pb, err := autoCaptureStateToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type BearerTokenAuth struct { // The Databricks secret key reference for a token. If you prefer to paste // your token directly, see `token_plaintext`. - // Wire name: 'token' Token string `json:"token,omitempty"` // The token provided as a plaintext string. If you prefer to reference your // token using Databricks Secrets, see `token`. - // Wire name: 'token_plaintext' TokenPlaintext string `json:"token_plaintext,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *BearerTokenAuth) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &bearerTokenAuthPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := bearerTokenAuthFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *BearerTokenAuth) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st BearerTokenAuth) MarshalJSON() ([]byte, error) { - pb, err := bearerTokenAuthToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s BearerTokenAuth) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get build logs for a served model type BuildLogsRequest struct { // The name of the serving endpoint that the served model belongs to. This // field is required. - Name string `json:"-" tf:"-"` + Name string `json:"-" url:"-"` // The name of the served model that build logs will be retrieved for. This // field is required. - ServedModelName string `json:"-" tf:"-"` -} - -func (st *BuildLogsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &buildLogsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := buildLogsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st BuildLogsRequest) MarshalJSON() ([]byte, error) { - pb, err := buildLogsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + ServedModelName string `json:"-" url:"-"` } type BuildLogsResponse struct { // The logs associated with building the served entity's environment. - // Wire name: 'logs' Logs string `json:"logs"` } -func (st *BuildLogsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &buildLogsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := buildLogsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st BuildLogsResponse) MarshalJSON() ([]byte, error) { - pb, err := buildLogsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type ChatMessage struct { // The content of the message. - // Wire name: 'content' Content string `json:"content,omitempty"` // The role of the message. One of [system, user, assistant]. - // Wire name: 'role' Role ChatMessageRole `json:"role,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ChatMessage) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &chatMessagePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := chatMessageFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ChatMessage) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ChatMessage) MarshalJSON() ([]byte, error) { - pb, err := chatMessageToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ChatMessage) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The role of the message. One of [system, user, assistant]. @@ -945,229 +534,116 @@ func (f *ChatMessageRole) Type() string { type CohereConfig struct { // This is an optional field to provide a customized base URL for the Cohere // API. If left unspecified, the standard Cohere base URL is used. - // Wire name: 'cohere_api_base' CohereApiBase string `json:"cohere_api_base,omitempty"` // The Databricks secret key reference for a Cohere API key. If you prefer // to paste your API key directly, see `cohere_api_key_plaintext`. You must // provide an API key using one of the following fields: `cohere_api_key` or // `cohere_api_key_plaintext`. - // Wire name: 'cohere_api_key' CohereApiKey string `json:"cohere_api_key,omitempty"` // The Cohere API key provided as a plaintext string. If you prefer to // reference your key using Databricks Secrets, see `cohere_api_key`. You // must provide an API key using one of the following fields: // `cohere_api_key` or `cohere_api_key_plaintext`. - // Wire name: 'cohere_api_key_plaintext' CohereApiKeyPlaintext string `json:"cohere_api_key_plaintext,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CohereConfig) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &cohereConfigPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := cohereConfigFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CohereConfig) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CohereConfig) MarshalJSON() ([]byte, error) { - pb, err := cohereConfigToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CohereConfig) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreatePtEndpointRequest struct { // The AI Gateway configuration for the serving endpoint. - // Wire name: 'ai_gateway' AiGateway *AiGatewayConfig `json:"ai_gateway,omitempty"` // The budget policy associated with the endpoint. - // Wire name: 'budget_policy_id' BudgetPolicyId string `json:"budget_policy_id,omitempty"` // The core config of the serving endpoint. - // Wire name: 'config' Config PtEndpointCoreConfig `json:"config"` // The name of the serving endpoint. This field is required and must be // unique across a Databricks workspace. An endpoint name can consist of // alphanumeric characters, dashes, and underscores. - // Wire name: 'name' Name string `json:"name"` // Tags to be attached to the serving endpoint and automatically propagated // to billing logs. - // Wire name: 'tags' Tags []EndpointTag `json:"tags,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreatePtEndpointRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createPtEndpointRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createPtEndpointRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreatePtEndpointRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreatePtEndpointRequest) MarshalJSON() ([]byte, error) { - pb, err := createPtEndpointRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreatePtEndpointRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreateServingEndpoint struct { // The AI Gateway configuration for the serving endpoint. NOTE: External // model, provisioned throughput, and pay-per-token endpoints are fully // supported; agent endpoints currently only support inference tables. - // Wire name: 'ai_gateway' AiGateway *AiGatewayConfig `json:"ai_gateway,omitempty"` // The budget policy to be applied to the serving endpoint. - // Wire name: 'budget_policy_id' BudgetPolicyId string `json:"budget_policy_id,omitempty"` // The core config of the serving endpoint. - // Wire name: 'config' Config *EndpointCoreConfigInput `json:"config,omitempty"` // The name of the serving endpoint. This field is required and must be // unique across a Databricks workspace. An endpoint name can consist of // alphanumeric characters, dashes, and underscores. - // Wire name: 'name' Name string `json:"name"` // Rate limits to be applied to the serving endpoint. NOTE: this field is // deprecated, please use AI Gateway to manage rate limits. - // Wire name: 'rate_limits' RateLimits []RateLimit `json:"rate_limits,omitempty"` // Enable route optimization for the serving endpoint. - // Wire name: 'route_optimized' RouteOptimized bool `json:"route_optimized,omitempty"` // Tags to be attached to the serving endpoint and automatically propagated // to billing logs. - // Wire name: 'tags' Tags []EndpointTag `json:"tags,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateServingEndpoint) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createServingEndpointPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createServingEndpointFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateServingEndpoint) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateServingEndpoint) MarshalJSON() ([]byte, error) { - pb, err := createServingEndpointToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateServingEndpoint) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Configs needed to create a custom provider model route. type CustomProviderConfig struct { // This is a field to provide API key authentication for the custom provider // API. You can only specify one authentication method. - // Wire name: 'api_key_auth' ApiKeyAuth *ApiKeyAuth `json:"api_key_auth,omitempty"` // This is a field to provide bearer token authentication for the custom // provider API. You can only specify one authentication method. - // Wire name: 'bearer_token_auth' BearerTokenAuth *BearerTokenAuth `json:"bearer_token_auth,omitempty"` // This is a field to provide the URL of the custom provider API. - // Wire name: 'custom_provider_url' CustomProviderUrl string `json:"custom_provider_url"` } -func (st *CustomProviderConfig) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &customProviderConfigPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := customProviderConfigFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CustomProviderConfig) MarshalJSON() ([]byte, error) { - pb, err := customProviderConfigToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Details necessary to query this object's API through the DataPlane APIs. type DataPlaneInfo struct { // Authorization details as a string. - // Wire name: 'authorization_details' AuthorizationDetails string `json:"authorization_details,omitempty"` // The URL of the endpoint for this operation in the dataplane. - // Wire name: 'endpoint_url' EndpointUrl string `json:"endpoint_url,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DataPlaneInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &dataPlaneInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := dataPlaneInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DataPlaneInfo) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DataPlaneInfo) MarshalJSON() ([]byte, error) { - pb, err := dataPlaneInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DataPlaneInfo) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type DatabricksModelServingConfig struct { @@ -1177,7 +653,6 @@ type DatabricksModelServingConfig struct { // to paste your API key directly, see `databricks_api_token_plaintext`. You // must provide an API key using one of the following fields: // `databricks_api_token` or `databricks_api_token_plaintext`. - // Wire name: 'databricks_api_token' DatabricksApiToken string `json:"databricks_api_token,omitempty"` // The Databricks API token that corresponds to a user or service principal // with Can Query access to the model serving endpoint pointed to by this @@ -1185,173 +660,54 @@ type DatabricksModelServingConfig struct { // your key using Databricks Secrets, see `databricks_api_token`. You must // provide an API key using one of the following fields: // `databricks_api_token` or `databricks_api_token_plaintext`. - // Wire name: 'databricks_api_token_plaintext' DatabricksApiTokenPlaintext string `json:"databricks_api_token_plaintext,omitempty"` // The URL of the Databricks workspace containing the model serving endpoint // pointed to by this external model. - // Wire name: 'databricks_workspace_url' DatabricksWorkspaceUrl string `json:"databricks_workspace_url"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DatabricksModelServingConfig) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &databricksModelServingConfigPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := databricksModelServingConfigFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DatabricksModelServingConfig) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DatabricksModelServingConfig) MarshalJSON() ([]byte, error) { - pb, err := databricksModelServingConfigToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DatabricksModelServingConfig) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type DataframeSplitInput struct { - - // Wire name: 'columns' Columns []any `json:"columns,omitempty"` - // Wire name: 'data' Data []any `json:"data,omitempty"` - // Wire name: 'index' Index []int `json:"index,omitempty"` } -func (st *DataframeSplitInput) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &dataframeSplitInputPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := dataframeSplitInputFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DataframeSplitInput) MarshalJSON() ([]byte, error) { - pb, err := dataframeSplitInputToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type DeleteResponse struct { } -func (st *DeleteResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Delete a serving endpoint type DeleteServingEndpointRequest struct { - Name string `json:"-" tf:"-"` -} - -func (st *DeleteServingEndpointRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteServingEndpointRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteServingEndpointRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteServingEndpointRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteServingEndpointRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Name string `json:"-" url:"-"` } type EmbeddingsV1ResponseEmbeddingElement struct { - - // Wire name: 'embedding' Embedding []float64 `json:"embedding,omitempty"` // The index of the embedding in the response. - // Wire name: 'index' Index int `json:"index,omitempty"` // This will always be 'embedding'. - // Wire name: 'object' Object EmbeddingsV1ResponseEmbeddingElementObject `json:"object,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *EmbeddingsV1ResponseEmbeddingElement) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &embeddingsV1ResponseEmbeddingElementPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := embeddingsV1ResponseEmbeddingElementFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *EmbeddingsV1ResponseEmbeddingElement) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st EmbeddingsV1ResponseEmbeddingElement) MarshalJSON() ([]byte, error) { - pb, err := embeddingsV1ResponseEmbeddingElementToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s EmbeddingsV1ResponseEmbeddingElement) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // This will always be 'embedding'. @@ -1395,185 +751,84 @@ type EndpointCoreConfigInput struct { // new provisioned throughput endpoints, or updating existing provisioned // throughput endpoints that never have inference table configured; in these // cases please use AI Gateway to manage inference tables. - // Wire name: 'auto_capture_config' AutoCaptureConfig *AutoCaptureConfigInput `json:"auto_capture_config,omitempty"` // The name of the serving endpoint to update. This field is required. - Name string `json:"-" tf:"-"` + Name string `json:"-" url:"-"` // The list of served entities under the serving endpoint config. - // Wire name: 'served_entities' ServedEntities []ServedEntityInput `json:"served_entities,omitempty"` // (Deprecated, use served_entities instead) The list of served models under // the serving endpoint config. - // Wire name: 'served_models' ServedModels []ServedModelInput `json:"served_models,omitempty"` // The traffic configuration associated with the serving endpoint config. - // Wire name: 'traffic_config' TrafficConfig *TrafficConfig `json:"traffic_config,omitempty"` } -func (st *EndpointCoreConfigInput) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &endpointCoreConfigInputPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := endpointCoreConfigInputFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st EndpointCoreConfigInput) MarshalJSON() ([]byte, error) { - pb, err := endpointCoreConfigInputToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type EndpointCoreConfigOutput struct { // Configuration for Inference Tables which automatically logs requests and // responses to Unity Catalog. Note: this field is deprecated for creating // new provisioned throughput endpoints, or updating existing provisioned // throughput endpoints that never have inference table configured; in these // cases please use AI Gateway to manage inference tables. - // Wire name: 'auto_capture_config' AutoCaptureConfig *AutoCaptureConfigOutput `json:"auto_capture_config,omitempty"` // The config version that the serving endpoint is currently serving. - // Wire name: 'config_version' ConfigVersion int64 `json:"config_version,omitempty"` // The list of served entities under the serving endpoint config. - // Wire name: 'served_entities' ServedEntities []ServedEntityOutput `json:"served_entities,omitempty"` // (Deprecated, use served_entities instead) The list of served models under // the serving endpoint config. - // Wire name: 'served_models' ServedModels []ServedModelOutput `json:"served_models,omitempty"` // The traffic configuration associated with the serving endpoint config. - // Wire name: 'traffic_config' TrafficConfig *TrafficConfig `json:"traffic_config,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *EndpointCoreConfigOutput) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &endpointCoreConfigOutputPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := endpointCoreConfigOutputFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *EndpointCoreConfigOutput) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st EndpointCoreConfigOutput) MarshalJSON() ([]byte, error) { - pb, err := endpointCoreConfigOutputToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s EndpointCoreConfigOutput) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type EndpointCoreConfigSummary struct { // The list of served entities under the serving endpoint config. - // Wire name: 'served_entities' ServedEntities []ServedEntitySpec `json:"served_entities,omitempty"` // (Deprecated, use served_entities instead) The list of served models under // the serving endpoint config. - // Wire name: 'served_models' ServedModels []ServedModelSpec `json:"served_models,omitempty"` } -func (st *EndpointCoreConfigSummary) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &endpointCoreConfigSummaryPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := endpointCoreConfigSummaryFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st EndpointCoreConfigSummary) MarshalJSON() ([]byte, error) { - pb, err := endpointCoreConfigSummaryToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type EndpointPendingConfig struct { // Configuration for Inference Tables which automatically logs requests and // responses to Unity Catalog. Note: this field is deprecated for creating // new provisioned throughput endpoints, or updating existing provisioned // throughput endpoints that never have inference table configured; in these // cases please use AI Gateway to manage inference tables. - // Wire name: 'auto_capture_config' AutoCaptureConfig *AutoCaptureConfigOutput `json:"auto_capture_config,omitempty"` // The config version that the serving endpoint is currently serving. - // Wire name: 'config_version' ConfigVersion int `json:"config_version,omitempty"` // The list of served entities belonging to the last issued update to the // serving endpoint. - // Wire name: 'served_entities' ServedEntities []ServedEntityOutput `json:"served_entities,omitempty"` // (Deprecated, use served_entities instead) The list of served models // belonging to the last issued update to the serving endpoint. - // Wire name: 'served_models' ServedModels []ServedModelOutput `json:"served_models,omitempty"` // The timestamp when the update to the pending config started. - // Wire name: 'start_time' StartTime int64 `json:"start_time,omitempty"` // The traffic config defining how invocations to the serving endpoint // should be routed. - // Wire name: 'traffic_config' TrafficConfig *TrafficConfig `json:"traffic_config,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *EndpointPendingConfig) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &endpointPendingConfigPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := endpointPendingConfigFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *EndpointPendingConfig) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st EndpointPendingConfig) MarshalJSON() ([]byte, error) { - pb, err := endpointPendingConfigToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s EndpointPendingConfig) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type EndpointState struct { @@ -1582,41 +837,14 @@ type EndpointState struct { // update in progress. Note that if the endpoint's config_update state value // is IN_PROGRESS, another update can not be made until the update completes // or fails. - // Wire name: 'config_update' ConfigUpdate EndpointStateConfigUpdate `json:"config_update,omitempty"` // The state of an endpoint, indicating whether or not the endpoint is // queryable. An endpoint is READY if all of the served entities in its // active configuration are ready. If any of the actively served entities // are in a non-ready state, the endpoint state will be NOT_READY. - // Wire name: 'ready' Ready EndpointStateReady `json:"ready,omitempty"` } -func (st *EndpointState) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &endpointStatePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := endpointStateFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st EndpointState) MarshalJSON() ([]byte, error) { - pb, err := endpointStateToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type EndpointStateConfigUpdate string const EndpointStateConfigUpdateInProgress EndpointStateConfigUpdate = `IN_PROGRESS` @@ -1699,181 +927,62 @@ func (f *EndpointStateReady) Type() string { type EndpointTag struct { // Key field for a serving endpoint tag. - // Wire name: 'key' Key string `json:"key"` // Optional value field for a serving endpoint tag. - // Wire name: 'value' Value string `json:"value,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *EndpointTag) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &endpointTagPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := endpointTagFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *EndpointTag) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st EndpointTag) MarshalJSON() ([]byte, error) { - pb, err := endpointTagToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s EndpointTag) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type EndpointTags struct { - - // Wire name: 'tags' Tags []EndpointTag `json:"tags,omitempty"` } -func (st *EndpointTags) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &endpointTagsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := endpointTagsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st EndpointTags) MarshalJSON() ([]byte, error) { - pb, err := endpointTagsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Get metrics of a serving endpoint type ExportMetricsRequest struct { // The name of the serving endpoint to retrieve metrics for. This field is // required. - Name string `json:"-" tf:"-"` -} - -func (st *ExportMetricsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &exportMetricsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := exportMetricsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ExportMetricsRequest) MarshalJSON() ([]byte, error) { - pb, err := exportMetricsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Name string `json:"-" url:"-"` } type ExportMetricsResponse struct { - Contents io.ReadCloser `json:"-" tf:"-"` -} - -func (st *ExportMetricsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &exportMetricsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := exportMetricsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ExportMetricsResponse) MarshalJSON() ([]byte, error) { - pb, err := exportMetricsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Contents io.ReadCloser `json:"-"` } // Simple Proto message for testing type ExternalFunctionRequest struct { // The connection name to use. This is required to identify the external // connection. - // Wire name: 'connection_name' ConnectionName string `json:"connection_name"` // Additional headers for the request. If not provided, only auth headers // from connections would be passed. - // Wire name: 'headers' Headers string `json:"headers,omitempty"` // The JSON payload to send in the request body. - // Wire name: 'json' Json string `json:"json,omitempty"` // The HTTP method to use (e.g., 'GET', 'POST'). - // Wire name: 'method' Method ExternalFunctionRequestHttpMethod `json:"method"` // Query parameters for the request. - // Wire name: 'params' Params string `json:"params,omitempty"` // The relative path for the API endpoint. This is required. - // Wire name: 'path' Path string `json:"path"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ExternalFunctionRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &externalFunctionRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := externalFunctionRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ExternalFunctionRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ExternalFunctionRequest) MarshalJSON() ([]byte, error) { - pb, err := externalFunctionRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ExternalFunctionRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ExternalFunctionRequestHttpMethod string @@ -1924,73 +1033,36 @@ func (f *ExternalFunctionRequestHttpMethod) Type() string { type ExternalModel struct { // AI21Labs Config. Only required if the provider is 'ai21labs'. - // Wire name: 'ai21labs_config' Ai21labsConfig *Ai21LabsConfig `json:"ai21labs_config,omitempty"` // Amazon Bedrock Config. Only required if the provider is 'amazon-bedrock'. - // Wire name: 'amazon_bedrock_config' AmazonBedrockConfig *AmazonBedrockConfig `json:"amazon_bedrock_config,omitempty"` // Anthropic Config. Only required if the provider is 'anthropic'. - // Wire name: 'anthropic_config' AnthropicConfig *AnthropicConfig `json:"anthropic_config,omitempty"` // Cohere Config. Only required if the provider is 'cohere'. - // Wire name: 'cohere_config' CohereConfig *CohereConfig `json:"cohere_config,omitempty"` // Custom Provider Config. Only required if the provider is 'custom'. - // Wire name: 'custom_provider_config' CustomProviderConfig *CustomProviderConfig `json:"custom_provider_config,omitempty"` // Databricks Model Serving Config. Only required if the provider is // 'databricks-model-serving'. - // Wire name: 'databricks_model_serving_config' DatabricksModelServingConfig *DatabricksModelServingConfig `json:"databricks_model_serving_config,omitempty"` // Google Cloud Vertex AI Config. Only required if the provider is // 'google-cloud-vertex-ai'. - // Wire name: 'google_cloud_vertex_ai_config' GoogleCloudVertexAiConfig *GoogleCloudVertexAiConfig `json:"google_cloud_vertex_ai_config,omitempty"` // The name of the external model. - // Wire name: 'name' Name string `json:"name"` // OpenAI Config. Only required if the provider is 'openai'. - // Wire name: 'openai_config' OpenaiConfig *OpenAiConfig `json:"openai_config,omitempty"` // PaLM Config. Only required if the provider is 'palm'. - // Wire name: 'palm_config' PalmConfig *PaLmConfig `json:"palm_config,omitempty"` // The name of the provider for the external model. Currently, the supported // providers are 'ai21labs', 'anthropic', 'amazon-bedrock', 'cohere', // 'databricks-model-serving', 'google-cloud-vertex-ai', 'openai', 'palm', // and 'custom'. - // Wire name: 'provider' Provider ExternalModelProvider `json:"provider"` // The task type of the external model. - // Wire name: 'task' Task string `json:"task"` } -func (st *ExternalModel) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &externalModelPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := externalModelFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ExternalModel) MarshalJSON() ([]byte, error) { - pb, err := externalModelToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type ExternalModelProvider string const ExternalModelProviderAi21labs ExternalModelProvider = `ai21labs` @@ -2051,41 +1123,21 @@ func (f *ExternalModelProvider) Type() string { type ExternalModelUsageElement struct { // The number of tokens in the chat/completions response. - // Wire name: 'completion_tokens' CompletionTokens int `json:"completion_tokens,omitempty"` // The number of tokens in the prompt. - // Wire name: 'prompt_tokens' PromptTokens int `json:"prompt_tokens,omitempty"` // The total number of tokens in the prompt and response. - // Wire name: 'total_tokens' TotalTokens int `json:"total_tokens,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ExternalModelUsageElement) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &externalModelUsageElementPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := externalModelUsageElementFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ExternalModelUsageElement) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ExternalModelUsageElement) MarshalJSON() ([]byte, error) { - pb, err := externalModelUsageElementToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ExternalModelUsageElement) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type FallbackConfig struct { @@ -2095,262 +1147,63 @@ type FallbackConfig struct { // same endpoint, following the order of served entity list, until a // successful response is returned. If all attempts fail, return the last // response with the error code. - // Wire name: 'enabled' Enabled bool `json:"enabled"` } -func (st *FallbackConfig) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &fallbackConfigPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := fallbackConfigFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st FallbackConfig) MarshalJSON() ([]byte, error) { - pb, err := fallbackConfigToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // All fields are not sensitive as they are hard-coded in the system and made // available to customers. type FoundationModel struct { - - // Wire name: 'description' Description string `json:"description,omitempty"` - // Wire name: 'display_name' DisplayName string `json:"display_name,omitempty"` - // Wire name: 'docs' Docs string `json:"docs,omitempty"` - // Wire name: 'name' Name string `json:"name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *FoundationModel) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &foundationModelPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := foundationModelFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *FoundationModel) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st FoundationModel) MarshalJSON() ([]byte, error) { - pb, err := foundationModelToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s FoundationModel) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get the schema for a serving endpoint type GetOpenApiRequest struct { // The name of the serving endpoint that the served model belongs to. This // field is required. - Name string `json:"-" tf:"-"` -} - -func (st *GetOpenApiRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getOpenApiRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getOpenApiRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetOpenApiRequest) MarshalJSON() ([]byte, error) { - pb, err := getOpenApiRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - -type GetOpenApiResponse struct { - Contents io.ReadCloser `json:"-" tf:"-"` + Name string `json:"-" url:"-"` } - -func (st *GetOpenApiResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getOpenApiResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getOpenApiResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetOpenApiResponse) MarshalJSON() ([]byte, error) { - pb, err := getOpenApiResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - -// Get serving endpoint permission levels -type GetServingEndpointPermissionLevelsRequest struct { - // The serving endpoint for which to get or manage permissions. - ServingEndpointId string `json:"-" tf:"-"` -} - -func (st *GetServingEndpointPermissionLevelsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getServingEndpointPermissionLevelsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getServingEndpointPermissionLevelsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil + +type GetOpenApiResponse struct { + Contents io.ReadCloser `json:"-"` } -func (st GetServingEndpointPermissionLevelsRequest) MarshalJSON() ([]byte, error) { - pb, err := getServingEndpointPermissionLevelsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +// Get serving endpoint permission levels +type GetServingEndpointPermissionLevelsRequest struct { + // The serving endpoint for which to get or manage permissions. + ServingEndpointId string `json:"-" url:"-"` } type GetServingEndpointPermissionLevelsResponse struct { // Specific permission levels - // Wire name: 'permission_levels' PermissionLevels []ServingEndpointPermissionsDescription `json:"permission_levels,omitempty"` } -func (st *GetServingEndpointPermissionLevelsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getServingEndpointPermissionLevelsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getServingEndpointPermissionLevelsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetServingEndpointPermissionLevelsResponse) MarshalJSON() ([]byte, error) { - pb, err := getServingEndpointPermissionLevelsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Get serving endpoint permissions type GetServingEndpointPermissionsRequest struct { // The serving endpoint for which to get or manage permissions. - ServingEndpointId string `json:"-" tf:"-"` -} - -func (st *GetServingEndpointPermissionsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getServingEndpointPermissionsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getServingEndpointPermissionsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetServingEndpointPermissionsRequest) MarshalJSON() ([]byte, error) { - pb, err := getServingEndpointPermissionsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + ServingEndpointId string `json:"-" url:"-"` } // Get a single serving endpoint type GetServingEndpointRequest struct { // The name of the serving endpoint. This field is required. - Name string `json:"-" tf:"-"` -} - -func (st *GetServingEndpointRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getServingEndpointRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getServingEndpointRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetServingEndpointRequest) MarshalJSON() ([]byte, error) { - pb, err := getServingEndpointRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Name string `json:"-" url:"-"` } type GoogleCloudVertexAiConfig struct { @@ -2363,7 +1216,6 @@ type GoogleCloudVertexAiConfig struct { // // [Best practices for managing service account keys]: // https://cloud.google.com/iam/docs/best-practices-for-managing-service-account-keys - // Wire name: 'private_key' PrivateKey string `json:"private_key,omitempty"` // The private key for the service account which has access to the Google // Cloud Vertex AI Service provided as a plaintext secret. See [Best @@ -2374,11 +1226,9 @@ type GoogleCloudVertexAiConfig struct { // // [Best practices for managing service account keys]: // https://cloud.google.com/iam/docs/best-practices-for-managing-service-account-keys - // Wire name: 'private_key_plaintext' PrivateKeyPlaintext string `json:"private_key_plaintext,omitempty"` // This is the Google Cloud project id that the service account is // associated with. - // Wire name: 'project_id' ProjectId string `json:"project_id"` // This is the region for the Google Cloud Vertex AI Service. See [supported // regions] for more details. Some models are only available in specific @@ -2386,170 +1236,49 @@ type GoogleCloudVertexAiConfig struct { // // [supported regions]: // https://cloud.google.com/vertex-ai/docs/general/locations - // Wire name: 'region' Region string `json:"region"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GoogleCloudVertexAiConfig) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &googleCloudVertexAiConfigPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := googleCloudVertexAiConfigFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GoogleCloudVertexAiConfig) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GoogleCloudVertexAiConfig) MarshalJSON() ([]byte, error) { - pb, err := googleCloudVertexAiConfigToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GoogleCloudVertexAiConfig) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type HttpRequestResponse struct { - Contents io.ReadCloser `json:"-" tf:"-"` -} - -func (st *HttpRequestResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &httpRequestResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := httpRequestResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st HttpRequestResponse) MarshalJSON() ([]byte, error) { - pb, err := httpRequestResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Contents io.ReadCloser `json:"-"` } type ListEndpointsResponse struct { // The list of endpoints. - // Wire name: 'endpoints' Endpoints []ServingEndpoint `json:"endpoints,omitempty"` } -func (st *ListEndpointsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listEndpointsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listEndpointsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ListEndpointsResponse) MarshalJSON() ([]byte, error) { - pb, err := listEndpointsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Get the latest logs for a served model type LogsRequest struct { // The name of the serving endpoint that the served model belongs to. This // field is required. - Name string `json:"-" tf:"-"` + Name string `json:"-" url:"-"` // The name of the served model that logs will be retrieved for. This field // is required. - ServedModelName string `json:"-" tf:"-"` -} - -func (st *LogsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &logsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := logsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st LogsRequest) MarshalJSON() ([]byte, error) { - pb, err := logsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + ServedModelName string `json:"-" url:"-"` } // A representation of all DataPlaneInfo for operations that can be done on a // model through Data Plane APIs. type ModelDataPlaneInfo struct { // Information required to query DataPlane API 'query' endpoint. - // Wire name: 'query_info' QueryInfo *DataPlaneInfo `json:"query_info,omitempty"` } -func (st *ModelDataPlaneInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &modelDataPlaneInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := modelDataPlaneInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ModelDataPlaneInfo) MarshalJSON() ([]byte, error) { - pb, err := modelDataPlaneInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Configs needed to create an OpenAI model route. type OpenAiConfig struct { // This field is only required for Azure AD OpenAI and is the Microsoft // Entra Client ID. - // Wire name: 'microsoft_entra_client_id' MicrosoftEntraClientId string `json:"microsoft_entra_client_id,omitempty"` // The Databricks secret key reference for a client secret used for // Microsoft Entra ID authentication. If you prefer to paste your client @@ -2557,85 +1286,58 @@ type OpenAiConfig struct { // provide an API key using one of the following fields: // `microsoft_entra_client_secret` or // `microsoft_entra_client_secret_plaintext`. - // Wire name: 'microsoft_entra_client_secret' MicrosoftEntraClientSecret string `json:"microsoft_entra_client_secret,omitempty"` // The client secret used for Microsoft Entra ID authentication provided as // a plaintext string. If you prefer to reference your key using Databricks // Secrets, see `microsoft_entra_client_secret`. You must provide an API key // using one of the following fields: `microsoft_entra_client_secret` or // `microsoft_entra_client_secret_plaintext`. - // Wire name: 'microsoft_entra_client_secret_plaintext' MicrosoftEntraClientSecretPlaintext string `json:"microsoft_entra_client_secret_plaintext,omitempty"` // This field is only required for Azure AD OpenAI and is the Microsoft // Entra Tenant ID. - // Wire name: 'microsoft_entra_tenant_id' MicrosoftEntraTenantId string `json:"microsoft_entra_tenant_id,omitempty"` // This is a field to provide a customized base URl for the OpenAI API. For // Azure OpenAI, this field is required, and is the base URL for the Azure // OpenAI API service provided by Azure. For other OpenAI API types, this // field is optional, and if left unspecified, the standard OpenAI base URL // is used. - // Wire name: 'openai_api_base' OpenaiApiBase string `json:"openai_api_base,omitempty"` // The Databricks secret key reference for an OpenAI API key using the // OpenAI or Azure service. If you prefer to paste your API key directly, // see `openai_api_key_plaintext`. You must provide an API key using one of // the following fields: `openai_api_key` or `openai_api_key_plaintext`. - // Wire name: 'openai_api_key' OpenaiApiKey string `json:"openai_api_key,omitempty"` // The OpenAI API key using the OpenAI or Azure service provided as a // plaintext string. If you prefer to reference your key using Databricks // Secrets, see `openai_api_key`. You must provide an API key using one of // the following fields: `openai_api_key` or `openai_api_key_plaintext`. - // Wire name: 'openai_api_key_plaintext' OpenaiApiKeyPlaintext string `json:"openai_api_key_plaintext,omitempty"` // This is an optional field to specify the type of OpenAI API to use. For // Azure OpenAI, this field is required, and adjust this parameter to // represent the preferred security access validation protocol. For access // token validation, use azure. For authentication using Azure Active // Directory (Azure AD) use, azuread. - // Wire name: 'openai_api_type' OpenaiApiType string `json:"openai_api_type,omitempty"` // This is an optional field to specify the OpenAI API version. For Azure // OpenAI, this field is required, and is the version of the Azure OpenAI // service to utilize, specified by a date. - // Wire name: 'openai_api_version' OpenaiApiVersion string `json:"openai_api_version,omitempty"` // This field is only required for Azure OpenAI and is the name of the // deployment resource for the Azure OpenAI service. - // Wire name: 'openai_deployment_name' OpenaiDeploymentName string `json:"openai_deployment_name,omitempty"` // This is an optional field to specify the organization in OpenAI or Azure // OpenAI. - // Wire name: 'openai_organization' OpenaiOrganization string `json:"openai_organization,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *OpenAiConfig) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &openAiConfigPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := openAiConfigFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *OpenAiConfig) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st OpenAiConfig) MarshalJSON() ([]byte, error) { - pb, err := openAiConfigToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s OpenAiConfig) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type PaLmConfig struct { @@ -2643,527 +1345,245 @@ type PaLmConfig struct { // paste your API key directly, see `palm_api_key_plaintext`. You must // provide an API key using one of the following fields: `palm_api_key` or // `palm_api_key_plaintext`. - // Wire name: 'palm_api_key' PalmApiKey string `json:"palm_api_key,omitempty"` // The PaLM API key provided as a plaintext string. If you prefer to // reference your key using Databricks Secrets, see `palm_api_key`. You must // provide an API key using one of the following fields: `palm_api_key` or // `palm_api_key_plaintext`. - // Wire name: 'palm_api_key_plaintext' PalmApiKeyPlaintext string `json:"palm_api_key_plaintext,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *PaLmConfig) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &paLmConfigPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := paLmConfigFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *PaLmConfig) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st PaLmConfig) MarshalJSON() ([]byte, error) { - pb, err := paLmConfigToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s PaLmConfig) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type PatchServingEndpointTags struct { // List of endpoint tags to add - // Wire name: 'add_tags' AddTags []EndpointTag `json:"add_tags,omitempty"` // List of tag keys to delete - // Wire name: 'delete_tags' DeleteTags []string `json:"delete_tags,omitempty"` // The name of the serving endpoint who's tags to patch. This field is // required. - Name string `json:"-" tf:"-"` -} - -func (st *PatchServingEndpointTags) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &patchServingEndpointTagsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := patchServingEndpointTagsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st PatchServingEndpointTags) MarshalJSON() ([]byte, error) { - pb, err := patchServingEndpointTagsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Name string `json:"-" url:"-"` } type PayloadTable struct { - - // Wire name: 'name' Name string `json:"name,omitempty"` - // Wire name: 'status' Status string `json:"status,omitempty"` - // Wire name: 'status_message' StatusMessage string `json:"status_message,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *PayloadTable) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &payloadTablePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := payloadTableFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *PayloadTable) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st PayloadTable) MarshalJSON() ([]byte, error) { - pb, err := payloadTableToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s PayloadTable) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type PtEndpointCoreConfig struct { // The list of served entities under the serving endpoint config. - // Wire name: 'served_entities' ServedEntities []PtServedModel `json:"served_entities,omitempty"` - // Wire name: 'traffic_config' TrafficConfig *TrafficConfig `json:"traffic_config,omitempty"` } -func (st *PtEndpointCoreConfig) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &ptEndpointCoreConfigPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := ptEndpointCoreConfigFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st PtEndpointCoreConfig) MarshalJSON() ([]byte, error) { - pb, err := ptEndpointCoreConfigToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type PtServedModel struct { // The name of the entity to be served. The entity may be a model in the // Databricks Model Registry, a model in the Unity Catalog (UC), or a // function of type FEATURE_SPEC in the UC. If it is a UC object, the full // name of the object should be given in the form of // **catalog_name.schema_name.model_name**. - // Wire name: 'entity_name' EntityName string `json:"entity_name"` - // Wire name: 'entity_version' EntityVersion string `json:"entity_version,omitempty"` // The name of a served entity. It must be unique across an endpoint. A // served entity name can consist of alphanumeric characters, dashes, and // underscores. If not specified for an external model, this field defaults // to external_model.name, with '.' and ':' replaced with '-', and if not // specified for other entities, it defaults to entity_name-entity_version. - // Wire name: 'name' Name string `json:"name,omitempty"` // The number of model units to be provisioned. - // Wire name: 'provisioned_model_units' ProvisionedModelUnits int64 `json:"provisioned_model_units"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *PtServedModel) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &ptServedModelPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := ptServedModelFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *PtServedModel) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st PtServedModel) MarshalJSON() ([]byte, error) { - pb, err := ptServedModelToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s PtServedModel) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type PutAiGatewayRequest struct { // Configuration for traffic fallback which auto fallbacks to other served // entities if the request to a served entity fails with certain error // codes, to increase availability. - // Wire name: 'fallback_config' FallbackConfig *FallbackConfig `json:"fallback_config,omitempty"` // Configuration for AI Guardrails to prevent unwanted data and unsafe data // in requests and responses. - // Wire name: 'guardrails' Guardrails *AiGatewayGuardrails `json:"guardrails,omitempty"` // Configuration for payload logging using inference tables. Use these // tables to monitor and audit data being sent to and received from model // APIs and to improve model quality. - // Wire name: 'inference_table_config' InferenceTableConfig *AiGatewayInferenceTableConfig `json:"inference_table_config,omitempty"` // The name of the serving endpoint whose AI Gateway is being updated. This // field is required. - Name string `json:"-" tf:"-"` + Name string `json:"-" url:"-"` // Configuration for rate limits which can be set to limit endpoint traffic. - // Wire name: 'rate_limits' RateLimits []AiGatewayRateLimit `json:"rate_limits,omitempty"` // Configuration to enable usage tracking using system tables. These tables // allow you to monitor operational usage on endpoints and their associated // costs. - // Wire name: 'usage_tracking_config' UsageTrackingConfig *AiGatewayUsageTrackingConfig `json:"usage_tracking_config,omitempty"` } -func (st *PutAiGatewayRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &putAiGatewayRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := putAiGatewayRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st PutAiGatewayRequest) MarshalJSON() ([]byte, error) { - pb, err := putAiGatewayRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type PutAiGatewayResponse struct { // Configuration for traffic fallback which auto fallbacks to other served // entities if the request to a served entity fails with certain error // codes, to increase availability. - // Wire name: 'fallback_config' FallbackConfig *FallbackConfig `json:"fallback_config,omitempty"` // Configuration for AI Guardrails to prevent unwanted data and unsafe data // in requests and responses. - // Wire name: 'guardrails' Guardrails *AiGatewayGuardrails `json:"guardrails,omitempty"` // Configuration for payload logging using inference tables. Use these // tables to monitor and audit data being sent to and received from model // APIs and to improve model quality. - // Wire name: 'inference_table_config' InferenceTableConfig *AiGatewayInferenceTableConfig `json:"inference_table_config,omitempty"` // Configuration for rate limits which can be set to limit endpoint traffic. - // Wire name: 'rate_limits' RateLimits []AiGatewayRateLimit `json:"rate_limits,omitempty"` // Configuration to enable usage tracking using system tables. These tables // allow you to monitor operational usage on endpoints and their associated // costs. - // Wire name: 'usage_tracking_config' UsageTrackingConfig *AiGatewayUsageTrackingConfig `json:"usage_tracking_config,omitempty"` } -func (st *PutAiGatewayResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &putAiGatewayResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := putAiGatewayResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st PutAiGatewayResponse) MarshalJSON() ([]byte, error) { - pb, err := putAiGatewayResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type PutRequest struct { // The name of the serving endpoint whose rate limits are being updated. // This field is required. - Name string `json:"-" tf:"-"` + Name string `json:"-" url:"-"` // The list of endpoint rate limits. - // Wire name: 'rate_limits' RateLimits []RateLimit `json:"rate_limits,omitempty"` } -func (st *PutRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &putRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := putRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st PutRequest) MarshalJSON() ([]byte, error) { - pb, err := putRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type PutResponse struct { // The list of endpoint rate limits. - // Wire name: 'rate_limits' RateLimits []RateLimit `json:"rate_limits,omitempty"` } -func (st *PutResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &putResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := putResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st PutResponse) MarshalJSON() ([]byte, error) { - pb, err := putResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type QueryEndpointInput struct { // Pandas Dataframe input in the records orientation. - // Wire name: 'dataframe_records' DataframeRecords []any `json:"dataframe_records,omitempty"` // Pandas Dataframe input in the split orientation. - // Wire name: 'dataframe_split' DataframeSplit *DataframeSplitInput `json:"dataframe_split,omitempty"` // The extra parameters field used ONLY for __completions, chat,__ and // __embeddings external & foundation model__ serving endpoints. This is a // map of strings and should only be used with other external/foundation // model query fields. - // Wire name: 'extra_params' ExtraParams map[string]string `json:"extra_params,omitempty"` // The input string (or array of strings) field used ONLY for __embeddings // external & foundation model__ serving endpoints and is the only field // (along with extra_params if needed) used by embeddings queries. - // Wire name: 'input' Input any `json:"input,omitempty"` // Tensor-based input in columnar format. - // Wire name: 'inputs' Inputs any `json:"inputs,omitempty"` // Tensor-based input in row format. - // Wire name: 'instances' Instances []any `json:"instances,omitempty"` // The max tokens field used ONLY for __completions__ and __chat external & // foundation model__ serving endpoints. This is an integer and should only // be used with other chat/completions query fields. - // Wire name: 'max_tokens' MaxTokens int `json:"max_tokens,omitempty"` // The messages field used ONLY for __chat external & foundation model__ // serving endpoints. This is a map of strings and should only be used with // other chat query fields. - // Wire name: 'messages' Messages []ChatMessage `json:"messages,omitempty"` // The n (number of candidates) field used ONLY for __completions__ and // __chat external & foundation model__ serving endpoints. This is an // integer between 1 and 5 with a default of 1 and should only be used with // other chat/completions query fields. - // Wire name: 'n' N int `json:"n,omitempty"` // The name of the serving endpoint. This field is required. - Name string `json:"-" tf:"-"` + Name string `json:"-" url:"-"` // The prompt string (or array of strings) field used ONLY for __completions // external & foundation model__ serving endpoints and should only be used // with other completions query fields. - // Wire name: 'prompt' Prompt any `json:"prompt,omitempty"` // The stop sequences field used ONLY for __completions__ and __chat // external & foundation model__ serving endpoints. This is a list of // strings and should only be used with other chat/completions query fields. - // Wire name: 'stop' Stop []string `json:"stop,omitempty"` // The stream field used ONLY for __completions__ and __chat external & // foundation model__ serving endpoints. This is a boolean defaulting to // false and should only be used with other chat/completions query fields. - // Wire name: 'stream' Stream bool `json:"stream,omitempty"` // The temperature field used ONLY for __completions__ and __chat external & // foundation model__ serving endpoints. This is a float between 0.0 and 2.0 // with a default of 1.0 and should only be used with other chat/completions // query fields. - // Wire name: 'temperature' Temperature float64 `json:"temperature,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *QueryEndpointInput) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &queryEndpointInputPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := queryEndpointInputFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *QueryEndpointInput) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st QueryEndpointInput) MarshalJSON() ([]byte, error) { - pb, err := queryEndpointInputToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s QueryEndpointInput) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type QueryEndpointResponse struct { // The list of choices returned by the __chat or completions // external/foundation model__ serving endpoint. - // Wire name: 'choices' Choices []V1ResponseChoiceElement `json:"choices,omitempty"` // The timestamp in seconds when the query was created in Unix time returned // by a __completions or chat external/foundation model__ serving endpoint. - // Wire name: 'created' Created int64 `json:"created,omitempty"` // The list of the embeddings returned by the __embeddings // external/foundation model__ serving endpoint. - // Wire name: 'data' Data []EmbeddingsV1ResponseEmbeddingElement `json:"data,omitempty"` // The ID of the query that may be returned by a __completions or chat // external/foundation model__ serving endpoint. - // Wire name: 'id' Id string `json:"id,omitempty"` // The name of the __external/foundation model__ used for querying. This is // the name of the model that was specified in the endpoint config. - // Wire name: 'model' Model string `json:"model,omitempty"` // The type of object returned by the __external/foundation model__ serving // endpoint, one of [text_completion, chat.completion, list (of // embeddings)]. - // Wire name: 'object' Object QueryEndpointResponseObject `json:"object,omitempty"` // The predictions returned by the serving endpoint. - // Wire name: 'predictions' Predictions []any `json:"predictions,omitempty"` // The name of the served model that served the request. This is useful when // there are multiple models behind the same endpoint with traffic split. - ServedModelName string `json:"-" tf:"-"` + ServedModelName string `json:"-" url:"-" header:"served-model-name,omitempty"` // The usage object that may be returned by the __external/foundation // model__ serving endpoint. This contains information about the number of // tokens used in the prompt and response. - // Wire name: 'usage' Usage *ExternalModelUsageElement `json:"usage,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *QueryEndpointResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &queryEndpointResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := queryEndpointResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *QueryEndpointResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st QueryEndpointResponse) MarshalJSON() ([]byte, error) { - pb, err := queryEndpointResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s QueryEndpointResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The type of object returned by the __external/foundation model__ serving @@ -3211,44 +1631,16 @@ func (f *QueryEndpointResponseObject) Type() string { type RateLimit struct { // Used to specify how many calls are allowed for a key within the // renewal_period. - // Wire name: 'calls' Calls int64 `json:"calls"` // Key field for a serving endpoint rate limit. Currently, only 'user' and // 'endpoint' are supported, with 'endpoint' being the default if not // specified. - // Wire name: 'key' Key RateLimitKey `json:"key,omitempty"` // Renewal period field for a serving endpoint rate limit. Currently, only // 'minute' is supported. - // Wire name: 'renewal_period' RenewalPeriod RateLimitRenewalPeriod `json:"renewal_period"` } -func (st *RateLimit) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &rateLimitPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := rateLimitFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st RateLimit) MarshalJSON() ([]byte, error) { - pb, err := rateLimitToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type RateLimitKey string const RateLimitKeyEndpoint RateLimitKey = `endpoint` @@ -3322,49 +1714,20 @@ func (f *RateLimitRenewalPeriod) Type() string { type Route struct { // The name of the served model this route configures traffic for. - // Wire name: 'served_model_name' ServedModelName string `json:"served_model_name"` // The percentage of endpoint traffic to send to this route. It must be an // integer between 0 and 100 inclusive. - // Wire name: 'traffic_percentage' TrafficPercentage int `json:"traffic_percentage"` } -func (st *Route) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &routePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := routeFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st Route) MarshalJSON() ([]byte, error) { - pb, err := routeToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type ServedEntityInput struct { // The name of the entity to be served. The entity may be a model in the // Databricks Model Registry, a model in the Unity Catalog (UC), or a // function of type FEATURE_SPEC in the UC. If it is a UC object, the full // name of the object should be given in the form of // **catalog_name.schema_name.model_name**. - // Wire name: 'entity_name' EntityName string `json:"entity_name,omitempty"` - // Wire name: 'entity_version' EntityVersion string `json:"entity_version,omitempty"` // An object containing a set of optional, user-specified environment // variable key-value pairs used for serving this entity. Note: this is an @@ -3372,7 +1735,6 @@ type ServedEntityInput struct { // variables that refer to Databricks secrets: `{"OPENAI_API_KEY": // "{{secrets/my_scope/my_key}}", "DATABRICKS_TOKEN": // "{{secrets/my_scope2/my_key2}}"}` - // Wire name: 'environment_vars' EnvironmentVars map[string]string `json:"environment_vars,omitempty"` // The external model to be served. NOTE: Only one of external_model and // (entity_name, entity_version, workload_size, workload_type, and @@ -3382,39 +1744,30 @@ type ServedEntityInput struct { // endpoint without external_model. If the endpoint is created without // external_model, users cannot update it to add external_model later. The // task type of all external models within an endpoint must be the same. - // Wire name: 'external_model' ExternalModel *ExternalModel `json:"external_model,omitempty"` // ARN of the instance profile that the served entity uses to access AWS // resources. - // Wire name: 'instance_profile_arn' InstanceProfileArn string `json:"instance_profile_arn,omitempty"` // The maximum provisioned concurrency that the endpoint can scale up to. Do // not use if workload_size is specified. - // Wire name: 'max_provisioned_concurrency' MaxProvisionedConcurrency int `json:"max_provisioned_concurrency,omitempty"` // The maximum tokens per second that the endpoint can scale up to. - // Wire name: 'max_provisioned_throughput' MaxProvisionedThroughput int `json:"max_provisioned_throughput,omitempty"` // The minimum provisioned concurrency that the endpoint can scale down to. // Do not use if workload_size is specified. - // Wire name: 'min_provisioned_concurrency' MinProvisionedConcurrency int `json:"min_provisioned_concurrency,omitempty"` // The minimum tokens per second that the endpoint can scale down to. - // Wire name: 'min_provisioned_throughput' MinProvisionedThroughput int `json:"min_provisioned_throughput,omitempty"` // The name of a served entity. It must be unique across an endpoint. A // served entity name can consist of alphanumeric characters, dashes, and // underscores. If not specified for an external model, this field defaults // to external_model.name, with '.' and ':' replaced with '-', and if not // specified for other entities, it defaults to entity_name-entity_version. - // Wire name: 'name' Name string `json:"name,omitempty"` // The number of model units provisioned. - // Wire name: 'provisioned_model_units' ProvisionedModelUnits int64 `json:"provisioned_model_units,omitempty"` // Whether the compute resources for the served entity should scale down to // zero. - // Wire name: 'scale_to_zero_enabled' ScaleToZeroEnabled bool `json:"scale_to_zero_enabled,omitempty"` // The workload size of the served entity. The workload size corresponds to // a range of provisioned concurrency that the compute autoscales between. A @@ -3426,7 +1779,6 @@ type ServedEntityInput struct { // lower bound of the provisioned concurrency for each workload size is 0. // Do not use if min_provisioned_concurrency and max_provisioned_concurrency // are specified. - // Wire name: 'workload_size' WorkloadSize string `json:"workload_size,omitempty"` // The workload type of the served entity. The workload type selects which // type of compute to use in the endpoint. The default value for this @@ -3435,53 +1787,30 @@ type ServedEntityInput struct { // available [GPU types]. // // [GPU types]: https://docs.databricks.com/en/machine-learning/model-serving/create-manage-serving-endpoints.html#gpu-workload-types - // Wire name: 'workload_type' WorkloadType ServingModelWorkloadType `json:"workload_type,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ServedEntityInput) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &servedEntityInputPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := servedEntityInputFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ServedEntityInput) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ServedEntityInput) MarshalJSON() ([]byte, error) { - pb, err := servedEntityInputToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ServedEntityInput) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ServedEntityOutput struct { - - // Wire name: 'creation_timestamp' CreationTimestamp int64 `json:"creation_timestamp,omitempty"` - // Wire name: 'creator' Creator string `json:"creator,omitempty"` // The name of the entity to be served. The entity may be a model in the // Databricks Model Registry, a model in the Unity Catalog (UC), or a // function of type FEATURE_SPEC in the UC. If it is a UC object, the full // name of the object should be given in the form of // **catalog_name.schema_name.model_name**. - // Wire name: 'entity_name' EntityName string `json:"entity_name,omitempty"` - // Wire name: 'entity_version' EntityVersion string `json:"entity_version,omitempty"` // An object containing a set of optional, user-specified environment // variable key-value pairs used for serving this entity. Note: this is an @@ -3489,7 +1818,6 @@ type ServedEntityOutput struct { // variables that refer to Databricks secrets: `{"OPENAI_API_KEY": // "{{secrets/my_scope/my_key}}", "DATABRICKS_TOKEN": // "{{secrets/my_scope2/my_key2}}"}` - // Wire name: 'environment_vars' EnvironmentVars map[string]string `json:"environment_vars,omitempty"` // The external model to be served. NOTE: Only one of external_model and // (entity_name, entity_version, workload_size, workload_type, and @@ -3499,46 +1827,35 @@ type ServedEntityOutput struct { // endpoint without external_model. If the endpoint is created without // external_model, users cannot update it to add external_model later. The // task type of all external models within an endpoint must be the same. - // Wire name: 'external_model' ExternalModel *ExternalModel `json:"external_model,omitempty"` // All fields are not sensitive as they are hard-coded in the system and // made available to customers. - // Wire name: 'foundation_model' FoundationModel *FoundationModel `json:"foundation_model,omitempty"` // ARN of the instance profile that the served entity uses to access AWS // resources. - // Wire name: 'instance_profile_arn' InstanceProfileArn string `json:"instance_profile_arn,omitempty"` // The maximum provisioned concurrency that the endpoint can scale up to. Do // not use if workload_size is specified. - // Wire name: 'max_provisioned_concurrency' MaxProvisionedConcurrency int `json:"max_provisioned_concurrency,omitempty"` // The maximum tokens per second that the endpoint can scale up to. - // Wire name: 'max_provisioned_throughput' MaxProvisionedThroughput int `json:"max_provisioned_throughput,omitempty"` // The minimum provisioned concurrency that the endpoint can scale down to. // Do not use if workload_size is specified. - // Wire name: 'min_provisioned_concurrency' MinProvisionedConcurrency int `json:"min_provisioned_concurrency,omitempty"` // The minimum tokens per second that the endpoint can scale down to. - // Wire name: 'min_provisioned_throughput' MinProvisionedThroughput int `json:"min_provisioned_throughput,omitempty"` // The name of a served entity. It must be unique across an endpoint. A // served entity name can consist of alphanumeric characters, dashes, and // underscores. If not specified for an external model, this field defaults // to external_model.name, with '.' and ':' replaced with '-', and if not // specified for other entities, it defaults to entity_name-entity_version. - // Wire name: 'name' Name string `json:"name,omitempty"` // The number of model units provisioned. - // Wire name: 'provisioned_model_units' ProvisionedModelUnits int64 `json:"provisioned_model_units,omitempty"` // Whether the compute resources for the served entity should scale down to // zero. - // Wire name: 'scale_to_zero_enabled' ScaleToZeroEnabled bool `json:"scale_to_zero_enabled,omitempty"` - // Wire name: 'state' State *ServedModelState `json:"state,omitempty"` // The workload size of the served entity. The workload size corresponds to // a range of provisioned concurrency that the compute autoscales between. A @@ -3550,7 +1867,6 @@ type ServedEntityOutput struct { // lower bound of the provisioned concurrency for each workload size is 0. // Do not use if min_provisioned_concurrency and max_provisioned_concurrency // are specified. - // Wire name: 'workload_size' WorkloadSize string `json:"workload_size,omitempty"` // The workload type of the served entity. The workload type selects which // type of compute to use in the endpoint. The default value for this @@ -3559,81 +1875,40 @@ type ServedEntityOutput struct { // available [GPU types]. // // [GPU types]: https://docs.databricks.com/en/machine-learning/model-serving/create-manage-serving-endpoints.html#gpu-workload-types - // Wire name: 'workload_type' WorkloadType ServingModelWorkloadType `json:"workload_type,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ServedEntityOutput) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &servedEntityOutputPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := servedEntityOutputFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ServedEntityOutput) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ServedEntityOutput) MarshalJSON() ([]byte, error) { - pb, err := servedEntityOutputToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ServedEntityOutput) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ServedEntitySpec struct { - - // Wire name: 'entity_name' EntityName string `json:"entity_name,omitempty"` - // Wire name: 'entity_version' EntityVersion string `json:"entity_version,omitempty"` - // Wire name: 'external_model' ExternalModel *ExternalModel `json:"external_model,omitempty"` // All fields are not sensitive as they are hard-coded in the system and // made available to customers. - // Wire name: 'foundation_model' FoundationModel *FoundationModel `json:"foundation_model,omitempty"` - // Wire name: 'name' Name string `json:"name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ServedEntitySpec) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &servedEntitySpecPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := servedEntitySpecFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ServedEntitySpec) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ServedEntitySpec) MarshalJSON() ([]byte, error) { - pb, err := servedEntitySpecToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ServedEntitySpec) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ServedModelInput struct { @@ -3643,45 +1918,34 @@ type ServedModelInput struct { // variables that refer to Databricks secrets: `{"OPENAI_API_KEY": // "{{secrets/my_scope/my_key}}", "DATABRICKS_TOKEN": // "{{secrets/my_scope2/my_key2}}"}` - // Wire name: 'environment_vars' EnvironmentVars map[string]string `json:"environment_vars,omitempty"` // ARN of the instance profile that the served entity uses to access AWS // resources. - // Wire name: 'instance_profile_arn' InstanceProfileArn string `json:"instance_profile_arn,omitempty"` // The maximum provisioned concurrency that the endpoint can scale up to. Do // not use if workload_size is specified. - // Wire name: 'max_provisioned_concurrency' MaxProvisionedConcurrency int `json:"max_provisioned_concurrency,omitempty"` // The maximum tokens per second that the endpoint can scale up to. - // Wire name: 'max_provisioned_throughput' MaxProvisionedThroughput int `json:"max_provisioned_throughput,omitempty"` // The minimum provisioned concurrency that the endpoint can scale down to. // Do not use if workload_size is specified. - // Wire name: 'min_provisioned_concurrency' MinProvisionedConcurrency int `json:"min_provisioned_concurrency,omitempty"` // The minimum tokens per second that the endpoint can scale down to. - // Wire name: 'min_provisioned_throughput' MinProvisionedThroughput int `json:"min_provisioned_throughput,omitempty"` - // Wire name: 'model_name' ModelName string `json:"model_name"` - // Wire name: 'model_version' ModelVersion string `json:"model_version"` // The name of a served entity. It must be unique across an endpoint. A // served entity name can consist of alphanumeric characters, dashes, and // underscores. If not specified for an external model, this field defaults // to external_model.name, with '.' and ':' replaced with '-', and if not // specified for other entities, it defaults to entity_name-entity_version. - // Wire name: 'name' Name string `json:"name,omitempty"` // The number of model units provisioned. - // Wire name: 'provisioned_model_units' ProvisionedModelUnits int64 `json:"provisioned_model_units,omitempty"` // Whether the compute resources for the served entity should scale down to // zero. - // Wire name: 'scale_to_zero_enabled' ScaleToZeroEnabled bool `json:"scale_to_zero_enabled"` // The workload size of the served entity. The workload size corresponds to // a range of provisioned concurrency that the compute autoscales between. A @@ -3693,7 +1957,6 @@ type ServedModelInput struct { // lower bound of the provisioned concurrency for each workload size is 0. // Do not use if min_provisioned_concurrency and max_provisioned_concurrency // are specified. - // Wire name: 'workload_size' WorkloadSize string `json:"workload_size,omitempty"` // The workload type of the served entity. The workload type selects which // type of compute to use in the endpoint. The default value for this @@ -3702,35 +1965,17 @@ type ServedModelInput struct { // available [GPU types]. // // [GPU types]: https://docs.databricks.com/en/machine-learning/model-serving/create-manage-serving-endpoints.html#gpu-workload-types - // Wire name: 'workload_type' WorkloadType ServedModelInputWorkloadType `json:"workload_type,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ServedModelInput) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &servedModelInputPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := servedModelInputFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ServedModelInput) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ServedModelInput) MarshalJSON() ([]byte, error) { - pb, err := servedModelInputToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ServedModelInput) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Please keep this in sync with with workload types in @@ -3782,11 +2027,8 @@ func (f *ServedModelInputWorkloadType) Type() string { } type ServedModelOutput struct { - - // Wire name: 'creation_timestamp' CreationTimestamp int64 `json:"creation_timestamp,omitempty"` - // Wire name: 'creator' Creator string `json:"creator,omitempty"` // An object containing a set of optional, user-specified environment // variable key-value pairs used for serving this entity. Note: this is an @@ -3794,42 +2036,32 @@ type ServedModelOutput struct { // variables that refer to Databricks secrets: `{"OPENAI_API_KEY": // "{{secrets/my_scope/my_key}}", "DATABRICKS_TOKEN": // "{{secrets/my_scope2/my_key2}}"}` - // Wire name: 'environment_vars' EnvironmentVars map[string]string `json:"environment_vars,omitempty"` // ARN of the instance profile that the served entity uses to access AWS // resources. - // Wire name: 'instance_profile_arn' InstanceProfileArn string `json:"instance_profile_arn,omitempty"` // The maximum provisioned concurrency that the endpoint can scale up to. Do // not use if workload_size is specified. - // Wire name: 'max_provisioned_concurrency' MaxProvisionedConcurrency int `json:"max_provisioned_concurrency,omitempty"` // The minimum provisioned concurrency that the endpoint can scale down to. // Do not use if workload_size is specified. - // Wire name: 'min_provisioned_concurrency' MinProvisionedConcurrency int `json:"min_provisioned_concurrency,omitempty"` - // Wire name: 'model_name' ModelName string `json:"model_name,omitempty"` - // Wire name: 'model_version' ModelVersion string `json:"model_version,omitempty"` // The name of a served entity. It must be unique across an endpoint. A // served entity name can consist of alphanumeric characters, dashes, and // underscores. If not specified for an external model, this field defaults // to external_model.name, with '.' and ':' replaced with '-', and if not // specified for other entities, it defaults to entity_name-entity_version. - // Wire name: 'name' Name string `json:"name,omitempty"` // The number of model units provisioned. - // Wire name: 'provisioned_model_units' ProvisionedModelUnits int64 `json:"provisioned_model_units,omitempty"` // Whether the compute resources for the served entity should scale down to // zero. - // Wire name: 'scale_to_zero_enabled' ScaleToZeroEnabled bool `json:"scale_to_zero_enabled,omitempty"` - // Wire name: 'state' State *ServedModelState `json:"state,omitempty"` // The workload size of the served entity. The workload size corresponds to // a range of provisioned concurrency that the compute autoscales between. A @@ -3841,7 +2073,6 @@ type ServedModelOutput struct { // lower bound of the provisioned concurrency for each workload size is 0. // Do not use if min_provisioned_concurrency and max_provisioned_concurrency // are specified. - // Wire name: 'workload_size' WorkloadSize string `json:"workload_size,omitempty"` // The workload type of the served entity. The workload type selects which // type of compute to use in the endpoint. The default value for this @@ -3850,110 +2081,52 @@ type ServedModelOutput struct { // available [GPU types]. // // [GPU types]: https://docs.databricks.com/en/machine-learning/model-serving/create-manage-serving-endpoints.html#gpu-workload-types - // Wire name: 'workload_type' WorkloadType ServingModelWorkloadType `json:"workload_type,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ServedModelOutput) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &servedModelOutputPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := servedModelOutputFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ServedModelOutput) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ServedModelOutput) MarshalJSON() ([]byte, error) { - pb, err := servedModelOutputToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ServedModelOutput) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ServedModelSpec struct { // Only one of model_name and entity_name should be populated - // Wire name: 'model_name' ModelName string `json:"model_name,omitempty"` // Only one of model_version and entity_version should be populated - // Wire name: 'model_version' ModelVersion string `json:"model_version,omitempty"` - // Wire name: 'name' Name string `json:"name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ServedModelSpec) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &servedModelSpecPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := servedModelSpecFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ServedModelSpec) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ServedModelSpec) MarshalJSON() ([]byte, error) { - pb, err := servedModelSpecToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ServedModelSpec) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ServedModelState struct { - - // Wire name: 'deployment' Deployment ServedModelStateDeployment `json:"deployment,omitempty"` - // Wire name: 'deployment_state_message' DeploymentStateMessage string `json:"deployment_state_message,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ServedModelState) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &servedModelStatePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := servedModelStateFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ServedModelState) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ServedModelState) MarshalJSON() ([]byte, error) { - pb, err := servedModelStateToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ServedModelState) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ServedModelStateDeployment string @@ -4005,274 +2178,142 @@ func (f *ServedModelStateDeployment) Type() string { type ServerLogsResponse struct { // The most recent log lines of the model server processing invocation // requests. - // Wire name: 'logs' Logs string `json:"logs"` } -func (st *ServerLogsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &serverLogsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := serverLogsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ServerLogsResponse) MarshalJSON() ([]byte, error) { - pb, err := serverLogsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type ServingEndpoint struct { // The AI Gateway configuration for the serving endpoint. NOTE: External // model, provisioned throughput, and pay-per-token endpoints are fully // supported; agent endpoints currently only support inference tables. - // Wire name: 'ai_gateway' AiGateway *AiGatewayConfig `json:"ai_gateway,omitempty"` // The budget policy associated with the endpoint. - // Wire name: 'budget_policy_id' BudgetPolicyId string `json:"budget_policy_id,omitempty"` // The config that is currently being served by the endpoint. - // Wire name: 'config' Config *EndpointCoreConfigSummary `json:"config,omitempty"` // The timestamp when the endpoint was created in Unix time. - // Wire name: 'creation_timestamp' CreationTimestamp int64 `json:"creation_timestamp,omitempty"` // The email of the user who created the serving endpoint. - // Wire name: 'creator' Creator string `json:"creator,omitempty"` // Description of the endpoint - // Wire name: 'description' Description string `json:"description,omitempty"` // System-generated ID of the endpoint, included to be used by the // Permissions API. - // Wire name: 'id' Id string `json:"id,omitempty"` // The timestamp when the endpoint was last updated by a user in Unix time. - // Wire name: 'last_updated_timestamp' LastUpdatedTimestamp int64 `json:"last_updated_timestamp,omitempty"` // The name of the serving endpoint. - // Wire name: 'name' Name string `json:"name,omitempty"` // Information corresponding to the state of the serving endpoint. - // Wire name: 'state' State *EndpointState `json:"state,omitempty"` // Tags attached to the serving endpoint. - // Wire name: 'tags' Tags []EndpointTag `json:"tags,omitempty"` // The task type of the serving endpoint. - // Wire name: 'task' Task string `json:"task,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ServingEndpoint) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &servingEndpointPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := servingEndpointFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ServingEndpoint) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ServingEndpoint) MarshalJSON() ([]byte, error) { - pb, err := servingEndpointToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ServingEndpoint) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ServingEndpointAccessControlRequest struct { // name of the group - // Wire name: 'group_name' GroupName string `json:"group_name,omitempty"` // Permission level - // Wire name: 'permission_level' PermissionLevel ServingEndpointPermissionLevel `json:"permission_level,omitempty"` // application ID of a service principal - // Wire name: 'service_principal_name' ServicePrincipalName string `json:"service_principal_name,omitempty"` // name of the user - // Wire name: 'user_name' UserName string `json:"user_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ServingEndpointAccessControlRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &servingEndpointAccessControlRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := servingEndpointAccessControlRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ServingEndpointAccessControlRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ServingEndpointAccessControlRequest) MarshalJSON() ([]byte, error) { - pb, err := servingEndpointAccessControlRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ServingEndpointAccessControlRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ServingEndpointAccessControlResponse struct { // All permissions. - // Wire name: 'all_permissions' AllPermissions []ServingEndpointPermission `json:"all_permissions,omitempty"` // Display name of the user or service principal. - // Wire name: 'display_name' DisplayName string `json:"display_name,omitempty"` // name of the group - // Wire name: 'group_name' GroupName string `json:"group_name,omitempty"` // Name of the service principal. - // Wire name: 'service_principal_name' ServicePrincipalName string `json:"service_principal_name,omitempty"` // name of the user - // Wire name: 'user_name' UserName string `json:"user_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ServingEndpointAccessControlResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &servingEndpointAccessControlResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := servingEndpointAccessControlResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ServingEndpointAccessControlResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ServingEndpointAccessControlResponse) MarshalJSON() ([]byte, error) { - pb, err := servingEndpointAccessControlResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ServingEndpointAccessControlResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ServingEndpointDetailed struct { // The AI Gateway configuration for the serving endpoint. NOTE: External // model, provisioned throughput, and pay-per-token endpoints are fully // supported; agent endpoints currently only support inference tables. - // Wire name: 'ai_gateway' AiGateway *AiGatewayConfig `json:"ai_gateway,omitempty"` // The budget policy associated with the endpoint. - // Wire name: 'budget_policy_id' BudgetPolicyId string `json:"budget_policy_id,omitempty"` // The config that is currently being served by the endpoint. - // Wire name: 'config' Config *EndpointCoreConfigOutput `json:"config,omitempty"` // The timestamp when the endpoint was created in Unix time. - // Wire name: 'creation_timestamp' CreationTimestamp int64 `json:"creation_timestamp,omitempty"` // The email of the user who created the serving endpoint. - // Wire name: 'creator' Creator string `json:"creator,omitempty"` // Information required to query DataPlane APIs. - // Wire name: 'data_plane_info' DataPlaneInfo *ModelDataPlaneInfo `json:"data_plane_info,omitempty"` // Description of the serving model - // Wire name: 'description' Description string `json:"description,omitempty"` // Endpoint invocation url if route optimization is enabled for endpoint - // Wire name: 'endpoint_url' EndpointUrl string `json:"endpoint_url,omitempty"` // System-generated ID of the endpoint. This is used to refer to the // endpoint in the Permissions API - // Wire name: 'id' Id string `json:"id,omitempty"` // The timestamp when the endpoint was last updated by a user in Unix time. - // Wire name: 'last_updated_timestamp' LastUpdatedTimestamp int64 `json:"last_updated_timestamp,omitempty"` // The name of the serving endpoint. - // Wire name: 'name' Name string `json:"name,omitempty"` // The config that the endpoint is attempting to update to. - // Wire name: 'pending_config' PendingConfig *EndpointPendingConfig `json:"pending_config,omitempty"` // The permission level of the principal making the request. - // Wire name: 'permission_level' PermissionLevel ServingEndpointDetailedPermissionLevel `json:"permission_level,omitempty"` // Boolean representing if route optimization has been enabled for the // endpoint - // Wire name: 'route_optimized' RouteOptimized bool `json:"route_optimized,omitempty"` // Information corresponding to the state of the serving endpoint. - // Wire name: 'state' State *EndpointState `json:"state,omitempty"` // Tags attached to the serving endpoint. - // Wire name: 'tags' Tags []EndpointTag `json:"tags,omitempty"` // The task type of the serving endpoint. - // Wire name: 'task' Task string `json:"task,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ServingEndpointDetailed) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &servingEndpointDetailedPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := servingEndpointDetailedFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ServingEndpointDetailed) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ServingEndpointDetailed) MarshalJSON() ([]byte, error) { - pb, err := servingEndpointDetailedToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ServingEndpointDetailed) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ServingEndpointDetailedPermissionLevel string @@ -4316,42 +2357,21 @@ func (f *ServingEndpointDetailedPermissionLevel) Type() string { } type ServingEndpointPermission struct { - - // Wire name: 'inherited' Inherited bool `json:"inherited,omitempty"` - // Wire name: 'inherited_from_object' InheritedFromObject []string `json:"inherited_from_object,omitempty"` // Permission level - // Wire name: 'permission_level' PermissionLevel ServingEndpointPermissionLevel `json:"permission_level,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ServingEndpointPermission) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &servingEndpointPermissionPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := servingEndpointPermissionFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ServingEndpointPermission) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ServingEndpointPermission) MarshalJSON() ([]byte, error) { - pb, err := servingEndpointPermissionToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ServingEndpointPermission) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Permission level @@ -4396,111 +2416,43 @@ func (f *ServingEndpointPermissionLevel) Type() string { } type ServingEndpointPermissions struct { - - // Wire name: 'access_control_list' AccessControlList []ServingEndpointAccessControlResponse `json:"access_control_list,omitempty"` - // Wire name: 'object_id' ObjectId string `json:"object_id,omitempty"` - // Wire name: 'object_type' ObjectType string `json:"object_type,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ServingEndpointPermissions) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &servingEndpointPermissionsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := servingEndpointPermissionsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ServingEndpointPermissions) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ServingEndpointPermissions) MarshalJSON() ([]byte, error) { - pb, err := servingEndpointPermissionsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ServingEndpointPermissions) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ServingEndpointPermissionsDescription struct { - - // Wire name: 'description' Description string `json:"description,omitempty"` // Permission level - // Wire name: 'permission_level' PermissionLevel ServingEndpointPermissionLevel `json:"permission_level,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ServingEndpointPermissionsDescription) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &servingEndpointPermissionsDescriptionPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := servingEndpointPermissionsDescriptionFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ServingEndpointPermissionsDescription) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ServingEndpointPermissionsDescription) MarshalJSON() ([]byte, error) { - pb, err := servingEndpointPermissionsDescriptionToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ServingEndpointPermissionsDescription) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ServingEndpointPermissionsRequest struct { - - // Wire name: 'access_control_list' AccessControlList []ServingEndpointAccessControlRequest `json:"access_control_list,omitempty"` // The serving endpoint for which to get or manage permissions. - ServingEndpointId string `json:"-" tf:"-"` -} - -func (st *ServingEndpointPermissionsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &servingEndpointPermissionsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := servingEndpointPermissionsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ServingEndpointPermissionsRequest) MarshalJSON() ([]byte, error) { - pb, err := servingEndpointPermissionsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + ServingEndpointId string `json:"-" url:"-"` } // Please keep this in sync with with workload types in @@ -4553,109 +2505,34 @@ func (f *ServingModelWorkloadType) Type() string { type TrafficConfig struct { // The list of routes that define traffic to each served entity. - // Wire name: 'routes' Routes []Route `json:"routes,omitempty"` } -func (st *TrafficConfig) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &trafficConfigPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := trafficConfigFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st TrafficConfig) MarshalJSON() ([]byte, error) { - pb, err := trafficConfigToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type UpdateProvisionedThroughputEndpointConfigRequest struct { - - // Wire name: 'config' Config PtEndpointCoreConfig `json:"config"` // The name of the pt endpoint to update. This field is required. - Name string `json:"-" tf:"-"` -} - -func (st *UpdateProvisionedThroughputEndpointConfigRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateProvisionedThroughputEndpointConfigRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateProvisionedThroughputEndpointConfigRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateProvisionedThroughputEndpointConfigRequest) MarshalJSON() ([]byte, error) { - pb, err := updateProvisionedThroughputEndpointConfigRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Name string `json:"-" url:"-"` } type V1ResponseChoiceElement struct { // The finish reason returned by the endpoint. - // Wire name: 'finishReason' FinishReason string `json:"finishReason,omitempty"` // The index of the choice in the __chat or completions__ response. - // Wire name: 'index' Index int `json:"index,omitempty"` // The logprobs returned only by the __completions__ endpoint. - // Wire name: 'logprobs' Logprobs int `json:"logprobs,omitempty"` // The message response from the __chat__ endpoint. - // Wire name: 'message' Message *ChatMessage `json:"message,omitempty"` // The text response from the __completions__ endpoint. - // Wire name: 'text' Text string `json:"text,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *V1ResponseChoiceElement) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &v1ResponseChoiceElementPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := v1ResponseChoiceElementFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *V1ResponseChoiceElement) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st V1ResponseChoiceElement) MarshalJSON() ([]byte, error) { - pb, err := v1ResponseChoiceElementToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s V1ResponseChoiceElement) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } diff --git a/service/settings/impl.go b/service/settings/impl.go index d22ad0e36..eab1eff62 100755 --- a/service/settings/impl.go +++ b/service/settings/impl.go @@ -18,95 +18,33 @@ type accountIpAccessListsImpl struct { } func (a *accountIpAccessListsImpl) Create(ctx context.Context, request CreateIpAccessList) (*CreateIpAccessListResponse, error) { - - requestPb, pbErr := createIpAccessListToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var createIpAccessListResponsePb createIpAccessListResponsePb + var createIpAccessListResponse CreateIpAccessListResponse path := fmt.Sprintf("/api/2.0/accounts/%v/ip-access-lists", a.client.ConfiguredAccountID()) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &createIpAccessListResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := createIpAccessListResponseFromPb(&createIpAccessListResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &createIpAccessListResponse) + return &createIpAccessListResponse, err } func (a *accountIpAccessListsImpl) Delete(ctx context.Context, request DeleteAccountIpAccessListRequest) error { - - requestPb, pbErr := deleteAccountIpAccessListRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteResponsePb deleteResponsePb - path := fmt.Sprintf("/api/2.0/accounts/%v/ip-access-lists/%v", a.client.ConfiguredAccountID(), requestPb.IpAccessListId) - queryParams := make(map[string]any) - headers := make(map[string]string) - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteResponsePb, - ) - if err != nil { - return err - } - + var deleteResponse DeleteResponse + path := fmt.Sprintf("/api/2.0/accounts/%v/ip-access-lists/%v", a.client.ConfiguredAccountID(), request.IpAccessListId) + queryParams := make(map[string]any) + headers := make(map[string]string) + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteResponse) return err } func (a *accountIpAccessListsImpl) Get(ctx context.Context, request GetAccountIpAccessListRequest) (*GetIpAccessListResponse, error) { - - requestPb, pbErr := getAccountIpAccessListRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var getIpAccessListResponsePb getIpAccessListResponsePb - path := fmt.Sprintf("/api/2.0/accounts/%v/ip-access-lists/%v", a.client.ConfiguredAccountID(), requestPb.IpAccessListId) + var getIpAccessListResponse GetIpAccessListResponse + path := fmt.Sprintf("/api/2.0/accounts/%v/ip-access-lists/%v", a.client.ConfiguredAccountID(), request.IpAccessListId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &getIpAccessListResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := getIpAccessListResponseFromPb(&getIpAccessListResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getIpAccessListResponse) + return &getIpAccessListResponse, err } // Gets all IP access lists for the specified account. @@ -136,85 +74,32 @@ func (a *accountIpAccessListsImpl) ListAll(ctx context.Context) ([]IpAccessListI } func (a *accountIpAccessListsImpl) internalList(ctx context.Context) (*GetIpAccessListsResponse, error) { - - var getIpAccessListsResponsePb getIpAccessListsResponsePb + var getIpAccessListsResponse GetIpAccessListsResponse path := fmt.Sprintf("/api/2.0/accounts/%v/ip-access-lists", a.client.ConfiguredAccountID()) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - nil, - nil, - &getIpAccessListsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := getIpAccessListsResponseFromPb(&getIpAccessListsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, nil, nil, &getIpAccessListsResponse) + return &getIpAccessListsResponse, err } func (a *accountIpAccessListsImpl) Replace(ctx context.Context, request ReplaceIpAccessList) error { - - requestPb, pbErr := replaceIpAccessListToPb(&request) - if pbErr != nil { - return pbErr - } - - var replaceResponsePb replaceResponsePb - path := fmt.Sprintf("/api/2.0/accounts/%v/ip-access-lists/%v", a.client.ConfiguredAccountID(), requestPb.IpAccessListId) + var replaceResponse ReplaceResponse + path := fmt.Sprintf("/api/2.0/accounts/%v/ip-access-lists/%v", a.client.ConfiguredAccountID(), request.IpAccessListId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPut, - path, - headers, - queryParams, - (*requestPb), - &replaceResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &replaceResponse) return err } func (a *accountIpAccessListsImpl) Update(ctx context.Context, request UpdateIpAccessList) error { - - requestPb, pbErr := updateIpAccessListToPb(&request) - if pbErr != nil { - return pbErr - } - - var updateResponsePb updateResponsePb - path := fmt.Sprintf("/api/2.0/accounts/%v/ip-access-lists/%v", a.client.ConfiguredAccountID(), requestPb.IpAccessListId) + var updateResponse UpdateResponse + path := fmt.Sprintf("/api/2.0/accounts/%v/ip-access-lists/%v", a.client.ConfiguredAccountID(), request.IpAccessListId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &updateResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &updateResponse) return err } @@ -229,100 +114,34 @@ type aibiDashboardEmbeddingAccessPolicyImpl struct { } func (a *aibiDashboardEmbeddingAccessPolicyImpl) Delete(ctx context.Context, request DeleteAibiDashboardEmbeddingAccessPolicySettingRequest) (*DeleteAibiDashboardEmbeddingAccessPolicySettingResponse, error) { - - requestPb, pbErr := deleteAibiDashboardEmbeddingAccessPolicySettingRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var deleteAibiDashboardEmbeddingAccessPolicySettingResponsePb deleteAibiDashboardEmbeddingAccessPolicySettingResponsePb + var deleteAibiDashboardEmbeddingAccessPolicySettingResponse DeleteAibiDashboardEmbeddingAccessPolicySettingResponse path := "/api/2.0/settings/types/aibi_dash_embed_ws_acc_policy/names/default" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteAibiDashboardEmbeddingAccessPolicySettingResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := deleteAibiDashboardEmbeddingAccessPolicySettingResponseFromPb(&deleteAibiDashboardEmbeddingAccessPolicySettingResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteAibiDashboardEmbeddingAccessPolicySettingResponse) + return &deleteAibiDashboardEmbeddingAccessPolicySettingResponse, err } func (a *aibiDashboardEmbeddingAccessPolicyImpl) Get(ctx context.Context, request GetAibiDashboardEmbeddingAccessPolicySettingRequest) (*AibiDashboardEmbeddingAccessPolicySetting, error) { - - requestPb, pbErr := getAibiDashboardEmbeddingAccessPolicySettingRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var aibiDashboardEmbeddingAccessPolicySettingPb aibiDashboardEmbeddingAccessPolicySettingPb + var aibiDashboardEmbeddingAccessPolicySetting AibiDashboardEmbeddingAccessPolicySetting path := "/api/2.0/settings/types/aibi_dash_embed_ws_acc_policy/names/default" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &aibiDashboardEmbeddingAccessPolicySettingPb, - ) - if err != nil { - return nil, err - } - resp, err := aibiDashboardEmbeddingAccessPolicySettingFromPb(&aibiDashboardEmbeddingAccessPolicySettingPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &aibiDashboardEmbeddingAccessPolicySetting) + return &aibiDashboardEmbeddingAccessPolicySetting, err } func (a *aibiDashboardEmbeddingAccessPolicyImpl) Update(ctx context.Context, request UpdateAibiDashboardEmbeddingAccessPolicySettingRequest) (*AibiDashboardEmbeddingAccessPolicySetting, error) { - - requestPb, pbErr := updateAibiDashboardEmbeddingAccessPolicySettingRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var aibiDashboardEmbeddingAccessPolicySettingPb aibiDashboardEmbeddingAccessPolicySettingPb + var aibiDashboardEmbeddingAccessPolicySetting AibiDashboardEmbeddingAccessPolicySetting path := "/api/2.0/settings/types/aibi_dash_embed_ws_acc_policy/names/default" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &aibiDashboardEmbeddingAccessPolicySettingPb, - ) - if err != nil { - return nil, err - } - resp, err := aibiDashboardEmbeddingAccessPolicySettingFromPb(&aibiDashboardEmbeddingAccessPolicySettingPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &aibiDashboardEmbeddingAccessPolicySetting) + return &aibiDashboardEmbeddingAccessPolicySetting, err } // unexported type that holds implementations of just AibiDashboardEmbeddingApprovedDomains API methods @@ -331,100 +150,34 @@ type aibiDashboardEmbeddingApprovedDomainsImpl struct { } func (a *aibiDashboardEmbeddingApprovedDomainsImpl) Delete(ctx context.Context, request DeleteAibiDashboardEmbeddingApprovedDomainsSettingRequest) (*DeleteAibiDashboardEmbeddingApprovedDomainsSettingResponse, error) { - - requestPb, pbErr := deleteAibiDashboardEmbeddingApprovedDomainsSettingRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var deleteAibiDashboardEmbeddingApprovedDomainsSettingResponsePb deleteAibiDashboardEmbeddingApprovedDomainsSettingResponsePb + var deleteAibiDashboardEmbeddingApprovedDomainsSettingResponse DeleteAibiDashboardEmbeddingApprovedDomainsSettingResponse path := "/api/2.0/settings/types/aibi_dash_embed_ws_apprvd_domains/names/default" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteAibiDashboardEmbeddingApprovedDomainsSettingResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := deleteAibiDashboardEmbeddingApprovedDomainsSettingResponseFromPb(&deleteAibiDashboardEmbeddingApprovedDomainsSettingResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteAibiDashboardEmbeddingApprovedDomainsSettingResponse) + return &deleteAibiDashboardEmbeddingApprovedDomainsSettingResponse, err } func (a *aibiDashboardEmbeddingApprovedDomainsImpl) Get(ctx context.Context, request GetAibiDashboardEmbeddingApprovedDomainsSettingRequest) (*AibiDashboardEmbeddingApprovedDomainsSetting, error) { - - requestPb, pbErr := getAibiDashboardEmbeddingApprovedDomainsSettingRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var aibiDashboardEmbeddingApprovedDomainsSettingPb aibiDashboardEmbeddingApprovedDomainsSettingPb + var aibiDashboardEmbeddingApprovedDomainsSetting AibiDashboardEmbeddingApprovedDomainsSetting path := "/api/2.0/settings/types/aibi_dash_embed_ws_apprvd_domains/names/default" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &aibiDashboardEmbeddingApprovedDomainsSettingPb, - ) - if err != nil { - return nil, err - } - resp, err := aibiDashboardEmbeddingApprovedDomainsSettingFromPb(&aibiDashboardEmbeddingApprovedDomainsSettingPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &aibiDashboardEmbeddingApprovedDomainsSetting) + return &aibiDashboardEmbeddingApprovedDomainsSetting, err } func (a *aibiDashboardEmbeddingApprovedDomainsImpl) Update(ctx context.Context, request UpdateAibiDashboardEmbeddingApprovedDomainsSettingRequest) (*AibiDashboardEmbeddingApprovedDomainsSetting, error) { - - requestPb, pbErr := updateAibiDashboardEmbeddingApprovedDomainsSettingRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var aibiDashboardEmbeddingApprovedDomainsSettingPb aibiDashboardEmbeddingApprovedDomainsSettingPb + var aibiDashboardEmbeddingApprovedDomainsSetting AibiDashboardEmbeddingApprovedDomainsSetting path := "/api/2.0/settings/types/aibi_dash_embed_ws_apprvd_domains/names/default" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &aibiDashboardEmbeddingApprovedDomainsSettingPb, - ) - if err != nil { - return nil, err - } - resp, err := aibiDashboardEmbeddingApprovedDomainsSettingFromPb(&aibiDashboardEmbeddingApprovedDomainsSettingPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &aibiDashboardEmbeddingApprovedDomainsSetting) + return &aibiDashboardEmbeddingApprovedDomainsSetting, err } // unexported type that holds implementations of just AutomaticClusterUpdate API methods @@ -433,68 +186,24 @@ type automaticClusterUpdateImpl struct { } func (a *automaticClusterUpdateImpl) Get(ctx context.Context, request GetAutomaticClusterUpdateSettingRequest) (*AutomaticClusterUpdateSetting, error) { - - requestPb, pbErr := getAutomaticClusterUpdateSettingRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var automaticClusterUpdateSettingPb automaticClusterUpdateSettingPb + var automaticClusterUpdateSetting AutomaticClusterUpdateSetting path := "/api/2.0/settings/types/automatic_cluster_update/names/default" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &automaticClusterUpdateSettingPb, - ) - if err != nil { - return nil, err - } - resp, err := automaticClusterUpdateSettingFromPb(&automaticClusterUpdateSettingPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &automaticClusterUpdateSetting) + return &automaticClusterUpdateSetting, err } func (a *automaticClusterUpdateImpl) Update(ctx context.Context, request UpdateAutomaticClusterUpdateSettingRequest) (*AutomaticClusterUpdateSetting, error) { - - requestPb, pbErr := updateAutomaticClusterUpdateSettingRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var automaticClusterUpdateSettingPb automaticClusterUpdateSettingPb + var automaticClusterUpdateSetting AutomaticClusterUpdateSetting path := "/api/2.0/settings/types/automatic_cluster_update/names/default" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &automaticClusterUpdateSettingPb, - ) - if err != nil { - return nil, err - } - resp, err := automaticClusterUpdateSettingFromPb(&automaticClusterUpdateSettingPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &automaticClusterUpdateSetting) + return &automaticClusterUpdateSetting, err } // unexported type that holds implementations of just ComplianceSecurityProfile API methods @@ -503,68 +212,24 @@ type complianceSecurityProfileImpl struct { } func (a *complianceSecurityProfileImpl) Get(ctx context.Context, request GetComplianceSecurityProfileSettingRequest) (*ComplianceSecurityProfileSetting, error) { - - requestPb, pbErr := getComplianceSecurityProfileSettingRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var complianceSecurityProfileSettingPb complianceSecurityProfileSettingPb + var complianceSecurityProfileSetting ComplianceSecurityProfileSetting path := "/api/2.0/settings/types/shield_csp_enablement_ws_db/names/default" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &complianceSecurityProfileSettingPb, - ) - if err != nil { - return nil, err - } - resp, err := complianceSecurityProfileSettingFromPb(&complianceSecurityProfileSettingPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &complianceSecurityProfileSetting) + return &complianceSecurityProfileSetting, err } func (a *complianceSecurityProfileImpl) Update(ctx context.Context, request UpdateComplianceSecurityProfileSettingRequest) (*ComplianceSecurityProfileSetting, error) { - - requestPb, pbErr := updateComplianceSecurityProfileSettingRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var complianceSecurityProfileSettingPb complianceSecurityProfileSettingPb + var complianceSecurityProfileSetting ComplianceSecurityProfileSetting path := "/api/2.0/settings/types/shield_csp_enablement_ws_db/names/default" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &complianceSecurityProfileSettingPb, - ) - if err != nil { - return nil, err - } - resp, err := complianceSecurityProfileSettingFromPb(&complianceSecurityProfileSettingPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &complianceSecurityProfileSetting) + return &complianceSecurityProfileSetting, err } // unexported type that holds implementations of just CredentialsManager API methods @@ -573,36 +238,14 @@ type credentialsManagerImpl struct { } func (a *credentialsManagerImpl) ExchangeToken(ctx context.Context, request ExchangeTokenRequest) (*ExchangeTokenResponse, error) { - - requestPb, pbErr := exchangeTokenRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var exchangeTokenResponsePb exchangeTokenResponsePb + var exchangeTokenResponse ExchangeTokenResponse path := "/api/2.0/credentials-manager/exchange-tokens/token" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &exchangeTokenResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := exchangeTokenResponseFromPb(&exchangeTokenResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &exchangeTokenResponse) + return &exchangeTokenResponse, err } // unexported type that holds implementations of just CspEnablementAccount API methods @@ -611,68 +254,24 @@ type cspEnablementAccountImpl struct { } func (a *cspEnablementAccountImpl) Get(ctx context.Context, request GetCspEnablementAccountSettingRequest) (*CspEnablementAccountSetting, error) { - - requestPb, pbErr := getCspEnablementAccountSettingRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var cspEnablementAccountSettingPb cspEnablementAccountSettingPb + var cspEnablementAccountSetting CspEnablementAccountSetting path := fmt.Sprintf("/api/2.0/accounts/%v/settings/types/shield_csp_enablement_ac/names/default", a.client.ConfiguredAccountID()) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &cspEnablementAccountSettingPb, - ) - if err != nil { - return nil, err - } - resp, err := cspEnablementAccountSettingFromPb(&cspEnablementAccountSettingPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &cspEnablementAccountSetting) + return &cspEnablementAccountSetting, err } func (a *cspEnablementAccountImpl) Update(ctx context.Context, request UpdateCspEnablementAccountSettingRequest) (*CspEnablementAccountSetting, error) { - - requestPb, pbErr := updateCspEnablementAccountSettingRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var cspEnablementAccountSettingPb cspEnablementAccountSettingPb + var cspEnablementAccountSetting CspEnablementAccountSetting path := fmt.Sprintf("/api/2.0/accounts/%v/settings/types/shield_csp_enablement_ac/names/default", a.client.ConfiguredAccountID()) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &cspEnablementAccountSettingPb, - ) - if err != nil { - return nil, err - } - resp, err := cspEnablementAccountSettingFromPb(&cspEnablementAccountSettingPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &cspEnablementAccountSetting) + return &cspEnablementAccountSetting, err } // unexported type that holds implementations of just DashboardEmailSubscriptions API methods @@ -681,100 +280,34 @@ type dashboardEmailSubscriptionsImpl struct { } func (a *dashboardEmailSubscriptionsImpl) Delete(ctx context.Context, request DeleteDashboardEmailSubscriptionsRequest) (*DeleteDashboardEmailSubscriptionsResponse, error) { - - requestPb, pbErr := deleteDashboardEmailSubscriptionsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var deleteDashboardEmailSubscriptionsResponsePb deleteDashboardEmailSubscriptionsResponsePb + var deleteDashboardEmailSubscriptionsResponse DeleteDashboardEmailSubscriptionsResponse path := "/api/2.0/settings/types/dashboard_email_subscriptions/names/default" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteDashboardEmailSubscriptionsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := deleteDashboardEmailSubscriptionsResponseFromPb(&deleteDashboardEmailSubscriptionsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteDashboardEmailSubscriptionsResponse) + return &deleteDashboardEmailSubscriptionsResponse, err } func (a *dashboardEmailSubscriptionsImpl) Get(ctx context.Context, request GetDashboardEmailSubscriptionsRequest) (*DashboardEmailSubscriptions, error) { - - requestPb, pbErr := getDashboardEmailSubscriptionsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var dashboardEmailSubscriptionsPb dashboardEmailSubscriptionsPb + var dashboardEmailSubscriptions DashboardEmailSubscriptions path := "/api/2.0/settings/types/dashboard_email_subscriptions/names/default" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &dashboardEmailSubscriptionsPb, - ) - if err != nil { - return nil, err - } - resp, err := dashboardEmailSubscriptionsFromPb(&dashboardEmailSubscriptionsPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &dashboardEmailSubscriptions) + return &dashboardEmailSubscriptions, err } func (a *dashboardEmailSubscriptionsImpl) Update(ctx context.Context, request UpdateDashboardEmailSubscriptionsRequest) (*DashboardEmailSubscriptions, error) { - - requestPb, pbErr := updateDashboardEmailSubscriptionsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var dashboardEmailSubscriptionsPb dashboardEmailSubscriptionsPb + var dashboardEmailSubscriptions DashboardEmailSubscriptions path := "/api/2.0/settings/types/dashboard_email_subscriptions/names/default" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &dashboardEmailSubscriptionsPb, - ) - if err != nil { - return nil, err - } - resp, err := dashboardEmailSubscriptionsFromPb(&dashboardEmailSubscriptionsPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &dashboardEmailSubscriptions) + return &dashboardEmailSubscriptions, err } // unexported type that holds implementations of just DefaultNamespace API methods @@ -783,100 +316,34 @@ type defaultNamespaceImpl struct { } func (a *defaultNamespaceImpl) Delete(ctx context.Context, request DeleteDefaultNamespaceSettingRequest) (*DeleteDefaultNamespaceSettingResponse, error) { - - requestPb, pbErr := deleteDefaultNamespaceSettingRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var deleteDefaultNamespaceSettingResponsePb deleteDefaultNamespaceSettingResponsePb + var deleteDefaultNamespaceSettingResponse DeleteDefaultNamespaceSettingResponse path := "/api/2.0/settings/types/default_namespace_ws/names/default" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteDefaultNamespaceSettingResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := deleteDefaultNamespaceSettingResponseFromPb(&deleteDefaultNamespaceSettingResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteDefaultNamespaceSettingResponse) + return &deleteDefaultNamespaceSettingResponse, err } func (a *defaultNamespaceImpl) Get(ctx context.Context, request GetDefaultNamespaceSettingRequest) (*DefaultNamespaceSetting, error) { - - requestPb, pbErr := getDefaultNamespaceSettingRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var defaultNamespaceSettingPb defaultNamespaceSettingPb + var defaultNamespaceSetting DefaultNamespaceSetting path := "/api/2.0/settings/types/default_namespace_ws/names/default" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &defaultNamespaceSettingPb, - ) - if err != nil { - return nil, err - } - resp, err := defaultNamespaceSettingFromPb(&defaultNamespaceSettingPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &defaultNamespaceSetting) + return &defaultNamespaceSetting, err } func (a *defaultNamespaceImpl) Update(ctx context.Context, request UpdateDefaultNamespaceSettingRequest) (*DefaultNamespaceSetting, error) { - - requestPb, pbErr := updateDefaultNamespaceSettingRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var defaultNamespaceSettingPb defaultNamespaceSettingPb + var defaultNamespaceSetting DefaultNamespaceSetting path := "/api/2.0/settings/types/default_namespace_ws/names/default" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &defaultNamespaceSettingPb, - ) - if err != nil { - return nil, err - } - resp, err := defaultNamespaceSettingFromPb(&defaultNamespaceSettingPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &defaultNamespaceSetting) + return &defaultNamespaceSetting, err } // unexported type that holds implementations of just DisableLegacyAccess API methods @@ -885,100 +352,34 @@ type disableLegacyAccessImpl struct { } func (a *disableLegacyAccessImpl) Delete(ctx context.Context, request DeleteDisableLegacyAccessRequest) (*DeleteDisableLegacyAccessResponse, error) { - - requestPb, pbErr := deleteDisableLegacyAccessRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var deleteDisableLegacyAccessResponsePb deleteDisableLegacyAccessResponsePb + var deleteDisableLegacyAccessResponse DeleteDisableLegacyAccessResponse path := "/api/2.0/settings/types/disable_legacy_access/names/default" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteDisableLegacyAccessResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := deleteDisableLegacyAccessResponseFromPb(&deleteDisableLegacyAccessResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteDisableLegacyAccessResponse) + return &deleteDisableLegacyAccessResponse, err } func (a *disableLegacyAccessImpl) Get(ctx context.Context, request GetDisableLegacyAccessRequest) (*DisableLegacyAccess, error) { - - requestPb, pbErr := getDisableLegacyAccessRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var disableLegacyAccessPb disableLegacyAccessPb + var disableLegacyAccess DisableLegacyAccess path := "/api/2.0/settings/types/disable_legacy_access/names/default" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &disableLegacyAccessPb, - ) - if err != nil { - return nil, err - } - resp, err := disableLegacyAccessFromPb(&disableLegacyAccessPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &disableLegacyAccess) + return &disableLegacyAccess, err } func (a *disableLegacyAccessImpl) Update(ctx context.Context, request UpdateDisableLegacyAccessRequest) (*DisableLegacyAccess, error) { - - requestPb, pbErr := updateDisableLegacyAccessRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var disableLegacyAccessPb disableLegacyAccessPb + var disableLegacyAccess DisableLegacyAccess path := "/api/2.0/settings/types/disable_legacy_access/names/default" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &disableLegacyAccessPb, - ) - if err != nil { - return nil, err - } - resp, err := disableLegacyAccessFromPb(&disableLegacyAccessPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &disableLegacyAccess) + return &disableLegacyAccess, err } // unexported type that holds implementations of just DisableLegacyDbfs API methods @@ -987,100 +388,34 @@ type disableLegacyDbfsImpl struct { } func (a *disableLegacyDbfsImpl) Delete(ctx context.Context, request DeleteDisableLegacyDbfsRequest) (*DeleteDisableLegacyDbfsResponse, error) { - - requestPb, pbErr := deleteDisableLegacyDbfsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var deleteDisableLegacyDbfsResponsePb deleteDisableLegacyDbfsResponsePb + var deleteDisableLegacyDbfsResponse DeleteDisableLegacyDbfsResponse path := "/api/2.0/settings/types/disable_legacy_dbfs/names/default" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteDisableLegacyDbfsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := deleteDisableLegacyDbfsResponseFromPb(&deleteDisableLegacyDbfsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteDisableLegacyDbfsResponse) + return &deleteDisableLegacyDbfsResponse, err } func (a *disableLegacyDbfsImpl) Get(ctx context.Context, request GetDisableLegacyDbfsRequest) (*DisableLegacyDbfs, error) { - - requestPb, pbErr := getDisableLegacyDbfsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var disableLegacyDbfsPb disableLegacyDbfsPb + var disableLegacyDbfs DisableLegacyDbfs path := "/api/2.0/settings/types/disable_legacy_dbfs/names/default" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &disableLegacyDbfsPb, - ) - if err != nil { - return nil, err - } - resp, err := disableLegacyDbfsFromPb(&disableLegacyDbfsPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &disableLegacyDbfs) + return &disableLegacyDbfs, err } func (a *disableLegacyDbfsImpl) Update(ctx context.Context, request UpdateDisableLegacyDbfsRequest) (*DisableLegacyDbfs, error) { - - requestPb, pbErr := updateDisableLegacyDbfsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var disableLegacyDbfsPb disableLegacyDbfsPb + var disableLegacyDbfs DisableLegacyDbfs path := "/api/2.0/settings/types/disable_legacy_dbfs/names/default" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &disableLegacyDbfsPb, - ) - if err != nil { - return nil, err - } - resp, err := disableLegacyDbfsFromPb(&disableLegacyDbfsPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &disableLegacyDbfs) + return &disableLegacyDbfs, err } // unexported type that holds implementations of just DisableLegacyFeatures API methods @@ -1089,100 +424,34 @@ type disableLegacyFeaturesImpl struct { } func (a *disableLegacyFeaturesImpl) Delete(ctx context.Context, request DeleteDisableLegacyFeaturesRequest) (*DeleteDisableLegacyFeaturesResponse, error) { - - requestPb, pbErr := deleteDisableLegacyFeaturesRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var deleteDisableLegacyFeaturesResponsePb deleteDisableLegacyFeaturesResponsePb + var deleteDisableLegacyFeaturesResponse DeleteDisableLegacyFeaturesResponse path := fmt.Sprintf("/api/2.0/accounts/%v/settings/types/disable_legacy_features/names/default", a.client.ConfiguredAccountID()) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteDisableLegacyFeaturesResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := deleteDisableLegacyFeaturesResponseFromPb(&deleteDisableLegacyFeaturesResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteDisableLegacyFeaturesResponse) + return &deleteDisableLegacyFeaturesResponse, err } func (a *disableLegacyFeaturesImpl) Get(ctx context.Context, request GetDisableLegacyFeaturesRequest) (*DisableLegacyFeatures, error) { - - requestPb, pbErr := getDisableLegacyFeaturesRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var disableLegacyFeaturesPb disableLegacyFeaturesPb + var disableLegacyFeatures DisableLegacyFeatures path := fmt.Sprintf("/api/2.0/accounts/%v/settings/types/disable_legacy_features/names/default", a.client.ConfiguredAccountID()) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &disableLegacyFeaturesPb, - ) - if err != nil { - return nil, err - } - resp, err := disableLegacyFeaturesFromPb(&disableLegacyFeaturesPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &disableLegacyFeatures) + return &disableLegacyFeatures, err } func (a *disableLegacyFeaturesImpl) Update(ctx context.Context, request UpdateDisableLegacyFeaturesRequest) (*DisableLegacyFeatures, error) { - - requestPb, pbErr := updateDisableLegacyFeaturesRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var disableLegacyFeaturesPb disableLegacyFeaturesPb + var disableLegacyFeatures DisableLegacyFeatures path := fmt.Sprintf("/api/2.0/accounts/%v/settings/types/disable_legacy_features/names/default", a.client.ConfiguredAccountID()) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &disableLegacyFeaturesPb, - ) - if err != nil { - return nil, err - } - resp, err := disableLegacyFeaturesFromPb(&disableLegacyFeaturesPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &disableLegacyFeatures) + return &disableLegacyFeatures, err } // unexported type that holds implementations of just EnableExportNotebook API methods @@ -1191,63 +460,24 @@ type enableExportNotebookImpl struct { } func (a *enableExportNotebookImpl) GetEnableExportNotebook(ctx context.Context) (*EnableExportNotebook, error) { - - var enableExportNotebookPb enableExportNotebookPb + var enableExportNotebook EnableExportNotebook path := "/api/2.0/settings/types/enable-export-notebook/names/default" headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - nil, - nil, - &enableExportNotebookPb, - ) - if err != nil { - return nil, err - } - resp, err := enableExportNotebookFromPb(&enableExportNotebookPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, nil, nil, &enableExportNotebook) + return &enableExportNotebook, err } func (a *enableExportNotebookImpl) PatchEnableExportNotebook(ctx context.Context, request UpdateEnableExportNotebookRequest) (*EnableExportNotebook, error) { - - requestPb, pbErr := updateEnableExportNotebookRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var enableExportNotebookPb enableExportNotebookPb + var enableExportNotebook EnableExportNotebook path := "/api/2.0/settings/types/enable-export-notebook/names/default" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &enableExportNotebookPb, - ) - if err != nil { - return nil, err - } - resp, err := enableExportNotebookFromPb(&enableExportNotebookPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &enableExportNotebook) + return &enableExportNotebook, err } // unexported type that holds implementations of just EnableIpAccessLists API methods @@ -1256,100 +486,34 @@ type enableIpAccessListsImpl struct { } func (a *enableIpAccessListsImpl) Delete(ctx context.Context, request DeleteAccountIpAccessEnableRequest) (*DeleteAccountIpAccessEnableResponse, error) { - - requestPb, pbErr := deleteAccountIpAccessEnableRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var deleteAccountIpAccessEnableResponsePb deleteAccountIpAccessEnableResponsePb + var deleteAccountIpAccessEnableResponse DeleteAccountIpAccessEnableResponse path := fmt.Sprintf("/api/2.0/accounts/%v/settings/types/acct_ip_acl_enable/names/default", a.client.ConfiguredAccountID()) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteAccountIpAccessEnableResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := deleteAccountIpAccessEnableResponseFromPb(&deleteAccountIpAccessEnableResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteAccountIpAccessEnableResponse) + return &deleteAccountIpAccessEnableResponse, err } func (a *enableIpAccessListsImpl) Get(ctx context.Context, request GetAccountIpAccessEnableRequest) (*AccountIpAccessEnable, error) { - - requestPb, pbErr := getAccountIpAccessEnableRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var accountIpAccessEnablePb accountIpAccessEnablePb + var accountIpAccessEnable AccountIpAccessEnable path := fmt.Sprintf("/api/2.0/accounts/%v/settings/types/acct_ip_acl_enable/names/default", a.client.ConfiguredAccountID()) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &accountIpAccessEnablePb, - ) - if err != nil { - return nil, err - } - resp, err := accountIpAccessEnableFromPb(&accountIpAccessEnablePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &accountIpAccessEnable) + return &accountIpAccessEnable, err } func (a *enableIpAccessListsImpl) Update(ctx context.Context, request UpdateAccountIpAccessEnableRequest) (*AccountIpAccessEnable, error) { - - requestPb, pbErr := updateAccountIpAccessEnableRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var accountIpAccessEnablePb accountIpAccessEnablePb + var accountIpAccessEnable AccountIpAccessEnable path := fmt.Sprintf("/api/2.0/accounts/%v/settings/types/acct_ip_acl_enable/names/default", a.client.ConfiguredAccountID()) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &accountIpAccessEnablePb, - ) - if err != nil { - return nil, err - } - resp, err := accountIpAccessEnableFromPb(&accountIpAccessEnablePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &accountIpAccessEnable) + return &accountIpAccessEnable, err } // unexported type that holds implementations of just EnableNotebookTableClipboard API methods @@ -1358,63 +522,24 @@ type enableNotebookTableClipboardImpl struct { } func (a *enableNotebookTableClipboardImpl) GetEnableNotebookTableClipboard(ctx context.Context) (*EnableNotebookTableClipboard, error) { - - var enableNotebookTableClipboardPb enableNotebookTableClipboardPb + var enableNotebookTableClipboard EnableNotebookTableClipboard path := "/api/2.0/settings/types/enable-notebook-table-clipboard/names/default" headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - nil, - nil, - &enableNotebookTableClipboardPb, - ) - if err != nil { - return nil, err - } - resp, err := enableNotebookTableClipboardFromPb(&enableNotebookTableClipboardPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, nil, nil, &enableNotebookTableClipboard) + return &enableNotebookTableClipboard, err } func (a *enableNotebookTableClipboardImpl) PatchEnableNotebookTableClipboard(ctx context.Context, request UpdateEnableNotebookTableClipboardRequest) (*EnableNotebookTableClipboard, error) { - - requestPb, pbErr := updateEnableNotebookTableClipboardRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var enableNotebookTableClipboardPb enableNotebookTableClipboardPb + var enableNotebookTableClipboard EnableNotebookTableClipboard path := "/api/2.0/settings/types/enable-notebook-table-clipboard/names/default" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &enableNotebookTableClipboardPb, - ) - if err != nil { - return nil, err - } - resp, err := enableNotebookTableClipboardFromPb(&enableNotebookTableClipboardPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &enableNotebookTableClipboard) + return &enableNotebookTableClipboard, err } // unexported type that holds implementations of just EnableResultsDownloading API methods @@ -1423,63 +548,24 @@ type enableResultsDownloadingImpl struct { } func (a *enableResultsDownloadingImpl) GetEnableResultsDownloading(ctx context.Context) (*EnableResultsDownloading, error) { - - var enableResultsDownloadingPb enableResultsDownloadingPb + var enableResultsDownloading EnableResultsDownloading path := "/api/2.0/settings/types/enable-results-downloading/names/default" headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - nil, - nil, - &enableResultsDownloadingPb, - ) - if err != nil { - return nil, err - } - resp, err := enableResultsDownloadingFromPb(&enableResultsDownloadingPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, nil, nil, &enableResultsDownloading) + return &enableResultsDownloading, err } func (a *enableResultsDownloadingImpl) PatchEnableResultsDownloading(ctx context.Context, request UpdateEnableResultsDownloadingRequest) (*EnableResultsDownloading, error) { - - requestPb, pbErr := updateEnableResultsDownloadingRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var enableResultsDownloadingPb enableResultsDownloadingPb + var enableResultsDownloading EnableResultsDownloading path := "/api/2.0/settings/types/enable-results-downloading/names/default" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &enableResultsDownloadingPb, - ) - if err != nil { - return nil, err - } - resp, err := enableResultsDownloadingFromPb(&enableResultsDownloadingPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &enableResultsDownloading) + return &enableResultsDownloading, err } // unexported type that holds implementations of just EnhancedSecurityMonitoring API methods @@ -1488,68 +574,24 @@ type enhancedSecurityMonitoringImpl struct { } func (a *enhancedSecurityMonitoringImpl) Get(ctx context.Context, request GetEnhancedSecurityMonitoringSettingRequest) (*EnhancedSecurityMonitoringSetting, error) { - - requestPb, pbErr := getEnhancedSecurityMonitoringSettingRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var enhancedSecurityMonitoringSettingPb enhancedSecurityMonitoringSettingPb + var enhancedSecurityMonitoringSetting EnhancedSecurityMonitoringSetting path := "/api/2.0/settings/types/shield_esm_enablement_ws_db/names/default" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &enhancedSecurityMonitoringSettingPb, - ) - if err != nil { - return nil, err - } - resp, err := enhancedSecurityMonitoringSettingFromPb(&enhancedSecurityMonitoringSettingPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &enhancedSecurityMonitoringSetting) + return &enhancedSecurityMonitoringSetting, err } func (a *enhancedSecurityMonitoringImpl) Update(ctx context.Context, request UpdateEnhancedSecurityMonitoringSettingRequest) (*EnhancedSecurityMonitoringSetting, error) { - - requestPb, pbErr := updateEnhancedSecurityMonitoringSettingRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var enhancedSecurityMonitoringSettingPb enhancedSecurityMonitoringSettingPb + var enhancedSecurityMonitoringSetting EnhancedSecurityMonitoringSetting path := "/api/2.0/settings/types/shield_esm_enablement_ws_db/names/default" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &enhancedSecurityMonitoringSettingPb, - ) - if err != nil { - return nil, err - } - resp, err := enhancedSecurityMonitoringSettingFromPb(&enhancedSecurityMonitoringSettingPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &enhancedSecurityMonitoringSetting) + return &enhancedSecurityMonitoringSetting, err } // unexported type that holds implementations of just EsmEnablementAccount API methods @@ -1558,68 +600,24 @@ type esmEnablementAccountImpl struct { } func (a *esmEnablementAccountImpl) Get(ctx context.Context, request GetEsmEnablementAccountSettingRequest) (*EsmEnablementAccountSetting, error) { - - requestPb, pbErr := getEsmEnablementAccountSettingRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var esmEnablementAccountSettingPb esmEnablementAccountSettingPb + var esmEnablementAccountSetting EsmEnablementAccountSetting path := fmt.Sprintf("/api/2.0/accounts/%v/settings/types/shield_esm_enablement_ac/names/default", a.client.ConfiguredAccountID()) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &esmEnablementAccountSettingPb, - ) - if err != nil { - return nil, err - } - resp, err := esmEnablementAccountSettingFromPb(&esmEnablementAccountSettingPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &esmEnablementAccountSetting) + return &esmEnablementAccountSetting, err } func (a *esmEnablementAccountImpl) Update(ctx context.Context, request UpdateEsmEnablementAccountSettingRequest) (*EsmEnablementAccountSetting, error) { - - requestPb, pbErr := updateEsmEnablementAccountSettingRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var esmEnablementAccountSettingPb esmEnablementAccountSettingPb + var esmEnablementAccountSetting EsmEnablementAccountSetting path := fmt.Sprintf("/api/2.0/accounts/%v/settings/types/shield_esm_enablement_ac/names/default", a.client.ConfiguredAccountID()) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &esmEnablementAccountSettingPb, - ) - if err != nil { - return nil, err - } - resp, err := esmEnablementAccountSettingFromPb(&esmEnablementAccountSettingPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &esmEnablementAccountSetting) + return &esmEnablementAccountSetting, err } // unexported type that holds implementations of just IpAccessLists API methods @@ -1628,95 +626,33 @@ type ipAccessListsImpl struct { } func (a *ipAccessListsImpl) Create(ctx context.Context, request CreateIpAccessList) (*CreateIpAccessListResponse, error) { - - requestPb, pbErr := createIpAccessListToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var createIpAccessListResponsePb createIpAccessListResponsePb + var createIpAccessListResponse CreateIpAccessListResponse path := "/api/2.0/ip-access-lists" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &createIpAccessListResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := createIpAccessListResponseFromPb(&createIpAccessListResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &createIpAccessListResponse) + return &createIpAccessListResponse, err } func (a *ipAccessListsImpl) Delete(ctx context.Context, request DeleteIpAccessListRequest) error { - - requestPb, pbErr := deleteIpAccessListRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteResponsePb deleteResponsePb - path := fmt.Sprintf("/api/2.0/ip-access-lists/%v", requestPb.IpAccessListId) - queryParams := make(map[string]any) - headers := make(map[string]string) - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteResponsePb, - ) - if err != nil { - return err - } - + var deleteResponse DeleteResponse + path := fmt.Sprintf("/api/2.0/ip-access-lists/%v", request.IpAccessListId) + queryParams := make(map[string]any) + headers := make(map[string]string) + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteResponse) return err } func (a *ipAccessListsImpl) Get(ctx context.Context, request GetIpAccessListRequest) (*FetchIpAccessListResponse, error) { - - requestPb, pbErr := getIpAccessListRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var fetchIpAccessListResponsePb fetchIpAccessListResponsePb - path := fmt.Sprintf("/api/2.0/ip-access-lists/%v", requestPb.IpAccessListId) + var fetchIpAccessListResponse FetchIpAccessListResponse + path := fmt.Sprintf("/api/2.0/ip-access-lists/%v", request.IpAccessListId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &fetchIpAccessListResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := fetchIpAccessListResponseFromPb(&fetchIpAccessListResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &fetchIpAccessListResponse) + return &fetchIpAccessListResponse, err } // Gets all IP access lists for the specified workspace. @@ -1746,85 +682,32 @@ func (a *ipAccessListsImpl) ListAll(ctx context.Context) ([]IpAccessListInfo, er } func (a *ipAccessListsImpl) internalList(ctx context.Context) (*ListIpAccessListResponse, error) { - - var listIpAccessListResponsePb listIpAccessListResponsePb + var listIpAccessListResponse ListIpAccessListResponse path := "/api/2.0/ip-access-lists" headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - nil, - nil, - &listIpAccessListResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listIpAccessListResponseFromPb(&listIpAccessListResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, nil, nil, &listIpAccessListResponse) + return &listIpAccessListResponse, err } func (a *ipAccessListsImpl) Replace(ctx context.Context, request ReplaceIpAccessList) error { - - requestPb, pbErr := replaceIpAccessListToPb(&request) - if pbErr != nil { - return pbErr - } - - var replaceResponsePb replaceResponsePb - path := fmt.Sprintf("/api/2.0/ip-access-lists/%v", requestPb.IpAccessListId) + var replaceResponse ReplaceResponse + path := fmt.Sprintf("/api/2.0/ip-access-lists/%v", request.IpAccessListId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPut, - path, - headers, - queryParams, - (*requestPb), - &replaceResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &replaceResponse) return err } func (a *ipAccessListsImpl) Update(ctx context.Context, request UpdateIpAccessList) error { - - requestPb, pbErr := updateIpAccessListToPb(&request) - if pbErr != nil { - return pbErr - } - - var updateResponsePb updateResponsePb - path := fmt.Sprintf("/api/2.0/ip-access-lists/%v", requestPb.IpAccessListId) + var updateResponse UpdateResponse + path := fmt.Sprintf("/api/2.0/ip-access-lists/%v", request.IpAccessListId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &updateResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &updateResponse) return err } @@ -1834,68 +717,24 @@ type llmProxyPartnerPoweredAccountImpl struct { } func (a *llmProxyPartnerPoweredAccountImpl) Get(ctx context.Context, request GetLlmProxyPartnerPoweredAccountRequest) (*LlmProxyPartnerPoweredAccount, error) { - - requestPb, pbErr := getLlmProxyPartnerPoweredAccountRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var llmProxyPartnerPoweredAccountPb llmProxyPartnerPoweredAccountPb + var llmProxyPartnerPoweredAccount LlmProxyPartnerPoweredAccount path := fmt.Sprintf("/api/2.0/accounts/%v/settings/types/llm_proxy_partner_powered/names/default", a.client.ConfiguredAccountID()) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &llmProxyPartnerPoweredAccountPb, - ) - if err != nil { - return nil, err - } - resp, err := llmProxyPartnerPoweredAccountFromPb(&llmProxyPartnerPoweredAccountPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &llmProxyPartnerPoweredAccount) + return &llmProxyPartnerPoweredAccount, err } func (a *llmProxyPartnerPoweredAccountImpl) Update(ctx context.Context, request UpdateLlmProxyPartnerPoweredAccountRequest) (*LlmProxyPartnerPoweredAccount, error) { - - requestPb, pbErr := updateLlmProxyPartnerPoweredAccountRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var llmProxyPartnerPoweredAccountPb llmProxyPartnerPoweredAccountPb + var llmProxyPartnerPoweredAccount LlmProxyPartnerPoweredAccount path := fmt.Sprintf("/api/2.0/accounts/%v/settings/types/llm_proxy_partner_powered/names/default", a.client.ConfiguredAccountID()) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &llmProxyPartnerPoweredAccountPb, - ) - if err != nil { - return nil, err - } - resp, err := llmProxyPartnerPoweredAccountFromPb(&llmProxyPartnerPoweredAccountPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &llmProxyPartnerPoweredAccount) + return &llmProxyPartnerPoweredAccount, err } // unexported type that holds implementations of just LlmProxyPartnerPoweredEnforce API methods @@ -1904,68 +743,24 @@ type llmProxyPartnerPoweredEnforceImpl struct { } func (a *llmProxyPartnerPoweredEnforceImpl) Get(ctx context.Context, request GetLlmProxyPartnerPoweredEnforceRequest) (*LlmProxyPartnerPoweredEnforce, error) { - - requestPb, pbErr := getLlmProxyPartnerPoweredEnforceRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var llmProxyPartnerPoweredEnforcePb llmProxyPartnerPoweredEnforcePb + var llmProxyPartnerPoweredEnforce LlmProxyPartnerPoweredEnforce path := fmt.Sprintf("/api/2.0/accounts/%v/settings/types/llm_proxy_partner_powered_enforce/names/default", a.client.ConfiguredAccountID()) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &llmProxyPartnerPoweredEnforcePb, - ) - if err != nil { - return nil, err - } - resp, err := llmProxyPartnerPoweredEnforceFromPb(&llmProxyPartnerPoweredEnforcePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &llmProxyPartnerPoweredEnforce) + return &llmProxyPartnerPoweredEnforce, err } func (a *llmProxyPartnerPoweredEnforceImpl) Update(ctx context.Context, request UpdateLlmProxyPartnerPoweredEnforceRequest) (*LlmProxyPartnerPoweredEnforce, error) { - - requestPb, pbErr := updateLlmProxyPartnerPoweredEnforceRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var llmProxyPartnerPoweredEnforcePb llmProxyPartnerPoweredEnforcePb + var llmProxyPartnerPoweredEnforce LlmProxyPartnerPoweredEnforce path := fmt.Sprintf("/api/2.0/accounts/%v/settings/types/llm_proxy_partner_powered_enforce/names/default", a.client.ConfiguredAccountID()) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &llmProxyPartnerPoweredEnforcePb, - ) - if err != nil { - return nil, err - } - resp, err := llmProxyPartnerPoweredEnforceFromPb(&llmProxyPartnerPoweredEnforcePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &llmProxyPartnerPoweredEnforce) + return &llmProxyPartnerPoweredEnforce, err } // unexported type that holds implementations of just LlmProxyPartnerPoweredWorkspace API methods @@ -1974,100 +769,34 @@ type llmProxyPartnerPoweredWorkspaceImpl struct { } func (a *llmProxyPartnerPoweredWorkspaceImpl) Delete(ctx context.Context, request DeleteLlmProxyPartnerPoweredWorkspaceRequest) (*DeleteLlmProxyPartnerPoweredWorkspaceResponse, error) { - - requestPb, pbErr := deleteLlmProxyPartnerPoweredWorkspaceRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var deleteLlmProxyPartnerPoweredWorkspaceResponsePb deleteLlmProxyPartnerPoweredWorkspaceResponsePb + var deleteLlmProxyPartnerPoweredWorkspaceResponse DeleteLlmProxyPartnerPoweredWorkspaceResponse path := "/api/2.0/settings/types/llm_proxy_partner_powered/names/default" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteLlmProxyPartnerPoweredWorkspaceResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := deleteLlmProxyPartnerPoweredWorkspaceResponseFromPb(&deleteLlmProxyPartnerPoweredWorkspaceResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteLlmProxyPartnerPoweredWorkspaceResponse) + return &deleteLlmProxyPartnerPoweredWorkspaceResponse, err } func (a *llmProxyPartnerPoweredWorkspaceImpl) Get(ctx context.Context, request GetLlmProxyPartnerPoweredWorkspaceRequest) (*LlmProxyPartnerPoweredWorkspace, error) { - - requestPb, pbErr := getLlmProxyPartnerPoweredWorkspaceRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var llmProxyPartnerPoweredWorkspacePb llmProxyPartnerPoweredWorkspacePb + var llmProxyPartnerPoweredWorkspace LlmProxyPartnerPoweredWorkspace path := "/api/2.0/settings/types/llm_proxy_partner_powered/names/default" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &llmProxyPartnerPoweredWorkspacePb, - ) - if err != nil { - return nil, err - } - resp, err := llmProxyPartnerPoweredWorkspaceFromPb(&llmProxyPartnerPoweredWorkspacePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &llmProxyPartnerPoweredWorkspace) + return &llmProxyPartnerPoweredWorkspace, err } func (a *llmProxyPartnerPoweredWorkspaceImpl) Update(ctx context.Context, request UpdateLlmProxyPartnerPoweredWorkspaceRequest) (*LlmProxyPartnerPoweredWorkspace, error) { - - requestPb, pbErr := updateLlmProxyPartnerPoweredWorkspaceRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var llmProxyPartnerPoweredWorkspacePb llmProxyPartnerPoweredWorkspacePb + var llmProxyPartnerPoweredWorkspace LlmProxyPartnerPoweredWorkspace path := "/api/2.0/settings/types/llm_proxy_partner_powered/names/default" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &llmProxyPartnerPoweredWorkspacePb, - ) - if err != nil { - return nil, err - } - resp, err := llmProxyPartnerPoweredWorkspaceFromPb(&llmProxyPartnerPoweredWorkspacePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &llmProxyPartnerPoweredWorkspace) + return &llmProxyPartnerPoweredWorkspace, err } // unexported type that holds implementations of just NetworkConnectivity API methods @@ -2076,193 +805,65 @@ type networkConnectivityImpl struct { } func (a *networkConnectivityImpl) CreateNetworkConnectivityConfiguration(ctx context.Context, request CreateNetworkConnectivityConfigRequest) (*NetworkConnectivityConfiguration, error) { - - requestPb, pbErr := createNetworkConnectivityConfigRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var networkConnectivityConfigurationPb networkConnectivityConfigurationPb + var networkConnectivityConfiguration NetworkConnectivityConfiguration path := fmt.Sprintf("/api/2.0/accounts/%v/network-connectivity-configs", a.client.ConfiguredAccountID()) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb).NetworkConnectivityConfig, - &networkConnectivityConfigurationPb, - ) - if err != nil { - return nil, err - } - resp, err := networkConnectivityConfigurationFromPb(&networkConnectivityConfigurationPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.NetworkConnectivityConfig, &networkConnectivityConfiguration) + return &networkConnectivityConfiguration, err } func (a *networkConnectivityImpl) CreatePrivateEndpointRule(ctx context.Context, request CreatePrivateEndpointRuleRequest) (*NccPrivateEndpointRule, error) { - - requestPb, pbErr := createPrivateEndpointRuleRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var nccPrivateEndpointRulePb nccPrivateEndpointRulePb - path := fmt.Sprintf("/api/2.0/accounts/%v/network-connectivity-configs/%v/private-endpoint-rules", a.client.ConfiguredAccountID(), requestPb.NetworkConnectivityConfigId) + var nccPrivateEndpointRule NccPrivateEndpointRule + path := fmt.Sprintf("/api/2.0/accounts/%v/network-connectivity-configs/%v/private-endpoint-rules", a.client.ConfiguredAccountID(), request.NetworkConnectivityConfigId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb).PrivateEndpointRule, - &nccPrivateEndpointRulePb, - ) - if err != nil { - return nil, err - } - resp, err := nccPrivateEndpointRuleFromPb(&nccPrivateEndpointRulePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.PrivateEndpointRule, &nccPrivateEndpointRule) + return &nccPrivateEndpointRule, err } func (a *networkConnectivityImpl) DeleteNetworkConnectivityConfiguration(ctx context.Context, request DeleteNetworkConnectivityConfigurationRequest) error { - - requestPb, pbErr := deleteNetworkConnectivityConfigurationRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteNetworkConnectivityConfigurationResponsePb deleteNetworkConnectivityConfigurationResponsePb - path := fmt.Sprintf("/api/2.0/accounts/%v/network-connectivity-configs/%v", a.client.ConfiguredAccountID(), requestPb.NetworkConnectivityConfigId) + var deleteNetworkConnectivityConfigurationResponse DeleteNetworkConnectivityConfigurationResponse + path := fmt.Sprintf("/api/2.0/accounts/%v/network-connectivity-configs/%v", a.client.ConfiguredAccountID(), request.NetworkConnectivityConfigId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteNetworkConnectivityConfigurationResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteNetworkConnectivityConfigurationResponse) return err } func (a *networkConnectivityImpl) DeletePrivateEndpointRule(ctx context.Context, request DeletePrivateEndpointRuleRequest) (*NccPrivateEndpointRule, error) { - - requestPb, pbErr := deletePrivateEndpointRuleRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var nccPrivateEndpointRulePb nccPrivateEndpointRulePb - path := fmt.Sprintf("/api/2.0/accounts/%v/network-connectivity-configs/%v/private-endpoint-rules/%v", a.client.ConfiguredAccountID(), requestPb.NetworkConnectivityConfigId, requestPb.PrivateEndpointRuleId) + var nccPrivateEndpointRule NccPrivateEndpointRule + path := fmt.Sprintf("/api/2.0/accounts/%v/network-connectivity-configs/%v/private-endpoint-rules/%v", a.client.ConfiguredAccountID(), request.NetworkConnectivityConfigId, request.PrivateEndpointRuleId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &nccPrivateEndpointRulePb, - ) - if err != nil { - return nil, err - } - resp, err := nccPrivateEndpointRuleFromPb(&nccPrivateEndpointRulePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &nccPrivateEndpointRule) + return &nccPrivateEndpointRule, err } func (a *networkConnectivityImpl) GetNetworkConnectivityConfiguration(ctx context.Context, request GetNetworkConnectivityConfigurationRequest) (*NetworkConnectivityConfiguration, error) { - - requestPb, pbErr := getNetworkConnectivityConfigurationRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var networkConnectivityConfigurationPb networkConnectivityConfigurationPb - path := fmt.Sprintf("/api/2.0/accounts/%v/network-connectivity-configs/%v", a.client.ConfiguredAccountID(), requestPb.NetworkConnectivityConfigId) + var networkConnectivityConfiguration NetworkConnectivityConfiguration + path := fmt.Sprintf("/api/2.0/accounts/%v/network-connectivity-configs/%v", a.client.ConfiguredAccountID(), request.NetworkConnectivityConfigId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &networkConnectivityConfigurationPb, - ) - if err != nil { - return nil, err - } - resp, err := networkConnectivityConfigurationFromPb(&networkConnectivityConfigurationPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &networkConnectivityConfiguration) + return &networkConnectivityConfiguration, err } func (a *networkConnectivityImpl) GetPrivateEndpointRule(ctx context.Context, request GetPrivateEndpointRuleRequest) (*NccPrivateEndpointRule, error) { - - requestPb, pbErr := getPrivateEndpointRuleRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var nccPrivateEndpointRulePb nccPrivateEndpointRulePb - path := fmt.Sprintf("/api/2.0/accounts/%v/network-connectivity-configs/%v/private-endpoint-rules/%v", a.client.ConfiguredAccountID(), requestPb.NetworkConnectivityConfigId, requestPb.PrivateEndpointRuleId) + var nccPrivateEndpointRule NccPrivateEndpointRule + path := fmt.Sprintf("/api/2.0/accounts/%v/network-connectivity-configs/%v/private-endpoint-rules/%v", a.client.ConfiguredAccountID(), request.NetworkConnectivityConfigId, request.PrivateEndpointRuleId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &nccPrivateEndpointRulePb, - ) - if err != nil { - return nil, err - } - resp, err := nccPrivateEndpointRuleFromPb(&nccPrivateEndpointRulePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &nccPrivateEndpointRule) + return &nccPrivateEndpointRule, err } // Gets an array of network connectivity configurations. @@ -2297,35 +898,13 @@ func (a *networkConnectivityImpl) ListNetworkConnectivityConfigurationsAll(ctx c } func (a *networkConnectivityImpl) internalListNetworkConnectivityConfigurations(ctx context.Context, request ListNetworkConnectivityConfigurationsRequest) (*ListNetworkConnectivityConfigurationsResponse, error) { - - requestPb, pbErr := listNetworkConnectivityConfigurationsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listNetworkConnectivityConfigurationsResponsePb listNetworkConnectivityConfigurationsResponsePb + var listNetworkConnectivityConfigurationsResponse ListNetworkConnectivityConfigurationsResponse path := fmt.Sprintf("/api/2.0/accounts/%v/network-connectivity-configs", a.client.ConfiguredAccountID()) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listNetworkConnectivityConfigurationsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listNetworkConnectivityConfigurationsResponseFromPb(&listNetworkConnectivityConfigurationsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listNetworkConnectivityConfigurationsResponse) + return &listNetworkConnectivityConfigurationsResponse, err } // Gets an array of private endpoint rules. @@ -2360,71 +939,27 @@ func (a *networkConnectivityImpl) ListPrivateEndpointRulesAll(ctx context.Contex } func (a *networkConnectivityImpl) internalListPrivateEndpointRules(ctx context.Context, request ListPrivateEndpointRulesRequest) (*ListPrivateEndpointRulesResponse, error) { - - requestPb, pbErr := listPrivateEndpointRulesRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listPrivateEndpointRulesResponsePb listPrivateEndpointRulesResponsePb - path := fmt.Sprintf("/api/2.0/accounts/%v/network-connectivity-configs/%v/private-endpoint-rules", a.client.ConfiguredAccountID(), requestPb.NetworkConnectivityConfigId) + var listPrivateEndpointRulesResponse ListPrivateEndpointRulesResponse + path := fmt.Sprintf("/api/2.0/accounts/%v/network-connectivity-configs/%v/private-endpoint-rules", a.client.ConfiguredAccountID(), request.NetworkConnectivityConfigId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listPrivateEndpointRulesResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listPrivateEndpointRulesResponseFromPb(&listPrivateEndpointRulesResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listPrivateEndpointRulesResponse) + return &listPrivateEndpointRulesResponse, err } func (a *networkConnectivityImpl) UpdatePrivateEndpointRule(ctx context.Context, request UpdateNccPrivateEndpointRuleRequest) (*NccPrivateEndpointRule, error) { - - requestPb, pbErr := updateNccPrivateEndpointRuleRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var nccPrivateEndpointRulePb nccPrivateEndpointRulePb - path := fmt.Sprintf("/api/2.0/accounts/%v/network-connectivity-configs/%v/private-endpoint-rules/%v", a.client.ConfiguredAccountID(), requestPb.NetworkConnectivityConfigId, requestPb.PrivateEndpointRuleId) + var nccPrivateEndpointRule NccPrivateEndpointRule + path := fmt.Sprintf("/api/2.0/accounts/%v/network-connectivity-configs/%v/private-endpoint-rules/%v", a.client.ConfiguredAccountID(), request.NetworkConnectivityConfigId, request.PrivateEndpointRuleId) queryParams := make(map[string]any) - if requestPb.UpdateMask != "" { - queryParams["update_mask"] = requestPb.UpdateMask + if request.UpdateMask != "" { + queryParams["update_mask"] = request.UpdateMask } headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb).PrivateEndpointRule, - &nccPrivateEndpointRulePb, - ) - if err != nil { - return nil, err - } - resp, err := nccPrivateEndpointRuleFromPb(&nccPrivateEndpointRulePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.PrivateEndpointRule, &nccPrivateEndpointRule) + return &nccPrivateEndpointRule, err } // unexported type that holds implementations of just NetworkPolicies API methods @@ -2433,96 +968,34 @@ type networkPoliciesImpl struct { } func (a *networkPoliciesImpl) CreateNetworkPolicyRpc(ctx context.Context, request CreateNetworkPolicyRequest) (*AccountNetworkPolicy, error) { - - requestPb, pbErr := createNetworkPolicyRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var accountNetworkPolicyPb accountNetworkPolicyPb + var accountNetworkPolicy AccountNetworkPolicy path := fmt.Sprintf("/api/2.0/accounts/%v/network-policies", a.client.ConfiguredAccountID()) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb).NetworkPolicy, - &accountNetworkPolicyPb, - ) - if err != nil { - return nil, err - } - resp, err := accountNetworkPolicyFromPb(&accountNetworkPolicyPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.NetworkPolicy, &accountNetworkPolicy) + return &accountNetworkPolicy, err } func (a *networkPoliciesImpl) DeleteNetworkPolicyRpc(ctx context.Context, request DeleteNetworkPolicyRequest) error { - - requestPb, pbErr := deleteNetworkPolicyRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteNetworkPolicyRpcResponsePb deleteNetworkPolicyRpcResponsePb - path := fmt.Sprintf("/api/2.0/accounts/%v/network-policies/%v", a.client.ConfiguredAccountID(), requestPb.NetworkPolicyId) + var deleteNetworkPolicyRpcResponse DeleteNetworkPolicyRpcResponse + path := fmt.Sprintf("/api/2.0/accounts/%v/network-policies/%v", a.client.ConfiguredAccountID(), request.NetworkPolicyId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteNetworkPolicyRpcResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteNetworkPolicyRpcResponse) return err } func (a *networkPoliciesImpl) GetNetworkPolicyRpc(ctx context.Context, request GetNetworkPolicyRequest) (*AccountNetworkPolicy, error) { - - requestPb, pbErr := getNetworkPolicyRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var accountNetworkPolicyPb accountNetworkPolicyPb - path := fmt.Sprintf("/api/2.0/accounts/%v/network-policies/%v", a.client.ConfiguredAccountID(), requestPb.NetworkPolicyId) + var accountNetworkPolicy AccountNetworkPolicy + path := fmt.Sprintf("/api/2.0/accounts/%v/network-policies/%v", a.client.ConfiguredAccountID(), request.NetworkPolicyId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &accountNetworkPolicyPb, - ) - if err != nil { - return nil, err - } - resp, err := accountNetworkPolicyFromPb(&accountNetworkPolicyPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &accountNetworkPolicy) + return &accountNetworkPolicy, err } // Gets an array of network policies. @@ -2557,68 +1030,24 @@ func (a *networkPoliciesImpl) ListNetworkPoliciesRpcAll(ctx context.Context, req } func (a *networkPoliciesImpl) internalListNetworkPoliciesRpc(ctx context.Context, request ListNetworkPoliciesRequest) (*ListNetworkPoliciesResponse, error) { - - requestPb, pbErr := listNetworkPoliciesRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listNetworkPoliciesResponsePb listNetworkPoliciesResponsePb + var listNetworkPoliciesResponse ListNetworkPoliciesResponse path := fmt.Sprintf("/api/2.0/accounts/%v/network-policies", a.client.ConfiguredAccountID()) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listNetworkPoliciesResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listNetworkPoliciesResponseFromPb(&listNetworkPoliciesResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listNetworkPoliciesResponse) + return &listNetworkPoliciesResponse, err } func (a *networkPoliciesImpl) UpdateNetworkPolicyRpc(ctx context.Context, request UpdateNetworkPolicyRequest) (*AccountNetworkPolicy, error) { - - requestPb, pbErr := updateNetworkPolicyRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var accountNetworkPolicyPb accountNetworkPolicyPb - path := fmt.Sprintf("/api/2.0/accounts/%v/network-policies/%v", a.client.ConfiguredAccountID(), requestPb.NetworkPolicyId) + var accountNetworkPolicy AccountNetworkPolicy + path := fmt.Sprintf("/api/2.0/accounts/%v/network-policies/%v", a.client.ConfiguredAccountID(), request.NetworkPolicyId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPut, - path, - headers, - queryParams, - (*requestPb).NetworkPolicy, - &accountNetworkPolicyPb, - ) - if err != nil { - return nil, err - } - resp, err := accountNetworkPolicyFromPb(&accountNetworkPolicyPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request.NetworkPolicy, &accountNetworkPolicy) + return &accountNetworkPolicy, err } // unexported type that holds implementations of just NotificationDestinations API methods @@ -2627,96 +1056,34 @@ type notificationDestinationsImpl struct { } func (a *notificationDestinationsImpl) Create(ctx context.Context, request CreateNotificationDestinationRequest) (*NotificationDestination, error) { - - requestPb, pbErr := createNotificationDestinationRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var notificationDestinationPb notificationDestinationPb + var notificationDestination NotificationDestination path := "/api/2.0/notification-destinations" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - ¬ificationDestinationPb, - ) - if err != nil { - return nil, err - } - resp, err := notificationDestinationFromPb(¬ificationDestinationPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, ¬ificationDestination) + return ¬ificationDestination, err } func (a *notificationDestinationsImpl) Delete(ctx context.Context, request DeleteNotificationDestinationRequest) error { - - requestPb, pbErr := deleteNotificationDestinationRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var emptyPb emptyPb - path := fmt.Sprintf("/api/2.0/notification-destinations/%v", requestPb.Id) + var empty Empty + path := fmt.Sprintf("/api/2.0/notification-destinations/%v", request.Id) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &emptyPb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &empty) return err } func (a *notificationDestinationsImpl) Get(ctx context.Context, request GetNotificationDestinationRequest) (*NotificationDestination, error) { - - requestPb, pbErr := getNotificationDestinationRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var notificationDestinationPb notificationDestinationPb - path := fmt.Sprintf("/api/2.0/notification-destinations/%v", requestPb.Id) + var notificationDestination NotificationDestination + path := fmt.Sprintf("/api/2.0/notification-destinations/%v", request.Id) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - ¬ificationDestinationPb, - ) - if err != nil { - return nil, err - } - resp, err := notificationDestinationFromPb(¬ificationDestinationPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, ¬ificationDestination) + return ¬ificationDestination, err } // Lists notification destinations. @@ -2751,68 +1118,24 @@ func (a *notificationDestinationsImpl) ListAll(ctx context.Context, request List } func (a *notificationDestinationsImpl) internalList(ctx context.Context, request ListNotificationDestinationsRequest) (*ListNotificationDestinationsResponse, error) { - - requestPb, pbErr := listNotificationDestinationsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listNotificationDestinationsResponsePb listNotificationDestinationsResponsePb + var listNotificationDestinationsResponse ListNotificationDestinationsResponse path := "/api/2.0/notification-destinations" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listNotificationDestinationsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listNotificationDestinationsResponseFromPb(&listNotificationDestinationsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listNotificationDestinationsResponse) + return &listNotificationDestinationsResponse, err } func (a *notificationDestinationsImpl) Update(ctx context.Context, request UpdateNotificationDestinationRequest) (*NotificationDestination, error) { - - requestPb, pbErr := updateNotificationDestinationRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var notificationDestinationPb notificationDestinationPb - path := fmt.Sprintf("/api/2.0/notification-destinations/%v", requestPb.Id) + var notificationDestination NotificationDestination + path := fmt.Sprintf("/api/2.0/notification-destinations/%v", request.Id) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - ¬ificationDestinationPb, - ) - if err != nil { - return nil, err - } - resp, err := notificationDestinationFromPb(¬ificationDestinationPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, ¬ificationDestination) + return ¬ificationDestination, err } // unexported type that holds implementations of just PersonalCompute API methods @@ -2821,100 +1144,34 @@ type personalComputeImpl struct { } func (a *personalComputeImpl) Delete(ctx context.Context, request DeletePersonalComputeSettingRequest) (*DeletePersonalComputeSettingResponse, error) { - - requestPb, pbErr := deletePersonalComputeSettingRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var deletePersonalComputeSettingResponsePb deletePersonalComputeSettingResponsePb + var deletePersonalComputeSettingResponse DeletePersonalComputeSettingResponse path := fmt.Sprintf("/api/2.0/accounts/%v/settings/types/dcp_acct_enable/names/default", a.client.ConfiguredAccountID()) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deletePersonalComputeSettingResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := deletePersonalComputeSettingResponseFromPb(&deletePersonalComputeSettingResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deletePersonalComputeSettingResponse) + return &deletePersonalComputeSettingResponse, err } func (a *personalComputeImpl) Get(ctx context.Context, request GetPersonalComputeSettingRequest) (*PersonalComputeSetting, error) { - - requestPb, pbErr := getPersonalComputeSettingRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var personalComputeSettingPb personalComputeSettingPb + var personalComputeSetting PersonalComputeSetting path := fmt.Sprintf("/api/2.0/accounts/%v/settings/types/dcp_acct_enable/names/default", a.client.ConfiguredAccountID()) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &personalComputeSettingPb, - ) - if err != nil { - return nil, err - } - resp, err := personalComputeSettingFromPb(&personalComputeSettingPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &personalComputeSetting) + return &personalComputeSetting, err } func (a *personalComputeImpl) Update(ctx context.Context, request UpdatePersonalComputeSettingRequest) (*PersonalComputeSetting, error) { - - requestPb, pbErr := updatePersonalComputeSettingRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var personalComputeSettingPb personalComputeSettingPb + var personalComputeSetting PersonalComputeSetting path := fmt.Sprintf("/api/2.0/accounts/%v/settings/types/dcp_acct_enable/names/default", a.client.ConfiguredAccountID()) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &personalComputeSettingPb, - ) - if err != nil { - return nil, err - } - resp, err := personalComputeSettingFromPb(&personalComputeSettingPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &personalComputeSetting) + return &personalComputeSetting, err } // unexported type that holds implementations of just RestrictWorkspaceAdmins API methods @@ -2923,100 +1180,34 @@ type restrictWorkspaceAdminsImpl struct { } func (a *restrictWorkspaceAdminsImpl) Delete(ctx context.Context, request DeleteRestrictWorkspaceAdminsSettingRequest) (*DeleteRestrictWorkspaceAdminsSettingResponse, error) { - - requestPb, pbErr := deleteRestrictWorkspaceAdminsSettingRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var deleteRestrictWorkspaceAdminsSettingResponsePb deleteRestrictWorkspaceAdminsSettingResponsePb + var deleteRestrictWorkspaceAdminsSettingResponse DeleteRestrictWorkspaceAdminsSettingResponse path := "/api/2.0/settings/types/restrict_workspace_admins/names/default" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteRestrictWorkspaceAdminsSettingResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := deleteRestrictWorkspaceAdminsSettingResponseFromPb(&deleteRestrictWorkspaceAdminsSettingResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteRestrictWorkspaceAdminsSettingResponse) + return &deleteRestrictWorkspaceAdminsSettingResponse, err } func (a *restrictWorkspaceAdminsImpl) Get(ctx context.Context, request GetRestrictWorkspaceAdminsSettingRequest) (*RestrictWorkspaceAdminsSetting, error) { - - requestPb, pbErr := getRestrictWorkspaceAdminsSettingRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var restrictWorkspaceAdminsSettingPb restrictWorkspaceAdminsSettingPb + var restrictWorkspaceAdminsSetting RestrictWorkspaceAdminsSetting path := "/api/2.0/settings/types/restrict_workspace_admins/names/default" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &restrictWorkspaceAdminsSettingPb, - ) - if err != nil { - return nil, err - } - resp, err := restrictWorkspaceAdminsSettingFromPb(&restrictWorkspaceAdminsSettingPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &restrictWorkspaceAdminsSetting) + return &restrictWorkspaceAdminsSetting, err } func (a *restrictWorkspaceAdminsImpl) Update(ctx context.Context, request UpdateRestrictWorkspaceAdminsSettingRequest) (*RestrictWorkspaceAdminsSetting, error) { - - requestPb, pbErr := updateRestrictWorkspaceAdminsSettingRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var restrictWorkspaceAdminsSettingPb restrictWorkspaceAdminsSettingPb + var restrictWorkspaceAdminsSetting RestrictWorkspaceAdminsSetting path := "/api/2.0/settings/types/restrict_workspace_admins/names/default" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &restrictWorkspaceAdminsSettingPb, - ) - if err != nil { - return nil, err - } - resp, err := restrictWorkspaceAdminsSettingFromPb(&restrictWorkspaceAdminsSettingPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &restrictWorkspaceAdminsSetting) + return &restrictWorkspaceAdminsSetting, err } // unexported type that holds implementations of just Settings API methods @@ -3030,100 +1221,34 @@ type sqlResultsDownloadImpl struct { } func (a *sqlResultsDownloadImpl) Delete(ctx context.Context, request DeleteSqlResultsDownloadRequest) (*DeleteSqlResultsDownloadResponse, error) { - - requestPb, pbErr := deleteSqlResultsDownloadRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var deleteSqlResultsDownloadResponsePb deleteSqlResultsDownloadResponsePb + var deleteSqlResultsDownloadResponse DeleteSqlResultsDownloadResponse path := "/api/2.0/settings/types/sql_results_download/names/default" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteSqlResultsDownloadResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := deleteSqlResultsDownloadResponseFromPb(&deleteSqlResultsDownloadResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteSqlResultsDownloadResponse) + return &deleteSqlResultsDownloadResponse, err } func (a *sqlResultsDownloadImpl) Get(ctx context.Context, request GetSqlResultsDownloadRequest) (*SqlResultsDownload, error) { - - requestPb, pbErr := getSqlResultsDownloadRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var sqlResultsDownloadPb sqlResultsDownloadPb + var sqlResultsDownload SqlResultsDownload path := "/api/2.0/settings/types/sql_results_download/names/default" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &sqlResultsDownloadPb, - ) - if err != nil { - return nil, err - } - resp, err := sqlResultsDownloadFromPb(&sqlResultsDownloadPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &sqlResultsDownload) + return &sqlResultsDownload, err } func (a *sqlResultsDownloadImpl) Update(ctx context.Context, request UpdateSqlResultsDownloadRequest) (*SqlResultsDownload, error) { - - requestPb, pbErr := updateSqlResultsDownloadRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var sqlResultsDownloadPb sqlResultsDownloadPb + var sqlResultsDownload SqlResultsDownload path := "/api/2.0/settings/types/sql_results_download/names/default" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &sqlResultsDownloadPb, - ) - if err != nil { - return nil, err - } - resp, err := sqlResultsDownloadFromPb(&sqlResultsDownloadPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &sqlResultsDownload) + return &sqlResultsDownload, err } // unexported type that holds implementations of just TokenManagement API methods @@ -3132,149 +1257,53 @@ type tokenManagementImpl struct { } func (a *tokenManagementImpl) CreateOboToken(ctx context.Context, request CreateOboTokenRequest) (*CreateOboTokenResponse, error) { - - requestPb, pbErr := createOboTokenRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var createOboTokenResponsePb createOboTokenResponsePb + var createOboTokenResponse CreateOboTokenResponse path := "/api/2.0/token-management/on-behalf-of/tokens" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &createOboTokenResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := createOboTokenResponseFromPb(&createOboTokenResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &createOboTokenResponse) + return &createOboTokenResponse, err } func (a *tokenManagementImpl) Delete(ctx context.Context, request DeleteTokenManagementRequest) error { - - requestPb, pbErr := deleteTokenManagementRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteResponsePb deleteResponsePb - path := fmt.Sprintf("/api/2.0/token-management/tokens/%v", requestPb.TokenId) - queryParams := make(map[string]any) - headers := make(map[string]string) - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteResponsePb, - ) - if err != nil { - return err - } - + var deleteResponse DeleteResponse + path := fmt.Sprintf("/api/2.0/token-management/tokens/%v", request.TokenId) + queryParams := make(map[string]any) + headers := make(map[string]string) + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteResponse) return err } func (a *tokenManagementImpl) Get(ctx context.Context, request GetTokenManagementRequest) (*GetTokenResponse, error) { - - requestPb, pbErr := getTokenManagementRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var getTokenResponsePb getTokenResponsePb - path := fmt.Sprintf("/api/2.0/token-management/tokens/%v", requestPb.TokenId) + var getTokenResponse GetTokenResponse + path := fmt.Sprintf("/api/2.0/token-management/tokens/%v", request.TokenId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &getTokenResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := getTokenResponseFromPb(&getTokenResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getTokenResponse) + return &getTokenResponse, err } func (a *tokenManagementImpl) GetPermissionLevels(ctx context.Context) (*GetTokenPermissionLevelsResponse, error) { - - var getTokenPermissionLevelsResponsePb getTokenPermissionLevelsResponsePb + var getTokenPermissionLevelsResponse GetTokenPermissionLevelsResponse path := "/api/2.0/permissions/authorization/tokens/permissionLevels" headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - nil, - nil, - &getTokenPermissionLevelsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := getTokenPermissionLevelsResponseFromPb(&getTokenPermissionLevelsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, nil, nil, &getTokenPermissionLevelsResponse) + return &getTokenPermissionLevelsResponse, err } func (a *tokenManagementImpl) GetPermissions(ctx context.Context) (*TokenPermissions, error) { - - var tokenPermissionsPb tokenPermissionsPb + var tokenPermissions TokenPermissions path := "/api/2.0/permissions/authorization/tokens" headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - nil, - nil, - &tokenPermissionsPb, - ) - if err != nil { - return nil, err - } - resp, err := tokenPermissionsFromPb(&tokenPermissionsPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, nil, nil, &tokenPermissions) + return &tokenPermissions, err } // Lists all tokens associated with the specified workspace or user. @@ -3303,101 +1332,35 @@ func (a *tokenManagementImpl) ListAll(ctx context.Context, request ListTokenMana } func (a *tokenManagementImpl) internalList(ctx context.Context, request ListTokenManagementRequest) (*ListTokensResponse, error) { - - requestPb, pbErr := listTokenManagementRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listTokensResponsePb listTokensResponsePb + var listTokensResponse ListTokensResponse path := "/api/2.0/token-management/tokens" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listTokensResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listTokensResponseFromPb(&listTokensResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listTokensResponse) + return &listTokensResponse, err } func (a *tokenManagementImpl) SetPermissions(ctx context.Context, request TokenPermissionsRequest) (*TokenPermissions, error) { - - requestPb, pbErr := tokenPermissionsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var tokenPermissionsPb tokenPermissionsPb + var tokenPermissions TokenPermissions path := "/api/2.0/permissions/authorization/tokens" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPut, - path, - headers, - queryParams, - (*requestPb), - &tokenPermissionsPb, - ) - if err != nil { - return nil, err - } - resp, err := tokenPermissionsFromPb(&tokenPermissionsPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &tokenPermissions) + return &tokenPermissions, err } func (a *tokenManagementImpl) UpdatePermissions(ctx context.Context, request TokenPermissionsRequest) (*TokenPermissions, error) { - - requestPb, pbErr := tokenPermissionsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var tokenPermissionsPb tokenPermissionsPb + var tokenPermissions TokenPermissions path := "/api/2.0/permissions/authorization/tokens" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &tokenPermissionsPb, - ) - if err != nil { - return nil, err - } - resp, err := tokenPermissionsFromPb(&tokenPermissionsPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &tokenPermissions) + return &tokenPermissions, err } // unexported type that holds implementations of just Tokens API methods @@ -3406,64 +1369,24 @@ type tokensImpl struct { } func (a *tokensImpl) Create(ctx context.Context, request CreateTokenRequest) (*CreateTokenResponse, error) { - - requestPb, pbErr := createTokenRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var createTokenResponsePb createTokenResponsePb + var createTokenResponse CreateTokenResponse path := "/api/2.0/token/create" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &createTokenResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := createTokenResponseFromPb(&createTokenResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &createTokenResponse) + return &createTokenResponse, err } func (a *tokensImpl) Delete(ctx context.Context, request RevokeTokenRequest) error { - - requestPb, pbErr := revokeTokenRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var revokeTokenResponsePb revokeTokenResponsePb + var revokeTokenResponse RevokeTokenResponse path := "/api/2.0/token/delete" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &revokeTokenResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &revokeTokenResponse) return err } @@ -3494,30 +1417,13 @@ func (a *tokensImpl) ListAll(ctx context.Context) ([]PublicTokenInfo, error) { } func (a *tokensImpl) internalList(ctx context.Context) (*ListPublicTokensResponse, error) { - - var listPublicTokensResponsePb listPublicTokensResponsePb + var listPublicTokensResponse ListPublicTokensResponse path := "/api/2.0/token/list" headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - nil, - nil, - &listPublicTokensResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listPublicTokensResponseFromPb(&listPublicTokensResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, nil, nil, &listPublicTokensResponse) + return &listPublicTokensResponse, err } // unexported type that holds implementations of just WorkspaceConf API methods @@ -3526,59 +1432,22 @@ type workspaceConfImpl struct { } func (a *workspaceConfImpl) GetStatus(ctx context.Context, request GetStatusRequest) (*map[string]string, error) { - - requestPb, pbErr := getStatusRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var workspaceConfPb map[string]string + var workspaceConf map[string]string path := "/api/2.0/workspace-conf" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &workspaceConfPb, - ) - if err != nil { - return nil, err - } - resp := &workspaceConfPb - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &workspaceConf) + return &workspaceConf, err } func (a *workspaceConfImpl) SetStatus(ctx context.Context, request WorkspaceConf) error { - - requestPb, pbErr := workspaceConfToPb(&request) - if pbErr != nil { - return pbErr - } - - var setStatusResponsePb setStatusResponsePb + var setStatusResponse SetStatusResponse path := "/api/2.0/workspace-conf" queryParams := make(map[string]any) headers := make(map[string]string) headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &setStatusResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &setStatusResponse) return err } @@ -3588,66 +1457,22 @@ type workspaceNetworkConfigurationImpl struct { } func (a *workspaceNetworkConfigurationImpl) GetWorkspaceNetworkOptionRpc(ctx context.Context, request GetWorkspaceNetworkOptionRequest) (*WorkspaceNetworkOption, error) { - - requestPb, pbErr := getWorkspaceNetworkOptionRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var workspaceNetworkOptionPb workspaceNetworkOptionPb - path := fmt.Sprintf("/api/2.0/accounts/%v/workspaces/%v/network", a.client.ConfiguredAccountID(), requestPb.WorkspaceId) + var workspaceNetworkOption WorkspaceNetworkOption + path := fmt.Sprintf("/api/2.0/accounts/%v/workspaces/%v/network", a.client.ConfiguredAccountID(), request.WorkspaceId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &workspaceNetworkOptionPb, - ) - if err != nil { - return nil, err - } - resp, err := workspaceNetworkOptionFromPb(&workspaceNetworkOptionPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &workspaceNetworkOption) + return &workspaceNetworkOption, err } func (a *workspaceNetworkConfigurationImpl) UpdateWorkspaceNetworkOptionRpc(ctx context.Context, request UpdateWorkspaceNetworkOptionRequest) (*WorkspaceNetworkOption, error) { - - requestPb, pbErr := updateWorkspaceNetworkOptionRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var workspaceNetworkOptionPb workspaceNetworkOptionPb - path := fmt.Sprintf("/api/2.0/accounts/%v/workspaces/%v/network", a.client.ConfiguredAccountID(), requestPb.WorkspaceId) + var workspaceNetworkOption WorkspaceNetworkOption + path := fmt.Sprintf("/api/2.0/accounts/%v/workspaces/%v/network", a.client.ConfiguredAccountID(), request.WorkspaceId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPut, - path, - headers, - queryParams, - (*requestPb).WorkspaceNetworkOption, - &workspaceNetworkOptionPb, - ) - if err != nil { - return nil, err - } - resp, err := workspaceNetworkOptionFromPb(&workspaceNetworkOptionPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request.WorkspaceNetworkOption, &workspaceNetworkOption) + return &workspaceNetworkOption, err } diff --git a/service/settings/internal.go b/service/settings/internal.go deleted file mode 100755 index 7aea68d52..000000000 --- a/service/settings/internal.go +++ /dev/null @@ -1,7055 +0,0 @@ -// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. - -package settings - -import ( - "fmt" - "strings" - "time" - - "github.com/databricks/databricks-sdk-go/marshal" -) - -func accountIpAccessEnableToPb(st *AccountIpAccessEnable) (*accountIpAccessEnablePb, error) { - if st == nil { - return nil, nil - } - pb := &accountIpAccessEnablePb{} - pb.AcctIpAclEnable = st.AcctIpAclEnable - pb.Etag = st.Etag - pb.SettingName = st.SettingName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type accountIpAccessEnablePb struct { - AcctIpAclEnable BooleanMessage `json:"acct_ip_acl_enable"` - Etag string `json:"etag,omitempty"` - SettingName string `json:"setting_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func accountIpAccessEnableFromPb(pb *accountIpAccessEnablePb) (*AccountIpAccessEnable, error) { - if pb == nil { - return nil, nil - } - st := &AccountIpAccessEnable{} - st.AcctIpAclEnable = pb.AcctIpAclEnable - st.Etag = pb.Etag - st.SettingName = pb.SettingName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *accountIpAccessEnablePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st accountIpAccessEnablePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func accountNetworkPolicyToPb(st *AccountNetworkPolicy) (*accountNetworkPolicyPb, error) { - if st == nil { - return nil, nil - } - pb := &accountNetworkPolicyPb{} - pb.AccountId = st.AccountId - pb.Egress = st.Egress - pb.NetworkPolicyId = st.NetworkPolicyId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type accountNetworkPolicyPb struct { - AccountId string `json:"account_id,omitempty"` - Egress *NetworkPolicyEgress `json:"egress,omitempty"` - NetworkPolicyId string `json:"network_policy_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func accountNetworkPolicyFromPb(pb *accountNetworkPolicyPb) (*AccountNetworkPolicy, error) { - if pb == nil { - return nil, nil - } - st := &AccountNetworkPolicy{} - st.AccountId = pb.AccountId - st.Egress = pb.Egress - st.NetworkPolicyId = pb.NetworkPolicyId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *accountNetworkPolicyPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st accountNetworkPolicyPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func aibiDashboardEmbeddingAccessPolicyToPb(st *AibiDashboardEmbeddingAccessPolicy) (*aibiDashboardEmbeddingAccessPolicyPb, error) { - if st == nil { - return nil, nil - } - pb := &aibiDashboardEmbeddingAccessPolicyPb{} - pb.AccessPolicyType = st.AccessPolicyType - - return pb, nil -} - -type aibiDashboardEmbeddingAccessPolicyPb struct { - AccessPolicyType AibiDashboardEmbeddingAccessPolicyAccessPolicyType `json:"access_policy_type"` -} - -func aibiDashboardEmbeddingAccessPolicyFromPb(pb *aibiDashboardEmbeddingAccessPolicyPb) (*AibiDashboardEmbeddingAccessPolicy, error) { - if pb == nil { - return nil, nil - } - st := &AibiDashboardEmbeddingAccessPolicy{} - st.AccessPolicyType = pb.AccessPolicyType - - return st, nil -} - -func aibiDashboardEmbeddingAccessPolicySettingToPb(st *AibiDashboardEmbeddingAccessPolicySetting) (*aibiDashboardEmbeddingAccessPolicySettingPb, error) { - if st == nil { - return nil, nil - } - pb := &aibiDashboardEmbeddingAccessPolicySettingPb{} - pb.AibiDashboardEmbeddingAccessPolicy = st.AibiDashboardEmbeddingAccessPolicy - pb.Etag = st.Etag - pb.SettingName = st.SettingName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type aibiDashboardEmbeddingAccessPolicySettingPb struct { - AibiDashboardEmbeddingAccessPolicy AibiDashboardEmbeddingAccessPolicy `json:"aibi_dashboard_embedding_access_policy"` - Etag string `json:"etag,omitempty"` - SettingName string `json:"setting_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func aibiDashboardEmbeddingAccessPolicySettingFromPb(pb *aibiDashboardEmbeddingAccessPolicySettingPb) (*AibiDashboardEmbeddingAccessPolicySetting, error) { - if pb == nil { - return nil, nil - } - st := &AibiDashboardEmbeddingAccessPolicySetting{} - st.AibiDashboardEmbeddingAccessPolicy = pb.AibiDashboardEmbeddingAccessPolicy - st.Etag = pb.Etag - st.SettingName = pb.SettingName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *aibiDashboardEmbeddingAccessPolicySettingPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st aibiDashboardEmbeddingAccessPolicySettingPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func aibiDashboardEmbeddingApprovedDomainsToPb(st *AibiDashboardEmbeddingApprovedDomains) (*aibiDashboardEmbeddingApprovedDomainsPb, error) { - if st == nil { - return nil, nil - } - pb := &aibiDashboardEmbeddingApprovedDomainsPb{} - pb.ApprovedDomains = st.ApprovedDomains - - return pb, nil -} - -type aibiDashboardEmbeddingApprovedDomainsPb struct { - ApprovedDomains []string `json:"approved_domains,omitempty"` -} - -func aibiDashboardEmbeddingApprovedDomainsFromPb(pb *aibiDashboardEmbeddingApprovedDomainsPb) (*AibiDashboardEmbeddingApprovedDomains, error) { - if pb == nil { - return nil, nil - } - st := &AibiDashboardEmbeddingApprovedDomains{} - st.ApprovedDomains = pb.ApprovedDomains - - return st, nil -} - -func aibiDashboardEmbeddingApprovedDomainsSettingToPb(st *AibiDashboardEmbeddingApprovedDomainsSetting) (*aibiDashboardEmbeddingApprovedDomainsSettingPb, error) { - if st == nil { - return nil, nil - } - pb := &aibiDashboardEmbeddingApprovedDomainsSettingPb{} - pb.AibiDashboardEmbeddingApprovedDomains = st.AibiDashboardEmbeddingApprovedDomains - pb.Etag = st.Etag - pb.SettingName = st.SettingName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type aibiDashboardEmbeddingApprovedDomainsSettingPb struct { - AibiDashboardEmbeddingApprovedDomains AibiDashboardEmbeddingApprovedDomains `json:"aibi_dashboard_embedding_approved_domains"` - Etag string `json:"etag,omitempty"` - SettingName string `json:"setting_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func aibiDashboardEmbeddingApprovedDomainsSettingFromPb(pb *aibiDashboardEmbeddingApprovedDomainsSettingPb) (*AibiDashboardEmbeddingApprovedDomainsSetting, error) { - if pb == nil { - return nil, nil - } - st := &AibiDashboardEmbeddingApprovedDomainsSetting{} - st.AibiDashboardEmbeddingApprovedDomains = pb.AibiDashboardEmbeddingApprovedDomains - st.Etag = pb.Etag - st.SettingName = pb.SettingName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *aibiDashboardEmbeddingApprovedDomainsSettingPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st aibiDashboardEmbeddingApprovedDomainsSettingPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func automaticClusterUpdateSettingToPb(st *AutomaticClusterUpdateSetting) (*automaticClusterUpdateSettingPb, error) { - if st == nil { - return nil, nil - } - pb := &automaticClusterUpdateSettingPb{} - pb.AutomaticClusterUpdateWorkspace = st.AutomaticClusterUpdateWorkspace - pb.Etag = st.Etag - pb.SettingName = st.SettingName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type automaticClusterUpdateSettingPb struct { - AutomaticClusterUpdateWorkspace ClusterAutoRestartMessage `json:"automatic_cluster_update_workspace"` - Etag string `json:"etag,omitempty"` - SettingName string `json:"setting_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func automaticClusterUpdateSettingFromPb(pb *automaticClusterUpdateSettingPb) (*AutomaticClusterUpdateSetting, error) { - if pb == nil { - return nil, nil - } - st := &AutomaticClusterUpdateSetting{} - st.AutomaticClusterUpdateWorkspace = pb.AutomaticClusterUpdateWorkspace - st.Etag = pb.Etag - st.SettingName = pb.SettingName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *automaticClusterUpdateSettingPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st automaticClusterUpdateSettingPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func booleanMessageToPb(st *BooleanMessage) (*booleanMessagePb, error) { - if st == nil { - return nil, nil - } - pb := &booleanMessagePb{} - pb.Value = st.Value - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type booleanMessagePb struct { - Value bool `json:"value,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func booleanMessageFromPb(pb *booleanMessagePb) (*BooleanMessage, error) { - if pb == nil { - return nil, nil - } - st := &BooleanMessage{} - st.Value = pb.Value - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *booleanMessagePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st booleanMessagePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func clusterAutoRestartMessageToPb(st *ClusterAutoRestartMessage) (*clusterAutoRestartMessagePb, error) { - if st == nil { - return nil, nil - } - pb := &clusterAutoRestartMessagePb{} - pb.CanToggle = st.CanToggle - pb.Enabled = st.Enabled - pb.EnablementDetails = st.EnablementDetails - pb.MaintenanceWindow = st.MaintenanceWindow - pb.RestartEvenIfNoUpdatesAvailable = st.RestartEvenIfNoUpdatesAvailable - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type clusterAutoRestartMessagePb struct { - CanToggle bool `json:"can_toggle,omitempty"` - Enabled bool `json:"enabled,omitempty"` - EnablementDetails *ClusterAutoRestartMessageEnablementDetails `json:"enablement_details,omitempty"` - MaintenanceWindow *ClusterAutoRestartMessageMaintenanceWindow `json:"maintenance_window,omitempty"` - RestartEvenIfNoUpdatesAvailable bool `json:"restart_even_if_no_updates_available,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func clusterAutoRestartMessageFromPb(pb *clusterAutoRestartMessagePb) (*ClusterAutoRestartMessage, error) { - if pb == nil { - return nil, nil - } - st := &ClusterAutoRestartMessage{} - st.CanToggle = pb.CanToggle - st.Enabled = pb.Enabled - st.EnablementDetails = pb.EnablementDetails - st.MaintenanceWindow = pb.MaintenanceWindow - st.RestartEvenIfNoUpdatesAvailable = pb.RestartEvenIfNoUpdatesAvailable - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *clusterAutoRestartMessagePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st clusterAutoRestartMessagePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func clusterAutoRestartMessageEnablementDetailsToPb(st *ClusterAutoRestartMessageEnablementDetails) (*clusterAutoRestartMessageEnablementDetailsPb, error) { - if st == nil { - return nil, nil - } - pb := &clusterAutoRestartMessageEnablementDetailsPb{} - pb.ForcedForComplianceMode = st.ForcedForComplianceMode - pb.UnavailableForDisabledEntitlement = st.UnavailableForDisabledEntitlement - pb.UnavailableForNonEnterpriseTier = st.UnavailableForNonEnterpriseTier - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type clusterAutoRestartMessageEnablementDetailsPb struct { - ForcedForComplianceMode bool `json:"forced_for_compliance_mode,omitempty"` - UnavailableForDisabledEntitlement bool `json:"unavailable_for_disabled_entitlement,omitempty"` - UnavailableForNonEnterpriseTier bool `json:"unavailable_for_non_enterprise_tier,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func clusterAutoRestartMessageEnablementDetailsFromPb(pb *clusterAutoRestartMessageEnablementDetailsPb) (*ClusterAutoRestartMessageEnablementDetails, error) { - if pb == nil { - return nil, nil - } - st := &ClusterAutoRestartMessageEnablementDetails{} - st.ForcedForComplianceMode = pb.ForcedForComplianceMode - st.UnavailableForDisabledEntitlement = pb.UnavailableForDisabledEntitlement - st.UnavailableForNonEnterpriseTier = pb.UnavailableForNonEnterpriseTier - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *clusterAutoRestartMessageEnablementDetailsPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st clusterAutoRestartMessageEnablementDetailsPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func clusterAutoRestartMessageMaintenanceWindowToPb(st *ClusterAutoRestartMessageMaintenanceWindow) (*clusterAutoRestartMessageMaintenanceWindowPb, error) { - if st == nil { - return nil, nil - } - pb := &clusterAutoRestartMessageMaintenanceWindowPb{} - pb.WeekDayBasedSchedule = st.WeekDayBasedSchedule - - return pb, nil -} - -type clusterAutoRestartMessageMaintenanceWindowPb struct { - WeekDayBasedSchedule *ClusterAutoRestartMessageMaintenanceWindowWeekDayBasedSchedule `json:"week_day_based_schedule,omitempty"` -} - -func clusterAutoRestartMessageMaintenanceWindowFromPb(pb *clusterAutoRestartMessageMaintenanceWindowPb) (*ClusterAutoRestartMessageMaintenanceWindow, error) { - if pb == nil { - return nil, nil - } - st := &ClusterAutoRestartMessageMaintenanceWindow{} - st.WeekDayBasedSchedule = pb.WeekDayBasedSchedule - - return st, nil -} - -func clusterAutoRestartMessageMaintenanceWindowWeekDayBasedScheduleToPb(st *ClusterAutoRestartMessageMaintenanceWindowWeekDayBasedSchedule) (*clusterAutoRestartMessageMaintenanceWindowWeekDayBasedSchedulePb, error) { - if st == nil { - return nil, nil - } - pb := &clusterAutoRestartMessageMaintenanceWindowWeekDayBasedSchedulePb{} - pb.DayOfWeek = st.DayOfWeek - pb.Frequency = st.Frequency - pb.WindowStartTime = st.WindowStartTime - - return pb, nil -} - -type clusterAutoRestartMessageMaintenanceWindowWeekDayBasedSchedulePb struct { - DayOfWeek ClusterAutoRestartMessageMaintenanceWindowDayOfWeek `json:"day_of_week,omitempty"` - Frequency ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequency `json:"frequency,omitempty"` - WindowStartTime *ClusterAutoRestartMessageMaintenanceWindowWindowStartTime `json:"window_start_time,omitempty"` -} - -func clusterAutoRestartMessageMaintenanceWindowWeekDayBasedScheduleFromPb(pb *clusterAutoRestartMessageMaintenanceWindowWeekDayBasedSchedulePb) (*ClusterAutoRestartMessageMaintenanceWindowWeekDayBasedSchedule, error) { - if pb == nil { - return nil, nil - } - st := &ClusterAutoRestartMessageMaintenanceWindowWeekDayBasedSchedule{} - st.DayOfWeek = pb.DayOfWeek - st.Frequency = pb.Frequency - st.WindowStartTime = pb.WindowStartTime - - return st, nil -} - -func clusterAutoRestartMessageMaintenanceWindowWindowStartTimeToPb(st *ClusterAutoRestartMessageMaintenanceWindowWindowStartTime) (*clusterAutoRestartMessageMaintenanceWindowWindowStartTimePb, error) { - if st == nil { - return nil, nil - } - pb := &clusterAutoRestartMessageMaintenanceWindowWindowStartTimePb{} - pb.Hours = st.Hours - pb.Minutes = st.Minutes - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type clusterAutoRestartMessageMaintenanceWindowWindowStartTimePb struct { - Hours int `json:"hours,omitempty"` - Minutes int `json:"minutes,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func clusterAutoRestartMessageMaintenanceWindowWindowStartTimeFromPb(pb *clusterAutoRestartMessageMaintenanceWindowWindowStartTimePb) (*ClusterAutoRestartMessageMaintenanceWindowWindowStartTime, error) { - if pb == nil { - return nil, nil - } - st := &ClusterAutoRestartMessageMaintenanceWindowWindowStartTime{} - st.Hours = pb.Hours - st.Minutes = pb.Minutes - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *clusterAutoRestartMessageMaintenanceWindowWindowStartTimePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st clusterAutoRestartMessageMaintenanceWindowWindowStartTimePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func complianceSecurityProfileToPb(st *ComplianceSecurityProfile) (*complianceSecurityProfilePb, error) { - if st == nil { - return nil, nil - } - pb := &complianceSecurityProfilePb{} - pb.ComplianceStandards = st.ComplianceStandards - pb.IsEnabled = st.IsEnabled - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type complianceSecurityProfilePb struct { - ComplianceStandards []ComplianceStandard `json:"compliance_standards,omitempty"` - IsEnabled bool `json:"is_enabled,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func complianceSecurityProfileFromPb(pb *complianceSecurityProfilePb) (*ComplianceSecurityProfile, error) { - if pb == nil { - return nil, nil - } - st := &ComplianceSecurityProfile{} - st.ComplianceStandards = pb.ComplianceStandards - st.IsEnabled = pb.IsEnabled - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *complianceSecurityProfilePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st complianceSecurityProfilePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func complianceSecurityProfileSettingToPb(st *ComplianceSecurityProfileSetting) (*complianceSecurityProfileSettingPb, error) { - if st == nil { - return nil, nil - } - pb := &complianceSecurityProfileSettingPb{} - pb.ComplianceSecurityProfileWorkspace = st.ComplianceSecurityProfileWorkspace - pb.Etag = st.Etag - pb.SettingName = st.SettingName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type complianceSecurityProfileSettingPb struct { - ComplianceSecurityProfileWorkspace ComplianceSecurityProfile `json:"compliance_security_profile_workspace"` - Etag string `json:"etag,omitempty"` - SettingName string `json:"setting_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func complianceSecurityProfileSettingFromPb(pb *complianceSecurityProfileSettingPb) (*ComplianceSecurityProfileSetting, error) { - if pb == nil { - return nil, nil - } - st := &ComplianceSecurityProfileSetting{} - st.ComplianceSecurityProfileWorkspace = pb.ComplianceSecurityProfileWorkspace - st.Etag = pb.Etag - st.SettingName = pb.SettingName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *complianceSecurityProfileSettingPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st complianceSecurityProfileSettingPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func configToPb(st *Config) (*configPb, error) { - if st == nil { - return nil, nil - } - pb := &configPb{} - pb.Email = st.Email - pb.GenericWebhook = st.GenericWebhook - pb.MicrosoftTeams = st.MicrosoftTeams - pb.Pagerduty = st.Pagerduty - pb.Slack = st.Slack - - return pb, nil -} - -type configPb struct { - Email *EmailConfig `json:"email,omitempty"` - GenericWebhook *GenericWebhookConfig `json:"generic_webhook,omitempty"` - MicrosoftTeams *MicrosoftTeamsConfig `json:"microsoft_teams,omitempty"` - Pagerduty *PagerdutyConfig `json:"pagerduty,omitempty"` - Slack *SlackConfig `json:"slack,omitempty"` -} - -func configFromPb(pb *configPb) (*Config, error) { - if pb == nil { - return nil, nil - } - st := &Config{} - st.Email = pb.Email - st.GenericWebhook = pb.GenericWebhook - st.MicrosoftTeams = pb.MicrosoftTeams - st.Pagerduty = pb.Pagerduty - st.Slack = pb.Slack - - return st, nil -} - -func createIpAccessListToPb(st *CreateIpAccessList) (*createIpAccessListPb, error) { - if st == nil { - return nil, nil - } - pb := &createIpAccessListPb{} - pb.IpAddresses = st.IpAddresses - pb.Label = st.Label - pb.ListType = st.ListType - - return pb, nil -} - -type createIpAccessListPb struct { - IpAddresses []string `json:"ip_addresses,omitempty"` - Label string `json:"label"` - ListType ListType `json:"list_type"` -} - -func createIpAccessListFromPb(pb *createIpAccessListPb) (*CreateIpAccessList, error) { - if pb == nil { - return nil, nil - } - st := &CreateIpAccessList{} - st.IpAddresses = pb.IpAddresses - st.Label = pb.Label - st.ListType = pb.ListType - - return st, nil -} - -func createIpAccessListResponseToPb(st *CreateIpAccessListResponse) (*createIpAccessListResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &createIpAccessListResponsePb{} - pb.IpAccessList = st.IpAccessList - - return pb, nil -} - -type createIpAccessListResponsePb struct { - IpAccessList *IpAccessListInfo `json:"ip_access_list,omitempty"` -} - -func createIpAccessListResponseFromPb(pb *createIpAccessListResponsePb) (*CreateIpAccessListResponse, error) { - if pb == nil { - return nil, nil - } - st := &CreateIpAccessListResponse{} - st.IpAccessList = pb.IpAccessList - - return st, nil -} - -func createNetworkConnectivityConfigRequestToPb(st *CreateNetworkConnectivityConfigRequest) (*createNetworkConnectivityConfigRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &createNetworkConnectivityConfigRequestPb{} - pb.NetworkConnectivityConfig = st.NetworkConnectivityConfig - - return pb, nil -} - -type createNetworkConnectivityConfigRequestPb struct { - NetworkConnectivityConfig CreateNetworkConnectivityConfiguration `json:"network_connectivity_config"` -} - -func createNetworkConnectivityConfigRequestFromPb(pb *createNetworkConnectivityConfigRequestPb) (*CreateNetworkConnectivityConfigRequest, error) { - if pb == nil { - return nil, nil - } - st := &CreateNetworkConnectivityConfigRequest{} - st.NetworkConnectivityConfig = pb.NetworkConnectivityConfig - - return st, nil -} - -func createNetworkConnectivityConfigurationToPb(st *CreateNetworkConnectivityConfiguration) (*createNetworkConnectivityConfigurationPb, error) { - if st == nil { - return nil, nil - } - pb := &createNetworkConnectivityConfigurationPb{} - pb.Name = st.Name - pb.Region = st.Region - - return pb, nil -} - -type createNetworkConnectivityConfigurationPb struct { - Name string `json:"name"` - Region string `json:"region"` -} - -func createNetworkConnectivityConfigurationFromPb(pb *createNetworkConnectivityConfigurationPb) (*CreateNetworkConnectivityConfiguration, error) { - if pb == nil { - return nil, nil - } - st := &CreateNetworkConnectivityConfiguration{} - st.Name = pb.Name - st.Region = pb.Region - - return st, nil -} - -func createNetworkPolicyRequestToPb(st *CreateNetworkPolicyRequest) (*createNetworkPolicyRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &createNetworkPolicyRequestPb{} - pb.NetworkPolicy = st.NetworkPolicy - - return pb, nil -} - -type createNetworkPolicyRequestPb struct { - NetworkPolicy AccountNetworkPolicy `json:"network_policy"` -} - -func createNetworkPolicyRequestFromPb(pb *createNetworkPolicyRequestPb) (*CreateNetworkPolicyRequest, error) { - if pb == nil { - return nil, nil - } - st := &CreateNetworkPolicyRequest{} - st.NetworkPolicy = pb.NetworkPolicy - - return st, nil -} - -func createNotificationDestinationRequestToPb(st *CreateNotificationDestinationRequest) (*createNotificationDestinationRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &createNotificationDestinationRequestPb{} - pb.Config = st.Config - pb.DisplayName = st.DisplayName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createNotificationDestinationRequestPb struct { - Config *Config `json:"config,omitempty"` - DisplayName string `json:"display_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createNotificationDestinationRequestFromPb(pb *createNotificationDestinationRequestPb) (*CreateNotificationDestinationRequest, error) { - if pb == nil { - return nil, nil - } - st := &CreateNotificationDestinationRequest{} - st.Config = pb.Config - st.DisplayName = pb.DisplayName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createNotificationDestinationRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createNotificationDestinationRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createOboTokenRequestToPb(st *CreateOboTokenRequest) (*createOboTokenRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &createOboTokenRequestPb{} - pb.ApplicationId = st.ApplicationId - pb.Comment = st.Comment - pb.LifetimeSeconds = st.LifetimeSeconds - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createOboTokenRequestPb struct { - ApplicationId string `json:"application_id"` - Comment string `json:"comment,omitempty"` - LifetimeSeconds int64 `json:"lifetime_seconds,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createOboTokenRequestFromPb(pb *createOboTokenRequestPb) (*CreateOboTokenRequest, error) { - if pb == nil { - return nil, nil - } - st := &CreateOboTokenRequest{} - st.ApplicationId = pb.ApplicationId - st.Comment = pb.Comment - st.LifetimeSeconds = pb.LifetimeSeconds - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createOboTokenRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createOboTokenRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createOboTokenResponseToPb(st *CreateOboTokenResponse) (*createOboTokenResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &createOboTokenResponsePb{} - pb.TokenInfo = st.TokenInfo - pb.TokenValue = st.TokenValue - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createOboTokenResponsePb struct { - TokenInfo *TokenInfo `json:"token_info,omitempty"` - TokenValue string `json:"token_value,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createOboTokenResponseFromPb(pb *createOboTokenResponsePb) (*CreateOboTokenResponse, error) { - if pb == nil { - return nil, nil - } - st := &CreateOboTokenResponse{} - st.TokenInfo = pb.TokenInfo - st.TokenValue = pb.TokenValue - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createOboTokenResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createOboTokenResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createPrivateEndpointRuleToPb(st *CreatePrivateEndpointRule) (*createPrivateEndpointRulePb, error) { - if st == nil { - return nil, nil - } - pb := &createPrivateEndpointRulePb{} - pb.DomainNames = st.DomainNames - pb.EndpointService = st.EndpointService - pb.GroupId = st.GroupId - pb.ResourceId = st.ResourceId - pb.ResourceNames = st.ResourceNames - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createPrivateEndpointRulePb struct { - DomainNames []string `json:"domain_names,omitempty"` - EndpointService string `json:"endpoint_service,omitempty"` - GroupId string `json:"group_id,omitempty"` - ResourceId string `json:"resource_id,omitempty"` - ResourceNames []string `json:"resource_names,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createPrivateEndpointRuleFromPb(pb *createPrivateEndpointRulePb) (*CreatePrivateEndpointRule, error) { - if pb == nil { - return nil, nil - } - st := &CreatePrivateEndpointRule{} - st.DomainNames = pb.DomainNames - st.EndpointService = pb.EndpointService - st.GroupId = pb.GroupId - st.ResourceId = pb.ResourceId - st.ResourceNames = pb.ResourceNames - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createPrivateEndpointRulePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createPrivateEndpointRulePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createPrivateEndpointRuleRequestToPb(st *CreatePrivateEndpointRuleRequest) (*createPrivateEndpointRuleRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &createPrivateEndpointRuleRequestPb{} - pb.NetworkConnectivityConfigId = st.NetworkConnectivityConfigId - pb.PrivateEndpointRule = st.PrivateEndpointRule - - return pb, nil -} - -type createPrivateEndpointRuleRequestPb struct { - NetworkConnectivityConfigId string `json:"-" url:"-"` - PrivateEndpointRule CreatePrivateEndpointRule `json:"private_endpoint_rule"` -} - -func createPrivateEndpointRuleRequestFromPb(pb *createPrivateEndpointRuleRequestPb) (*CreatePrivateEndpointRuleRequest, error) { - if pb == nil { - return nil, nil - } - st := &CreatePrivateEndpointRuleRequest{} - st.NetworkConnectivityConfigId = pb.NetworkConnectivityConfigId - st.PrivateEndpointRule = pb.PrivateEndpointRule - - return st, nil -} - -func createTokenRequestToPb(st *CreateTokenRequest) (*createTokenRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &createTokenRequestPb{} - pb.Comment = st.Comment - pb.LifetimeSeconds = st.LifetimeSeconds - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createTokenRequestPb struct { - Comment string `json:"comment,omitempty"` - LifetimeSeconds int64 `json:"lifetime_seconds,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createTokenRequestFromPb(pb *createTokenRequestPb) (*CreateTokenRequest, error) { - if pb == nil { - return nil, nil - } - st := &CreateTokenRequest{} - st.Comment = pb.Comment - st.LifetimeSeconds = pb.LifetimeSeconds - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createTokenRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createTokenRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createTokenResponseToPb(st *CreateTokenResponse) (*createTokenResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &createTokenResponsePb{} - pb.TokenInfo = st.TokenInfo - pb.TokenValue = st.TokenValue - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createTokenResponsePb struct { - TokenInfo *PublicTokenInfo `json:"token_info,omitempty"` - TokenValue string `json:"token_value,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createTokenResponseFromPb(pb *createTokenResponsePb) (*CreateTokenResponse, error) { - if pb == nil { - return nil, nil - } - st := &CreateTokenResponse{} - st.TokenInfo = pb.TokenInfo - st.TokenValue = pb.TokenValue - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createTokenResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createTokenResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func cspEnablementAccountToPb(st *CspEnablementAccount) (*cspEnablementAccountPb, error) { - if st == nil { - return nil, nil - } - pb := &cspEnablementAccountPb{} - pb.ComplianceStandards = st.ComplianceStandards - pb.IsEnforced = st.IsEnforced - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type cspEnablementAccountPb struct { - ComplianceStandards []ComplianceStandard `json:"compliance_standards,omitempty"` - IsEnforced bool `json:"is_enforced,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func cspEnablementAccountFromPb(pb *cspEnablementAccountPb) (*CspEnablementAccount, error) { - if pb == nil { - return nil, nil - } - st := &CspEnablementAccount{} - st.ComplianceStandards = pb.ComplianceStandards - st.IsEnforced = pb.IsEnforced - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *cspEnablementAccountPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st cspEnablementAccountPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func cspEnablementAccountSettingToPb(st *CspEnablementAccountSetting) (*cspEnablementAccountSettingPb, error) { - if st == nil { - return nil, nil - } - pb := &cspEnablementAccountSettingPb{} - pb.CspEnablementAccount = st.CspEnablementAccount - pb.Etag = st.Etag - pb.SettingName = st.SettingName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type cspEnablementAccountSettingPb struct { - CspEnablementAccount CspEnablementAccount `json:"csp_enablement_account"` - Etag string `json:"etag,omitempty"` - SettingName string `json:"setting_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func cspEnablementAccountSettingFromPb(pb *cspEnablementAccountSettingPb) (*CspEnablementAccountSetting, error) { - if pb == nil { - return nil, nil - } - st := &CspEnablementAccountSetting{} - st.CspEnablementAccount = pb.CspEnablementAccount - st.Etag = pb.Etag - st.SettingName = pb.SettingName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *cspEnablementAccountSettingPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st cspEnablementAccountSettingPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func customerFacingNetworkConnectivityConfigAwsPrivateEndpointRuleToPb(st *CustomerFacingNetworkConnectivityConfigAwsPrivateEndpointRule) (*customerFacingNetworkConnectivityConfigAwsPrivateEndpointRulePb, error) { - if st == nil { - return nil, nil - } - pb := &customerFacingNetworkConnectivityConfigAwsPrivateEndpointRulePb{} - pb.AccountId = st.AccountId - pb.ConnectionState = st.ConnectionState - pb.CreationTime = st.CreationTime - pb.Deactivated = st.Deactivated - pb.DeactivatedAt = st.DeactivatedAt - pb.DomainNames = st.DomainNames - pb.Enabled = st.Enabled - pb.EndpointService = st.EndpointService - pb.NetworkConnectivityConfigId = st.NetworkConnectivityConfigId - pb.ResourceNames = st.ResourceNames - pb.RuleId = st.RuleId - pb.UpdatedTime = st.UpdatedTime - pb.VpcEndpointId = st.VpcEndpointId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type customerFacingNetworkConnectivityConfigAwsPrivateEndpointRulePb struct { - AccountId string `json:"account_id,omitempty"` - ConnectionState CustomerFacingNetworkConnectivityConfigAwsPrivateEndpointRulePrivateLinkConnectionState `json:"connection_state,omitempty"` - CreationTime int64 `json:"creation_time,omitempty"` - Deactivated bool `json:"deactivated,omitempty"` - DeactivatedAt int64 `json:"deactivated_at,omitempty"` - DomainNames []string `json:"domain_names,omitempty"` - Enabled bool `json:"enabled,omitempty"` - EndpointService string `json:"endpoint_service,omitempty"` - NetworkConnectivityConfigId string `json:"network_connectivity_config_id,omitempty"` - ResourceNames []string `json:"resource_names,omitempty"` - RuleId string `json:"rule_id,omitempty"` - UpdatedTime int64 `json:"updated_time,omitempty"` - VpcEndpointId string `json:"vpc_endpoint_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func customerFacingNetworkConnectivityConfigAwsPrivateEndpointRuleFromPb(pb *customerFacingNetworkConnectivityConfigAwsPrivateEndpointRulePb) (*CustomerFacingNetworkConnectivityConfigAwsPrivateEndpointRule, error) { - if pb == nil { - return nil, nil - } - st := &CustomerFacingNetworkConnectivityConfigAwsPrivateEndpointRule{} - st.AccountId = pb.AccountId - st.ConnectionState = pb.ConnectionState - st.CreationTime = pb.CreationTime - st.Deactivated = pb.Deactivated - st.DeactivatedAt = pb.DeactivatedAt - st.DomainNames = pb.DomainNames - st.Enabled = pb.Enabled - st.EndpointService = pb.EndpointService - st.NetworkConnectivityConfigId = pb.NetworkConnectivityConfigId - st.ResourceNames = pb.ResourceNames - st.RuleId = pb.RuleId - st.UpdatedTime = pb.UpdatedTime - st.VpcEndpointId = pb.VpcEndpointId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *customerFacingNetworkConnectivityConfigAwsPrivateEndpointRulePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st customerFacingNetworkConnectivityConfigAwsPrivateEndpointRulePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func dashboardEmailSubscriptionsToPb(st *DashboardEmailSubscriptions) (*dashboardEmailSubscriptionsPb, error) { - if st == nil { - return nil, nil - } - pb := &dashboardEmailSubscriptionsPb{} - pb.BooleanVal = st.BooleanVal - pb.Etag = st.Etag - pb.SettingName = st.SettingName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type dashboardEmailSubscriptionsPb struct { - BooleanVal BooleanMessage `json:"boolean_val"` - Etag string `json:"etag,omitempty"` - SettingName string `json:"setting_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func dashboardEmailSubscriptionsFromPb(pb *dashboardEmailSubscriptionsPb) (*DashboardEmailSubscriptions, error) { - if pb == nil { - return nil, nil - } - st := &DashboardEmailSubscriptions{} - st.BooleanVal = pb.BooleanVal - st.Etag = pb.Etag - st.SettingName = pb.SettingName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *dashboardEmailSubscriptionsPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st dashboardEmailSubscriptionsPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func defaultNamespaceSettingToPb(st *DefaultNamespaceSetting) (*defaultNamespaceSettingPb, error) { - if st == nil { - return nil, nil - } - pb := &defaultNamespaceSettingPb{} - pb.Etag = st.Etag - pb.Namespace = st.Namespace - pb.SettingName = st.SettingName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type defaultNamespaceSettingPb struct { - Etag string `json:"etag,omitempty"` - Namespace StringMessage `json:"namespace"` - SettingName string `json:"setting_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func defaultNamespaceSettingFromPb(pb *defaultNamespaceSettingPb) (*DefaultNamespaceSetting, error) { - if pb == nil { - return nil, nil - } - st := &DefaultNamespaceSetting{} - st.Etag = pb.Etag - st.Namespace = pb.Namespace - st.SettingName = pb.SettingName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *defaultNamespaceSettingPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st defaultNamespaceSettingPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func deleteAccountIpAccessEnableRequestToPb(st *DeleteAccountIpAccessEnableRequest) (*deleteAccountIpAccessEnableRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteAccountIpAccessEnableRequestPb{} - pb.Etag = st.Etag - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type deleteAccountIpAccessEnableRequestPb struct { - Etag string `json:"-" url:"etag,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func deleteAccountIpAccessEnableRequestFromPb(pb *deleteAccountIpAccessEnableRequestPb) (*DeleteAccountIpAccessEnableRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteAccountIpAccessEnableRequest{} - st.Etag = pb.Etag - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *deleteAccountIpAccessEnableRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st deleteAccountIpAccessEnableRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func deleteAccountIpAccessEnableResponseToPb(st *DeleteAccountIpAccessEnableResponse) (*deleteAccountIpAccessEnableResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteAccountIpAccessEnableResponsePb{} - pb.Etag = st.Etag - - return pb, nil -} - -type deleteAccountIpAccessEnableResponsePb struct { - Etag string `json:"etag"` -} - -func deleteAccountIpAccessEnableResponseFromPb(pb *deleteAccountIpAccessEnableResponsePb) (*DeleteAccountIpAccessEnableResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteAccountIpAccessEnableResponse{} - st.Etag = pb.Etag - - return st, nil -} - -func deleteAccountIpAccessListRequestToPb(st *DeleteAccountIpAccessListRequest) (*deleteAccountIpAccessListRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteAccountIpAccessListRequestPb{} - pb.IpAccessListId = st.IpAccessListId - - return pb, nil -} - -type deleteAccountIpAccessListRequestPb struct { - IpAccessListId string `json:"-" url:"-"` -} - -func deleteAccountIpAccessListRequestFromPb(pb *deleteAccountIpAccessListRequestPb) (*DeleteAccountIpAccessListRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteAccountIpAccessListRequest{} - st.IpAccessListId = pb.IpAccessListId - - return st, nil -} - -func deleteAibiDashboardEmbeddingAccessPolicySettingRequestToPb(st *DeleteAibiDashboardEmbeddingAccessPolicySettingRequest) (*deleteAibiDashboardEmbeddingAccessPolicySettingRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteAibiDashboardEmbeddingAccessPolicySettingRequestPb{} - pb.Etag = st.Etag - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type deleteAibiDashboardEmbeddingAccessPolicySettingRequestPb struct { - Etag string `json:"-" url:"etag,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func deleteAibiDashboardEmbeddingAccessPolicySettingRequestFromPb(pb *deleteAibiDashboardEmbeddingAccessPolicySettingRequestPb) (*DeleteAibiDashboardEmbeddingAccessPolicySettingRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteAibiDashboardEmbeddingAccessPolicySettingRequest{} - st.Etag = pb.Etag - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *deleteAibiDashboardEmbeddingAccessPolicySettingRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st deleteAibiDashboardEmbeddingAccessPolicySettingRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func deleteAibiDashboardEmbeddingAccessPolicySettingResponseToPb(st *DeleteAibiDashboardEmbeddingAccessPolicySettingResponse) (*deleteAibiDashboardEmbeddingAccessPolicySettingResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteAibiDashboardEmbeddingAccessPolicySettingResponsePb{} - pb.Etag = st.Etag - - return pb, nil -} - -type deleteAibiDashboardEmbeddingAccessPolicySettingResponsePb struct { - Etag string `json:"etag"` -} - -func deleteAibiDashboardEmbeddingAccessPolicySettingResponseFromPb(pb *deleteAibiDashboardEmbeddingAccessPolicySettingResponsePb) (*DeleteAibiDashboardEmbeddingAccessPolicySettingResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteAibiDashboardEmbeddingAccessPolicySettingResponse{} - st.Etag = pb.Etag - - return st, nil -} - -func deleteAibiDashboardEmbeddingApprovedDomainsSettingRequestToPb(st *DeleteAibiDashboardEmbeddingApprovedDomainsSettingRequest) (*deleteAibiDashboardEmbeddingApprovedDomainsSettingRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteAibiDashboardEmbeddingApprovedDomainsSettingRequestPb{} - pb.Etag = st.Etag - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type deleteAibiDashboardEmbeddingApprovedDomainsSettingRequestPb struct { - Etag string `json:"-" url:"etag,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func deleteAibiDashboardEmbeddingApprovedDomainsSettingRequestFromPb(pb *deleteAibiDashboardEmbeddingApprovedDomainsSettingRequestPb) (*DeleteAibiDashboardEmbeddingApprovedDomainsSettingRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteAibiDashboardEmbeddingApprovedDomainsSettingRequest{} - st.Etag = pb.Etag - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *deleteAibiDashboardEmbeddingApprovedDomainsSettingRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st deleteAibiDashboardEmbeddingApprovedDomainsSettingRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func deleteAibiDashboardEmbeddingApprovedDomainsSettingResponseToPb(st *DeleteAibiDashboardEmbeddingApprovedDomainsSettingResponse) (*deleteAibiDashboardEmbeddingApprovedDomainsSettingResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteAibiDashboardEmbeddingApprovedDomainsSettingResponsePb{} - pb.Etag = st.Etag - - return pb, nil -} - -type deleteAibiDashboardEmbeddingApprovedDomainsSettingResponsePb struct { - Etag string `json:"etag"` -} - -func deleteAibiDashboardEmbeddingApprovedDomainsSettingResponseFromPb(pb *deleteAibiDashboardEmbeddingApprovedDomainsSettingResponsePb) (*DeleteAibiDashboardEmbeddingApprovedDomainsSettingResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteAibiDashboardEmbeddingApprovedDomainsSettingResponse{} - st.Etag = pb.Etag - - return st, nil -} - -func deleteDashboardEmailSubscriptionsRequestToPb(st *DeleteDashboardEmailSubscriptionsRequest) (*deleteDashboardEmailSubscriptionsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteDashboardEmailSubscriptionsRequestPb{} - pb.Etag = st.Etag - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type deleteDashboardEmailSubscriptionsRequestPb struct { - Etag string `json:"-" url:"etag,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func deleteDashboardEmailSubscriptionsRequestFromPb(pb *deleteDashboardEmailSubscriptionsRequestPb) (*DeleteDashboardEmailSubscriptionsRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteDashboardEmailSubscriptionsRequest{} - st.Etag = pb.Etag - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *deleteDashboardEmailSubscriptionsRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st deleteDashboardEmailSubscriptionsRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func deleteDashboardEmailSubscriptionsResponseToPb(st *DeleteDashboardEmailSubscriptionsResponse) (*deleteDashboardEmailSubscriptionsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteDashboardEmailSubscriptionsResponsePb{} - pb.Etag = st.Etag - - return pb, nil -} - -type deleteDashboardEmailSubscriptionsResponsePb struct { - Etag string `json:"etag"` -} - -func deleteDashboardEmailSubscriptionsResponseFromPb(pb *deleteDashboardEmailSubscriptionsResponsePb) (*DeleteDashboardEmailSubscriptionsResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteDashboardEmailSubscriptionsResponse{} - st.Etag = pb.Etag - - return st, nil -} - -func deleteDefaultNamespaceSettingRequestToPb(st *DeleteDefaultNamespaceSettingRequest) (*deleteDefaultNamespaceSettingRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteDefaultNamespaceSettingRequestPb{} - pb.Etag = st.Etag - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type deleteDefaultNamespaceSettingRequestPb struct { - Etag string `json:"-" url:"etag,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func deleteDefaultNamespaceSettingRequestFromPb(pb *deleteDefaultNamespaceSettingRequestPb) (*DeleteDefaultNamespaceSettingRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteDefaultNamespaceSettingRequest{} - st.Etag = pb.Etag - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *deleteDefaultNamespaceSettingRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st deleteDefaultNamespaceSettingRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func deleteDefaultNamespaceSettingResponseToPb(st *DeleteDefaultNamespaceSettingResponse) (*deleteDefaultNamespaceSettingResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteDefaultNamespaceSettingResponsePb{} - pb.Etag = st.Etag - - return pb, nil -} - -type deleteDefaultNamespaceSettingResponsePb struct { - Etag string `json:"etag"` -} - -func deleteDefaultNamespaceSettingResponseFromPb(pb *deleteDefaultNamespaceSettingResponsePb) (*DeleteDefaultNamespaceSettingResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteDefaultNamespaceSettingResponse{} - st.Etag = pb.Etag - - return st, nil -} - -func deleteDisableLegacyAccessRequestToPb(st *DeleteDisableLegacyAccessRequest) (*deleteDisableLegacyAccessRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteDisableLegacyAccessRequestPb{} - pb.Etag = st.Etag - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type deleteDisableLegacyAccessRequestPb struct { - Etag string `json:"-" url:"etag,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func deleteDisableLegacyAccessRequestFromPb(pb *deleteDisableLegacyAccessRequestPb) (*DeleteDisableLegacyAccessRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteDisableLegacyAccessRequest{} - st.Etag = pb.Etag - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *deleteDisableLegacyAccessRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st deleteDisableLegacyAccessRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func deleteDisableLegacyAccessResponseToPb(st *DeleteDisableLegacyAccessResponse) (*deleteDisableLegacyAccessResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteDisableLegacyAccessResponsePb{} - pb.Etag = st.Etag - - return pb, nil -} - -type deleteDisableLegacyAccessResponsePb struct { - Etag string `json:"etag"` -} - -func deleteDisableLegacyAccessResponseFromPb(pb *deleteDisableLegacyAccessResponsePb) (*DeleteDisableLegacyAccessResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteDisableLegacyAccessResponse{} - st.Etag = pb.Etag - - return st, nil -} - -func deleteDisableLegacyDbfsRequestToPb(st *DeleteDisableLegacyDbfsRequest) (*deleteDisableLegacyDbfsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteDisableLegacyDbfsRequestPb{} - pb.Etag = st.Etag - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type deleteDisableLegacyDbfsRequestPb struct { - Etag string `json:"-" url:"etag,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func deleteDisableLegacyDbfsRequestFromPb(pb *deleteDisableLegacyDbfsRequestPb) (*DeleteDisableLegacyDbfsRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteDisableLegacyDbfsRequest{} - st.Etag = pb.Etag - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *deleteDisableLegacyDbfsRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st deleteDisableLegacyDbfsRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func deleteDisableLegacyDbfsResponseToPb(st *DeleteDisableLegacyDbfsResponse) (*deleteDisableLegacyDbfsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteDisableLegacyDbfsResponsePb{} - pb.Etag = st.Etag - - return pb, nil -} - -type deleteDisableLegacyDbfsResponsePb struct { - Etag string `json:"etag"` -} - -func deleteDisableLegacyDbfsResponseFromPb(pb *deleteDisableLegacyDbfsResponsePb) (*DeleteDisableLegacyDbfsResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteDisableLegacyDbfsResponse{} - st.Etag = pb.Etag - - return st, nil -} - -func deleteDisableLegacyFeaturesRequestToPb(st *DeleteDisableLegacyFeaturesRequest) (*deleteDisableLegacyFeaturesRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteDisableLegacyFeaturesRequestPb{} - pb.Etag = st.Etag - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type deleteDisableLegacyFeaturesRequestPb struct { - Etag string `json:"-" url:"etag,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func deleteDisableLegacyFeaturesRequestFromPb(pb *deleteDisableLegacyFeaturesRequestPb) (*DeleteDisableLegacyFeaturesRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteDisableLegacyFeaturesRequest{} - st.Etag = pb.Etag - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *deleteDisableLegacyFeaturesRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st deleteDisableLegacyFeaturesRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func deleteDisableLegacyFeaturesResponseToPb(st *DeleteDisableLegacyFeaturesResponse) (*deleteDisableLegacyFeaturesResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteDisableLegacyFeaturesResponsePb{} - pb.Etag = st.Etag - - return pb, nil -} - -type deleteDisableLegacyFeaturesResponsePb struct { - Etag string `json:"etag"` -} - -func deleteDisableLegacyFeaturesResponseFromPb(pb *deleteDisableLegacyFeaturesResponsePb) (*DeleteDisableLegacyFeaturesResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteDisableLegacyFeaturesResponse{} - st.Etag = pb.Etag - - return st, nil -} - -func deleteIpAccessListRequestToPb(st *DeleteIpAccessListRequest) (*deleteIpAccessListRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteIpAccessListRequestPb{} - pb.IpAccessListId = st.IpAccessListId - - return pb, nil -} - -type deleteIpAccessListRequestPb struct { - IpAccessListId string `json:"-" url:"-"` -} - -func deleteIpAccessListRequestFromPb(pb *deleteIpAccessListRequestPb) (*DeleteIpAccessListRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteIpAccessListRequest{} - st.IpAccessListId = pb.IpAccessListId - - return st, nil -} - -func deleteLlmProxyPartnerPoweredWorkspaceRequestToPb(st *DeleteLlmProxyPartnerPoweredWorkspaceRequest) (*deleteLlmProxyPartnerPoweredWorkspaceRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteLlmProxyPartnerPoweredWorkspaceRequestPb{} - pb.Etag = st.Etag - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type deleteLlmProxyPartnerPoweredWorkspaceRequestPb struct { - Etag string `json:"-" url:"etag,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func deleteLlmProxyPartnerPoweredWorkspaceRequestFromPb(pb *deleteLlmProxyPartnerPoweredWorkspaceRequestPb) (*DeleteLlmProxyPartnerPoweredWorkspaceRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteLlmProxyPartnerPoweredWorkspaceRequest{} - st.Etag = pb.Etag - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *deleteLlmProxyPartnerPoweredWorkspaceRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st deleteLlmProxyPartnerPoweredWorkspaceRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func deleteLlmProxyPartnerPoweredWorkspaceResponseToPb(st *DeleteLlmProxyPartnerPoweredWorkspaceResponse) (*deleteLlmProxyPartnerPoweredWorkspaceResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteLlmProxyPartnerPoweredWorkspaceResponsePb{} - pb.Etag = st.Etag - - return pb, nil -} - -type deleteLlmProxyPartnerPoweredWorkspaceResponsePb struct { - Etag string `json:"etag"` -} - -func deleteLlmProxyPartnerPoweredWorkspaceResponseFromPb(pb *deleteLlmProxyPartnerPoweredWorkspaceResponsePb) (*DeleteLlmProxyPartnerPoweredWorkspaceResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteLlmProxyPartnerPoweredWorkspaceResponse{} - st.Etag = pb.Etag - - return st, nil -} - -func deleteNetworkConnectivityConfigurationRequestToPb(st *DeleteNetworkConnectivityConfigurationRequest) (*deleteNetworkConnectivityConfigurationRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteNetworkConnectivityConfigurationRequestPb{} - pb.NetworkConnectivityConfigId = st.NetworkConnectivityConfigId - - return pb, nil -} - -type deleteNetworkConnectivityConfigurationRequestPb struct { - NetworkConnectivityConfigId string `json:"-" url:"-"` -} - -func deleteNetworkConnectivityConfigurationRequestFromPb(pb *deleteNetworkConnectivityConfigurationRequestPb) (*DeleteNetworkConnectivityConfigurationRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteNetworkConnectivityConfigurationRequest{} - st.NetworkConnectivityConfigId = pb.NetworkConnectivityConfigId - - return st, nil -} - -func deleteNetworkConnectivityConfigurationResponseToPb(st *DeleteNetworkConnectivityConfigurationResponse) (*deleteNetworkConnectivityConfigurationResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteNetworkConnectivityConfigurationResponsePb{} - - return pb, nil -} - -type deleteNetworkConnectivityConfigurationResponsePb struct { -} - -func deleteNetworkConnectivityConfigurationResponseFromPb(pb *deleteNetworkConnectivityConfigurationResponsePb) (*DeleteNetworkConnectivityConfigurationResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteNetworkConnectivityConfigurationResponse{} - - return st, nil -} - -func deleteNetworkPolicyRequestToPb(st *DeleteNetworkPolicyRequest) (*deleteNetworkPolicyRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteNetworkPolicyRequestPb{} - pb.NetworkPolicyId = st.NetworkPolicyId - - return pb, nil -} - -type deleteNetworkPolicyRequestPb struct { - NetworkPolicyId string `json:"-" url:"-"` -} - -func deleteNetworkPolicyRequestFromPb(pb *deleteNetworkPolicyRequestPb) (*DeleteNetworkPolicyRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteNetworkPolicyRequest{} - st.NetworkPolicyId = pb.NetworkPolicyId - - return st, nil -} - -func deleteNetworkPolicyRpcResponseToPb(st *DeleteNetworkPolicyRpcResponse) (*deleteNetworkPolicyRpcResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteNetworkPolicyRpcResponsePb{} - - return pb, nil -} - -type deleteNetworkPolicyRpcResponsePb struct { -} - -func deleteNetworkPolicyRpcResponseFromPb(pb *deleteNetworkPolicyRpcResponsePb) (*DeleteNetworkPolicyRpcResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteNetworkPolicyRpcResponse{} - - return st, nil -} - -func deleteNotificationDestinationRequestToPb(st *DeleteNotificationDestinationRequest) (*deleteNotificationDestinationRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteNotificationDestinationRequestPb{} - pb.Id = st.Id - - return pb, nil -} - -type deleteNotificationDestinationRequestPb struct { - Id string `json:"-" url:"-"` -} - -func deleteNotificationDestinationRequestFromPb(pb *deleteNotificationDestinationRequestPb) (*DeleteNotificationDestinationRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteNotificationDestinationRequest{} - st.Id = pb.Id - - return st, nil -} - -func deletePersonalComputeSettingRequestToPb(st *DeletePersonalComputeSettingRequest) (*deletePersonalComputeSettingRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deletePersonalComputeSettingRequestPb{} - pb.Etag = st.Etag - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type deletePersonalComputeSettingRequestPb struct { - Etag string `json:"-" url:"etag,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func deletePersonalComputeSettingRequestFromPb(pb *deletePersonalComputeSettingRequestPb) (*DeletePersonalComputeSettingRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeletePersonalComputeSettingRequest{} - st.Etag = pb.Etag - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *deletePersonalComputeSettingRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st deletePersonalComputeSettingRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func deletePersonalComputeSettingResponseToPb(st *DeletePersonalComputeSettingResponse) (*deletePersonalComputeSettingResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deletePersonalComputeSettingResponsePb{} - pb.Etag = st.Etag - - return pb, nil -} - -type deletePersonalComputeSettingResponsePb struct { - Etag string `json:"etag"` -} - -func deletePersonalComputeSettingResponseFromPb(pb *deletePersonalComputeSettingResponsePb) (*DeletePersonalComputeSettingResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeletePersonalComputeSettingResponse{} - st.Etag = pb.Etag - - return st, nil -} - -func deletePrivateEndpointRuleRequestToPb(st *DeletePrivateEndpointRuleRequest) (*deletePrivateEndpointRuleRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deletePrivateEndpointRuleRequestPb{} - pb.NetworkConnectivityConfigId = st.NetworkConnectivityConfigId - pb.PrivateEndpointRuleId = st.PrivateEndpointRuleId - - return pb, nil -} - -type deletePrivateEndpointRuleRequestPb struct { - NetworkConnectivityConfigId string `json:"-" url:"-"` - PrivateEndpointRuleId string `json:"-" url:"-"` -} - -func deletePrivateEndpointRuleRequestFromPb(pb *deletePrivateEndpointRuleRequestPb) (*DeletePrivateEndpointRuleRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeletePrivateEndpointRuleRequest{} - st.NetworkConnectivityConfigId = pb.NetworkConnectivityConfigId - st.PrivateEndpointRuleId = pb.PrivateEndpointRuleId - - return st, nil -} - -func deleteResponseToPb(st *DeleteResponse) (*deleteResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteResponsePb{} - - return pb, nil -} - -type deleteResponsePb struct { -} - -func deleteResponseFromPb(pb *deleteResponsePb) (*DeleteResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteResponse{} - - return st, nil -} - -func deleteRestrictWorkspaceAdminsSettingRequestToPb(st *DeleteRestrictWorkspaceAdminsSettingRequest) (*deleteRestrictWorkspaceAdminsSettingRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteRestrictWorkspaceAdminsSettingRequestPb{} - pb.Etag = st.Etag - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type deleteRestrictWorkspaceAdminsSettingRequestPb struct { - Etag string `json:"-" url:"etag,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func deleteRestrictWorkspaceAdminsSettingRequestFromPb(pb *deleteRestrictWorkspaceAdminsSettingRequestPb) (*DeleteRestrictWorkspaceAdminsSettingRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteRestrictWorkspaceAdminsSettingRequest{} - st.Etag = pb.Etag - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *deleteRestrictWorkspaceAdminsSettingRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st deleteRestrictWorkspaceAdminsSettingRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func deleteRestrictWorkspaceAdminsSettingResponseToPb(st *DeleteRestrictWorkspaceAdminsSettingResponse) (*deleteRestrictWorkspaceAdminsSettingResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteRestrictWorkspaceAdminsSettingResponsePb{} - pb.Etag = st.Etag - - return pb, nil -} - -type deleteRestrictWorkspaceAdminsSettingResponsePb struct { - Etag string `json:"etag"` -} - -func deleteRestrictWorkspaceAdminsSettingResponseFromPb(pb *deleteRestrictWorkspaceAdminsSettingResponsePb) (*DeleteRestrictWorkspaceAdminsSettingResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteRestrictWorkspaceAdminsSettingResponse{} - st.Etag = pb.Etag - - return st, nil -} - -func deleteSqlResultsDownloadRequestToPb(st *DeleteSqlResultsDownloadRequest) (*deleteSqlResultsDownloadRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteSqlResultsDownloadRequestPb{} - pb.Etag = st.Etag - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type deleteSqlResultsDownloadRequestPb struct { - Etag string `json:"-" url:"etag,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func deleteSqlResultsDownloadRequestFromPb(pb *deleteSqlResultsDownloadRequestPb) (*DeleteSqlResultsDownloadRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteSqlResultsDownloadRequest{} - st.Etag = pb.Etag - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *deleteSqlResultsDownloadRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st deleteSqlResultsDownloadRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func deleteSqlResultsDownloadResponseToPb(st *DeleteSqlResultsDownloadResponse) (*deleteSqlResultsDownloadResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteSqlResultsDownloadResponsePb{} - pb.Etag = st.Etag - - return pb, nil -} - -type deleteSqlResultsDownloadResponsePb struct { - Etag string `json:"etag"` -} - -func deleteSqlResultsDownloadResponseFromPb(pb *deleteSqlResultsDownloadResponsePb) (*DeleteSqlResultsDownloadResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteSqlResultsDownloadResponse{} - st.Etag = pb.Etag - - return st, nil -} - -func deleteTokenManagementRequestToPb(st *DeleteTokenManagementRequest) (*deleteTokenManagementRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteTokenManagementRequestPb{} - pb.TokenId = st.TokenId - - return pb, nil -} - -type deleteTokenManagementRequestPb struct { - TokenId string `json:"-" url:"-"` -} - -func deleteTokenManagementRequestFromPb(pb *deleteTokenManagementRequestPb) (*DeleteTokenManagementRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteTokenManagementRequest{} - st.TokenId = pb.TokenId - - return st, nil -} - -func disableLegacyAccessToPb(st *DisableLegacyAccess) (*disableLegacyAccessPb, error) { - if st == nil { - return nil, nil - } - pb := &disableLegacyAccessPb{} - pb.DisableLegacyAccess = st.DisableLegacyAccess - pb.Etag = st.Etag - pb.SettingName = st.SettingName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type disableLegacyAccessPb struct { - DisableLegacyAccess BooleanMessage `json:"disable_legacy_access"` - Etag string `json:"etag,omitempty"` - SettingName string `json:"setting_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func disableLegacyAccessFromPb(pb *disableLegacyAccessPb) (*DisableLegacyAccess, error) { - if pb == nil { - return nil, nil - } - st := &DisableLegacyAccess{} - st.DisableLegacyAccess = pb.DisableLegacyAccess - st.Etag = pb.Etag - st.SettingName = pb.SettingName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *disableLegacyAccessPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st disableLegacyAccessPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func disableLegacyDbfsToPb(st *DisableLegacyDbfs) (*disableLegacyDbfsPb, error) { - if st == nil { - return nil, nil - } - pb := &disableLegacyDbfsPb{} - pb.DisableLegacyDbfs = st.DisableLegacyDbfs - pb.Etag = st.Etag - pb.SettingName = st.SettingName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type disableLegacyDbfsPb struct { - DisableLegacyDbfs BooleanMessage `json:"disable_legacy_dbfs"` - Etag string `json:"etag,omitempty"` - SettingName string `json:"setting_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func disableLegacyDbfsFromPb(pb *disableLegacyDbfsPb) (*DisableLegacyDbfs, error) { - if pb == nil { - return nil, nil - } - st := &DisableLegacyDbfs{} - st.DisableLegacyDbfs = pb.DisableLegacyDbfs - st.Etag = pb.Etag - st.SettingName = pb.SettingName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *disableLegacyDbfsPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st disableLegacyDbfsPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func disableLegacyFeaturesToPb(st *DisableLegacyFeatures) (*disableLegacyFeaturesPb, error) { - if st == nil { - return nil, nil - } - pb := &disableLegacyFeaturesPb{} - pb.DisableLegacyFeatures = st.DisableLegacyFeatures - pb.Etag = st.Etag - pb.SettingName = st.SettingName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type disableLegacyFeaturesPb struct { - DisableLegacyFeatures BooleanMessage `json:"disable_legacy_features"` - Etag string `json:"etag,omitempty"` - SettingName string `json:"setting_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func disableLegacyFeaturesFromPb(pb *disableLegacyFeaturesPb) (*DisableLegacyFeatures, error) { - if pb == nil { - return nil, nil - } - st := &DisableLegacyFeatures{} - st.DisableLegacyFeatures = pb.DisableLegacyFeatures - st.Etag = pb.Etag - st.SettingName = pb.SettingName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *disableLegacyFeaturesPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st disableLegacyFeaturesPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func egressNetworkPolicyToPb(st *EgressNetworkPolicy) (*egressNetworkPolicyPb, error) { - if st == nil { - return nil, nil - } - pb := &egressNetworkPolicyPb{} - pb.InternetAccess = st.InternetAccess - - return pb, nil -} - -type egressNetworkPolicyPb struct { - InternetAccess *EgressNetworkPolicyInternetAccessPolicy `json:"internet_access,omitempty"` -} - -func egressNetworkPolicyFromPb(pb *egressNetworkPolicyPb) (*EgressNetworkPolicy, error) { - if pb == nil { - return nil, nil - } - st := &EgressNetworkPolicy{} - st.InternetAccess = pb.InternetAccess - - return st, nil -} - -func egressNetworkPolicyInternetAccessPolicyToPb(st *EgressNetworkPolicyInternetAccessPolicy) (*egressNetworkPolicyInternetAccessPolicyPb, error) { - if st == nil { - return nil, nil - } - pb := &egressNetworkPolicyInternetAccessPolicyPb{} - pb.AllowedInternetDestinations = st.AllowedInternetDestinations - pb.AllowedStorageDestinations = st.AllowedStorageDestinations - pb.LogOnlyMode = st.LogOnlyMode - pb.RestrictionMode = st.RestrictionMode - - return pb, nil -} - -type egressNetworkPolicyInternetAccessPolicyPb struct { - AllowedInternetDestinations []EgressNetworkPolicyInternetAccessPolicyInternetDestination `json:"allowed_internet_destinations,omitempty"` - AllowedStorageDestinations []EgressNetworkPolicyInternetAccessPolicyStorageDestination `json:"allowed_storage_destinations,omitempty"` - LogOnlyMode *EgressNetworkPolicyInternetAccessPolicyLogOnlyMode `json:"log_only_mode,omitempty"` - RestrictionMode EgressNetworkPolicyInternetAccessPolicyRestrictionMode `json:"restriction_mode,omitempty"` -} - -func egressNetworkPolicyInternetAccessPolicyFromPb(pb *egressNetworkPolicyInternetAccessPolicyPb) (*EgressNetworkPolicyInternetAccessPolicy, error) { - if pb == nil { - return nil, nil - } - st := &EgressNetworkPolicyInternetAccessPolicy{} - st.AllowedInternetDestinations = pb.AllowedInternetDestinations - st.AllowedStorageDestinations = pb.AllowedStorageDestinations - st.LogOnlyMode = pb.LogOnlyMode - st.RestrictionMode = pb.RestrictionMode - - return st, nil -} - -func egressNetworkPolicyInternetAccessPolicyInternetDestinationToPb(st *EgressNetworkPolicyInternetAccessPolicyInternetDestination) (*egressNetworkPolicyInternetAccessPolicyInternetDestinationPb, error) { - if st == nil { - return nil, nil - } - pb := &egressNetworkPolicyInternetAccessPolicyInternetDestinationPb{} - pb.Destination = st.Destination - pb.Protocol = st.Protocol - pb.Type = st.Type - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type egressNetworkPolicyInternetAccessPolicyInternetDestinationPb struct { - Destination string `json:"destination,omitempty"` - Protocol EgressNetworkPolicyInternetAccessPolicyInternetDestinationInternetDestinationFilteringProtocol `json:"protocol,omitempty"` - Type EgressNetworkPolicyInternetAccessPolicyInternetDestinationInternetDestinationType `json:"type,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func egressNetworkPolicyInternetAccessPolicyInternetDestinationFromPb(pb *egressNetworkPolicyInternetAccessPolicyInternetDestinationPb) (*EgressNetworkPolicyInternetAccessPolicyInternetDestination, error) { - if pb == nil { - return nil, nil - } - st := &EgressNetworkPolicyInternetAccessPolicyInternetDestination{} - st.Destination = pb.Destination - st.Protocol = pb.Protocol - st.Type = pb.Type - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *egressNetworkPolicyInternetAccessPolicyInternetDestinationPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st egressNetworkPolicyInternetAccessPolicyInternetDestinationPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func egressNetworkPolicyInternetAccessPolicyLogOnlyModeToPb(st *EgressNetworkPolicyInternetAccessPolicyLogOnlyMode) (*egressNetworkPolicyInternetAccessPolicyLogOnlyModePb, error) { - if st == nil { - return nil, nil - } - pb := &egressNetworkPolicyInternetAccessPolicyLogOnlyModePb{} - pb.LogOnlyModeType = st.LogOnlyModeType - pb.Workloads = st.Workloads - - return pb, nil -} - -type egressNetworkPolicyInternetAccessPolicyLogOnlyModePb struct { - LogOnlyModeType EgressNetworkPolicyInternetAccessPolicyLogOnlyModeLogOnlyModeType `json:"log_only_mode_type,omitempty"` - Workloads []EgressNetworkPolicyInternetAccessPolicyLogOnlyModeWorkloadType `json:"workloads,omitempty"` -} - -func egressNetworkPolicyInternetAccessPolicyLogOnlyModeFromPb(pb *egressNetworkPolicyInternetAccessPolicyLogOnlyModePb) (*EgressNetworkPolicyInternetAccessPolicyLogOnlyMode, error) { - if pb == nil { - return nil, nil - } - st := &EgressNetworkPolicyInternetAccessPolicyLogOnlyMode{} - st.LogOnlyModeType = pb.LogOnlyModeType - st.Workloads = pb.Workloads - - return st, nil -} - -func egressNetworkPolicyInternetAccessPolicyStorageDestinationToPb(st *EgressNetworkPolicyInternetAccessPolicyStorageDestination) (*egressNetworkPolicyInternetAccessPolicyStorageDestinationPb, error) { - if st == nil { - return nil, nil - } - pb := &egressNetworkPolicyInternetAccessPolicyStorageDestinationPb{} - pb.AllowedPaths = st.AllowedPaths - pb.AzureContainer = st.AzureContainer - pb.AzureDnsZone = st.AzureDnsZone - pb.AzureStorageAccount = st.AzureStorageAccount - pb.AzureStorageService = st.AzureStorageService - pb.BucketName = st.BucketName - pb.Region = st.Region - pb.Type = st.Type - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type egressNetworkPolicyInternetAccessPolicyStorageDestinationPb struct { - AllowedPaths []string `json:"allowed_paths,omitempty"` - AzureContainer string `json:"azure_container,omitempty"` - AzureDnsZone string `json:"azure_dns_zone,omitempty"` - AzureStorageAccount string `json:"azure_storage_account,omitempty"` - AzureStorageService string `json:"azure_storage_service,omitempty"` - BucketName string `json:"bucket_name,omitempty"` - Region string `json:"region,omitempty"` - Type EgressNetworkPolicyInternetAccessPolicyStorageDestinationStorageDestinationType `json:"type,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func egressNetworkPolicyInternetAccessPolicyStorageDestinationFromPb(pb *egressNetworkPolicyInternetAccessPolicyStorageDestinationPb) (*EgressNetworkPolicyInternetAccessPolicyStorageDestination, error) { - if pb == nil { - return nil, nil - } - st := &EgressNetworkPolicyInternetAccessPolicyStorageDestination{} - st.AllowedPaths = pb.AllowedPaths - st.AzureContainer = pb.AzureContainer - st.AzureDnsZone = pb.AzureDnsZone - st.AzureStorageAccount = pb.AzureStorageAccount - st.AzureStorageService = pb.AzureStorageService - st.BucketName = pb.BucketName - st.Region = pb.Region - st.Type = pb.Type - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *egressNetworkPolicyInternetAccessPolicyStorageDestinationPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st egressNetworkPolicyInternetAccessPolicyStorageDestinationPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func egressNetworkPolicyNetworkAccessPolicyToPb(st *EgressNetworkPolicyNetworkAccessPolicy) (*egressNetworkPolicyNetworkAccessPolicyPb, error) { - if st == nil { - return nil, nil - } - pb := &egressNetworkPolicyNetworkAccessPolicyPb{} - pb.AllowedInternetDestinations = st.AllowedInternetDestinations - pb.AllowedStorageDestinations = st.AllowedStorageDestinations - pb.PolicyEnforcement = st.PolicyEnforcement - pb.RestrictionMode = st.RestrictionMode - - return pb, nil -} - -type egressNetworkPolicyNetworkAccessPolicyPb struct { - AllowedInternetDestinations []EgressNetworkPolicyNetworkAccessPolicyInternetDestination `json:"allowed_internet_destinations,omitempty"` - AllowedStorageDestinations []EgressNetworkPolicyNetworkAccessPolicyStorageDestination `json:"allowed_storage_destinations,omitempty"` - PolicyEnforcement *EgressNetworkPolicyNetworkAccessPolicyPolicyEnforcement `json:"policy_enforcement,omitempty"` - RestrictionMode EgressNetworkPolicyNetworkAccessPolicyRestrictionMode `json:"restriction_mode"` -} - -func egressNetworkPolicyNetworkAccessPolicyFromPb(pb *egressNetworkPolicyNetworkAccessPolicyPb) (*EgressNetworkPolicyNetworkAccessPolicy, error) { - if pb == nil { - return nil, nil - } - st := &EgressNetworkPolicyNetworkAccessPolicy{} - st.AllowedInternetDestinations = pb.AllowedInternetDestinations - st.AllowedStorageDestinations = pb.AllowedStorageDestinations - st.PolicyEnforcement = pb.PolicyEnforcement - st.RestrictionMode = pb.RestrictionMode - - return st, nil -} - -func egressNetworkPolicyNetworkAccessPolicyInternetDestinationToPb(st *EgressNetworkPolicyNetworkAccessPolicyInternetDestination) (*egressNetworkPolicyNetworkAccessPolicyInternetDestinationPb, error) { - if st == nil { - return nil, nil - } - pb := &egressNetworkPolicyNetworkAccessPolicyInternetDestinationPb{} - pb.Destination = st.Destination - pb.InternetDestinationType = st.InternetDestinationType - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type egressNetworkPolicyNetworkAccessPolicyInternetDestinationPb struct { - Destination string `json:"destination,omitempty"` - InternetDestinationType EgressNetworkPolicyNetworkAccessPolicyInternetDestinationInternetDestinationType `json:"internet_destination_type,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func egressNetworkPolicyNetworkAccessPolicyInternetDestinationFromPb(pb *egressNetworkPolicyNetworkAccessPolicyInternetDestinationPb) (*EgressNetworkPolicyNetworkAccessPolicyInternetDestination, error) { - if pb == nil { - return nil, nil - } - st := &EgressNetworkPolicyNetworkAccessPolicyInternetDestination{} - st.Destination = pb.Destination - st.InternetDestinationType = pb.InternetDestinationType - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *egressNetworkPolicyNetworkAccessPolicyInternetDestinationPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st egressNetworkPolicyNetworkAccessPolicyInternetDestinationPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func egressNetworkPolicyNetworkAccessPolicyPolicyEnforcementToPb(st *EgressNetworkPolicyNetworkAccessPolicyPolicyEnforcement) (*egressNetworkPolicyNetworkAccessPolicyPolicyEnforcementPb, error) { - if st == nil { - return nil, nil - } - pb := &egressNetworkPolicyNetworkAccessPolicyPolicyEnforcementPb{} - pb.DryRunModeProductFilter = st.DryRunModeProductFilter - pb.EnforcementMode = st.EnforcementMode - - return pb, nil -} - -type egressNetworkPolicyNetworkAccessPolicyPolicyEnforcementPb struct { - DryRunModeProductFilter []EgressNetworkPolicyNetworkAccessPolicyPolicyEnforcementDryRunModeProductFilter `json:"dry_run_mode_product_filter,omitempty"` - EnforcementMode EgressNetworkPolicyNetworkAccessPolicyPolicyEnforcementEnforcementMode `json:"enforcement_mode,omitempty"` -} - -func egressNetworkPolicyNetworkAccessPolicyPolicyEnforcementFromPb(pb *egressNetworkPolicyNetworkAccessPolicyPolicyEnforcementPb) (*EgressNetworkPolicyNetworkAccessPolicyPolicyEnforcement, error) { - if pb == nil { - return nil, nil - } - st := &EgressNetworkPolicyNetworkAccessPolicyPolicyEnforcement{} - st.DryRunModeProductFilter = pb.DryRunModeProductFilter - st.EnforcementMode = pb.EnforcementMode - - return st, nil -} - -func egressNetworkPolicyNetworkAccessPolicyStorageDestinationToPb(st *EgressNetworkPolicyNetworkAccessPolicyStorageDestination) (*egressNetworkPolicyNetworkAccessPolicyStorageDestinationPb, error) { - if st == nil { - return nil, nil - } - pb := &egressNetworkPolicyNetworkAccessPolicyStorageDestinationPb{} - pb.AzureStorageAccount = st.AzureStorageAccount - pb.AzureStorageService = st.AzureStorageService - pb.BucketName = st.BucketName - pb.Region = st.Region - pb.StorageDestinationType = st.StorageDestinationType - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type egressNetworkPolicyNetworkAccessPolicyStorageDestinationPb struct { - AzureStorageAccount string `json:"azure_storage_account,omitempty"` - AzureStorageService string `json:"azure_storage_service,omitempty"` - BucketName string `json:"bucket_name,omitempty"` - Region string `json:"region,omitempty"` - StorageDestinationType EgressNetworkPolicyNetworkAccessPolicyStorageDestinationStorageDestinationType `json:"storage_destination_type,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func egressNetworkPolicyNetworkAccessPolicyStorageDestinationFromPb(pb *egressNetworkPolicyNetworkAccessPolicyStorageDestinationPb) (*EgressNetworkPolicyNetworkAccessPolicyStorageDestination, error) { - if pb == nil { - return nil, nil - } - st := &EgressNetworkPolicyNetworkAccessPolicyStorageDestination{} - st.AzureStorageAccount = pb.AzureStorageAccount - st.AzureStorageService = pb.AzureStorageService - st.BucketName = pb.BucketName - st.Region = pb.Region - st.StorageDestinationType = pb.StorageDestinationType - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *egressNetworkPolicyNetworkAccessPolicyStorageDestinationPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st egressNetworkPolicyNetworkAccessPolicyStorageDestinationPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func emailConfigToPb(st *EmailConfig) (*emailConfigPb, error) { - if st == nil { - return nil, nil - } - pb := &emailConfigPb{} - pb.Addresses = st.Addresses - - return pb, nil -} - -type emailConfigPb struct { - Addresses []string `json:"addresses,omitempty"` -} - -func emailConfigFromPb(pb *emailConfigPb) (*EmailConfig, error) { - if pb == nil { - return nil, nil - } - st := &EmailConfig{} - st.Addresses = pb.Addresses - - return st, nil -} - -func emptyToPb(st *Empty) (*emptyPb, error) { - if st == nil { - return nil, nil - } - pb := &emptyPb{} - - return pb, nil -} - -type emptyPb struct { -} - -func emptyFromPb(pb *emptyPb) (*Empty, error) { - if pb == nil { - return nil, nil - } - st := &Empty{} - - return st, nil -} - -func enableExportNotebookToPb(st *EnableExportNotebook) (*enableExportNotebookPb, error) { - if st == nil { - return nil, nil - } - pb := &enableExportNotebookPb{} - pb.BooleanVal = st.BooleanVal - pb.SettingName = st.SettingName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type enableExportNotebookPb struct { - BooleanVal *BooleanMessage `json:"boolean_val,omitempty"` - SettingName string `json:"setting_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func enableExportNotebookFromPb(pb *enableExportNotebookPb) (*EnableExportNotebook, error) { - if pb == nil { - return nil, nil - } - st := &EnableExportNotebook{} - st.BooleanVal = pb.BooleanVal - st.SettingName = pb.SettingName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *enableExportNotebookPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st enableExportNotebookPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func enableNotebookTableClipboardToPb(st *EnableNotebookTableClipboard) (*enableNotebookTableClipboardPb, error) { - if st == nil { - return nil, nil - } - pb := &enableNotebookTableClipboardPb{} - pb.BooleanVal = st.BooleanVal - pb.SettingName = st.SettingName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type enableNotebookTableClipboardPb struct { - BooleanVal *BooleanMessage `json:"boolean_val,omitempty"` - SettingName string `json:"setting_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func enableNotebookTableClipboardFromPb(pb *enableNotebookTableClipboardPb) (*EnableNotebookTableClipboard, error) { - if pb == nil { - return nil, nil - } - st := &EnableNotebookTableClipboard{} - st.BooleanVal = pb.BooleanVal - st.SettingName = pb.SettingName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *enableNotebookTableClipboardPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st enableNotebookTableClipboardPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func enableResultsDownloadingToPb(st *EnableResultsDownloading) (*enableResultsDownloadingPb, error) { - if st == nil { - return nil, nil - } - pb := &enableResultsDownloadingPb{} - pb.BooleanVal = st.BooleanVal - pb.SettingName = st.SettingName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type enableResultsDownloadingPb struct { - BooleanVal *BooleanMessage `json:"boolean_val,omitempty"` - SettingName string `json:"setting_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func enableResultsDownloadingFromPb(pb *enableResultsDownloadingPb) (*EnableResultsDownloading, error) { - if pb == nil { - return nil, nil - } - st := &EnableResultsDownloading{} - st.BooleanVal = pb.BooleanVal - st.SettingName = pb.SettingName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *enableResultsDownloadingPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st enableResultsDownloadingPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func enhancedSecurityMonitoringToPb(st *EnhancedSecurityMonitoring) (*enhancedSecurityMonitoringPb, error) { - if st == nil { - return nil, nil - } - pb := &enhancedSecurityMonitoringPb{} - pb.IsEnabled = st.IsEnabled - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type enhancedSecurityMonitoringPb struct { - IsEnabled bool `json:"is_enabled,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func enhancedSecurityMonitoringFromPb(pb *enhancedSecurityMonitoringPb) (*EnhancedSecurityMonitoring, error) { - if pb == nil { - return nil, nil - } - st := &EnhancedSecurityMonitoring{} - st.IsEnabled = pb.IsEnabled - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *enhancedSecurityMonitoringPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st enhancedSecurityMonitoringPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func enhancedSecurityMonitoringSettingToPb(st *EnhancedSecurityMonitoringSetting) (*enhancedSecurityMonitoringSettingPb, error) { - if st == nil { - return nil, nil - } - pb := &enhancedSecurityMonitoringSettingPb{} - pb.EnhancedSecurityMonitoringWorkspace = st.EnhancedSecurityMonitoringWorkspace - pb.Etag = st.Etag - pb.SettingName = st.SettingName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type enhancedSecurityMonitoringSettingPb struct { - EnhancedSecurityMonitoringWorkspace EnhancedSecurityMonitoring `json:"enhanced_security_monitoring_workspace"` - Etag string `json:"etag,omitempty"` - SettingName string `json:"setting_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func enhancedSecurityMonitoringSettingFromPb(pb *enhancedSecurityMonitoringSettingPb) (*EnhancedSecurityMonitoringSetting, error) { - if pb == nil { - return nil, nil - } - st := &EnhancedSecurityMonitoringSetting{} - st.EnhancedSecurityMonitoringWorkspace = pb.EnhancedSecurityMonitoringWorkspace - st.Etag = pb.Etag - st.SettingName = pb.SettingName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *enhancedSecurityMonitoringSettingPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st enhancedSecurityMonitoringSettingPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func esmEnablementAccountToPb(st *EsmEnablementAccount) (*esmEnablementAccountPb, error) { - if st == nil { - return nil, nil - } - pb := &esmEnablementAccountPb{} - pb.IsEnforced = st.IsEnforced - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type esmEnablementAccountPb struct { - IsEnforced bool `json:"is_enforced,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func esmEnablementAccountFromPb(pb *esmEnablementAccountPb) (*EsmEnablementAccount, error) { - if pb == nil { - return nil, nil - } - st := &EsmEnablementAccount{} - st.IsEnforced = pb.IsEnforced - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *esmEnablementAccountPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st esmEnablementAccountPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func esmEnablementAccountSettingToPb(st *EsmEnablementAccountSetting) (*esmEnablementAccountSettingPb, error) { - if st == nil { - return nil, nil - } - pb := &esmEnablementAccountSettingPb{} - pb.EsmEnablementAccount = st.EsmEnablementAccount - pb.Etag = st.Etag - pb.SettingName = st.SettingName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type esmEnablementAccountSettingPb struct { - EsmEnablementAccount EsmEnablementAccount `json:"esm_enablement_account"` - Etag string `json:"etag,omitempty"` - SettingName string `json:"setting_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func esmEnablementAccountSettingFromPb(pb *esmEnablementAccountSettingPb) (*EsmEnablementAccountSetting, error) { - if pb == nil { - return nil, nil - } - st := &EsmEnablementAccountSetting{} - st.EsmEnablementAccount = pb.EsmEnablementAccount - st.Etag = pb.Etag - st.SettingName = pb.SettingName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *esmEnablementAccountSettingPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st esmEnablementAccountSettingPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func exchangeTokenToPb(st *ExchangeToken) (*exchangeTokenPb, error) { - if st == nil { - return nil, nil - } - pb := &exchangeTokenPb{} - pb.Credential = st.Credential - pb.CredentialEolTime = st.CredentialEolTime - pb.OwnerId = st.OwnerId - pb.Scopes = st.Scopes - pb.TokenType = st.TokenType - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type exchangeTokenPb struct { - Credential string `json:"credential,omitempty"` - CredentialEolTime int64 `json:"credentialEolTime,omitempty"` - OwnerId int64 `json:"ownerId,omitempty"` - Scopes []string `json:"scopes,omitempty"` - TokenType TokenType `json:"tokenType,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func exchangeTokenFromPb(pb *exchangeTokenPb) (*ExchangeToken, error) { - if pb == nil { - return nil, nil - } - st := &ExchangeToken{} - st.Credential = pb.Credential - st.CredentialEolTime = pb.CredentialEolTime - st.OwnerId = pb.OwnerId - st.Scopes = pb.Scopes - st.TokenType = pb.TokenType - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *exchangeTokenPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st exchangeTokenPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func exchangeTokenRequestToPb(st *ExchangeTokenRequest) (*exchangeTokenRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &exchangeTokenRequestPb{} - pb.PartitionId = st.PartitionId - pb.Scopes = st.Scopes - pb.TokenType = st.TokenType - - return pb, nil -} - -type exchangeTokenRequestPb struct { - PartitionId PartitionId `json:"partitionId"` - Scopes []string `json:"scopes"` - TokenType []TokenType `json:"tokenType"` -} - -func exchangeTokenRequestFromPb(pb *exchangeTokenRequestPb) (*ExchangeTokenRequest, error) { - if pb == nil { - return nil, nil - } - st := &ExchangeTokenRequest{} - st.PartitionId = pb.PartitionId - st.Scopes = pb.Scopes - st.TokenType = pb.TokenType - - return st, nil -} - -func exchangeTokenResponseToPb(st *ExchangeTokenResponse) (*exchangeTokenResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &exchangeTokenResponsePb{} - pb.Values = st.Values - - return pb, nil -} - -type exchangeTokenResponsePb struct { - Values []ExchangeToken `json:"values,omitempty"` -} - -func exchangeTokenResponseFromPb(pb *exchangeTokenResponsePb) (*ExchangeTokenResponse, error) { - if pb == nil { - return nil, nil - } - st := &ExchangeTokenResponse{} - st.Values = pb.Values - - return st, nil -} - -func fetchIpAccessListResponseToPb(st *FetchIpAccessListResponse) (*fetchIpAccessListResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &fetchIpAccessListResponsePb{} - pb.IpAccessList = st.IpAccessList - - return pb, nil -} - -type fetchIpAccessListResponsePb struct { - IpAccessList *IpAccessListInfo `json:"ip_access_list,omitempty"` -} - -func fetchIpAccessListResponseFromPb(pb *fetchIpAccessListResponsePb) (*FetchIpAccessListResponse, error) { - if pb == nil { - return nil, nil - } - st := &FetchIpAccessListResponse{} - st.IpAccessList = pb.IpAccessList - - return st, nil -} - -func genericWebhookConfigToPb(st *GenericWebhookConfig) (*genericWebhookConfigPb, error) { - if st == nil { - return nil, nil - } - pb := &genericWebhookConfigPb{} - pb.Password = st.Password - pb.PasswordSet = st.PasswordSet - pb.Url = st.Url - pb.UrlSet = st.UrlSet - pb.Username = st.Username - pb.UsernameSet = st.UsernameSet - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type genericWebhookConfigPb struct { - Password string `json:"password,omitempty"` - PasswordSet bool `json:"password_set,omitempty"` - Url string `json:"url,omitempty"` - UrlSet bool `json:"url_set,omitempty"` - Username string `json:"username,omitempty"` - UsernameSet bool `json:"username_set,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func genericWebhookConfigFromPb(pb *genericWebhookConfigPb) (*GenericWebhookConfig, error) { - if pb == nil { - return nil, nil - } - st := &GenericWebhookConfig{} - st.Password = pb.Password - st.PasswordSet = pb.PasswordSet - st.Url = pb.Url - st.UrlSet = pb.UrlSet - st.Username = pb.Username - st.UsernameSet = pb.UsernameSet - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *genericWebhookConfigPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st genericWebhookConfigPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getAccountIpAccessEnableRequestToPb(st *GetAccountIpAccessEnableRequest) (*getAccountIpAccessEnableRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getAccountIpAccessEnableRequestPb{} - pb.Etag = st.Etag - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getAccountIpAccessEnableRequestPb struct { - Etag string `json:"-" url:"etag,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getAccountIpAccessEnableRequestFromPb(pb *getAccountIpAccessEnableRequestPb) (*GetAccountIpAccessEnableRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetAccountIpAccessEnableRequest{} - st.Etag = pb.Etag - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getAccountIpAccessEnableRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getAccountIpAccessEnableRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getAccountIpAccessListRequestToPb(st *GetAccountIpAccessListRequest) (*getAccountIpAccessListRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getAccountIpAccessListRequestPb{} - pb.IpAccessListId = st.IpAccessListId - - return pb, nil -} - -type getAccountIpAccessListRequestPb struct { - IpAccessListId string `json:"-" url:"-"` -} - -func getAccountIpAccessListRequestFromPb(pb *getAccountIpAccessListRequestPb) (*GetAccountIpAccessListRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetAccountIpAccessListRequest{} - st.IpAccessListId = pb.IpAccessListId - - return st, nil -} - -func getAibiDashboardEmbeddingAccessPolicySettingRequestToPb(st *GetAibiDashboardEmbeddingAccessPolicySettingRequest) (*getAibiDashboardEmbeddingAccessPolicySettingRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getAibiDashboardEmbeddingAccessPolicySettingRequestPb{} - pb.Etag = st.Etag - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getAibiDashboardEmbeddingAccessPolicySettingRequestPb struct { - Etag string `json:"-" url:"etag,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getAibiDashboardEmbeddingAccessPolicySettingRequestFromPb(pb *getAibiDashboardEmbeddingAccessPolicySettingRequestPb) (*GetAibiDashboardEmbeddingAccessPolicySettingRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetAibiDashboardEmbeddingAccessPolicySettingRequest{} - st.Etag = pb.Etag - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getAibiDashboardEmbeddingAccessPolicySettingRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getAibiDashboardEmbeddingAccessPolicySettingRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getAibiDashboardEmbeddingApprovedDomainsSettingRequestToPb(st *GetAibiDashboardEmbeddingApprovedDomainsSettingRequest) (*getAibiDashboardEmbeddingApprovedDomainsSettingRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getAibiDashboardEmbeddingApprovedDomainsSettingRequestPb{} - pb.Etag = st.Etag - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getAibiDashboardEmbeddingApprovedDomainsSettingRequestPb struct { - Etag string `json:"-" url:"etag,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getAibiDashboardEmbeddingApprovedDomainsSettingRequestFromPb(pb *getAibiDashboardEmbeddingApprovedDomainsSettingRequestPb) (*GetAibiDashboardEmbeddingApprovedDomainsSettingRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetAibiDashboardEmbeddingApprovedDomainsSettingRequest{} - st.Etag = pb.Etag - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getAibiDashboardEmbeddingApprovedDomainsSettingRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getAibiDashboardEmbeddingApprovedDomainsSettingRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getAutomaticClusterUpdateSettingRequestToPb(st *GetAutomaticClusterUpdateSettingRequest) (*getAutomaticClusterUpdateSettingRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getAutomaticClusterUpdateSettingRequestPb{} - pb.Etag = st.Etag - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getAutomaticClusterUpdateSettingRequestPb struct { - Etag string `json:"-" url:"etag,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getAutomaticClusterUpdateSettingRequestFromPb(pb *getAutomaticClusterUpdateSettingRequestPb) (*GetAutomaticClusterUpdateSettingRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetAutomaticClusterUpdateSettingRequest{} - st.Etag = pb.Etag - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getAutomaticClusterUpdateSettingRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getAutomaticClusterUpdateSettingRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getComplianceSecurityProfileSettingRequestToPb(st *GetComplianceSecurityProfileSettingRequest) (*getComplianceSecurityProfileSettingRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getComplianceSecurityProfileSettingRequestPb{} - pb.Etag = st.Etag - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getComplianceSecurityProfileSettingRequestPb struct { - Etag string `json:"-" url:"etag,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getComplianceSecurityProfileSettingRequestFromPb(pb *getComplianceSecurityProfileSettingRequestPb) (*GetComplianceSecurityProfileSettingRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetComplianceSecurityProfileSettingRequest{} - st.Etag = pb.Etag - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getComplianceSecurityProfileSettingRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getComplianceSecurityProfileSettingRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getCspEnablementAccountSettingRequestToPb(st *GetCspEnablementAccountSettingRequest) (*getCspEnablementAccountSettingRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getCspEnablementAccountSettingRequestPb{} - pb.Etag = st.Etag - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getCspEnablementAccountSettingRequestPb struct { - Etag string `json:"-" url:"etag,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getCspEnablementAccountSettingRequestFromPb(pb *getCspEnablementAccountSettingRequestPb) (*GetCspEnablementAccountSettingRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetCspEnablementAccountSettingRequest{} - st.Etag = pb.Etag - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getCspEnablementAccountSettingRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getCspEnablementAccountSettingRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getDashboardEmailSubscriptionsRequestToPb(st *GetDashboardEmailSubscriptionsRequest) (*getDashboardEmailSubscriptionsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getDashboardEmailSubscriptionsRequestPb{} - pb.Etag = st.Etag - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getDashboardEmailSubscriptionsRequestPb struct { - Etag string `json:"-" url:"etag,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getDashboardEmailSubscriptionsRequestFromPb(pb *getDashboardEmailSubscriptionsRequestPb) (*GetDashboardEmailSubscriptionsRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetDashboardEmailSubscriptionsRequest{} - st.Etag = pb.Etag - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getDashboardEmailSubscriptionsRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getDashboardEmailSubscriptionsRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getDefaultNamespaceSettingRequestToPb(st *GetDefaultNamespaceSettingRequest) (*getDefaultNamespaceSettingRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getDefaultNamespaceSettingRequestPb{} - pb.Etag = st.Etag - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getDefaultNamespaceSettingRequestPb struct { - Etag string `json:"-" url:"etag,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getDefaultNamespaceSettingRequestFromPb(pb *getDefaultNamespaceSettingRequestPb) (*GetDefaultNamespaceSettingRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetDefaultNamespaceSettingRequest{} - st.Etag = pb.Etag - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getDefaultNamespaceSettingRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getDefaultNamespaceSettingRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getDisableLegacyAccessRequestToPb(st *GetDisableLegacyAccessRequest) (*getDisableLegacyAccessRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getDisableLegacyAccessRequestPb{} - pb.Etag = st.Etag - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getDisableLegacyAccessRequestPb struct { - Etag string `json:"-" url:"etag,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getDisableLegacyAccessRequestFromPb(pb *getDisableLegacyAccessRequestPb) (*GetDisableLegacyAccessRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetDisableLegacyAccessRequest{} - st.Etag = pb.Etag - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getDisableLegacyAccessRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getDisableLegacyAccessRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getDisableLegacyDbfsRequestToPb(st *GetDisableLegacyDbfsRequest) (*getDisableLegacyDbfsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getDisableLegacyDbfsRequestPb{} - pb.Etag = st.Etag - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getDisableLegacyDbfsRequestPb struct { - Etag string `json:"-" url:"etag,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getDisableLegacyDbfsRequestFromPb(pb *getDisableLegacyDbfsRequestPb) (*GetDisableLegacyDbfsRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetDisableLegacyDbfsRequest{} - st.Etag = pb.Etag - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getDisableLegacyDbfsRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getDisableLegacyDbfsRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getDisableLegacyFeaturesRequestToPb(st *GetDisableLegacyFeaturesRequest) (*getDisableLegacyFeaturesRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getDisableLegacyFeaturesRequestPb{} - pb.Etag = st.Etag - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getDisableLegacyFeaturesRequestPb struct { - Etag string `json:"-" url:"etag,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getDisableLegacyFeaturesRequestFromPb(pb *getDisableLegacyFeaturesRequestPb) (*GetDisableLegacyFeaturesRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetDisableLegacyFeaturesRequest{} - st.Etag = pb.Etag - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getDisableLegacyFeaturesRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getDisableLegacyFeaturesRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getEnhancedSecurityMonitoringSettingRequestToPb(st *GetEnhancedSecurityMonitoringSettingRequest) (*getEnhancedSecurityMonitoringSettingRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getEnhancedSecurityMonitoringSettingRequestPb{} - pb.Etag = st.Etag - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getEnhancedSecurityMonitoringSettingRequestPb struct { - Etag string `json:"-" url:"etag,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getEnhancedSecurityMonitoringSettingRequestFromPb(pb *getEnhancedSecurityMonitoringSettingRequestPb) (*GetEnhancedSecurityMonitoringSettingRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetEnhancedSecurityMonitoringSettingRequest{} - st.Etag = pb.Etag - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getEnhancedSecurityMonitoringSettingRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getEnhancedSecurityMonitoringSettingRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getEsmEnablementAccountSettingRequestToPb(st *GetEsmEnablementAccountSettingRequest) (*getEsmEnablementAccountSettingRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getEsmEnablementAccountSettingRequestPb{} - pb.Etag = st.Etag - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getEsmEnablementAccountSettingRequestPb struct { - Etag string `json:"-" url:"etag,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getEsmEnablementAccountSettingRequestFromPb(pb *getEsmEnablementAccountSettingRequestPb) (*GetEsmEnablementAccountSettingRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetEsmEnablementAccountSettingRequest{} - st.Etag = pb.Etag - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getEsmEnablementAccountSettingRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getEsmEnablementAccountSettingRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getIpAccessListRequestToPb(st *GetIpAccessListRequest) (*getIpAccessListRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getIpAccessListRequestPb{} - pb.IpAccessListId = st.IpAccessListId - - return pb, nil -} - -type getIpAccessListRequestPb struct { - IpAccessListId string `json:"-" url:"-"` -} - -func getIpAccessListRequestFromPb(pb *getIpAccessListRequestPb) (*GetIpAccessListRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetIpAccessListRequest{} - st.IpAccessListId = pb.IpAccessListId - - return st, nil -} - -func getIpAccessListResponseToPb(st *GetIpAccessListResponse) (*getIpAccessListResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &getIpAccessListResponsePb{} - pb.IpAccessList = st.IpAccessList - - return pb, nil -} - -type getIpAccessListResponsePb struct { - IpAccessList *IpAccessListInfo `json:"ip_access_list,omitempty"` -} - -func getIpAccessListResponseFromPb(pb *getIpAccessListResponsePb) (*GetIpAccessListResponse, error) { - if pb == nil { - return nil, nil - } - st := &GetIpAccessListResponse{} - st.IpAccessList = pb.IpAccessList - - return st, nil -} - -func getIpAccessListsResponseToPb(st *GetIpAccessListsResponse) (*getIpAccessListsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &getIpAccessListsResponsePb{} - pb.IpAccessLists = st.IpAccessLists - - return pb, nil -} - -type getIpAccessListsResponsePb struct { - IpAccessLists []IpAccessListInfo `json:"ip_access_lists,omitempty"` -} - -func getIpAccessListsResponseFromPb(pb *getIpAccessListsResponsePb) (*GetIpAccessListsResponse, error) { - if pb == nil { - return nil, nil - } - st := &GetIpAccessListsResponse{} - st.IpAccessLists = pb.IpAccessLists - - return st, nil -} - -func getLlmProxyPartnerPoweredAccountRequestToPb(st *GetLlmProxyPartnerPoweredAccountRequest) (*getLlmProxyPartnerPoweredAccountRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getLlmProxyPartnerPoweredAccountRequestPb{} - pb.Etag = st.Etag - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getLlmProxyPartnerPoweredAccountRequestPb struct { - Etag string `json:"-" url:"etag,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getLlmProxyPartnerPoweredAccountRequestFromPb(pb *getLlmProxyPartnerPoweredAccountRequestPb) (*GetLlmProxyPartnerPoweredAccountRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetLlmProxyPartnerPoweredAccountRequest{} - st.Etag = pb.Etag - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getLlmProxyPartnerPoweredAccountRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getLlmProxyPartnerPoweredAccountRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getLlmProxyPartnerPoweredEnforceRequestToPb(st *GetLlmProxyPartnerPoweredEnforceRequest) (*getLlmProxyPartnerPoweredEnforceRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getLlmProxyPartnerPoweredEnforceRequestPb{} - pb.Etag = st.Etag - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getLlmProxyPartnerPoweredEnforceRequestPb struct { - Etag string `json:"-" url:"etag,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getLlmProxyPartnerPoweredEnforceRequestFromPb(pb *getLlmProxyPartnerPoweredEnforceRequestPb) (*GetLlmProxyPartnerPoweredEnforceRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetLlmProxyPartnerPoweredEnforceRequest{} - st.Etag = pb.Etag - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getLlmProxyPartnerPoweredEnforceRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getLlmProxyPartnerPoweredEnforceRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getLlmProxyPartnerPoweredWorkspaceRequestToPb(st *GetLlmProxyPartnerPoweredWorkspaceRequest) (*getLlmProxyPartnerPoweredWorkspaceRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getLlmProxyPartnerPoweredWorkspaceRequestPb{} - pb.Etag = st.Etag - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getLlmProxyPartnerPoweredWorkspaceRequestPb struct { - Etag string `json:"-" url:"etag,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getLlmProxyPartnerPoweredWorkspaceRequestFromPb(pb *getLlmProxyPartnerPoweredWorkspaceRequestPb) (*GetLlmProxyPartnerPoweredWorkspaceRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetLlmProxyPartnerPoweredWorkspaceRequest{} - st.Etag = pb.Etag - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getLlmProxyPartnerPoweredWorkspaceRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getLlmProxyPartnerPoweredWorkspaceRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getNetworkConnectivityConfigurationRequestToPb(st *GetNetworkConnectivityConfigurationRequest) (*getNetworkConnectivityConfigurationRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getNetworkConnectivityConfigurationRequestPb{} - pb.NetworkConnectivityConfigId = st.NetworkConnectivityConfigId - - return pb, nil -} - -type getNetworkConnectivityConfigurationRequestPb struct { - NetworkConnectivityConfigId string `json:"-" url:"-"` -} - -func getNetworkConnectivityConfigurationRequestFromPb(pb *getNetworkConnectivityConfigurationRequestPb) (*GetNetworkConnectivityConfigurationRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetNetworkConnectivityConfigurationRequest{} - st.NetworkConnectivityConfigId = pb.NetworkConnectivityConfigId - - return st, nil -} - -func getNetworkPolicyRequestToPb(st *GetNetworkPolicyRequest) (*getNetworkPolicyRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getNetworkPolicyRequestPb{} - pb.NetworkPolicyId = st.NetworkPolicyId - - return pb, nil -} - -type getNetworkPolicyRequestPb struct { - NetworkPolicyId string `json:"-" url:"-"` -} - -func getNetworkPolicyRequestFromPb(pb *getNetworkPolicyRequestPb) (*GetNetworkPolicyRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetNetworkPolicyRequest{} - st.NetworkPolicyId = pb.NetworkPolicyId - - return st, nil -} - -func getNotificationDestinationRequestToPb(st *GetNotificationDestinationRequest) (*getNotificationDestinationRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getNotificationDestinationRequestPb{} - pb.Id = st.Id - - return pb, nil -} - -type getNotificationDestinationRequestPb struct { - Id string `json:"-" url:"-"` -} - -func getNotificationDestinationRequestFromPb(pb *getNotificationDestinationRequestPb) (*GetNotificationDestinationRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetNotificationDestinationRequest{} - st.Id = pb.Id - - return st, nil -} - -func getPersonalComputeSettingRequestToPb(st *GetPersonalComputeSettingRequest) (*getPersonalComputeSettingRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getPersonalComputeSettingRequestPb{} - pb.Etag = st.Etag - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getPersonalComputeSettingRequestPb struct { - Etag string `json:"-" url:"etag,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getPersonalComputeSettingRequestFromPb(pb *getPersonalComputeSettingRequestPb) (*GetPersonalComputeSettingRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetPersonalComputeSettingRequest{} - st.Etag = pb.Etag - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getPersonalComputeSettingRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getPersonalComputeSettingRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getPrivateEndpointRuleRequestToPb(st *GetPrivateEndpointRuleRequest) (*getPrivateEndpointRuleRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getPrivateEndpointRuleRequestPb{} - pb.NetworkConnectivityConfigId = st.NetworkConnectivityConfigId - pb.PrivateEndpointRuleId = st.PrivateEndpointRuleId - - return pb, nil -} - -type getPrivateEndpointRuleRequestPb struct { - NetworkConnectivityConfigId string `json:"-" url:"-"` - PrivateEndpointRuleId string `json:"-" url:"-"` -} - -func getPrivateEndpointRuleRequestFromPb(pb *getPrivateEndpointRuleRequestPb) (*GetPrivateEndpointRuleRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetPrivateEndpointRuleRequest{} - st.NetworkConnectivityConfigId = pb.NetworkConnectivityConfigId - st.PrivateEndpointRuleId = pb.PrivateEndpointRuleId - - return st, nil -} - -func getRestrictWorkspaceAdminsSettingRequestToPb(st *GetRestrictWorkspaceAdminsSettingRequest) (*getRestrictWorkspaceAdminsSettingRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getRestrictWorkspaceAdminsSettingRequestPb{} - pb.Etag = st.Etag - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getRestrictWorkspaceAdminsSettingRequestPb struct { - Etag string `json:"-" url:"etag,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getRestrictWorkspaceAdminsSettingRequestFromPb(pb *getRestrictWorkspaceAdminsSettingRequestPb) (*GetRestrictWorkspaceAdminsSettingRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetRestrictWorkspaceAdminsSettingRequest{} - st.Etag = pb.Etag - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getRestrictWorkspaceAdminsSettingRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getRestrictWorkspaceAdminsSettingRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getSqlResultsDownloadRequestToPb(st *GetSqlResultsDownloadRequest) (*getSqlResultsDownloadRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getSqlResultsDownloadRequestPb{} - pb.Etag = st.Etag - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getSqlResultsDownloadRequestPb struct { - Etag string `json:"-" url:"etag,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getSqlResultsDownloadRequestFromPb(pb *getSqlResultsDownloadRequestPb) (*GetSqlResultsDownloadRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetSqlResultsDownloadRequest{} - st.Etag = pb.Etag - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getSqlResultsDownloadRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getSqlResultsDownloadRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getStatusRequestToPb(st *GetStatusRequest) (*getStatusRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getStatusRequestPb{} - pb.Keys = st.Keys - - return pb, nil -} - -type getStatusRequestPb struct { - Keys string `json:"-" url:"keys"` -} - -func getStatusRequestFromPb(pb *getStatusRequestPb) (*GetStatusRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetStatusRequest{} - st.Keys = pb.Keys - - return st, nil -} - -func getTokenManagementRequestToPb(st *GetTokenManagementRequest) (*getTokenManagementRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getTokenManagementRequestPb{} - pb.TokenId = st.TokenId - - return pb, nil -} - -type getTokenManagementRequestPb struct { - TokenId string `json:"-" url:"-"` -} - -func getTokenManagementRequestFromPb(pb *getTokenManagementRequestPb) (*GetTokenManagementRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetTokenManagementRequest{} - st.TokenId = pb.TokenId - - return st, nil -} - -func getTokenPermissionLevelsResponseToPb(st *GetTokenPermissionLevelsResponse) (*getTokenPermissionLevelsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &getTokenPermissionLevelsResponsePb{} - pb.PermissionLevels = st.PermissionLevels - - return pb, nil -} - -type getTokenPermissionLevelsResponsePb struct { - PermissionLevels []TokenPermissionsDescription `json:"permission_levels,omitempty"` -} - -func getTokenPermissionLevelsResponseFromPb(pb *getTokenPermissionLevelsResponsePb) (*GetTokenPermissionLevelsResponse, error) { - if pb == nil { - return nil, nil - } - st := &GetTokenPermissionLevelsResponse{} - st.PermissionLevels = pb.PermissionLevels - - return st, nil -} - -func getTokenResponseToPb(st *GetTokenResponse) (*getTokenResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &getTokenResponsePb{} - pb.TokenInfo = st.TokenInfo - - return pb, nil -} - -type getTokenResponsePb struct { - TokenInfo *TokenInfo `json:"token_info,omitempty"` -} - -func getTokenResponseFromPb(pb *getTokenResponsePb) (*GetTokenResponse, error) { - if pb == nil { - return nil, nil - } - st := &GetTokenResponse{} - st.TokenInfo = pb.TokenInfo - - return st, nil -} - -func getWorkspaceNetworkOptionRequestToPb(st *GetWorkspaceNetworkOptionRequest) (*getWorkspaceNetworkOptionRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getWorkspaceNetworkOptionRequestPb{} - pb.WorkspaceId = st.WorkspaceId - - return pb, nil -} - -type getWorkspaceNetworkOptionRequestPb struct { - WorkspaceId int64 `json:"-" url:"-"` -} - -func getWorkspaceNetworkOptionRequestFromPb(pb *getWorkspaceNetworkOptionRequestPb) (*GetWorkspaceNetworkOptionRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetWorkspaceNetworkOptionRequest{} - st.WorkspaceId = pb.WorkspaceId - - return st, nil -} - -func ipAccessListInfoToPb(st *IpAccessListInfo) (*ipAccessListInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &ipAccessListInfoPb{} - pb.AddressCount = st.AddressCount - pb.CreatedAt = st.CreatedAt - pb.CreatedBy = st.CreatedBy - pb.Enabled = st.Enabled - pb.IpAddresses = st.IpAddresses - pb.Label = st.Label - pb.ListId = st.ListId - pb.ListType = st.ListType - pb.UpdatedAt = st.UpdatedAt - pb.UpdatedBy = st.UpdatedBy - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type ipAccessListInfoPb struct { - AddressCount int `json:"address_count,omitempty"` - CreatedAt int64 `json:"created_at,omitempty"` - CreatedBy int64 `json:"created_by,omitempty"` - Enabled bool `json:"enabled,omitempty"` - IpAddresses []string `json:"ip_addresses,omitempty"` - Label string `json:"label,omitempty"` - ListId string `json:"list_id,omitempty"` - ListType ListType `json:"list_type,omitempty"` - UpdatedAt int64 `json:"updated_at,omitempty"` - UpdatedBy int64 `json:"updated_by,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func ipAccessListInfoFromPb(pb *ipAccessListInfoPb) (*IpAccessListInfo, error) { - if pb == nil { - return nil, nil - } - st := &IpAccessListInfo{} - st.AddressCount = pb.AddressCount - st.CreatedAt = pb.CreatedAt - st.CreatedBy = pb.CreatedBy - st.Enabled = pb.Enabled - st.IpAddresses = pb.IpAddresses - st.Label = pb.Label - st.ListId = pb.ListId - st.ListType = pb.ListType - st.UpdatedAt = pb.UpdatedAt - st.UpdatedBy = pb.UpdatedBy - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *ipAccessListInfoPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st ipAccessListInfoPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listIpAccessListResponseToPb(st *ListIpAccessListResponse) (*listIpAccessListResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listIpAccessListResponsePb{} - pb.IpAccessLists = st.IpAccessLists - - return pb, nil -} - -type listIpAccessListResponsePb struct { - IpAccessLists []IpAccessListInfo `json:"ip_access_lists,omitempty"` -} - -func listIpAccessListResponseFromPb(pb *listIpAccessListResponsePb) (*ListIpAccessListResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListIpAccessListResponse{} - st.IpAccessLists = pb.IpAccessLists - - return st, nil -} - -func listNetworkConnectivityConfigurationsRequestToPb(st *ListNetworkConnectivityConfigurationsRequest) (*listNetworkConnectivityConfigurationsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listNetworkConnectivityConfigurationsRequestPb{} - pb.PageToken = st.PageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listNetworkConnectivityConfigurationsRequestPb struct { - PageToken string `json:"-" url:"page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listNetworkConnectivityConfigurationsRequestFromPb(pb *listNetworkConnectivityConfigurationsRequestPb) (*ListNetworkConnectivityConfigurationsRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListNetworkConnectivityConfigurationsRequest{} - st.PageToken = pb.PageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listNetworkConnectivityConfigurationsRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listNetworkConnectivityConfigurationsRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listNetworkConnectivityConfigurationsResponseToPb(st *ListNetworkConnectivityConfigurationsResponse) (*listNetworkConnectivityConfigurationsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listNetworkConnectivityConfigurationsResponsePb{} - pb.Items = st.Items - pb.NextPageToken = st.NextPageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listNetworkConnectivityConfigurationsResponsePb struct { - Items []NetworkConnectivityConfiguration `json:"items,omitempty"` - NextPageToken string `json:"next_page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listNetworkConnectivityConfigurationsResponseFromPb(pb *listNetworkConnectivityConfigurationsResponsePb) (*ListNetworkConnectivityConfigurationsResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListNetworkConnectivityConfigurationsResponse{} - st.Items = pb.Items - st.NextPageToken = pb.NextPageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listNetworkConnectivityConfigurationsResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listNetworkConnectivityConfigurationsResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listNetworkPoliciesRequestToPb(st *ListNetworkPoliciesRequest) (*listNetworkPoliciesRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listNetworkPoliciesRequestPb{} - pb.PageToken = st.PageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listNetworkPoliciesRequestPb struct { - PageToken string `json:"-" url:"page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listNetworkPoliciesRequestFromPb(pb *listNetworkPoliciesRequestPb) (*ListNetworkPoliciesRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListNetworkPoliciesRequest{} - st.PageToken = pb.PageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listNetworkPoliciesRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listNetworkPoliciesRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listNetworkPoliciesResponseToPb(st *ListNetworkPoliciesResponse) (*listNetworkPoliciesResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listNetworkPoliciesResponsePb{} - pb.Items = st.Items - pb.NextPageToken = st.NextPageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listNetworkPoliciesResponsePb struct { - Items []AccountNetworkPolicy `json:"items,omitempty"` - NextPageToken string `json:"next_page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listNetworkPoliciesResponseFromPb(pb *listNetworkPoliciesResponsePb) (*ListNetworkPoliciesResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListNetworkPoliciesResponse{} - st.Items = pb.Items - st.NextPageToken = pb.NextPageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listNetworkPoliciesResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listNetworkPoliciesResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listNotificationDestinationsRequestToPb(st *ListNotificationDestinationsRequest) (*listNotificationDestinationsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listNotificationDestinationsRequestPb{} - pb.PageSize = st.PageSize - pb.PageToken = st.PageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listNotificationDestinationsRequestPb struct { - PageSize int64 `json:"-" url:"page_size,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listNotificationDestinationsRequestFromPb(pb *listNotificationDestinationsRequestPb) (*ListNotificationDestinationsRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListNotificationDestinationsRequest{} - st.PageSize = pb.PageSize - st.PageToken = pb.PageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listNotificationDestinationsRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listNotificationDestinationsRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listNotificationDestinationsResponseToPb(st *ListNotificationDestinationsResponse) (*listNotificationDestinationsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listNotificationDestinationsResponsePb{} - pb.NextPageToken = st.NextPageToken - pb.Results = st.Results - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listNotificationDestinationsResponsePb struct { - NextPageToken string `json:"next_page_token,omitempty"` - Results []ListNotificationDestinationsResult `json:"results,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listNotificationDestinationsResponseFromPb(pb *listNotificationDestinationsResponsePb) (*ListNotificationDestinationsResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListNotificationDestinationsResponse{} - st.NextPageToken = pb.NextPageToken - st.Results = pb.Results - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listNotificationDestinationsResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listNotificationDestinationsResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listNotificationDestinationsResultToPb(st *ListNotificationDestinationsResult) (*listNotificationDestinationsResultPb, error) { - if st == nil { - return nil, nil - } - pb := &listNotificationDestinationsResultPb{} - pb.DestinationType = st.DestinationType - pb.DisplayName = st.DisplayName - pb.Id = st.Id - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listNotificationDestinationsResultPb struct { - DestinationType DestinationType `json:"destination_type,omitempty"` - DisplayName string `json:"display_name,omitempty"` - Id string `json:"id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listNotificationDestinationsResultFromPb(pb *listNotificationDestinationsResultPb) (*ListNotificationDestinationsResult, error) { - if pb == nil { - return nil, nil - } - st := &ListNotificationDestinationsResult{} - st.DestinationType = pb.DestinationType - st.DisplayName = pb.DisplayName - st.Id = pb.Id - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listNotificationDestinationsResultPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listNotificationDestinationsResultPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listPrivateEndpointRulesRequestToPb(st *ListPrivateEndpointRulesRequest) (*listPrivateEndpointRulesRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listPrivateEndpointRulesRequestPb{} - pb.NetworkConnectivityConfigId = st.NetworkConnectivityConfigId - pb.PageToken = st.PageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listPrivateEndpointRulesRequestPb struct { - NetworkConnectivityConfigId string `json:"-" url:"-"` - PageToken string `json:"-" url:"page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listPrivateEndpointRulesRequestFromPb(pb *listPrivateEndpointRulesRequestPb) (*ListPrivateEndpointRulesRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListPrivateEndpointRulesRequest{} - st.NetworkConnectivityConfigId = pb.NetworkConnectivityConfigId - st.PageToken = pb.PageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listPrivateEndpointRulesRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listPrivateEndpointRulesRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listPrivateEndpointRulesResponseToPb(st *ListPrivateEndpointRulesResponse) (*listPrivateEndpointRulesResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listPrivateEndpointRulesResponsePb{} - pb.Items = st.Items - pb.NextPageToken = st.NextPageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listPrivateEndpointRulesResponsePb struct { - Items []NccPrivateEndpointRule `json:"items,omitempty"` - NextPageToken string `json:"next_page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listPrivateEndpointRulesResponseFromPb(pb *listPrivateEndpointRulesResponsePb) (*ListPrivateEndpointRulesResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListPrivateEndpointRulesResponse{} - st.Items = pb.Items - st.NextPageToken = pb.NextPageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listPrivateEndpointRulesResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listPrivateEndpointRulesResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listPublicTokensResponseToPb(st *ListPublicTokensResponse) (*listPublicTokensResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listPublicTokensResponsePb{} - pb.TokenInfos = st.TokenInfos - - return pb, nil -} - -type listPublicTokensResponsePb struct { - TokenInfos []PublicTokenInfo `json:"token_infos,omitempty"` -} - -func listPublicTokensResponseFromPb(pb *listPublicTokensResponsePb) (*ListPublicTokensResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListPublicTokensResponse{} - st.TokenInfos = pb.TokenInfos - - return st, nil -} - -func listTokenManagementRequestToPb(st *ListTokenManagementRequest) (*listTokenManagementRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listTokenManagementRequestPb{} - pb.CreatedById = st.CreatedById - pb.CreatedByUsername = st.CreatedByUsername - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listTokenManagementRequestPb struct { - CreatedById int64 `json:"-" url:"created_by_id,omitempty"` - CreatedByUsername string `json:"-" url:"created_by_username,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listTokenManagementRequestFromPb(pb *listTokenManagementRequestPb) (*ListTokenManagementRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListTokenManagementRequest{} - st.CreatedById = pb.CreatedById - st.CreatedByUsername = pb.CreatedByUsername - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listTokenManagementRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listTokenManagementRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listTokensResponseToPb(st *ListTokensResponse) (*listTokensResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listTokensResponsePb{} - pb.TokenInfos = st.TokenInfos - - return pb, nil -} - -type listTokensResponsePb struct { - TokenInfos []TokenInfo `json:"token_infos,omitempty"` -} - -func listTokensResponseFromPb(pb *listTokensResponsePb) (*ListTokensResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListTokensResponse{} - st.TokenInfos = pb.TokenInfos - - return st, nil -} - -func llmProxyPartnerPoweredAccountToPb(st *LlmProxyPartnerPoweredAccount) (*llmProxyPartnerPoweredAccountPb, error) { - if st == nil { - return nil, nil - } - pb := &llmProxyPartnerPoweredAccountPb{} - pb.BooleanVal = st.BooleanVal - pb.Etag = st.Etag - pb.SettingName = st.SettingName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type llmProxyPartnerPoweredAccountPb struct { - BooleanVal BooleanMessage `json:"boolean_val"` - Etag string `json:"etag,omitempty"` - SettingName string `json:"setting_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func llmProxyPartnerPoweredAccountFromPb(pb *llmProxyPartnerPoweredAccountPb) (*LlmProxyPartnerPoweredAccount, error) { - if pb == nil { - return nil, nil - } - st := &LlmProxyPartnerPoweredAccount{} - st.BooleanVal = pb.BooleanVal - st.Etag = pb.Etag - st.SettingName = pb.SettingName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *llmProxyPartnerPoweredAccountPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st llmProxyPartnerPoweredAccountPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func llmProxyPartnerPoweredEnforceToPb(st *LlmProxyPartnerPoweredEnforce) (*llmProxyPartnerPoweredEnforcePb, error) { - if st == nil { - return nil, nil - } - pb := &llmProxyPartnerPoweredEnforcePb{} - pb.BooleanVal = st.BooleanVal - pb.Etag = st.Etag - pb.SettingName = st.SettingName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type llmProxyPartnerPoweredEnforcePb struct { - BooleanVal BooleanMessage `json:"boolean_val"` - Etag string `json:"etag,omitempty"` - SettingName string `json:"setting_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func llmProxyPartnerPoweredEnforceFromPb(pb *llmProxyPartnerPoweredEnforcePb) (*LlmProxyPartnerPoweredEnforce, error) { - if pb == nil { - return nil, nil - } - st := &LlmProxyPartnerPoweredEnforce{} - st.BooleanVal = pb.BooleanVal - st.Etag = pb.Etag - st.SettingName = pb.SettingName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *llmProxyPartnerPoweredEnforcePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st llmProxyPartnerPoweredEnforcePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func llmProxyPartnerPoweredWorkspaceToPb(st *LlmProxyPartnerPoweredWorkspace) (*llmProxyPartnerPoweredWorkspacePb, error) { - if st == nil { - return nil, nil - } - pb := &llmProxyPartnerPoweredWorkspacePb{} - pb.BooleanVal = st.BooleanVal - pb.Etag = st.Etag - pb.SettingName = st.SettingName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type llmProxyPartnerPoweredWorkspacePb struct { - BooleanVal BooleanMessage `json:"boolean_val"` - Etag string `json:"etag,omitempty"` - SettingName string `json:"setting_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func llmProxyPartnerPoweredWorkspaceFromPb(pb *llmProxyPartnerPoweredWorkspacePb) (*LlmProxyPartnerPoweredWorkspace, error) { - if pb == nil { - return nil, nil - } - st := &LlmProxyPartnerPoweredWorkspace{} - st.BooleanVal = pb.BooleanVal - st.Etag = pb.Etag - st.SettingName = pb.SettingName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *llmProxyPartnerPoweredWorkspacePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st llmProxyPartnerPoweredWorkspacePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func microsoftTeamsConfigToPb(st *MicrosoftTeamsConfig) (*microsoftTeamsConfigPb, error) { - if st == nil { - return nil, nil - } - pb := µsoftTeamsConfigPb{} - pb.Url = st.Url - pb.UrlSet = st.UrlSet - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type microsoftTeamsConfigPb struct { - Url string `json:"url,omitempty"` - UrlSet bool `json:"url_set,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func microsoftTeamsConfigFromPb(pb *microsoftTeamsConfigPb) (*MicrosoftTeamsConfig, error) { - if pb == nil { - return nil, nil - } - st := &MicrosoftTeamsConfig{} - st.Url = pb.Url - st.UrlSet = pb.UrlSet - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *microsoftTeamsConfigPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st microsoftTeamsConfigPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func nccAwsStableIpRuleToPb(st *NccAwsStableIpRule) (*nccAwsStableIpRulePb, error) { - if st == nil { - return nil, nil - } - pb := &nccAwsStableIpRulePb{} - pb.CidrBlocks = st.CidrBlocks - - return pb, nil -} - -type nccAwsStableIpRulePb struct { - CidrBlocks []string `json:"cidr_blocks,omitempty"` -} - -func nccAwsStableIpRuleFromPb(pb *nccAwsStableIpRulePb) (*NccAwsStableIpRule, error) { - if pb == nil { - return nil, nil - } - st := &NccAwsStableIpRule{} - st.CidrBlocks = pb.CidrBlocks - - return st, nil -} - -func nccAzurePrivateEndpointRuleToPb(st *NccAzurePrivateEndpointRule) (*nccAzurePrivateEndpointRulePb, error) { - if st == nil { - return nil, nil - } - pb := &nccAzurePrivateEndpointRulePb{} - pb.ConnectionState = st.ConnectionState - pb.CreationTime = st.CreationTime - pb.Deactivated = st.Deactivated - pb.DeactivatedAt = st.DeactivatedAt - pb.DomainNames = st.DomainNames - pb.EndpointName = st.EndpointName - pb.GroupId = st.GroupId - pb.NetworkConnectivityConfigId = st.NetworkConnectivityConfigId - pb.ResourceId = st.ResourceId - pb.RuleId = st.RuleId - pb.UpdatedTime = st.UpdatedTime - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type nccAzurePrivateEndpointRulePb struct { - ConnectionState NccAzurePrivateEndpointRuleConnectionState `json:"connection_state,omitempty"` - CreationTime int64 `json:"creation_time,omitempty"` - Deactivated bool `json:"deactivated,omitempty"` - DeactivatedAt int64 `json:"deactivated_at,omitempty"` - DomainNames []string `json:"domain_names,omitempty"` - EndpointName string `json:"endpoint_name,omitempty"` - GroupId string `json:"group_id,omitempty"` - NetworkConnectivityConfigId string `json:"network_connectivity_config_id,omitempty"` - ResourceId string `json:"resource_id,omitempty"` - RuleId string `json:"rule_id,omitempty"` - UpdatedTime int64 `json:"updated_time,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func nccAzurePrivateEndpointRuleFromPb(pb *nccAzurePrivateEndpointRulePb) (*NccAzurePrivateEndpointRule, error) { - if pb == nil { - return nil, nil - } - st := &NccAzurePrivateEndpointRule{} - st.ConnectionState = pb.ConnectionState - st.CreationTime = pb.CreationTime - st.Deactivated = pb.Deactivated - st.DeactivatedAt = pb.DeactivatedAt - st.DomainNames = pb.DomainNames - st.EndpointName = pb.EndpointName - st.GroupId = pb.GroupId - st.NetworkConnectivityConfigId = pb.NetworkConnectivityConfigId - st.ResourceId = pb.ResourceId - st.RuleId = pb.RuleId - st.UpdatedTime = pb.UpdatedTime - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *nccAzurePrivateEndpointRulePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st nccAzurePrivateEndpointRulePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func nccAzureServiceEndpointRuleToPb(st *NccAzureServiceEndpointRule) (*nccAzureServiceEndpointRulePb, error) { - if st == nil { - return nil, nil - } - pb := &nccAzureServiceEndpointRulePb{} - pb.Subnets = st.Subnets - pb.TargetRegion = st.TargetRegion - pb.TargetServices = st.TargetServices - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type nccAzureServiceEndpointRulePb struct { - Subnets []string `json:"subnets,omitempty"` - TargetRegion string `json:"target_region,omitempty"` - TargetServices []EgressResourceType `json:"target_services,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func nccAzureServiceEndpointRuleFromPb(pb *nccAzureServiceEndpointRulePb) (*NccAzureServiceEndpointRule, error) { - if pb == nil { - return nil, nil - } - st := &NccAzureServiceEndpointRule{} - st.Subnets = pb.Subnets - st.TargetRegion = pb.TargetRegion - st.TargetServices = pb.TargetServices - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *nccAzureServiceEndpointRulePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st nccAzureServiceEndpointRulePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func nccEgressConfigToPb(st *NccEgressConfig) (*nccEgressConfigPb, error) { - if st == nil { - return nil, nil - } - pb := &nccEgressConfigPb{} - pb.DefaultRules = st.DefaultRules - pb.TargetRules = st.TargetRules - - return pb, nil -} - -type nccEgressConfigPb struct { - DefaultRules *NccEgressDefaultRules `json:"default_rules,omitempty"` - TargetRules *NccEgressTargetRules `json:"target_rules,omitempty"` -} - -func nccEgressConfigFromPb(pb *nccEgressConfigPb) (*NccEgressConfig, error) { - if pb == nil { - return nil, nil - } - st := &NccEgressConfig{} - st.DefaultRules = pb.DefaultRules - st.TargetRules = pb.TargetRules - - return st, nil -} - -func nccEgressDefaultRulesToPb(st *NccEgressDefaultRules) (*nccEgressDefaultRulesPb, error) { - if st == nil { - return nil, nil - } - pb := &nccEgressDefaultRulesPb{} - pb.AwsStableIpRule = st.AwsStableIpRule - pb.AzureServiceEndpointRule = st.AzureServiceEndpointRule - - return pb, nil -} - -type nccEgressDefaultRulesPb struct { - AwsStableIpRule *NccAwsStableIpRule `json:"aws_stable_ip_rule,omitempty"` - AzureServiceEndpointRule *NccAzureServiceEndpointRule `json:"azure_service_endpoint_rule,omitempty"` -} - -func nccEgressDefaultRulesFromPb(pb *nccEgressDefaultRulesPb) (*NccEgressDefaultRules, error) { - if pb == nil { - return nil, nil - } - st := &NccEgressDefaultRules{} - st.AwsStableIpRule = pb.AwsStableIpRule - st.AzureServiceEndpointRule = pb.AzureServiceEndpointRule - - return st, nil -} - -func nccEgressTargetRulesToPb(st *NccEgressTargetRules) (*nccEgressTargetRulesPb, error) { - if st == nil { - return nil, nil - } - pb := &nccEgressTargetRulesPb{} - pb.AwsPrivateEndpointRules = st.AwsPrivateEndpointRules - pb.AzurePrivateEndpointRules = st.AzurePrivateEndpointRules - - return pb, nil -} - -type nccEgressTargetRulesPb struct { - AwsPrivateEndpointRules []CustomerFacingNetworkConnectivityConfigAwsPrivateEndpointRule `json:"aws_private_endpoint_rules,omitempty"` - AzurePrivateEndpointRules []NccAzurePrivateEndpointRule `json:"azure_private_endpoint_rules,omitempty"` -} - -func nccEgressTargetRulesFromPb(pb *nccEgressTargetRulesPb) (*NccEgressTargetRules, error) { - if pb == nil { - return nil, nil - } - st := &NccEgressTargetRules{} - st.AwsPrivateEndpointRules = pb.AwsPrivateEndpointRules - st.AzurePrivateEndpointRules = pb.AzurePrivateEndpointRules - - return st, nil -} - -func nccPrivateEndpointRuleToPb(st *NccPrivateEndpointRule) (*nccPrivateEndpointRulePb, error) { - if st == nil { - return nil, nil - } - pb := &nccPrivateEndpointRulePb{} - pb.AccountId = st.AccountId - pb.ConnectionState = st.ConnectionState - pb.CreationTime = st.CreationTime - pb.Deactivated = st.Deactivated - pb.DeactivatedAt = st.DeactivatedAt - pb.DomainNames = st.DomainNames - pb.Enabled = st.Enabled - pb.EndpointName = st.EndpointName - pb.EndpointService = st.EndpointService - pb.GroupId = st.GroupId - pb.NetworkConnectivityConfigId = st.NetworkConnectivityConfigId - pb.ResourceId = st.ResourceId - pb.ResourceNames = st.ResourceNames - pb.RuleId = st.RuleId - pb.UpdatedTime = st.UpdatedTime - pb.VpcEndpointId = st.VpcEndpointId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type nccPrivateEndpointRulePb struct { - AccountId string `json:"account_id,omitempty"` - ConnectionState NccPrivateEndpointRulePrivateLinkConnectionState `json:"connection_state,omitempty"` - CreationTime int64 `json:"creation_time,omitempty"` - Deactivated bool `json:"deactivated,omitempty"` - DeactivatedAt int64 `json:"deactivated_at,omitempty"` - DomainNames []string `json:"domain_names,omitempty"` - Enabled bool `json:"enabled,omitempty"` - EndpointName string `json:"endpoint_name,omitempty"` - EndpointService string `json:"endpoint_service,omitempty"` - GroupId string `json:"group_id,omitempty"` - NetworkConnectivityConfigId string `json:"network_connectivity_config_id,omitempty"` - ResourceId string `json:"resource_id,omitempty"` - ResourceNames []string `json:"resource_names,omitempty"` - RuleId string `json:"rule_id,omitempty"` - UpdatedTime int64 `json:"updated_time,omitempty"` - VpcEndpointId string `json:"vpc_endpoint_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func nccPrivateEndpointRuleFromPb(pb *nccPrivateEndpointRulePb) (*NccPrivateEndpointRule, error) { - if pb == nil { - return nil, nil - } - st := &NccPrivateEndpointRule{} - st.AccountId = pb.AccountId - st.ConnectionState = pb.ConnectionState - st.CreationTime = pb.CreationTime - st.Deactivated = pb.Deactivated - st.DeactivatedAt = pb.DeactivatedAt - st.DomainNames = pb.DomainNames - st.Enabled = pb.Enabled - st.EndpointName = pb.EndpointName - st.EndpointService = pb.EndpointService - st.GroupId = pb.GroupId - st.NetworkConnectivityConfigId = pb.NetworkConnectivityConfigId - st.ResourceId = pb.ResourceId - st.ResourceNames = pb.ResourceNames - st.RuleId = pb.RuleId - st.UpdatedTime = pb.UpdatedTime - st.VpcEndpointId = pb.VpcEndpointId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *nccPrivateEndpointRulePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st nccPrivateEndpointRulePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func networkConnectivityConfigurationToPb(st *NetworkConnectivityConfiguration) (*networkConnectivityConfigurationPb, error) { - if st == nil { - return nil, nil - } - pb := &networkConnectivityConfigurationPb{} - pb.AccountId = st.AccountId - pb.CreationTime = st.CreationTime - pb.EgressConfig = st.EgressConfig - pb.Name = st.Name - pb.NetworkConnectivityConfigId = st.NetworkConnectivityConfigId - pb.Region = st.Region - pb.UpdatedTime = st.UpdatedTime - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type networkConnectivityConfigurationPb struct { - AccountId string `json:"account_id,omitempty"` - CreationTime int64 `json:"creation_time,omitempty"` - EgressConfig *NccEgressConfig `json:"egress_config,omitempty"` - Name string `json:"name,omitempty"` - NetworkConnectivityConfigId string `json:"network_connectivity_config_id,omitempty"` - Region string `json:"region,omitempty"` - UpdatedTime int64 `json:"updated_time,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func networkConnectivityConfigurationFromPb(pb *networkConnectivityConfigurationPb) (*NetworkConnectivityConfiguration, error) { - if pb == nil { - return nil, nil - } - st := &NetworkConnectivityConfiguration{} - st.AccountId = pb.AccountId - st.CreationTime = pb.CreationTime - st.EgressConfig = pb.EgressConfig - st.Name = pb.Name - st.NetworkConnectivityConfigId = pb.NetworkConnectivityConfigId - st.Region = pb.Region - st.UpdatedTime = pb.UpdatedTime - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *networkConnectivityConfigurationPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st networkConnectivityConfigurationPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func networkPolicyEgressToPb(st *NetworkPolicyEgress) (*networkPolicyEgressPb, error) { - if st == nil { - return nil, nil - } - pb := &networkPolicyEgressPb{} - pb.NetworkAccess = st.NetworkAccess - - return pb, nil -} - -type networkPolicyEgressPb struct { - NetworkAccess *EgressNetworkPolicyNetworkAccessPolicy `json:"network_access,omitempty"` -} - -func networkPolicyEgressFromPb(pb *networkPolicyEgressPb) (*NetworkPolicyEgress, error) { - if pb == nil { - return nil, nil - } - st := &NetworkPolicyEgress{} - st.NetworkAccess = pb.NetworkAccess - - return st, nil -} - -func notificationDestinationToPb(st *NotificationDestination) (*notificationDestinationPb, error) { - if st == nil { - return nil, nil - } - pb := ¬ificationDestinationPb{} - pb.Config = st.Config - pb.DestinationType = st.DestinationType - pb.DisplayName = st.DisplayName - pb.Id = st.Id - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type notificationDestinationPb struct { - Config *Config `json:"config,omitempty"` - DestinationType DestinationType `json:"destination_type,omitempty"` - DisplayName string `json:"display_name,omitempty"` - Id string `json:"id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func notificationDestinationFromPb(pb *notificationDestinationPb) (*NotificationDestination, error) { - if pb == nil { - return nil, nil - } - st := &NotificationDestination{} - st.Config = pb.Config - st.DestinationType = pb.DestinationType - st.DisplayName = pb.DisplayName - st.Id = pb.Id - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *notificationDestinationPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st notificationDestinationPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func pagerdutyConfigToPb(st *PagerdutyConfig) (*pagerdutyConfigPb, error) { - if st == nil { - return nil, nil - } - pb := &pagerdutyConfigPb{} - pb.IntegrationKey = st.IntegrationKey - pb.IntegrationKeySet = st.IntegrationKeySet - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type pagerdutyConfigPb struct { - IntegrationKey string `json:"integration_key,omitempty"` - IntegrationKeySet bool `json:"integration_key_set,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func pagerdutyConfigFromPb(pb *pagerdutyConfigPb) (*PagerdutyConfig, error) { - if pb == nil { - return nil, nil - } - st := &PagerdutyConfig{} - st.IntegrationKey = pb.IntegrationKey - st.IntegrationKeySet = pb.IntegrationKeySet - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *pagerdutyConfigPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st pagerdutyConfigPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func partitionIdToPb(st *PartitionId) (*partitionIdPb, error) { - if st == nil { - return nil, nil - } - pb := &partitionIdPb{} - pb.WorkspaceId = st.WorkspaceId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type partitionIdPb struct { - WorkspaceId int64 `json:"workspaceId,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func partitionIdFromPb(pb *partitionIdPb) (*PartitionId, error) { - if pb == nil { - return nil, nil - } - st := &PartitionId{} - st.WorkspaceId = pb.WorkspaceId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *partitionIdPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st partitionIdPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func personalComputeMessageToPb(st *PersonalComputeMessage) (*personalComputeMessagePb, error) { - if st == nil { - return nil, nil - } - pb := &personalComputeMessagePb{} - pb.Value = st.Value - - return pb, nil -} - -type personalComputeMessagePb struct { - Value PersonalComputeMessageEnum `json:"value"` -} - -func personalComputeMessageFromPb(pb *personalComputeMessagePb) (*PersonalComputeMessage, error) { - if pb == nil { - return nil, nil - } - st := &PersonalComputeMessage{} - st.Value = pb.Value - - return st, nil -} - -func personalComputeSettingToPb(st *PersonalComputeSetting) (*personalComputeSettingPb, error) { - if st == nil { - return nil, nil - } - pb := &personalComputeSettingPb{} - pb.Etag = st.Etag - pb.PersonalCompute = st.PersonalCompute - pb.SettingName = st.SettingName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type personalComputeSettingPb struct { - Etag string `json:"etag,omitempty"` - PersonalCompute PersonalComputeMessage `json:"personal_compute"` - SettingName string `json:"setting_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func personalComputeSettingFromPb(pb *personalComputeSettingPb) (*PersonalComputeSetting, error) { - if pb == nil { - return nil, nil - } - st := &PersonalComputeSetting{} - st.Etag = pb.Etag - st.PersonalCompute = pb.PersonalCompute - st.SettingName = pb.SettingName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *personalComputeSettingPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st personalComputeSettingPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func publicTokenInfoToPb(st *PublicTokenInfo) (*publicTokenInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &publicTokenInfoPb{} - pb.Comment = st.Comment - pb.CreationTime = st.CreationTime - pb.ExpiryTime = st.ExpiryTime - pb.TokenId = st.TokenId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type publicTokenInfoPb struct { - Comment string `json:"comment,omitempty"` - CreationTime int64 `json:"creation_time,omitempty"` - ExpiryTime int64 `json:"expiry_time,omitempty"` - TokenId string `json:"token_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func publicTokenInfoFromPb(pb *publicTokenInfoPb) (*PublicTokenInfo, error) { - if pb == nil { - return nil, nil - } - st := &PublicTokenInfo{} - st.Comment = pb.Comment - st.CreationTime = pb.CreationTime - st.ExpiryTime = pb.ExpiryTime - st.TokenId = pb.TokenId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *publicTokenInfoPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st publicTokenInfoPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func replaceIpAccessListToPb(st *ReplaceIpAccessList) (*replaceIpAccessListPb, error) { - if st == nil { - return nil, nil - } - pb := &replaceIpAccessListPb{} - pb.Enabled = st.Enabled - pb.IpAccessListId = st.IpAccessListId - pb.IpAddresses = st.IpAddresses - pb.Label = st.Label - pb.ListType = st.ListType - - return pb, nil -} - -type replaceIpAccessListPb struct { - Enabled bool `json:"enabled"` - IpAccessListId string `json:"-" url:"-"` - IpAddresses []string `json:"ip_addresses,omitempty"` - Label string `json:"label"` - ListType ListType `json:"list_type"` -} - -func replaceIpAccessListFromPb(pb *replaceIpAccessListPb) (*ReplaceIpAccessList, error) { - if pb == nil { - return nil, nil - } - st := &ReplaceIpAccessList{} - st.Enabled = pb.Enabled - st.IpAccessListId = pb.IpAccessListId - st.IpAddresses = pb.IpAddresses - st.Label = pb.Label - st.ListType = pb.ListType - - return st, nil -} - -func replaceResponseToPb(st *ReplaceResponse) (*replaceResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &replaceResponsePb{} - - return pb, nil -} - -type replaceResponsePb struct { -} - -func replaceResponseFromPb(pb *replaceResponsePb) (*ReplaceResponse, error) { - if pb == nil { - return nil, nil - } - st := &ReplaceResponse{} - - return st, nil -} - -func restrictWorkspaceAdminsMessageToPb(st *RestrictWorkspaceAdminsMessage) (*restrictWorkspaceAdminsMessagePb, error) { - if st == nil { - return nil, nil - } - pb := &restrictWorkspaceAdminsMessagePb{} - pb.Status = st.Status - - return pb, nil -} - -type restrictWorkspaceAdminsMessagePb struct { - Status RestrictWorkspaceAdminsMessageStatus `json:"status"` -} - -func restrictWorkspaceAdminsMessageFromPb(pb *restrictWorkspaceAdminsMessagePb) (*RestrictWorkspaceAdminsMessage, error) { - if pb == nil { - return nil, nil - } - st := &RestrictWorkspaceAdminsMessage{} - st.Status = pb.Status - - return st, nil -} - -func restrictWorkspaceAdminsSettingToPb(st *RestrictWorkspaceAdminsSetting) (*restrictWorkspaceAdminsSettingPb, error) { - if st == nil { - return nil, nil - } - pb := &restrictWorkspaceAdminsSettingPb{} - pb.Etag = st.Etag - pb.RestrictWorkspaceAdmins = st.RestrictWorkspaceAdmins - pb.SettingName = st.SettingName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type restrictWorkspaceAdminsSettingPb struct { - Etag string `json:"etag,omitempty"` - RestrictWorkspaceAdmins RestrictWorkspaceAdminsMessage `json:"restrict_workspace_admins"` - SettingName string `json:"setting_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func restrictWorkspaceAdminsSettingFromPb(pb *restrictWorkspaceAdminsSettingPb) (*RestrictWorkspaceAdminsSetting, error) { - if pb == nil { - return nil, nil - } - st := &RestrictWorkspaceAdminsSetting{} - st.Etag = pb.Etag - st.RestrictWorkspaceAdmins = pb.RestrictWorkspaceAdmins - st.SettingName = pb.SettingName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *restrictWorkspaceAdminsSettingPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st restrictWorkspaceAdminsSettingPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func revokeTokenRequestToPb(st *RevokeTokenRequest) (*revokeTokenRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &revokeTokenRequestPb{} - pb.TokenId = st.TokenId - - return pb, nil -} - -type revokeTokenRequestPb struct { - TokenId string `json:"token_id"` -} - -func revokeTokenRequestFromPb(pb *revokeTokenRequestPb) (*RevokeTokenRequest, error) { - if pb == nil { - return nil, nil - } - st := &RevokeTokenRequest{} - st.TokenId = pb.TokenId - - return st, nil -} - -func revokeTokenResponseToPb(st *RevokeTokenResponse) (*revokeTokenResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &revokeTokenResponsePb{} - - return pb, nil -} - -type revokeTokenResponsePb struct { -} - -func revokeTokenResponseFromPb(pb *revokeTokenResponsePb) (*RevokeTokenResponse, error) { - if pb == nil { - return nil, nil - } - st := &RevokeTokenResponse{} - - return st, nil -} - -func setStatusResponseToPb(st *SetStatusResponse) (*setStatusResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &setStatusResponsePb{} - - return pb, nil -} - -type setStatusResponsePb struct { -} - -func setStatusResponseFromPb(pb *setStatusResponsePb) (*SetStatusResponse, error) { - if pb == nil { - return nil, nil - } - st := &SetStatusResponse{} - - return st, nil -} - -func slackConfigToPb(st *SlackConfig) (*slackConfigPb, error) { - if st == nil { - return nil, nil - } - pb := &slackConfigPb{} - pb.Url = st.Url - pb.UrlSet = st.UrlSet - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type slackConfigPb struct { - Url string `json:"url,omitempty"` - UrlSet bool `json:"url_set,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func slackConfigFromPb(pb *slackConfigPb) (*SlackConfig, error) { - if pb == nil { - return nil, nil - } - st := &SlackConfig{} - st.Url = pb.Url - st.UrlSet = pb.UrlSet - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *slackConfigPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st slackConfigPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func sqlResultsDownloadToPb(st *SqlResultsDownload) (*sqlResultsDownloadPb, error) { - if st == nil { - return nil, nil - } - pb := &sqlResultsDownloadPb{} - pb.BooleanVal = st.BooleanVal - pb.Etag = st.Etag - pb.SettingName = st.SettingName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type sqlResultsDownloadPb struct { - BooleanVal BooleanMessage `json:"boolean_val"` - Etag string `json:"etag,omitempty"` - SettingName string `json:"setting_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func sqlResultsDownloadFromPb(pb *sqlResultsDownloadPb) (*SqlResultsDownload, error) { - if pb == nil { - return nil, nil - } - st := &SqlResultsDownload{} - st.BooleanVal = pb.BooleanVal - st.Etag = pb.Etag - st.SettingName = pb.SettingName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *sqlResultsDownloadPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st sqlResultsDownloadPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func stringMessageToPb(st *StringMessage) (*stringMessagePb, error) { - if st == nil { - return nil, nil - } - pb := &stringMessagePb{} - pb.Value = st.Value - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type stringMessagePb struct { - Value string `json:"value,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func stringMessageFromPb(pb *stringMessagePb) (*StringMessage, error) { - if pb == nil { - return nil, nil - } - st := &StringMessage{} - st.Value = pb.Value - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *stringMessagePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st stringMessagePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func tokenAccessControlRequestToPb(st *TokenAccessControlRequest) (*tokenAccessControlRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &tokenAccessControlRequestPb{} - pb.GroupName = st.GroupName - pb.PermissionLevel = st.PermissionLevel - pb.ServicePrincipalName = st.ServicePrincipalName - pb.UserName = st.UserName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type tokenAccessControlRequestPb struct { - GroupName string `json:"group_name,omitempty"` - PermissionLevel TokenPermissionLevel `json:"permission_level,omitempty"` - ServicePrincipalName string `json:"service_principal_name,omitempty"` - UserName string `json:"user_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func tokenAccessControlRequestFromPb(pb *tokenAccessControlRequestPb) (*TokenAccessControlRequest, error) { - if pb == nil { - return nil, nil - } - st := &TokenAccessControlRequest{} - st.GroupName = pb.GroupName - st.PermissionLevel = pb.PermissionLevel - st.ServicePrincipalName = pb.ServicePrincipalName - st.UserName = pb.UserName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *tokenAccessControlRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st tokenAccessControlRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func tokenAccessControlResponseToPb(st *TokenAccessControlResponse) (*tokenAccessControlResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &tokenAccessControlResponsePb{} - pb.AllPermissions = st.AllPermissions - pb.DisplayName = st.DisplayName - pb.GroupName = st.GroupName - pb.ServicePrincipalName = st.ServicePrincipalName - pb.UserName = st.UserName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type tokenAccessControlResponsePb struct { - AllPermissions []TokenPermission `json:"all_permissions,omitempty"` - DisplayName string `json:"display_name,omitempty"` - GroupName string `json:"group_name,omitempty"` - ServicePrincipalName string `json:"service_principal_name,omitempty"` - UserName string `json:"user_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func tokenAccessControlResponseFromPb(pb *tokenAccessControlResponsePb) (*TokenAccessControlResponse, error) { - if pb == nil { - return nil, nil - } - st := &TokenAccessControlResponse{} - st.AllPermissions = pb.AllPermissions - st.DisplayName = pb.DisplayName - st.GroupName = pb.GroupName - st.ServicePrincipalName = pb.ServicePrincipalName - st.UserName = pb.UserName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *tokenAccessControlResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st tokenAccessControlResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func tokenInfoToPb(st *TokenInfo) (*tokenInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &tokenInfoPb{} - pb.Comment = st.Comment - pb.CreatedById = st.CreatedById - pb.CreatedByUsername = st.CreatedByUsername - pb.CreationTime = st.CreationTime - pb.ExpiryTime = st.ExpiryTime - pb.LastUsedDay = st.LastUsedDay - pb.OwnerId = st.OwnerId - pb.TokenId = st.TokenId - pb.WorkspaceId = st.WorkspaceId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type tokenInfoPb struct { - Comment string `json:"comment,omitempty"` - CreatedById int64 `json:"created_by_id,omitempty"` - CreatedByUsername string `json:"created_by_username,omitempty"` - CreationTime int64 `json:"creation_time,omitempty"` - ExpiryTime int64 `json:"expiry_time,omitempty"` - LastUsedDay int64 `json:"last_used_day,omitempty"` - OwnerId int64 `json:"owner_id,omitempty"` - TokenId string `json:"token_id,omitempty"` - WorkspaceId int64 `json:"workspace_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func tokenInfoFromPb(pb *tokenInfoPb) (*TokenInfo, error) { - if pb == nil { - return nil, nil - } - st := &TokenInfo{} - st.Comment = pb.Comment - st.CreatedById = pb.CreatedById - st.CreatedByUsername = pb.CreatedByUsername - st.CreationTime = pb.CreationTime - st.ExpiryTime = pb.ExpiryTime - st.LastUsedDay = pb.LastUsedDay - st.OwnerId = pb.OwnerId - st.TokenId = pb.TokenId - st.WorkspaceId = pb.WorkspaceId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *tokenInfoPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st tokenInfoPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func tokenPermissionToPb(st *TokenPermission) (*tokenPermissionPb, error) { - if st == nil { - return nil, nil - } - pb := &tokenPermissionPb{} - pb.Inherited = st.Inherited - pb.InheritedFromObject = st.InheritedFromObject - pb.PermissionLevel = st.PermissionLevel - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type tokenPermissionPb struct { - Inherited bool `json:"inherited,omitempty"` - InheritedFromObject []string `json:"inherited_from_object,omitempty"` - PermissionLevel TokenPermissionLevel `json:"permission_level,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func tokenPermissionFromPb(pb *tokenPermissionPb) (*TokenPermission, error) { - if pb == nil { - return nil, nil - } - st := &TokenPermission{} - st.Inherited = pb.Inherited - st.InheritedFromObject = pb.InheritedFromObject - st.PermissionLevel = pb.PermissionLevel - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *tokenPermissionPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st tokenPermissionPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func tokenPermissionsToPb(st *TokenPermissions) (*tokenPermissionsPb, error) { - if st == nil { - return nil, nil - } - pb := &tokenPermissionsPb{} - pb.AccessControlList = st.AccessControlList - pb.ObjectId = st.ObjectId - pb.ObjectType = st.ObjectType - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type tokenPermissionsPb struct { - AccessControlList []TokenAccessControlResponse `json:"access_control_list,omitempty"` - ObjectId string `json:"object_id,omitempty"` - ObjectType string `json:"object_type,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func tokenPermissionsFromPb(pb *tokenPermissionsPb) (*TokenPermissions, error) { - if pb == nil { - return nil, nil - } - st := &TokenPermissions{} - st.AccessControlList = pb.AccessControlList - st.ObjectId = pb.ObjectId - st.ObjectType = pb.ObjectType - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *tokenPermissionsPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st tokenPermissionsPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func tokenPermissionsDescriptionToPb(st *TokenPermissionsDescription) (*tokenPermissionsDescriptionPb, error) { - if st == nil { - return nil, nil - } - pb := &tokenPermissionsDescriptionPb{} - pb.Description = st.Description - pb.PermissionLevel = st.PermissionLevel - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type tokenPermissionsDescriptionPb struct { - Description string `json:"description,omitempty"` - PermissionLevel TokenPermissionLevel `json:"permission_level,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func tokenPermissionsDescriptionFromPb(pb *tokenPermissionsDescriptionPb) (*TokenPermissionsDescription, error) { - if pb == nil { - return nil, nil - } - st := &TokenPermissionsDescription{} - st.Description = pb.Description - st.PermissionLevel = pb.PermissionLevel - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *tokenPermissionsDescriptionPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st tokenPermissionsDescriptionPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func tokenPermissionsRequestToPb(st *TokenPermissionsRequest) (*tokenPermissionsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &tokenPermissionsRequestPb{} - pb.AccessControlList = st.AccessControlList - - return pb, nil -} - -type tokenPermissionsRequestPb struct { - AccessControlList []TokenAccessControlRequest `json:"access_control_list,omitempty"` -} - -func tokenPermissionsRequestFromPb(pb *tokenPermissionsRequestPb) (*TokenPermissionsRequest, error) { - if pb == nil { - return nil, nil - } - st := &TokenPermissionsRequest{} - st.AccessControlList = pb.AccessControlList - - return st, nil -} - -func updateAccountIpAccessEnableRequestToPb(st *UpdateAccountIpAccessEnableRequest) (*updateAccountIpAccessEnableRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &updateAccountIpAccessEnableRequestPb{} - pb.AllowMissing = st.AllowMissing - pb.FieldMask = st.FieldMask - pb.Setting = st.Setting - - return pb, nil -} - -type updateAccountIpAccessEnableRequestPb struct { - AllowMissing bool `json:"allow_missing"` - FieldMask string `json:"field_mask"` - Setting AccountIpAccessEnable `json:"setting"` -} - -func updateAccountIpAccessEnableRequestFromPb(pb *updateAccountIpAccessEnableRequestPb) (*UpdateAccountIpAccessEnableRequest, error) { - if pb == nil { - return nil, nil - } - st := &UpdateAccountIpAccessEnableRequest{} - st.AllowMissing = pb.AllowMissing - st.FieldMask = pb.FieldMask - st.Setting = pb.Setting - - return st, nil -} - -func updateAibiDashboardEmbeddingAccessPolicySettingRequestToPb(st *UpdateAibiDashboardEmbeddingAccessPolicySettingRequest) (*updateAibiDashboardEmbeddingAccessPolicySettingRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &updateAibiDashboardEmbeddingAccessPolicySettingRequestPb{} - pb.AllowMissing = st.AllowMissing - pb.FieldMask = st.FieldMask - pb.Setting = st.Setting - - return pb, nil -} - -type updateAibiDashboardEmbeddingAccessPolicySettingRequestPb struct { - AllowMissing bool `json:"allow_missing"` - FieldMask string `json:"field_mask"` - Setting AibiDashboardEmbeddingAccessPolicySetting `json:"setting"` -} - -func updateAibiDashboardEmbeddingAccessPolicySettingRequestFromPb(pb *updateAibiDashboardEmbeddingAccessPolicySettingRequestPb) (*UpdateAibiDashboardEmbeddingAccessPolicySettingRequest, error) { - if pb == nil { - return nil, nil - } - st := &UpdateAibiDashboardEmbeddingAccessPolicySettingRequest{} - st.AllowMissing = pb.AllowMissing - st.FieldMask = pb.FieldMask - st.Setting = pb.Setting - - return st, nil -} - -func updateAibiDashboardEmbeddingApprovedDomainsSettingRequestToPb(st *UpdateAibiDashboardEmbeddingApprovedDomainsSettingRequest) (*updateAibiDashboardEmbeddingApprovedDomainsSettingRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &updateAibiDashboardEmbeddingApprovedDomainsSettingRequestPb{} - pb.AllowMissing = st.AllowMissing - pb.FieldMask = st.FieldMask - pb.Setting = st.Setting - - return pb, nil -} - -type updateAibiDashboardEmbeddingApprovedDomainsSettingRequestPb struct { - AllowMissing bool `json:"allow_missing"` - FieldMask string `json:"field_mask"` - Setting AibiDashboardEmbeddingApprovedDomainsSetting `json:"setting"` -} - -func updateAibiDashboardEmbeddingApprovedDomainsSettingRequestFromPb(pb *updateAibiDashboardEmbeddingApprovedDomainsSettingRequestPb) (*UpdateAibiDashboardEmbeddingApprovedDomainsSettingRequest, error) { - if pb == nil { - return nil, nil - } - st := &UpdateAibiDashboardEmbeddingApprovedDomainsSettingRequest{} - st.AllowMissing = pb.AllowMissing - st.FieldMask = pb.FieldMask - st.Setting = pb.Setting - - return st, nil -} - -func updateAutomaticClusterUpdateSettingRequestToPb(st *UpdateAutomaticClusterUpdateSettingRequest) (*updateAutomaticClusterUpdateSettingRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &updateAutomaticClusterUpdateSettingRequestPb{} - pb.AllowMissing = st.AllowMissing - pb.FieldMask = st.FieldMask - pb.Setting = st.Setting - - return pb, nil -} - -type updateAutomaticClusterUpdateSettingRequestPb struct { - AllowMissing bool `json:"allow_missing"` - FieldMask string `json:"field_mask"` - Setting AutomaticClusterUpdateSetting `json:"setting"` -} - -func updateAutomaticClusterUpdateSettingRequestFromPb(pb *updateAutomaticClusterUpdateSettingRequestPb) (*UpdateAutomaticClusterUpdateSettingRequest, error) { - if pb == nil { - return nil, nil - } - st := &UpdateAutomaticClusterUpdateSettingRequest{} - st.AllowMissing = pb.AllowMissing - st.FieldMask = pb.FieldMask - st.Setting = pb.Setting - - return st, nil -} - -func updateComplianceSecurityProfileSettingRequestToPb(st *UpdateComplianceSecurityProfileSettingRequest) (*updateComplianceSecurityProfileSettingRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &updateComplianceSecurityProfileSettingRequestPb{} - pb.AllowMissing = st.AllowMissing - pb.FieldMask = st.FieldMask - pb.Setting = st.Setting - - return pb, nil -} - -type updateComplianceSecurityProfileSettingRequestPb struct { - AllowMissing bool `json:"allow_missing"` - FieldMask string `json:"field_mask"` - Setting ComplianceSecurityProfileSetting `json:"setting"` -} - -func updateComplianceSecurityProfileSettingRequestFromPb(pb *updateComplianceSecurityProfileSettingRequestPb) (*UpdateComplianceSecurityProfileSettingRequest, error) { - if pb == nil { - return nil, nil - } - st := &UpdateComplianceSecurityProfileSettingRequest{} - st.AllowMissing = pb.AllowMissing - st.FieldMask = pb.FieldMask - st.Setting = pb.Setting - - return st, nil -} - -func updateCspEnablementAccountSettingRequestToPb(st *UpdateCspEnablementAccountSettingRequest) (*updateCspEnablementAccountSettingRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &updateCspEnablementAccountSettingRequestPb{} - pb.AllowMissing = st.AllowMissing - pb.FieldMask = st.FieldMask - pb.Setting = st.Setting - - return pb, nil -} - -type updateCspEnablementAccountSettingRequestPb struct { - AllowMissing bool `json:"allow_missing"` - FieldMask string `json:"field_mask"` - Setting CspEnablementAccountSetting `json:"setting"` -} - -func updateCspEnablementAccountSettingRequestFromPb(pb *updateCspEnablementAccountSettingRequestPb) (*UpdateCspEnablementAccountSettingRequest, error) { - if pb == nil { - return nil, nil - } - st := &UpdateCspEnablementAccountSettingRequest{} - st.AllowMissing = pb.AllowMissing - st.FieldMask = pb.FieldMask - st.Setting = pb.Setting - - return st, nil -} - -func updateDashboardEmailSubscriptionsRequestToPb(st *UpdateDashboardEmailSubscriptionsRequest) (*updateDashboardEmailSubscriptionsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &updateDashboardEmailSubscriptionsRequestPb{} - pb.AllowMissing = st.AllowMissing - pb.FieldMask = st.FieldMask - pb.Setting = st.Setting - - return pb, nil -} - -type updateDashboardEmailSubscriptionsRequestPb struct { - AllowMissing bool `json:"allow_missing"` - FieldMask string `json:"field_mask"` - Setting DashboardEmailSubscriptions `json:"setting"` -} - -func updateDashboardEmailSubscriptionsRequestFromPb(pb *updateDashboardEmailSubscriptionsRequestPb) (*UpdateDashboardEmailSubscriptionsRequest, error) { - if pb == nil { - return nil, nil - } - st := &UpdateDashboardEmailSubscriptionsRequest{} - st.AllowMissing = pb.AllowMissing - st.FieldMask = pb.FieldMask - st.Setting = pb.Setting - - return st, nil -} - -func updateDefaultNamespaceSettingRequestToPb(st *UpdateDefaultNamespaceSettingRequest) (*updateDefaultNamespaceSettingRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &updateDefaultNamespaceSettingRequestPb{} - pb.AllowMissing = st.AllowMissing - pb.FieldMask = st.FieldMask - pb.Setting = st.Setting - - return pb, nil -} - -type updateDefaultNamespaceSettingRequestPb struct { - AllowMissing bool `json:"allow_missing"` - FieldMask string `json:"field_mask"` - Setting DefaultNamespaceSetting `json:"setting"` -} - -func updateDefaultNamespaceSettingRequestFromPb(pb *updateDefaultNamespaceSettingRequestPb) (*UpdateDefaultNamespaceSettingRequest, error) { - if pb == nil { - return nil, nil - } - st := &UpdateDefaultNamespaceSettingRequest{} - st.AllowMissing = pb.AllowMissing - st.FieldMask = pb.FieldMask - st.Setting = pb.Setting - - return st, nil -} - -func updateDisableLegacyAccessRequestToPb(st *UpdateDisableLegacyAccessRequest) (*updateDisableLegacyAccessRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &updateDisableLegacyAccessRequestPb{} - pb.AllowMissing = st.AllowMissing - pb.FieldMask = st.FieldMask - pb.Setting = st.Setting - - return pb, nil -} - -type updateDisableLegacyAccessRequestPb struct { - AllowMissing bool `json:"allow_missing"` - FieldMask string `json:"field_mask"` - Setting DisableLegacyAccess `json:"setting"` -} - -func updateDisableLegacyAccessRequestFromPb(pb *updateDisableLegacyAccessRequestPb) (*UpdateDisableLegacyAccessRequest, error) { - if pb == nil { - return nil, nil - } - st := &UpdateDisableLegacyAccessRequest{} - st.AllowMissing = pb.AllowMissing - st.FieldMask = pb.FieldMask - st.Setting = pb.Setting - - return st, nil -} - -func updateDisableLegacyDbfsRequestToPb(st *UpdateDisableLegacyDbfsRequest) (*updateDisableLegacyDbfsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &updateDisableLegacyDbfsRequestPb{} - pb.AllowMissing = st.AllowMissing - pb.FieldMask = st.FieldMask - pb.Setting = st.Setting - - return pb, nil -} - -type updateDisableLegacyDbfsRequestPb struct { - AllowMissing bool `json:"allow_missing"` - FieldMask string `json:"field_mask"` - Setting DisableLegacyDbfs `json:"setting"` -} - -func updateDisableLegacyDbfsRequestFromPb(pb *updateDisableLegacyDbfsRequestPb) (*UpdateDisableLegacyDbfsRequest, error) { - if pb == nil { - return nil, nil - } - st := &UpdateDisableLegacyDbfsRequest{} - st.AllowMissing = pb.AllowMissing - st.FieldMask = pb.FieldMask - st.Setting = pb.Setting - - return st, nil -} - -func updateDisableLegacyFeaturesRequestToPb(st *UpdateDisableLegacyFeaturesRequest) (*updateDisableLegacyFeaturesRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &updateDisableLegacyFeaturesRequestPb{} - pb.AllowMissing = st.AllowMissing - pb.FieldMask = st.FieldMask - pb.Setting = st.Setting - - return pb, nil -} - -type updateDisableLegacyFeaturesRequestPb struct { - AllowMissing bool `json:"allow_missing"` - FieldMask string `json:"field_mask"` - Setting DisableLegacyFeatures `json:"setting"` -} - -func updateDisableLegacyFeaturesRequestFromPb(pb *updateDisableLegacyFeaturesRequestPb) (*UpdateDisableLegacyFeaturesRequest, error) { - if pb == nil { - return nil, nil - } - st := &UpdateDisableLegacyFeaturesRequest{} - st.AllowMissing = pb.AllowMissing - st.FieldMask = pb.FieldMask - st.Setting = pb.Setting - - return st, nil -} - -func updateEnableExportNotebookRequestToPb(st *UpdateEnableExportNotebookRequest) (*updateEnableExportNotebookRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &updateEnableExportNotebookRequestPb{} - pb.AllowMissing = st.AllowMissing - pb.FieldMask = st.FieldMask - pb.Setting = st.Setting - - return pb, nil -} - -type updateEnableExportNotebookRequestPb struct { - AllowMissing bool `json:"allow_missing"` - FieldMask string `json:"field_mask"` - Setting EnableExportNotebook `json:"setting"` -} - -func updateEnableExportNotebookRequestFromPb(pb *updateEnableExportNotebookRequestPb) (*UpdateEnableExportNotebookRequest, error) { - if pb == nil { - return nil, nil - } - st := &UpdateEnableExportNotebookRequest{} - st.AllowMissing = pb.AllowMissing - st.FieldMask = pb.FieldMask - st.Setting = pb.Setting - - return st, nil -} - -func updateEnableNotebookTableClipboardRequestToPb(st *UpdateEnableNotebookTableClipboardRequest) (*updateEnableNotebookTableClipboardRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &updateEnableNotebookTableClipboardRequestPb{} - pb.AllowMissing = st.AllowMissing - pb.FieldMask = st.FieldMask - pb.Setting = st.Setting - - return pb, nil -} - -type updateEnableNotebookTableClipboardRequestPb struct { - AllowMissing bool `json:"allow_missing"` - FieldMask string `json:"field_mask"` - Setting EnableNotebookTableClipboard `json:"setting"` -} - -func updateEnableNotebookTableClipboardRequestFromPb(pb *updateEnableNotebookTableClipboardRequestPb) (*UpdateEnableNotebookTableClipboardRequest, error) { - if pb == nil { - return nil, nil - } - st := &UpdateEnableNotebookTableClipboardRequest{} - st.AllowMissing = pb.AllowMissing - st.FieldMask = pb.FieldMask - st.Setting = pb.Setting - - return st, nil -} - -func updateEnableResultsDownloadingRequestToPb(st *UpdateEnableResultsDownloadingRequest) (*updateEnableResultsDownloadingRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &updateEnableResultsDownloadingRequestPb{} - pb.AllowMissing = st.AllowMissing - pb.FieldMask = st.FieldMask - pb.Setting = st.Setting - - return pb, nil -} - -type updateEnableResultsDownloadingRequestPb struct { - AllowMissing bool `json:"allow_missing"` - FieldMask string `json:"field_mask"` - Setting EnableResultsDownloading `json:"setting"` -} - -func updateEnableResultsDownloadingRequestFromPb(pb *updateEnableResultsDownloadingRequestPb) (*UpdateEnableResultsDownloadingRequest, error) { - if pb == nil { - return nil, nil - } - st := &UpdateEnableResultsDownloadingRequest{} - st.AllowMissing = pb.AllowMissing - st.FieldMask = pb.FieldMask - st.Setting = pb.Setting - - return st, nil -} - -func updateEnhancedSecurityMonitoringSettingRequestToPb(st *UpdateEnhancedSecurityMonitoringSettingRequest) (*updateEnhancedSecurityMonitoringSettingRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &updateEnhancedSecurityMonitoringSettingRequestPb{} - pb.AllowMissing = st.AllowMissing - pb.FieldMask = st.FieldMask - pb.Setting = st.Setting - - return pb, nil -} - -type updateEnhancedSecurityMonitoringSettingRequestPb struct { - AllowMissing bool `json:"allow_missing"` - FieldMask string `json:"field_mask"` - Setting EnhancedSecurityMonitoringSetting `json:"setting"` -} - -func updateEnhancedSecurityMonitoringSettingRequestFromPb(pb *updateEnhancedSecurityMonitoringSettingRequestPb) (*UpdateEnhancedSecurityMonitoringSettingRequest, error) { - if pb == nil { - return nil, nil - } - st := &UpdateEnhancedSecurityMonitoringSettingRequest{} - st.AllowMissing = pb.AllowMissing - st.FieldMask = pb.FieldMask - st.Setting = pb.Setting - - return st, nil -} - -func updateEsmEnablementAccountSettingRequestToPb(st *UpdateEsmEnablementAccountSettingRequest) (*updateEsmEnablementAccountSettingRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &updateEsmEnablementAccountSettingRequestPb{} - pb.AllowMissing = st.AllowMissing - pb.FieldMask = st.FieldMask - pb.Setting = st.Setting - - return pb, nil -} - -type updateEsmEnablementAccountSettingRequestPb struct { - AllowMissing bool `json:"allow_missing"` - FieldMask string `json:"field_mask"` - Setting EsmEnablementAccountSetting `json:"setting"` -} - -func updateEsmEnablementAccountSettingRequestFromPb(pb *updateEsmEnablementAccountSettingRequestPb) (*UpdateEsmEnablementAccountSettingRequest, error) { - if pb == nil { - return nil, nil - } - st := &UpdateEsmEnablementAccountSettingRequest{} - st.AllowMissing = pb.AllowMissing - st.FieldMask = pb.FieldMask - st.Setting = pb.Setting - - return st, nil -} - -func updateIpAccessListToPb(st *UpdateIpAccessList) (*updateIpAccessListPb, error) { - if st == nil { - return nil, nil - } - pb := &updateIpAccessListPb{} - pb.Enabled = st.Enabled - pb.IpAccessListId = st.IpAccessListId - pb.IpAddresses = st.IpAddresses - pb.Label = st.Label - pb.ListType = st.ListType - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type updateIpAccessListPb struct { - Enabled bool `json:"enabled,omitempty"` - IpAccessListId string `json:"-" url:"-"` - IpAddresses []string `json:"ip_addresses,omitempty"` - Label string `json:"label,omitempty"` - ListType ListType `json:"list_type,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func updateIpAccessListFromPb(pb *updateIpAccessListPb) (*UpdateIpAccessList, error) { - if pb == nil { - return nil, nil - } - st := &UpdateIpAccessList{} - st.Enabled = pb.Enabled - st.IpAccessListId = pb.IpAccessListId - st.IpAddresses = pb.IpAddresses - st.Label = pb.Label - st.ListType = pb.ListType - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *updateIpAccessListPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st updateIpAccessListPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func updateLlmProxyPartnerPoweredAccountRequestToPb(st *UpdateLlmProxyPartnerPoweredAccountRequest) (*updateLlmProxyPartnerPoweredAccountRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &updateLlmProxyPartnerPoweredAccountRequestPb{} - pb.AllowMissing = st.AllowMissing - pb.FieldMask = st.FieldMask - pb.Setting = st.Setting - - return pb, nil -} - -type updateLlmProxyPartnerPoweredAccountRequestPb struct { - AllowMissing bool `json:"allow_missing"` - FieldMask string `json:"field_mask"` - Setting LlmProxyPartnerPoweredAccount `json:"setting"` -} - -func updateLlmProxyPartnerPoweredAccountRequestFromPb(pb *updateLlmProxyPartnerPoweredAccountRequestPb) (*UpdateLlmProxyPartnerPoweredAccountRequest, error) { - if pb == nil { - return nil, nil - } - st := &UpdateLlmProxyPartnerPoweredAccountRequest{} - st.AllowMissing = pb.AllowMissing - st.FieldMask = pb.FieldMask - st.Setting = pb.Setting - - return st, nil -} - -func updateLlmProxyPartnerPoweredEnforceRequestToPb(st *UpdateLlmProxyPartnerPoweredEnforceRequest) (*updateLlmProxyPartnerPoweredEnforceRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &updateLlmProxyPartnerPoweredEnforceRequestPb{} - pb.AllowMissing = st.AllowMissing - pb.FieldMask = st.FieldMask - pb.Setting = st.Setting - - return pb, nil -} - -type updateLlmProxyPartnerPoweredEnforceRequestPb struct { - AllowMissing bool `json:"allow_missing"` - FieldMask string `json:"field_mask"` - Setting LlmProxyPartnerPoweredEnforce `json:"setting"` -} - -func updateLlmProxyPartnerPoweredEnforceRequestFromPb(pb *updateLlmProxyPartnerPoweredEnforceRequestPb) (*UpdateLlmProxyPartnerPoweredEnforceRequest, error) { - if pb == nil { - return nil, nil - } - st := &UpdateLlmProxyPartnerPoweredEnforceRequest{} - st.AllowMissing = pb.AllowMissing - st.FieldMask = pb.FieldMask - st.Setting = pb.Setting - - return st, nil -} - -func updateLlmProxyPartnerPoweredWorkspaceRequestToPb(st *UpdateLlmProxyPartnerPoweredWorkspaceRequest) (*updateLlmProxyPartnerPoweredWorkspaceRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &updateLlmProxyPartnerPoweredWorkspaceRequestPb{} - pb.AllowMissing = st.AllowMissing - pb.FieldMask = st.FieldMask - pb.Setting = st.Setting - - return pb, nil -} - -type updateLlmProxyPartnerPoweredWorkspaceRequestPb struct { - AllowMissing bool `json:"allow_missing"` - FieldMask string `json:"field_mask"` - Setting LlmProxyPartnerPoweredWorkspace `json:"setting"` -} - -func updateLlmProxyPartnerPoweredWorkspaceRequestFromPb(pb *updateLlmProxyPartnerPoweredWorkspaceRequestPb) (*UpdateLlmProxyPartnerPoweredWorkspaceRequest, error) { - if pb == nil { - return nil, nil - } - st := &UpdateLlmProxyPartnerPoweredWorkspaceRequest{} - st.AllowMissing = pb.AllowMissing - st.FieldMask = pb.FieldMask - st.Setting = pb.Setting - - return st, nil -} - -func updateNccPrivateEndpointRuleRequestToPb(st *UpdateNccPrivateEndpointRuleRequest) (*updateNccPrivateEndpointRuleRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &updateNccPrivateEndpointRuleRequestPb{} - pb.NetworkConnectivityConfigId = st.NetworkConnectivityConfigId - pb.PrivateEndpointRule = st.PrivateEndpointRule - pb.PrivateEndpointRuleId = st.PrivateEndpointRuleId - pb.UpdateMask = st.UpdateMask - - return pb, nil -} - -type updateNccPrivateEndpointRuleRequestPb struct { - NetworkConnectivityConfigId string `json:"-" url:"-"` - PrivateEndpointRule UpdatePrivateEndpointRule `json:"private_endpoint_rule"` - PrivateEndpointRuleId string `json:"-" url:"-"` - UpdateMask string `json:"-" url:"update_mask"` -} - -func updateNccPrivateEndpointRuleRequestFromPb(pb *updateNccPrivateEndpointRuleRequestPb) (*UpdateNccPrivateEndpointRuleRequest, error) { - if pb == nil { - return nil, nil - } - st := &UpdateNccPrivateEndpointRuleRequest{} - st.NetworkConnectivityConfigId = pb.NetworkConnectivityConfigId - st.PrivateEndpointRule = pb.PrivateEndpointRule - st.PrivateEndpointRuleId = pb.PrivateEndpointRuleId - st.UpdateMask = pb.UpdateMask - - return st, nil -} - -func updateNetworkPolicyRequestToPb(st *UpdateNetworkPolicyRequest) (*updateNetworkPolicyRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &updateNetworkPolicyRequestPb{} - pb.NetworkPolicy = st.NetworkPolicy - pb.NetworkPolicyId = st.NetworkPolicyId - - return pb, nil -} - -type updateNetworkPolicyRequestPb struct { - NetworkPolicy AccountNetworkPolicy `json:"network_policy"` - NetworkPolicyId string `json:"-" url:"-"` -} - -func updateNetworkPolicyRequestFromPb(pb *updateNetworkPolicyRequestPb) (*UpdateNetworkPolicyRequest, error) { - if pb == nil { - return nil, nil - } - st := &UpdateNetworkPolicyRequest{} - st.NetworkPolicy = pb.NetworkPolicy - st.NetworkPolicyId = pb.NetworkPolicyId - - return st, nil -} - -func updateNotificationDestinationRequestToPb(st *UpdateNotificationDestinationRequest) (*updateNotificationDestinationRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &updateNotificationDestinationRequestPb{} - pb.Config = st.Config - pb.DisplayName = st.DisplayName - pb.Id = st.Id - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type updateNotificationDestinationRequestPb struct { - Config *Config `json:"config,omitempty"` - DisplayName string `json:"display_name,omitempty"` - Id string `json:"-" url:"-"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func updateNotificationDestinationRequestFromPb(pb *updateNotificationDestinationRequestPb) (*UpdateNotificationDestinationRequest, error) { - if pb == nil { - return nil, nil - } - st := &UpdateNotificationDestinationRequest{} - st.Config = pb.Config - st.DisplayName = pb.DisplayName - st.Id = pb.Id - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *updateNotificationDestinationRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st updateNotificationDestinationRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func updatePersonalComputeSettingRequestToPb(st *UpdatePersonalComputeSettingRequest) (*updatePersonalComputeSettingRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &updatePersonalComputeSettingRequestPb{} - pb.AllowMissing = st.AllowMissing - pb.FieldMask = st.FieldMask - pb.Setting = st.Setting - - return pb, nil -} - -type updatePersonalComputeSettingRequestPb struct { - AllowMissing bool `json:"allow_missing"` - FieldMask string `json:"field_mask"` - Setting PersonalComputeSetting `json:"setting"` -} - -func updatePersonalComputeSettingRequestFromPb(pb *updatePersonalComputeSettingRequestPb) (*UpdatePersonalComputeSettingRequest, error) { - if pb == nil { - return nil, nil - } - st := &UpdatePersonalComputeSettingRequest{} - st.AllowMissing = pb.AllowMissing - st.FieldMask = pb.FieldMask - st.Setting = pb.Setting - - return st, nil -} - -func updatePrivateEndpointRuleToPb(st *UpdatePrivateEndpointRule) (*updatePrivateEndpointRulePb, error) { - if st == nil { - return nil, nil - } - pb := &updatePrivateEndpointRulePb{} - pb.DomainNames = st.DomainNames - pb.Enabled = st.Enabled - pb.ResourceNames = st.ResourceNames - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type updatePrivateEndpointRulePb struct { - DomainNames []string `json:"domain_names,omitempty"` - Enabled bool `json:"enabled,omitempty"` - ResourceNames []string `json:"resource_names,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func updatePrivateEndpointRuleFromPb(pb *updatePrivateEndpointRulePb) (*UpdatePrivateEndpointRule, error) { - if pb == nil { - return nil, nil - } - st := &UpdatePrivateEndpointRule{} - st.DomainNames = pb.DomainNames - st.Enabled = pb.Enabled - st.ResourceNames = pb.ResourceNames - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *updatePrivateEndpointRulePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st updatePrivateEndpointRulePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func updateResponseToPb(st *UpdateResponse) (*updateResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &updateResponsePb{} - - return pb, nil -} - -type updateResponsePb struct { -} - -func updateResponseFromPb(pb *updateResponsePb) (*UpdateResponse, error) { - if pb == nil { - return nil, nil - } - st := &UpdateResponse{} - - return st, nil -} - -func updateRestrictWorkspaceAdminsSettingRequestToPb(st *UpdateRestrictWorkspaceAdminsSettingRequest) (*updateRestrictWorkspaceAdminsSettingRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &updateRestrictWorkspaceAdminsSettingRequestPb{} - pb.AllowMissing = st.AllowMissing - pb.FieldMask = st.FieldMask - pb.Setting = st.Setting - - return pb, nil -} - -type updateRestrictWorkspaceAdminsSettingRequestPb struct { - AllowMissing bool `json:"allow_missing"` - FieldMask string `json:"field_mask"` - Setting RestrictWorkspaceAdminsSetting `json:"setting"` -} - -func updateRestrictWorkspaceAdminsSettingRequestFromPb(pb *updateRestrictWorkspaceAdminsSettingRequestPb) (*UpdateRestrictWorkspaceAdminsSettingRequest, error) { - if pb == nil { - return nil, nil - } - st := &UpdateRestrictWorkspaceAdminsSettingRequest{} - st.AllowMissing = pb.AllowMissing - st.FieldMask = pb.FieldMask - st.Setting = pb.Setting - - return st, nil -} - -func updateSqlResultsDownloadRequestToPb(st *UpdateSqlResultsDownloadRequest) (*updateSqlResultsDownloadRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &updateSqlResultsDownloadRequestPb{} - pb.AllowMissing = st.AllowMissing - pb.FieldMask = st.FieldMask - pb.Setting = st.Setting - - return pb, nil -} - -type updateSqlResultsDownloadRequestPb struct { - AllowMissing bool `json:"allow_missing"` - FieldMask string `json:"field_mask"` - Setting SqlResultsDownload `json:"setting"` -} - -func updateSqlResultsDownloadRequestFromPb(pb *updateSqlResultsDownloadRequestPb) (*UpdateSqlResultsDownloadRequest, error) { - if pb == nil { - return nil, nil - } - st := &UpdateSqlResultsDownloadRequest{} - st.AllowMissing = pb.AllowMissing - st.FieldMask = pb.FieldMask - st.Setting = pb.Setting - - return st, nil -} - -func updateWorkspaceNetworkOptionRequestToPb(st *UpdateWorkspaceNetworkOptionRequest) (*updateWorkspaceNetworkOptionRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &updateWorkspaceNetworkOptionRequestPb{} - pb.WorkspaceId = st.WorkspaceId - pb.WorkspaceNetworkOption = st.WorkspaceNetworkOption - - return pb, nil -} - -type updateWorkspaceNetworkOptionRequestPb struct { - WorkspaceId int64 `json:"-" url:"-"` - WorkspaceNetworkOption WorkspaceNetworkOption `json:"workspace_network_option"` -} - -func updateWorkspaceNetworkOptionRequestFromPb(pb *updateWorkspaceNetworkOptionRequestPb) (*UpdateWorkspaceNetworkOptionRequest, error) { - if pb == nil { - return nil, nil - } - st := &UpdateWorkspaceNetworkOptionRequest{} - st.WorkspaceId = pb.WorkspaceId - st.WorkspaceNetworkOption = pb.WorkspaceNetworkOption - - return st, nil -} - -type workspaceConfPb WorkspaceConf - -func workspaceConfToPb(st *WorkspaceConf) (*workspaceConfPb, error) { - if st == nil { - return nil, nil - } - stPb := workspaceConfPb(*st) - return &stPb, nil -} - -func workspaceConfFromPb(stPb *workspaceConfPb) (*WorkspaceConf, error) { - if stPb == nil { - return nil, nil - } - st := WorkspaceConf(*stPb) - return &st, nil -} - -func workspaceNetworkOptionToPb(st *WorkspaceNetworkOption) (*workspaceNetworkOptionPb, error) { - if st == nil { - return nil, nil - } - pb := &workspaceNetworkOptionPb{} - pb.NetworkPolicyId = st.NetworkPolicyId - pb.WorkspaceId = st.WorkspaceId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type workspaceNetworkOptionPb struct { - NetworkPolicyId string `json:"network_policy_id,omitempty"` - WorkspaceId int64 `json:"workspace_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func workspaceNetworkOptionFromPb(pb *workspaceNetworkOptionPb) (*WorkspaceNetworkOption, error) { - if pb == nil { - return nil, nil - } - st := &WorkspaceNetworkOption{} - st.NetworkPolicyId = pb.NetworkPolicyId - st.WorkspaceId = pb.WorkspaceId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *workspaceNetworkOptionPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st workspaceNetworkOptionPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func durationToPb(d *time.Duration) (*string, error) { - if d == nil { - return nil, nil - } - s := fmt.Sprintf("%.9fs", d.Seconds()) - return &s, nil -} - -func durationFromPb(s *string) (*time.Duration, error) { - if s == nil { - return nil, nil - } - d, err := time.ParseDuration(*s) - if err != nil { - return nil, err - } - return &d, nil -} - -func timestampToPb(t *time.Time) (*string, error) { - if t == nil { - return nil, nil - } - s := t.Format(time.RFC3339) - return &s, nil -} - -func timestampFromPb(s *string) (*time.Time, error) { - if s == nil { - return nil, nil - } - t, err := time.Parse(time.RFC3339, *s) - if err != nil { - return nil, err - } - return &t, nil -} - -func fieldMaskToPb(fm *[]string) (*string, error) { - if fm == nil { - return nil, nil - } - s := strings.Join(*fm, ",") - return &s, nil -} - -func fieldMaskFromPb(s *string) (*[]string, error) { - if s == nil { - return nil, nil - } - fm := strings.Split(*s, ",") - return &fm, nil -} diff --git a/service/settings/model.go b/service/settings/model.go index 42ccbf5a9..6e83773e2 100755 --- a/service/settings/model.go +++ b/service/settings/model.go @@ -3,13 +3,12 @@ package settings import ( - "encoding/json" "fmt" + + "github.com/databricks/databricks-sdk-go/marshal" ) type AccountIpAccessEnable struct { - - // Wire name: 'acct_ip_acl_enable' AcctIpAclEnable BooleanMessage `json:"acct_ip_acl_enable"` // etag used for versioning. The response is at least as fresh as the eTag // provided. This is used for optimistic concurrency control as a way to @@ -18,114 +17,48 @@ type AccountIpAccessEnable struct { // update pattern to perform setting updates in order to avoid race // conditions. That is, get an etag from a GET request, and pass it with the // PATCH request to identify the setting version you are updating. - // Wire name: 'etag' Etag string `json:"etag,omitempty"` // Name of the corresponding setting. This field is populated in the // response, but it will not be respected even if it's set in the request // body. The setting name in the path parameter will be respected instead. // Setting name is required to be 'default' if the setting only has one // instance per workspace. - // Wire name: 'setting_name' SettingName string `json:"setting_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *AccountIpAccessEnable) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &accountIpAccessEnablePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := accountIpAccessEnableFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *AccountIpAccessEnable) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st AccountIpAccessEnable) MarshalJSON() ([]byte, error) { - pb, err := accountIpAccessEnableToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s AccountIpAccessEnable) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type AccountNetworkPolicy struct { // The associated account ID for this Network Policy object. - // Wire name: 'account_id' AccountId string `json:"account_id,omitempty"` // The network policies applying for egress traffic. - // Wire name: 'egress' Egress *NetworkPolicyEgress `json:"egress,omitempty"` // The unique identifier for the network policy. - // Wire name: 'network_policy_id' NetworkPolicyId string `json:"network_policy_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *AccountNetworkPolicy) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &accountNetworkPolicyPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := accountNetworkPolicyFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *AccountNetworkPolicy) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st AccountNetworkPolicy) MarshalJSON() ([]byte, error) { - pb, err := accountNetworkPolicyToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s AccountNetworkPolicy) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type AibiDashboardEmbeddingAccessPolicy struct { - - // Wire name: 'access_policy_type' AccessPolicyType AibiDashboardEmbeddingAccessPolicyAccessPolicyType `json:"access_policy_type"` } -func (st *AibiDashboardEmbeddingAccessPolicy) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &aibiDashboardEmbeddingAccessPolicyPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := aibiDashboardEmbeddingAccessPolicyFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st AibiDashboardEmbeddingAccessPolicy) MarshalJSON() ([]byte, error) { - pb, err := aibiDashboardEmbeddingAccessPolicyToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type AibiDashboardEmbeddingAccessPolicyAccessPolicyType string const AibiDashboardEmbeddingAccessPolicyAccessPolicyTypeAllowAllDomains AibiDashboardEmbeddingAccessPolicyAccessPolicyType = `ALLOW_ALL_DOMAINS` @@ -167,8 +100,6 @@ func (f *AibiDashboardEmbeddingAccessPolicyAccessPolicyType) Type() string { } type AibiDashboardEmbeddingAccessPolicySetting struct { - - // Wire name: 'aibi_dashboard_embedding_access_policy' AibiDashboardEmbeddingAccessPolicy AibiDashboardEmbeddingAccessPolicy `json:"aibi_dashboard_embedding_access_policy"` // etag used for versioning. The response is at least as fresh as the eTag // provided. This is used for optimistic concurrency control as a way to @@ -177,78 +108,30 @@ type AibiDashboardEmbeddingAccessPolicySetting struct { // update pattern to perform setting updates in order to avoid race // conditions. That is, get an etag from a GET request, and pass it with the // PATCH request to identify the setting version you are updating. - // Wire name: 'etag' Etag string `json:"etag,omitempty"` // Name of the corresponding setting. This field is populated in the // response, but it will not be respected even if it's set in the request // body. The setting name in the path parameter will be respected instead. // Setting name is required to be 'default' if the setting only has one // instance per workspace. - // Wire name: 'setting_name' SettingName string `json:"setting_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *AibiDashboardEmbeddingAccessPolicySetting) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &aibiDashboardEmbeddingAccessPolicySettingPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := aibiDashboardEmbeddingAccessPolicySettingFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *AibiDashboardEmbeddingAccessPolicySetting) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st AibiDashboardEmbeddingAccessPolicySetting) MarshalJSON() ([]byte, error) { - pb, err := aibiDashboardEmbeddingAccessPolicySettingToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s AibiDashboardEmbeddingAccessPolicySetting) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type AibiDashboardEmbeddingApprovedDomains struct { - - // Wire name: 'approved_domains' ApprovedDomains []string `json:"approved_domains,omitempty"` } -func (st *AibiDashboardEmbeddingApprovedDomains) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &aibiDashboardEmbeddingApprovedDomainsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := aibiDashboardEmbeddingApprovedDomainsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st AibiDashboardEmbeddingApprovedDomains) MarshalJSON() ([]byte, error) { - pb, err := aibiDashboardEmbeddingApprovedDomainsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type AibiDashboardEmbeddingApprovedDomainsSetting struct { - - // Wire name: 'aibi_dashboard_embedding_approved_domains' AibiDashboardEmbeddingApprovedDomains AibiDashboardEmbeddingApprovedDomains `json:"aibi_dashboard_embedding_approved_domains"` // etag used for versioning. The response is at least as fresh as the eTag // provided. This is used for optimistic concurrency control as a way to @@ -257,47 +140,26 @@ type AibiDashboardEmbeddingApprovedDomainsSetting struct { // update pattern to perform setting updates in order to avoid race // conditions. That is, get an etag from a GET request, and pass it with the // PATCH request to identify the setting version you are updating. - // Wire name: 'etag' Etag string `json:"etag,omitempty"` // Name of the corresponding setting. This field is populated in the // response, but it will not be respected even if it's set in the request // body. The setting name in the path parameter will be respected instead. // Setting name is required to be 'default' if the setting only has one // instance per workspace. - // Wire name: 'setting_name' SettingName string `json:"setting_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *AibiDashboardEmbeddingApprovedDomainsSetting) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &aibiDashboardEmbeddingApprovedDomainsSettingPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := aibiDashboardEmbeddingApprovedDomainsSettingFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *AibiDashboardEmbeddingApprovedDomainsSetting) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st AibiDashboardEmbeddingApprovedDomainsSetting) MarshalJSON() ([]byte, error) { - pb, err := aibiDashboardEmbeddingApprovedDomainsSettingToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s AibiDashboardEmbeddingApprovedDomainsSetting) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type AutomaticClusterUpdateSetting struct { - - // Wire name: 'automatic_cluster_update_workspace' AutomaticClusterUpdateWorkspace ClusterAutoRestartMessage `json:"automatic_cluster_update_workspace"` // etag used for versioning. The response is at least as fresh as the eTag // provided. This is used for optimistic concurrency control as a way to @@ -306,83 +168,42 @@ type AutomaticClusterUpdateSetting struct { // update pattern to perform setting updates in order to avoid race // conditions. That is, get an etag from a GET request, and pass it with the // PATCH request to identify the setting version you are updating. - // Wire name: 'etag' Etag string `json:"etag,omitempty"` // Name of the corresponding setting. This field is populated in the // response, but it will not be respected even if it's set in the request // body. The setting name in the path parameter will be respected instead. // Setting name is required to be 'default' if the setting only has one // instance per workspace. - // Wire name: 'setting_name' SettingName string `json:"setting_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *AutomaticClusterUpdateSetting) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &automaticClusterUpdateSettingPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := automaticClusterUpdateSettingFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *AutomaticClusterUpdateSetting) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st AutomaticClusterUpdateSetting) MarshalJSON() ([]byte, error) { - pb, err := automaticClusterUpdateSettingToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s AutomaticClusterUpdateSetting) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type BooleanMessage struct { - - // Wire name: 'value' Value bool `json:"value,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *BooleanMessage) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &booleanMessagePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := booleanMessageFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *BooleanMessage) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st BooleanMessage) MarshalJSON() ([]byte, error) { - pb, err := booleanMessageToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s BooleanMessage) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ClusterAutoRestartMessage struct { - - // Wire name: 'can_toggle' CanToggle bool `json:"can_toggle,omitempty"` - // Wire name: 'enabled' Enabled bool `json:"enabled,omitempty"` // Contains an information about the enablement status judging (e.g. whether // the enterprise tier is enabled) This is only additional information that @@ -390,41 +211,21 @@ type ClusterAutoRestartMessage struct { // intended to use only for purposes like showing an error message to the // customer with the additional details. For example, using these details we // can check why exactly the feature is disabled for this customer. - // Wire name: 'enablement_details' EnablementDetails *ClusterAutoRestartMessageEnablementDetails `json:"enablement_details,omitempty"` - // Wire name: 'maintenance_window' MaintenanceWindow *ClusterAutoRestartMessageMaintenanceWindow `json:"maintenance_window,omitempty"` - // Wire name: 'restart_even_if_no_updates_available' RestartEvenIfNoUpdatesAvailable bool `json:"restart_even_if_no_updates_available,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ClusterAutoRestartMessage) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &clusterAutoRestartMessagePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := clusterAutoRestartMessageFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ClusterAutoRestartMessage) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ClusterAutoRestartMessage) MarshalJSON() ([]byte, error) { - pb, err := clusterAutoRestartMessageToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ClusterAutoRestartMessage) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Contains an information about the enablement status judging (e.g. whether the @@ -435,75 +236,28 @@ func (st ClusterAutoRestartMessage) MarshalJSON() ([]byte, error) { // the feature is disabled for this customer. type ClusterAutoRestartMessageEnablementDetails struct { // The feature is force enabled if compliance mode is active - // Wire name: 'forced_for_compliance_mode' ForcedForComplianceMode bool `json:"forced_for_compliance_mode,omitempty"` // The feature is unavailable if the corresponding entitlement disabled (see // getShieldEntitlementEnable) - // Wire name: 'unavailable_for_disabled_entitlement' UnavailableForDisabledEntitlement bool `json:"unavailable_for_disabled_entitlement,omitempty"` // The feature is unavailable if the customer doesn't have enterprise tier - // Wire name: 'unavailable_for_non_enterprise_tier' UnavailableForNonEnterpriseTier bool `json:"unavailable_for_non_enterprise_tier,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ClusterAutoRestartMessageEnablementDetails) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &clusterAutoRestartMessageEnablementDetailsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := clusterAutoRestartMessageEnablementDetailsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ClusterAutoRestartMessageEnablementDetails) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ClusterAutoRestartMessageEnablementDetails) MarshalJSON() ([]byte, error) { - pb, err := clusterAutoRestartMessageEnablementDetailsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ClusterAutoRestartMessageEnablementDetails) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ClusterAutoRestartMessageMaintenanceWindow struct { - - // Wire name: 'week_day_based_schedule' WeekDayBasedSchedule *ClusterAutoRestartMessageMaintenanceWindowWeekDayBasedSchedule `json:"week_day_based_schedule,omitempty"` } -func (st *ClusterAutoRestartMessageMaintenanceWindow) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &clusterAutoRestartMessageMaintenanceWindowPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := clusterAutoRestartMessageMaintenanceWindowFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ClusterAutoRestartMessageMaintenanceWindow) MarshalJSON() ([]byte, error) { - pb, err := clusterAutoRestartMessageMaintenanceWindowToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type ClusterAutoRestartMessageMaintenanceWindowDayOfWeek string const ClusterAutoRestartMessageMaintenanceWindowDayOfWeekFriday ClusterAutoRestartMessageMaintenanceWindowDayOfWeek = `FRIDAY` @@ -557,42 +311,13 @@ func (f *ClusterAutoRestartMessageMaintenanceWindowDayOfWeek) Type() string { } type ClusterAutoRestartMessageMaintenanceWindowWeekDayBasedSchedule struct { - - // Wire name: 'day_of_week' DayOfWeek ClusterAutoRestartMessageMaintenanceWindowDayOfWeek `json:"day_of_week,omitempty"` - // Wire name: 'frequency' Frequency ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequency `json:"frequency,omitempty"` - // Wire name: 'window_start_time' WindowStartTime *ClusterAutoRestartMessageMaintenanceWindowWindowStartTime `json:"window_start_time,omitempty"` } -func (st *ClusterAutoRestartMessageMaintenanceWindowWeekDayBasedSchedule) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &clusterAutoRestartMessageMaintenanceWindowWeekDayBasedSchedulePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := clusterAutoRestartMessageMaintenanceWindowWeekDayBasedScheduleFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ClusterAutoRestartMessageMaintenanceWindowWeekDayBasedSchedule) MarshalJSON() ([]byte, error) { - pb, err := clusterAutoRestartMessageMaintenanceWindowWeekDayBasedScheduleToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequency string const ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequencyEveryWeek ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequency = `EVERY_WEEK` @@ -646,81 +371,41 @@ func (f *ClusterAutoRestartMessageMaintenanceWindowWeekDayFrequency) Type() stri } type ClusterAutoRestartMessageMaintenanceWindowWindowStartTime struct { - - // Wire name: 'hours' Hours int `json:"hours,omitempty"` - // Wire name: 'minutes' Minutes int `json:"minutes,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ClusterAutoRestartMessageMaintenanceWindowWindowStartTime) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &clusterAutoRestartMessageMaintenanceWindowWindowStartTimePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := clusterAutoRestartMessageMaintenanceWindowWindowStartTimeFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ClusterAutoRestartMessageMaintenanceWindowWindowStartTime) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ClusterAutoRestartMessageMaintenanceWindowWindowStartTime) MarshalJSON() ([]byte, error) { - pb, err := clusterAutoRestartMessageMaintenanceWindowWindowStartTimeToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ClusterAutoRestartMessageMaintenanceWindowWindowStartTime) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // SHIELD feature: CSP type ComplianceSecurityProfile struct { // Set by customers when they request Compliance Security Profile (CSP) - // Wire name: 'compliance_standards' ComplianceStandards []ComplianceStandard `json:"compliance_standards,omitempty"` - // Wire name: 'is_enabled' IsEnabled bool `json:"is_enabled,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ComplianceSecurityProfile) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &complianceSecurityProfilePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := complianceSecurityProfileFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ComplianceSecurityProfile) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ComplianceSecurityProfile) MarshalJSON() ([]byte, error) { - pb, err := complianceSecurityProfileToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ComplianceSecurityProfile) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ComplianceSecurityProfileSetting struct { // SHIELD feature: CSP - // Wire name: 'compliance_security_profile_workspace' ComplianceSecurityProfileWorkspace ComplianceSecurityProfile `json:"compliance_security_profile_workspace"` // etag used for versioning. The response is at least as fresh as the eTag // provided. This is used for optimistic concurrency control as a way to @@ -729,42 +414,23 @@ type ComplianceSecurityProfileSetting struct { // update pattern to perform setting updates in order to avoid race // conditions. That is, get an etag from a GET request, and pass it with the // PATCH request to identify the setting version you are updating. - // Wire name: 'etag' Etag string `json:"etag,omitempty"` // Name of the corresponding setting. This field is populated in the // response, but it will not be respected even if it's set in the request // body. The setting name in the path parameter will be respected instead. // Setting name is required to be 'default' if the setting only has one // instance per workspace. - // Wire name: 'setting_name' SettingName string `json:"setting_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ComplianceSecurityProfileSetting) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &complianceSecurityProfileSettingPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := complianceSecurityProfileSettingFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ComplianceSecurityProfileSetting) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ComplianceSecurityProfileSetting) MarshalJSON() ([]byte, error) { - pb, err := complianceSecurityProfileSettingToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ComplianceSecurityProfileSetting) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Compliance stardard for SHIELD customers @@ -839,55 +505,21 @@ func (f *ComplianceStandard) Type() string { } type Config struct { - - // Wire name: 'email' Email *EmailConfig `json:"email,omitempty"` - // Wire name: 'generic_webhook' GenericWebhook *GenericWebhookConfig `json:"generic_webhook,omitempty"` - // Wire name: 'microsoft_teams' MicrosoftTeams *MicrosoftTeamsConfig `json:"microsoft_teams,omitempty"` - // Wire name: 'pagerduty' Pagerduty *PagerdutyConfig `json:"pagerduty,omitempty"` - // Wire name: 'slack' Slack *SlackConfig `json:"slack,omitempty"` } -func (st *Config) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &configPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := configFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st Config) MarshalJSON() ([]byte, error) { - pb, err := configToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Details required to configure a block list or allow list. type CreateIpAccessList struct { - - // Wire name: 'ip_addresses' IpAddresses []string `json:"ip_addresses,omitempty"` // Label for the IP access list. This **cannot** be empty. - // Wire name: 'label' Label string `json:"label"` // Type of IP access list. Valid values are as follows and are // case-sensitive: @@ -895,283 +527,92 @@ type CreateIpAccessList struct { // * `ALLOW`: An allow list. Include this IP or range. * `BLOCK`: A block // list. Exclude this IP or range. IP addresses in the block list are // excluded even if they are included in an allow list. - // Wire name: 'list_type' ListType ListType `json:"list_type"` } -func (st *CreateIpAccessList) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createIpAccessListPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createIpAccessListFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CreateIpAccessList) MarshalJSON() ([]byte, error) { - pb, err := createIpAccessListToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // An IP access list was successfully created. type CreateIpAccessListResponse struct { // Definition of an IP Access list - // Wire name: 'ip_access_list' IpAccessList *IpAccessListInfo `json:"ip_access_list,omitempty"` } -func (st *CreateIpAccessListResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createIpAccessListResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createIpAccessListResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CreateIpAccessListResponse) MarshalJSON() ([]byte, error) { - pb, err := createIpAccessListResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Create a network connectivity configuration type CreateNetworkConnectivityConfigRequest struct { // Properties of the new network connectivity configuration. - // Wire name: 'network_connectivity_config' NetworkConnectivityConfig CreateNetworkConnectivityConfiguration `json:"network_connectivity_config"` } -func (st *CreateNetworkConnectivityConfigRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createNetworkConnectivityConfigRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createNetworkConnectivityConfigRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CreateNetworkConnectivityConfigRequest) MarshalJSON() ([]byte, error) { - pb, err := createNetworkConnectivityConfigRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Properties of the new network connectivity configuration. type CreateNetworkConnectivityConfiguration struct { // The name of the network connectivity configuration. The name can contain // alphanumeric characters, hyphens, and underscores. The length must be // between 3 and 30 characters. The name must match the regular expression // ^[0-9a-zA-Z-_]{3,30}$ - // Wire name: 'name' Name string `json:"name"` // The region for the network connectivity configuration. Only workspaces in // the same region can be attached to the network connectivity // configuration. - // Wire name: 'region' Region string `json:"region"` } -func (st *CreateNetworkConnectivityConfiguration) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createNetworkConnectivityConfigurationPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createNetworkConnectivityConfigurationFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CreateNetworkConnectivityConfiguration) MarshalJSON() ([]byte, error) { - pb, err := createNetworkConnectivityConfigurationToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Create a network policy type CreateNetworkPolicyRequest struct { - - // Wire name: 'network_policy' NetworkPolicy AccountNetworkPolicy `json:"network_policy"` } -func (st *CreateNetworkPolicyRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createNetworkPolicyRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createNetworkPolicyRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CreateNetworkPolicyRequest) MarshalJSON() ([]byte, error) { - pb, err := createNetworkPolicyRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type CreateNotificationDestinationRequest struct { // The configuration for the notification destination. Must wrap EXACTLY one // of the nested configs. - // Wire name: 'config' Config *Config `json:"config,omitempty"` // The display name for the notification destination. - // Wire name: 'display_name' DisplayName string `json:"display_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateNotificationDestinationRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createNotificationDestinationRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createNotificationDestinationRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateNotificationDestinationRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateNotificationDestinationRequest) MarshalJSON() ([]byte, error) { - pb, err := createNotificationDestinationRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateNotificationDestinationRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Configuration details for creating on-behalf tokens. type CreateOboTokenRequest struct { // Application ID of the service principal. - // Wire name: 'application_id' ApplicationId string `json:"application_id"` // Comment that describes the purpose of the token. - // Wire name: 'comment' Comment string `json:"comment,omitempty"` // The number of seconds before the token expires. - // Wire name: 'lifetime_seconds' LifetimeSeconds int64 `json:"lifetime_seconds,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateOboTokenRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createOboTokenRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createOboTokenRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateOboTokenRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateOboTokenRequest) MarshalJSON() ([]byte, error) { - pb, err := createOboTokenRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateOboTokenRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // An on-behalf token was successfully created for the service principal. type CreateOboTokenResponse struct { - - // Wire name: 'token_info' TokenInfo *TokenInfo `json:"token_info,omitempty"` // Value of the token. - // Wire name: 'token_value' TokenValue string `json:"token_value,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateOboTokenResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createOboTokenResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createOboTokenResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateOboTokenResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateOboTokenResponse) MarshalJSON() ([]byte, error) { - pb, err := createOboTokenResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateOboTokenResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Properties of the new private endpoint rule. Note that you must approve the @@ -1182,21 +623,17 @@ type CreatePrivateEndpointRule struct { // // Domain names of target private link service. When updating this field, // the full list of target domain_names must be specified. - // Wire name: 'domain_names' DomainNames []string `json:"domain_names,omitempty"` // The full target AWS endpoint service name that connects to the // destination resources of the private endpoint. - // Wire name: 'endpoint_service' EndpointService string `json:"endpoint_service,omitempty"` // Not used by customer-managed private endpoint services. // // The sub-resource type (group ID) of the target resource. Note that to // connect to workspace root storage (root DBFS), you need two endpoints, // one for blob and one for dfs. - // Wire name: 'group_id' GroupId string `json:"group_id,omitempty"` // The Azure resource ID of the target resource. - // Wire name: 'resource_id' ResourceId string `json:"resource_id,omitempty"` // Only used by private endpoints towards AWS S3 service. // @@ -1204,187 +641,85 @@ type CreatePrivateEndpointRule struct { // endpoint. The bucket names must be in the same region as the NCC/endpoint // service. When updating this field, we perform full update on this field. // Please ensure a full list of desired resource_names is provided. - // Wire name: 'resource_names' ResourceNames []string `json:"resource_names,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreatePrivateEndpointRule) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createPrivateEndpointRulePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createPrivateEndpointRuleFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreatePrivateEndpointRule) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreatePrivateEndpointRule) MarshalJSON() ([]byte, error) { - pb, err := createPrivateEndpointRuleToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreatePrivateEndpointRule) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Create a private endpoint rule type CreatePrivateEndpointRuleRequest struct { // Your Network Connectivity Configuration ID. - NetworkConnectivityConfigId string `json:"-" tf:"-"` + NetworkConnectivityConfigId string `json:"-" url:"-"` // Properties of the new private endpoint rule. Note that you must approve // the endpoint in Azure portal after initialization. - // Wire name: 'private_endpoint_rule' PrivateEndpointRule CreatePrivateEndpointRule `json:"private_endpoint_rule"` } -func (st *CreatePrivateEndpointRuleRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createPrivateEndpointRuleRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createPrivateEndpointRuleRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CreatePrivateEndpointRuleRequest) MarshalJSON() ([]byte, error) { - pb, err := createPrivateEndpointRuleRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type CreateTokenRequest struct { // Optional description to attach to the token. - // Wire name: 'comment' Comment string `json:"comment,omitempty"` // The lifetime of the token, in seconds. // // If the lifetime is not specified, this token remains valid indefinitely. - // Wire name: 'lifetime_seconds' LifetimeSeconds int64 `json:"lifetime_seconds,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateTokenRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createTokenRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createTokenRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateTokenRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateTokenRequest) MarshalJSON() ([]byte, error) { - pb, err := createTokenRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateTokenRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreateTokenResponse struct { // The information for the new token. - // Wire name: 'token_info' TokenInfo *PublicTokenInfo `json:"token_info,omitempty"` // The value of the new token. - // Wire name: 'token_value' TokenValue string `json:"token_value,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateTokenResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createTokenResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createTokenResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateTokenResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateTokenResponse) MarshalJSON() ([]byte, error) { - pb, err := createTokenResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateTokenResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Account level policy for CSP type CspEnablementAccount struct { // Set by customers when they request Compliance Security Profile (CSP) // Invariants are enforced in Settings policy. - // Wire name: 'compliance_standards' ComplianceStandards []ComplianceStandard `json:"compliance_standards,omitempty"` // Enforced = it cannot be overriden at workspace level. - // Wire name: 'is_enforced' IsEnforced bool `json:"is_enforced,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CspEnablementAccount) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &cspEnablementAccountPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := cspEnablementAccountFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CspEnablementAccount) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CspEnablementAccount) MarshalJSON() ([]byte, error) { - pb, err := cspEnablementAccountToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CspEnablementAccount) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CspEnablementAccountSetting struct { // Account level policy for CSP - // Wire name: 'csp_enablement_account' CspEnablementAccount CspEnablementAccount `json:"csp_enablement_account"` // etag used for versioning. The response is at least as fresh as the eTag // provided. This is used for optimistic concurrency control as a way to @@ -1393,42 +728,23 @@ type CspEnablementAccountSetting struct { // update pattern to perform setting updates in order to avoid race // conditions. That is, get an etag from a GET request, and pass it with the // PATCH request to identify the setting version you are updating. - // Wire name: 'etag' Etag string `json:"etag,omitempty"` // Name of the corresponding setting. This field is populated in the // response, but it will not be respected even if it's set in the request // body. The setting name in the path parameter will be respected instead. // Setting name is required to be 'default' if the setting only has one // instance per workspace. - // Wire name: 'setting_name' SettingName string `json:"setting_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CspEnablementAccountSetting) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &cspEnablementAccountSettingPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := cspEnablementAccountSettingFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CspEnablementAccountSetting) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CspEnablementAccountSetting) MarshalJSON() ([]byte, error) { - pb, err := cspEnablementAccountSettingToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CspEnablementAccountSetting) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Properties of the new private endpoint rule. Note that for private endpoints @@ -1437,7 +753,6 @@ func (st CspEnablementAccountSetting) MarshalJSON() ([]byte, error) { type CustomerFacingNetworkConnectivityConfigAwsPrivateEndpointRule struct { // Databricks account ID. You can find your account ID from the Accounts // Console. - // Wire name: 'account_id' AccountId string `json:"account_id,omitempty"` // The current status of this private endpoint. The private endpoint rules // are effective only if the connection state is ESTABLISHED. Remember that @@ -1450,16 +765,12 @@ type CustomerFacingNetworkConnectivityConfigAwsPrivateEndpointRule struct { // the private endpoint becomes informative and should be deleted for // clean-up. - EXPIRED: If the endpoint is created but not approved in 14 // days, it is EXPIRED. - // Wire name: 'connection_state' ConnectionState CustomerFacingNetworkConnectivityConfigAwsPrivateEndpointRulePrivateLinkConnectionState `json:"connection_state,omitempty"` // Time in epoch milliseconds when this object was created. - // Wire name: 'creation_time' CreationTime int64 `json:"creation_time,omitempty"` // Whether this private endpoint is deactivated. - // Wire name: 'deactivated' Deactivated bool `json:"deactivated,omitempty"` // Time in epoch milliseconds when this object was deactivated. - // Wire name: 'deactivated_at' DeactivatedAt int64 `json:"deactivated_at,omitempty"` // Only used by private endpoints towards a VPC endpoint service for // customer-managed VPC endpoint service. @@ -1467,21 +778,17 @@ type CustomerFacingNetworkConnectivityConfigAwsPrivateEndpointRule struct { // The target AWS resource FQDNs accessible via the VPC endpoint service. // When updating this field, we perform full update on this field. Please // ensure a full list of desired domain_names is provided. - // Wire name: 'domain_names' DomainNames []string `json:"domain_names,omitempty"` // Only used by private endpoints towards an AWS S3 service. // // Update this field to activate/deactivate this private endpoint to allow // egress access from serverless compute resources. - // Wire name: 'enabled' Enabled bool `json:"enabled,omitempty"` // The full target AWS endpoint service name that connects to the // destination resources of the private endpoint. - // Wire name: 'endpoint_service' EndpointService string `json:"endpoint_service,omitempty"` // The ID of a network connectivity configuration, which is the parent // resource of this private endpoint rule object. - // Wire name: 'network_connectivity_config_id' NetworkConnectivityConfigId string `json:"network_connectivity_config_id,omitempty"` // Only used by private endpoints towards AWS S3 service. // @@ -1489,45 +796,24 @@ type CustomerFacingNetworkConnectivityConfigAwsPrivateEndpointRule struct { // endpoint. The bucket names must be in the same region as the NCC/endpoint // service. When updating this field, we perform full update on this field. // Please ensure a full list of desired resource_names is provided. - // Wire name: 'resource_names' ResourceNames []string `json:"resource_names,omitempty"` // The ID of a private endpoint rule. - // Wire name: 'rule_id' RuleId string `json:"rule_id,omitempty"` // Time in epoch milliseconds when this object was updated. - // Wire name: 'updated_time' UpdatedTime int64 `json:"updated_time,omitempty"` // The AWS VPC endpoint ID. You can use this ID to identify VPC endpoint // created by Databricks. - // Wire name: 'vpc_endpoint_id' VpcEndpointId string `json:"vpc_endpoint_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CustomerFacingNetworkConnectivityConfigAwsPrivateEndpointRule) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &customerFacingNetworkConnectivityConfigAwsPrivateEndpointRulePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := customerFacingNetworkConnectivityConfigAwsPrivateEndpointRuleFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CustomerFacingNetworkConnectivityConfigAwsPrivateEndpointRule) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CustomerFacingNetworkConnectivityConfigAwsPrivateEndpointRule) MarshalJSON() ([]byte, error) { - pb, err := customerFacingNetworkConnectivityConfigAwsPrivateEndpointRuleToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CustomerFacingNetworkConnectivityConfigAwsPrivateEndpointRule) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CustomerFacingNetworkConnectivityConfigAwsPrivateEndpointRulePrivateLinkConnectionState string @@ -1577,8 +863,6 @@ func (f *CustomerFacingNetworkConnectivityConfigAwsPrivateEndpointRulePrivateLin } type DashboardEmailSubscriptions struct { - - // Wire name: 'boolean_val' BooleanVal BooleanMessage `json:"boolean_val"` // etag used for versioning. The response is at least as fresh as the eTag // provided. This is used for optimistic concurrency control as a way to @@ -1587,42 +871,23 @@ type DashboardEmailSubscriptions struct { // update pattern to perform setting updates in order to avoid race // conditions. That is, get an etag from a GET request, and pass it with the // PATCH request to identify the setting version you are updating. - // Wire name: 'etag' Etag string `json:"etag,omitempty"` // Name of the corresponding setting. This field is populated in the // response, but it will not be respected even if it's set in the request // body. The setting name in the path parameter will be respected instead. // Setting name is required to be 'default' if the setting only has one // instance per workspace. - // Wire name: 'setting_name' SettingName string `json:"setting_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DashboardEmailSubscriptions) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &dashboardEmailSubscriptionsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := dashboardEmailSubscriptionsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DashboardEmailSubscriptions) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DashboardEmailSubscriptions) MarshalJSON() ([]byte, error) { - pb, err := dashboardEmailSubscriptionsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DashboardEmailSubscriptions) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // This represents the setting configuration for the default namespace in the @@ -1642,45 +907,25 @@ type DefaultNamespaceSetting struct { // update pattern to perform setting updates in order to avoid race // conditions. That is, get an etag from a GET request, and pass it with the // PATCH request to identify the setting version you are updating. - // Wire name: 'etag' Etag string `json:"etag,omitempty"` - // Wire name: 'namespace' Namespace StringMessage `json:"namespace"` // Name of the corresponding setting. This field is populated in the // response, but it will not be respected even if it's set in the request // body. The setting name in the path parameter will be respected instead. // Setting name is required to be 'default' if the setting only has one // instance per workspace. - // Wire name: 'setting_name' SettingName string `json:"setting_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DefaultNamespaceSetting) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &defaultNamespaceSettingPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := defaultNamespaceSettingFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DefaultNamespaceSetting) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DefaultNamespaceSetting) MarshalJSON() ([]byte, error) { - pb, err := defaultNamespaceSettingToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DefaultNamespaceSetting) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Delete the account IP access toggle setting @@ -1692,34 +937,17 @@ type DeleteAccountIpAccessEnableRequest struct { // delete pattern to perform setting deletions in order to avoid race // conditions. That is, get an etag from a GET request, and pass it with the // DELETE request to identify the rule set version you are deleting. - Etag string `json:"-" tf:"-"` + Etag string `json:"-" url:"etag,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DeleteAccountIpAccessEnableRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteAccountIpAccessEnableRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteAccountIpAccessEnableRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DeleteAccountIpAccessEnableRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DeleteAccountIpAccessEnableRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteAccountIpAccessEnableRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DeleteAccountIpAccessEnableRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The etag is returned. @@ -1731,64 +959,13 @@ type DeleteAccountIpAccessEnableResponse struct { // delete pattern to perform setting deletions in order to avoid race // conditions. That is, get an etag from a GET request, and pass it with the // DELETE request to identify the rule set version you are deleting. - // Wire name: 'etag' Etag string `json:"etag"` } -func (st *DeleteAccountIpAccessEnableResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteAccountIpAccessEnableResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteAccountIpAccessEnableResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteAccountIpAccessEnableResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteAccountIpAccessEnableResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Delete access list type DeleteAccountIpAccessListRequest struct { // The ID for the corresponding IP access list - IpAccessListId string `json:"-" tf:"-"` -} - -func (st *DeleteAccountIpAccessListRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteAccountIpAccessListRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteAccountIpAccessListRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteAccountIpAccessListRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteAccountIpAccessListRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + IpAccessListId string `json:"-" url:"-"` } // Delete the AI/BI dashboard embedding access policy @@ -1800,34 +977,17 @@ type DeleteAibiDashboardEmbeddingAccessPolicySettingRequest struct { // delete pattern to perform setting deletions in order to avoid race // conditions. That is, get an etag from a GET request, and pass it with the // DELETE request to identify the rule set version you are deleting. - Etag string `json:"-" tf:"-"` + Etag string `json:"-" url:"etag,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DeleteAibiDashboardEmbeddingAccessPolicySettingRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteAibiDashboardEmbeddingAccessPolicySettingRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteAibiDashboardEmbeddingAccessPolicySettingRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DeleteAibiDashboardEmbeddingAccessPolicySettingRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DeleteAibiDashboardEmbeddingAccessPolicySettingRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteAibiDashboardEmbeddingAccessPolicySettingRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DeleteAibiDashboardEmbeddingAccessPolicySettingRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The etag is returned. @@ -1839,35 +999,9 @@ type DeleteAibiDashboardEmbeddingAccessPolicySettingResponse struct { // delete pattern to perform setting deletions in order to avoid race // conditions. That is, get an etag from a GET request, and pass it with the // DELETE request to identify the rule set version you are deleting. - // Wire name: 'etag' Etag string `json:"etag"` } -func (st *DeleteAibiDashboardEmbeddingAccessPolicySettingResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteAibiDashboardEmbeddingAccessPolicySettingResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteAibiDashboardEmbeddingAccessPolicySettingResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteAibiDashboardEmbeddingAccessPolicySettingResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteAibiDashboardEmbeddingAccessPolicySettingResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Delete AI/BI dashboard embedding approved domains type DeleteAibiDashboardEmbeddingApprovedDomainsSettingRequest struct { // etag used for versioning. The response is at least as fresh as the eTag @@ -1877,34 +1011,17 @@ type DeleteAibiDashboardEmbeddingApprovedDomainsSettingRequest struct { // delete pattern to perform setting deletions in order to avoid race // conditions. That is, get an etag from a GET request, and pass it with the // DELETE request to identify the rule set version you are deleting. - Etag string `json:"-" tf:"-"` + Etag string `json:"-" url:"etag,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DeleteAibiDashboardEmbeddingApprovedDomainsSettingRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteAibiDashboardEmbeddingApprovedDomainsSettingRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteAibiDashboardEmbeddingApprovedDomainsSettingRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DeleteAibiDashboardEmbeddingApprovedDomainsSettingRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DeleteAibiDashboardEmbeddingApprovedDomainsSettingRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteAibiDashboardEmbeddingApprovedDomainsSettingRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DeleteAibiDashboardEmbeddingApprovedDomainsSettingRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The etag is returned. @@ -1916,35 +1033,9 @@ type DeleteAibiDashboardEmbeddingApprovedDomainsSettingResponse struct { // delete pattern to perform setting deletions in order to avoid race // conditions. That is, get an etag from a GET request, and pass it with the // DELETE request to identify the rule set version you are deleting. - // Wire name: 'etag' Etag string `json:"etag"` } -func (st *DeleteAibiDashboardEmbeddingApprovedDomainsSettingResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteAibiDashboardEmbeddingApprovedDomainsSettingResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteAibiDashboardEmbeddingApprovedDomainsSettingResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteAibiDashboardEmbeddingApprovedDomainsSettingResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteAibiDashboardEmbeddingApprovedDomainsSettingResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Delete the Dashboard Email Subscriptions setting type DeleteDashboardEmailSubscriptionsRequest struct { // etag used for versioning. The response is at least as fresh as the eTag @@ -1954,34 +1045,17 @@ type DeleteDashboardEmailSubscriptionsRequest struct { // delete pattern to perform setting deletions in order to avoid race // conditions. That is, get an etag from a GET request, and pass it with the // DELETE request to identify the rule set version you are deleting. - Etag string `json:"-" tf:"-"` + Etag string `json:"-" url:"etag,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DeleteDashboardEmailSubscriptionsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteDashboardEmailSubscriptionsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteDashboardEmailSubscriptionsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DeleteDashboardEmailSubscriptionsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DeleteDashboardEmailSubscriptionsRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteDashboardEmailSubscriptionsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DeleteDashboardEmailSubscriptionsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The etag is returned. @@ -1993,35 +1067,9 @@ type DeleteDashboardEmailSubscriptionsResponse struct { // delete pattern to perform setting deletions in order to avoid race // conditions. That is, get an etag from a GET request, and pass it with the // DELETE request to identify the rule set version you are deleting. - // Wire name: 'etag' Etag string `json:"etag"` } -func (st *DeleteDashboardEmailSubscriptionsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteDashboardEmailSubscriptionsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteDashboardEmailSubscriptionsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteDashboardEmailSubscriptionsResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteDashboardEmailSubscriptionsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Delete the default namespace setting type DeleteDefaultNamespaceSettingRequest struct { // etag used for versioning. The response is at least as fresh as the eTag @@ -2031,34 +1079,17 @@ type DeleteDefaultNamespaceSettingRequest struct { // delete pattern to perform setting deletions in order to avoid race // conditions. That is, get an etag from a GET request, and pass it with the // DELETE request to identify the rule set version you are deleting. - Etag string `json:"-" tf:"-"` + Etag string `json:"-" url:"etag,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DeleteDefaultNamespaceSettingRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteDefaultNamespaceSettingRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteDefaultNamespaceSettingRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DeleteDefaultNamespaceSettingRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DeleteDefaultNamespaceSettingRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteDefaultNamespaceSettingRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DeleteDefaultNamespaceSettingRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The etag is returned. @@ -2070,35 +1101,9 @@ type DeleteDefaultNamespaceSettingResponse struct { // delete pattern to perform setting deletions in order to avoid race // conditions. That is, get an etag from a GET request, and pass it with the // DELETE request to identify the rule set version you are deleting. - // Wire name: 'etag' Etag string `json:"etag"` } -func (st *DeleteDefaultNamespaceSettingResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteDefaultNamespaceSettingResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteDefaultNamespaceSettingResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteDefaultNamespaceSettingResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteDefaultNamespaceSettingResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Delete Legacy Access Disablement Status type DeleteDisableLegacyAccessRequest struct { // etag used for versioning. The response is at least as fresh as the eTag @@ -2108,34 +1113,17 @@ type DeleteDisableLegacyAccessRequest struct { // delete pattern to perform setting deletions in order to avoid race // conditions. That is, get an etag from a GET request, and pass it with the // DELETE request to identify the rule set version you are deleting. - Etag string `json:"-" tf:"-"` + Etag string `json:"-" url:"etag,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DeleteDisableLegacyAccessRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteDisableLegacyAccessRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteDisableLegacyAccessRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DeleteDisableLegacyAccessRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DeleteDisableLegacyAccessRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteDisableLegacyAccessRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DeleteDisableLegacyAccessRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The etag is returned. @@ -2147,35 +1135,9 @@ type DeleteDisableLegacyAccessResponse struct { // delete pattern to perform setting deletions in order to avoid race // conditions. That is, get an etag from a GET request, and pass it with the // DELETE request to identify the rule set version you are deleting. - // Wire name: 'etag' Etag string `json:"etag"` } -func (st *DeleteDisableLegacyAccessResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteDisableLegacyAccessResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteDisableLegacyAccessResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteDisableLegacyAccessResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteDisableLegacyAccessResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Delete the disable legacy DBFS setting type DeleteDisableLegacyDbfsRequest struct { // etag used for versioning. The response is at least as fresh as the eTag @@ -2185,34 +1147,17 @@ type DeleteDisableLegacyDbfsRequest struct { // delete pattern to perform setting deletions in order to avoid race // conditions. That is, get an etag from a GET request, and pass it with the // DELETE request to identify the rule set version you are deleting. - Etag string `json:"-" tf:"-"` + Etag string `json:"-" url:"etag,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DeleteDisableLegacyDbfsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteDisableLegacyDbfsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteDisableLegacyDbfsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DeleteDisableLegacyDbfsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DeleteDisableLegacyDbfsRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteDisableLegacyDbfsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DeleteDisableLegacyDbfsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The etag is returned. @@ -2224,35 +1169,9 @@ type DeleteDisableLegacyDbfsResponse struct { // delete pattern to perform setting deletions in order to avoid race // conditions. That is, get an etag from a GET request, and pass it with the // DELETE request to identify the rule set version you are deleting. - // Wire name: 'etag' Etag string `json:"etag"` } -func (st *DeleteDisableLegacyDbfsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteDisableLegacyDbfsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteDisableLegacyDbfsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteDisableLegacyDbfsResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteDisableLegacyDbfsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Delete the disable legacy features setting type DeleteDisableLegacyFeaturesRequest struct { // etag used for versioning. The response is at least as fresh as the eTag @@ -2262,34 +1181,17 @@ type DeleteDisableLegacyFeaturesRequest struct { // delete pattern to perform setting deletions in order to avoid race // conditions. That is, get an etag from a GET request, and pass it with the // DELETE request to identify the rule set version you are deleting. - Etag string `json:"-" tf:"-"` + Etag string `json:"-" url:"etag,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DeleteDisableLegacyFeaturesRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteDisableLegacyFeaturesRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteDisableLegacyFeaturesRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DeleteDisableLegacyFeaturesRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DeleteDisableLegacyFeaturesRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteDisableLegacyFeaturesRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DeleteDisableLegacyFeaturesRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The etag is returned. @@ -2301,64 +1203,13 @@ type DeleteDisableLegacyFeaturesResponse struct { // delete pattern to perform setting deletions in order to avoid race // conditions. That is, get an etag from a GET request, and pass it with the // DELETE request to identify the rule set version you are deleting. - // Wire name: 'etag' Etag string `json:"etag"` } -func (st *DeleteDisableLegacyFeaturesResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteDisableLegacyFeaturesResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteDisableLegacyFeaturesResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteDisableLegacyFeaturesResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteDisableLegacyFeaturesResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Delete access list type DeleteIpAccessListRequest struct { // The ID for the corresponding IP access list - IpAccessListId string `json:"-" tf:"-"` -} - -func (st *DeleteIpAccessListRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteIpAccessListRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteIpAccessListRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteIpAccessListRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteIpAccessListRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + IpAccessListId string `json:"-" url:"-"` } // Delete the enable partner powered AI features workspace setting @@ -2370,34 +1221,17 @@ type DeleteLlmProxyPartnerPoweredWorkspaceRequest struct { // delete pattern to perform setting deletions in order to avoid race // conditions. That is, get an etag from a GET request, and pass it with the // DELETE request to identify the rule set version you are deleting. - Etag string `json:"-" tf:"-"` + Etag string `json:"-" url:"etag,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DeleteLlmProxyPartnerPoweredWorkspaceRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteLlmProxyPartnerPoweredWorkspaceRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteLlmProxyPartnerPoweredWorkspaceRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DeleteLlmProxyPartnerPoweredWorkspaceRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DeleteLlmProxyPartnerPoweredWorkspaceRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteLlmProxyPartnerPoweredWorkspaceRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DeleteLlmProxyPartnerPoweredWorkspaceRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The etag is returned. @@ -2409,181 +1243,30 @@ type DeleteLlmProxyPartnerPoweredWorkspaceResponse struct { // delete pattern to perform setting deletions in order to avoid race // conditions. That is, get an etag from a GET request, and pass it with the // DELETE request to identify the rule set version you are deleting. - // Wire name: 'etag' Etag string `json:"etag"` } -func (st *DeleteLlmProxyPartnerPoweredWorkspaceResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteLlmProxyPartnerPoweredWorkspaceResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteLlmProxyPartnerPoweredWorkspaceResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteLlmProxyPartnerPoweredWorkspaceResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteLlmProxyPartnerPoweredWorkspaceResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Delete a network connectivity configuration type DeleteNetworkConnectivityConfigurationRequest struct { // Your Network Connectivity Configuration ID. - NetworkConnectivityConfigId string `json:"-" tf:"-"` -} - -func (st *DeleteNetworkConnectivityConfigurationRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteNetworkConnectivityConfigurationRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteNetworkConnectivityConfigurationRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteNetworkConnectivityConfigurationRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteNetworkConnectivityConfigurationRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + NetworkConnectivityConfigId string `json:"-" url:"-"` } type DeleteNetworkConnectivityConfigurationResponse struct { } -func (st *DeleteNetworkConnectivityConfigurationResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteNetworkConnectivityConfigurationResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteNetworkConnectivityConfigurationResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteNetworkConnectivityConfigurationResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteNetworkConnectivityConfigurationResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Delete a network policy type DeleteNetworkPolicyRequest struct { // The unique identifier of the network policy to delete. - NetworkPolicyId string `json:"-" tf:"-"` -} - -func (st *DeleteNetworkPolicyRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteNetworkPolicyRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteNetworkPolicyRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteNetworkPolicyRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteNetworkPolicyRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + NetworkPolicyId string `json:"-" url:"-"` } type DeleteNetworkPolicyRpcResponse struct { } -func (st *DeleteNetworkPolicyRpcResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteNetworkPolicyRpcResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteNetworkPolicyRpcResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteNetworkPolicyRpcResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteNetworkPolicyRpcResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Delete a notification destination type DeleteNotificationDestinationRequest struct { - Id string `json:"-" tf:"-"` -} - -func (st *DeleteNotificationDestinationRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteNotificationDestinationRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteNotificationDestinationRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteNotificationDestinationRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteNotificationDestinationRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Id string `json:"-" url:"-"` } // Delete Personal Compute setting @@ -2595,34 +1278,17 @@ type DeletePersonalComputeSettingRequest struct { // delete pattern to perform setting deletions in order to avoid race // conditions. That is, get an etag from a GET request, and pass it with the // DELETE request to identify the rule set version you are deleting. - Etag string `json:"-" tf:"-"` + Etag string `json:"-" url:"etag,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DeletePersonalComputeSettingRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deletePersonalComputeSettingRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deletePersonalComputeSettingRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DeletePersonalComputeSettingRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DeletePersonalComputeSettingRequest) MarshalJSON() ([]byte, error) { - pb, err := deletePersonalComputeSettingRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DeletePersonalComputeSettingRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The etag is returned. @@ -2634,96 +1300,20 @@ type DeletePersonalComputeSettingResponse struct { // delete pattern to perform setting deletions in order to avoid race // conditions. That is, get an etag from a GET request, and pass it with the // DELETE request to identify the rule set version you are deleting. - // Wire name: 'etag' Etag string `json:"etag"` } -func (st *DeletePersonalComputeSettingResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deletePersonalComputeSettingResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deletePersonalComputeSettingResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeletePersonalComputeSettingResponse) MarshalJSON() ([]byte, error) { - pb, err := deletePersonalComputeSettingResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Delete a private endpoint rule type DeletePrivateEndpointRuleRequest struct { // Your Network Connectvity Configuration ID. - NetworkConnectivityConfigId string `json:"-" tf:"-"` + NetworkConnectivityConfigId string `json:"-" url:"-"` // Your private endpoint rule ID. - PrivateEndpointRuleId string `json:"-" tf:"-"` -} - -func (st *DeletePrivateEndpointRuleRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deletePrivateEndpointRuleRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deletePrivateEndpointRuleRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeletePrivateEndpointRuleRequest) MarshalJSON() ([]byte, error) { - pb, err := deletePrivateEndpointRuleRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + PrivateEndpointRuleId string `json:"-" url:"-"` } type DeleteResponse struct { } -func (st *DeleteResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Delete the restrict workspace admins setting type DeleteRestrictWorkspaceAdminsSettingRequest struct { // etag used for versioning. The response is at least as fresh as the eTag @@ -2733,34 +1323,17 @@ type DeleteRestrictWorkspaceAdminsSettingRequest struct { // delete pattern to perform setting deletions in order to avoid race // conditions. That is, get an etag from a GET request, and pass it with the // DELETE request to identify the rule set version you are deleting. - Etag string `json:"-" tf:"-"` + Etag string `json:"-" url:"etag,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DeleteRestrictWorkspaceAdminsSettingRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteRestrictWorkspaceAdminsSettingRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteRestrictWorkspaceAdminsSettingRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DeleteRestrictWorkspaceAdminsSettingRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DeleteRestrictWorkspaceAdminsSettingRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteRestrictWorkspaceAdminsSettingRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DeleteRestrictWorkspaceAdminsSettingRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The etag is returned. @@ -2772,35 +1345,9 @@ type DeleteRestrictWorkspaceAdminsSettingResponse struct { // delete pattern to perform setting deletions in order to avoid race // conditions. That is, get an etag from a GET request, and pass it with the // DELETE request to identify the rule set version you are deleting. - // Wire name: 'etag' Etag string `json:"etag"` } -func (st *DeleteRestrictWorkspaceAdminsSettingResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteRestrictWorkspaceAdminsSettingResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteRestrictWorkspaceAdminsSettingResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteRestrictWorkspaceAdminsSettingResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteRestrictWorkspaceAdminsSettingResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Delete the SQL Results Download setting type DeleteSqlResultsDownloadRequest struct { // etag used for versioning. The response is at least as fresh as the eTag @@ -2810,34 +1357,17 @@ type DeleteSqlResultsDownloadRequest struct { // delete pattern to perform setting deletions in order to avoid race // conditions. That is, get an etag from a GET request, and pass it with the // DELETE request to identify the rule set version you are deleting. - Etag string `json:"-" tf:"-"` + Etag string `json:"-" url:"etag,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DeleteSqlResultsDownloadRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteSqlResultsDownloadRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteSqlResultsDownloadRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DeleteSqlResultsDownloadRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DeleteSqlResultsDownloadRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteSqlResultsDownloadRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DeleteSqlResultsDownloadRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The etag is returned. @@ -2849,64 +1379,13 @@ type DeleteSqlResultsDownloadResponse struct { // delete pattern to perform setting deletions in order to avoid race // conditions. That is, get an etag from a GET request, and pass it with the // DELETE request to identify the rule set version you are deleting. - // Wire name: 'etag' Etag string `json:"etag"` } -func (st *DeleteSqlResultsDownloadResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteSqlResultsDownloadResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteSqlResultsDownloadResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteSqlResultsDownloadResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteSqlResultsDownloadResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Delete a token type DeleteTokenManagementRequest struct { // The ID of the token to revoke. - TokenId string `json:"-" tf:"-"` -} - -func (st *DeleteTokenManagementRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteTokenManagementRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteTokenManagementRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteTokenManagementRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteTokenManagementRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + TokenId string `json:"-" url:"-"` } type DestinationType string @@ -2956,8 +1435,6 @@ func (f *DestinationType) Type() string { } type DisableLegacyAccess struct { - - // Wire name: 'disable_legacy_access' DisableLegacyAccess BooleanMessage `json:"disable_legacy_access"` // etag used for versioning. The response is at least as fresh as the eTag // provided. This is used for optimistic concurrency control as a way to @@ -2966,47 +1443,26 @@ type DisableLegacyAccess struct { // update pattern to perform setting updates in order to avoid race // conditions. That is, get an etag from a GET request, and pass it with the // PATCH request to identify the setting version you are updating. - // Wire name: 'etag' Etag string `json:"etag,omitempty"` // Name of the corresponding setting. This field is populated in the // response, but it will not be respected even if it's set in the request // body. The setting name in the path parameter will be respected instead. // Setting name is required to be 'default' if the setting only has one // instance per workspace. - // Wire name: 'setting_name' SettingName string `json:"setting_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DisableLegacyAccess) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &disableLegacyAccessPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := disableLegacyAccessFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DisableLegacyAccess) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DisableLegacyAccess) MarshalJSON() ([]byte, error) { - pb, err := disableLegacyAccessToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DisableLegacyAccess) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type DisableLegacyDbfs struct { - - // Wire name: 'disable_legacy_dbfs' DisableLegacyDbfs BooleanMessage `json:"disable_legacy_dbfs"` // etag used for versioning. The response is at least as fresh as the eTag // provided. This is used for optimistic concurrency control as a way to @@ -3015,47 +1471,26 @@ type DisableLegacyDbfs struct { // update pattern to perform setting updates in order to avoid race // conditions. That is, get an etag from a GET request, and pass it with the // PATCH request to identify the setting version you are updating. - // Wire name: 'etag' Etag string `json:"etag,omitempty"` // Name of the corresponding setting. This field is populated in the // response, but it will not be respected even if it's set in the request // body. The setting name in the path parameter will be respected instead. // Setting name is required to be 'default' if the setting only has one // instance per workspace. - // Wire name: 'setting_name' SettingName string `json:"setting_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DisableLegacyDbfs) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &disableLegacyDbfsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := disableLegacyDbfsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DisableLegacyDbfs) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DisableLegacyDbfs) MarshalJSON() ([]byte, error) { - pb, err := disableLegacyDbfsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DisableLegacyDbfs) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type DisableLegacyFeatures struct { - - // Wire name: 'disable_legacy_features' DisableLegacyFeatures BooleanMessage `json:"disable_legacy_features"` // etag used for versioning. The response is at least as fresh as the eTag // provided. This is used for optimistic concurrency control as a way to @@ -3064,42 +1499,23 @@ type DisableLegacyFeatures struct { // update pattern to perform setting updates in order to avoid race // conditions. That is, get an etag from a GET request, and pass it with the // PATCH request to identify the setting version you are updating. - // Wire name: 'etag' Etag string `json:"etag,omitempty"` // Name of the corresponding setting. This field is populated in the // response, but it will not be respected even if it's set in the request // body. The setting name in the path parameter will be respected instead. // Setting name is required to be 'default' if the setting only has one // instance per workspace. - // Wire name: 'setting_name' SettingName string `json:"setting_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DisableLegacyFeatures) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &disableLegacyFeaturesPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := disableLegacyFeaturesFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DisableLegacyFeatures) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DisableLegacyFeatures) MarshalJSON() ([]byte, error) { - pb, err := disableLegacyFeaturesToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DisableLegacyFeatures) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The network policies applying for egress traffic. This message is used by the @@ -3108,45 +1524,15 @@ func (st DisableLegacyFeatures) MarshalJSON() ([]byte, error) { // dataplane, see networkconfig.textproto). type EgressNetworkPolicy struct { // The access policy enforced for egress traffic to the internet. - // Wire name: 'internet_access' InternetAccess *EgressNetworkPolicyInternetAccessPolicy `json:"internet_access,omitempty"` } -func (st *EgressNetworkPolicy) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &egressNetworkPolicyPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := egressNetworkPolicyFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st EgressNetworkPolicy) MarshalJSON() ([]byte, error) { - pb, err := egressNetworkPolicyToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type EgressNetworkPolicyInternetAccessPolicy struct { - - // Wire name: 'allowed_internet_destinations' AllowedInternetDestinations []EgressNetworkPolicyInternetAccessPolicyInternetDestination `json:"allowed_internet_destinations,omitempty"` - // Wire name: 'allowed_storage_destinations' AllowedStorageDestinations []EgressNetworkPolicyInternetAccessPolicyStorageDestination `json:"allowed_storage_destinations,omitempty"` // Optional. If not specified, assume the policy is enforced for all // workloads. - // Wire name: 'log_only_mode' LogOnlyMode *EgressNetworkPolicyInternetAccessPolicyLogOnlyMode `json:"log_only_mode,omitempty"` // At which level can Databricks and Databricks managed compute access // Internet. FULL_ACCESS: Databricks can access Internet. No blocking rules @@ -3154,79 +1540,32 @@ type EgressNetworkPolicyInternetAccessPolicy struct { // allowed internet and storage destinations, as well as UC connections and // external locations. PRIVATE_ACCESS_ONLY (not used): Databricks can only // access destinations via private link. - // Wire name: 'restriction_mode' RestrictionMode EgressNetworkPolicyInternetAccessPolicyRestrictionMode `json:"restriction_mode,omitempty"` } -func (st *EgressNetworkPolicyInternetAccessPolicy) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &egressNetworkPolicyInternetAccessPolicyPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := egressNetworkPolicyInternetAccessPolicyFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st EgressNetworkPolicyInternetAccessPolicy) MarshalJSON() ([]byte, error) { - pb, err := egressNetworkPolicyInternetAccessPolicyToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Users can specify accessible internet destinations when outbound access is // restricted. We only support domain name (FQDN) destinations for the time // being, though going forwards we want to support host names and IP addresses. type EgressNetworkPolicyInternetAccessPolicyInternetDestination struct { - - // Wire name: 'destination' Destination string `json:"destination,omitempty"` // The filtering protocol used by the DP. For private and public preview, // SEG will only support TCP filtering (i.e. DNS based filtering, filtering // by destination IP address), so protocol will be set to TCP by default and // hidden from the user. In the future, users may be able to select HTTP // filtering (i.e. SNI based filtering, filtering by FQDN). - // Wire name: 'protocol' Protocol EgressNetworkPolicyInternetAccessPolicyInternetDestinationInternetDestinationFilteringProtocol `json:"protocol,omitempty"` - // Wire name: 'type' Type EgressNetworkPolicyInternetAccessPolicyInternetDestinationInternetDestinationType `json:"type,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *EgressNetworkPolicyInternetAccessPolicyInternetDestination) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &egressNetworkPolicyInternetAccessPolicyInternetDestinationPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := egressNetworkPolicyInternetAccessPolicyInternetDestinationFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *EgressNetworkPolicyInternetAccessPolicyInternetDestination) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st EgressNetworkPolicyInternetAccessPolicyInternetDestination) MarshalJSON() ([]byte, error) { - pb, err := egressNetworkPolicyInternetAccessPolicyInternetDestinationToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s EgressNetworkPolicyInternetAccessPolicyInternetDestination) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The filtering protocol used by the DP. For private and public preview, SEG @@ -3303,39 +1642,11 @@ func (f *EgressNetworkPolicyInternetAccessPolicyInternetDestinationInternetDesti } type EgressNetworkPolicyInternetAccessPolicyLogOnlyMode struct { - - // Wire name: 'log_only_mode_type' LogOnlyModeType EgressNetworkPolicyInternetAccessPolicyLogOnlyModeLogOnlyModeType `json:"log_only_mode_type,omitempty"` - // Wire name: 'workloads' Workloads []EgressNetworkPolicyInternetAccessPolicyLogOnlyModeWorkloadType `json:"workloads,omitempty"` } -func (st *EgressNetworkPolicyInternetAccessPolicyLogOnlyMode) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &egressNetworkPolicyInternetAccessPolicyLogOnlyModePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := egressNetworkPolicyInternetAccessPolicyLogOnlyModeFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st EgressNetworkPolicyInternetAccessPolicyLogOnlyMode) MarshalJSON() ([]byte, error) { - pb, err := egressNetworkPolicyInternetAccessPolicyLogOnlyModeToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type EgressNetworkPolicyInternetAccessPolicyLogOnlyModeLogOnlyModeType string const EgressNetworkPolicyInternetAccessPolicyLogOnlyModeLogOnlyModeTypeAllServices EgressNetworkPolicyInternetAccessPolicyLogOnlyModeLogOnlyModeType = `ALL_SERVICES` @@ -3459,57 +1770,31 @@ func (f *EgressNetworkPolicyInternetAccessPolicyRestrictionMode) Type() string { // Users can specify accessible storage destinations. type EgressNetworkPolicyInternetAccessPolicyStorageDestination struct { - - // Wire name: 'allowed_paths' AllowedPaths []string `json:"allowed_paths,omitempty"` - // Wire name: 'azure_container' AzureContainer string `json:"azure_container,omitempty"` - // Wire name: 'azure_dns_zone' AzureDnsZone string `json:"azure_dns_zone,omitempty"` - // Wire name: 'azure_storage_account' AzureStorageAccount string `json:"azure_storage_account,omitempty"` - // Wire name: 'azure_storage_service' AzureStorageService string `json:"azure_storage_service,omitempty"` - // Wire name: 'bucket_name' BucketName string `json:"bucket_name,omitempty"` - // Wire name: 'region' Region string `json:"region,omitempty"` - // Wire name: 'type' Type EgressNetworkPolicyInternetAccessPolicyStorageDestinationStorageDestinationType `json:"type,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *EgressNetworkPolicyInternetAccessPolicyStorageDestination) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &egressNetworkPolicyInternetAccessPolicyStorageDestinationPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := egressNetworkPolicyInternetAccessPolicyStorageDestinationFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *EgressNetworkPolicyInternetAccessPolicyStorageDestination) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st EgressNetworkPolicyInternetAccessPolicyStorageDestination) MarshalJSON() ([]byte, error) { - pb, err := egressNetworkPolicyInternetAccessPolicyStorageDestinationToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s EgressNetworkPolicyInternetAccessPolicyStorageDestination) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type EgressNetworkPolicyInternetAccessPolicyStorageDestinationStorageDestinationType string @@ -3558,85 +1843,37 @@ func (f *EgressNetworkPolicyInternetAccessPolicyStorageDestinationStorageDestina type EgressNetworkPolicyNetworkAccessPolicy struct { // List of internet destinations that serverless workloads are allowed to // access when in RESTRICTED_ACCESS mode. - // Wire name: 'allowed_internet_destinations' AllowedInternetDestinations []EgressNetworkPolicyNetworkAccessPolicyInternetDestination `json:"allowed_internet_destinations,omitempty"` // List of storage destinations that serverless workloads are allowed to // access when in RESTRICTED_ACCESS mode. - // Wire name: 'allowed_storage_destinations' AllowedStorageDestinations []EgressNetworkPolicyNetworkAccessPolicyStorageDestination `json:"allowed_storage_destinations,omitempty"` // Optional. When policy_enforcement is not provided, we default to // ENFORCE_MODE_ALL_SERVICES - // Wire name: 'policy_enforcement' PolicyEnforcement *EgressNetworkPolicyNetworkAccessPolicyPolicyEnforcement `json:"policy_enforcement,omitempty"` // The restriction mode that controls how serverless workloads can access // the internet. - // Wire name: 'restriction_mode' RestrictionMode EgressNetworkPolicyNetworkAccessPolicyRestrictionMode `json:"restriction_mode"` } -func (st *EgressNetworkPolicyNetworkAccessPolicy) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &egressNetworkPolicyNetworkAccessPolicyPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := egressNetworkPolicyNetworkAccessPolicyFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st EgressNetworkPolicyNetworkAccessPolicy) MarshalJSON() ([]byte, error) { - pb, err := egressNetworkPolicyNetworkAccessPolicyToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Users can specify accessible internet destinations when outbound access is // restricted. We only support DNS_NAME (FQDN format) destinations for the time // being. Going forward we may extend support to host names and IP addresses. type EgressNetworkPolicyNetworkAccessPolicyInternetDestination struct { // The internet destination to which access will be allowed. Format // dependent on the destination type. - // Wire name: 'destination' Destination string `json:"destination,omitempty"` // The type of internet destination. Currently only DNS_NAME is supported. - // Wire name: 'internet_destination_type' InternetDestinationType EgressNetworkPolicyNetworkAccessPolicyInternetDestinationInternetDestinationType `json:"internet_destination_type,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *EgressNetworkPolicyNetworkAccessPolicyInternetDestination) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &egressNetworkPolicyNetworkAccessPolicyInternetDestinationPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := egressNetworkPolicyNetworkAccessPolicyInternetDestinationFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *EgressNetworkPolicyNetworkAccessPolicyInternetDestination) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st EgressNetworkPolicyNetworkAccessPolicyInternetDestination) MarshalJSON() ([]byte, error) { - pb, err := egressNetworkPolicyNetworkAccessPolicyInternetDestinationToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s EgressNetworkPolicyNetworkAccessPolicyInternetDestination) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type EgressNetworkPolicyNetworkAccessPolicyInternetDestinationInternetDestinationType string @@ -3677,40 +1914,13 @@ type EgressNetworkPolicyNetworkAccessPolicyPolicyEnforcement struct { // When empty, it means dry run for all products. When non-empty, it means // dry run for specific products and for the other products, they will run // in enforced mode. - // Wire name: 'dry_run_mode_product_filter' DryRunModeProductFilter []EgressNetworkPolicyNetworkAccessPolicyPolicyEnforcementDryRunModeProductFilter `json:"dry_run_mode_product_filter,omitempty"` // The mode of policy enforcement. ENFORCED blocks traffic that violates // policy, while DRY_RUN only logs violations without blocking. When not // specified, defaults to ENFORCED. - // Wire name: 'enforcement_mode' EnforcementMode EgressNetworkPolicyNetworkAccessPolicyPolicyEnforcementEnforcementMode `json:"enforcement_mode,omitempty"` } -func (st *EgressNetworkPolicyNetworkAccessPolicyPolicyEnforcement) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &egressNetworkPolicyNetworkAccessPolicyPolicyEnforcementPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := egressNetworkPolicyNetworkAccessPolicyPolicyEnforcementFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st EgressNetworkPolicyNetworkAccessPolicyPolicyEnforcement) MarshalJSON() ([]byte, error) { - pb, err := egressNetworkPolicyNetworkAccessPolicyPolicyEnforcementToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // The values should match the list of workloads used in networkconfig.proto type EgressNetworkPolicyNetworkAccessPolicyPolicyEnforcementDryRunModeProductFilter string @@ -3830,47 +2040,25 @@ func (f *EgressNetworkPolicyNetworkAccessPolicyRestrictionMode) Type() string { // Users can specify accessible storage destinations. type EgressNetworkPolicyNetworkAccessPolicyStorageDestination struct { // The Azure storage account name. - // Wire name: 'azure_storage_account' AzureStorageAccount string `json:"azure_storage_account,omitempty"` // The Azure storage service type (blob, dfs, etc.). - // Wire name: 'azure_storage_service' AzureStorageService string `json:"azure_storage_service,omitempty"` - // Wire name: 'bucket_name' BucketName string `json:"bucket_name,omitempty"` - // Wire name: 'region' Region string `json:"region,omitempty"` // The type of storage destination. - // Wire name: 'storage_destination_type' StorageDestinationType EgressNetworkPolicyNetworkAccessPolicyStorageDestinationStorageDestinationType `json:"storage_destination_type,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *EgressNetworkPolicyNetworkAccessPolicyStorageDestination) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &egressNetworkPolicyNetworkAccessPolicyStorageDestinationPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := egressNetworkPolicyNetworkAccessPolicyStorageDestinationFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *EgressNetworkPolicyNetworkAccessPolicyStorageDestination) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st EgressNetworkPolicyNetworkAccessPolicyStorageDestination) MarshalJSON() ([]byte, error) { - pb, err := egressNetworkPolicyNetworkAccessPolicyStorageDestinationToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s EgressNetworkPolicyNetworkAccessPolicyStorageDestination) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type EgressNetworkPolicyNetworkAccessPolicyStorageDestinationStorageDestinationType string @@ -3953,220 +2141,89 @@ func (f *EgressResourceType) Type() string { type EmailConfig struct { // Email addresses to notify. - // Wire name: 'addresses' Addresses []string `json:"addresses,omitempty"` } -func (st *EmailConfig) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &emailConfigPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := emailConfigFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st EmailConfig) MarshalJSON() ([]byte, error) { - pb, err := emailConfigToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type Empty struct { } -func (st *Empty) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &emptyPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := emptyFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st Empty) MarshalJSON() ([]byte, error) { - pb, err := emptyToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type EnableExportNotebook struct { - - // Wire name: 'boolean_val' BooleanVal *BooleanMessage `json:"boolean_val,omitempty"` // Name of the corresponding setting. This field is populated in the // response, but it will not be respected even if it's set in the request // body. The setting name in the path parameter will be respected instead. // Setting name is required to be 'default' if the setting only has one // instance per workspace. - // Wire name: 'setting_name' SettingName string `json:"setting_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *EnableExportNotebook) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &enableExportNotebookPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := enableExportNotebookFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *EnableExportNotebook) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st EnableExportNotebook) MarshalJSON() ([]byte, error) { - pb, err := enableExportNotebookToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s EnableExportNotebook) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type EnableNotebookTableClipboard struct { - - // Wire name: 'boolean_val' BooleanVal *BooleanMessage `json:"boolean_val,omitempty"` // Name of the corresponding setting. This field is populated in the // response, but it will not be respected even if it's set in the request // body. The setting name in the path parameter will be respected instead. // Setting name is required to be 'default' if the setting only has one // instance per workspace. - // Wire name: 'setting_name' SettingName string `json:"setting_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *EnableNotebookTableClipboard) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &enableNotebookTableClipboardPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := enableNotebookTableClipboardFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *EnableNotebookTableClipboard) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st EnableNotebookTableClipboard) MarshalJSON() ([]byte, error) { - pb, err := enableNotebookTableClipboardToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s EnableNotebookTableClipboard) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type EnableResultsDownloading struct { - - // Wire name: 'boolean_val' BooleanVal *BooleanMessage `json:"boolean_val,omitempty"` // Name of the corresponding setting. This field is populated in the // response, but it will not be respected even if it's set in the request // body. The setting name in the path parameter will be respected instead. // Setting name is required to be 'default' if the setting only has one // instance per workspace. - // Wire name: 'setting_name' SettingName string `json:"setting_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *EnableResultsDownloading) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &enableResultsDownloadingPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := enableResultsDownloadingFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *EnableResultsDownloading) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st EnableResultsDownloading) MarshalJSON() ([]byte, error) { - pb, err := enableResultsDownloadingToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s EnableResultsDownloading) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // SHIELD feature: ESM type EnhancedSecurityMonitoring struct { - - // Wire name: 'is_enabled' IsEnabled bool `json:"is_enabled,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *EnhancedSecurityMonitoring) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &enhancedSecurityMonitoringPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := enhancedSecurityMonitoringFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *EnhancedSecurityMonitoring) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st EnhancedSecurityMonitoring) MarshalJSON() ([]byte, error) { - pb, err := enhancedSecurityMonitoringToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s EnhancedSecurityMonitoring) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type EnhancedSecurityMonitoringSetting struct { // SHIELD feature: ESM - // Wire name: 'enhanced_security_monitoring_workspace' EnhancedSecurityMonitoringWorkspace EnhancedSecurityMonitoring `json:"enhanced_security_monitoring_workspace"` // etag used for versioning. The response is at least as fresh as the eTag // provided. This is used for optimistic concurrency control as a way to @@ -4175,81 +2232,42 @@ type EnhancedSecurityMonitoringSetting struct { // update pattern to perform setting updates in order to avoid race // conditions. That is, get an etag from a GET request, and pass it with the // PATCH request to identify the setting version you are updating. - // Wire name: 'etag' Etag string `json:"etag,omitempty"` // Name of the corresponding setting. This field is populated in the // response, but it will not be respected even if it's set in the request // body. The setting name in the path parameter will be respected instead. // Setting name is required to be 'default' if the setting only has one // instance per workspace. - // Wire name: 'setting_name' SettingName string `json:"setting_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *EnhancedSecurityMonitoringSetting) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &enhancedSecurityMonitoringSettingPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := enhancedSecurityMonitoringSettingFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *EnhancedSecurityMonitoringSetting) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st EnhancedSecurityMonitoringSetting) MarshalJSON() ([]byte, error) { - pb, err := enhancedSecurityMonitoringSettingToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s EnhancedSecurityMonitoringSetting) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Account level policy for ESM type EsmEnablementAccount struct { - - // Wire name: 'is_enforced' IsEnforced bool `json:"is_enforced,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *EsmEnablementAccount) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &esmEnablementAccountPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := esmEnablementAccountFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *EsmEnablementAccount) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st EsmEnablementAccount) MarshalJSON() ([]byte, error) { - pb, err := esmEnablementAccountToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s EsmEnablementAccount) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type EsmEnablementAccountSetting struct { // Account level policy for ESM - // Wire name: 'esm_enablement_account' EsmEnablementAccount EsmEnablementAccount `json:"esm_enablement_account"` // etag used for versioning. The response is at least as fresh as the eTag // provided. This is used for optimistic concurrency control as a way to @@ -4258,239 +2276,94 @@ type EsmEnablementAccountSetting struct { // update pattern to perform setting updates in order to avoid race // conditions. That is, get an etag from a GET request, and pass it with the // PATCH request to identify the setting version you are updating. - // Wire name: 'etag' Etag string `json:"etag,omitempty"` // Name of the corresponding setting. This field is populated in the // response, but it will not be respected even if it's set in the request // body. The setting name in the path parameter will be respected instead. // Setting name is required to be 'default' if the setting only has one // instance per workspace. - // Wire name: 'setting_name' SettingName string `json:"setting_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *EsmEnablementAccountSetting) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &esmEnablementAccountSettingPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := esmEnablementAccountSettingFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *EsmEnablementAccountSetting) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st EsmEnablementAccountSetting) MarshalJSON() ([]byte, error) { - pb, err := esmEnablementAccountSettingToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s EsmEnablementAccountSetting) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The exchange token is the result of the token exchange with the IdP type ExchangeToken struct { // The requested token. - // Wire name: 'credential' Credential string `json:"credential,omitempty"` // The end-of-life timestamp of the token. The value is in milliseconds // since the Unix epoch. - // Wire name: 'credentialEolTime' CredentialEolTime int64 `json:"credentialEolTime,omitempty"` // User ID of the user that owns this token. - // Wire name: 'ownerId' OwnerId int64 `json:"ownerId,omitempty"` // The scopes of access granted in the token. - // Wire name: 'scopes' Scopes []string `json:"scopes,omitempty"` // The type of this exchange token - // Wire name: 'tokenType' TokenType TokenType `json:"tokenType,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ExchangeToken) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &exchangeTokenPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := exchangeTokenFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ExchangeToken) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ExchangeToken) MarshalJSON() ([]byte, error) { - pb, err := exchangeTokenToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ExchangeToken) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Exchange a token with the IdP type ExchangeTokenRequest struct { // The partition of Credentials store - // Wire name: 'partitionId' PartitionId PartitionId `json:"partitionId"` // Array of scopes for the token request. - // Wire name: 'scopes' Scopes []string `json:"scopes"` // A list of token types being requested - // Wire name: 'tokenType' TokenType []TokenType `json:"tokenType"` } -func (st *ExchangeTokenRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &exchangeTokenRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := exchangeTokenRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ExchangeTokenRequest) MarshalJSON() ([]byte, error) { - pb, err := exchangeTokenRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Exhanged tokens were successfully returned. type ExchangeTokenResponse struct { - - // Wire name: 'values' Values []ExchangeToken `json:"values,omitempty"` } -func (st *ExchangeTokenResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &exchangeTokenResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := exchangeTokenResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ExchangeTokenResponse) MarshalJSON() ([]byte, error) { - pb, err := exchangeTokenResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // An IP access list was successfully returned. type FetchIpAccessListResponse struct { // Definition of an IP Access list - // Wire name: 'ip_access_list' IpAccessList *IpAccessListInfo `json:"ip_access_list,omitempty"` } -func (st *FetchIpAccessListResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &fetchIpAccessListResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := fetchIpAccessListResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st FetchIpAccessListResponse) MarshalJSON() ([]byte, error) { - pb, err := fetchIpAccessListResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type GenericWebhookConfig struct { // [Input-Only][Optional] Password for webhook. - // Wire name: 'password' Password string `json:"password,omitempty"` // [Output-Only] Whether password is set. - // Wire name: 'password_set' PasswordSet bool `json:"password_set,omitempty"` // [Input-Only] URL for webhook. - // Wire name: 'url' Url string `json:"url,omitempty"` // [Output-Only] Whether URL is set. - // Wire name: 'url_set' UrlSet bool `json:"url_set,omitempty"` // [Input-Only][Optional] Username for webhook. - // Wire name: 'username' Username string `json:"username,omitempty"` // [Output-Only] Whether username is set. - // Wire name: 'username_set' UsernameSet bool `json:"username_set,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GenericWebhookConfig) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &genericWebhookConfigPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := genericWebhookConfigFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GenericWebhookConfig) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GenericWebhookConfig) MarshalJSON() ([]byte, error) { - pb, err := genericWebhookConfigToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GenericWebhookConfig) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get the account IP access toggle setting @@ -4502,65 +2375,23 @@ type GetAccountIpAccessEnableRequest struct { // delete pattern to perform setting deletions in order to avoid race // conditions. That is, get an etag from a GET request, and pass it with the // DELETE request to identify the rule set version you are deleting. - Etag string `json:"-" tf:"-"` + Etag string `json:"-" url:"etag,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetAccountIpAccessEnableRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getAccountIpAccessEnableRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getAccountIpAccessEnableRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetAccountIpAccessEnableRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetAccountIpAccessEnableRequest) MarshalJSON() ([]byte, error) { - pb, err := getAccountIpAccessEnableRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetAccountIpAccessEnableRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get IP access list type GetAccountIpAccessListRequest struct { // The ID for the corresponding IP access list - IpAccessListId string `json:"-" tf:"-"` -} - -func (st *GetAccountIpAccessListRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getAccountIpAccessListRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getAccountIpAccessListRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetAccountIpAccessListRequest) MarshalJSON() ([]byte, error) { - pb, err := getAccountIpAccessListRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + IpAccessListId string `json:"-" url:"-"` } // Retrieve the AI/BI dashboard embedding access policy @@ -4572,34 +2403,17 @@ type GetAibiDashboardEmbeddingAccessPolicySettingRequest struct { // delete pattern to perform setting deletions in order to avoid race // conditions. That is, get an etag from a GET request, and pass it with the // DELETE request to identify the rule set version you are deleting. - Etag string `json:"-" tf:"-"` + Etag string `json:"-" url:"etag,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetAibiDashboardEmbeddingAccessPolicySettingRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getAibiDashboardEmbeddingAccessPolicySettingRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getAibiDashboardEmbeddingAccessPolicySettingRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetAibiDashboardEmbeddingAccessPolicySettingRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetAibiDashboardEmbeddingAccessPolicySettingRequest) MarshalJSON() ([]byte, error) { - pb, err := getAibiDashboardEmbeddingAccessPolicySettingRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetAibiDashboardEmbeddingAccessPolicySettingRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Retrieve the list of domains approved to host embedded AI/BI dashboards @@ -4611,34 +2425,17 @@ type GetAibiDashboardEmbeddingApprovedDomainsSettingRequest struct { // delete pattern to perform setting deletions in order to avoid race // conditions. That is, get an etag from a GET request, and pass it with the // DELETE request to identify the rule set version you are deleting. - Etag string `json:"-" tf:"-"` + Etag string `json:"-" url:"etag,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetAibiDashboardEmbeddingApprovedDomainsSettingRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getAibiDashboardEmbeddingApprovedDomainsSettingRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getAibiDashboardEmbeddingApprovedDomainsSettingRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetAibiDashboardEmbeddingApprovedDomainsSettingRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetAibiDashboardEmbeddingApprovedDomainsSettingRequest) MarshalJSON() ([]byte, error) { - pb, err := getAibiDashboardEmbeddingApprovedDomainsSettingRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetAibiDashboardEmbeddingApprovedDomainsSettingRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get the automatic cluster update setting @@ -4650,34 +2447,17 @@ type GetAutomaticClusterUpdateSettingRequest struct { // delete pattern to perform setting deletions in order to avoid race // conditions. That is, get an etag from a GET request, and pass it with the // DELETE request to identify the rule set version you are deleting. - Etag string `json:"-" tf:"-"` + Etag string `json:"-" url:"etag,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetAutomaticClusterUpdateSettingRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getAutomaticClusterUpdateSettingRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getAutomaticClusterUpdateSettingRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetAutomaticClusterUpdateSettingRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetAutomaticClusterUpdateSettingRequest) MarshalJSON() ([]byte, error) { - pb, err := getAutomaticClusterUpdateSettingRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetAutomaticClusterUpdateSettingRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get the compliance security profile setting @@ -4689,34 +2469,17 @@ type GetComplianceSecurityProfileSettingRequest struct { // delete pattern to perform setting deletions in order to avoid race // conditions. That is, get an etag from a GET request, and pass it with the // DELETE request to identify the rule set version you are deleting. - Etag string `json:"-" tf:"-"` + Etag string `json:"-" url:"etag,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetComplianceSecurityProfileSettingRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getComplianceSecurityProfileSettingRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getComplianceSecurityProfileSettingRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetComplianceSecurityProfileSettingRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetComplianceSecurityProfileSettingRequest) MarshalJSON() ([]byte, error) { - pb, err := getComplianceSecurityProfileSettingRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetComplianceSecurityProfileSettingRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get the compliance security profile setting for new workspaces @@ -4728,34 +2491,17 @@ type GetCspEnablementAccountSettingRequest struct { // delete pattern to perform setting deletions in order to avoid race // conditions. That is, get an etag from a GET request, and pass it with the // DELETE request to identify the rule set version you are deleting. - Etag string `json:"-" tf:"-"` + Etag string `json:"-" url:"etag,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetCspEnablementAccountSettingRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getCspEnablementAccountSettingRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getCspEnablementAccountSettingRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetCspEnablementAccountSettingRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetCspEnablementAccountSettingRequest) MarshalJSON() ([]byte, error) { - pb, err := getCspEnablementAccountSettingRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetCspEnablementAccountSettingRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get the Dashboard Email Subscriptions setting @@ -4767,34 +2513,17 @@ type GetDashboardEmailSubscriptionsRequest struct { // delete pattern to perform setting deletions in order to avoid race // conditions. That is, get an etag from a GET request, and pass it with the // DELETE request to identify the rule set version you are deleting. - Etag string `json:"-" tf:"-"` + Etag string `json:"-" url:"etag,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetDashboardEmailSubscriptionsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getDashboardEmailSubscriptionsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getDashboardEmailSubscriptionsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetDashboardEmailSubscriptionsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetDashboardEmailSubscriptionsRequest) MarshalJSON() ([]byte, error) { - pb, err := getDashboardEmailSubscriptionsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetDashboardEmailSubscriptionsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get the default namespace setting @@ -4806,34 +2535,17 @@ type GetDefaultNamespaceSettingRequest struct { // delete pattern to perform setting deletions in order to avoid race // conditions. That is, get an etag from a GET request, and pass it with the // DELETE request to identify the rule set version you are deleting. - Etag string `json:"-" tf:"-"` + Etag string `json:"-" url:"etag,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetDefaultNamespaceSettingRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getDefaultNamespaceSettingRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getDefaultNamespaceSettingRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetDefaultNamespaceSettingRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetDefaultNamespaceSettingRequest) MarshalJSON() ([]byte, error) { - pb, err := getDefaultNamespaceSettingRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetDefaultNamespaceSettingRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Retrieve Legacy Access Disablement Status @@ -4845,34 +2557,17 @@ type GetDisableLegacyAccessRequest struct { // delete pattern to perform setting deletions in order to avoid race // conditions. That is, get an etag from a GET request, and pass it with the // DELETE request to identify the rule set version you are deleting. - Etag string `json:"-" tf:"-"` + Etag string `json:"-" url:"etag,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetDisableLegacyAccessRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getDisableLegacyAccessRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getDisableLegacyAccessRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetDisableLegacyAccessRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetDisableLegacyAccessRequest) MarshalJSON() ([]byte, error) { - pb, err := getDisableLegacyAccessRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetDisableLegacyAccessRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get the disable legacy DBFS setting @@ -4884,34 +2579,17 @@ type GetDisableLegacyDbfsRequest struct { // delete pattern to perform setting deletions in order to avoid race // conditions. That is, get an etag from a GET request, and pass it with the // DELETE request to identify the rule set version you are deleting. - Etag string `json:"-" tf:"-"` + Etag string `json:"-" url:"etag,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetDisableLegacyDbfsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getDisableLegacyDbfsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getDisableLegacyDbfsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetDisableLegacyDbfsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetDisableLegacyDbfsRequest) MarshalJSON() ([]byte, error) { - pb, err := getDisableLegacyDbfsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetDisableLegacyDbfsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get the disable legacy features setting @@ -4923,34 +2601,17 @@ type GetDisableLegacyFeaturesRequest struct { // delete pattern to perform setting deletions in order to avoid race // conditions. That is, get an etag from a GET request, and pass it with the // DELETE request to identify the rule set version you are deleting. - Etag string `json:"-" tf:"-"` + Etag string `json:"-" url:"etag,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetDisableLegacyFeaturesRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getDisableLegacyFeaturesRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getDisableLegacyFeaturesRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetDisableLegacyFeaturesRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetDisableLegacyFeaturesRequest) MarshalJSON() ([]byte, error) { - pb, err := getDisableLegacyFeaturesRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetDisableLegacyFeaturesRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get the enhanced security monitoring setting @@ -4962,34 +2623,17 @@ type GetEnhancedSecurityMonitoringSettingRequest struct { // delete pattern to perform setting deletions in order to avoid race // conditions. That is, get an etag from a GET request, and pass it with the // DELETE request to identify the rule set version you are deleting. - Etag string `json:"-" tf:"-"` + Etag string `json:"-" url:"etag,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetEnhancedSecurityMonitoringSettingRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getEnhancedSecurityMonitoringSettingRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getEnhancedSecurityMonitoringSettingRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetEnhancedSecurityMonitoringSettingRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetEnhancedSecurityMonitoringSettingRequest) MarshalJSON() ([]byte, error) { - pb, err := getEnhancedSecurityMonitoringSettingRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetEnhancedSecurityMonitoringSettingRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get the enhanced security monitoring setting for new workspaces @@ -5001,130 +2645,35 @@ type GetEsmEnablementAccountSettingRequest struct { // delete pattern to perform setting deletions in order to avoid race // conditions. That is, get an etag from a GET request, and pass it with the // DELETE request to identify the rule set version you are deleting. - Etag string `json:"-" tf:"-"` + Etag string `json:"-" url:"etag,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetEsmEnablementAccountSettingRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getEsmEnablementAccountSettingRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getEsmEnablementAccountSettingRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetEsmEnablementAccountSettingRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetEsmEnablementAccountSettingRequest) MarshalJSON() ([]byte, error) { - pb, err := getEsmEnablementAccountSettingRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetEsmEnablementAccountSettingRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get access list type GetIpAccessListRequest struct { // The ID for the corresponding IP access list - IpAccessListId string `json:"-" tf:"-"` -} - -func (st *GetIpAccessListRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getIpAccessListRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getIpAccessListRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetIpAccessListRequest) MarshalJSON() ([]byte, error) { - pb, err := getIpAccessListRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + IpAccessListId string `json:"-" url:"-"` } type GetIpAccessListResponse struct { // Definition of an IP Access list - // Wire name: 'ip_access_list' IpAccessList *IpAccessListInfo `json:"ip_access_list,omitempty"` } -func (st *GetIpAccessListResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getIpAccessListResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getIpAccessListResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetIpAccessListResponse) MarshalJSON() ([]byte, error) { - pb, err := getIpAccessListResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // IP access lists were successfully returned. type GetIpAccessListsResponse struct { - - // Wire name: 'ip_access_lists' IpAccessLists []IpAccessListInfo `json:"ip_access_lists,omitempty"` } -func (st *GetIpAccessListsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getIpAccessListsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getIpAccessListsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetIpAccessListsResponse) MarshalJSON() ([]byte, error) { - pb, err := getIpAccessListsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Get the enable partner powered AI features account setting type GetLlmProxyPartnerPoweredAccountRequest struct { // etag used for versioning. The response is at least as fresh as the eTag @@ -5134,34 +2683,17 @@ type GetLlmProxyPartnerPoweredAccountRequest struct { // delete pattern to perform setting deletions in order to avoid race // conditions. That is, get an etag from a GET request, and pass it with the // DELETE request to identify the rule set version you are deleting. - Etag string `json:"-" tf:"-"` + Etag string `json:"-" url:"etag,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetLlmProxyPartnerPoweredAccountRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getLlmProxyPartnerPoweredAccountRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getLlmProxyPartnerPoweredAccountRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetLlmProxyPartnerPoweredAccountRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetLlmProxyPartnerPoweredAccountRequest) MarshalJSON() ([]byte, error) { - pb, err := getLlmProxyPartnerPoweredAccountRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetLlmProxyPartnerPoweredAccountRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get the enforcement status of partner powered AI features account setting @@ -5173,34 +2705,17 @@ type GetLlmProxyPartnerPoweredEnforceRequest struct { // delete pattern to perform setting deletions in order to avoid race // conditions. That is, get an etag from a GET request, and pass it with the // DELETE request to identify the rule set version you are deleting. - Etag string `json:"-" tf:"-"` + Etag string `json:"-" url:"etag,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetLlmProxyPartnerPoweredEnforceRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getLlmProxyPartnerPoweredEnforceRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getLlmProxyPartnerPoweredEnforceRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetLlmProxyPartnerPoweredEnforceRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetLlmProxyPartnerPoweredEnforceRequest) MarshalJSON() ([]byte, error) { - pb, err := getLlmProxyPartnerPoweredEnforceRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetLlmProxyPartnerPoweredEnforceRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get the enable partner powered AI features workspace setting @@ -5212,126 +2727,34 @@ type GetLlmProxyPartnerPoweredWorkspaceRequest struct { // delete pattern to perform setting deletions in order to avoid race // conditions. That is, get an etag from a GET request, and pass it with the // DELETE request to identify the rule set version you are deleting. - Etag string `json:"-" tf:"-"` + Etag string `json:"-" url:"etag,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetLlmProxyPartnerPoweredWorkspaceRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getLlmProxyPartnerPoweredWorkspaceRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getLlmProxyPartnerPoweredWorkspaceRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetLlmProxyPartnerPoweredWorkspaceRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetLlmProxyPartnerPoweredWorkspaceRequest) MarshalJSON() ([]byte, error) { - pb, err := getLlmProxyPartnerPoweredWorkspaceRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetLlmProxyPartnerPoweredWorkspaceRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get a network connectivity configuration type GetNetworkConnectivityConfigurationRequest struct { // Your Network Connectivity Configuration ID. - NetworkConnectivityConfigId string `json:"-" tf:"-"` -} - -func (st *GetNetworkConnectivityConfigurationRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getNetworkConnectivityConfigurationRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getNetworkConnectivityConfigurationRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetNetworkConnectivityConfigurationRequest) MarshalJSON() ([]byte, error) { - pb, err := getNetworkConnectivityConfigurationRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + NetworkConnectivityConfigId string `json:"-" url:"-"` } // Get a network policy type GetNetworkPolicyRequest struct { // The unique identifier of the network policy to retrieve. - NetworkPolicyId string `json:"-" tf:"-"` -} - -func (st *GetNetworkPolicyRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getNetworkPolicyRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getNetworkPolicyRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetNetworkPolicyRequest) MarshalJSON() ([]byte, error) { - pb, err := getNetworkPolicyRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + NetworkPolicyId string `json:"-" url:"-"` } // Get a notification destination type GetNotificationDestinationRequest struct { - Id string `json:"-" tf:"-"` -} - -func (st *GetNotificationDestinationRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getNotificationDestinationRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getNotificationDestinationRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetNotificationDestinationRequest) MarshalJSON() ([]byte, error) { - pb, err := getNotificationDestinationRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Id string `json:"-" url:"-"` } // Get Personal Compute setting @@ -5343,67 +2766,25 @@ type GetPersonalComputeSettingRequest struct { // delete pattern to perform setting deletions in order to avoid race // conditions. That is, get an etag from a GET request, and pass it with the // DELETE request to identify the rule set version you are deleting. - Etag string `json:"-" tf:"-"` + Etag string `json:"-" url:"etag,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetPersonalComputeSettingRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getPersonalComputeSettingRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getPersonalComputeSettingRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetPersonalComputeSettingRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetPersonalComputeSettingRequest) MarshalJSON() ([]byte, error) { - pb, err := getPersonalComputeSettingRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetPersonalComputeSettingRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Gets a private endpoint rule type GetPrivateEndpointRuleRequest struct { // Your Network Connectvity Configuration ID. - NetworkConnectivityConfigId string `json:"-" tf:"-"` + NetworkConnectivityConfigId string `json:"-" url:"-"` // Your private endpoint rule ID. - PrivateEndpointRuleId string `json:"-" tf:"-"` -} - -func (st *GetPrivateEndpointRuleRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getPrivateEndpointRuleRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getPrivateEndpointRuleRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetPrivateEndpointRuleRequest) MarshalJSON() ([]byte, error) { - pb, err := getPrivateEndpointRuleRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + PrivateEndpointRuleId string `json:"-" url:"-"` } // Get the restrict workspace admins setting @@ -5415,34 +2796,17 @@ type GetRestrictWorkspaceAdminsSettingRequest struct { // delete pattern to perform setting deletions in order to avoid race // conditions. That is, get an etag from a GET request, and pass it with the // DELETE request to identify the rule set version you are deleting. - Etag string `json:"-" tf:"-"` + Etag string `json:"-" url:"etag,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetRestrictWorkspaceAdminsSettingRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getRestrictWorkspaceAdminsSettingRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getRestrictWorkspaceAdminsSettingRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetRestrictWorkspaceAdminsSettingRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetRestrictWorkspaceAdminsSettingRequest) MarshalJSON() ([]byte, error) { - pb, err := getRestrictWorkspaceAdminsSettingRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetRestrictWorkspaceAdminsSettingRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get the SQL Results Download setting @@ -5454,213 +2818,61 @@ type GetSqlResultsDownloadRequest struct { // delete pattern to perform setting deletions in order to avoid race // conditions. That is, get an etag from a GET request, and pass it with the // DELETE request to identify the rule set version you are deleting. - Etag string `json:"-" tf:"-"` + Etag string `json:"-" url:"etag,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetSqlResultsDownloadRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getSqlResultsDownloadRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getSqlResultsDownloadRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetSqlResultsDownloadRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetSqlResultsDownloadRequest) MarshalJSON() ([]byte, error) { - pb, err := getSqlResultsDownloadRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetSqlResultsDownloadRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Check configuration status type GetStatusRequest struct { - Keys string `json:"-" tf:"-"` -} - -func (st *GetStatusRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getStatusRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getStatusRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetStatusRequest) MarshalJSON() ([]byte, error) { - pb, err := getStatusRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Keys string `json:"-" url:"keys"` } // Get token info type GetTokenManagementRequest struct { // The ID of the token to get. - TokenId string `json:"-" tf:"-"` -} - -func (st *GetTokenManagementRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getTokenManagementRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getTokenManagementRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetTokenManagementRequest) MarshalJSON() ([]byte, error) { - pb, err := getTokenManagementRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + TokenId string `json:"-" url:"-"` } type GetTokenPermissionLevelsResponse struct { // Specific permission levels - // Wire name: 'permission_levels' PermissionLevels []TokenPermissionsDescription `json:"permission_levels,omitempty"` } -func (st *GetTokenPermissionLevelsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getTokenPermissionLevelsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getTokenPermissionLevelsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetTokenPermissionLevelsResponse) MarshalJSON() ([]byte, error) { - pb, err := getTokenPermissionLevelsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Token with specified Token ID was successfully returned. type GetTokenResponse struct { - - // Wire name: 'token_info' TokenInfo *TokenInfo `json:"token_info,omitempty"` } -func (st *GetTokenResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getTokenResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getTokenResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetTokenResponse) MarshalJSON() ([]byte, error) { - pb, err := getTokenResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Get workspace network option type GetWorkspaceNetworkOptionRequest struct { // The workspace ID. - WorkspaceId int64 `json:"-" tf:"-"` -} - -func (st *GetWorkspaceNetworkOptionRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getWorkspaceNetworkOptionRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getWorkspaceNetworkOptionRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetWorkspaceNetworkOptionRequest) MarshalJSON() ([]byte, error) { - pb, err := getWorkspaceNetworkOptionRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + WorkspaceId int64 `json:"-" url:"-"` } // Definition of an IP Access list type IpAccessListInfo struct { // Total number of IP or CIDR values. - // Wire name: 'address_count' AddressCount int `json:"address_count,omitempty"` // Creation timestamp in milliseconds. - // Wire name: 'created_at' CreatedAt int64 `json:"created_at,omitempty"` // User ID of the user who created this list. - // Wire name: 'created_by' CreatedBy int64 `json:"created_by,omitempty"` // Specifies whether this IP access list is enabled. - // Wire name: 'enabled' Enabled bool `json:"enabled,omitempty"` - // Wire name: 'ip_addresses' IpAddresses []string `json:"ip_addresses,omitempty"` // Label for the IP access list. This **cannot** be empty. - // Wire name: 'label' Label string `json:"label,omitempty"` // Universally unique identifier (UUID) of the IP access list. - // Wire name: 'list_id' ListId string `json:"list_id,omitempty"` // Type of IP access list. Valid values are as follows and are // case-sensitive: @@ -5668,497 +2880,215 @@ type IpAccessListInfo struct { // * `ALLOW`: An allow list. Include this IP or range. * `BLOCK`: A block // list. Exclude this IP or range. IP addresses in the block list are // excluded even if they are included in an allow list. - // Wire name: 'list_type' ListType ListType `json:"list_type,omitempty"` // Update timestamp in milliseconds. - // Wire name: 'updated_at' UpdatedAt int64 `json:"updated_at,omitempty"` // User ID of the user who updated this list. - // Wire name: 'updated_by' UpdatedBy int64 `json:"updated_by,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *IpAccessListInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &ipAccessListInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := ipAccessListInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *IpAccessListInfo) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st IpAccessListInfo) MarshalJSON() ([]byte, error) { - pb, err := ipAccessListInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s IpAccessListInfo) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // IP access lists were successfully returned. type ListIpAccessListResponse struct { - - // Wire name: 'ip_access_lists' IpAccessLists []IpAccessListInfo `json:"ip_access_lists,omitempty"` } -func (st *ListIpAccessListResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listIpAccessListResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listIpAccessListResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ListIpAccessListResponse) MarshalJSON() ([]byte, error) { - pb, err := listIpAccessListResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // List network connectivity configurations type ListNetworkConnectivityConfigurationsRequest struct { // Pagination token to go to next page based on previous query. - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListNetworkConnectivityConfigurationsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listNetworkConnectivityConfigurationsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listNetworkConnectivityConfigurationsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListNetworkConnectivityConfigurationsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListNetworkConnectivityConfigurationsRequest) MarshalJSON() ([]byte, error) { - pb, err := listNetworkConnectivityConfigurationsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListNetworkConnectivityConfigurationsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The network connectivity configuration list was successfully retrieved. type ListNetworkConnectivityConfigurationsResponse struct { - - // Wire name: 'items' Items []NetworkConnectivityConfiguration `json:"items,omitempty"` // A token that can be used to get the next page of results. If null, there // are no more results to show. - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListNetworkConnectivityConfigurationsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listNetworkConnectivityConfigurationsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listNetworkConnectivityConfigurationsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListNetworkConnectivityConfigurationsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListNetworkConnectivityConfigurationsResponse) MarshalJSON() ([]byte, error) { - pb, err := listNetworkConnectivityConfigurationsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListNetworkConnectivityConfigurationsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // List network policies type ListNetworkPoliciesRequest struct { // Pagination token to go to next page based on previous query. - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListNetworkPoliciesRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listNetworkPoliciesRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listNetworkPoliciesRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListNetworkPoliciesRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListNetworkPoliciesRequest) MarshalJSON() ([]byte, error) { - pb, err := listNetworkPoliciesRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListNetworkPoliciesRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListNetworkPoliciesResponse struct { // List of network policies. - // Wire name: 'items' Items []AccountNetworkPolicy `json:"items,omitempty"` // A token that can be used to get the next page of results. If null, there // are no more results to show. - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListNetworkPoliciesResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listNetworkPoliciesResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listNetworkPoliciesResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListNetworkPoliciesResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListNetworkPoliciesResponse) MarshalJSON() ([]byte, error) { - pb, err := listNetworkPoliciesResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListNetworkPoliciesResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // List notification destinations type ListNotificationDestinationsRequest struct { - PageSize int64 `json:"-" tf:"-"` + PageSize int64 `json:"-" url:"page_size,omitempty"` - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListNotificationDestinationsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listNotificationDestinationsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listNotificationDestinationsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListNotificationDestinationsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListNotificationDestinationsRequest) MarshalJSON() ([]byte, error) { - pb, err := listNotificationDestinationsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListNotificationDestinationsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListNotificationDestinationsResponse struct { // Page token for next of results. - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` - // Wire name: 'results' Results []ListNotificationDestinationsResult `json:"results,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListNotificationDestinationsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listNotificationDestinationsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listNotificationDestinationsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListNotificationDestinationsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListNotificationDestinationsResponse) MarshalJSON() ([]byte, error) { - pb, err := listNotificationDestinationsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListNotificationDestinationsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListNotificationDestinationsResult struct { // [Output-only] The type of the notification destination. The type can not // be changed once set. - // Wire name: 'destination_type' DestinationType DestinationType `json:"destination_type,omitempty"` // The display name for the notification destination. - // Wire name: 'display_name' DisplayName string `json:"display_name,omitempty"` // UUID identifying notification destination. - // Wire name: 'id' Id string `json:"id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListNotificationDestinationsResult) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listNotificationDestinationsResultPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listNotificationDestinationsResultFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListNotificationDestinationsResult) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListNotificationDestinationsResult) MarshalJSON() ([]byte, error) { - pb, err := listNotificationDestinationsResultToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListNotificationDestinationsResult) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // List private endpoint rules type ListPrivateEndpointRulesRequest struct { // Your Network Connectvity Configuration ID. - NetworkConnectivityConfigId string `json:"-" tf:"-"` + NetworkConnectivityConfigId string `json:"-" url:"-"` // Pagination token to go to next page based on previous query. - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListPrivateEndpointRulesRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listPrivateEndpointRulesRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listPrivateEndpointRulesRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListPrivateEndpointRulesRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListPrivateEndpointRulesRequest) MarshalJSON() ([]byte, error) { - pb, err := listPrivateEndpointRulesRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListPrivateEndpointRulesRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The private endpoint rule list was successfully retrieved. type ListPrivateEndpointRulesResponse struct { - - // Wire name: 'items' Items []NccPrivateEndpointRule `json:"items,omitempty"` // A token that can be used to get the next page of results. If null, there // are no more results to show. - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListPrivateEndpointRulesResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listPrivateEndpointRulesResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listPrivateEndpointRulesResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListPrivateEndpointRulesResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListPrivateEndpointRulesResponse) MarshalJSON() ([]byte, error) { - pb, err := listPrivateEndpointRulesResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListPrivateEndpointRulesResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListPublicTokensResponse struct { // The information for each token. - // Wire name: 'token_infos' TokenInfos []PublicTokenInfo `json:"token_infos,omitempty"` } -func (st *ListPublicTokensResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listPublicTokensResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listPublicTokensResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ListPublicTokensResponse) MarshalJSON() ([]byte, error) { - pb, err := listPublicTokensResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // List all tokens type ListTokenManagementRequest struct { // User ID of the user that created the token. - CreatedById int64 `json:"-" tf:"-"` + CreatedById int64 `json:"-" url:"created_by_id,omitempty"` // Username of the user that created the token. - CreatedByUsername string `json:"-" tf:"-"` + CreatedByUsername string `json:"-" url:"created_by_username,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListTokenManagementRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listTokenManagementRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listTokenManagementRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListTokenManagementRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListTokenManagementRequest) MarshalJSON() ([]byte, error) { - pb, err := listTokenManagementRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListTokenManagementRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Tokens were successfully returned. type ListTokensResponse struct { // Token metadata of each user-created token in the workspace - // Wire name: 'token_infos' TokenInfos []TokenInfo `json:"token_infos,omitempty"` } -func (st *ListTokensResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listTokensResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listTokensResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ListTokensResponse) MarshalJSON() ([]byte, error) { - pb, err := listTokensResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Type of IP access list. Valid values are as follows and are case-sensitive: // // * `ALLOW`: An allow list. Include this IP or range. * `BLOCK`: A block list. @@ -6205,8 +3135,6 @@ func (f *ListType) Type() string { } type LlmProxyPartnerPoweredAccount struct { - - // Wire name: 'boolean_val' BooleanVal BooleanMessage `json:"boolean_val"` // etag used for versioning. The response is at least as fresh as the eTag // provided. This is used for optimistic concurrency control as a way to @@ -6215,47 +3143,26 @@ type LlmProxyPartnerPoweredAccount struct { // update pattern to perform setting updates in order to avoid race // conditions. That is, get an etag from a GET request, and pass it with the // PATCH request to identify the setting version you are updating. - // Wire name: 'etag' Etag string `json:"etag,omitempty"` // Name of the corresponding setting. This field is populated in the // response, but it will not be respected even if it's set in the request // body. The setting name in the path parameter will be respected instead. // Setting name is required to be 'default' if the setting only has one // instance per workspace. - // Wire name: 'setting_name' SettingName string `json:"setting_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *LlmProxyPartnerPoweredAccount) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &llmProxyPartnerPoweredAccountPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := llmProxyPartnerPoweredAccountFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *LlmProxyPartnerPoweredAccount) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st LlmProxyPartnerPoweredAccount) MarshalJSON() ([]byte, error) { - pb, err := llmProxyPartnerPoweredAccountToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s LlmProxyPartnerPoweredAccount) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type LlmProxyPartnerPoweredEnforce struct { - - // Wire name: 'boolean_val' BooleanVal BooleanMessage `json:"boolean_val"` // etag used for versioning. The response is at least as fresh as the eTag // provided. This is used for optimistic concurrency control as a way to @@ -6264,47 +3171,26 @@ type LlmProxyPartnerPoweredEnforce struct { // update pattern to perform setting updates in order to avoid race // conditions. That is, get an etag from a GET request, and pass it with the // PATCH request to identify the setting version you are updating. - // Wire name: 'etag' Etag string `json:"etag,omitempty"` // Name of the corresponding setting. This field is populated in the // response, but it will not be respected even if it's set in the request // body. The setting name in the path parameter will be respected instead. // Setting name is required to be 'default' if the setting only has one // instance per workspace. - // Wire name: 'setting_name' SettingName string `json:"setting_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *LlmProxyPartnerPoweredEnforce) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &llmProxyPartnerPoweredEnforcePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := llmProxyPartnerPoweredEnforceFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *LlmProxyPartnerPoweredEnforce) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st LlmProxyPartnerPoweredEnforce) MarshalJSON() ([]byte, error) { - pb, err := llmProxyPartnerPoweredEnforceToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s LlmProxyPartnerPoweredEnforce) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type LlmProxyPartnerPoweredWorkspace struct { - - // Wire name: 'boolean_val' BooleanVal BooleanMessage `json:"boolean_val"` // etag used for versioning. The response is at least as fresh as the eTag // provided. This is used for optimistic concurrency control as a way to @@ -6313,78 +3199,40 @@ type LlmProxyPartnerPoweredWorkspace struct { // update pattern to perform setting updates in order to avoid race // conditions. That is, get an etag from a GET request, and pass it with the // PATCH request to identify the setting version you are updating. - // Wire name: 'etag' Etag string `json:"etag,omitempty"` // Name of the corresponding setting. This field is populated in the // response, but it will not be respected even if it's set in the request // body. The setting name in the path parameter will be respected instead. // Setting name is required to be 'default' if the setting only has one // instance per workspace. - // Wire name: 'setting_name' SettingName string `json:"setting_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *LlmProxyPartnerPoweredWorkspace) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &llmProxyPartnerPoweredWorkspacePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := llmProxyPartnerPoweredWorkspaceFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *LlmProxyPartnerPoweredWorkspace) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st LlmProxyPartnerPoweredWorkspace) MarshalJSON() ([]byte, error) { - pb, err := llmProxyPartnerPoweredWorkspaceToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s LlmProxyPartnerPoweredWorkspace) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type MicrosoftTeamsConfig struct { // [Input-Only] URL for Microsoft Teams. - // Wire name: 'url' Url string `json:"url,omitempty"` // [Output-Only] Whether URL is set. - // Wire name: 'url_set' UrlSet bool `json:"url_set,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *MicrosoftTeamsConfig) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := µsoftTeamsConfigPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := microsoftTeamsConfigFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *MicrosoftTeamsConfig) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st MicrosoftTeamsConfig) MarshalJSON() ([]byte, error) { - pb, err := microsoftTeamsConfigToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s MicrosoftTeamsConfig) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The stable AWS IP CIDR blocks. You can use these to configure the firewall of @@ -6392,35 +3240,9 @@ func (st MicrosoftTeamsConfig) MarshalJSON() ([]byte, error) { type NccAwsStableIpRule struct { // The list of stable IP CIDR blocks from which Databricks network traffic // originates when accessing your resources. - // Wire name: 'cidr_blocks' CidrBlocks []string `json:"cidr_blocks,omitempty"` } -func (st *NccAwsStableIpRule) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &nccAwsStableIpRulePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := nccAwsStableIpRuleFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st NccAwsStableIpRule) MarshalJSON() ([]byte, error) { - pb, err := nccAwsStableIpRuleToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Properties of the new private endpoint rule. Note that you must approve the // endpoint in Azure portal after initialization. type NccAzurePrivateEndpointRule struct { @@ -6436,73 +3258,45 @@ type NccAzurePrivateEndpointRule struct { // link resource owner, the private endpoint becomes informative and should // be deleted for clean-up. - EXPIRED: If the endpoint was created but not // approved in 14 days, it will be EXPIRED. - // Wire name: 'connection_state' ConnectionState NccAzurePrivateEndpointRuleConnectionState `json:"connection_state,omitempty"` // Time in epoch milliseconds when this object was created. - // Wire name: 'creation_time' CreationTime int64 `json:"creation_time,omitempty"` // Whether this private endpoint is deactivated. - // Wire name: 'deactivated' Deactivated bool `json:"deactivated,omitempty"` // Time in epoch milliseconds when this object was deactivated. - // Wire name: 'deactivated_at' DeactivatedAt int64 `json:"deactivated_at,omitempty"` // Not used by customer-managed private endpoint services. // // Domain names of target private link service. When updating this field, // the full list of target domain_names must be specified. - // Wire name: 'domain_names' DomainNames []string `json:"domain_names,omitempty"` // The name of the Azure private endpoint resource. - // Wire name: 'endpoint_name' EndpointName string `json:"endpoint_name,omitempty"` // Only used by private endpoints to Azure first-party services. // // The sub-resource type (group ID) of the target resource. Note that to // connect to workspace root storage (root DBFS), you need two endpoints, // one for blob and one for dfs. - // Wire name: 'group_id' GroupId string `json:"group_id,omitempty"` // The ID of a network connectivity configuration, which is the parent // resource of this private endpoint rule object. - // Wire name: 'network_connectivity_config_id' NetworkConnectivityConfigId string `json:"network_connectivity_config_id,omitempty"` // The Azure resource ID of the target resource. - // Wire name: 'resource_id' ResourceId string `json:"resource_id,omitempty"` // The ID of a private endpoint rule. - // Wire name: 'rule_id' RuleId string `json:"rule_id,omitempty"` // Time in epoch milliseconds when this object was updated. - // Wire name: 'updated_time' UpdatedTime int64 `json:"updated_time,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *NccAzurePrivateEndpointRule) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &nccAzurePrivateEndpointRulePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := nccAzurePrivateEndpointRuleFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *NccAzurePrivateEndpointRule) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st NccAzurePrivateEndpointRule) MarshalJSON() ([]byte, error) { - pb, err := nccAzurePrivateEndpointRuleToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s NccAzurePrivateEndpointRule) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type NccAzurePrivateEndpointRuleConnectionState string @@ -6560,162 +3354,60 @@ func (f *NccAzurePrivateEndpointRuleConnectionState) Type() string { type NccAzureServiceEndpointRule struct { // The list of subnets from which Databricks network traffic originates when // accessing your Azure resources. - // Wire name: 'subnets' Subnets []string `json:"subnets,omitempty"` // The Azure region in which this service endpoint rule applies.. - // Wire name: 'target_region' TargetRegion string `json:"target_region,omitempty"` // The Azure services to which this service endpoint rule applies to. - // Wire name: 'target_services' TargetServices []EgressResourceType `json:"target_services,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *NccAzureServiceEndpointRule) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &nccAzureServiceEndpointRulePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := nccAzureServiceEndpointRuleFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *NccAzureServiceEndpointRule) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st NccAzureServiceEndpointRule) MarshalJSON() ([]byte, error) { - pb, err := nccAzureServiceEndpointRuleToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s NccAzureServiceEndpointRule) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type NccEgressConfig struct { // The network connectivity rules that are applied by default without // resource specific configurations. You can find the stable network // information of your serverless compute resources here. - // Wire name: 'default_rules' DefaultRules *NccEgressDefaultRules `json:"default_rules,omitempty"` // The network connectivity rules that configured for each destinations. // These rules override default rules. - // Wire name: 'target_rules' TargetRules *NccEgressTargetRules `json:"target_rules,omitempty"` } -func (st *NccEgressConfig) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &nccEgressConfigPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := nccEgressConfigFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st NccEgressConfig) MarshalJSON() ([]byte, error) { - pb, err := nccEgressConfigToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Default rules don't have specific targets. type NccEgressDefaultRules struct { // The stable AWS IP CIDR blocks. You can use these to configure the // firewall of your resources to allow traffic from your Databricks // workspace. - // Wire name: 'aws_stable_ip_rule' AwsStableIpRule *NccAwsStableIpRule `json:"aws_stable_ip_rule,omitempty"` // The stable Azure service endpoints. You can configure the firewall of // your Azure resources to allow traffic from your Databricks serverless // compute resources. - // Wire name: 'azure_service_endpoint_rule' AzureServiceEndpointRule *NccAzureServiceEndpointRule `json:"azure_service_endpoint_rule,omitempty"` } -func (st *NccEgressDefaultRules) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &nccEgressDefaultRulesPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := nccEgressDefaultRulesFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st NccEgressDefaultRules) MarshalJSON() ([]byte, error) { - pb, err := nccEgressDefaultRulesToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Target rule controls the egress rules that are dedicated to specific // resources. type NccEgressTargetRules struct { // AWS private endpoint rule controls the AWS private endpoint based egress // rules. - // Wire name: 'aws_private_endpoint_rules' AwsPrivateEndpointRules []CustomerFacingNetworkConnectivityConfigAwsPrivateEndpointRule `json:"aws_private_endpoint_rules,omitempty"` - // Wire name: 'azure_private_endpoint_rules' AzurePrivateEndpointRules []NccAzurePrivateEndpointRule `json:"azure_private_endpoint_rules,omitempty"` } -func (st *NccEgressTargetRules) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &nccEgressTargetRulesPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := nccEgressTargetRulesFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st NccEgressTargetRules) MarshalJSON() ([]byte, error) { - pb, err := nccEgressTargetRulesToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Properties of the new private endpoint rule. Note that you must approve the // endpoint in Azure portal after initialization. type NccPrivateEndpointRule struct { // Databricks account ID. You can find your account ID from the Accounts // Console. - // Wire name: 'account_id' AccountId string `json:"account_id,omitempty"` // The current status of this private endpoint. The private endpoint rules // are effective only if the connection state is ESTABLISHED. Remember that @@ -6728,50 +3420,39 @@ type NccPrivateEndpointRule struct { // the private endpoint becomes informative and should be deleted for // clean-up. - EXPIRED: If the endpoint was created but not approved in 14 // days, it will be EXPIRED. - // Wire name: 'connection_state' ConnectionState NccPrivateEndpointRulePrivateLinkConnectionState `json:"connection_state,omitempty"` // Time in epoch milliseconds when this object was created. - // Wire name: 'creation_time' CreationTime int64 `json:"creation_time,omitempty"` // Whether this private endpoint is deactivated. - // Wire name: 'deactivated' Deactivated bool `json:"deactivated,omitempty"` // Time in epoch milliseconds when this object was deactivated. - // Wire name: 'deactivated_at' DeactivatedAt int64 `json:"deactivated_at,omitempty"` // Only used by private endpoints to customer-managed private endpoint // services. // // Domain names of target private link service. When updating this field, // the full list of target domain_names must be specified. - // Wire name: 'domain_names' DomainNames []string `json:"domain_names,omitempty"` // Only used by private endpoints towards an AWS S3 service. // // Update this field to activate/deactivate this private endpoint to allow // egress access from serverless compute resources. - // Wire name: 'enabled' Enabled bool `json:"enabled,omitempty"` // The name of the Azure private endpoint resource. - // Wire name: 'endpoint_name' EndpointName string `json:"endpoint_name,omitempty"` // The full target AWS endpoint service name that connects to the // destination resources of the private endpoint. - // Wire name: 'endpoint_service' EndpointService string `json:"endpoint_service,omitempty"` // Not used by customer-managed private endpoint services. // // The sub-resource type (group ID) of the target resource. Note that to // connect to workspace root storage (root DBFS), you need two endpoints, // one for blob and one for dfs. - // Wire name: 'group_id' GroupId string `json:"group_id,omitempty"` // The ID of a network connectivity configuration, which is the parent // resource of this private endpoint rule object. - // Wire name: 'network_connectivity_config_id' NetworkConnectivityConfigId string `json:"network_connectivity_config_id,omitempty"` // The Azure resource ID of the target resource. - // Wire name: 'resource_id' ResourceId string `json:"resource_id,omitempty"` // Only used by private endpoints towards AWS S3 service. // @@ -6779,45 +3460,24 @@ type NccPrivateEndpointRule struct { // endpoint. The bucket names must be in the same region as the NCC/endpoint // service. When updating this field, we perform full update on this field. // Please ensure a full list of desired resource_names is provided. - // Wire name: 'resource_names' ResourceNames []string `json:"resource_names,omitempty"` // The ID of a private endpoint rule. - // Wire name: 'rule_id' RuleId string `json:"rule_id,omitempty"` // Time in epoch milliseconds when this object was updated. - // Wire name: 'updated_time' UpdatedTime int64 `json:"updated_time,omitempty"` // The AWS VPC endpoint ID. You can use this ID to identify the VPC endpoint // created by Databricks. - // Wire name: 'vpc_endpoint_id' VpcEndpointId string `json:"vpc_endpoint_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *NccPrivateEndpointRule) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &nccPrivateEndpointRulePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := nccPrivateEndpointRuleFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *NccPrivateEndpointRule) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st NccPrivateEndpointRule) MarshalJSON() ([]byte, error) { - pb, err := nccPrivateEndpointRuleToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s NccPrivateEndpointRule) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type NccPrivateEndpointRulePrivateLinkConnectionState string @@ -6870,59 +3530,35 @@ func (f *NccPrivateEndpointRulePrivateLinkConnectionState) Type() string { type NetworkConnectivityConfiguration struct { // Your Databricks account ID. You can find your account ID in your // Databricks accounts console. - // Wire name: 'account_id' AccountId string `json:"account_id,omitempty"` // Time in epoch milliseconds when this object was created. - // Wire name: 'creation_time' CreationTime int64 `json:"creation_time,omitempty"` // The network connectivity rules that apply to network traffic from your // serverless compute resources. - // Wire name: 'egress_config' EgressConfig *NccEgressConfig `json:"egress_config,omitempty"` // The name of the network connectivity configuration. The name can contain // alphanumeric characters, hyphens, and underscores. The length must be // between 3 and 30 characters. The name must match the regular expression // ^[0-9a-zA-Z-_]{3,30}$ - // Wire name: 'name' Name string `json:"name,omitempty"` // Databricks network connectivity configuration ID. - // Wire name: 'network_connectivity_config_id' NetworkConnectivityConfigId string `json:"network_connectivity_config_id,omitempty"` // The region for the network connectivity configuration. Only workspaces in // the same region can be attached to the network connectivity // configuration. - // Wire name: 'region' Region string `json:"region,omitempty"` // Time in epoch milliseconds when this object was updated. - // Wire name: 'updated_time' UpdatedTime int64 `json:"updated_time,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *NetworkConnectivityConfiguration) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &networkConnectivityConfigurationPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := networkConnectivityConfigurationFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *NetworkConnectivityConfiguration) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st NetworkConnectivityConfiguration) MarshalJSON() ([]byte, error) { - pb, err := networkConnectivityConfigurationToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s NetworkConnectivityConfiguration) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The network policies applying for egress traffic. This message is used by the @@ -6934,148 +3570,64 @@ func (st NetworkConnectivityConfiguration) MarshalJSON() ([]byte, error) { // https://docs.google.com/document/d/1DKWO_FpZMCY4cF2O62LpwII1lx8gsnDGG-qgE3t3TOA/ type NetworkPolicyEgress struct { // The access policy enforced for egress traffic to the internet. - // Wire name: 'network_access' NetworkAccess *EgressNetworkPolicyNetworkAccessPolicy `json:"network_access,omitempty"` } -func (st *NetworkPolicyEgress) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &networkPolicyEgressPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := networkPolicyEgressFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st NetworkPolicyEgress) MarshalJSON() ([]byte, error) { - pb, err := networkPolicyEgressToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type NotificationDestination struct { // The configuration for the notification destination. Will be exactly one // of the nested configs. Only returns for users with workspace admin // permissions. - // Wire name: 'config' Config *Config `json:"config,omitempty"` // [Output-only] The type of the notification destination. The type can not // be changed once set. - // Wire name: 'destination_type' DestinationType DestinationType `json:"destination_type,omitempty"` // The display name for the notification destination. - // Wire name: 'display_name' DisplayName string `json:"display_name,omitempty"` // UUID identifying notification destination. - // Wire name: 'id' Id string `json:"id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *NotificationDestination) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := ¬ificationDestinationPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := notificationDestinationFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *NotificationDestination) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st NotificationDestination) MarshalJSON() ([]byte, error) { - pb, err := notificationDestinationToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s NotificationDestination) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type PagerdutyConfig struct { // [Input-Only] Integration key for PagerDuty. - // Wire name: 'integration_key' IntegrationKey string `json:"integration_key,omitempty"` // [Output-Only] Whether integration key is set. - // Wire name: 'integration_key_set' IntegrationKeySet bool `json:"integration_key_set,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *PagerdutyConfig) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &pagerdutyConfigPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := pagerdutyConfigFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *PagerdutyConfig) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st PagerdutyConfig) MarshalJSON() ([]byte, error) { - pb, err := pagerdutyConfigToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s PagerdutyConfig) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Partition by workspace or account type PartitionId struct { // The ID of the workspace. - // Wire name: 'workspaceId' WorkspaceId int64 `json:"workspaceId,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *PartitionId) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &partitionIdPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := partitionIdFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *PartitionId) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st PartitionId) MarshalJSON() ([]byte, error) { - pb, err := partitionIdToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s PartitionId) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type PersonalComputeMessage struct { @@ -7086,35 +3638,9 @@ type PersonalComputeMessage struct { // users or groups to be added to the ACLs of that workspace’s Personal // Compute default policy before they will be able to create compute // resources through that policy. - // Wire name: 'value' Value PersonalComputeMessageEnum `json:"value"` } -func (st *PersonalComputeMessage) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &personalComputeMessagePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := personalComputeMessageFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st PersonalComputeMessage) MarshalJSON() ([]byte, error) { - pb, err := personalComputeMessageToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // ON: Grants all users in all workspaces access to the Personal Compute default // policy, allowing all users to create single-machine compute resources. // DELEGATE: Moves access control for the Personal Compute default policy to @@ -7166,102 +3692,58 @@ type PersonalComputeSetting struct { // update pattern to perform setting updates in order to avoid race // conditions. That is, get an etag from a GET request, and pass it with the // PATCH request to identify the setting version you are updating. - // Wire name: 'etag' Etag string `json:"etag,omitempty"` - // Wire name: 'personal_compute' PersonalCompute PersonalComputeMessage `json:"personal_compute"` // Name of the corresponding setting. This field is populated in the // response, but it will not be respected even if it's set in the request // body. The setting name in the path parameter will be respected instead. // Setting name is required to be 'default' if the setting only has one // instance per workspace. - // Wire name: 'setting_name' SettingName string `json:"setting_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *PersonalComputeSetting) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &personalComputeSettingPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := personalComputeSettingFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *PersonalComputeSetting) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st PersonalComputeSetting) MarshalJSON() ([]byte, error) { - pb, err := personalComputeSettingToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s PersonalComputeSetting) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type PublicTokenInfo struct { // Comment the token was created with, if applicable. - // Wire name: 'comment' Comment string `json:"comment,omitempty"` // Server time (in epoch milliseconds) when the token was created. - // Wire name: 'creation_time' CreationTime int64 `json:"creation_time,omitempty"` // Server time (in epoch milliseconds) when the token will expire, or -1 if // not applicable. - // Wire name: 'expiry_time' ExpiryTime int64 `json:"expiry_time,omitempty"` // The ID of this token. - // Wire name: 'token_id' TokenId string `json:"token_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *PublicTokenInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &publicTokenInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := publicTokenInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *PublicTokenInfo) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st PublicTokenInfo) MarshalJSON() ([]byte, error) { - pb, err := publicTokenInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s PublicTokenInfo) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Details required to replace an IP access list. type ReplaceIpAccessList struct { // Specifies whether this IP access list is enabled. - // Wire name: 'enabled' Enabled bool `json:"enabled"` // The ID for the corresponding IP access list - IpAccessListId string `json:"-" tf:"-"` + IpAccessListId string `json:"-" url:"-"` - // Wire name: 'ip_addresses' IpAddresses []string `json:"ip_addresses,omitempty"` // Label for the IP access list. This **cannot** be empty. - // Wire name: 'label' Label string `json:"label"` // Type of IP access list. Valid values are as follows and are // case-sensitive: @@ -7269,94 +3751,16 @@ type ReplaceIpAccessList struct { // * `ALLOW`: An allow list. Include this IP or range. * `BLOCK`: A block // list. Exclude this IP or range. IP addresses in the block list are // excluded even if they are included in an allow list. - // Wire name: 'list_type' ListType ListType `json:"list_type"` } -func (st *ReplaceIpAccessList) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &replaceIpAccessListPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := replaceIpAccessListFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ReplaceIpAccessList) MarshalJSON() ([]byte, error) { - pb, err := replaceIpAccessListToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type ReplaceResponse struct { } -func (st *ReplaceResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &replaceResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := replaceResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ReplaceResponse) MarshalJSON() ([]byte, error) { - pb, err := replaceResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type RestrictWorkspaceAdminsMessage struct { - - // Wire name: 'status' Status RestrictWorkspaceAdminsMessageStatus `json:"status"` } -func (st *RestrictWorkspaceAdminsMessage) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &restrictWorkspaceAdminsMessagePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := restrictWorkspaceAdminsMessageFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st RestrictWorkspaceAdminsMessage) MarshalJSON() ([]byte, error) { - pb, err := restrictWorkspaceAdminsMessageToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type RestrictWorkspaceAdminsMessageStatus string const RestrictWorkspaceAdminsMessageStatusAllowAll RestrictWorkspaceAdminsMessageStatus = `ALLOW_ALL` @@ -7402,173 +3806,56 @@ type RestrictWorkspaceAdminsSetting struct { // update pattern to perform setting updates in order to avoid race // conditions. That is, get an etag from a GET request, and pass it with the // PATCH request to identify the setting version you are updating. - // Wire name: 'etag' Etag string `json:"etag,omitempty"` - // Wire name: 'restrict_workspace_admins' RestrictWorkspaceAdmins RestrictWorkspaceAdminsMessage `json:"restrict_workspace_admins"` // Name of the corresponding setting. This field is populated in the // response, but it will not be respected even if it's set in the request // body. The setting name in the path parameter will be respected instead. // Setting name is required to be 'default' if the setting only has one // instance per workspace. - // Wire name: 'setting_name' SettingName string `json:"setting_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *RestrictWorkspaceAdminsSetting) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &restrictWorkspaceAdminsSettingPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := restrictWorkspaceAdminsSettingFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *RestrictWorkspaceAdminsSetting) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st RestrictWorkspaceAdminsSetting) MarshalJSON() ([]byte, error) { - pb, err := restrictWorkspaceAdminsSettingToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s RestrictWorkspaceAdminsSetting) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type RevokeTokenRequest struct { // The ID of the token to be revoked. - // Wire name: 'token_id' TokenId string `json:"token_id"` } -func (st *RevokeTokenRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &revokeTokenRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := revokeTokenRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st RevokeTokenRequest) MarshalJSON() ([]byte, error) { - pb, err := revokeTokenRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type RevokeTokenResponse struct { } -func (st *RevokeTokenResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &revokeTokenResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := revokeTokenResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st RevokeTokenResponse) MarshalJSON() ([]byte, error) { - pb, err := revokeTokenResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type SetStatusResponse struct { } -func (st *SetStatusResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &setStatusResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := setStatusResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st SetStatusResponse) MarshalJSON() ([]byte, error) { - pb, err := setStatusResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type SlackConfig struct { // [Input-Only] URL for Slack destination. - // Wire name: 'url' Url string `json:"url,omitempty"` // [Output-Only] Whether URL is set. - // Wire name: 'url_set' UrlSet bool `json:"url_set,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *SlackConfig) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &slackConfigPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := slackConfigFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *SlackConfig) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st SlackConfig) MarshalJSON() ([]byte, error) { - pb, err := slackConfigToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s SlackConfig) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type SqlResultsDownload struct { - - // Wire name: 'boolean_val' BooleanVal BooleanMessage `json:"boolean_val"` // etag used for versioning. The response is at least as fresh as the eTag // provided. This is used for optimistic concurrency control as a way to @@ -7577,260 +3864,133 @@ type SqlResultsDownload struct { // update pattern to perform setting updates in order to avoid race // conditions. That is, get an etag from a GET request, and pass it with the // PATCH request to identify the setting version you are updating. - // Wire name: 'etag' Etag string `json:"etag,omitempty"` // Name of the corresponding setting. This field is populated in the // response, but it will not be respected even if it's set in the request // body. The setting name in the path parameter will be respected instead. // Setting name is required to be 'default' if the setting only has one // instance per workspace. - // Wire name: 'setting_name' SettingName string `json:"setting_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *SqlResultsDownload) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &sqlResultsDownloadPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := sqlResultsDownloadFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *SqlResultsDownload) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st SqlResultsDownload) MarshalJSON() ([]byte, error) { - pb, err := sqlResultsDownloadToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s SqlResultsDownload) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type StringMessage struct { // Represents a generic string value. - // Wire name: 'value' Value string `json:"value,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *StringMessage) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &stringMessagePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := stringMessageFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *StringMessage) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st StringMessage) MarshalJSON() ([]byte, error) { - pb, err := stringMessageToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s StringMessage) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type TokenAccessControlRequest struct { // name of the group - // Wire name: 'group_name' GroupName string `json:"group_name,omitempty"` // Permission level - // Wire name: 'permission_level' PermissionLevel TokenPermissionLevel `json:"permission_level,omitempty"` // application ID of a service principal - // Wire name: 'service_principal_name' ServicePrincipalName string `json:"service_principal_name,omitempty"` // name of the user - // Wire name: 'user_name' UserName string `json:"user_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *TokenAccessControlRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &tokenAccessControlRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := tokenAccessControlRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *TokenAccessControlRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st TokenAccessControlRequest) MarshalJSON() ([]byte, error) { - pb, err := tokenAccessControlRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s TokenAccessControlRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type TokenAccessControlResponse struct { // All permissions. - // Wire name: 'all_permissions' AllPermissions []TokenPermission `json:"all_permissions,omitempty"` // Display name of the user or service principal. - // Wire name: 'display_name' DisplayName string `json:"display_name,omitempty"` // name of the group - // Wire name: 'group_name' GroupName string `json:"group_name,omitempty"` // Name of the service principal. - // Wire name: 'service_principal_name' ServicePrincipalName string `json:"service_principal_name,omitempty"` // name of the user - // Wire name: 'user_name' UserName string `json:"user_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` -} - -func (st *TokenAccessControlResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &tokenAccessControlResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := tokenAccessControlResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil + ForceSendFields []string `json:"-" url:"-"` } -func (st TokenAccessControlResponse) MarshalJSON() ([]byte, error) { - pb, err := tokenAccessControlResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s *TokenAccessControlResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) +} + +func (s TokenAccessControlResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type TokenInfo struct { // Comment that describes the purpose of the token, specified by the token // creator. - // Wire name: 'comment' Comment string `json:"comment,omitempty"` // User ID of the user that created the token. - // Wire name: 'created_by_id' CreatedById int64 `json:"created_by_id,omitempty"` // Username of the user that created the token. - // Wire name: 'created_by_username' CreatedByUsername string `json:"created_by_username,omitempty"` // Timestamp when the token was created. - // Wire name: 'creation_time' CreationTime int64 `json:"creation_time,omitempty"` // Timestamp when the token expires. - // Wire name: 'expiry_time' ExpiryTime int64 `json:"expiry_time,omitempty"` // Approximate timestamp for the day the token was last used. Accurate up to // 1 day. - // Wire name: 'last_used_day' LastUsedDay int64 `json:"last_used_day,omitempty"` // User ID of the user that owns the token. - // Wire name: 'owner_id' OwnerId int64 `json:"owner_id,omitempty"` // ID of the token. - // Wire name: 'token_id' TokenId string `json:"token_id,omitempty"` // If applicable, the ID of the workspace that the token was created in. - // Wire name: 'workspace_id' WorkspaceId int64 `json:"workspace_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *TokenInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &tokenInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := tokenInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *TokenInfo) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st TokenInfo) MarshalJSON() ([]byte, error) { - pb, err := tokenInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s TokenInfo) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type TokenPermission struct { - - // Wire name: 'inherited' Inherited bool `json:"inherited,omitempty"` - // Wire name: 'inherited_from_object' InheritedFromObject []string `json:"inherited_from_object,omitempty"` // Permission level - // Wire name: 'permission_level' PermissionLevel TokenPermissionLevel `json:"permission_level,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *TokenPermission) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &tokenPermissionPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := tokenPermissionFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *TokenPermission) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st TokenPermission) MarshalJSON() ([]byte, error) { - pb, err := tokenPermissionToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s TokenPermission) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Permission level @@ -7869,111 +4029,43 @@ func (f *TokenPermissionLevel) Type() string { } type TokenPermissions struct { - - // Wire name: 'access_control_list' AccessControlList []TokenAccessControlResponse `json:"access_control_list,omitempty"` - // Wire name: 'object_id' ObjectId string `json:"object_id,omitempty"` - // Wire name: 'object_type' ObjectType string `json:"object_type,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *TokenPermissions) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &tokenPermissionsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := tokenPermissionsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *TokenPermissions) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st TokenPermissions) MarshalJSON() ([]byte, error) { - pb, err := tokenPermissionsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s TokenPermissions) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type TokenPermissionsDescription struct { - - // Wire name: 'description' Description string `json:"description,omitempty"` // Permission level - // Wire name: 'permission_level' PermissionLevel TokenPermissionLevel `json:"permission_level,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *TokenPermissionsDescription) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &tokenPermissionsDescriptionPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := tokenPermissionsDescriptionFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *TokenPermissionsDescription) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st TokenPermissionsDescription) MarshalJSON() ([]byte, error) { - pb, err := tokenPermissionsDescriptionToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s TokenPermissionsDescription) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type TokenPermissionsRequest struct { - - // Wire name: 'access_control_list' AccessControlList []TokenAccessControlRequest `json:"access_control_list,omitempty"` } -func (st *TokenPermissionsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &tokenPermissionsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := tokenPermissionsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st TokenPermissionsRequest) MarshalJSON() ([]byte, error) { - pb, err := tokenPermissionsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // The type of token request. As of now, only `AZURE_ACTIVE_DIRECTORY_TOKEN` is // supported. type TokenType string @@ -8026,7 +4118,6 @@ func (f *TokenType) Type() string { type UpdateAccountIpAccessEnableRequest struct { // This should always be set to true for Settings API. Added for AIP // compliance. - // Wire name: 'allow_missing' AllowMissing bool `json:"allow_missing"` // The field mask must be a single string, with multiple fields separated by // commas (no spaces). The field path is relative to the resource object, @@ -8039,43 +4130,15 @@ type UpdateAccountIpAccessEnableRequest struct { // always explicitly list the fields being updated and avoid using `*` // wildcards, as it can lead to unintended results if the API changes in the // future. - // Wire name: 'field_mask' FieldMask string `json:"field_mask"` - // Wire name: 'setting' Setting AccountIpAccessEnable `json:"setting"` } -func (st *UpdateAccountIpAccessEnableRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateAccountIpAccessEnableRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateAccountIpAccessEnableRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateAccountIpAccessEnableRequest) MarshalJSON() ([]byte, error) { - pb, err := updateAccountIpAccessEnableRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Details required to update a setting. type UpdateAibiDashboardEmbeddingAccessPolicySettingRequest struct { // This should always be set to true for Settings API. Added for AIP // compliance. - // Wire name: 'allow_missing' AllowMissing bool `json:"allow_missing"` // The field mask must be a single string, with multiple fields separated by // commas (no spaces). The field path is relative to the resource object, @@ -8088,43 +4151,15 @@ type UpdateAibiDashboardEmbeddingAccessPolicySettingRequest struct { // always explicitly list the fields being updated and avoid using `*` // wildcards, as it can lead to unintended results if the API changes in the // future. - // Wire name: 'field_mask' FieldMask string `json:"field_mask"` - // Wire name: 'setting' Setting AibiDashboardEmbeddingAccessPolicySetting `json:"setting"` } -func (st *UpdateAibiDashboardEmbeddingAccessPolicySettingRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateAibiDashboardEmbeddingAccessPolicySettingRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateAibiDashboardEmbeddingAccessPolicySettingRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateAibiDashboardEmbeddingAccessPolicySettingRequest) MarshalJSON() ([]byte, error) { - pb, err := updateAibiDashboardEmbeddingAccessPolicySettingRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Details required to update a setting. type UpdateAibiDashboardEmbeddingApprovedDomainsSettingRequest struct { // This should always be set to true for Settings API. Added for AIP // compliance. - // Wire name: 'allow_missing' AllowMissing bool `json:"allow_missing"` // The field mask must be a single string, with multiple fields separated by // commas (no spaces). The field path is relative to the resource object, @@ -8137,43 +4172,15 @@ type UpdateAibiDashboardEmbeddingApprovedDomainsSettingRequest struct { // always explicitly list the fields being updated and avoid using `*` // wildcards, as it can lead to unintended results if the API changes in the // future. - // Wire name: 'field_mask' FieldMask string `json:"field_mask"` - // Wire name: 'setting' Setting AibiDashboardEmbeddingApprovedDomainsSetting `json:"setting"` } -func (st *UpdateAibiDashboardEmbeddingApprovedDomainsSettingRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateAibiDashboardEmbeddingApprovedDomainsSettingRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateAibiDashboardEmbeddingApprovedDomainsSettingRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateAibiDashboardEmbeddingApprovedDomainsSettingRequest) MarshalJSON() ([]byte, error) { - pb, err := updateAibiDashboardEmbeddingApprovedDomainsSettingRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Details required to update a setting. type UpdateAutomaticClusterUpdateSettingRequest struct { // This should always be set to true for Settings API. Added for AIP // compliance. - // Wire name: 'allow_missing' AllowMissing bool `json:"allow_missing"` // The field mask must be a single string, with multiple fields separated by // commas (no spaces). The field path is relative to the resource object, @@ -8186,43 +4193,15 @@ type UpdateAutomaticClusterUpdateSettingRequest struct { // always explicitly list the fields being updated and avoid using `*` // wildcards, as it can lead to unintended results if the API changes in the // future. - // Wire name: 'field_mask' FieldMask string `json:"field_mask"` - // Wire name: 'setting' Setting AutomaticClusterUpdateSetting `json:"setting"` } -func (st *UpdateAutomaticClusterUpdateSettingRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateAutomaticClusterUpdateSettingRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateAutomaticClusterUpdateSettingRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateAutomaticClusterUpdateSettingRequest) MarshalJSON() ([]byte, error) { - pb, err := updateAutomaticClusterUpdateSettingRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Details required to update a setting. type UpdateComplianceSecurityProfileSettingRequest struct { // This should always be set to true for Settings API. Added for AIP // compliance. - // Wire name: 'allow_missing' AllowMissing bool `json:"allow_missing"` // The field mask must be a single string, with multiple fields separated by // commas (no spaces). The field path is relative to the resource object, @@ -8235,43 +4214,15 @@ type UpdateComplianceSecurityProfileSettingRequest struct { // always explicitly list the fields being updated and avoid using `*` // wildcards, as it can lead to unintended results if the API changes in the // future. - // Wire name: 'field_mask' FieldMask string `json:"field_mask"` - // Wire name: 'setting' Setting ComplianceSecurityProfileSetting `json:"setting"` } -func (st *UpdateComplianceSecurityProfileSettingRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateComplianceSecurityProfileSettingRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateComplianceSecurityProfileSettingRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateComplianceSecurityProfileSettingRequest) MarshalJSON() ([]byte, error) { - pb, err := updateComplianceSecurityProfileSettingRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Details required to update a setting. type UpdateCspEnablementAccountSettingRequest struct { // This should always be set to true for Settings API. Added for AIP // compliance. - // Wire name: 'allow_missing' AllowMissing bool `json:"allow_missing"` // The field mask must be a single string, with multiple fields separated by // commas (no spaces). The field path is relative to the resource object, @@ -8284,43 +4235,15 @@ type UpdateCspEnablementAccountSettingRequest struct { // always explicitly list the fields being updated and avoid using `*` // wildcards, as it can lead to unintended results if the API changes in the // future. - // Wire name: 'field_mask' FieldMask string `json:"field_mask"` - // Wire name: 'setting' Setting CspEnablementAccountSetting `json:"setting"` } -func (st *UpdateCspEnablementAccountSettingRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateCspEnablementAccountSettingRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateCspEnablementAccountSettingRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateCspEnablementAccountSettingRequest) MarshalJSON() ([]byte, error) { - pb, err := updateCspEnablementAccountSettingRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Details required to update a setting. type UpdateDashboardEmailSubscriptionsRequest struct { // This should always be set to true for Settings API. Added for AIP // compliance. - // Wire name: 'allow_missing' AllowMissing bool `json:"allow_missing"` // The field mask must be a single string, with multiple fields separated by // commas (no spaces). The field path is relative to the resource object, @@ -8333,43 +4256,15 @@ type UpdateDashboardEmailSubscriptionsRequest struct { // always explicitly list the fields being updated and avoid using `*` // wildcards, as it can lead to unintended results if the API changes in the // future. - // Wire name: 'field_mask' FieldMask string `json:"field_mask"` - // Wire name: 'setting' Setting DashboardEmailSubscriptions `json:"setting"` } -func (st *UpdateDashboardEmailSubscriptionsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateDashboardEmailSubscriptionsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateDashboardEmailSubscriptionsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateDashboardEmailSubscriptionsRequest) MarshalJSON() ([]byte, error) { - pb, err := updateDashboardEmailSubscriptionsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Details required to update a setting. type UpdateDefaultNamespaceSettingRequest struct { // This should always be set to true for Settings API. Added for AIP // compliance. - // Wire name: 'allow_missing' AllowMissing bool `json:"allow_missing"` // The field mask must be a single string, with multiple fields separated by // commas (no spaces). The field path is relative to the resource object, @@ -8382,7 +4277,6 @@ type UpdateDefaultNamespaceSettingRequest struct { // always explicitly list the fields being updated and avoid using `*` // wildcards, as it can lead to unintended results if the API changes in the // future. - // Wire name: 'field_mask' FieldMask string `json:"field_mask"` // This represents the setting configuration for the default namespace in // the Databricks workspace. Setting the default catalog for the workspace @@ -8393,40 +4287,13 @@ type UpdateDefaultNamespaceSettingRequest struct { // assumed). This setting requires a restart of clusters and SQL warehouses // to take effect. Additionally, the default namespace only applies when // using Unity Catalog-enabled compute. - // Wire name: 'setting' Setting DefaultNamespaceSetting `json:"setting"` } -func (st *UpdateDefaultNamespaceSettingRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateDefaultNamespaceSettingRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateDefaultNamespaceSettingRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateDefaultNamespaceSettingRequest) MarshalJSON() ([]byte, error) { - pb, err := updateDefaultNamespaceSettingRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Details required to update a setting. type UpdateDisableLegacyAccessRequest struct { // This should always be set to true for Settings API. Added for AIP // compliance. - // Wire name: 'allow_missing' AllowMissing bool `json:"allow_missing"` // The field mask must be a single string, with multiple fields separated by // commas (no spaces). The field path is relative to the resource object, @@ -8439,43 +4306,15 @@ type UpdateDisableLegacyAccessRequest struct { // always explicitly list the fields being updated and avoid using `*` // wildcards, as it can lead to unintended results if the API changes in the // future. - // Wire name: 'field_mask' FieldMask string `json:"field_mask"` - // Wire name: 'setting' Setting DisableLegacyAccess `json:"setting"` } -func (st *UpdateDisableLegacyAccessRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateDisableLegacyAccessRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateDisableLegacyAccessRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateDisableLegacyAccessRequest) MarshalJSON() ([]byte, error) { - pb, err := updateDisableLegacyAccessRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Details required to update a setting. type UpdateDisableLegacyDbfsRequest struct { // This should always be set to true for Settings API. Added for AIP // compliance. - // Wire name: 'allow_missing' AllowMissing bool `json:"allow_missing"` // The field mask must be a single string, with multiple fields separated by // commas (no spaces). The field path is relative to the resource object, @@ -8488,43 +4327,15 @@ type UpdateDisableLegacyDbfsRequest struct { // always explicitly list the fields being updated and avoid using `*` // wildcards, as it can lead to unintended results if the API changes in the // future. - // Wire name: 'field_mask' FieldMask string `json:"field_mask"` - // Wire name: 'setting' Setting DisableLegacyDbfs `json:"setting"` } -func (st *UpdateDisableLegacyDbfsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateDisableLegacyDbfsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateDisableLegacyDbfsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateDisableLegacyDbfsRequest) MarshalJSON() ([]byte, error) { - pb, err := updateDisableLegacyDbfsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Details required to update a setting. type UpdateDisableLegacyFeaturesRequest struct { // This should always be set to true for Settings API. Added for AIP // compliance. - // Wire name: 'allow_missing' AllowMissing bool `json:"allow_missing"` // The field mask must be a single string, with multiple fields separated by // commas (no spaces). The field path is relative to the resource object, @@ -8537,43 +4348,15 @@ type UpdateDisableLegacyFeaturesRequest struct { // always explicitly list the fields being updated and avoid using `*` // wildcards, as it can lead to unintended results if the API changes in the // future. - // Wire name: 'field_mask' FieldMask string `json:"field_mask"` - // Wire name: 'setting' Setting DisableLegacyFeatures `json:"setting"` } -func (st *UpdateDisableLegacyFeaturesRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateDisableLegacyFeaturesRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateDisableLegacyFeaturesRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateDisableLegacyFeaturesRequest) MarshalJSON() ([]byte, error) { - pb, err := updateDisableLegacyFeaturesRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Details required to update a setting. type UpdateEnableExportNotebookRequest struct { // This should always be set to true for Settings API. Added for AIP // compliance. - // Wire name: 'allow_missing' AllowMissing bool `json:"allow_missing"` // The field mask must be a single string, with multiple fields separated by // commas (no spaces). The field path is relative to the resource object, @@ -8586,43 +4369,15 @@ type UpdateEnableExportNotebookRequest struct { // always explicitly list the fields being updated and avoid using `*` // wildcards, as it can lead to unintended results if the API changes in the // future. - // Wire name: 'field_mask' FieldMask string `json:"field_mask"` - // Wire name: 'setting' Setting EnableExportNotebook `json:"setting"` } -func (st *UpdateEnableExportNotebookRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateEnableExportNotebookRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateEnableExportNotebookRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateEnableExportNotebookRequest) MarshalJSON() ([]byte, error) { - pb, err := updateEnableExportNotebookRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Details required to update a setting. type UpdateEnableNotebookTableClipboardRequest struct { // This should always be set to true for Settings API. Added for AIP // compliance. - // Wire name: 'allow_missing' AllowMissing bool `json:"allow_missing"` // The field mask must be a single string, with multiple fields separated by // commas (no spaces). The field path is relative to the resource object, @@ -8635,43 +4390,15 @@ type UpdateEnableNotebookTableClipboardRequest struct { // always explicitly list the fields being updated and avoid using `*` // wildcards, as it can lead to unintended results if the API changes in the // future. - // Wire name: 'field_mask' FieldMask string `json:"field_mask"` - // Wire name: 'setting' Setting EnableNotebookTableClipboard `json:"setting"` } -func (st *UpdateEnableNotebookTableClipboardRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateEnableNotebookTableClipboardRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateEnableNotebookTableClipboardRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateEnableNotebookTableClipboardRequest) MarshalJSON() ([]byte, error) { - pb, err := updateEnableNotebookTableClipboardRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Details required to update a setting. type UpdateEnableResultsDownloadingRequest struct { // This should always be set to true for Settings API. Added for AIP // compliance. - // Wire name: 'allow_missing' AllowMissing bool `json:"allow_missing"` // The field mask must be a single string, with multiple fields separated by // commas (no spaces). The field path is relative to the resource object, @@ -8684,43 +4411,15 @@ type UpdateEnableResultsDownloadingRequest struct { // always explicitly list the fields being updated and avoid using `*` // wildcards, as it can lead to unintended results if the API changes in the // future. - // Wire name: 'field_mask' FieldMask string `json:"field_mask"` - // Wire name: 'setting' Setting EnableResultsDownloading `json:"setting"` } -func (st *UpdateEnableResultsDownloadingRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateEnableResultsDownloadingRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateEnableResultsDownloadingRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateEnableResultsDownloadingRequest) MarshalJSON() ([]byte, error) { - pb, err := updateEnableResultsDownloadingRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Details required to update a setting. type UpdateEnhancedSecurityMonitoringSettingRequest struct { // This should always be set to true for Settings API. Added for AIP // compliance. - // Wire name: 'allow_missing' AllowMissing bool `json:"allow_missing"` // The field mask must be a single string, with multiple fields separated by // commas (no spaces). The field path is relative to the resource object, @@ -8733,43 +4432,15 @@ type UpdateEnhancedSecurityMonitoringSettingRequest struct { // always explicitly list the fields being updated and avoid using `*` // wildcards, as it can lead to unintended results if the API changes in the // future. - // Wire name: 'field_mask' FieldMask string `json:"field_mask"` - // Wire name: 'setting' Setting EnhancedSecurityMonitoringSetting `json:"setting"` } -func (st *UpdateEnhancedSecurityMonitoringSettingRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateEnhancedSecurityMonitoringSettingRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateEnhancedSecurityMonitoringSettingRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateEnhancedSecurityMonitoringSettingRequest) MarshalJSON() ([]byte, error) { - pb, err := updateEnhancedSecurityMonitoringSettingRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Details required to update a setting. type UpdateEsmEnablementAccountSettingRequest struct { // This should always be set to true for Settings API. Added for AIP // compliance. - // Wire name: 'allow_missing' AllowMissing bool `json:"allow_missing"` // The field mask must be a single string, with multiple fields separated by // commas (no spaces). The field path is relative to the resource object, @@ -8782,50 +4453,20 @@ type UpdateEsmEnablementAccountSettingRequest struct { // always explicitly list the fields being updated and avoid using `*` // wildcards, as it can lead to unintended results if the API changes in the // future. - // Wire name: 'field_mask' FieldMask string `json:"field_mask"` - // Wire name: 'setting' Setting EsmEnablementAccountSetting `json:"setting"` } -func (st *UpdateEsmEnablementAccountSettingRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateEsmEnablementAccountSettingRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateEsmEnablementAccountSettingRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateEsmEnablementAccountSettingRequest) MarshalJSON() ([]byte, error) { - pb, err := updateEsmEnablementAccountSettingRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Details required to update an IP access list. type UpdateIpAccessList struct { // Specifies whether this IP access list is enabled. - // Wire name: 'enabled' Enabled bool `json:"enabled,omitempty"` // The ID for the corresponding IP access list - IpAccessListId string `json:"-" tf:"-"` + IpAccessListId string `json:"-" url:"-"` - // Wire name: 'ip_addresses' IpAddresses []string `json:"ip_addresses,omitempty"` // Label for the IP access list. This **cannot** be empty. - // Wire name: 'label' Label string `json:"label,omitempty"` // Type of IP access list. Valid values are as follows and are // case-sensitive: @@ -8833,42 +4474,23 @@ type UpdateIpAccessList struct { // * `ALLOW`: An allow list. Include this IP or range. * `BLOCK`: A block // list. Exclude this IP or range. IP addresses in the block list are // excluded even if they are included in an allow list. - // Wire name: 'list_type' ListType ListType `json:"list_type,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *UpdateIpAccessList) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateIpAccessListPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateIpAccessListFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *UpdateIpAccessList) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st UpdateIpAccessList) MarshalJSON() ([]byte, error) { - pb, err := updateIpAccessListToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s UpdateIpAccessList) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Details required to update a setting. type UpdateLlmProxyPartnerPoweredAccountRequest struct { // This should always be set to true for Settings API. Added for AIP // compliance. - // Wire name: 'allow_missing' AllowMissing bool `json:"allow_missing"` // The field mask must be a single string, with multiple fields separated by // commas (no spaces). The field path is relative to the resource object, @@ -8881,43 +4503,15 @@ type UpdateLlmProxyPartnerPoweredAccountRequest struct { // always explicitly list the fields being updated and avoid using `*` // wildcards, as it can lead to unintended results if the API changes in the // future. - // Wire name: 'field_mask' FieldMask string `json:"field_mask"` - // Wire name: 'setting' Setting LlmProxyPartnerPoweredAccount `json:"setting"` } -func (st *UpdateLlmProxyPartnerPoweredAccountRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateLlmProxyPartnerPoweredAccountRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateLlmProxyPartnerPoweredAccountRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateLlmProxyPartnerPoweredAccountRequest) MarshalJSON() ([]byte, error) { - pb, err := updateLlmProxyPartnerPoweredAccountRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Details required to update a setting. type UpdateLlmProxyPartnerPoweredEnforceRequest struct { // This should always be set to true for Settings API. Added for AIP // compliance. - // Wire name: 'allow_missing' AllowMissing bool `json:"allow_missing"` // The field mask must be a single string, with multiple fields separated by // commas (no spaces). The field path is relative to the resource object, @@ -8930,43 +4524,15 @@ type UpdateLlmProxyPartnerPoweredEnforceRequest struct { // always explicitly list the fields being updated and avoid using `*` // wildcards, as it can lead to unintended results if the API changes in the // future. - // Wire name: 'field_mask' FieldMask string `json:"field_mask"` - // Wire name: 'setting' Setting LlmProxyPartnerPoweredEnforce `json:"setting"` } -func (st *UpdateLlmProxyPartnerPoweredEnforceRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateLlmProxyPartnerPoweredEnforceRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateLlmProxyPartnerPoweredEnforceRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateLlmProxyPartnerPoweredEnforceRequest) MarshalJSON() ([]byte, error) { - pb, err := updateLlmProxyPartnerPoweredEnforceRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Details required to update a setting. type UpdateLlmProxyPartnerPoweredWorkspaceRequest struct { // This should always be set to true for Settings API. Added for AIP // compliance. - // Wire name: 'allow_missing' AllowMissing bool `json:"allow_missing"` // The field mask must be a single string, with multiple fields separated by // commas (no spaces). The field path is relative to the resource object, @@ -8979,161 +4545,61 @@ type UpdateLlmProxyPartnerPoweredWorkspaceRequest struct { // always explicitly list the fields being updated and avoid using `*` // wildcards, as it can lead to unintended results if the API changes in the // future. - // Wire name: 'field_mask' FieldMask string `json:"field_mask"` - // Wire name: 'setting' Setting LlmProxyPartnerPoweredWorkspace `json:"setting"` } -func (st *UpdateLlmProxyPartnerPoweredWorkspaceRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateLlmProxyPartnerPoweredWorkspaceRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateLlmProxyPartnerPoweredWorkspaceRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateLlmProxyPartnerPoweredWorkspaceRequest) MarshalJSON() ([]byte, error) { - pb, err := updateLlmProxyPartnerPoweredWorkspaceRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Update a private endpoint rule type UpdateNccPrivateEndpointRuleRequest struct { // The ID of a network connectivity configuration, which is the parent // resource of this private endpoint rule object. - NetworkConnectivityConfigId string `json:"-" tf:"-"` + NetworkConnectivityConfigId string `json:"-" url:"-"` // Properties of the new private endpoint rule. Note that you must approve // the endpoint in Azure portal after initialization. - // Wire name: 'private_endpoint_rule' PrivateEndpointRule UpdatePrivateEndpointRule `json:"private_endpoint_rule"` // Your private endpoint rule ID. - PrivateEndpointRuleId string `json:"-" tf:"-"` + PrivateEndpointRuleId string `json:"-" url:"-"` // The field mask must be a single string, with multiple fields separated by // commas (no spaces). The field path is relative to the resource object, // using a dot (`.`) to navigate sub-fields (e.g., `author.given_name`). // Specification of elements in sequence or map fields is not allowed, as // only the entire collection field can be specified. Field names must // exactly match the resource field names. - UpdateMask string `json:"-" tf:"-"` -} - -func (st *UpdateNccPrivateEndpointRuleRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateNccPrivateEndpointRuleRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateNccPrivateEndpointRuleRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateNccPrivateEndpointRuleRequest) MarshalJSON() ([]byte, error) { - pb, err := updateNccPrivateEndpointRuleRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + UpdateMask string `json:"-" url:"update_mask"` } // Update a network policy type UpdateNetworkPolicyRequest struct { - - // Wire name: 'network_policy' NetworkPolicy AccountNetworkPolicy `json:"network_policy"` // The unique identifier for the network policy. - NetworkPolicyId string `json:"-" tf:"-"` -} - -func (st *UpdateNetworkPolicyRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateNetworkPolicyRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateNetworkPolicyRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateNetworkPolicyRequest) MarshalJSON() ([]byte, error) { - pb, err := updateNetworkPolicyRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + NetworkPolicyId string `json:"-" url:"-"` } type UpdateNotificationDestinationRequest struct { // The configuration for the notification destination. Must wrap EXACTLY one // of the nested configs. - // Wire name: 'config' Config *Config `json:"config,omitempty"` // The display name for the notification destination. - // Wire name: 'display_name' DisplayName string `json:"display_name,omitempty"` // UUID identifying notification destination. - Id string `json:"-" tf:"-"` + Id string `json:"-" url:"-"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *UpdateNotificationDestinationRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateNotificationDestinationRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateNotificationDestinationRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *UpdateNotificationDestinationRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st UpdateNotificationDestinationRequest) MarshalJSON() ([]byte, error) { - pb, err := updateNotificationDestinationRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s UpdateNotificationDestinationRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Details required to update a setting. type UpdatePersonalComputeSettingRequest struct { // This should always be set to true for Settings API. Added for AIP // compliance. - // Wire name: 'allow_missing' AllowMissing bool `json:"allow_missing"` // The field mask must be a single string, with multiple fields separated by // commas (no spaces). The field path is relative to the resource object, @@ -9146,38 +4612,11 @@ type UpdatePersonalComputeSettingRequest struct { // always explicitly list the fields being updated and avoid using `*` // wildcards, as it can lead to unintended results if the API changes in the // future. - // Wire name: 'field_mask' FieldMask string `json:"field_mask"` - // Wire name: 'setting' Setting PersonalComputeSetting `json:"setting"` } -func (st *UpdatePersonalComputeSettingRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updatePersonalComputeSettingRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updatePersonalComputeSettingRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdatePersonalComputeSettingRequest) MarshalJSON() ([]byte, error) { - pb, err := updatePersonalComputeSettingRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Properties of the new private endpoint rule. Note that you must approve the // endpoint in Azure portal after initialization. type UpdatePrivateEndpointRule struct { @@ -9186,13 +4625,11 @@ type UpdatePrivateEndpointRule struct { // // Domain names of target private link service. When updating this field, // the full list of target domain_names must be specified. - // Wire name: 'domain_names' DomainNames []string `json:"domain_names,omitempty"` // Only used by private endpoints towards an AWS S3 service. // // Update this field to activate/deactivate this private endpoint to allow // egress access from serverless compute resources. - // Wire name: 'enabled' Enabled bool `json:"enabled,omitempty"` // Only used by private endpoints towards AWS S3 service. // @@ -9200,70 +4637,26 @@ type UpdatePrivateEndpointRule struct { // endpoint. The bucket names must be in the same region as the NCC/endpoint // service. When updating this field, we perform full update on this field. // Please ensure a full list of desired resource_names is provided. - // Wire name: 'resource_names' ResourceNames []string `json:"resource_names,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *UpdatePrivateEndpointRule) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updatePrivateEndpointRulePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updatePrivateEndpointRuleFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *UpdatePrivateEndpointRule) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st UpdatePrivateEndpointRule) MarshalJSON() ([]byte, error) { - pb, err := updatePrivateEndpointRuleToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s UpdatePrivateEndpointRule) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type UpdateResponse struct { } -func (st *UpdateResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateResponse) MarshalJSON() ([]byte, error) { - pb, err := updateResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Details required to update a setting. type UpdateRestrictWorkspaceAdminsSettingRequest struct { // This should always be set to true for Settings API. Added for AIP // compliance. - // Wire name: 'allow_missing' AllowMissing bool `json:"allow_missing"` // The field mask must be a single string, with multiple fields separated by // commas (no spaces). The field path is relative to the resource object, @@ -9276,43 +4669,15 @@ type UpdateRestrictWorkspaceAdminsSettingRequest struct { // always explicitly list the fields being updated and avoid using `*` // wildcards, as it can lead to unintended results if the API changes in the // future. - // Wire name: 'field_mask' FieldMask string `json:"field_mask"` - // Wire name: 'setting' Setting RestrictWorkspaceAdminsSetting `json:"setting"` } -func (st *UpdateRestrictWorkspaceAdminsSettingRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateRestrictWorkspaceAdminsSettingRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateRestrictWorkspaceAdminsSettingRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateRestrictWorkspaceAdminsSettingRequest) MarshalJSON() ([]byte, error) { - pb, err := updateRestrictWorkspaceAdminsSettingRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Details required to update a setting. type UpdateSqlResultsDownloadRequest struct { // This should always be set to true for Settings API. Added for AIP // compliance. - // Wire name: 'allow_missing' AllowMissing bool `json:"allow_missing"` // The field mask must be a single string, with multiple fields separated by // commas (no spaces). The field path is relative to the resource object, @@ -9325,72 +4690,19 @@ type UpdateSqlResultsDownloadRequest struct { // always explicitly list the fields being updated and avoid using `*` // wildcards, as it can lead to unintended results if the API changes in the // future. - // Wire name: 'field_mask' FieldMask string `json:"field_mask"` - // Wire name: 'setting' Setting SqlResultsDownload `json:"setting"` } -func (st *UpdateSqlResultsDownloadRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateSqlResultsDownloadRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateSqlResultsDownloadRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateSqlResultsDownloadRequest) MarshalJSON() ([]byte, error) { - pb, err := updateSqlResultsDownloadRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Update workspace network option type UpdateWorkspaceNetworkOptionRequest struct { // The workspace ID. - WorkspaceId int64 `json:"-" tf:"-"` + WorkspaceId int64 `json:"-" url:"-"` - // Wire name: 'workspace_network_option' WorkspaceNetworkOption WorkspaceNetworkOption `json:"workspace_network_option"` } -func (st *UpdateWorkspaceNetworkOptionRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateWorkspaceNetworkOptionRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateWorkspaceNetworkOptionRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateWorkspaceNetworkOptionRequest) MarshalJSON() ([]byte, error) { - pb, err := updateWorkspaceNetworkOptionRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type WorkspaceConf map[string]string type WorkspaceNetworkOption struct { @@ -9399,36 +4711,17 @@ type WorkspaceNetworkOption struct { // workspace. Each workspace can only be linked to one policy at a time. If // no policy is explicitly assigned, the workspace will use // 'default-policy'. - // Wire name: 'network_policy_id' NetworkPolicyId string `json:"network_policy_id,omitempty"` // The workspace ID. - // Wire name: 'workspace_id' WorkspaceId int64 `json:"workspace_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *WorkspaceNetworkOption) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &workspaceNetworkOptionPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := workspaceNetworkOptionFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *WorkspaceNetworkOption) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st WorkspaceNetworkOption) MarshalJSON() ([]byte, error) { - pb, err := workspaceNetworkOptionToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s WorkspaceNetworkOption) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } diff --git a/service/sharing/impl.go b/service/sharing/impl.go index 3c45ebd8e..c5dc9ca0a 100755 --- a/service/sharing/impl.go +++ b/service/sharing/impl.go @@ -19,95 +19,33 @@ type providersImpl struct { } func (a *providersImpl) Create(ctx context.Context, request CreateProvider) (*ProviderInfo, error) { - - requestPb, pbErr := createProviderToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var providerInfoPb providerInfoPb + var providerInfo ProviderInfo path := "/api/2.1/unity-catalog/providers" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &providerInfoPb, - ) - if err != nil { - return nil, err - } - resp, err := providerInfoFromPb(&providerInfoPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &providerInfo) + return &providerInfo, err } func (a *providersImpl) Delete(ctx context.Context, request DeleteProviderRequest) error { - - requestPb, pbErr := deleteProviderRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteResponsePb deleteResponsePb - path := fmt.Sprintf("/api/2.1/unity-catalog/providers/%v", requestPb.Name) + var deleteResponse DeleteResponse + path := fmt.Sprintf("/api/2.1/unity-catalog/providers/%v", request.Name) queryParams := make(map[string]any) headers := make(map[string]string) - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteResponse) return err } func (a *providersImpl) Get(ctx context.Context, request GetProviderRequest) (*ProviderInfo, error) { - - requestPb, pbErr := getProviderRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var providerInfoPb providerInfoPb - path := fmt.Sprintf("/api/2.1/unity-catalog/providers/%v", requestPb.Name) + var providerInfo ProviderInfo + path := fmt.Sprintf("/api/2.1/unity-catalog/providers/%v", request.Name) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &providerInfoPb, - ) - if err != nil { - return nil, err - } - resp, err := providerInfoFromPb(&providerInfoPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &providerInfo) + return &providerInfo, err } // Gets an array of available authentication providers. The caller must either @@ -150,67 +88,23 @@ func (a *providersImpl) ListAll(ctx context.Context, request ListProvidersReques } func (a *providersImpl) internalList(ctx context.Context, request ListProvidersRequest) (*ListProvidersResponse, error) { - - requestPb, pbErr := listProvidersRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listProvidersResponsePb listProvidersResponsePb + var listProvidersResponse ListProvidersResponse path := "/api/2.1/unity-catalog/providers" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listProvidersResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listProvidersResponseFromPb(&listProvidersResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listProvidersResponse) + return &listProvidersResponse, err } func (a *providersImpl) ListProviderShareAssets(ctx context.Context, request ListProviderShareAssetsRequest) (*ListProviderShareAssetsResponse, error) { - - requestPb, pbErr := listProviderShareAssetsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listProviderShareAssetsResponsePb listProviderShareAssetsResponsePb - path := fmt.Sprintf("/api/2.1/data-sharing/providers/%v/shares/%v", requestPb.ProviderName, requestPb.ShareName) + var listProviderShareAssetsResponse ListProviderShareAssetsResponse + path := fmt.Sprintf("/api/2.1/data-sharing/providers/%v/shares/%v", request.ProviderName, request.ShareName) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listProviderShareAssetsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listProviderShareAssetsResponseFromPb(&listProviderShareAssetsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listProviderShareAssetsResponse) + return &listProviderShareAssetsResponse, err } // Gets an array of a specified provider's shares within the metastore where: @@ -251,68 +145,24 @@ func (a *providersImpl) ListSharesAll(ctx context.Context, request ListSharesReq } func (a *providersImpl) internalListShares(ctx context.Context, request ListSharesRequest) (*ListProviderSharesResponse, error) { - - requestPb, pbErr := listSharesRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listProviderSharesResponsePb listProviderSharesResponsePb - path := fmt.Sprintf("/api/2.1/unity-catalog/providers/%v/shares", requestPb.Name) + var listProviderSharesResponse ListProviderSharesResponse + path := fmt.Sprintf("/api/2.1/unity-catalog/providers/%v/shares", request.Name) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listProviderSharesResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listProviderSharesResponseFromPb(&listProviderSharesResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listProviderSharesResponse) + return &listProviderSharesResponse, err } func (a *providersImpl) Update(ctx context.Context, request UpdateProvider) (*ProviderInfo, error) { - - requestPb, pbErr := updateProviderToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var providerInfoPb providerInfoPb - path := fmt.Sprintf("/api/2.1/unity-catalog/providers/%v", requestPb.Name) + var providerInfo ProviderInfo + path := fmt.Sprintf("/api/2.1/unity-catalog/providers/%v", request.Name) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &providerInfoPb, - ) - if err != nil { - return nil, err - } - resp, err := providerInfoFromPb(&providerInfoPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &providerInfo) + return &providerInfo, err } // unexported type that holds implementations of just RecipientActivation API methods @@ -321,63 +171,23 @@ type recipientActivationImpl struct { } func (a *recipientActivationImpl) GetActivationUrlInfo(ctx context.Context, request GetActivationUrlInfoRequest) error { - - requestPb, pbErr := getActivationUrlInfoRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var getActivationUrlInfoResponsePb getActivationUrlInfoResponsePb - path := fmt.Sprintf("/api/2.1/unity-catalog/public/data_sharing_activation_info/%v", requestPb.ActivationUrl) + var getActivationUrlInfoResponse GetActivationUrlInfoResponse + path := fmt.Sprintf("/api/2.1/unity-catalog/public/data_sharing_activation_info/%v", request.ActivationUrl) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &getActivationUrlInfoResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getActivationUrlInfoResponse) return err } func (a *recipientActivationImpl) RetrieveToken(ctx context.Context, request RetrieveTokenRequest) (*RetrieveTokenResponse, error) { - - requestPb, pbErr := retrieveTokenRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var retrieveTokenResponsePb retrieveTokenResponsePb - path := fmt.Sprintf("/api/2.1/unity-catalog/public/data_sharing_activation/%v", requestPb.ActivationUrl) + var retrieveTokenResponse RetrieveTokenResponse + path := fmt.Sprintf("/api/2.1/unity-catalog/public/data_sharing_activation/%v", request.ActivationUrl) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &retrieveTokenResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := retrieveTokenResponseFromPb(&retrieveTokenResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &retrieveTokenResponse) + return &retrieveTokenResponse, err } // unexported type that holds implementations of just RecipientFederationPolicies API methods @@ -386,96 +196,34 @@ type recipientFederationPoliciesImpl struct { } func (a *recipientFederationPoliciesImpl) Create(ctx context.Context, request CreateFederationPolicyRequest) (*FederationPolicy, error) { - - requestPb, pbErr := createFederationPolicyRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var federationPolicyPb federationPolicyPb - path := fmt.Sprintf("/api/2.0/data-sharing/recipients/%v/federation-policies", requestPb.RecipientName) + var federationPolicy FederationPolicy + path := fmt.Sprintf("/api/2.0/data-sharing/recipients/%v/federation-policies", request.RecipientName) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb).Policy, - &federationPolicyPb, - ) - if err != nil { - return nil, err - } - resp, err := federationPolicyFromPb(&federationPolicyPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.Policy, &federationPolicy) + return &federationPolicy, err } func (a *recipientFederationPoliciesImpl) Delete(ctx context.Context, request DeleteFederationPolicyRequest) error { - - requestPb, pbErr := deleteFederationPolicyRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteResponsePb deleteResponsePb - path := fmt.Sprintf("/api/2.0/data-sharing/recipients/%v/federation-policies/%v", requestPb.RecipientName, requestPb.Name) + var deleteResponse DeleteResponse + path := fmt.Sprintf("/api/2.0/data-sharing/recipients/%v/federation-policies/%v", request.RecipientName, request.Name) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteResponse) return err } func (a *recipientFederationPoliciesImpl) GetFederationPolicy(ctx context.Context, request GetFederationPolicyRequest) (*FederationPolicy, error) { - - requestPb, pbErr := getFederationPolicyRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var federationPolicyPb federationPolicyPb - path := fmt.Sprintf("/api/2.0/data-sharing/recipients/%v/federation-policies/%v", requestPb.RecipientName, requestPb.Name) + var federationPolicy FederationPolicy + path := fmt.Sprintf("/api/2.0/data-sharing/recipients/%v/federation-policies/%v", request.RecipientName, request.Name) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &federationPolicyPb, - ) - if err != nil { - return nil, err - } - resp, err := federationPolicyFromPb(&federationPolicyPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &federationPolicy) + return &federationPolicy, err } // Lists federation policies for an OIDC_FEDERATION recipient for sharing data @@ -514,71 +262,27 @@ func (a *recipientFederationPoliciesImpl) ListAll(ctx context.Context, request L } func (a *recipientFederationPoliciesImpl) internalList(ctx context.Context, request ListFederationPoliciesRequest) (*ListFederationPoliciesResponse, error) { - - requestPb, pbErr := listFederationPoliciesRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listFederationPoliciesResponsePb listFederationPoliciesResponsePb - path := fmt.Sprintf("/api/2.0/data-sharing/recipients/%v/federation-policies", requestPb.RecipientName) + var listFederationPoliciesResponse ListFederationPoliciesResponse + path := fmt.Sprintf("/api/2.0/data-sharing/recipients/%v/federation-policies", request.RecipientName) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listFederationPoliciesResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listFederationPoliciesResponseFromPb(&listFederationPoliciesResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listFederationPoliciesResponse) + return &listFederationPoliciesResponse, err } func (a *recipientFederationPoliciesImpl) Update(ctx context.Context, request UpdateFederationPolicyRequest) (*FederationPolicy, error) { - - requestPb, pbErr := updateFederationPolicyRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var federationPolicyPb federationPolicyPb - path := fmt.Sprintf("/api/2.0/data-sharing/recipients/%v/federation-policies/%v", requestPb.RecipientName, requestPb.Name) + var federationPolicy FederationPolicy + path := fmt.Sprintf("/api/2.0/data-sharing/recipients/%v/federation-policies/%v", request.RecipientName, request.Name) queryParams := make(map[string]any) - if requestPb.UpdateMask != "" || slices.Contains(requestPb.ForceSendFields, "UpdateMask") { - queryParams["update_mask"] = requestPb.UpdateMask + if request.UpdateMask != "" || slices.Contains(request.ForceSendFields, "UpdateMask") { + queryParams["update_mask"] = request.UpdateMask } headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb).Policy, - &federationPolicyPb, - ) - if err != nil { - return nil, err - } - resp, err := federationPolicyFromPb(&federationPolicyPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.Policy, &federationPolicy) + return &federationPolicy, err } // unexported type that holds implementations of just Recipients API methods @@ -587,95 +291,33 @@ type recipientsImpl struct { } func (a *recipientsImpl) Create(ctx context.Context, request CreateRecipient) (*RecipientInfo, error) { - - requestPb, pbErr := createRecipientToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var recipientInfoPb recipientInfoPb + var recipientInfo RecipientInfo path := "/api/2.1/unity-catalog/recipients" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &recipientInfoPb, - ) - if err != nil { - return nil, err - } - resp, err := recipientInfoFromPb(&recipientInfoPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &recipientInfo) + return &recipientInfo, err } func (a *recipientsImpl) Delete(ctx context.Context, request DeleteRecipientRequest) error { - - requestPb, pbErr := deleteRecipientRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteResponsePb deleteResponsePb - path := fmt.Sprintf("/api/2.1/unity-catalog/recipients/%v", requestPb.Name) + var deleteResponse DeleteResponse + path := fmt.Sprintf("/api/2.1/unity-catalog/recipients/%v", request.Name) queryParams := make(map[string]any) headers := make(map[string]string) - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteResponse) return err } func (a *recipientsImpl) Get(ctx context.Context, request GetRecipientRequest) (*RecipientInfo, error) { - - requestPb, pbErr := getRecipientRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var recipientInfoPb recipientInfoPb - path := fmt.Sprintf("/api/2.1/unity-catalog/recipients/%v", requestPb.Name) + var recipientInfo RecipientInfo + path := fmt.Sprintf("/api/2.1/unity-catalog/recipients/%v", request.Name) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &recipientInfoPb, - ) - if err != nil { - return nil, err - } - resp, err := recipientInfoFromPb(&recipientInfoPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &recipientInfo) + return &recipientInfo, err } // Gets an array of all share recipients within the current metastore where: @@ -718,133 +360,45 @@ func (a *recipientsImpl) ListAll(ctx context.Context, request ListRecipientsRequ } func (a *recipientsImpl) internalList(ctx context.Context, request ListRecipientsRequest) (*ListRecipientsResponse, error) { - - requestPb, pbErr := listRecipientsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listRecipientsResponsePb listRecipientsResponsePb + var listRecipientsResponse ListRecipientsResponse path := "/api/2.1/unity-catalog/recipients" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listRecipientsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listRecipientsResponseFromPb(&listRecipientsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listRecipientsResponse) + return &listRecipientsResponse, err } func (a *recipientsImpl) RotateToken(ctx context.Context, request RotateRecipientToken) (*RecipientInfo, error) { - - requestPb, pbErr := rotateRecipientTokenToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var recipientInfoPb recipientInfoPb - path := fmt.Sprintf("/api/2.1/unity-catalog/recipients/%v/rotate-token", requestPb.Name) + var recipientInfo RecipientInfo + path := fmt.Sprintf("/api/2.1/unity-catalog/recipients/%v/rotate-token", request.Name) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &recipientInfoPb, - ) - if err != nil { - return nil, err - } - resp, err := recipientInfoFromPb(&recipientInfoPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &recipientInfo) + return &recipientInfo, err } func (a *recipientsImpl) SharePermissions(ctx context.Context, request SharePermissionsRequest) (*GetRecipientSharePermissionsResponse, error) { - - requestPb, pbErr := sharePermissionsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var getRecipientSharePermissionsResponsePb getRecipientSharePermissionsResponsePb - path := fmt.Sprintf("/api/2.1/unity-catalog/recipients/%v/share-permissions", requestPb.Name) + var getRecipientSharePermissionsResponse GetRecipientSharePermissionsResponse + path := fmt.Sprintf("/api/2.1/unity-catalog/recipients/%v/share-permissions", request.Name) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &getRecipientSharePermissionsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := getRecipientSharePermissionsResponseFromPb(&getRecipientSharePermissionsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getRecipientSharePermissionsResponse) + return &getRecipientSharePermissionsResponse, err } func (a *recipientsImpl) Update(ctx context.Context, request UpdateRecipient) (*RecipientInfo, error) { - - requestPb, pbErr := updateRecipientToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var recipientInfoPb recipientInfoPb - path := fmt.Sprintf("/api/2.1/unity-catalog/recipients/%v", requestPb.Name) + var recipientInfo RecipientInfo + path := fmt.Sprintf("/api/2.1/unity-catalog/recipients/%v", request.Name) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &recipientInfoPb, - ) - if err != nil { - return nil, err - } - resp, err := recipientInfoFromPb(&recipientInfoPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &recipientInfo) + return &recipientInfo, err } // unexported type that holds implementations of just Shares API methods @@ -853,95 +407,33 @@ type sharesImpl struct { } func (a *sharesImpl) Create(ctx context.Context, request CreateShare) (*ShareInfo, error) { - - requestPb, pbErr := createShareToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var shareInfoPb shareInfoPb + var shareInfo ShareInfo path := "/api/2.1/unity-catalog/shares" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &shareInfoPb, - ) - if err != nil { - return nil, err - } - resp, err := shareInfoFromPb(&shareInfoPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &shareInfo) + return &shareInfo, err } func (a *sharesImpl) Delete(ctx context.Context, request DeleteShareRequest) error { - - requestPb, pbErr := deleteShareRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteResponsePb deleteResponsePb - path := fmt.Sprintf("/api/2.1/unity-catalog/shares/%v", requestPb.Name) + var deleteResponse DeleteResponse + path := fmt.Sprintf("/api/2.1/unity-catalog/shares/%v", request.Name) queryParams := make(map[string]any) headers := make(map[string]string) - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteResponse) return err } func (a *sharesImpl) Get(ctx context.Context, request GetShareRequest) (*ShareInfo, error) { - - requestPb, pbErr := getShareRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var shareInfoPb shareInfoPb - path := fmt.Sprintf("/api/2.1/unity-catalog/shares/%v", requestPb.Name) + var shareInfo ShareInfo + path := fmt.Sprintf("/api/2.1/unity-catalog/shares/%v", request.Name) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &shareInfoPb, - ) - if err != nil { - return nil, err - } - resp, err := shareInfoFromPb(&shareInfoPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &shareInfo) + return &shareInfo, err } // Gets an array of data object shares from the metastore. The caller must be a @@ -982,131 +474,43 @@ func (a *sharesImpl) ListAll(ctx context.Context, request ListSharesRequest) ([] } func (a *sharesImpl) internalList(ctx context.Context, request ListSharesRequest) (*ListSharesResponse, error) { - - requestPb, pbErr := listSharesRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listSharesResponsePb listSharesResponsePb + var listSharesResponse ListSharesResponse path := "/api/2.1/unity-catalog/shares" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listSharesResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listSharesResponseFromPb(&listSharesResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listSharesResponse) + return &listSharesResponse, err } func (a *sharesImpl) SharePermissions(ctx context.Context, request SharePermissionsRequest) (*GetSharePermissionsResponse, error) { - - requestPb, pbErr := sharePermissionsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var getSharePermissionsResponsePb getSharePermissionsResponsePb - path := fmt.Sprintf("/api/2.1/unity-catalog/shares/%v/permissions", requestPb.Name) + var getSharePermissionsResponse GetSharePermissionsResponse + path := fmt.Sprintf("/api/2.1/unity-catalog/shares/%v/permissions", request.Name) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &getSharePermissionsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := getSharePermissionsResponseFromPb(&getSharePermissionsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getSharePermissionsResponse) + return &getSharePermissionsResponse, err } func (a *sharesImpl) Update(ctx context.Context, request UpdateShare) (*ShareInfo, error) { - - requestPb, pbErr := updateShareToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var shareInfoPb shareInfoPb - path := fmt.Sprintf("/api/2.1/unity-catalog/shares/%v", requestPb.Name) + var shareInfo ShareInfo + path := fmt.Sprintf("/api/2.1/unity-catalog/shares/%v", request.Name) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &shareInfoPb, - ) - if err != nil { - return nil, err - } - resp, err := shareInfoFromPb(&shareInfoPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &shareInfo) + return &shareInfo, err } func (a *sharesImpl) UpdatePermissions(ctx context.Context, request UpdateSharePermissions) (*UpdateSharePermissionsResponse, error) { - - requestPb, pbErr := updateSharePermissionsToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var updateSharePermissionsResponsePb updateSharePermissionsResponsePb - path := fmt.Sprintf("/api/2.1/unity-catalog/shares/%v/permissions", requestPb.Name) + var updateSharePermissionsResponse UpdateSharePermissionsResponse + path := fmt.Sprintf("/api/2.1/unity-catalog/shares/%v/permissions", request.Name) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &updateSharePermissionsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := updateSharePermissionsResponseFromPb(&updateSharePermissionsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &updateSharePermissionsResponse) + return &updateSharePermissionsResponse, err } diff --git a/service/sharing/internal.go b/service/sharing/internal.go deleted file mode 100755 index bbe313d91..000000000 --- a/service/sharing/internal.go +++ /dev/null @@ -1,2823 +0,0 @@ -// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. - -package sharing - -import ( - "fmt" - "strings" - "time" - - "github.com/databricks/databricks-sdk-go/marshal" - "github.com/databricks/databricks-sdk-go/service/catalog" -) - -func createFederationPolicyRequestToPb(st *CreateFederationPolicyRequest) (*createFederationPolicyRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &createFederationPolicyRequestPb{} - pb.Policy = st.Policy - pb.RecipientName = st.RecipientName - - return pb, nil -} - -type createFederationPolicyRequestPb struct { - Policy FederationPolicy `json:"policy"` - RecipientName string `json:"-" url:"-"` -} - -func createFederationPolicyRequestFromPb(pb *createFederationPolicyRequestPb) (*CreateFederationPolicyRequest, error) { - if pb == nil { - return nil, nil - } - st := &CreateFederationPolicyRequest{} - st.Policy = pb.Policy - st.RecipientName = pb.RecipientName - - return st, nil -} - -func createProviderToPb(st *CreateProvider) (*createProviderPb, error) { - if st == nil { - return nil, nil - } - pb := &createProviderPb{} - pb.AuthenticationType = st.AuthenticationType - pb.Comment = st.Comment - pb.Name = st.Name - pb.RecipientProfileStr = st.RecipientProfileStr - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createProviderPb struct { - AuthenticationType AuthenticationType `json:"authentication_type"` - Comment string `json:"comment,omitempty"` - Name string `json:"name"` - RecipientProfileStr string `json:"recipient_profile_str,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createProviderFromPb(pb *createProviderPb) (*CreateProvider, error) { - if pb == nil { - return nil, nil - } - st := &CreateProvider{} - st.AuthenticationType = pb.AuthenticationType - st.Comment = pb.Comment - st.Name = pb.Name - st.RecipientProfileStr = pb.RecipientProfileStr - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createProviderPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createProviderPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createRecipientToPb(st *CreateRecipient) (*createRecipientPb, error) { - if st == nil { - return nil, nil - } - pb := &createRecipientPb{} - pb.AuthenticationType = st.AuthenticationType - pb.Comment = st.Comment - pb.DataRecipientGlobalMetastoreId = st.DataRecipientGlobalMetastoreId - pb.ExpirationTime = st.ExpirationTime - pb.IpAccessList = st.IpAccessList - pb.Name = st.Name - pb.Owner = st.Owner - pb.PropertiesKvpairs = st.PropertiesKvpairs - pb.SharingCode = st.SharingCode - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createRecipientPb struct { - AuthenticationType AuthenticationType `json:"authentication_type"` - Comment string `json:"comment,omitempty"` - DataRecipientGlobalMetastoreId string `json:"data_recipient_global_metastore_id,omitempty"` - ExpirationTime int64 `json:"expiration_time,omitempty"` - IpAccessList *IpAccessList `json:"ip_access_list,omitempty"` - Name string `json:"name"` - Owner string `json:"owner,omitempty"` - PropertiesKvpairs *SecurablePropertiesKvPairs `json:"properties_kvpairs,omitempty"` - SharingCode string `json:"sharing_code,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createRecipientFromPb(pb *createRecipientPb) (*CreateRecipient, error) { - if pb == nil { - return nil, nil - } - st := &CreateRecipient{} - st.AuthenticationType = pb.AuthenticationType - st.Comment = pb.Comment - st.DataRecipientGlobalMetastoreId = pb.DataRecipientGlobalMetastoreId - st.ExpirationTime = pb.ExpirationTime - st.IpAccessList = pb.IpAccessList - st.Name = pb.Name - st.Owner = pb.Owner - st.PropertiesKvpairs = pb.PropertiesKvpairs - st.SharingCode = pb.SharingCode - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createRecipientPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createRecipientPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createShareToPb(st *CreateShare) (*createSharePb, error) { - if st == nil { - return nil, nil - } - pb := &createSharePb{} - pb.Comment = st.Comment - pb.Name = st.Name - pb.StorageRoot = st.StorageRoot - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createSharePb struct { - Comment string `json:"comment,omitempty"` - Name string `json:"name"` - StorageRoot string `json:"storage_root,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createShareFromPb(pb *createSharePb) (*CreateShare, error) { - if pb == nil { - return nil, nil - } - st := &CreateShare{} - st.Comment = pb.Comment - st.Name = pb.Name - st.StorageRoot = pb.StorageRoot - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createSharePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createSharePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func deleteFederationPolicyRequestToPb(st *DeleteFederationPolicyRequest) (*deleteFederationPolicyRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteFederationPolicyRequestPb{} - pb.Name = st.Name - pb.RecipientName = st.RecipientName - - return pb, nil -} - -type deleteFederationPolicyRequestPb struct { - Name string `json:"-" url:"-"` - RecipientName string `json:"-" url:"-"` -} - -func deleteFederationPolicyRequestFromPb(pb *deleteFederationPolicyRequestPb) (*DeleteFederationPolicyRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteFederationPolicyRequest{} - st.Name = pb.Name - st.RecipientName = pb.RecipientName - - return st, nil -} - -func deleteProviderRequestToPb(st *DeleteProviderRequest) (*deleteProviderRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteProviderRequestPb{} - pb.Name = st.Name - - return pb, nil -} - -type deleteProviderRequestPb struct { - Name string `json:"-" url:"-"` -} - -func deleteProviderRequestFromPb(pb *deleteProviderRequestPb) (*DeleteProviderRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteProviderRequest{} - st.Name = pb.Name - - return st, nil -} - -func deleteRecipientRequestToPb(st *DeleteRecipientRequest) (*deleteRecipientRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteRecipientRequestPb{} - pb.Name = st.Name - - return pb, nil -} - -type deleteRecipientRequestPb struct { - Name string `json:"-" url:"-"` -} - -func deleteRecipientRequestFromPb(pb *deleteRecipientRequestPb) (*DeleteRecipientRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteRecipientRequest{} - st.Name = pb.Name - - return st, nil -} - -func deleteResponseToPb(st *DeleteResponse) (*deleteResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteResponsePb{} - - return pb, nil -} - -type deleteResponsePb struct { -} - -func deleteResponseFromPb(pb *deleteResponsePb) (*DeleteResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteResponse{} - - return st, nil -} - -func deleteShareRequestToPb(st *DeleteShareRequest) (*deleteShareRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteShareRequestPb{} - pb.Name = st.Name - - return pb, nil -} - -type deleteShareRequestPb struct { - Name string `json:"-" url:"-"` -} - -func deleteShareRequestFromPb(pb *deleteShareRequestPb) (*DeleteShareRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteShareRequest{} - st.Name = pb.Name - - return st, nil -} - -func deltaSharingDependencyToPb(st *DeltaSharingDependency) (*deltaSharingDependencyPb, error) { - if st == nil { - return nil, nil - } - pb := &deltaSharingDependencyPb{} - pb.Function = st.Function - pb.Table = st.Table - - return pb, nil -} - -type deltaSharingDependencyPb struct { - Function *DeltaSharingFunctionDependency `json:"function,omitempty"` - Table *DeltaSharingTableDependency `json:"table,omitempty"` -} - -func deltaSharingDependencyFromPb(pb *deltaSharingDependencyPb) (*DeltaSharingDependency, error) { - if pb == nil { - return nil, nil - } - st := &DeltaSharingDependency{} - st.Function = pb.Function - st.Table = pb.Table - - return st, nil -} - -func deltaSharingDependencyListToPb(st *DeltaSharingDependencyList) (*deltaSharingDependencyListPb, error) { - if st == nil { - return nil, nil - } - pb := &deltaSharingDependencyListPb{} - pb.Dependencies = st.Dependencies - - return pb, nil -} - -type deltaSharingDependencyListPb struct { - Dependencies []DeltaSharingDependency `json:"dependencies,omitempty"` -} - -func deltaSharingDependencyListFromPb(pb *deltaSharingDependencyListPb) (*DeltaSharingDependencyList, error) { - if pb == nil { - return nil, nil - } - st := &DeltaSharingDependencyList{} - st.Dependencies = pb.Dependencies - - return st, nil -} - -func deltaSharingFunctionToPb(st *DeltaSharingFunction) (*deltaSharingFunctionPb, error) { - if st == nil { - return nil, nil - } - pb := &deltaSharingFunctionPb{} - pb.Aliases = st.Aliases - pb.Comment = st.Comment - pb.DataType = st.DataType - pb.DependencyList = st.DependencyList - pb.FullDataType = st.FullDataType - pb.Id = st.Id - pb.InputParams = st.InputParams - pb.Name = st.Name - pb.Properties = st.Properties - pb.RoutineDefinition = st.RoutineDefinition - pb.Schema = st.Schema - pb.SecurableKind = st.SecurableKind - pb.Share = st.Share - pb.ShareId = st.ShareId - pb.StorageLocation = st.StorageLocation - pb.Tags = st.Tags - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type deltaSharingFunctionPb struct { - Aliases []RegisteredModelAlias `json:"aliases,omitempty"` - Comment string `json:"comment,omitempty"` - DataType ColumnTypeName `json:"data_type,omitempty"` - DependencyList *DeltaSharingDependencyList `json:"dependency_list,omitempty"` - FullDataType string `json:"full_data_type,omitempty"` - Id string `json:"id,omitempty"` - InputParams *FunctionParameterInfos `json:"input_params,omitempty"` - Name string `json:"name,omitempty"` - Properties string `json:"properties,omitempty"` - RoutineDefinition string `json:"routine_definition,omitempty"` - Schema string `json:"schema,omitempty"` - SecurableKind SharedSecurableKind `json:"securable_kind,omitempty"` - Share string `json:"share,omitempty"` - ShareId string `json:"share_id,omitempty"` - StorageLocation string `json:"storage_location,omitempty"` - Tags []catalog.TagKeyValue `json:"tags,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func deltaSharingFunctionFromPb(pb *deltaSharingFunctionPb) (*DeltaSharingFunction, error) { - if pb == nil { - return nil, nil - } - st := &DeltaSharingFunction{} - st.Aliases = pb.Aliases - st.Comment = pb.Comment - st.DataType = pb.DataType - st.DependencyList = pb.DependencyList - st.FullDataType = pb.FullDataType - st.Id = pb.Id - st.InputParams = pb.InputParams - st.Name = pb.Name - st.Properties = pb.Properties - st.RoutineDefinition = pb.RoutineDefinition - st.Schema = pb.Schema - st.SecurableKind = pb.SecurableKind - st.Share = pb.Share - st.ShareId = pb.ShareId - st.StorageLocation = pb.StorageLocation - st.Tags = pb.Tags - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *deltaSharingFunctionPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st deltaSharingFunctionPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func deltaSharingFunctionDependencyToPb(st *DeltaSharingFunctionDependency) (*deltaSharingFunctionDependencyPb, error) { - if st == nil { - return nil, nil - } - pb := &deltaSharingFunctionDependencyPb{} - pb.FunctionName = st.FunctionName - pb.SchemaName = st.SchemaName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type deltaSharingFunctionDependencyPb struct { - FunctionName string `json:"function_name,omitempty"` - SchemaName string `json:"schema_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func deltaSharingFunctionDependencyFromPb(pb *deltaSharingFunctionDependencyPb) (*DeltaSharingFunctionDependency, error) { - if pb == nil { - return nil, nil - } - st := &DeltaSharingFunctionDependency{} - st.FunctionName = pb.FunctionName - st.SchemaName = pb.SchemaName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *deltaSharingFunctionDependencyPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st deltaSharingFunctionDependencyPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func deltaSharingTableDependencyToPb(st *DeltaSharingTableDependency) (*deltaSharingTableDependencyPb, error) { - if st == nil { - return nil, nil - } - pb := &deltaSharingTableDependencyPb{} - pb.SchemaName = st.SchemaName - pb.TableName = st.TableName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type deltaSharingTableDependencyPb struct { - SchemaName string `json:"schema_name,omitempty"` - TableName string `json:"table_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func deltaSharingTableDependencyFromPb(pb *deltaSharingTableDependencyPb) (*DeltaSharingTableDependency, error) { - if pb == nil { - return nil, nil - } - st := &DeltaSharingTableDependency{} - st.SchemaName = pb.SchemaName - st.TableName = pb.TableName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *deltaSharingTableDependencyPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st deltaSharingTableDependencyPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func federationPolicyToPb(st *FederationPolicy) (*federationPolicyPb, error) { - if st == nil { - return nil, nil - } - pb := &federationPolicyPb{} - pb.Comment = st.Comment - pb.CreateTime = st.CreateTime - pb.Id = st.Id - pb.Name = st.Name - pb.OidcPolicy = st.OidcPolicy - pb.UpdateTime = st.UpdateTime - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type federationPolicyPb struct { - Comment string `json:"comment,omitempty"` - CreateTime string `json:"create_time,omitempty"` - Id string `json:"id,omitempty"` - Name string `json:"name,omitempty"` - OidcPolicy *OidcFederationPolicy `json:"oidc_policy,omitempty"` - UpdateTime string `json:"update_time,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func federationPolicyFromPb(pb *federationPolicyPb) (*FederationPolicy, error) { - if pb == nil { - return nil, nil - } - st := &FederationPolicy{} - st.Comment = pb.Comment - st.CreateTime = pb.CreateTime - st.Id = pb.Id - st.Name = pb.Name - st.OidcPolicy = pb.OidcPolicy - st.UpdateTime = pb.UpdateTime - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *federationPolicyPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st federationPolicyPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func functionParameterInfoToPb(st *FunctionParameterInfo) (*functionParameterInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &functionParameterInfoPb{} - pb.Comment = st.Comment - pb.Name = st.Name - pb.ParameterDefault = st.ParameterDefault - pb.ParameterMode = st.ParameterMode - pb.ParameterType = st.ParameterType - pb.Position = st.Position - pb.TypeIntervalType = st.TypeIntervalType - pb.TypeJson = st.TypeJson - pb.TypeName = st.TypeName - pb.TypePrecision = st.TypePrecision - pb.TypeScale = st.TypeScale - pb.TypeText = st.TypeText - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type functionParameterInfoPb struct { - Comment string `json:"comment,omitempty"` - Name string `json:"name,omitempty"` - ParameterDefault string `json:"parameter_default,omitempty"` - ParameterMode FunctionParameterMode `json:"parameter_mode,omitempty"` - ParameterType FunctionParameterType `json:"parameter_type,omitempty"` - Position int `json:"position,omitempty"` - TypeIntervalType string `json:"type_interval_type,omitempty"` - TypeJson string `json:"type_json,omitempty"` - TypeName ColumnTypeName `json:"type_name,omitempty"` - TypePrecision int `json:"type_precision,omitempty"` - TypeScale int `json:"type_scale,omitempty"` - TypeText string `json:"type_text,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func functionParameterInfoFromPb(pb *functionParameterInfoPb) (*FunctionParameterInfo, error) { - if pb == nil { - return nil, nil - } - st := &FunctionParameterInfo{} - st.Comment = pb.Comment - st.Name = pb.Name - st.ParameterDefault = pb.ParameterDefault - st.ParameterMode = pb.ParameterMode - st.ParameterType = pb.ParameterType - st.Position = pb.Position - st.TypeIntervalType = pb.TypeIntervalType - st.TypeJson = pb.TypeJson - st.TypeName = pb.TypeName - st.TypePrecision = pb.TypePrecision - st.TypeScale = pb.TypeScale - st.TypeText = pb.TypeText - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *functionParameterInfoPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st functionParameterInfoPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func functionParameterInfosToPb(st *FunctionParameterInfos) (*functionParameterInfosPb, error) { - if st == nil { - return nil, nil - } - pb := &functionParameterInfosPb{} - pb.Parameters = st.Parameters - - return pb, nil -} - -type functionParameterInfosPb struct { - Parameters []FunctionParameterInfo `json:"parameters,omitempty"` -} - -func functionParameterInfosFromPb(pb *functionParameterInfosPb) (*FunctionParameterInfos, error) { - if pb == nil { - return nil, nil - } - st := &FunctionParameterInfos{} - st.Parameters = pb.Parameters - - return st, nil -} - -func getActivationUrlInfoRequestToPb(st *GetActivationUrlInfoRequest) (*getActivationUrlInfoRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getActivationUrlInfoRequestPb{} - pb.ActivationUrl = st.ActivationUrl - - return pb, nil -} - -type getActivationUrlInfoRequestPb struct { - ActivationUrl string `json:"-" url:"-"` -} - -func getActivationUrlInfoRequestFromPb(pb *getActivationUrlInfoRequestPb) (*GetActivationUrlInfoRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetActivationUrlInfoRequest{} - st.ActivationUrl = pb.ActivationUrl - - return st, nil -} - -func getActivationUrlInfoResponseToPb(st *GetActivationUrlInfoResponse) (*getActivationUrlInfoResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &getActivationUrlInfoResponsePb{} - - return pb, nil -} - -type getActivationUrlInfoResponsePb struct { -} - -func getActivationUrlInfoResponseFromPb(pb *getActivationUrlInfoResponsePb) (*GetActivationUrlInfoResponse, error) { - if pb == nil { - return nil, nil - } - st := &GetActivationUrlInfoResponse{} - - return st, nil -} - -func getFederationPolicyRequestToPb(st *GetFederationPolicyRequest) (*getFederationPolicyRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getFederationPolicyRequestPb{} - pb.Name = st.Name - pb.RecipientName = st.RecipientName - - return pb, nil -} - -type getFederationPolicyRequestPb struct { - Name string `json:"-" url:"-"` - RecipientName string `json:"-" url:"-"` -} - -func getFederationPolicyRequestFromPb(pb *getFederationPolicyRequestPb) (*GetFederationPolicyRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetFederationPolicyRequest{} - st.Name = pb.Name - st.RecipientName = pb.RecipientName - - return st, nil -} - -func getProviderRequestToPb(st *GetProviderRequest) (*getProviderRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getProviderRequestPb{} - pb.Name = st.Name - - return pb, nil -} - -type getProviderRequestPb struct { - Name string `json:"-" url:"-"` -} - -func getProviderRequestFromPb(pb *getProviderRequestPb) (*GetProviderRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetProviderRequest{} - st.Name = pb.Name - - return st, nil -} - -func getRecipientRequestToPb(st *GetRecipientRequest) (*getRecipientRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getRecipientRequestPb{} - pb.Name = st.Name - - return pb, nil -} - -type getRecipientRequestPb struct { - Name string `json:"-" url:"-"` -} - -func getRecipientRequestFromPb(pb *getRecipientRequestPb) (*GetRecipientRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetRecipientRequest{} - st.Name = pb.Name - - return st, nil -} - -func getRecipientSharePermissionsResponseToPb(st *GetRecipientSharePermissionsResponse) (*getRecipientSharePermissionsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &getRecipientSharePermissionsResponsePb{} - pb.NextPageToken = st.NextPageToken - pb.PermissionsOut = st.PermissionsOut - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getRecipientSharePermissionsResponsePb struct { - NextPageToken string `json:"next_page_token,omitempty"` - PermissionsOut []ShareToPrivilegeAssignment `json:"permissions_out,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getRecipientSharePermissionsResponseFromPb(pb *getRecipientSharePermissionsResponsePb) (*GetRecipientSharePermissionsResponse, error) { - if pb == nil { - return nil, nil - } - st := &GetRecipientSharePermissionsResponse{} - st.NextPageToken = pb.NextPageToken - st.PermissionsOut = pb.PermissionsOut - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getRecipientSharePermissionsResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getRecipientSharePermissionsResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getSharePermissionsResponseToPb(st *GetSharePermissionsResponse) (*getSharePermissionsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &getSharePermissionsResponsePb{} - pb.NextPageToken = st.NextPageToken - pb.PrivilegeAssignments = st.PrivilegeAssignments - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getSharePermissionsResponsePb struct { - NextPageToken string `json:"next_page_token,omitempty"` - PrivilegeAssignments []PrivilegeAssignment `json:"privilege_assignments,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getSharePermissionsResponseFromPb(pb *getSharePermissionsResponsePb) (*GetSharePermissionsResponse, error) { - if pb == nil { - return nil, nil - } - st := &GetSharePermissionsResponse{} - st.NextPageToken = pb.NextPageToken - st.PrivilegeAssignments = pb.PrivilegeAssignments - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getSharePermissionsResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getSharePermissionsResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getShareRequestToPb(st *GetShareRequest) (*getShareRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getShareRequestPb{} - pb.IncludeSharedData = st.IncludeSharedData - pb.Name = st.Name - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getShareRequestPb struct { - IncludeSharedData bool `json:"-" url:"include_shared_data,omitempty"` - Name string `json:"-" url:"-"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getShareRequestFromPb(pb *getShareRequestPb) (*GetShareRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetShareRequest{} - st.IncludeSharedData = pb.IncludeSharedData - st.Name = pb.Name - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getShareRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getShareRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func ipAccessListToPb(st *IpAccessList) (*ipAccessListPb, error) { - if st == nil { - return nil, nil - } - pb := &ipAccessListPb{} - pb.AllowedIpAddresses = st.AllowedIpAddresses - - return pb, nil -} - -type ipAccessListPb struct { - AllowedIpAddresses []string `json:"allowed_ip_addresses,omitempty"` -} - -func ipAccessListFromPb(pb *ipAccessListPb) (*IpAccessList, error) { - if pb == nil { - return nil, nil - } - st := &IpAccessList{} - st.AllowedIpAddresses = pb.AllowedIpAddresses - - return st, nil -} - -func listFederationPoliciesRequestToPb(st *ListFederationPoliciesRequest) (*listFederationPoliciesRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listFederationPoliciesRequestPb{} - pb.MaxResults = st.MaxResults - pb.PageToken = st.PageToken - pb.RecipientName = st.RecipientName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listFederationPoliciesRequestPb struct { - MaxResults int `json:"-" url:"max_results,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - RecipientName string `json:"-" url:"-"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listFederationPoliciesRequestFromPb(pb *listFederationPoliciesRequestPb) (*ListFederationPoliciesRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListFederationPoliciesRequest{} - st.MaxResults = pb.MaxResults - st.PageToken = pb.PageToken - st.RecipientName = pb.RecipientName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listFederationPoliciesRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listFederationPoliciesRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listFederationPoliciesResponseToPb(st *ListFederationPoliciesResponse) (*listFederationPoliciesResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listFederationPoliciesResponsePb{} - pb.NextPageToken = st.NextPageToken - pb.Policies = st.Policies - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listFederationPoliciesResponsePb struct { - NextPageToken string `json:"next_page_token,omitempty"` - Policies []FederationPolicy `json:"policies,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listFederationPoliciesResponseFromPb(pb *listFederationPoliciesResponsePb) (*ListFederationPoliciesResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListFederationPoliciesResponse{} - st.NextPageToken = pb.NextPageToken - st.Policies = pb.Policies - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listFederationPoliciesResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listFederationPoliciesResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listProviderShareAssetsRequestToPb(st *ListProviderShareAssetsRequest) (*listProviderShareAssetsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listProviderShareAssetsRequestPb{} - pb.FunctionMaxResults = st.FunctionMaxResults - pb.NotebookMaxResults = st.NotebookMaxResults - pb.ProviderName = st.ProviderName - pb.ShareName = st.ShareName - pb.TableMaxResults = st.TableMaxResults - pb.VolumeMaxResults = st.VolumeMaxResults - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listProviderShareAssetsRequestPb struct { - FunctionMaxResults int `json:"-" url:"function_max_results,omitempty"` - NotebookMaxResults int `json:"-" url:"notebook_max_results,omitempty"` - ProviderName string `json:"-" url:"-"` - ShareName string `json:"-" url:"-"` - TableMaxResults int `json:"-" url:"table_max_results,omitempty"` - VolumeMaxResults int `json:"-" url:"volume_max_results,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listProviderShareAssetsRequestFromPb(pb *listProviderShareAssetsRequestPb) (*ListProviderShareAssetsRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListProviderShareAssetsRequest{} - st.FunctionMaxResults = pb.FunctionMaxResults - st.NotebookMaxResults = pb.NotebookMaxResults - st.ProviderName = pb.ProviderName - st.ShareName = pb.ShareName - st.TableMaxResults = pb.TableMaxResults - st.VolumeMaxResults = pb.VolumeMaxResults - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listProviderShareAssetsRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listProviderShareAssetsRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listProviderShareAssetsResponseToPb(st *ListProviderShareAssetsResponse) (*listProviderShareAssetsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listProviderShareAssetsResponsePb{} - pb.Functions = st.Functions - pb.Notebooks = st.Notebooks - pb.Tables = st.Tables - pb.Volumes = st.Volumes - - return pb, nil -} - -type listProviderShareAssetsResponsePb struct { - Functions []DeltaSharingFunction `json:"functions,omitempty"` - Notebooks []NotebookFile `json:"notebooks,omitempty"` - Tables []Table `json:"tables,omitempty"` - Volumes []Volume `json:"volumes,omitempty"` -} - -func listProviderShareAssetsResponseFromPb(pb *listProviderShareAssetsResponsePb) (*ListProviderShareAssetsResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListProviderShareAssetsResponse{} - st.Functions = pb.Functions - st.Notebooks = pb.Notebooks - st.Tables = pb.Tables - st.Volumes = pb.Volumes - - return st, nil -} - -func listProviderSharesResponseToPb(st *ListProviderSharesResponse) (*listProviderSharesResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listProviderSharesResponsePb{} - pb.NextPageToken = st.NextPageToken - pb.Shares = st.Shares - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listProviderSharesResponsePb struct { - NextPageToken string `json:"next_page_token,omitempty"` - Shares []ProviderShare `json:"shares,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listProviderSharesResponseFromPb(pb *listProviderSharesResponsePb) (*ListProviderSharesResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListProviderSharesResponse{} - st.NextPageToken = pb.NextPageToken - st.Shares = pb.Shares - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listProviderSharesResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listProviderSharesResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listProvidersRequestToPb(st *ListProvidersRequest) (*listProvidersRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listProvidersRequestPb{} - pb.DataProviderGlobalMetastoreId = st.DataProviderGlobalMetastoreId - pb.MaxResults = st.MaxResults - pb.PageToken = st.PageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listProvidersRequestPb struct { - DataProviderGlobalMetastoreId string `json:"-" url:"data_provider_global_metastore_id,omitempty"` - MaxResults int `json:"-" url:"max_results,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listProvidersRequestFromPb(pb *listProvidersRequestPb) (*ListProvidersRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListProvidersRequest{} - st.DataProviderGlobalMetastoreId = pb.DataProviderGlobalMetastoreId - st.MaxResults = pb.MaxResults - st.PageToken = pb.PageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listProvidersRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listProvidersRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listProvidersResponseToPb(st *ListProvidersResponse) (*listProvidersResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listProvidersResponsePb{} - pb.NextPageToken = st.NextPageToken - pb.Providers = st.Providers - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listProvidersResponsePb struct { - NextPageToken string `json:"next_page_token,omitempty"` - Providers []ProviderInfo `json:"providers,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listProvidersResponseFromPb(pb *listProvidersResponsePb) (*ListProvidersResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListProvidersResponse{} - st.NextPageToken = pb.NextPageToken - st.Providers = pb.Providers - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listProvidersResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listProvidersResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listRecipientsRequestToPb(st *ListRecipientsRequest) (*listRecipientsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listRecipientsRequestPb{} - pb.DataRecipientGlobalMetastoreId = st.DataRecipientGlobalMetastoreId - pb.MaxResults = st.MaxResults - pb.PageToken = st.PageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listRecipientsRequestPb struct { - DataRecipientGlobalMetastoreId string `json:"-" url:"data_recipient_global_metastore_id,omitempty"` - MaxResults int `json:"-" url:"max_results,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listRecipientsRequestFromPb(pb *listRecipientsRequestPb) (*ListRecipientsRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListRecipientsRequest{} - st.DataRecipientGlobalMetastoreId = pb.DataRecipientGlobalMetastoreId - st.MaxResults = pb.MaxResults - st.PageToken = pb.PageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listRecipientsRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listRecipientsRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listRecipientsResponseToPb(st *ListRecipientsResponse) (*listRecipientsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listRecipientsResponsePb{} - pb.NextPageToken = st.NextPageToken - pb.Recipients = st.Recipients - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listRecipientsResponsePb struct { - NextPageToken string `json:"next_page_token,omitempty"` - Recipients []RecipientInfo `json:"recipients,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listRecipientsResponseFromPb(pb *listRecipientsResponsePb) (*ListRecipientsResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListRecipientsResponse{} - st.NextPageToken = pb.NextPageToken - st.Recipients = pb.Recipients - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listRecipientsResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listRecipientsResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listSharesRequestToPb(st *ListSharesRequest) (*listSharesRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listSharesRequestPb{} - pb.MaxResults = st.MaxResults - pb.Name = st.Name - pb.PageToken = st.PageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listSharesRequestPb struct { - MaxResults int `json:"-" url:"max_results,omitempty"` - Name string `json:"-" url:"-"` - PageToken string `json:"-" url:"page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listSharesRequestFromPb(pb *listSharesRequestPb) (*ListSharesRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListSharesRequest{} - st.MaxResults = pb.MaxResults - st.Name = pb.Name - st.PageToken = pb.PageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listSharesRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listSharesRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listSharesResponseToPb(st *ListSharesResponse) (*listSharesResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listSharesResponsePb{} - pb.NextPageToken = st.NextPageToken - pb.Shares = st.Shares - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listSharesResponsePb struct { - NextPageToken string `json:"next_page_token,omitempty"` - Shares []ShareInfo `json:"shares,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listSharesResponseFromPb(pb *listSharesResponsePb) (*ListSharesResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListSharesResponse{} - st.NextPageToken = pb.NextPageToken - st.Shares = pb.Shares - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listSharesResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listSharesResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func notebookFileToPb(st *NotebookFile) (*notebookFilePb, error) { - if st == nil { - return nil, nil - } - pb := ¬ebookFilePb{} - pb.Comment = st.Comment - pb.Id = st.Id - pb.Name = st.Name - pb.Share = st.Share - pb.ShareId = st.ShareId - pb.Tags = st.Tags - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type notebookFilePb struct { - Comment string `json:"comment,omitempty"` - Id string `json:"id,omitempty"` - Name string `json:"name,omitempty"` - Share string `json:"share,omitempty"` - ShareId string `json:"share_id,omitempty"` - Tags []catalog.TagKeyValue `json:"tags,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func notebookFileFromPb(pb *notebookFilePb) (*NotebookFile, error) { - if pb == nil { - return nil, nil - } - st := &NotebookFile{} - st.Comment = pb.Comment - st.Id = pb.Id - st.Name = pb.Name - st.Share = pb.Share - st.ShareId = pb.ShareId - st.Tags = pb.Tags - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *notebookFilePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st notebookFilePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func oidcFederationPolicyToPb(st *OidcFederationPolicy) (*oidcFederationPolicyPb, error) { - if st == nil { - return nil, nil - } - pb := &oidcFederationPolicyPb{} - pb.Audiences = st.Audiences - pb.Issuer = st.Issuer - pb.Subject = st.Subject - pb.SubjectClaim = st.SubjectClaim - - return pb, nil -} - -type oidcFederationPolicyPb struct { - Audiences []string `json:"audiences,omitempty"` - Issuer string `json:"issuer"` - Subject string `json:"subject"` - SubjectClaim string `json:"subject_claim"` -} - -func oidcFederationPolicyFromPb(pb *oidcFederationPolicyPb) (*OidcFederationPolicy, error) { - if pb == nil { - return nil, nil - } - st := &OidcFederationPolicy{} - st.Audiences = pb.Audiences - st.Issuer = pb.Issuer - st.Subject = pb.Subject - st.SubjectClaim = pb.SubjectClaim - - return st, nil -} - -func partitionToPb(st *Partition) (*partitionPb, error) { - if st == nil { - return nil, nil - } - pb := &partitionPb{} - pb.Values = st.Values - - return pb, nil -} - -type partitionPb struct { - Values []PartitionValue `json:"values,omitempty"` -} - -func partitionFromPb(pb *partitionPb) (*Partition, error) { - if pb == nil { - return nil, nil - } - st := &Partition{} - st.Values = pb.Values - - return st, nil -} - -func partitionValueToPb(st *PartitionValue) (*partitionValuePb, error) { - if st == nil { - return nil, nil - } - pb := &partitionValuePb{} - pb.Name = st.Name - pb.Op = st.Op - pb.RecipientPropertyKey = st.RecipientPropertyKey - pb.Value = st.Value - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type partitionValuePb struct { - Name string `json:"name,omitempty"` - Op PartitionValueOp `json:"op,omitempty"` - RecipientPropertyKey string `json:"recipient_property_key,omitempty"` - Value string `json:"value,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func partitionValueFromPb(pb *partitionValuePb) (*PartitionValue, error) { - if pb == nil { - return nil, nil - } - st := &PartitionValue{} - st.Name = pb.Name - st.Op = pb.Op - st.RecipientPropertyKey = pb.RecipientPropertyKey - st.Value = pb.Value - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *partitionValuePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st partitionValuePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func permissionsChangeToPb(st *PermissionsChange) (*permissionsChangePb, error) { - if st == nil { - return nil, nil - } - pb := &permissionsChangePb{} - pb.Add = st.Add - pb.Principal = st.Principal - pb.Remove = st.Remove - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type permissionsChangePb struct { - Add []string `json:"add,omitempty"` - Principal string `json:"principal,omitempty"` - Remove []string `json:"remove,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func permissionsChangeFromPb(pb *permissionsChangePb) (*PermissionsChange, error) { - if pb == nil { - return nil, nil - } - st := &PermissionsChange{} - st.Add = pb.Add - st.Principal = pb.Principal - st.Remove = pb.Remove - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *permissionsChangePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st permissionsChangePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func privilegeAssignmentToPb(st *PrivilegeAssignment) (*privilegeAssignmentPb, error) { - if st == nil { - return nil, nil - } - pb := &privilegeAssignmentPb{} - pb.Principal = st.Principal - pb.Privileges = st.Privileges - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type privilegeAssignmentPb struct { - Principal string `json:"principal,omitempty"` - Privileges []Privilege `json:"privileges,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func privilegeAssignmentFromPb(pb *privilegeAssignmentPb) (*PrivilegeAssignment, error) { - if pb == nil { - return nil, nil - } - st := &PrivilegeAssignment{} - st.Principal = pb.Principal - st.Privileges = pb.Privileges - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *privilegeAssignmentPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st privilegeAssignmentPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func providerInfoToPb(st *ProviderInfo) (*providerInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &providerInfoPb{} - pb.AuthenticationType = st.AuthenticationType - pb.Cloud = st.Cloud - pb.Comment = st.Comment - pb.CreatedAt = st.CreatedAt - pb.CreatedBy = st.CreatedBy - pb.DataProviderGlobalMetastoreId = st.DataProviderGlobalMetastoreId - pb.MetastoreId = st.MetastoreId - pb.Name = st.Name - pb.Owner = st.Owner - pb.RecipientProfile = st.RecipientProfile - pb.RecipientProfileStr = st.RecipientProfileStr - pb.Region = st.Region - pb.UpdatedAt = st.UpdatedAt - pb.UpdatedBy = st.UpdatedBy - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type providerInfoPb struct { - AuthenticationType AuthenticationType `json:"authentication_type,omitempty"` - Cloud string `json:"cloud,omitempty"` - Comment string `json:"comment,omitempty"` - CreatedAt int64 `json:"created_at,omitempty"` - CreatedBy string `json:"created_by,omitempty"` - DataProviderGlobalMetastoreId string `json:"data_provider_global_metastore_id,omitempty"` - MetastoreId string `json:"metastore_id,omitempty"` - Name string `json:"name,omitempty"` - Owner string `json:"owner,omitempty"` - RecipientProfile *RecipientProfile `json:"recipient_profile,omitempty"` - RecipientProfileStr string `json:"recipient_profile_str,omitempty"` - Region string `json:"region,omitempty"` - UpdatedAt int64 `json:"updated_at,omitempty"` - UpdatedBy string `json:"updated_by,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func providerInfoFromPb(pb *providerInfoPb) (*ProviderInfo, error) { - if pb == nil { - return nil, nil - } - st := &ProviderInfo{} - st.AuthenticationType = pb.AuthenticationType - st.Cloud = pb.Cloud - st.Comment = pb.Comment - st.CreatedAt = pb.CreatedAt - st.CreatedBy = pb.CreatedBy - st.DataProviderGlobalMetastoreId = pb.DataProviderGlobalMetastoreId - st.MetastoreId = pb.MetastoreId - st.Name = pb.Name - st.Owner = pb.Owner - st.RecipientProfile = pb.RecipientProfile - st.RecipientProfileStr = pb.RecipientProfileStr - st.Region = pb.Region - st.UpdatedAt = pb.UpdatedAt - st.UpdatedBy = pb.UpdatedBy - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *providerInfoPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st providerInfoPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func providerShareToPb(st *ProviderShare) (*providerSharePb, error) { - if st == nil { - return nil, nil - } - pb := &providerSharePb{} - pb.Name = st.Name - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type providerSharePb struct { - Name string `json:"name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func providerShareFromPb(pb *providerSharePb) (*ProviderShare, error) { - if pb == nil { - return nil, nil - } - st := &ProviderShare{} - st.Name = pb.Name - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *providerSharePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st providerSharePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func recipientInfoToPb(st *RecipientInfo) (*recipientInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &recipientInfoPb{} - pb.Activated = st.Activated - pb.ActivationUrl = st.ActivationUrl - pb.AuthenticationType = st.AuthenticationType - pb.Cloud = st.Cloud - pb.Comment = st.Comment - pb.CreatedAt = st.CreatedAt - pb.CreatedBy = st.CreatedBy - pb.DataRecipientGlobalMetastoreId = st.DataRecipientGlobalMetastoreId - pb.ExpirationTime = st.ExpirationTime - pb.IpAccessList = st.IpAccessList - pb.MetastoreId = st.MetastoreId - pb.Name = st.Name - pb.Owner = st.Owner - pb.PropertiesKvpairs = st.PropertiesKvpairs - pb.Region = st.Region - pb.SharingCode = st.SharingCode - pb.Tokens = st.Tokens - pb.UpdatedAt = st.UpdatedAt - pb.UpdatedBy = st.UpdatedBy - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type recipientInfoPb struct { - Activated bool `json:"activated,omitempty"` - ActivationUrl string `json:"activation_url,omitempty"` - AuthenticationType AuthenticationType `json:"authentication_type,omitempty"` - Cloud string `json:"cloud,omitempty"` - Comment string `json:"comment,omitempty"` - CreatedAt int64 `json:"created_at,omitempty"` - CreatedBy string `json:"created_by,omitempty"` - DataRecipientGlobalMetastoreId string `json:"data_recipient_global_metastore_id,omitempty"` - ExpirationTime int64 `json:"expiration_time,omitempty"` - IpAccessList *IpAccessList `json:"ip_access_list,omitempty"` - MetastoreId string `json:"metastore_id,omitempty"` - Name string `json:"name,omitempty"` - Owner string `json:"owner,omitempty"` - PropertiesKvpairs *SecurablePropertiesKvPairs `json:"properties_kvpairs,omitempty"` - Region string `json:"region,omitempty"` - SharingCode string `json:"sharing_code,omitempty"` - Tokens []RecipientTokenInfo `json:"tokens,omitempty"` - UpdatedAt int64 `json:"updated_at,omitempty"` - UpdatedBy string `json:"updated_by,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func recipientInfoFromPb(pb *recipientInfoPb) (*RecipientInfo, error) { - if pb == nil { - return nil, nil - } - st := &RecipientInfo{} - st.Activated = pb.Activated - st.ActivationUrl = pb.ActivationUrl - st.AuthenticationType = pb.AuthenticationType - st.Cloud = pb.Cloud - st.Comment = pb.Comment - st.CreatedAt = pb.CreatedAt - st.CreatedBy = pb.CreatedBy - st.DataRecipientGlobalMetastoreId = pb.DataRecipientGlobalMetastoreId - st.ExpirationTime = pb.ExpirationTime - st.IpAccessList = pb.IpAccessList - st.MetastoreId = pb.MetastoreId - st.Name = pb.Name - st.Owner = pb.Owner - st.PropertiesKvpairs = pb.PropertiesKvpairs - st.Region = pb.Region - st.SharingCode = pb.SharingCode - st.Tokens = pb.Tokens - st.UpdatedAt = pb.UpdatedAt - st.UpdatedBy = pb.UpdatedBy - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *recipientInfoPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st recipientInfoPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func recipientProfileToPb(st *RecipientProfile) (*recipientProfilePb, error) { - if st == nil { - return nil, nil - } - pb := &recipientProfilePb{} - pb.BearerToken = st.BearerToken - pb.Endpoint = st.Endpoint - pb.ShareCredentialsVersion = st.ShareCredentialsVersion - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type recipientProfilePb struct { - BearerToken string `json:"bearer_token,omitempty"` - Endpoint string `json:"endpoint,omitempty"` - ShareCredentialsVersion int `json:"share_credentials_version,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func recipientProfileFromPb(pb *recipientProfilePb) (*RecipientProfile, error) { - if pb == nil { - return nil, nil - } - st := &RecipientProfile{} - st.BearerToken = pb.BearerToken - st.Endpoint = pb.Endpoint - st.ShareCredentialsVersion = pb.ShareCredentialsVersion - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *recipientProfilePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st recipientProfilePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func recipientTokenInfoToPb(st *RecipientTokenInfo) (*recipientTokenInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &recipientTokenInfoPb{} - pb.ActivationUrl = st.ActivationUrl - pb.CreatedAt = st.CreatedAt - pb.CreatedBy = st.CreatedBy - pb.ExpirationTime = st.ExpirationTime - pb.Id = st.Id - pb.UpdatedAt = st.UpdatedAt - pb.UpdatedBy = st.UpdatedBy - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type recipientTokenInfoPb struct { - ActivationUrl string `json:"activation_url,omitempty"` - CreatedAt int64 `json:"created_at,omitempty"` - CreatedBy string `json:"created_by,omitempty"` - ExpirationTime int64 `json:"expiration_time,omitempty"` - Id string `json:"id,omitempty"` - UpdatedAt int64 `json:"updated_at,omitempty"` - UpdatedBy string `json:"updated_by,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func recipientTokenInfoFromPb(pb *recipientTokenInfoPb) (*RecipientTokenInfo, error) { - if pb == nil { - return nil, nil - } - st := &RecipientTokenInfo{} - st.ActivationUrl = pb.ActivationUrl - st.CreatedAt = pb.CreatedAt - st.CreatedBy = pb.CreatedBy - st.ExpirationTime = pb.ExpirationTime - st.Id = pb.Id - st.UpdatedAt = pb.UpdatedAt - st.UpdatedBy = pb.UpdatedBy - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *recipientTokenInfoPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st recipientTokenInfoPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func registeredModelAliasToPb(st *RegisteredModelAlias) (*registeredModelAliasPb, error) { - if st == nil { - return nil, nil - } - pb := ®isteredModelAliasPb{} - pb.AliasName = st.AliasName - pb.VersionNum = st.VersionNum - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type registeredModelAliasPb struct { - AliasName string `json:"alias_name,omitempty"` - VersionNum int64 `json:"version_num,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func registeredModelAliasFromPb(pb *registeredModelAliasPb) (*RegisteredModelAlias, error) { - if pb == nil { - return nil, nil - } - st := &RegisteredModelAlias{} - st.AliasName = pb.AliasName - st.VersionNum = pb.VersionNum - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *registeredModelAliasPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st registeredModelAliasPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func retrieveTokenRequestToPb(st *RetrieveTokenRequest) (*retrieveTokenRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &retrieveTokenRequestPb{} - pb.ActivationUrl = st.ActivationUrl - - return pb, nil -} - -type retrieveTokenRequestPb struct { - ActivationUrl string `json:"-" url:"-"` -} - -func retrieveTokenRequestFromPb(pb *retrieveTokenRequestPb) (*RetrieveTokenRequest, error) { - if pb == nil { - return nil, nil - } - st := &RetrieveTokenRequest{} - st.ActivationUrl = pb.ActivationUrl - - return st, nil -} - -func retrieveTokenResponseToPb(st *RetrieveTokenResponse) (*retrieveTokenResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &retrieveTokenResponsePb{} - pb.BearerToken = st.BearerToken - pb.Endpoint = st.Endpoint - pb.ExpirationTime = st.ExpirationTime - pb.ShareCredentialsVersion = st.ShareCredentialsVersion - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type retrieveTokenResponsePb struct { - BearerToken string `json:"bearerToken,omitempty"` - Endpoint string `json:"endpoint,omitempty"` - ExpirationTime string `json:"expirationTime,omitempty"` - ShareCredentialsVersion int `json:"shareCredentialsVersion,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func retrieveTokenResponseFromPb(pb *retrieveTokenResponsePb) (*RetrieveTokenResponse, error) { - if pb == nil { - return nil, nil - } - st := &RetrieveTokenResponse{} - st.BearerToken = pb.BearerToken - st.Endpoint = pb.Endpoint - st.ExpirationTime = pb.ExpirationTime - st.ShareCredentialsVersion = pb.ShareCredentialsVersion - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *retrieveTokenResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st retrieveTokenResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func rotateRecipientTokenToPb(st *RotateRecipientToken) (*rotateRecipientTokenPb, error) { - if st == nil { - return nil, nil - } - pb := &rotateRecipientTokenPb{} - pb.ExistingTokenExpireInSeconds = st.ExistingTokenExpireInSeconds - pb.Name = st.Name - - return pb, nil -} - -type rotateRecipientTokenPb struct { - ExistingTokenExpireInSeconds int64 `json:"existing_token_expire_in_seconds"` - Name string `json:"-" url:"-"` -} - -func rotateRecipientTokenFromPb(pb *rotateRecipientTokenPb) (*RotateRecipientToken, error) { - if pb == nil { - return nil, nil - } - st := &RotateRecipientToken{} - st.ExistingTokenExpireInSeconds = pb.ExistingTokenExpireInSeconds - st.Name = pb.Name - - return st, nil -} - -func securablePropertiesKvPairsToPb(st *SecurablePropertiesKvPairs) (*securablePropertiesKvPairsPb, error) { - if st == nil { - return nil, nil - } - pb := &securablePropertiesKvPairsPb{} - pb.Properties = st.Properties - - return pb, nil -} - -type securablePropertiesKvPairsPb struct { - Properties map[string]string `json:"properties"` -} - -func securablePropertiesKvPairsFromPb(pb *securablePropertiesKvPairsPb) (*SecurablePropertiesKvPairs, error) { - if pb == nil { - return nil, nil - } - st := &SecurablePropertiesKvPairs{} - st.Properties = pb.Properties - - return st, nil -} - -func shareInfoToPb(st *ShareInfo) (*shareInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &shareInfoPb{} - pb.Comment = st.Comment - pb.CreatedAt = st.CreatedAt - pb.CreatedBy = st.CreatedBy - pb.Name = st.Name - pb.Objects = st.Objects - pb.Owner = st.Owner - pb.StorageLocation = st.StorageLocation - pb.StorageRoot = st.StorageRoot - pb.UpdatedAt = st.UpdatedAt - pb.UpdatedBy = st.UpdatedBy - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type shareInfoPb struct { - Comment string `json:"comment,omitempty"` - CreatedAt int64 `json:"created_at,omitempty"` - CreatedBy string `json:"created_by,omitempty"` - Name string `json:"name,omitempty"` - Objects []SharedDataObject `json:"objects,omitempty"` - Owner string `json:"owner,omitempty"` - StorageLocation string `json:"storage_location,omitempty"` - StorageRoot string `json:"storage_root,omitempty"` - UpdatedAt int64 `json:"updated_at,omitempty"` - UpdatedBy string `json:"updated_by,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func shareInfoFromPb(pb *shareInfoPb) (*ShareInfo, error) { - if pb == nil { - return nil, nil - } - st := &ShareInfo{} - st.Comment = pb.Comment - st.CreatedAt = pb.CreatedAt - st.CreatedBy = pb.CreatedBy - st.Name = pb.Name - st.Objects = pb.Objects - st.Owner = pb.Owner - st.StorageLocation = pb.StorageLocation - st.StorageRoot = pb.StorageRoot - st.UpdatedAt = pb.UpdatedAt - st.UpdatedBy = pb.UpdatedBy - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *shareInfoPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st shareInfoPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func sharePermissionsRequestToPb(st *SharePermissionsRequest) (*sharePermissionsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &sharePermissionsRequestPb{} - pb.MaxResults = st.MaxResults - pb.Name = st.Name - pb.PageToken = st.PageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type sharePermissionsRequestPb struct { - MaxResults int `json:"-" url:"max_results,omitempty"` - Name string `json:"-" url:"-"` - PageToken string `json:"-" url:"page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func sharePermissionsRequestFromPb(pb *sharePermissionsRequestPb) (*SharePermissionsRequest, error) { - if pb == nil { - return nil, nil - } - st := &SharePermissionsRequest{} - st.MaxResults = pb.MaxResults - st.Name = pb.Name - st.PageToken = pb.PageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *sharePermissionsRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st sharePermissionsRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func shareToPrivilegeAssignmentToPb(st *ShareToPrivilegeAssignment) (*shareToPrivilegeAssignmentPb, error) { - if st == nil { - return nil, nil - } - pb := &shareToPrivilegeAssignmentPb{} - pb.PrivilegeAssignments = st.PrivilegeAssignments - pb.ShareName = st.ShareName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type shareToPrivilegeAssignmentPb struct { - PrivilegeAssignments []PrivilegeAssignment `json:"privilege_assignments,omitempty"` - ShareName string `json:"share_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func shareToPrivilegeAssignmentFromPb(pb *shareToPrivilegeAssignmentPb) (*ShareToPrivilegeAssignment, error) { - if pb == nil { - return nil, nil - } - st := &ShareToPrivilegeAssignment{} - st.PrivilegeAssignments = pb.PrivilegeAssignments - st.ShareName = pb.ShareName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *shareToPrivilegeAssignmentPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st shareToPrivilegeAssignmentPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func sharedDataObjectToPb(st *SharedDataObject) (*sharedDataObjectPb, error) { - if st == nil { - return nil, nil - } - pb := &sharedDataObjectPb{} - pb.AddedAt = st.AddedAt - pb.AddedBy = st.AddedBy - pb.CdfEnabled = st.CdfEnabled - pb.Comment = st.Comment - pb.Content = st.Content - pb.DataObjectType = st.DataObjectType - pb.HistoryDataSharingStatus = st.HistoryDataSharingStatus - pb.Name = st.Name - pb.Partitions = st.Partitions - pb.SharedAs = st.SharedAs - pb.StartVersion = st.StartVersion - pb.Status = st.Status - pb.StringSharedAs = st.StringSharedAs - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type sharedDataObjectPb struct { - AddedAt int64 `json:"added_at,omitempty"` - AddedBy string `json:"added_by,omitempty"` - CdfEnabled bool `json:"cdf_enabled,omitempty"` - Comment string `json:"comment,omitempty"` - Content string `json:"content,omitempty"` - DataObjectType SharedDataObjectDataObjectType `json:"data_object_type,omitempty"` - HistoryDataSharingStatus SharedDataObjectHistoryDataSharingStatus `json:"history_data_sharing_status,omitempty"` - Name string `json:"name"` - Partitions []Partition `json:"partitions,omitempty"` - SharedAs string `json:"shared_as,omitempty"` - StartVersion int64 `json:"start_version,omitempty"` - Status SharedDataObjectStatus `json:"status,omitempty"` - StringSharedAs string `json:"string_shared_as,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func sharedDataObjectFromPb(pb *sharedDataObjectPb) (*SharedDataObject, error) { - if pb == nil { - return nil, nil - } - st := &SharedDataObject{} - st.AddedAt = pb.AddedAt - st.AddedBy = pb.AddedBy - st.CdfEnabled = pb.CdfEnabled - st.Comment = pb.Comment - st.Content = pb.Content - st.DataObjectType = pb.DataObjectType - st.HistoryDataSharingStatus = pb.HistoryDataSharingStatus - st.Name = pb.Name - st.Partitions = pb.Partitions - st.SharedAs = pb.SharedAs - st.StartVersion = pb.StartVersion - st.Status = pb.Status - st.StringSharedAs = pb.StringSharedAs - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *sharedDataObjectPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st sharedDataObjectPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func sharedDataObjectUpdateToPb(st *SharedDataObjectUpdate) (*sharedDataObjectUpdatePb, error) { - if st == nil { - return nil, nil - } - pb := &sharedDataObjectUpdatePb{} - pb.Action = st.Action - pb.DataObject = st.DataObject - - return pb, nil -} - -type sharedDataObjectUpdatePb struct { - Action SharedDataObjectUpdateAction `json:"action,omitempty"` - DataObject *SharedDataObject `json:"data_object,omitempty"` -} - -func sharedDataObjectUpdateFromPb(pb *sharedDataObjectUpdatePb) (*SharedDataObjectUpdate, error) { - if pb == nil { - return nil, nil - } - st := &SharedDataObjectUpdate{} - st.Action = pb.Action - st.DataObject = pb.DataObject - - return st, nil -} - -func tableToPb(st *Table) (*tablePb, error) { - if st == nil { - return nil, nil - } - pb := &tablePb{} - pb.Comment = st.Comment - pb.Id = st.Id - pb.InternalAttributes = st.InternalAttributes - pb.MaterializationNamespace = st.MaterializationNamespace - pb.MaterializedTableName = st.MaterializedTableName - pb.Name = st.Name - pb.Schema = st.Schema - pb.Share = st.Share - pb.ShareId = st.ShareId - pb.Tags = st.Tags - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type tablePb struct { - Comment string `json:"comment,omitempty"` - Id string `json:"id,omitempty"` - InternalAttributes *TableInternalAttributes `json:"internal_attributes,omitempty"` - MaterializationNamespace string `json:"materialization_namespace,omitempty"` - MaterializedTableName string `json:"materialized_table_name,omitempty"` - Name string `json:"name,omitempty"` - Schema string `json:"schema,omitempty"` - Share string `json:"share,omitempty"` - ShareId string `json:"share_id,omitempty"` - Tags []catalog.TagKeyValue `json:"tags,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func tableFromPb(pb *tablePb) (*Table, error) { - if pb == nil { - return nil, nil - } - st := &Table{} - st.Comment = pb.Comment - st.Id = pb.Id - st.InternalAttributes = pb.InternalAttributes - st.MaterializationNamespace = pb.MaterializationNamespace - st.MaterializedTableName = pb.MaterializedTableName - st.Name = pb.Name - st.Schema = pb.Schema - st.Share = pb.Share - st.ShareId = pb.ShareId - st.Tags = pb.Tags - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *tablePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st tablePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func tableInternalAttributesToPb(st *TableInternalAttributes) (*tableInternalAttributesPb, error) { - if st == nil { - return nil, nil - } - pb := &tableInternalAttributesPb{} - pb.ParentStorageLocation = st.ParentStorageLocation - pb.StorageLocation = st.StorageLocation - pb.Type = st.Type - pb.ViewDefinition = st.ViewDefinition - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type tableInternalAttributesPb struct { - ParentStorageLocation string `json:"parent_storage_location,omitempty"` - StorageLocation string `json:"storage_location,omitempty"` - Type TableInternalAttributesSharedTableType `json:"type,omitempty"` - ViewDefinition string `json:"view_definition,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func tableInternalAttributesFromPb(pb *tableInternalAttributesPb) (*TableInternalAttributes, error) { - if pb == nil { - return nil, nil - } - st := &TableInternalAttributes{} - st.ParentStorageLocation = pb.ParentStorageLocation - st.StorageLocation = pb.StorageLocation - st.Type = pb.Type - st.ViewDefinition = pb.ViewDefinition - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *tableInternalAttributesPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st tableInternalAttributesPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func updateFederationPolicyRequestToPb(st *UpdateFederationPolicyRequest) (*updateFederationPolicyRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &updateFederationPolicyRequestPb{} - pb.Name = st.Name - pb.Policy = st.Policy - pb.RecipientName = st.RecipientName - pb.UpdateMask = st.UpdateMask - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type updateFederationPolicyRequestPb struct { - Name string `json:"-" url:"-"` - Policy FederationPolicy `json:"policy"` - RecipientName string `json:"-" url:"-"` - UpdateMask string `json:"-" url:"update_mask,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func updateFederationPolicyRequestFromPb(pb *updateFederationPolicyRequestPb) (*UpdateFederationPolicyRequest, error) { - if pb == nil { - return nil, nil - } - st := &UpdateFederationPolicyRequest{} - st.Name = pb.Name - st.Policy = pb.Policy - st.RecipientName = pb.RecipientName - st.UpdateMask = pb.UpdateMask - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *updateFederationPolicyRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st updateFederationPolicyRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func updateProviderToPb(st *UpdateProvider) (*updateProviderPb, error) { - if st == nil { - return nil, nil - } - pb := &updateProviderPb{} - pb.Comment = st.Comment - pb.Name = st.Name - pb.NewName = st.NewName - pb.Owner = st.Owner - pb.RecipientProfileStr = st.RecipientProfileStr - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type updateProviderPb struct { - Comment string `json:"comment,omitempty"` - Name string `json:"-" url:"-"` - NewName string `json:"new_name,omitempty"` - Owner string `json:"owner,omitempty"` - RecipientProfileStr string `json:"recipient_profile_str,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func updateProviderFromPb(pb *updateProviderPb) (*UpdateProvider, error) { - if pb == nil { - return nil, nil - } - st := &UpdateProvider{} - st.Comment = pb.Comment - st.Name = pb.Name - st.NewName = pb.NewName - st.Owner = pb.Owner - st.RecipientProfileStr = pb.RecipientProfileStr - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *updateProviderPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st updateProviderPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func updateRecipientToPb(st *UpdateRecipient) (*updateRecipientPb, error) { - if st == nil { - return nil, nil - } - pb := &updateRecipientPb{} - pb.Comment = st.Comment - pb.ExpirationTime = st.ExpirationTime - pb.IpAccessList = st.IpAccessList - pb.Name = st.Name - pb.NewName = st.NewName - pb.Owner = st.Owner - pb.PropertiesKvpairs = st.PropertiesKvpairs - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type updateRecipientPb struct { - Comment string `json:"comment,omitempty"` - ExpirationTime int64 `json:"expiration_time,omitempty"` - IpAccessList *IpAccessList `json:"ip_access_list,omitempty"` - Name string `json:"-" url:"-"` - NewName string `json:"new_name,omitempty"` - Owner string `json:"owner,omitempty"` - PropertiesKvpairs *SecurablePropertiesKvPairs `json:"properties_kvpairs,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func updateRecipientFromPb(pb *updateRecipientPb) (*UpdateRecipient, error) { - if pb == nil { - return nil, nil - } - st := &UpdateRecipient{} - st.Comment = pb.Comment - st.ExpirationTime = pb.ExpirationTime - st.IpAccessList = pb.IpAccessList - st.Name = pb.Name - st.NewName = pb.NewName - st.Owner = pb.Owner - st.PropertiesKvpairs = pb.PropertiesKvpairs - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *updateRecipientPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st updateRecipientPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func updateShareToPb(st *UpdateShare) (*updateSharePb, error) { - if st == nil { - return nil, nil - } - pb := &updateSharePb{} - pb.Comment = st.Comment - pb.Name = st.Name - pb.NewName = st.NewName - pb.Owner = st.Owner - pb.StorageRoot = st.StorageRoot - pb.Updates = st.Updates - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type updateSharePb struct { - Comment string `json:"comment,omitempty"` - Name string `json:"-" url:"-"` - NewName string `json:"new_name,omitempty"` - Owner string `json:"owner,omitempty"` - StorageRoot string `json:"storage_root,omitempty"` - Updates []SharedDataObjectUpdate `json:"updates,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func updateShareFromPb(pb *updateSharePb) (*UpdateShare, error) { - if pb == nil { - return nil, nil - } - st := &UpdateShare{} - st.Comment = pb.Comment - st.Name = pb.Name - st.NewName = pb.NewName - st.Owner = pb.Owner - st.StorageRoot = pb.StorageRoot - st.Updates = pb.Updates - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *updateSharePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st updateSharePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func updateSharePermissionsToPb(st *UpdateSharePermissions) (*updateSharePermissionsPb, error) { - if st == nil { - return nil, nil - } - pb := &updateSharePermissionsPb{} - pb.Changes = st.Changes - pb.Name = st.Name - pb.OmitPermissionsList = st.OmitPermissionsList - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type updateSharePermissionsPb struct { - Changes []PermissionsChange `json:"changes,omitempty"` - Name string `json:"-" url:"-"` - OmitPermissionsList bool `json:"omit_permissions_list,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func updateSharePermissionsFromPb(pb *updateSharePermissionsPb) (*UpdateSharePermissions, error) { - if pb == nil { - return nil, nil - } - st := &UpdateSharePermissions{} - st.Changes = pb.Changes - st.Name = pb.Name - st.OmitPermissionsList = pb.OmitPermissionsList - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *updateSharePermissionsPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st updateSharePermissionsPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func updateSharePermissionsResponseToPb(st *UpdateSharePermissionsResponse) (*updateSharePermissionsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &updateSharePermissionsResponsePb{} - pb.PrivilegeAssignments = st.PrivilegeAssignments - - return pb, nil -} - -type updateSharePermissionsResponsePb struct { - PrivilegeAssignments []PrivilegeAssignment `json:"privilege_assignments,omitempty"` -} - -func updateSharePermissionsResponseFromPb(pb *updateSharePermissionsResponsePb) (*UpdateSharePermissionsResponse, error) { - if pb == nil { - return nil, nil - } - st := &UpdateSharePermissionsResponse{} - st.PrivilegeAssignments = pb.PrivilegeAssignments - - return st, nil -} - -func volumeToPb(st *Volume) (*volumePb, error) { - if st == nil { - return nil, nil - } - pb := &volumePb{} - pb.Comment = st.Comment - pb.Id = st.Id - pb.InternalAttributes = st.InternalAttributes - pb.Name = st.Name - pb.Schema = st.Schema - pb.Share = st.Share - pb.ShareId = st.ShareId - pb.Tags = st.Tags - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type volumePb struct { - Comment string `json:"comment,omitempty"` - Id string `json:"id,omitempty"` - InternalAttributes *VolumeInternalAttributes `json:"internal_attributes,omitempty"` - Name string `json:"name,omitempty"` - Schema string `json:"schema,omitempty"` - Share string `json:"share,omitempty"` - ShareId string `json:"share_id,omitempty"` - Tags []catalog.TagKeyValue `json:"tags,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func volumeFromPb(pb *volumePb) (*Volume, error) { - if pb == nil { - return nil, nil - } - st := &Volume{} - st.Comment = pb.Comment - st.Id = pb.Id - st.InternalAttributes = pb.InternalAttributes - st.Name = pb.Name - st.Schema = pb.Schema - st.Share = pb.Share - st.ShareId = pb.ShareId - st.Tags = pb.Tags - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *volumePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st volumePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func volumeInternalAttributesToPb(st *VolumeInternalAttributes) (*volumeInternalAttributesPb, error) { - if st == nil { - return nil, nil - } - pb := &volumeInternalAttributesPb{} - pb.StorageLocation = st.StorageLocation - pb.Type = st.Type - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type volumeInternalAttributesPb struct { - StorageLocation string `json:"storage_location,omitempty"` - Type string `json:"type,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func volumeInternalAttributesFromPb(pb *volumeInternalAttributesPb) (*VolumeInternalAttributes, error) { - if pb == nil { - return nil, nil - } - st := &VolumeInternalAttributes{} - st.StorageLocation = pb.StorageLocation - st.Type = pb.Type - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *volumeInternalAttributesPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st volumeInternalAttributesPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func durationToPb(d *time.Duration) (*string, error) { - if d == nil { - return nil, nil - } - s := fmt.Sprintf("%.9fs", d.Seconds()) - return &s, nil -} - -func durationFromPb(s *string) (*time.Duration, error) { - if s == nil { - return nil, nil - } - d, err := time.ParseDuration(*s) - if err != nil { - return nil, err - } - return &d, nil -} - -func timestampToPb(t *time.Time) (*string, error) { - if t == nil { - return nil, nil - } - s := t.Format(time.RFC3339) - return &s, nil -} - -func timestampFromPb(s *string) (*time.Time, error) { - if s == nil { - return nil, nil - } - t, err := time.Parse(time.RFC3339, *s) - if err != nil { - return nil, err - } - return &t, nil -} - -func fieldMaskToPb(fm *[]string) (*string, error) { - if fm == nil { - return nil, nil - } - s := strings.Join(*fm, ",") - return &s, nil -} - -func fieldMaskFromPb(s *string) (*[]string, error) { - if s == nil { - return nil, nil - } - fm := strings.Split(*s, ",") - return &fm, nil -} diff --git a/service/sharing/model.go b/service/sharing/model.go index 373461e6d..f88285200 100755 --- a/service/sharing/model.go +++ b/service/sharing/model.go @@ -3,9 +3,9 @@ package sharing import ( - "encoding/json" "fmt" + "github.com/databricks/databricks-sdk-go/marshal" "github.com/databricks/databricks-sdk-go/service/catalog" ) @@ -154,709 +154,286 @@ func (f *ColumnTypeName) Type() string { // Create recipient federation policy type CreateFederationPolicyRequest struct { - - // Wire name: 'policy' Policy FederationPolicy `json:"policy"` // Name of the recipient. This is the name of the recipient for which the // policy is being created. - RecipientName string `json:"-" tf:"-"` -} - -func (st *CreateFederationPolicyRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createFederationPolicyRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createFederationPolicyRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CreateFederationPolicyRequest) MarshalJSON() ([]byte, error) { - pb, err := createFederationPolicyRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + RecipientName string `json:"-" url:"-"` } type CreateProvider struct { // The delta sharing authentication type. - // Wire name: 'authentication_type' AuthenticationType AuthenticationType `json:"authentication_type"` // Description about the provider. - // Wire name: 'comment' Comment string `json:"comment,omitempty"` // The name of the Provider. - // Wire name: 'name' Name string `json:"name"` // This field is required when the __authentication_type__ is **TOKEN**, // **OAUTH_CLIENT_CREDENTIALS** or not provided. - // Wire name: 'recipient_profile_str' RecipientProfileStr string `json:"recipient_profile_str,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateProvider) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createProviderPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createProviderFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateProvider) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateProvider) MarshalJSON() ([]byte, error) { - pb, err := createProviderToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateProvider) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreateRecipient struct { // The delta sharing authentication type. - // Wire name: 'authentication_type' AuthenticationType AuthenticationType `json:"authentication_type"` // Description about the recipient. - // Wire name: 'comment' Comment string `json:"comment,omitempty"` // The global Unity Catalog metastore id provided by the data recipient. // This field is only present when the __authentication_type__ is // **DATABRICKS**. The identifier is of format // __cloud__:__region__:__metastore-uuid__. - // Wire name: 'data_recipient_global_metastore_id' DataRecipientGlobalMetastoreId string `json:"data_recipient_global_metastore_id,omitempty"` // Expiration timestamp of the token, in epoch milliseconds. - // Wire name: 'expiration_time' ExpirationTime int64 `json:"expiration_time,omitempty"` // IP Access List - // Wire name: 'ip_access_list' IpAccessList *IpAccessList `json:"ip_access_list,omitempty"` // Name of Recipient. - // Wire name: 'name' Name string `json:"name"` // Username of the recipient owner. - // Wire name: 'owner' Owner string `json:"owner,omitempty"` // Recipient properties as map of string key-value pairs. When provided in // update request, the specified properties will override the existing // properties. To add and remove properties, one would need to perform a // read-modify-write. - // Wire name: 'properties_kvpairs' PropertiesKvpairs *SecurablePropertiesKvPairs `json:"properties_kvpairs,omitempty"` // The one-time sharing code provided by the data recipient. This field is // only present when the __authentication_type__ is **DATABRICKS**. - // Wire name: 'sharing_code' SharingCode string `json:"sharing_code,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateRecipient) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createRecipientPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createRecipientFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateRecipient) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateRecipient) MarshalJSON() ([]byte, error) { - pb, err := createRecipientToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateRecipient) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreateShare struct { // User-provided free-form text description. - // Wire name: 'comment' Comment string `json:"comment,omitempty"` // Name of the share. - // Wire name: 'name' Name string `json:"name"` // Storage root URL for the share. - // Wire name: 'storage_root' StorageRoot string `json:"storage_root,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateShare) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createSharePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createShareFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateShare) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateShare) MarshalJSON() ([]byte, error) { - pb, err := createShareToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateShare) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Delete recipient federation policy type DeleteFederationPolicyRequest struct { // Name of the policy. This is the name of the policy to be deleted. - Name string `json:"-" tf:"-"` + Name string `json:"-" url:"-"` // Name of the recipient. This is the name of the recipient for which the // policy is being deleted. - RecipientName string `json:"-" tf:"-"` -} - -func (st *DeleteFederationPolicyRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteFederationPolicyRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteFederationPolicyRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteFederationPolicyRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteFederationPolicyRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + RecipientName string `json:"-" url:"-"` } // Delete a provider type DeleteProviderRequest struct { // Name of the provider. - Name string `json:"-" tf:"-"` -} - -func (st *DeleteProviderRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteProviderRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteProviderRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteProviderRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteProviderRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Name string `json:"-" url:"-"` } // Delete a share recipient type DeleteRecipientRequest struct { // Name of the recipient. - Name string `json:"-" tf:"-"` -} - -func (st *DeleteRecipientRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteRecipientRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteRecipientRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteRecipientRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteRecipientRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Name string `json:"-" url:"-"` } type DeleteResponse struct { } -func (st *DeleteResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Delete a share type DeleteShareRequest struct { // The name of the share. - Name string `json:"-" tf:"-"` -} - -func (st *DeleteShareRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteShareRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteShareRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteShareRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteShareRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Name string `json:"-" url:"-"` } // Represents a UC dependency. type DeltaSharingDependency struct { // A Function in UC as a dependency. - // Wire name: 'function' Function *DeltaSharingFunctionDependency `json:"function,omitempty"` // A Table in UC as a dependency. - // Wire name: 'table' Table *DeltaSharingTableDependency `json:"table,omitempty"` } -func (st *DeltaSharingDependency) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deltaSharingDependencyPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deltaSharingDependencyFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeltaSharingDependency) MarshalJSON() ([]byte, error) { - pb, err := deltaSharingDependencyToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Represents a list of dependencies. type DeltaSharingDependencyList struct { // An array of Dependency. - // Wire name: 'dependencies' Dependencies []DeltaSharingDependency `json:"dependencies,omitempty"` } -func (st *DeltaSharingDependencyList) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deltaSharingDependencyListPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deltaSharingDependencyListFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeltaSharingDependencyList) MarshalJSON() ([]byte, error) { - pb, err := deltaSharingDependencyListToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type DeltaSharingFunction struct { // The aliass of registered model. - // Wire name: 'aliases' Aliases []RegisteredModelAlias `json:"aliases,omitempty"` // The comment of the function. - // Wire name: 'comment' Comment string `json:"comment,omitempty"` // The data type of the function. - // Wire name: 'data_type' DataType ColumnTypeName `json:"data_type,omitempty"` // The dependency list of the function. - // Wire name: 'dependency_list' DependencyList *DeltaSharingDependencyList `json:"dependency_list,omitempty"` // The full data type of the function. - // Wire name: 'full_data_type' FullDataType string `json:"full_data_type,omitempty"` // The id of the function. - // Wire name: 'id' Id string `json:"id,omitempty"` // The function parameter information. - // Wire name: 'input_params' InputParams *FunctionParameterInfos `json:"input_params,omitempty"` // The name of the function. - // Wire name: 'name' Name string `json:"name,omitempty"` // The properties of the function. - // Wire name: 'properties' Properties string `json:"properties,omitempty"` // The routine definition of the function. - // Wire name: 'routine_definition' RoutineDefinition string `json:"routine_definition,omitempty"` // The name of the schema that the function belongs to. - // Wire name: 'schema' Schema string `json:"schema,omitempty"` // The securable kind of the function. - // Wire name: 'securable_kind' SecurableKind SharedSecurableKind `json:"securable_kind,omitempty"` // The name of the share that the function belongs to. - // Wire name: 'share' Share string `json:"share,omitempty"` // The id of the share that the function belongs to. - // Wire name: 'share_id' ShareId string `json:"share_id,omitempty"` // The storage location of the function. - // Wire name: 'storage_location' StorageLocation string `json:"storage_location,omitempty"` // The tags of the function. - // Wire name: 'tags' Tags []catalog.TagKeyValue `json:"tags,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DeltaSharingFunction) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deltaSharingFunctionPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deltaSharingFunctionFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DeltaSharingFunction) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DeltaSharingFunction) MarshalJSON() ([]byte, error) { - pb, err := deltaSharingFunctionToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DeltaSharingFunction) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // A Function in UC as a dependency. type DeltaSharingFunctionDependency struct { - - // Wire name: 'function_name' FunctionName string `json:"function_name,omitempty"` - // Wire name: 'schema_name' SchemaName string `json:"schema_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DeltaSharingFunctionDependency) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deltaSharingFunctionDependencyPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deltaSharingFunctionDependencyFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DeltaSharingFunctionDependency) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DeltaSharingFunctionDependency) MarshalJSON() ([]byte, error) { - pb, err := deltaSharingFunctionDependencyToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DeltaSharingFunctionDependency) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // A Table in UC as a dependency. type DeltaSharingTableDependency struct { - - // Wire name: 'schema_name' SchemaName string `json:"schema_name,omitempty"` - // Wire name: 'table_name' TableName string `json:"table_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DeltaSharingTableDependency) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deltaSharingTableDependencyPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deltaSharingTableDependencyFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DeltaSharingTableDependency) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DeltaSharingTableDependency) MarshalJSON() ([]byte, error) { - pb, err := deltaSharingTableDependencyToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DeltaSharingTableDependency) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type FederationPolicy struct { // Description of the policy. This is a user-provided description. - // Wire name: 'comment' Comment string `json:"comment,omitempty"` // System-generated timestamp indicating when the policy was created. - // Wire name: 'create_time' CreateTime string `json:"create_time,omitempty"` // Unique, immutable system-generated identifier for the federation policy. - // Wire name: 'id' Id string `json:"id,omitempty"` // Name of the federation policy. A recipient can have multiple policies // with different names. The name must contain only lowercase alphanumeric // characters, numbers, and hyphens. - // Wire name: 'name' Name string `json:"name,omitempty"` // Specifies the policy to use for validating OIDC claims in the federated // tokens. - // Wire name: 'oidc_policy' OidcPolicy *OidcFederationPolicy `json:"oidc_policy,omitempty"` // System-generated timestamp indicating when the policy was last updated. - // Wire name: 'update_time' UpdateTime string `json:"update_time,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *FederationPolicy) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &federationPolicyPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := federationPolicyFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *FederationPolicy) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st FederationPolicy) MarshalJSON() ([]byte, error) { - pb, err := federationPolicyToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s FederationPolicy) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Represents a parameter of a function. The same message is used for both input // and output columns. type FunctionParameterInfo struct { // The comment of the parameter. - // Wire name: 'comment' Comment string `json:"comment,omitempty"` // The name of the parameter. - // Wire name: 'name' Name string `json:"name,omitempty"` // The default value of the parameter. - // Wire name: 'parameter_default' ParameterDefault string `json:"parameter_default,omitempty"` // The mode of the function parameter. - // Wire name: 'parameter_mode' ParameterMode FunctionParameterMode `json:"parameter_mode,omitempty"` // The type of the function parameter. - // Wire name: 'parameter_type' ParameterType FunctionParameterType `json:"parameter_type,omitempty"` // The position of the parameter. - // Wire name: 'position' Position int `json:"position,omitempty"` // The interval type of the parameter type. - // Wire name: 'type_interval_type' TypeIntervalType string `json:"type_interval_type,omitempty"` // The type of the parameter in JSON format. - // Wire name: 'type_json' TypeJson string `json:"type_json,omitempty"` // The type of the parameter in Enum format. - // Wire name: 'type_name' TypeName ColumnTypeName `json:"type_name,omitempty"` // The precision of the parameter type. - // Wire name: 'type_precision' TypePrecision int `json:"type_precision,omitempty"` // The scale of the parameter type. - // Wire name: 'type_scale' TypeScale int `json:"type_scale,omitempty"` // The type of the parameter in text format. - // Wire name: 'type_text' TypeText string `json:"type_text,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *FunctionParameterInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &functionParameterInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := functionParameterInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *FunctionParameterInfo) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st FunctionParameterInfo) MarshalJSON() ([]byte, error) { - pb, err := functionParameterInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s FunctionParameterInfo) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type FunctionParameterInfos struct { // The list of parameters of the function. - // Wire name: 'parameters' Parameters []FunctionParameterInfo `json:"parameters,omitempty"` } -func (st *FunctionParameterInfos) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &functionParameterInfosPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := functionParameterInfosFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st FunctionParameterInfos) MarshalJSON() ([]byte, error) { - pb, err := functionParameterInfosToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type FunctionParameterMode string const FunctionParameterModeIn FunctionParameterMode = `IN` @@ -937,501 +514,193 @@ func (f *FunctionParameterType) Type() string { // Get a share activation URL type GetActivationUrlInfoRequest struct { // The one time activation url. It also accepts activation token. - ActivationUrl string `json:"-" tf:"-"` -} - -func (st *GetActivationUrlInfoRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getActivationUrlInfoRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getActivationUrlInfoRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetActivationUrlInfoRequest) MarshalJSON() ([]byte, error) { - pb, err := getActivationUrlInfoRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + ActivationUrl string `json:"-" url:"-"` } type GetActivationUrlInfoResponse struct { } -func (st *GetActivationUrlInfoResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getActivationUrlInfoResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getActivationUrlInfoResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetActivationUrlInfoResponse) MarshalJSON() ([]byte, error) { - pb, err := getActivationUrlInfoResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Get recipient federation policy type GetFederationPolicyRequest struct { // Name of the policy. This is the name of the policy to be retrieved. - Name string `json:"-" tf:"-"` + Name string `json:"-" url:"-"` // Name of the recipient. This is the name of the recipient for which the // policy is being retrieved. - RecipientName string `json:"-" tf:"-"` -} - -func (st *GetFederationPolicyRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getFederationPolicyRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getFederationPolicyRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetFederationPolicyRequest) MarshalJSON() ([]byte, error) { - pb, err := getFederationPolicyRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + RecipientName string `json:"-" url:"-"` } // Get a provider type GetProviderRequest struct { // Name of the provider. - Name string `json:"-" tf:"-"` -} - -func (st *GetProviderRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getProviderRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getProviderRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetProviderRequest) MarshalJSON() ([]byte, error) { - pb, err := getProviderRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Name string `json:"-" url:"-"` } // Get a share recipient type GetRecipientRequest struct { // Name of the recipient. - Name string `json:"-" tf:"-"` -} - -func (st *GetRecipientRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getRecipientRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getRecipientRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetRecipientRequest) MarshalJSON() ([]byte, error) { - pb, err := getRecipientRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Name string `json:"-" url:"-"` } type GetRecipientSharePermissionsResponse struct { // Opaque token to retrieve the next page of results. Absent if there are no // more pages. __page_token__ should be set to this value for the next // request (for the next page of results). - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` // An array of data share permissions for a recipient. - // Wire name: 'permissions_out' PermissionsOut []ShareToPrivilegeAssignment `json:"permissions_out,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetRecipientSharePermissionsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getRecipientSharePermissionsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getRecipientSharePermissionsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetRecipientSharePermissionsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetRecipientSharePermissionsResponse) MarshalJSON() ([]byte, error) { - pb, err := getRecipientSharePermissionsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetRecipientSharePermissionsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type GetSharePermissionsResponse struct { // Opaque token to retrieve the next page of results. Absent if there are no // more pages. __page_token__ should be set to this value for the next // request (for the next page of results). - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` // The privileges assigned to each principal - // Wire name: 'privilege_assignments' PrivilegeAssignments []PrivilegeAssignment `json:"privilege_assignments,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetSharePermissionsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getSharePermissionsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getSharePermissionsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetSharePermissionsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetSharePermissionsResponse) MarshalJSON() ([]byte, error) { - pb, err := getSharePermissionsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetSharePermissionsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get a share type GetShareRequest struct { // Query for data to include in the share. - IncludeSharedData bool `json:"-" tf:"-"` + IncludeSharedData bool `json:"-" url:"include_shared_data,omitempty"` // The name of the share. - Name string `json:"-" tf:"-"` + Name string `json:"-" url:"-"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetShareRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getShareRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getShareRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetShareRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetShareRequest) MarshalJSON() ([]byte, error) { - pb, err := getShareRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetShareRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type IpAccessList struct { // Allowed IP Addresses in CIDR notation. Limit of 100. - // Wire name: 'allowed_ip_addresses' AllowedIpAddresses []string `json:"allowed_ip_addresses,omitempty"` } -func (st *IpAccessList) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &ipAccessListPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := ipAccessListFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st IpAccessList) MarshalJSON() ([]byte, error) { - pb, err := ipAccessListToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // List recipient federation policies type ListFederationPoliciesRequest struct { - MaxResults int `json:"-" tf:"-"` + MaxResults int `json:"-" url:"max_results,omitempty"` - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` // Name of the recipient. This is the name of the recipient for which the // policies are being listed. - RecipientName string `json:"-" tf:"-"` + RecipientName string `json:"-" url:"-"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListFederationPoliciesRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listFederationPoliciesRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listFederationPoliciesRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListFederationPoliciesRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListFederationPoliciesRequest) MarshalJSON() ([]byte, error) { - pb, err := listFederationPoliciesRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListFederationPoliciesRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListFederationPoliciesResponse struct { - - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` - // Wire name: 'policies' Policies []FederationPolicy `json:"policies,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListFederationPoliciesResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listFederationPoliciesResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listFederationPoliciesResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListFederationPoliciesResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListFederationPoliciesResponse) MarshalJSON() ([]byte, error) { - pb, err := listFederationPoliciesResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListFederationPoliciesResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // List assets by provider share type ListProviderShareAssetsRequest struct { // Maximum number of functions to return. - FunctionMaxResults int `json:"-" tf:"-"` + FunctionMaxResults int `json:"-" url:"function_max_results,omitempty"` // Maximum number of notebooks to return. - NotebookMaxResults int `json:"-" tf:"-"` + NotebookMaxResults int `json:"-" url:"notebook_max_results,omitempty"` // The name of the provider who owns the share. - ProviderName string `json:"-" tf:"-"` + ProviderName string `json:"-" url:"-"` // The name of the share. - ShareName string `json:"-" tf:"-"` + ShareName string `json:"-" url:"-"` // Maximum number of tables to return. - TableMaxResults int `json:"-" tf:"-"` + TableMaxResults int `json:"-" url:"table_max_results,omitempty"` // Maximum number of volumes to return. - VolumeMaxResults int `json:"-" tf:"-"` + VolumeMaxResults int `json:"-" url:"volume_max_results,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListProviderShareAssetsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listProviderShareAssetsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listProviderShareAssetsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListProviderShareAssetsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListProviderShareAssetsRequest) MarshalJSON() ([]byte, error) { - pb, err := listProviderShareAssetsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListProviderShareAssetsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Response to ListProviderShareAssets, which contains the list of assets of a // share. type ListProviderShareAssetsResponse struct { // The list of functions in the share. - // Wire name: 'functions' Functions []DeltaSharingFunction `json:"functions,omitempty"` // The list of notebooks in the share. - // Wire name: 'notebooks' Notebooks []NotebookFile `json:"notebooks,omitempty"` // The list of tables in the share. - // Wire name: 'tables' Tables []Table `json:"tables,omitempty"` // The list of volumes in the share. - // Wire name: 'volumes' Volumes []Volume `json:"volumes,omitempty"` } -func (st *ListProviderShareAssetsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listProviderShareAssetsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listProviderShareAssetsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ListProviderShareAssetsResponse) MarshalJSON() ([]byte, error) { - pb, err := listProviderShareAssetsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type ListProviderSharesResponse struct { // Opaque token to retrieve the next page of results. Absent if there are no // more pages. __page_token__ should be set to this value for the next // request (for the next page of results). - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` // An array of provider shares. - // Wire name: 'shares' Shares []ProviderShare `json:"shares,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListProviderSharesResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listProviderSharesResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listProviderSharesResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListProviderSharesResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListProviderSharesResponse) MarshalJSON() ([]byte, error) { - pb, err := listProviderSharesResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListProviderSharesResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // List providers type ListProvidersRequest struct { // If not provided, all providers will be returned. If no providers exist // with this ID, no results will be returned. - DataProviderGlobalMetastoreId string `json:"-" tf:"-"` + DataProviderGlobalMetastoreId string `json:"-" url:"data_provider_global_metastore_id,omitempty"` // Maximum number of providers to return. - when set to 0, the page length // is set to a server configured value (recommended); - when set to a value // greater than 0, the page length is the minimum of this value and a server @@ -1441,81 +710,45 @@ type ListProvidersRequest struct { // the specified max_results size, even zero. The only definitive indication // that no further providers can be fetched is when the next_page_token is // unset from the response. - MaxResults int `json:"-" tf:"-"` + MaxResults int `json:"-" url:"max_results,omitempty"` // Opaque pagination token to go to next page based on previous query. - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListProvidersRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listProvidersRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listProvidersRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListProvidersRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListProvidersRequest) MarshalJSON() ([]byte, error) { - pb, err := listProvidersRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListProvidersRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListProvidersResponse struct { // Opaque token to retrieve the next page of results. Absent if there are no // more pages. __page_token__ should be set to this value for the next // request (for the next page of results). - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` // An array of provider information objects. - // Wire name: 'providers' Providers []ProviderInfo `json:"providers,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListProvidersResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listProvidersResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listProvidersResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListProvidersResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListProvidersResponse) MarshalJSON() ([]byte, error) { - pb, err := listProvidersResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListProvidersResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // List share recipients type ListRecipientsRequest struct { // If not provided, all recipients will be returned. If no recipients exist // with this ID, no results will be returned. - DataRecipientGlobalMetastoreId string `json:"-" tf:"-"` + DataRecipientGlobalMetastoreId string `json:"-" url:"data_recipient_global_metastore_id,omitempty"` // Maximum number of recipients to return. - when set to 0, the page length // is set to a server configured value (recommended); - when set to a value // greater than 0, the page length is the minimum of this value and a server @@ -1525,74 +758,38 @@ type ListRecipientsRequest struct { // than the specified max_results size, even zero. The only definitive // indication that no further recipients can be fetched is when the // next_page_token is unset from the response. - MaxResults int `json:"-" tf:"-"` + MaxResults int `json:"-" url:"max_results,omitempty"` // Opaque pagination token to go to next page based on previous query. - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListRecipientsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listRecipientsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listRecipientsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListRecipientsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListRecipientsRequest) MarshalJSON() ([]byte, error) { - pb, err := listRecipientsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListRecipientsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListRecipientsResponse struct { // Opaque token to retrieve the next page of results. Absent if there are no // more pages. __page_token__ should be set to this value for the next // request (for the next page of results). - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` // An array of recipient information objects. - // Wire name: 'recipients' Recipients []RecipientInfo `json:"recipients,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListRecipientsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listRecipientsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listRecipientsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListRecipientsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListRecipientsResponse) MarshalJSON() ([]byte, error) { - pb, err := listRecipientsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListRecipientsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // List shares by Provider @@ -1606,124 +803,65 @@ type ListSharesRequest struct { // the specified max_results size, even zero. The only definitive indication // that no further shares can be fetched is when the next_page_token is // unset from the response. - MaxResults int `json:"-" tf:"-"` + MaxResults int `json:"-" url:"max_results,omitempty"` // Name of the provider in which to list shares. - Name string `json:"-" tf:"-"` + Name string `json:"-" url:"-"` // Opaque pagination token to go to next page based on previous query. - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListSharesRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listSharesRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listSharesRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListSharesRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListSharesRequest) MarshalJSON() ([]byte, error) { - pb, err := listSharesRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListSharesRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListSharesResponse struct { // Opaque token to retrieve the next page of results. Absent if there are no // more pages. __page_token__ should be set to this value for the next // request (for the next page of results). - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` // An array of data share information objects. - // Wire name: 'shares' Shares []ShareInfo `json:"shares,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListSharesResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listSharesResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listSharesResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListSharesResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListSharesResponse) MarshalJSON() ([]byte, error) { - pb, err := listSharesResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListSharesResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type NotebookFile struct { // The comment of the notebook file. - // Wire name: 'comment' Comment string `json:"comment,omitempty"` // The id of the notebook file. - // Wire name: 'id' Id string `json:"id,omitempty"` // Name of the notebook file. - // Wire name: 'name' Name string `json:"name,omitempty"` // The name of the share that the notebook file belongs to. - // Wire name: 'share' Share string `json:"share,omitempty"` // The id of the share that the notebook file belongs to. - // Wire name: 'share_id' ShareId string `json:"share_id,omitempty"` // The tags of the notebook file. - // Wire name: 'tags' Tags []catalog.TagKeyValue `json:"tags,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *NotebookFile) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := ¬ebookFilePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := notebookFileFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *NotebookFile) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st NotebookFile) MarshalJSON() ([]byte, error) { - pb, err := notebookFileToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s NotebookFile) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Specifies the policy to use for validating OIDC claims in your federated @@ -1735,11 +873,9 @@ type OidcFederationPolicy struct { // tokens. The audience identifier is intended to represent the recipient of // the token. Can be any non-empty string value. As long as the audience in // the token matches at least one audience in the policy, - // Wire name: 'audiences' Audiences []string `json:"audiences,omitempty"` // The required token issuer, as specified in the 'iss' claim of federated // tokens. - // Wire name: 'issuer' Issuer string `json:"issuer"` // The required token subject, as specified in the subject claim of // federated tokens. The subject claim identifies the identity of the user @@ -1749,7 +885,6 @@ type OidcFederationPolicy struct { // subject claim is `oid`, this must be the Object ID of the user in Entra // ID. - M2M flow (OAuth App access): If the subject claim is `azp`, this // must be the client ID of the OAuth app registered in Entra ID. - // Wire name: 'subject' Subject string `json:"subject"` // The claim that contains the subject of the token. Depending on the // identity provider and the use case (U2M or M2M), this can vary: - For @@ -1760,110 +895,37 @@ type OidcFederationPolicy struct { // Supported `subject_claim` values are: - `oid`: Object ID of the user. - // `azp`: Client ID of the OAuth app. - `groups`: Object ID of the group. - // `sub`: Subject identifier for other use cases. - // Wire name: 'subject_claim' SubjectClaim string `json:"subject_claim"` } -func (st *OidcFederationPolicy) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &oidcFederationPolicyPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := oidcFederationPolicyFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st OidcFederationPolicy) MarshalJSON() ([]byte, error) { - pb, err := oidcFederationPolicyToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type Partition struct { // An array of partition values. - // Wire name: 'values' Values []PartitionValue `json:"values,omitempty"` } -func (st *Partition) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &partitionPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := partitionFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st Partition) MarshalJSON() ([]byte, error) { - pb, err := partitionToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type PartitionValue struct { // The name of the partition column. - // Wire name: 'name' Name string `json:"name,omitempty"` // The operator to apply for the value. - // Wire name: 'op' Op PartitionValueOp `json:"op,omitempty"` // The key of a Delta Sharing recipient's property. For example // "databricks-account-id". When this field is set, field `value` can not be // set. - // Wire name: 'recipient_property_key' RecipientPropertyKey string `json:"recipient_property_key,omitempty"` // The value of the partition column. When this value is not set, it means // `null` value. When this field is set, field `recipient_property_key` can // not be set. - // Wire name: 'value' Value string `json:"value,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *PartitionValue) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &partitionValuePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := partitionValueFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *PartitionValue) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st PartitionValue) MarshalJSON() ([]byte, error) { - pb, err := partitionValueToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s PartitionValue) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type PartitionValueOp string @@ -1905,41 +967,21 @@ func (f *PartitionValueOp) Type() string { type PermissionsChange struct { // The set of privileges to add. - // Wire name: 'add' Add []string `json:"add,omitempty"` // The principal whose privileges we are changing. - // Wire name: 'principal' Principal string `json:"principal,omitempty"` // The set of privileges to remove. - // Wire name: 'remove' Remove []string `json:"remove,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *PermissionsChange) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &permissionsChangePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := permissionsChangeFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *PermissionsChange) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st PermissionsChange) MarshalJSON() ([]byte, error) { - pb, err := permissionsChangeToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s PermissionsChange) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type Privilege string @@ -2110,449 +1152,236 @@ func (f *Privilege) Type() string { type PrivilegeAssignment struct { // The principal (user email address or group name). - // Wire name: 'principal' Principal string `json:"principal,omitempty"` // The privileges assigned to the principal. - // Wire name: 'privileges' Privileges []Privilege `json:"privileges,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *PrivilegeAssignment) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &privilegeAssignmentPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := privilegeAssignmentFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *PrivilegeAssignment) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st PrivilegeAssignment) MarshalJSON() ([]byte, error) { - pb, err := privilegeAssignmentToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s PrivilegeAssignment) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ProviderInfo struct { // The delta sharing authentication type. - // Wire name: 'authentication_type' AuthenticationType AuthenticationType `json:"authentication_type,omitempty"` // Cloud vendor of the provider's UC metastore. This field is only present // when the __authentication_type__ is **DATABRICKS**. - // Wire name: 'cloud' Cloud string `json:"cloud,omitempty"` // Description about the provider. - // Wire name: 'comment' Comment string `json:"comment,omitempty"` // Time at which this Provider was created, in epoch milliseconds. - // Wire name: 'created_at' CreatedAt int64 `json:"created_at,omitempty"` // Username of Provider creator. - // Wire name: 'created_by' CreatedBy string `json:"created_by,omitempty"` // The global UC metastore id of the data provider. This field is only // present when the __authentication_type__ is **DATABRICKS**. The // identifier is of format __cloud__:__region__:__metastore-uuid__. - // Wire name: 'data_provider_global_metastore_id' DataProviderGlobalMetastoreId string `json:"data_provider_global_metastore_id,omitempty"` // UUID of the provider's UC metastore. This field is only present when the // __authentication_type__ is **DATABRICKS**. - // Wire name: 'metastore_id' MetastoreId string `json:"metastore_id,omitempty"` // The name of the Provider. - // Wire name: 'name' Name string `json:"name,omitempty"` // Username of Provider owner. - // Wire name: 'owner' Owner string `json:"owner,omitempty"` // The recipient profile. This field is only present when the // authentication_type is `TOKEN` or `OAUTH_CLIENT_CREDENTIALS`. - // Wire name: 'recipient_profile' RecipientProfile *RecipientProfile `json:"recipient_profile,omitempty"` // This field is required when the __authentication_type__ is **TOKEN**, // **OAUTH_CLIENT_CREDENTIALS** or not provided. - // Wire name: 'recipient_profile_str' RecipientProfileStr string `json:"recipient_profile_str,omitempty"` // Cloud region of the provider's UC metastore. This field is only present // when the __authentication_type__ is **DATABRICKS**. - // Wire name: 'region' Region string `json:"region,omitempty"` // Time at which this Provider was created, in epoch milliseconds. - // Wire name: 'updated_at' UpdatedAt int64 `json:"updated_at,omitempty"` // Username of user who last modified Provider. - // Wire name: 'updated_by' UpdatedBy string `json:"updated_by,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ProviderInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &providerInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := providerInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ProviderInfo) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ProviderInfo) MarshalJSON() ([]byte, error) { - pb, err := providerInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ProviderInfo) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ProviderShare struct { // The name of the Provider Share. - // Wire name: 'name' Name string `json:"name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ProviderShare) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &providerSharePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := providerShareFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ProviderShare) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ProviderShare) MarshalJSON() ([]byte, error) { - pb, err := providerShareToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ProviderShare) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type RecipientInfo struct { // A boolean status field showing whether the Recipient's activation URL has // been exercised or not. - // Wire name: 'activated' Activated bool `json:"activated,omitempty"` // Full activation url to retrieve the access token. It will be empty if the // token is already retrieved. - // Wire name: 'activation_url' ActivationUrl string `json:"activation_url,omitempty"` // The delta sharing authentication type. - // Wire name: 'authentication_type' AuthenticationType AuthenticationType `json:"authentication_type,omitempty"` // Cloud vendor of the recipient's Unity Catalog Metastore. This field is // only present when the __authentication_type__ is **DATABRICKS**. - // Wire name: 'cloud' Cloud string `json:"cloud,omitempty"` // Description about the recipient. - // Wire name: 'comment' Comment string `json:"comment,omitempty"` // Time at which this recipient was created, in epoch milliseconds. - // Wire name: 'created_at' CreatedAt int64 `json:"created_at,omitempty"` // Username of recipient creator. - // Wire name: 'created_by' CreatedBy string `json:"created_by,omitempty"` // The global Unity Catalog metastore id provided by the data recipient. // This field is only present when the __authentication_type__ is // **DATABRICKS**. The identifier is of format // __cloud__:__region__:__metastore-uuid__. - // Wire name: 'data_recipient_global_metastore_id' DataRecipientGlobalMetastoreId string `json:"data_recipient_global_metastore_id,omitempty"` // Expiration timestamp of the token, in epoch milliseconds. - // Wire name: 'expiration_time' ExpirationTime int64 `json:"expiration_time,omitempty"` // IP Access List - // Wire name: 'ip_access_list' IpAccessList *IpAccessList `json:"ip_access_list,omitempty"` // Unique identifier of recipient's Unity Catalog Metastore. This field is // only present when the __authentication_type__ is **DATABRICKS**. - // Wire name: 'metastore_id' MetastoreId string `json:"metastore_id,omitempty"` // Name of Recipient. - // Wire name: 'name' Name string `json:"name,omitempty"` // Username of the recipient owner. - // Wire name: 'owner' Owner string `json:"owner,omitempty"` // Recipient properties as map of string key-value pairs. When provided in // update request, the specified properties will override the existing // properties. To add and remove properties, one would need to perform a // read-modify-write. - // Wire name: 'properties_kvpairs' PropertiesKvpairs *SecurablePropertiesKvPairs `json:"properties_kvpairs,omitempty"` // Cloud region of the recipient's Unity Catalog Metastore. This field is // only present when the __authentication_type__ is **DATABRICKS**. - // Wire name: 'region' Region string `json:"region,omitempty"` // The one-time sharing code provided by the data recipient. This field is // only present when the __authentication_type__ is **DATABRICKS**. - // Wire name: 'sharing_code' SharingCode string `json:"sharing_code,omitempty"` // This field is only present when the __authentication_type__ is **TOKEN**. - // Wire name: 'tokens' Tokens []RecipientTokenInfo `json:"tokens,omitempty"` // Time at which the recipient was updated, in epoch milliseconds. - // Wire name: 'updated_at' UpdatedAt int64 `json:"updated_at,omitempty"` // Username of recipient updater. - // Wire name: 'updated_by' UpdatedBy string `json:"updated_by,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *RecipientInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &recipientInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := recipientInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *RecipientInfo) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st RecipientInfo) MarshalJSON() ([]byte, error) { - pb, err := recipientInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s RecipientInfo) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type RecipientProfile struct { // The token used to authorize the recipient. - // Wire name: 'bearer_token' BearerToken string `json:"bearer_token,omitempty"` // The endpoint for the share to be used by the recipient. - // Wire name: 'endpoint' Endpoint string `json:"endpoint,omitempty"` // The version number of the recipient's credentials on a share. - // Wire name: 'share_credentials_version' ShareCredentialsVersion int `json:"share_credentials_version,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *RecipientProfile) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &recipientProfilePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := recipientProfileFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *RecipientProfile) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st RecipientProfile) MarshalJSON() ([]byte, error) { - pb, err := recipientProfileToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s RecipientProfile) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type RecipientTokenInfo struct { // Full activation URL to retrieve the access token. It will be empty if the // token is already retrieved. - // Wire name: 'activation_url' ActivationUrl string `json:"activation_url,omitempty"` // Time at which this recipient token was created, in epoch milliseconds. - // Wire name: 'created_at' CreatedAt int64 `json:"created_at,omitempty"` // Username of recipient token creator. - // Wire name: 'created_by' CreatedBy string `json:"created_by,omitempty"` // Expiration timestamp of the token in epoch milliseconds. - // Wire name: 'expiration_time' ExpirationTime int64 `json:"expiration_time,omitempty"` // Unique ID of the recipient token. - // Wire name: 'id' Id string `json:"id,omitempty"` // Time at which this recipient token was updated, in epoch milliseconds. - // Wire name: 'updated_at' UpdatedAt int64 `json:"updated_at,omitempty"` // Username of recipient token updater. - // Wire name: 'updated_by' UpdatedBy string `json:"updated_by,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *RecipientTokenInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &recipientTokenInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := recipientTokenInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *RecipientTokenInfo) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st RecipientTokenInfo) MarshalJSON() ([]byte, error) { - pb, err := recipientTokenInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s RecipientTokenInfo) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type RegisteredModelAlias struct { // Name of the alias. - // Wire name: 'alias_name' AliasName string `json:"alias_name,omitempty"` // Numeric model version that alias will reference. - // Wire name: 'version_num' VersionNum int64 `json:"version_num,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *RegisteredModelAlias) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := ®isteredModelAliasPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := registeredModelAliasFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *RegisteredModelAlias) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st RegisteredModelAlias) MarshalJSON() ([]byte, error) { - pb, err := registeredModelAliasToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s RegisteredModelAlias) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get an access token type RetrieveTokenRequest struct { // The one time activation url. It also accepts activation token. - ActivationUrl string `json:"-" tf:"-"` -} - -func (st *RetrieveTokenRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &retrieveTokenRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := retrieveTokenRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st RetrieveTokenRequest) MarshalJSON() ([]byte, error) { - pb, err := retrieveTokenRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + ActivationUrl string `json:"-" url:"-"` } type RetrieveTokenResponse struct { // The token used to authorize the recipient. - // Wire name: 'bearerToken' BearerToken string `json:"bearerToken,omitempty"` // The endpoint for the share to be used by the recipient. - // Wire name: 'endpoint' Endpoint string `json:"endpoint,omitempty"` // Expiration timestamp of the token in epoch milliseconds. - // Wire name: 'expirationTime' ExpirationTime string `json:"expirationTime,omitempty"` // These field names must follow the delta sharing protocol. - // Wire name: 'shareCredentialsVersion' ShareCredentialsVersion int `json:"shareCredentialsVersion,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *RetrieveTokenResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &retrieveTokenResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := retrieveTokenResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *RetrieveTokenResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st RetrieveTokenResponse) MarshalJSON() ([]byte, error) { - pb, err := retrieveTokenResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s RetrieveTokenResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type RotateRecipientToken struct { @@ -2560,128 +1389,49 @@ type RotateRecipientToken struct { // the expiration_time of existing token only to a smaller timestamp, it // cannot extend the expiration_time. Use 0 to expire the existing token // immediately, negative number will return an error. - // Wire name: 'existing_token_expire_in_seconds' ExistingTokenExpireInSeconds int64 `json:"existing_token_expire_in_seconds"` // The name of the Recipient. - Name string `json:"-" tf:"-"` -} - -func (st *RotateRecipientToken) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &rotateRecipientTokenPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := rotateRecipientTokenFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st RotateRecipientToken) MarshalJSON() ([]byte, error) { - pb, err := rotateRecipientTokenToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Name string `json:"-" url:"-"` } // An object with __properties__ containing map of key-value properties attached // to the securable. type SecurablePropertiesKvPairs struct { // A map of key-value properties attached to the securable. - // Wire name: 'properties' Properties map[string]string `json:"properties"` } -func (st *SecurablePropertiesKvPairs) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &securablePropertiesKvPairsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := securablePropertiesKvPairsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st SecurablePropertiesKvPairs) MarshalJSON() ([]byte, error) { - pb, err := securablePropertiesKvPairsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type ShareInfo struct { // User-provided free-form text description. - // Wire name: 'comment' Comment string `json:"comment,omitempty"` // Time at which this share was created, in epoch milliseconds. - // Wire name: 'created_at' CreatedAt int64 `json:"created_at,omitempty"` // Username of share creator. - // Wire name: 'created_by' CreatedBy string `json:"created_by,omitempty"` // Name of the share. - // Wire name: 'name' Name string `json:"name,omitempty"` // A list of shared data objects within the share. - // Wire name: 'objects' Objects []SharedDataObject `json:"objects,omitempty"` // Username of current owner of share. - // Wire name: 'owner' Owner string `json:"owner,omitempty"` // Storage Location URL (full path) for the share. - // Wire name: 'storage_location' StorageLocation string `json:"storage_location,omitempty"` // Storage root URL for the share. - // Wire name: 'storage_root' StorageRoot string `json:"storage_root,omitempty"` // Time at which this share was updated, in epoch milliseconds. - // Wire name: 'updated_at' UpdatedAt int64 `json:"updated_at,omitempty"` // Username of share updater. - // Wire name: 'updated_by' UpdatedBy string `json:"updated_by,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ShareInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &shareInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := shareInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ShareInfo) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ShareInfo) MarshalJSON() ([]byte, error) { - pb, err := shareInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ShareInfo) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get recipient share permissions @@ -2695,115 +1445,69 @@ type SharePermissionsRequest struct { // than the specified max_results size, even zero. The only definitive // indication that no further permissions can be fetched is when the // next_page_token is unset from the response. - MaxResults int `json:"-" tf:"-"` + MaxResults int `json:"-" url:"max_results,omitempty"` // The name of the Recipient. - Name string `json:"-" tf:"-"` + Name string `json:"-" url:"-"` // Opaque pagination token to go to next page based on previous query. - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *SharePermissionsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &sharePermissionsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := sharePermissionsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *SharePermissionsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st SharePermissionsRequest) MarshalJSON() ([]byte, error) { - pb, err := sharePermissionsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s SharePermissionsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ShareToPrivilegeAssignment struct { // The privileges assigned to the principal. - // Wire name: 'privilege_assignments' PrivilegeAssignments []PrivilegeAssignment `json:"privilege_assignments,omitempty"` // The share name. - // Wire name: 'share_name' ShareName string `json:"share_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ShareToPrivilegeAssignment) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &shareToPrivilegeAssignmentPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := shareToPrivilegeAssignmentFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ShareToPrivilegeAssignment) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ShareToPrivilegeAssignment) MarshalJSON() ([]byte, error) { - pb, err := shareToPrivilegeAssignmentToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ShareToPrivilegeAssignment) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type SharedDataObject struct { // The time when this data object is added to the share, in epoch // milliseconds. - // Wire name: 'added_at' AddedAt int64 `json:"added_at,omitempty"` // Username of the sharer. - // Wire name: 'added_by' AddedBy string `json:"added_by,omitempty"` // Whether to enable cdf or indicate if cdf is enabled on the shared object. - // Wire name: 'cdf_enabled' CdfEnabled bool `json:"cdf_enabled,omitempty"` // A user-provided comment when adding the data object to the share. - // Wire name: 'comment' Comment string `json:"comment,omitempty"` // The content of the notebook file when the data object type is // NOTEBOOK_FILE. This should be base64 encoded. Required for adding a // NOTEBOOK_FILE, optional for updating, ignored for other types. - // Wire name: 'content' Content string `json:"content,omitempty"` // The type of the data object. - // Wire name: 'data_object_type' DataObjectType SharedDataObjectDataObjectType `json:"data_object_type,omitempty"` // Whether to enable or disable sharing of data history. If not specified, // the default is **DISABLED**. - // Wire name: 'history_data_sharing_status' HistoryDataSharingStatus SharedDataObjectHistoryDataSharingStatus `json:"history_data_sharing_status,omitempty"` // A fully qualified name that uniquely identifies a data object. For // example, a table's fully qualified name is in the format of // `..`, - // Wire name: 'name' Name string `json:"name"` // Array of partitions for the shared data. - // Wire name: 'partitions' Partitions []Partition `json:"partitions,omitempty"` // A user-provided new name for the data object within the share. If this // new name is not provided, the object's original name will be used as the // `shared_as` name. The `shared_as` name must be unique within a share. For // tables, the new name must follow the format of `.
`. - // Wire name: 'shared_as' SharedAs string `json:"shared_as,omitempty"` // The start version associated with the object. This allows data providers // to control the lowest object version that is accessible by clients. If @@ -2812,45 +1516,25 @@ type SharedDataObject struct { // version of the object at the time it was added to the share. // // NOTE: The start_version should be <= the `current` version of the object. - // Wire name: 'start_version' StartVersion int64 `json:"start_version,omitempty"` // One of: **ACTIVE**, **PERMISSION_DENIED**. - // Wire name: 'status' Status SharedDataObjectStatus `json:"status,omitempty"` // A user-provided new name for the shared object within the share. If this // new name is not not provided, the object's original name will be used as // the `string_shared_as` name. The `string_shared_as` name must be unique // for objects of the same type within a Share. For notebooks, the new name // should be the new notebook file name. - // Wire name: 'string_shared_as' StringSharedAs string `json:"string_shared_as,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *SharedDataObject) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &sharedDataObjectPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := sharedDataObjectFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *SharedDataObject) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st SharedDataObject) MarshalJSON() ([]byte, error) { - pb, err := sharedDataObjectToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s SharedDataObject) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type SharedDataObjectDataObjectType string @@ -2987,38 +1671,11 @@ func (f *SharedDataObjectStatus) Type() string { type SharedDataObjectUpdate struct { // One of: **ADD**, **REMOVE**, **UPDATE**. - // Wire name: 'action' Action SharedDataObjectUpdateAction `json:"action,omitempty"` // The data object that is being added, removed, or updated. - // Wire name: 'data_object' DataObject *SharedDataObject `json:"data_object,omitempty"` } -func (st *SharedDataObjectUpdate) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &sharedDataObjectUpdatePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := sharedDataObjectUpdateFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st SharedDataObjectUpdate) MarshalJSON() ([]byte, error) { - pb, err := sharedDataObjectUpdateToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type SharedDataObjectUpdateAction string const SharedDataObjectUpdateActionAdd SharedDataObjectUpdateAction = `ADD` @@ -3102,63 +1759,36 @@ func (f *SharedSecurableKind) Type() string { type Table struct { // The comment of the table. - // Wire name: 'comment' Comment string `json:"comment,omitempty"` // The id of the table. - // Wire name: 'id' Id string `json:"id,omitempty"` // Internal information for D2D sharing that should not be disclosed to // external users. - // Wire name: 'internal_attributes' InternalAttributes *TableInternalAttributes `json:"internal_attributes,omitempty"` // The catalog and schema of the materialized table - // Wire name: 'materialization_namespace' MaterializationNamespace string `json:"materialization_namespace,omitempty"` // The name of a materialized table. - // Wire name: 'materialized_table_name' MaterializedTableName string `json:"materialized_table_name,omitempty"` // The name of the table. - // Wire name: 'name' Name string `json:"name,omitempty"` // The name of the schema that the table belongs to. - // Wire name: 'schema' Schema string `json:"schema,omitempty"` // The name of the share that the table belongs to. - // Wire name: 'share' Share string `json:"share,omitempty"` // The id of the share that the table belongs to. - // Wire name: 'share_id' ShareId string `json:"share_id,omitempty"` // The Tags of the table. - // Wire name: 'tags' Tags []catalog.TagKeyValue `json:"tags,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *Table) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &tablePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := tableFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *Table) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st Table) MarshalJSON() ([]byte, error) { - pb, err := tableToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s Table) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Internal information for D2D sharing that should not be disclosed to external @@ -3172,45 +1802,24 @@ type TableInternalAttributes struct { // on the recipient side to be whitelisted when SEG is enabled on the // workspace of the recipient, to allow the recipient users to query this // shared VIEW/FOREIGN_TABLE. - // Wire name: 'parent_storage_location' ParentStorageLocation string `json:"parent_storage_location,omitempty"` // The cloud storage location of a shard table with DIRECTORY_BASED_TABLE // type. - // Wire name: 'storage_location' StorageLocation string `json:"storage_location,omitempty"` // The type of the shared table. - // Wire name: 'type' Type TableInternalAttributesSharedTableType `json:"type,omitempty"` // The view definition of a shared view. DEPRECATED. - // Wire name: 'view_definition' ViewDefinition string `json:"view_definition,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *TableInternalAttributes) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &tableInternalAttributesPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := tableInternalAttributesFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *TableInternalAttributes) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st TableInternalAttributes) MarshalJSON() ([]byte, error) { - pb, err := tableInternalAttributesToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s TableInternalAttributes) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type TableInternalAttributesSharedTableType string @@ -3265,355 +1874,182 @@ func (f *TableInternalAttributesSharedTableType) Type() string { // Update recipient federation policy type UpdateFederationPolicyRequest struct { // Name of the policy. This is the name of the current name of the policy. - Name string `json:"-" tf:"-"` + Name string `json:"-" url:"-"` - // Wire name: 'policy' Policy FederationPolicy `json:"policy"` // Name of the recipient. This is the name of the recipient for which the // policy is being updated. - RecipientName string `json:"-" tf:"-"` + RecipientName string `json:"-" url:"-"` // The field mask specifies which fields of the policy to update. To specify // multiple fields in the field mask, use comma as the separator (no space). // The special value '*' indicates that all fields should be updated (full // replacement). If unspecified, all fields that are set in the policy // provided in the update request will overwrite the corresponding fields in // the existing policy. Example value: 'comment,oidc_policy.audiences'. - UpdateMask string `json:"-" tf:"-"` + UpdateMask string `json:"-" url:"update_mask,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *UpdateFederationPolicyRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateFederationPolicyRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateFederationPolicyRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *UpdateFederationPolicyRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st UpdateFederationPolicyRequest) MarshalJSON() ([]byte, error) { - pb, err := updateFederationPolicyRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s UpdateFederationPolicyRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type UpdateProvider struct { // Description about the provider. - // Wire name: 'comment' Comment string `json:"comment,omitempty"` // Name of the provider. - Name string `json:"-" tf:"-"` + Name string `json:"-" url:"-"` // New name for the provider. - // Wire name: 'new_name' NewName string `json:"new_name,omitempty"` // Username of Provider owner. - // Wire name: 'owner' Owner string `json:"owner,omitempty"` // This field is required when the __authentication_type__ is **TOKEN**, // **OAUTH_CLIENT_CREDENTIALS** or not provided. - // Wire name: 'recipient_profile_str' RecipientProfileStr string `json:"recipient_profile_str,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *UpdateProvider) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateProviderPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateProviderFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *UpdateProvider) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st UpdateProvider) MarshalJSON() ([]byte, error) { - pb, err := updateProviderToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s UpdateProvider) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type UpdateRecipient struct { // Description about the recipient. - // Wire name: 'comment' Comment string `json:"comment,omitempty"` // Expiration timestamp of the token, in epoch milliseconds. - // Wire name: 'expiration_time' ExpirationTime int64 `json:"expiration_time,omitempty"` // IP Access List - // Wire name: 'ip_access_list' IpAccessList *IpAccessList `json:"ip_access_list,omitempty"` // Name of the recipient. - Name string `json:"-" tf:"-"` + Name string `json:"-" url:"-"` // New name for the recipient. . - // Wire name: 'new_name' NewName string `json:"new_name,omitempty"` // Username of the recipient owner. - // Wire name: 'owner' Owner string `json:"owner,omitempty"` // Recipient properties as map of string key-value pairs. When provided in // update request, the specified properties will override the existing // properties. To add and remove properties, one would need to perform a // read-modify-write. - // Wire name: 'properties_kvpairs' PropertiesKvpairs *SecurablePropertiesKvPairs `json:"properties_kvpairs,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *UpdateRecipient) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateRecipientPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateRecipientFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *UpdateRecipient) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st UpdateRecipient) MarshalJSON() ([]byte, error) { - pb, err := updateRecipientToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s UpdateRecipient) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type UpdateShare struct { // User-provided free-form text description. - // Wire name: 'comment' Comment string `json:"comment,omitempty"` // The name of the share. - Name string `json:"-" tf:"-"` + Name string `json:"-" url:"-"` // New name for the share. - // Wire name: 'new_name' NewName string `json:"new_name,omitempty"` // Username of current owner of share. - // Wire name: 'owner' Owner string `json:"owner,omitempty"` // Storage root URL for the share. - // Wire name: 'storage_root' StorageRoot string `json:"storage_root,omitempty"` // Array of shared data object updates. - // Wire name: 'updates' Updates []SharedDataObjectUpdate `json:"updates,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *UpdateShare) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateSharePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateShareFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *UpdateShare) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st UpdateShare) MarshalJSON() ([]byte, error) { - pb, err := updateShareToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s UpdateShare) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type UpdateSharePermissions struct { // Array of permissions change objects. - // Wire name: 'changes' Changes []PermissionsChange `json:"changes,omitempty"` // The name of the share. - Name string `json:"-" tf:"-"` + Name string `json:"-" url:"-"` // Optional. Whether to return the latest permissions list of the share in // the response. - // Wire name: 'omit_permissions_list' OmitPermissionsList bool `json:"omit_permissions_list,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *UpdateSharePermissions) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateSharePermissionsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateSharePermissionsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *UpdateSharePermissions) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st UpdateSharePermissions) MarshalJSON() ([]byte, error) { - pb, err := updateSharePermissionsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s UpdateSharePermissions) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type UpdateSharePermissionsResponse struct { // The privileges assigned to each principal - // Wire name: 'privilege_assignments' PrivilegeAssignments []PrivilegeAssignment `json:"privilege_assignments,omitempty"` } -func (st *UpdateSharePermissionsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateSharePermissionsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateSharePermissionsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateSharePermissionsResponse) MarshalJSON() ([]byte, error) { - pb, err := updateSharePermissionsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type Volume struct { // The comment of the volume. - // Wire name: 'comment' Comment string `json:"comment,omitempty"` // This id maps to the shared_volume_id in database Recipient needs // shared_volume_id for recon to check if this volume is already in // recipient's DB or not. - // Wire name: 'id' Id string `json:"id,omitempty"` // Internal attributes for D2D sharing that should not be disclosed to // external users. - // Wire name: 'internal_attributes' InternalAttributes *VolumeInternalAttributes `json:"internal_attributes,omitempty"` // The name of the volume. - // Wire name: 'name' Name string `json:"name,omitempty"` // The name of the schema that the volume belongs to. - // Wire name: 'schema' Schema string `json:"schema,omitempty"` // The name of the share that the volume belongs to. - // Wire name: 'share' Share string `json:"share,omitempty"` // / The id of the share that the volume belongs to. - // Wire name: 'share_id' ShareId string `json:"share_id,omitempty"` // The tags of the volume. - // Wire name: 'tags' Tags []catalog.TagKeyValue `json:"tags,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *Volume) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &volumePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := volumeFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *Volume) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st Volume) MarshalJSON() ([]byte, error) { - pb, err := volumeToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s Volume) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Internal information for D2D sharing that should not be disclosed to external // users. type VolumeInternalAttributes struct { // The cloud storage location of the volume - // Wire name: 'storage_location' StorageLocation string `json:"storage_location,omitempty"` // The type of the shared volume. - // Wire name: 'type' Type string `json:"type,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *VolumeInternalAttributes) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &volumeInternalAttributesPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := volumeInternalAttributesFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *VolumeInternalAttributes) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st VolumeInternalAttributes) MarshalJSON() ([]byte, error) { - pb, err := volumeInternalAttributesToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s VolumeInternalAttributes) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } diff --git a/service/sql/impl.go b/service/sql/impl.go index 0767b4c61..97071ebd9 100755 --- a/service/sql/impl.go +++ b/service/sql/impl.go @@ -18,96 +18,34 @@ type alertsImpl struct { } func (a *alertsImpl) Create(ctx context.Context, request CreateAlertRequest) (*Alert, error) { - - requestPb, pbErr := createAlertRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var alertPb alertPb + var alert Alert path := "/api/2.0/sql/alerts" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &alertPb, - ) - if err != nil { - return nil, err - } - resp, err := alertFromPb(&alertPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &alert) + return &alert, err } func (a *alertsImpl) Delete(ctx context.Context, request TrashAlertRequest) error { - - requestPb, pbErr := trashAlertRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var emptyPb emptyPb - path := fmt.Sprintf("/api/2.0/sql/alerts/%v", requestPb.Id) + var empty Empty + path := fmt.Sprintf("/api/2.0/sql/alerts/%v", request.Id) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &emptyPb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &empty) return err } func (a *alertsImpl) Get(ctx context.Context, request GetAlertRequest) (*Alert, error) { - - requestPb, pbErr := getAlertRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var alertPb alertPb - path := fmt.Sprintf("/api/2.0/sql/alerts/%v", requestPb.Id) + var alert Alert + path := fmt.Sprintf("/api/2.0/sql/alerts/%v", request.Id) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &alertPb, - ) - if err != nil { - return nil, err - } - resp, err := alertFromPb(&alertPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &alert) + return &alert, err } // Gets a list of alerts accessible to the user, ordered by creation time. @@ -146,68 +84,24 @@ func (a *alertsImpl) ListAll(ctx context.Context, request ListAlertsRequest) ([] } func (a *alertsImpl) internalList(ctx context.Context, request ListAlertsRequest) (*ListAlertsResponse, error) { - - requestPb, pbErr := listAlertsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listAlertsResponsePb listAlertsResponsePb + var listAlertsResponse ListAlertsResponse path := "/api/2.0/sql/alerts" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listAlertsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listAlertsResponseFromPb(&listAlertsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listAlertsResponse) + return &listAlertsResponse, err } func (a *alertsImpl) Update(ctx context.Context, request UpdateAlertRequest) (*Alert, error) { - - requestPb, pbErr := updateAlertRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var alertPb alertPb - path := fmt.Sprintf("/api/2.0/sql/alerts/%v", requestPb.Id) + var alert Alert + path := fmt.Sprintf("/api/2.0/sql/alerts/%v", request.Id) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &alertPb, - ) - if err != nil { - return nil, err - } - resp, err := alertFromPb(&alertPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &alert) + return &alert, err } // unexported type that holds implementations of just AlertsLegacy API methods @@ -216,155 +110,54 @@ type alertsLegacyImpl struct { } func (a *alertsLegacyImpl) Create(ctx context.Context, request CreateAlert) (*LegacyAlert, error) { - - requestPb, pbErr := createAlertToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var legacyAlertPb legacyAlertPb + var legacyAlert LegacyAlert path := "/api/2.0/preview/sql/alerts" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &legacyAlertPb, - ) - if err != nil { - return nil, err - } - resp, err := legacyAlertFromPb(&legacyAlertPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &legacyAlert) + return &legacyAlert, err } func (a *alertsLegacyImpl) Delete(ctx context.Context, request DeleteAlertsLegacyRequest) error { - - requestPb, pbErr := deleteAlertsLegacyRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteResponsePb deleteResponsePb - path := fmt.Sprintf("/api/2.0/preview/sql/alerts/%v", requestPb.AlertId) + var deleteResponse DeleteResponse + path := fmt.Sprintf("/api/2.0/preview/sql/alerts/%v", request.AlertId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteResponse) return err } func (a *alertsLegacyImpl) Get(ctx context.Context, request GetAlertsLegacyRequest) (*LegacyAlert, error) { - - requestPb, pbErr := getAlertsLegacyRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var legacyAlertPb legacyAlertPb - path := fmt.Sprintf("/api/2.0/preview/sql/alerts/%v", requestPb.AlertId) + var legacyAlert LegacyAlert + path := fmt.Sprintf("/api/2.0/preview/sql/alerts/%v", request.AlertId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &legacyAlertPb, - ) - if err != nil { - return nil, err - } - resp, err := legacyAlertFromPb(&legacyAlertPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &legacyAlert) + return &legacyAlert, err } func (a *alertsLegacyImpl) List(ctx context.Context) ([]LegacyAlert, error) { - - var legacyAlertListPb []legacyAlertPb + var legacyAlertList []LegacyAlert path := "/api/2.0/preview/sql/alerts" headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - nil, - nil, - &legacyAlertListPb, - ) - if err != nil { - return nil, err - } - var resp []LegacyAlert - for _, item := range legacyAlertListPb { - itemResp, err := legacyAlertFromPb(&item) - if err != nil { - return nil, err - } - resp = append(resp, *itemResp) - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, nil, nil, &legacyAlertList) + return legacyAlertList, err } func (a *alertsLegacyImpl) Update(ctx context.Context, request EditAlert) error { - - requestPb, pbErr := editAlertToPb(&request) - if pbErr != nil { - return pbErr - } - - var updateResponsePb updateResponsePb - path := fmt.Sprintf("/api/2.0/preview/sql/alerts/%v", requestPb.AlertId) + var updateResponse UpdateResponse + path := fmt.Sprintf("/api/2.0/preview/sql/alerts/%v", request.AlertId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPut, - path, - headers, - queryParams, - (*requestPb), - &updateResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &updateResponse) return err } @@ -374,68 +167,24 @@ type alertsV2Impl struct { } func (a *alertsV2Impl) CreateAlert(ctx context.Context, request CreateAlertV2Request) (*AlertV2, error) { - - requestPb, pbErr := createAlertV2RequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var alertV2Pb alertV2Pb + var alertV2 AlertV2 path := "/api/2.0/alerts" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb).Alert, - &alertV2Pb, - ) - if err != nil { - return nil, err - } - resp, err := alertV2FromPb(&alertV2Pb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.Alert, &alertV2) + return &alertV2, err } func (a *alertsV2Impl) GetAlert(ctx context.Context, request GetAlertV2Request) (*AlertV2, error) { - - requestPb, pbErr := getAlertV2RequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var alertV2Pb alertV2Pb - path := fmt.Sprintf("/api/2.0/alerts/%v", requestPb.Id) + var alertV2 AlertV2 + path := fmt.Sprintf("/api/2.0/alerts/%v", request.Id) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &alertV2Pb, - ) - if err != nil { - return nil, err - } - resp, err := alertV2FromPb(&alertV2Pb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &alertV2) + return &alertV2, err } // Gets a list of alerts accessible to the user, ordered by creation time. @@ -470,99 +219,37 @@ func (a *alertsV2Impl) ListAlertsAll(ctx context.Context, request ListAlertsV2Re } func (a *alertsV2Impl) internalListAlerts(ctx context.Context, request ListAlertsV2Request) (*ListAlertsV2Response, error) { - - requestPb, pbErr := listAlertsV2RequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listAlertsV2ResponsePb listAlertsV2ResponsePb + var listAlertsV2Response ListAlertsV2Response path := "/api/2.0/alerts" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listAlertsV2ResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listAlertsV2ResponseFromPb(&listAlertsV2ResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listAlertsV2Response) + return &listAlertsV2Response, err } func (a *alertsV2Impl) TrashAlert(ctx context.Context, request TrashAlertV2Request) error { - - requestPb, pbErr := trashAlertV2RequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var emptyPb emptyPb - path := fmt.Sprintf("/api/2.0/alerts/%v", requestPb.Id) + var empty Empty + path := fmt.Sprintf("/api/2.0/alerts/%v", request.Id) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &emptyPb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &empty) return err } func (a *alertsV2Impl) UpdateAlert(ctx context.Context, request UpdateAlertV2Request) (*AlertV2, error) { - - requestPb, pbErr := updateAlertV2RequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var alertV2Pb alertV2Pb - path := fmt.Sprintf("/api/2.0/alerts/%v", requestPb.Id) + var alertV2 AlertV2 + path := fmt.Sprintf("/api/2.0/alerts/%v", request.Id) queryParams := make(map[string]any) - if requestPb.UpdateMask != "" { - queryParams["update_mask"] = requestPb.UpdateMask + if request.UpdateMask != "" { + queryParams["update_mask"] = request.UpdateMask } headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb).Alert, - &alertV2Pb, - ) - if err != nil { - return nil, err - } - resp, err := alertV2FromPb(&alertV2Pb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.Alert, &alertV2) + return &alertV2, err } // unexported type that holds implementations of just DashboardWidgets API methods @@ -571,97 +258,35 @@ type dashboardWidgetsImpl struct { } func (a *dashboardWidgetsImpl) Create(ctx context.Context, request CreateWidget) (*Widget, error) { - - requestPb, pbErr := createWidgetToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var widgetPb widgetPb + var widget Widget path := "/api/2.0/preview/sql/widgets" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &widgetPb, - ) - if err != nil { - return nil, err - } - resp, err := widgetFromPb(&widgetPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &widget) + return &widget, err } func (a *dashboardWidgetsImpl) Delete(ctx context.Context, request DeleteDashboardWidgetRequest) error { - - requestPb, pbErr := deleteDashboardWidgetRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteResponsePb deleteResponsePb - path := fmt.Sprintf("/api/2.0/preview/sql/widgets/%v", requestPb.Id) + var deleteResponse DeleteResponse + path := fmt.Sprintf("/api/2.0/preview/sql/widgets/%v", request.Id) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteResponse) return err } func (a *dashboardWidgetsImpl) Update(ctx context.Context, request CreateWidget) (*Widget, error) { - - requestPb, pbErr := createWidgetToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var widgetPb widgetPb - path := fmt.Sprintf("/api/2.0/preview/sql/widgets/%v", requestPb.Id) + var widget Widget + path := fmt.Sprintf("/api/2.0/preview/sql/widgets/%v", request.Id) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &widgetPb, - ) - if err != nil { - return nil, err - } - resp, err := widgetFromPb(&widgetPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &widget) + return &widget, err } // unexported type that holds implementations of just Dashboards API methods @@ -670,96 +295,34 @@ type dashboardsImpl struct { } func (a *dashboardsImpl) Create(ctx context.Context, request DashboardPostContent) (*Dashboard, error) { - - requestPb, pbErr := dashboardPostContentToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var dashboardPb dashboardPb + var dashboard Dashboard path := "/api/2.0/preview/sql/dashboards" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &dashboardPb, - ) - if err != nil { - return nil, err - } - resp, err := dashboardFromPb(&dashboardPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &dashboard) + return &dashboard, err } func (a *dashboardsImpl) Delete(ctx context.Context, request DeleteDashboardRequest) error { - - requestPb, pbErr := deleteDashboardRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteResponsePb deleteResponsePb - path := fmt.Sprintf("/api/2.0/preview/sql/dashboards/%v", requestPb.DashboardId) + var deleteResponse DeleteResponse + path := fmt.Sprintf("/api/2.0/preview/sql/dashboards/%v", request.DashboardId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteResponse) return err } func (a *dashboardsImpl) Get(ctx context.Context, request GetDashboardRequest) (*Dashboard, error) { - - requestPb, pbErr := getDashboardRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var dashboardPb dashboardPb - path := fmt.Sprintf("/api/2.0/preview/sql/dashboards/%v", requestPb.DashboardId) + var dashboard Dashboard + path := fmt.Sprintf("/api/2.0/preview/sql/dashboards/%v", request.DashboardId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &dashboardPb, - ) - if err != nil { - return nil, err - } - resp, err := dashboardFromPb(&dashboardPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &dashboard) + return &dashboard, err } // Fetch a paginated list of dashboard objects. @@ -808,96 +371,34 @@ func (a *dashboardsImpl) ListAll(ctx context.Context, request ListDashboardsRequ } func (a *dashboardsImpl) internalList(ctx context.Context, request ListDashboardsRequest) (*ListResponse, error) { - - requestPb, pbErr := listDashboardsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listResponsePb listResponsePb + var listResponse ListResponse path := "/api/2.0/preview/sql/dashboards" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listResponseFromPb(&listResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listResponse) + return &listResponse, err } func (a *dashboardsImpl) Restore(ctx context.Context, request RestoreDashboardRequest) error { - - requestPb, pbErr := restoreDashboardRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var restoreResponsePb restoreResponsePb - path := fmt.Sprintf("/api/2.0/preview/sql/dashboards/trash/%v", requestPb.DashboardId) + var restoreResponse RestoreResponse + path := fmt.Sprintf("/api/2.0/preview/sql/dashboards/trash/%v", request.DashboardId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - nil, - &restoreResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, nil, &restoreResponse) return err } func (a *dashboardsImpl) Update(ctx context.Context, request DashboardEditContent) (*Dashboard, error) { - - requestPb, pbErr := dashboardEditContentToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var dashboardPb dashboardPb - path := fmt.Sprintf("/api/2.0/preview/sql/dashboards/%v", requestPb.DashboardId) + var dashboard Dashboard + path := fmt.Sprintf("/api/2.0/preview/sql/dashboards/%v", request.DashboardId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &dashboardPb, - ) - if err != nil { - return nil, err - } - resp, err := dashboardFromPb(&dashboardPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &dashboard) + return &dashboard, err } // unexported type that holds implementations of just DataSources API methods @@ -906,34 +407,13 @@ type dataSourcesImpl struct { } func (a *dataSourcesImpl) List(ctx context.Context) ([]DataSource, error) { - - var dataSourceListPb []dataSourcePb + var dataSourceList []DataSource path := "/api/2.0/preview/sql/data_sources" headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - nil, - nil, - &dataSourceListPb, - ) - if err != nil { - return nil, err - } - var resp []DataSource - for _, item := range dataSourceListPb { - itemResp, err := dataSourceFromPb(&item) - if err != nil { - return nil, err - } - resp = append(resp, *itemResp) - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, nil, nil, &dataSourceList) + return dataSourceList, err } // unexported type that holds implementations of just DbsqlPermissions API methods @@ -942,101 +422,35 @@ type dbsqlPermissionsImpl struct { } func (a *dbsqlPermissionsImpl) Get(ctx context.Context, request GetDbsqlPermissionRequest) (*GetResponse, error) { - - requestPb, pbErr := getDbsqlPermissionRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var getResponsePb getResponsePb - path := fmt.Sprintf("/api/2.0/preview/sql/permissions/%v/%v", requestPb.ObjectType, requestPb.ObjectId) + var getResponse GetResponse + path := fmt.Sprintf("/api/2.0/preview/sql/permissions/%v/%v", request.ObjectType, request.ObjectId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &getResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := getResponseFromPb(&getResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getResponse) + return &getResponse, err } func (a *dbsqlPermissionsImpl) Set(ctx context.Context, request SetRequest) (*SetResponse, error) { - - requestPb, pbErr := setRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var setResponsePb setResponsePb - path := fmt.Sprintf("/api/2.0/preview/sql/permissions/%v/%v", requestPb.ObjectType, requestPb.ObjectId) + var setResponse SetResponse + path := fmt.Sprintf("/api/2.0/preview/sql/permissions/%v/%v", request.ObjectType, request.ObjectId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &setResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := setResponseFromPb(&setResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &setResponse) + return &setResponse, err } func (a *dbsqlPermissionsImpl) TransferOwnership(ctx context.Context, request TransferOwnershipRequest) (*Success, error) { - - requestPb, pbErr := transferOwnershipRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var successPb successPb - path := fmt.Sprintf("/api/2.0/preview/sql/permissions/%v/%v/transfer", requestPb.ObjectType, requestPb.ObjectId) + var success Success + path := fmt.Sprintf("/api/2.0/preview/sql/permissions/%v/%v/transfer", request.ObjectType, request.ObjectId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &successPb, - ) - if err != nil { - return nil, err - } - resp, err := successFromPb(&successPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &success) + return &success, err } // unexported type that holds implementations of just Queries API methods @@ -1045,96 +459,34 @@ type queriesImpl struct { } func (a *queriesImpl) Create(ctx context.Context, request CreateQueryRequest) (*Query, error) { - - requestPb, pbErr := createQueryRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var queryPb queryPb + var query Query path := "/api/2.0/sql/queries" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &queryPb, - ) - if err != nil { - return nil, err - } - resp, err := queryFromPb(&queryPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &query) + return &query, err } func (a *queriesImpl) Delete(ctx context.Context, request TrashQueryRequest) error { - - requestPb, pbErr := trashQueryRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var emptyPb emptyPb - path := fmt.Sprintf("/api/2.0/sql/queries/%v", requestPb.Id) + var empty Empty + path := fmt.Sprintf("/api/2.0/sql/queries/%v", request.Id) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &emptyPb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &empty) return err } func (a *queriesImpl) Get(ctx context.Context, request GetQueryRequest) (*Query, error) { - - requestPb, pbErr := getQueryRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var queryPb queryPb - path := fmt.Sprintf("/api/2.0/sql/queries/%v", requestPb.Id) + var query Query + path := fmt.Sprintf("/api/2.0/sql/queries/%v", request.Id) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &queryPb, - ) - if err != nil { - return nil, err - } - resp, err := queryFromPb(&queryPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &query) + return &query, err } // Gets a list of queries accessible to the user, ordered by creation time. @@ -1173,35 +525,13 @@ func (a *queriesImpl) ListAll(ctx context.Context, request ListQueriesRequest) ( } func (a *queriesImpl) internalList(ctx context.Context, request ListQueriesRequest) (*ListQueryObjectsResponse, error) { - - requestPb, pbErr := listQueriesRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listQueryObjectsResponsePb listQueryObjectsResponsePb + var listQueryObjectsResponse ListQueryObjectsResponse path := "/api/2.0/sql/queries" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listQueryObjectsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listQueryObjectsResponseFromPb(&listQueryObjectsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listQueryObjectsResponse) + return &listQueryObjectsResponse, err } // Gets a list of visualizations on a query. @@ -1236,68 +566,24 @@ func (a *queriesImpl) ListVisualizationsAll(ctx context.Context, request ListVis } func (a *queriesImpl) internalListVisualizations(ctx context.Context, request ListVisualizationsForQueryRequest) (*ListVisualizationsForQueryResponse, error) { - - requestPb, pbErr := listVisualizationsForQueryRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listVisualizationsForQueryResponsePb listVisualizationsForQueryResponsePb - path := fmt.Sprintf("/api/2.0/sql/queries/%v/visualizations", requestPb.Id) + var listVisualizationsForQueryResponse ListVisualizationsForQueryResponse + path := fmt.Sprintf("/api/2.0/sql/queries/%v/visualizations", request.Id) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listVisualizationsForQueryResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listVisualizationsForQueryResponseFromPb(&listVisualizationsForQueryResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listVisualizationsForQueryResponse) + return &listVisualizationsForQueryResponse, err } func (a *queriesImpl) Update(ctx context.Context, request UpdateQueryRequest) (*Query, error) { - - requestPb, pbErr := updateQueryRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var queryPb queryPb - path := fmt.Sprintf("/api/2.0/sql/queries/%v", requestPb.Id) + var query Query + path := fmt.Sprintf("/api/2.0/sql/queries/%v", request.Id) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &queryPb, - ) - if err != nil { - return nil, err - } - resp, err := queryFromPb(&queryPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &query) + return &query, err } // unexported type that holds implementations of just QueriesLegacy API methods @@ -1306,96 +592,34 @@ type queriesLegacyImpl struct { } func (a *queriesLegacyImpl) Create(ctx context.Context, request QueryPostContent) (*LegacyQuery, error) { - - requestPb, pbErr := queryPostContentToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var legacyQueryPb legacyQueryPb + var legacyQuery LegacyQuery path := "/api/2.0/preview/sql/queries" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &legacyQueryPb, - ) - if err != nil { - return nil, err - } - resp, err := legacyQueryFromPb(&legacyQueryPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &legacyQuery) + return &legacyQuery, err } func (a *queriesLegacyImpl) Delete(ctx context.Context, request DeleteQueriesLegacyRequest) error { - - requestPb, pbErr := deleteQueriesLegacyRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteResponsePb deleteResponsePb - path := fmt.Sprintf("/api/2.0/preview/sql/queries/%v", requestPb.QueryId) + var deleteResponse DeleteResponse + path := fmt.Sprintf("/api/2.0/preview/sql/queries/%v", request.QueryId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteResponse) return err } func (a *queriesLegacyImpl) Get(ctx context.Context, request GetQueriesLegacyRequest) (*LegacyQuery, error) { - - requestPb, pbErr := getQueriesLegacyRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var legacyQueryPb legacyQueryPb - path := fmt.Sprintf("/api/2.0/preview/sql/queries/%v", requestPb.QueryId) + var legacyQuery LegacyQuery + path := fmt.Sprintf("/api/2.0/preview/sql/queries/%v", request.QueryId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &legacyQueryPb, - ) - if err != nil { - return nil, err - } - resp, err := legacyQueryFromPb(&legacyQueryPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &legacyQuery) + return &legacyQuery, err } // Gets a list of queries. Optionally, this list can be filtered by a search @@ -1456,96 +680,34 @@ func (a *queriesLegacyImpl) ListAll(ctx context.Context, request ListQueriesLega } func (a *queriesLegacyImpl) internalList(ctx context.Context, request ListQueriesLegacyRequest) (*QueryList, error) { - - requestPb, pbErr := listQueriesLegacyRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var queryListPb queryListPb + var queryList QueryList path := "/api/2.0/preview/sql/queries" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &queryListPb, - ) - if err != nil { - return nil, err - } - resp, err := queryListFromPb(&queryListPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &queryList) + return &queryList, err } func (a *queriesLegacyImpl) Restore(ctx context.Context, request RestoreQueriesLegacyRequest) error { - - requestPb, pbErr := restoreQueriesLegacyRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var restoreResponsePb restoreResponsePb - path := fmt.Sprintf("/api/2.0/preview/sql/queries/trash/%v", requestPb.QueryId) + var restoreResponse RestoreResponse + path := fmt.Sprintf("/api/2.0/preview/sql/queries/trash/%v", request.QueryId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - nil, - &restoreResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, nil, &restoreResponse) return err } func (a *queriesLegacyImpl) Update(ctx context.Context, request QueryEditContent) (*LegacyQuery, error) { - - requestPb, pbErr := queryEditContentToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var legacyQueryPb legacyQueryPb - path := fmt.Sprintf("/api/2.0/preview/sql/queries/%v", requestPb.QueryId) + var legacyQuery LegacyQuery + path := fmt.Sprintf("/api/2.0/preview/sql/queries/%v", request.QueryId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &legacyQueryPb, - ) - if err != nil { - return nil, err - } - resp, err := legacyQueryFromPb(&legacyQueryPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &legacyQuery) + return &legacyQuery, err } // unexported type that holds implementations of just QueryHistory API methods @@ -1554,35 +716,13 @@ type queryHistoryImpl struct { } func (a *queryHistoryImpl) List(ctx context.Context, request ListQueryHistoryRequest) (*ListQueriesResponse, error) { - - requestPb, pbErr := listQueryHistoryRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listQueriesResponsePb listQueriesResponsePb + var listQueriesResponse ListQueriesResponse path := "/api/2.0/sql/history/queries" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listQueriesResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listQueriesResponseFromPb(&listQueriesResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listQueriesResponse) + return &listQueriesResponse, err } // unexported type that holds implementations of just QueryVisualizations API methods @@ -1591,97 +731,35 @@ type queryVisualizationsImpl struct { } func (a *queryVisualizationsImpl) Create(ctx context.Context, request CreateVisualizationRequest) (*Visualization, error) { - - requestPb, pbErr := createVisualizationRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var visualizationPb visualizationPb + var visualization Visualization path := "/api/2.0/sql/visualizations" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &visualizationPb, - ) - if err != nil { - return nil, err - } - resp, err := visualizationFromPb(&visualizationPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &visualization) + return &visualization, err } func (a *queryVisualizationsImpl) Delete(ctx context.Context, request DeleteVisualizationRequest) error { - - requestPb, pbErr := deleteVisualizationRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var emptyPb emptyPb - path := fmt.Sprintf("/api/2.0/sql/visualizations/%v", requestPb.Id) + var empty Empty + path := fmt.Sprintf("/api/2.0/sql/visualizations/%v", request.Id) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &emptyPb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &empty) return err } func (a *queryVisualizationsImpl) Update(ctx context.Context, request UpdateVisualizationRequest) (*Visualization, error) { - - requestPb, pbErr := updateVisualizationRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var visualizationPb visualizationPb - path := fmt.Sprintf("/api/2.0/sql/visualizations/%v", requestPb.Id) + var visualization Visualization + path := fmt.Sprintf("/api/2.0/sql/visualizations/%v", request.Id) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &visualizationPb, - ) - if err != nil { - return nil, err - } - resp, err := visualizationFromPb(&visualizationPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &visualization) + return &visualization, err } // unexported type that holds implementations of just QueryVisualizationsLegacy API methods @@ -1690,97 +768,35 @@ type queryVisualizationsLegacyImpl struct { } func (a *queryVisualizationsLegacyImpl) Create(ctx context.Context, request CreateQueryVisualizationsLegacyRequest) (*LegacyVisualization, error) { - - requestPb, pbErr := createQueryVisualizationsLegacyRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var legacyVisualizationPb legacyVisualizationPb + var legacyVisualization LegacyVisualization path := "/api/2.0/preview/sql/visualizations" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &legacyVisualizationPb, - ) - if err != nil { - return nil, err - } - resp, err := legacyVisualizationFromPb(&legacyVisualizationPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &legacyVisualization) + return &legacyVisualization, err } func (a *queryVisualizationsLegacyImpl) Delete(ctx context.Context, request DeleteQueryVisualizationsLegacyRequest) error { - - requestPb, pbErr := deleteQueryVisualizationsLegacyRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteResponsePb deleteResponsePb - path := fmt.Sprintf("/api/2.0/preview/sql/visualizations/%v", requestPb.Id) + var deleteResponse DeleteResponse + path := fmt.Sprintf("/api/2.0/preview/sql/visualizations/%v", request.Id) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteResponse) return err } func (a *queryVisualizationsLegacyImpl) Update(ctx context.Context, request LegacyVisualization) (*LegacyVisualization, error) { - - requestPb, pbErr := legacyVisualizationToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var legacyVisualizationPb legacyVisualizationPb - path := fmt.Sprintf("/api/2.0/preview/sql/visualizations/%v", requestPb.Id) + var legacyVisualization LegacyVisualization + path := fmt.Sprintf("/api/2.0/preview/sql/visualizations/%v", request.Id) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &legacyVisualizationPb, - ) - if err != nil { - return nil, err - } - resp, err := legacyVisualizationFromPb(&legacyVisualizationPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &legacyVisualization) + return &legacyVisualization, err } // unexported type that holds implementations of just RedashConfig API methods @@ -1789,30 +805,13 @@ type redashConfigImpl struct { } func (a *redashConfigImpl) GetConfig(ctx context.Context) (*ClientConfig, error) { - - var clientConfigPb clientConfigPb + var clientConfig ClientConfig path := "/api/2.0/redash-v2/config" headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - nil, - nil, - &clientConfigPb, - ) - if err != nil { - return nil, err - } - resp, err := clientConfigFromPb(&clientConfigPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, nil, nil, &clientConfig) + return &clientConfig, err } // unexported type that holds implementations of just StatementExecution API methods @@ -1821,127 +820,43 @@ type statementExecutionImpl struct { } func (a *statementExecutionImpl) CancelExecution(ctx context.Context, request CancelExecutionRequest) error { - - requestPb, pbErr := cancelExecutionRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var cancelExecutionResponsePb cancelExecutionResponsePb - path := fmt.Sprintf("/api/2.0/sql/statements/%v/cancel", requestPb.StatementId) + var cancelExecutionResponse CancelExecutionResponse + path := fmt.Sprintf("/api/2.0/sql/statements/%v/cancel", request.StatementId) queryParams := make(map[string]any) headers := make(map[string]string) - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - nil, - &cancelExecutionResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, nil, &cancelExecutionResponse) return err } func (a *statementExecutionImpl) ExecuteStatement(ctx context.Context, request ExecuteStatementRequest) (*StatementResponse, error) { - - requestPb, pbErr := executeStatementRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var statementResponsePb statementResponsePb + var statementResponse StatementResponse path := "/api/2.0/sql/statements/" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &statementResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := statementResponseFromPb(&statementResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &statementResponse) + return &statementResponse, err } func (a *statementExecutionImpl) GetStatement(ctx context.Context, request GetStatementRequest) (*StatementResponse, error) { - - requestPb, pbErr := getStatementRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var statementResponsePb statementResponsePb - path := fmt.Sprintf("/api/2.0/sql/statements/%v", requestPb.StatementId) + var statementResponse StatementResponse + path := fmt.Sprintf("/api/2.0/sql/statements/%v", request.StatementId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &statementResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := statementResponseFromPb(&statementResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &statementResponse) + return &statementResponse, err } func (a *statementExecutionImpl) GetStatementResultChunkN(ctx context.Context, request GetStatementResultChunkNRequest) (*ResultData, error) { - - requestPb, pbErr := getStatementResultChunkNRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var resultDataPb resultDataPb - path := fmt.Sprintf("/api/2.0/sql/statements/%v/result/chunks/%v", requestPb.StatementId, requestPb.ChunkIndex) + var resultData ResultData + path := fmt.Sprintf("/api/2.0/sql/statements/%v/result/chunks/%v", request.StatementId, request.ChunkIndex) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &resultDataPb, - ) - if err != nil { - return nil, err - } - resp, err := resultDataFromPb(&resultDataPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &resultData) + return &resultData, err } // unexported type that holds implementations of just Warehouses API methods @@ -1950,216 +865,75 @@ type warehousesImpl struct { } func (a *warehousesImpl) Create(ctx context.Context, request CreateWarehouseRequest) (*CreateWarehouseResponse, error) { - - requestPb, pbErr := createWarehouseRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var createWarehouseResponsePb createWarehouseResponsePb + var createWarehouseResponse CreateWarehouseResponse path := "/api/2.0/sql/warehouses" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &createWarehouseResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := createWarehouseResponseFromPb(&createWarehouseResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &createWarehouseResponse) + return &createWarehouseResponse, err } func (a *warehousesImpl) Delete(ctx context.Context, request DeleteWarehouseRequest) error { - - requestPb, pbErr := deleteWarehouseRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteWarehouseResponsePb deleteWarehouseResponsePb - path := fmt.Sprintf("/api/2.0/sql/warehouses/%v", requestPb.Id) + var deleteWarehouseResponse DeleteWarehouseResponse + path := fmt.Sprintf("/api/2.0/sql/warehouses/%v", request.Id) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteWarehouseResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteWarehouseResponse) return err } func (a *warehousesImpl) Edit(ctx context.Context, request EditWarehouseRequest) error { - - requestPb, pbErr := editWarehouseRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var editWarehouseResponsePb editWarehouseResponsePb - path := fmt.Sprintf("/api/2.0/sql/warehouses/%v/edit", requestPb.Id) + var editWarehouseResponse EditWarehouseResponse + path := fmt.Sprintf("/api/2.0/sql/warehouses/%v/edit", request.Id) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &editWarehouseResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &editWarehouseResponse) return err } func (a *warehousesImpl) Get(ctx context.Context, request GetWarehouseRequest) (*GetWarehouseResponse, error) { - - requestPb, pbErr := getWarehouseRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var getWarehouseResponsePb getWarehouseResponsePb - path := fmt.Sprintf("/api/2.0/sql/warehouses/%v", requestPb.Id) + var getWarehouseResponse GetWarehouseResponse + path := fmt.Sprintf("/api/2.0/sql/warehouses/%v", request.Id) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &getWarehouseResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := getWarehouseResponseFromPb(&getWarehouseResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getWarehouseResponse) + return &getWarehouseResponse, err } func (a *warehousesImpl) GetPermissionLevels(ctx context.Context, request GetWarehousePermissionLevelsRequest) (*GetWarehousePermissionLevelsResponse, error) { - - requestPb, pbErr := getWarehousePermissionLevelsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var getWarehousePermissionLevelsResponsePb getWarehousePermissionLevelsResponsePb - path := fmt.Sprintf("/api/2.0/permissions/warehouses/%v/permissionLevels", requestPb.WarehouseId) + var getWarehousePermissionLevelsResponse GetWarehousePermissionLevelsResponse + path := fmt.Sprintf("/api/2.0/permissions/warehouses/%v/permissionLevels", request.WarehouseId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &getWarehousePermissionLevelsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := getWarehousePermissionLevelsResponseFromPb(&getWarehousePermissionLevelsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getWarehousePermissionLevelsResponse) + return &getWarehousePermissionLevelsResponse, err } func (a *warehousesImpl) GetPermissions(ctx context.Context, request GetWarehousePermissionsRequest) (*WarehousePermissions, error) { - - requestPb, pbErr := getWarehousePermissionsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var warehousePermissionsPb warehousePermissionsPb - path := fmt.Sprintf("/api/2.0/permissions/warehouses/%v", requestPb.WarehouseId) + var warehousePermissions WarehousePermissions + path := fmt.Sprintf("/api/2.0/permissions/warehouses/%v", request.WarehouseId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &warehousePermissionsPb, - ) - if err != nil { - return nil, err - } - resp, err := warehousePermissionsFromPb(&warehousePermissionsPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &warehousePermissions) + return &warehousePermissions, err } func (a *warehousesImpl) GetWorkspaceWarehouseConfig(ctx context.Context) (*GetWorkspaceWarehouseConfigResponse, error) { - - var getWorkspaceWarehouseConfigResponsePb getWorkspaceWarehouseConfigResponsePb + var getWorkspaceWarehouseConfigResponse GetWorkspaceWarehouseConfigResponse path := "/api/2.0/sql/config/warehouses" headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - nil, - nil, - &getWorkspaceWarehouseConfigResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := getWorkspaceWarehouseConfigResponseFromPb(&getWorkspaceWarehouseConfigResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, nil, nil, &getWorkspaceWarehouseConfigResponse) + return &getWorkspaceWarehouseConfigResponse, err } // Lists all SQL warehouses that a user has manager permissions on. @@ -2188,184 +962,64 @@ func (a *warehousesImpl) ListAll(ctx context.Context, request ListWarehousesRequ } func (a *warehousesImpl) internalList(ctx context.Context, request ListWarehousesRequest) (*ListWarehousesResponse, error) { - - requestPb, pbErr := listWarehousesRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listWarehousesResponsePb listWarehousesResponsePb + var listWarehousesResponse ListWarehousesResponse path := "/api/2.0/sql/warehouses" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listWarehousesResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listWarehousesResponseFromPb(&listWarehousesResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listWarehousesResponse) + return &listWarehousesResponse, err } func (a *warehousesImpl) SetPermissions(ctx context.Context, request WarehousePermissionsRequest) (*WarehousePermissions, error) { - - requestPb, pbErr := warehousePermissionsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var warehousePermissionsPb warehousePermissionsPb - path := fmt.Sprintf("/api/2.0/permissions/warehouses/%v", requestPb.WarehouseId) + var warehousePermissions WarehousePermissions + path := fmt.Sprintf("/api/2.0/permissions/warehouses/%v", request.WarehouseId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPut, - path, - headers, - queryParams, - (*requestPb), - &warehousePermissionsPb, - ) - if err != nil { - return nil, err - } - resp, err := warehousePermissionsFromPb(&warehousePermissionsPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &warehousePermissions) + return &warehousePermissions, err } func (a *warehousesImpl) SetWorkspaceWarehouseConfig(ctx context.Context, request SetWorkspaceWarehouseConfigRequest) error { - - requestPb, pbErr := setWorkspaceWarehouseConfigRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var setWorkspaceWarehouseConfigResponsePb setWorkspaceWarehouseConfigResponsePb + var setWorkspaceWarehouseConfigResponse SetWorkspaceWarehouseConfigResponse path := "/api/2.0/sql/config/warehouses" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPut, - path, - headers, - queryParams, - (*requestPb), - &setWorkspaceWarehouseConfigResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &setWorkspaceWarehouseConfigResponse) return err } func (a *warehousesImpl) Start(ctx context.Context, request StartRequest) error { - - requestPb, pbErr := startRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var startWarehouseResponsePb startWarehouseResponsePb - path := fmt.Sprintf("/api/2.0/sql/warehouses/%v/start", requestPb.Id) + var startWarehouseResponse StartWarehouseResponse + path := fmt.Sprintf("/api/2.0/sql/warehouses/%v/start", request.Id) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - nil, - &startWarehouseResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, nil, &startWarehouseResponse) return err } func (a *warehousesImpl) Stop(ctx context.Context, request StopRequest) error { - - requestPb, pbErr := stopRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var stopWarehouseResponsePb stopWarehouseResponsePb - path := fmt.Sprintf("/api/2.0/sql/warehouses/%v/stop", requestPb.Id) + var stopWarehouseResponse StopWarehouseResponse + path := fmt.Sprintf("/api/2.0/sql/warehouses/%v/stop", request.Id) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - nil, - &stopWarehouseResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, nil, &stopWarehouseResponse) return err } func (a *warehousesImpl) UpdatePermissions(ctx context.Context, request WarehousePermissionsRequest) (*WarehousePermissions, error) { - - requestPb, pbErr := warehousePermissionsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var warehousePermissionsPb warehousePermissionsPb - path := fmt.Sprintf("/api/2.0/permissions/warehouses/%v", requestPb.WarehouseId) + var warehousePermissions WarehousePermissions + path := fmt.Sprintf("/api/2.0/permissions/warehouses/%v", request.WarehouseId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &warehousePermissionsPb, - ) - if err != nil { - return nil, err - } - resp, err := warehousePermissionsFromPb(&warehousePermissionsPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &warehousePermissions) + return &warehousePermissions, err } diff --git a/service/sql/internal.go b/service/sql/internal.go deleted file mode 100755 index 4eb631c7e..000000000 --- a/service/sql/internal.go +++ /dev/null @@ -1,7106 +0,0 @@ -// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. - -package sql - -import ( - "fmt" - "strings" - "time" - - "github.com/databricks/databricks-sdk-go/marshal" -) - -func accessControlToPb(st *AccessControl) (*accessControlPb, error) { - if st == nil { - return nil, nil - } - pb := &accessControlPb{} - pb.GroupName = st.GroupName - pb.PermissionLevel = st.PermissionLevel - pb.UserName = st.UserName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type accessControlPb struct { - GroupName string `json:"group_name,omitempty"` - PermissionLevel PermissionLevel `json:"permission_level,omitempty"` - UserName string `json:"user_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func accessControlFromPb(pb *accessControlPb) (*AccessControl, error) { - if pb == nil { - return nil, nil - } - st := &AccessControl{} - st.GroupName = pb.GroupName - st.PermissionLevel = pb.PermissionLevel - st.UserName = pb.UserName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *accessControlPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st accessControlPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func alertToPb(st *Alert) (*alertPb, error) { - if st == nil { - return nil, nil - } - pb := &alertPb{} - pb.Condition = st.Condition - pb.CreateTime = st.CreateTime - pb.CustomBody = st.CustomBody - pb.CustomSubject = st.CustomSubject - pb.DisplayName = st.DisplayName - pb.Id = st.Id - pb.LifecycleState = st.LifecycleState - pb.NotifyOnOk = st.NotifyOnOk - pb.OwnerUserName = st.OwnerUserName - pb.ParentPath = st.ParentPath - pb.QueryId = st.QueryId - pb.SecondsToRetrigger = st.SecondsToRetrigger - pb.State = st.State - pb.TriggerTime = st.TriggerTime - pb.UpdateTime = st.UpdateTime - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type alertPb struct { - Condition *AlertCondition `json:"condition,omitempty"` - CreateTime string `json:"create_time,omitempty"` - CustomBody string `json:"custom_body,omitempty"` - CustomSubject string `json:"custom_subject,omitempty"` - DisplayName string `json:"display_name,omitempty"` - Id string `json:"id,omitempty"` - LifecycleState LifecycleState `json:"lifecycle_state,omitempty"` - NotifyOnOk bool `json:"notify_on_ok,omitempty"` - OwnerUserName string `json:"owner_user_name,omitempty"` - ParentPath string `json:"parent_path,omitempty"` - QueryId string `json:"query_id,omitempty"` - SecondsToRetrigger int `json:"seconds_to_retrigger,omitempty"` - State AlertState `json:"state,omitempty"` - TriggerTime string `json:"trigger_time,omitempty"` - UpdateTime string `json:"update_time,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func alertFromPb(pb *alertPb) (*Alert, error) { - if pb == nil { - return nil, nil - } - st := &Alert{} - st.Condition = pb.Condition - st.CreateTime = pb.CreateTime - st.CustomBody = pb.CustomBody - st.CustomSubject = pb.CustomSubject - st.DisplayName = pb.DisplayName - st.Id = pb.Id - st.LifecycleState = pb.LifecycleState - st.NotifyOnOk = pb.NotifyOnOk - st.OwnerUserName = pb.OwnerUserName - st.ParentPath = pb.ParentPath - st.QueryId = pb.QueryId - st.SecondsToRetrigger = pb.SecondsToRetrigger - st.State = pb.State - st.TriggerTime = pb.TriggerTime - st.UpdateTime = pb.UpdateTime - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *alertPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st alertPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func alertConditionToPb(st *AlertCondition) (*alertConditionPb, error) { - if st == nil { - return nil, nil - } - pb := &alertConditionPb{} - pb.EmptyResultState = st.EmptyResultState - pb.Op = st.Op - pb.Operand = st.Operand - pb.Threshold = st.Threshold - - return pb, nil -} - -type alertConditionPb struct { - EmptyResultState AlertState `json:"empty_result_state,omitempty"` - Op AlertOperator `json:"op,omitempty"` - Operand *AlertConditionOperand `json:"operand,omitempty"` - Threshold *AlertConditionThreshold `json:"threshold,omitempty"` -} - -func alertConditionFromPb(pb *alertConditionPb) (*AlertCondition, error) { - if pb == nil { - return nil, nil - } - st := &AlertCondition{} - st.EmptyResultState = pb.EmptyResultState - st.Op = pb.Op - st.Operand = pb.Operand - st.Threshold = pb.Threshold - - return st, nil -} - -func alertConditionOperandToPb(st *AlertConditionOperand) (*alertConditionOperandPb, error) { - if st == nil { - return nil, nil - } - pb := &alertConditionOperandPb{} - pb.Column = st.Column - - return pb, nil -} - -type alertConditionOperandPb struct { - Column *AlertOperandColumn `json:"column,omitempty"` -} - -func alertConditionOperandFromPb(pb *alertConditionOperandPb) (*AlertConditionOperand, error) { - if pb == nil { - return nil, nil - } - st := &AlertConditionOperand{} - st.Column = pb.Column - - return st, nil -} - -func alertConditionThresholdToPb(st *AlertConditionThreshold) (*alertConditionThresholdPb, error) { - if st == nil { - return nil, nil - } - pb := &alertConditionThresholdPb{} - pb.Value = st.Value - - return pb, nil -} - -type alertConditionThresholdPb struct { - Value *AlertOperandValue `json:"value,omitempty"` -} - -func alertConditionThresholdFromPb(pb *alertConditionThresholdPb) (*AlertConditionThreshold, error) { - if pb == nil { - return nil, nil - } - st := &AlertConditionThreshold{} - st.Value = pb.Value - - return st, nil -} - -func alertOperandColumnToPb(st *AlertOperandColumn) (*alertOperandColumnPb, error) { - if st == nil { - return nil, nil - } - pb := &alertOperandColumnPb{} - pb.Name = st.Name - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type alertOperandColumnPb struct { - Name string `json:"name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func alertOperandColumnFromPb(pb *alertOperandColumnPb) (*AlertOperandColumn, error) { - if pb == nil { - return nil, nil - } - st := &AlertOperandColumn{} - st.Name = pb.Name - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *alertOperandColumnPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st alertOperandColumnPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func alertOperandValueToPb(st *AlertOperandValue) (*alertOperandValuePb, error) { - if st == nil { - return nil, nil - } - pb := &alertOperandValuePb{} - pb.BoolValue = st.BoolValue - pb.DoubleValue = st.DoubleValue - pb.StringValue = st.StringValue - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type alertOperandValuePb struct { - BoolValue bool `json:"bool_value,omitempty"` - DoubleValue float64 `json:"double_value,omitempty"` - StringValue string `json:"string_value,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func alertOperandValueFromPb(pb *alertOperandValuePb) (*AlertOperandValue, error) { - if pb == nil { - return nil, nil - } - st := &AlertOperandValue{} - st.BoolValue = pb.BoolValue - st.DoubleValue = pb.DoubleValue - st.StringValue = pb.StringValue - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *alertOperandValuePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st alertOperandValuePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func alertOptionsToPb(st *AlertOptions) (*alertOptionsPb, error) { - if st == nil { - return nil, nil - } - pb := &alertOptionsPb{} - pb.Column = st.Column - pb.CustomBody = st.CustomBody - pb.CustomSubject = st.CustomSubject - pb.EmptyResultState = st.EmptyResultState - pb.Muted = st.Muted - pb.Op = st.Op - pb.Value = st.Value - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type alertOptionsPb struct { - Column string `json:"column"` - CustomBody string `json:"custom_body,omitempty"` - CustomSubject string `json:"custom_subject,omitempty"` - EmptyResultState AlertOptionsEmptyResultState `json:"empty_result_state,omitempty"` - Muted bool `json:"muted,omitempty"` - Op string `json:"op"` - Value any `json:"value"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func alertOptionsFromPb(pb *alertOptionsPb) (*AlertOptions, error) { - if pb == nil { - return nil, nil - } - st := &AlertOptions{} - st.Column = pb.Column - st.CustomBody = pb.CustomBody - st.CustomSubject = pb.CustomSubject - st.EmptyResultState = pb.EmptyResultState - st.Muted = pb.Muted - st.Op = pb.Op - st.Value = pb.Value - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *alertOptionsPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st alertOptionsPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func alertQueryToPb(st *AlertQuery) (*alertQueryPb, error) { - if st == nil { - return nil, nil - } - pb := &alertQueryPb{} - pb.CreatedAt = st.CreatedAt - pb.DataSourceId = st.DataSourceId - pb.Description = st.Description - pb.Id = st.Id - pb.IsArchived = st.IsArchived - pb.IsDraft = st.IsDraft - pb.IsSafe = st.IsSafe - pb.Name = st.Name - pb.Options = st.Options - pb.Query = st.Query - pb.Tags = st.Tags - pb.UpdatedAt = st.UpdatedAt - pb.UserId = st.UserId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type alertQueryPb struct { - CreatedAt string `json:"created_at,omitempty"` - DataSourceId string `json:"data_source_id,omitempty"` - Description string `json:"description,omitempty"` - Id string `json:"id,omitempty"` - IsArchived bool `json:"is_archived,omitempty"` - IsDraft bool `json:"is_draft,omitempty"` - IsSafe bool `json:"is_safe,omitempty"` - Name string `json:"name,omitempty"` - Options *QueryOptions `json:"options,omitempty"` - Query string `json:"query,omitempty"` - Tags []string `json:"tags,omitempty"` - UpdatedAt string `json:"updated_at,omitempty"` - UserId int `json:"user_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func alertQueryFromPb(pb *alertQueryPb) (*AlertQuery, error) { - if pb == nil { - return nil, nil - } - st := &AlertQuery{} - st.CreatedAt = pb.CreatedAt - st.DataSourceId = pb.DataSourceId - st.Description = pb.Description - st.Id = pb.Id - st.IsArchived = pb.IsArchived - st.IsDraft = pb.IsDraft - st.IsSafe = pb.IsSafe - st.Name = pb.Name - st.Options = pb.Options - st.Query = pb.Query - st.Tags = pb.Tags - st.UpdatedAt = pb.UpdatedAt - st.UserId = pb.UserId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *alertQueryPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st alertQueryPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func alertV2ToPb(st *AlertV2) (*alertV2Pb, error) { - if st == nil { - return nil, nil - } - pb := &alertV2Pb{} - pb.CreateTime = st.CreateTime - pb.CustomDescription = st.CustomDescription - pb.CustomSummary = st.CustomSummary - pb.DisplayName = st.DisplayName - pb.Evaluation = st.Evaluation - pb.Id = st.Id - pb.LifecycleState = st.LifecycleState - pb.OwnerUserName = st.OwnerUserName - pb.ParentPath = st.ParentPath - pb.QueryText = st.QueryText - pb.RunAsUserName = st.RunAsUserName - pb.Schedule = st.Schedule - pb.UpdateTime = st.UpdateTime - pb.WarehouseId = st.WarehouseId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type alertV2Pb struct { - CreateTime string `json:"create_time,omitempty"` - CustomDescription string `json:"custom_description,omitempty"` - CustomSummary string `json:"custom_summary,omitempty"` - DisplayName string `json:"display_name,omitempty"` - Evaluation *AlertV2Evaluation `json:"evaluation,omitempty"` - Id string `json:"id,omitempty"` - LifecycleState LifecycleState `json:"lifecycle_state,omitempty"` - OwnerUserName string `json:"owner_user_name,omitempty"` - ParentPath string `json:"parent_path,omitempty"` - QueryText string `json:"query_text,omitempty"` - RunAsUserName string `json:"run_as_user_name,omitempty"` - Schedule *CronSchedule `json:"schedule,omitempty"` - UpdateTime string `json:"update_time,omitempty"` - WarehouseId string `json:"warehouse_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func alertV2FromPb(pb *alertV2Pb) (*AlertV2, error) { - if pb == nil { - return nil, nil - } - st := &AlertV2{} - st.CreateTime = pb.CreateTime - st.CustomDescription = pb.CustomDescription - st.CustomSummary = pb.CustomSummary - st.DisplayName = pb.DisplayName - st.Evaluation = pb.Evaluation - st.Id = pb.Id - st.LifecycleState = pb.LifecycleState - st.OwnerUserName = pb.OwnerUserName - st.ParentPath = pb.ParentPath - st.QueryText = pb.QueryText - st.RunAsUserName = pb.RunAsUserName - st.Schedule = pb.Schedule - st.UpdateTime = pb.UpdateTime - st.WarehouseId = pb.WarehouseId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *alertV2Pb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st alertV2Pb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func alertV2EvaluationToPb(st *AlertV2Evaluation) (*alertV2EvaluationPb, error) { - if st == nil { - return nil, nil - } - pb := &alertV2EvaluationPb{} - pb.ComparisonOperator = st.ComparisonOperator - pb.EmptyResultState = st.EmptyResultState - pb.LastEvaluatedAt = st.LastEvaluatedAt - pb.Notification = st.Notification - pb.Source = st.Source - pb.State = st.State - pb.Threshold = st.Threshold - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type alertV2EvaluationPb struct { - ComparisonOperator ComparisonOperator `json:"comparison_operator,omitempty"` - EmptyResultState AlertEvaluationState `json:"empty_result_state,omitempty"` - LastEvaluatedAt string `json:"last_evaluated_at,omitempty"` - Notification *AlertV2Notification `json:"notification,omitempty"` - Source *AlertV2OperandColumn `json:"source,omitempty"` - State AlertEvaluationState `json:"state,omitempty"` - Threshold *AlertV2Operand `json:"threshold,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func alertV2EvaluationFromPb(pb *alertV2EvaluationPb) (*AlertV2Evaluation, error) { - if pb == nil { - return nil, nil - } - st := &AlertV2Evaluation{} - st.ComparisonOperator = pb.ComparisonOperator - st.EmptyResultState = pb.EmptyResultState - st.LastEvaluatedAt = pb.LastEvaluatedAt - st.Notification = pb.Notification - st.Source = pb.Source - st.State = pb.State - st.Threshold = pb.Threshold - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *alertV2EvaluationPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st alertV2EvaluationPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func alertV2NotificationToPb(st *AlertV2Notification) (*alertV2NotificationPb, error) { - if st == nil { - return nil, nil - } - pb := &alertV2NotificationPb{} - pb.NotifyOnOk = st.NotifyOnOk - pb.RetriggerSeconds = st.RetriggerSeconds - pb.Subscriptions = st.Subscriptions - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type alertV2NotificationPb struct { - NotifyOnOk bool `json:"notify_on_ok,omitempty"` - RetriggerSeconds int `json:"retrigger_seconds,omitempty"` - Subscriptions []AlertV2Subscription `json:"subscriptions,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func alertV2NotificationFromPb(pb *alertV2NotificationPb) (*AlertV2Notification, error) { - if pb == nil { - return nil, nil - } - st := &AlertV2Notification{} - st.NotifyOnOk = pb.NotifyOnOk - st.RetriggerSeconds = pb.RetriggerSeconds - st.Subscriptions = pb.Subscriptions - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *alertV2NotificationPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st alertV2NotificationPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func alertV2OperandToPb(st *AlertV2Operand) (*alertV2OperandPb, error) { - if st == nil { - return nil, nil - } - pb := &alertV2OperandPb{} - pb.Column = st.Column - pb.Value = st.Value - - return pb, nil -} - -type alertV2OperandPb struct { - Column *AlertV2OperandColumn `json:"column,omitempty"` - Value *AlertV2OperandValue `json:"value,omitempty"` -} - -func alertV2OperandFromPb(pb *alertV2OperandPb) (*AlertV2Operand, error) { - if pb == nil { - return nil, nil - } - st := &AlertV2Operand{} - st.Column = pb.Column - st.Value = pb.Value - - return st, nil -} - -func alertV2OperandColumnToPb(st *AlertV2OperandColumn) (*alertV2OperandColumnPb, error) { - if st == nil { - return nil, nil - } - pb := &alertV2OperandColumnPb{} - pb.Aggregation = st.Aggregation - pb.Display = st.Display - pb.Name = st.Name - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type alertV2OperandColumnPb struct { - Aggregation Aggregation `json:"aggregation,omitempty"` - Display string `json:"display,omitempty"` - Name string `json:"name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func alertV2OperandColumnFromPb(pb *alertV2OperandColumnPb) (*AlertV2OperandColumn, error) { - if pb == nil { - return nil, nil - } - st := &AlertV2OperandColumn{} - st.Aggregation = pb.Aggregation - st.Display = pb.Display - st.Name = pb.Name - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *alertV2OperandColumnPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st alertV2OperandColumnPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func alertV2OperandValueToPb(st *AlertV2OperandValue) (*alertV2OperandValuePb, error) { - if st == nil { - return nil, nil - } - pb := &alertV2OperandValuePb{} - pb.BoolValue = st.BoolValue - pb.DoubleValue = st.DoubleValue - pb.StringValue = st.StringValue - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type alertV2OperandValuePb struct { - BoolValue bool `json:"bool_value,omitempty"` - DoubleValue float64 `json:"double_value,omitempty"` - StringValue string `json:"string_value,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func alertV2OperandValueFromPb(pb *alertV2OperandValuePb) (*AlertV2OperandValue, error) { - if pb == nil { - return nil, nil - } - st := &AlertV2OperandValue{} - st.BoolValue = pb.BoolValue - st.DoubleValue = pb.DoubleValue - st.StringValue = pb.StringValue - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *alertV2OperandValuePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st alertV2OperandValuePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func alertV2SubscriptionToPb(st *AlertV2Subscription) (*alertV2SubscriptionPb, error) { - if st == nil { - return nil, nil - } - pb := &alertV2SubscriptionPb{} - pb.DestinationId = st.DestinationId - pb.UserEmail = st.UserEmail - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type alertV2SubscriptionPb struct { - DestinationId string `json:"destination_id,omitempty"` - UserEmail string `json:"user_email,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func alertV2SubscriptionFromPb(pb *alertV2SubscriptionPb) (*AlertV2Subscription, error) { - if pb == nil { - return nil, nil - } - st := &AlertV2Subscription{} - st.DestinationId = pb.DestinationId - st.UserEmail = pb.UserEmail - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *alertV2SubscriptionPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st alertV2SubscriptionPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func baseChunkInfoToPb(st *BaseChunkInfo) (*baseChunkInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &baseChunkInfoPb{} - pb.ByteCount = st.ByteCount - pb.ChunkIndex = st.ChunkIndex - pb.RowCount = st.RowCount - pb.RowOffset = st.RowOffset - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type baseChunkInfoPb struct { - ByteCount int64 `json:"byte_count,omitempty"` - ChunkIndex int `json:"chunk_index,omitempty"` - RowCount int64 `json:"row_count,omitempty"` - RowOffset int64 `json:"row_offset,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func baseChunkInfoFromPb(pb *baseChunkInfoPb) (*BaseChunkInfo, error) { - if pb == nil { - return nil, nil - } - st := &BaseChunkInfo{} - st.ByteCount = pb.ByteCount - st.ChunkIndex = pb.ChunkIndex - st.RowCount = pb.RowCount - st.RowOffset = pb.RowOffset - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *baseChunkInfoPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st baseChunkInfoPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func cancelExecutionRequestToPb(st *CancelExecutionRequest) (*cancelExecutionRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &cancelExecutionRequestPb{} - pb.StatementId = st.StatementId - - return pb, nil -} - -type cancelExecutionRequestPb struct { - StatementId string `json:"-" url:"-"` -} - -func cancelExecutionRequestFromPb(pb *cancelExecutionRequestPb) (*CancelExecutionRequest, error) { - if pb == nil { - return nil, nil - } - st := &CancelExecutionRequest{} - st.StatementId = pb.StatementId - - return st, nil -} - -func cancelExecutionResponseToPb(st *CancelExecutionResponse) (*cancelExecutionResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &cancelExecutionResponsePb{} - - return pb, nil -} - -type cancelExecutionResponsePb struct { -} - -func cancelExecutionResponseFromPb(pb *cancelExecutionResponsePb) (*CancelExecutionResponse, error) { - if pb == nil { - return nil, nil - } - st := &CancelExecutionResponse{} - - return st, nil -} - -func channelToPb(st *Channel) (*channelPb, error) { - if st == nil { - return nil, nil - } - pb := &channelPb{} - pb.DbsqlVersion = st.DbsqlVersion - pb.Name = st.Name - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type channelPb struct { - DbsqlVersion string `json:"dbsql_version,omitempty"` - Name ChannelName `json:"name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func channelFromPb(pb *channelPb) (*Channel, error) { - if pb == nil { - return nil, nil - } - st := &Channel{} - st.DbsqlVersion = pb.DbsqlVersion - st.Name = pb.Name - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *channelPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st channelPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func channelInfoToPb(st *ChannelInfo) (*channelInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &channelInfoPb{} - pb.DbsqlVersion = st.DbsqlVersion - pb.Name = st.Name - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type channelInfoPb struct { - DbsqlVersion string `json:"dbsql_version,omitempty"` - Name ChannelName `json:"name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func channelInfoFromPb(pb *channelInfoPb) (*ChannelInfo, error) { - if pb == nil { - return nil, nil - } - st := &ChannelInfo{} - st.DbsqlVersion = pb.DbsqlVersion - st.Name = pb.Name - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *channelInfoPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st channelInfoPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func clientConfigToPb(st *ClientConfig) (*clientConfigPb, error) { - if st == nil { - return nil, nil - } - pb := &clientConfigPb{} - pb.AllowCustomJsVisualizations = st.AllowCustomJsVisualizations - pb.AllowDownloads = st.AllowDownloads - pb.AllowExternalShares = st.AllowExternalShares - pb.AllowSubscriptions = st.AllowSubscriptions - pb.DateFormat = st.DateFormat - pb.DateTimeFormat = st.DateTimeFormat - pb.DisablePublish = st.DisablePublish - pb.EnableLegacyAutodetectTypes = st.EnableLegacyAutodetectTypes - pb.FeatureShowPermissionsControl = st.FeatureShowPermissionsControl - pb.HidePlotlyModeBar = st.HidePlotlyModeBar - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type clientConfigPb struct { - AllowCustomJsVisualizations bool `json:"allow_custom_js_visualizations,omitempty"` - AllowDownloads bool `json:"allow_downloads,omitempty"` - AllowExternalShares bool `json:"allow_external_shares,omitempty"` - AllowSubscriptions bool `json:"allow_subscriptions,omitempty"` - DateFormat string `json:"date_format,omitempty"` - DateTimeFormat string `json:"date_time_format,omitempty"` - DisablePublish bool `json:"disable_publish,omitempty"` - EnableLegacyAutodetectTypes bool `json:"enable_legacy_autodetect_types,omitempty"` - FeatureShowPermissionsControl bool `json:"feature_show_permissions_control,omitempty"` - HidePlotlyModeBar bool `json:"hide_plotly_mode_bar,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func clientConfigFromPb(pb *clientConfigPb) (*ClientConfig, error) { - if pb == nil { - return nil, nil - } - st := &ClientConfig{} - st.AllowCustomJsVisualizations = pb.AllowCustomJsVisualizations - st.AllowDownloads = pb.AllowDownloads - st.AllowExternalShares = pb.AllowExternalShares - st.AllowSubscriptions = pb.AllowSubscriptions - st.DateFormat = pb.DateFormat - st.DateTimeFormat = pb.DateTimeFormat - st.DisablePublish = pb.DisablePublish - st.EnableLegacyAutodetectTypes = pb.EnableLegacyAutodetectTypes - st.FeatureShowPermissionsControl = pb.FeatureShowPermissionsControl - st.HidePlotlyModeBar = pb.HidePlotlyModeBar - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *clientConfigPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st clientConfigPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func columnInfoToPb(st *ColumnInfo) (*columnInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &columnInfoPb{} - pb.Name = st.Name - pb.Position = st.Position - pb.TypeIntervalType = st.TypeIntervalType - pb.TypeName = st.TypeName - pb.TypePrecision = st.TypePrecision - pb.TypeScale = st.TypeScale - pb.TypeText = st.TypeText - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type columnInfoPb struct { - Name string `json:"name,omitempty"` - Position int `json:"position,omitempty"` - TypeIntervalType string `json:"type_interval_type,omitempty"` - TypeName ColumnInfoTypeName `json:"type_name,omitempty"` - TypePrecision int `json:"type_precision,omitempty"` - TypeScale int `json:"type_scale,omitempty"` - TypeText string `json:"type_text,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func columnInfoFromPb(pb *columnInfoPb) (*ColumnInfo, error) { - if pb == nil { - return nil, nil - } - st := &ColumnInfo{} - st.Name = pb.Name - st.Position = pb.Position - st.TypeIntervalType = pb.TypeIntervalType - st.TypeName = pb.TypeName - st.TypePrecision = pb.TypePrecision - st.TypeScale = pb.TypeScale - st.TypeText = pb.TypeText - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *columnInfoPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st columnInfoPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createAlertToPb(st *CreateAlert) (*createAlertPb, error) { - if st == nil { - return nil, nil - } - pb := &createAlertPb{} - pb.Name = st.Name - pb.Options = st.Options - pb.Parent = st.Parent - pb.QueryId = st.QueryId - pb.Rearm = st.Rearm - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createAlertPb struct { - Name string `json:"name"` - Options AlertOptions `json:"options"` - Parent string `json:"parent,omitempty"` - QueryId string `json:"query_id"` - Rearm int `json:"rearm,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createAlertFromPb(pb *createAlertPb) (*CreateAlert, error) { - if pb == nil { - return nil, nil - } - st := &CreateAlert{} - st.Name = pb.Name - st.Options = pb.Options - st.Parent = pb.Parent - st.QueryId = pb.QueryId - st.Rearm = pb.Rearm - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createAlertPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createAlertPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createAlertRequestToPb(st *CreateAlertRequest) (*createAlertRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &createAlertRequestPb{} - pb.Alert = st.Alert - pb.AutoResolveDisplayName = st.AutoResolveDisplayName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createAlertRequestPb struct { - Alert *CreateAlertRequestAlert `json:"alert,omitempty"` - AutoResolveDisplayName bool `json:"auto_resolve_display_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createAlertRequestFromPb(pb *createAlertRequestPb) (*CreateAlertRequest, error) { - if pb == nil { - return nil, nil - } - st := &CreateAlertRequest{} - st.Alert = pb.Alert - st.AutoResolveDisplayName = pb.AutoResolveDisplayName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createAlertRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createAlertRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createAlertRequestAlertToPb(st *CreateAlertRequestAlert) (*createAlertRequestAlertPb, error) { - if st == nil { - return nil, nil - } - pb := &createAlertRequestAlertPb{} - pb.Condition = st.Condition - pb.CustomBody = st.CustomBody - pb.CustomSubject = st.CustomSubject - pb.DisplayName = st.DisplayName - pb.NotifyOnOk = st.NotifyOnOk - pb.ParentPath = st.ParentPath - pb.QueryId = st.QueryId - pb.SecondsToRetrigger = st.SecondsToRetrigger - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createAlertRequestAlertPb struct { - Condition *AlertCondition `json:"condition,omitempty"` - CustomBody string `json:"custom_body,omitempty"` - CustomSubject string `json:"custom_subject,omitempty"` - DisplayName string `json:"display_name,omitempty"` - NotifyOnOk bool `json:"notify_on_ok,omitempty"` - ParentPath string `json:"parent_path,omitempty"` - QueryId string `json:"query_id,omitempty"` - SecondsToRetrigger int `json:"seconds_to_retrigger,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createAlertRequestAlertFromPb(pb *createAlertRequestAlertPb) (*CreateAlertRequestAlert, error) { - if pb == nil { - return nil, nil - } - st := &CreateAlertRequestAlert{} - st.Condition = pb.Condition - st.CustomBody = pb.CustomBody - st.CustomSubject = pb.CustomSubject - st.DisplayName = pb.DisplayName - st.NotifyOnOk = pb.NotifyOnOk - st.ParentPath = pb.ParentPath - st.QueryId = pb.QueryId - st.SecondsToRetrigger = pb.SecondsToRetrigger - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createAlertRequestAlertPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createAlertRequestAlertPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createAlertV2RequestToPb(st *CreateAlertV2Request) (*createAlertV2RequestPb, error) { - if st == nil { - return nil, nil - } - pb := &createAlertV2RequestPb{} - pb.Alert = st.Alert - - return pb, nil -} - -type createAlertV2RequestPb struct { - Alert AlertV2 `json:"alert"` -} - -func createAlertV2RequestFromPb(pb *createAlertV2RequestPb) (*CreateAlertV2Request, error) { - if pb == nil { - return nil, nil - } - st := &CreateAlertV2Request{} - st.Alert = pb.Alert - - return st, nil -} - -func createQueryRequestToPb(st *CreateQueryRequest) (*createQueryRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &createQueryRequestPb{} - pb.AutoResolveDisplayName = st.AutoResolveDisplayName - pb.Query = st.Query - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createQueryRequestPb struct { - AutoResolveDisplayName bool `json:"auto_resolve_display_name,omitempty"` - Query *CreateQueryRequestQuery `json:"query,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createQueryRequestFromPb(pb *createQueryRequestPb) (*CreateQueryRequest, error) { - if pb == nil { - return nil, nil - } - st := &CreateQueryRequest{} - st.AutoResolveDisplayName = pb.AutoResolveDisplayName - st.Query = pb.Query - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createQueryRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createQueryRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createQueryRequestQueryToPb(st *CreateQueryRequestQuery) (*createQueryRequestQueryPb, error) { - if st == nil { - return nil, nil - } - pb := &createQueryRequestQueryPb{} - pb.ApplyAutoLimit = st.ApplyAutoLimit - pb.Catalog = st.Catalog - pb.Description = st.Description - pb.DisplayName = st.DisplayName - pb.Parameters = st.Parameters - pb.ParentPath = st.ParentPath - pb.QueryText = st.QueryText - pb.RunAsMode = st.RunAsMode - pb.Schema = st.Schema - pb.Tags = st.Tags - pb.WarehouseId = st.WarehouseId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createQueryRequestQueryPb struct { - ApplyAutoLimit bool `json:"apply_auto_limit,omitempty"` - Catalog string `json:"catalog,omitempty"` - Description string `json:"description,omitempty"` - DisplayName string `json:"display_name,omitempty"` - Parameters []QueryParameter `json:"parameters,omitempty"` - ParentPath string `json:"parent_path,omitempty"` - QueryText string `json:"query_text,omitempty"` - RunAsMode RunAsMode `json:"run_as_mode,omitempty"` - Schema string `json:"schema,omitempty"` - Tags []string `json:"tags,omitempty"` - WarehouseId string `json:"warehouse_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createQueryRequestQueryFromPb(pb *createQueryRequestQueryPb) (*CreateQueryRequestQuery, error) { - if pb == nil { - return nil, nil - } - st := &CreateQueryRequestQuery{} - st.ApplyAutoLimit = pb.ApplyAutoLimit - st.Catalog = pb.Catalog - st.Description = pb.Description - st.DisplayName = pb.DisplayName - st.Parameters = pb.Parameters - st.ParentPath = pb.ParentPath - st.QueryText = pb.QueryText - st.RunAsMode = pb.RunAsMode - st.Schema = pb.Schema - st.Tags = pb.Tags - st.WarehouseId = pb.WarehouseId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createQueryRequestQueryPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createQueryRequestQueryPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createQueryVisualizationsLegacyRequestToPb(st *CreateQueryVisualizationsLegacyRequest) (*createQueryVisualizationsLegacyRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &createQueryVisualizationsLegacyRequestPb{} - pb.Description = st.Description - pb.Name = st.Name - pb.Options = st.Options - pb.QueryId = st.QueryId - pb.Type = st.Type - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createQueryVisualizationsLegacyRequestPb struct { - Description string `json:"description,omitempty"` - Name string `json:"name,omitempty"` - Options any `json:"options"` - QueryId string `json:"query_id"` - Type string `json:"type"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createQueryVisualizationsLegacyRequestFromPb(pb *createQueryVisualizationsLegacyRequestPb) (*CreateQueryVisualizationsLegacyRequest, error) { - if pb == nil { - return nil, nil - } - st := &CreateQueryVisualizationsLegacyRequest{} - st.Description = pb.Description - st.Name = pb.Name - st.Options = pb.Options - st.QueryId = pb.QueryId - st.Type = pb.Type - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createQueryVisualizationsLegacyRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createQueryVisualizationsLegacyRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createVisualizationRequestToPb(st *CreateVisualizationRequest) (*createVisualizationRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &createVisualizationRequestPb{} - pb.Visualization = st.Visualization - - return pb, nil -} - -type createVisualizationRequestPb struct { - Visualization *CreateVisualizationRequestVisualization `json:"visualization,omitempty"` -} - -func createVisualizationRequestFromPb(pb *createVisualizationRequestPb) (*CreateVisualizationRequest, error) { - if pb == nil { - return nil, nil - } - st := &CreateVisualizationRequest{} - st.Visualization = pb.Visualization - - return st, nil -} - -func createVisualizationRequestVisualizationToPb(st *CreateVisualizationRequestVisualization) (*createVisualizationRequestVisualizationPb, error) { - if st == nil { - return nil, nil - } - pb := &createVisualizationRequestVisualizationPb{} - pb.DisplayName = st.DisplayName - pb.QueryId = st.QueryId - pb.SerializedOptions = st.SerializedOptions - pb.SerializedQueryPlan = st.SerializedQueryPlan - pb.Type = st.Type - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createVisualizationRequestVisualizationPb struct { - DisplayName string `json:"display_name,omitempty"` - QueryId string `json:"query_id,omitempty"` - SerializedOptions string `json:"serialized_options,omitempty"` - SerializedQueryPlan string `json:"serialized_query_plan,omitempty"` - Type string `json:"type,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createVisualizationRequestVisualizationFromPb(pb *createVisualizationRequestVisualizationPb) (*CreateVisualizationRequestVisualization, error) { - if pb == nil { - return nil, nil - } - st := &CreateVisualizationRequestVisualization{} - st.DisplayName = pb.DisplayName - st.QueryId = pb.QueryId - st.SerializedOptions = pb.SerializedOptions - st.SerializedQueryPlan = pb.SerializedQueryPlan - st.Type = pb.Type - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createVisualizationRequestVisualizationPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createVisualizationRequestVisualizationPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createWarehouseRequestToPb(st *CreateWarehouseRequest) (*createWarehouseRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &createWarehouseRequestPb{} - pb.AutoStopMins = st.AutoStopMins - pb.Channel = st.Channel - pb.ClusterSize = st.ClusterSize - pb.CreatorName = st.CreatorName - pb.EnablePhoton = st.EnablePhoton - pb.EnableServerlessCompute = st.EnableServerlessCompute - pb.InstanceProfileArn = st.InstanceProfileArn - pb.MaxNumClusters = st.MaxNumClusters - pb.MinNumClusters = st.MinNumClusters - pb.Name = st.Name - pb.SpotInstancePolicy = st.SpotInstancePolicy - pb.Tags = st.Tags - pb.WarehouseType = st.WarehouseType - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createWarehouseRequestPb struct { - AutoStopMins int `json:"auto_stop_mins,omitempty"` - Channel *Channel `json:"channel,omitempty"` - ClusterSize string `json:"cluster_size,omitempty"` - CreatorName string `json:"creator_name,omitempty"` - EnablePhoton bool `json:"enable_photon,omitempty"` - EnableServerlessCompute bool `json:"enable_serverless_compute,omitempty"` - InstanceProfileArn string `json:"instance_profile_arn,omitempty"` - MaxNumClusters int `json:"max_num_clusters,omitempty"` - MinNumClusters int `json:"min_num_clusters,omitempty"` - Name string `json:"name,omitempty"` - SpotInstancePolicy SpotInstancePolicy `json:"spot_instance_policy,omitempty"` - Tags *EndpointTags `json:"tags,omitempty"` - WarehouseType CreateWarehouseRequestWarehouseType `json:"warehouse_type,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createWarehouseRequestFromPb(pb *createWarehouseRequestPb) (*CreateWarehouseRequest, error) { - if pb == nil { - return nil, nil - } - st := &CreateWarehouseRequest{} - st.AutoStopMins = pb.AutoStopMins - st.Channel = pb.Channel - st.ClusterSize = pb.ClusterSize - st.CreatorName = pb.CreatorName - st.EnablePhoton = pb.EnablePhoton - st.EnableServerlessCompute = pb.EnableServerlessCompute - st.InstanceProfileArn = pb.InstanceProfileArn - st.MaxNumClusters = pb.MaxNumClusters - st.MinNumClusters = pb.MinNumClusters - st.Name = pb.Name - st.SpotInstancePolicy = pb.SpotInstancePolicy - st.Tags = pb.Tags - st.WarehouseType = pb.WarehouseType - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createWarehouseRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createWarehouseRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createWarehouseResponseToPb(st *CreateWarehouseResponse) (*createWarehouseResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &createWarehouseResponsePb{} - pb.Id = st.Id - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createWarehouseResponsePb struct { - Id string `json:"id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createWarehouseResponseFromPb(pb *createWarehouseResponsePb) (*CreateWarehouseResponse, error) { - if pb == nil { - return nil, nil - } - st := &CreateWarehouseResponse{} - st.Id = pb.Id - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createWarehouseResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createWarehouseResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createWidgetToPb(st *CreateWidget) (*createWidgetPb, error) { - if st == nil { - return nil, nil - } - pb := &createWidgetPb{} - pb.DashboardId = st.DashboardId - pb.Id = st.Id - pb.Options = st.Options - pb.Text = st.Text - pb.VisualizationId = st.VisualizationId - pb.Width = st.Width - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createWidgetPb struct { - DashboardId string `json:"dashboard_id"` - Id string `json:"-" url:"-"` - Options WidgetOptions `json:"options"` - Text string `json:"text,omitempty"` - VisualizationId string `json:"visualization_id,omitempty"` - Width int `json:"width"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createWidgetFromPb(pb *createWidgetPb) (*CreateWidget, error) { - if pb == nil { - return nil, nil - } - st := &CreateWidget{} - st.DashboardId = pb.DashboardId - st.Id = pb.Id - st.Options = pb.Options - st.Text = pb.Text - st.VisualizationId = pb.VisualizationId - st.Width = pb.Width - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createWidgetPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createWidgetPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func cronScheduleToPb(st *CronSchedule) (*cronSchedulePb, error) { - if st == nil { - return nil, nil - } - pb := &cronSchedulePb{} - pb.PauseStatus = st.PauseStatus - pb.QuartzCronSchedule = st.QuartzCronSchedule - pb.TimezoneId = st.TimezoneId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type cronSchedulePb struct { - PauseStatus SchedulePauseStatus `json:"pause_status,omitempty"` - QuartzCronSchedule string `json:"quartz_cron_schedule,omitempty"` - TimezoneId string `json:"timezone_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func cronScheduleFromPb(pb *cronSchedulePb) (*CronSchedule, error) { - if pb == nil { - return nil, nil - } - st := &CronSchedule{} - st.PauseStatus = pb.PauseStatus - st.QuartzCronSchedule = pb.QuartzCronSchedule - st.TimezoneId = pb.TimezoneId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *cronSchedulePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st cronSchedulePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func dashboardToPb(st *Dashboard) (*dashboardPb, error) { - if st == nil { - return nil, nil - } - pb := &dashboardPb{} - pb.CanEdit = st.CanEdit - pb.CreatedAt = st.CreatedAt - pb.DashboardFiltersEnabled = st.DashboardFiltersEnabled - pb.Id = st.Id - pb.IsArchived = st.IsArchived - pb.IsDraft = st.IsDraft - pb.IsFavorite = st.IsFavorite - pb.Name = st.Name - pb.Options = st.Options - pb.Parent = st.Parent - pb.PermissionTier = st.PermissionTier - pb.Slug = st.Slug - pb.Tags = st.Tags - pb.UpdatedAt = st.UpdatedAt - pb.User = st.User - pb.UserId = st.UserId - pb.Widgets = st.Widgets - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type dashboardPb struct { - CanEdit bool `json:"can_edit,omitempty"` - CreatedAt string `json:"created_at,omitempty"` - DashboardFiltersEnabled bool `json:"dashboard_filters_enabled,omitempty"` - Id string `json:"id,omitempty"` - IsArchived bool `json:"is_archived,omitempty"` - IsDraft bool `json:"is_draft,omitempty"` - IsFavorite bool `json:"is_favorite,omitempty"` - Name string `json:"name,omitempty"` - Options *DashboardOptions `json:"options,omitempty"` - Parent string `json:"parent,omitempty"` - PermissionTier PermissionLevel `json:"permission_tier,omitempty"` - Slug string `json:"slug,omitempty"` - Tags []string `json:"tags,omitempty"` - UpdatedAt string `json:"updated_at,omitempty"` - User *User `json:"user,omitempty"` - UserId int `json:"user_id,omitempty"` - Widgets []Widget `json:"widgets,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func dashboardFromPb(pb *dashboardPb) (*Dashboard, error) { - if pb == nil { - return nil, nil - } - st := &Dashboard{} - st.CanEdit = pb.CanEdit - st.CreatedAt = pb.CreatedAt - st.DashboardFiltersEnabled = pb.DashboardFiltersEnabled - st.Id = pb.Id - st.IsArchived = pb.IsArchived - st.IsDraft = pb.IsDraft - st.IsFavorite = pb.IsFavorite - st.Name = pb.Name - st.Options = pb.Options - st.Parent = pb.Parent - st.PermissionTier = pb.PermissionTier - st.Slug = pb.Slug - st.Tags = pb.Tags - st.UpdatedAt = pb.UpdatedAt - st.User = pb.User - st.UserId = pb.UserId - st.Widgets = pb.Widgets - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *dashboardPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st dashboardPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func dashboardEditContentToPb(st *DashboardEditContent) (*dashboardEditContentPb, error) { - if st == nil { - return nil, nil - } - pb := &dashboardEditContentPb{} - pb.DashboardId = st.DashboardId - pb.Name = st.Name - pb.RunAsRole = st.RunAsRole - pb.Tags = st.Tags - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type dashboardEditContentPb struct { - DashboardId string `json:"-" url:"-"` - Name string `json:"name,omitempty"` - RunAsRole RunAsRole `json:"run_as_role,omitempty"` - Tags []string `json:"tags,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func dashboardEditContentFromPb(pb *dashboardEditContentPb) (*DashboardEditContent, error) { - if pb == nil { - return nil, nil - } - st := &DashboardEditContent{} - st.DashboardId = pb.DashboardId - st.Name = pb.Name - st.RunAsRole = pb.RunAsRole - st.Tags = pb.Tags - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *dashboardEditContentPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st dashboardEditContentPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func dashboardOptionsToPb(st *DashboardOptions) (*dashboardOptionsPb, error) { - if st == nil { - return nil, nil - } - pb := &dashboardOptionsPb{} - pb.MovedToTrashAt = st.MovedToTrashAt - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type dashboardOptionsPb struct { - MovedToTrashAt string `json:"moved_to_trash_at,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func dashboardOptionsFromPb(pb *dashboardOptionsPb) (*DashboardOptions, error) { - if pb == nil { - return nil, nil - } - st := &DashboardOptions{} - st.MovedToTrashAt = pb.MovedToTrashAt - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *dashboardOptionsPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st dashboardOptionsPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func dashboardPostContentToPb(st *DashboardPostContent) (*dashboardPostContentPb, error) { - if st == nil { - return nil, nil - } - pb := &dashboardPostContentPb{} - pb.DashboardFiltersEnabled = st.DashboardFiltersEnabled - pb.IsFavorite = st.IsFavorite - pb.Name = st.Name - pb.Parent = st.Parent - pb.RunAsRole = st.RunAsRole - pb.Tags = st.Tags - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type dashboardPostContentPb struct { - DashboardFiltersEnabled bool `json:"dashboard_filters_enabled,omitempty"` - IsFavorite bool `json:"is_favorite,omitempty"` - Name string `json:"name"` - Parent string `json:"parent,omitempty"` - RunAsRole RunAsRole `json:"run_as_role,omitempty"` - Tags []string `json:"tags,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func dashboardPostContentFromPb(pb *dashboardPostContentPb) (*DashboardPostContent, error) { - if pb == nil { - return nil, nil - } - st := &DashboardPostContent{} - st.DashboardFiltersEnabled = pb.DashboardFiltersEnabled - st.IsFavorite = pb.IsFavorite - st.Name = pb.Name - st.Parent = pb.Parent - st.RunAsRole = pb.RunAsRole - st.Tags = pb.Tags - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *dashboardPostContentPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st dashboardPostContentPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func dataSourceToPb(st *DataSource) (*dataSourcePb, error) { - if st == nil { - return nil, nil - } - pb := &dataSourcePb{} - pb.Id = st.Id - pb.Name = st.Name - pb.PauseReason = st.PauseReason - pb.Paused = st.Paused - pb.SupportsAutoLimit = st.SupportsAutoLimit - pb.Syntax = st.Syntax - pb.Type = st.Type - pb.ViewOnly = st.ViewOnly - pb.WarehouseId = st.WarehouseId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type dataSourcePb struct { - Id string `json:"id,omitempty"` - Name string `json:"name,omitempty"` - PauseReason string `json:"pause_reason,omitempty"` - Paused int `json:"paused,omitempty"` - SupportsAutoLimit bool `json:"supports_auto_limit,omitempty"` - Syntax string `json:"syntax,omitempty"` - Type string `json:"type,omitempty"` - ViewOnly bool `json:"view_only,omitempty"` - WarehouseId string `json:"warehouse_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func dataSourceFromPb(pb *dataSourcePb) (*DataSource, error) { - if pb == nil { - return nil, nil - } - st := &DataSource{} - st.Id = pb.Id - st.Name = pb.Name - st.PauseReason = pb.PauseReason - st.Paused = pb.Paused - st.SupportsAutoLimit = pb.SupportsAutoLimit - st.Syntax = pb.Syntax - st.Type = pb.Type - st.ViewOnly = pb.ViewOnly - st.WarehouseId = pb.WarehouseId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *dataSourcePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st dataSourcePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func dateRangeToPb(st *DateRange) (*dateRangePb, error) { - if st == nil { - return nil, nil - } - pb := &dateRangePb{} - pb.End = st.End - pb.Start = st.Start - - return pb, nil -} - -type dateRangePb struct { - End string `json:"end"` - Start string `json:"start"` -} - -func dateRangeFromPb(pb *dateRangePb) (*DateRange, error) { - if pb == nil { - return nil, nil - } - st := &DateRange{} - st.End = pb.End - st.Start = pb.Start - - return st, nil -} - -func dateRangeValueToPb(st *DateRangeValue) (*dateRangeValuePb, error) { - if st == nil { - return nil, nil - } - pb := &dateRangeValuePb{} - pb.DateRangeValue = st.DateRangeValue - pb.DynamicDateRangeValue = st.DynamicDateRangeValue - pb.Precision = st.Precision - pb.StartDayOfWeek = st.StartDayOfWeek - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type dateRangeValuePb struct { - DateRangeValue *DateRange `json:"date_range_value,omitempty"` - DynamicDateRangeValue DateRangeValueDynamicDateRange `json:"dynamic_date_range_value,omitempty"` - Precision DatePrecision `json:"precision,omitempty"` - StartDayOfWeek int `json:"start_day_of_week,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func dateRangeValueFromPb(pb *dateRangeValuePb) (*DateRangeValue, error) { - if pb == nil { - return nil, nil - } - st := &DateRangeValue{} - st.DateRangeValue = pb.DateRangeValue - st.DynamicDateRangeValue = pb.DynamicDateRangeValue - st.Precision = pb.Precision - st.StartDayOfWeek = pb.StartDayOfWeek - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *dateRangeValuePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st dateRangeValuePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func dateValueToPb(st *DateValue) (*dateValuePb, error) { - if st == nil { - return nil, nil - } - pb := &dateValuePb{} - pb.DateValue = st.DateValue - pb.DynamicDateValue = st.DynamicDateValue - pb.Precision = st.Precision - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type dateValuePb struct { - DateValue string `json:"date_value,omitempty"` - DynamicDateValue DateValueDynamicDate `json:"dynamic_date_value,omitempty"` - Precision DatePrecision `json:"precision,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func dateValueFromPb(pb *dateValuePb) (*DateValue, error) { - if pb == nil { - return nil, nil - } - st := &DateValue{} - st.DateValue = pb.DateValue - st.DynamicDateValue = pb.DynamicDateValue - st.Precision = pb.Precision - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *dateValuePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st dateValuePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func deleteAlertsLegacyRequestToPb(st *DeleteAlertsLegacyRequest) (*deleteAlertsLegacyRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteAlertsLegacyRequestPb{} - pb.AlertId = st.AlertId - - return pb, nil -} - -type deleteAlertsLegacyRequestPb struct { - AlertId string `json:"-" url:"-"` -} - -func deleteAlertsLegacyRequestFromPb(pb *deleteAlertsLegacyRequestPb) (*DeleteAlertsLegacyRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteAlertsLegacyRequest{} - st.AlertId = pb.AlertId - - return st, nil -} - -func deleteDashboardRequestToPb(st *DeleteDashboardRequest) (*deleteDashboardRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteDashboardRequestPb{} - pb.DashboardId = st.DashboardId - - return pb, nil -} - -type deleteDashboardRequestPb struct { - DashboardId string `json:"-" url:"-"` -} - -func deleteDashboardRequestFromPb(pb *deleteDashboardRequestPb) (*DeleteDashboardRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteDashboardRequest{} - st.DashboardId = pb.DashboardId - - return st, nil -} - -func deleteDashboardWidgetRequestToPb(st *DeleteDashboardWidgetRequest) (*deleteDashboardWidgetRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteDashboardWidgetRequestPb{} - pb.Id = st.Id - - return pb, nil -} - -type deleteDashboardWidgetRequestPb struct { - Id string `json:"-" url:"-"` -} - -func deleteDashboardWidgetRequestFromPb(pb *deleteDashboardWidgetRequestPb) (*DeleteDashboardWidgetRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteDashboardWidgetRequest{} - st.Id = pb.Id - - return st, nil -} - -func deleteQueriesLegacyRequestToPb(st *DeleteQueriesLegacyRequest) (*deleteQueriesLegacyRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteQueriesLegacyRequestPb{} - pb.QueryId = st.QueryId - - return pb, nil -} - -type deleteQueriesLegacyRequestPb struct { - QueryId string `json:"-" url:"-"` -} - -func deleteQueriesLegacyRequestFromPb(pb *deleteQueriesLegacyRequestPb) (*DeleteQueriesLegacyRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteQueriesLegacyRequest{} - st.QueryId = pb.QueryId - - return st, nil -} - -func deleteQueryVisualizationsLegacyRequestToPb(st *DeleteQueryVisualizationsLegacyRequest) (*deleteQueryVisualizationsLegacyRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteQueryVisualizationsLegacyRequestPb{} - pb.Id = st.Id - - return pb, nil -} - -type deleteQueryVisualizationsLegacyRequestPb struct { - Id string `json:"-" url:"-"` -} - -func deleteQueryVisualizationsLegacyRequestFromPb(pb *deleteQueryVisualizationsLegacyRequestPb) (*DeleteQueryVisualizationsLegacyRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteQueryVisualizationsLegacyRequest{} - st.Id = pb.Id - - return st, nil -} - -func deleteResponseToPb(st *DeleteResponse) (*deleteResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteResponsePb{} - - return pb, nil -} - -type deleteResponsePb struct { -} - -func deleteResponseFromPb(pb *deleteResponsePb) (*DeleteResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteResponse{} - - return st, nil -} - -func deleteVisualizationRequestToPb(st *DeleteVisualizationRequest) (*deleteVisualizationRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteVisualizationRequestPb{} - pb.Id = st.Id - - return pb, nil -} - -type deleteVisualizationRequestPb struct { - Id string `json:"-" url:"-"` -} - -func deleteVisualizationRequestFromPb(pb *deleteVisualizationRequestPb) (*DeleteVisualizationRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteVisualizationRequest{} - st.Id = pb.Id - - return st, nil -} - -func deleteWarehouseRequestToPb(st *DeleteWarehouseRequest) (*deleteWarehouseRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteWarehouseRequestPb{} - pb.Id = st.Id - - return pb, nil -} - -type deleteWarehouseRequestPb struct { - Id string `json:"-" url:"-"` -} - -func deleteWarehouseRequestFromPb(pb *deleteWarehouseRequestPb) (*DeleteWarehouseRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteWarehouseRequest{} - st.Id = pb.Id - - return st, nil -} - -func deleteWarehouseResponseToPb(st *DeleteWarehouseResponse) (*deleteWarehouseResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteWarehouseResponsePb{} - - return pb, nil -} - -type deleteWarehouseResponsePb struct { -} - -func deleteWarehouseResponseFromPb(pb *deleteWarehouseResponsePb) (*DeleteWarehouseResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteWarehouseResponse{} - - return st, nil -} - -func editAlertToPb(st *EditAlert) (*editAlertPb, error) { - if st == nil { - return nil, nil - } - pb := &editAlertPb{} - pb.AlertId = st.AlertId - pb.Name = st.Name - pb.Options = st.Options - pb.QueryId = st.QueryId - pb.Rearm = st.Rearm - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type editAlertPb struct { - AlertId string `json:"-" url:"-"` - Name string `json:"name"` - Options AlertOptions `json:"options"` - QueryId string `json:"query_id"` - Rearm int `json:"rearm,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func editAlertFromPb(pb *editAlertPb) (*EditAlert, error) { - if pb == nil { - return nil, nil - } - st := &EditAlert{} - st.AlertId = pb.AlertId - st.Name = pb.Name - st.Options = pb.Options - st.QueryId = pb.QueryId - st.Rearm = pb.Rearm - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *editAlertPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st editAlertPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func editWarehouseRequestToPb(st *EditWarehouseRequest) (*editWarehouseRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &editWarehouseRequestPb{} - pb.AutoStopMins = st.AutoStopMins - pb.Channel = st.Channel - pb.ClusterSize = st.ClusterSize - pb.CreatorName = st.CreatorName - pb.EnablePhoton = st.EnablePhoton - pb.EnableServerlessCompute = st.EnableServerlessCompute - pb.Id = st.Id - pb.InstanceProfileArn = st.InstanceProfileArn - pb.MaxNumClusters = st.MaxNumClusters - pb.MinNumClusters = st.MinNumClusters - pb.Name = st.Name - pb.SpotInstancePolicy = st.SpotInstancePolicy - pb.Tags = st.Tags - pb.WarehouseType = st.WarehouseType - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type editWarehouseRequestPb struct { - AutoStopMins int `json:"auto_stop_mins,omitempty"` - Channel *Channel `json:"channel,omitempty"` - ClusterSize string `json:"cluster_size,omitempty"` - CreatorName string `json:"creator_name,omitempty"` - EnablePhoton bool `json:"enable_photon,omitempty"` - EnableServerlessCompute bool `json:"enable_serverless_compute,omitempty"` - Id string `json:"-" url:"-"` - InstanceProfileArn string `json:"instance_profile_arn,omitempty"` - MaxNumClusters int `json:"max_num_clusters,omitempty"` - MinNumClusters int `json:"min_num_clusters,omitempty"` - Name string `json:"name,omitempty"` - SpotInstancePolicy SpotInstancePolicy `json:"spot_instance_policy,omitempty"` - Tags *EndpointTags `json:"tags,omitempty"` - WarehouseType EditWarehouseRequestWarehouseType `json:"warehouse_type,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func editWarehouseRequestFromPb(pb *editWarehouseRequestPb) (*EditWarehouseRequest, error) { - if pb == nil { - return nil, nil - } - st := &EditWarehouseRequest{} - st.AutoStopMins = pb.AutoStopMins - st.Channel = pb.Channel - st.ClusterSize = pb.ClusterSize - st.CreatorName = pb.CreatorName - st.EnablePhoton = pb.EnablePhoton - st.EnableServerlessCompute = pb.EnableServerlessCompute - st.Id = pb.Id - st.InstanceProfileArn = pb.InstanceProfileArn - st.MaxNumClusters = pb.MaxNumClusters - st.MinNumClusters = pb.MinNumClusters - st.Name = pb.Name - st.SpotInstancePolicy = pb.SpotInstancePolicy - st.Tags = pb.Tags - st.WarehouseType = pb.WarehouseType - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *editWarehouseRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st editWarehouseRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func editWarehouseResponseToPb(st *EditWarehouseResponse) (*editWarehouseResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &editWarehouseResponsePb{} - - return pb, nil -} - -type editWarehouseResponsePb struct { -} - -func editWarehouseResponseFromPb(pb *editWarehouseResponsePb) (*EditWarehouseResponse, error) { - if pb == nil { - return nil, nil - } - st := &EditWarehouseResponse{} - - return st, nil -} - -func emptyToPb(st *Empty) (*emptyPb, error) { - if st == nil { - return nil, nil - } - pb := &emptyPb{} - - return pb, nil -} - -type emptyPb struct { -} - -func emptyFromPb(pb *emptyPb) (*Empty, error) { - if pb == nil { - return nil, nil - } - st := &Empty{} - - return st, nil -} - -func endpointConfPairToPb(st *EndpointConfPair) (*endpointConfPairPb, error) { - if st == nil { - return nil, nil - } - pb := &endpointConfPairPb{} - pb.Key = st.Key - pb.Value = st.Value - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type endpointConfPairPb struct { - Key string `json:"key,omitempty"` - Value string `json:"value,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func endpointConfPairFromPb(pb *endpointConfPairPb) (*EndpointConfPair, error) { - if pb == nil { - return nil, nil - } - st := &EndpointConfPair{} - st.Key = pb.Key - st.Value = pb.Value - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *endpointConfPairPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st endpointConfPairPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func endpointHealthToPb(st *EndpointHealth) (*endpointHealthPb, error) { - if st == nil { - return nil, nil - } - pb := &endpointHealthPb{} - pb.Details = st.Details - pb.FailureReason = st.FailureReason - pb.Message = st.Message - pb.Status = st.Status - pb.Summary = st.Summary - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type endpointHealthPb struct { - Details string `json:"details,omitempty"` - FailureReason *TerminationReason `json:"failure_reason,omitempty"` - Message string `json:"message,omitempty"` - Status Status `json:"status,omitempty"` - Summary string `json:"summary,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func endpointHealthFromPb(pb *endpointHealthPb) (*EndpointHealth, error) { - if pb == nil { - return nil, nil - } - st := &EndpointHealth{} - st.Details = pb.Details - st.FailureReason = pb.FailureReason - st.Message = pb.Message - st.Status = pb.Status - st.Summary = pb.Summary - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *endpointHealthPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st endpointHealthPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func endpointInfoToPb(st *EndpointInfo) (*endpointInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &endpointInfoPb{} - pb.AutoStopMins = st.AutoStopMins - pb.Channel = st.Channel - pb.ClusterSize = st.ClusterSize - pb.CreatorName = st.CreatorName - pb.EnablePhoton = st.EnablePhoton - pb.EnableServerlessCompute = st.EnableServerlessCompute - pb.Health = st.Health - pb.Id = st.Id - pb.InstanceProfileArn = st.InstanceProfileArn - pb.JdbcUrl = st.JdbcUrl - pb.MaxNumClusters = st.MaxNumClusters - pb.MinNumClusters = st.MinNumClusters - pb.Name = st.Name - pb.NumActiveSessions = st.NumActiveSessions - pb.NumClusters = st.NumClusters - pb.OdbcParams = st.OdbcParams - pb.SpotInstancePolicy = st.SpotInstancePolicy - pb.State = st.State - pb.Tags = st.Tags - pb.WarehouseType = st.WarehouseType - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type endpointInfoPb struct { - AutoStopMins int `json:"auto_stop_mins,omitempty"` - Channel *Channel `json:"channel,omitempty"` - ClusterSize string `json:"cluster_size,omitempty"` - CreatorName string `json:"creator_name,omitempty"` - EnablePhoton bool `json:"enable_photon,omitempty"` - EnableServerlessCompute bool `json:"enable_serverless_compute,omitempty"` - Health *EndpointHealth `json:"health,omitempty"` - Id string `json:"id,omitempty"` - InstanceProfileArn string `json:"instance_profile_arn,omitempty"` - JdbcUrl string `json:"jdbc_url,omitempty"` - MaxNumClusters int `json:"max_num_clusters,omitempty"` - MinNumClusters int `json:"min_num_clusters,omitempty"` - Name string `json:"name,omitempty"` - NumActiveSessions int64 `json:"num_active_sessions,omitempty"` - NumClusters int `json:"num_clusters,omitempty"` - OdbcParams *OdbcParams `json:"odbc_params,omitempty"` - SpotInstancePolicy SpotInstancePolicy `json:"spot_instance_policy,omitempty"` - State State `json:"state,omitempty"` - Tags *EndpointTags `json:"tags,omitempty"` - WarehouseType EndpointInfoWarehouseType `json:"warehouse_type,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func endpointInfoFromPb(pb *endpointInfoPb) (*EndpointInfo, error) { - if pb == nil { - return nil, nil - } - st := &EndpointInfo{} - st.AutoStopMins = pb.AutoStopMins - st.Channel = pb.Channel - st.ClusterSize = pb.ClusterSize - st.CreatorName = pb.CreatorName - st.EnablePhoton = pb.EnablePhoton - st.EnableServerlessCompute = pb.EnableServerlessCompute - st.Health = pb.Health - st.Id = pb.Id - st.InstanceProfileArn = pb.InstanceProfileArn - st.JdbcUrl = pb.JdbcUrl - st.MaxNumClusters = pb.MaxNumClusters - st.MinNumClusters = pb.MinNumClusters - st.Name = pb.Name - st.NumActiveSessions = pb.NumActiveSessions - st.NumClusters = pb.NumClusters - st.OdbcParams = pb.OdbcParams - st.SpotInstancePolicy = pb.SpotInstancePolicy - st.State = pb.State - st.Tags = pb.Tags - st.WarehouseType = pb.WarehouseType - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *endpointInfoPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st endpointInfoPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func endpointTagPairToPb(st *EndpointTagPair) (*endpointTagPairPb, error) { - if st == nil { - return nil, nil - } - pb := &endpointTagPairPb{} - pb.Key = st.Key - pb.Value = st.Value - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type endpointTagPairPb struct { - Key string `json:"key,omitempty"` - Value string `json:"value,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func endpointTagPairFromPb(pb *endpointTagPairPb) (*EndpointTagPair, error) { - if pb == nil { - return nil, nil - } - st := &EndpointTagPair{} - st.Key = pb.Key - st.Value = pb.Value - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *endpointTagPairPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st endpointTagPairPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func endpointTagsToPb(st *EndpointTags) (*endpointTagsPb, error) { - if st == nil { - return nil, nil - } - pb := &endpointTagsPb{} - pb.CustomTags = st.CustomTags - - return pb, nil -} - -type endpointTagsPb struct { - CustomTags []EndpointTagPair `json:"custom_tags,omitempty"` -} - -func endpointTagsFromPb(pb *endpointTagsPb) (*EndpointTags, error) { - if pb == nil { - return nil, nil - } - st := &EndpointTags{} - st.CustomTags = pb.CustomTags - - return st, nil -} - -func enumValueToPb(st *EnumValue) (*enumValuePb, error) { - if st == nil { - return nil, nil - } - pb := &enumValuePb{} - pb.EnumOptions = st.EnumOptions - pb.MultiValuesOptions = st.MultiValuesOptions - pb.Values = st.Values - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type enumValuePb struct { - EnumOptions string `json:"enum_options,omitempty"` - MultiValuesOptions *MultiValuesOptions `json:"multi_values_options,omitempty"` - Values []string `json:"values,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func enumValueFromPb(pb *enumValuePb) (*EnumValue, error) { - if pb == nil { - return nil, nil - } - st := &EnumValue{} - st.EnumOptions = pb.EnumOptions - st.MultiValuesOptions = pb.MultiValuesOptions - st.Values = pb.Values - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *enumValuePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st enumValuePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func executeStatementRequestToPb(st *ExecuteStatementRequest) (*executeStatementRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &executeStatementRequestPb{} - pb.ByteLimit = st.ByteLimit - pb.Catalog = st.Catalog - pb.Disposition = st.Disposition - pb.Format = st.Format - pb.OnWaitTimeout = st.OnWaitTimeout - pb.Parameters = st.Parameters - pb.RowLimit = st.RowLimit - pb.Schema = st.Schema - pb.Statement = st.Statement - pb.WaitTimeout = st.WaitTimeout - pb.WarehouseId = st.WarehouseId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type executeStatementRequestPb struct { - ByteLimit int64 `json:"byte_limit,omitempty"` - Catalog string `json:"catalog,omitempty"` - Disposition Disposition `json:"disposition,omitempty"` - Format Format `json:"format,omitempty"` - OnWaitTimeout ExecuteStatementRequestOnWaitTimeout `json:"on_wait_timeout,omitempty"` - Parameters []StatementParameterListItem `json:"parameters,omitempty"` - RowLimit int64 `json:"row_limit,omitempty"` - Schema string `json:"schema,omitempty"` - Statement string `json:"statement"` - WaitTimeout string `json:"wait_timeout,omitempty"` - WarehouseId string `json:"warehouse_id"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func executeStatementRequestFromPb(pb *executeStatementRequestPb) (*ExecuteStatementRequest, error) { - if pb == nil { - return nil, nil - } - st := &ExecuteStatementRequest{} - st.ByteLimit = pb.ByteLimit - st.Catalog = pb.Catalog - st.Disposition = pb.Disposition - st.Format = pb.Format - st.OnWaitTimeout = pb.OnWaitTimeout - st.Parameters = pb.Parameters - st.RowLimit = pb.RowLimit - st.Schema = pb.Schema - st.Statement = pb.Statement - st.WaitTimeout = pb.WaitTimeout - st.WarehouseId = pb.WarehouseId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *executeStatementRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st executeStatementRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func externalLinkToPb(st *ExternalLink) (*externalLinkPb, error) { - if st == nil { - return nil, nil - } - pb := &externalLinkPb{} - pb.ByteCount = st.ByteCount - pb.ChunkIndex = st.ChunkIndex - pb.Expiration = st.Expiration - pb.ExternalLink = st.ExternalLink - pb.HttpHeaders = st.HttpHeaders - pb.NextChunkIndex = st.NextChunkIndex - pb.NextChunkInternalLink = st.NextChunkInternalLink - pb.RowCount = st.RowCount - pb.RowOffset = st.RowOffset - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type externalLinkPb struct { - ByteCount int64 `json:"byte_count,omitempty"` - ChunkIndex int `json:"chunk_index,omitempty"` - Expiration string `json:"expiration,omitempty"` - ExternalLink string `json:"external_link,omitempty"` - HttpHeaders map[string]string `json:"http_headers,omitempty"` - NextChunkIndex int `json:"next_chunk_index,omitempty"` - NextChunkInternalLink string `json:"next_chunk_internal_link,omitempty"` - RowCount int64 `json:"row_count,omitempty"` - RowOffset int64 `json:"row_offset,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func externalLinkFromPb(pb *externalLinkPb) (*ExternalLink, error) { - if pb == nil { - return nil, nil - } - st := &ExternalLink{} - st.ByteCount = pb.ByteCount - st.ChunkIndex = pb.ChunkIndex - st.Expiration = pb.Expiration - st.ExternalLink = pb.ExternalLink - st.HttpHeaders = pb.HttpHeaders - st.NextChunkIndex = pb.NextChunkIndex - st.NextChunkInternalLink = pb.NextChunkInternalLink - st.RowCount = pb.RowCount - st.RowOffset = pb.RowOffset - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *externalLinkPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st externalLinkPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func externalQuerySourceToPb(st *ExternalQuerySource) (*externalQuerySourcePb, error) { - if st == nil { - return nil, nil - } - pb := &externalQuerySourcePb{} - pb.AlertId = st.AlertId - pb.DashboardId = st.DashboardId - pb.GenieSpaceId = st.GenieSpaceId - pb.JobInfo = st.JobInfo - pb.LegacyDashboardId = st.LegacyDashboardId - pb.NotebookId = st.NotebookId - pb.SqlQueryId = st.SqlQueryId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type externalQuerySourcePb struct { - AlertId string `json:"alert_id,omitempty"` - DashboardId string `json:"dashboard_id,omitempty"` - GenieSpaceId string `json:"genie_space_id,omitempty"` - JobInfo *ExternalQuerySourceJobInfo `json:"job_info,omitempty"` - LegacyDashboardId string `json:"legacy_dashboard_id,omitempty"` - NotebookId string `json:"notebook_id,omitempty"` - SqlQueryId string `json:"sql_query_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func externalQuerySourceFromPb(pb *externalQuerySourcePb) (*ExternalQuerySource, error) { - if pb == nil { - return nil, nil - } - st := &ExternalQuerySource{} - st.AlertId = pb.AlertId - st.DashboardId = pb.DashboardId - st.GenieSpaceId = pb.GenieSpaceId - st.JobInfo = pb.JobInfo - st.LegacyDashboardId = pb.LegacyDashboardId - st.NotebookId = pb.NotebookId - st.SqlQueryId = pb.SqlQueryId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *externalQuerySourcePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st externalQuerySourcePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func externalQuerySourceJobInfoToPb(st *ExternalQuerySourceJobInfo) (*externalQuerySourceJobInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &externalQuerySourceJobInfoPb{} - pb.JobId = st.JobId - pb.JobRunId = st.JobRunId - pb.JobTaskRunId = st.JobTaskRunId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type externalQuerySourceJobInfoPb struct { - JobId string `json:"job_id,omitempty"` - JobRunId string `json:"job_run_id,omitempty"` - JobTaskRunId string `json:"job_task_run_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func externalQuerySourceJobInfoFromPb(pb *externalQuerySourceJobInfoPb) (*ExternalQuerySourceJobInfo, error) { - if pb == nil { - return nil, nil - } - st := &ExternalQuerySourceJobInfo{} - st.JobId = pb.JobId - st.JobRunId = pb.JobRunId - st.JobTaskRunId = pb.JobTaskRunId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *externalQuerySourceJobInfoPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st externalQuerySourceJobInfoPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getAlertRequestToPb(st *GetAlertRequest) (*getAlertRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getAlertRequestPb{} - pb.Id = st.Id - - return pb, nil -} - -type getAlertRequestPb struct { - Id string `json:"-" url:"-"` -} - -func getAlertRequestFromPb(pb *getAlertRequestPb) (*GetAlertRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetAlertRequest{} - st.Id = pb.Id - - return st, nil -} - -func getAlertV2RequestToPb(st *GetAlertV2Request) (*getAlertV2RequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getAlertV2RequestPb{} - pb.Id = st.Id - - return pb, nil -} - -type getAlertV2RequestPb struct { - Id string `json:"-" url:"-"` -} - -func getAlertV2RequestFromPb(pb *getAlertV2RequestPb) (*GetAlertV2Request, error) { - if pb == nil { - return nil, nil - } - st := &GetAlertV2Request{} - st.Id = pb.Id - - return st, nil -} - -func getAlertsLegacyRequestToPb(st *GetAlertsLegacyRequest) (*getAlertsLegacyRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getAlertsLegacyRequestPb{} - pb.AlertId = st.AlertId - - return pb, nil -} - -type getAlertsLegacyRequestPb struct { - AlertId string `json:"-" url:"-"` -} - -func getAlertsLegacyRequestFromPb(pb *getAlertsLegacyRequestPb) (*GetAlertsLegacyRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetAlertsLegacyRequest{} - st.AlertId = pb.AlertId - - return st, nil -} - -func getDashboardRequestToPb(st *GetDashboardRequest) (*getDashboardRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getDashboardRequestPb{} - pb.DashboardId = st.DashboardId - - return pb, nil -} - -type getDashboardRequestPb struct { - DashboardId string `json:"-" url:"-"` -} - -func getDashboardRequestFromPb(pb *getDashboardRequestPb) (*GetDashboardRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetDashboardRequest{} - st.DashboardId = pb.DashboardId - - return st, nil -} - -func getDbsqlPermissionRequestToPb(st *GetDbsqlPermissionRequest) (*getDbsqlPermissionRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getDbsqlPermissionRequestPb{} - pb.ObjectId = st.ObjectId - pb.ObjectType = st.ObjectType - - return pb, nil -} - -type getDbsqlPermissionRequestPb struct { - ObjectId string `json:"-" url:"-"` - ObjectType ObjectTypePlural `json:"-" url:"-"` -} - -func getDbsqlPermissionRequestFromPb(pb *getDbsqlPermissionRequestPb) (*GetDbsqlPermissionRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetDbsqlPermissionRequest{} - st.ObjectId = pb.ObjectId - st.ObjectType = pb.ObjectType - - return st, nil -} - -func getQueriesLegacyRequestToPb(st *GetQueriesLegacyRequest) (*getQueriesLegacyRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getQueriesLegacyRequestPb{} - pb.QueryId = st.QueryId - - return pb, nil -} - -type getQueriesLegacyRequestPb struct { - QueryId string `json:"-" url:"-"` -} - -func getQueriesLegacyRequestFromPb(pb *getQueriesLegacyRequestPb) (*GetQueriesLegacyRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetQueriesLegacyRequest{} - st.QueryId = pb.QueryId - - return st, nil -} - -func getQueryRequestToPb(st *GetQueryRequest) (*getQueryRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getQueryRequestPb{} - pb.Id = st.Id - - return pb, nil -} - -type getQueryRequestPb struct { - Id string `json:"-" url:"-"` -} - -func getQueryRequestFromPb(pb *getQueryRequestPb) (*GetQueryRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetQueryRequest{} - st.Id = pb.Id - - return st, nil -} - -func getResponseToPb(st *GetResponse) (*getResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &getResponsePb{} - pb.AccessControlList = st.AccessControlList - pb.ObjectId = st.ObjectId - pb.ObjectType = st.ObjectType - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getResponsePb struct { - AccessControlList []AccessControl `json:"access_control_list,omitempty"` - ObjectId string `json:"object_id,omitempty"` - ObjectType ObjectType `json:"object_type,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getResponseFromPb(pb *getResponsePb) (*GetResponse, error) { - if pb == nil { - return nil, nil - } - st := &GetResponse{} - st.AccessControlList = pb.AccessControlList - st.ObjectId = pb.ObjectId - st.ObjectType = pb.ObjectType - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getStatementRequestToPb(st *GetStatementRequest) (*getStatementRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getStatementRequestPb{} - pb.StatementId = st.StatementId - - return pb, nil -} - -type getStatementRequestPb struct { - StatementId string `json:"-" url:"-"` -} - -func getStatementRequestFromPb(pb *getStatementRequestPb) (*GetStatementRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetStatementRequest{} - st.StatementId = pb.StatementId - - return st, nil -} - -func getStatementResultChunkNRequestToPb(st *GetStatementResultChunkNRequest) (*getStatementResultChunkNRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getStatementResultChunkNRequestPb{} - pb.ChunkIndex = st.ChunkIndex - pb.StatementId = st.StatementId - - return pb, nil -} - -type getStatementResultChunkNRequestPb struct { - ChunkIndex int `json:"-" url:"-"` - StatementId string `json:"-" url:"-"` -} - -func getStatementResultChunkNRequestFromPb(pb *getStatementResultChunkNRequestPb) (*GetStatementResultChunkNRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetStatementResultChunkNRequest{} - st.ChunkIndex = pb.ChunkIndex - st.StatementId = pb.StatementId - - return st, nil -} - -func getWarehousePermissionLevelsRequestToPb(st *GetWarehousePermissionLevelsRequest) (*getWarehousePermissionLevelsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getWarehousePermissionLevelsRequestPb{} - pb.WarehouseId = st.WarehouseId - - return pb, nil -} - -type getWarehousePermissionLevelsRequestPb struct { - WarehouseId string `json:"-" url:"-"` -} - -func getWarehousePermissionLevelsRequestFromPb(pb *getWarehousePermissionLevelsRequestPb) (*GetWarehousePermissionLevelsRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetWarehousePermissionLevelsRequest{} - st.WarehouseId = pb.WarehouseId - - return st, nil -} - -func getWarehousePermissionLevelsResponseToPb(st *GetWarehousePermissionLevelsResponse) (*getWarehousePermissionLevelsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &getWarehousePermissionLevelsResponsePb{} - pb.PermissionLevels = st.PermissionLevels - - return pb, nil -} - -type getWarehousePermissionLevelsResponsePb struct { - PermissionLevels []WarehousePermissionsDescription `json:"permission_levels,omitempty"` -} - -func getWarehousePermissionLevelsResponseFromPb(pb *getWarehousePermissionLevelsResponsePb) (*GetWarehousePermissionLevelsResponse, error) { - if pb == nil { - return nil, nil - } - st := &GetWarehousePermissionLevelsResponse{} - st.PermissionLevels = pb.PermissionLevels - - return st, nil -} - -func getWarehousePermissionsRequestToPb(st *GetWarehousePermissionsRequest) (*getWarehousePermissionsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getWarehousePermissionsRequestPb{} - pb.WarehouseId = st.WarehouseId - - return pb, nil -} - -type getWarehousePermissionsRequestPb struct { - WarehouseId string `json:"-" url:"-"` -} - -func getWarehousePermissionsRequestFromPb(pb *getWarehousePermissionsRequestPb) (*GetWarehousePermissionsRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetWarehousePermissionsRequest{} - st.WarehouseId = pb.WarehouseId - - return st, nil -} - -func getWarehouseRequestToPb(st *GetWarehouseRequest) (*getWarehouseRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getWarehouseRequestPb{} - pb.Id = st.Id - - return pb, nil -} - -type getWarehouseRequestPb struct { - Id string `json:"-" url:"-"` -} - -func getWarehouseRequestFromPb(pb *getWarehouseRequestPb) (*GetWarehouseRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetWarehouseRequest{} - st.Id = pb.Id - - return st, nil -} - -func getWarehouseResponseToPb(st *GetWarehouseResponse) (*getWarehouseResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &getWarehouseResponsePb{} - pb.AutoStopMins = st.AutoStopMins - pb.Channel = st.Channel - pb.ClusterSize = st.ClusterSize - pb.CreatorName = st.CreatorName - pb.EnablePhoton = st.EnablePhoton - pb.EnableServerlessCompute = st.EnableServerlessCompute - pb.Health = st.Health - pb.Id = st.Id - pb.InstanceProfileArn = st.InstanceProfileArn - pb.JdbcUrl = st.JdbcUrl - pb.MaxNumClusters = st.MaxNumClusters - pb.MinNumClusters = st.MinNumClusters - pb.Name = st.Name - pb.NumActiveSessions = st.NumActiveSessions - pb.NumClusters = st.NumClusters - pb.OdbcParams = st.OdbcParams - pb.SpotInstancePolicy = st.SpotInstancePolicy - pb.State = st.State - pb.Tags = st.Tags - pb.WarehouseType = st.WarehouseType - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getWarehouseResponsePb struct { - AutoStopMins int `json:"auto_stop_mins,omitempty"` - Channel *Channel `json:"channel,omitempty"` - ClusterSize string `json:"cluster_size,omitempty"` - CreatorName string `json:"creator_name,omitempty"` - EnablePhoton bool `json:"enable_photon,omitempty"` - EnableServerlessCompute bool `json:"enable_serverless_compute,omitempty"` - Health *EndpointHealth `json:"health,omitempty"` - Id string `json:"id,omitempty"` - InstanceProfileArn string `json:"instance_profile_arn,omitempty"` - JdbcUrl string `json:"jdbc_url,omitempty"` - MaxNumClusters int `json:"max_num_clusters,omitempty"` - MinNumClusters int `json:"min_num_clusters,omitempty"` - Name string `json:"name,omitempty"` - NumActiveSessions int64 `json:"num_active_sessions,omitempty"` - NumClusters int `json:"num_clusters,omitempty"` - OdbcParams *OdbcParams `json:"odbc_params,omitempty"` - SpotInstancePolicy SpotInstancePolicy `json:"spot_instance_policy,omitempty"` - State State `json:"state,omitempty"` - Tags *EndpointTags `json:"tags,omitempty"` - WarehouseType GetWarehouseResponseWarehouseType `json:"warehouse_type,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getWarehouseResponseFromPb(pb *getWarehouseResponsePb) (*GetWarehouseResponse, error) { - if pb == nil { - return nil, nil - } - st := &GetWarehouseResponse{} - st.AutoStopMins = pb.AutoStopMins - st.Channel = pb.Channel - st.ClusterSize = pb.ClusterSize - st.CreatorName = pb.CreatorName - st.EnablePhoton = pb.EnablePhoton - st.EnableServerlessCompute = pb.EnableServerlessCompute - st.Health = pb.Health - st.Id = pb.Id - st.InstanceProfileArn = pb.InstanceProfileArn - st.JdbcUrl = pb.JdbcUrl - st.MaxNumClusters = pb.MaxNumClusters - st.MinNumClusters = pb.MinNumClusters - st.Name = pb.Name - st.NumActiveSessions = pb.NumActiveSessions - st.NumClusters = pb.NumClusters - st.OdbcParams = pb.OdbcParams - st.SpotInstancePolicy = pb.SpotInstancePolicy - st.State = pb.State - st.Tags = pb.Tags - st.WarehouseType = pb.WarehouseType - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getWarehouseResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getWarehouseResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getWorkspaceWarehouseConfigResponseToPb(st *GetWorkspaceWarehouseConfigResponse) (*getWorkspaceWarehouseConfigResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &getWorkspaceWarehouseConfigResponsePb{} - pb.Channel = st.Channel - pb.ConfigParam = st.ConfigParam - pb.DataAccessConfig = st.DataAccessConfig - pb.EnabledWarehouseTypes = st.EnabledWarehouseTypes - pb.GlobalParam = st.GlobalParam - pb.GoogleServiceAccount = st.GoogleServiceAccount - pb.InstanceProfileArn = st.InstanceProfileArn - pb.SecurityPolicy = st.SecurityPolicy - pb.SqlConfigurationParameters = st.SqlConfigurationParameters - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getWorkspaceWarehouseConfigResponsePb struct { - Channel *Channel `json:"channel,omitempty"` - ConfigParam *RepeatedEndpointConfPairs `json:"config_param,omitempty"` - DataAccessConfig []EndpointConfPair `json:"data_access_config,omitempty"` - EnabledWarehouseTypes []WarehouseTypePair `json:"enabled_warehouse_types,omitempty"` - GlobalParam *RepeatedEndpointConfPairs `json:"global_param,omitempty"` - GoogleServiceAccount string `json:"google_service_account,omitempty"` - InstanceProfileArn string `json:"instance_profile_arn,omitempty"` - SecurityPolicy GetWorkspaceWarehouseConfigResponseSecurityPolicy `json:"security_policy,omitempty"` - SqlConfigurationParameters *RepeatedEndpointConfPairs `json:"sql_configuration_parameters,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getWorkspaceWarehouseConfigResponseFromPb(pb *getWorkspaceWarehouseConfigResponsePb) (*GetWorkspaceWarehouseConfigResponse, error) { - if pb == nil { - return nil, nil - } - st := &GetWorkspaceWarehouseConfigResponse{} - st.Channel = pb.Channel - st.ConfigParam = pb.ConfigParam - st.DataAccessConfig = pb.DataAccessConfig - st.EnabledWarehouseTypes = pb.EnabledWarehouseTypes - st.GlobalParam = pb.GlobalParam - st.GoogleServiceAccount = pb.GoogleServiceAccount - st.InstanceProfileArn = pb.InstanceProfileArn - st.SecurityPolicy = pb.SecurityPolicy - st.SqlConfigurationParameters = pb.SqlConfigurationParameters - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getWorkspaceWarehouseConfigResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getWorkspaceWarehouseConfigResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func legacyAlertToPb(st *LegacyAlert) (*legacyAlertPb, error) { - if st == nil { - return nil, nil - } - pb := &legacyAlertPb{} - pb.CreatedAt = st.CreatedAt - pb.Id = st.Id - pb.LastTriggeredAt = st.LastTriggeredAt - pb.Name = st.Name - pb.Options = st.Options - pb.Parent = st.Parent - pb.Query = st.Query - pb.Rearm = st.Rearm - pb.State = st.State - pb.UpdatedAt = st.UpdatedAt - pb.User = st.User - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type legacyAlertPb struct { - CreatedAt string `json:"created_at,omitempty"` - Id string `json:"id,omitempty"` - LastTriggeredAt string `json:"last_triggered_at,omitempty"` - Name string `json:"name,omitempty"` - Options *AlertOptions `json:"options,omitempty"` - Parent string `json:"parent,omitempty"` - Query *AlertQuery `json:"query,omitempty"` - Rearm int `json:"rearm,omitempty"` - State LegacyAlertState `json:"state,omitempty"` - UpdatedAt string `json:"updated_at,omitempty"` - User *User `json:"user,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func legacyAlertFromPb(pb *legacyAlertPb) (*LegacyAlert, error) { - if pb == nil { - return nil, nil - } - st := &LegacyAlert{} - st.CreatedAt = pb.CreatedAt - st.Id = pb.Id - st.LastTriggeredAt = pb.LastTriggeredAt - st.Name = pb.Name - st.Options = pb.Options - st.Parent = pb.Parent - st.Query = pb.Query - st.Rearm = pb.Rearm - st.State = pb.State - st.UpdatedAt = pb.UpdatedAt - st.User = pb.User - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *legacyAlertPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st legacyAlertPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func legacyQueryToPb(st *LegacyQuery) (*legacyQueryPb, error) { - if st == nil { - return nil, nil - } - pb := &legacyQueryPb{} - pb.CanEdit = st.CanEdit - pb.CreatedAt = st.CreatedAt - pb.DataSourceId = st.DataSourceId - pb.Description = st.Description - pb.Id = st.Id - pb.IsArchived = st.IsArchived - pb.IsDraft = st.IsDraft - pb.IsFavorite = st.IsFavorite - pb.IsSafe = st.IsSafe - pb.LastModifiedBy = st.LastModifiedBy - pb.LastModifiedById = st.LastModifiedById - pb.LatestQueryDataId = st.LatestQueryDataId - pb.Name = st.Name - pb.Options = st.Options - pb.Parent = st.Parent - pb.PermissionTier = st.PermissionTier - pb.Query = st.Query - pb.QueryHash = st.QueryHash - pb.RunAsRole = st.RunAsRole - pb.Tags = st.Tags - pb.UpdatedAt = st.UpdatedAt - pb.User = st.User - pb.UserId = st.UserId - pb.Visualizations = st.Visualizations - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type legacyQueryPb struct { - CanEdit bool `json:"can_edit,omitempty"` - CreatedAt string `json:"created_at,omitempty"` - DataSourceId string `json:"data_source_id,omitempty"` - Description string `json:"description,omitempty"` - Id string `json:"id,omitempty"` - IsArchived bool `json:"is_archived,omitempty"` - IsDraft bool `json:"is_draft,omitempty"` - IsFavorite bool `json:"is_favorite,omitempty"` - IsSafe bool `json:"is_safe,omitempty"` - LastModifiedBy *User `json:"last_modified_by,omitempty"` - LastModifiedById int `json:"last_modified_by_id,omitempty"` - LatestQueryDataId string `json:"latest_query_data_id,omitempty"` - Name string `json:"name,omitempty"` - Options *QueryOptions `json:"options,omitempty"` - Parent string `json:"parent,omitempty"` - PermissionTier PermissionLevel `json:"permission_tier,omitempty"` - Query string `json:"query,omitempty"` - QueryHash string `json:"query_hash,omitempty"` - RunAsRole RunAsRole `json:"run_as_role,omitempty"` - Tags []string `json:"tags,omitempty"` - UpdatedAt string `json:"updated_at,omitempty"` - User *User `json:"user,omitempty"` - UserId int `json:"user_id,omitempty"` - Visualizations []LegacyVisualization `json:"visualizations,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func legacyQueryFromPb(pb *legacyQueryPb) (*LegacyQuery, error) { - if pb == nil { - return nil, nil - } - st := &LegacyQuery{} - st.CanEdit = pb.CanEdit - st.CreatedAt = pb.CreatedAt - st.DataSourceId = pb.DataSourceId - st.Description = pb.Description - st.Id = pb.Id - st.IsArchived = pb.IsArchived - st.IsDraft = pb.IsDraft - st.IsFavorite = pb.IsFavorite - st.IsSafe = pb.IsSafe - st.LastModifiedBy = pb.LastModifiedBy - st.LastModifiedById = pb.LastModifiedById - st.LatestQueryDataId = pb.LatestQueryDataId - st.Name = pb.Name - st.Options = pb.Options - st.Parent = pb.Parent - st.PermissionTier = pb.PermissionTier - st.Query = pb.Query - st.QueryHash = pb.QueryHash - st.RunAsRole = pb.RunAsRole - st.Tags = pb.Tags - st.UpdatedAt = pb.UpdatedAt - st.User = pb.User - st.UserId = pb.UserId - st.Visualizations = pb.Visualizations - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *legacyQueryPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st legacyQueryPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func legacyVisualizationToPb(st *LegacyVisualization) (*legacyVisualizationPb, error) { - if st == nil { - return nil, nil - } - pb := &legacyVisualizationPb{} - pb.CreatedAt = st.CreatedAt - pb.Description = st.Description - pb.Id = st.Id - pb.Name = st.Name - pb.Options = st.Options - pb.Query = st.Query - pb.Type = st.Type - pb.UpdatedAt = st.UpdatedAt - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type legacyVisualizationPb struct { - CreatedAt string `json:"created_at,omitempty"` - Description string `json:"description,omitempty"` - Id string `json:"id,omitempty"` - Name string `json:"name,omitempty"` - Options any `json:"options,omitempty"` - Query *LegacyQuery `json:"query,omitempty"` - Type string `json:"type,omitempty"` - UpdatedAt string `json:"updated_at,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func legacyVisualizationFromPb(pb *legacyVisualizationPb) (*LegacyVisualization, error) { - if pb == nil { - return nil, nil - } - st := &LegacyVisualization{} - st.CreatedAt = pb.CreatedAt - st.Description = pb.Description - st.Id = pb.Id - st.Name = pb.Name - st.Options = pb.Options - st.Query = pb.Query - st.Type = pb.Type - st.UpdatedAt = pb.UpdatedAt - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *legacyVisualizationPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st legacyVisualizationPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listAlertsRequestToPb(st *ListAlertsRequest) (*listAlertsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listAlertsRequestPb{} - pb.PageSize = st.PageSize - pb.PageToken = st.PageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listAlertsRequestPb struct { - PageSize int `json:"-" url:"page_size,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listAlertsRequestFromPb(pb *listAlertsRequestPb) (*ListAlertsRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListAlertsRequest{} - st.PageSize = pb.PageSize - st.PageToken = pb.PageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listAlertsRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listAlertsRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listAlertsResponseToPb(st *ListAlertsResponse) (*listAlertsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listAlertsResponsePb{} - pb.NextPageToken = st.NextPageToken - pb.Results = st.Results - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listAlertsResponsePb struct { - NextPageToken string `json:"next_page_token,omitempty"` - Results []ListAlertsResponseAlert `json:"results,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listAlertsResponseFromPb(pb *listAlertsResponsePb) (*ListAlertsResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListAlertsResponse{} - st.NextPageToken = pb.NextPageToken - st.Results = pb.Results - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listAlertsResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listAlertsResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listAlertsResponseAlertToPb(st *ListAlertsResponseAlert) (*listAlertsResponseAlertPb, error) { - if st == nil { - return nil, nil - } - pb := &listAlertsResponseAlertPb{} - pb.Condition = st.Condition - pb.CreateTime = st.CreateTime - pb.CustomBody = st.CustomBody - pb.CustomSubject = st.CustomSubject - pb.DisplayName = st.DisplayName - pb.Id = st.Id - pb.LifecycleState = st.LifecycleState - pb.NotifyOnOk = st.NotifyOnOk - pb.OwnerUserName = st.OwnerUserName - pb.QueryId = st.QueryId - pb.SecondsToRetrigger = st.SecondsToRetrigger - pb.State = st.State - pb.TriggerTime = st.TriggerTime - pb.UpdateTime = st.UpdateTime - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listAlertsResponseAlertPb struct { - Condition *AlertCondition `json:"condition,omitempty"` - CreateTime string `json:"create_time,omitempty"` - CustomBody string `json:"custom_body,omitempty"` - CustomSubject string `json:"custom_subject,omitempty"` - DisplayName string `json:"display_name,omitempty"` - Id string `json:"id,omitempty"` - LifecycleState LifecycleState `json:"lifecycle_state,omitempty"` - NotifyOnOk bool `json:"notify_on_ok,omitempty"` - OwnerUserName string `json:"owner_user_name,omitempty"` - QueryId string `json:"query_id,omitempty"` - SecondsToRetrigger int `json:"seconds_to_retrigger,omitempty"` - State AlertState `json:"state,omitempty"` - TriggerTime string `json:"trigger_time,omitempty"` - UpdateTime string `json:"update_time,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listAlertsResponseAlertFromPb(pb *listAlertsResponseAlertPb) (*ListAlertsResponseAlert, error) { - if pb == nil { - return nil, nil - } - st := &ListAlertsResponseAlert{} - st.Condition = pb.Condition - st.CreateTime = pb.CreateTime - st.CustomBody = pb.CustomBody - st.CustomSubject = pb.CustomSubject - st.DisplayName = pb.DisplayName - st.Id = pb.Id - st.LifecycleState = pb.LifecycleState - st.NotifyOnOk = pb.NotifyOnOk - st.OwnerUserName = pb.OwnerUserName - st.QueryId = pb.QueryId - st.SecondsToRetrigger = pb.SecondsToRetrigger - st.State = pb.State - st.TriggerTime = pb.TriggerTime - st.UpdateTime = pb.UpdateTime - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listAlertsResponseAlertPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listAlertsResponseAlertPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listAlertsV2RequestToPb(st *ListAlertsV2Request) (*listAlertsV2RequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listAlertsV2RequestPb{} - pb.PageSize = st.PageSize - pb.PageToken = st.PageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listAlertsV2RequestPb struct { - PageSize int `json:"-" url:"page_size,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listAlertsV2RequestFromPb(pb *listAlertsV2RequestPb) (*ListAlertsV2Request, error) { - if pb == nil { - return nil, nil - } - st := &ListAlertsV2Request{} - st.PageSize = pb.PageSize - st.PageToken = pb.PageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listAlertsV2RequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listAlertsV2RequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listAlertsV2ResponseToPb(st *ListAlertsV2Response) (*listAlertsV2ResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listAlertsV2ResponsePb{} - pb.NextPageToken = st.NextPageToken - pb.Results = st.Results - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listAlertsV2ResponsePb struct { - NextPageToken string `json:"next_page_token,omitempty"` - Results []AlertV2 `json:"results,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listAlertsV2ResponseFromPb(pb *listAlertsV2ResponsePb) (*ListAlertsV2Response, error) { - if pb == nil { - return nil, nil - } - st := &ListAlertsV2Response{} - st.NextPageToken = pb.NextPageToken - st.Results = pb.Results - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listAlertsV2ResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listAlertsV2ResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listDashboardsRequestToPb(st *ListDashboardsRequest) (*listDashboardsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listDashboardsRequestPb{} - pb.Order = st.Order - pb.Page = st.Page - pb.PageSize = st.PageSize - pb.Q = st.Q - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listDashboardsRequestPb struct { - Order ListOrder `json:"-" url:"order,omitempty"` - Page int `json:"-" url:"page,omitempty"` - PageSize int `json:"-" url:"page_size,omitempty"` - Q string `json:"-" url:"q,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listDashboardsRequestFromPb(pb *listDashboardsRequestPb) (*ListDashboardsRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListDashboardsRequest{} - st.Order = pb.Order - st.Page = pb.Page - st.PageSize = pb.PageSize - st.Q = pb.Q - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listDashboardsRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listDashboardsRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listQueriesLegacyRequestToPb(st *ListQueriesLegacyRequest) (*listQueriesLegacyRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listQueriesLegacyRequestPb{} - pb.Order = st.Order - pb.Page = st.Page - pb.PageSize = st.PageSize - pb.Q = st.Q - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listQueriesLegacyRequestPb struct { - Order string `json:"-" url:"order,omitempty"` - Page int `json:"-" url:"page,omitempty"` - PageSize int `json:"-" url:"page_size,omitempty"` - Q string `json:"-" url:"q,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listQueriesLegacyRequestFromPb(pb *listQueriesLegacyRequestPb) (*ListQueriesLegacyRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListQueriesLegacyRequest{} - st.Order = pb.Order - st.Page = pb.Page - st.PageSize = pb.PageSize - st.Q = pb.Q - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listQueriesLegacyRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listQueriesLegacyRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listQueriesRequestToPb(st *ListQueriesRequest) (*listQueriesRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listQueriesRequestPb{} - pb.PageSize = st.PageSize - pb.PageToken = st.PageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listQueriesRequestPb struct { - PageSize int `json:"-" url:"page_size,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listQueriesRequestFromPb(pb *listQueriesRequestPb) (*ListQueriesRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListQueriesRequest{} - st.PageSize = pb.PageSize - st.PageToken = pb.PageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listQueriesRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listQueriesRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listQueriesResponseToPb(st *ListQueriesResponse) (*listQueriesResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listQueriesResponsePb{} - pb.HasNextPage = st.HasNextPage - pb.NextPageToken = st.NextPageToken - pb.Res = st.Res - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listQueriesResponsePb struct { - HasNextPage bool `json:"has_next_page,omitempty"` - NextPageToken string `json:"next_page_token,omitempty"` - Res []QueryInfo `json:"res,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listQueriesResponseFromPb(pb *listQueriesResponsePb) (*ListQueriesResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListQueriesResponse{} - st.HasNextPage = pb.HasNextPage - st.NextPageToken = pb.NextPageToken - st.Res = pb.Res - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listQueriesResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listQueriesResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listQueryHistoryRequestToPb(st *ListQueryHistoryRequest) (*listQueryHistoryRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listQueryHistoryRequestPb{} - pb.FilterBy = st.FilterBy - pb.IncludeMetrics = st.IncludeMetrics - pb.MaxResults = st.MaxResults - pb.PageToken = st.PageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listQueryHistoryRequestPb struct { - FilterBy *QueryFilter `json:"-" url:"filter_by,omitempty"` - IncludeMetrics bool `json:"-" url:"include_metrics,omitempty"` - MaxResults int `json:"-" url:"max_results,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listQueryHistoryRequestFromPb(pb *listQueryHistoryRequestPb) (*ListQueryHistoryRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListQueryHistoryRequest{} - st.FilterBy = pb.FilterBy - st.IncludeMetrics = pb.IncludeMetrics - st.MaxResults = pb.MaxResults - st.PageToken = pb.PageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listQueryHistoryRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listQueryHistoryRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listQueryObjectsResponseToPb(st *ListQueryObjectsResponse) (*listQueryObjectsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listQueryObjectsResponsePb{} - pb.NextPageToken = st.NextPageToken - pb.Results = st.Results - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listQueryObjectsResponsePb struct { - NextPageToken string `json:"next_page_token,omitempty"` - Results []ListQueryObjectsResponseQuery `json:"results,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listQueryObjectsResponseFromPb(pb *listQueryObjectsResponsePb) (*ListQueryObjectsResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListQueryObjectsResponse{} - st.NextPageToken = pb.NextPageToken - st.Results = pb.Results - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listQueryObjectsResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listQueryObjectsResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listQueryObjectsResponseQueryToPb(st *ListQueryObjectsResponseQuery) (*listQueryObjectsResponseQueryPb, error) { - if st == nil { - return nil, nil - } - pb := &listQueryObjectsResponseQueryPb{} - pb.ApplyAutoLimit = st.ApplyAutoLimit - pb.Catalog = st.Catalog - pb.CreateTime = st.CreateTime - pb.Description = st.Description - pb.DisplayName = st.DisplayName - pb.Id = st.Id - pb.LastModifierUserName = st.LastModifierUserName - pb.LifecycleState = st.LifecycleState - pb.OwnerUserName = st.OwnerUserName - pb.Parameters = st.Parameters - pb.QueryText = st.QueryText - pb.RunAsMode = st.RunAsMode - pb.Schema = st.Schema - pb.Tags = st.Tags - pb.UpdateTime = st.UpdateTime - pb.WarehouseId = st.WarehouseId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listQueryObjectsResponseQueryPb struct { - ApplyAutoLimit bool `json:"apply_auto_limit,omitempty"` - Catalog string `json:"catalog,omitempty"` - CreateTime string `json:"create_time,omitempty"` - Description string `json:"description,omitempty"` - DisplayName string `json:"display_name,omitempty"` - Id string `json:"id,omitempty"` - LastModifierUserName string `json:"last_modifier_user_name,omitempty"` - LifecycleState LifecycleState `json:"lifecycle_state,omitempty"` - OwnerUserName string `json:"owner_user_name,omitempty"` - Parameters []QueryParameter `json:"parameters,omitempty"` - QueryText string `json:"query_text,omitempty"` - RunAsMode RunAsMode `json:"run_as_mode,omitempty"` - Schema string `json:"schema,omitempty"` - Tags []string `json:"tags,omitempty"` - UpdateTime string `json:"update_time,omitempty"` - WarehouseId string `json:"warehouse_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listQueryObjectsResponseQueryFromPb(pb *listQueryObjectsResponseQueryPb) (*ListQueryObjectsResponseQuery, error) { - if pb == nil { - return nil, nil - } - st := &ListQueryObjectsResponseQuery{} - st.ApplyAutoLimit = pb.ApplyAutoLimit - st.Catalog = pb.Catalog - st.CreateTime = pb.CreateTime - st.Description = pb.Description - st.DisplayName = pb.DisplayName - st.Id = pb.Id - st.LastModifierUserName = pb.LastModifierUserName - st.LifecycleState = pb.LifecycleState - st.OwnerUserName = pb.OwnerUserName - st.Parameters = pb.Parameters - st.QueryText = pb.QueryText - st.RunAsMode = pb.RunAsMode - st.Schema = pb.Schema - st.Tags = pb.Tags - st.UpdateTime = pb.UpdateTime - st.WarehouseId = pb.WarehouseId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listQueryObjectsResponseQueryPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listQueryObjectsResponseQueryPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listResponseToPb(st *ListResponse) (*listResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listResponsePb{} - pb.Count = st.Count - pb.Page = st.Page - pb.PageSize = st.PageSize - pb.Results = st.Results - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listResponsePb struct { - Count int `json:"count,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` - Results []Dashboard `json:"results,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listResponseFromPb(pb *listResponsePb) (*ListResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListResponse{} - st.Count = pb.Count - st.Page = pb.Page - st.PageSize = pb.PageSize - st.Results = pb.Results - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listVisualizationsForQueryRequestToPb(st *ListVisualizationsForQueryRequest) (*listVisualizationsForQueryRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listVisualizationsForQueryRequestPb{} - pb.Id = st.Id - pb.PageSize = st.PageSize - pb.PageToken = st.PageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listVisualizationsForQueryRequestPb struct { - Id string `json:"-" url:"-"` - PageSize int `json:"-" url:"page_size,omitempty"` - PageToken string `json:"-" url:"page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listVisualizationsForQueryRequestFromPb(pb *listVisualizationsForQueryRequestPb) (*ListVisualizationsForQueryRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListVisualizationsForQueryRequest{} - st.Id = pb.Id - st.PageSize = pb.PageSize - st.PageToken = pb.PageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listVisualizationsForQueryRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listVisualizationsForQueryRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listVisualizationsForQueryResponseToPb(st *ListVisualizationsForQueryResponse) (*listVisualizationsForQueryResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listVisualizationsForQueryResponsePb{} - pb.NextPageToken = st.NextPageToken - pb.Results = st.Results - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listVisualizationsForQueryResponsePb struct { - NextPageToken string `json:"next_page_token,omitempty"` - Results []Visualization `json:"results,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listVisualizationsForQueryResponseFromPb(pb *listVisualizationsForQueryResponsePb) (*ListVisualizationsForQueryResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListVisualizationsForQueryResponse{} - st.NextPageToken = pb.NextPageToken - st.Results = pb.Results - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listVisualizationsForQueryResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listVisualizationsForQueryResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listWarehousesRequestToPb(st *ListWarehousesRequest) (*listWarehousesRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listWarehousesRequestPb{} - pb.RunAsUserId = st.RunAsUserId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listWarehousesRequestPb struct { - RunAsUserId int `json:"-" url:"run_as_user_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listWarehousesRequestFromPb(pb *listWarehousesRequestPb) (*ListWarehousesRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListWarehousesRequest{} - st.RunAsUserId = pb.RunAsUserId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listWarehousesRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listWarehousesRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listWarehousesResponseToPb(st *ListWarehousesResponse) (*listWarehousesResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listWarehousesResponsePb{} - pb.Warehouses = st.Warehouses - - return pb, nil -} - -type listWarehousesResponsePb struct { - Warehouses []EndpointInfo `json:"warehouses,omitempty"` -} - -func listWarehousesResponseFromPb(pb *listWarehousesResponsePb) (*ListWarehousesResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListWarehousesResponse{} - st.Warehouses = pb.Warehouses - - return st, nil -} - -func multiValuesOptionsToPb(st *MultiValuesOptions) (*multiValuesOptionsPb, error) { - if st == nil { - return nil, nil - } - pb := &multiValuesOptionsPb{} - pb.Prefix = st.Prefix - pb.Separator = st.Separator - pb.Suffix = st.Suffix - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type multiValuesOptionsPb struct { - Prefix string `json:"prefix,omitempty"` - Separator string `json:"separator,omitempty"` - Suffix string `json:"suffix,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func multiValuesOptionsFromPb(pb *multiValuesOptionsPb) (*MultiValuesOptions, error) { - if pb == nil { - return nil, nil - } - st := &MultiValuesOptions{} - st.Prefix = pb.Prefix - st.Separator = pb.Separator - st.Suffix = pb.Suffix - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *multiValuesOptionsPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st multiValuesOptionsPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func numericValueToPb(st *NumericValue) (*numericValuePb, error) { - if st == nil { - return nil, nil - } - pb := &numericValuePb{} - pb.Value = st.Value - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type numericValuePb struct { - Value float64 `json:"value,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func numericValueFromPb(pb *numericValuePb) (*NumericValue, error) { - if pb == nil { - return nil, nil - } - st := &NumericValue{} - st.Value = pb.Value - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *numericValuePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st numericValuePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func odbcParamsToPb(st *OdbcParams) (*odbcParamsPb, error) { - if st == nil { - return nil, nil - } - pb := &odbcParamsPb{} - pb.Hostname = st.Hostname - pb.Path = st.Path - pb.Port = st.Port - pb.Protocol = st.Protocol - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type odbcParamsPb struct { - Hostname string `json:"hostname,omitempty"` - Path string `json:"path,omitempty"` - Port int `json:"port,omitempty"` - Protocol string `json:"protocol,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func odbcParamsFromPb(pb *odbcParamsPb) (*OdbcParams, error) { - if pb == nil { - return nil, nil - } - st := &OdbcParams{} - st.Hostname = pb.Hostname - st.Path = pb.Path - st.Port = pb.Port - st.Protocol = pb.Protocol - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *odbcParamsPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st odbcParamsPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func parameterToPb(st *Parameter) (*parameterPb, error) { - if st == nil { - return nil, nil - } - pb := ¶meterPb{} - pb.EnumOptions = st.EnumOptions - pb.MultiValuesOptions = st.MultiValuesOptions - pb.Name = st.Name - pb.QueryId = st.QueryId - pb.Title = st.Title - pb.Type = st.Type - pb.Value = st.Value - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type parameterPb struct { - EnumOptions string `json:"enumOptions,omitempty"` - MultiValuesOptions *MultiValuesOptions `json:"multiValuesOptions,omitempty"` - Name string `json:"name,omitempty"` - QueryId string `json:"queryId,omitempty"` - Title string `json:"title,omitempty"` - Type ParameterType `json:"type,omitempty"` - Value any `json:"value,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func parameterFromPb(pb *parameterPb) (*Parameter, error) { - if pb == nil { - return nil, nil - } - st := &Parameter{} - st.EnumOptions = pb.EnumOptions - st.MultiValuesOptions = pb.MultiValuesOptions - st.Name = pb.Name - st.QueryId = pb.QueryId - st.Title = pb.Title - st.Type = pb.Type - st.Value = pb.Value - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *parameterPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st parameterPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func queryToPb(st *Query) (*queryPb, error) { - if st == nil { - return nil, nil - } - pb := &queryPb{} - pb.ApplyAutoLimit = st.ApplyAutoLimit - pb.Catalog = st.Catalog - pb.CreateTime = st.CreateTime - pb.Description = st.Description - pb.DisplayName = st.DisplayName - pb.Id = st.Id - pb.LastModifierUserName = st.LastModifierUserName - pb.LifecycleState = st.LifecycleState - pb.OwnerUserName = st.OwnerUserName - pb.Parameters = st.Parameters - pb.ParentPath = st.ParentPath - pb.QueryText = st.QueryText - pb.RunAsMode = st.RunAsMode - pb.Schema = st.Schema - pb.Tags = st.Tags - pb.UpdateTime = st.UpdateTime - pb.WarehouseId = st.WarehouseId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type queryPb struct { - ApplyAutoLimit bool `json:"apply_auto_limit,omitempty"` - Catalog string `json:"catalog,omitempty"` - CreateTime string `json:"create_time,omitempty"` - Description string `json:"description,omitempty"` - DisplayName string `json:"display_name,omitempty"` - Id string `json:"id,omitempty"` - LastModifierUserName string `json:"last_modifier_user_name,omitempty"` - LifecycleState LifecycleState `json:"lifecycle_state,omitempty"` - OwnerUserName string `json:"owner_user_name,omitempty"` - Parameters []QueryParameter `json:"parameters,omitempty"` - ParentPath string `json:"parent_path,omitempty"` - QueryText string `json:"query_text,omitempty"` - RunAsMode RunAsMode `json:"run_as_mode,omitempty"` - Schema string `json:"schema,omitempty"` - Tags []string `json:"tags,omitempty"` - UpdateTime string `json:"update_time,omitempty"` - WarehouseId string `json:"warehouse_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func queryFromPb(pb *queryPb) (*Query, error) { - if pb == nil { - return nil, nil - } - st := &Query{} - st.ApplyAutoLimit = pb.ApplyAutoLimit - st.Catalog = pb.Catalog - st.CreateTime = pb.CreateTime - st.Description = pb.Description - st.DisplayName = pb.DisplayName - st.Id = pb.Id - st.LastModifierUserName = pb.LastModifierUserName - st.LifecycleState = pb.LifecycleState - st.OwnerUserName = pb.OwnerUserName - st.Parameters = pb.Parameters - st.ParentPath = pb.ParentPath - st.QueryText = pb.QueryText - st.RunAsMode = pb.RunAsMode - st.Schema = pb.Schema - st.Tags = pb.Tags - st.UpdateTime = pb.UpdateTime - st.WarehouseId = pb.WarehouseId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *queryPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st queryPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func queryBackedValueToPb(st *QueryBackedValue) (*queryBackedValuePb, error) { - if st == nil { - return nil, nil - } - pb := &queryBackedValuePb{} - pb.MultiValuesOptions = st.MultiValuesOptions - pb.QueryId = st.QueryId - pb.Values = st.Values - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type queryBackedValuePb struct { - MultiValuesOptions *MultiValuesOptions `json:"multi_values_options,omitempty"` - QueryId string `json:"query_id,omitempty"` - Values []string `json:"values,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func queryBackedValueFromPb(pb *queryBackedValuePb) (*QueryBackedValue, error) { - if pb == nil { - return nil, nil - } - st := &QueryBackedValue{} - st.MultiValuesOptions = pb.MultiValuesOptions - st.QueryId = pb.QueryId - st.Values = pb.Values - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *queryBackedValuePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st queryBackedValuePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func queryEditContentToPb(st *QueryEditContent) (*queryEditContentPb, error) { - if st == nil { - return nil, nil - } - pb := &queryEditContentPb{} - pb.DataSourceId = st.DataSourceId - pb.Description = st.Description - pb.Name = st.Name - pb.Options = st.Options - pb.Query = st.Query - pb.QueryId = st.QueryId - pb.RunAsRole = st.RunAsRole - pb.Tags = st.Tags - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type queryEditContentPb struct { - DataSourceId string `json:"data_source_id,omitempty"` - Description string `json:"description,omitempty"` - Name string `json:"name,omitempty"` - Options any `json:"options,omitempty"` - Query string `json:"query,omitempty"` - QueryId string `json:"-" url:"-"` - RunAsRole RunAsRole `json:"run_as_role,omitempty"` - Tags []string `json:"tags,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func queryEditContentFromPb(pb *queryEditContentPb) (*QueryEditContent, error) { - if pb == nil { - return nil, nil - } - st := &QueryEditContent{} - st.DataSourceId = pb.DataSourceId - st.Description = pb.Description - st.Name = pb.Name - st.Options = pb.Options - st.Query = pb.Query - st.QueryId = pb.QueryId - st.RunAsRole = pb.RunAsRole - st.Tags = pb.Tags - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *queryEditContentPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st queryEditContentPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func queryFilterToPb(st *QueryFilter) (*queryFilterPb, error) { - if st == nil { - return nil, nil - } - pb := &queryFilterPb{} - pb.QueryStartTimeRange = st.QueryStartTimeRange - pb.StatementIds = st.StatementIds - pb.Statuses = st.Statuses - pb.UserIds = st.UserIds - pb.WarehouseIds = st.WarehouseIds - - return pb, nil -} - -type queryFilterPb struct { - QueryStartTimeRange *TimeRange `json:"query_start_time_range,omitempty" url:"query_start_time_range,omitempty"` - StatementIds []string `json:"statement_ids,omitempty" url:"statement_ids,omitempty"` - Statuses []QueryStatus `json:"statuses,omitempty" url:"statuses,omitempty"` - UserIds []int64 `json:"user_ids,omitempty" url:"user_ids,omitempty"` - WarehouseIds []string `json:"warehouse_ids,omitempty" url:"warehouse_ids,omitempty"` -} - -func queryFilterFromPb(pb *queryFilterPb) (*QueryFilter, error) { - if pb == nil { - return nil, nil - } - st := &QueryFilter{} - st.QueryStartTimeRange = pb.QueryStartTimeRange - st.StatementIds = pb.StatementIds - st.Statuses = pb.Statuses - st.UserIds = pb.UserIds - st.WarehouseIds = pb.WarehouseIds - - return st, nil -} - -func queryInfoToPb(st *QueryInfo) (*queryInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &queryInfoPb{} - pb.ChannelUsed = st.ChannelUsed - pb.ClientApplication = st.ClientApplication - pb.Duration = st.Duration - pb.EndpointId = st.EndpointId - pb.ErrorMessage = st.ErrorMessage - pb.ExecutedAsUserId = st.ExecutedAsUserId - pb.ExecutedAsUserName = st.ExecutedAsUserName - pb.ExecutionEndTimeMs = st.ExecutionEndTimeMs - pb.IsFinal = st.IsFinal - pb.LookupKey = st.LookupKey - pb.Metrics = st.Metrics - pb.PlansState = st.PlansState - pb.QueryEndTimeMs = st.QueryEndTimeMs - pb.QueryId = st.QueryId - pb.QuerySource = st.QuerySource - pb.QueryStartTimeMs = st.QueryStartTimeMs - pb.QueryText = st.QueryText - pb.RowsProduced = st.RowsProduced - pb.SparkUiUrl = st.SparkUiUrl - pb.StatementType = st.StatementType - pb.Status = st.Status - pb.UserId = st.UserId - pb.UserName = st.UserName - pb.WarehouseId = st.WarehouseId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type queryInfoPb struct { - ChannelUsed *ChannelInfo `json:"channel_used,omitempty"` - ClientApplication string `json:"client_application,omitempty"` - Duration int64 `json:"duration,omitempty"` - EndpointId string `json:"endpoint_id,omitempty"` - ErrorMessage string `json:"error_message,omitempty"` - ExecutedAsUserId int64 `json:"executed_as_user_id,omitempty"` - ExecutedAsUserName string `json:"executed_as_user_name,omitempty"` - ExecutionEndTimeMs int64 `json:"execution_end_time_ms,omitempty"` - IsFinal bool `json:"is_final,omitempty"` - LookupKey string `json:"lookup_key,omitempty"` - Metrics *QueryMetrics `json:"metrics,omitempty"` - PlansState PlansState `json:"plans_state,omitempty"` - QueryEndTimeMs int64 `json:"query_end_time_ms,omitempty"` - QueryId string `json:"query_id,omitempty"` - QuerySource *ExternalQuerySource `json:"query_source,omitempty"` - QueryStartTimeMs int64 `json:"query_start_time_ms,omitempty"` - QueryText string `json:"query_text,omitempty"` - RowsProduced int64 `json:"rows_produced,omitempty"` - SparkUiUrl string `json:"spark_ui_url,omitempty"` - StatementType QueryStatementType `json:"statement_type,omitempty"` - Status QueryStatus `json:"status,omitempty"` - UserId int64 `json:"user_id,omitempty"` - UserName string `json:"user_name,omitempty"` - WarehouseId string `json:"warehouse_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func queryInfoFromPb(pb *queryInfoPb) (*QueryInfo, error) { - if pb == nil { - return nil, nil - } - st := &QueryInfo{} - st.ChannelUsed = pb.ChannelUsed - st.ClientApplication = pb.ClientApplication - st.Duration = pb.Duration - st.EndpointId = pb.EndpointId - st.ErrorMessage = pb.ErrorMessage - st.ExecutedAsUserId = pb.ExecutedAsUserId - st.ExecutedAsUserName = pb.ExecutedAsUserName - st.ExecutionEndTimeMs = pb.ExecutionEndTimeMs - st.IsFinal = pb.IsFinal - st.LookupKey = pb.LookupKey - st.Metrics = pb.Metrics - st.PlansState = pb.PlansState - st.QueryEndTimeMs = pb.QueryEndTimeMs - st.QueryId = pb.QueryId - st.QuerySource = pb.QuerySource - st.QueryStartTimeMs = pb.QueryStartTimeMs - st.QueryText = pb.QueryText - st.RowsProduced = pb.RowsProduced - st.SparkUiUrl = pb.SparkUiUrl - st.StatementType = pb.StatementType - st.Status = pb.Status - st.UserId = pb.UserId - st.UserName = pb.UserName - st.WarehouseId = pb.WarehouseId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *queryInfoPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st queryInfoPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func queryListToPb(st *QueryList) (*queryListPb, error) { - if st == nil { - return nil, nil - } - pb := &queryListPb{} - pb.Count = st.Count - pb.Page = st.Page - pb.PageSize = st.PageSize - pb.Results = st.Results - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type queryListPb struct { - Count int `json:"count,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` - Results []LegacyQuery `json:"results,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func queryListFromPb(pb *queryListPb) (*QueryList, error) { - if pb == nil { - return nil, nil - } - st := &QueryList{} - st.Count = pb.Count - st.Page = pb.Page - st.PageSize = pb.PageSize - st.Results = pb.Results - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *queryListPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st queryListPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func queryMetricsToPb(st *QueryMetrics) (*queryMetricsPb, error) { - if st == nil { - return nil, nil - } - pb := &queryMetricsPb{} - pb.CompilationTimeMs = st.CompilationTimeMs - pb.ExecutionTimeMs = st.ExecutionTimeMs - pb.NetworkSentBytes = st.NetworkSentBytes - pb.OverloadingQueueStartTimestamp = st.OverloadingQueueStartTimestamp - pb.PhotonTotalTimeMs = st.PhotonTotalTimeMs - pb.ProvisioningQueueStartTimestamp = st.ProvisioningQueueStartTimestamp - pb.PrunedBytes = st.PrunedBytes - pb.PrunedFilesCount = st.PrunedFilesCount - pb.QueryCompilationStartTimestamp = st.QueryCompilationStartTimestamp - pb.ReadBytes = st.ReadBytes - pb.ReadCacheBytes = st.ReadCacheBytes - pb.ReadFilesCount = st.ReadFilesCount - pb.ReadPartitionsCount = st.ReadPartitionsCount - pb.ReadRemoteBytes = st.ReadRemoteBytes - pb.ResultFetchTimeMs = st.ResultFetchTimeMs - pb.ResultFromCache = st.ResultFromCache - pb.RowsProducedCount = st.RowsProducedCount - pb.RowsReadCount = st.RowsReadCount - pb.SpillToDiskBytes = st.SpillToDiskBytes - pb.TaskTimeOverTimeRange = st.TaskTimeOverTimeRange - pb.TaskTotalTimeMs = st.TaskTotalTimeMs - pb.TotalTimeMs = st.TotalTimeMs - pb.WriteRemoteBytes = st.WriteRemoteBytes - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type queryMetricsPb struct { - CompilationTimeMs int64 `json:"compilation_time_ms,omitempty"` - ExecutionTimeMs int64 `json:"execution_time_ms,omitempty"` - NetworkSentBytes int64 `json:"network_sent_bytes,omitempty"` - OverloadingQueueStartTimestamp int64 `json:"overloading_queue_start_timestamp,omitempty"` - PhotonTotalTimeMs int64 `json:"photon_total_time_ms,omitempty"` - ProvisioningQueueStartTimestamp int64 `json:"provisioning_queue_start_timestamp,omitempty"` - PrunedBytes int64 `json:"pruned_bytes,omitempty"` - PrunedFilesCount int64 `json:"pruned_files_count,omitempty"` - QueryCompilationStartTimestamp int64 `json:"query_compilation_start_timestamp,omitempty"` - ReadBytes int64 `json:"read_bytes,omitempty"` - ReadCacheBytes int64 `json:"read_cache_bytes,omitempty"` - ReadFilesCount int64 `json:"read_files_count,omitempty"` - ReadPartitionsCount int64 `json:"read_partitions_count,omitempty"` - ReadRemoteBytes int64 `json:"read_remote_bytes,omitempty"` - ResultFetchTimeMs int64 `json:"result_fetch_time_ms,omitempty"` - ResultFromCache bool `json:"result_from_cache,omitempty"` - RowsProducedCount int64 `json:"rows_produced_count,omitempty"` - RowsReadCount int64 `json:"rows_read_count,omitempty"` - SpillToDiskBytes int64 `json:"spill_to_disk_bytes,omitempty"` - TaskTimeOverTimeRange *TaskTimeOverRange `json:"task_time_over_time_range,omitempty"` - TaskTotalTimeMs int64 `json:"task_total_time_ms,omitempty"` - TotalTimeMs int64 `json:"total_time_ms,omitempty"` - WriteRemoteBytes int64 `json:"write_remote_bytes,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func queryMetricsFromPb(pb *queryMetricsPb) (*QueryMetrics, error) { - if pb == nil { - return nil, nil - } - st := &QueryMetrics{} - st.CompilationTimeMs = pb.CompilationTimeMs - st.ExecutionTimeMs = pb.ExecutionTimeMs - st.NetworkSentBytes = pb.NetworkSentBytes - st.OverloadingQueueStartTimestamp = pb.OverloadingQueueStartTimestamp - st.PhotonTotalTimeMs = pb.PhotonTotalTimeMs - st.ProvisioningQueueStartTimestamp = pb.ProvisioningQueueStartTimestamp - st.PrunedBytes = pb.PrunedBytes - st.PrunedFilesCount = pb.PrunedFilesCount - st.QueryCompilationStartTimestamp = pb.QueryCompilationStartTimestamp - st.ReadBytes = pb.ReadBytes - st.ReadCacheBytes = pb.ReadCacheBytes - st.ReadFilesCount = pb.ReadFilesCount - st.ReadPartitionsCount = pb.ReadPartitionsCount - st.ReadRemoteBytes = pb.ReadRemoteBytes - st.ResultFetchTimeMs = pb.ResultFetchTimeMs - st.ResultFromCache = pb.ResultFromCache - st.RowsProducedCount = pb.RowsProducedCount - st.RowsReadCount = pb.RowsReadCount - st.SpillToDiskBytes = pb.SpillToDiskBytes - st.TaskTimeOverTimeRange = pb.TaskTimeOverTimeRange - st.TaskTotalTimeMs = pb.TaskTotalTimeMs - st.TotalTimeMs = pb.TotalTimeMs - st.WriteRemoteBytes = pb.WriteRemoteBytes - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *queryMetricsPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st queryMetricsPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func queryOptionsToPb(st *QueryOptions) (*queryOptionsPb, error) { - if st == nil { - return nil, nil - } - pb := &queryOptionsPb{} - pb.Catalog = st.Catalog - pb.MovedToTrashAt = st.MovedToTrashAt - pb.Parameters = st.Parameters - pb.Schema = st.Schema - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type queryOptionsPb struct { - Catalog string `json:"catalog,omitempty"` - MovedToTrashAt string `json:"moved_to_trash_at,omitempty"` - Parameters []Parameter `json:"parameters,omitempty"` - Schema string `json:"schema,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func queryOptionsFromPb(pb *queryOptionsPb) (*QueryOptions, error) { - if pb == nil { - return nil, nil - } - st := &QueryOptions{} - st.Catalog = pb.Catalog - st.MovedToTrashAt = pb.MovedToTrashAt - st.Parameters = pb.Parameters - st.Schema = pb.Schema - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *queryOptionsPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st queryOptionsPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func queryParameterToPb(st *QueryParameter) (*queryParameterPb, error) { - if st == nil { - return nil, nil - } - pb := &queryParameterPb{} - pb.DateRangeValue = st.DateRangeValue - pb.DateValue = st.DateValue - pb.EnumValue = st.EnumValue - pb.Name = st.Name - pb.NumericValue = st.NumericValue - pb.QueryBackedValue = st.QueryBackedValue - pb.TextValue = st.TextValue - pb.Title = st.Title - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type queryParameterPb struct { - DateRangeValue *DateRangeValue `json:"date_range_value,omitempty"` - DateValue *DateValue `json:"date_value,omitempty"` - EnumValue *EnumValue `json:"enum_value,omitempty"` - Name string `json:"name,omitempty"` - NumericValue *NumericValue `json:"numeric_value,omitempty"` - QueryBackedValue *QueryBackedValue `json:"query_backed_value,omitempty"` - TextValue *TextValue `json:"text_value,omitempty"` - Title string `json:"title,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func queryParameterFromPb(pb *queryParameterPb) (*QueryParameter, error) { - if pb == nil { - return nil, nil - } - st := &QueryParameter{} - st.DateRangeValue = pb.DateRangeValue - st.DateValue = pb.DateValue - st.EnumValue = pb.EnumValue - st.Name = pb.Name - st.NumericValue = pb.NumericValue - st.QueryBackedValue = pb.QueryBackedValue - st.TextValue = pb.TextValue - st.Title = pb.Title - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *queryParameterPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st queryParameterPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func queryPostContentToPb(st *QueryPostContent) (*queryPostContentPb, error) { - if st == nil { - return nil, nil - } - pb := &queryPostContentPb{} - pb.DataSourceId = st.DataSourceId - pb.Description = st.Description - pb.Name = st.Name - pb.Options = st.Options - pb.Parent = st.Parent - pb.Query = st.Query - pb.RunAsRole = st.RunAsRole - pb.Tags = st.Tags - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type queryPostContentPb struct { - DataSourceId string `json:"data_source_id,omitempty"` - Description string `json:"description,omitempty"` - Name string `json:"name,omitempty"` - Options any `json:"options,omitempty"` - Parent string `json:"parent,omitempty"` - Query string `json:"query,omitempty"` - RunAsRole RunAsRole `json:"run_as_role,omitempty"` - Tags []string `json:"tags,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func queryPostContentFromPb(pb *queryPostContentPb) (*QueryPostContent, error) { - if pb == nil { - return nil, nil - } - st := &QueryPostContent{} - st.DataSourceId = pb.DataSourceId - st.Description = pb.Description - st.Name = pb.Name - st.Options = pb.Options - st.Parent = pb.Parent - st.Query = pb.Query - st.RunAsRole = pb.RunAsRole - st.Tags = pb.Tags - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *queryPostContentPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st queryPostContentPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func repeatedEndpointConfPairsToPb(st *RepeatedEndpointConfPairs) (*repeatedEndpointConfPairsPb, error) { - if st == nil { - return nil, nil - } - pb := &repeatedEndpointConfPairsPb{} - pb.ConfigPair = st.ConfigPair - pb.ConfigurationPairs = st.ConfigurationPairs - - return pb, nil -} - -type repeatedEndpointConfPairsPb struct { - ConfigPair []EndpointConfPair `json:"config_pair,omitempty"` - ConfigurationPairs []EndpointConfPair `json:"configuration_pairs,omitempty"` -} - -func repeatedEndpointConfPairsFromPb(pb *repeatedEndpointConfPairsPb) (*RepeatedEndpointConfPairs, error) { - if pb == nil { - return nil, nil - } - st := &RepeatedEndpointConfPairs{} - st.ConfigPair = pb.ConfigPair - st.ConfigurationPairs = pb.ConfigurationPairs - - return st, nil -} - -func restoreDashboardRequestToPb(st *RestoreDashboardRequest) (*restoreDashboardRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &restoreDashboardRequestPb{} - pb.DashboardId = st.DashboardId - - return pb, nil -} - -type restoreDashboardRequestPb struct { - DashboardId string `json:"-" url:"-"` -} - -func restoreDashboardRequestFromPb(pb *restoreDashboardRequestPb) (*RestoreDashboardRequest, error) { - if pb == nil { - return nil, nil - } - st := &RestoreDashboardRequest{} - st.DashboardId = pb.DashboardId - - return st, nil -} - -func restoreQueriesLegacyRequestToPb(st *RestoreQueriesLegacyRequest) (*restoreQueriesLegacyRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &restoreQueriesLegacyRequestPb{} - pb.QueryId = st.QueryId - - return pb, nil -} - -type restoreQueriesLegacyRequestPb struct { - QueryId string `json:"-" url:"-"` -} - -func restoreQueriesLegacyRequestFromPb(pb *restoreQueriesLegacyRequestPb) (*RestoreQueriesLegacyRequest, error) { - if pb == nil { - return nil, nil - } - st := &RestoreQueriesLegacyRequest{} - st.QueryId = pb.QueryId - - return st, nil -} - -func restoreResponseToPb(st *RestoreResponse) (*restoreResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &restoreResponsePb{} - - return pb, nil -} - -type restoreResponsePb struct { -} - -func restoreResponseFromPb(pb *restoreResponsePb) (*RestoreResponse, error) { - if pb == nil { - return nil, nil - } - st := &RestoreResponse{} - - return st, nil -} - -func resultDataToPb(st *ResultData) (*resultDataPb, error) { - if st == nil { - return nil, nil - } - pb := &resultDataPb{} - pb.ByteCount = st.ByteCount - pb.ChunkIndex = st.ChunkIndex - pb.DataArray = st.DataArray - pb.ExternalLinks = st.ExternalLinks - pb.NextChunkIndex = st.NextChunkIndex - pb.NextChunkInternalLink = st.NextChunkInternalLink - pb.RowCount = st.RowCount - pb.RowOffset = st.RowOffset - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type resultDataPb struct { - ByteCount int64 `json:"byte_count,omitempty"` - ChunkIndex int `json:"chunk_index,omitempty"` - DataArray [][]string `json:"data_array,omitempty"` - ExternalLinks []ExternalLink `json:"external_links,omitempty"` - NextChunkIndex int `json:"next_chunk_index,omitempty"` - NextChunkInternalLink string `json:"next_chunk_internal_link,omitempty"` - RowCount int64 `json:"row_count,omitempty"` - RowOffset int64 `json:"row_offset,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func resultDataFromPb(pb *resultDataPb) (*ResultData, error) { - if pb == nil { - return nil, nil - } - st := &ResultData{} - st.ByteCount = pb.ByteCount - st.ChunkIndex = pb.ChunkIndex - st.DataArray = pb.DataArray - st.ExternalLinks = pb.ExternalLinks - st.NextChunkIndex = pb.NextChunkIndex - st.NextChunkInternalLink = pb.NextChunkInternalLink - st.RowCount = pb.RowCount - st.RowOffset = pb.RowOffset - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *resultDataPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st resultDataPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func resultManifestToPb(st *ResultManifest) (*resultManifestPb, error) { - if st == nil { - return nil, nil - } - pb := &resultManifestPb{} - pb.Chunks = st.Chunks - pb.Format = st.Format - pb.Schema = st.Schema - pb.TotalByteCount = st.TotalByteCount - pb.TotalChunkCount = st.TotalChunkCount - pb.TotalRowCount = st.TotalRowCount - pb.Truncated = st.Truncated - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type resultManifestPb struct { - Chunks []BaseChunkInfo `json:"chunks,omitempty"` - Format Format `json:"format,omitempty"` - Schema *ResultSchema `json:"schema,omitempty"` - TotalByteCount int64 `json:"total_byte_count,omitempty"` - TotalChunkCount int `json:"total_chunk_count,omitempty"` - TotalRowCount int64 `json:"total_row_count,omitempty"` - Truncated bool `json:"truncated,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func resultManifestFromPb(pb *resultManifestPb) (*ResultManifest, error) { - if pb == nil { - return nil, nil - } - st := &ResultManifest{} - st.Chunks = pb.Chunks - st.Format = pb.Format - st.Schema = pb.Schema - st.TotalByteCount = pb.TotalByteCount - st.TotalChunkCount = pb.TotalChunkCount - st.TotalRowCount = pb.TotalRowCount - st.Truncated = pb.Truncated - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *resultManifestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st resultManifestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func resultSchemaToPb(st *ResultSchema) (*resultSchemaPb, error) { - if st == nil { - return nil, nil - } - pb := &resultSchemaPb{} - pb.ColumnCount = st.ColumnCount - pb.Columns = st.Columns - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type resultSchemaPb struct { - ColumnCount int `json:"column_count,omitempty"` - Columns []ColumnInfo `json:"columns,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func resultSchemaFromPb(pb *resultSchemaPb) (*ResultSchema, error) { - if pb == nil { - return nil, nil - } - st := &ResultSchema{} - st.ColumnCount = pb.ColumnCount - st.Columns = pb.Columns - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *resultSchemaPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st resultSchemaPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func serviceErrorToPb(st *ServiceError) (*serviceErrorPb, error) { - if st == nil { - return nil, nil - } - pb := &serviceErrorPb{} - pb.ErrorCode = st.ErrorCode - pb.Message = st.Message - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type serviceErrorPb struct { - ErrorCode ServiceErrorCode `json:"error_code,omitempty"` - Message string `json:"message,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func serviceErrorFromPb(pb *serviceErrorPb) (*ServiceError, error) { - if pb == nil { - return nil, nil - } - st := &ServiceError{} - st.ErrorCode = pb.ErrorCode - st.Message = pb.Message - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *serviceErrorPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st serviceErrorPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func setRequestToPb(st *SetRequest) (*setRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &setRequestPb{} - pb.AccessControlList = st.AccessControlList - pb.ObjectId = st.ObjectId - pb.ObjectType = st.ObjectType - - return pb, nil -} - -type setRequestPb struct { - AccessControlList []AccessControl `json:"access_control_list,omitempty"` - ObjectId string `json:"-" url:"-"` - ObjectType ObjectTypePlural `json:"-" url:"-"` -} - -func setRequestFromPb(pb *setRequestPb) (*SetRequest, error) { - if pb == nil { - return nil, nil - } - st := &SetRequest{} - st.AccessControlList = pb.AccessControlList - st.ObjectId = pb.ObjectId - st.ObjectType = pb.ObjectType - - return st, nil -} - -func setResponseToPb(st *SetResponse) (*setResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &setResponsePb{} - pb.AccessControlList = st.AccessControlList - pb.ObjectId = st.ObjectId - pb.ObjectType = st.ObjectType - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type setResponsePb struct { - AccessControlList []AccessControl `json:"access_control_list,omitempty"` - ObjectId string `json:"object_id,omitempty"` - ObjectType ObjectType `json:"object_type,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func setResponseFromPb(pb *setResponsePb) (*SetResponse, error) { - if pb == nil { - return nil, nil - } - st := &SetResponse{} - st.AccessControlList = pb.AccessControlList - st.ObjectId = pb.ObjectId - st.ObjectType = pb.ObjectType - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *setResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st setResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func setWorkspaceWarehouseConfigRequestToPb(st *SetWorkspaceWarehouseConfigRequest) (*setWorkspaceWarehouseConfigRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &setWorkspaceWarehouseConfigRequestPb{} - pb.Channel = st.Channel - pb.ConfigParam = st.ConfigParam - pb.DataAccessConfig = st.DataAccessConfig - pb.EnabledWarehouseTypes = st.EnabledWarehouseTypes - pb.GlobalParam = st.GlobalParam - pb.GoogleServiceAccount = st.GoogleServiceAccount - pb.InstanceProfileArn = st.InstanceProfileArn - pb.SecurityPolicy = st.SecurityPolicy - pb.SqlConfigurationParameters = st.SqlConfigurationParameters - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type setWorkspaceWarehouseConfigRequestPb struct { - Channel *Channel `json:"channel,omitempty"` - ConfigParam *RepeatedEndpointConfPairs `json:"config_param,omitempty"` - DataAccessConfig []EndpointConfPair `json:"data_access_config,omitempty"` - EnabledWarehouseTypes []WarehouseTypePair `json:"enabled_warehouse_types,omitempty"` - GlobalParam *RepeatedEndpointConfPairs `json:"global_param,omitempty"` - GoogleServiceAccount string `json:"google_service_account,omitempty"` - InstanceProfileArn string `json:"instance_profile_arn,omitempty"` - SecurityPolicy SetWorkspaceWarehouseConfigRequestSecurityPolicy `json:"security_policy,omitempty"` - SqlConfigurationParameters *RepeatedEndpointConfPairs `json:"sql_configuration_parameters,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func setWorkspaceWarehouseConfigRequestFromPb(pb *setWorkspaceWarehouseConfigRequestPb) (*SetWorkspaceWarehouseConfigRequest, error) { - if pb == nil { - return nil, nil - } - st := &SetWorkspaceWarehouseConfigRequest{} - st.Channel = pb.Channel - st.ConfigParam = pb.ConfigParam - st.DataAccessConfig = pb.DataAccessConfig - st.EnabledWarehouseTypes = pb.EnabledWarehouseTypes - st.GlobalParam = pb.GlobalParam - st.GoogleServiceAccount = pb.GoogleServiceAccount - st.InstanceProfileArn = pb.InstanceProfileArn - st.SecurityPolicy = pb.SecurityPolicy - st.SqlConfigurationParameters = pb.SqlConfigurationParameters - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *setWorkspaceWarehouseConfigRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st setWorkspaceWarehouseConfigRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func setWorkspaceWarehouseConfigResponseToPb(st *SetWorkspaceWarehouseConfigResponse) (*setWorkspaceWarehouseConfigResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &setWorkspaceWarehouseConfigResponsePb{} - - return pb, nil -} - -type setWorkspaceWarehouseConfigResponsePb struct { -} - -func setWorkspaceWarehouseConfigResponseFromPb(pb *setWorkspaceWarehouseConfigResponsePb) (*SetWorkspaceWarehouseConfigResponse, error) { - if pb == nil { - return nil, nil - } - st := &SetWorkspaceWarehouseConfigResponse{} - - return st, nil -} - -func startRequestToPb(st *StartRequest) (*startRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &startRequestPb{} - pb.Id = st.Id - - return pb, nil -} - -type startRequestPb struct { - Id string `json:"-" url:"-"` -} - -func startRequestFromPb(pb *startRequestPb) (*StartRequest, error) { - if pb == nil { - return nil, nil - } - st := &StartRequest{} - st.Id = pb.Id - - return st, nil -} - -func startWarehouseResponseToPb(st *StartWarehouseResponse) (*startWarehouseResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &startWarehouseResponsePb{} - - return pb, nil -} - -type startWarehouseResponsePb struct { -} - -func startWarehouseResponseFromPb(pb *startWarehouseResponsePb) (*StartWarehouseResponse, error) { - if pb == nil { - return nil, nil - } - st := &StartWarehouseResponse{} - - return st, nil -} - -func statementParameterListItemToPb(st *StatementParameterListItem) (*statementParameterListItemPb, error) { - if st == nil { - return nil, nil - } - pb := &statementParameterListItemPb{} - pb.Name = st.Name - pb.Type = st.Type - pb.Value = st.Value - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type statementParameterListItemPb struct { - Name string `json:"name"` - Type string `json:"type,omitempty"` - Value string `json:"value,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func statementParameterListItemFromPb(pb *statementParameterListItemPb) (*StatementParameterListItem, error) { - if pb == nil { - return nil, nil - } - st := &StatementParameterListItem{} - st.Name = pb.Name - st.Type = pb.Type - st.Value = pb.Value - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *statementParameterListItemPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st statementParameterListItemPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func statementResponseToPb(st *StatementResponse) (*statementResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &statementResponsePb{} - pb.Manifest = st.Manifest - pb.Result = st.Result - pb.StatementId = st.StatementId - pb.Status = st.Status - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type statementResponsePb struct { - Manifest *ResultManifest `json:"manifest,omitempty"` - Result *ResultData `json:"result,omitempty"` - StatementId string `json:"statement_id,omitempty"` - Status *StatementStatus `json:"status,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func statementResponseFromPb(pb *statementResponsePb) (*StatementResponse, error) { - if pb == nil { - return nil, nil - } - st := &StatementResponse{} - st.Manifest = pb.Manifest - st.Result = pb.Result - st.StatementId = pb.StatementId - st.Status = pb.Status - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *statementResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st statementResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func statementStatusToPb(st *StatementStatus) (*statementStatusPb, error) { - if st == nil { - return nil, nil - } - pb := &statementStatusPb{} - pb.Error = st.Error - pb.State = st.State - - return pb, nil -} - -type statementStatusPb struct { - Error *ServiceError `json:"error,omitempty"` - State StatementState `json:"state,omitempty"` -} - -func statementStatusFromPb(pb *statementStatusPb) (*StatementStatus, error) { - if pb == nil { - return nil, nil - } - st := &StatementStatus{} - st.Error = pb.Error - st.State = pb.State - - return st, nil -} - -func stopRequestToPb(st *StopRequest) (*stopRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &stopRequestPb{} - pb.Id = st.Id - - return pb, nil -} - -type stopRequestPb struct { - Id string `json:"-" url:"-"` -} - -func stopRequestFromPb(pb *stopRequestPb) (*StopRequest, error) { - if pb == nil { - return nil, nil - } - st := &StopRequest{} - st.Id = pb.Id - - return st, nil -} - -func stopWarehouseResponseToPb(st *StopWarehouseResponse) (*stopWarehouseResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &stopWarehouseResponsePb{} - - return pb, nil -} - -type stopWarehouseResponsePb struct { -} - -func stopWarehouseResponseFromPb(pb *stopWarehouseResponsePb) (*StopWarehouseResponse, error) { - if pb == nil { - return nil, nil - } - st := &StopWarehouseResponse{} - - return st, nil -} - -func successToPb(st *Success) (*successPb, error) { - if st == nil { - return nil, nil - } - pb := &successPb{} - pb.Message = st.Message - - return pb, nil -} - -type successPb struct { - Message SuccessMessage `json:"message,omitempty"` -} - -func successFromPb(pb *successPb) (*Success, error) { - if pb == nil { - return nil, nil - } - st := &Success{} - st.Message = pb.Message - - return st, nil -} - -func taskTimeOverRangeToPb(st *TaskTimeOverRange) (*taskTimeOverRangePb, error) { - if st == nil { - return nil, nil - } - pb := &taskTimeOverRangePb{} - pb.Entries = st.Entries - pb.Interval = st.Interval - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type taskTimeOverRangePb struct { - Entries []TaskTimeOverRangeEntry `json:"entries,omitempty"` - Interval int64 `json:"interval,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func taskTimeOverRangeFromPb(pb *taskTimeOverRangePb) (*TaskTimeOverRange, error) { - if pb == nil { - return nil, nil - } - st := &TaskTimeOverRange{} - st.Entries = pb.Entries - st.Interval = pb.Interval - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *taskTimeOverRangePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st taskTimeOverRangePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func taskTimeOverRangeEntryToPb(st *TaskTimeOverRangeEntry) (*taskTimeOverRangeEntryPb, error) { - if st == nil { - return nil, nil - } - pb := &taskTimeOverRangeEntryPb{} - pb.TaskCompletedTimeMs = st.TaskCompletedTimeMs - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type taskTimeOverRangeEntryPb struct { - TaskCompletedTimeMs int64 `json:"task_completed_time_ms,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func taskTimeOverRangeEntryFromPb(pb *taskTimeOverRangeEntryPb) (*TaskTimeOverRangeEntry, error) { - if pb == nil { - return nil, nil - } - st := &TaskTimeOverRangeEntry{} - st.TaskCompletedTimeMs = pb.TaskCompletedTimeMs - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *taskTimeOverRangeEntryPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st taskTimeOverRangeEntryPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func terminationReasonToPb(st *TerminationReason) (*terminationReasonPb, error) { - if st == nil { - return nil, nil - } - pb := &terminationReasonPb{} - pb.Code = st.Code - pb.Parameters = st.Parameters - pb.Type = st.Type - - return pb, nil -} - -type terminationReasonPb struct { - Code TerminationReasonCode `json:"code,omitempty"` - Parameters map[string]string `json:"parameters,omitempty"` - Type TerminationReasonType `json:"type,omitempty"` -} - -func terminationReasonFromPb(pb *terminationReasonPb) (*TerminationReason, error) { - if pb == nil { - return nil, nil - } - st := &TerminationReason{} - st.Code = pb.Code - st.Parameters = pb.Parameters - st.Type = pb.Type - - return st, nil -} - -func textValueToPb(st *TextValue) (*textValuePb, error) { - if st == nil { - return nil, nil - } - pb := &textValuePb{} - pb.Value = st.Value - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type textValuePb struct { - Value string `json:"value,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func textValueFromPb(pb *textValuePb) (*TextValue, error) { - if pb == nil { - return nil, nil - } - st := &TextValue{} - st.Value = pb.Value - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *textValuePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st textValuePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func timeRangeToPb(st *TimeRange) (*timeRangePb, error) { - if st == nil { - return nil, nil - } - pb := &timeRangePb{} - pb.EndTimeMs = st.EndTimeMs - pb.StartTimeMs = st.StartTimeMs - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type timeRangePb struct { - EndTimeMs int64 `json:"end_time_ms,omitempty" url:"end_time_ms,omitempty"` - StartTimeMs int64 `json:"start_time_ms,omitempty" url:"start_time_ms,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func timeRangeFromPb(pb *timeRangePb) (*TimeRange, error) { - if pb == nil { - return nil, nil - } - st := &TimeRange{} - st.EndTimeMs = pb.EndTimeMs - st.StartTimeMs = pb.StartTimeMs - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *timeRangePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st timeRangePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func transferOwnershipObjectIdToPb(st *TransferOwnershipObjectId) (*transferOwnershipObjectIdPb, error) { - if st == nil { - return nil, nil - } - pb := &transferOwnershipObjectIdPb{} - pb.NewOwner = st.NewOwner - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type transferOwnershipObjectIdPb struct { - NewOwner string `json:"new_owner,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func transferOwnershipObjectIdFromPb(pb *transferOwnershipObjectIdPb) (*TransferOwnershipObjectId, error) { - if pb == nil { - return nil, nil - } - st := &TransferOwnershipObjectId{} - st.NewOwner = pb.NewOwner - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *transferOwnershipObjectIdPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st transferOwnershipObjectIdPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func transferOwnershipRequestToPb(st *TransferOwnershipRequest) (*transferOwnershipRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &transferOwnershipRequestPb{} - pb.NewOwner = st.NewOwner - pb.ObjectId = st.ObjectId - pb.ObjectType = st.ObjectType - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type transferOwnershipRequestPb struct { - NewOwner string `json:"new_owner,omitempty"` - ObjectId TransferOwnershipObjectId `json:"-" url:"-"` - ObjectType OwnableObjectType `json:"-" url:"-"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func transferOwnershipRequestFromPb(pb *transferOwnershipRequestPb) (*TransferOwnershipRequest, error) { - if pb == nil { - return nil, nil - } - st := &TransferOwnershipRequest{} - st.NewOwner = pb.NewOwner - st.ObjectId = pb.ObjectId - st.ObjectType = pb.ObjectType - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *transferOwnershipRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st transferOwnershipRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func trashAlertRequestToPb(st *TrashAlertRequest) (*trashAlertRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &trashAlertRequestPb{} - pb.Id = st.Id - - return pb, nil -} - -type trashAlertRequestPb struct { - Id string `json:"-" url:"-"` -} - -func trashAlertRequestFromPb(pb *trashAlertRequestPb) (*TrashAlertRequest, error) { - if pb == nil { - return nil, nil - } - st := &TrashAlertRequest{} - st.Id = pb.Id - - return st, nil -} - -func trashAlertV2RequestToPb(st *TrashAlertV2Request) (*trashAlertV2RequestPb, error) { - if st == nil { - return nil, nil - } - pb := &trashAlertV2RequestPb{} - pb.Id = st.Id - - return pb, nil -} - -type trashAlertV2RequestPb struct { - Id string `json:"-" url:"-"` -} - -func trashAlertV2RequestFromPb(pb *trashAlertV2RequestPb) (*TrashAlertV2Request, error) { - if pb == nil { - return nil, nil - } - st := &TrashAlertV2Request{} - st.Id = pb.Id - - return st, nil -} - -func trashQueryRequestToPb(st *TrashQueryRequest) (*trashQueryRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &trashQueryRequestPb{} - pb.Id = st.Id - - return pb, nil -} - -type trashQueryRequestPb struct { - Id string `json:"-" url:"-"` -} - -func trashQueryRequestFromPb(pb *trashQueryRequestPb) (*TrashQueryRequest, error) { - if pb == nil { - return nil, nil - } - st := &TrashQueryRequest{} - st.Id = pb.Id - - return st, nil -} - -func updateAlertRequestToPb(st *UpdateAlertRequest) (*updateAlertRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &updateAlertRequestPb{} - pb.Alert = st.Alert - pb.AutoResolveDisplayName = st.AutoResolveDisplayName - pb.Id = st.Id - pb.UpdateMask = st.UpdateMask - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type updateAlertRequestPb struct { - Alert *UpdateAlertRequestAlert `json:"alert,omitempty"` - AutoResolveDisplayName bool `json:"auto_resolve_display_name,omitempty"` - Id string `json:"-" url:"-"` - UpdateMask string `json:"update_mask"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func updateAlertRequestFromPb(pb *updateAlertRequestPb) (*UpdateAlertRequest, error) { - if pb == nil { - return nil, nil - } - st := &UpdateAlertRequest{} - st.Alert = pb.Alert - st.AutoResolveDisplayName = pb.AutoResolveDisplayName - st.Id = pb.Id - st.UpdateMask = pb.UpdateMask - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *updateAlertRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st updateAlertRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func updateAlertRequestAlertToPb(st *UpdateAlertRequestAlert) (*updateAlertRequestAlertPb, error) { - if st == nil { - return nil, nil - } - pb := &updateAlertRequestAlertPb{} - pb.Condition = st.Condition - pb.CustomBody = st.CustomBody - pb.CustomSubject = st.CustomSubject - pb.DisplayName = st.DisplayName - pb.NotifyOnOk = st.NotifyOnOk - pb.OwnerUserName = st.OwnerUserName - pb.QueryId = st.QueryId - pb.SecondsToRetrigger = st.SecondsToRetrigger - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type updateAlertRequestAlertPb struct { - Condition *AlertCondition `json:"condition,omitempty"` - CustomBody string `json:"custom_body,omitempty"` - CustomSubject string `json:"custom_subject,omitempty"` - DisplayName string `json:"display_name,omitempty"` - NotifyOnOk bool `json:"notify_on_ok,omitempty"` - OwnerUserName string `json:"owner_user_name,omitempty"` - QueryId string `json:"query_id,omitempty"` - SecondsToRetrigger int `json:"seconds_to_retrigger,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func updateAlertRequestAlertFromPb(pb *updateAlertRequestAlertPb) (*UpdateAlertRequestAlert, error) { - if pb == nil { - return nil, nil - } - st := &UpdateAlertRequestAlert{} - st.Condition = pb.Condition - st.CustomBody = pb.CustomBody - st.CustomSubject = pb.CustomSubject - st.DisplayName = pb.DisplayName - st.NotifyOnOk = pb.NotifyOnOk - st.OwnerUserName = pb.OwnerUserName - st.QueryId = pb.QueryId - st.SecondsToRetrigger = pb.SecondsToRetrigger - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *updateAlertRequestAlertPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st updateAlertRequestAlertPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func updateAlertV2RequestToPb(st *UpdateAlertV2Request) (*updateAlertV2RequestPb, error) { - if st == nil { - return nil, nil - } - pb := &updateAlertV2RequestPb{} - pb.Alert = st.Alert - pb.Id = st.Id - pb.UpdateMask = st.UpdateMask - - return pb, nil -} - -type updateAlertV2RequestPb struct { - Alert AlertV2 `json:"alert"` - Id string `json:"-" url:"-"` - UpdateMask string `json:"-" url:"update_mask"` -} - -func updateAlertV2RequestFromPb(pb *updateAlertV2RequestPb) (*UpdateAlertV2Request, error) { - if pb == nil { - return nil, nil - } - st := &UpdateAlertV2Request{} - st.Alert = pb.Alert - st.Id = pb.Id - st.UpdateMask = pb.UpdateMask - - return st, nil -} - -func updateQueryRequestToPb(st *UpdateQueryRequest) (*updateQueryRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &updateQueryRequestPb{} - pb.AutoResolveDisplayName = st.AutoResolveDisplayName - pb.Id = st.Id - pb.Query = st.Query - pb.UpdateMask = st.UpdateMask - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type updateQueryRequestPb struct { - AutoResolveDisplayName bool `json:"auto_resolve_display_name,omitempty"` - Id string `json:"-" url:"-"` - Query *UpdateQueryRequestQuery `json:"query,omitempty"` - UpdateMask string `json:"update_mask"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func updateQueryRequestFromPb(pb *updateQueryRequestPb) (*UpdateQueryRequest, error) { - if pb == nil { - return nil, nil - } - st := &UpdateQueryRequest{} - st.AutoResolveDisplayName = pb.AutoResolveDisplayName - st.Id = pb.Id - st.Query = pb.Query - st.UpdateMask = pb.UpdateMask - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *updateQueryRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st updateQueryRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func updateQueryRequestQueryToPb(st *UpdateQueryRequestQuery) (*updateQueryRequestQueryPb, error) { - if st == nil { - return nil, nil - } - pb := &updateQueryRequestQueryPb{} - pb.ApplyAutoLimit = st.ApplyAutoLimit - pb.Catalog = st.Catalog - pb.Description = st.Description - pb.DisplayName = st.DisplayName - pb.OwnerUserName = st.OwnerUserName - pb.Parameters = st.Parameters - pb.QueryText = st.QueryText - pb.RunAsMode = st.RunAsMode - pb.Schema = st.Schema - pb.Tags = st.Tags - pb.WarehouseId = st.WarehouseId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type updateQueryRequestQueryPb struct { - ApplyAutoLimit bool `json:"apply_auto_limit,omitempty"` - Catalog string `json:"catalog,omitempty"` - Description string `json:"description,omitempty"` - DisplayName string `json:"display_name,omitempty"` - OwnerUserName string `json:"owner_user_name,omitempty"` - Parameters []QueryParameter `json:"parameters,omitempty"` - QueryText string `json:"query_text,omitempty"` - RunAsMode RunAsMode `json:"run_as_mode,omitempty"` - Schema string `json:"schema,omitempty"` - Tags []string `json:"tags,omitempty"` - WarehouseId string `json:"warehouse_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func updateQueryRequestQueryFromPb(pb *updateQueryRequestQueryPb) (*UpdateQueryRequestQuery, error) { - if pb == nil { - return nil, nil - } - st := &UpdateQueryRequestQuery{} - st.ApplyAutoLimit = pb.ApplyAutoLimit - st.Catalog = pb.Catalog - st.Description = pb.Description - st.DisplayName = pb.DisplayName - st.OwnerUserName = pb.OwnerUserName - st.Parameters = pb.Parameters - st.QueryText = pb.QueryText - st.RunAsMode = pb.RunAsMode - st.Schema = pb.Schema - st.Tags = pb.Tags - st.WarehouseId = pb.WarehouseId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *updateQueryRequestQueryPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st updateQueryRequestQueryPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func updateResponseToPb(st *UpdateResponse) (*updateResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &updateResponsePb{} - - return pb, nil -} - -type updateResponsePb struct { -} - -func updateResponseFromPb(pb *updateResponsePb) (*UpdateResponse, error) { - if pb == nil { - return nil, nil - } - st := &UpdateResponse{} - - return st, nil -} - -func updateVisualizationRequestToPb(st *UpdateVisualizationRequest) (*updateVisualizationRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &updateVisualizationRequestPb{} - pb.Id = st.Id - pb.UpdateMask = st.UpdateMask - pb.Visualization = st.Visualization - - return pb, nil -} - -type updateVisualizationRequestPb struct { - Id string `json:"-" url:"-"` - UpdateMask string `json:"update_mask"` - Visualization *UpdateVisualizationRequestVisualization `json:"visualization,omitempty"` -} - -func updateVisualizationRequestFromPb(pb *updateVisualizationRequestPb) (*UpdateVisualizationRequest, error) { - if pb == nil { - return nil, nil - } - st := &UpdateVisualizationRequest{} - st.Id = pb.Id - st.UpdateMask = pb.UpdateMask - st.Visualization = pb.Visualization - - return st, nil -} - -func updateVisualizationRequestVisualizationToPb(st *UpdateVisualizationRequestVisualization) (*updateVisualizationRequestVisualizationPb, error) { - if st == nil { - return nil, nil - } - pb := &updateVisualizationRequestVisualizationPb{} - pb.DisplayName = st.DisplayName - pb.SerializedOptions = st.SerializedOptions - pb.SerializedQueryPlan = st.SerializedQueryPlan - pb.Type = st.Type - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type updateVisualizationRequestVisualizationPb struct { - DisplayName string `json:"display_name,omitempty"` - SerializedOptions string `json:"serialized_options,omitempty"` - SerializedQueryPlan string `json:"serialized_query_plan,omitempty"` - Type string `json:"type,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func updateVisualizationRequestVisualizationFromPb(pb *updateVisualizationRequestVisualizationPb) (*UpdateVisualizationRequestVisualization, error) { - if pb == nil { - return nil, nil - } - st := &UpdateVisualizationRequestVisualization{} - st.DisplayName = pb.DisplayName - st.SerializedOptions = pb.SerializedOptions - st.SerializedQueryPlan = pb.SerializedQueryPlan - st.Type = pb.Type - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *updateVisualizationRequestVisualizationPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st updateVisualizationRequestVisualizationPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func userToPb(st *User) (*userPb, error) { - if st == nil { - return nil, nil - } - pb := &userPb{} - pb.Email = st.Email - pb.Id = st.Id - pb.Name = st.Name - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type userPb struct { - Email string `json:"email,omitempty"` - Id int `json:"id,omitempty"` - Name string `json:"name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func userFromPb(pb *userPb) (*User, error) { - if pb == nil { - return nil, nil - } - st := &User{} - st.Email = pb.Email - st.Id = pb.Id - st.Name = pb.Name - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *userPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st userPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func visualizationToPb(st *Visualization) (*visualizationPb, error) { - if st == nil { - return nil, nil - } - pb := &visualizationPb{} - pb.CreateTime = st.CreateTime - pb.DisplayName = st.DisplayName - pb.Id = st.Id - pb.QueryId = st.QueryId - pb.SerializedOptions = st.SerializedOptions - pb.SerializedQueryPlan = st.SerializedQueryPlan - pb.Type = st.Type - pb.UpdateTime = st.UpdateTime - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type visualizationPb struct { - CreateTime string `json:"create_time,omitempty"` - DisplayName string `json:"display_name,omitempty"` - Id string `json:"id,omitempty"` - QueryId string `json:"query_id,omitempty"` - SerializedOptions string `json:"serialized_options,omitempty"` - SerializedQueryPlan string `json:"serialized_query_plan,omitempty"` - Type string `json:"type,omitempty"` - UpdateTime string `json:"update_time,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func visualizationFromPb(pb *visualizationPb) (*Visualization, error) { - if pb == nil { - return nil, nil - } - st := &Visualization{} - st.CreateTime = pb.CreateTime - st.DisplayName = pb.DisplayName - st.Id = pb.Id - st.QueryId = pb.QueryId - st.SerializedOptions = pb.SerializedOptions - st.SerializedQueryPlan = pb.SerializedQueryPlan - st.Type = pb.Type - st.UpdateTime = pb.UpdateTime - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *visualizationPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st visualizationPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func warehouseAccessControlRequestToPb(st *WarehouseAccessControlRequest) (*warehouseAccessControlRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &warehouseAccessControlRequestPb{} - pb.GroupName = st.GroupName - pb.PermissionLevel = st.PermissionLevel - pb.ServicePrincipalName = st.ServicePrincipalName - pb.UserName = st.UserName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type warehouseAccessControlRequestPb struct { - GroupName string `json:"group_name,omitempty"` - PermissionLevel WarehousePermissionLevel `json:"permission_level,omitempty"` - ServicePrincipalName string `json:"service_principal_name,omitempty"` - UserName string `json:"user_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func warehouseAccessControlRequestFromPb(pb *warehouseAccessControlRequestPb) (*WarehouseAccessControlRequest, error) { - if pb == nil { - return nil, nil - } - st := &WarehouseAccessControlRequest{} - st.GroupName = pb.GroupName - st.PermissionLevel = pb.PermissionLevel - st.ServicePrincipalName = pb.ServicePrincipalName - st.UserName = pb.UserName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *warehouseAccessControlRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st warehouseAccessControlRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func warehouseAccessControlResponseToPb(st *WarehouseAccessControlResponse) (*warehouseAccessControlResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &warehouseAccessControlResponsePb{} - pb.AllPermissions = st.AllPermissions - pb.DisplayName = st.DisplayName - pb.GroupName = st.GroupName - pb.ServicePrincipalName = st.ServicePrincipalName - pb.UserName = st.UserName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type warehouseAccessControlResponsePb struct { - AllPermissions []WarehousePermission `json:"all_permissions,omitempty"` - DisplayName string `json:"display_name,omitempty"` - GroupName string `json:"group_name,omitempty"` - ServicePrincipalName string `json:"service_principal_name,omitempty"` - UserName string `json:"user_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func warehouseAccessControlResponseFromPb(pb *warehouseAccessControlResponsePb) (*WarehouseAccessControlResponse, error) { - if pb == nil { - return nil, nil - } - st := &WarehouseAccessControlResponse{} - st.AllPermissions = pb.AllPermissions - st.DisplayName = pb.DisplayName - st.GroupName = pb.GroupName - st.ServicePrincipalName = pb.ServicePrincipalName - st.UserName = pb.UserName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *warehouseAccessControlResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st warehouseAccessControlResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func warehousePermissionToPb(st *WarehousePermission) (*warehousePermissionPb, error) { - if st == nil { - return nil, nil - } - pb := &warehousePermissionPb{} - pb.Inherited = st.Inherited - pb.InheritedFromObject = st.InheritedFromObject - pb.PermissionLevel = st.PermissionLevel - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type warehousePermissionPb struct { - Inherited bool `json:"inherited,omitempty"` - InheritedFromObject []string `json:"inherited_from_object,omitempty"` - PermissionLevel WarehousePermissionLevel `json:"permission_level,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func warehousePermissionFromPb(pb *warehousePermissionPb) (*WarehousePermission, error) { - if pb == nil { - return nil, nil - } - st := &WarehousePermission{} - st.Inherited = pb.Inherited - st.InheritedFromObject = pb.InheritedFromObject - st.PermissionLevel = pb.PermissionLevel - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *warehousePermissionPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st warehousePermissionPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func warehousePermissionsToPb(st *WarehousePermissions) (*warehousePermissionsPb, error) { - if st == nil { - return nil, nil - } - pb := &warehousePermissionsPb{} - pb.AccessControlList = st.AccessControlList - pb.ObjectId = st.ObjectId - pb.ObjectType = st.ObjectType - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type warehousePermissionsPb struct { - AccessControlList []WarehouseAccessControlResponse `json:"access_control_list,omitempty"` - ObjectId string `json:"object_id,omitempty"` - ObjectType string `json:"object_type,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func warehousePermissionsFromPb(pb *warehousePermissionsPb) (*WarehousePermissions, error) { - if pb == nil { - return nil, nil - } - st := &WarehousePermissions{} - st.AccessControlList = pb.AccessControlList - st.ObjectId = pb.ObjectId - st.ObjectType = pb.ObjectType - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *warehousePermissionsPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st warehousePermissionsPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func warehousePermissionsDescriptionToPb(st *WarehousePermissionsDescription) (*warehousePermissionsDescriptionPb, error) { - if st == nil { - return nil, nil - } - pb := &warehousePermissionsDescriptionPb{} - pb.Description = st.Description - pb.PermissionLevel = st.PermissionLevel - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type warehousePermissionsDescriptionPb struct { - Description string `json:"description,omitempty"` - PermissionLevel WarehousePermissionLevel `json:"permission_level,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func warehousePermissionsDescriptionFromPb(pb *warehousePermissionsDescriptionPb) (*WarehousePermissionsDescription, error) { - if pb == nil { - return nil, nil - } - st := &WarehousePermissionsDescription{} - st.Description = pb.Description - st.PermissionLevel = pb.PermissionLevel - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *warehousePermissionsDescriptionPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st warehousePermissionsDescriptionPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func warehousePermissionsRequestToPb(st *WarehousePermissionsRequest) (*warehousePermissionsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &warehousePermissionsRequestPb{} - pb.AccessControlList = st.AccessControlList - pb.WarehouseId = st.WarehouseId - - return pb, nil -} - -type warehousePermissionsRequestPb struct { - AccessControlList []WarehouseAccessControlRequest `json:"access_control_list,omitempty"` - WarehouseId string `json:"-" url:"-"` -} - -func warehousePermissionsRequestFromPb(pb *warehousePermissionsRequestPb) (*WarehousePermissionsRequest, error) { - if pb == nil { - return nil, nil - } - st := &WarehousePermissionsRequest{} - st.AccessControlList = pb.AccessControlList - st.WarehouseId = pb.WarehouseId - - return st, nil -} - -func warehouseTypePairToPb(st *WarehouseTypePair) (*warehouseTypePairPb, error) { - if st == nil { - return nil, nil - } - pb := &warehouseTypePairPb{} - pb.Enabled = st.Enabled - pb.WarehouseType = st.WarehouseType - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type warehouseTypePairPb struct { - Enabled bool `json:"enabled,omitempty"` - WarehouseType WarehouseTypePairWarehouseType `json:"warehouse_type,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func warehouseTypePairFromPb(pb *warehouseTypePairPb) (*WarehouseTypePair, error) { - if pb == nil { - return nil, nil - } - st := &WarehouseTypePair{} - st.Enabled = pb.Enabled - st.WarehouseType = pb.WarehouseType - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *warehouseTypePairPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st warehouseTypePairPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func widgetToPb(st *Widget) (*widgetPb, error) { - if st == nil { - return nil, nil - } - pb := &widgetPb{} - pb.Id = st.Id - pb.Options = st.Options - pb.Visualization = st.Visualization - pb.Width = st.Width - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type widgetPb struct { - Id string `json:"id,omitempty"` - Options *WidgetOptions `json:"options,omitempty"` - Visualization *LegacyVisualization `json:"visualization,omitempty"` - Width int `json:"width,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func widgetFromPb(pb *widgetPb) (*Widget, error) { - if pb == nil { - return nil, nil - } - st := &Widget{} - st.Id = pb.Id - st.Options = pb.Options - st.Visualization = pb.Visualization - st.Width = pb.Width - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *widgetPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st widgetPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func widgetOptionsToPb(st *WidgetOptions) (*widgetOptionsPb, error) { - if st == nil { - return nil, nil - } - pb := &widgetOptionsPb{} - pb.CreatedAt = st.CreatedAt - pb.Description = st.Description - pb.IsHidden = st.IsHidden - pb.ParameterMappings = st.ParameterMappings - pb.Position = st.Position - pb.Title = st.Title - pb.UpdatedAt = st.UpdatedAt - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type widgetOptionsPb struct { - CreatedAt string `json:"created_at,omitempty"` - Description string `json:"description,omitempty"` - IsHidden bool `json:"isHidden,omitempty"` - ParameterMappings any `json:"parameterMappings,omitempty"` - Position *WidgetPosition `json:"position,omitempty"` - Title string `json:"title,omitempty"` - UpdatedAt string `json:"updated_at,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func widgetOptionsFromPb(pb *widgetOptionsPb) (*WidgetOptions, error) { - if pb == nil { - return nil, nil - } - st := &WidgetOptions{} - st.CreatedAt = pb.CreatedAt - st.Description = pb.Description - st.IsHidden = pb.IsHidden - st.ParameterMappings = pb.ParameterMappings - st.Position = pb.Position - st.Title = pb.Title - st.UpdatedAt = pb.UpdatedAt - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *widgetOptionsPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st widgetOptionsPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func widgetPositionToPb(st *WidgetPosition) (*widgetPositionPb, error) { - if st == nil { - return nil, nil - } - pb := &widgetPositionPb{} - pb.AutoHeight = st.AutoHeight - pb.Col = st.Col - pb.Row = st.Row - pb.SizeX = st.SizeX - pb.SizeY = st.SizeY - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type widgetPositionPb struct { - AutoHeight bool `json:"autoHeight,omitempty"` - Col int `json:"col,omitempty"` - Row int `json:"row,omitempty"` - SizeX int `json:"sizeX,omitempty"` - SizeY int `json:"sizeY,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func widgetPositionFromPb(pb *widgetPositionPb) (*WidgetPosition, error) { - if pb == nil { - return nil, nil - } - st := &WidgetPosition{} - st.AutoHeight = pb.AutoHeight - st.Col = pb.Col - st.Row = pb.Row - st.SizeX = pb.SizeX - st.SizeY = pb.SizeY - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *widgetPositionPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st widgetPositionPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func durationToPb(d *time.Duration) (*string, error) { - if d == nil { - return nil, nil - } - s := fmt.Sprintf("%.9fs", d.Seconds()) - return &s, nil -} - -func durationFromPb(s *string) (*time.Duration, error) { - if s == nil { - return nil, nil - } - d, err := time.ParseDuration(*s) - if err != nil { - return nil, err - } - return &d, nil -} - -func timestampToPb(t *time.Time) (*string, error) { - if t == nil { - return nil, nil - } - s := t.Format(time.RFC3339) - return &s, nil -} - -func timestampFromPb(s *string) (*time.Time, error) { - if s == nil { - return nil, nil - } - t, err := time.Parse(time.RFC3339, *s) - if err != nil { - return nil, err - } - return &t, nil -} - -func fieldMaskToPb(fm *[]string) (*string, error) { - if fm == nil { - return nil, nil - } - s := strings.Join(*fm, ",") - return &s, nil -} - -func fieldMaskFromPb(s *string) (*[]string, error) { - if s == nil { - return nil, nil - } - fm := strings.Split(*s, ",") - return &fm, nil -} diff --git a/service/sql/model.go b/service/sql/model.go index 75c8547ea..73688a0db 100755 --- a/service/sql/model.go +++ b/service/sql/model.go @@ -3,48 +3,28 @@ package sql import ( - "encoding/json" "fmt" + + "github.com/databricks/databricks-sdk-go/marshal" ) type AccessControl struct { - - // Wire name: 'group_name' GroupName string `json:"group_name,omitempty"` // * `CAN_VIEW`: Can view the query * `CAN_RUN`: Can run the query * // `CAN_EDIT`: Can edit the query * `CAN_MANAGE`: Can manage the query - // Wire name: 'permission_level' PermissionLevel PermissionLevel `json:"permission_level,omitempty"` - // Wire name: 'user_name' UserName string `json:"user_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *AccessControl) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &accessControlPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := accessControlFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *AccessControl) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st AccessControl) MarshalJSON() ([]byte, error) { - pb, err := accessControlToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s AccessControl) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type Aggregation string @@ -104,195 +84,80 @@ func (f *Aggregation) Type() string { type Alert struct { // Trigger conditions of the alert. - // Wire name: 'condition' Condition *AlertCondition `json:"condition,omitempty"` // The timestamp indicating when the alert was created. - // Wire name: 'create_time' CreateTime string `json:"create_time,omitempty"` // Custom body of alert notification, if it exists. See [here] for custom // templating instructions. // // [here]: https://docs.databricks.com/sql/user/alerts/index.html - // Wire name: 'custom_body' CustomBody string `json:"custom_body,omitempty"` // Custom subject of alert notification, if it exists. This can include // email subject entries and Slack notification headers, for example. See // [here] for custom templating instructions. // // [here]: https://docs.databricks.com/sql/user/alerts/index.html - // Wire name: 'custom_subject' CustomSubject string `json:"custom_subject,omitempty"` // The display name of the alert. - // Wire name: 'display_name' DisplayName string `json:"display_name,omitempty"` // UUID identifying the alert. - // Wire name: 'id' Id string `json:"id,omitempty"` // The workspace state of the alert. Used for tracking trashed status. - // Wire name: 'lifecycle_state' LifecycleState LifecycleState `json:"lifecycle_state,omitempty"` // Whether to notify alert subscribers when alert returns back to normal. - // Wire name: 'notify_on_ok' NotifyOnOk bool `json:"notify_on_ok,omitempty"` // The owner's username. This field is set to "Unavailable" if the user has // been deleted. - // Wire name: 'owner_user_name' OwnerUserName string `json:"owner_user_name,omitempty"` // The workspace path of the folder containing the alert. - // Wire name: 'parent_path' ParentPath string `json:"parent_path,omitempty"` // UUID of the query attached to the alert. - // Wire name: 'query_id' QueryId string `json:"query_id,omitempty"` // Number of seconds an alert must wait after being triggered to rearm // itself. After rearming, it can be triggered again. If 0 or not specified, // the alert will not be triggered again. - // Wire name: 'seconds_to_retrigger' SecondsToRetrigger int `json:"seconds_to_retrigger,omitempty"` // Current state of the alert's trigger status. This field is set to UNKNOWN // if the alert has not yet been evaluated or ran into an error during the // last evaluation. - // Wire name: 'state' State AlertState `json:"state,omitempty"` // Timestamp when the alert was last triggered, if the alert has been // triggered before. - // Wire name: 'trigger_time' TriggerTime string `json:"trigger_time,omitempty"` // The timestamp indicating when the alert was updated. - // Wire name: 'update_time' UpdateTime string `json:"update_time,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *Alert) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &alertPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := alertFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *Alert) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st Alert) MarshalJSON() ([]byte, error) { - pb, err := alertToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s Alert) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type AlertCondition struct { // Alert state if result is empty. - // Wire name: 'empty_result_state' EmptyResultState AlertState `json:"empty_result_state,omitempty"` // Operator used for comparison in alert evaluation. - // Wire name: 'op' Op AlertOperator `json:"op,omitempty"` // Name of the column from the query result to use for comparison in alert // evaluation. - // Wire name: 'operand' Operand *AlertConditionOperand `json:"operand,omitempty"` // Threshold value used for comparison in alert evaluation. - // Wire name: 'threshold' Threshold *AlertConditionThreshold `json:"threshold,omitempty"` } -func (st *AlertCondition) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &alertConditionPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := alertConditionFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st AlertCondition) MarshalJSON() ([]byte, error) { - pb, err := alertConditionToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type AlertConditionOperand struct { - - // Wire name: 'column' Column *AlertOperandColumn `json:"column,omitempty"` } -func (st *AlertConditionOperand) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &alertConditionOperandPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := alertConditionOperandFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st AlertConditionOperand) MarshalJSON() ([]byte, error) { - pb, err := alertConditionOperandToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type AlertConditionThreshold struct { - - // Wire name: 'value' Value *AlertOperandValue `json:"value,omitempty"` } -func (st *AlertConditionThreshold) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &alertConditionThresholdPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := alertConditionThresholdFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st AlertConditionThreshold) MarshalJSON() ([]byte, error) { - pb, err := alertConditionThresholdToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // UNSPECIFIED - default unspecify value for proto enum, do not use it in the // code UNKNOWN - alert not yet evaluated TRIGGERED - alert is triggered OK - // alert is not triggered ERROR - alert evaluation failed @@ -340,75 +205,35 @@ func (f *AlertEvaluationState) Type() string { } type AlertOperandColumn struct { - - // Wire name: 'name' Name string `json:"name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *AlertOperandColumn) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &alertOperandColumnPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := alertOperandColumnFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *AlertOperandColumn) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st AlertOperandColumn) MarshalJSON() ([]byte, error) { - pb, err := alertOperandColumnToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s AlertOperandColumn) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type AlertOperandValue struct { - - // Wire name: 'bool_value' BoolValue bool `json:"bool_value,omitempty"` - // Wire name: 'double_value' DoubleValue float64 `json:"double_value,omitempty"` - // Wire name: 'string_value' StringValue string `json:"string_value,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *AlertOperandValue) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &alertOperandValuePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := alertOperandValueFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *AlertOperandValue) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st AlertOperandValue) MarshalJSON() ([]byte, error) { - pb, err := alertOperandValueToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s AlertOperandValue) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type AlertOperator string @@ -466,63 +291,39 @@ func (f *AlertOperator) Type() string { // Alert configuration options. type AlertOptions struct { // Name of column in the query result to compare in alert evaluation. - // Wire name: 'column' Column string `json:"column"` // Custom body of alert notification, if it exists. See [here] for custom // templating instructions. // // [here]: https://docs.databricks.com/sql/user/alerts/index.html - // Wire name: 'custom_body' CustomBody string `json:"custom_body,omitempty"` // Custom subject of alert notification, if it exists. This includes email // subject, Slack notification header, etc. See [here] for custom templating // instructions. // // [here]: https://docs.databricks.com/sql/user/alerts/index.html - // Wire name: 'custom_subject' CustomSubject string `json:"custom_subject,omitempty"` // State that alert evaluates to when query result is empty. - // Wire name: 'empty_result_state' EmptyResultState AlertOptionsEmptyResultState `json:"empty_result_state,omitempty"` // Whether or not the alert is muted. If an alert is muted, it will not // notify users and notification destinations when triggered. - // Wire name: 'muted' Muted bool `json:"muted,omitempty"` // Operator used to compare in alert evaluation: `>`, `>=`, `<`, `<=`, `==`, // `!=` - // Wire name: 'op' Op string `json:"op"` // Value used to compare in alert evaluation. Supported types include // strings (eg. 'foobar'), floats (eg. 123.4), and booleans (true). - // Wire name: 'value' Value any `json:"value"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *AlertOptions) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &alertOptionsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := alertOptionsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *AlertOptions) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st AlertOptions) MarshalJSON() ([]byte, error) { - pb, err := alertOptionsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s AlertOptions) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // State that alert evaluates to when query result is empty. @@ -568,84 +369,54 @@ func (f *AlertOptionsEmptyResultState) Type() string { type AlertQuery struct { // The timestamp when this query was created. - // Wire name: 'created_at' CreatedAt string `json:"created_at,omitempty"` // Data source ID maps to the ID of the data source used by the resource and // is distinct from the warehouse ID. [Learn more] // // [Learn more]: https://docs.databricks.com/api/workspace/datasources/list - // Wire name: 'data_source_id' DataSourceId string `json:"data_source_id,omitempty"` // General description that conveys additional information about this query // such as usage notes. - // Wire name: 'description' Description string `json:"description,omitempty"` // Query ID. - // Wire name: 'id' Id string `json:"id,omitempty"` // Indicates whether the query is trashed. Trashed queries can't be used in // dashboards, or appear in search results. If this boolean is `true`, the // `options` property for this query includes a `moved_to_trash_at` // timestamp. Trashed queries are permanently deleted after 30 days. - // Wire name: 'is_archived' IsArchived bool `json:"is_archived,omitempty"` // Whether the query is a draft. Draft queries only appear in list views for // their owners. Visualizations from draft queries cannot appear on // dashboards. - // Wire name: 'is_draft' IsDraft bool `json:"is_draft,omitempty"` // Text parameter types are not safe from SQL injection for all types of // data source. Set this Boolean parameter to `true` if a query either does // not use any text type parameters or uses a data source type where text // type parameters are handled safely. - // Wire name: 'is_safe' IsSafe bool `json:"is_safe,omitempty"` // The title of this query that appears in list views, widget headings, and // on the query page. - // Wire name: 'name' Name string `json:"name,omitempty"` - // Wire name: 'options' Options *QueryOptions `json:"options,omitempty"` // The text of the query to be run. - // Wire name: 'query' Query string `json:"query,omitempty"` - // Wire name: 'tags' Tags []string `json:"tags,omitempty"` // The timestamp at which this query was last updated. - // Wire name: 'updated_at' UpdatedAt string `json:"updated_at,omitempty"` // The ID of the user who owns the query. - // Wire name: 'user_id' UserId int `json:"user_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *AlertQuery) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &alertQueryPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := alertQueryFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *AlertQuery) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st AlertQuery) MarshalJSON() ([]byte, error) { - pb, err := alertQueryToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s AlertQuery) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type AlertState string @@ -690,317 +461,152 @@ func (f *AlertState) Type() string { type AlertV2 struct { // The timestamp indicating when the alert was created. - // Wire name: 'create_time' CreateTime string `json:"create_time,omitempty"` // Custom description for the alert. support mustache template. - // Wire name: 'custom_description' CustomDescription string `json:"custom_description,omitempty"` // Custom summary for the alert. support mustache template. - // Wire name: 'custom_summary' CustomSummary string `json:"custom_summary,omitempty"` // The display name of the alert. - // Wire name: 'display_name' DisplayName string `json:"display_name,omitempty"` - // Wire name: 'evaluation' Evaluation *AlertV2Evaluation `json:"evaluation,omitempty"` // UUID identifying the alert. - // Wire name: 'id' Id string `json:"id,omitempty"` // Indicates whether the query is trashed. - // Wire name: 'lifecycle_state' LifecycleState LifecycleState `json:"lifecycle_state,omitempty"` // The owner's username. This field is set to "Unavailable" if the user has // been deleted. - // Wire name: 'owner_user_name' OwnerUserName string `json:"owner_user_name,omitempty"` // The workspace path of the folder containing the alert. Can only be set on // create, and cannot be updated. - // Wire name: 'parent_path' ParentPath string `json:"parent_path,omitempty"` // Text of the query to be run. - // Wire name: 'query_text' QueryText string `json:"query_text,omitempty"` // The run as username. This field is set to "Unavailable" if the user has // been deleted. - // Wire name: 'run_as_user_name' RunAsUserName string `json:"run_as_user_name,omitempty"` - // Wire name: 'schedule' Schedule *CronSchedule `json:"schedule,omitempty"` // The timestamp indicating when the alert was updated. - // Wire name: 'update_time' UpdateTime string `json:"update_time,omitempty"` // ID of the SQL warehouse attached to the alert. - // Wire name: 'warehouse_id' WarehouseId string `json:"warehouse_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *AlertV2) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &alertV2Pb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := alertV2FromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *AlertV2) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st AlertV2) MarshalJSON() ([]byte, error) { - pb, err := alertV2ToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s AlertV2) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type AlertV2Evaluation struct { // Operator used for comparison in alert evaluation. - // Wire name: 'comparison_operator' ComparisonOperator ComparisonOperator `json:"comparison_operator,omitempty"` // Alert state if result is empty. - // Wire name: 'empty_result_state' EmptyResultState AlertEvaluationState `json:"empty_result_state,omitempty"` // Timestamp of the last evaluation. - // Wire name: 'last_evaluated_at' LastEvaluatedAt string `json:"last_evaluated_at,omitempty"` // User or Notification Destination to notify when alert is triggered. - // Wire name: 'notification' Notification *AlertV2Notification `json:"notification,omitempty"` // Source column from result to use to evaluate alert - // Wire name: 'source' Source *AlertV2OperandColumn `json:"source,omitempty"` // Latest state of alert evaluation. - // Wire name: 'state' State AlertEvaluationState `json:"state,omitempty"` // Threshold to user for alert evaluation, can be a column or a value. - // Wire name: 'threshold' Threshold *AlertV2Operand `json:"threshold,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *AlertV2Evaluation) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &alertV2EvaluationPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := alertV2EvaluationFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *AlertV2Evaluation) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st AlertV2Evaluation) MarshalJSON() ([]byte, error) { - pb, err := alertV2EvaluationToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s AlertV2Evaluation) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type AlertV2Notification struct { // Whether to notify alert subscribers when alert returns back to normal. - // Wire name: 'notify_on_ok' NotifyOnOk bool `json:"notify_on_ok,omitempty"` // Number of seconds an alert must wait after being triggered to rearm // itself. After rearming, it can be triggered again. If 0 or not specified, // the alert will not be triggered again. - // Wire name: 'retrigger_seconds' RetriggerSeconds int `json:"retrigger_seconds,omitempty"` - // Wire name: 'subscriptions' Subscriptions []AlertV2Subscription `json:"subscriptions,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *AlertV2Notification) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &alertV2NotificationPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := alertV2NotificationFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *AlertV2Notification) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st AlertV2Notification) MarshalJSON() ([]byte, error) { - pb, err := alertV2NotificationToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s AlertV2Notification) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type AlertV2Operand struct { - - // Wire name: 'column' Column *AlertV2OperandColumn `json:"column,omitempty"` - // Wire name: 'value' Value *AlertV2OperandValue `json:"value,omitempty"` } -func (st *AlertV2Operand) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &alertV2OperandPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := alertV2OperandFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st AlertV2Operand) MarshalJSON() ([]byte, error) { - pb, err := alertV2OperandToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type AlertV2OperandColumn struct { - - // Wire name: 'aggregation' Aggregation Aggregation `json:"aggregation,omitempty"` - // Wire name: 'display' Display string `json:"display,omitempty"` - // Wire name: 'name' Name string `json:"name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *AlertV2OperandColumn) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &alertV2OperandColumnPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := alertV2OperandColumnFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *AlertV2OperandColumn) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st AlertV2OperandColumn) MarshalJSON() ([]byte, error) { - pb, err := alertV2OperandColumnToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s AlertV2OperandColumn) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type AlertV2OperandValue struct { - - // Wire name: 'bool_value' BoolValue bool `json:"bool_value,omitempty"` - // Wire name: 'double_value' DoubleValue float64 `json:"double_value,omitempty"` - // Wire name: 'string_value' StringValue string `json:"string_value,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *AlertV2OperandValue) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &alertV2OperandValuePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := alertV2OperandValueFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *AlertV2OperandValue) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st AlertV2OperandValue) MarshalJSON() ([]byte, error) { - pb, err := alertV2OperandValueToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s AlertV2OperandValue) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type AlertV2Subscription struct { - - // Wire name: 'destination_id' DestinationId string `json:"destination_id,omitempty"` - // Wire name: 'user_email' UserEmail string `json:"user_email,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *AlertV2Subscription) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &alertV2SubscriptionPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := alertV2SubscriptionFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *AlertV2Subscription) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st AlertV2Subscription) MarshalJSON() ([]byte, error) { - pb, err := alertV2SubscriptionToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s AlertV2Subscription) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Describes metadata for a particular chunk, within a result set; this @@ -1009,179 +615,69 @@ func (st AlertV2Subscription) MarshalJSON() ([]byte, error) { type BaseChunkInfo struct { // The number of bytes in the result chunk. This field is not available when // using `INLINE` disposition. - // Wire name: 'byte_count' ByteCount int64 `json:"byte_count,omitempty"` // The position within the sequence of result set chunks. - // Wire name: 'chunk_index' ChunkIndex int `json:"chunk_index,omitempty"` // The number of rows within the result chunk. - // Wire name: 'row_count' RowCount int64 `json:"row_count,omitempty"` // The starting row offset within the result set. - // Wire name: 'row_offset' RowOffset int64 `json:"row_offset,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *BaseChunkInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &baseChunkInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := baseChunkInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *BaseChunkInfo) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st BaseChunkInfo) MarshalJSON() ([]byte, error) { - pb, err := baseChunkInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s BaseChunkInfo) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Cancel statement execution type CancelExecutionRequest struct { // The statement ID is returned upon successfully submitting a SQL // statement, and is a required reference for all subsequent calls. - StatementId string `json:"-" tf:"-"` -} - -func (st *CancelExecutionRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &cancelExecutionRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := cancelExecutionRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CancelExecutionRequest) MarshalJSON() ([]byte, error) { - pb, err := cancelExecutionRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + StatementId string `json:"-" url:"-"` } type CancelExecutionResponse struct { } -func (st *CancelExecutionResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &cancelExecutionResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := cancelExecutionResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CancelExecutionResponse) MarshalJSON() ([]byte, error) { - pb, err := cancelExecutionResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Configures the channel name and DBSQL version of the warehouse. // CHANNEL_NAME_CUSTOM should be chosen only when `dbsql_version` is specified. type Channel struct { - - // Wire name: 'dbsql_version' DbsqlVersion string `json:"dbsql_version,omitempty"` - // Wire name: 'name' Name ChannelName `json:"name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *Channel) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &channelPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := channelFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *Channel) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st Channel) MarshalJSON() ([]byte, error) { - pb, err := channelToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s Channel) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Details about a Channel. type ChannelInfo struct { // DB SQL Version the Channel is mapped to. - // Wire name: 'dbsql_version' DbsqlVersion string `json:"dbsql_version,omitempty"` // Name of the channel - // Wire name: 'name' Name ChannelName `json:"name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ChannelInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &channelInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := channelInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ChannelInfo) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ChannelInfo) MarshalJSON() ([]byte, error) { - pb, err := channelInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ChannelInfo) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ChannelName string @@ -1228,117 +724,65 @@ func (f *ChannelName) Type() string { } type ClientConfig struct { - - // Wire name: 'allow_custom_js_visualizations' AllowCustomJsVisualizations bool `json:"allow_custom_js_visualizations,omitempty"` - // Wire name: 'allow_downloads' AllowDownloads bool `json:"allow_downloads,omitempty"` - // Wire name: 'allow_external_shares' AllowExternalShares bool `json:"allow_external_shares,omitempty"` - // Wire name: 'allow_subscriptions' AllowSubscriptions bool `json:"allow_subscriptions,omitempty"` - // Wire name: 'date_format' DateFormat string `json:"date_format,omitempty"` - // Wire name: 'date_time_format' DateTimeFormat string `json:"date_time_format,omitempty"` - // Wire name: 'disable_publish' DisablePublish bool `json:"disable_publish,omitempty"` - // Wire name: 'enable_legacy_autodetect_types' EnableLegacyAutodetectTypes bool `json:"enable_legacy_autodetect_types,omitempty"` - // Wire name: 'feature_show_permissions_control' FeatureShowPermissionsControl bool `json:"feature_show_permissions_control,omitempty"` - // Wire name: 'hide_plotly_mode_bar' HidePlotlyModeBar bool `json:"hide_plotly_mode_bar,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ClientConfig) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &clientConfigPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := clientConfigFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ClientConfig) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ClientConfig) MarshalJSON() ([]byte, error) { - pb, err := clientConfigToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ClientConfig) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ColumnInfo struct { // The name of the column. - // Wire name: 'name' Name string `json:"name,omitempty"` // The ordinal position of the column (starting at position 0). - // Wire name: 'position' Position int `json:"position,omitempty"` // The format of the interval type. - // Wire name: 'type_interval_type' TypeIntervalType string `json:"type_interval_type,omitempty"` // The name of the base data type. This doesn't include details for complex // types such as STRUCT, MAP or ARRAY. - // Wire name: 'type_name' TypeName ColumnInfoTypeName `json:"type_name,omitempty"` // Specifies the number of digits in a number. This applies to the DECIMAL // type. - // Wire name: 'type_precision' TypePrecision int `json:"type_precision,omitempty"` // Specifies the number of digits to the right of the decimal point in a // number. This applies to the DECIMAL type. - // Wire name: 'type_scale' TypeScale int `json:"type_scale,omitempty"` // The full SQL type specification. - // Wire name: 'type_text' TypeText string `json:"type_text,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ColumnInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &columnInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := columnInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ColumnInfo) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ColumnInfo) MarshalJSON() ([]byte, error) { - pb, err := columnInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ColumnInfo) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The name of the base data type. This doesn't include details for complex @@ -1488,415 +932,203 @@ func (f *ComparisonOperator) Type() string { type CreateAlert struct { // Name of the alert. - // Wire name: 'name' Name string `json:"name"` // Alert configuration options. - // Wire name: 'options' Options AlertOptions `json:"options"` // The identifier of the workspace folder containing the object. - // Wire name: 'parent' Parent string `json:"parent,omitempty"` // Query ID. - // Wire name: 'query_id' QueryId string `json:"query_id"` // Number of seconds after being triggered before the alert rearms itself // and can be triggered again. If `null`, alert will never be triggered // again. - // Wire name: 'rearm' Rearm int `json:"rearm,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateAlert) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createAlertPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createAlertFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateAlert) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateAlert) MarshalJSON() ([]byte, error) { - pb, err := createAlertToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateAlert) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreateAlertRequest struct { - - // Wire name: 'alert' Alert *CreateAlertRequestAlert `json:"alert,omitempty"` // If true, automatically resolve alert display name conflicts. Otherwise, // fail the request if the alert's display name conflicts with an existing // alert's display name. - // Wire name: 'auto_resolve_display_name' AutoResolveDisplayName bool `json:"auto_resolve_display_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateAlertRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createAlertRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createAlertRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateAlertRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateAlertRequest) MarshalJSON() ([]byte, error) { - pb, err := createAlertRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateAlertRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreateAlertRequestAlert struct { // Trigger conditions of the alert. - // Wire name: 'condition' Condition *AlertCondition `json:"condition,omitempty"` // Custom body of alert notification, if it exists. See [here] for custom // templating instructions. // // [here]: https://docs.databricks.com/sql/user/alerts/index.html - // Wire name: 'custom_body' CustomBody string `json:"custom_body,omitempty"` // Custom subject of alert notification, if it exists. This can include // email subject entries and Slack notification headers, for example. See // [here] for custom templating instructions. // // [here]: https://docs.databricks.com/sql/user/alerts/index.html - // Wire name: 'custom_subject' CustomSubject string `json:"custom_subject,omitempty"` // The display name of the alert. - // Wire name: 'display_name' DisplayName string `json:"display_name,omitempty"` // Whether to notify alert subscribers when alert returns back to normal. - // Wire name: 'notify_on_ok' NotifyOnOk bool `json:"notify_on_ok,omitempty"` // The workspace path of the folder containing the alert. - // Wire name: 'parent_path' ParentPath string `json:"parent_path,omitempty"` // UUID of the query attached to the alert. - // Wire name: 'query_id' QueryId string `json:"query_id,omitempty"` // Number of seconds an alert must wait after being triggered to rearm // itself. After rearming, it can be triggered again. If 0 or not specified, // the alert will not be triggered again. - // Wire name: 'seconds_to_retrigger' SecondsToRetrigger int `json:"seconds_to_retrigger,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateAlertRequestAlert) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createAlertRequestAlertPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createAlertRequestAlertFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateAlertRequestAlert) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateAlertRequestAlert) MarshalJSON() ([]byte, error) { - pb, err := createAlertRequestAlertToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateAlertRequestAlert) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Create an alert type CreateAlertV2Request struct { - - // Wire name: 'alert' Alert AlertV2 `json:"alert"` } -func (st *CreateAlertV2Request) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createAlertV2RequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createAlertV2RequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CreateAlertV2Request) MarshalJSON() ([]byte, error) { - pb, err := createAlertV2RequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type CreateQueryRequest struct { // If true, automatically resolve query display name conflicts. Otherwise, // fail the request if the query's display name conflicts with an existing // query's display name. - // Wire name: 'auto_resolve_display_name' AutoResolveDisplayName bool `json:"auto_resolve_display_name,omitempty"` - // Wire name: 'query' Query *CreateQueryRequestQuery `json:"query,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateQueryRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createQueryRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createQueryRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateQueryRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateQueryRequest) MarshalJSON() ([]byte, error) { - pb, err := createQueryRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateQueryRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreateQueryRequestQuery struct { // Whether to apply a 1000 row limit to the query result. - // Wire name: 'apply_auto_limit' ApplyAutoLimit bool `json:"apply_auto_limit,omitempty"` // Name of the catalog where this query will be executed. - // Wire name: 'catalog' Catalog string `json:"catalog,omitempty"` // General description that conveys additional information about this query // such as usage notes. - // Wire name: 'description' Description string `json:"description,omitempty"` // Display name of the query that appears in list views, widget headings, // and on the query page. - // Wire name: 'display_name' DisplayName string `json:"display_name,omitempty"` // List of query parameter definitions. - // Wire name: 'parameters' Parameters []QueryParameter `json:"parameters,omitempty"` // Workspace path of the workspace folder containing the object. - // Wire name: 'parent_path' ParentPath string `json:"parent_path,omitempty"` // Text of the query to be run. - // Wire name: 'query_text' QueryText string `json:"query_text,omitempty"` // Sets the "Run as" role for the object. - // Wire name: 'run_as_mode' RunAsMode RunAsMode `json:"run_as_mode,omitempty"` // Name of the schema where this query will be executed. - // Wire name: 'schema' Schema string `json:"schema,omitempty"` - // Wire name: 'tags' Tags []string `json:"tags,omitempty"` // ID of the SQL warehouse attached to the query. - // Wire name: 'warehouse_id' WarehouseId string `json:"warehouse_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateQueryRequestQuery) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createQueryRequestQueryPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createQueryRequestQueryFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateQueryRequestQuery) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateQueryRequestQuery) MarshalJSON() ([]byte, error) { - pb, err := createQueryRequestQueryToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateQueryRequestQuery) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Add visualization to a query type CreateQueryVisualizationsLegacyRequest struct { // A short description of this visualization. This is not displayed in the // UI. - // Wire name: 'description' Description string `json:"description,omitempty"` // The name of the visualization that appears on dashboards and the query // screen. - // Wire name: 'name' Name string `json:"name,omitempty"` // The options object varies widely from one visualization type to the next // and is unsupported. Databricks does not recommend modifying visualization // settings in JSON. - // Wire name: 'options' Options any `json:"options"` // The identifier returned by :method:queries/create - // Wire name: 'query_id' QueryId string `json:"query_id"` // The type of visualization: chart, table, pivot table, and so on. - // Wire name: 'type' Type string `json:"type"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateQueryVisualizationsLegacyRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createQueryVisualizationsLegacyRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createQueryVisualizationsLegacyRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateQueryVisualizationsLegacyRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateQueryVisualizationsLegacyRequest) MarshalJSON() ([]byte, error) { - pb, err := createQueryVisualizationsLegacyRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateQueryVisualizationsLegacyRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreateVisualizationRequest struct { - - // Wire name: 'visualization' Visualization *CreateVisualizationRequestVisualization `json:"visualization,omitempty"` } -func (st *CreateVisualizationRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createVisualizationRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createVisualizationRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CreateVisualizationRequest) MarshalJSON() ([]byte, error) { - pb, err := createVisualizationRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type CreateVisualizationRequestVisualization struct { // The display name of the visualization. - // Wire name: 'display_name' DisplayName string `json:"display_name,omitempty"` // UUID of the query that the visualization is attached to. - // Wire name: 'query_id' QueryId string `json:"query_id,omitempty"` // The visualization options varies widely from one visualization type to // the next and is unsupported. Databricks does not recommend modifying // visualization options directly. - // Wire name: 'serialized_options' SerializedOptions string `json:"serialized_options,omitempty"` // The visualization query plan varies widely from one visualization type to // the next and is unsupported. Databricks does not recommend modifying the // visualization query plan directly. - // Wire name: 'serialized_query_plan' SerializedQueryPlan string `json:"serialized_query_plan,omitempty"` // The type of visualization: counter, table, funnel, and so on. - // Wire name: 'type' Type string `json:"type,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateVisualizationRequestVisualization) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createVisualizationRequestVisualizationPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createVisualizationRequestVisualizationFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateVisualizationRequestVisualization) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateVisualizationRequestVisualization) MarshalJSON() ([]byte, error) { - pb, err := createVisualizationRequestVisualizationToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateVisualizationRequestVisualization) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreateWarehouseRequest struct { @@ -1908,10 +1140,8 @@ type CreateWarehouseRequest struct { // autostop. // // Defaults to 120 mins - // Wire name: 'auto_stop_mins' AutoStopMins int `json:"auto_stop_mins,omitempty"` // Channel Details - // Wire name: 'channel' Channel *Channel `json:"channel,omitempty"` // Size of the clusters allocated for this warehouse. Increasing the size of // a spark cluster allows you to run larger queries on it. If you want to @@ -1919,21 +1149,16 @@ type CreateWarehouseRequest struct { // // Supported values: - 2X-Small - X-Small - Small - Medium - Large - X-Large // - 2X-Large - 3X-Large - 4X-Large - // Wire name: 'cluster_size' ClusterSize string `json:"cluster_size,omitempty"` // warehouse creator name - // Wire name: 'creator_name' CreatorName string `json:"creator_name,omitempty"` // Configures whether the warehouse should use Photon optimized clusters. // // Defaults to false. - // Wire name: 'enable_photon' EnablePhoton bool `json:"enable_photon,omitempty"` // Configures whether the warehouse should use serverless compute - // Wire name: 'enable_serverless_compute' EnableServerlessCompute bool `json:"enable_serverless_compute,omitempty"` // Deprecated. Instance profile used to pass IAM role to the cluster - // Wire name: 'instance_profile_arn' InstanceProfileArn string `json:"instance_profile_arn,omitempty"` // Maximum number of clusters that the autoscaler will create to handle // concurrent queries. @@ -1941,7 +1166,6 @@ type CreateWarehouseRequest struct { // Supported values: - Must be >= min_num_clusters - Must be <= 30. // // Defaults to min_clusters if unset. - // Wire name: 'max_num_clusters' MaxNumClusters int `json:"max_num_clusters,omitempty"` // Minimum number of available clusters that will be maintained for this SQL // warehouse. Increasing this will ensure that a larger number of clusters @@ -1952,55 +1176,33 @@ type CreateWarehouseRequest struct { // Supported values: - Must be > 0 - Must be <= min(max_num_clusters, 30) // // Defaults to 1 - // Wire name: 'min_num_clusters' MinNumClusters int `json:"min_num_clusters,omitempty"` // Logical name for the cluster. // // Supported values: - Must be unique within an org. - Must be less than 100 // characters. - // Wire name: 'name' Name string `json:"name,omitempty"` // Configurations whether the warehouse should use spot instances. - // Wire name: 'spot_instance_policy' SpotInstancePolicy SpotInstancePolicy `json:"spot_instance_policy,omitempty"` // A set of key-value pairs that will be tagged on all resources (e.g., AWS // instances and EBS volumes) associated with this SQL warehouse. // // Supported values: - Number of tags < 45. - // Wire name: 'tags' Tags *EndpointTags `json:"tags,omitempty"` // Warehouse type: `PRO` or `CLASSIC`. If you want to use serverless // compute, you must set to `PRO` and also set the field // `enable_serverless_compute` to `true`. - // Wire name: 'warehouse_type' WarehouseType CreateWarehouseRequestWarehouseType `json:"warehouse_type,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateWarehouseRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createWarehouseRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createWarehouseRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateWarehouseRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateWarehouseRequest) MarshalJSON() ([]byte, error) { - pb, err := createWarehouseRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateWarehouseRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Warehouse type: `PRO` or `CLASSIC`. If you want to use serverless compute, @@ -2048,352 +1250,197 @@ func (f *CreateWarehouseRequestWarehouseType) Type() string { type CreateWarehouseResponse struct { // Id for the SQL warehouse. This value is unique across all SQL warehouses. - // Wire name: 'id' Id string `json:"id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateWarehouseResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createWarehouseResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createWarehouseResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateWarehouseResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateWarehouseResponse) MarshalJSON() ([]byte, error) { - pb, err := createWarehouseResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateWarehouseResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreateWidget struct { // Dashboard ID returned by :method:dashboards/create. - // Wire name: 'dashboard_id' DashboardId string `json:"dashboard_id"` // Widget ID returned by :method:dashboardwidgets/create - Id string `json:"-" tf:"-"` + Id string `json:"-" url:"-"` - // Wire name: 'options' Options WidgetOptions `json:"options"` // If this is a textbox widget, the application displays this text. This // field is ignored if the widget contains a visualization in the // `visualization` field. - // Wire name: 'text' Text string `json:"text,omitempty"` // Query Vizualization ID returned by :method:queryvisualizations/create. - // Wire name: 'visualization_id' VisualizationId string `json:"visualization_id,omitempty"` // Width of a widget - // Wire name: 'width' Width int `json:"width"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateWidget) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createWidgetPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createWidgetFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateWidget) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateWidget) MarshalJSON() ([]byte, error) { - pb, err := createWidgetToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateWidget) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CronSchedule struct { // Indicate whether this schedule is paused or not. - // Wire name: 'pause_status' PauseStatus SchedulePauseStatus `json:"pause_status,omitempty"` // A cron expression using quartz syntax that specifies the schedule for // this pipeline. Should use the quartz format described here: // http://www.quartz-scheduler.org/documentation/quartz-2.1.7/tutorials/tutorial-lesson-06.html - // Wire name: 'quartz_cron_schedule' QuartzCronSchedule string `json:"quartz_cron_schedule,omitempty"` // A Java timezone id. The schedule will be resolved using this timezone. // This will be combined with the quartz_cron_schedule to determine the // schedule. See // https://docs.databricks.com/sql/language-manual/sql-ref-syntax-aux-conf-mgmt-set-timezone.html // for details. - // Wire name: 'timezone_id' TimezoneId string `json:"timezone_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CronSchedule) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &cronSchedulePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := cronScheduleFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CronSchedule) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CronSchedule) MarshalJSON() ([]byte, error) { - pb, err := cronScheduleToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CronSchedule) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // A JSON representing a dashboard containing widgets of visualizations and text // boxes. type Dashboard struct { // Whether the authenticated user can edit the query definition. - // Wire name: 'can_edit' CanEdit bool `json:"can_edit,omitempty"` // Timestamp when this dashboard was created. - // Wire name: 'created_at' CreatedAt string `json:"created_at,omitempty"` // In the web application, query filters that share a name are coupled to a // single selection box if this value is `true`. - // Wire name: 'dashboard_filters_enabled' DashboardFiltersEnabled bool `json:"dashboard_filters_enabled,omitempty"` // The ID for this dashboard. - // Wire name: 'id' Id string `json:"id,omitempty"` // Indicates whether a dashboard is trashed. Trashed dashboards won't appear // in list views. If this boolean is `true`, the `options` property for this // dashboard includes a `moved_to_trash_at` timestamp. Items in trash are // permanently deleted after 30 days. - // Wire name: 'is_archived' IsArchived bool `json:"is_archived,omitempty"` // Whether a dashboard is a draft. Draft dashboards only appear in list // views for their owners. - // Wire name: 'is_draft' IsDraft bool `json:"is_draft,omitempty"` // Indicates whether this query object appears in the current user's // favorites list. This flag determines whether the star icon for favorites // is selected. - // Wire name: 'is_favorite' IsFavorite bool `json:"is_favorite,omitempty"` // The title of the dashboard that appears in list views and at the top of // the dashboard page. - // Wire name: 'name' Name string `json:"name,omitempty"` - // Wire name: 'options' Options *DashboardOptions `json:"options,omitempty"` // The identifier of the workspace folder containing the object. - // Wire name: 'parent' Parent string `json:"parent,omitempty"` // * `CAN_VIEW`: Can view the query * `CAN_RUN`: Can run the query * // `CAN_EDIT`: Can edit the query * `CAN_MANAGE`: Can manage the query - // Wire name: 'permission_tier' PermissionTier PermissionLevel `json:"permission_tier,omitempty"` // URL slug. Usually mirrors the query name with dashes (`-`) instead of // spaces. Appears in the URL for this query. - // Wire name: 'slug' Slug string `json:"slug,omitempty"` - // Wire name: 'tags' Tags []string `json:"tags,omitempty"` // Timestamp when this dashboard was last updated. - // Wire name: 'updated_at' UpdatedAt string `json:"updated_at,omitempty"` - // Wire name: 'user' User *User `json:"user,omitempty"` // The ID of the user who owns the dashboard. - // Wire name: 'user_id' UserId int `json:"user_id,omitempty"` - // Wire name: 'widgets' Widgets []Widget `json:"widgets,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *Dashboard) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &dashboardPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := dashboardFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *Dashboard) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st Dashboard) MarshalJSON() ([]byte, error) { - pb, err := dashboardToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s Dashboard) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type DashboardEditContent struct { - DashboardId string `json:"-" tf:"-"` + DashboardId string `json:"-" url:"-"` // The title of this dashboard that appears in list views and at the top of // the dashboard page. - // Wire name: 'name' Name string `json:"name,omitempty"` // Sets the **Run as** role for the object. Must be set to one of `"viewer"` // (signifying "run as viewer" behavior) or `"owner"` (signifying "run as // owner" behavior) - // Wire name: 'run_as_role' RunAsRole RunAsRole `json:"run_as_role,omitempty"` - // Wire name: 'tags' Tags []string `json:"tags,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DashboardEditContent) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &dashboardEditContentPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := dashboardEditContentFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DashboardEditContent) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DashboardEditContent) MarshalJSON() ([]byte, error) { - pb, err := dashboardEditContentToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DashboardEditContent) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type DashboardOptions struct { // The timestamp when this dashboard was moved to trash. Only present when // the `is_archived` property is `true`. Trashed items are deleted after // thirty days. - // Wire name: 'moved_to_trash_at' MovedToTrashAt string `json:"moved_to_trash_at,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DashboardOptions) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &dashboardOptionsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := dashboardOptionsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DashboardOptions) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DashboardOptions) MarshalJSON() ([]byte, error) { - pb, err := dashboardOptionsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DashboardOptions) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type DashboardPostContent struct { // Indicates whether the dashboard filters are enabled - // Wire name: 'dashboard_filters_enabled' DashboardFiltersEnabled bool `json:"dashboard_filters_enabled,omitempty"` // Indicates whether this dashboard object should appear in the current // user's favorites list. - // Wire name: 'is_favorite' IsFavorite bool `json:"is_favorite,omitempty"` // The title of this dashboard that appears in list views and at the top of // the dashboard page. - // Wire name: 'name' Name string `json:"name"` // The identifier of the workspace folder containing the object. - // Wire name: 'parent' Parent string `json:"parent,omitempty"` // Sets the **Run as** role for the object. Must be set to one of `"viewer"` // (signifying "run as viewer" behavior) or `"owner"` (signifying "run as // owner" behavior) - // Wire name: 'run_as_role' RunAsRole RunAsRole `json:"run_as_role,omitempty"` - // Wire name: 'tags' Tags []string `json:"tags,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DashboardPostContent) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &dashboardPostContentPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := dashboardPostContentFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DashboardPostContent) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DashboardPostContent) MarshalJSON() ([]byte, error) { - pb, err := dashboardPostContentToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DashboardPostContent) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // A JSON object representing a DBSQL data source / SQL warehouse. @@ -2402,62 +1449,36 @@ type DataSource struct { // is distinct from the warehouse ID. [Learn more] // // [Learn more]: https://docs.databricks.com/api/workspace/datasources/list - // Wire name: 'id' Id string `json:"id,omitempty"` // The string name of this data source / SQL warehouse as it appears in the // Databricks SQL web application. - // Wire name: 'name' Name string `json:"name,omitempty"` // Reserved for internal use. - // Wire name: 'pause_reason' PauseReason string `json:"pause_reason,omitempty"` // Reserved for internal use. - // Wire name: 'paused' Paused int `json:"paused,omitempty"` // Reserved for internal use. - // Wire name: 'supports_auto_limit' SupportsAutoLimit bool `json:"supports_auto_limit,omitempty"` // Reserved for internal use. - // Wire name: 'syntax' Syntax string `json:"syntax,omitempty"` // The type of data source. For SQL warehouses, this will be // `databricks_internal`. - // Wire name: 'type' Type string `json:"type,omitempty"` // Reserved for internal use. - // Wire name: 'view_only' ViewOnly bool `json:"view_only,omitempty"` // The ID of the associated SQL warehouse, if this data source is backed by // a SQL warehouse. - // Wire name: 'warehouse_id' WarehouseId string `json:"warehouse_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DataSource) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &dataSourcePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := dataSourceFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DataSource) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DataSource) MarshalJSON() ([]byte, error) { - pb, err := dataSourceToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DataSource) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type DatePrecision string @@ -2501,80 +1522,31 @@ func (f *DatePrecision) Type() string { } type DateRange struct { - - // Wire name: 'end' End string `json:"end"` - // Wire name: 'start' Start string `json:"start"` } -func (st *DateRange) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &dateRangePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := dateRangeFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DateRange) MarshalJSON() ([]byte, error) { - pb, err := dateRangeToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type DateRangeValue struct { // Manually specified date-time range value. - // Wire name: 'date_range_value' DateRangeValue *DateRange `json:"date_range_value,omitempty"` // Dynamic date-time range value based on current date-time. - // Wire name: 'dynamic_date_range_value' DynamicDateRangeValue DateRangeValueDynamicDateRange `json:"dynamic_date_range_value,omitempty"` // Date-time precision to format the value into when the query is run. // Defaults to DAY_PRECISION (YYYY-MM-DD). - // Wire name: 'precision' Precision DatePrecision `json:"precision,omitempty"` - // Wire name: 'start_day_of_week' StartDayOfWeek int `json:"start_day_of_week,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DateRangeValue) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &dateRangeValuePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := dateRangeValueFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DateRangeValue) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DateRangeValue) MarshalJSON() ([]byte, error) { - pb, err := dateRangeValueToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DateRangeValue) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type DateRangeValueDynamicDateRange string @@ -2661,42 +1633,22 @@ func (f *DateRangeValueDynamicDateRange) Type() string { type DateValue struct { // Manually specified date-time value. - // Wire name: 'date_value' DateValue string `json:"date_value,omitempty"` // Dynamic date-time value based on current date-time. - // Wire name: 'dynamic_date_value' DynamicDateValue DateValueDynamicDate `json:"dynamic_date_value,omitempty"` // Date-time precision to format the value into when the query is run. // Defaults to DAY_PRECISION (YYYY-MM-DD). - // Wire name: 'precision' Precision DatePrecision `json:"precision,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DateValue) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &dateValuePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := dateValueFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DateValue) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DateValue) MarshalJSON() ([]byte, error) { - pb, err := dateValueToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DateValue) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type DateValueDynamicDate string @@ -2738,273 +1690,48 @@ func (f *DateValueDynamicDate) Type() string { // Delete an alert type DeleteAlertsLegacyRequest struct { - AlertId string `json:"-" tf:"-"` -} - -func (st *DeleteAlertsLegacyRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteAlertsLegacyRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteAlertsLegacyRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteAlertsLegacyRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteAlertsLegacyRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + AlertId string `json:"-" url:"-"` } // Remove a dashboard type DeleteDashboardRequest struct { - DashboardId string `json:"-" tf:"-"` -} - -func (st *DeleteDashboardRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteDashboardRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteDashboardRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteDashboardRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteDashboardRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + DashboardId string `json:"-" url:"-"` } // Remove widget type DeleteDashboardWidgetRequest struct { // Widget ID returned by :method:dashboardwidgets/create - Id string `json:"-" tf:"-"` + Id string `json:"-" url:"-"` } -func (st *DeleteDashboardWidgetRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteDashboardWidgetRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteDashboardWidgetRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +// Delete a query +type DeleteQueriesLegacyRequest struct { + QueryId string `json:"-" url:"-"` } -func (st DeleteDashboardWidgetRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteDashboardWidgetRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +// Remove visualization +type DeleteQueryVisualizationsLegacyRequest struct { + // Widget ID returned by :method:queryvizualisations/create + Id string `json:"-" url:"-"` } -// Delete a query -type DeleteQueriesLegacyRequest struct { - QueryId string `json:"-" tf:"-"` -} - -func (st *DeleteQueriesLegacyRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteQueriesLegacyRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteQueriesLegacyRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteQueriesLegacyRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteQueriesLegacyRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - -// Remove visualization -type DeleteQueryVisualizationsLegacyRequest struct { - // Widget ID returned by :method:queryvizualisations/create - Id string `json:"-" tf:"-"` -} - -func (st *DeleteQueryVisualizationsLegacyRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteQueryVisualizationsLegacyRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteQueryVisualizationsLegacyRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteQueryVisualizationsLegacyRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteQueryVisualizationsLegacyRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - -type DeleteResponse struct { -} - -func (st *DeleteResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +type DeleteResponse struct { } // Remove a visualization type DeleteVisualizationRequest struct { - Id string `json:"-" tf:"-"` -} - -func (st *DeleteVisualizationRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteVisualizationRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteVisualizationRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteVisualizationRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteVisualizationRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Id string `json:"-" url:"-"` } // Delete a warehouse type DeleteWarehouseRequest struct { // Required. Id of the SQL warehouse. - Id string `json:"-" tf:"-"` -} - -func (st *DeleteWarehouseRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteWarehouseRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteWarehouseRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteWarehouseRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteWarehouseRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Id string `json:"-" url:"-"` } type DeleteWarehouseResponse struct { } -func (st *DeleteWarehouseResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteWarehouseResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteWarehouseResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteWarehouseResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteWarehouseResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type Disposition string const DispositionExternalLinks Disposition = `EXTERNAL_LINKS` @@ -3043,48 +1770,27 @@ func (f *Disposition) Type() string { } type EditAlert struct { - AlertId string `json:"-" tf:"-"` + AlertId string `json:"-" url:"-"` // Name of the alert. - // Wire name: 'name' Name string `json:"name"` // Alert configuration options. - // Wire name: 'options' Options AlertOptions `json:"options"` // Query ID. - // Wire name: 'query_id' QueryId string `json:"query_id"` // Number of seconds after being triggered before the alert rearms itself // and can be triggered again. If `null`, alert will never be triggered // again. - // Wire name: 'rearm' Rearm int `json:"rearm,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *EditAlert) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &editAlertPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := editAlertFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *EditAlert) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st EditAlert) MarshalJSON() ([]byte, error) { - pb, err := editAlertToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s EditAlert) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type EditWarehouseRequest struct { @@ -3094,10 +1800,8 @@ type EditWarehouseRequest struct { // Supported values: - Must be == 0 or >= 10 mins - 0 indicates no autostop. // // Defaults to 120 mins - // Wire name: 'auto_stop_mins' AutoStopMins int `json:"auto_stop_mins,omitempty"` // Channel Details - // Wire name: 'channel' Channel *Channel `json:"channel,omitempty"` // Size of the clusters allocated for this warehouse. Increasing the size of // a spark cluster allows you to run larger queries on it. If you want to @@ -3105,23 +1809,18 @@ type EditWarehouseRequest struct { // // Supported values: - 2X-Small - X-Small - Small - Medium - Large - X-Large // - 2X-Large - 3X-Large - 4X-Large - // Wire name: 'cluster_size' ClusterSize string `json:"cluster_size,omitempty"` // warehouse creator name - // Wire name: 'creator_name' CreatorName string `json:"creator_name,omitempty"` // Configures whether the warehouse should use Photon optimized clusters. // // Defaults to false. - // Wire name: 'enable_photon' EnablePhoton bool `json:"enable_photon,omitempty"` // Configures whether the warehouse should use serverless compute. - // Wire name: 'enable_serverless_compute' EnableServerlessCompute bool `json:"enable_serverless_compute,omitempty"` // Required. Id of the warehouse to configure. - Id string `json:"-" tf:"-"` + Id string `json:"-" url:"-"` // Deprecated. Instance profile used to pass IAM role to the cluster - // Wire name: 'instance_profile_arn' InstanceProfileArn string `json:"instance_profile_arn,omitempty"` // Maximum number of clusters that the autoscaler will create to handle // concurrent queries. @@ -3129,7 +1828,6 @@ type EditWarehouseRequest struct { // Supported values: - Must be >= min_num_clusters - Must be <= 30. // // Defaults to min_clusters if unset. - // Wire name: 'max_num_clusters' MaxNumClusters int `json:"max_num_clusters,omitempty"` // Minimum number of available clusters that will be maintained for this SQL // warehouse. Increasing this will ensure that a larger number of clusters @@ -3140,55 +1838,33 @@ type EditWarehouseRequest struct { // Supported values: - Must be > 0 - Must be <= min(max_num_clusters, 30) // // Defaults to 1 - // Wire name: 'min_num_clusters' MinNumClusters int `json:"min_num_clusters,omitempty"` // Logical name for the cluster. // // Supported values: - Must be unique within an org. - Must be less than 100 // characters. - // Wire name: 'name' Name string `json:"name,omitempty"` // Configurations whether the warehouse should use spot instances. - // Wire name: 'spot_instance_policy' SpotInstancePolicy SpotInstancePolicy `json:"spot_instance_policy,omitempty"` // A set of key-value pairs that will be tagged on all resources (e.g., AWS // instances and EBS volumes) associated with this SQL warehouse. // // Supported values: - Number of tags < 45. - // Wire name: 'tags' Tags *EndpointTags `json:"tags,omitempty"` // Warehouse type: `PRO` or `CLASSIC`. If you want to use serverless // compute, you must set to `PRO` and also set the field // `enable_serverless_compute` to `true`. - // Wire name: 'warehouse_type' WarehouseType EditWarehouseRequestWarehouseType `json:"warehouse_type,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *EditWarehouseRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &editWarehouseRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := editWarehouseRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *EditWarehouseRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st EditWarehouseRequest) MarshalJSON() ([]byte, error) { - pb, err := editWarehouseRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s EditWarehouseRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Warehouse type: `PRO` or `CLASSIC`. If you want to use serverless compute, @@ -3237,142 +1913,50 @@ func (f *EditWarehouseRequestWarehouseType) Type() string { type EditWarehouseResponse struct { } -func (st *EditWarehouseResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &editWarehouseResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := editWarehouseResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st EditWarehouseResponse) MarshalJSON() ([]byte, error) { - pb, err := editWarehouseResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Represents an empty message, similar to google.protobuf.Empty, which is not // available in the firm right now. type Empty struct { } -func (st *Empty) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &emptyPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := emptyFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st Empty) MarshalJSON() ([]byte, error) { - pb, err := emptyToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type EndpointConfPair struct { - - // Wire name: 'key' Key string `json:"key,omitempty"` - // Wire name: 'value' Value string `json:"value,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *EndpointConfPair) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &endpointConfPairPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := endpointConfPairFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *EndpointConfPair) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st EndpointConfPair) MarshalJSON() ([]byte, error) { - pb, err := endpointConfPairToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s EndpointConfPair) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type EndpointHealth struct { // Details about errors that are causing current degraded/failed status. - // Wire name: 'details' Details string `json:"details,omitempty"` // The reason for failure to bring up clusters for this warehouse. This is // available when status is 'FAILED' and sometimes when it is DEGRADED. - // Wire name: 'failure_reason' FailureReason *TerminationReason `json:"failure_reason,omitempty"` // Deprecated. split into summary and details for security - // Wire name: 'message' Message string `json:"message,omitempty"` // Health status of the warehouse. - // Wire name: 'status' Status Status `json:"status,omitempty"` // A short summary of the health status in case of degraded/failed // warehouses. - // Wire name: 'summary' Summary string `json:"summary,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *EndpointHealth) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &endpointHealthPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := endpointHealthFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *EndpointHealth) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st EndpointHealth) MarshalJSON() ([]byte, error) { - pb, err := endpointHealthToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s EndpointHealth) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type EndpointInfo struct { @@ -3382,10 +1966,8 @@ type EndpointInfo struct { // Supported values: - Must be == 0 or >= 10 mins - 0 indicates no autostop. // // Defaults to 120 mins - // Wire name: 'auto_stop_mins' AutoStopMins int `json:"auto_stop_mins,omitempty"` // Channel Details - // Wire name: 'channel' Channel *Channel `json:"channel,omitempty"` // Size of the clusters allocated for this warehouse. Increasing the size of // a spark cluster allows you to run larger queries on it. If you want to @@ -3393,31 +1975,23 @@ type EndpointInfo struct { // // Supported values: - 2X-Small - X-Small - Small - Medium - Large - X-Large // - 2X-Large - 3X-Large - 4X-Large - // Wire name: 'cluster_size' ClusterSize string `json:"cluster_size,omitempty"` // warehouse creator name - // Wire name: 'creator_name' CreatorName string `json:"creator_name,omitempty"` // Configures whether the warehouse should use Photon optimized clusters. // // Defaults to false. - // Wire name: 'enable_photon' EnablePhoton bool `json:"enable_photon,omitempty"` // Configures whether the warehouse should use serverless compute - // Wire name: 'enable_serverless_compute' EnableServerlessCompute bool `json:"enable_serverless_compute,omitempty"` // Optional health status. Assume the warehouse is healthy if this field is // not set. - // Wire name: 'health' Health *EndpointHealth `json:"health,omitempty"` // unique identifier for warehouse - // Wire name: 'id' Id string `json:"id,omitempty"` // Deprecated. Instance profile used to pass IAM role to the cluster - // Wire name: 'instance_profile_arn' InstanceProfileArn string `json:"instance_profile_arn,omitempty"` // the jdbc connection string for this warehouse - // Wire name: 'jdbc_url' JdbcUrl string `json:"jdbc_url,omitempty"` // Maximum number of clusters that the autoscaler will create to handle // concurrent queries. @@ -3425,7 +1999,6 @@ type EndpointInfo struct { // Supported values: - Must be >= min_num_clusters - Must be <= 30. // // Defaults to min_clusters if unset. - // Wire name: 'max_num_clusters' MaxNumClusters int `json:"max_num_clusters,omitempty"` // Minimum number of available clusters that will be maintained for this SQL // warehouse. Increasing this will ensure that a larger number of clusters @@ -3436,67 +2009,41 @@ type EndpointInfo struct { // Supported values: - Must be > 0 - Must be <= min(max_num_clusters, 30) // // Defaults to 1 - // Wire name: 'min_num_clusters' MinNumClusters int `json:"min_num_clusters,omitempty"` // Logical name for the cluster. // // Supported values: - Must be unique within an org. - Must be less than 100 // characters. - // Wire name: 'name' Name string `json:"name,omitempty"` // Deprecated. current number of active sessions for the warehouse - // Wire name: 'num_active_sessions' NumActiveSessions int64 `json:"num_active_sessions,omitempty"` // current number of clusters running for the service - // Wire name: 'num_clusters' NumClusters int `json:"num_clusters,omitempty"` // ODBC parameters for the SQL warehouse - // Wire name: 'odbc_params' OdbcParams *OdbcParams `json:"odbc_params,omitempty"` // Configurations whether the warehouse should use spot instances. - // Wire name: 'spot_instance_policy' SpotInstancePolicy SpotInstancePolicy `json:"spot_instance_policy,omitempty"` // State of the warehouse - // Wire name: 'state' State State `json:"state,omitempty"` // A set of key-value pairs that will be tagged on all resources (e.g., AWS // instances and EBS volumes) associated with this SQL warehouse. // // Supported values: - Number of tags < 45. - // Wire name: 'tags' Tags *EndpointTags `json:"tags,omitempty"` // Warehouse type: `PRO` or `CLASSIC`. If you want to use serverless // compute, you must set to `PRO` and also set the field // `enable_serverless_compute` to `true`. - // Wire name: 'warehouse_type' WarehouseType EndpointInfoWarehouseType `json:"warehouse_type,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *EndpointInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &endpointInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := endpointInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *EndpointInfo) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st EndpointInfo) MarshalJSON() ([]byte, error) { - pb, err := endpointInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s EndpointInfo) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Warehouse type: `PRO` or `CLASSIC`. If you want to use serverless compute, @@ -3543,109 +2090,42 @@ func (f *EndpointInfoWarehouseType) Type() string { } type EndpointTagPair struct { - - // Wire name: 'key' Key string `json:"key,omitempty"` - // Wire name: 'value' Value string `json:"value,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *EndpointTagPair) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &endpointTagPairPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := endpointTagPairFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *EndpointTagPair) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st EndpointTagPair) MarshalJSON() ([]byte, error) { - pb, err := endpointTagPairToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s EndpointTagPair) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type EndpointTags struct { - - // Wire name: 'custom_tags' CustomTags []EndpointTagPair `json:"custom_tags,omitempty"` } -func (st *EndpointTags) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &endpointTagsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := endpointTagsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st EndpointTags) MarshalJSON() ([]byte, error) { - pb, err := endpointTagsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type EnumValue struct { // List of valid query parameter values, newline delimited. - // Wire name: 'enum_options' EnumOptions string `json:"enum_options,omitempty"` // If specified, allows multiple values to be selected for this parameter. - // Wire name: 'multi_values_options' MultiValuesOptions *MultiValuesOptions `json:"multi_values_options,omitempty"` // List of selected query parameter values. - // Wire name: 'values' Values []string `json:"values,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *EnumValue) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &enumValuePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := enumValueFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *EnumValue) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st EnumValue) MarshalJSON() ([]byte, error) { - pb, err := enumValueToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s EnumValue) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ExecuteStatementRequest struct { @@ -3655,16 +2135,13 @@ type ExecuteStatementRequest struct { // byte limit, then `truncated` in the response is set to `true`. When using // `EXTERNAL_LINKS` disposition, a default `byte_limit` of 100 GiB is // applied if `byte_limit` is not explcitly set. - // Wire name: 'byte_limit' ByteLimit int64 `json:"byte_limit,omitempty"` // Sets default catalog for statement execution, similar to [`USE CATALOG`] // in SQL. // // [`USE CATALOG`]: https://docs.databricks.com/sql/language-manual/sql-ref-syntax-ddl-use-catalog.html - // Wire name: 'catalog' Catalog string `json:"catalog,omitempty"` - // Wire name: 'disposition' Disposition Disposition `json:"disposition,omitempty"` // Statement execution supports three result formats: `JSON_ARRAY` // (default), `ARROW_STREAM`, and `CSV`. @@ -3702,7 +2179,6 @@ type ExecuteStatementRequest struct { // // [Apache Arrow streaming format]: https://arrow.apache.org/docs/format/Columnar.html#ipc-streaming-format // [RFC 4180]: https://www.rfc-editor.org/rfc/rfc4180 - // Wire name: 'format' Format Format `json:"format,omitempty"` // When `wait_timeout > 0s`, the call will block up to the specified time. // If the statement execution doesn't finish within this time, @@ -3712,7 +2188,6 @@ type ExecuteStatementRequest struct { // polling with :method:statementexecution/getStatement. When set to // `CANCEL`, the statement execution is canceled and the call returns with a // `CANCELED` state. - // Wire name: 'on_wait_timeout' OnWaitTimeout ExecuteStatementRequestOnWaitTimeout `json:"on_wait_timeout,omitempty"` // A list of parameters to pass into a SQL statement containing parameter // markers. A parameter consists of a name, a value, and optionally a type. @@ -3744,22 +2219,18 @@ type ExecuteStatementRequest struct { // // [Parameter markers]: https://docs.databricks.com/sql/language-manual/sql-ref-parameter-marker.html // [`cast` function]: https://docs.databricks.com/sql/language-manual/functions/cast.html - // Wire name: 'parameters' Parameters []StatementParameterListItem `json:"parameters,omitempty"` // Applies the given row limit to the statement's result set, but unlike the // `LIMIT` clause in SQL, it also sets the `truncated` field in the response // to indicate whether the result was trimmed due to the limit or not. - // Wire name: 'row_limit' RowLimit int64 `json:"row_limit,omitempty"` // Sets default schema for statement execution, similar to [`USE SCHEMA`] in // SQL. // // [`USE SCHEMA`]: https://docs.databricks.com/sql/language-manual/sql-ref-syntax-ddl-use-schema.html - // Wire name: 'schema' Schema string `json:"schema,omitempty"` // The SQL statement to execute. The statement can optionally be // parameterized, see `parameters`. The maximum query text size is 16 MiB. - // Wire name: 'statement' Statement string `json:"statement"` // The time in seconds the call will wait for the statement's result set as // `Ns`, where `N` can be set to 0 or to a value between 5 and 50. @@ -3775,41 +2246,22 @@ type ExecuteStatementRequest struct { // manifest and result data (or a `FAILED` state in case of an execution // error). If the statement takes longer to execute, `on_wait_timeout` // determines what should happen after the timeout is reached. - // Wire name: 'wait_timeout' WaitTimeout string `json:"wait_timeout,omitempty"` // Warehouse upon which to execute a statement. See also [What are SQL // warehouses?] // // [What are SQL warehouses?]: https://docs.databricks.com/sql/admin/warehouse-type.html - // Wire name: 'warehouse_id' WarehouseId string `json:"warehouse_id"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ExecuteStatementRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &executeStatementRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := executeStatementRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ExecuteStatementRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ExecuteStatementRequest) MarshalJSON() ([]byte, error) { - pb, err := executeStatementRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ExecuteStatementRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // When `wait_timeout > 0s`, the call will block up to the specified time. If @@ -3859,161 +2311,91 @@ func (f *ExecuteStatementRequestOnWaitTimeout) Type() string { type ExternalLink struct { // The number of bytes in the result chunk. This field is not available when // using `INLINE` disposition. - // Wire name: 'byte_count' ByteCount int64 `json:"byte_count,omitempty"` // The position within the sequence of result set chunks. - // Wire name: 'chunk_index' ChunkIndex int `json:"chunk_index,omitempty"` // Indicates the date-time that the given external link will expire and // becomes invalid, after which point a new `external_link` must be // requested. - // Wire name: 'expiration' Expiration string `json:"expiration,omitempty"` - // Wire name: 'external_link' ExternalLink string `json:"external_link,omitempty"` // HTTP headers that must be included with a GET request to the // `external_link`. Each header is provided as a key-value pair. Headers are // typically used to pass a decryption key to the external service. The // values of these headers should be considered sensitive and the client // should not expose these values in a log. - // Wire name: 'http_headers' HttpHeaders map[string]string `json:"http_headers,omitempty"` // When fetching, provides the `chunk_index` for the _next_ chunk. If // absent, indicates there are no more chunks. The next chunk can be fetched // with a :method:statementexecution/getStatementResultChunkN request. - // Wire name: 'next_chunk_index' NextChunkIndex int `json:"next_chunk_index,omitempty"` // When fetching, provides a link to fetch the _next_ chunk. If absent, // indicates there are no more chunks. This link is an absolute `path` to be // joined with your `$DATABRICKS_HOST`, and should be treated as an opaque // link. This is an alternative to using `next_chunk_index`. - // Wire name: 'next_chunk_internal_link' NextChunkInternalLink string `json:"next_chunk_internal_link,omitempty"` // The number of rows within the result chunk. - // Wire name: 'row_count' RowCount int64 `json:"row_count,omitempty"` // The starting row offset within the result set. - // Wire name: 'row_offset' RowOffset int64 `json:"row_offset,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ExternalLink) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &externalLinkPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := externalLinkFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ExternalLink) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ExternalLink) MarshalJSON() ([]byte, error) { - pb, err := externalLinkToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ExternalLink) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ExternalQuerySource struct { // The canonical identifier for this SQL alert - // Wire name: 'alert_id' AlertId string `json:"alert_id,omitempty"` // The canonical identifier for this Lakeview dashboard - // Wire name: 'dashboard_id' DashboardId string `json:"dashboard_id,omitempty"` // The canonical identifier for this Genie space - // Wire name: 'genie_space_id' GenieSpaceId string `json:"genie_space_id,omitempty"` - // Wire name: 'job_info' JobInfo *ExternalQuerySourceJobInfo `json:"job_info,omitempty"` // The canonical identifier for this legacy dashboard - // Wire name: 'legacy_dashboard_id' LegacyDashboardId string `json:"legacy_dashboard_id,omitempty"` // The canonical identifier for this notebook - // Wire name: 'notebook_id' NotebookId string `json:"notebook_id,omitempty"` // The canonical identifier for this SQL query - // Wire name: 'sql_query_id' SqlQueryId string `json:"sql_query_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ExternalQuerySource) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &externalQuerySourcePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := externalQuerySourceFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ExternalQuerySource) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ExternalQuerySource) MarshalJSON() ([]byte, error) { - pb, err := externalQuerySourceToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ExternalQuerySource) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ExternalQuerySourceJobInfo struct { // The canonical identifier for this job. - // Wire name: 'job_id' JobId string `json:"job_id,omitempty"` // The canonical identifier of the run. This ID is unique across all runs of // all jobs. - // Wire name: 'job_run_id' JobRunId string `json:"job_run_id,omitempty"` // The canonical identifier of the task run. - // Wire name: 'job_task_run_id' JobTaskRunId string `json:"job_task_run_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ExternalQuerySourceJobInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &externalQuerySourceJobInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := externalQuerySourceJobInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ExternalQuerySourceJobInfo) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ExternalQuerySourceJobInfo) MarshalJSON() ([]byte, error) { - pb, err := externalQuerySourceJobInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ExternalQuerySourceJobInfo) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type Format string @@ -4058,443 +2440,96 @@ func (f *Format) Type() string { // Get an alert type GetAlertRequest struct { - Id string `json:"-" tf:"-"` -} - -func (st *GetAlertRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getAlertRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getAlertRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetAlertRequest) MarshalJSON() ([]byte, error) { - pb, err := getAlertRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Id string `json:"-" url:"-"` } // Get an alert type GetAlertV2Request struct { - Id string `json:"-" tf:"-"` -} - -func (st *GetAlertV2Request) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getAlertV2RequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getAlertV2RequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetAlertV2Request) MarshalJSON() ([]byte, error) { - pb, err := getAlertV2RequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Id string `json:"-" url:"-"` } // Get an alert type GetAlertsLegacyRequest struct { - AlertId string `json:"-" tf:"-"` -} - -func (st *GetAlertsLegacyRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getAlertsLegacyRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getAlertsLegacyRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetAlertsLegacyRequest) MarshalJSON() ([]byte, error) { - pb, err := getAlertsLegacyRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + AlertId string `json:"-" url:"-"` } // Retrieve a definition type GetDashboardRequest struct { - DashboardId string `json:"-" tf:"-"` -} - -func (st *GetDashboardRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getDashboardRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getDashboardRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetDashboardRequest) MarshalJSON() ([]byte, error) { - pb, err := getDashboardRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + DashboardId string `json:"-" url:"-"` } // Get object ACL type GetDbsqlPermissionRequest struct { // Object ID. An ACL is returned for the object with this UUID. - ObjectId string `json:"-" tf:"-"` + ObjectId string `json:"-" url:"-"` // The type of object permissions to check. - ObjectType ObjectTypePlural `json:"-" tf:"-"` -} - -func (st *GetDbsqlPermissionRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getDbsqlPermissionRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getDbsqlPermissionRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetDbsqlPermissionRequest) MarshalJSON() ([]byte, error) { - pb, err := getDbsqlPermissionRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + ObjectType ObjectTypePlural `json:"-" url:"-"` } // Get a query definition. type GetQueriesLegacyRequest struct { - QueryId string `json:"-" tf:"-"` -} - -func (st *GetQueriesLegacyRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getQueriesLegacyRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getQueriesLegacyRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetQueriesLegacyRequest) MarshalJSON() ([]byte, error) { - pb, err := getQueriesLegacyRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + QueryId string `json:"-" url:"-"` } // Get a query type GetQueryRequest struct { - Id string `json:"-" tf:"-"` -} - -func (st *GetQueryRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getQueryRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getQueryRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetQueryRequest) MarshalJSON() ([]byte, error) { - pb, err := getQueryRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Id string `json:"-" url:"-"` } type GetResponse struct { - - // Wire name: 'access_control_list' AccessControlList []AccessControl `json:"access_control_list,omitempty"` // An object's type and UUID, separated by a forward slash (/) character. - // Wire name: 'object_id' ObjectId string `json:"object_id,omitempty"` // A singular noun object type. - // Wire name: 'object_type' ObjectType ObjectType `json:"object_type,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetResponse) MarshalJSON() ([]byte, error) { - pb, err := getResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get status, manifest, and result first chunk type GetStatementRequest struct { // The statement ID is returned upon successfully submitting a SQL // statement, and is a required reference for all subsequent calls. - StatementId string `json:"-" tf:"-"` -} - -func (st *GetStatementRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getStatementRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getStatementRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetStatementRequest) MarshalJSON() ([]byte, error) { - pb, err := getStatementRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + StatementId string `json:"-" url:"-"` } // Get result chunk by index type GetStatementResultChunkNRequest struct { - ChunkIndex int `json:"-" tf:"-"` + ChunkIndex int `json:"-" url:"-"` // The statement ID is returned upon successfully submitting a SQL // statement, and is a required reference for all subsequent calls. - StatementId string `json:"-" tf:"-"` -} - -func (st *GetStatementResultChunkNRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getStatementResultChunkNRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getStatementResultChunkNRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetStatementResultChunkNRequest) MarshalJSON() ([]byte, error) { - pb, err := getStatementResultChunkNRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + StatementId string `json:"-" url:"-"` } // Get SQL warehouse permission levels type GetWarehousePermissionLevelsRequest struct { // The SQL warehouse for which to get or manage permissions. - WarehouseId string `json:"-" tf:"-"` -} - -func (st *GetWarehousePermissionLevelsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getWarehousePermissionLevelsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getWarehousePermissionLevelsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetWarehousePermissionLevelsRequest) MarshalJSON() ([]byte, error) { - pb, err := getWarehousePermissionLevelsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + WarehouseId string `json:"-" url:"-"` } type GetWarehousePermissionLevelsResponse struct { // Specific permission levels - // Wire name: 'permission_levels' PermissionLevels []WarehousePermissionsDescription `json:"permission_levels,omitempty"` } -func (st *GetWarehousePermissionLevelsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getWarehousePermissionLevelsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getWarehousePermissionLevelsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetWarehousePermissionLevelsResponse) MarshalJSON() ([]byte, error) { - pb, err := getWarehousePermissionLevelsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Get SQL warehouse permissions type GetWarehousePermissionsRequest struct { // The SQL warehouse for which to get or manage permissions. - WarehouseId string `json:"-" tf:"-"` -} - -func (st *GetWarehousePermissionsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getWarehousePermissionsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getWarehousePermissionsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetWarehousePermissionsRequest) MarshalJSON() ([]byte, error) { - pb, err := getWarehousePermissionsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + WarehouseId string `json:"-" url:"-"` } // Get warehouse info type GetWarehouseRequest struct { // Required. Id of the SQL warehouse. - Id string `json:"-" tf:"-"` -} - -func (st *GetWarehouseRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getWarehouseRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getWarehouseRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetWarehouseRequest) MarshalJSON() ([]byte, error) { - pb, err := getWarehouseRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Id string `json:"-" url:"-"` } type GetWarehouseResponse struct { @@ -4504,10 +2539,8 @@ type GetWarehouseResponse struct { // Supported values: - Must be == 0 or >= 10 mins - 0 indicates no autostop. // // Defaults to 120 mins - // Wire name: 'auto_stop_mins' AutoStopMins int `json:"auto_stop_mins,omitempty"` // Channel Details - // Wire name: 'channel' Channel *Channel `json:"channel,omitempty"` // Size of the clusters allocated for this warehouse. Increasing the size of // a spark cluster allows you to run larger queries on it. If you want to @@ -4515,31 +2548,23 @@ type GetWarehouseResponse struct { // // Supported values: - 2X-Small - X-Small - Small - Medium - Large - X-Large // - 2X-Large - 3X-Large - 4X-Large - // Wire name: 'cluster_size' ClusterSize string `json:"cluster_size,omitempty"` // warehouse creator name - // Wire name: 'creator_name' CreatorName string `json:"creator_name,omitempty"` // Configures whether the warehouse should use Photon optimized clusters. // // Defaults to false. - // Wire name: 'enable_photon' EnablePhoton bool `json:"enable_photon,omitempty"` // Configures whether the warehouse should use serverless compute - // Wire name: 'enable_serverless_compute' EnableServerlessCompute bool `json:"enable_serverless_compute,omitempty"` // Optional health status. Assume the warehouse is healthy if this field is // not set. - // Wire name: 'health' Health *EndpointHealth `json:"health,omitempty"` // unique identifier for warehouse - // Wire name: 'id' Id string `json:"id,omitempty"` // Deprecated. Instance profile used to pass IAM role to the cluster - // Wire name: 'instance_profile_arn' InstanceProfileArn string `json:"instance_profile_arn,omitempty"` // the jdbc connection string for this warehouse - // Wire name: 'jdbc_url' JdbcUrl string `json:"jdbc_url,omitempty"` // Maximum number of clusters that the autoscaler will create to handle // concurrent queries. @@ -4547,7 +2572,6 @@ type GetWarehouseResponse struct { // Supported values: - Must be >= min_num_clusters - Must be <= 30. // // Defaults to min_clusters if unset. - // Wire name: 'max_num_clusters' MaxNumClusters int `json:"max_num_clusters,omitempty"` // Minimum number of available clusters that will be maintained for this SQL // warehouse. Increasing this will ensure that a larger number of clusters @@ -4558,67 +2582,41 @@ type GetWarehouseResponse struct { // Supported values: - Must be > 0 - Must be <= min(max_num_clusters, 30) // // Defaults to 1 - // Wire name: 'min_num_clusters' MinNumClusters int `json:"min_num_clusters,omitempty"` // Logical name for the cluster. // // Supported values: - Must be unique within an org. - Must be less than 100 // characters. - // Wire name: 'name' Name string `json:"name,omitempty"` // Deprecated. current number of active sessions for the warehouse - // Wire name: 'num_active_sessions' NumActiveSessions int64 `json:"num_active_sessions,omitempty"` // current number of clusters running for the service - // Wire name: 'num_clusters' NumClusters int `json:"num_clusters,omitempty"` // ODBC parameters for the SQL warehouse - // Wire name: 'odbc_params' OdbcParams *OdbcParams `json:"odbc_params,omitempty"` // Configurations whether the warehouse should use spot instances. - // Wire name: 'spot_instance_policy' SpotInstancePolicy SpotInstancePolicy `json:"spot_instance_policy,omitempty"` // State of the warehouse - // Wire name: 'state' State State `json:"state,omitempty"` // A set of key-value pairs that will be tagged on all resources (e.g., AWS // instances and EBS volumes) associated with this SQL warehouse. // // Supported values: - Number of tags < 45. - // Wire name: 'tags' Tags *EndpointTags `json:"tags,omitempty"` // Warehouse type: `PRO` or `CLASSIC`. If you want to use serverless // compute, you must set to `PRO` and also set the field // `enable_serverless_compute` to `true`. - // Wire name: 'warehouse_type' WarehouseType GetWarehouseResponseWarehouseType `json:"warehouse_type,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetWarehouseResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getWarehouseResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getWarehouseResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetWarehouseResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetWarehouseResponse) MarshalJSON() ([]byte, error) { - pb, err := getWarehouseResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetWarehouseResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Warehouse type: `PRO` or `CLASSIC`. If you want to use serverless compute, @@ -4666,14 +2664,11 @@ func (f *GetWarehouseResponseWarehouseType) Type() string { type GetWorkspaceWarehouseConfigResponse struct { // Optional: Channel selection details - // Wire name: 'channel' Channel *Channel `json:"channel,omitempty"` // Deprecated: Use sql_configuration_parameters - // Wire name: 'config_param' ConfigParam *RepeatedEndpointConfPairs `json:"config_param,omitempty"` // Spark confs for external hive metastore configuration JSON serialized // size must be less than <= 512K - // Wire name: 'data_access_config' DataAccessConfig []EndpointConfPair `json:"data_access_config,omitempty"` // List of Warehouse Types allowed in this workspace (limits allowed value // of the type field in CreateWarehouse and EditWarehouse). Note: Some types @@ -4681,51 +2676,28 @@ type GetWorkspaceWarehouseConfigResponse struct { // SetWorkspaceWarehouseConfig. Note: Disabling a type may cause existing // warehouses to be converted to another type. Used by frontend to save // specific type availability in the warehouse create and edit form UI. - // Wire name: 'enabled_warehouse_types' EnabledWarehouseTypes []WarehouseTypePair `json:"enabled_warehouse_types,omitempty"` // Deprecated: Use sql_configuration_parameters - // Wire name: 'global_param' GlobalParam *RepeatedEndpointConfPairs `json:"global_param,omitempty"` // GCP only: Google Service Account used to pass to cluster to access Google // Cloud Storage - // Wire name: 'google_service_account' GoogleServiceAccount string `json:"google_service_account,omitempty"` // AWS Only: Instance profile used to pass IAM role to the cluster - // Wire name: 'instance_profile_arn' InstanceProfileArn string `json:"instance_profile_arn,omitempty"` // Security policy for warehouses - // Wire name: 'security_policy' SecurityPolicy GetWorkspaceWarehouseConfigResponseSecurityPolicy `json:"security_policy,omitempty"` // SQL configuration parameters - // Wire name: 'sql_configuration_parameters' SqlConfigurationParameters *RepeatedEndpointConfPairs `json:"sql_configuration_parameters,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetWorkspaceWarehouseConfigResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getWorkspaceWarehouseConfigResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getWorkspaceWarehouseConfigResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetWorkspaceWarehouseConfigResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetWorkspaceWarehouseConfigResponse) MarshalJSON() ([]byte, error) { - pb, err := getWorkspaceWarehouseConfigResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetWorkspaceWarehouseConfigResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Security policy for warehouses @@ -4771,69 +2743,41 @@ func (f *GetWorkspaceWarehouseConfigResponseSecurityPolicy) Type() string { type LegacyAlert struct { // Timestamp when the alert was created. - // Wire name: 'created_at' CreatedAt string `json:"created_at,omitempty"` // Alert ID. - // Wire name: 'id' Id string `json:"id,omitempty"` // Timestamp when the alert was last triggered. - // Wire name: 'last_triggered_at' LastTriggeredAt string `json:"last_triggered_at,omitempty"` // Name of the alert. - // Wire name: 'name' Name string `json:"name,omitempty"` // Alert configuration options. - // Wire name: 'options' Options *AlertOptions `json:"options,omitempty"` // The identifier of the workspace folder containing the object. - // Wire name: 'parent' Parent string `json:"parent,omitempty"` - // Wire name: 'query' Query *AlertQuery `json:"query,omitempty"` // Number of seconds after being triggered before the alert rearms itself // and can be triggered again. If `null`, alert will never be triggered // again. - // Wire name: 'rearm' Rearm int `json:"rearm,omitempty"` // State of the alert. Possible values are: `unknown` (yet to be evaluated), // `triggered` (evaluated and fulfilled trigger conditions), or `ok` // (evaluated and did not fulfill trigger conditions). - // Wire name: 'state' State LegacyAlertState `json:"state,omitempty"` // Timestamp when the alert was last updated. - // Wire name: 'updated_at' UpdatedAt string `json:"updated_at,omitempty"` - // Wire name: 'user' User *User `json:"user,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *LegacyAlert) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &legacyAlertPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := legacyAlertFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *LegacyAlert) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st LegacyAlert) MarshalJSON() ([]byte, error) { - pb, err := legacyAlertToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s LegacyAlert) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // State of the alert. Possible values are: `unknown` (yet to be evaluated), @@ -4882,123 +2826,82 @@ func (f *LegacyAlertState) Type() string { type LegacyQuery struct { // Describes whether the authenticated user is allowed to edit the // definition of this query. - // Wire name: 'can_edit' CanEdit bool `json:"can_edit,omitempty"` // The timestamp when this query was created. - // Wire name: 'created_at' CreatedAt string `json:"created_at,omitempty"` // Data source ID maps to the ID of the data source used by the resource and // is distinct from the warehouse ID. [Learn more] // // [Learn more]: https://docs.databricks.com/api/workspace/datasources/list - // Wire name: 'data_source_id' DataSourceId string `json:"data_source_id,omitempty"` // General description that conveys additional information about this query // such as usage notes. - // Wire name: 'description' Description string `json:"description,omitempty"` // Query ID. - // Wire name: 'id' Id string `json:"id,omitempty"` // Indicates whether the query is trashed. Trashed queries can't be used in // dashboards, or appear in search results. If this boolean is `true`, the // `options` property for this query includes a `moved_to_trash_at` // timestamp. Trashed queries are permanently deleted after 30 days. - // Wire name: 'is_archived' IsArchived bool `json:"is_archived,omitempty"` // Whether the query is a draft. Draft queries only appear in list views for // their owners. Visualizations from draft queries cannot appear on // dashboards. - // Wire name: 'is_draft' IsDraft bool `json:"is_draft,omitempty"` // Whether this query object appears in the current user's favorites list. // This flag determines whether the star icon for favorites is selected. - // Wire name: 'is_favorite' IsFavorite bool `json:"is_favorite,omitempty"` // Text parameter types are not safe from SQL injection for all types of // data source. Set this Boolean parameter to `true` if a query either does // not use any text type parameters or uses a data source type where text // type parameters are handled safely. - // Wire name: 'is_safe' IsSafe bool `json:"is_safe,omitempty"` - // Wire name: 'last_modified_by' LastModifiedBy *User `json:"last_modified_by,omitempty"` // The ID of the user who last saved changes to this query. - // Wire name: 'last_modified_by_id' LastModifiedById int `json:"last_modified_by_id,omitempty"` // If there is a cached result for this query and user, this field includes // the query result ID. If this query uses parameters, this field is always // null. - // Wire name: 'latest_query_data_id' LatestQueryDataId string `json:"latest_query_data_id,omitempty"` // The title of this query that appears in list views, widget headings, and // on the query page. - // Wire name: 'name' Name string `json:"name,omitempty"` - // Wire name: 'options' Options *QueryOptions `json:"options,omitempty"` // The identifier of the workspace folder containing the object. - // Wire name: 'parent' Parent string `json:"parent,omitempty"` // * `CAN_VIEW`: Can view the query * `CAN_RUN`: Can run the query * // `CAN_EDIT`: Can edit the query * `CAN_MANAGE`: Can manage the query - // Wire name: 'permission_tier' PermissionTier PermissionLevel `json:"permission_tier,omitempty"` // The text of the query to be run. - // Wire name: 'query' Query string `json:"query,omitempty"` // A SHA-256 hash of the query text along with the authenticated user ID. - // Wire name: 'query_hash' QueryHash string `json:"query_hash,omitempty"` // Sets the **Run as** role for the object. Must be set to one of `"viewer"` // (signifying "run as viewer" behavior) or `"owner"` (signifying "run as // owner" behavior) - // Wire name: 'run_as_role' RunAsRole RunAsRole `json:"run_as_role,omitempty"` - // Wire name: 'tags' Tags []string `json:"tags,omitempty"` // The timestamp at which this query was last updated. - // Wire name: 'updated_at' UpdatedAt string `json:"updated_at,omitempty"` - // Wire name: 'user' User *User `json:"user,omitempty"` // The ID of the user who owns the query. - // Wire name: 'user_id' UserId int `json:"user_id,omitempty"` - // Wire name: 'visualizations' Visualizations []LegacyVisualization `json:"visualizations,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *LegacyQuery) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &legacyQueryPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := legacyQueryFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *LegacyQuery) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st LegacyQuery) MarshalJSON() ([]byte, error) { - pb, err := legacyQueryToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s LegacyQuery) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The visualization description API changes frequently and is unsupported. You @@ -5007,61 +2910,35 @@ func (st LegacyQuery) MarshalJSON() ([]byte, error) { // same endpoint. Databricks does not recommend constructing ad-hoc // visualizations entirely in JSON. type LegacyVisualization struct { - - // Wire name: 'created_at' CreatedAt string `json:"created_at,omitempty"` // A short description of this visualization. This is not displayed in the // UI. - // Wire name: 'description' Description string `json:"description,omitempty"` // The UUID for this visualization. - // Wire name: 'id' Id string `json:"id,omitempty"` // The name of the visualization that appears on dashboards and the query // screen. - // Wire name: 'name' Name string `json:"name,omitempty"` // The options object varies widely from one visualization type to the next // and is unsupported. Databricks does not recommend modifying visualization // settings in JSON. - // Wire name: 'options' Options any `json:"options,omitempty"` - // Wire name: 'query' Query *LegacyQuery `json:"query,omitempty"` // The type of visualization: chart, table, pivot table, and so on. - // Wire name: 'type' Type string `json:"type,omitempty"` - // Wire name: 'updated_at' UpdatedAt string `json:"updated_at,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *LegacyVisualization) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &legacyVisualizationPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := legacyVisualizationFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *LegacyVisualization) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st LegacyVisualization) MarshalJSON() ([]byte, error) { - pb, err := legacyVisualizationToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s LegacyVisualization) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type LifecycleState string @@ -5103,266 +2980,144 @@ func (f *LifecycleState) Type() string { // List alerts type ListAlertsRequest struct { - PageSize int `json:"-" tf:"-"` + PageSize int `json:"-" url:"page_size,omitempty"` - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListAlertsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listAlertsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listAlertsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListAlertsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListAlertsRequest) MarshalJSON() ([]byte, error) { - pb, err := listAlertsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListAlertsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListAlertsResponse struct { - - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` - // Wire name: 'results' Results []ListAlertsResponseAlert `json:"results,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListAlertsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listAlertsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listAlertsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListAlertsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListAlertsResponse) MarshalJSON() ([]byte, error) { - pb, err := listAlertsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListAlertsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListAlertsResponseAlert struct { // Trigger conditions of the alert. - // Wire name: 'condition' Condition *AlertCondition `json:"condition,omitempty"` // The timestamp indicating when the alert was created. - // Wire name: 'create_time' CreateTime string `json:"create_time,omitempty"` // Custom body of alert notification, if it exists. See [here] for custom // templating instructions. // // [here]: https://docs.databricks.com/sql/user/alerts/index.html - // Wire name: 'custom_body' CustomBody string `json:"custom_body,omitempty"` // Custom subject of alert notification, if it exists. This can include // email subject entries and Slack notification headers, for example. See // [here] for custom templating instructions. // // [here]: https://docs.databricks.com/sql/user/alerts/index.html - // Wire name: 'custom_subject' CustomSubject string `json:"custom_subject,omitempty"` // The display name of the alert. - // Wire name: 'display_name' DisplayName string `json:"display_name,omitempty"` // UUID identifying the alert. - // Wire name: 'id' Id string `json:"id,omitempty"` // The workspace state of the alert. Used for tracking trashed status. - // Wire name: 'lifecycle_state' LifecycleState LifecycleState `json:"lifecycle_state,omitempty"` // Whether to notify alert subscribers when alert returns back to normal. - // Wire name: 'notify_on_ok' NotifyOnOk bool `json:"notify_on_ok,omitempty"` // The owner's username. This field is set to "Unavailable" if the user has // been deleted. - // Wire name: 'owner_user_name' OwnerUserName string `json:"owner_user_name,omitempty"` // UUID of the query attached to the alert. - // Wire name: 'query_id' QueryId string `json:"query_id,omitempty"` // Number of seconds an alert must wait after being triggered to rearm // itself. After rearming, it can be triggered again. If 0 or not specified, // the alert will not be triggered again. - // Wire name: 'seconds_to_retrigger' SecondsToRetrigger int `json:"seconds_to_retrigger,omitempty"` // Current state of the alert's trigger status. This field is set to UNKNOWN // if the alert has not yet been evaluated or ran into an error during the // last evaluation. - // Wire name: 'state' State AlertState `json:"state,omitempty"` // Timestamp when the alert was last triggered, if the alert has been // triggered before. - // Wire name: 'trigger_time' TriggerTime string `json:"trigger_time,omitempty"` // The timestamp indicating when the alert was updated. - // Wire name: 'update_time' UpdateTime string `json:"update_time,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListAlertsResponseAlert) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listAlertsResponseAlertPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listAlertsResponseAlertFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListAlertsResponseAlert) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListAlertsResponseAlert) MarshalJSON() ([]byte, error) { - pb, err := listAlertsResponseAlertToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListAlertsResponseAlert) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // List alerts type ListAlertsV2Request struct { - PageSize int `json:"-" tf:"-"` + PageSize int `json:"-" url:"page_size,omitempty"` - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListAlertsV2Request) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listAlertsV2RequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listAlertsV2RequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListAlertsV2Request) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListAlertsV2Request) MarshalJSON() ([]byte, error) { - pb, err := listAlertsV2RequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListAlertsV2Request) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListAlertsV2Response struct { - - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` - // Wire name: 'results' Results []AlertV2 `json:"results,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListAlertsV2Response) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listAlertsV2ResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listAlertsV2ResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListAlertsV2Response) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListAlertsV2Response) MarshalJSON() ([]byte, error) { - pb, err := listAlertsV2ResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListAlertsV2Response) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get dashboard objects type ListDashboardsRequest struct { // Name of dashboard attribute to order by. - Order ListOrder `json:"-" tf:"-"` + Order ListOrder `json:"-" url:"order,omitempty"` // Page number to retrieve. - Page int `json:"-" tf:"-"` + Page int `json:"-" url:"page,omitempty"` // Number of dashboards to return per page. - PageSize int `json:"-" tf:"-"` + PageSize int `json:"-" url:"page_size,omitempty"` // Full text search term. - Q string `json:"-" tf:"-"` + Q string `json:"-" url:"q,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListDashboardsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listDashboardsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listDashboardsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListDashboardsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListDashboardsRequest) MarshalJSON() ([]byte, error) { - pb, err := listDashboardsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListDashboardsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListOrder string @@ -5418,113 +3173,59 @@ type ListQueriesLegacyRequest struct { // - `executed_at`: The timestamp when the query was last run. // // - `created_by`: The user name of the user that created the query. - Order string `json:"-" tf:"-"` + Order string `json:"-" url:"order,omitempty"` // Page number to retrieve. - Page int `json:"-" tf:"-"` + Page int `json:"-" url:"page,omitempty"` // Number of queries to return per page. - PageSize int `json:"-" tf:"-"` + PageSize int `json:"-" url:"page_size,omitempty"` // Full text search term - Q string `json:"-" tf:"-"` + Q string `json:"-" url:"q,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListQueriesLegacyRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listQueriesLegacyRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listQueriesLegacyRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListQueriesLegacyRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListQueriesLegacyRequest) MarshalJSON() ([]byte, error) { - pb, err := listQueriesLegacyRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListQueriesLegacyRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // List queries type ListQueriesRequest struct { - PageSize int `json:"-" tf:"-"` + PageSize int `json:"-" url:"page_size,omitempty"` - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListQueriesRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listQueriesRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listQueriesRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListQueriesRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListQueriesRequest) MarshalJSON() ([]byte, error) { - pb, err := listQueriesRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListQueriesRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListQueriesResponse struct { // Whether there is another page of results. - // Wire name: 'has_next_page' HasNextPage bool `json:"has_next_page,omitempty"` // A token that can be used to get the next page of results. - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` - // Wire name: 'res' Res []QueryInfo `json:"res,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListQueriesResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listQueriesResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listQueriesResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListQueriesResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListQueriesResponse) MarshalJSON() ([]byte, error) { - pb, err := listQueriesResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListQueriesResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // List Queries @@ -5533,413 +3234,203 @@ type ListQueryHistoryRequest struct { // parameters such as user IDs, endpoint IDs, and statuses to narrow the // returned data. In a URL, the parameters of this filter are specified with // dot notation. For example: `filter_by.statement_ids`. - FilterBy *QueryFilter `json:"-" tf:"-"` + FilterBy *QueryFilter `json:"-" url:"filter_by,omitempty"` // Whether to include the query metrics with each query. Only use this for a // small subset of queries (max_results). Defaults to false. - IncludeMetrics bool `json:"-" tf:"-"` + IncludeMetrics bool `json:"-" url:"include_metrics,omitempty"` // Limit the number of results returned in one page. Must be less than 1000 // and the default is 100. - MaxResults int `json:"-" tf:"-"` + MaxResults int `json:"-" url:"max_results,omitempty"` // A token that can be used to get the next page of results. The token can // contains characters that need to be encoded before using it in a URL. For // example, the character '+' needs to be replaced by %2B. This field is // optional. - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListQueryHistoryRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listQueryHistoryRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listQueryHistoryRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListQueryHistoryRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListQueryHistoryRequest) MarshalJSON() ([]byte, error) { - pb, err := listQueryHistoryRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListQueryHistoryRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListQueryObjectsResponse struct { - - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` - // Wire name: 'results' Results []ListQueryObjectsResponseQuery `json:"results,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListQueryObjectsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listQueryObjectsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listQueryObjectsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListQueryObjectsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListQueryObjectsResponse) MarshalJSON() ([]byte, error) { - pb, err := listQueryObjectsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListQueryObjectsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListQueryObjectsResponseQuery struct { // Whether to apply a 1000 row limit to the query result. - // Wire name: 'apply_auto_limit' ApplyAutoLimit bool `json:"apply_auto_limit,omitempty"` // Name of the catalog where this query will be executed. - // Wire name: 'catalog' Catalog string `json:"catalog,omitempty"` // Timestamp when this query was created. - // Wire name: 'create_time' CreateTime string `json:"create_time,omitempty"` // General description that conveys additional information about this query // such as usage notes. - // Wire name: 'description' Description string `json:"description,omitempty"` // Display name of the query that appears in list views, widget headings, // and on the query page. - // Wire name: 'display_name' DisplayName string `json:"display_name,omitempty"` // UUID identifying the query. - // Wire name: 'id' Id string `json:"id,omitempty"` // Username of the user who last saved changes to this query. - // Wire name: 'last_modifier_user_name' LastModifierUserName string `json:"last_modifier_user_name,omitempty"` // Indicates whether the query is trashed. - // Wire name: 'lifecycle_state' LifecycleState LifecycleState `json:"lifecycle_state,omitempty"` // Username of the user that owns the query. - // Wire name: 'owner_user_name' OwnerUserName string `json:"owner_user_name,omitempty"` // List of query parameter definitions. - // Wire name: 'parameters' Parameters []QueryParameter `json:"parameters,omitempty"` // Text of the query to be run. - // Wire name: 'query_text' QueryText string `json:"query_text,omitempty"` // Sets the "Run as" role for the object. - // Wire name: 'run_as_mode' RunAsMode RunAsMode `json:"run_as_mode,omitempty"` // Name of the schema where this query will be executed. - // Wire name: 'schema' Schema string `json:"schema,omitempty"` - // Wire name: 'tags' Tags []string `json:"tags,omitempty"` // Timestamp when this query was last updated. - // Wire name: 'update_time' UpdateTime string `json:"update_time,omitempty"` // ID of the SQL warehouse attached to the query. - // Wire name: 'warehouse_id' WarehouseId string `json:"warehouse_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListQueryObjectsResponseQuery) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listQueryObjectsResponseQueryPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listQueryObjectsResponseQueryFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListQueryObjectsResponseQuery) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListQueryObjectsResponseQuery) MarshalJSON() ([]byte, error) { - pb, err := listQueryObjectsResponseQueryToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListQueryObjectsResponseQuery) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListResponse struct { // The total number of dashboards. - // Wire name: 'count' Count int `json:"count,omitempty"` // The current page being displayed. - // Wire name: 'page' Page int `json:"page,omitempty"` // The number of dashboards per page. - // Wire name: 'page_size' PageSize int `json:"page_size,omitempty"` // List of dashboards returned. - // Wire name: 'results' Results []Dashboard `json:"results,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListResponse) MarshalJSON() ([]byte, error) { - pb, err := listResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // List visualizations on a query type ListVisualizationsForQueryRequest struct { - Id string `json:"-" tf:"-"` + Id string `json:"-" url:"-"` - PageSize int `json:"-" tf:"-"` + PageSize int `json:"-" url:"page_size,omitempty"` - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListVisualizationsForQueryRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listVisualizationsForQueryRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listVisualizationsForQueryRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListVisualizationsForQueryRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListVisualizationsForQueryRequest) MarshalJSON() ([]byte, error) { - pb, err := listVisualizationsForQueryRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListVisualizationsForQueryRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListVisualizationsForQueryResponse struct { - - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` - // Wire name: 'results' Results []Visualization `json:"results,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListVisualizationsForQueryResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listVisualizationsForQueryResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listVisualizationsForQueryResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListVisualizationsForQueryResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListVisualizationsForQueryResponse) MarshalJSON() ([]byte, error) { - pb, err := listVisualizationsForQueryResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListVisualizationsForQueryResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // List warehouses type ListWarehousesRequest struct { // Service Principal which will be used to fetch the list of warehouses. If // not specified, the user from the session header is used. - RunAsUserId int `json:"-" tf:"-"` + RunAsUserId int `json:"-" url:"run_as_user_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListWarehousesRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listWarehousesRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listWarehousesRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListWarehousesRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListWarehousesRequest) MarshalJSON() ([]byte, error) { - pb, err := listWarehousesRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListWarehousesRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListWarehousesResponse struct { // A list of warehouses and their configurations. - // Wire name: 'warehouses' Warehouses []EndpointInfo `json:"warehouses,omitempty"` } -func (st *ListWarehousesResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listWarehousesResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listWarehousesResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ListWarehousesResponse) MarshalJSON() ([]byte, error) { - pb, err := listWarehousesResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type MultiValuesOptions struct { // Character that prefixes each selected parameter value. - // Wire name: 'prefix' Prefix string `json:"prefix,omitempty"` // Character that separates each selected parameter value. Defaults to a // comma. - // Wire name: 'separator' Separator string `json:"separator,omitempty"` // Character that suffixes each selected parameter value. - // Wire name: 'suffix' Suffix string `json:"suffix,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *MultiValuesOptions) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &multiValuesOptionsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := multiValuesOptionsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *MultiValuesOptions) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st MultiValuesOptions) MarshalJSON() ([]byte, error) { - pb, err := multiValuesOptionsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s MultiValuesOptions) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type NumericValue struct { - - // Wire name: 'value' Value float64 `json:"value,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *NumericValue) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &numericValuePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := numericValueFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *NumericValue) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st NumericValue) MarshalJSON() ([]byte, error) { - pb, err := numericValueToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s NumericValue) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // A singular noun object type. @@ -6031,45 +3522,23 @@ func (f *ObjectTypePlural) Type() string { } type OdbcParams struct { - - // Wire name: 'hostname' Hostname string `json:"hostname,omitempty"` - // Wire name: 'path' Path string `json:"path,omitempty"` - // Wire name: 'port' Port int `json:"port,omitempty"` - // Wire name: 'protocol' Protocol string `json:"protocol,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *OdbcParams) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &odbcParamsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := odbcParamsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *OdbcParams) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st OdbcParams) MarshalJSON() ([]byte, error) { - pb, err := odbcParamsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s OdbcParams) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The singular form of the type of object which can be owned. @@ -6116,56 +3585,32 @@ func (f *OwnableObjectType) Type() string { type Parameter struct { // List of valid parameter values, newline delimited. Only applies for // dropdown list parameters. - // Wire name: 'enumOptions' EnumOptions string `json:"enumOptions,omitempty"` // If specified, allows multiple values to be selected for this parameter. // Only applies to dropdown list and query-based dropdown list parameters. - // Wire name: 'multiValuesOptions' MultiValuesOptions *MultiValuesOptions `json:"multiValuesOptions,omitempty"` // The literal parameter marker that appears between double curly braces in // the query text. - // Wire name: 'name' Name string `json:"name,omitempty"` // The UUID of the query that provides the parameter values. Only applies // for query-based dropdown list parameters. - // Wire name: 'queryId' QueryId string `json:"queryId,omitempty"` // The text displayed in a parameter picking widget. - // Wire name: 'title' Title string `json:"title,omitempty"` // Parameters can have several different types. - // Wire name: 'type' Type ParameterType `json:"type,omitempty"` // The default value for this parameter. - // Wire name: 'value' Value any `json:"value,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *Parameter) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := ¶meterPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := parameterFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *Parameter) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st Parameter) MarshalJSON() ([]byte, error) { - pb, err := parameterToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s Parameter) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Parameters can have several different types. @@ -6316,124 +3761,70 @@ func (f *PlansState) Type() string { type Query struct { // Whether to apply a 1000 row limit to the query result. - // Wire name: 'apply_auto_limit' ApplyAutoLimit bool `json:"apply_auto_limit,omitempty"` // Name of the catalog where this query will be executed. - // Wire name: 'catalog' Catalog string `json:"catalog,omitempty"` // Timestamp when this query was created. - // Wire name: 'create_time' CreateTime string `json:"create_time,omitempty"` // General description that conveys additional information about this query // such as usage notes. - // Wire name: 'description' Description string `json:"description,omitempty"` // Display name of the query that appears in list views, widget headings, // and on the query page. - // Wire name: 'display_name' DisplayName string `json:"display_name,omitempty"` // UUID identifying the query. - // Wire name: 'id' Id string `json:"id,omitempty"` // Username of the user who last saved changes to this query. - // Wire name: 'last_modifier_user_name' LastModifierUserName string `json:"last_modifier_user_name,omitempty"` // Indicates whether the query is trashed. - // Wire name: 'lifecycle_state' LifecycleState LifecycleState `json:"lifecycle_state,omitempty"` // Username of the user that owns the query. - // Wire name: 'owner_user_name' OwnerUserName string `json:"owner_user_name,omitempty"` // List of query parameter definitions. - // Wire name: 'parameters' Parameters []QueryParameter `json:"parameters,omitempty"` // Workspace path of the workspace folder containing the object. - // Wire name: 'parent_path' ParentPath string `json:"parent_path,omitempty"` // Text of the query to be run. - // Wire name: 'query_text' QueryText string `json:"query_text,omitempty"` // Sets the "Run as" role for the object. - // Wire name: 'run_as_mode' RunAsMode RunAsMode `json:"run_as_mode,omitempty"` // Name of the schema where this query will be executed. - // Wire name: 'schema' Schema string `json:"schema,omitempty"` - // Wire name: 'tags' Tags []string `json:"tags,omitempty"` // Timestamp when this query was last updated. - // Wire name: 'update_time' UpdateTime string `json:"update_time,omitempty"` // ID of the SQL warehouse attached to the query. - // Wire name: 'warehouse_id' WarehouseId string `json:"warehouse_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *Query) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &queryPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := queryFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *Query) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st Query) MarshalJSON() ([]byte, error) { - pb, err := queryToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s Query) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type QueryBackedValue struct { // If specified, allows multiple values to be selected for this parameter. - // Wire name: 'multi_values_options' MultiValuesOptions *MultiValuesOptions `json:"multi_values_options,omitempty"` // UUID of the query that provides the parameter values. - // Wire name: 'query_id' QueryId string `json:"query_id,omitempty"` // List of selected query parameter values. - // Wire name: 'values' Values []string `json:"values,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *QueryBackedValue) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &queryBackedValuePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := queryBackedValueFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *QueryBackedValue) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st QueryBackedValue) MarshalJSON() ([]byte, error) { - pb, err := queryBackedValueToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s QueryBackedValue) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type QueryEditContent struct { @@ -6441,480 +3832,278 @@ type QueryEditContent struct { // is distinct from the warehouse ID. [Learn more] // // [Learn more]: https://docs.databricks.com/api/workspace/datasources/list - // Wire name: 'data_source_id' DataSourceId string `json:"data_source_id,omitempty"` // General description that conveys additional information about this query // such as usage notes. - // Wire name: 'description' Description string `json:"description,omitempty"` // The title of this query that appears in list views, widget headings, and // on the query page. - // Wire name: 'name' Name string `json:"name,omitempty"` // Exclusively used for storing a list parameter definitions. A parameter is // an object with `title`, `name`, `type`, and `value` properties. The // `value` field here is the default value. It can be overridden at runtime. - // Wire name: 'options' Options any `json:"options,omitempty"` // The text of the query to be run. - // Wire name: 'query' Query string `json:"query,omitempty"` - QueryId string `json:"-" tf:"-"` + QueryId string `json:"-" url:"-"` // Sets the **Run as** role for the object. Must be set to one of `"viewer"` // (signifying "run as viewer" behavior) or `"owner"` (signifying "run as // owner" behavior) - // Wire name: 'run_as_role' RunAsRole RunAsRole `json:"run_as_role,omitempty"` - // Wire name: 'tags' Tags []string `json:"tags,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *QueryEditContent) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &queryEditContentPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := queryEditContentFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *QueryEditContent) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st QueryEditContent) MarshalJSON() ([]byte, error) { - pb, err := queryEditContentToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s QueryEditContent) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type QueryFilter struct { // A range filter for query submitted time. The time range must be less than // or equal to 30 days. - // Wire name: 'query_start_time_range' - QueryStartTimeRange *TimeRange `json:"query_start_time_range,omitempty"` + QueryStartTimeRange *TimeRange `json:"query_start_time_range,omitempty" url:"query_start_time_range,omitempty"` // A list of statement IDs. - // Wire name: 'statement_ids' - StatementIds []string `json:"statement_ids,omitempty"` + StatementIds []string `json:"statement_ids,omitempty" url:"statement_ids,omitempty"` // A list of statuses (QUEUED, RUNNING, CANCELED, FAILED, FINISHED) to match // query results. Corresponds to the `status` field in the response. // Filtering for multiple statuses is not recommended. Instead, opt to // filter by a single status multiple times and then combine the results. - // Wire name: 'statuses' - Statuses []QueryStatus `json:"statuses,omitempty"` + Statuses []QueryStatus `json:"statuses,omitempty" url:"statuses,omitempty"` // A list of user IDs who ran the queries. - // Wire name: 'user_ids' - UserIds []int64 `json:"user_ids,omitempty"` + UserIds []int64 `json:"user_ids,omitempty" url:"user_ids,omitempty"` // A list of warehouse IDs. - // Wire name: 'warehouse_ids' - WarehouseIds []string `json:"warehouse_ids,omitempty"` -} - -func (st *QueryFilter) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &queryFilterPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := queryFilterFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st QueryFilter) MarshalJSON() ([]byte, error) { - pb, err := queryFilterToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + WarehouseIds []string `json:"warehouse_ids,omitempty" url:"warehouse_ids,omitempty"` } type QueryInfo struct { // SQL Warehouse channel information at the time of query execution - // Wire name: 'channel_used' ChannelUsed *ChannelInfo `json:"channel_used,omitempty"` // Client application that ran the statement. For example: Databricks SQL // Editor, Tableau, and Power BI. This field is derived from information // provided by client applications. While values are expected to remain // static over time, this cannot be guaranteed. - // Wire name: 'client_application' ClientApplication string `json:"client_application,omitempty"` // Total time of the statement execution. This value does not include the // time taken to retrieve the results, which can result in a discrepancy // between this value and the start-to-finish wall-clock time. - // Wire name: 'duration' Duration int64 `json:"duration,omitempty"` // Alias for `warehouse_id`. - // Wire name: 'endpoint_id' EndpointId string `json:"endpoint_id,omitempty"` // Message describing why the query could not complete. - // Wire name: 'error_message' ErrorMessage string `json:"error_message,omitempty"` // The ID of the user whose credentials were used to run the query. - // Wire name: 'executed_as_user_id' ExecutedAsUserId int64 `json:"executed_as_user_id,omitempty"` // The email address or username of the user whose credentials were used to // run the query. - // Wire name: 'executed_as_user_name' ExecutedAsUserName string `json:"executed_as_user_name,omitempty"` // The time execution of the query ended. - // Wire name: 'execution_end_time_ms' ExecutionEndTimeMs int64 `json:"execution_end_time_ms,omitempty"` // Whether more updates for the query are expected. - // Wire name: 'is_final' IsFinal bool `json:"is_final,omitempty"` // A key that can be used to look up query details. - // Wire name: 'lookup_key' LookupKey string `json:"lookup_key,omitempty"` // Metrics about query execution. - // Wire name: 'metrics' Metrics *QueryMetrics `json:"metrics,omitempty"` // Whether plans exist for the execution, or the reason why they are missing - // Wire name: 'plans_state' PlansState PlansState `json:"plans_state,omitempty"` // The time the query ended. - // Wire name: 'query_end_time_ms' QueryEndTimeMs int64 `json:"query_end_time_ms,omitempty"` // The query ID. - // Wire name: 'query_id' QueryId string `json:"query_id,omitempty"` // A struct that contains key-value pairs representing Databricks entities // that were involved in the execution of this statement, such as jobs, // notebooks, or dashboards. This field only records Databricks entities. - // Wire name: 'query_source' QuerySource *ExternalQuerySource `json:"query_source,omitempty"` // The time the query started. - // Wire name: 'query_start_time_ms' QueryStartTimeMs int64 `json:"query_start_time_ms,omitempty"` // The text of the query. - // Wire name: 'query_text' QueryText string `json:"query_text,omitempty"` // The number of results returned by the query. - // Wire name: 'rows_produced' RowsProduced int64 `json:"rows_produced,omitempty"` // URL to the Spark UI query plan. - // Wire name: 'spark_ui_url' SparkUiUrl string `json:"spark_ui_url,omitempty"` // Type of statement for this query - // Wire name: 'statement_type' StatementType QueryStatementType `json:"statement_type,omitempty"` // Query status with one the following values: // // - `QUEUED`: Query has been received and queued. - `RUNNING`: Query has // started. - `CANCELED`: Query has been cancelled by the user. - `FAILED`: // Query has failed. - `FINISHED`: Query has completed. - // Wire name: 'status' Status QueryStatus `json:"status,omitempty"` // The ID of the user who ran the query. - // Wire name: 'user_id' UserId int64 `json:"user_id,omitempty"` // The email address or username of the user who ran the query. - // Wire name: 'user_name' UserName string `json:"user_name,omitempty"` // Warehouse ID. - // Wire name: 'warehouse_id' WarehouseId string `json:"warehouse_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *QueryInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &queryInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := queryInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *QueryInfo) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st QueryInfo) MarshalJSON() ([]byte, error) { - pb, err := queryInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s QueryInfo) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type QueryList struct { // The total number of queries. - // Wire name: 'count' Count int `json:"count,omitempty"` // The page number that is currently displayed. - // Wire name: 'page' Page int `json:"page,omitempty"` // The number of queries per page. - // Wire name: 'page_size' PageSize int `json:"page_size,omitempty"` // List of queries returned. - // Wire name: 'results' Results []LegacyQuery `json:"results,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *QueryList) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &queryListPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := queryListFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *QueryList) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st QueryList) MarshalJSON() ([]byte, error) { - pb, err := queryListToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s QueryList) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // A query metric that encapsulates a set of measurements for a single query. // Metrics come from the driver and are stored in the history service database. type QueryMetrics struct { // Time spent loading metadata and optimizing the query, in milliseconds. - // Wire name: 'compilation_time_ms' CompilationTimeMs int64 `json:"compilation_time_ms,omitempty"` // Time spent executing the query, in milliseconds. - // Wire name: 'execution_time_ms' ExecutionTimeMs int64 `json:"execution_time_ms,omitempty"` // Total amount of data sent over the network between executor nodes during // shuffle, in bytes. - // Wire name: 'network_sent_bytes' NetworkSentBytes int64 `json:"network_sent_bytes,omitempty"` // Timestamp of when the query was enqueued waiting while the warehouse was // at max load. This field is optional and will not appear if the query // skipped the overloading queue. - // Wire name: 'overloading_queue_start_timestamp' OverloadingQueueStartTimestamp int64 `json:"overloading_queue_start_timestamp,omitempty"` // Total execution time for all individual Photon query engine tasks in the // query, in milliseconds. - // Wire name: 'photon_total_time_ms' PhotonTotalTimeMs int64 `json:"photon_total_time_ms,omitempty"` // Timestamp of when the query was enqueued waiting for a cluster to be // provisioned for the warehouse. This field is optional and will not appear // if the query skipped the provisioning queue. - // Wire name: 'provisioning_queue_start_timestamp' ProvisioningQueueStartTimestamp int64 `json:"provisioning_queue_start_timestamp,omitempty"` // Total number of bytes in all tables not read due to pruning - // Wire name: 'pruned_bytes' PrunedBytes int64 `json:"pruned_bytes,omitempty"` // Total number of files from all tables not read due to pruning - // Wire name: 'pruned_files_count' PrunedFilesCount int64 `json:"pruned_files_count,omitempty"` // Timestamp of when the underlying compute started compilation of the // query. - // Wire name: 'query_compilation_start_timestamp' QueryCompilationStartTimestamp int64 `json:"query_compilation_start_timestamp,omitempty"` // Total size of data read by the query, in bytes. - // Wire name: 'read_bytes' ReadBytes int64 `json:"read_bytes,omitempty"` // Size of persistent data read from the cache, in bytes. - // Wire name: 'read_cache_bytes' ReadCacheBytes int64 `json:"read_cache_bytes,omitempty"` // Number of files read after pruning - // Wire name: 'read_files_count' ReadFilesCount int64 `json:"read_files_count,omitempty"` // Number of partitions read after pruning. - // Wire name: 'read_partitions_count' ReadPartitionsCount int64 `json:"read_partitions_count,omitempty"` // Size of persistent data read from cloud object storage on your cloud // tenant, in bytes. - // Wire name: 'read_remote_bytes' ReadRemoteBytes int64 `json:"read_remote_bytes,omitempty"` // Time spent fetching the query results after the execution finished, in // milliseconds. - // Wire name: 'result_fetch_time_ms' ResultFetchTimeMs int64 `json:"result_fetch_time_ms,omitempty"` // `true` if the query result was fetched from cache, `false` otherwise. - // Wire name: 'result_from_cache' ResultFromCache bool `json:"result_from_cache,omitempty"` // Total number of rows returned by the query. - // Wire name: 'rows_produced_count' RowsProducedCount int64 `json:"rows_produced_count,omitempty"` // Total number of rows read by the query. - // Wire name: 'rows_read_count' RowsReadCount int64 `json:"rows_read_count,omitempty"` // Size of data temporarily written to disk while executing the query, in // bytes. - // Wire name: 'spill_to_disk_bytes' SpillToDiskBytes int64 `json:"spill_to_disk_bytes,omitempty"` // sum of task times completed in a range of wall clock time, approximated // to a configurable number of points aggregated over all stages and jobs in // the query (based on task_total_time_ms) - // Wire name: 'task_time_over_time_range' TaskTimeOverTimeRange *TaskTimeOverRange `json:"task_time_over_time_range,omitempty"` // Sum of execution time for all of the query’s tasks, in milliseconds. - // Wire name: 'task_total_time_ms' TaskTotalTimeMs int64 `json:"task_total_time_ms,omitempty"` // Total execution time of the query from the client’s point of view, in // milliseconds. - // Wire name: 'total_time_ms' TotalTimeMs int64 `json:"total_time_ms,omitempty"` // Size pf persistent data written to cloud object storage in your cloud // tenant, in bytes. - // Wire name: 'write_remote_bytes' WriteRemoteBytes int64 `json:"write_remote_bytes,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *QueryMetrics) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &queryMetricsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := queryMetricsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *QueryMetrics) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st QueryMetrics) MarshalJSON() ([]byte, error) { - pb, err := queryMetricsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s QueryMetrics) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type QueryOptions struct { // The name of the catalog to execute this query in. - // Wire name: 'catalog' Catalog string `json:"catalog,omitempty"` // The timestamp when this query was moved to trash. Only present when the // `is_archived` property is `true`. Trashed items are deleted after thirty // days. - // Wire name: 'moved_to_trash_at' MovedToTrashAt string `json:"moved_to_trash_at,omitempty"` - // Wire name: 'parameters' Parameters []Parameter `json:"parameters,omitempty"` // The name of the schema to execute this query in. - // Wire name: 'schema' Schema string `json:"schema,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *QueryOptions) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &queryOptionsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := queryOptionsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *QueryOptions) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st QueryOptions) MarshalJSON() ([]byte, error) { - pb, err := queryOptionsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s QueryOptions) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type QueryParameter struct { // Date-range query parameter value. Can only specify one of // `dynamic_date_range_value` or `date_range_value`. - // Wire name: 'date_range_value' DateRangeValue *DateRangeValue `json:"date_range_value,omitempty"` // Date query parameter value. Can only specify one of `dynamic_date_value` // or `date_value`. - // Wire name: 'date_value' DateValue *DateValue `json:"date_value,omitempty"` // Dropdown query parameter value. - // Wire name: 'enum_value' EnumValue *EnumValue `json:"enum_value,omitempty"` // Literal parameter marker that appears between double curly braces in the // query text. - // Wire name: 'name' Name string `json:"name,omitempty"` // Numeric query parameter value. - // Wire name: 'numeric_value' NumericValue *NumericValue `json:"numeric_value,omitempty"` // Query-based dropdown query parameter value. - // Wire name: 'query_backed_value' QueryBackedValue *QueryBackedValue `json:"query_backed_value,omitempty"` // Text query parameter value. - // Wire name: 'text_value' TextValue *TextValue `json:"text_value,omitempty"` // Text displayed in the user-facing parameter widget in the UI. - // Wire name: 'title' Title string `json:"title,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *QueryParameter) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &queryParameterPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := queryParameterFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *QueryParameter) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st QueryParameter) MarshalJSON() ([]byte, error) { - pb, err := queryParameterToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s QueryParameter) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type QueryPostContent struct { @@ -6922,62 +4111,37 @@ type QueryPostContent struct { // is distinct from the warehouse ID. [Learn more] // // [Learn more]: https://docs.databricks.com/api/workspace/datasources/list - // Wire name: 'data_source_id' DataSourceId string `json:"data_source_id,omitempty"` // General description that conveys additional information about this query // such as usage notes. - // Wire name: 'description' Description string `json:"description,omitempty"` // The title of this query that appears in list views, widget headings, and // on the query page. - // Wire name: 'name' Name string `json:"name,omitempty"` // Exclusively used for storing a list parameter definitions. A parameter is // an object with `title`, `name`, `type`, and `value` properties. The // `value` field here is the default value. It can be overridden at runtime. - // Wire name: 'options' Options any `json:"options,omitempty"` // The identifier of the workspace folder containing the object. - // Wire name: 'parent' Parent string `json:"parent,omitempty"` // The text of the query to be run. - // Wire name: 'query' Query string `json:"query,omitempty"` // Sets the **Run as** role for the object. Must be set to one of `"viewer"` // (signifying "run as viewer" behavior) or `"owner"` (signifying "run as // owner" behavior) - // Wire name: 'run_as_role' RunAsRole RunAsRole `json:"run_as_role,omitempty"` - // Wire name: 'tags' Tags []string `json:"tags,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *QueryPostContent) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &queryPostContentPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := queryPostContentFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *QueryPostContent) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st QueryPostContent) MarshalJSON() ([]byte, error) { - pb, err := queryPostContentToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s QueryPostContent) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type QueryStatementType string @@ -7135,277 +4299,106 @@ func (f *QueryStatus) Type() string { type RepeatedEndpointConfPairs struct { // Deprecated: Use configuration_pairs - // Wire name: 'config_pair' ConfigPair []EndpointConfPair `json:"config_pair,omitempty"` - // Wire name: 'configuration_pairs' ConfigurationPairs []EndpointConfPair `json:"configuration_pairs,omitempty"` } -func (st *RepeatedEndpointConfPairs) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &repeatedEndpointConfPairsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := repeatedEndpointConfPairsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st RepeatedEndpointConfPairs) MarshalJSON() ([]byte, error) { - pb, err := repeatedEndpointConfPairsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Restore a dashboard type RestoreDashboardRequest struct { - DashboardId string `json:"-" tf:"-"` -} - -func (st *RestoreDashboardRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &restoreDashboardRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := restoreDashboardRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st RestoreDashboardRequest) MarshalJSON() ([]byte, error) { - pb, err := restoreDashboardRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + DashboardId string `json:"-" url:"-"` } // Restore a query type RestoreQueriesLegacyRequest struct { - QueryId string `json:"-" tf:"-"` -} - -func (st *RestoreQueriesLegacyRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &restoreQueriesLegacyRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := restoreQueriesLegacyRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st RestoreQueriesLegacyRequest) MarshalJSON() ([]byte, error) { - pb, err := restoreQueriesLegacyRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + QueryId string `json:"-" url:"-"` } type RestoreResponse struct { } -func (st *RestoreResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &restoreResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := restoreResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st RestoreResponse) MarshalJSON() ([]byte, error) { - pb, err := restoreResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type ResultData struct { // The number of bytes in the result chunk. This field is not available when // using `INLINE` disposition. - // Wire name: 'byte_count' ByteCount int64 `json:"byte_count,omitempty"` // The position within the sequence of result set chunks. - // Wire name: 'chunk_index' ChunkIndex int `json:"chunk_index,omitempty"` // The `JSON_ARRAY` format is an array of arrays of values, where each // non-null value is formatted as a string. Null values are encoded as JSON // `null`. - // Wire name: 'data_array' DataArray [][]string `json:"data_array,omitempty"` - // Wire name: 'external_links' ExternalLinks []ExternalLink `json:"external_links,omitempty"` // When fetching, provides the `chunk_index` for the _next_ chunk. If // absent, indicates there are no more chunks. The next chunk can be fetched // with a :method:statementexecution/getStatementResultChunkN request. - // Wire name: 'next_chunk_index' NextChunkIndex int `json:"next_chunk_index,omitempty"` // When fetching, provides a link to fetch the _next_ chunk. If absent, // indicates there are no more chunks. This link is an absolute `path` to be // joined with your `$DATABRICKS_HOST`, and should be treated as an opaque // link. This is an alternative to using `next_chunk_index`. - // Wire name: 'next_chunk_internal_link' NextChunkInternalLink string `json:"next_chunk_internal_link,omitempty"` // The number of rows within the result chunk. - // Wire name: 'row_count' RowCount int64 `json:"row_count,omitempty"` // The starting row offset within the result set. - // Wire name: 'row_offset' RowOffset int64 `json:"row_offset,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ResultData) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &resultDataPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := resultDataFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ResultData) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ResultData) MarshalJSON() ([]byte, error) { - pb, err := resultDataToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ResultData) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The result manifest provides schema and metadata for the result set. type ResultManifest struct { // Array of result set chunk metadata. - // Wire name: 'chunks' Chunks []BaseChunkInfo `json:"chunks,omitempty"` - // Wire name: 'format' Format Format `json:"format,omitempty"` // The schema is an ordered list of column descriptions. - // Wire name: 'schema' Schema *ResultSchema `json:"schema,omitempty"` // The total number of bytes in the result set. This field is not available // when using `INLINE` disposition. - // Wire name: 'total_byte_count' TotalByteCount int64 `json:"total_byte_count,omitempty"` // The total number of chunks that the result set has been divided into. - // Wire name: 'total_chunk_count' TotalChunkCount int `json:"total_chunk_count,omitempty"` // The total number of rows in the result set. - // Wire name: 'total_row_count' TotalRowCount int64 `json:"total_row_count,omitempty"` // Indicates whether the result is truncated due to `row_limit` or // `byte_limit`. - // Wire name: 'truncated' Truncated bool `json:"truncated,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ResultManifest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &resultManifestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := resultManifestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ResultManifest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ResultManifest) MarshalJSON() ([]byte, error) { - pb, err := resultManifestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ResultManifest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The schema is an ordered list of column descriptions. type ResultSchema struct { - - // Wire name: 'column_count' ColumnCount int `json:"column_count,omitempty"` - // Wire name: 'columns' Columns []ColumnInfo `json:"columns,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ResultSchema) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &resultSchemaPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := resultSchemaFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ResultSchema) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ResultSchema) MarshalJSON() ([]byte, error) { - pb, err := resultSchemaToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ResultSchema) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type RunAsMode string @@ -7523,39 +4516,19 @@ func (f *SchedulePauseStatus) Type() string { } type ServiceError struct { - - // Wire name: 'error_code' ErrorCode ServiceErrorCode `json:"error_code,omitempty"` // A brief summary of the error condition. - // Wire name: 'message' Message string `json:"message,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ServiceError) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &serviceErrorPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := serviceErrorFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ServiceError) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ServiceError) MarshalJSON() ([]byte, error) { - pb, err := serviceErrorToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ServiceError) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ServiceErrorCode string @@ -7633,90 +4606,39 @@ func (f *ServiceErrorCode) Type() string { // Set object ACL type SetRequest struct { - - // Wire name: 'access_control_list' AccessControlList []AccessControl `json:"access_control_list,omitempty"` // Object ID. The ACL for the object with this UUID is overwritten by this // request's POST content. - ObjectId string `json:"-" tf:"-"` + ObjectId string `json:"-" url:"-"` // The type of object permission to set. - ObjectType ObjectTypePlural `json:"-" tf:"-"` -} - -func (st *SetRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &setRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := setRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st SetRequest) MarshalJSON() ([]byte, error) { - pb, err := setRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + ObjectType ObjectTypePlural `json:"-" url:"-"` } type SetResponse struct { - - // Wire name: 'access_control_list' AccessControlList []AccessControl `json:"access_control_list,omitempty"` // An object's type and UUID, separated by a forward slash (/) character. - // Wire name: 'object_id' ObjectId string `json:"object_id,omitempty"` // A singular noun object type. - // Wire name: 'object_type' ObjectType ObjectType `json:"object_type,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *SetResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &setResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := setResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *SetResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st SetResponse) MarshalJSON() ([]byte, error) { - pb, err := setResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s SetResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type SetWorkspaceWarehouseConfigRequest struct { // Optional: Channel selection details - // Wire name: 'channel' Channel *Channel `json:"channel,omitempty"` // Deprecated: Use sql_configuration_parameters - // Wire name: 'config_param' ConfigParam *RepeatedEndpointConfPairs `json:"config_param,omitempty"` // Spark confs for external hive metastore configuration JSON serialized // size must be less than <= 512K - // Wire name: 'data_access_config' DataAccessConfig []EndpointConfPair `json:"data_access_config,omitempty"` // List of Warehouse Types allowed in this workspace (limits allowed value // of the type field in CreateWarehouse and EditWarehouse). Note: Some types @@ -7724,51 +4646,28 @@ type SetWorkspaceWarehouseConfigRequest struct { // SetWorkspaceWarehouseConfig. Note: Disabling a type may cause existing // warehouses to be converted to another type. Used by frontend to save // specific type availability in the warehouse create and edit form UI. - // Wire name: 'enabled_warehouse_types' EnabledWarehouseTypes []WarehouseTypePair `json:"enabled_warehouse_types,omitempty"` // Deprecated: Use sql_configuration_parameters - // Wire name: 'global_param' GlobalParam *RepeatedEndpointConfPairs `json:"global_param,omitempty"` // GCP only: Google Service Account used to pass to cluster to access Google // Cloud Storage - // Wire name: 'google_service_account' GoogleServiceAccount string `json:"google_service_account,omitempty"` // AWS Only: Instance profile used to pass IAM role to the cluster - // Wire name: 'instance_profile_arn' InstanceProfileArn string `json:"instance_profile_arn,omitempty"` // Security policy for warehouses - // Wire name: 'security_policy' SecurityPolicy SetWorkspaceWarehouseConfigRequestSecurityPolicy `json:"security_policy,omitempty"` // SQL configuration parameters - // Wire name: 'sql_configuration_parameters' SqlConfigurationParameters *RepeatedEndpointConfPairs `json:"sql_configuration_parameters,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *SetWorkspaceWarehouseConfigRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &setWorkspaceWarehouseConfigRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := setWorkspaceWarehouseConfigRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *SetWorkspaceWarehouseConfigRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st SetWorkspaceWarehouseConfigRequest) MarshalJSON() ([]byte, error) { - pb, err := setWorkspaceWarehouseConfigRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s SetWorkspaceWarehouseConfigRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Security policy for warehouses @@ -7815,31 +4714,6 @@ func (f *SetWorkspaceWarehouseConfigRequestSecurityPolicy) Type() string { type SetWorkspaceWarehouseConfigResponse struct { } -func (st *SetWorkspaceWarehouseConfigResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &setWorkspaceWarehouseConfigResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := setWorkspaceWarehouseConfigResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st SetWorkspaceWarehouseConfigResponse) MarshalJSON() ([]byte, error) { - pb, err := setWorkspaceWarehouseConfigResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Configurations whether the warehouse should use spot instances. type SpotInstancePolicy string @@ -7884,62 +4758,12 @@ func (f *SpotInstancePolicy) Type() string { // Start a warehouse type StartRequest struct { // Required. Id of the SQL warehouse. - Id string `json:"-" tf:"-"` -} - -func (st *StartRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &startRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := startRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st StartRequest) MarshalJSON() ([]byte, error) { - pb, err := startRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Id string `json:"-" url:"-"` } type StartWarehouseResponse struct { } -func (st *StartWarehouseResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &startWarehouseResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := startWarehouseResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st StartWarehouseResponse) MarshalJSON() ([]byte, error) { - pb, err := startWarehouseResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // State of the warehouse type State string @@ -7992,7 +4816,6 @@ func (f *State) Type() string { type StatementParameterListItem struct { // The name of a parameter marker to be substituted in the statement. - // Wire name: 'name' Name string `json:"name"` // The data type, given as a string. For example: `INT`, `STRING`, // `DECIMAL(10,2)`. If no type is given the type is assumed to be `STRING`. @@ -8001,83 +4824,43 @@ type StatementParameterListItem struct { // reference. // // [Data types]: https://docs.databricks.com/sql/language-manual/functions/cast.html - // Wire name: 'type' Type string `json:"type,omitempty"` // The value to substitute, represented as a string. If omitted, the value // is interpreted as NULL. - // Wire name: 'value' Value string `json:"value,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *StatementParameterListItem) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &statementParameterListItemPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := statementParameterListItemFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *StatementParameterListItem) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st StatementParameterListItem) MarshalJSON() ([]byte, error) { - pb, err := statementParameterListItemToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s StatementParameterListItem) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type StatementResponse struct { // The result manifest provides schema and metadata for the result set. - // Wire name: 'manifest' Manifest *ResultManifest `json:"manifest,omitempty"` - // Wire name: 'result' Result *ResultData `json:"result,omitempty"` // The statement ID is returned upon successfully submitting a SQL // statement, and is a required reference for all subsequent calls. - // Wire name: 'statement_id' StatementId string `json:"statement_id,omitempty"` // The status response includes execution state and if relevant, error // information. - // Wire name: 'status' Status *StatementStatus `json:"status,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *StatementResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &statementResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := statementResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *StatementResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st StatementResponse) MarshalJSON() ([]byte, error) { - pb, err := statementResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s StatementResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Statement execution state: - `PENDING`: waiting for warehouse - `RUNNING`: @@ -8146,8 +4929,6 @@ func (f *StatementState) Type() string { // The status response includes execution state and if relevant, error // information. type StatementStatus struct { - - // Wire name: 'error' Error *ServiceError `json:"error,omitempty"` // Statement execution state: - `PENDING`: waiting for warehouse - // `RUNNING`: running - `SUCCEEDED`: execution was successful, result data @@ -8156,35 +4937,9 @@ type StatementStatus struct { // come from explicit cancel call, or timeout with `on_wait_timeout=CANCEL` // - `CLOSED`: execution successful, and statement closed; result no longer // available for fetch - // Wire name: 'state' State StatementState `json:"state,omitempty"` } -func (st *StatementStatus) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &statementStatusPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := statementStatusFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st StatementStatus) MarshalJSON() ([]byte, error) { - pb, err := statementStatusToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Health status of the warehouse. type Status string @@ -8232,93 +4987,16 @@ func (f *Status) Type() string { // Stop a warehouse type StopRequest struct { // Required. Id of the SQL warehouse. - Id string `json:"-" tf:"-"` -} - -func (st *StopRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &stopRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := stopRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st StopRequest) MarshalJSON() ([]byte, error) { - pb, err := stopRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Id string `json:"-" url:"-"` } type StopWarehouseResponse struct { } -func (st *StopWarehouseResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &stopWarehouseResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := stopWarehouseResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st StopWarehouseResponse) MarshalJSON() ([]byte, error) { - pb, err := stopWarehouseResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type Success struct { - - // Wire name: 'message' Message SuccessMessage `json:"message,omitempty"` } -func (st *Success) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &successPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := successFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st Success) MarshalJSON() ([]byte, error) { - pb, err := successToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type SuccessMessage string const SuccessMessageSuccess SuccessMessage = `Success` @@ -8354,115 +5032,49 @@ func (f *SuccessMessage) Type() string { } type TaskTimeOverRange struct { - - // Wire name: 'entries' Entries []TaskTimeOverRangeEntry `json:"entries,omitempty"` // interval length for all entries (difference in start time and end time of // an entry range) the same for all entries start time of first interval is // query_start_time_ms - // Wire name: 'interval' Interval int64 `json:"interval,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *TaskTimeOverRange) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &taskTimeOverRangePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := taskTimeOverRangeFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *TaskTimeOverRange) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st TaskTimeOverRange) MarshalJSON() ([]byte, error) { - pb, err := taskTimeOverRangeToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s TaskTimeOverRange) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type TaskTimeOverRangeEntry struct { // total task completion time in this time range, aggregated over all stages // and jobs in the query - // Wire name: 'task_completed_time_ms' TaskCompletedTimeMs int64 `json:"task_completed_time_ms,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *TaskTimeOverRangeEntry) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &taskTimeOverRangeEntryPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := taskTimeOverRangeEntryFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *TaskTimeOverRangeEntry) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st TaskTimeOverRangeEntry) MarshalJSON() ([]byte, error) { - pb, err := taskTimeOverRangeEntryToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s TaskTimeOverRangeEntry) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type TerminationReason struct { // status code indicating why the cluster was terminated - // Wire name: 'code' Code TerminationReasonCode `json:"code,omitempty"` // list of parameters that provide additional information about why the // cluster was terminated - // Wire name: 'parameters' Parameters map[string]string `json:"parameters,omitempty"` // type of the termination - // Wire name: 'type' Type TerminationReasonType `json:"type,omitempty"` } -func (st *TerminationReason) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &terminationReasonPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := terminationReasonFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st TerminationReason) MarshalJSON() ([]byte, error) { - pb, err := terminationReasonToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // status code indicating why the cluster was terminated type TerminationReasonCode string @@ -8777,246 +5389,94 @@ func (f *TerminationReasonType) Type() string { } type TextValue struct { - - // Wire name: 'value' Value string `json:"value,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *TextValue) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &textValuePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := textValueFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *TextValue) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st TextValue) MarshalJSON() ([]byte, error) { - pb, err := textValueToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s TextValue) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type TimeRange struct { // The end time in milliseconds. - // Wire name: 'end_time_ms' - EndTimeMs int64 `json:"end_time_ms,omitempty"` + EndTimeMs int64 `json:"end_time_ms,omitempty" url:"end_time_ms,omitempty"` // The start time in milliseconds. - // Wire name: 'start_time_ms' - StartTimeMs int64 `json:"start_time_ms,omitempty"` + StartTimeMs int64 `json:"start_time_ms,omitempty" url:"start_time_ms,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *TimeRange) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &timeRangePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := timeRangeFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *TimeRange) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st TimeRange) MarshalJSON() ([]byte, error) { - pb, err := timeRangeToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s TimeRange) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type TransferOwnershipObjectId struct { // Email address for the new owner, who must exist in the workspace. - // Wire name: 'new_owner' NewOwner string `json:"new_owner,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *TransferOwnershipObjectId) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &transferOwnershipObjectIdPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := transferOwnershipObjectIdFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *TransferOwnershipObjectId) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st TransferOwnershipObjectId) MarshalJSON() ([]byte, error) { - pb, err := transferOwnershipObjectIdToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s TransferOwnershipObjectId) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Transfer object ownership type TransferOwnershipRequest struct { // Email address for the new owner, who must exist in the workspace. - // Wire name: 'new_owner' NewOwner string `json:"new_owner,omitempty"` // The ID of the object on which to change ownership. - ObjectId TransferOwnershipObjectId `json:"-" tf:"-"` + ObjectId TransferOwnershipObjectId `json:"-" url:"-"` // The type of object on which to change ownership. - ObjectType OwnableObjectType `json:"-" tf:"-"` + ObjectType OwnableObjectType `json:"-" url:"-"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *TransferOwnershipRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &transferOwnershipRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := transferOwnershipRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *TransferOwnershipRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st TransferOwnershipRequest) MarshalJSON() ([]byte, error) { - pb, err := transferOwnershipRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s TransferOwnershipRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Delete an alert type TrashAlertRequest struct { - Id string `json:"-" tf:"-"` -} - -func (st *TrashAlertRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &trashAlertRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := trashAlertRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st TrashAlertRequest) MarshalJSON() ([]byte, error) { - pb, err := trashAlertRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Id string `json:"-" url:"-"` } // Delete an alert type TrashAlertV2Request struct { - Id string `json:"-" tf:"-"` -} - -func (st *TrashAlertV2Request) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &trashAlertV2RequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := trashAlertV2RequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st TrashAlertV2Request) MarshalJSON() ([]byte, error) { - pb, err := trashAlertV2RequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Id string `json:"-" url:"-"` } // Delete a query type TrashQueryRequest struct { - Id string `json:"-" tf:"-"` -} - -func (st *TrashQueryRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &trashQueryRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := trashQueryRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st TrashQueryRequest) MarshalJSON() ([]byte, error) { - pb, err := trashQueryRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Id string `json:"-" url:"-"` } type UpdateAlertRequest struct { - - // Wire name: 'alert' Alert *UpdateAlertRequestAlert `json:"alert,omitempty"` // If true, automatically resolve alert display name conflicts. Otherwise, // fail the request if the alert's display name conflicts with an existing // alert's display name. - // Wire name: 'auto_resolve_display_name' AutoResolveDisplayName bool `json:"auto_resolve_display_name,omitempty"` - Id string `json:"-" tf:"-"` + Id string `json:"-" url:"-"` // The field mask must be a single string, with multiple fields separated by // commas (no spaces). The field path is relative to the resource object, // using a dot (`.`) to navigate sub-fields (e.g., `author.given_name`). @@ -9028,108 +5488,63 @@ type UpdateAlertRequest struct { // always explicitly list the fields being updated and avoid using `*` // wildcards, as it can lead to unintended results if the API changes in the // future. - // Wire name: 'update_mask' UpdateMask string `json:"update_mask"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *UpdateAlertRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateAlertRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateAlertRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *UpdateAlertRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st UpdateAlertRequest) MarshalJSON() ([]byte, error) { - pb, err := updateAlertRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s UpdateAlertRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type UpdateAlertRequestAlert struct { // Trigger conditions of the alert. - // Wire name: 'condition' Condition *AlertCondition `json:"condition,omitempty"` // Custom body of alert notification, if it exists. See [here] for custom // templating instructions. // // [here]: https://docs.databricks.com/sql/user/alerts/index.html - // Wire name: 'custom_body' CustomBody string `json:"custom_body,omitempty"` // Custom subject of alert notification, if it exists. This can include // email subject entries and Slack notification headers, for example. See // [here] for custom templating instructions. // // [here]: https://docs.databricks.com/sql/user/alerts/index.html - // Wire name: 'custom_subject' CustomSubject string `json:"custom_subject,omitempty"` // The display name of the alert. - // Wire name: 'display_name' DisplayName string `json:"display_name,omitempty"` // Whether to notify alert subscribers when alert returns back to normal. - // Wire name: 'notify_on_ok' NotifyOnOk bool `json:"notify_on_ok,omitempty"` // The owner's username. This field is set to "Unavailable" if the user has // been deleted. - // Wire name: 'owner_user_name' OwnerUserName string `json:"owner_user_name,omitempty"` // UUID of the query attached to the alert. - // Wire name: 'query_id' QueryId string `json:"query_id,omitempty"` // Number of seconds an alert must wait after being triggered to rearm // itself. After rearming, it can be triggered again. If 0 or not specified, // the alert will not be triggered again. - // Wire name: 'seconds_to_retrigger' SecondsToRetrigger int `json:"seconds_to_retrigger,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *UpdateAlertRequestAlert) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateAlertRequestAlertPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateAlertRequestAlertFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *UpdateAlertRequestAlert) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st UpdateAlertRequestAlert) MarshalJSON() ([]byte, error) { - pb, err := updateAlertRequestAlertToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s UpdateAlertRequestAlert) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Update an alert type UpdateAlertV2Request struct { - - // Wire name: 'alert' Alert AlertV2 `json:"alert"` // UUID identifying the alert. - Id string `json:"-" tf:"-"` + Id string `json:"-" url:"-"` // The field mask must be a single string, with multiple fields separated by // commas (no spaces). The field path is relative to the resource object, // using a dot (`.`) to navigate sub-fields (e.g., `author.given_name`). @@ -9141,44 +5556,17 @@ type UpdateAlertV2Request struct { // always explicitly list the fields being updated and avoid using `*` // wildcards, as it can lead to unintended results if the API changes in the // future. - UpdateMask string `json:"-" tf:"-"` -} - -func (st *UpdateAlertV2Request) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateAlertV2RequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateAlertV2RequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateAlertV2Request) MarshalJSON() ([]byte, error) { - pb, err := updateAlertV2RequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + UpdateMask string `json:"-" url:"update_mask"` } type UpdateQueryRequest struct { // If true, automatically resolve alert display name conflicts. Otherwise, // fail the request if the alert's display name conflicts with an existing // alert's display name. - // Wire name: 'auto_resolve_display_name' AutoResolveDisplayName bool `json:"auto_resolve_display_name,omitempty"` - Id string `json:"-" tf:"-"` + Id string `json:"-" url:"-"` - // Wire name: 'query' Query *UpdateQueryRequestQuery `json:"query,omitempty"` // The field mask must be a single string, with multiple fields separated by // commas (no spaces). The field path is relative to the resource object, @@ -9191,132 +5579,61 @@ type UpdateQueryRequest struct { // always explicitly list the fields being updated and avoid using `*` // wildcards, as it can lead to unintended results if the API changes in the // future. - // Wire name: 'update_mask' UpdateMask string `json:"update_mask"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *UpdateQueryRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateQueryRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateQueryRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *UpdateQueryRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st UpdateQueryRequest) MarshalJSON() ([]byte, error) { - pb, err := updateQueryRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s UpdateQueryRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type UpdateQueryRequestQuery struct { // Whether to apply a 1000 row limit to the query result. - // Wire name: 'apply_auto_limit' ApplyAutoLimit bool `json:"apply_auto_limit,omitempty"` // Name of the catalog where this query will be executed. - // Wire name: 'catalog' Catalog string `json:"catalog,omitempty"` // General description that conveys additional information about this query // such as usage notes. - // Wire name: 'description' Description string `json:"description,omitempty"` // Display name of the query that appears in list views, widget headings, // and on the query page. - // Wire name: 'display_name' DisplayName string `json:"display_name,omitempty"` // Username of the user that owns the query. - // Wire name: 'owner_user_name' OwnerUserName string `json:"owner_user_name,omitempty"` // List of query parameter definitions. - // Wire name: 'parameters' Parameters []QueryParameter `json:"parameters,omitempty"` // Text of the query to be run. - // Wire name: 'query_text' QueryText string `json:"query_text,omitempty"` // Sets the "Run as" role for the object. - // Wire name: 'run_as_mode' RunAsMode RunAsMode `json:"run_as_mode,omitempty"` // Name of the schema where this query will be executed. - // Wire name: 'schema' Schema string `json:"schema,omitempty"` - // Wire name: 'tags' Tags []string `json:"tags,omitempty"` // ID of the SQL warehouse attached to the query. - // Wire name: 'warehouse_id' WarehouseId string `json:"warehouse_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *UpdateQueryRequestQuery) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateQueryRequestQueryPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateQueryRequestQueryFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *UpdateQueryRequestQuery) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st UpdateQueryRequestQuery) MarshalJSON() ([]byte, error) { - pb, err := updateQueryRequestQueryToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s UpdateQueryRequestQuery) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type UpdateResponse struct { } -func (st *UpdateResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateResponse) MarshalJSON() ([]byte, error) { - pb, err := updateResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type UpdateVisualizationRequest struct { - Id string `json:"-" tf:"-"` + Id string `json:"-" url:"-"` // The field mask must be a single string, with multiple fields separated by // commas (no spaces). The field path is relative to the resource object, // using a dot (`.`) to navigate sub-fields (e.g., `author.given_name`). @@ -9328,305 +5645,147 @@ type UpdateVisualizationRequest struct { // always explicitly list the fields being updated and avoid using `*` // wildcards, as it can lead to unintended results if the API changes in the // future. - // Wire name: 'update_mask' UpdateMask string `json:"update_mask"` - // Wire name: 'visualization' Visualization *UpdateVisualizationRequestVisualization `json:"visualization,omitempty"` } -func (st *UpdateVisualizationRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateVisualizationRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateVisualizationRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateVisualizationRequest) MarshalJSON() ([]byte, error) { - pb, err := updateVisualizationRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type UpdateVisualizationRequestVisualization struct { // The display name of the visualization. - // Wire name: 'display_name' DisplayName string `json:"display_name,omitempty"` // The visualization options varies widely from one visualization type to // the next and is unsupported. Databricks does not recommend modifying // visualization options directly. - // Wire name: 'serialized_options' SerializedOptions string `json:"serialized_options,omitempty"` // The visualization query plan varies widely from one visualization type to // the next and is unsupported. Databricks does not recommend modifying the // visualization query plan directly. - // Wire name: 'serialized_query_plan' SerializedQueryPlan string `json:"serialized_query_plan,omitempty"` // The type of visualization: counter, table, funnel, and so on. - // Wire name: 'type' Type string `json:"type,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *UpdateVisualizationRequestVisualization) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateVisualizationRequestVisualizationPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateVisualizationRequestVisualizationFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *UpdateVisualizationRequestVisualization) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st UpdateVisualizationRequestVisualization) MarshalJSON() ([]byte, error) { - pb, err := updateVisualizationRequestVisualizationToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s UpdateVisualizationRequestVisualization) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type User struct { - - // Wire name: 'email' Email string `json:"email,omitempty"` - // Wire name: 'id' Id int `json:"id,omitempty"` - // Wire name: 'name' Name string `json:"name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *User) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &userPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := userFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *User) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st User) MarshalJSON() ([]byte, error) { - pb, err := userToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s User) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type Visualization struct { // The timestamp indicating when the visualization was created. - // Wire name: 'create_time' CreateTime string `json:"create_time,omitempty"` // The display name of the visualization. - // Wire name: 'display_name' DisplayName string `json:"display_name,omitempty"` // UUID identifying the visualization. - // Wire name: 'id' Id string `json:"id,omitempty"` // UUID of the query that the visualization is attached to. - // Wire name: 'query_id' QueryId string `json:"query_id,omitempty"` // The visualization options varies widely from one visualization type to // the next and is unsupported. Databricks does not recommend modifying // visualization options directly. - // Wire name: 'serialized_options' SerializedOptions string `json:"serialized_options,omitempty"` // The visualization query plan varies widely from one visualization type to // the next and is unsupported. Databricks does not recommend modifying the // visualization query plan directly. - // Wire name: 'serialized_query_plan' SerializedQueryPlan string `json:"serialized_query_plan,omitempty"` // The type of visualization: counter, table, funnel, and so on. - // Wire name: 'type' Type string `json:"type,omitempty"` // The timestamp indicating when the visualization was updated. - // Wire name: 'update_time' UpdateTime string `json:"update_time,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *Visualization) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &visualizationPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := visualizationFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *Visualization) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st Visualization) MarshalJSON() ([]byte, error) { - pb, err := visualizationToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s Visualization) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type WarehouseAccessControlRequest struct { // name of the group - // Wire name: 'group_name' GroupName string `json:"group_name,omitempty"` // Permission level - // Wire name: 'permission_level' PermissionLevel WarehousePermissionLevel `json:"permission_level,omitempty"` // application ID of a service principal - // Wire name: 'service_principal_name' ServicePrincipalName string `json:"service_principal_name,omitempty"` // name of the user - // Wire name: 'user_name' UserName string `json:"user_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *WarehouseAccessControlRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &warehouseAccessControlRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := warehouseAccessControlRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *WarehouseAccessControlRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st WarehouseAccessControlRequest) MarshalJSON() ([]byte, error) { - pb, err := warehouseAccessControlRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s WarehouseAccessControlRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type WarehouseAccessControlResponse struct { // All permissions. - // Wire name: 'all_permissions' AllPermissions []WarehousePermission `json:"all_permissions,omitempty"` // Display name of the user or service principal. - // Wire name: 'display_name' DisplayName string `json:"display_name,omitempty"` // name of the group - // Wire name: 'group_name' GroupName string `json:"group_name,omitempty"` // Name of the service principal. - // Wire name: 'service_principal_name' ServicePrincipalName string `json:"service_principal_name,omitempty"` // name of the user - // Wire name: 'user_name' UserName string `json:"user_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *WarehouseAccessControlResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &warehouseAccessControlResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := warehouseAccessControlResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *WarehouseAccessControlResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st WarehouseAccessControlResponse) MarshalJSON() ([]byte, error) { - pb, err := warehouseAccessControlResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s WarehouseAccessControlResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type WarehousePermission struct { - - // Wire name: 'inherited' Inherited bool `json:"inherited,omitempty"` - // Wire name: 'inherited_from_object' InheritedFromObject []string `json:"inherited_from_object,omitempty"` // Permission level - // Wire name: 'permission_level' PermissionLevel WarehousePermissionLevel `json:"permission_level,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *WarehousePermission) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &warehousePermissionPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := warehousePermissionFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *WarehousePermission) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st WarehousePermission) MarshalJSON() ([]byte, error) { - pb, err := warehousePermissionToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s WarehousePermission) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Permission level @@ -9677,148 +5836,61 @@ func (f *WarehousePermissionLevel) Type() string { } type WarehousePermissions struct { - - // Wire name: 'access_control_list' AccessControlList []WarehouseAccessControlResponse `json:"access_control_list,omitempty"` - // Wire name: 'object_id' ObjectId string `json:"object_id,omitempty"` - // Wire name: 'object_type' ObjectType string `json:"object_type,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *WarehousePermissions) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &warehousePermissionsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := warehousePermissionsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *WarehousePermissions) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st WarehousePermissions) MarshalJSON() ([]byte, error) { - pb, err := warehousePermissionsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s WarehousePermissions) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type WarehousePermissionsDescription struct { - - // Wire name: 'description' Description string `json:"description,omitempty"` // Permission level - // Wire name: 'permission_level' PermissionLevel WarehousePermissionLevel `json:"permission_level,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *WarehousePermissionsDescription) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &warehousePermissionsDescriptionPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := warehousePermissionsDescriptionFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *WarehousePermissionsDescription) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st WarehousePermissionsDescription) MarshalJSON() ([]byte, error) { - pb, err := warehousePermissionsDescriptionToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s WarehousePermissionsDescription) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type WarehousePermissionsRequest struct { - - // Wire name: 'access_control_list' AccessControlList []WarehouseAccessControlRequest `json:"access_control_list,omitempty"` // The SQL warehouse for which to get or manage permissions. - WarehouseId string `json:"-" tf:"-"` -} - -func (st *WarehousePermissionsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &warehousePermissionsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := warehousePermissionsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st WarehousePermissionsRequest) MarshalJSON() ([]byte, error) { - pb, err := warehousePermissionsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + WarehouseId string `json:"-" url:"-"` } type WarehouseTypePair struct { // If set to false the specific warehouse type will not be be allowed as a // value for warehouse_type in CreateWarehouse and EditWarehouse - // Wire name: 'enabled' Enabled bool `json:"enabled,omitempty"` // Warehouse type: `PRO` or `CLASSIC`. - // Wire name: 'warehouse_type' WarehouseType WarehouseTypePairWarehouseType `json:"warehouse_type,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *WarehouseTypePair) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &warehouseTypePairPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := warehouseTypePairFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *WarehouseTypePair) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st WarehouseTypePair) MarshalJSON() ([]byte, error) { - pb, err := warehouseTypePairToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s WarehouseTypePair) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Warehouse type: `PRO` or `CLASSIC`. @@ -9864,147 +5936,80 @@ func (f *WarehouseTypePairWarehouseType) Type() string { type Widget struct { // The unique ID for this widget. - // Wire name: 'id' Id string `json:"id,omitempty"` - // Wire name: 'options' Options *WidgetOptions `json:"options,omitempty"` // The visualization description API changes frequently and is unsupported. // You can duplicate a visualization by copying description objects received // _from the API_ and then using them to create a new one with a POST // request to the same endpoint. Databricks does not recommend constructing // ad-hoc visualizations entirely in JSON. - // Wire name: 'visualization' Visualization *LegacyVisualization `json:"visualization,omitempty"` // Unused field. - // Wire name: 'width' Width int `json:"width,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *Widget) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &widgetPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := widgetFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *Widget) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st Widget) MarshalJSON() ([]byte, error) { - pb, err := widgetToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s Widget) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type WidgetOptions struct { // Timestamp when this object was created - // Wire name: 'created_at' CreatedAt string `json:"created_at,omitempty"` // Custom description of the widget - // Wire name: 'description' Description string `json:"description,omitempty"` // Whether this widget is hidden on the dashboard. - // Wire name: 'isHidden' IsHidden bool `json:"isHidden,omitempty"` // How parameters used by the visualization in this widget relate to other // widgets on the dashboard. Databricks does not recommend modifying this // definition in JSON. - // Wire name: 'parameterMappings' ParameterMappings any `json:"parameterMappings,omitempty"` // Coordinates of this widget on a dashboard. This portion of the API // changes frequently and is unsupported. - // Wire name: 'position' Position *WidgetPosition `json:"position,omitempty"` // Custom title of the widget - // Wire name: 'title' Title string `json:"title,omitempty"` // Timestamp of the last time this object was updated. - // Wire name: 'updated_at' UpdatedAt string `json:"updated_at,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *WidgetOptions) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &widgetOptionsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := widgetOptionsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *WidgetOptions) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st WidgetOptions) MarshalJSON() ([]byte, error) { - pb, err := widgetOptionsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s WidgetOptions) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Coordinates of this widget on a dashboard. This portion of the API changes // frequently and is unsupported. type WidgetPosition struct { // reserved for internal use - // Wire name: 'autoHeight' AutoHeight bool `json:"autoHeight,omitempty"` // column in the dashboard grid. Values start with 0 - // Wire name: 'col' Col int `json:"col,omitempty"` // row in the dashboard grid. Values start with 0 - // Wire name: 'row' Row int `json:"row,omitempty"` // width of the widget measured in dashboard grid cells - // Wire name: 'sizeX' SizeX int `json:"sizeX,omitempty"` // height of the widget measured in dashboard grid cells - // Wire name: 'sizeY' SizeY int `json:"sizeY,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *WidgetPosition) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &widgetPositionPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := widgetPositionFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *WidgetPosition) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st WidgetPosition) MarshalJSON() ([]byte, error) { - pb, err := widgetPositionToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s WidgetPosition) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } diff --git a/service/vectorsearch/impl.go b/service/vectorsearch/impl.go index 840d6f6a7..057774168 100755 --- a/service/vectorsearch/impl.go +++ b/service/vectorsearch/impl.go @@ -18,96 +18,34 @@ type vectorSearchEndpointsImpl struct { } func (a *vectorSearchEndpointsImpl) CreateEndpoint(ctx context.Context, request CreateEndpoint) (*EndpointInfo, error) { - - requestPb, pbErr := createEndpointToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var endpointInfoPb endpointInfoPb + var endpointInfo EndpointInfo path := "/api/2.0/vector-search/endpoints" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &endpointInfoPb, - ) - if err != nil { - return nil, err - } - resp, err := endpointInfoFromPb(&endpointInfoPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &endpointInfo) + return &endpointInfo, err } func (a *vectorSearchEndpointsImpl) DeleteEndpoint(ctx context.Context, request DeleteEndpointRequest) error { - - requestPb, pbErr := deleteEndpointRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteEndpointResponsePb deleteEndpointResponsePb - path := fmt.Sprintf("/api/2.0/vector-search/endpoints/%v", requestPb.EndpointName) + var deleteEndpointResponse DeleteEndpointResponse + path := fmt.Sprintf("/api/2.0/vector-search/endpoints/%v", request.EndpointName) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteEndpointResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteEndpointResponse) return err } func (a *vectorSearchEndpointsImpl) GetEndpoint(ctx context.Context, request GetEndpointRequest) (*EndpointInfo, error) { - - requestPb, pbErr := getEndpointRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var endpointInfoPb endpointInfoPb - path := fmt.Sprintf("/api/2.0/vector-search/endpoints/%v", requestPb.EndpointName) + var endpointInfo EndpointInfo + path := fmt.Sprintf("/api/2.0/vector-search/endpoints/%v", request.EndpointName) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &endpointInfoPb, - ) - if err != nil { - return nil, err - } - resp, err := endpointInfoFromPb(&endpointInfoPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &endpointInfo) + return &endpointInfo, err } // List all vector search endpoints in the workspace. @@ -142,101 +80,35 @@ func (a *vectorSearchEndpointsImpl) ListEndpointsAll(ctx context.Context, reques } func (a *vectorSearchEndpointsImpl) internalListEndpoints(ctx context.Context, request ListEndpointsRequest) (*ListEndpointResponse, error) { - - requestPb, pbErr := listEndpointsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listEndpointResponsePb listEndpointResponsePb + var listEndpointResponse ListEndpointResponse path := "/api/2.0/vector-search/endpoints" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listEndpointResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listEndpointResponseFromPb(&listEndpointResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listEndpointResponse) + return &listEndpointResponse, err } func (a *vectorSearchEndpointsImpl) UpdateEndpointBudgetPolicy(ctx context.Context, request PatchEndpointBudgetPolicyRequest) (*PatchEndpointBudgetPolicyResponse, error) { - - requestPb, pbErr := patchEndpointBudgetPolicyRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var patchEndpointBudgetPolicyResponsePb patchEndpointBudgetPolicyResponsePb - path := fmt.Sprintf("/api/2.0/vector-search/endpoints/%v/budget-policy", requestPb.EndpointName) + var patchEndpointBudgetPolicyResponse PatchEndpointBudgetPolicyResponse + path := fmt.Sprintf("/api/2.0/vector-search/endpoints/%v/budget-policy", request.EndpointName) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &patchEndpointBudgetPolicyResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := patchEndpointBudgetPolicyResponseFromPb(&patchEndpointBudgetPolicyResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &patchEndpointBudgetPolicyResponse) + return &patchEndpointBudgetPolicyResponse, err } func (a *vectorSearchEndpointsImpl) UpdateEndpointCustomTags(ctx context.Context, request UpdateEndpointCustomTagsRequest) (*UpdateEndpointCustomTagsResponse, error) { - - requestPb, pbErr := updateEndpointCustomTagsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var updateEndpointCustomTagsResponsePb updateEndpointCustomTagsResponsePb - path := fmt.Sprintf("/api/2.0/vector-search/endpoints/%v/tags", requestPb.EndpointName) + var updateEndpointCustomTagsResponse UpdateEndpointCustomTagsResponse + path := fmt.Sprintf("/api/2.0/vector-search/endpoints/%v/tags", request.EndpointName) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &updateEndpointCustomTagsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := updateEndpointCustomTagsResponseFromPb(&updateEndpointCustomTagsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &updateEndpointCustomTagsResponse) + return &updateEndpointCustomTagsResponse, err } // unexported type that holds implementations of just VectorSearchIndexes API methods @@ -245,128 +117,44 @@ type vectorSearchIndexesImpl struct { } func (a *vectorSearchIndexesImpl) CreateIndex(ctx context.Context, request CreateVectorIndexRequest) (*VectorIndex, error) { - - requestPb, pbErr := createVectorIndexRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var vectorIndexPb vectorIndexPb + var vectorIndex VectorIndex path := "/api/2.0/vector-search/indexes" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &vectorIndexPb, - ) - if err != nil { - return nil, err - } - resp, err := vectorIndexFromPb(&vectorIndexPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &vectorIndex) + return &vectorIndex, err } func (a *vectorSearchIndexesImpl) DeleteDataVectorIndex(ctx context.Context, request DeleteDataVectorIndexRequest) (*DeleteDataVectorIndexResponse, error) { - - requestPb, pbErr := deleteDataVectorIndexRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var deleteDataVectorIndexResponsePb deleteDataVectorIndexResponsePb - path := fmt.Sprintf("/api/2.0/vector-search/indexes/%v/delete-data", requestPb.IndexName) + var deleteDataVectorIndexResponse DeleteDataVectorIndexResponse + path := fmt.Sprintf("/api/2.0/vector-search/indexes/%v/delete-data", request.IndexName) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteDataVectorIndexResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := deleteDataVectorIndexResponseFromPb(&deleteDataVectorIndexResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteDataVectorIndexResponse) + return &deleteDataVectorIndexResponse, err } func (a *vectorSearchIndexesImpl) DeleteIndex(ctx context.Context, request DeleteIndexRequest) error { - - requestPb, pbErr := deleteIndexRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteIndexResponsePb deleteIndexResponsePb - path := fmt.Sprintf("/api/2.0/vector-search/indexes/%v", requestPb.IndexName) + var deleteIndexResponse DeleteIndexResponse + path := fmt.Sprintf("/api/2.0/vector-search/indexes/%v", request.IndexName) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteIndexResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteIndexResponse) return err } func (a *vectorSearchIndexesImpl) GetIndex(ctx context.Context, request GetIndexRequest) (*VectorIndex, error) { - - requestPb, pbErr := getIndexRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var vectorIndexPb vectorIndexPb - path := fmt.Sprintf("/api/2.0/vector-search/indexes/%v", requestPb.IndexName) + var vectorIndex VectorIndex + path := fmt.Sprintf("/api/2.0/vector-search/indexes/%v", request.IndexName) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &vectorIndexPb, - ) - if err != nil { - return nil, err - } - resp, err := vectorIndexFromPb(&vectorIndexPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &vectorIndex) + return &vectorIndex, err } // List all indexes in the given endpoint. @@ -401,193 +189,65 @@ func (a *vectorSearchIndexesImpl) ListIndexesAll(ctx context.Context, request Li } func (a *vectorSearchIndexesImpl) internalListIndexes(ctx context.Context, request ListIndexesRequest) (*ListVectorIndexesResponse, error) { - - requestPb, pbErr := listIndexesRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listVectorIndexesResponsePb listVectorIndexesResponsePb + var listVectorIndexesResponse ListVectorIndexesResponse path := "/api/2.0/vector-search/indexes" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listVectorIndexesResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listVectorIndexesResponseFromPb(&listVectorIndexesResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listVectorIndexesResponse) + return &listVectorIndexesResponse, err } func (a *vectorSearchIndexesImpl) QueryIndex(ctx context.Context, request QueryVectorIndexRequest) (*QueryVectorIndexResponse, error) { - - requestPb, pbErr := queryVectorIndexRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var queryVectorIndexResponsePb queryVectorIndexResponsePb - path := fmt.Sprintf("/api/2.0/vector-search/indexes/%v/query", requestPb.IndexName) + var queryVectorIndexResponse QueryVectorIndexResponse + path := fmt.Sprintf("/api/2.0/vector-search/indexes/%v/query", request.IndexName) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &queryVectorIndexResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := queryVectorIndexResponseFromPb(&queryVectorIndexResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &queryVectorIndexResponse) + return &queryVectorIndexResponse, err } func (a *vectorSearchIndexesImpl) QueryNextPage(ctx context.Context, request QueryVectorIndexNextPageRequest) (*QueryVectorIndexResponse, error) { - - requestPb, pbErr := queryVectorIndexNextPageRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var queryVectorIndexResponsePb queryVectorIndexResponsePb - path := fmt.Sprintf("/api/2.0/vector-search/indexes/%v/query-next-page", requestPb.IndexName) + var queryVectorIndexResponse QueryVectorIndexResponse + path := fmt.Sprintf("/api/2.0/vector-search/indexes/%v/query-next-page", request.IndexName) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &queryVectorIndexResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := queryVectorIndexResponseFromPb(&queryVectorIndexResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &queryVectorIndexResponse) + return &queryVectorIndexResponse, err } func (a *vectorSearchIndexesImpl) ScanIndex(ctx context.Context, request ScanVectorIndexRequest) (*ScanVectorIndexResponse, error) { - - requestPb, pbErr := scanVectorIndexRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var scanVectorIndexResponsePb scanVectorIndexResponsePb - path := fmt.Sprintf("/api/2.0/vector-search/indexes/%v/scan", requestPb.IndexName) + var scanVectorIndexResponse ScanVectorIndexResponse + path := fmt.Sprintf("/api/2.0/vector-search/indexes/%v/scan", request.IndexName) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &scanVectorIndexResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := scanVectorIndexResponseFromPb(&scanVectorIndexResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &scanVectorIndexResponse) + return &scanVectorIndexResponse, err } func (a *vectorSearchIndexesImpl) SyncIndex(ctx context.Context, request SyncIndexRequest) error { - - requestPb, pbErr := syncIndexRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var syncIndexResponsePb syncIndexResponsePb - path := fmt.Sprintf("/api/2.0/vector-search/indexes/%v/sync", requestPb.IndexName) + var syncIndexResponse SyncIndexResponse + path := fmt.Sprintf("/api/2.0/vector-search/indexes/%v/sync", request.IndexName) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - nil, - &syncIndexResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, nil, &syncIndexResponse) return err } func (a *vectorSearchIndexesImpl) UpsertDataVectorIndex(ctx context.Context, request UpsertDataVectorIndexRequest) (*UpsertDataVectorIndexResponse, error) { - - requestPb, pbErr := upsertDataVectorIndexRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var upsertDataVectorIndexResponsePb upsertDataVectorIndexResponsePb - path := fmt.Sprintf("/api/2.0/vector-search/indexes/%v/upsert-data", requestPb.IndexName) + var upsertDataVectorIndexResponse UpsertDataVectorIndexResponse + path := fmt.Sprintf("/api/2.0/vector-search/indexes/%v/upsert-data", request.IndexName) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &upsertDataVectorIndexResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := upsertDataVectorIndexResponseFromPb(&upsertDataVectorIndexResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &upsertDataVectorIndexResponse) + return &upsertDataVectorIndexResponse, err } diff --git a/service/vectorsearch/internal.go b/service/vectorsearch/internal.go deleted file mode 100755 index 4f76d60f2..000000000 --- a/service/vectorsearch/internal.go +++ /dev/null @@ -1,1787 +0,0 @@ -// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. - -package vectorsearch - -import ( - "fmt" - "strings" - "time" - - "github.com/databricks/databricks-sdk-go/marshal" -) - -func columnInfoToPb(st *ColumnInfo) (*columnInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &columnInfoPb{} - pb.Name = st.Name - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type columnInfoPb struct { - Name string `json:"name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func columnInfoFromPb(pb *columnInfoPb) (*ColumnInfo, error) { - if pb == nil { - return nil, nil - } - st := &ColumnInfo{} - st.Name = pb.Name - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *columnInfoPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st columnInfoPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createEndpointToPb(st *CreateEndpoint) (*createEndpointPb, error) { - if st == nil { - return nil, nil - } - pb := &createEndpointPb{} - pb.BudgetPolicyId = st.BudgetPolicyId - pb.EndpointType = st.EndpointType - pb.Name = st.Name - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createEndpointPb struct { - BudgetPolicyId string `json:"budget_policy_id,omitempty"` - EndpointType EndpointType `json:"endpoint_type"` - Name string `json:"name"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createEndpointFromPb(pb *createEndpointPb) (*CreateEndpoint, error) { - if pb == nil { - return nil, nil - } - st := &CreateEndpoint{} - st.BudgetPolicyId = pb.BudgetPolicyId - st.EndpointType = pb.EndpointType - st.Name = pb.Name - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createEndpointPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createEndpointPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createVectorIndexRequestToPb(st *CreateVectorIndexRequest) (*createVectorIndexRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &createVectorIndexRequestPb{} - pb.DeltaSyncIndexSpec = st.DeltaSyncIndexSpec - pb.DirectAccessIndexSpec = st.DirectAccessIndexSpec - pb.EndpointName = st.EndpointName - pb.IndexType = st.IndexType - pb.Name = st.Name - pb.PrimaryKey = st.PrimaryKey - - return pb, nil -} - -type createVectorIndexRequestPb struct { - DeltaSyncIndexSpec *DeltaSyncVectorIndexSpecRequest `json:"delta_sync_index_spec,omitempty"` - DirectAccessIndexSpec *DirectAccessVectorIndexSpec `json:"direct_access_index_spec,omitempty"` - EndpointName string `json:"endpoint_name"` - IndexType VectorIndexType `json:"index_type"` - Name string `json:"name"` - PrimaryKey string `json:"primary_key"` -} - -func createVectorIndexRequestFromPb(pb *createVectorIndexRequestPb) (*CreateVectorIndexRequest, error) { - if pb == nil { - return nil, nil - } - st := &CreateVectorIndexRequest{} - st.DeltaSyncIndexSpec = pb.DeltaSyncIndexSpec - st.DirectAccessIndexSpec = pb.DirectAccessIndexSpec - st.EndpointName = pb.EndpointName - st.IndexType = pb.IndexType - st.Name = pb.Name - st.PrimaryKey = pb.PrimaryKey - - return st, nil -} - -func customTagToPb(st *CustomTag) (*customTagPb, error) { - if st == nil { - return nil, nil - } - pb := &customTagPb{} - pb.Key = st.Key - pb.Value = st.Value - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type customTagPb struct { - Key string `json:"key"` - Value string `json:"value,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func customTagFromPb(pb *customTagPb) (*CustomTag, error) { - if pb == nil { - return nil, nil - } - st := &CustomTag{} - st.Key = pb.Key - st.Value = pb.Value - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *customTagPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st customTagPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func deleteDataResultToPb(st *DeleteDataResult) (*deleteDataResultPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteDataResultPb{} - pb.FailedPrimaryKeys = st.FailedPrimaryKeys - pb.SuccessRowCount = st.SuccessRowCount - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type deleteDataResultPb struct { - FailedPrimaryKeys []string `json:"failed_primary_keys,omitempty"` - SuccessRowCount int64 `json:"success_row_count,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func deleteDataResultFromPb(pb *deleteDataResultPb) (*DeleteDataResult, error) { - if pb == nil { - return nil, nil - } - st := &DeleteDataResult{} - st.FailedPrimaryKeys = pb.FailedPrimaryKeys - st.SuccessRowCount = pb.SuccessRowCount - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *deleteDataResultPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st deleteDataResultPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func deleteDataVectorIndexRequestToPb(st *DeleteDataVectorIndexRequest) (*deleteDataVectorIndexRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteDataVectorIndexRequestPb{} - pb.IndexName = st.IndexName - pb.PrimaryKeys = st.PrimaryKeys - - return pb, nil -} - -type deleteDataVectorIndexRequestPb struct { - IndexName string `json:"-" url:"-"` - PrimaryKeys []string `json:"-" url:"primary_keys"` -} - -func deleteDataVectorIndexRequestFromPb(pb *deleteDataVectorIndexRequestPb) (*DeleteDataVectorIndexRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteDataVectorIndexRequest{} - st.IndexName = pb.IndexName - st.PrimaryKeys = pb.PrimaryKeys - - return st, nil -} - -func deleteDataVectorIndexResponseToPb(st *DeleteDataVectorIndexResponse) (*deleteDataVectorIndexResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteDataVectorIndexResponsePb{} - pb.Result = st.Result - pb.Status = st.Status - - return pb, nil -} - -type deleteDataVectorIndexResponsePb struct { - Result *DeleteDataResult `json:"result,omitempty"` - Status DeleteDataStatus `json:"status,omitempty"` -} - -func deleteDataVectorIndexResponseFromPb(pb *deleteDataVectorIndexResponsePb) (*DeleteDataVectorIndexResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteDataVectorIndexResponse{} - st.Result = pb.Result - st.Status = pb.Status - - return st, nil -} - -func deleteEndpointRequestToPb(st *DeleteEndpointRequest) (*deleteEndpointRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteEndpointRequestPb{} - pb.EndpointName = st.EndpointName - - return pb, nil -} - -type deleteEndpointRequestPb struct { - EndpointName string `json:"-" url:"-"` -} - -func deleteEndpointRequestFromPb(pb *deleteEndpointRequestPb) (*DeleteEndpointRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteEndpointRequest{} - st.EndpointName = pb.EndpointName - - return st, nil -} - -func deleteEndpointResponseToPb(st *DeleteEndpointResponse) (*deleteEndpointResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteEndpointResponsePb{} - - return pb, nil -} - -type deleteEndpointResponsePb struct { -} - -func deleteEndpointResponseFromPb(pb *deleteEndpointResponsePb) (*DeleteEndpointResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteEndpointResponse{} - - return st, nil -} - -func deleteIndexRequestToPb(st *DeleteIndexRequest) (*deleteIndexRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteIndexRequestPb{} - pb.IndexName = st.IndexName - - return pb, nil -} - -type deleteIndexRequestPb struct { - IndexName string `json:"-" url:"-"` -} - -func deleteIndexRequestFromPb(pb *deleteIndexRequestPb) (*DeleteIndexRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteIndexRequest{} - st.IndexName = pb.IndexName - - return st, nil -} - -func deleteIndexResponseToPb(st *DeleteIndexResponse) (*deleteIndexResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteIndexResponsePb{} - - return pb, nil -} - -type deleteIndexResponsePb struct { -} - -func deleteIndexResponseFromPb(pb *deleteIndexResponsePb) (*DeleteIndexResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteIndexResponse{} - - return st, nil -} - -func deltaSyncVectorIndexSpecRequestToPb(st *DeltaSyncVectorIndexSpecRequest) (*deltaSyncVectorIndexSpecRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deltaSyncVectorIndexSpecRequestPb{} - pb.ColumnsToSync = st.ColumnsToSync - pb.EmbeddingSourceColumns = st.EmbeddingSourceColumns - pb.EmbeddingVectorColumns = st.EmbeddingVectorColumns - pb.EmbeddingWritebackTable = st.EmbeddingWritebackTable - pb.PipelineType = st.PipelineType - pb.SourceTable = st.SourceTable - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type deltaSyncVectorIndexSpecRequestPb struct { - ColumnsToSync []string `json:"columns_to_sync,omitempty"` - EmbeddingSourceColumns []EmbeddingSourceColumn `json:"embedding_source_columns,omitempty"` - EmbeddingVectorColumns []EmbeddingVectorColumn `json:"embedding_vector_columns,omitempty"` - EmbeddingWritebackTable string `json:"embedding_writeback_table,omitempty"` - PipelineType PipelineType `json:"pipeline_type,omitempty"` - SourceTable string `json:"source_table,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func deltaSyncVectorIndexSpecRequestFromPb(pb *deltaSyncVectorIndexSpecRequestPb) (*DeltaSyncVectorIndexSpecRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeltaSyncVectorIndexSpecRequest{} - st.ColumnsToSync = pb.ColumnsToSync - st.EmbeddingSourceColumns = pb.EmbeddingSourceColumns - st.EmbeddingVectorColumns = pb.EmbeddingVectorColumns - st.EmbeddingWritebackTable = pb.EmbeddingWritebackTable - st.PipelineType = pb.PipelineType - st.SourceTable = pb.SourceTable - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *deltaSyncVectorIndexSpecRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st deltaSyncVectorIndexSpecRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func deltaSyncVectorIndexSpecResponseToPb(st *DeltaSyncVectorIndexSpecResponse) (*deltaSyncVectorIndexSpecResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deltaSyncVectorIndexSpecResponsePb{} - pb.EmbeddingSourceColumns = st.EmbeddingSourceColumns - pb.EmbeddingVectorColumns = st.EmbeddingVectorColumns - pb.EmbeddingWritebackTable = st.EmbeddingWritebackTable - pb.PipelineId = st.PipelineId - pb.PipelineType = st.PipelineType - pb.SourceTable = st.SourceTable - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type deltaSyncVectorIndexSpecResponsePb struct { - EmbeddingSourceColumns []EmbeddingSourceColumn `json:"embedding_source_columns,omitempty"` - EmbeddingVectorColumns []EmbeddingVectorColumn `json:"embedding_vector_columns,omitempty"` - EmbeddingWritebackTable string `json:"embedding_writeback_table,omitempty"` - PipelineId string `json:"pipeline_id,omitempty"` - PipelineType PipelineType `json:"pipeline_type,omitempty"` - SourceTable string `json:"source_table,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func deltaSyncVectorIndexSpecResponseFromPb(pb *deltaSyncVectorIndexSpecResponsePb) (*DeltaSyncVectorIndexSpecResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeltaSyncVectorIndexSpecResponse{} - st.EmbeddingSourceColumns = pb.EmbeddingSourceColumns - st.EmbeddingVectorColumns = pb.EmbeddingVectorColumns - st.EmbeddingWritebackTable = pb.EmbeddingWritebackTable - st.PipelineId = pb.PipelineId - st.PipelineType = pb.PipelineType - st.SourceTable = pb.SourceTable - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *deltaSyncVectorIndexSpecResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st deltaSyncVectorIndexSpecResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func directAccessVectorIndexSpecToPb(st *DirectAccessVectorIndexSpec) (*directAccessVectorIndexSpecPb, error) { - if st == nil { - return nil, nil - } - pb := &directAccessVectorIndexSpecPb{} - pb.EmbeddingSourceColumns = st.EmbeddingSourceColumns - pb.EmbeddingVectorColumns = st.EmbeddingVectorColumns - pb.SchemaJson = st.SchemaJson - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type directAccessVectorIndexSpecPb struct { - EmbeddingSourceColumns []EmbeddingSourceColumn `json:"embedding_source_columns,omitempty"` - EmbeddingVectorColumns []EmbeddingVectorColumn `json:"embedding_vector_columns,omitempty"` - SchemaJson string `json:"schema_json,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func directAccessVectorIndexSpecFromPb(pb *directAccessVectorIndexSpecPb) (*DirectAccessVectorIndexSpec, error) { - if pb == nil { - return nil, nil - } - st := &DirectAccessVectorIndexSpec{} - st.EmbeddingSourceColumns = pb.EmbeddingSourceColumns - st.EmbeddingVectorColumns = pb.EmbeddingVectorColumns - st.SchemaJson = pb.SchemaJson - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *directAccessVectorIndexSpecPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st directAccessVectorIndexSpecPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func embeddingSourceColumnToPb(st *EmbeddingSourceColumn) (*embeddingSourceColumnPb, error) { - if st == nil { - return nil, nil - } - pb := &embeddingSourceColumnPb{} - pb.EmbeddingModelEndpointName = st.EmbeddingModelEndpointName - pb.Name = st.Name - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type embeddingSourceColumnPb struct { - EmbeddingModelEndpointName string `json:"embedding_model_endpoint_name,omitempty"` - Name string `json:"name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func embeddingSourceColumnFromPb(pb *embeddingSourceColumnPb) (*EmbeddingSourceColumn, error) { - if pb == nil { - return nil, nil - } - st := &EmbeddingSourceColumn{} - st.EmbeddingModelEndpointName = pb.EmbeddingModelEndpointName - st.Name = pb.Name - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *embeddingSourceColumnPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st embeddingSourceColumnPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func embeddingVectorColumnToPb(st *EmbeddingVectorColumn) (*embeddingVectorColumnPb, error) { - if st == nil { - return nil, nil - } - pb := &embeddingVectorColumnPb{} - pb.EmbeddingDimension = st.EmbeddingDimension - pb.Name = st.Name - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type embeddingVectorColumnPb struct { - EmbeddingDimension int `json:"embedding_dimension,omitempty"` - Name string `json:"name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func embeddingVectorColumnFromPb(pb *embeddingVectorColumnPb) (*EmbeddingVectorColumn, error) { - if pb == nil { - return nil, nil - } - st := &EmbeddingVectorColumn{} - st.EmbeddingDimension = pb.EmbeddingDimension - st.Name = pb.Name - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *embeddingVectorColumnPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st embeddingVectorColumnPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func endpointInfoToPb(st *EndpointInfo) (*endpointInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &endpointInfoPb{} - pb.CreationTimestamp = st.CreationTimestamp - pb.Creator = st.Creator - pb.CustomTags = st.CustomTags - pb.EffectiveBudgetPolicyId = st.EffectiveBudgetPolicyId - pb.EndpointStatus = st.EndpointStatus - pb.EndpointType = st.EndpointType - pb.Id = st.Id - pb.LastUpdatedTimestamp = st.LastUpdatedTimestamp - pb.LastUpdatedUser = st.LastUpdatedUser - pb.Name = st.Name - pb.NumIndexes = st.NumIndexes - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type endpointInfoPb struct { - CreationTimestamp int64 `json:"creation_timestamp,omitempty"` - Creator string `json:"creator,omitempty"` - CustomTags []CustomTag `json:"custom_tags,omitempty"` - EffectiveBudgetPolicyId string `json:"effective_budget_policy_id,omitempty"` - EndpointStatus *EndpointStatus `json:"endpoint_status,omitempty"` - EndpointType EndpointType `json:"endpoint_type,omitempty"` - Id string `json:"id,omitempty"` - LastUpdatedTimestamp int64 `json:"last_updated_timestamp,omitempty"` - LastUpdatedUser string `json:"last_updated_user,omitempty"` - Name string `json:"name,omitempty"` - NumIndexes int `json:"num_indexes,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func endpointInfoFromPb(pb *endpointInfoPb) (*EndpointInfo, error) { - if pb == nil { - return nil, nil - } - st := &EndpointInfo{} - st.CreationTimestamp = pb.CreationTimestamp - st.Creator = pb.Creator - st.CustomTags = pb.CustomTags - st.EffectiveBudgetPolicyId = pb.EffectiveBudgetPolicyId - st.EndpointStatus = pb.EndpointStatus - st.EndpointType = pb.EndpointType - st.Id = pb.Id - st.LastUpdatedTimestamp = pb.LastUpdatedTimestamp - st.LastUpdatedUser = pb.LastUpdatedUser - st.Name = pb.Name - st.NumIndexes = pb.NumIndexes - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *endpointInfoPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st endpointInfoPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func endpointStatusToPb(st *EndpointStatus) (*endpointStatusPb, error) { - if st == nil { - return nil, nil - } - pb := &endpointStatusPb{} - pb.Message = st.Message - pb.State = st.State - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type endpointStatusPb struct { - Message string `json:"message,omitempty"` - State EndpointStatusState `json:"state,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func endpointStatusFromPb(pb *endpointStatusPb) (*EndpointStatus, error) { - if pb == nil { - return nil, nil - } - st := &EndpointStatus{} - st.Message = pb.Message - st.State = pb.State - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *endpointStatusPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st endpointStatusPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getEndpointRequestToPb(st *GetEndpointRequest) (*getEndpointRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getEndpointRequestPb{} - pb.EndpointName = st.EndpointName - - return pb, nil -} - -type getEndpointRequestPb struct { - EndpointName string `json:"-" url:"-"` -} - -func getEndpointRequestFromPb(pb *getEndpointRequestPb) (*GetEndpointRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetEndpointRequest{} - st.EndpointName = pb.EndpointName - - return st, nil -} - -func getIndexRequestToPb(st *GetIndexRequest) (*getIndexRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getIndexRequestPb{} - pb.IndexName = st.IndexName - - return pb, nil -} - -type getIndexRequestPb struct { - IndexName string `json:"-" url:"-"` -} - -func getIndexRequestFromPb(pb *getIndexRequestPb) (*GetIndexRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetIndexRequest{} - st.IndexName = pb.IndexName - - return st, nil -} - -func listEndpointResponseToPb(st *ListEndpointResponse) (*listEndpointResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listEndpointResponsePb{} - pb.Endpoints = st.Endpoints - pb.NextPageToken = st.NextPageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listEndpointResponsePb struct { - Endpoints []EndpointInfo `json:"endpoints,omitempty"` - NextPageToken string `json:"next_page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listEndpointResponseFromPb(pb *listEndpointResponsePb) (*ListEndpointResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListEndpointResponse{} - st.Endpoints = pb.Endpoints - st.NextPageToken = pb.NextPageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listEndpointResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listEndpointResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listEndpointsRequestToPb(st *ListEndpointsRequest) (*listEndpointsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listEndpointsRequestPb{} - pb.PageToken = st.PageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listEndpointsRequestPb struct { - PageToken string `json:"-" url:"page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listEndpointsRequestFromPb(pb *listEndpointsRequestPb) (*ListEndpointsRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListEndpointsRequest{} - st.PageToken = pb.PageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listEndpointsRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listEndpointsRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listIndexesRequestToPb(st *ListIndexesRequest) (*listIndexesRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listIndexesRequestPb{} - pb.EndpointName = st.EndpointName - pb.PageToken = st.PageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listIndexesRequestPb struct { - EndpointName string `json:"-" url:"endpoint_name"` - PageToken string `json:"-" url:"page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listIndexesRequestFromPb(pb *listIndexesRequestPb) (*ListIndexesRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListIndexesRequest{} - st.EndpointName = pb.EndpointName - st.PageToken = pb.PageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listIndexesRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listIndexesRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listValueToPb(st *ListValue) (*listValuePb, error) { - if st == nil { - return nil, nil - } - pb := &listValuePb{} - pb.Values = st.Values - - return pb, nil -} - -type listValuePb struct { - Values []Value `json:"values,omitempty"` -} - -func listValueFromPb(pb *listValuePb) (*ListValue, error) { - if pb == nil { - return nil, nil - } - st := &ListValue{} - st.Values = pb.Values - - return st, nil -} - -func listVectorIndexesResponseToPb(st *ListVectorIndexesResponse) (*listVectorIndexesResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listVectorIndexesResponsePb{} - pb.NextPageToken = st.NextPageToken - pb.VectorIndexes = st.VectorIndexes - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listVectorIndexesResponsePb struct { - NextPageToken string `json:"next_page_token,omitempty"` - VectorIndexes []MiniVectorIndex `json:"vector_indexes,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listVectorIndexesResponseFromPb(pb *listVectorIndexesResponsePb) (*ListVectorIndexesResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListVectorIndexesResponse{} - st.NextPageToken = pb.NextPageToken - st.VectorIndexes = pb.VectorIndexes - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listVectorIndexesResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listVectorIndexesResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func mapStringValueEntryToPb(st *MapStringValueEntry) (*mapStringValueEntryPb, error) { - if st == nil { - return nil, nil - } - pb := &mapStringValueEntryPb{} - pb.Key = st.Key - pb.Value = st.Value - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type mapStringValueEntryPb struct { - Key string `json:"key,omitempty"` - Value *Value `json:"value,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func mapStringValueEntryFromPb(pb *mapStringValueEntryPb) (*MapStringValueEntry, error) { - if pb == nil { - return nil, nil - } - st := &MapStringValueEntry{} - st.Key = pb.Key - st.Value = pb.Value - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *mapStringValueEntryPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st mapStringValueEntryPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func miniVectorIndexToPb(st *MiniVectorIndex) (*miniVectorIndexPb, error) { - if st == nil { - return nil, nil - } - pb := &miniVectorIndexPb{} - pb.Creator = st.Creator - pb.EndpointName = st.EndpointName - pb.IndexType = st.IndexType - pb.Name = st.Name - pb.PrimaryKey = st.PrimaryKey - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type miniVectorIndexPb struct { - Creator string `json:"creator,omitempty"` - EndpointName string `json:"endpoint_name,omitempty"` - IndexType VectorIndexType `json:"index_type,omitempty"` - Name string `json:"name,omitempty"` - PrimaryKey string `json:"primary_key,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func miniVectorIndexFromPb(pb *miniVectorIndexPb) (*MiniVectorIndex, error) { - if pb == nil { - return nil, nil - } - st := &MiniVectorIndex{} - st.Creator = pb.Creator - st.EndpointName = pb.EndpointName - st.IndexType = pb.IndexType - st.Name = pb.Name - st.PrimaryKey = pb.PrimaryKey - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *miniVectorIndexPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st miniVectorIndexPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func patchEndpointBudgetPolicyRequestToPb(st *PatchEndpointBudgetPolicyRequest) (*patchEndpointBudgetPolicyRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &patchEndpointBudgetPolicyRequestPb{} - pb.BudgetPolicyId = st.BudgetPolicyId - pb.EndpointName = st.EndpointName - - return pb, nil -} - -type patchEndpointBudgetPolicyRequestPb struct { - BudgetPolicyId string `json:"budget_policy_id"` - EndpointName string `json:"-" url:"-"` -} - -func patchEndpointBudgetPolicyRequestFromPb(pb *patchEndpointBudgetPolicyRequestPb) (*PatchEndpointBudgetPolicyRequest, error) { - if pb == nil { - return nil, nil - } - st := &PatchEndpointBudgetPolicyRequest{} - st.BudgetPolicyId = pb.BudgetPolicyId - st.EndpointName = pb.EndpointName - - return st, nil -} - -func patchEndpointBudgetPolicyResponseToPb(st *PatchEndpointBudgetPolicyResponse) (*patchEndpointBudgetPolicyResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &patchEndpointBudgetPolicyResponsePb{} - pb.EffectiveBudgetPolicyId = st.EffectiveBudgetPolicyId - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type patchEndpointBudgetPolicyResponsePb struct { - EffectiveBudgetPolicyId string `json:"effective_budget_policy_id,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func patchEndpointBudgetPolicyResponseFromPb(pb *patchEndpointBudgetPolicyResponsePb) (*PatchEndpointBudgetPolicyResponse, error) { - if pb == nil { - return nil, nil - } - st := &PatchEndpointBudgetPolicyResponse{} - st.EffectiveBudgetPolicyId = pb.EffectiveBudgetPolicyId - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *patchEndpointBudgetPolicyResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st patchEndpointBudgetPolicyResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func queryVectorIndexNextPageRequestToPb(st *QueryVectorIndexNextPageRequest) (*queryVectorIndexNextPageRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &queryVectorIndexNextPageRequestPb{} - pb.EndpointName = st.EndpointName - pb.IndexName = st.IndexName - pb.PageToken = st.PageToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type queryVectorIndexNextPageRequestPb struct { - EndpointName string `json:"endpoint_name,omitempty"` - IndexName string `json:"-" url:"-"` - PageToken string `json:"page_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func queryVectorIndexNextPageRequestFromPb(pb *queryVectorIndexNextPageRequestPb) (*QueryVectorIndexNextPageRequest, error) { - if pb == nil { - return nil, nil - } - st := &QueryVectorIndexNextPageRequest{} - st.EndpointName = pb.EndpointName - st.IndexName = pb.IndexName - st.PageToken = pb.PageToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *queryVectorIndexNextPageRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st queryVectorIndexNextPageRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func queryVectorIndexRequestToPb(st *QueryVectorIndexRequest) (*queryVectorIndexRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &queryVectorIndexRequestPb{} - pb.Columns = st.Columns - pb.ColumnsToRerank = st.ColumnsToRerank - pb.FiltersJson = st.FiltersJson - pb.IndexName = st.IndexName - pb.NumResults = st.NumResults - pb.QueryText = st.QueryText - pb.QueryType = st.QueryType - pb.QueryVector = st.QueryVector - pb.ScoreThreshold = st.ScoreThreshold - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type queryVectorIndexRequestPb struct { - Columns []string `json:"columns"` - ColumnsToRerank []string `json:"columns_to_rerank,omitempty"` - FiltersJson string `json:"filters_json,omitempty"` - IndexName string `json:"-" url:"-"` - NumResults int `json:"num_results,omitempty"` - QueryText string `json:"query_text,omitempty"` - QueryType string `json:"query_type,omitempty"` - QueryVector []float64 `json:"query_vector,omitempty"` - ScoreThreshold float64 `json:"score_threshold,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func queryVectorIndexRequestFromPb(pb *queryVectorIndexRequestPb) (*QueryVectorIndexRequest, error) { - if pb == nil { - return nil, nil - } - st := &QueryVectorIndexRequest{} - st.Columns = pb.Columns - st.ColumnsToRerank = pb.ColumnsToRerank - st.FiltersJson = pb.FiltersJson - st.IndexName = pb.IndexName - st.NumResults = pb.NumResults - st.QueryText = pb.QueryText - st.QueryType = pb.QueryType - st.QueryVector = pb.QueryVector - st.ScoreThreshold = pb.ScoreThreshold - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *queryVectorIndexRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st queryVectorIndexRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func queryVectorIndexResponseToPb(st *QueryVectorIndexResponse) (*queryVectorIndexResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &queryVectorIndexResponsePb{} - pb.Manifest = st.Manifest - pb.NextPageToken = st.NextPageToken - pb.Result = st.Result - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type queryVectorIndexResponsePb struct { - Manifest *ResultManifest `json:"manifest,omitempty"` - NextPageToken string `json:"next_page_token,omitempty"` - Result *ResultData `json:"result,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func queryVectorIndexResponseFromPb(pb *queryVectorIndexResponsePb) (*QueryVectorIndexResponse, error) { - if pb == nil { - return nil, nil - } - st := &QueryVectorIndexResponse{} - st.Manifest = pb.Manifest - st.NextPageToken = pb.NextPageToken - st.Result = pb.Result - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *queryVectorIndexResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st queryVectorIndexResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func resultDataToPb(st *ResultData) (*resultDataPb, error) { - if st == nil { - return nil, nil - } - pb := &resultDataPb{} - pb.DataArray = st.DataArray - pb.RowCount = st.RowCount - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type resultDataPb struct { - DataArray [][]string `json:"data_array,omitempty"` - RowCount int `json:"row_count,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func resultDataFromPb(pb *resultDataPb) (*ResultData, error) { - if pb == nil { - return nil, nil - } - st := &ResultData{} - st.DataArray = pb.DataArray - st.RowCount = pb.RowCount - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *resultDataPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st resultDataPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func resultManifestToPb(st *ResultManifest) (*resultManifestPb, error) { - if st == nil { - return nil, nil - } - pb := &resultManifestPb{} - pb.ColumnCount = st.ColumnCount - pb.Columns = st.Columns - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type resultManifestPb struct { - ColumnCount int `json:"column_count,omitempty"` - Columns []ColumnInfo `json:"columns,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func resultManifestFromPb(pb *resultManifestPb) (*ResultManifest, error) { - if pb == nil { - return nil, nil - } - st := &ResultManifest{} - st.ColumnCount = pb.ColumnCount - st.Columns = pb.Columns - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *resultManifestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st resultManifestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func scanVectorIndexRequestToPb(st *ScanVectorIndexRequest) (*scanVectorIndexRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &scanVectorIndexRequestPb{} - pb.IndexName = st.IndexName - pb.LastPrimaryKey = st.LastPrimaryKey - pb.NumResults = st.NumResults - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type scanVectorIndexRequestPb struct { - IndexName string `json:"-" url:"-"` - LastPrimaryKey string `json:"last_primary_key,omitempty"` - NumResults int `json:"num_results,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func scanVectorIndexRequestFromPb(pb *scanVectorIndexRequestPb) (*ScanVectorIndexRequest, error) { - if pb == nil { - return nil, nil - } - st := &ScanVectorIndexRequest{} - st.IndexName = pb.IndexName - st.LastPrimaryKey = pb.LastPrimaryKey - st.NumResults = pb.NumResults - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *scanVectorIndexRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st scanVectorIndexRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func scanVectorIndexResponseToPb(st *ScanVectorIndexResponse) (*scanVectorIndexResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &scanVectorIndexResponsePb{} - pb.Data = st.Data - pb.LastPrimaryKey = st.LastPrimaryKey - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type scanVectorIndexResponsePb struct { - Data []Struct `json:"data,omitempty"` - LastPrimaryKey string `json:"last_primary_key,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func scanVectorIndexResponseFromPb(pb *scanVectorIndexResponsePb) (*ScanVectorIndexResponse, error) { - if pb == nil { - return nil, nil - } - st := &ScanVectorIndexResponse{} - st.Data = pb.Data - st.LastPrimaryKey = pb.LastPrimaryKey - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *scanVectorIndexResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st scanVectorIndexResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func structToPb(st *Struct) (*structPb, error) { - if st == nil { - return nil, nil - } - pb := &structPb{} - pb.Fields = st.Fields - - return pb, nil -} - -type structPb struct { - Fields []MapStringValueEntry `json:"fields,omitempty"` -} - -func structFromPb(pb *structPb) (*Struct, error) { - if pb == nil { - return nil, nil - } - st := &Struct{} - st.Fields = pb.Fields - - return st, nil -} - -func syncIndexRequestToPb(st *SyncIndexRequest) (*syncIndexRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &syncIndexRequestPb{} - pb.IndexName = st.IndexName - - return pb, nil -} - -type syncIndexRequestPb struct { - IndexName string `json:"-" url:"-"` -} - -func syncIndexRequestFromPb(pb *syncIndexRequestPb) (*SyncIndexRequest, error) { - if pb == nil { - return nil, nil - } - st := &SyncIndexRequest{} - st.IndexName = pb.IndexName - - return st, nil -} - -func syncIndexResponseToPb(st *SyncIndexResponse) (*syncIndexResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &syncIndexResponsePb{} - - return pb, nil -} - -type syncIndexResponsePb struct { -} - -func syncIndexResponseFromPb(pb *syncIndexResponsePb) (*SyncIndexResponse, error) { - if pb == nil { - return nil, nil - } - st := &SyncIndexResponse{} - - return st, nil -} - -func updateEndpointCustomTagsRequestToPb(st *UpdateEndpointCustomTagsRequest) (*updateEndpointCustomTagsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &updateEndpointCustomTagsRequestPb{} - pb.CustomTags = st.CustomTags - pb.EndpointName = st.EndpointName - - return pb, nil -} - -type updateEndpointCustomTagsRequestPb struct { - CustomTags []CustomTag `json:"custom_tags"` - EndpointName string `json:"-" url:"-"` -} - -func updateEndpointCustomTagsRequestFromPb(pb *updateEndpointCustomTagsRequestPb) (*UpdateEndpointCustomTagsRequest, error) { - if pb == nil { - return nil, nil - } - st := &UpdateEndpointCustomTagsRequest{} - st.CustomTags = pb.CustomTags - st.EndpointName = pb.EndpointName - - return st, nil -} - -func updateEndpointCustomTagsResponseToPb(st *UpdateEndpointCustomTagsResponse) (*updateEndpointCustomTagsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &updateEndpointCustomTagsResponsePb{} - pb.CustomTags = st.CustomTags - pb.Name = st.Name - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type updateEndpointCustomTagsResponsePb struct { - CustomTags []CustomTag `json:"custom_tags,omitempty"` - Name string `json:"name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func updateEndpointCustomTagsResponseFromPb(pb *updateEndpointCustomTagsResponsePb) (*UpdateEndpointCustomTagsResponse, error) { - if pb == nil { - return nil, nil - } - st := &UpdateEndpointCustomTagsResponse{} - st.CustomTags = pb.CustomTags - st.Name = pb.Name - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *updateEndpointCustomTagsResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st updateEndpointCustomTagsResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func upsertDataResultToPb(st *UpsertDataResult) (*upsertDataResultPb, error) { - if st == nil { - return nil, nil - } - pb := &upsertDataResultPb{} - pb.FailedPrimaryKeys = st.FailedPrimaryKeys - pb.SuccessRowCount = st.SuccessRowCount - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type upsertDataResultPb struct { - FailedPrimaryKeys []string `json:"failed_primary_keys,omitempty"` - SuccessRowCount int64 `json:"success_row_count,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func upsertDataResultFromPb(pb *upsertDataResultPb) (*UpsertDataResult, error) { - if pb == nil { - return nil, nil - } - st := &UpsertDataResult{} - st.FailedPrimaryKeys = pb.FailedPrimaryKeys - st.SuccessRowCount = pb.SuccessRowCount - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *upsertDataResultPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st upsertDataResultPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func upsertDataVectorIndexRequestToPb(st *UpsertDataVectorIndexRequest) (*upsertDataVectorIndexRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &upsertDataVectorIndexRequestPb{} - pb.IndexName = st.IndexName - pb.InputsJson = st.InputsJson - - return pb, nil -} - -type upsertDataVectorIndexRequestPb struct { - IndexName string `json:"-" url:"-"` - InputsJson string `json:"inputs_json"` -} - -func upsertDataVectorIndexRequestFromPb(pb *upsertDataVectorIndexRequestPb) (*UpsertDataVectorIndexRequest, error) { - if pb == nil { - return nil, nil - } - st := &UpsertDataVectorIndexRequest{} - st.IndexName = pb.IndexName - st.InputsJson = pb.InputsJson - - return st, nil -} - -func upsertDataVectorIndexResponseToPb(st *UpsertDataVectorIndexResponse) (*upsertDataVectorIndexResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &upsertDataVectorIndexResponsePb{} - pb.Result = st.Result - pb.Status = st.Status - - return pb, nil -} - -type upsertDataVectorIndexResponsePb struct { - Result *UpsertDataResult `json:"result,omitempty"` - Status UpsertDataStatus `json:"status,omitempty"` -} - -func upsertDataVectorIndexResponseFromPb(pb *upsertDataVectorIndexResponsePb) (*UpsertDataVectorIndexResponse, error) { - if pb == nil { - return nil, nil - } - st := &UpsertDataVectorIndexResponse{} - st.Result = pb.Result - st.Status = pb.Status - - return st, nil -} - -func valueToPb(st *Value) (*valuePb, error) { - if st == nil { - return nil, nil - } - pb := &valuePb{} - pb.BoolValue = st.BoolValue - pb.ListValue = st.ListValue - pb.NumberValue = st.NumberValue - pb.StringValue = st.StringValue - pb.StructValue = st.StructValue - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type valuePb struct { - BoolValue bool `json:"bool_value,omitempty"` - ListValue *ListValue `json:"list_value,omitempty"` - NumberValue float64 `json:"number_value,omitempty"` - StringValue string `json:"string_value,omitempty"` - StructValue *Struct `json:"struct_value,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func valueFromPb(pb *valuePb) (*Value, error) { - if pb == nil { - return nil, nil - } - st := &Value{} - st.BoolValue = pb.BoolValue - st.ListValue = pb.ListValue - st.NumberValue = pb.NumberValue - st.StringValue = pb.StringValue - st.StructValue = pb.StructValue - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *valuePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st valuePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func vectorIndexToPb(st *VectorIndex) (*vectorIndexPb, error) { - if st == nil { - return nil, nil - } - pb := &vectorIndexPb{} - pb.Creator = st.Creator - pb.DeltaSyncIndexSpec = st.DeltaSyncIndexSpec - pb.DirectAccessIndexSpec = st.DirectAccessIndexSpec - pb.EndpointName = st.EndpointName - pb.IndexType = st.IndexType - pb.Name = st.Name - pb.PrimaryKey = st.PrimaryKey - pb.Status = st.Status - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type vectorIndexPb struct { - Creator string `json:"creator,omitempty"` - DeltaSyncIndexSpec *DeltaSyncVectorIndexSpecResponse `json:"delta_sync_index_spec,omitempty"` - DirectAccessIndexSpec *DirectAccessVectorIndexSpec `json:"direct_access_index_spec,omitempty"` - EndpointName string `json:"endpoint_name,omitempty"` - IndexType VectorIndexType `json:"index_type,omitempty"` - Name string `json:"name,omitempty"` - PrimaryKey string `json:"primary_key,omitempty"` - Status *VectorIndexStatus `json:"status,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func vectorIndexFromPb(pb *vectorIndexPb) (*VectorIndex, error) { - if pb == nil { - return nil, nil - } - st := &VectorIndex{} - st.Creator = pb.Creator - st.DeltaSyncIndexSpec = pb.DeltaSyncIndexSpec - st.DirectAccessIndexSpec = pb.DirectAccessIndexSpec - st.EndpointName = pb.EndpointName - st.IndexType = pb.IndexType - st.Name = pb.Name - st.PrimaryKey = pb.PrimaryKey - st.Status = pb.Status - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *vectorIndexPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st vectorIndexPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func vectorIndexStatusToPb(st *VectorIndexStatus) (*vectorIndexStatusPb, error) { - if st == nil { - return nil, nil - } - pb := &vectorIndexStatusPb{} - pb.IndexUrl = st.IndexUrl - pb.IndexedRowCount = st.IndexedRowCount - pb.Message = st.Message - pb.Ready = st.Ready - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type vectorIndexStatusPb struct { - IndexUrl string `json:"index_url,omitempty"` - IndexedRowCount int64 `json:"indexed_row_count,omitempty"` - Message string `json:"message,omitempty"` - Ready bool `json:"ready,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func vectorIndexStatusFromPb(pb *vectorIndexStatusPb) (*VectorIndexStatus, error) { - if pb == nil { - return nil, nil - } - st := &VectorIndexStatus{} - st.IndexUrl = pb.IndexUrl - st.IndexedRowCount = pb.IndexedRowCount - st.Message = pb.Message - st.Ready = pb.Ready - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *vectorIndexStatusPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st vectorIndexStatusPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func durationToPb(d *time.Duration) (*string, error) { - if d == nil { - return nil, nil - } - s := fmt.Sprintf("%.9fs", d.Seconds()) - return &s, nil -} - -func durationFromPb(s *string) (*time.Duration, error) { - if s == nil { - return nil, nil - } - d, err := time.ParseDuration(*s) - if err != nil { - return nil, err - } - return &d, nil -} - -func timestampToPb(t *time.Time) (*string, error) { - if t == nil { - return nil, nil - } - s := t.Format(time.RFC3339) - return &s, nil -} - -func timestampFromPb(s *string) (*time.Time, error) { - if s == nil { - return nil, nil - } - t, err := time.Parse(time.RFC3339, *s) - if err != nil { - return nil, err - } - return &t, nil -} - -func fieldMaskToPb(fm *[]string) (*string, error) { - if fm == nil { - return nil, nil - } - s := strings.Join(*fm, ",") - return &s, nil -} - -func fieldMaskFromPb(s *string) (*[]string, error) { - if s == nil { - return nil, nil - } - fm := strings.Split(*s, ",") - return &fm, nil -} diff --git a/service/vectorsearch/model.go b/service/vectorsearch/model.go index 28c700e2a..659691755 100755 --- a/service/vectorsearch/model.go +++ b/service/vectorsearch/model.go @@ -3,93 +3,53 @@ package vectorsearch import ( - "encoding/json" "fmt" + + "github.com/databricks/databricks-sdk-go/marshal" ) type ColumnInfo struct { // Name of the column. - // Wire name: 'name' Name string `json:"name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ColumnInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &columnInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := columnInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ColumnInfo) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ColumnInfo) MarshalJSON() ([]byte, error) { - pb, err := columnInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ColumnInfo) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreateEndpoint struct { // The budget policy id to be applied - // Wire name: 'budget_policy_id' BudgetPolicyId string `json:"budget_policy_id,omitempty"` // Type of endpoint - // Wire name: 'endpoint_type' EndpointType EndpointType `json:"endpoint_type"` // Name of the vector search endpoint - // Wire name: 'name' Name string `json:"name"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateEndpoint) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createEndpointPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createEndpointFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateEndpoint) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateEndpoint) MarshalJSON() ([]byte, error) { - pb, err := createEndpointToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateEndpoint) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreateVectorIndexRequest struct { // Specification for Delta Sync Index. Required if `index_type` is // `DELTA_SYNC`. - // Wire name: 'delta_sync_index_spec' DeltaSyncIndexSpec *DeltaSyncVectorIndexSpecRequest `json:"delta_sync_index_spec,omitempty"` // Specification for Direct Vector Access Index. Required if `index_type` is // `DIRECT_ACCESS`. - // Wire name: 'direct_access_index_spec' DirectAccessIndexSpec *DirectAccessVectorIndexSpec `json:"direct_access_index_spec,omitempty"` // Name of the endpoint to be used for serving the index - // Wire name: 'endpoint_name' EndpointName string `json:"endpoint_name"` // There are 2 types of Vector Search indexes: - `DELTA_SYNC`: An index that // automatically syncs with a source Delta Table, automatically and @@ -97,111 +57,45 @@ type CreateVectorIndexRequest struct { // Table changes. - `DIRECT_ACCESS`: An index that supports direct read and // write of vectors and metadata through our REST and SDK APIs. With this // model, the user manages index updates. - // Wire name: 'index_type' IndexType VectorIndexType `json:"index_type"` // Name of the index - // Wire name: 'name' Name string `json:"name"` // Primary key of the index - // Wire name: 'primary_key' PrimaryKey string `json:"primary_key"` } -func (st *CreateVectorIndexRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createVectorIndexRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createVectorIndexRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CreateVectorIndexRequest) MarshalJSON() ([]byte, error) { - pb, err := createVectorIndexRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type CustomTag struct { // Key field for a vector search endpoint tag. - // Wire name: 'key' Key string `json:"key"` // [Optional] Value field for a vector search endpoint tag. - // Wire name: 'value' Value string `json:"value,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CustomTag) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &customTagPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := customTagFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CustomTag) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CustomTag) MarshalJSON() ([]byte, error) { - pb, err := customTagToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CustomTag) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type DeleteDataResult struct { // List of primary keys for rows that failed to process. - // Wire name: 'failed_primary_keys' FailedPrimaryKeys []string `json:"failed_primary_keys,omitempty"` // Count of successfully processed rows. - // Wire name: 'success_row_count' SuccessRowCount int64 `json:"success_row_count,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DeleteDataResult) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteDataResultPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteDataResultFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DeleteDataResult) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DeleteDataResult) MarshalJSON() ([]byte, error) { - pb, err := deleteDataResultToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DeleteDataResult) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type DeleteDataStatus string @@ -248,204 +142,48 @@ func (f *DeleteDataStatus) Type() string { type DeleteDataVectorIndexRequest struct { // Name of the vector index where data is to be deleted. Must be a Direct // Vector Access Index. - IndexName string `json:"-" tf:"-"` + IndexName string `json:"-" url:"-"` // List of primary keys for the data to be deleted. - PrimaryKeys []string `json:"-" tf:"-"` -} - -func (st *DeleteDataVectorIndexRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteDataVectorIndexRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteDataVectorIndexRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteDataVectorIndexRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteDataVectorIndexRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + PrimaryKeys []string `json:"-" url:"primary_keys"` } type DeleteDataVectorIndexResponse struct { // Result of the upsert or delete operation. - // Wire name: 'result' Result *DeleteDataResult `json:"result,omitempty"` // Status of the delete operation. - // Wire name: 'status' Status DeleteDataStatus `json:"status,omitempty"` } -func (st *DeleteDataVectorIndexResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteDataVectorIndexResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteDataVectorIndexResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteDataVectorIndexResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteDataVectorIndexResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Delete an endpoint type DeleteEndpointRequest struct { // Name of the vector search endpoint - EndpointName string `json:"-" tf:"-"` -} - -func (st *DeleteEndpointRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteEndpointRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteEndpointRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteEndpointRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteEndpointRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + EndpointName string `json:"-" url:"-"` } type DeleteEndpointResponse struct { } -func (st *DeleteEndpointResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteEndpointResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteEndpointResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteEndpointResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteEndpointResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Delete an index type DeleteIndexRequest struct { // Name of the index - IndexName string `json:"-" tf:"-"` -} - -func (st *DeleteIndexRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteIndexRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteIndexRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteIndexRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteIndexRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + IndexName string `json:"-" url:"-"` } type DeleteIndexResponse struct { } -func (st *DeleteIndexResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteIndexResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteIndexResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteIndexResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteIndexResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type DeltaSyncVectorIndexSpecRequest struct { // [Optional] Select the columns to sync with the vector index. If you leave // this field blank, all columns from the source table are synced with the // index. The primary key column and embedding source column or embedding // vector column are always synced. - // Wire name: 'columns_to_sync' ColumnsToSync []string `json:"columns_to_sync,omitempty"` // The columns that contain the embedding source. - // Wire name: 'embedding_source_columns' EmbeddingSourceColumns []EmbeddingSourceColumn `json:"embedding_source_columns,omitempty"` // The columns that contain the embedding vectors. - // Wire name: 'embedding_vector_columns' EmbeddingVectorColumns []EmbeddingVectorColumn `json:"embedding_vector_columns,omitempty"` // [Optional] Name of the Delta table to sync the vector index contents and // computed embeddings to. - // Wire name: 'embedding_writeback_table' EmbeddingWritebackTable string `json:"embedding_writeback_table,omitempty"` // Pipeline execution mode. - `TRIGGERED`: If the pipeline uses the // triggered execution mode, the system stops processing after successfully @@ -454,53 +192,30 @@ type DeltaSyncVectorIndexSpecRequest struct { // `CONTINUOUS`: If the pipeline uses continuous execution, the pipeline // processes new data as it arrives in the source table to keep vector index // fresh. - // Wire name: 'pipeline_type' PipelineType PipelineType `json:"pipeline_type,omitempty"` // The name of the source table. - // Wire name: 'source_table' SourceTable string `json:"source_table,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DeltaSyncVectorIndexSpecRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deltaSyncVectorIndexSpecRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deltaSyncVectorIndexSpecRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DeltaSyncVectorIndexSpecRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DeltaSyncVectorIndexSpecRequest) MarshalJSON() ([]byte, error) { - pb, err := deltaSyncVectorIndexSpecRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DeltaSyncVectorIndexSpecRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type DeltaSyncVectorIndexSpecResponse struct { // The columns that contain the embedding source. - // Wire name: 'embedding_source_columns' EmbeddingSourceColumns []EmbeddingSourceColumn `json:"embedding_source_columns,omitempty"` // The columns that contain the embedding vectors. - // Wire name: 'embedding_vector_columns' EmbeddingVectorColumns []EmbeddingVectorColumn `json:"embedding_vector_columns,omitempty"` // [Optional] Name of the Delta table to sync the vector index contents and // computed embeddings to. - // Wire name: 'embedding_writeback_table' EmbeddingWritebackTable string `json:"embedding_writeback_table,omitempty"` // The ID of the pipeline that is used to sync the index. - // Wire name: 'pipeline_id' PipelineId string `json:"pipeline_id,omitempty"` // Pipeline execution mode. - `TRIGGERED`: If the pipeline uses the // triggered execution mode, the system stops processing after successfully @@ -509,253 +224,129 @@ type DeltaSyncVectorIndexSpecResponse struct { // `CONTINUOUS`: If the pipeline uses continuous execution, the pipeline // processes new data as it arrives in the source table to keep vector index // fresh. - // Wire name: 'pipeline_type' PipelineType PipelineType `json:"pipeline_type,omitempty"` // The name of the source table. - // Wire name: 'source_table' SourceTable string `json:"source_table,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DeltaSyncVectorIndexSpecResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deltaSyncVectorIndexSpecResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deltaSyncVectorIndexSpecResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DeltaSyncVectorIndexSpecResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DeltaSyncVectorIndexSpecResponse) MarshalJSON() ([]byte, error) { - pb, err := deltaSyncVectorIndexSpecResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DeltaSyncVectorIndexSpecResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type DirectAccessVectorIndexSpec struct { // The columns that contain the embedding source. The format should be // array[double]. - // Wire name: 'embedding_source_columns' EmbeddingSourceColumns []EmbeddingSourceColumn `json:"embedding_source_columns,omitempty"` // The columns that contain the embedding vectors. The format should be // array[double]. - // Wire name: 'embedding_vector_columns' EmbeddingVectorColumns []EmbeddingVectorColumn `json:"embedding_vector_columns,omitempty"` // The schema of the index in JSON format. Supported types are `integer`, // `long`, `float`, `double`, `boolean`, `string`, `date`, `timestamp`. // Supported types for vector column: `array`, `array`,`. - // Wire name: 'schema_json' SchemaJson string `json:"schema_json,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *DirectAccessVectorIndexSpec) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &directAccessVectorIndexSpecPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := directAccessVectorIndexSpecFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *DirectAccessVectorIndexSpec) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st DirectAccessVectorIndexSpec) MarshalJSON() ([]byte, error) { - pb, err := directAccessVectorIndexSpecToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s DirectAccessVectorIndexSpec) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type EmbeddingSourceColumn struct { // Name of the embedding model endpoint - // Wire name: 'embedding_model_endpoint_name' EmbeddingModelEndpointName string `json:"embedding_model_endpoint_name,omitempty"` // Name of the column - // Wire name: 'name' Name string `json:"name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *EmbeddingSourceColumn) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &embeddingSourceColumnPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := embeddingSourceColumnFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *EmbeddingSourceColumn) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st EmbeddingSourceColumn) MarshalJSON() ([]byte, error) { - pb, err := embeddingSourceColumnToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s EmbeddingSourceColumn) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type EmbeddingVectorColumn struct { // Dimension of the embedding vector - // Wire name: 'embedding_dimension' EmbeddingDimension int `json:"embedding_dimension,omitempty"` // Name of the column - // Wire name: 'name' Name string `json:"name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *EmbeddingVectorColumn) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &embeddingVectorColumnPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := embeddingVectorColumnFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *EmbeddingVectorColumn) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st EmbeddingVectorColumn) MarshalJSON() ([]byte, error) { - pb, err := embeddingVectorColumnToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s EmbeddingVectorColumn) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type EndpointInfo struct { // Timestamp of endpoint creation - // Wire name: 'creation_timestamp' CreationTimestamp int64 `json:"creation_timestamp,omitempty"` // Creator of the endpoint - // Wire name: 'creator' Creator string `json:"creator,omitempty"` // The custom tags assigned to the endpoint - // Wire name: 'custom_tags' CustomTags []CustomTag `json:"custom_tags,omitempty"` // The budget policy id applied to the endpoint - // Wire name: 'effective_budget_policy_id' EffectiveBudgetPolicyId string `json:"effective_budget_policy_id,omitempty"` // Current status of the endpoint - // Wire name: 'endpoint_status' EndpointStatus *EndpointStatus `json:"endpoint_status,omitempty"` // Type of endpoint - // Wire name: 'endpoint_type' EndpointType EndpointType `json:"endpoint_type,omitempty"` // Unique identifier of the endpoint - // Wire name: 'id' Id string `json:"id,omitempty"` // Timestamp of last update to the endpoint - // Wire name: 'last_updated_timestamp' LastUpdatedTimestamp int64 `json:"last_updated_timestamp,omitempty"` // User who last updated the endpoint - // Wire name: 'last_updated_user' LastUpdatedUser string `json:"last_updated_user,omitempty"` // Name of the vector search endpoint - // Wire name: 'name' Name string `json:"name,omitempty"` // Number of indexes on the endpoint - // Wire name: 'num_indexes' NumIndexes int `json:"num_indexes,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *EndpointInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &endpointInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := endpointInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *EndpointInfo) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st EndpointInfo) MarshalJSON() ([]byte, error) { - pb, err := endpointInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s EndpointInfo) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Status information of an endpoint type EndpointStatus struct { // Additional status message - // Wire name: 'message' Message string `json:"message,omitempty"` // Current state of the endpoint - // Wire name: 'state' State EndpointStatusState `json:"state,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *EndpointStatus) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &endpointStatusPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := endpointStatusFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *EndpointStatus) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st EndpointStatus) MarshalJSON() ([]byte, error) { - pb, err := endpointStatusToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s EndpointStatus) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Current state of the endpoint @@ -837,281 +428,112 @@ func (f *EndpointType) Type() string { // Get an endpoint type GetEndpointRequest struct { // Name of the endpoint - EndpointName string `json:"-" tf:"-"` -} - -func (st *GetEndpointRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getEndpointRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getEndpointRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetEndpointRequest) MarshalJSON() ([]byte, error) { - pb, err := getEndpointRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + EndpointName string `json:"-" url:"-"` } // Get an index type GetIndexRequest struct { // Name of the index - IndexName string `json:"-" tf:"-"` -} - -func (st *GetIndexRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getIndexRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getIndexRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetIndexRequest) MarshalJSON() ([]byte, error) { - pb, err := getIndexRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + IndexName string `json:"-" url:"-"` } type ListEndpointResponse struct { // An array of Endpoint objects - // Wire name: 'endpoints' Endpoints []EndpointInfo `json:"endpoints,omitempty"` // A token that can be used to get the next page of results. If not present, // there are no more results to show. - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListEndpointResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listEndpointResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listEndpointResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListEndpointResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListEndpointResponse) MarshalJSON() ([]byte, error) { - pb, err := listEndpointResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListEndpointResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // List all endpoints type ListEndpointsRequest struct { // Token for pagination - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListEndpointsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listEndpointsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listEndpointsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListEndpointsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListEndpointsRequest) MarshalJSON() ([]byte, error) { - pb, err := listEndpointsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListEndpointsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // List indexes type ListIndexesRequest struct { // Name of the endpoint - EndpointName string `json:"-" tf:"-"` + EndpointName string `json:"-" url:"endpoint_name"` // Token for pagination - PageToken string `json:"-" tf:"-"` + PageToken string `json:"-" url:"page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListIndexesRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listIndexesRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listIndexesRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListIndexesRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListIndexesRequest) MarshalJSON() ([]byte, error) { - pb, err := listIndexesRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListIndexesRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListValue struct { // Repeated field of dynamically typed values. - // Wire name: 'values' Values []Value `json:"values,omitempty"` } -func (st *ListValue) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listValuePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listValueFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ListValue) MarshalJSON() ([]byte, error) { - pb, err := listValueToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type ListVectorIndexesResponse struct { // A token that can be used to get the next page of results. If not present, // there are no more results to show. - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` - // Wire name: 'vector_indexes' VectorIndexes []MiniVectorIndex `json:"vector_indexes,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListVectorIndexesResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listVectorIndexesResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listVectorIndexesResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListVectorIndexesResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListVectorIndexesResponse) MarshalJSON() ([]byte, error) { - pb, err := listVectorIndexesResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListVectorIndexesResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Key-value pair. type MapStringValueEntry struct { // Column name. - // Wire name: 'key' Key string `json:"key,omitempty"` // Column value, nullable. - // Wire name: 'value' Value *Value `json:"value,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *MapStringValueEntry) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &mapStringValueEntryPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := mapStringValueEntryFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *MapStringValueEntry) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st MapStringValueEntry) MarshalJSON() ([]byte, error) { - pb, err := mapStringValueEntryToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s MapStringValueEntry) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type MiniVectorIndex struct { // The user who created the index. - // Wire name: 'creator' Creator string `json:"creator,omitempty"` // Name of the endpoint associated with the index - // Wire name: 'endpoint_name' EndpointName string `json:"endpoint_name,omitempty"` // There are 2 types of Vector Search indexes: - `DELTA_SYNC`: An index that // automatically syncs with a source Delta Table, automatically and @@ -1119,107 +541,43 @@ type MiniVectorIndex struct { // Table changes. - `DIRECT_ACCESS`: An index that supports direct read and // write of vectors and metadata through our REST and SDK APIs. With this // model, the user manages index updates. - // Wire name: 'index_type' IndexType VectorIndexType `json:"index_type,omitempty"` // Name of the index - // Wire name: 'name' Name string `json:"name,omitempty"` // Primary key of the index - // Wire name: 'primary_key' PrimaryKey string `json:"primary_key,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *MiniVectorIndex) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &miniVectorIndexPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := miniVectorIndexFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *MiniVectorIndex) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st MiniVectorIndex) MarshalJSON() ([]byte, error) { - pb, err := miniVectorIndexToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s MiniVectorIndex) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type PatchEndpointBudgetPolicyRequest struct { // The budget policy id to be applied - // Wire name: 'budget_policy_id' BudgetPolicyId string `json:"budget_policy_id"` // Name of the vector search endpoint - EndpointName string `json:"-" tf:"-"` -} - -func (st *PatchEndpointBudgetPolicyRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &patchEndpointBudgetPolicyRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := patchEndpointBudgetPolicyRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st PatchEndpointBudgetPolicyRequest) MarshalJSON() ([]byte, error) { - pb, err := patchEndpointBudgetPolicyRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + EndpointName string `json:"-" url:"-"` } type PatchEndpointBudgetPolicyResponse struct { // The budget policy applied to the vector search endpoint. - // Wire name: 'effective_budget_policy_id' EffectiveBudgetPolicyId string `json:"effective_budget_policy_id,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *PatchEndpointBudgetPolicyResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &patchEndpointBudgetPolicyResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := patchEndpointBudgetPolicyResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *PatchEndpointBudgetPolicyResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st PatchEndpointBudgetPolicyResponse) MarshalJSON() ([]byte, error) { - pb, err := patchEndpointBudgetPolicyResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s PatchEndpointBudgetPolicyResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Pipeline execution mode. - `TRIGGERED`: If the pipeline uses the triggered @@ -1274,49 +632,28 @@ func (f *PipelineType) Type() string { // Request payload for getting next page of results. type QueryVectorIndexNextPageRequest struct { // Name of the endpoint. - // Wire name: 'endpoint_name' EndpointName string `json:"endpoint_name,omitempty"` // Name of the vector index to query. - IndexName string `json:"-" tf:"-"` + IndexName string `json:"-" url:"-"` // Page token returned from previous `QueryVectorIndex` or // `QueryVectorIndexNextPage` API. - // Wire name: 'page_token' PageToken string `json:"page_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *QueryVectorIndexNextPageRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &queryVectorIndexNextPageRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := queryVectorIndexNextPageRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *QueryVectorIndexNextPageRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st QueryVectorIndexNextPageRequest) MarshalJSON() ([]byte, error) { - pb, err := queryVectorIndexNextPageRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s QueryVectorIndexNextPageRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type QueryVectorIndexRequest struct { // List of column names to include in the response. - // Wire name: 'columns' Columns []string `json:"columns"` // Column names used to retrieve data to send to the reranker. - // Wire name: 'columns_to_rerank' ColumnsToRerank []string `json:"columns_to_rerank,omitempty"` // JSON string representing query filters. // @@ -1326,439 +663,180 @@ type QueryVectorIndexRequest struct { // id greater than 5. - `{"id <=": 5}`: Filter for id less than equal to 5. // - `{"id >=": 5}`: Filter for id greater than equal to 5. - `{"id": 5}`: // Filter for id equal to 5. - // Wire name: 'filters_json' FiltersJson string `json:"filters_json,omitempty"` // Name of the vector index to query. - IndexName string `json:"-" tf:"-"` + IndexName string `json:"-" url:"-"` // Number of results to return. Defaults to 10. - // Wire name: 'num_results' NumResults int `json:"num_results,omitempty"` // Query text. Required for Delta Sync Index using model endpoint. - // Wire name: 'query_text' QueryText string `json:"query_text,omitempty"` // The query type to use. Choices are `ANN` and `HYBRID`. Defaults to `ANN`. - // Wire name: 'query_type' QueryType string `json:"query_type,omitempty"` // Query vector. Required for Direct Vector Access Index and Delta Sync // Index using self-managed vectors. - // Wire name: 'query_vector' QueryVector []float64 `json:"query_vector,omitempty"` // Threshold for the approximate nearest neighbor search. Defaults to 0.0. - // Wire name: 'score_threshold' ScoreThreshold float64 `json:"score_threshold,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *QueryVectorIndexRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &queryVectorIndexRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := queryVectorIndexRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *QueryVectorIndexRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st QueryVectorIndexRequest) MarshalJSON() ([]byte, error) { - pb, err := queryVectorIndexRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s QueryVectorIndexRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type QueryVectorIndexResponse struct { // Metadata about the result set. - // Wire name: 'manifest' Manifest *ResultManifest `json:"manifest,omitempty"` // [Optional] Token that can be used in `QueryVectorIndexNextPage` API to // get next page of results. If more than 1000 results satisfy the query, // they are returned in groups of 1000. Empty value means no more results. // The maximum number of results that can be returned is 10,000. - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` // Data returned in the query result. - // Wire name: 'result' Result *ResultData `json:"result,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *QueryVectorIndexResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &queryVectorIndexResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := queryVectorIndexResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *QueryVectorIndexResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st QueryVectorIndexResponse) MarshalJSON() ([]byte, error) { - pb, err := queryVectorIndexResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s QueryVectorIndexResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Data returned in the query result. type ResultData struct { // Data rows returned in the query. - // Wire name: 'data_array' DataArray [][]string `json:"data_array,omitempty"` // Number of rows in the result set. - // Wire name: 'row_count' RowCount int `json:"row_count,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ResultData) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &resultDataPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := resultDataFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ResultData) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ResultData) MarshalJSON() ([]byte, error) { - pb, err := resultDataToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ResultData) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Metadata about the result set. type ResultManifest struct { // Number of columns in the result set. - // Wire name: 'column_count' ColumnCount int `json:"column_count,omitempty"` // Information about each column in the result set. - // Wire name: 'columns' Columns []ColumnInfo `json:"columns,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ResultManifest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &resultManifestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := resultManifestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ResultManifest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ResultManifest) MarshalJSON() ([]byte, error) { - pb, err := resultManifestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ResultManifest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ScanVectorIndexRequest struct { // Name of the vector index to scan. - IndexName string `json:"-" tf:"-"` + IndexName string `json:"-" url:"-"` // Primary key of the last entry returned in the previous scan. - // Wire name: 'last_primary_key' LastPrimaryKey string `json:"last_primary_key,omitempty"` // Number of results to return. Defaults to 10. - // Wire name: 'num_results' NumResults int `json:"num_results,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ScanVectorIndexRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &scanVectorIndexRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := scanVectorIndexRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ScanVectorIndexRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ScanVectorIndexRequest) MarshalJSON() ([]byte, error) { - pb, err := scanVectorIndexRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ScanVectorIndexRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Response to a scan vector index request. type ScanVectorIndexResponse struct { // List of data entries - // Wire name: 'data' Data []Struct `json:"data,omitempty"` // Primary key of the last entry. - // Wire name: 'last_primary_key' LastPrimaryKey string `json:"last_primary_key,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ScanVectorIndexResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &scanVectorIndexResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := scanVectorIndexResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ScanVectorIndexResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ScanVectorIndexResponse) MarshalJSON() ([]byte, error) { - pb, err := scanVectorIndexResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ScanVectorIndexResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type Struct struct { // Data entry, corresponding to a row in a vector index. - // Wire name: 'fields' Fields []MapStringValueEntry `json:"fields,omitempty"` } -func (st *Struct) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &structPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := structFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st Struct) MarshalJSON() ([]byte, error) { - pb, err := structToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Synchronize an index type SyncIndexRequest struct { // Name of the vector index to synchronize. Must be a Delta Sync Index. - IndexName string `json:"-" tf:"-"` -} - -func (st *SyncIndexRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &syncIndexRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := syncIndexRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st SyncIndexRequest) MarshalJSON() ([]byte, error) { - pb, err := syncIndexRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + IndexName string `json:"-" url:"-"` } type SyncIndexResponse struct { } -func (st *SyncIndexResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &syncIndexResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := syncIndexResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st SyncIndexResponse) MarshalJSON() ([]byte, error) { - pb, err := syncIndexResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type UpdateEndpointCustomTagsRequest struct { // The new custom tags for the vector search endpoint - // Wire name: 'custom_tags' CustomTags []CustomTag `json:"custom_tags"` // Name of the vector search endpoint - EndpointName string `json:"-" tf:"-"` -} - -func (st *UpdateEndpointCustomTagsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateEndpointCustomTagsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateEndpointCustomTagsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateEndpointCustomTagsRequest) MarshalJSON() ([]byte, error) { - pb, err := updateEndpointCustomTagsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + EndpointName string `json:"-" url:"-"` } type UpdateEndpointCustomTagsResponse struct { // All the custom tags that are applied to the vector search endpoint. - // Wire name: 'custom_tags' CustomTags []CustomTag `json:"custom_tags,omitempty"` // The name of the vector search endpoint whose custom tags were updated. - // Wire name: 'name' Name string `json:"name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *UpdateEndpointCustomTagsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateEndpointCustomTagsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateEndpointCustomTagsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *UpdateEndpointCustomTagsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st UpdateEndpointCustomTagsResponse) MarshalJSON() ([]byte, error) { - pb, err := updateEndpointCustomTagsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s UpdateEndpointCustomTagsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type UpsertDataResult struct { // List of primary keys for rows that failed to process. - // Wire name: 'failed_primary_keys' FailedPrimaryKeys []string `json:"failed_primary_keys,omitempty"` // Count of successfully processed rows. - // Wire name: 'success_row_count' SuccessRowCount int64 `json:"success_row_count,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *UpsertDataResult) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &upsertDataResultPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := upsertDataResultFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *UpsertDataResult) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st UpsertDataResult) MarshalJSON() ([]byte, error) { - pb, err := upsertDataResultToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s UpsertDataResult) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type UpsertDataStatus string @@ -1804,128 +882,48 @@ func (f *UpsertDataStatus) Type() string { type UpsertDataVectorIndexRequest struct { // Name of the vector index where data is to be upserted. Must be a Direct // Vector Access Index. - IndexName string `json:"-" tf:"-"` + IndexName string `json:"-" url:"-"` // JSON string representing the data to be upserted. - // Wire name: 'inputs_json' InputsJson string `json:"inputs_json"` } -func (st *UpsertDataVectorIndexRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &upsertDataVectorIndexRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := upsertDataVectorIndexRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpsertDataVectorIndexRequest) MarshalJSON() ([]byte, error) { - pb, err := upsertDataVectorIndexRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type UpsertDataVectorIndexResponse struct { // Result of the upsert or delete operation. - // Wire name: 'result' Result *UpsertDataResult `json:"result,omitempty"` // Status of the upsert operation. - // Wire name: 'status' Status UpsertDataStatus `json:"status,omitempty"` } -func (st *UpsertDataVectorIndexResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &upsertDataVectorIndexResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := upsertDataVectorIndexResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpsertDataVectorIndexResponse) MarshalJSON() ([]byte, error) { - pb, err := upsertDataVectorIndexResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type Value struct { - - // Wire name: 'bool_value' BoolValue bool `json:"bool_value,omitempty"` - // Wire name: 'list_value' ListValue *ListValue `json:"list_value,omitempty"` - // Wire name: 'number_value' NumberValue float64 `json:"number_value,omitempty"` - // Wire name: 'string_value' StringValue string `json:"string_value,omitempty"` - // Wire name: 'struct_value' StructValue *Struct `json:"struct_value,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *Value) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &valuePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := valueFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *Value) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st Value) MarshalJSON() ([]byte, error) { - pb, err := valueToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s Value) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type VectorIndex struct { // The user who created the index. - // Wire name: 'creator' Creator string `json:"creator,omitempty"` - // Wire name: 'delta_sync_index_spec' DeltaSyncIndexSpec *DeltaSyncVectorIndexSpecResponse `json:"delta_sync_index_spec,omitempty"` - // Wire name: 'direct_access_index_spec' DirectAccessIndexSpec *DirectAccessVectorIndexSpec `json:"direct_access_index_spec,omitempty"` // Name of the endpoint associated with the index - // Wire name: 'endpoint_name' EndpointName string `json:"endpoint_name,omitempty"` // There are 2 types of Vector Search indexes: - `DELTA_SYNC`: An index that // automatically syncs with a source Delta Table, automatically and @@ -1933,86 +931,44 @@ type VectorIndex struct { // Table changes. - `DIRECT_ACCESS`: An index that supports direct read and // write of vectors and metadata through our REST and SDK APIs. With this // model, the user manages index updates. - // Wire name: 'index_type' IndexType VectorIndexType `json:"index_type,omitempty"` // Name of the index - // Wire name: 'name' Name string `json:"name,omitempty"` // Primary key of the index - // Wire name: 'primary_key' PrimaryKey string `json:"primary_key,omitempty"` - // Wire name: 'status' Status *VectorIndexStatus `json:"status,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *VectorIndex) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &vectorIndexPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := vectorIndexFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *VectorIndex) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st VectorIndex) MarshalJSON() ([]byte, error) { - pb, err := vectorIndexToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s VectorIndex) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type VectorIndexStatus struct { // Index API Url to be used to perform operations on the index - // Wire name: 'index_url' IndexUrl string `json:"index_url,omitempty"` // Number of rows indexed - // Wire name: 'indexed_row_count' IndexedRowCount int64 `json:"indexed_row_count,omitempty"` // Message associated with the index status - // Wire name: 'message' Message string `json:"message,omitempty"` // Whether the index is ready for search - // Wire name: 'ready' Ready bool `json:"ready,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *VectorIndexStatus) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &vectorIndexStatusPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := vectorIndexStatusFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *VectorIndexStatus) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st VectorIndexStatus) MarshalJSON() ([]byte, error) { - pb, err := vectorIndexStatusToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s VectorIndexStatus) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // There are 2 types of Vector Search indexes: - `DELTA_SYNC`: An index that diff --git a/service/workspace/impl.go b/service/workspace/impl.go index 59ba85224..35b49ee8e 100755 --- a/service/workspace/impl.go +++ b/service/workspace/impl.go @@ -18,96 +18,34 @@ type gitCredentialsImpl struct { } func (a *gitCredentialsImpl) Create(ctx context.Context, request CreateCredentialsRequest) (*CreateCredentialsResponse, error) { - - requestPb, pbErr := createCredentialsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var createCredentialsResponsePb createCredentialsResponsePb + var createCredentialsResponse CreateCredentialsResponse path := "/api/2.0/git-credentials" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &createCredentialsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := createCredentialsResponseFromPb(&createCredentialsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &createCredentialsResponse) + return &createCredentialsResponse, err } func (a *gitCredentialsImpl) Delete(ctx context.Context, request DeleteCredentialsRequest) error { - - requestPb, pbErr := deleteCredentialsRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteCredentialsResponsePb deleteCredentialsResponsePb - path := fmt.Sprintf("/api/2.0/git-credentials/%v", requestPb.CredentialId) + var deleteCredentialsResponse DeleteCredentialsResponse + path := fmt.Sprintf("/api/2.0/git-credentials/%v", request.CredentialId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteCredentialsResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteCredentialsResponse) return err } func (a *gitCredentialsImpl) Get(ctx context.Context, request GetCredentialsRequest) (*GetCredentialsResponse, error) { - - requestPb, pbErr := getCredentialsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var getCredentialsResponsePb getCredentialsResponsePb - path := fmt.Sprintf("/api/2.0/git-credentials/%v", requestPb.CredentialId) + var getCredentialsResponse GetCredentialsResponse + path := fmt.Sprintf("/api/2.0/git-credentials/%v", request.CredentialId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &getCredentialsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := getCredentialsResponseFromPb(&getCredentialsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getCredentialsResponse) + return &getCredentialsResponse, err } // Lists the calling user's Git credentials. One credential per user is @@ -139,58 +77,23 @@ func (a *gitCredentialsImpl) ListAll(ctx context.Context) ([]CredentialInfo, err } func (a *gitCredentialsImpl) internalList(ctx context.Context) (*ListCredentialsResponse, error) { - - var listCredentialsResponsePb listCredentialsResponsePb + var listCredentialsResponse ListCredentialsResponse path := "/api/2.0/git-credentials" headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - nil, - nil, - &listCredentialsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listCredentialsResponseFromPb(&listCredentialsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, nil, nil, &listCredentialsResponse) + return &listCredentialsResponse, err } func (a *gitCredentialsImpl) Update(ctx context.Context, request UpdateCredentialsRequest) error { - - requestPb, pbErr := updateCredentialsRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var updateCredentialsResponsePb updateCredentialsResponsePb - path := fmt.Sprintf("/api/2.0/git-credentials/%v", requestPb.CredentialId) + var updateCredentialsResponse UpdateCredentialsResponse + path := fmt.Sprintf("/api/2.0/git-credentials/%v", request.CredentialId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &updateCredentialsResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &updateCredentialsResponse) return err } @@ -200,160 +103,54 @@ type reposImpl struct { } func (a *reposImpl) Create(ctx context.Context, request CreateRepoRequest) (*CreateRepoResponse, error) { - - requestPb, pbErr := createRepoRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var createRepoResponsePb createRepoResponsePb + var createRepoResponse CreateRepoResponse path := "/api/2.0/repos" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &createRepoResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := createRepoResponseFromPb(&createRepoResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &createRepoResponse) + return &createRepoResponse, err } func (a *reposImpl) Delete(ctx context.Context, request DeleteRepoRequest) error { - - requestPb, pbErr := deleteRepoRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteRepoResponsePb deleteRepoResponsePb - path := fmt.Sprintf("/api/2.0/repos/%v", requestPb.RepoId) + var deleteRepoResponse DeleteRepoResponse + path := fmt.Sprintf("/api/2.0/repos/%v", request.RepoId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodDelete, - path, - headers, - queryParams, - (*requestPb), - &deleteRepoResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteRepoResponse) return err } func (a *reposImpl) Get(ctx context.Context, request GetRepoRequest) (*GetRepoResponse, error) { - - requestPb, pbErr := getRepoRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var getRepoResponsePb getRepoResponsePb - path := fmt.Sprintf("/api/2.0/repos/%v", requestPb.RepoId) + var getRepoResponse GetRepoResponse + path := fmt.Sprintf("/api/2.0/repos/%v", request.RepoId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &getRepoResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := getRepoResponseFromPb(&getRepoResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getRepoResponse) + return &getRepoResponse, err } func (a *reposImpl) GetPermissionLevels(ctx context.Context, request GetRepoPermissionLevelsRequest) (*GetRepoPermissionLevelsResponse, error) { - - requestPb, pbErr := getRepoPermissionLevelsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var getRepoPermissionLevelsResponsePb getRepoPermissionLevelsResponsePb - path := fmt.Sprintf("/api/2.0/permissions/repos/%v/permissionLevels", requestPb.RepoId) + var getRepoPermissionLevelsResponse GetRepoPermissionLevelsResponse + path := fmt.Sprintf("/api/2.0/permissions/repos/%v/permissionLevels", request.RepoId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &getRepoPermissionLevelsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := getRepoPermissionLevelsResponseFromPb(&getRepoPermissionLevelsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getRepoPermissionLevelsResponse) + return &getRepoPermissionLevelsResponse, err } func (a *reposImpl) GetPermissions(ctx context.Context, request GetRepoPermissionsRequest) (*RepoPermissions, error) { - - requestPb, pbErr := getRepoPermissionsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var repoPermissionsPb repoPermissionsPb - path := fmt.Sprintf("/api/2.0/permissions/repos/%v", requestPb.RepoId) + var repoPermissions RepoPermissions + path := fmt.Sprintf("/api/2.0/permissions/repos/%v", request.RepoId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &repoPermissionsPb, - ) - if err != nil { - return nil, err - } - resp, err := repoPermissionsFromPb(&repoPermissionsPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &repoPermissions) + return &repoPermissions, err } // Returns repos that the calling user has Manage permissions on. Use @@ -390,130 +187,46 @@ func (a *reposImpl) ListAll(ctx context.Context, request ListReposRequest) ([]Re } func (a *reposImpl) internalList(ctx context.Context, request ListReposRequest) (*ListReposResponse, error) { - - requestPb, pbErr := listReposRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listReposResponsePb listReposResponsePb + var listReposResponse ListReposResponse path := "/api/2.0/repos" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listReposResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listReposResponseFromPb(&listReposResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listReposResponse) + return &listReposResponse, err } func (a *reposImpl) SetPermissions(ctx context.Context, request RepoPermissionsRequest) (*RepoPermissions, error) { - - requestPb, pbErr := repoPermissionsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var repoPermissionsPb repoPermissionsPb - path := fmt.Sprintf("/api/2.0/permissions/repos/%v", requestPb.RepoId) + var repoPermissions RepoPermissions + path := fmt.Sprintf("/api/2.0/permissions/repos/%v", request.RepoId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPut, - path, - headers, - queryParams, - (*requestPb), - &repoPermissionsPb, - ) - if err != nil { - return nil, err - } - resp, err := repoPermissionsFromPb(&repoPermissionsPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &repoPermissions) + return &repoPermissions, err } func (a *reposImpl) Update(ctx context.Context, request UpdateRepoRequest) error { - - requestPb, pbErr := updateRepoRequestToPb(&request) - if pbErr != nil { - return pbErr - } - - var updateRepoResponsePb updateRepoResponsePb - path := fmt.Sprintf("/api/2.0/repos/%v", requestPb.RepoId) + var updateRepoResponse UpdateRepoResponse + path := fmt.Sprintf("/api/2.0/repos/%v", request.RepoId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &updateRepoResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &updateRepoResponse) return err } func (a *reposImpl) UpdatePermissions(ctx context.Context, request RepoPermissionsRequest) (*RepoPermissions, error) { - - requestPb, pbErr := repoPermissionsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var repoPermissionsPb repoPermissionsPb - path := fmt.Sprintf("/api/2.0/permissions/repos/%v", requestPb.RepoId) + var repoPermissions RepoPermissions + path := fmt.Sprintf("/api/2.0/permissions/repos/%v", request.RepoId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &repoPermissionsPb, - ) - if err != nil { - return nil, err - } - resp, err := repoPermissionsFromPb(&repoPermissionsPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &repoPermissions) + return &repoPermissions, err } // unexported type that holds implementations of just Secrets API methods @@ -522,183 +235,67 @@ type secretsImpl struct { } func (a *secretsImpl) CreateScope(ctx context.Context, request CreateScope) error { - - requestPb, pbErr := createScopeToPb(&request) - if pbErr != nil { - return pbErr - } - - var createScopeResponsePb createScopeResponsePb + var createScopeResponse CreateScopeResponse path := "/api/2.0/secrets/scopes/create" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &createScopeResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &createScopeResponse) return err } func (a *secretsImpl) DeleteAcl(ctx context.Context, request DeleteAcl) error { - - requestPb, pbErr := deleteAclToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteAclResponsePb deleteAclResponsePb + var deleteAclResponse DeleteAclResponse path := "/api/2.0/secrets/acls/delete" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &deleteAclResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &deleteAclResponse) return err } func (a *secretsImpl) DeleteScope(ctx context.Context, request DeleteScope) error { - - requestPb, pbErr := deleteScopeToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteScopeResponsePb deleteScopeResponsePb + var deleteScopeResponse DeleteScopeResponse path := "/api/2.0/secrets/scopes/delete" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &deleteScopeResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &deleteScopeResponse) return err } func (a *secretsImpl) DeleteSecret(ctx context.Context, request DeleteSecret) error { - - requestPb, pbErr := deleteSecretToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteSecretResponsePb deleteSecretResponsePb + var deleteSecretResponse DeleteSecretResponse path := "/api/2.0/secrets/delete" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &deleteSecretResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &deleteSecretResponse) return err } func (a *secretsImpl) GetAcl(ctx context.Context, request GetAclRequest) (*AclItem, error) { - - requestPb, pbErr := getAclRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var aclItemPb aclItemPb + var aclItem AclItem path := "/api/2.0/secrets/acls/get" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &aclItemPb, - ) - if err != nil { - return nil, err - } - resp, err := aclItemFromPb(&aclItemPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &aclItem) + return &aclItem, err } func (a *secretsImpl) GetSecret(ctx context.Context, request GetSecretRequest) (*GetSecretResponse, error) { - - requestPb, pbErr := getSecretRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var getSecretResponsePb getSecretResponsePb + var getSecretResponse GetSecretResponse path := "/api/2.0/secrets/get" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &getSecretResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := getSecretResponseFromPb(&getSecretResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getSecretResponse) + return &getSecretResponse, err } // List the ACLs for a given secret scope. Users must have the `MANAGE` @@ -737,35 +334,13 @@ func (a *secretsImpl) ListAclsAll(ctx context.Context, request ListAclsRequest) } func (a *secretsImpl) internalListAcls(ctx context.Context, request ListAclsRequest) (*ListAclsResponse, error) { - - requestPb, pbErr := listAclsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listAclsResponsePb listAclsResponsePb + var listAclsResponse ListAclsResponse path := "/api/2.0/secrets/acls/list" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listAclsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listAclsResponseFromPb(&listAclsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listAclsResponse) + return &listAclsResponse, err } // Lists all secret scopes available in the workspace. @@ -801,30 +376,13 @@ func (a *secretsImpl) ListScopesAll(ctx context.Context) ([]SecretScope, error) } func (a *secretsImpl) internalListScopes(ctx context.Context) (*ListScopesResponse, error) { - - var listScopesResponsePb listScopesResponsePb + var listScopesResponse ListScopesResponse path := "/api/2.0/secrets/scopes/list" headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - nil, - nil, - &listScopesResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listScopesResponseFromPb(&listScopesResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, nil, nil, &listScopesResponse) + return &listScopesResponse, err } // Lists the secret keys that are stored at this scope. This is a metadata-only @@ -867,92 +425,34 @@ func (a *secretsImpl) ListSecretsAll(ctx context.Context, request ListSecretsReq } func (a *secretsImpl) internalListSecrets(ctx context.Context, request ListSecretsRequest) (*ListSecretsResponse, error) { - - requestPb, pbErr := listSecretsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listSecretsResponsePb listSecretsResponsePb + var listSecretsResponse ListSecretsResponse path := "/api/2.0/secrets/list" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listSecretsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listSecretsResponseFromPb(&listSecretsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listSecretsResponse) + return &listSecretsResponse, err } func (a *secretsImpl) PutAcl(ctx context.Context, request PutAcl) error { - - requestPb, pbErr := putAclToPb(&request) - if pbErr != nil { - return pbErr - } - - var putAclResponsePb putAclResponsePb + var putAclResponse PutAclResponse path := "/api/2.0/secrets/acls/put" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &putAclResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &putAclResponse) return err } func (a *secretsImpl) PutSecret(ctx context.Context, request PutSecret) error { - - requestPb, pbErr := putSecretToPb(&request) - if pbErr != nil { - return pbErr - } - - var putSecretResponsePb putSecretResponsePb + var putSecretResponse PutSecretResponse path := "/api/2.0/secrets/put" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &putSecretResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &putSecretResponse) return err } @@ -962,188 +462,64 @@ type workspaceImpl struct { } func (a *workspaceImpl) Delete(ctx context.Context, request Delete) error { - - requestPb, pbErr := deleteToPb(&request) - if pbErr != nil { - return pbErr - } - - var deleteResponsePb deleteResponsePb + var deleteResponse DeleteResponse path := "/api/2.0/workspace/delete" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &deleteResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &deleteResponse) return err } func (a *workspaceImpl) Export(ctx context.Context, request ExportRequest) (*ExportResponse, error) { - - requestPb, pbErr := exportRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var exportResponsePb exportResponsePb + var exportResponse ExportResponse path := "/api/2.0/workspace/export" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &exportResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := exportResponseFromPb(&exportResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &exportResponse) + return &exportResponse, err } func (a *workspaceImpl) GetPermissionLevels(ctx context.Context, request GetWorkspaceObjectPermissionLevelsRequest) (*GetWorkspaceObjectPermissionLevelsResponse, error) { - - requestPb, pbErr := getWorkspaceObjectPermissionLevelsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var getWorkspaceObjectPermissionLevelsResponsePb getWorkspaceObjectPermissionLevelsResponsePb - path := fmt.Sprintf("/api/2.0/permissions/%v/%v/permissionLevels", requestPb.WorkspaceObjectType, requestPb.WorkspaceObjectId) + var getWorkspaceObjectPermissionLevelsResponse GetWorkspaceObjectPermissionLevelsResponse + path := fmt.Sprintf("/api/2.0/permissions/%v/%v/permissionLevels", request.WorkspaceObjectType, request.WorkspaceObjectId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &getWorkspaceObjectPermissionLevelsResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := getWorkspaceObjectPermissionLevelsResponseFromPb(&getWorkspaceObjectPermissionLevelsResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getWorkspaceObjectPermissionLevelsResponse) + return &getWorkspaceObjectPermissionLevelsResponse, err } func (a *workspaceImpl) GetPermissions(ctx context.Context, request GetWorkspaceObjectPermissionsRequest) (*WorkspaceObjectPermissions, error) { - - requestPb, pbErr := getWorkspaceObjectPermissionsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var workspaceObjectPermissionsPb workspaceObjectPermissionsPb - path := fmt.Sprintf("/api/2.0/permissions/%v/%v", requestPb.WorkspaceObjectType, requestPb.WorkspaceObjectId) + var workspaceObjectPermissions WorkspaceObjectPermissions + path := fmt.Sprintf("/api/2.0/permissions/%v/%v", request.WorkspaceObjectType, request.WorkspaceObjectId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &workspaceObjectPermissionsPb, - ) - if err != nil { - return nil, err - } - resp, err := workspaceObjectPermissionsFromPb(&workspaceObjectPermissionsPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &workspaceObjectPermissions) + return &workspaceObjectPermissions, err } func (a *workspaceImpl) GetStatus(ctx context.Context, request GetStatusRequest) (*ObjectInfo, error) { - - requestPb, pbErr := getStatusRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var objectInfoPb objectInfoPb + var objectInfo ObjectInfo path := "/api/2.0/workspace/get-status" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &objectInfoPb, - ) - if err != nil { - return nil, err - } - resp, err := objectInfoFromPb(&objectInfoPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &objectInfo) + return &objectInfo, err } func (a *workspaceImpl) Import(ctx context.Context, request Import) error { - - requestPb, pbErr := importToPb(&request) - if pbErr != nil { - return pbErr - } - - var importResponsePb importResponsePb + var importResponse ImportResponse path := "/api/2.0/workspace/import" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &importResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &importResponse) return err } @@ -1177,128 +553,44 @@ func (a *workspaceImpl) ListAll(ctx context.Context, request ListWorkspaceReques } func (a *workspaceImpl) internalList(ctx context.Context, request ListWorkspaceRequest) (*ListResponse, error) { - - requestPb, pbErr := listWorkspaceRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var listResponsePb listResponsePb + var listResponse ListResponse path := "/api/2.0/workspace/list" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" - err := a.client.Do( - ctx, - http.MethodGet, - path, - headers, - queryParams, - (*requestPb), - &listResponsePb, - ) - if err != nil { - return nil, err - } - resp, err := listResponseFromPb(&listResponsePb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listResponse) + return &listResponse, err } func (a *workspaceImpl) Mkdirs(ctx context.Context, request Mkdirs) error { - - requestPb, pbErr := mkdirsToPb(&request) - if pbErr != nil { - return pbErr - } - - var mkdirsResponsePb mkdirsResponsePb + var mkdirsResponse MkdirsResponse path := "/api/2.0/workspace/mkdirs" queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPost, - path, - headers, - queryParams, - (*requestPb), - &mkdirsResponsePb, - ) - if err != nil { - return err - } - + err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &mkdirsResponse) return err } func (a *workspaceImpl) SetPermissions(ctx context.Context, request WorkspaceObjectPermissionsRequest) (*WorkspaceObjectPermissions, error) { - - requestPb, pbErr := workspaceObjectPermissionsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var workspaceObjectPermissionsPb workspaceObjectPermissionsPb - path := fmt.Sprintf("/api/2.0/permissions/%v/%v", requestPb.WorkspaceObjectType, requestPb.WorkspaceObjectId) + var workspaceObjectPermissions WorkspaceObjectPermissions + path := fmt.Sprintf("/api/2.0/permissions/%v/%v", request.WorkspaceObjectType, request.WorkspaceObjectId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPut, - path, - headers, - queryParams, - (*requestPb), - &workspaceObjectPermissionsPb, - ) - if err != nil { - return nil, err - } - resp, err := workspaceObjectPermissionsFromPb(&workspaceObjectPermissionsPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &workspaceObjectPermissions) + return &workspaceObjectPermissions, err } func (a *workspaceImpl) UpdatePermissions(ctx context.Context, request WorkspaceObjectPermissionsRequest) (*WorkspaceObjectPermissions, error) { - - requestPb, pbErr := workspaceObjectPermissionsRequestToPb(&request) - if pbErr != nil { - return nil, pbErr - } - - var workspaceObjectPermissionsPb workspaceObjectPermissionsPb - path := fmt.Sprintf("/api/2.0/permissions/%v/%v", requestPb.WorkspaceObjectType, requestPb.WorkspaceObjectId) + var workspaceObjectPermissions WorkspaceObjectPermissions + path := fmt.Sprintf("/api/2.0/permissions/%v/%v", request.WorkspaceObjectType, request.WorkspaceObjectId) queryParams := make(map[string]any) headers := make(map[string]string) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" - err := a.client.Do( - ctx, - http.MethodPatch, - path, - headers, - queryParams, - (*requestPb), - &workspaceObjectPermissionsPb, - ) - if err != nil { - return nil, err - } - resp, err := workspaceObjectPermissionsFromPb(&workspaceObjectPermissionsPb) - if err != nil { - return nil, err - } - - return resp, err + err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &workspaceObjectPermissions) + return &workspaceObjectPermissions, err } diff --git a/service/workspace/internal.go b/service/workspace/internal.go deleted file mode 100755 index 404c14b44..000000000 --- a/service/workspace/internal.go +++ /dev/null @@ -1,2555 +0,0 @@ -// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. - -package workspace - -import ( - "fmt" - "strings" - "time" - - "github.com/databricks/databricks-sdk-go/marshal" -) - -func aclItemToPb(st *AclItem) (*aclItemPb, error) { - if st == nil { - return nil, nil - } - pb := &aclItemPb{} - pb.Permission = st.Permission - pb.Principal = st.Principal - - return pb, nil -} - -type aclItemPb struct { - Permission AclPermission `json:"permission"` - Principal string `json:"principal"` -} - -func aclItemFromPb(pb *aclItemPb) (*AclItem, error) { - if pb == nil { - return nil, nil - } - st := &AclItem{} - st.Permission = pb.Permission - st.Principal = pb.Principal - - return st, nil -} - -func azureKeyVaultSecretScopeMetadataToPb(st *AzureKeyVaultSecretScopeMetadata) (*azureKeyVaultSecretScopeMetadataPb, error) { - if st == nil { - return nil, nil - } - pb := &azureKeyVaultSecretScopeMetadataPb{} - pb.DnsName = st.DnsName - pb.ResourceId = st.ResourceId - - return pb, nil -} - -type azureKeyVaultSecretScopeMetadataPb struct { - DnsName string `json:"dns_name"` - ResourceId string `json:"resource_id"` -} - -func azureKeyVaultSecretScopeMetadataFromPb(pb *azureKeyVaultSecretScopeMetadataPb) (*AzureKeyVaultSecretScopeMetadata, error) { - if pb == nil { - return nil, nil - } - st := &AzureKeyVaultSecretScopeMetadata{} - st.DnsName = pb.DnsName - st.ResourceId = pb.ResourceId - - return st, nil -} - -func createCredentialsRequestToPb(st *CreateCredentialsRequest) (*createCredentialsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &createCredentialsRequestPb{} - pb.GitProvider = st.GitProvider - pb.GitUsername = st.GitUsername - pb.PersonalAccessToken = st.PersonalAccessToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createCredentialsRequestPb struct { - GitProvider string `json:"git_provider"` - GitUsername string `json:"git_username,omitempty"` - PersonalAccessToken string `json:"personal_access_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createCredentialsRequestFromPb(pb *createCredentialsRequestPb) (*CreateCredentialsRequest, error) { - if pb == nil { - return nil, nil - } - st := &CreateCredentialsRequest{} - st.GitProvider = pb.GitProvider - st.GitUsername = pb.GitUsername - st.PersonalAccessToken = pb.PersonalAccessToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createCredentialsRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createCredentialsRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createCredentialsResponseToPb(st *CreateCredentialsResponse) (*createCredentialsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &createCredentialsResponsePb{} - pb.CredentialId = st.CredentialId - pb.GitProvider = st.GitProvider - pb.GitUsername = st.GitUsername - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createCredentialsResponsePb struct { - CredentialId int64 `json:"credential_id"` - GitProvider string `json:"git_provider"` - GitUsername string `json:"git_username,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createCredentialsResponseFromPb(pb *createCredentialsResponsePb) (*CreateCredentialsResponse, error) { - if pb == nil { - return nil, nil - } - st := &CreateCredentialsResponse{} - st.CredentialId = pb.CredentialId - st.GitProvider = pb.GitProvider - st.GitUsername = pb.GitUsername - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createCredentialsResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createCredentialsResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createRepoRequestToPb(st *CreateRepoRequest) (*createRepoRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &createRepoRequestPb{} - pb.Path = st.Path - pb.Provider = st.Provider - pb.SparseCheckout = st.SparseCheckout - pb.Url = st.Url - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createRepoRequestPb struct { - Path string `json:"path,omitempty"` - Provider string `json:"provider"` - SparseCheckout *SparseCheckout `json:"sparse_checkout,omitempty"` - Url string `json:"url"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createRepoRequestFromPb(pb *createRepoRequestPb) (*CreateRepoRequest, error) { - if pb == nil { - return nil, nil - } - st := &CreateRepoRequest{} - st.Path = pb.Path - st.Provider = pb.Provider - st.SparseCheckout = pb.SparseCheckout - st.Url = pb.Url - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createRepoRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createRepoRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createRepoResponseToPb(st *CreateRepoResponse) (*createRepoResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &createRepoResponsePb{} - pb.Branch = st.Branch - pb.HeadCommitId = st.HeadCommitId - pb.Id = st.Id - pb.Path = st.Path - pb.Provider = st.Provider - pb.SparseCheckout = st.SparseCheckout - pb.Url = st.Url - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createRepoResponsePb struct { - Branch string `json:"branch,omitempty"` - HeadCommitId string `json:"head_commit_id,omitempty"` - Id int64 `json:"id,omitempty"` - Path string `json:"path,omitempty"` - Provider string `json:"provider,omitempty"` - SparseCheckout *SparseCheckout `json:"sparse_checkout,omitempty"` - Url string `json:"url,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createRepoResponseFromPb(pb *createRepoResponsePb) (*CreateRepoResponse, error) { - if pb == nil { - return nil, nil - } - st := &CreateRepoResponse{} - st.Branch = pb.Branch - st.HeadCommitId = pb.HeadCommitId - st.Id = pb.Id - st.Path = pb.Path - st.Provider = pb.Provider - st.SparseCheckout = pb.SparseCheckout - st.Url = pb.Url - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createRepoResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createRepoResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createScopeToPb(st *CreateScope) (*createScopePb, error) { - if st == nil { - return nil, nil - } - pb := &createScopePb{} - pb.BackendAzureKeyvault = st.BackendAzureKeyvault - pb.InitialManagePrincipal = st.InitialManagePrincipal - pb.Scope = st.Scope - pb.ScopeBackendType = st.ScopeBackendType - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type createScopePb struct { - BackendAzureKeyvault *AzureKeyVaultSecretScopeMetadata `json:"backend_azure_keyvault,omitempty"` - InitialManagePrincipal string `json:"initial_manage_principal,omitempty"` - Scope string `json:"scope"` - ScopeBackendType ScopeBackendType `json:"scope_backend_type,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func createScopeFromPb(pb *createScopePb) (*CreateScope, error) { - if pb == nil { - return nil, nil - } - st := &CreateScope{} - st.BackendAzureKeyvault = pb.BackendAzureKeyvault - st.InitialManagePrincipal = pb.InitialManagePrincipal - st.Scope = pb.Scope - st.ScopeBackendType = pb.ScopeBackendType - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *createScopePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st createScopePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func createScopeResponseToPb(st *CreateScopeResponse) (*createScopeResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &createScopeResponsePb{} - - return pb, nil -} - -type createScopeResponsePb struct { -} - -func createScopeResponseFromPb(pb *createScopeResponsePb) (*CreateScopeResponse, error) { - if pb == nil { - return nil, nil - } - st := &CreateScopeResponse{} - - return st, nil -} - -func credentialInfoToPb(st *CredentialInfo) (*credentialInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &credentialInfoPb{} - pb.CredentialId = st.CredentialId - pb.GitProvider = st.GitProvider - pb.GitUsername = st.GitUsername - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type credentialInfoPb struct { - CredentialId int64 `json:"credential_id"` - GitProvider string `json:"git_provider,omitempty"` - GitUsername string `json:"git_username,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func credentialInfoFromPb(pb *credentialInfoPb) (*CredentialInfo, error) { - if pb == nil { - return nil, nil - } - st := &CredentialInfo{} - st.CredentialId = pb.CredentialId - st.GitProvider = pb.GitProvider - st.GitUsername = pb.GitUsername - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *credentialInfoPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st credentialInfoPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func deleteToPb(st *Delete) (*deletePb, error) { - if st == nil { - return nil, nil - } - pb := &deletePb{} - pb.Path = st.Path - pb.Recursive = st.Recursive - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type deletePb struct { - Path string `json:"path"` - Recursive bool `json:"recursive,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func deleteFromPb(pb *deletePb) (*Delete, error) { - if pb == nil { - return nil, nil - } - st := &Delete{} - st.Path = pb.Path - st.Recursive = pb.Recursive - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *deletePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st deletePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func deleteAclToPb(st *DeleteAcl) (*deleteAclPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteAclPb{} - pb.Principal = st.Principal - pb.Scope = st.Scope - - return pb, nil -} - -type deleteAclPb struct { - Principal string `json:"principal"` - Scope string `json:"scope"` -} - -func deleteAclFromPb(pb *deleteAclPb) (*DeleteAcl, error) { - if pb == nil { - return nil, nil - } - st := &DeleteAcl{} - st.Principal = pb.Principal - st.Scope = pb.Scope - - return st, nil -} - -func deleteAclResponseToPb(st *DeleteAclResponse) (*deleteAclResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteAclResponsePb{} - - return pb, nil -} - -type deleteAclResponsePb struct { -} - -func deleteAclResponseFromPb(pb *deleteAclResponsePb) (*DeleteAclResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteAclResponse{} - - return st, nil -} - -func deleteCredentialsRequestToPb(st *DeleteCredentialsRequest) (*deleteCredentialsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteCredentialsRequestPb{} - pb.CredentialId = st.CredentialId - - return pb, nil -} - -type deleteCredentialsRequestPb struct { - CredentialId int64 `json:"-" url:"-"` -} - -func deleteCredentialsRequestFromPb(pb *deleteCredentialsRequestPb) (*DeleteCredentialsRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteCredentialsRequest{} - st.CredentialId = pb.CredentialId - - return st, nil -} - -func deleteCredentialsResponseToPb(st *DeleteCredentialsResponse) (*deleteCredentialsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteCredentialsResponsePb{} - - return pb, nil -} - -type deleteCredentialsResponsePb struct { -} - -func deleteCredentialsResponseFromPb(pb *deleteCredentialsResponsePb) (*DeleteCredentialsResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteCredentialsResponse{} - - return st, nil -} - -func deleteRepoRequestToPb(st *DeleteRepoRequest) (*deleteRepoRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteRepoRequestPb{} - pb.RepoId = st.RepoId - - return pb, nil -} - -type deleteRepoRequestPb struct { - RepoId int64 `json:"-" url:"-"` -} - -func deleteRepoRequestFromPb(pb *deleteRepoRequestPb) (*DeleteRepoRequest, error) { - if pb == nil { - return nil, nil - } - st := &DeleteRepoRequest{} - st.RepoId = pb.RepoId - - return st, nil -} - -func deleteRepoResponseToPb(st *DeleteRepoResponse) (*deleteRepoResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteRepoResponsePb{} - - return pb, nil -} - -type deleteRepoResponsePb struct { -} - -func deleteRepoResponseFromPb(pb *deleteRepoResponsePb) (*DeleteRepoResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteRepoResponse{} - - return st, nil -} - -func deleteResponseToPb(st *DeleteResponse) (*deleteResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteResponsePb{} - - return pb, nil -} - -type deleteResponsePb struct { -} - -func deleteResponseFromPb(pb *deleteResponsePb) (*DeleteResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteResponse{} - - return st, nil -} - -func deleteScopeToPb(st *DeleteScope) (*deleteScopePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteScopePb{} - pb.Scope = st.Scope - - return pb, nil -} - -type deleteScopePb struct { - Scope string `json:"scope"` -} - -func deleteScopeFromPb(pb *deleteScopePb) (*DeleteScope, error) { - if pb == nil { - return nil, nil - } - st := &DeleteScope{} - st.Scope = pb.Scope - - return st, nil -} - -func deleteScopeResponseToPb(st *DeleteScopeResponse) (*deleteScopeResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteScopeResponsePb{} - - return pb, nil -} - -type deleteScopeResponsePb struct { -} - -func deleteScopeResponseFromPb(pb *deleteScopeResponsePb) (*DeleteScopeResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteScopeResponse{} - - return st, nil -} - -func deleteSecretToPb(st *DeleteSecret) (*deleteSecretPb, error) { - if st == nil { - return nil, nil - } - pb := &deleteSecretPb{} - pb.Key = st.Key - pb.Scope = st.Scope - - return pb, nil -} - -type deleteSecretPb struct { - Key string `json:"key"` - Scope string `json:"scope"` -} - -func deleteSecretFromPb(pb *deleteSecretPb) (*DeleteSecret, error) { - if pb == nil { - return nil, nil - } - st := &DeleteSecret{} - st.Key = pb.Key - st.Scope = pb.Scope - - return st, nil -} - -func deleteSecretResponseToPb(st *DeleteSecretResponse) (*deleteSecretResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &deleteSecretResponsePb{} - - return pb, nil -} - -type deleteSecretResponsePb struct { -} - -func deleteSecretResponseFromPb(pb *deleteSecretResponsePb) (*DeleteSecretResponse, error) { - if pb == nil { - return nil, nil - } - st := &DeleteSecretResponse{} - - return st, nil -} - -func exportRequestToPb(st *ExportRequest) (*exportRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &exportRequestPb{} - pb.Format = st.Format - pb.Path = st.Path - - return pb, nil -} - -type exportRequestPb struct { - Format ExportFormat `json:"-" url:"format,omitempty"` - Path string `json:"-" url:"path"` -} - -func exportRequestFromPb(pb *exportRequestPb) (*ExportRequest, error) { - if pb == nil { - return nil, nil - } - st := &ExportRequest{} - st.Format = pb.Format - st.Path = pb.Path - - return st, nil -} - -func exportResponseToPb(st *ExportResponse) (*exportResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &exportResponsePb{} - pb.Content = st.Content - pb.FileType = st.FileType - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type exportResponsePb struct { - Content string `json:"content,omitempty"` - FileType string `json:"file_type,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func exportResponseFromPb(pb *exportResponsePb) (*ExportResponse, error) { - if pb == nil { - return nil, nil - } - st := &ExportResponse{} - st.Content = pb.Content - st.FileType = pb.FileType - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *exportResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st exportResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getAclRequestToPb(st *GetAclRequest) (*getAclRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getAclRequestPb{} - pb.Principal = st.Principal - pb.Scope = st.Scope - - return pb, nil -} - -type getAclRequestPb struct { - Principal string `json:"-" url:"principal"` - Scope string `json:"-" url:"scope"` -} - -func getAclRequestFromPb(pb *getAclRequestPb) (*GetAclRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetAclRequest{} - st.Principal = pb.Principal - st.Scope = pb.Scope - - return st, nil -} - -func getCredentialsRequestToPb(st *GetCredentialsRequest) (*getCredentialsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getCredentialsRequestPb{} - pb.CredentialId = st.CredentialId - - return pb, nil -} - -type getCredentialsRequestPb struct { - CredentialId int64 `json:"-" url:"-"` -} - -func getCredentialsRequestFromPb(pb *getCredentialsRequestPb) (*GetCredentialsRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetCredentialsRequest{} - st.CredentialId = pb.CredentialId - - return st, nil -} - -func getCredentialsResponseToPb(st *GetCredentialsResponse) (*getCredentialsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &getCredentialsResponsePb{} - pb.CredentialId = st.CredentialId - pb.GitProvider = st.GitProvider - pb.GitUsername = st.GitUsername - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getCredentialsResponsePb struct { - CredentialId int64 `json:"credential_id"` - GitProvider string `json:"git_provider,omitempty"` - GitUsername string `json:"git_username,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getCredentialsResponseFromPb(pb *getCredentialsResponsePb) (*GetCredentialsResponse, error) { - if pb == nil { - return nil, nil - } - st := &GetCredentialsResponse{} - st.CredentialId = pb.CredentialId - st.GitProvider = pb.GitProvider - st.GitUsername = pb.GitUsername - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getCredentialsResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getCredentialsResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getRepoPermissionLevelsRequestToPb(st *GetRepoPermissionLevelsRequest) (*getRepoPermissionLevelsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getRepoPermissionLevelsRequestPb{} - pb.RepoId = st.RepoId - - return pb, nil -} - -type getRepoPermissionLevelsRequestPb struct { - RepoId string `json:"-" url:"-"` -} - -func getRepoPermissionLevelsRequestFromPb(pb *getRepoPermissionLevelsRequestPb) (*GetRepoPermissionLevelsRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetRepoPermissionLevelsRequest{} - st.RepoId = pb.RepoId - - return st, nil -} - -func getRepoPermissionLevelsResponseToPb(st *GetRepoPermissionLevelsResponse) (*getRepoPermissionLevelsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &getRepoPermissionLevelsResponsePb{} - pb.PermissionLevels = st.PermissionLevels - - return pb, nil -} - -type getRepoPermissionLevelsResponsePb struct { - PermissionLevels []RepoPermissionsDescription `json:"permission_levels,omitempty"` -} - -func getRepoPermissionLevelsResponseFromPb(pb *getRepoPermissionLevelsResponsePb) (*GetRepoPermissionLevelsResponse, error) { - if pb == nil { - return nil, nil - } - st := &GetRepoPermissionLevelsResponse{} - st.PermissionLevels = pb.PermissionLevels - - return st, nil -} - -func getRepoPermissionsRequestToPb(st *GetRepoPermissionsRequest) (*getRepoPermissionsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getRepoPermissionsRequestPb{} - pb.RepoId = st.RepoId - - return pb, nil -} - -type getRepoPermissionsRequestPb struct { - RepoId string `json:"-" url:"-"` -} - -func getRepoPermissionsRequestFromPb(pb *getRepoPermissionsRequestPb) (*GetRepoPermissionsRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetRepoPermissionsRequest{} - st.RepoId = pb.RepoId - - return st, nil -} - -func getRepoRequestToPb(st *GetRepoRequest) (*getRepoRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getRepoRequestPb{} - pb.RepoId = st.RepoId - - return pb, nil -} - -type getRepoRequestPb struct { - RepoId int64 `json:"-" url:"-"` -} - -func getRepoRequestFromPb(pb *getRepoRequestPb) (*GetRepoRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetRepoRequest{} - st.RepoId = pb.RepoId - - return st, nil -} - -func getRepoResponseToPb(st *GetRepoResponse) (*getRepoResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &getRepoResponsePb{} - pb.Branch = st.Branch - pb.HeadCommitId = st.HeadCommitId - pb.Id = st.Id - pb.Path = st.Path - pb.Provider = st.Provider - pb.SparseCheckout = st.SparseCheckout - pb.Url = st.Url - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getRepoResponsePb struct { - Branch string `json:"branch,omitempty"` - HeadCommitId string `json:"head_commit_id,omitempty"` - Id int64 `json:"id,omitempty"` - Path string `json:"path,omitempty"` - Provider string `json:"provider,omitempty"` - SparseCheckout *SparseCheckout `json:"sparse_checkout,omitempty"` - Url string `json:"url,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getRepoResponseFromPb(pb *getRepoResponsePb) (*GetRepoResponse, error) { - if pb == nil { - return nil, nil - } - st := &GetRepoResponse{} - st.Branch = pb.Branch - st.HeadCommitId = pb.HeadCommitId - st.Id = pb.Id - st.Path = pb.Path - st.Provider = pb.Provider - st.SparseCheckout = pb.SparseCheckout - st.Url = pb.Url - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getRepoResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getRepoResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getSecretRequestToPb(st *GetSecretRequest) (*getSecretRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getSecretRequestPb{} - pb.Key = st.Key - pb.Scope = st.Scope - - return pb, nil -} - -type getSecretRequestPb struct { - Key string `json:"-" url:"key"` - Scope string `json:"-" url:"scope"` -} - -func getSecretRequestFromPb(pb *getSecretRequestPb) (*GetSecretRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetSecretRequest{} - st.Key = pb.Key - st.Scope = pb.Scope - - return st, nil -} - -func getSecretResponseToPb(st *GetSecretResponse) (*getSecretResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &getSecretResponsePb{} - pb.Key = st.Key - pb.Value = st.Value - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type getSecretResponsePb struct { - Key string `json:"key,omitempty"` - Value string `json:"value,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func getSecretResponseFromPb(pb *getSecretResponsePb) (*GetSecretResponse, error) { - if pb == nil { - return nil, nil - } - st := &GetSecretResponse{} - st.Key = pb.Key - st.Value = pb.Value - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *getSecretResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st getSecretResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func getStatusRequestToPb(st *GetStatusRequest) (*getStatusRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getStatusRequestPb{} - pb.Path = st.Path - - return pb, nil -} - -type getStatusRequestPb struct { - Path string `json:"-" url:"path"` -} - -func getStatusRequestFromPb(pb *getStatusRequestPb) (*GetStatusRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetStatusRequest{} - st.Path = pb.Path - - return st, nil -} - -func getWorkspaceObjectPermissionLevelsRequestToPb(st *GetWorkspaceObjectPermissionLevelsRequest) (*getWorkspaceObjectPermissionLevelsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getWorkspaceObjectPermissionLevelsRequestPb{} - pb.WorkspaceObjectId = st.WorkspaceObjectId - pb.WorkspaceObjectType = st.WorkspaceObjectType - - return pb, nil -} - -type getWorkspaceObjectPermissionLevelsRequestPb struct { - WorkspaceObjectId string `json:"-" url:"-"` - WorkspaceObjectType string `json:"-" url:"-"` -} - -func getWorkspaceObjectPermissionLevelsRequestFromPb(pb *getWorkspaceObjectPermissionLevelsRequestPb) (*GetWorkspaceObjectPermissionLevelsRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetWorkspaceObjectPermissionLevelsRequest{} - st.WorkspaceObjectId = pb.WorkspaceObjectId - st.WorkspaceObjectType = pb.WorkspaceObjectType - - return st, nil -} - -func getWorkspaceObjectPermissionLevelsResponseToPb(st *GetWorkspaceObjectPermissionLevelsResponse) (*getWorkspaceObjectPermissionLevelsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &getWorkspaceObjectPermissionLevelsResponsePb{} - pb.PermissionLevels = st.PermissionLevels - - return pb, nil -} - -type getWorkspaceObjectPermissionLevelsResponsePb struct { - PermissionLevels []WorkspaceObjectPermissionsDescription `json:"permission_levels,omitempty"` -} - -func getWorkspaceObjectPermissionLevelsResponseFromPb(pb *getWorkspaceObjectPermissionLevelsResponsePb) (*GetWorkspaceObjectPermissionLevelsResponse, error) { - if pb == nil { - return nil, nil - } - st := &GetWorkspaceObjectPermissionLevelsResponse{} - st.PermissionLevels = pb.PermissionLevels - - return st, nil -} - -func getWorkspaceObjectPermissionsRequestToPb(st *GetWorkspaceObjectPermissionsRequest) (*getWorkspaceObjectPermissionsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &getWorkspaceObjectPermissionsRequestPb{} - pb.WorkspaceObjectId = st.WorkspaceObjectId - pb.WorkspaceObjectType = st.WorkspaceObjectType - - return pb, nil -} - -type getWorkspaceObjectPermissionsRequestPb struct { - WorkspaceObjectId string `json:"-" url:"-"` - WorkspaceObjectType string `json:"-" url:"-"` -} - -func getWorkspaceObjectPermissionsRequestFromPb(pb *getWorkspaceObjectPermissionsRequestPb) (*GetWorkspaceObjectPermissionsRequest, error) { - if pb == nil { - return nil, nil - } - st := &GetWorkspaceObjectPermissionsRequest{} - st.WorkspaceObjectId = pb.WorkspaceObjectId - st.WorkspaceObjectType = pb.WorkspaceObjectType - - return st, nil -} - -func importToPb(st *Import) (*importPb, error) { - if st == nil { - return nil, nil - } - pb := &importPb{} - pb.Content = st.Content - pb.Format = st.Format - pb.Language = st.Language - pb.Overwrite = st.Overwrite - pb.Path = st.Path - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type importPb struct { - Content string `json:"content,omitempty"` - Format ImportFormat `json:"format,omitempty"` - Language Language `json:"language,omitempty"` - Overwrite bool `json:"overwrite,omitempty"` - Path string `json:"path"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func importFromPb(pb *importPb) (*Import, error) { - if pb == nil { - return nil, nil - } - st := &Import{} - st.Content = pb.Content - st.Format = pb.Format - st.Language = pb.Language - st.Overwrite = pb.Overwrite - st.Path = pb.Path - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *importPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st importPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func importResponseToPb(st *ImportResponse) (*importResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &importResponsePb{} - - return pb, nil -} - -type importResponsePb struct { -} - -func importResponseFromPb(pb *importResponsePb) (*ImportResponse, error) { - if pb == nil { - return nil, nil - } - st := &ImportResponse{} - - return st, nil -} - -func listAclsRequestToPb(st *ListAclsRequest) (*listAclsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listAclsRequestPb{} - pb.Scope = st.Scope - - return pb, nil -} - -type listAclsRequestPb struct { - Scope string `json:"-" url:"scope"` -} - -func listAclsRequestFromPb(pb *listAclsRequestPb) (*ListAclsRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListAclsRequest{} - st.Scope = pb.Scope - - return st, nil -} - -func listAclsResponseToPb(st *ListAclsResponse) (*listAclsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listAclsResponsePb{} - pb.Items = st.Items - - return pb, nil -} - -type listAclsResponsePb struct { - Items []AclItem `json:"items,omitempty"` -} - -func listAclsResponseFromPb(pb *listAclsResponsePb) (*ListAclsResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListAclsResponse{} - st.Items = pb.Items - - return st, nil -} - -func listCredentialsResponseToPb(st *ListCredentialsResponse) (*listCredentialsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listCredentialsResponsePb{} - pb.Credentials = st.Credentials - - return pb, nil -} - -type listCredentialsResponsePb struct { - Credentials []CredentialInfo `json:"credentials,omitempty"` -} - -func listCredentialsResponseFromPb(pb *listCredentialsResponsePb) (*ListCredentialsResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListCredentialsResponse{} - st.Credentials = pb.Credentials - - return st, nil -} - -func listReposRequestToPb(st *ListReposRequest) (*listReposRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listReposRequestPb{} - pb.NextPageToken = st.NextPageToken - pb.PathPrefix = st.PathPrefix - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listReposRequestPb struct { - NextPageToken string `json:"-" url:"next_page_token,omitempty"` - PathPrefix string `json:"-" url:"path_prefix,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listReposRequestFromPb(pb *listReposRequestPb) (*ListReposRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListReposRequest{} - st.NextPageToken = pb.NextPageToken - st.PathPrefix = pb.PathPrefix - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listReposRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listReposRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listReposResponseToPb(st *ListReposResponse) (*listReposResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listReposResponsePb{} - pb.NextPageToken = st.NextPageToken - pb.Repos = st.Repos - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listReposResponsePb struct { - NextPageToken string `json:"next_page_token,omitempty"` - Repos []RepoInfo `json:"repos,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listReposResponseFromPb(pb *listReposResponsePb) (*ListReposResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListReposResponse{} - st.NextPageToken = pb.NextPageToken - st.Repos = pb.Repos - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listReposResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listReposResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func listResponseToPb(st *ListResponse) (*listResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listResponsePb{} - pb.Objects = st.Objects - - return pb, nil -} - -type listResponsePb struct { - Objects []ObjectInfo `json:"objects,omitempty"` -} - -func listResponseFromPb(pb *listResponsePb) (*ListResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListResponse{} - st.Objects = pb.Objects - - return st, nil -} - -func listScopesResponseToPb(st *ListScopesResponse) (*listScopesResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listScopesResponsePb{} - pb.Scopes = st.Scopes - - return pb, nil -} - -type listScopesResponsePb struct { - Scopes []SecretScope `json:"scopes,omitempty"` -} - -func listScopesResponseFromPb(pb *listScopesResponsePb) (*ListScopesResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListScopesResponse{} - st.Scopes = pb.Scopes - - return st, nil -} - -func listSecretsRequestToPb(st *ListSecretsRequest) (*listSecretsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listSecretsRequestPb{} - pb.Scope = st.Scope - - return pb, nil -} - -type listSecretsRequestPb struct { - Scope string `json:"-" url:"scope"` -} - -func listSecretsRequestFromPb(pb *listSecretsRequestPb) (*ListSecretsRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListSecretsRequest{} - st.Scope = pb.Scope - - return st, nil -} - -func listSecretsResponseToPb(st *ListSecretsResponse) (*listSecretsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &listSecretsResponsePb{} - pb.Secrets = st.Secrets - - return pb, nil -} - -type listSecretsResponsePb struct { - Secrets []SecretMetadata `json:"secrets,omitempty"` -} - -func listSecretsResponseFromPb(pb *listSecretsResponsePb) (*ListSecretsResponse, error) { - if pb == nil { - return nil, nil - } - st := &ListSecretsResponse{} - st.Secrets = pb.Secrets - - return st, nil -} - -func listWorkspaceRequestToPb(st *ListWorkspaceRequest) (*listWorkspaceRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &listWorkspaceRequestPb{} - pb.NotebooksModifiedAfter = st.NotebooksModifiedAfter - pb.Path = st.Path - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type listWorkspaceRequestPb struct { - NotebooksModifiedAfter int64 `json:"-" url:"notebooks_modified_after,omitempty"` - Path string `json:"-" url:"path"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func listWorkspaceRequestFromPb(pb *listWorkspaceRequestPb) (*ListWorkspaceRequest, error) { - if pb == nil { - return nil, nil - } - st := &ListWorkspaceRequest{} - st.NotebooksModifiedAfter = pb.NotebooksModifiedAfter - st.Path = pb.Path - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *listWorkspaceRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st listWorkspaceRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func mkdirsToPb(st *Mkdirs) (*mkdirsPb, error) { - if st == nil { - return nil, nil - } - pb := &mkdirsPb{} - pb.Path = st.Path - - return pb, nil -} - -type mkdirsPb struct { - Path string `json:"path"` -} - -func mkdirsFromPb(pb *mkdirsPb) (*Mkdirs, error) { - if pb == nil { - return nil, nil - } - st := &Mkdirs{} - st.Path = pb.Path - - return st, nil -} - -func mkdirsResponseToPb(st *MkdirsResponse) (*mkdirsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &mkdirsResponsePb{} - - return pb, nil -} - -type mkdirsResponsePb struct { -} - -func mkdirsResponseFromPb(pb *mkdirsResponsePb) (*MkdirsResponse, error) { - if pb == nil { - return nil, nil - } - st := &MkdirsResponse{} - - return st, nil -} - -func objectInfoToPb(st *ObjectInfo) (*objectInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &objectInfoPb{} - pb.CreatedAt = st.CreatedAt - pb.Language = st.Language - pb.ModifiedAt = st.ModifiedAt - pb.ObjectId = st.ObjectId - pb.ObjectType = st.ObjectType - pb.Path = st.Path - pb.ResourceId = st.ResourceId - pb.Size = st.Size - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type objectInfoPb struct { - CreatedAt int64 `json:"created_at,omitempty"` - Language Language `json:"language,omitempty"` - ModifiedAt int64 `json:"modified_at,omitempty"` - ObjectId int64 `json:"object_id,omitempty"` - ObjectType ObjectType `json:"object_type,omitempty"` - Path string `json:"path,omitempty"` - ResourceId string `json:"resource_id,omitempty"` - Size int64 `json:"size,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func objectInfoFromPb(pb *objectInfoPb) (*ObjectInfo, error) { - if pb == nil { - return nil, nil - } - st := &ObjectInfo{} - st.CreatedAt = pb.CreatedAt - st.Language = pb.Language - st.ModifiedAt = pb.ModifiedAt - st.ObjectId = pb.ObjectId - st.ObjectType = pb.ObjectType - st.Path = pb.Path - st.ResourceId = pb.ResourceId - st.Size = pb.Size - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *objectInfoPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st objectInfoPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func putAclToPb(st *PutAcl) (*putAclPb, error) { - if st == nil { - return nil, nil - } - pb := &putAclPb{} - pb.Permission = st.Permission - pb.Principal = st.Principal - pb.Scope = st.Scope - - return pb, nil -} - -type putAclPb struct { - Permission AclPermission `json:"permission"` - Principal string `json:"principal"` - Scope string `json:"scope"` -} - -func putAclFromPb(pb *putAclPb) (*PutAcl, error) { - if pb == nil { - return nil, nil - } - st := &PutAcl{} - st.Permission = pb.Permission - st.Principal = pb.Principal - st.Scope = pb.Scope - - return st, nil -} - -func putAclResponseToPb(st *PutAclResponse) (*putAclResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &putAclResponsePb{} - - return pb, nil -} - -type putAclResponsePb struct { -} - -func putAclResponseFromPb(pb *putAclResponsePb) (*PutAclResponse, error) { - if pb == nil { - return nil, nil - } - st := &PutAclResponse{} - - return st, nil -} - -func putSecretToPb(st *PutSecret) (*putSecretPb, error) { - if st == nil { - return nil, nil - } - pb := &putSecretPb{} - pb.BytesValue = st.BytesValue - pb.Key = st.Key - pb.Scope = st.Scope - pb.StringValue = st.StringValue - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type putSecretPb struct { - BytesValue string `json:"bytes_value,omitempty"` - Key string `json:"key"` - Scope string `json:"scope"` - StringValue string `json:"string_value,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func putSecretFromPb(pb *putSecretPb) (*PutSecret, error) { - if pb == nil { - return nil, nil - } - st := &PutSecret{} - st.BytesValue = pb.BytesValue - st.Key = pb.Key - st.Scope = pb.Scope - st.StringValue = pb.StringValue - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *putSecretPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st putSecretPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func putSecretResponseToPb(st *PutSecretResponse) (*putSecretResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &putSecretResponsePb{} - - return pb, nil -} - -type putSecretResponsePb struct { -} - -func putSecretResponseFromPb(pb *putSecretResponsePb) (*PutSecretResponse, error) { - if pb == nil { - return nil, nil - } - st := &PutSecretResponse{} - - return st, nil -} - -func repoAccessControlRequestToPb(st *RepoAccessControlRequest) (*repoAccessControlRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &repoAccessControlRequestPb{} - pb.GroupName = st.GroupName - pb.PermissionLevel = st.PermissionLevel - pb.ServicePrincipalName = st.ServicePrincipalName - pb.UserName = st.UserName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type repoAccessControlRequestPb struct { - GroupName string `json:"group_name,omitempty"` - PermissionLevel RepoPermissionLevel `json:"permission_level,omitempty"` - ServicePrincipalName string `json:"service_principal_name,omitempty"` - UserName string `json:"user_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func repoAccessControlRequestFromPb(pb *repoAccessControlRequestPb) (*RepoAccessControlRequest, error) { - if pb == nil { - return nil, nil - } - st := &RepoAccessControlRequest{} - st.GroupName = pb.GroupName - st.PermissionLevel = pb.PermissionLevel - st.ServicePrincipalName = pb.ServicePrincipalName - st.UserName = pb.UserName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *repoAccessControlRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st repoAccessControlRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func repoAccessControlResponseToPb(st *RepoAccessControlResponse) (*repoAccessControlResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &repoAccessControlResponsePb{} - pb.AllPermissions = st.AllPermissions - pb.DisplayName = st.DisplayName - pb.GroupName = st.GroupName - pb.ServicePrincipalName = st.ServicePrincipalName - pb.UserName = st.UserName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type repoAccessControlResponsePb struct { - AllPermissions []RepoPermission `json:"all_permissions,omitempty"` - DisplayName string `json:"display_name,omitempty"` - GroupName string `json:"group_name,omitempty"` - ServicePrincipalName string `json:"service_principal_name,omitempty"` - UserName string `json:"user_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func repoAccessControlResponseFromPb(pb *repoAccessControlResponsePb) (*RepoAccessControlResponse, error) { - if pb == nil { - return nil, nil - } - st := &RepoAccessControlResponse{} - st.AllPermissions = pb.AllPermissions - st.DisplayName = pb.DisplayName - st.GroupName = pb.GroupName - st.ServicePrincipalName = pb.ServicePrincipalName - st.UserName = pb.UserName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *repoAccessControlResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st repoAccessControlResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func repoInfoToPb(st *RepoInfo) (*repoInfoPb, error) { - if st == nil { - return nil, nil - } - pb := &repoInfoPb{} - pb.Branch = st.Branch - pb.HeadCommitId = st.HeadCommitId - pb.Id = st.Id - pb.Path = st.Path - pb.Provider = st.Provider - pb.SparseCheckout = st.SparseCheckout - pb.Url = st.Url - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type repoInfoPb struct { - Branch string `json:"branch,omitempty"` - HeadCommitId string `json:"head_commit_id,omitempty"` - Id int64 `json:"id,omitempty"` - Path string `json:"path,omitempty"` - Provider string `json:"provider,omitempty"` - SparseCheckout *SparseCheckout `json:"sparse_checkout,omitempty"` - Url string `json:"url,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func repoInfoFromPb(pb *repoInfoPb) (*RepoInfo, error) { - if pb == nil { - return nil, nil - } - st := &RepoInfo{} - st.Branch = pb.Branch - st.HeadCommitId = pb.HeadCommitId - st.Id = pb.Id - st.Path = pb.Path - st.Provider = pb.Provider - st.SparseCheckout = pb.SparseCheckout - st.Url = pb.Url - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *repoInfoPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st repoInfoPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func repoPermissionToPb(st *RepoPermission) (*repoPermissionPb, error) { - if st == nil { - return nil, nil - } - pb := &repoPermissionPb{} - pb.Inherited = st.Inherited - pb.InheritedFromObject = st.InheritedFromObject - pb.PermissionLevel = st.PermissionLevel - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type repoPermissionPb struct { - Inherited bool `json:"inherited,omitempty"` - InheritedFromObject []string `json:"inherited_from_object,omitempty"` - PermissionLevel RepoPermissionLevel `json:"permission_level,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func repoPermissionFromPb(pb *repoPermissionPb) (*RepoPermission, error) { - if pb == nil { - return nil, nil - } - st := &RepoPermission{} - st.Inherited = pb.Inherited - st.InheritedFromObject = pb.InheritedFromObject - st.PermissionLevel = pb.PermissionLevel - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *repoPermissionPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st repoPermissionPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func repoPermissionsToPb(st *RepoPermissions) (*repoPermissionsPb, error) { - if st == nil { - return nil, nil - } - pb := &repoPermissionsPb{} - pb.AccessControlList = st.AccessControlList - pb.ObjectId = st.ObjectId - pb.ObjectType = st.ObjectType - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type repoPermissionsPb struct { - AccessControlList []RepoAccessControlResponse `json:"access_control_list,omitempty"` - ObjectId string `json:"object_id,omitempty"` - ObjectType string `json:"object_type,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func repoPermissionsFromPb(pb *repoPermissionsPb) (*RepoPermissions, error) { - if pb == nil { - return nil, nil - } - st := &RepoPermissions{} - st.AccessControlList = pb.AccessControlList - st.ObjectId = pb.ObjectId - st.ObjectType = pb.ObjectType - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *repoPermissionsPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st repoPermissionsPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func repoPermissionsDescriptionToPb(st *RepoPermissionsDescription) (*repoPermissionsDescriptionPb, error) { - if st == nil { - return nil, nil - } - pb := &repoPermissionsDescriptionPb{} - pb.Description = st.Description - pb.PermissionLevel = st.PermissionLevel - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type repoPermissionsDescriptionPb struct { - Description string `json:"description,omitempty"` - PermissionLevel RepoPermissionLevel `json:"permission_level,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func repoPermissionsDescriptionFromPb(pb *repoPermissionsDescriptionPb) (*RepoPermissionsDescription, error) { - if pb == nil { - return nil, nil - } - st := &RepoPermissionsDescription{} - st.Description = pb.Description - st.PermissionLevel = pb.PermissionLevel - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *repoPermissionsDescriptionPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st repoPermissionsDescriptionPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func repoPermissionsRequestToPb(st *RepoPermissionsRequest) (*repoPermissionsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &repoPermissionsRequestPb{} - pb.AccessControlList = st.AccessControlList - pb.RepoId = st.RepoId - - return pb, nil -} - -type repoPermissionsRequestPb struct { - AccessControlList []RepoAccessControlRequest `json:"access_control_list,omitempty"` - RepoId string `json:"-" url:"-"` -} - -func repoPermissionsRequestFromPb(pb *repoPermissionsRequestPb) (*RepoPermissionsRequest, error) { - if pb == nil { - return nil, nil - } - st := &RepoPermissionsRequest{} - st.AccessControlList = pb.AccessControlList - st.RepoId = pb.RepoId - - return st, nil -} - -func secretMetadataToPb(st *SecretMetadata) (*secretMetadataPb, error) { - if st == nil { - return nil, nil - } - pb := &secretMetadataPb{} - pb.Key = st.Key - pb.LastUpdatedTimestamp = st.LastUpdatedTimestamp - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type secretMetadataPb struct { - Key string `json:"key,omitempty"` - LastUpdatedTimestamp int64 `json:"last_updated_timestamp,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func secretMetadataFromPb(pb *secretMetadataPb) (*SecretMetadata, error) { - if pb == nil { - return nil, nil - } - st := &SecretMetadata{} - st.Key = pb.Key - st.LastUpdatedTimestamp = pb.LastUpdatedTimestamp - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *secretMetadataPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st secretMetadataPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func secretScopeToPb(st *SecretScope) (*secretScopePb, error) { - if st == nil { - return nil, nil - } - pb := &secretScopePb{} - pb.BackendType = st.BackendType - pb.KeyvaultMetadata = st.KeyvaultMetadata - pb.Name = st.Name - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type secretScopePb struct { - BackendType ScopeBackendType `json:"backend_type,omitempty"` - KeyvaultMetadata *AzureKeyVaultSecretScopeMetadata `json:"keyvault_metadata,omitempty"` - Name string `json:"name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func secretScopeFromPb(pb *secretScopePb) (*SecretScope, error) { - if pb == nil { - return nil, nil - } - st := &SecretScope{} - st.BackendType = pb.BackendType - st.KeyvaultMetadata = pb.KeyvaultMetadata - st.Name = pb.Name - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *secretScopePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st secretScopePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func sparseCheckoutToPb(st *SparseCheckout) (*sparseCheckoutPb, error) { - if st == nil { - return nil, nil - } - pb := &sparseCheckoutPb{} - pb.Patterns = st.Patterns - - return pb, nil -} - -type sparseCheckoutPb struct { - Patterns []string `json:"patterns,omitempty"` -} - -func sparseCheckoutFromPb(pb *sparseCheckoutPb) (*SparseCheckout, error) { - if pb == nil { - return nil, nil - } - st := &SparseCheckout{} - st.Patterns = pb.Patterns - - return st, nil -} - -func sparseCheckoutUpdateToPb(st *SparseCheckoutUpdate) (*sparseCheckoutUpdatePb, error) { - if st == nil { - return nil, nil - } - pb := &sparseCheckoutUpdatePb{} - pb.Patterns = st.Patterns - - return pb, nil -} - -type sparseCheckoutUpdatePb struct { - Patterns []string `json:"patterns,omitempty"` -} - -func sparseCheckoutUpdateFromPb(pb *sparseCheckoutUpdatePb) (*SparseCheckoutUpdate, error) { - if pb == nil { - return nil, nil - } - st := &SparseCheckoutUpdate{} - st.Patterns = pb.Patterns - - return st, nil -} - -func updateCredentialsRequestToPb(st *UpdateCredentialsRequest) (*updateCredentialsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &updateCredentialsRequestPb{} - pb.CredentialId = st.CredentialId - pb.GitProvider = st.GitProvider - pb.GitUsername = st.GitUsername - pb.PersonalAccessToken = st.PersonalAccessToken - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type updateCredentialsRequestPb struct { - CredentialId int64 `json:"-" url:"-"` - GitProvider string `json:"git_provider"` - GitUsername string `json:"git_username,omitempty"` - PersonalAccessToken string `json:"personal_access_token,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func updateCredentialsRequestFromPb(pb *updateCredentialsRequestPb) (*UpdateCredentialsRequest, error) { - if pb == nil { - return nil, nil - } - st := &UpdateCredentialsRequest{} - st.CredentialId = pb.CredentialId - st.GitProvider = pb.GitProvider - st.GitUsername = pb.GitUsername - st.PersonalAccessToken = pb.PersonalAccessToken - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *updateCredentialsRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st updateCredentialsRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func updateCredentialsResponseToPb(st *UpdateCredentialsResponse) (*updateCredentialsResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &updateCredentialsResponsePb{} - - return pb, nil -} - -type updateCredentialsResponsePb struct { -} - -func updateCredentialsResponseFromPb(pb *updateCredentialsResponsePb) (*UpdateCredentialsResponse, error) { - if pb == nil { - return nil, nil - } - st := &UpdateCredentialsResponse{} - - return st, nil -} - -func updateRepoRequestToPb(st *UpdateRepoRequest) (*updateRepoRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &updateRepoRequestPb{} - pb.Branch = st.Branch - pb.RepoId = st.RepoId - pb.SparseCheckout = st.SparseCheckout - pb.Tag = st.Tag - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type updateRepoRequestPb struct { - Branch string `json:"branch,omitempty"` - RepoId int64 `json:"-" url:"-"` - SparseCheckout *SparseCheckoutUpdate `json:"sparse_checkout,omitempty"` - Tag string `json:"tag,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func updateRepoRequestFromPb(pb *updateRepoRequestPb) (*UpdateRepoRequest, error) { - if pb == nil { - return nil, nil - } - st := &UpdateRepoRequest{} - st.Branch = pb.Branch - st.RepoId = pb.RepoId - st.SparseCheckout = pb.SparseCheckout - st.Tag = pb.Tag - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *updateRepoRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st updateRepoRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func updateRepoResponseToPb(st *UpdateRepoResponse) (*updateRepoResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &updateRepoResponsePb{} - - return pb, nil -} - -type updateRepoResponsePb struct { -} - -func updateRepoResponseFromPb(pb *updateRepoResponsePb) (*UpdateRepoResponse, error) { - if pb == nil { - return nil, nil - } - st := &UpdateRepoResponse{} - - return st, nil -} - -func workspaceObjectAccessControlRequestToPb(st *WorkspaceObjectAccessControlRequest) (*workspaceObjectAccessControlRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &workspaceObjectAccessControlRequestPb{} - pb.GroupName = st.GroupName - pb.PermissionLevel = st.PermissionLevel - pb.ServicePrincipalName = st.ServicePrincipalName - pb.UserName = st.UserName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type workspaceObjectAccessControlRequestPb struct { - GroupName string `json:"group_name,omitempty"` - PermissionLevel WorkspaceObjectPermissionLevel `json:"permission_level,omitempty"` - ServicePrincipalName string `json:"service_principal_name,omitempty"` - UserName string `json:"user_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func workspaceObjectAccessControlRequestFromPb(pb *workspaceObjectAccessControlRequestPb) (*WorkspaceObjectAccessControlRequest, error) { - if pb == nil { - return nil, nil - } - st := &WorkspaceObjectAccessControlRequest{} - st.GroupName = pb.GroupName - st.PermissionLevel = pb.PermissionLevel - st.ServicePrincipalName = pb.ServicePrincipalName - st.UserName = pb.UserName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *workspaceObjectAccessControlRequestPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st workspaceObjectAccessControlRequestPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func workspaceObjectAccessControlResponseToPb(st *WorkspaceObjectAccessControlResponse) (*workspaceObjectAccessControlResponsePb, error) { - if st == nil { - return nil, nil - } - pb := &workspaceObjectAccessControlResponsePb{} - pb.AllPermissions = st.AllPermissions - pb.DisplayName = st.DisplayName - pb.GroupName = st.GroupName - pb.ServicePrincipalName = st.ServicePrincipalName - pb.UserName = st.UserName - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type workspaceObjectAccessControlResponsePb struct { - AllPermissions []WorkspaceObjectPermission `json:"all_permissions,omitempty"` - DisplayName string `json:"display_name,omitempty"` - GroupName string `json:"group_name,omitempty"` - ServicePrincipalName string `json:"service_principal_name,omitempty"` - UserName string `json:"user_name,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func workspaceObjectAccessControlResponseFromPb(pb *workspaceObjectAccessControlResponsePb) (*WorkspaceObjectAccessControlResponse, error) { - if pb == nil { - return nil, nil - } - st := &WorkspaceObjectAccessControlResponse{} - st.AllPermissions = pb.AllPermissions - st.DisplayName = pb.DisplayName - st.GroupName = pb.GroupName - st.ServicePrincipalName = pb.ServicePrincipalName - st.UserName = pb.UserName - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *workspaceObjectAccessControlResponsePb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st workspaceObjectAccessControlResponsePb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func workspaceObjectPermissionToPb(st *WorkspaceObjectPermission) (*workspaceObjectPermissionPb, error) { - if st == nil { - return nil, nil - } - pb := &workspaceObjectPermissionPb{} - pb.Inherited = st.Inherited - pb.InheritedFromObject = st.InheritedFromObject - pb.PermissionLevel = st.PermissionLevel - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type workspaceObjectPermissionPb struct { - Inherited bool `json:"inherited,omitempty"` - InheritedFromObject []string `json:"inherited_from_object,omitempty"` - PermissionLevel WorkspaceObjectPermissionLevel `json:"permission_level,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func workspaceObjectPermissionFromPb(pb *workspaceObjectPermissionPb) (*WorkspaceObjectPermission, error) { - if pb == nil { - return nil, nil - } - st := &WorkspaceObjectPermission{} - st.Inherited = pb.Inherited - st.InheritedFromObject = pb.InheritedFromObject - st.PermissionLevel = pb.PermissionLevel - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *workspaceObjectPermissionPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st workspaceObjectPermissionPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func workspaceObjectPermissionsToPb(st *WorkspaceObjectPermissions) (*workspaceObjectPermissionsPb, error) { - if st == nil { - return nil, nil - } - pb := &workspaceObjectPermissionsPb{} - pb.AccessControlList = st.AccessControlList - pb.ObjectId = st.ObjectId - pb.ObjectType = st.ObjectType - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type workspaceObjectPermissionsPb struct { - AccessControlList []WorkspaceObjectAccessControlResponse `json:"access_control_list,omitempty"` - ObjectId string `json:"object_id,omitempty"` - ObjectType string `json:"object_type,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func workspaceObjectPermissionsFromPb(pb *workspaceObjectPermissionsPb) (*WorkspaceObjectPermissions, error) { - if pb == nil { - return nil, nil - } - st := &WorkspaceObjectPermissions{} - st.AccessControlList = pb.AccessControlList - st.ObjectId = pb.ObjectId - st.ObjectType = pb.ObjectType - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *workspaceObjectPermissionsPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st workspaceObjectPermissionsPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func workspaceObjectPermissionsDescriptionToPb(st *WorkspaceObjectPermissionsDescription) (*workspaceObjectPermissionsDescriptionPb, error) { - if st == nil { - return nil, nil - } - pb := &workspaceObjectPermissionsDescriptionPb{} - pb.Description = st.Description - pb.PermissionLevel = st.PermissionLevel - - pb.ForceSendFields = st.ForceSendFields - return pb, nil -} - -type workspaceObjectPermissionsDescriptionPb struct { - Description string `json:"description,omitempty"` - PermissionLevel WorkspaceObjectPermissionLevel `json:"permission_level,omitempty"` - - ForceSendFields []string `json:"-" url:"-"` -} - -func workspaceObjectPermissionsDescriptionFromPb(pb *workspaceObjectPermissionsDescriptionPb) (*WorkspaceObjectPermissionsDescription, error) { - if pb == nil { - return nil, nil - } - st := &WorkspaceObjectPermissionsDescription{} - st.Description = pb.Description - st.PermissionLevel = pb.PermissionLevel - - st.ForceSendFields = pb.ForceSendFields - return st, nil -} - -func (st *workspaceObjectPermissionsDescriptionPb) UnmarshalJSON(b []byte) error { - return marshal.Unmarshal(b, st) -} - -func (st workspaceObjectPermissionsDescriptionPb) MarshalJSON() ([]byte, error) { - return marshal.Marshal(st) -} - -func workspaceObjectPermissionsRequestToPb(st *WorkspaceObjectPermissionsRequest) (*workspaceObjectPermissionsRequestPb, error) { - if st == nil { - return nil, nil - } - pb := &workspaceObjectPermissionsRequestPb{} - pb.AccessControlList = st.AccessControlList - pb.WorkspaceObjectId = st.WorkspaceObjectId - pb.WorkspaceObjectType = st.WorkspaceObjectType - - return pb, nil -} - -type workspaceObjectPermissionsRequestPb struct { - AccessControlList []WorkspaceObjectAccessControlRequest `json:"access_control_list,omitempty"` - WorkspaceObjectId string `json:"-" url:"-"` - WorkspaceObjectType string `json:"-" url:"-"` -} - -func workspaceObjectPermissionsRequestFromPb(pb *workspaceObjectPermissionsRequestPb) (*WorkspaceObjectPermissionsRequest, error) { - if pb == nil { - return nil, nil - } - st := &WorkspaceObjectPermissionsRequest{} - st.AccessControlList = pb.AccessControlList - st.WorkspaceObjectId = pb.WorkspaceObjectId - st.WorkspaceObjectType = pb.WorkspaceObjectType - - return st, nil -} - -func durationToPb(d *time.Duration) (*string, error) { - if d == nil { - return nil, nil - } - s := fmt.Sprintf("%.9fs", d.Seconds()) - return &s, nil -} - -func durationFromPb(s *string) (*time.Duration, error) { - if s == nil { - return nil, nil - } - d, err := time.ParseDuration(*s) - if err != nil { - return nil, err - } - return &d, nil -} - -func timestampToPb(t *time.Time) (*string, error) { - if t == nil { - return nil, nil - } - s := t.Format(time.RFC3339) - return &s, nil -} - -func timestampFromPb(s *string) (*time.Time, error) { - if s == nil { - return nil, nil - } - t, err := time.Parse(time.RFC3339, *s) - if err != nil { - return nil, err - } - return &t, nil -} - -func fieldMaskToPb(fm *[]string) (*string, error) { - if fm == nil { - return nil, nil - } - s := strings.Join(*fm, ",") - return &s, nil -} - -func fieldMaskFromPb(s *string) (*[]string, error) { - if s == nil { - return nil, nil - } - fm := strings.Split(*s, ",") - return &fm, nil -} diff --git a/service/workspace/model.go b/service/workspace/model.go index 277828eb5..39c8a5969 100755 --- a/service/workspace/model.go +++ b/service/workspace/model.go @@ -3,44 +3,18 @@ package workspace import ( - "encoding/json" "fmt" + + "github.com/databricks/databricks-sdk-go/marshal" ) type AclItem struct { // The permission level applied to the principal. - // Wire name: 'permission' Permission AclPermission `json:"permission"` // The principal in which the permission is applied. - // Wire name: 'principal' Principal string `json:"principal"` } -func (st *AclItem) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &aclItemPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := aclItemFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st AclItem) MarshalJSON() ([]byte, error) { - pb, err := aclItemToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type AclPermission string const AclPermissionManage AclPermission = `MANAGE` @@ -83,45 +57,17 @@ func (f *AclPermission) Type() string { type AzureKeyVaultSecretScopeMetadata struct { // The DNS of the KeyVault - // Wire name: 'dns_name' DnsName string `json:"dns_name"` // The resource id of the azure KeyVault that user wants to associate the // scope with. - // Wire name: 'resource_id' ResourceId string `json:"resource_id"` } -func (st *AzureKeyVaultSecretScopeMetadata) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &azureKeyVaultSecretScopeMetadataPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := azureKeyVaultSecretScopeMetadataFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st AzureKeyVaultSecretScopeMetadata) MarshalJSON() ([]byte, error) { - pb, err := azureKeyVaultSecretScopeMetadataToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type CreateCredentialsRequest struct { // Git provider. This field is case-insensitive. The available Git providers // are `gitHub`, `bitbucketCloud`, `gitLab`, `azureDevOpsServices`, // `gitHubEnterprise`, `bitbucketServer`, `gitLabEnterpriseEdition` and // `awsCodeCommit`. - // Wire name: 'git_provider' GitProvider string `json:"git_provider"` // The username or email provided with your Git provider account, depending // on which provider you are using. For GitHub, GitHub Enterprise Server, or @@ -130,664 +76,215 @@ type CreateCredentialsRequest struct { // BitBucket or BitBucket Server, username must be used. For all other // providers please see your provider's Personal Access Token authentication // documentation to see what is supported. - // Wire name: 'git_username' GitUsername string `json:"git_username,omitempty"` // The personal access token used to authenticate to the corresponding Git // provider. For certain providers, support may exist for other types of // scoped access tokens. [Learn more]. // // [Learn more]: https://docs.databricks.com/repos/get-access-tokens-from-git-provider.html - // Wire name: 'personal_access_token' PersonalAccessToken string `json:"personal_access_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateCredentialsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createCredentialsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createCredentialsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateCredentialsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateCredentialsRequest) MarshalJSON() ([]byte, error) { - pb, err := createCredentialsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateCredentialsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreateCredentialsResponse struct { // ID of the credential object in the workspace. - // Wire name: 'credential_id' CredentialId int64 `json:"credential_id"` // The Git provider associated with the credential. - // Wire name: 'git_provider' GitProvider string `json:"git_provider"` // The username or email provided with your Git provider account and // associated with the credential. - // Wire name: 'git_username' GitUsername string `json:"git_username,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateCredentialsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createCredentialsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createCredentialsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateCredentialsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateCredentialsResponse) MarshalJSON() ([]byte, error) { - pb, err := createCredentialsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateCredentialsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreateRepoRequest struct { // Desired path for the repo in the workspace. Almost any path in the // workspace can be chosen. If repo is created in `/Repos`, path must be in // the format `/Repos/{folder}/{repo-name}`. - // Wire name: 'path' Path string `json:"path,omitempty"` // Git provider. This field is case-insensitive. The available Git providers // are `gitHub`, `bitbucketCloud`, `gitLab`, `azureDevOpsServices`, // `gitHubEnterprise`, `bitbucketServer`, `gitLabEnterpriseEdition` and // `awsCodeCommit`. - // Wire name: 'provider' Provider string `json:"provider"` // If specified, the repo will be created with sparse checkout enabled. You // cannot enable/disable sparse checkout after the repo is created. - // Wire name: 'sparse_checkout' SparseCheckout *SparseCheckout `json:"sparse_checkout,omitempty"` // URL of the Git repository to be linked. - // Wire name: 'url' Url string `json:"url"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateRepoRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createRepoRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createRepoRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateRepoRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateRepoRequest) MarshalJSON() ([]byte, error) { - pb, err := createRepoRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateRepoRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreateRepoResponse struct { // Branch that the Git folder (repo) is checked out to. - // Wire name: 'branch' Branch string `json:"branch,omitempty"` // SHA-1 hash representing the commit ID of the current HEAD of the Git // folder (repo). - // Wire name: 'head_commit_id' HeadCommitId string `json:"head_commit_id,omitempty"` // ID of the Git folder (repo) object in the workspace. - // Wire name: 'id' Id int64 `json:"id,omitempty"` // Path of the Git folder (repo) in the workspace. - // Wire name: 'path' Path string `json:"path,omitempty"` // Git provider of the linked Git repository. - // Wire name: 'provider' Provider string `json:"provider,omitempty"` // Sparse checkout settings for the Git folder (repo). - // Wire name: 'sparse_checkout' SparseCheckout *SparseCheckout `json:"sparse_checkout,omitempty"` // URL of the linked Git repository. - // Wire name: 'url' Url string `json:"url,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateRepoResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createRepoResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createRepoResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateRepoResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateRepoResponse) MarshalJSON() ([]byte, error) { - pb, err := createRepoResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateRepoResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreateScope struct { // The metadata for the secret scope if the type is `AZURE_KEYVAULT` - // Wire name: 'backend_azure_keyvault' BackendAzureKeyvault *AzureKeyVaultSecretScopeMetadata `json:"backend_azure_keyvault,omitempty"` // The principal that is initially granted `MANAGE` permission to the // created scope. - // Wire name: 'initial_manage_principal' InitialManagePrincipal string `json:"initial_manage_principal,omitempty"` // Scope name requested by the user. Scope names are unique. - // Wire name: 'scope' Scope string `json:"scope"` // The backend type the scope will be created with. If not specified, will // default to `DATABRICKS` - // Wire name: 'scope_backend_type' ScopeBackendType ScopeBackendType `json:"scope_backend_type,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CreateScope) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createScopePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createScopeFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CreateScope) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CreateScope) MarshalJSON() ([]byte, error) { - pb, err := createScopeToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CreateScope) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type CreateScopeResponse struct { } -func (st *CreateScopeResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &createScopeResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := createScopeResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st CreateScopeResponse) MarshalJSON() ([]byte, error) { - pb, err := createScopeResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type CredentialInfo struct { // ID of the credential object in the workspace. - // Wire name: 'credential_id' CredentialId int64 `json:"credential_id"` // The Git provider associated with the credential. - // Wire name: 'git_provider' GitProvider string `json:"git_provider,omitempty"` // The username or email provided with your Git provider account and // associated with the credential. - // Wire name: 'git_username' GitUsername string `json:"git_username,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *CredentialInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &credentialInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := credentialInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *CredentialInfo) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st CredentialInfo) MarshalJSON() ([]byte, error) { - pb, err := credentialInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s CredentialInfo) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type Delete struct { // The absolute path of the notebook or directory. - // Wire name: 'path' Path string `json:"path"` // The flag that specifies whether to delete the object recursively. It is // `false` by default. Please note this deleting directory is not atomic. If // it fails in the middle, some of objects under this directory may be // deleted and cannot be undone. - // Wire name: 'recursive' Recursive bool `json:"recursive,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *Delete) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deletePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *Delete) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st Delete) MarshalJSON() ([]byte, error) { - pb, err := deleteToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s Delete) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type DeleteAcl struct { // The principal to remove an existing ACL from. - // Wire name: 'principal' Principal string `json:"principal"` // The name of the scope to remove permissions from. - // Wire name: 'scope' Scope string `json:"scope"` } -func (st *DeleteAcl) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteAclPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteAclFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteAcl) MarshalJSON() ([]byte, error) { - pb, err := deleteAclToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type DeleteAclResponse struct { } -func (st *DeleteAclResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteAclResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteAclResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteAclResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteAclResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Delete a credential type DeleteCredentialsRequest struct { // The ID for the corresponding credential to access. - CredentialId int64 `json:"-" tf:"-"` -} - -func (st *DeleteCredentialsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteCredentialsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteCredentialsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteCredentialsRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteCredentialsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + CredentialId int64 `json:"-" url:"-"` } type DeleteCredentialsResponse struct { } -func (st *DeleteCredentialsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteCredentialsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteCredentialsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteCredentialsResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteCredentialsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Delete a repo type DeleteRepoRequest struct { // The ID for the corresponding repo to delete. - RepoId int64 `json:"-" tf:"-"` -} - -func (st *DeleteRepoRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteRepoRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteRepoRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteRepoRequest) MarshalJSON() ([]byte, error) { - pb, err := deleteRepoRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + RepoId int64 `json:"-" url:"-"` } type DeleteRepoResponse struct { } -func (st *DeleteRepoResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteRepoResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteRepoResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteRepoResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteRepoResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type DeleteResponse struct { } -func (st *DeleteResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type DeleteScope struct { // Name of the scope to delete. - // Wire name: 'scope' Scope string `json:"scope"` } -func (st *DeleteScope) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteScopePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteScopeFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteScope) MarshalJSON() ([]byte, error) { - pb, err := deleteScopeToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type DeleteScopeResponse struct { } -func (st *DeleteScopeResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteScopeResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteScopeResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteScopeResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteScopeResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type DeleteSecret struct { // Name of the secret to delete. - // Wire name: 'key' Key string `json:"key"` // The name of the scope that contains the secret to delete. - // Wire name: 'scope' Scope string `json:"scope"` } -func (st *DeleteSecret) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteSecretPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteSecretFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteSecret) MarshalJSON() ([]byte, error) { - pb, err := deleteSecretToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type DeleteSecretResponse struct { } -func (st *DeleteSecretResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &deleteSecretResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := deleteSecretResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st DeleteSecretResponse) MarshalJSON() ([]byte, error) { - pb, err := deleteSecretResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // The format for workspace import and export. type ExportFormat string @@ -857,35 +354,10 @@ type ExportRequest struct { // Markdown format. - `AUTO`: The object or directory is exported depending // on the objects type. Directory exports will include notebooks and // workspace files. - Format ExportFormat `json:"-" tf:"-"` + Format ExportFormat `json:"-" url:"format,omitempty"` // The absolute path of the object or directory. Exporting a directory is // only supported for the `DBC`, `SOURCE`, and `AUTO` format. - Path string `json:"-" tf:"-"` -} - -func (st *ExportRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &exportRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := exportRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ExportRequest) MarshalJSON() ([]byte, error) { - pb, err := exportRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Path string `json:"-" url:"path"` } // The request field `direct_download` determines whether a JSON response or @@ -893,514 +365,155 @@ func (st ExportRequest) MarshalJSON() ([]byte, error) { type ExportResponse struct { // The base64-encoded content. If the limit (10MB) is exceeded, exception // with error code **MAX_NOTEBOOK_SIZE_EXCEEDED** is thrown. - // Wire name: 'content' Content string `json:"content,omitempty"` // The file type of the exported file. - // Wire name: 'file_type' FileType string `json:"file_type,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ExportResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &exportResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := exportResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ExportResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ExportResponse) MarshalJSON() ([]byte, error) { - pb, err := exportResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ExportResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get secret ACL details type GetAclRequest struct { // The principal to fetch ACL information for. - Principal string `json:"-" tf:"-"` + Principal string `json:"-" url:"principal"` // The name of the scope to fetch ACL information from. - Scope string `json:"-" tf:"-"` -} - -func (st *GetAclRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getAclRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getAclRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetAclRequest) MarshalJSON() ([]byte, error) { - pb, err := getAclRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Scope string `json:"-" url:"scope"` } // Get a credential entry type GetCredentialsRequest struct { // The ID for the corresponding credential to access. - CredentialId int64 `json:"-" tf:"-"` -} - -func (st *GetCredentialsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getCredentialsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getCredentialsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetCredentialsRequest) MarshalJSON() ([]byte, error) { - pb, err := getCredentialsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + CredentialId int64 `json:"-" url:"-"` } type GetCredentialsResponse struct { // ID of the credential object in the workspace. - // Wire name: 'credential_id' CredentialId int64 `json:"credential_id"` // The Git provider associated with the credential. - // Wire name: 'git_provider' GitProvider string `json:"git_provider,omitempty"` // The username or email provided with your Git provider account and // associated with the credential. - // Wire name: 'git_username' GitUsername string `json:"git_username,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetCredentialsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getCredentialsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getCredentialsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetCredentialsResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetCredentialsResponse) MarshalJSON() ([]byte, error) { - pb, err := getCredentialsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetCredentialsResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get repo permission levels type GetRepoPermissionLevelsRequest struct { // The repo for which to get or manage permissions. - RepoId string `json:"-" tf:"-"` -} - -func (st *GetRepoPermissionLevelsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getRepoPermissionLevelsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getRepoPermissionLevelsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetRepoPermissionLevelsRequest) MarshalJSON() ([]byte, error) { - pb, err := getRepoPermissionLevelsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + RepoId string `json:"-" url:"-"` } type GetRepoPermissionLevelsResponse struct { // Specific permission levels - // Wire name: 'permission_levels' PermissionLevels []RepoPermissionsDescription `json:"permission_levels,omitempty"` } -func (st *GetRepoPermissionLevelsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getRepoPermissionLevelsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getRepoPermissionLevelsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetRepoPermissionLevelsResponse) MarshalJSON() ([]byte, error) { - pb, err := getRepoPermissionLevelsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Get repo permissions type GetRepoPermissionsRequest struct { // The repo for which to get or manage permissions. - RepoId string `json:"-" tf:"-"` -} - -func (st *GetRepoPermissionsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getRepoPermissionsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getRepoPermissionsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetRepoPermissionsRequest) MarshalJSON() ([]byte, error) { - pb, err := getRepoPermissionsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + RepoId string `json:"-" url:"-"` } // Get a repo type GetRepoRequest struct { // ID of the Git folder (repo) object in the workspace. - RepoId int64 `json:"-" tf:"-"` -} - -func (st *GetRepoRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getRepoRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getRepoRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetRepoRequest) MarshalJSON() ([]byte, error) { - pb, err := getRepoRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + RepoId int64 `json:"-" url:"-"` } type GetRepoResponse struct { // Branch that the local version of the repo is checked out to. - // Wire name: 'branch' Branch string `json:"branch,omitempty"` // SHA-1 hash representing the commit ID of the current HEAD of the repo. - // Wire name: 'head_commit_id' HeadCommitId string `json:"head_commit_id,omitempty"` // ID of the Git folder (repo) object in the workspace. - // Wire name: 'id' Id int64 `json:"id,omitempty"` // Path of the Git folder (repo) in the workspace. - // Wire name: 'path' Path string `json:"path,omitempty"` // Git provider of the linked Git repository. - // Wire name: 'provider' Provider string `json:"provider,omitempty"` // Sparse checkout settings for the Git folder (repo). - // Wire name: 'sparse_checkout' SparseCheckout *SparseCheckout `json:"sparse_checkout,omitempty"` // URL of the linked Git repository. - // Wire name: 'url' Url string `json:"url,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetRepoResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getRepoResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getRepoResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetRepoResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetRepoResponse) MarshalJSON() ([]byte, error) { - pb, err := getRepoResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetRepoResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get a secret type GetSecretRequest struct { // The key to fetch secret for. - Key string `json:"-" tf:"-"` + Key string `json:"-" url:"key"` // The name of the scope to fetch secret information from. - Scope string `json:"-" tf:"-"` -} - -func (st *GetSecretRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getSecretRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getSecretRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetSecretRequest) MarshalJSON() ([]byte, error) { - pb, err := getSecretRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Scope string `json:"-" url:"scope"` } type GetSecretResponse struct { // A unique name to identify the secret. - // Wire name: 'key' Key string `json:"key,omitempty"` // The value of the secret in its byte representation. - // Wire name: 'value' Value string `json:"value,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *GetSecretResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getSecretResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getSecretResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *GetSecretResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st GetSecretResponse) MarshalJSON() ([]byte, error) { - pb, err := getSecretResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s GetSecretResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Get status type GetStatusRequest struct { // The absolute path of the notebook or directory. - Path string `json:"-" tf:"-"` -} - -func (st *GetStatusRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getStatusRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getStatusRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetStatusRequest) MarshalJSON() ([]byte, error) { - pb, err := getStatusRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Path string `json:"-" url:"path"` } // Get workspace object permission levels type GetWorkspaceObjectPermissionLevelsRequest struct { // The workspace object for which to get or manage permissions. - WorkspaceObjectId string `json:"-" tf:"-"` + WorkspaceObjectId string `json:"-" url:"-"` // The workspace object type for which to get or manage permissions. - WorkspaceObjectType string `json:"-" tf:"-"` -} - -func (st *GetWorkspaceObjectPermissionLevelsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getWorkspaceObjectPermissionLevelsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getWorkspaceObjectPermissionLevelsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetWorkspaceObjectPermissionLevelsRequest) MarshalJSON() ([]byte, error) { - pb, err := getWorkspaceObjectPermissionLevelsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + WorkspaceObjectType string `json:"-" url:"-"` } type GetWorkspaceObjectPermissionLevelsResponse struct { // Specific permission levels - // Wire name: 'permission_levels' PermissionLevels []WorkspaceObjectPermissionsDescription `json:"permission_levels,omitempty"` } -func (st *GetWorkspaceObjectPermissionLevelsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getWorkspaceObjectPermissionLevelsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getWorkspaceObjectPermissionLevelsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetWorkspaceObjectPermissionLevelsResponse) MarshalJSON() ([]byte, error) { - pb, err := getWorkspaceObjectPermissionLevelsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Get workspace object permissions type GetWorkspaceObjectPermissionsRequest struct { // The workspace object for which to get or manage permissions. - WorkspaceObjectId string `json:"-" tf:"-"` + WorkspaceObjectId string `json:"-" url:"-"` // The workspace object type for which to get or manage permissions. - WorkspaceObjectType string `json:"-" tf:"-"` -} - -func (st *GetWorkspaceObjectPermissionsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &getWorkspaceObjectPermissionsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := getWorkspaceObjectPermissionsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st GetWorkspaceObjectPermissionsRequest) MarshalJSON() ([]byte, error) { - pb, err := getWorkspaceObjectPermissionsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + WorkspaceObjectType string `json:"-" url:"-"` } type Import struct { @@ -1409,7 +522,6 @@ type Import struct { // If the limit (10MB) is exceeded, exception with error code // **MAX_NOTEBOOK_SIZE_EXCEEDED** is thrown. This parameter might be absent, // and instead a posted file is used. - // Wire name: 'content' Content string `json:"content,omitempty"` // This specifies the format of the file to be imported. // @@ -1424,48 +536,27 @@ type Import struct { // notebook is imported in Databricks archive format. Required for // directories. - `R_MARKDOWN`: The notebook is imported from R Markdown // format. - // Wire name: 'format' Format ImportFormat `json:"format,omitempty"` // The language of the object. This value is set only if the object type is // `NOTEBOOK`. - // Wire name: 'language' Language Language `json:"language,omitempty"` // The flag that specifies whether to overwrite existing object. It is // `false` by default. For `DBC` format, `overwrite` is not supported since // it may contain a directory. - // Wire name: 'overwrite' Overwrite bool `json:"overwrite,omitempty"` // The absolute path of the object or directory. Importing a directory is // only supported for the `DBC` and `SOURCE` formats. - // Wire name: 'path' Path string `json:"path"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *Import) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &importPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := importFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *Import) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st Import) MarshalJSON() ([]byte, error) { - pb, err := importToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s Import) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The format for workspace import and export. @@ -1524,31 +615,6 @@ func (f *ImportFormat) Type() string { type ImportResponse struct { } -func (st *ImportResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &importResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := importResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ImportResponse) MarshalJSON() ([]byte, error) { - pb, err := importResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // The language of notebook. type Language string @@ -1596,452 +662,143 @@ func (f *Language) Type() string { // Lists ACLs type ListAclsRequest struct { // The name of the scope to fetch ACL information from. - Scope string `json:"-" tf:"-"` -} - -func (st *ListAclsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listAclsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listAclsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ListAclsRequest) MarshalJSON() ([]byte, error) { - pb, err := listAclsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Scope string `json:"-" url:"scope"` } type ListAclsResponse struct { // The associated ACLs rule applied to principals in the given scope. - // Wire name: 'items' Items []AclItem `json:"items,omitempty"` } -func (st *ListAclsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listAclsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listAclsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ListAclsResponse) MarshalJSON() ([]byte, error) { - pb, err := listAclsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type ListCredentialsResponse struct { // List of credentials. - // Wire name: 'credentials' Credentials []CredentialInfo `json:"credentials,omitempty"` } -func (st *ListCredentialsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listCredentialsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listCredentialsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ListCredentialsResponse) MarshalJSON() ([]byte, error) { - pb, err := listCredentialsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Get repos type ListReposRequest struct { // Token used to get the next page of results. If not specified, returns the // first page of results as well as a next page token if there are more // results. - NextPageToken string `json:"-" tf:"-"` + NextPageToken string `json:"-" url:"next_page_token,omitempty"` // Filters repos that have paths starting with the given path prefix. If not // provided or when provided an effectively empty prefix (`/` or // `/Workspace`) Git folders (repos) from `/Workspace/Repos` will be served. - PathPrefix string `json:"-" tf:"-"` + PathPrefix string `json:"-" url:"path_prefix,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListReposRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listReposRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listReposRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListReposRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListReposRequest) MarshalJSON() ([]byte, error) { - pb, err := listReposRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListReposRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListReposResponse struct { // Token that can be specified as a query parameter to the `GET /repos` // endpoint to retrieve the next page of results. - // Wire name: 'next_page_token' NextPageToken string `json:"next_page_token,omitempty"` // List of Git folders (repos). - // Wire name: 'repos' Repos []RepoInfo `json:"repos,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListReposResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listReposResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listReposResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListReposResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListReposResponse) MarshalJSON() ([]byte, error) { - pb, err := listReposResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListReposResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type ListResponse struct { // List of objects. - // Wire name: 'objects' Objects []ObjectInfo `json:"objects,omitempty"` } -func (st *ListResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ListResponse) MarshalJSON() ([]byte, error) { - pb, err := listResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type ListScopesResponse struct { // The available secret scopes. - // Wire name: 'scopes' Scopes []SecretScope `json:"scopes,omitempty"` } -func (st *ListScopesResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listScopesResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listScopesResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ListScopesResponse) MarshalJSON() ([]byte, error) { - pb, err := listScopesResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // List secret keys type ListSecretsRequest struct { // The name of the scope to list secrets within. - Scope string `json:"-" tf:"-"` -} - -func (st *ListSecretsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listSecretsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listSecretsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ListSecretsRequest) MarshalJSON() ([]byte, error) { - pb, err := listSecretsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + Scope string `json:"-" url:"scope"` } type ListSecretsResponse struct { // Metadata information of all secrets contained within the given scope. - // Wire name: 'secrets' Secrets []SecretMetadata `json:"secrets,omitempty"` } -func (st *ListSecretsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listSecretsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listSecretsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st ListSecretsResponse) MarshalJSON() ([]byte, error) { - pb, err := listSecretsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // List contents type ListWorkspaceRequest struct { // UTC timestamp in milliseconds - NotebooksModifiedAfter int64 `json:"-" tf:"-"` + NotebooksModifiedAfter int64 `json:"-" url:"notebooks_modified_after,omitempty"` // The absolute path of the notebook or directory. - Path string `json:"-" tf:"-"` + Path string `json:"-" url:"path"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ListWorkspaceRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &listWorkspaceRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := listWorkspaceRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ListWorkspaceRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ListWorkspaceRequest) MarshalJSON() ([]byte, error) { - pb, err := listWorkspaceRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ListWorkspaceRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type Mkdirs struct { // The absolute path of the directory. If the parent directories do not // exist, it will also create them. If the directory already exists, this // command will do nothing and succeed. - // Wire name: 'path' Path string `json:"path"` } -func (st *Mkdirs) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &mkdirsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := mkdirsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st Mkdirs) MarshalJSON() ([]byte, error) { - pb, err := mkdirsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type MkdirsResponse struct { } -func (st *MkdirsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &mkdirsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := mkdirsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st MkdirsResponse) MarshalJSON() ([]byte, error) { - pb, err := mkdirsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // The information of the object in workspace. It will be returned by “list“ // and “get-status“. type ObjectInfo struct { // Only applicable to files. The creation UTC timestamp. - // Wire name: 'created_at' CreatedAt int64 `json:"created_at,omitempty"` // The language of the object. This value is set only if the object type is // ``NOTEBOOK``. - // Wire name: 'language' Language Language `json:"language,omitempty"` // Only applicable to files, the last modified UTC timestamp. - // Wire name: 'modified_at' ModifiedAt int64 `json:"modified_at,omitempty"` // Unique identifier for the object. - // Wire name: 'object_id' ObjectId int64 `json:"object_id,omitempty"` // The type of the object in workspace. // // - `NOTEBOOK`: document that contains runnable code, visualizations, and // explanatory text. - `DIRECTORY`: directory - `LIBRARY`: library - `FILE`: // file - `REPO`: repository - `DASHBOARD`: Lakeview dashboard - // Wire name: 'object_type' ObjectType ObjectType `json:"object_type,omitempty"` // The absolute path of the object. - // Wire name: 'path' Path string `json:"path,omitempty"` // A unique identifier for the object that is consistent across all // Databricks APIs. - // Wire name: 'resource_id' ResourceId string `json:"resource_id,omitempty"` // Only applicable to files. The file size in bytes can be returned. - // Wire name: 'size' Size int64 `json:"size,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *ObjectInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &objectInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := objectInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *ObjectInfo) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st ObjectInfo) MarshalJSON() ([]byte, error) { - pb, err := objectInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s ObjectInfo) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // The type of the object in workspace. @@ -2096,315 +853,128 @@ func (f *ObjectType) Type() string { type PutAcl struct { // The permission level applied to the principal. - // Wire name: 'permission' Permission AclPermission `json:"permission"` // The principal in which the permission is applied. - // Wire name: 'principal' Principal string `json:"principal"` // The name of the scope to apply permissions to. - // Wire name: 'scope' Scope string `json:"scope"` } -func (st *PutAcl) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &putAclPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := putAclFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st PutAcl) MarshalJSON() ([]byte, error) { - pb, err := putAclToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type PutAclResponse struct { } -func (st *PutAclResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &putAclResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := putAclResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st PutAclResponse) MarshalJSON() ([]byte, error) { - pb, err := putAclResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type PutSecret struct { // If specified, value will be stored as bytes. - // Wire name: 'bytes_value' BytesValue string `json:"bytes_value,omitempty"` // A unique name to identify the secret. - // Wire name: 'key' Key string `json:"key"` // The name of the scope to which the secret will be associated with. - // Wire name: 'scope' Scope string `json:"scope"` // If specified, note that the value will be stored in UTF-8 (MB4) form. - // Wire name: 'string_value' StringValue string `json:"string_value,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *PutSecret) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &putSecretPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := putSecretFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *PutSecret) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st PutSecret) MarshalJSON() ([]byte, error) { - pb, err := putSecretToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s PutSecret) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type PutSecretResponse struct { } -func (st *PutSecretResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &putSecretResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := putSecretResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st PutSecretResponse) MarshalJSON() ([]byte, error) { - pb, err := putSecretResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type RepoAccessControlRequest struct { // name of the group - // Wire name: 'group_name' GroupName string `json:"group_name,omitempty"` // Permission level - // Wire name: 'permission_level' PermissionLevel RepoPermissionLevel `json:"permission_level,omitempty"` // application ID of a service principal - // Wire name: 'service_principal_name' ServicePrincipalName string `json:"service_principal_name,omitempty"` // name of the user - // Wire name: 'user_name' UserName string `json:"user_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *RepoAccessControlRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &repoAccessControlRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := repoAccessControlRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *RepoAccessControlRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st RepoAccessControlRequest) MarshalJSON() ([]byte, error) { - pb, err := repoAccessControlRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s RepoAccessControlRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type RepoAccessControlResponse struct { // All permissions. - // Wire name: 'all_permissions' AllPermissions []RepoPermission `json:"all_permissions,omitempty"` // Display name of the user or service principal. - // Wire name: 'display_name' DisplayName string `json:"display_name,omitempty"` // name of the group - // Wire name: 'group_name' GroupName string `json:"group_name,omitempty"` // Name of the service principal. - // Wire name: 'service_principal_name' ServicePrincipalName string `json:"service_principal_name,omitempty"` // name of the user - // Wire name: 'user_name' UserName string `json:"user_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *RepoAccessControlResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &repoAccessControlResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := repoAccessControlResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *RepoAccessControlResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st RepoAccessControlResponse) MarshalJSON() ([]byte, error) { - pb, err := repoAccessControlResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s RepoAccessControlResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Git folder (repo) information. type RepoInfo struct { // Name of the current git branch of the git folder (repo). - // Wire name: 'branch' Branch string `json:"branch,omitempty"` // Current git commit id of the git folder (repo). - // Wire name: 'head_commit_id' HeadCommitId string `json:"head_commit_id,omitempty"` // Id of the git folder (repo) in the Workspace. - // Wire name: 'id' Id int64 `json:"id,omitempty"` // Root path of the git folder (repo) in the Workspace. - // Wire name: 'path' Path string `json:"path,omitempty"` // Git provider of the remote git repository, e.g. `gitHub`. - // Wire name: 'provider' Provider string `json:"provider,omitempty"` // Sparse checkout config for the git folder (repo). - // Wire name: 'sparse_checkout' SparseCheckout *SparseCheckout `json:"sparse_checkout,omitempty"` // URL of the remote git repository. - // Wire name: 'url' Url string `json:"url,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *RepoInfo) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &repoInfoPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := repoInfoFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *RepoInfo) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st RepoInfo) MarshalJSON() ([]byte, error) { - pb, err := repoInfoToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s RepoInfo) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type RepoPermission struct { - - // Wire name: 'inherited' Inherited bool `json:"inherited,omitempty"` - // Wire name: 'inherited_from_object' InheritedFromObject []string `json:"inherited_from_object,omitempty"` // Permission level - // Wire name: 'permission_level' PermissionLevel RepoPermissionLevel `json:"permission_level,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *RepoPermission) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &repoPermissionPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := repoPermissionFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *RepoPermission) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st RepoPermission) MarshalJSON() ([]byte, error) { - pb, err := repoPermissionToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s RepoPermission) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Permission level @@ -2452,111 +1022,43 @@ func (f *RepoPermissionLevel) Type() string { } type RepoPermissions struct { - - // Wire name: 'access_control_list' AccessControlList []RepoAccessControlResponse `json:"access_control_list,omitempty"` - // Wire name: 'object_id' ObjectId string `json:"object_id,omitempty"` - // Wire name: 'object_type' ObjectType string `json:"object_type,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *RepoPermissions) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &repoPermissionsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := repoPermissionsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *RepoPermissions) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st RepoPermissions) MarshalJSON() ([]byte, error) { - pb, err := repoPermissionsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s RepoPermissions) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type RepoPermissionsDescription struct { - - // Wire name: 'description' Description string `json:"description,omitempty"` // Permission level - // Wire name: 'permission_level' PermissionLevel RepoPermissionLevel `json:"permission_level,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *RepoPermissionsDescription) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &repoPermissionsDescriptionPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := repoPermissionsDescriptionFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *RepoPermissionsDescription) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st RepoPermissionsDescription) MarshalJSON() ([]byte, error) { - pb, err := repoPermissionsDescriptionToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s RepoPermissionsDescription) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type RepoPermissionsRequest struct { - - // Wire name: 'access_control_list' AccessControlList []RepoAccessControlRequest `json:"access_control_list,omitempty"` // The repo for which to get or manage permissions. - RepoId string `json:"-" tf:"-"` -} - -func (st *RepoPermissionsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &repoPermissionsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := repoPermissionsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st RepoPermissionsRequest) MarshalJSON() ([]byte, error) { - pb, err := repoPermissionsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + RepoId string `json:"-" url:"-"` } type ScopeBackendType string @@ -2598,77 +1100,38 @@ func (f *ScopeBackendType) Type() string { type SecretMetadata struct { // A unique name to identify the secret. - // Wire name: 'key' Key string `json:"key,omitempty"` // The last updated timestamp (in milliseconds) for the secret. - // Wire name: 'last_updated_timestamp' LastUpdatedTimestamp int64 `json:"last_updated_timestamp,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *SecretMetadata) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &secretMetadataPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := secretMetadataFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *SecretMetadata) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st SecretMetadata) MarshalJSON() ([]byte, error) { - pb, err := secretMetadataToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s SecretMetadata) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type SecretScope struct { // The type of secret scope backend. - // Wire name: 'backend_type' BackendType ScopeBackendType `json:"backend_type,omitempty"` // The metadata for the secret scope if the type is `AZURE_KEYVAULT` - // Wire name: 'keyvault_metadata' KeyvaultMetadata *AzureKeyVaultSecretScopeMetadata `json:"keyvault_metadata,omitempty"` // A unique name to identify the secret scope. - // Wire name: 'name' Name string `json:"name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *SecretScope) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &secretScopePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := secretScopeFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *SecretScope) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st SecretScope) MarshalJSON() ([]byte, error) { - pb, err := secretScopeToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s SecretScope) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Sparse checkout configuration, it contains options like cone patterns. @@ -2677,78 +1140,25 @@ type SparseCheckout struct { // details. // // [cone mode handling]: https://git-scm.com/docs/git-sparse-checkout#_internalscone_mode_handling - // Wire name: 'patterns' Patterns []string `json:"patterns,omitempty"` } -func (st *SparseCheckout) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &sparseCheckoutPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := sparseCheckoutFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st SparseCheckout) MarshalJSON() ([]byte, error) { - pb, err := sparseCheckoutToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - // Sparse checkout configuration, it contains options like cone patterns. type SparseCheckoutUpdate struct { // List of sparse checkout cone patterns, see [cone mode handling] for // details. // // [cone mode handling]: https://git-scm.com/docs/git-sparse-checkout#_internalscone_mode_handling - // Wire name: 'patterns' Patterns []string `json:"patterns,omitempty"` } -func (st *SparseCheckoutUpdate) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &sparseCheckoutUpdatePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := sparseCheckoutUpdateFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st SparseCheckoutUpdate) MarshalJSON() ([]byte, error) { - pb, err := sparseCheckoutUpdateToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type UpdateCredentialsRequest struct { // The ID for the corresponding credential to access. - CredentialId int64 `json:"-" tf:"-"` + CredentialId int64 `json:"-" url:"-"` // Git provider. This field is case-insensitive. The available Git providers // are `gitHub`, `bitbucketCloud`, `gitLab`, `azureDevOpsServices`, // `gitHubEnterprise`, `bitbucketServer`, `gitLabEnterpriseEdition` and // `awsCodeCommit`. - // Wire name: 'git_provider' GitProvider string `json:"git_provider"` // The username or email provided with your Git provider account, depending // on which provider you are using. For GitHub, GitHub Enterprise Server, or @@ -2757,269 +1167,116 @@ type UpdateCredentialsRequest struct { // BitBucket or BitBucket Server, username must be used. For all other // providers please see your provider's Personal Access Token authentication // documentation to see what is supported. - // Wire name: 'git_username' GitUsername string `json:"git_username,omitempty"` // The personal access token used to authenticate to the corresponding Git // provider. For certain providers, support may exist for other types of // scoped access tokens. [Learn more]. // // [Learn more]: https://docs.databricks.com/repos/get-access-tokens-from-git-provider.html - // Wire name: 'personal_access_token' PersonalAccessToken string `json:"personal_access_token,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *UpdateCredentialsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateCredentialsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateCredentialsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *UpdateCredentialsRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st UpdateCredentialsRequest) MarshalJSON() ([]byte, error) { - pb, err := updateCredentialsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s UpdateCredentialsRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type UpdateCredentialsResponse struct { } -func (st *UpdateCredentialsResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateCredentialsResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateCredentialsResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateCredentialsResponse) MarshalJSON() ([]byte, error) { - pb, err := updateCredentialsResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type UpdateRepoRequest struct { // Branch that the local version of the repo is checked out to. - // Wire name: 'branch' Branch string `json:"branch,omitempty"` // ID of the Git folder (repo) object in the workspace. - RepoId int64 `json:"-" tf:"-"` + RepoId int64 `json:"-" url:"-"` // If specified, update the sparse checkout settings. The update will fail // if sparse checkout is not enabled for the repo. - // Wire name: 'sparse_checkout' SparseCheckout *SparseCheckoutUpdate `json:"sparse_checkout,omitempty"` // Tag that the local version of the repo is checked out to. Updating the // repo to a tag puts the repo in a detached HEAD state. Before committing // new changes, you must update the repo to a branch instead of the detached // HEAD. - // Wire name: 'tag' Tag string `json:"tag,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *UpdateRepoRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateRepoRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateRepoRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *UpdateRepoRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st UpdateRepoRequest) MarshalJSON() ([]byte, error) { - pb, err := updateRepoRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s UpdateRepoRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type UpdateRepoResponse struct { } -func (st *UpdateRepoResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &updateRepoResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := updateRepoResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st UpdateRepoResponse) MarshalJSON() ([]byte, error) { - pb, err := updateRepoResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) -} - type WorkspaceObjectAccessControlRequest struct { // name of the group - // Wire name: 'group_name' GroupName string `json:"group_name,omitempty"` // Permission level - // Wire name: 'permission_level' PermissionLevel WorkspaceObjectPermissionLevel `json:"permission_level,omitempty"` // application ID of a service principal - // Wire name: 'service_principal_name' ServicePrincipalName string `json:"service_principal_name,omitempty"` // name of the user - // Wire name: 'user_name' UserName string `json:"user_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *WorkspaceObjectAccessControlRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &workspaceObjectAccessControlRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := workspaceObjectAccessControlRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *WorkspaceObjectAccessControlRequest) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st WorkspaceObjectAccessControlRequest) MarshalJSON() ([]byte, error) { - pb, err := workspaceObjectAccessControlRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s WorkspaceObjectAccessControlRequest) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type WorkspaceObjectAccessControlResponse struct { // All permissions. - // Wire name: 'all_permissions' AllPermissions []WorkspaceObjectPermission `json:"all_permissions,omitempty"` // Display name of the user or service principal. - // Wire name: 'display_name' DisplayName string `json:"display_name,omitempty"` // name of the group - // Wire name: 'group_name' GroupName string `json:"group_name,omitempty"` // Name of the service principal. - // Wire name: 'service_principal_name' ServicePrincipalName string `json:"service_principal_name,omitempty"` // name of the user - // Wire name: 'user_name' UserName string `json:"user_name,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *WorkspaceObjectAccessControlResponse) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &workspaceObjectAccessControlResponsePb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := workspaceObjectAccessControlResponseFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *WorkspaceObjectAccessControlResponse) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st WorkspaceObjectAccessControlResponse) MarshalJSON() ([]byte, error) { - pb, err := workspaceObjectAccessControlResponseToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s WorkspaceObjectAccessControlResponse) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type WorkspaceObjectPermission struct { - - // Wire name: 'inherited' Inherited bool `json:"inherited,omitempty"` - // Wire name: 'inherited_from_object' InheritedFromObject []string `json:"inherited_from_object,omitempty"` // Permission level - // Wire name: 'permission_level' PermissionLevel WorkspaceObjectPermissionLevel `json:"permission_level,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *WorkspaceObjectPermission) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &workspaceObjectPermissionPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := workspaceObjectPermissionFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *WorkspaceObjectPermission) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st WorkspaceObjectPermission) MarshalJSON() ([]byte, error) { - pb, err := workspaceObjectPermissionToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s WorkspaceObjectPermission) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } // Permission level @@ -3067,111 +1324,43 @@ func (f *WorkspaceObjectPermissionLevel) Type() string { } type WorkspaceObjectPermissions struct { - - // Wire name: 'access_control_list' AccessControlList []WorkspaceObjectAccessControlResponse `json:"access_control_list,omitempty"` - // Wire name: 'object_id' ObjectId string `json:"object_id,omitempty"` - // Wire name: 'object_type' ObjectType string `json:"object_type,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *WorkspaceObjectPermissions) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &workspaceObjectPermissionsPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := workspaceObjectPermissionsFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *WorkspaceObjectPermissions) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st WorkspaceObjectPermissions) MarshalJSON() ([]byte, error) { - pb, err := workspaceObjectPermissionsToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s WorkspaceObjectPermissions) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type WorkspaceObjectPermissionsDescription struct { - - // Wire name: 'description' Description string `json:"description,omitempty"` // Permission level - // Wire name: 'permission_level' PermissionLevel WorkspaceObjectPermissionLevel `json:"permission_level,omitempty"` - ForceSendFields []string `json:"-" tf:"-"` + ForceSendFields []string `json:"-" url:"-"` } -func (st *WorkspaceObjectPermissionsDescription) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &workspaceObjectPermissionsDescriptionPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := workspaceObjectPermissionsDescriptionFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil +func (s *WorkspaceObjectPermissionsDescription) UnmarshalJSON(b []byte) error { + return marshal.Unmarshal(b, s) } -func (st WorkspaceObjectPermissionsDescription) MarshalJSON() ([]byte, error) { - pb, err := workspaceObjectPermissionsDescriptionToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) +func (s WorkspaceObjectPermissionsDescription) MarshalJSON() ([]byte, error) { + return marshal.Marshal(s) } type WorkspaceObjectPermissionsRequest struct { - - // Wire name: 'access_control_list' AccessControlList []WorkspaceObjectAccessControlRequest `json:"access_control_list,omitempty"` // The workspace object for which to get or manage permissions. - WorkspaceObjectId string `json:"-" tf:"-"` + WorkspaceObjectId string `json:"-" url:"-"` // The workspace object type for which to get or manage permissions. - WorkspaceObjectType string `json:"-" tf:"-"` -} - -func (st *WorkspaceObjectPermissionsRequest) UnmarshalJSON(b []byte) error { - if st == nil { - return fmt.Errorf("json.Unmarshal on nil pointer") - } - pb := &workspaceObjectPermissionsRequestPb{} - err := json.Unmarshal(b, pb) - if err != nil { - return err - } - tmp, err := workspaceObjectPermissionsRequestFromPb(pb) - if err != nil { - return err - } - *st = *tmp - return nil -} - -func (st WorkspaceObjectPermissionsRequest) MarshalJSON() ([]byte, error) { - pb, err := workspaceObjectPermissionsRequestToPb(&st) - if err != nil { - return nil, err - } - return json.Marshal(pb) + WorkspaceObjectType string `json:"-" url:"-"` }