diff --git a/api/v1alpha1/dataset.go b/api/v1alpha1/dataset.go index abe51d825..8040d7f85 100644 --- a/api/v1alpha1/dataset.go +++ b/api/v1alpha1/dataset.go @@ -28,7 +28,7 @@ const ( var ( // LabelDatasetScene defines the content type of this dataset LabelDatasetContentType = Group + "/content-type" - // LabelDatasetBestCase defines the best case to use this dataset - LabelDatasetBestCase = Group + "/best-case" + // LabelDatasetField defines the best field to use this dataset + LabelDatasetField = Group + "/field" LabelDatasetFinalizer = Group + "/finalizers" ) diff --git a/api/v1alpha1/dataset_types.go b/api/v1alpha1/dataset_types.go index 19626e38f..ff1c7d921 100644 --- a/api/v1alpha1/dataset_types.go +++ b/api/v1alpha1/dataset_types.go @@ -30,8 +30,8 @@ type DatasetSpec struct { // ContentType defines dataset ContentType string `json:"contentType"` - // bestCase defines the best case to use this dataset - BestCase string `json:"bestCase,omitempty"` + // Model application fields + Field string `json:"field,omitempty"` } // DatasetStatus defines the observed state of Dataset diff --git a/api/v1alpha1/model_types.go b/api/v1alpha1/model_types.go index 11618d113..6effd36ae 100644 --- a/api/v1alpha1/model_types.go +++ b/api/v1alpha1/model_types.go @@ -34,6 +34,9 @@ type ModelSpec struct { // Description defines datasource description Description string `json:"description,omitempty"` + // Model application fields + Field string `json:"field,omitempty"` + // Type defines what kind of model this is Type ModelType `json:"type,omitempty"` diff --git a/charts/arcadia/crds/arcadia.kubeagi.k8s.com.cn_datasets.yaml b/charts/arcadia/crds/arcadia.kubeagi.k8s.com.cn_datasets.yaml index 6c08fb927..df0df797c 100644 --- a/charts/arcadia/crds/arcadia.kubeagi.k8s.com.cn_datasets.yaml +++ b/charts/arcadia/crds/arcadia.kubeagi.k8s.com.cn_datasets.yaml @@ -42,9 +42,6 @@ spec: spec: description: DatasetSpec defines the desired state of Dataset properties: - bestCase: - description: bestCase defines the best case to use this dataset - type: string contentType: description: ContentType defines dataset type: string @@ -57,6 +54,9 @@ spec: displayName: description: DisplayName defines datasource display name type: string + field: + description: Model application fields + type: string required: - contentType type: object diff --git a/charts/arcadia/crds/arcadia.kubeagi.k8s.com.cn_models.yaml b/charts/arcadia/crds/arcadia.kubeagi.k8s.com.cn_models.yaml index 50434d738..7ecfe2c63 100644 --- a/charts/arcadia/crds/arcadia.kubeagi.k8s.com.cn_models.yaml +++ b/charts/arcadia/crds/arcadia.kubeagi.k8s.com.cn_models.yaml @@ -44,6 +44,9 @@ spec: displayName: description: DisplayName defines dataset display name type: string + field: + description: Model application fields + type: string type: description: Type defines what kind of model this is type: string diff --git a/config/crd/bases/arcadia.kubeagi.k8s.com.cn_datasets.yaml b/config/crd/bases/arcadia.kubeagi.k8s.com.cn_datasets.yaml index 6c08fb927..df0df797c 100644 --- a/config/crd/bases/arcadia.kubeagi.k8s.com.cn_datasets.yaml +++ b/config/crd/bases/arcadia.kubeagi.k8s.com.cn_datasets.yaml @@ -42,9 +42,6 @@ spec: spec: description: DatasetSpec defines the desired state of Dataset properties: - bestCase: - description: bestCase defines the best case to use this dataset - type: string contentType: description: ContentType defines dataset type: string @@ -57,6 +54,9 @@ spec: displayName: description: DisplayName defines datasource display name type: string + field: + description: Model application fields + type: string required: - contentType type: object diff --git a/config/crd/bases/arcadia.kubeagi.k8s.com.cn_models.yaml b/config/crd/bases/arcadia.kubeagi.k8s.com.cn_models.yaml index 50434d738..7ecfe2c63 100644 --- a/config/crd/bases/arcadia.kubeagi.k8s.com.cn_models.yaml +++ b/config/crd/bases/arcadia.kubeagi.k8s.com.cn_models.yaml @@ -44,6 +44,9 @@ spec: displayName: description: DisplayName defines dataset display name type: string + field: + description: Model application fields + type: string type: description: Type defines what kind of model this is type: string diff --git a/controllers/dataset_controller.go b/controllers/dataset_controller.go index 9ab0fae9c..f45c20c30 100644 --- a/controllers/dataset_controller.go +++ b/controllers/dataset_controller.go @@ -80,8 +80,8 @@ func (r *DatasetReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ct instance.Labels[arcadiav1alpha1.LabelDatasetContentType] = instance.Spec.ContentType update = true } - if v, ok := instance.Labels[arcadiav1alpha1.LabelDatasetBestCase]; !ok || v != instance.Spec.BestCase { - instance.Labels[arcadiav1alpha1.LabelDatasetBestCase] = instance.Spec.BestCase + if v, ok := instance.Labels[arcadiav1alpha1.LabelDatasetField]; !ok || v != instance.Spec.Field { + instance.Labels[arcadiav1alpha1.LabelDatasetField] = instance.Spec.Field update = true } if !utils.ContainString(instance.Finalizers, arcadiav1alpha1.Finalizer) { diff --git a/graphql-server/go-server/graph/generated.go b/graphql-server/go-server/graph/generated.go index 0fd3ab168..8136bc0d5 100644 --- a/graphql-server/go-server/graph/generated.go +++ b/graphql-server/go-server/graph/generated.go @@ -68,10 +68,26 @@ type ComplexityRoot struct { URL func(childComplexity int) int } + Model struct { + Annotations func(childComplexity int) int + Creator func(childComplexity int) int + Description func(childComplexity int) int + DisplayName func(childComplexity int) int + Field func(childComplexity int) int + Labels func(childComplexity int) int + Modeltype func(childComplexity int) int + Name func(childComplexity int) int + Namespace func(childComplexity int) int + UpdateTimestamp func(childComplexity int) int + } + Mutation struct { CreateDatasource func(childComplexity int, input model.CreateDatasourceInput) int + CreateModel func(childComplexity int, input model.CreateModelInput) int DeleteDatasource func(childComplexity int, input *model.DeleteDatasourceInput) int + DeleteModel func(childComplexity int, input *model.DeleteModelInput) int UpdateDatasource func(childComplexity int, input *model.UpdateDatasourceInput) int + UpdateModel func(childComplexity int, input *model.UpdateModelInput) int } Oss struct { @@ -87,9 +103,19 @@ type ComplexityRoot struct { TotalCount func(childComplexity int) int } + PaginatedModel struct { + HasNextPage func(childComplexity int) int + Nodes func(childComplexity int) int + Page func(childComplexity int) int + PageSize func(childComplexity int) int + TotalCount func(childComplexity int) int + } + Query struct { Datasource func(childComplexity int, name string, namespace string) int DatasourcesPaged func(childComplexity int, input model.ListDatasourceInput) int + GetModel func(childComplexity int, name string, namespace string) int + ListModels func(childComplexity int, input model.ListModelInput) int } TypedObjectReference struct { @@ -104,10 +130,15 @@ type MutationResolver interface { CreateDatasource(ctx context.Context, input model.CreateDatasourceInput) (*model.Datasource, error) UpdateDatasource(ctx context.Context, input *model.UpdateDatasourceInput) (*model.Datasource, error) DeleteDatasource(ctx context.Context, input *model.DeleteDatasourceInput) (*string, error) + CreateModel(ctx context.Context, input model.CreateModelInput) (*model.Model, error) + UpdateModel(ctx context.Context, input *model.UpdateModelInput) (*model.Model, error) + DeleteModel(ctx context.Context, input *model.DeleteModelInput) (*string, error) } type QueryResolver interface { Datasource(ctx context.Context, name string, namespace string) (*model.Datasource, error) DatasourcesPaged(ctx context.Context, input model.ListDatasourceInput) (*model.PaginatedDatasource, error) + GetModel(ctx context.Context, name string, namespace string) (*model.Model, error) + ListModels(ctx context.Context, input model.ListModelInput) (*model.PaginatedModel, error) } type executableSchema struct { @@ -227,6 +258,76 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Endpoint.URL(childComplexity), true + case "Model.annotations": + if e.complexity.Model.Annotations == nil { + break + } + + return e.complexity.Model.Annotations(childComplexity), true + + case "Model.creator": + if e.complexity.Model.Creator == nil { + break + } + + return e.complexity.Model.Creator(childComplexity), true + + case "Model.description": + if e.complexity.Model.Description == nil { + break + } + + return e.complexity.Model.Description(childComplexity), true + + case "Model.displayName": + if e.complexity.Model.DisplayName == nil { + break + } + + return e.complexity.Model.DisplayName(childComplexity), true + + case "Model.field": + if e.complexity.Model.Field == nil { + break + } + + return e.complexity.Model.Field(childComplexity), true + + case "Model.labels": + if e.complexity.Model.Labels == nil { + break + } + + return e.complexity.Model.Labels(childComplexity), true + + case "Model.modeltype": + if e.complexity.Model.Modeltype == nil { + break + } + + return e.complexity.Model.Modeltype(childComplexity), true + + case "Model.name": + if e.complexity.Model.Name == nil { + break + } + + return e.complexity.Model.Name(childComplexity), true + + case "Model.namespace": + if e.complexity.Model.Namespace == nil { + break + } + + return e.complexity.Model.Namespace(childComplexity), true + + case "Model.updateTimestamp": + if e.complexity.Model.UpdateTimestamp == nil { + break + } + + return e.complexity.Model.UpdateTimestamp(childComplexity), true + case "Mutation.createDatasource": if e.complexity.Mutation.CreateDatasource == nil { break @@ -239,6 +340,18 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Mutation.CreateDatasource(childComplexity, args["input"].(model.CreateDatasourceInput)), true + case "Mutation.createModel": + if e.complexity.Mutation.CreateModel == nil { + break + } + + args, err := ec.field_Mutation_createModel_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.CreateModel(childComplexity, args["input"].(model.CreateModelInput)), true + case "Mutation.deleteDatasource": if e.complexity.Mutation.DeleteDatasource == nil { break @@ -251,6 +364,18 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Mutation.DeleteDatasource(childComplexity, args["input"].(*model.DeleteDatasourceInput)), true + case "Mutation.deleteModel": + if e.complexity.Mutation.DeleteModel == nil { + break + } + + args, err := ec.field_Mutation_deleteModel_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.DeleteModel(childComplexity, args["input"].(*model.DeleteModelInput)), true + case "Mutation.updateDatasource": if e.complexity.Mutation.UpdateDatasource == nil { break @@ -263,6 +388,18 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Mutation.UpdateDatasource(childComplexity, args["input"].(*model.UpdateDatasourceInput)), true + case "Mutation.updateModel": + if e.complexity.Mutation.UpdateModel == nil { + break + } + + args, err := ec.field_Mutation_updateModel_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.UpdateModel(childComplexity, args["input"].(*model.UpdateModelInput)), true + case "Oss.bucket": if e.complexity.Oss.Bucket == nil { break @@ -312,6 +449,41 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.PaginatedDatasource.TotalCount(childComplexity), true + case "PaginatedModel.hasNextPage": + if e.complexity.PaginatedModel.HasNextPage == nil { + break + } + + return e.complexity.PaginatedModel.HasNextPage(childComplexity), true + + case "PaginatedModel.nodes": + if e.complexity.PaginatedModel.Nodes == nil { + break + } + + return e.complexity.PaginatedModel.Nodes(childComplexity), true + + case "PaginatedModel.page": + if e.complexity.PaginatedModel.Page == nil { + break + } + + return e.complexity.PaginatedModel.Page(childComplexity), true + + case "PaginatedModel.pageSize": + if e.complexity.PaginatedModel.PageSize == nil { + break + } + + return e.complexity.PaginatedModel.PageSize(childComplexity), true + + case "PaginatedModel.totalCount": + if e.complexity.PaginatedModel.TotalCount == nil { + break + } + + return e.complexity.PaginatedModel.TotalCount(childComplexity), true + case "Query.datasource": if e.complexity.Query.Datasource == nil { break @@ -336,6 +508,30 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Query.DatasourcesPaged(childComplexity, args["input"].(model.ListDatasourceInput)), true + case "Query.getModel": + if e.complexity.Query.GetModel == nil { + break + } + + args, err := ec.field_Query_getModel_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.GetModel(childComplexity, args["name"].(string), args["namespace"].(string)), true + + case "Query.listModels": + if e.complexity.Query.ListModels == nil { + break + } + + args, err := ec.field_Query_listModels_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.ListModels(childComplexity, args["input"].(model.ListModelInput)), true + case "TypedObjectReference.apiGroup": if e.complexity.TypedObjectReference.APIGroup == nil { break @@ -373,12 +569,16 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { ec := executionContext{rc, e, 0, 0, make(chan graphql.DeferredResult)} inputUnmarshalMap := graphql.BuildUnmarshalerMap( ec.unmarshalInputCreateDatasourceInput, + ec.unmarshalInputCreateModelInput, ec.unmarshalInputDeleteDatasourceInput, + ec.unmarshalInputDeleteModelInput, ec.unmarshalInputEndpointInput, ec.unmarshalInputListDatasourceInput, + ec.unmarshalInputListModelInput, ec.unmarshalInputOssInput, ec.unmarshalInputTypedObjectReferenceInput, ec.unmarshalInputUpdateDatasourceInput, + ec.unmarshalInputUpdateModelInput, ) first := true @@ -475,7 +675,7 @@ func (ec *executionContext) introspectType(name string) (*introspection.Type, er return introspection.WrapTypeFromDef(ec.Schema(), ec.Schema().Types[name]), nil } -//go:embed "datasource.graphqls" +//go:embed "datasource.graphqls" "model.graphqls" var sourcesFS embed.FS func sourceData(filename string) string { @@ -488,6 +688,7 @@ func sourceData(filename string) string { var sources = []*ast.Source{ {Name: "datasource.graphqls", Input: sourceData("datasource.graphqls"), BuiltIn: false}, + {Name: "model.graphqls", Input: sourceData("model.graphqls"), BuiltIn: false}, } var parsedSchema = gqlparser.MustLoadSchema(sources...) @@ -510,6 +711,21 @@ func (ec *executionContext) field_Mutation_createDatasource_args(ctx context.Con return args, nil } +func (ec *executionContext) field_Mutation_createModel_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 model.CreateModelInput + if tmp, ok := rawArgs["input"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) + arg0, err = ec.unmarshalNCreateModelInput2githubᚗcomᚋkubeagiᚋarcadiaᚋgraphqlᚑserverᚋgoᚑserverᚋgraphᚋmodelᚐCreateModelInput(ctx, tmp) + if err != nil { + return nil, err + } + } + args["input"] = arg0 + return args, nil +} + func (ec *executionContext) field_Mutation_deleteDatasource_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} @@ -525,6 +741,21 @@ func (ec *executionContext) field_Mutation_deleteDatasource_args(ctx context.Con return args, nil } +func (ec *executionContext) field_Mutation_deleteModel_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 *model.DeleteModelInput + if tmp, ok := rawArgs["input"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) + arg0, err = ec.unmarshalODeleteModelInput2ᚖgithubᚗcomᚋkubeagiᚋarcadiaᚋgraphqlᚑserverᚋgoᚑserverᚋgraphᚋmodelᚐDeleteModelInput(ctx, tmp) + if err != nil { + return nil, err + } + } + args["input"] = arg0 + return args, nil +} + func (ec *executionContext) field_Mutation_updateDatasource_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} @@ -540,6 +771,21 @@ func (ec *executionContext) field_Mutation_updateDatasource_args(ctx context.Con return args, nil } +func (ec *executionContext) field_Mutation_updateModel_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 *model.UpdateModelInput + if tmp, ok := rawArgs["input"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) + arg0, err = ec.unmarshalOUpdateModelInput2ᚖgithubᚗcomᚋkubeagiᚋarcadiaᚋgraphqlᚑserverᚋgoᚑserverᚋgraphᚋmodelᚐUpdateModelInput(ctx, tmp) + if err != nil { + return nil, err + } + } + args["input"] = arg0 + return args, nil +} + func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} @@ -594,6 +840,45 @@ func (ec *executionContext) field_Query_datasourcesPaged_args(ctx context.Contex return args, nil } +func (ec *executionContext) field_Query_getModel_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["name"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["name"] = arg0 + var arg1 string + if tmp, ok := rawArgs["namespace"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespace")) + arg1, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["namespace"] = arg1 + return args, nil +} + +func (ec *executionContext) field_Query_listModels_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 model.ListModelInput + if tmp, ok := rawArgs["input"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) + arg0, err = ec.unmarshalNListModelInput2githubᚗcomᚋkubeagiᚋarcadiaᚋgraphqlᚑserverᚋgoᚑserverᚋgraphᚋmodelᚐListModelInput(ctx, tmp) + if err != nil { + return nil, err + } + } + args["input"] = arg0 + return args, nil +} + func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} @@ -1242,8 +1527,8 @@ func (ec *executionContext) fieldContext_Endpoint_insecure(ctx context.Context, return fc, nil } -func (ec *executionContext) _Mutation_createDatasource(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Mutation_createDatasource(ctx, field) +func (ec *executionContext) _Model_name(ctx context.Context, field graphql.CollectedField, obj *model.Model) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Model_name(ctx, field) if err != nil { return graphql.Null } @@ -1256,7 +1541,7 @@ func (ec *executionContext) _Mutation_createDatasource(ctx context.Context, fiel }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Mutation().CreateDatasource(rctx, fc.Args["input"].(model.CreateDatasourceInput)) + return obj.Name, nil }) if err != nil { ec.Error(ctx, err) @@ -1268,61 +1553,26 @@ func (ec *executionContext) _Mutation_createDatasource(ctx context.Context, fiel } return graphql.Null } - res := resTmp.(*model.Datasource) + res := resTmp.(string) fc.Result = res - return ec.marshalNDatasource2ᚖgithubᚗcomᚋkubeagiᚋarcadiaᚋgraphqlᚑserverᚋgoᚑserverᚋgraphᚋmodelᚐDatasource(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Mutation_createDatasource(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Model_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Mutation", + Object: "Model", Field: field, - IsMethod: true, - IsResolver: true, + IsMethod: false, + IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "name": - return ec.fieldContext_Datasource_name(ctx, field) - case "namespace": - return ec.fieldContext_Datasource_namespace(ctx, field) - case "labels": - return ec.fieldContext_Datasource_labels(ctx, field) - case "annotations": - return ec.fieldContext_Datasource_annotations(ctx, field) - case "creator": - return ec.fieldContext_Datasource_creator(ctx, field) - case "displayName": - return ec.fieldContext_Datasource_displayName(ctx, field) - case "endpoint": - return ec.fieldContext_Datasource_endpoint(ctx, field) - case "oss": - return ec.fieldContext_Datasource_oss(ctx, field) - case "status": - return ec.fieldContext_Datasource_status(ctx, field) - case "fileCount": - return ec.fieldContext_Datasource_fileCount(ctx, field) - case "updateTimestamp": - return ec.fieldContext_Datasource_updateTimestamp(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Datasource", field.Name) + return nil, errors.New("field of type String does not have child fields") }, } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Mutation_createDatasource_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } -func (ec *executionContext) _Mutation_updateDatasource(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Mutation_updateDatasource(ctx, field) +func (ec *executionContext) _Model_namespace(ctx context.Context, field graphql.CollectedField, obj *model.Model) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Model_namespace(ctx, field) if err != nil { return graphql.Null } @@ -1335,7 +1585,7 @@ func (ec *executionContext) _Mutation_updateDatasource(ctx context.Context, fiel }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Mutation().UpdateDatasource(rctx, fc.Args["input"].(*model.UpdateDatasourceInput)) + return obj.Namespace, nil }) if err != nil { ec.Error(ctx, err) @@ -1347,61 +1597,26 @@ func (ec *executionContext) _Mutation_updateDatasource(ctx context.Context, fiel } return graphql.Null } - res := resTmp.(*model.Datasource) + res := resTmp.(string) fc.Result = res - return ec.marshalNDatasource2ᚖgithubᚗcomᚋkubeagiᚋarcadiaᚋgraphqlᚑserverᚋgoᚑserverᚋgraphᚋmodelᚐDatasource(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Mutation_updateDatasource(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Model_namespace(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Mutation", + Object: "Model", Field: field, - IsMethod: true, - IsResolver: true, + IsMethod: false, + IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "name": - return ec.fieldContext_Datasource_name(ctx, field) - case "namespace": - return ec.fieldContext_Datasource_namespace(ctx, field) - case "labels": - return ec.fieldContext_Datasource_labels(ctx, field) - case "annotations": - return ec.fieldContext_Datasource_annotations(ctx, field) - case "creator": - return ec.fieldContext_Datasource_creator(ctx, field) - case "displayName": - return ec.fieldContext_Datasource_displayName(ctx, field) - case "endpoint": - return ec.fieldContext_Datasource_endpoint(ctx, field) - case "oss": - return ec.fieldContext_Datasource_oss(ctx, field) - case "status": - return ec.fieldContext_Datasource_status(ctx, field) - case "fileCount": - return ec.fieldContext_Datasource_fileCount(ctx, field) - case "updateTimestamp": - return ec.fieldContext_Datasource_updateTimestamp(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Datasource", field.Name) + return nil, errors.New("field of type String does not have child fields") }, } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Mutation_updateDatasource_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } -func (ec *executionContext) _Mutation_deleteDatasource(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Mutation_deleteDatasource(ctx, field) +func (ec *executionContext) _Model_labels(ctx context.Context, field graphql.CollectedField, obj *model.Model) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Model_labels(ctx, field) if err != nil { return graphql.Null } @@ -1414,7 +1629,7 @@ func (ec *executionContext) _Mutation_deleteDatasource(ctx context.Context, fiel }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Mutation().DeleteDatasource(rctx, fc.Args["input"].(*model.DeleteDatasourceInput)) + return obj.Labels, nil }) if err != nil { ec.Error(ctx, err) @@ -1423,37 +1638,26 @@ func (ec *executionContext) _Mutation_deleteDatasource(ctx context.Context, fiel if resTmp == nil { return graphql.Null } - res := resTmp.(*string) + res := resTmp.(map[string]interface{}) fc.Result = res - return ec.marshalOVoid2ᚖstring(ctx, field.Selections, res) + return ec.marshalOMap2map(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Mutation_deleteDatasource(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Model_labels(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Mutation", + Object: "Model", Field: field, - IsMethod: true, - IsResolver: true, + IsMethod: false, + IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Void does not have child fields") + return nil, errors.New("field of type Map does not have child fields") }, } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Mutation_deleteDatasource_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } -func (ec *executionContext) _Oss_bucket(ctx context.Context, field graphql.CollectedField, obj *model.Oss) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Oss_bucket(ctx, field) +func (ec *executionContext) _Model_annotations(ctx context.Context, field graphql.CollectedField, obj *model.Model) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Model_annotations(ctx, field) if err != nil { return graphql.Null } @@ -1466,7 +1670,7 @@ func (ec *executionContext) _Oss_bucket(ctx context.Context, field graphql.Colle }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Bucket, nil + return obj.Annotations, nil }) if err != nil { ec.Error(ctx, err) @@ -1475,26 +1679,26 @@ func (ec *executionContext) _Oss_bucket(ctx context.Context, field graphql.Colle if resTmp == nil { return graphql.Null } - res := resTmp.(*string) + res := resTmp.(map[string]interface{}) fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) + return ec.marshalOMap2map(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Oss_bucket(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Model_annotations(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Oss", + Object: "Model", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + return nil, errors.New("field of type Map does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Oss_Object(ctx context.Context, field graphql.CollectedField, obj *model.Oss) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Oss_Object(ctx, field) +func (ec *executionContext) _Model_creator(ctx context.Context, field graphql.CollectedField, obj *model.Model) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Model_creator(ctx, field) if err != nil { return graphql.Null } @@ -1507,7 +1711,7 @@ func (ec *executionContext) _Oss_Object(ctx context.Context, field graphql.Colle }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Object, nil + return obj.Creator, nil }) if err != nil { ec.Error(ctx, err) @@ -1521,9 +1725,9 @@ func (ec *executionContext) _Oss_Object(ctx context.Context, field graphql.Colle return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Oss_Object(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Model_creator(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Oss", + Object: "Model", Field: field, IsMethod: false, IsResolver: false, @@ -1534,8 +1738,8 @@ func (ec *executionContext) fieldContext_Oss_Object(ctx context.Context, field g return fc, nil } -func (ec *executionContext) _PaginatedDatasource_hasNextPage(ctx context.Context, field graphql.CollectedField, obj *model.PaginatedDatasource) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_PaginatedDatasource_hasNextPage(ctx, field) +func (ec *executionContext) _Model_displayName(ctx context.Context, field graphql.CollectedField, obj *model.Model) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Model_displayName(ctx, field) if err != nil { return graphql.Null } @@ -1548,7 +1752,7 @@ func (ec *executionContext) _PaginatedDatasource_hasNextPage(ctx context.Context }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.HasNextPage, nil + return obj.DisplayName, nil }) if err != nil { ec.Error(ctx, err) @@ -1560,26 +1764,26 @@ func (ec *executionContext) _PaginatedDatasource_hasNextPage(ctx context.Context } return graphql.Null } - res := resTmp.(bool) + res := resTmp.(string) fc.Result = res - return ec.marshalNBoolean2bool(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_PaginatedDatasource_hasNextPage(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Model_displayName(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "PaginatedDatasource", + Object: "Model", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _PaginatedDatasource_nodes(ctx context.Context, field graphql.CollectedField, obj *model.PaginatedDatasource) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_PaginatedDatasource_nodes(ctx, field) +func (ec *executionContext) _Model_description(ctx context.Context, field graphql.CollectedField, obj *model.Model) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Model_description(ctx, field) if err != nil { return graphql.Null } @@ -1592,7 +1796,7 @@ func (ec *executionContext) _PaginatedDatasource_nodes(ctx context.Context, fiel }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Nodes, nil + return obj.Description, nil }) if err != nil { ec.Error(ctx, err) @@ -1601,50 +1805,26 @@ func (ec *executionContext) _PaginatedDatasource_nodes(ctx context.Context, fiel if resTmp == nil { return graphql.Null } - res := resTmp.([]*model.Datasource) + res := resTmp.(*string) fc.Result = res - return ec.marshalODatasource2ᚕᚖgithubᚗcomᚋkubeagiᚋarcadiaᚋgraphqlᚑserverᚋgoᚑserverᚋgraphᚋmodelᚐDatasourceᚄ(ctx, field.Selections, res) + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_PaginatedDatasource_nodes(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Model_description(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "PaginatedDatasource", + Object: "Model", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "name": - return ec.fieldContext_Datasource_name(ctx, field) - case "namespace": - return ec.fieldContext_Datasource_namespace(ctx, field) - case "labels": - return ec.fieldContext_Datasource_labels(ctx, field) - case "annotations": - return ec.fieldContext_Datasource_annotations(ctx, field) - case "creator": - return ec.fieldContext_Datasource_creator(ctx, field) - case "displayName": - return ec.fieldContext_Datasource_displayName(ctx, field) - case "endpoint": - return ec.fieldContext_Datasource_endpoint(ctx, field) - case "oss": - return ec.fieldContext_Datasource_oss(ctx, field) - case "status": - return ec.fieldContext_Datasource_status(ctx, field) - case "fileCount": - return ec.fieldContext_Datasource_fileCount(ctx, field) - case "updateTimestamp": - return ec.fieldContext_Datasource_updateTimestamp(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Datasource", field.Name) + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _PaginatedDatasource_page(ctx context.Context, field graphql.CollectedField, obj *model.PaginatedDatasource) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_PaginatedDatasource_page(ctx, field) +func (ec *executionContext) _Model_field(ctx context.Context, field graphql.CollectedField, obj *model.Model) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Model_field(ctx, field) if err != nil { return graphql.Null } @@ -1657,35 +1837,38 @@ func (ec *executionContext) _PaginatedDatasource_page(ctx context.Context, field }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Page, nil + return obj.Field, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.(*int) + res := resTmp.(string) fc.Result = res - return ec.marshalOInt2ᚖint(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_PaginatedDatasource_page(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Model_field(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "PaginatedDatasource", + Object: "Model", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Int does not have child fields") + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _PaginatedDatasource_pageSize(ctx context.Context, field graphql.CollectedField, obj *model.PaginatedDatasource) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_PaginatedDatasource_pageSize(ctx, field) +func (ec *executionContext) _Model_modeltype(ctx context.Context, field graphql.CollectedField, obj *model.Model) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Model_modeltype(ctx, field) if err != nil { return graphql.Null } @@ -1698,35 +1881,38 @@ func (ec *executionContext) _PaginatedDatasource_pageSize(ctx context.Context, f }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.PageSize, nil + return obj.Modeltype, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.(*int) + res := resTmp.(string) fc.Result = res - return ec.marshalOInt2ᚖint(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_PaginatedDatasource_pageSize(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Model_modeltype(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "PaginatedDatasource", + Object: "Model", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Int does not have child fields") + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _PaginatedDatasource_totalCount(ctx context.Context, field graphql.CollectedField, obj *model.PaginatedDatasource) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_PaginatedDatasource_totalCount(ctx, field) +func (ec *executionContext) _Model_updateTimestamp(ctx context.Context, field graphql.CollectedField, obj *model.Model) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Model_updateTimestamp(ctx, field) if err != nil { return graphql.Null } @@ -1739,38 +1925,35 @@ func (ec *executionContext) _PaginatedDatasource_totalCount(ctx context.Context, }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.TotalCount, nil + return obj.UpdateTimestamp, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(int) + res := resTmp.(*time.Time) fc.Result = res - return ec.marshalNInt2int(ctx, field.Selections, res) + return ec.marshalOTime2ᚖtimeᚐTime(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_PaginatedDatasource_totalCount(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Model_updateTimestamp(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "PaginatedDatasource", + Object: "Model", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Int does not have child fields") + return nil, errors.New("field of type Time does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Query_datasource(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Query_datasource(ctx, field) +func (ec *executionContext) _Mutation_createDatasource(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_createDatasource(ctx, field) if err != nil { return graphql.Null } @@ -1783,7 +1966,7 @@ func (ec *executionContext) _Query_datasource(ctx context.Context, field graphql }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().Datasource(rctx, fc.Args["name"].(string), fc.Args["namespace"].(string)) + return ec.resolvers.Mutation().CreateDatasource(rctx, fc.Args["input"].(model.CreateDatasourceInput)) }) if err != nil { ec.Error(ctx, err) @@ -1800,9 +1983,9 @@ func (ec *executionContext) _Query_datasource(ctx context.Context, field graphql return ec.marshalNDatasource2ᚖgithubᚗcomᚋkubeagiᚋarcadiaᚋgraphqlᚑserverᚋgoᚑserverᚋgraphᚋmodelᚐDatasource(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Query_datasource(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Mutation_createDatasource(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Query", + Object: "Mutation", Field: field, IsMethod: true, IsResolver: true, @@ -1841,15 +2024,15 @@ func (ec *executionContext) fieldContext_Query_datasource(ctx context.Context, f } }() ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Query_datasource_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + if fc.Args, err = ec.field_Mutation_createDatasource_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { ec.Error(ctx, err) return fc, err } return fc, nil } -func (ec *executionContext) _Query_datasourcesPaged(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Query_datasourcesPaged(ctx, field) +func (ec *executionContext) _Mutation_updateDatasource(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_updateDatasource(ctx, field) if err != nil { return graphql.Null } @@ -1862,7 +2045,7 @@ func (ec *executionContext) _Query_datasourcesPaged(ctx context.Context, field g }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().DatasourcesPaged(rctx, fc.Args["input"].(model.ListDatasourceInput)) + return ec.resolvers.Mutation().UpdateDatasource(rctx, fc.Args["input"].(*model.UpdateDatasourceInput)) }) if err != nil { ec.Error(ctx, err) @@ -1874,31 +2057,43 @@ func (ec *executionContext) _Query_datasourcesPaged(ctx context.Context, field g } return graphql.Null } - res := resTmp.(*model.PaginatedDatasource) + res := resTmp.(*model.Datasource) fc.Result = res - return ec.marshalNPaginatedDatasource2ᚖgithubᚗcomᚋkubeagiᚋarcadiaᚋgraphqlᚑserverᚋgoᚑserverᚋgraphᚋmodelᚐPaginatedDatasource(ctx, field.Selections, res) + return ec.marshalNDatasource2ᚖgithubᚗcomᚋkubeagiᚋarcadiaᚋgraphqlᚑserverᚋgoᚑserverᚋgraphᚋmodelᚐDatasource(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Query_datasourcesPaged(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Mutation_updateDatasource(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Query", + Object: "Mutation", Field: field, IsMethod: true, IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "hasNextPage": - return ec.fieldContext_PaginatedDatasource_hasNextPage(ctx, field) - case "nodes": - return ec.fieldContext_PaginatedDatasource_nodes(ctx, field) - case "page": - return ec.fieldContext_PaginatedDatasource_page(ctx, field) - case "pageSize": - return ec.fieldContext_PaginatedDatasource_pageSize(ctx, field) - case "totalCount": - return ec.fieldContext_PaginatedDatasource_totalCount(ctx, field) + case "name": + return ec.fieldContext_Datasource_name(ctx, field) + case "namespace": + return ec.fieldContext_Datasource_namespace(ctx, field) + case "labels": + return ec.fieldContext_Datasource_labels(ctx, field) + case "annotations": + return ec.fieldContext_Datasource_annotations(ctx, field) + case "creator": + return ec.fieldContext_Datasource_creator(ctx, field) + case "displayName": + return ec.fieldContext_Datasource_displayName(ctx, field) + case "endpoint": + return ec.fieldContext_Datasource_endpoint(ctx, field) + case "oss": + return ec.fieldContext_Datasource_oss(ctx, field) + case "status": + return ec.fieldContext_Datasource_status(ctx, field) + case "fileCount": + return ec.fieldContext_Datasource_fileCount(ctx, field) + case "updateTimestamp": + return ec.fieldContext_Datasource_updateTimestamp(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type PaginatedDatasource", field.Name) + return nil, fmt.Errorf("no field named %q was found under type Datasource", field.Name) }, } defer func() { @@ -1908,15 +2103,15 @@ func (ec *executionContext) fieldContext_Query_datasourcesPaged(ctx context.Cont } }() ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Query_datasourcesPaged_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + if fc.Args, err = ec.field_Mutation_updateDatasource_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { ec.Error(ctx, err) return fc, err } return fc, nil } -func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Query___type(ctx, field) +func (ec *executionContext) _Mutation_deleteDatasource(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_deleteDatasource(ctx, field) if err != nil { return graphql.Null } @@ -1929,7 +2124,7 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.introspectType(fc.Args["name"].(string)) + return ec.resolvers.Mutation().DeleteDatasource(rctx, fc.Args["input"].(*model.DeleteDatasourceInput)) }) if err != nil { ec.Error(ctx, err) @@ -1938,30 +2133,1128 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col if resTmp == nil { return graphql.Null } - res := resTmp.(*introspection.Type) + res := resTmp.(*string) fc.Result = res - return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) + return ec.marshalOVoid2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Query___type(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Mutation_deleteDatasource(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Query", + Object: "Mutation", Field: field, IsMethod: true, - IsResolver: false, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) - case "name": - return ec.fieldContext___Type_name(ctx, field) - case "description": - return ec.fieldContext___Type_description(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": + return nil, errors.New("field of type Void does not have child fields") + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_deleteDatasource_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_createModel(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_createModel(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().CreateModel(rctx, fc.Args["input"].(model.CreateModelInput)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.Model) + fc.Result = res + return ec.marshalNModel2ᚖgithubᚗcomᚋkubeagiᚋarcadiaᚋgraphqlᚑserverᚋgoᚑserverᚋgraphᚋmodelᚐModel(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_createModel(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return ec.fieldContext_Model_name(ctx, field) + case "namespace": + return ec.fieldContext_Model_namespace(ctx, field) + case "labels": + return ec.fieldContext_Model_labels(ctx, field) + case "annotations": + return ec.fieldContext_Model_annotations(ctx, field) + case "creator": + return ec.fieldContext_Model_creator(ctx, field) + case "displayName": + return ec.fieldContext_Model_displayName(ctx, field) + case "description": + return ec.fieldContext_Model_description(ctx, field) + case "field": + return ec.fieldContext_Model_field(ctx, field) + case "modeltype": + return ec.fieldContext_Model_modeltype(ctx, field) + case "updateTimestamp": + return ec.fieldContext_Model_updateTimestamp(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Model", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_createModel_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_updateModel(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_updateModel(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().UpdateModel(rctx, fc.Args["input"].(*model.UpdateModelInput)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.Model) + fc.Result = res + return ec.marshalNModel2ᚖgithubᚗcomᚋkubeagiᚋarcadiaᚋgraphqlᚑserverᚋgoᚑserverᚋgraphᚋmodelᚐModel(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_updateModel(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return ec.fieldContext_Model_name(ctx, field) + case "namespace": + return ec.fieldContext_Model_namespace(ctx, field) + case "labels": + return ec.fieldContext_Model_labels(ctx, field) + case "annotations": + return ec.fieldContext_Model_annotations(ctx, field) + case "creator": + return ec.fieldContext_Model_creator(ctx, field) + case "displayName": + return ec.fieldContext_Model_displayName(ctx, field) + case "description": + return ec.fieldContext_Model_description(ctx, field) + case "field": + return ec.fieldContext_Model_field(ctx, field) + case "modeltype": + return ec.fieldContext_Model_modeltype(ctx, field) + case "updateTimestamp": + return ec.fieldContext_Model_updateTimestamp(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Model", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_updateModel_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_deleteModel(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_deleteModel(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().DeleteModel(rctx, fc.Args["input"].(*model.DeleteModelInput)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOVoid2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_deleteModel(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Void does not have child fields") + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_deleteModel_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Oss_bucket(ctx context.Context, field graphql.CollectedField, obj *model.Oss) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Oss_bucket(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Bucket, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Oss_bucket(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Oss", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Oss_Object(ctx context.Context, field graphql.CollectedField, obj *model.Oss) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Oss_Object(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Object, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Oss_Object(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Oss", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _PaginatedDatasource_hasNextPage(ctx context.Context, field graphql.CollectedField, obj *model.PaginatedDatasource) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_PaginatedDatasource_hasNextPage(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.HasNextPage, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_PaginatedDatasource_hasNextPage(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "PaginatedDatasource", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _PaginatedDatasource_nodes(ctx context.Context, field graphql.CollectedField, obj *model.PaginatedDatasource) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_PaginatedDatasource_nodes(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Nodes, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]*model.Datasource) + fc.Result = res + return ec.marshalODatasource2ᚕᚖgithubᚗcomᚋkubeagiᚋarcadiaᚋgraphqlᚑserverᚋgoᚑserverᚋgraphᚋmodelᚐDatasourceᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_PaginatedDatasource_nodes(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "PaginatedDatasource", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return ec.fieldContext_Datasource_name(ctx, field) + case "namespace": + return ec.fieldContext_Datasource_namespace(ctx, field) + case "labels": + return ec.fieldContext_Datasource_labels(ctx, field) + case "annotations": + return ec.fieldContext_Datasource_annotations(ctx, field) + case "creator": + return ec.fieldContext_Datasource_creator(ctx, field) + case "displayName": + return ec.fieldContext_Datasource_displayName(ctx, field) + case "endpoint": + return ec.fieldContext_Datasource_endpoint(ctx, field) + case "oss": + return ec.fieldContext_Datasource_oss(ctx, field) + case "status": + return ec.fieldContext_Datasource_status(ctx, field) + case "fileCount": + return ec.fieldContext_Datasource_fileCount(ctx, field) + case "updateTimestamp": + return ec.fieldContext_Datasource_updateTimestamp(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Datasource", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _PaginatedDatasource_page(ctx context.Context, field graphql.CollectedField, obj *model.PaginatedDatasource) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_PaginatedDatasource_page(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Page, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*int) + fc.Result = res + return ec.marshalOInt2ᚖint(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_PaginatedDatasource_page(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "PaginatedDatasource", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _PaginatedDatasource_pageSize(ctx context.Context, field graphql.CollectedField, obj *model.PaginatedDatasource) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_PaginatedDatasource_pageSize(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.PageSize, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*int) + fc.Result = res + return ec.marshalOInt2ᚖint(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_PaginatedDatasource_pageSize(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "PaginatedDatasource", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _PaginatedDatasource_totalCount(ctx context.Context, field graphql.CollectedField, obj *model.PaginatedDatasource) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_PaginatedDatasource_totalCount(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.TotalCount, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(int) + fc.Result = res + return ec.marshalNInt2int(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_PaginatedDatasource_totalCount(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "PaginatedDatasource", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _PaginatedModel_hasNextPage(ctx context.Context, field graphql.CollectedField, obj *model.PaginatedModel) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_PaginatedModel_hasNextPage(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.HasNextPage, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_PaginatedModel_hasNextPage(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "PaginatedModel", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _PaginatedModel_nodes(ctx context.Context, field graphql.CollectedField, obj *model.PaginatedModel) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_PaginatedModel_nodes(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Nodes, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]*model.Model) + fc.Result = res + return ec.marshalOModel2ᚕᚖgithubᚗcomᚋkubeagiᚋarcadiaᚋgraphqlᚑserverᚋgoᚑserverᚋgraphᚋmodelᚐModelᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_PaginatedModel_nodes(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "PaginatedModel", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return ec.fieldContext_Model_name(ctx, field) + case "namespace": + return ec.fieldContext_Model_namespace(ctx, field) + case "labels": + return ec.fieldContext_Model_labels(ctx, field) + case "annotations": + return ec.fieldContext_Model_annotations(ctx, field) + case "creator": + return ec.fieldContext_Model_creator(ctx, field) + case "displayName": + return ec.fieldContext_Model_displayName(ctx, field) + case "description": + return ec.fieldContext_Model_description(ctx, field) + case "field": + return ec.fieldContext_Model_field(ctx, field) + case "modeltype": + return ec.fieldContext_Model_modeltype(ctx, field) + case "updateTimestamp": + return ec.fieldContext_Model_updateTimestamp(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Model", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _PaginatedModel_page(ctx context.Context, field graphql.CollectedField, obj *model.PaginatedModel) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_PaginatedModel_page(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Page, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*int) + fc.Result = res + return ec.marshalOInt2ᚖint(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_PaginatedModel_page(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "PaginatedModel", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _PaginatedModel_pageSize(ctx context.Context, field graphql.CollectedField, obj *model.PaginatedModel) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_PaginatedModel_pageSize(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.PageSize, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*int) + fc.Result = res + return ec.marshalOInt2ᚖint(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_PaginatedModel_pageSize(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "PaginatedModel", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _PaginatedModel_totalCount(ctx context.Context, field graphql.CollectedField, obj *model.PaginatedModel) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_PaginatedModel_totalCount(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.TotalCount, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(int) + fc.Result = res + return ec.marshalNInt2int(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_PaginatedModel_totalCount(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "PaginatedModel", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Query_datasource(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_datasource(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().Datasource(rctx, fc.Args["name"].(string), fc.Args["namespace"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.Datasource) + fc.Result = res + return ec.marshalNDatasource2ᚖgithubᚗcomᚋkubeagiᚋarcadiaᚋgraphqlᚑserverᚋgoᚑserverᚋgraphᚋmodelᚐDatasource(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_datasource(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return ec.fieldContext_Datasource_name(ctx, field) + case "namespace": + return ec.fieldContext_Datasource_namespace(ctx, field) + case "labels": + return ec.fieldContext_Datasource_labels(ctx, field) + case "annotations": + return ec.fieldContext_Datasource_annotations(ctx, field) + case "creator": + return ec.fieldContext_Datasource_creator(ctx, field) + case "displayName": + return ec.fieldContext_Datasource_displayName(ctx, field) + case "endpoint": + return ec.fieldContext_Datasource_endpoint(ctx, field) + case "oss": + return ec.fieldContext_Datasource_oss(ctx, field) + case "status": + return ec.fieldContext_Datasource_status(ctx, field) + case "fileCount": + return ec.fieldContext_Datasource_fileCount(ctx, field) + case "updateTimestamp": + return ec.fieldContext_Datasource_updateTimestamp(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Datasource", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_datasource_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Query_datasourcesPaged(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_datasourcesPaged(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().DatasourcesPaged(rctx, fc.Args["input"].(model.ListDatasourceInput)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.PaginatedDatasource) + fc.Result = res + return ec.marshalNPaginatedDatasource2ᚖgithubᚗcomᚋkubeagiᚋarcadiaᚋgraphqlᚑserverᚋgoᚑserverᚋgraphᚋmodelᚐPaginatedDatasource(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_datasourcesPaged(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "hasNextPage": + return ec.fieldContext_PaginatedDatasource_hasNextPage(ctx, field) + case "nodes": + return ec.fieldContext_PaginatedDatasource_nodes(ctx, field) + case "page": + return ec.fieldContext_PaginatedDatasource_page(ctx, field) + case "pageSize": + return ec.fieldContext_PaginatedDatasource_pageSize(ctx, field) + case "totalCount": + return ec.fieldContext_PaginatedDatasource_totalCount(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type PaginatedDatasource", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_datasourcesPaged_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Query_getModel(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_getModel(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().GetModel(rctx, fc.Args["name"].(string), fc.Args["namespace"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.Model) + fc.Result = res + return ec.marshalNModel2ᚖgithubᚗcomᚋkubeagiᚋarcadiaᚋgraphqlᚑserverᚋgoᚑserverᚋgraphᚋmodelᚐModel(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_getModel(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return ec.fieldContext_Model_name(ctx, field) + case "namespace": + return ec.fieldContext_Model_namespace(ctx, field) + case "labels": + return ec.fieldContext_Model_labels(ctx, field) + case "annotations": + return ec.fieldContext_Model_annotations(ctx, field) + case "creator": + return ec.fieldContext_Model_creator(ctx, field) + case "displayName": + return ec.fieldContext_Model_displayName(ctx, field) + case "description": + return ec.fieldContext_Model_description(ctx, field) + case "field": + return ec.fieldContext_Model_field(ctx, field) + case "modeltype": + return ec.fieldContext_Model_modeltype(ctx, field) + case "updateTimestamp": + return ec.fieldContext_Model_updateTimestamp(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Model", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_getModel_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Query_listModels(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_listModels(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().ListModels(rctx, fc.Args["input"].(model.ListModelInput)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.PaginatedModel) + fc.Result = res + return ec.marshalNPaginatedModel2ᚖgithubᚗcomᚋkubeagiᚋarcadiaᚋgraphqlᚑserverᚋgoᚑserverᚋgraphᚋmodelᚐPaginatedModel(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_listModels(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "hasNextPage": + return ec.fieldContext_PaginatedModel_hasNextPage(ctx, field) + case "nodes": + return ec.fieldContext_PaginatedModel_nodes(ctx, field) + case "page": + return ec.fieldContext_PaginatedModel_page(ctx, field) + case "pageSize": + return ec.fieldContext_PaginatedModel_pageSize(ctx, field) + case "totalCount": + return ec.fieldContext_PaginatedModel_totalCount(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type PaginatedModel", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_listModels_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query___type(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.introspectType(fc.Args["name"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*introspection.Type) + fc.Result = res + return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query___type(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": return ec.fieldContext___Type_possibleTypes(ctx, field) case "enumValues": return ec.fieldContext___Type_enumValues(ctx, field) @@ -3980,21 +5273,113 @@ func (ec *executionContext) fieldContext___Type_specifiedByURL(ctx context.Conte return nil, errors.New("field of type String does not have child fields") }, } - return fc, nil -} - -// endregion **************************** field.gotpl ***************************** + return fc, nil +} + +// endregion **************************** field.gotpl ***************************** + +// region **************************** input.gotpl ***************************** + +func (ec *executionContext) unmarshalInputCreateDatasourceInput(ctx context.Context, obj interface{}) (model.CreateDatasourceInput, error) { + var it model.CreateDatasourceInput + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"name", "namespace", "labels", "annotations", "displayName", "description", "endpointinput", "ossinput"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "name": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.Name = data + case "namespace": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespace")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.Namespace = data + case "labels": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("labels")) + data, err := ec.unmarshalOMap2map(ctx, v) + if err != nil { + return it, err + } + it.Labels = data + case "annotations": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("annotations")) + data, err := ec.unmarshalOMap2map(ctx, v) + if err != nil { + return it, err + } + it.Annotations = data + case "displayName": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("displayName")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.DisplayName = data + case "description": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("description")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Description = data + case "endpointinput": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("endpointinput")) + data, err := ec.unmarshalOEndpointInput2ᚖgithubᚗcomᚋkubeagiᚋarcadiaᚋgraphqlᚑserverᚋgoᚑserverᚋgraphᚋmodelᚐEndpointInput(ctx, v) + if err != nil { + return it, err + } + it.Endpointinput = data + case "ossinput": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ossinput")) + data, err := ec.unmarshalOOssInput2ᚖgithubᚗcomᚋkubeagiᚋarcadiaᚋgraphqlᚑserverᚋgoᚑserverᚋgraphᚋmodelᚐOssInput(ctx, v) + if err != nil { + return it, err + } + it.Ossinput = data + } + } -// region **************************** input.gotpl ***************************** + return it, nil +} -func (ec *executionContext) unmarshalInputCreateDatasourceInput(ctx context.Context, obj interface{}) (model.CreateDatasourceInput, error) { - var it model.CreateDatasourceInput +func (ec *executionContext) unmarshalInputCreateModelInput(ctx context.Context, obj interface{}) (model.CreateModelInput, error) { + var it model.CreateModelInput asMap := map[string]interface{}{} for k, v := range obj.(map[string]interface{}) { asMap[k] = v } - fieldsInOrder := [...]string{"name", "namespace", "labels", "annotations", "displayName", "description", "endpointinput", "ossinput"} + fieldsInOrder := [...]string{"name", "namespace", "displayName", "field", "description", "modeltype", "updateTimestamp"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { @@ -4019,33 +5404,24 @@ func (ec *executionContext) unmarshalInputCreateDatasourceInput(ctx context.Cont return it, err } it.Namespace = data - case "labels": - var err error - - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("labels")) - data, err := ec.unmarshalOMap2map(ctx, v) - if err != nil { - return it, err - } - it.Labels = data - case "annotations": + case "displayName": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("annotations")) - data, err := ec.unmarshalOMap2map(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("displayName")) + data, err := ec.unmarshalNString2string(ctx, v) if err != nil { return it, err } - it.Annotations = data - case "displayName": + it.DisplayName = data + case "field": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("displayName")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("field")) data, err := ec.unmarshalNString2string(ctx, v) if err != nil { return it, err } - it.DisplayName = data + it.Field = data case "description": var err error @@ -4055,24 +5431,24 @@ func (ec *executionContext) unmarshalInputCreateDatasourceInput(ctx context.Cont return it, err } it.Description = data - case "endpointinput": + case "modeltype": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("endpointinput")) - data, err := ec.unmarshalOEndpointInput2ᚖgithubᚗcomᚋkubeagiᚋarcadiaᚋgraphqlᚑserverᚋgoᚑserverᚋgraphᚋmodelᚐEndpointInput(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("modeltype")) + data, err := ec.unmarshalNString2string(ctx, v) if err != nil { return it, err } - it.Endpointinput = data - case "ossinput": + it.Modeltype = data + case "updateTimestamp": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ossinput")) - data, err := ec.unmarshalOOssInput2ᚖgithubᚗcomᚋkubeagiᚋarcadiaᚋgraphqlᚑserverᚋgoᚑserverᚋgraphᚋmodelᚐOssInput(ctx, v) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("updateTimestamp")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } - it.Ossinput = data + it.UpdateTimestamp = data } } @@ -4135,6 +5511,62 @@ func (ec *executionContext) unmarshalInputDeleteDatasourceInput(ctx context.Cont return it, nil } +func (ec *executionContext) unmarshalInputDeleteModelInput(ctx context.Context, obj interface{}) (model.DeleteModelInput, error) { + var it model.DeleteModelInput + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"name", "namespace", "labelSelector", "fieldSelector"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "name": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Name = data + case "namespace": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespace")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.Namespace = data + case "labelSelector": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("labelSelector")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.LabelSelector = data + case "fieldSelector": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("fieldSelector")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.FieldSelector = data + } + } + + return it, nil +} + func (ec *executionContext) unmarshalInputEndpointInput(ctx context.Context, obj interface{}) (model.EndpointInput, error) { var it model.EndpointInput asMap := map[string]interface{}{} @@ -4274,6 +5706,98 @@ func (ec *executionContext) unmarshalInputListDatasourceInput(ctx context.Contex return it, nil } +func (ec *executionContext) unmarshalInputListModelInput(ctx context.Context, obj interface{}) (model.ListModelInput, error) { + var it model.ListModelInput + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"name", "namespace", "displayName", "labelSelector", "fieldSelector", "page", "pageSize", "keyword"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "name": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Name = data + case "namespace": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespace")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.Namespace = data + case "displayName": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("displayName")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.DisplayName = data + case "labelSelector": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("labelSelector")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.LabelSelector = data + case "fieldSelector": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("fieldSelector")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.FieldSelector = data + case "page": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("page")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.Page = data + case "pageSize": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pageSize")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.PageSize = data + case "keyword": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("keyword")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Keyword = data + } + } + + return it, nil +} + func (ec *executionContext) unmarshalInputOssInput(ctx context.Context, obj interface{}) (model.OssInput, error) { var it model.OssInput asMap := map[string]interface{}{} @@ -4347,29 +5871,103 @@ func (ec *executionContext) unmarshalInputTypedObjectReferenceInput(ctx context. case "Name": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("Name")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("Name")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.Name = data + case "Namespace": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("Namespace")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Namespace = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputUpdateDatasourceInput(ctx context.Context, obj interface{}) (model.UpdateDatasourceInput, error) { + var it model.UpdateDatasourceInput + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"name", "namespace", "labels", "annotations", "displayName", "description"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "name": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.Name = data + case "namespace": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("namespace")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.Namespace = data + case "labels": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("labels")) + data, err := ec.unmarshalOMap2map(ctx, v) + if err != nil { + return it, err + } + it.Labels = data + case "annotations": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("annotations")) + data, err := ec.unmarshalOMap2map(ctx, v) + if err != nil { + return it, err + } + it.Annotations = data + case "displayName": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("displayName")) data, err := ec.unmarshalNString2string(ctx, v) if err != nil { return it, err } - it.Name = data - case "Namespace": + it.DisplayName = data + case "description": var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("Namespace")) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("description")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.Namespace = data + it.Description = data } } return it, nil } -func (ec *executionContext) unmarshalInputUpdateDatasourceInput(ctx context.Context, obj interface{}) (model.UpdateDatasourceInput, error) { - var it model.UpdateDatasourceInput +func (ec *executionContext) unmarshalInputUpdateModelInput(ctx context.Context, obj interface{}) (model.UpdateModelInput, error) { + var it model.UpdateModelInput asMap := map[string]interface{}{} for k, v := range obj.(map[string]interface{}) { asMap[k] = v @@ -4558,6 +6156,75 @@ func (ec *executionContext) _Endpoint(ctx context.Context, sel ast.SelectionSet, return out } +var modelImplementors = []string{"Model"} + +func (ec *executionContext) _Model(ctx context.Context, sel ast.SelectionSet, obj *model.Model) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, modelImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("Model") + case "name": + out.Values[i] = ec._Model_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "namespace": + out.Values[i] = ec._Model_namespace(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "labels": + out.Values[i] = ec._Model_labels(ctx, field, obj) + case "annotations": + out.Values[i] = ec._Model_annotations(ctx, field, obj) + case "creator": + out.Values[i] = ec._Model_creator(ctx, field, obj) + case "displayName": + out.Values[i] = ec._Model_displayName(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "description": + out.Values[i] = ec._Model_description(ctx, field, obj) + case "field": + out.Values[i] = ec._Model_field(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "modeltype": + out.Values[i] = ec._Model_modeltype(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "updateTimestamp": + out.Values[i] = ec._Model_updateTimestamp(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + var mutationImplementors = []string{"Mutation"} func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { @@ -4595,6 +6262,24 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { return ec._Mutation_deleteDatasource(ctx, field) }) + case "createModel": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_createModel(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "updateModel": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_updateModel(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "deleteModel": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_deleteModel(ctx, field) + }) default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -4706,6 +6391,56 @@ func (ec *executionContext) _PaginatedDatasource(ctx context.Context, sel ast.Se return out } +var paginatedModelImplementors = []string{"PaginatedModel"} + +func (ec *executionContext) _PaginatedModel(ctx context.Context, sel ast.SelectionSet, obj *model.PaginatedModel) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, paginatedModelImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("PaginatedModel") + case "hasNextPage": + out.Values[i] = ec._PaginatedModel_hasNextPage(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "nodes": + out.Values[i] = ec._PaginatedModel_nodes(ctx, field, obj) + case "page": + out.Values[i] = ec._PaginatedModel_page(ctx, field, obj) + case "pageSize": + out.Values[i] = ec._PaginatedModel_pageSize(ctx, field, obj) + case "totalCount": + out.Values[i] = ec._PaginatedModel_totalCount(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + var queryImplementors = []string{"Query"} func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { @@ -4768,6 +6503,50 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) } + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "getModel": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_getModel(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "listModels": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_listModels(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) case "__type": out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { @@ -5194,6 +6973,11 @@ func (ec *executionContext) unmarshalNCreateDatasourceInput2githubᚗcomᚋkubea return res, graphql.ErrorOnPath(ctx, err) } +func (ec *executionContext) unmarshalNCreateModelInput2githubᚗcomᚋkubeagiᚋarcadiaᚋgraphqlᚑserverᚋgoᚑserverᚋgraphᚋmodelᚐCreateModelInput(ctx context.Context, v interface{}) (model.CreateModelInput, error) { + res, err := ec.unmarshalInputCreateModelInput(ctx, v) + return res, graphql.ErrorOnPath(ctx, err) +} + func (ec *executionContext) marshalNDatasource2githubᚗcomᚋkubeagiᚋarcadiaᚋgraphqlᚑserverᚋgoᚑserverᚋgraphᚋmodelᚐDatasource(ctx context.Context, sel ast.SelectionSet, v model.Datasource) graphql.Marshaler { return ec._Datasource(ctx, sel, &v) } @@ -5228,6 +7012,25 @@ func (ec *executionContext) unmarshalNListDatasourceInput2githubᚗcomᚋkubeagi return res, graphql.ErrorOnPath(ctx, err) } +func (ec *executionContext) unmarshalNListModelInput2githubᚗcomᚋkubeagiᚋarcadiaᚋgraphqlᚑserverᚋgoᚑserverᚋgraphᚋmodelᚐListModelInput(ctx context.Context, v interface{}) (model.ListModelInput, error) { + res, err := ec.unmarshalInputListModelInput(ctx, v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNModel2githubᚗcomᚋkubeagiᚋarcadiaᚋgraphqlᚑserverᚋgoᚑserverᚋgraphᚋmodelᚐModel(ctx context.Context, sel ast.SelectionSet, v model.Model) graphql.Marshaler { + return ec._Model(ctx, sel, &v) +} + +func (ec *executionContext) marshalNModel2ᚖgithubᚗcomᚋkubeagiᚋarcadiaᚋgraphqlᚑserverᚋgoᚑserverᚋgraphᚋmodelᚐModel(ctx context.Context, sel ast.SelectionSet, v *model.Model) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._Model(ctx, sel, v) +} + func (ec *executionContext) marshalNPaginatedDatasource2githubᚗcomᚋkubeagiᚋarcadiaᚋgraphqlᚑserverᚋgoᚑserverᚋgraphᚋmodelᚐPaginatedDatasource(ctx context.Context, sel ast.SelectionSet, v model.PaginatedDatasource) graphql.Marshaler { return ec._PaginatedDatasource(ctx, sel, &v) } @@ -5242,6 +7045,20 @@ func (ec *executionContext) marshalNPaginatedDatasource2ᚖgithubᚗcomᚋkubeag return ec._PaginatedDatasource(ctx, sel, v) } +func (ec *executionContext) marshalNPaginatedModel2githubᚗcomᚋkubeagiᚋarcadiaᚋgraphqlᚑserverᚋgoᚑserverᚋgraphᚋmodelᚐPaginatedModel(ctx context.Context, sel ast.SelectionSet, v model.PaginatedModel) graphql.Marshaler { + return ec._PaginatedModel(ctx, sel, &v) +} + +func (ec *executionContext) marshalNPaginatedModel2ᚖgithubᚗcomᚋkubeagiᚋarcadiaᚋgraphqlᚑserverᚋgoᚑserverᚋgraphᚋmodelᚐPaginatedModel(ctx context.Context, sel ast.SelectionSet, v *model.PaginatedModel) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._PaginatedModel(ctx, sel, v) +} + func (ec *executionContext) unmarshalNString2string(ctx context.Context, v interface{}) (string, error) { res, err := graphql.UnmarshalString(v) return res, graphql.ErrorOnPath(ctx, err) @@ -5606,6 +7423,14 @@ func (ec *executionContext) unmarshalODeleteDatasourceInput2ᚖgithubᚗcomᚋku return &res, graphql.ErrorOnPath(ctx, err) } +func (ec *executionContext) unmarshalODeleteModelInput2ᚖgithubᚗcomᚋkubeagiᚋarcadiaᚋgraphqlᚑserverᚋgoᚑserverᚋgraphᚋmodelᚐDeleteModelInput(ctx context.Context, v interface{}) (*model.DeleteModelInput, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalInputDeleteModelInput(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + func (ec *executionContext) marshalOEndpoint2ᚖgithubᚗcomᚋkubeagiᚋarcadiaᚋgraphqlᚑserverᚋgoᚑserverᚋgraphᚋmodelᚐEndpoint(ctx context.Context, sel ast.SelectionSet, v *model.Endpoint) graphql.Marshaler { if v == nil { return graphql.Null @@ -5653,6 +7478,53 @@ func (ec *executionContext) marshalOMap2map(ctx context.Context, sel ast.Selecti return res } +func (ec *executionContext) marshalOModel2ᚕᚖgithubᚗcomᚋkubeagiᚋarcadiaᚋgraphqlᚑserverᚋgoᚑserverᚋgraphᚋmodelᚐModelᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.Model) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNModel2ᚖgithubᚗcomᚋkubeagiᚋarcadiaᚋgraphqlᚑserverᚋgoᚑserverᚋgraphᚋmodelᚐModel(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + func (ec *executionContext) marshalOOss2ᚖgithubᚗcomᚋkubeagiᚋarcadiaᚋgraphqlᚑserverᚋgoᚑserverᚋgraphᚋmodelᚐOss(ctx context.Context, sel ast.SelectionSet, v *model.Oss) graphql.Marshaler { if v == nil { return graphql.Null @@ -5684,6 +7556,22 @@ func (ec *executionContext) marshalOString2ᚖstring(ctx context.Context, sel as return res } +func (ec *executionContext) unmarshalOTime2ᚖtimeᚐTime(ctx context.Context, v interface{}) (*time.Time, error) { + if v == nil { + return nil, nil + } + res, err := graphql.UnmarshalTime(v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOTime2ᚖtimeᚐTime(ctx context.Context, sel ast.SelectionSet, v *time.Time) graphql.Marshaler { + if v == nil { + return graphql.Null + } + res := graphql.MarshalTime(*v) + return res +} + func (ec *executionContext) marshalOTypedObjectReference2ᚖgithubᚗcomᚋkubeagiᚋarcadiaᚋgraphqlᚑserverᚋgoᚑserverᚋgraphᚋmodelᚐTypedObjectReference(ctx context.Context, sel ast.SelectionSet, v *model.TypedObjectReference) graphql.Marshaler { if v == nil { return graphql.Null @@ -5707,6 +7595,14 @@ func (ec *executionContext) unmarshalOUpdateDatasourceInput2ᚖgithubᚗcomᚋku return &res, graphql.ErrorOnPath(ctx, err) } +func (ec *executionContext) unmarshalOUpdateModelInput2ᚖgithubᚗcomᚋkubeagiᚋarcadiaᚋgraphqlᚑserverᚋgoᚑserverᚋgraphᚋmodelᚐUpdateModelInput(ctx context.Context, v interface{}) (*model.UpdateModelInput, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalInputUpdateModelInput(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + func (ec *executionContext) unmarshalOVoid2ᚖstring(ctx context.Context, v interface{}) (*string, error) { if v == nil { return nil, nil diff --git a/graphql-server/go-server/graph/model.graphqls b/graphql-server/go-server/graph/model.graphqls new file mode 100644 index 000000000..6b2c95ff3 --- /dev/null +++ b/graphql-server/go-server/graph/model.graphqls @@ -0,0 +1,68 @@ +type Model { + name: String! + namespace: String! + labels: Map + annotations: Map + creator: String + displayName: String! + description: String + field: String! + modeltype: String! + updateTimestamp: Time +} + +type PaginatedModel { + hasNextPage: Boolean! + nodes: [Model!] + page: Int + pageSize: Int + totalCount: Int! +} + +input CreateModelInput{ + name: String! + namespace: String! + displayName: String! + field: String! + description: String + modeltype: String! + updateTimestamp: Time +} + +input UpdateModelInput { + name: String! + namespace: String! + labels: Map + annotations: Map + displayName: String! + description: String +} + +input DeleteModelInput { + name: String + namespace: String! + labelSelector: String + fieldSelector: String +} + +input ListModelInput { + name: String + namespace: String! + displayName: String + labelSelector: String + fieldSelector: String + page: Int + pageSize: Int + # 搜索,name,field字段 + keyword: String +} +extend type Mutation { + createModel(input: CreateModelInput!): Model! + updateModel(input: UpdateModelInput): Model! + deleteModel(input: DeleteModelInput): Void +} + +extend type Query { + getModel(name: String!, namespace: String!): Model! + listModels(input: ListModelInput!): PaginatedModel! +} \ No newline at end of file diff --git a/graphql-server/go-server/graph/model.resolvers.go b/graphql-server/go-server/graph/model.resolvers.go new file mode 100644 index 000000000..82696a83e --- /dev/null +++ b/graphql-server/go-server/graph/model.resolvers.go @@ -0,0 +1,139 @@ +package graph + +// This file will be automatically regenerated based on the schema, any resolver implementations +// will be copied through when generating and any unknown code will be moved to the end. +// Code generated by github.com/99designs/gqlgen version v0.17.40 + +import ( + "context" + "strings" + + "github.com/kubeagi/arcadia/graphql-server/go-server/graph/model" + "github.com/kubeagi/arcadia/graphql-server/go-server/pkg/auth" + "github.com/kubeagi/arcadia/graphql-server/go-server/pkg/client" + md "github.com/kubeagi/arcadia/graphql-server/go-server/pkg/model" +) + +// CreateModel is the resolver for the createModel field. +func (r *mutationResolver) CreateModel(ctx context.Context, input model.CreateModelInput) (*model.Model, error) { + token := auth.ForOIDCToken(ctx) + c, err := client.GetClient(token) + if err != nil { + return nil, err + } + + displayname, description, filed, modeltype := "", "", "", "" + + if input.DisplayName != "" { + displayname = input.DisplayName + } + if input.Description != nil { + description = *input.Description + } + if input.Field != "" { + filed = input.Field + } + if input.Modeltype != "" { + modeltype = input.Modeltype + } + return md.CreateModel(ctx, c, input.Name, input.Namespace, displayname, description, filed, modeltype) +} + +// UpdateModel is the resolver for the updateModel field. +func (r *mutationResolver) UpdateModel(ctx context.Context, input *model.UpdateModelInput) (*model.Model, error) { + token := auth.ForOIDCToken(ctx) + c, err := client.GetClient(token) + if err != nil { + return nil, err + } + name, displayname := "", "" + if input.DisplayName != "" { + displayname = input.DisplayName + } + if input.Name != "" { + name = input.Name + + } + return md.UpdateModel(ctx, c, name, input.Namespace, displayname) +} + +// DeleteModel is the resolver for the deleteModel field. +func (r *mutationResolver) DeleteModel(ctx context.Context, input *model.DeleteModelInput) (*string, error) { + token := auth.ForOIDCToken(ctx) + c, err := client.GetClient(token) + if err != nil { + return nil, err + } + name := "" + labelSelector, fieldSelector := "", "" + if input.Name != nil { + name = *input.Name + } + if input.FieldSelector != nil { + fieldSelector = *input.FieldSelector + } + if input.LabelSelector != nil { + labelSelector = *input.LabelSelector + } + return md.DeleteModel(ctx, c, name, input.Namespace, labelSelector, fieldSelector) +} + +// GetModel is the resolver for the getModel field. +func (r *queryResolver) GetModel(ctx context.Context, name string, namespace string) (*model.Model, error) { + token := auth.ForOIDCToken(ctx) + c, err := client.GetClient(token) + if err != nil { + return nil, err + } + return md.ReadModel(ctx, c, name, namespace) +} + +// ListModels is the resolver for the listModels field. +func (r *queryResolver) ListModels(ctx context.Context, input model.ListModelInput) (*model.PaginatedModel, error) { + token := auth.ForOIDCToken(ctx) + c, err := client.GetClient(token) + if err != nil { + return nil, err + } + name, displayName, labelSelector, fieldSelector := "", "", "", "" + page, pageSize := 1, 10 + if input.Name != nil { + name = *input.Name + } + if input.DisplayName != nil { + displayName = *input.DisplayName + } + if input.FieldSelector != nil { + fieldSelector = *input.FieldSelector + } + if input.LabelSelector != nil { + labelSelector = *input.LabelSelector + } + if input.Page != nil && *input.Page > 0 { + page = *input.Page + } + if input.PageSize != nil && *input.PageSize > 0 { + pageSize = *input.PageSize + } + result, err := md.ListModels(ctx, c, input.Namespace, labelSelector, fieldSelector) + if err != nil { + return nil, err + } + var filteredResult []*model.Model + for idx, u := range result { + if (name == "" || strings.Contains(u.Name, name)) && (displayName == "" || strings.Contains(u.DisplayName, displayName)) { + filteredResult = append(filteredResult, result[idx]) + } + } + + totalCount := len(filteredResult) + end := page * pageSize + if end > totalCount { + end = totalCount + } + return &model.PaginatedModel{ + TotalCount: totalCount, + HasNextPage: end < totalCount, + Nodes: filteredResult[(page-1)*pageSize : end], + }, nil +} diff --git a/graphql-server/go-server/graph/model/models_gen.go b/graphql-server/go-server/graph/model/models_gen.go index 993e05215..212b6a33b 100644 --- a/graphql-server/go-server/graph/model/models_gen.go +++ b/graphql-server/go-server/graph/model/models_gen.go @@ -17,6 +17,16 @@ type CreateDatasourceInput struct { Ossinput *OssInput `json:"ossinput,omitempty"` } +type CreateModelInput struct { + Name string `json:"name"` + Namespace string `json:"namespace"` + DisplayName string `json:"displayName"` + Field string `json:"field"` + Description *string `json:"description,omitempty"` + Modeltype string `json:"modeltype"` + UpdateTimestamp *time.Time `json:"updateTimestamp,omitempty"` +} + type Datasource struct { Name string `json:"name"` Namespace string `json:"namespace"` @@ -38,6 +48,13 @@ type DeleteDatasourceInput struct { FieldSelector *string `json:"fieldSelector,omitempty"` } +type DeleteModelInput struct { + Name *string `json:"name,omitempty"` + Namespace string `json:"namespace"` + LabelSelector *string `json:"labelSelector,omitempty"` + FieldSelector *string `json:"fieldSelector,omitempty"` +} + type Endpoint struct { URL *string `json:"url,omitempty"` AuthSecret *TypedObjectReference `json:"authSecret,omitempty"` @@ -61,6 +78,30 @@ type ListDatasourceInput struct { Keyword *string `json:"keyword,omitempty"` } +type ListModelInput struct { + Name *string `json:"name,omitempty"` + Namespace string `json:"namespace"` + DisplayName *string `json:"displayName,omitempty"` + LabelSelector *string `json:"labelSelector,omitempty"` + FieldSelector *string `json:"fieldSelector,omitempty"` + Page *int `json:"page,omitempty"` + PageSize *int `json:"pageSize,omitempty"` + Keyword *string `json:"keyword,omitempty"` +} + +type Model struct { + Name string `json:"name"` + Namespace string `json:"namespace"` + Labels map[string]interface{} `json:"labels,omitempty"` + Annotations map[string]interface{} `json:"annotations,omitempty"` + Creator *string `json:"creator,omitempty"` + DisplayName string `json:"displayName"` + Description *string `json:"description,omitempty"` + Field string `json:"field"` + Modeltype string `json:"modeltype"` + UpdateTimestamp *time.Time `json:"updateTimestamp,omitempty"` +} + type Oss struct { Bucket *string `json:"bucket,omitempty"` Object *string `json:"Object,omitempty"` @@ -79,6 +120,14 @@ type PaginatedDatasource struct { TotalCount int `json:"totalCount"` } +type PaginatedModel struct { + HasNextPage bool `json:"hasNextPage"` + Nodes []*Model `json:"nodes,omitempty"` + Page *int `json:"page,omitempty"` + PageSize *int `json:"pageSize,omitempty"` + TotalCount int `json:"totalCount"` +} + type TypedObjectReference struct { APIGroup *string `json:"apiGroup,omitempty"` Kind string `json:"kind"` @@ -101,3 +150,12 @@ type UpdateDatasourceInput struct { DisplayName string `json:"displayName"` Description *string `json:"description,omitempty"` } + +type UpdateModelInput struct { + Name string `json:"name"` + Namespace string `json:"namespace"` + Labels map[string]interface{} `json:"labels,omitempty"` + Annotations map[string]interface{} `json:"annotations,omitempty"` + DisplayName string `json:"displayName"` + Description *string `json:"description,omitempty"` +} diff --git a/graphql-server/go-server/pkg/model/model.go b/graphql-server/go-server/pkg/model/model.go new file mode 100644 index 000000000..0f5a71cdf --- /dev/null +++ b/graphql-server/go-server/pkg/model/model.go @@ -0,0 +1,158 @@ +/* +Copyright 2023 KubeAGI. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package model + +import ( + "context" + "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/client-go/dynamic" + + "github.com/kubeagi/arcadia/api/v1alpha1" + "github.com/kubeagi/arcadia/graphql-server/go-server/graph/model" +) + +func obj2model(obj *unstructured.Unstructured) *model.Model { + labels := make(map[string]interface{}) + for k, v := range obj.GetLabels() { + labels[k] = v + } + annotations := make(map[string]interface{}) + for k, v := range obj.GetAnnotations() { + annotations[k] = v + } + displayName, _, _ := unstructured.NestedString(obj.Object, "spec", "displayName") + field, _, _ := unstructured.NestedString(obj.Object, "spec", "field") + modeltype, _, _ := unstructured.NestedString(obj.Object, "spec", "type") + description, _, _ := unstructured.NestedString(obj.Object, "spec", "description") + updateTime := metav1.Now().Time + conditions, found, _ := unstructured.NestedSlice(obj.Object, "status", "conditions") + if found && len(conditions) > 0 { + condition, ok := conditions[0].(map[string]interface{}) + if ok { + timeStr, _ := condition["lastTransitionTime"].(string) + updateTime, _ = time.Parse(time.RFC3339, timeStr) + } + } + md := model.Model{ + Name: obj.GetName(), + Namespace: obj.GetNamespace(), + Labels: labels, + Annotations: annotations, + DisplayName: displayName, + Description: &description, + Field: field, + Modeltype: modeltype, + UpdateTimestamp: &updateTime, + } + return &md +} + +func CreateModel(ctx context.Context, c dynamic.Interface, name, namespace, displayName, description, field, modeltype string) (*model.Model, error) { + model := v1alpha1.Model{ + ObjectMeta: metav1.ObjectMeta{ + Name: name, + Namespace: namespace, + }, + TypeMeta: metav1.TypeMeta{ + Kind: "Model", + APIVersion: v1alpha1.GroupVersion.String(), + }, + Spec: v1alpha1.ModelSpec{ + DiplayName: displayName, + Description: description, + Field: field, + Type: v1alpha1.ModelType(modeltype), + }, + } + unstructuredModel, err := runtime.DefaultUnstructuredConverter.ToUnstructured(&model) + if err != nil { + return nil, err + } + obj, err := c.Resource(schema.GroupVersionResource{Group: v1alpha1.GroupVersion.Group, Version: v1alpha1.GroupVersion.Version, Resource: "models"}). + Namespace(namespace).Create(ctx, &unstructured.Unstructured{Object: unstructuredModel}, metav1.CreateOptions{}) + if err != nil { + return nil, err + } + md := obj2model(obj) + return md, nil +} + +func UpdateModel(ctx context.Context, c dynamic.Interface, name, namespace, displayname string) (*model.Model, error) { + resource := c.Resource(schema.GroupVersionResource{Group: v1alpha1.GroupVersion.Group, Version: v1alpha1.GroupVersion.Version, Resource: "models"}) + obj, err := resource.Namespace(namespace).Get(ctx, name, metav1.GetOptions{}) + if err != nil { + return nil, err + } + + obj.Object["spec"].(map[string]interface{})["displayName"] = displayname + updatedObject, err := resource.Namespace(namespace).Update(ctx, obj, metav1.UpdateOptions{}) + if err != nil { + return nil, err + } + md := obj2model(updatedObject) + return md, nil +} + +func DeleteModel(ctx context.Context, c dynamic.Interface, name, namespace, labelSelector, fieldSelector string) (*string, error) { + resource := c.Resource(schema.GroupVersionResource{Group: v1alpha1.GroupVersion.Group, Version: v1alpha1.GroupVersion.Version, Resource: "models"}) + if name != "" { + err := resource.Namespace(namespace).Delete(ctx, name, metav1.DeleteOptions{}) + if err != nil { + return nil, err + } + } else { + err := resource.Namespace(namespace).DeleteCollection(ctx, metav1.DeleteOptions{}, metav1.ListOptions{ + LabelSelector: labelSelector, + FieldSelector: fieldSelector, + }) + if err != nil { + return nil, err + } + } + return nil, nil +} + +func ListModels(ctx context.Context, c dynamic.Interface, namespace, labelSelector, fieldSelector string) ([]*model.Model, error) { + dsSchema := schema.GroupVersionResource{Group: v1alpha1.GroupVersion.Group, Version: v1alpha1.GroupVersion.Version, Resource: "models"} + listOptions := metav1.ListOptions{ + LabelSelector: labelSelector, + FieldSelector: fieldSelector, + } + us, err := c.Resource(dsSchema).Namespace(namespace).List(ctx, listOptions) + if err != nil { + return nil, err + } + result := make([]*model.Model, len(us.Items)) + for idx, u := range us.Items { + result[idx] = obj2model(&u) + } + return result, nil +} + +func ReadModel(ctx context.Context, c dynamic.Interface, name, namespace string) (*model.Model, error) { + resource := c.Resource(schema.GroupVersionResource{Group: v1alpha1.GroupVersion.Group, Version: v1alpha1.GroupVersion.Version, Resource: "models"}) + u, err := resource.Namespace(namespace).Get(ctx, name, metav1.GetOptions{}) + if err != nil { + return nil, err + } + return obj2model(u), nil +}