diff --git a/.openapi-generator-ignore b/.openapi-generator-ignore new file mode 100644 index 000000000..40209379f --- /dev/null +++ b/.openapi-generator-ignore @@ -0,0 +1,47 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md + +# model and client files +internal/model/openapi/api +internal/model/openapi/api/** +internal/model/openapi/git_push.sh +internal/model/openapi/.gitignore +internal/model/openapi/.travis.yml +internal/model/openapi/.openapi-generator-ignore + +internal/model/openapi/README.md +internal/model/openapi/docs/**.md +internal/model/openapi/test +internal/model/openapi/test/** +internal/model/openapi/**all_of.go +internal/model/openapi/go.mod +internal/model/openapi/go.sum + +# server files to ignore +internal/server/openapi/api +internal/server/openapi/api/** +internal/server/openapi/.openapi-generator-ignore +internal/server/openapi/README.md +internal/server/openapi/main.go +internal/server/openapi/model_*.go diff --git a/Dockerfile b/Dockerfile index 234dc71bb..d18777c15 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,9 +8,12 @@ COPY ["go.mod", "go.sum", "./"] # and so that source changes don't invalidate our downloaded layer RUN go mod download -# Copy the go source USER root -COPY ["Makefile", "main.go", "gqlgen.yml", "./"] +# install npm and java for openapi-generator-cli +RUN yum install -y nodejs npm java-11 + +# Copy the go source +COPY ["Makefile", "main.go", "gqlgen.yml", ".openapi-generator-ignore", "openapitools.json", "./"] # Download protoc compiler v24.3 RUN wget -q https://github.com/protocolbuffers/protobuf/releases/download/v24.3/protoc-24.3-linux-x86_64.zip -O protoc.zip && \ diff --git a/Makefile b/Makefile index 02f5e507a..789e60db8 100644 --- a/Makefile +++ b/Makefile @@ -26,13 +26,38 @@ gen/graph: internal/model/graph/models_gen.go internal/model/graph/models_gen.go: api/graphql/*.graphqls gqlgen.yml gqlgen generate +# validate the openapi schema +.PHONY: openapi/validate +openapi/validate: bin/openapi-generator-cli + openapi-generator-cli validate -i api/openapi/model-registry.yaml + +# generate the openapi server implementation +# note: run manually only when model-registry.yaml api changes, for model changes gen/openapi is run automatically +.PHONY: gen/openapi-server +gen/openapi-server: bin/openapi-generator-cli openapi/validate + openapi-generator-cli generate \ + -i api/openapi/model-registry.yaml -g go-server -o internal/server/openapi --package-name openapi \ + --ignore-file-override ./.openapi-generator-ignore --additional-properties=outputAsLibrary=true,enumClassPrefix=true,router=chi,sourceFolder=,onlyInterfaces=true + gofmt -w internal/server/openapi + +# generate the openapi schema model and client +.PHONY: gen/openapi +gen/openapi: bin/openapi-generator-cli openapi/validate internal/model/openapi/client.go + +internal/model/openapi/client.go: api/openapi/model-registry.yaml + rm -rf internal/model/openapi + openapi-generator-cli generate \ + -i api/openapi/model-registry.yaml -g go -o internal/model/openapi --package-name openapi \ + --ignore-file-override ./.openapi-generator-ignore --additional-properties=isGoSubmodule=true,enumClassPrefix=true,useOneOfDiscriminatorLookup=true + gofmt -w internal/model/openapi + .PHONY: vet vet: go vet ./... .PHONY: clean clean: - rm -Rf ./model-registry internal/ml_metadata/proto/*.go internal/model/graph/models_gen.go internal/converter/generated/converter.go + rm -Rf ./model-registry internal/ml_metadata/proto/*.go internal/model/graph/models_gen.go internal/converter/generated/converter.go internal/model/openapi bin/go-enum: GOBIN=$(PROJECT_BIN) go install github.com/searKing/golang/tools/go-enum@v1.2.97 @@ -52,8 +77,26 @@ bin/golangci-lint: bin/goverter: GOBIN=$(PROJECT_PATH)/bin go install github.com/jmattheis/goverter/cmd/goverter@v0.18.0 +OPENAPI_GENERATOR ?= ${PROJECT_BIN}/openapi-generator-cli +NPM ?= "$(shell which npm)" +bin/openapi-generator-cli: +ifeq (, $(shell which ${NPM} 2> /dev/null)) + @echo "npm is not available please install it to be able to install openapi-generator" + exit 1 +endif +ifeq (, $(shell which ${PROJECT_BIN}/openapi-generator-cli 2> /dev/null)) + @{ \ + set -e ;\ + mkdir -p ${PROJECT_BIN} ;\ + mkdir -p ${PROJECT_BIN}/openapi-generator-installation ;\ + cd ${PROJECT_BIN} ;\ + ${NPM} install -g --prefix ${PROJECT_BIN}/openapi-generator-installation @openapitools/openapi-generator-cli ;\ + ln -s openapi-generator-installation/bin/openapi-generator-cli openapi-generator-cli ;\ + } +endif + .PHONY: deps -deps: bin/go-enum bin/protoc-gen-go bin/protoc-gen-go-grpc bin/gqlgen bin/golangci-lint bin/goverter +deps: bin/go-enum bin/protoc-gen-go bin/protoc-gen-go-grpc bin/gqlgen bin/golangci-lint bin/goverter bin/openapi-generator-cli .PHONY: vendor vendor: @@ -64,7 +107,7 @@ build: gen vet lint go build .PHONY: gen -gen: deps gen/grpc gen/graph gen/converter +gen: deps gen/grpc gen/openapi gen/graph gen/converter go generate ./... .PHONY: lint @@ -86,6 +129,10 @@ metadata.sqlite.db: run/migrate run/server: gen metadata.sqlite.db go run main.go serve --logtostderr=true +.PHONY: run/proxy +run/proxy: gen + go run main.go proxy --logtostderr=true + .PHONY: run/client run/client: gen python test/python/test_mlmetadata.py diff --git a/README.md b/README.md index fb32a5bab..d35bd4b25 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,8 @@ It adds other features on top of the functionality offered by the gRPC interface ## Pre-requisites: - go >= 1.19 - protoc v24.3 - [Protocol Buffers v24.3 Release](https://github.com/protocolbuffers/protobuf/releases/tag/v24.3) +- npm >= 10.2.0 - [Installing Node.js and npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) +- Java >= 11.0 - python 3.9 ## Building Run the following command to build the server binary: @@ -17,6 +19,13 @@ The generated binary uses spf13 cmdline args. More information on using the serv ``` ./model-registry --help ``` +## OpenAPI Proxy Server +### Starting the OpenAPI Proxy Server +Run the following command to start the OpenAPI proxy server: +``` +make run/proxy & +``` +The proxy service implements the OpenAPI defined in [model-registry.yaml](api/openapi/model-registry.yaml) to create an Open Data Hub specific REST API that stores metadata in an ml-metadata CPP server. ## Server ### Creating/Migrating Server DB The server uses a local SQLite DB file (`metadata.sqlite.db` by default), which can be configured using the `-d` cmdline option. diff --git a/api/openapi/model-registry.yaml b/api/openapi/model-registry.yaml new file mode 100644 index 000000000..a051b89cf --- /dev/null +++ b/api/openapi/model-registry.yaml @@ -0,0 +1,1717 @@ +openapi: 3.0.3 +info: + title: Model Registry REST API + version: 1.0.0 + description: REST API for Model Registry to create and manage ML model metadata + license: + name: Apache 2.0 + url: 'https://www.apache.org/licenses/LICENSE-2.0' +servers: + - + url: 'https://localhost:8080' +paths: + /api/model_registry/v1alpha1/model_artifact: + summary: Path used to search for a modelartifact. + description: >- + The REST endpoint/path used to search for a `ModelArtifact` entity. This path contains a `GET` + operation to perform the find task. + get: + tags: + - ModelRegistryService + responses: + '200': + $ref: '#/components/responses/ModelArtifactResponse' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/InternalServerError' + operationId: findModelArtifact + summary: Get a ModelArtifact that matches search parameters. + description: Gets the details of a single instance of a `ModelArtifact` that matches search parameters. + parameters: + - + $ref: '#/components/parameters/name' + - + $ref: '#/components/parameters/externalID' + /api/model_registry/v1alpha1/model_artifacts: + summary: Path used to manage the list of modelartifacts. + description: >- + The REST endpoint/path used to list and create zero or more `ModelArtifact` entities. This path + contains a `GET` and `POST` operation to perform the list and create tasks, respectively. + get: + tags: + - ModelRegistryService + parameters: + - + $ref: '#/components/parameters/pageSize' + - + $ref: '#/components/parameters/orderBy' + - + $ref: '#/components/parameters/sortOrder' + - + $ref: '#/components/parameters/nextPageToken' + responses: + '200': + $ref: '#/components/responses/ModelArtifactListResponse' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/InternalServerError' + operationId: getModelArtifacts + summary: List All ModelArtifacts + description: Gets a list of all `ModelArtifact` entities. + post: + requestBody: + description: A new `ModelArtifact` to be created. + content: + application/json: + schema: + $ref: '#/components/schemas/ModelArtifactCreate' + required: true + tags: + - ModelRegistryService + responses: + '201': + $ref: '#/components/responses/ModelArtifactResponse' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '500': + $ref: '#/components/responses/InternalServerError' + operationId: createModelArtifact + summary: Create a ModelArtifact + description: Creates a new instance of a `ModelArtifact`. + '/api/model_registry/v1alpha1/model_artifacts/{modelartifactId}': + summary: Path used to manage a single ModelArtifact. + description: >- + The REST endpoint/path used to get, update, and delete single instances of an `ModelArtifact`. + This path contains `GET`, `PUT`, and `DELETE` operations used to perform the get, update, and + delete tasks, respectively. + get: + tags: + - ModelRegistryService + responses: + '200': + $ref: '#/components/responses/ModelArtifactResponse' + '401': + $ref: '#/components/responses/Unauthorized' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/InternalServerError' + operationId: getModelArtifact + summary: Get a ModelArtifact + description: Gets the details of a single instance of a `ModelArtifact`. + patch: + requestBody: + description: Updated `ModelArtifact` information. + content: + application/json: + schema: + $ref: '#/components/schemas/ModelArtifactUpdate' + required: true + tags: + - ModelRegistryService + responses: + '200': + $ref: '#/components/responses/ModelArtifactResponse' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/InternalServerError' + operationId: updateModelArtifact + summary: Update a ModelArtifact + description: Updates an existing `ModelArtifact`. + parameters: + - + name: modelartifactId + description: A unique identifier for a `ModelArtifact`. + schema: + type: string + in: path + required: true + /api/model_registry/v1alpha1/model_versions: + summary: Path used to manage the list of modelversions. + description: >- + The REST endpoint/path used to list and create zero or more `ModelVersion` entities. This path + contains a `GET` and `POST` operation to perform the list and create tasks, respectively. + get: + tags: + - ModelRegistryService + parameters: + - + $ref: '#/components/parameters/pageSize' + - + $ref: '#/components/parameters/orderBy' + - + $ref: '#/components/parameters/sortOrder' + - + $ref: '#/components/parameters/nextPageToken' + responses: + '200': + $ref: '#/components/responses/ModelVersionListResponse' + '401': + $ref: '#/components/responses/Unauthorized' + '500': + $ref: '#/components/responses/InternalServerError' + operationId: getModelVersions + summary: List All ModelVersions + description: Gets a list of all `ModelVersion` entities. + post: + requestBody: + description: A new `ModelVersion` to be created. + content: + application/json: + schema: + $ref: '#/components/schemas/ModelVersionCreate' + required: true + tags: + - ModelRegistryService + responses: + '201': + $ref: '#/components/responses/ModelVersionResponse' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '500': + $ref: '#/components/responses/InternalServerError' + operationId: createModelVersion + summary: Create a ModelVersion + description: Creates a new instance of a `ModelVersion`. + '/api/model_registry/v1alpha1/model_versions/{modelversionId}': + summary: Path used to manage a single ModelVersion. + description: >- + The REST endpoint/path used to get, update, and delete single instances of an `ModelVersion`. + This path contains `GET`, `PUT`, and `DELETE` operations used to perform the get, update, and + delete tasks, respectively. + get: + tags: + - ModelRegistryService + responses: + '200': + $ref: '#/components/responses/ModelVersionResponse' + '401': + $ref: '#/components/responses/Unauthorized' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/InternalServerError' + operationId: getModelVersion + summary: Get a ModelVersion + description: Gets the details of a single instance of a `ModelVersion`. + patch: + requestBody: + description: Updated `ModelVersion` information. + content: + application/json: + schema: + $ref: '#/components/schemas/ModelVersion' + required: true + tags: + - ModelRegistryService + responses: + '200': + $ref: '#/components/responses/ModelVersionResponse' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/InternalServerError' + operationId: updateModelVersion + summary: Update a ModelVersion + description: Updates an existing `ModelVersion`. + parameters: + - + name: modelversionId + description: A unique identifier for a `ModelVersion`. + schema: + type: string + in: path + required: true + /api/model_registry/v1alpha1/registered_model: + summary: Path used to search for a registeredmodel. + description: >- + The REST endpoint/path used to search for a `RegisteredModel` entity. This path contains a `GET` + operation to perform the find task. + get: + tags: + - ModelRegistryService + responses: + '200': + $ref: '#/components/responses/RegisteredModelResponse' + '401': + $ref: '#/components/responses/Unauthorized' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/InternalServerError' + operationId: findRegisteredModel + summary: Get a RegisteredModel that matches search parameters. + description: Gets the details of a single instance of a `RegisteredModel` that matches search parameters. + parameters: + - + $ref: '#/components/parameters/name' + - + $ref: '#/components/parameters/externalID' + /api/model_registry/v1alpha1/registered_models: + summary: Path used to manage the list of registeredmodels. + description: >- + The REST endpoint/path used to list and create zero or more `RegisteredModel` entities. This path + contains a `GET` and `POST` operation to perform the list and create tasks, respectively. + get: + tags: + - ModelRegistryService + parameters: + - + $ref: '#/components/parameters/pageSize' + - + $ref: '#/components/parameters/orderBy' + - + $ref: '#/components/parameters/sortOrder' + - + $ref: '#/components/parameters/nextPageToken' + responses: + '200': + $ref: '#/components/responses/RegisteredModelListResponse' + '401': + $ref: '#/components/responses/Unauthorized' + '500': + $ref: '#/components/responses/InternalServerError' + operationId: getRegisteredModels + summary: List All RegisteredModels + description: Gets a list of all `RegisteredModel` entities. + post: + requestBody: + description: A new `RegisteredModel` to be created. + content: + application/json: + schema: + $ref: '#/components/schemas/RegisteredModelCreate' + required: true + tags: + - ModelRegistryService + responses: + '201': + $ref: '#/components/responses/RegisteredModelResponse' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '500': + $ref: '#/components/responses/InternalServerError' + operationId: createRegisteredModel + summary: Create a RegisteredModel + description: Creates a new instance of a `RegisteredModel`. + '/api/model_registry/v1alpha1/registered_models/{registeredmodelId}': + summary: Path used to manage a single RegisteredModel. + description: >- + The REST endpoint/path used to get, update, and delete single instances of an `RegisteredModel`. + This path contains `GET`, `PUT`, and `DELETE` operations used to perform the get, update, and + delete tasks, respectively. + get: + tags: + - ModelRegistryService + responses: + '200': + $ref: '#/components/responses/RegisteredModelResponse' + '401': + $ref: '#/components/responses/Unauthorized' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/InternalServerError' + operationId: getRegisteredModel + summary: Get a RegisteredModel + description: Gets the details of a single instance of a `RegisteredModel`. + patch: + requestBody: + description: Updated `RegisteredModel` information. + content: + application/json: + schema: + $ref: '#/components/schemas/RegisteredModelUpdate' + required: true + tags: + - ModelRegistryService + responses: + '200': + $ref: '#/components/responses/RegisteredModelResponse' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/InternalServerError' + operationId: updateRegisteredModel + summary: Update a RegisteredModel + description: Updates an existing `RegisteredModel`. + parameters: + - + name: registeredmodelId + description: A unique identifier for a `RegisteredModel`. + schema: + type: string + in: path + required: true + /api/model_registry/v1alpha1/model_version: + summary: Path used to search for a modelversion. + description: >- + The REST endpoint/path used to search for a `ModelVersion` entity. This path contains a `GET` + operation to perform the find task. + get: + tags: + - ModelRegistryService + responses: + '200': + $ref: '#/components/responses/ModelVersionResponse' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/InternalServerError' + operationId: findModelVersion + summary: Get a ModelVersion that matches search parameters. + description: Gets the details of a single instance of a `ModelVersion` that matches search parameters. + parameters: + - + $ref: '#/components/parameters/name' + - + $ref: '#/components/parameters/externalID' + '/api/model_registry/v1alpha1/model_versions/{modelversionId}/artifacts': + summary: Path used to manage the list of artifacts for a modelversion. + description: >- + The REST endpoint/path used to list and create zero or more `Artifact` entities for a + `ModelVersion`. This path contains a `GET` and `POST` operation to perform the list and create + tasks, respectively. + get: + tags: + - ModelRegistryService + parameters: + - + $ref: '#/components/parameters/name' + - + $ref: '#/components/parameters/externalID' + - + $ref: '#/components/parameters/pageSize' + - + $ref: '#/components/parameters/orderBy' + - + $ref: '#/components/parameters/sortOrder' + - + $ref: '#/components/parameters/nextPageToken' + responses: + '200': + $ref: '#/components/responses/ArtifactListResponse' + '401': + $ref: '#/components/responses/Unauthorized' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/InternalServerError' + operationId: getModelVersionArtifacts + summary: List All ModelVersion's artifacts + description: Gets a list of all `Artifact` entities for the `ModelVersion`. + post: + requestBody: + description: A new or existing `Artifact` to be associated with the `ModelVersion`. + content: + application/json: + schema: + $ref: '#/components/schemas/Artifact' + required: true + tags: + - ModelRegistryService + responses: + '200': + $ref: '#/components/responses/ArtifactResponse' + '201': + $ref: '#/components/responses/ArtifactResponse' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/InternalServerError' + operationId: createModelVersionArtifact + summary: Create an Artifact in a ModelVersion + description: Creates a new instance of an Artifact if needed and associates it with `ModelVersion`. + parameters: + - + name: modelversionId + description: A unique identifier for a `ModelVersion`. + schema: + type: string + in: path + required: true + '/api/model_registry/v1alpha1/registered_models/{registeredmodelId}/versions': + summary: Path used to manage the list of modelversions for a registeredmodel. + description: >- + The REST endpoint/path used to list and create zero or more `ModelVersion` entities for a + `RegisteredModel`. This path contains a `GET` and `POST` operation to perform the list and create + tasks, respectively. + get: + tags: + - ModelRegistryService + parameters: + - + $ref: '#/components/parameters/name' + - + $ref: '#/components/parameters/externalID' + - + $ref: '#/components/parameters/pageSize' + - + $ref: '#/components/parameters/orderBy' + - + $ref: '#/components/parameters/sortOrder' + - + $ref: '#/components/parameters/nextPageToken' + responses: + '200': + $ref: '#/components/responses/ModelVersionListResponse' + '401': + $ref: '#/components/responses/Unauthorized' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/InternalServerError' + operationId: getRegisteredModelVersions + summary: List All RegisteredModel's ModelVersions + description: Gets a list of all `ModelVersion` entities for the `RegisteredModel`. + post: + requestBody: + description: A new `ModelVersion` to be created. + content: + application/json: + schema: + $ref: '#/components/schemas/ModelVersion' + required: true + tags: + - ModelRegistryService + responses: + '201': + $ref: '#/components/responses/ModelVersionResponse' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/InternalServerError' + operationId: createRegisteredModelVersion + summary: Create a ModelVersion in RegisteredModel + description: Creates a new instance of a `ModelVersion`. + parameters: + - + name: registeredmodelId + description: A unique identifier for a `RegisteredModel`. + schema: + type: string + in: path + required: true + /api/model_registry/v1alpha1/inference_service: + summary: Path used to manage an instance of inferenceservice. + description: >- + The REST endpoint/path used to list and create zero or more `InferenceService` entities. This + path contains a `GET` and `POST` operation to perform the list and create tasks, respectively. + get: + tags: + - ModelRegistryService + responses: + '200': + $ref: '#/components/responses/InferenceServiceResponse' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/InternalServerError' + operationId: findInferenceService + summary: Get an InferenceServices that matches search parameters. + description: Gets the details of a single instance of `InferenceService` that matches search parameters. + parameters: + - + $ref: '#/components/parameters/name' + - + $ref: '#/components/parameters/externalID' + '/api/model_registry/v1alpha1/inference_services/{inferenceserviceId}': + summary: Path used to manage a single InferenceService. + description: >- + The REST endpoint/path used to get, update, and delete single instances of an `InferenceService`. + This path contains `GET`, `PUT`, and `DELETE` operations used to perform the get, update, and + delete tasks, respectively. + get: + tags: + - ModelRegistryService + responses: + '200': + $ref: '#/components/responses/InferenceServiceResponse' + '401': + $ref: '#/components/responses/Unauthorized' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/InternalServerError' + operationId: getInferenceService + summary: Get a InferenceService + description: Gets the details of a single instance of a `InferenceService`. + patch: + requestBody: + description: Updated `InferenceService` information. + content: + application/json: + schema: + $ref: '#/components/schemas/InferenceServiceUpdate' + required: true + tags: + - ModelRegistryService + responses: + '200': + $ref: '#/components/responses/InferenceServiceResponse' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/InternalServerError' + operationId: updateInferenceService + summary: Update a InferenceService + description: Updates an existing `InferenceService`. + parameters: + - + name: inferenceserviceId + description: A unique identifier for a `InferenceService`. + schema: + type: string + in: path + required: true + /api/model_registry/v1alpha1/inference_services: + summary: Path used to manage the list of inferenceservices. + description: >- + The REST endpoint/path used to list and create zero or more `InferenceService` entities. This + path contains a `GET` and `POST` operation to perform the list and create tasks, respectively. + get: + tags: + - ModelRegistryService + parameters: + - + $ref: '#/components/parameters/pageSize' + - + $ref: '#/components/parameters/orderBy' + - + $ref: '#/components/parameters/sortOrder' + - + $ref: '#/components/parameters/nextPageToken' + responses: + '200': + $ref: '#/components/responses/InferenceServiceListResponse' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/InternalServerError' + operationId: getInferenceServices + summary: List All InferenceServices + description: Gets a list of all `InferenceService` entities. + post: + requestBody: + description: A new `InferenceService` to be created. + content: + application/json: + schema: + $ref: '#/components/schemas/InferenceServiceCreate' + required: true + tags: + - ModelRegistryService + responses: + '200': + $ref: '#/components/responses/InferenceServiceResponse' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '500': + $ref: '#/components/responses/InternalServerError' + operationId: createInferenceService + summary: Create a InferenceService + description: Creates a new instance of a `InferenceService`. + /api/model_registry/v1alpha1/serving_environment: + summary: Path used to find a servingenvironment. + description: >- + The REST endpoint/path used to search for a `ServingEnvironment` entity. This path contains a + `GET` operation to perform the find task. + get: + tags: + - ModelRegistryService + responses: + '200': + $ref: '#/components/responses/ServingEnvironmentResponse' + '401': + $ref: '#/components/responses/Unauthorized' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/InternalServerError' + operationId: findServingEnvironment + summary: Find ServingEnvironment + description: Finds a `ServingEnvironment` entity that matches query parameters. + parameters: + - + $ref: '#/components/parameters/name' + - + $ref: '#/components/parameters/externalID' + /api/model_registry/v1alpha1/serving_environments: + summary: Path used to manage the list of servingenvironments. + description: >- + The REST endpoint/path used to list and create zero or more `ServingEnvironment` entities. This + path contains a `GET` and `POST` operation to perform the list and create tasks, respectively. + get: + tags: + - ModelRegistryService + parameters: + - + $ref: '#/components/parameters/pageSize' + - + $ref: '#/components/parameters/orderBy' + - + $ref: '#/components/parameters/sortOrder' + - + $ref: '#/components/parameters/nextPageToken' + responses: + '200': + $ref: '#/components/responses/ServingEnvironmentListResponse' + '401': + $ref: '#/components/responses/Unauthorized' + '500': + $ref: '#/components/responses/InternalServerError' + operationId: getServingEnvironments + summary: List All ServingEnvironments + description: Gets a list of all `ServingEnvironment` entities. + post: + requestBody: + description: A new `ServingEnvironment` to be created. + content: + application/json: + schema: + $ref: '#/components/schemas/ServingEnvironmentCreate' + required: true + tags: + - ModelRegistryService + responses: + '201': + $ref: '#/components/responses/ServingEnvironmentResponse' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '500': + $ref: '#/components/responses/InternalServerError' + operationId: createServingEnvironment + summary: Create a ServingEnvironment + description: Creates a new instance of a `ServingEnvironment`. + '/api/model_registry/v1alpha1/serving_environments/{servingenvironmentId}': + summary: Path used to manage a single ServingEnvironment. + description: >- + The REST endpoint/path used to get, update, and delete single instances of an + `ServingEnvironment`. This path contains `GET`, `PUT`, and `DELETE` operations used to perform + the get, update, and delete tasks, respectively. + get: + tags: + - ModelRegistryService + responses: + '200': + $ref: '#/components/responses/ServingEnvironmentResponse' + '401': + $ref: '#/components/responses/Unauthorized' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/InternalServerError' + operationId: getServingEnvironment + summary: Get a ServingEnvironment + description: Gets the details of a single instance of a `ServingEnvironment`. + patch: + requestBody: + description: Updated `ServingEnvironment` information. + content: + application/json: + schema: + $ref: '#/components/schemas/ServingEnvironmentUpdate' + required: true + tags: + - ModelRegistryService + responses: + '200': + $ref: '#/components/responses/ServingEnvironmentResponse' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/InternalServerError' + operationId: updateServingEnvironment + summary: Update a ServingEnvironment + description: Updates an existing `ServingEnvironment`. + parameters: + - + name: servingenvironmentId + description: A unique identifier for a `ServingEnvironment`. + schema: + type: string + in: path + required: true + '/api/model_registry/v1alpha1/serving_environments/{servingenvironmentId}/inference_services': + summary: Path used to manage the list of `InferenceServices` for a `ServingEnvironment`. + description: >- + The REST endpoint/path used to list and create zero or more `InferenceService` entities for a + `ServingEnvironment`. This path contains a `GET` and `POST` operation to perform the list and + create tasks, respectively. + get: + tags: + - ModelRegistryService + parameters: + - + $ref: '#/components/parameters/name' + - + $ref: '#/components/parameters/externalID' + - + $ref: '#/components/parameters/pageSize' + - + $ref: '#/components/parameters/orderBy' + - + $ref: '#/components/parameters/sortOrder' + - + $ref: '#/components/parameters/nextPageToken' + responses: + '200': + $ref: '#/components/responses/InferenceServiceListResponse' + '401': + $ref: '#/components/responses/Unauthorized' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/InternalServerError' + operationId: getEnvironmentInferenceServices + summary: List All ServingEnvironment's InferenceServices + description: Gets a list of all `InferenceService` entities for the `ServingEnvironment`. + post: + requestBody: + description: A new `InferenceService` to be created. + content: + application/json: + schema: + $ref: '#/components/schemas/InferenceServiceCreate' + required: true + tags: + - ModelRegistryService + responses: + '201': + $ref: '#/components/responses/InferenceServiceResponse' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/InternalServerError' + operationId: createEnvironmentInferenceService + summary: Create a InferenceService in ServingEnvironment + description: Creates a new instance of a `InferenceService`. + parameters: + - + name: servingenvironmentId + description: A unique identifier for a `ServingEnvironment`. + schema: + type: string + in: path + required: true + '/api/model_registry/v1alpha1/inference_services/{inferenceserviceId}/serves': + summary: Path used to manage the list of `ServeModels` for a `InferenceService`. + description: >- + The REST endpoint/path used to list and create zero or more `ServeModel` entities for a + `InferenceService`. This path contains a `GET` and `POST` operation to perform the list and + create tasks, respectively. + get: + tags: + - ModelRegistryService + parameters: + - + $ref: '#/components/parameters/name' + - + $ref: '#/components/parameters/externalID' + - + $ref: '#/components/parameters/pageSize' + - + $ref: '#/components/parameters/orderBy' + - + $ref: '#/components/parameters/sortOrder' + - + $ref: '#/components/parameters/nextPageToken' + responses: + '200': + $ref: '#/components/responses/ServeModelListResponse' + '401': + $ref: '#/components/responses/Unauthorized' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/InternalServerError' + operationId: getInferenceServiceServes + summary: List All InferenceService's ServeModel actions + description: Gets a list of all `ServeModel` entities for the `InferenceService`. + post: + requestBody: + description: A new `ServeModel` to be associated with the `InferenceService`. + content: + application/json: + schema: + $ref: '#/components/schemas/ServeModelCreate' + required: true + tags: + - ModelRegistryService + responses: + '201': + $ref: '#/components/responses/ServeModelResponse' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/InternalServerError' + operationId: createInferenceServiceServe + summary: Create a ServeModel action in a InferenceService + description: Creates a new instance of a `ServeModel` associated with `InferenceService`. + parameters: + - + name: inferenceserviceId + description: A unique identifier for a `InferenceService`. + schema: + type: string + in: path + required: true + '/api/model_registry/v1alpha1/inference_services/{inferenceserviceId}/model': + summary: Path used to manage a `RegisteredModel` associated with an `InferenceService`. + description: >- + The REST endpoint/path used to list the `RegisteredModel` entity for an `InferenceService`. This + path contains a `GET` operation to perform the get task. + get: + tags: + - ModelRegistryService + responses: + '200': + $ref: '#/components/responses/RegisteredModelResponse' + '401': + $ref: '#/components/responses/Unauthorized' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/InternalServerError' + operationId: getInferenceServiceModel + summary: Get InferenceService's RegisteredModel + description: Gets the `RegisteredModel` entity for the `InferenceService`. + parameters: + - + name: inferenceserviceId + description: A unique identifier for a `InferenceService`. + schema: + type: string + in: path + required: true + '/api/model_registry/v1alpha1/inference_services/{inferenceserviceId}/version': + summary: Path used to get the current `ModelVersion` associated with an `InferenceService`. + description: >- + The REST endpoint/path used to get the current `ModelVersion` entity for a `InferenceService`. + This path contains a `GET` operation to perform the get task. + get: + tags: + - ModelRegistryService + responses: + '200': + $ref: '#/components/responses/ModelVersionResponse' + '401': + $ref: '#/components/responses/Unauthorized' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/InternalServerError' + operationId: getInferenceServiceVersion + summary: Get InferenceService's ModelVersion + description: Gets the `ModelVersion` entity for the `InferenceService`. + parameters: + - + name: inferenceserviceId + description: A unique identifier for a `InferenceService`. + schema: + type: string + in: path + required: true +components: + schemas: + ArtifactState: + description: |4- + - PENDING: A state indicating that the artifact may exist. + - LIVE: A state indicating that the artifact should exist, unless something + external to the system deletes it. + - MARKED_FOR_DELETION: A state indicating that the artifact should be deleted. + - DELETED: A state indicating that the artifact has been deleted. + - ABANDONED: A state indicating that the artifact has been abandoned, which may be + due to a failed or cancelled execution. + - REFERENCE: A state indicating that the artifact is a reference artifact. At + execution start time, the orchestrator produces an output artifact for + each output key with state PENDING. However, for an intermediate + artifact, this first artifact's state will be REFERENCE. Intermediate + artifacts emitted during a component's execution will copy the REFERENCE + artifact's attributes. At the end of an execution, the artifact state + should remain REFERENCE instead of being changed to LIVE. + + See also: ml-metadata Artifact.State + default: UNKNOWN + enum: + - UNKNOWN + - PENDING + - LIVE + - MARKED_FOR_DELETION + - DELETED + - ABANDONED + - REFERENCE + type: string + ExecutionState: + description: |- + The state of the Execution. The state transitions are + NEW -> RUNNING -> COMPLETE | CACHED | FAILED | CANCELED + CACHED means the execution is skipped due to cached results. + CANCELED means the execution is skipped due to precondition not met. It is + different from CACHED in that a CANCELED execution will not have any event + associated with it. It is different from FAILED in that there is no + unexpected error happened and it is regarded as a normal state. + + See also: ml-metadata Execution.State + default: UNKNOWN + enum: + - UNKNOWN + - NEW + - RUNNING + - COMPLETE + - FAILED + - CACHED + - CANCELED + type: string + ModelArtifact: + description: An ML model artifact. + type: object + allOf: + - + $ref: '#/components/schemas/BaseArtifact' + - + $ref: '#/components/schemas/ModelArtifactCreate' + RegisteredModel: + description: A registered model in model registry. A registered model has ModelVersion children. + allOf: + - + $ref: '#/components/schemas/BaseResource' + - + type: object + - + $ref: '#/components/schemas/RegisteredModelCreate' + ModelVersionList: + description: List of ModelVersion entities. + type: object + allOf: + - + type: object + properties: + items: + description: Array of `ModelVersion` entities. + type: array + items: + $ref: '#/components/schemas/ModelVersion' + - + $ref: '#/components/schemas/BaseResourceList' + ModelArtifactList: + description: List of ModelArtifact entities. + type: object + allOf: + - + type: object + properties: + items: + description: Array of `ModelArtifact` entities. + type: array + items: + $ref: '#/components/schemas/ModelArtifact' + - + $ref: '#/components/schemas/BaseResourceList' + RegisteredModelCreate: + description: A registered model in model registry. A registered model has ModelVersion children. + allOf: + - + type: object + - + $ref: '#/components/schemas/BaseResourceCreate' + - + $ref: '#/components/schemas/RegisteredModelUpdate' + RegisteredModelUpdate: + description: A registered model in model registry. A registered model has ModelVersion children. + allOf: + - + $ref: '#/components/schemas/BaseResourceUpdate' + ModelVersion: + description: Represents a ModelVersion belonging to a RegisteredModel. + allOf: + - + $ref: '#/components/schemas/ModelVersionCreate' + - + $ref: '#/components/schemas/BaseResource' + ModelVersionCreate: + description: Represents a ModelVersion belonging to a RegisteredModel. + required: + - registeredModelID + allOf: + - + $ref: '#/components/schemas/BaseResourceCreate' + - + $ref: '#/components/schemas/ModelVersionUpdate' + properties: + registeredModelID: + description: ID of the `RegisteredModel` to which this version belongs. + type: string + ModelVersionUpdate: + description: Represents a ModelVersion belonging to a RegisteredModel. + allOf: + - + $ref: '#/components/schemas/BaseResourceUpdate' + BaseArtifactCreate: + allOf: + - + $ref: '#/components/schemas/BaseArtifactUpdate' + - + $ref: '#/components/schemas/BaseResourceCreate' + BaseArtifactUpdate: + allOf: + - + $ref: '#/components/schemas/BaseResourceUpdate' + - + type: object + properties: + uri: + description: |- + The uniform resource identifier of the physical artifact. + May be empty if there is no physical artifact. + type: string + state: + $ref: '#/components/schemas/ArtifactState' + BaseExecution: + allOf: + - + $ref: '#/components/schemas/BaseExecutionCreate' + - + type: object + - + $ref: '#/components/schemas/BaseResource' + BaseExecutionCreate: + allOf: + - + $ref: '#/components/schemas/BaseExecutionUpdate' + - + type: object + - + $ref: '#/components/schemas/BaseResourceCreate' + BaseExecutionUpdate: + type: object + allOf: + - + type: object + properties: + lastKnownState: + $ref: '#/components/schemas/ExecutionState' + - + $ref: '#/components/schemas/BaseResourceUpdate' + MetadataValue: + oneOf: + - + type: object + properties: + int_value: + format: int64 + type: string + - + type: object + properties: + double_value: + format: double + type: number + - + type: object + properties: + string_value: + type: string + - + type: object + properties: + struct_value: + description: Base64 encoded bytes for struct value + type: string + - + type: object + properties: + type: + description: url describing proto value + type: string + proto_value: + description: Base64 encoded bytes for proto value + type: string + - + type: object + properties: + bool_value: + type: boolean + description: A value in properties. + BaseResource: + allOf: + - + $ref: '#/components/schemas/BaseResourceCreate' + - + type: object + properties: + id: + format: int64 + description: Output only. The unique server generated id of the resource. + type: string + readOnly: true + createTimeSinceEpoch: + format: int64 + description: Output only. Create time of the resource in millisecond since epoch. + type: string + readOnly: true + lastUpdateTimeSinceEpoch: + format: int64 + description: |- + Output only. Last update time of the resource since epoch in millisecond + since epoch. + type: string + readOnly: true + BaseResourceCreate: + allOf: + - + $ref: '#/components/schemas/BaseResourceUpdate' + - + type: object + properties: + name: + description: |- + The client provided name of the artifact. This field is optional. If set, + it must be unique among all the artifacts of the same artifact type within + a database instance and cannot be changed once set. + type: string + BaseResourceUpdate: + type: object + properties: + customProperties: + description: User provided custom properties which are not defined by its type. + type: object + additionalProperties: + $ref: '#/components/schemas/MetadataValue' + externalID: + description: |- + The external id that come from the clients’ system. This field is optional. + If set, it must be unique among all resources within a database instance. + type: string + BaseResourceList: + required: + - nextPageToken + - pageSize + - size + type: object + properties: + nextPageToken: + description: Token to use to retrieve next page of results. + type: string + pageSize: + format: int32 + description: Maximum number of resources to return in the result. + type: integer + size: + format: int32 + description: Number of items in result list. + type: integer + ArtifactList: + description: A list of Artifact entities. + type: object + allOf: + - + type: object + properties: + items: + description: Array of `Artifact` entities. + type: array + items: + $ref: '#/components/schemas/Artifact' + - + $ref: '#/components/schemas/BaseResourceList' + ModelArtifactUpdate: + description: An ML model artifact. + allOf: + - + $ref: '#/components/schemas/BaseArtifactUpdate' + - + type: object + properties: + modelFormatName: + description: Name of the model format. + type: string + runtime: + description: Model runtime. + type: string + storageKey: + description: Storage secret name. + type: string + storagePath: + description: Path for model in storage provided by `storageKey`. + type: string + modelFormatVersion: + description: Version of the model format. + type: string + serviceAccountName: + description: Name of the service account with storage secret. + type: string + ModelArtifactCreate: + description: An ML model artifact. + type: object + allOf: + - + $ref: '#/components/schemas/BaseArtifactCreate' + - + $ref: '#/components/schemas/ModelArtifactUpdate' + Error: + description: Error code and message. + required: + - code + - message + type: object + properties: + code: + description: Error code + type: string + message: + description: Error message + type: string + SortOrder: + description: Supported sort direction for ordering result entities. + enum: + - ASC + - DESC + type: string + OrderByField: + description: Supported fields for ordering result entities. + enum: + - CREATE_TIME + - LAST_UPDATE_TIME + - ID + type: string + Artifact: + oneOf: + - + $ref: '#/components/schemas/ModelArtifact' + discriminator: + propertyName: artifactType + mapping: + model-artifact: '#/components/schemas/ModelArtifact' + description: A metadata Artifact Entity. + BaseArtifact: + allOf: + - + $ref: '#/components/schemas/BaseArtifactCreate' + - + $ref: '#/components/schemas/BaseResource' + - + required: + - artifactType + type: object + properties: + artifactType: + type: string + ServingEnvironmentList: + description: List of ServingEnvironments. + type: object + allOf: + - + type: object + properties: + items: + description: '' + type: array + items: + $ref: '#/components/schemas/ServingEnvironment' + readOnly: false + - + $ref: '#/components/schemas/BaseResourceList' + RegisteredModelList: + description: List of RegisteredModels. + type: object + allOf: + - + type: object + properties: + items: + description: '' + type: array + items: + $ref: '#/components/schemas/RegisteredModel' + readOnly: false + - + $ref: '#/components/schemas/BaseResourceList' + ServingEnvironment: + description: A Model Serving environment for serving `RegisteredModels`. + allOf: + - + $ref: '#/components/schemas/BaseResource' + - + type: object + - + $ref: '#/components/schemas/ServingEnvironmentCreate' + ServingEnvironmentUpdate: + description: A Model Serving environment for serving `RegisteredModels`. + allOf: + - + $ref: '#/components/schemas/BaseResourceUpdate' + ServingEnvironmentCreate: + description: A Model Serving environment for serving `RegisteredModels`. + allOf: + - + type: object + - + $ref: '#/components/schemas/BaseResourceCreate' + - + $ref: '#/components/schemas/ServingEnvironmentUpdate' + InferenceService: + description: >- + An `InferenceService` entity in a `ServingEnvironment` represents a deployed `ModelVersion` + from a `RegisteredModel` created by Model Serving. + allOf: + - + $ref: '#/components/schemas/BaseResource' + - + $ref: '#/components/schemas/InferenceServiceCreate' + InferenceServiceList: + description: List of InferenceServices. + type: object + allOf: + - + type: object + properties: + items: + description: '' + type: array + items: + $ref: '#/components/schemas/InferenceService' + readOnly: false + - + $ref: '#/components/schemas/BaseResourceList' + ServeModelList: + description: List of ServeModel entities. + type: object + allOf: + - + type: object + properties: + items: + description: Array of `ModelArtifact` entities. + type: array + items: + $ref: '#/components/schemas/ServeModel' + - + $ref: '#/components/schemas/BaseResourceList' + ServeModel: + description: An ML model serving action. + type: object + allOf: + - + $ref: '#/components/schemas/BaseExecution' + - + $ref: '#/components/schemas/ServeModelCreate' + ServeModelUpdate: + description: An ML model serving action. + allOf: + - + $ref: '#/components/schemas/BaseExecutionUpdate' + ServeModelCreate: + description: An ML model serving action. + allOf: + - + $ref: '#/components/schemas/BaseExecutionCreate' + - + $ref: '#/components/schemas/ServeModelUpdate' + - + required: + - modelVersionId + type: object + properties: + modelVersionId: + description: ID of the `ModelVersion` that was served in `InferenceService`. + type: string + InferenceServiceUpdate: + description: >- + An `InferenceService` entity in a `ServingEnvironment` represents a deployed `ModelVersion` + from a `RegisteredModel` created by Model Serving. + allOf: + - + $ref: '#/components/schemas/BaseResourceUpdate' + - + type: object + properties: + modelVersionId: + description: >- + ID of the `ModelVersion` to serve. If it's unspecified, then the latest + `ModelVersion` by creation order will be served. + type: string + InferenceServiceCreate: + description: >- + An `InferenceService` entity in a `ServingEnvironment` represents a deployed `ModelVersion` + from a `RegisteredModel` created by Model Serving. + allOf: + - + $ref: '#/components/schemas/BaseResourceCreate' + - + $ref: '#/components/schemas/InferenceServiceUpdate' + - + required: + - registeredModelId + - servingEnvironmentId + type: object + properties: + registeredModelId: + description: ID of the `RegisteredModel` to serve. + type: string + servingEnvironmentId: + description: ID of the parent `ServingEnvironment` for this `InferenceService` entity. + type: string + responses: + NotFound: + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: The specified resource was not found + BadRequest: + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Bad Request parameters + Unauthorized: + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Unauthorized + InternalServerError: + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Unexpected internal server error + ModelArtifactListResponse: + content: + application/json: + schema: + $ref: '#/components/schemas/ModelArtifactList' + description: A response containing a list of ModelArtifact entities. + ModelArtifactResponse: + content: + application/json: + schema: + $ref: '#/components/schemas/ModelArtifact' + description: A response containing a `ModelArtifact` entity. + ModelVersionListResponse: + content: + application/json: + schema: + $ref: '#/components/schemas/ModelVersionList' + description: A response containing a list of `ModelVersion` entities. + ModelVersionResponse: + content: + application/json: + schema: + $ref: '#/components/schemas/ModelVersion' + description: A response containing a `ModelVersion` entity. + RegisteredModelListResponse: + content: + application/json: + schema: + $ref: '#/components/schemas/RegisteredModelList' + description: A response containing a list of `RegisteredModel` entities. + RegisteredModelResponse: + content: + application/json: + schema: + $ref: '#/components/schemas/RegisteredModel' + description: A response containing a `RegisteredModel` entity. + ArtifactResponse: + content: + application/json: + schema: + $ref: '#/components/schemas/Artifact' + description: A response containing an `Artifact` entity. + ArtifactListResponse: + content: + application/json: + schema: + $ref: '#/components/schemas/ArtifactList' + description: A response containing a list of `Artifact` entities. + ServingEnvironmentListResponse: + content: + application/json: + schema: + $ref: '#/components/schemas/ServingEnvironmentList' + description: A response containing a list of `ServingEnvironment` entities. + ServingEnvironmentResponse: + content: + application/json: + schema: + $ref: '#/components/schemas/ServingEnvironment' + description: A response containing a `ServingEnvironment` entity. + InferenceServiceListResponse: + content: + application/json: + schema: + $ref: '#/components/schemas/InferenceServiceList' + description: A response containing a list of `InferenceService` entities. + InferenceServiceResponse: + content: + application/json: + schema: + $ref: '#/components/schemas/InferenceService' + description: A response containing a `InferenceService` entity. + ServeModelListResponse: + content: + application/json: + schema: + $ref: '#/components/schemas/ServeModelList' + description: A response containing a list of `ServeModel` entities. + ServeModelResponse: + content: + application/json: + schema: + $ref: '#/components/schemas/ServeModel' + description: A response containing a `ServeModel` entity. + parameters: + id: + name: id + description: The ID of resource. + schema: + type: string + in: path + required: true + name: + examples: + name: + value: entity-name + name: name + description: Name of entity to search. + schema: + type: string + in: query + required: false + externalID: + examples: + externalID: + value: '10' + name: externalID + description: External ID of entity to search. + schema: + type: string + in: query + required: false + pageSize: + examples: + pageSize: + value: '100' + name: pageSize + description: Number of entities in each page. + schema: + type: string + in: query + required: false + nextPageToken: + examples: + nextPageToken: + value: IkhlbGxvLCB3b3JsZC4i + name: nextPageToken + description: Token to use to retrieve next page of results. + schema: + type: string + in: query + required: false + orderBy: + style: form + explode: true + examples: + orderBy: + value: ID + name: orderBy + description: Specifies the order by criteria for listing entities. + schema: + $ref: '#/components/schemas/OrderByField' + in: query + required: false + sortOrder: + style: form + explode: true + examples: + sortOrder: + value: DESC + name: sortOrder + description: 'Specifies the sort order for listing entities, defaults to ASC.' + schema: + $ref: '#/components/schemas/SortOrder' + in: query + required: false + securitySchemes: + Bearer: + scheme: bearer + bearerFormat: JWT + type: http + description: Bearer JWT scheme +security: + - + Bearer: [] +tags: + - + name: ModelRegistryService + description: Model Registry Service REST API diff --git a/api/openapi/modelregistry.yml b/api/openapi/modelregistry.yml deleted file mode 100644 index 62f2e4ac8..000000000 --- a/api/openapi/modelregistry.yml +++ /dev/null @@ -1,369 +0,0 @@ -openapi: 3.0.2 -info: - title: Model Registry API - version: 1.0.0 - description: 'See also https://github.com/opendatahub-io/model-registry/issues/44#issue-1919724627' -paths: - /environments: - summary: Path used to manage the list of environments. - description: >- - The REST endpoint/path used to list and create zero or more `Environment` entities. This path - contains a `GET` and `POST` operation to perform the list and create tasks, respectively. - get: - responses: - '200': - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/Environment' - description: Successful response - returns an array of `Environment` entities. - operationId: getEnvironments - summary: List All Environments - description: Gets a list of all `Environment` entities. - post: - requestBody: - description: A new `Environment` to be created. - content: - application/json: - schema: - $ref: '#/components/schemas/Environment' - required: true - responses: - '201': - description: Successful response. - operationId: createEnvironment - summary: Create a Environment - description: Creates a new instance of a `Environment`. - delete: - parameters: - - - name: name - description: '' - schema: {} - in: query - responses: - '200': - description: Successfully deleted `Environment` having `name`. - summary: Delete an Environment - description: 'Placed here only to avoid subpaths, can be re-drawn.' - /search: - description: |- - TBD: We feel this might be redundant with `models/` and `models/{name}`. - We suggest instead to: - 1. avoid usage of Query param (that might "explode" as search grows) - 2. provide search criteria in the body - get: - responses: - '200': - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/RegisteredModel' - description: Get all `RegisteredModel`s matching the supplied criteria. - summary: Search models - parameters: - - - name: name - description: '' - schema: - type: string - in: query - - - name: id - description: '' - schema: - type: string - in: query - - - name: tag - description: '' - schema: - type: string - in: query - - - name: label - description: '' - schema: - type: string - in: query - /models: - get: - responses: - '200': - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/RegisteredModel' - description: List all - summary: List all Models - description: List all `RegisteredModel` and belonging `VersionedModel`(s). - post: - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/VersionedModel' - required: true - responses: - '200': - content: - application/json: - schema: - $ref: '#/components/schemas/VersionedModel' - description: Successfully created a `VersionedModel` for a Registered model. - summary: Assign a version to a registered model - description: |- - If a `RegisteredModel` for `model_name` already exists, this `VersionedModel` - will be assigned to it, else a new `RegisteredModel` will be created. - If a `model_name` is not provided, a random one will be used. - - The `id` is generated in the backend by the registry. - It could be implemented as a progressive number, to be decided. - The `id`s are unique within a RegisteredModel. - - The `version` is a user-provided symbolic name, for instance semantic versioning - The `version` if provided must be unique and non-already-existing within a - RegisterdModel and must not be the same as any of the `id`s. - '/models/{name}/versions/{version}': - get: - responses: - '200': - content: - application/json: - schema: - $ref: '#/components/schemas/VersionedModel' - description: get `VersionedModel` for model name and version - summary: Get Version details - delete: - responses: - '200': - description: Successfully archive a `VersionedModel`. - summary: Archive a VersionedModel - description: 'This does NOT delete any `VersionedModel`, but archives and deprecate it.' - patch: - requestBody: - description: 'The `uri`, `id`, `version` and other non-updatable fields will be ignored.' - content: - application/json: - schema: - $ref: '#/components/schemas/VersionedModel' - required: true - responses: - '200': - description: Successfully upated a `VersionedModel` in the updatable and provided fields. - description: |- - Updates a `VersionedModel` only for the updatable fields, such as label, tags, - description. - - Some fields will not be updated even if supplied, such as `model_uri`, `id`, - `version`. - parameters: - - - name: name - schema: - type: string - in: path - required: true - - - name: version - schema: - type: string - in: path - required: true - '/models/{name}': - get: - responses: - '200': - content: - application/json: - schema: - $ref: '#/components/schemas/RegisteredModel' - description: Retrieves the `RegisteredModel`. - summary: Return a given RegisteredModel - post: - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/VersionedModel' - responses: - '200': - description: Successfully registered a versionedmodel under a registered model. - summary: Register a VersionedModel under a given name - description: |- - TBD: this as a potential alternative or complementary of `/models` POST - where the model's name is provided as a Path param instead. - parameters: - - - name: name - schema: - type: string - in: path - required: true -components: - schemas: - Environment: - title: Root Type for Environment - description: '' - type: object - properties: - name: - type: string - uri: - type: string - example: - name: My Environment - uri: 'http://localhost:8080' - RegisteredModel: - title: Root Type for RegisteredModel - description: '' - type: object - properties: - name: - type: string - labels: - type: array - items: - type: string - versions: - type: array - items: - $ref: '#/components/schemas/VersionedModel' - example: - name: my ML pricing model - labels: - - tutorial - - linreg - versions: - - - model_name: my ML pricing model - id: ae123-78932-64893 - version: v1 - model_uri: 's3://89492-46893-54692' - tags: - - Staging - labels: - - tutorial - - linreg - environments: - - - name: My Environment - uri: 'http://localhost:8080' - created date: '20231002T12:34:56' - updated date: '20231002T12:34:56' - author: 'John Doe, data scientist' - origin: 'dsp://123' - metadata: - accuracy: 99 - artifacts: - - - name: dataset - type: csv - uri: 's3://67489-46393-63469' - metadata: - authority: US Census - VersionedModel: - title: Root Type for VersionedModel - description: '' - required: - - model_uri - type: object - properties: - id: - type: string - version: - type: string - tags: - type: array - items: - type: string - labels: - type: array - items: - type: string - environments: - type: array - items: - $ref: '#/components/schemas/Environment' - created date: - format: date-time - type: string - updated date: - format: date-time - type: string - model_name: - type: string - author: - description: '' - type: string - example: '"John Doe, data scientist"' - metadata: - description: '' - type: object - model_uri: - description: '' - type: string - artifacts: - description: '' - type: array - items: - $ref: '#/components/schemas/Artifact' - origin: - description: 'For instance, the DSP id which realized the model' - type: string - example: - model_name: my ML pricing model - id: ae123-78932-64893 - version: v1 - model_uri: 's3://89492-46893-54692' - tags: - - Staging - labels: - - tutorial - - linreg - environments: - - - name: My Environment - uri: 'http://localhost:8080' - created date: '20231002T12:34:56' - updated date: '20231002T12:34:56' - author: 'John Doe, data scientist' - origin: 'dsp://123' - metadata: - accuracy: 99 - artifacts: - - - name: dataset - type: csv - uri: 's3://67489-46393-63469' - metadata: - authority: US Census - Artifact: - title: Root Type for Artifact - description: '' - type: object - properties: - type: - type: string - uri: - type: string - metadata: - type: object - properties: - authority: - type: string - name: - description: '' - type: string - example: - name: dataset - type: csv - uri: 's3://67489-46393-63469' - metadata: - authority: US Census diff --git a/cmd/proxy.go b/cmd/proxy.go new file mode 100644 index 000000000..167ded09d --- /dev/null +++ b/cmd/proxy.go @@ -0,0 +1,50 @@ +package cmd + +import ( + "fmt" + "github.com/golang/glog" + "github.com/opendatahub-io/model-registry/internal/server/openapi" + "github.com/spf13/cobra" + "log" + "net/http" +) + +var ( + // proxyCmd represents the proxy command + proxyCmd = &cobra.Command{ + Use: "proxy", + Short: "Starts the ml-metadata go OpenAPI proxy", + Long: `This command launches the ml-metadata go OpenAPI proxy server. + +The server connects to a mlmd CPP server. It supports options to customize the +hostname and port where it listens.'`, + RunE: runProxyServer, + } +) + +func runProxyServer(cmd *cobra.Command, args []string) error { + glog.Infof("proxy server started at %s:%v", cfg.Hostname, cfg.Port) + + ModelRegistryServiceAPIService := openapi.NewModelRegistryServiceAPIService() + ModelRegistryServiceAPIController := openapi.NewModelRegistryServiceAPIController(ModelRegistryServiceAPIService) + + router := openapi.NewRouter(ModelRegistryServiceAPIController) + + log.Fatal(http.ListenAndServe(fmt.Sprintf("%s:%d", cfg.Hostname, cfg.Port), router)) + return nil +} + +func init() { + rootCmd.AddCommand(proxyCmd) + + // Here you will define your flags and configuration settings. + + // Cobra supports Persistent Flags which will work for this command + // and all subcommands, e.g.: + // proxyCmd.PersistentFlags().String("foo", "", "A help for foo") + + // Cobra supports local flags which will only run when this command + // is called directly, e.g.: + proxyCmd.Flags().StringVarP(&cfg.Hostname, "hostname", "n", cfg.Hostname, "Proxy server listen hostname") + proxyCmd.Flags().IntVarP(&cfg.Port, "port", "p", cfg.Port, "Proxy server listen port") +} diff --git a/go.mod b/go.mod index 42b125ac2..96c0acaa1 100644 --- a/go.mod +++ b/go.mod @@ -4,6 +4,7 @@ go 1.19 require ( github.com/99designs/gqlgen v0.17.36 + github.com/go-chi/chi/v5 v5.0.10 github.com/golang/glog v1.1.0 github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.0.0 github.com/searKing/golang/tools/go-enum v1.2.97 diff --git a/go.sum b/go.sum index df9780200..938301e10 100644 --- a/go.sum +++ b/go.sum @@ -70,6 +70,8 @@ github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7 github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0XL9UY= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= +github.com/go-chi/chi/v5 v5.0.10 h1:rLz5avzKpjqxrYwXNfmjkrYYXOyLJd37pz53UFHC6vk= +github.com/go-chi/chi/v5 v5.0.10/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= diff --git a/internal/model/openapi/.openapi-generator/FILES b/internal/model/openapi/.openapi-generator/FILES new file mode 100644 index 000000000..0efba780d --- /dev/null +++ b/internal/model/openapi/.openapi-generator/FILES @@ -0,0 +1,53 @@ +api_model_registry_service.go +client.go +configuration.go +model_artifact.go +model_artifact_list.go +model_artifact_state.go +model_base_artifact.go +model_base_artifact_create.go +model_base_artifact_update.go +model_base_execution.go +model_base_execution_create.go +model_base_execution_update.go +model_base_resource.go +model_base_resource_create.go +model_base_resource_list.go +model_base_resource_update.go +model_error.go +model_execution_state.go +model_inference_service.go +model_inference_service_create.go +model_inference_service_list.go +model_inference_service_update.go +model_metadata_value.go +model_metadata_value_one_of.go +model_metadata_value_one_of_1.go +model_metadata_value_one_of_2.go +model_metadata_value_one_of_3.go +model_metadata_value_one_of_4.go +model_metadata_value_one_of_5.go +model_model_artifact.go +model_model_artifact_create.go +model_model_artifact_list.go +model_model_artifact_update.go +model_model_version.go +model_model_version_create.go +model_model_version_list.go +model_model_version_update.go +model_order_by_field.go +model_registered_model.go +model_registered_model_create.go +model_registered_model_list.go +model_registered_model_update.go +model_serve_model.go +model_serve_model_create.go +model_serve_model_list.go +model_serve_model_update.go +model_serving_environment.go +model_serving_environment_create.go +model_serving_environment_list.go +model_serving_environment_update.go +model_sort_order.go +response.go +utils.go diff --git a/internal/model/openapi/.openapi-generator/VERSION b/internal/model/openapi/.openapi-generator/VERSION new file mode 100644 index 000000000..73a86b197 --- /dev/null +++ b/internal/model/openapi/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.0.1 \ No newline at end of file diff --git a/internal/model/openapi/api_model_registry_service.go b/internal/model/openapi/api_model_registry_service.go new file mode 100644 index 000000000..f23c42381 --- /dev/null +++ b/internal/model/openapi/api_model_registry_service.go @@ -0,0 +1,5552 @@ +/* +Model Registry REST API + +REST API for Model Registry to create and manage ML model metadata + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" +) + +// ModelRegistryServiceAPIService ModelRegistryServiceAPI service +type ModelRegistryServiceAPIService service + +type ApiCreateEnvironmentInferenceServiceRequest struct { + ctx context.Context + ApiService *ModelRegistryServiceAPIService + servingenvironmentId string + inferenceServiceCreate *InferenceServiceCreate +} + +// A new `InferenceService` to be created. +func (r ApiCreateEnvironmentInferenceServiceRequest) InferenceServiceCreate(inferenceServiceCreate InferenceServiceCreate) ApiCreateEnvironmentInferenceServiceRequest { + r.inferenceServiceCreate = &inferenceServiceCreate + return r +} + +func (r ApiCreateEnvironmentInferenceServiceRequest) Execute() (*InferenceService, *http.Response, error) { + return r.ApiService.CreateEnvironmentInferenceServiceExecute(r) +} + +/* +CreateEnvironmentInferenceService Create a InferenceService in ServingEnvironment + +Creates a new instance of a `InferenceService`. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param servingenvironmentId A unique identifier for a `ServingEnvironment`. + @return ApiCreateEnvironmentInferenceServiceRequest +*/ +func (a *ModelRegistryServiceAPIService) CreateEnvironmentInferenceService(ctx context.Context, servingenvironmentId string) ApiCreateEnvironmentInferenceServiceRequest { + return ApiCreateEnvironmentInferenceServiceRequest{ + ApiService: a, + ctx: ctx, + servingenvironmentId: servingenvironmentId, + } +} + +// Execute executes the request +// +// @return InferenceService +func (a *ModelRegistryServiceAPIService) CreateEnvironmentInferenceServiceExecute(r ApiCreateEnvironmentInferenceServiceRequest) (*InferenceService, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *InferenceService + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ModelRegistryServiceAPIService.CreateEnvironmentInferenceService") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/api/model_registry/v1alpha1/serving_environments/{servingenvironmentId}/inference_services" + localVarPath = strings.Replace(localVarPath, "{"+"servingenvironmentId"+"}", url.PathEscape(parameterValueToString(r.servingenvironmentId, "servingenvironmentId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.inferenceServiceCreate == nil { + return localVarReturnValue, nil, reportError("inferenceServiceCreate is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.inferenceServiceCreate + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiCreateInferenceServiceRequest struct { + ctx context.Context + ApiService *ModelRegistryServiceAPIService + inferenceServiceCreate *InferenceServiceCreate +} + +// A new `InferenceService` to be created. +func (r ApiCreateInferenceServiceRequest) InferenceServiceCreate(inferenceServiceCreate InferenceServiceCreate) ApiCreateInferenceServiceRequest { + r.inferenceServiceCreate = &inferenceServiceCreate + return r +} + +func (r ApiCreateInferenceServiceRequest) Execute() (*InferenceService, *http.Response, error) { + return r.ApiService.CreateInferenceServiceExecute(r) +} + +/* +CreateInferenceService Create a InferenceService + +Creates a new instance of a `InferenceService`. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiCreateInferenceServiceRequest +*/ +func (a *ModelRegistryServiceAPIService) CreateInferenceService(ctx context.Context) ApiCreateInferenceServiceRequest { + return ApiCreateInferenceServiceRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return InferenceService +func (a *ModelRegistryServiceAPIService) CreateInferenceServiceExecute(r ApiCreateInferenceServiceRequest) (*InferenceService, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *InferenceService + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ModelRegistryServiceAPIService.CreateInferenceService") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/api/model_registry/v1alpha1/inference_services" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.inferenceServiceCreate == nil { + return localVarReturnValue, nil, reportError("inferenceServiceCreate is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.inferenceServiceCreate + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiCreateInferenceServiceServeRequest struct { + ctx context.Context + ApiService *ModelRegistryServiceAPIService + inferenceserviceId string + serveModelCreate *ServeModelCreate +} + +// A new `ServeModel` to be associated with the `InferenceService`. +func (r ApiCreateInferenceServiceServeRequest) ServeModelCreate(serveModelCreate ServeModelCreate) ApiCreateInferenceServiceServeRequest { + r.serveModelCreate = &serveModelCreate + return r +} + +func (r ApiCreateInferenceServiceServeRequest) Execute() (*ServeModel, *http.Response, error) { + return r.ApiService.CreateInferenceServiceServeExecute(r) +} + +/* +CreateInferenceServiceServe Create a ServeModel action in a InferenceService + +Creates a new instance of a `ServeModel` associated with `InferenceService`. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param inferenceserviceId A unique identifier for a `InferenceService`. + @return ApiCreateInferenceServiceServeRequest +*/ +func (a *ModelRegistryServiceAPIService) CreateInferenceServiceServe(ctx context.Context, inferenceserviceId string) ApiCreateInferenceServiceServeRequest { + return ApiCreateInferenceServiceServeRequest{ + ApiService: a, + ctx: ctx, + inferenceserviceId: inferenceserviceId, + } +} + +// Execute executes the request +// +// @return ServeModel +func (a *ModelRegistryServiceAPIService) CreateInferenceServiceServeExecute(r ApiCreateInferenceServiceServeRequest) (*ServeModel, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ServeModel + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ModelRegistryServiceAPIService.CreateInferenceServiceServe") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/api/model_registry/v1alpha1/inference_services/{inferenceserviceId}/serves" + localVarPath = strings.Replace(localVarPath, "{"+"inferenceserviceId"+"}", url.PathEscape(parameterValueToString(r.inferenceserviceId, "inferenceserviceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.serveModelCreate == nil { + return localVarReturnValue, nil, reportError("serveModelCreate is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.serveModelCreate + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiCreateModelArtifactRequest struct { + ctx context.Context + ApiService *ModelRegistryServiceAPIService + modelArtifactCreate *ModelArtifactCreate +} + +// A new `ModelArtifact` to be created. +func (r ApiCreateModelArtifactRequest) ModelArtifactCreate(modelArtifactCreate ModelArtifactCreate) ApiCreateModelArtifactRequest { + r.modelArtifactCreate = &modelArtifactCreate + return r +} + +func (r ApiCreateModelArtifactRequest) Execute() (*ModelArtifact, *http.Response, error) { + return r.ApiService.CreateModelArtifactExecute(r) +} + +/* +CreateModelArtifact Create a ModelArtifact + +Creates a new instance of a `ModelArtifact`. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiCreateModelArtifactRequest +*/ +func (a *ModelRegistryServiceAPIService) CreateModelArtifact(ctx context.Context) ApiCreateModelArtifactRequest { + return ApiCreateModelArtifactRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return ModelArtifact +func (a *ModelRegistryServiceAPIService) CreateModelArtifactExecute(r ApiCreateModelArtifactRequest) (*ModelArtifact, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ModelArtifact + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ModelRegistryServiceAPIService.CreateModelArtifact") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/api/model_registry/v1alpha1/model_artifacts" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.modelArtifactCreate == nil { + return localVarReturnValue, nil, reportError("modelArtifactCreate is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.modelArtifactCreate + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiCreateModelVersionRequest struct { + ctx context.Context + ApiService *ModelRegistryServiceAPIService + modelVersionCreate *ModelVersionCreate +} + +// A new `ModelVersion` to be created. +func (r ApiCreateModelVersionRequest) ModelVersionCreate(modelVersionCreate ModelVersionCreate) ApiCreateModelVersionRequest { + r.modelVersionCreate = &modelVersionCreate + return r +} + +func (r ApiCreateModelVersionRequest) Execute() (*ModelVersion, *http.Response, error) { + return r.ApiService.CreateModelVersionExecute(r) +} + +/* +CreateModelVersion Create a ModelVersion + +Creates a new instance of a `ModelVersion`. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiCreateModelVersionRequest +*/ +func (a *ModelRegistryServiceAPIService) CreateModelVersion(ctx context.Context) ApiCreateModelVersionRequest { + return ApiCreateModelVersionRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return ModelVersion +func (a *ModelRegistryServiceAPIService) CreateModelVersionExecute(r ApiCreateModelVersionRequest) (*ModelVersion, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ModelVersion + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ModelRegistryServiceAPIService.CreateModelVersion") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/api/model_registry/v1alpha1/model_versions" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.modelVersionCreate == nil { + return localVarReturnValue, nil, reportError("modelVersionCreate is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.modelVersionCreate + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiCreateModelVersionArtifactRequest struct { + ctx context.Context + ApiService *ModelRegistryServiceAPIService + modelversionId string + artifact *Artifact +} + +// A new or existing `Artifact` to be associated with the `ModelVersion`. +func (r ApiCreateModelVersionArtifactRequest) Artifact(artifact Artifact) ApiCreateModelVersionArtifactRequest { + r.artifact = &artifact + return r +} + +func (r ApiCreateModelVersionArtifactRequest) Execute() (*Artifact, *http.Response, error) { + return r.ApiService.CreateModelVersionArtifactExecute(r) +} + +/* +CreateModelVersionArtifact Create an Artifact in a ModelVersion + +Creates a new instance of an Artifact if needed and associates it with `ModelVersion`. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param modelversionId A unique identifier for a `ModelVersion`. + @return ApiCreateModelVersionArtifactRequest +*/ +func (a *ModelRegistryServiceAPIService) CreateModelVersionArtifact(ctx context.Context, modelversionId string) ApiCreateModelVersionArtifactRequest { + return ApiCreateModelVersionArtifactRequest{ + ApiService: a, + ctx: ctx, + modelversionId: modelversionId, + } +} + +// Execute executes the request +// +// @return Artifact +func (a *ModelRegistryServiceAPIService) CreateModelVersionArtifactExecute(r ApiCreateModelVersionArtifactRequest) (*Artifact, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Artifact + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ModelRegistryServiceAPIService.CreateModelVersionArtifact") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/api/model_registry/v1alpha1/model_versions/{modelversionId}/artifacts" + localVarPath = strings.Replace(localVarPath, "{"+"modelversionId"+"}", url.PathEscape(parameterValueToString(r.modelversionId, "modelversionId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.artifact == nil { + return localVarReturnValue, nil, reportError("artifact is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.artifact + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiCreateRegisteredModelRequest struct { + ctx context.Context + ApiService *ModelRegistryServiceAPIService + registeredModelCreate *RegisteredModelCreate +} + +// A new `RegisteredModel` to be created. +func (r ApiCreateRegisteredModelRequest) RegisteredModelCreate(registeredModelCreate RegisteredModelCreate) ApiCreateRegisteredModelRequest { + r.registeredModelCreate = ®isteredModelCreate + return r +} + +func (r ApiCreateRegisteredModelRequest) Execute() (*RegisteredModel, *http.Response, error) { + return r.ApiService.CreateRegisteredModelExecute(r) +} + +/* +CreateRegisteredModel Create a RegisteredModel + +Creates a new instance of a `RegisteredModel`. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiCreateRegisteredModelRequest +*/ +func (a *ModelRegistryServiceAPIService) CreateRegisteredModel(ctx context.Context) ApiCreateRegisteredModelRequest { + return ApiCreateRegisteredModelRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return RegisteredModel +func (a *ModelRegistryServiceAPIService) CreateRegisteredModelExecute(r ApiCreateRegisteredModelRequest) (*RegisteredModel, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RegisteredModel + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ModelRegistryServiceAPIService.CreateRegisteredModel") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/api/model_registry/v1alpha1/registered_models" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.registeredModelCreate == nil { + return localVarReturnValue, nil, reportError("registeredModelCreate is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.registeredModelCreate + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiCreateRegisteredModelVersionRequest struct { + ctx context.Context + ApiService *ModelRegistryServiceAPIService + registeredmodelId string + modelVersion *ModelVersion +} + +// A new `ModelVersion` to be created. +func (r ApiCreateRegisteredModelVersionRequest) ModelVersion(modelVersion ModelVersion) ApiCreateRegisteredModelVersionRequest { + r.modelVersion = &modelVersion + return r +} + +func (r ApiCreateRegisteredModelVersionRequest) Execute() (*ModelVersion, *http.Response, error) { + return r.ApiService.CreateRegisteredModelVersionExecute(r) +} + +/* +CreateRegisteredModelVersion Create a ModelVersion in RegisteredModel + +Creates a new instance of a `ModelVersion`. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param registeredmodelId A unique identifier for a `RegisteredModel`. + @return ApiCreateRegisteredModelVersionRequest +*/ +func (a *ModelRegistryServiceAPIService) CreateRegisteredModelVersion(ctx context.Context, registeredmodelId string) ApiCreateRegisteredModelVersionRequest { + return ApiCreateRegisteredModelVersionRequest{ + ApiService: a, + ctx: ctx, + registeredmodelId: registeredmodelId, + } +} + +// Execute executes the request +// +// @return ModelVersion +func (a *ModelRegistryServiceAPIService) CreateRegisteredModelVersionExecute(r ApiCreateRegisteredModelVersionRequest) (*ModelVersion, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ModelVersion + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ModelRegistryServiceAPIService.CreateRegisteredModelVersion") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/api/model_registry/v1alpha1/registered_models/{registeredmodelId}/versions" + localVarPath = strings.Replace(localVarPath, "{"+"registeredmodelId"+"}", url.PathEscape(parameterValueToString(r.registeredmodelId, "registeredmodelId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.modelVersion == nil { + return localVarReturnValue, nil, reportError("modelVersion is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.modelVersion + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiCreateServingEnvironmentRequest struct { + ctx context.Context + ApiService *ModelRegistryServiceAPIService + servingEnvironmentCreate *ServingEnvironmentCreate +} + +// A new `ServingEnvironment` to be created. +func (r ApiCreateServingEnvironmentRequest) ServingEnvironmentCreate(servingEnvironmentCreate ServingEnvironmentCreate) ApiCreateServingEnvironmentRequest { + r.servingEnvironmentCreate = &servingEnvironmentCreate + return r +} + +func (r ApiCreateServingEnvironmentRequest) Execute() (*ServingEnvironment, *http.Response, error) { + return r.ApiService.CreateServingEnvironmentExecute(r) +} + +/* +CreateServingEnvironment Create a ServingEnvironment + +Creates a new instance of a `ServingEnvironment`. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiCreateServingEnvironmentRequest +*/ +func (a *ModelRegistryServiceAPIService) CreateServingEnvironment(ctx context.Context) ApiCreateServingEnvironmentRequest { + return ApiCreateServingEnvironmentRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return ServingEnvironment +func (a *ModelRegistryServiceAPIService) CreateServingEnvironmentExecute(r ApiCreateServingEnvironmentRequest) (*ServingEnvironment, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ServingEnvironment + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ModelRegistryServiceAPIService.CreateServingEnvironment") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/api/model_registry/v1alpha1/serving_environments" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.servingEnvironmentCreate == nil { + return localVarReturnValue, nil, reportError("servingEnvironmentCreate is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.servingEnvironmentCreate + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiFindInferenceServiceRequest struct { + ctx context.Context + ApiService *ModelRegistryServiceAPIService + name *string + externalID *string +} + +// Name of entity to search. +func (r ApiFindInferenceServiceRequest) Name(name string) ApiFindInferenceServiceRequest { + r.name = &name + return r +} + +// External ID of entity to search. +func (r ApiFindInferenceServiceRequest) ExternalID(externalID string) ApiFindInferenceServiceRequest { + r.externalID = &externalID + return r +} + +func (r ApiFindInferenceServiceRequest) Execute() (*InferenceService, *http.Response, error) { + return r.ApiService.FindInferenceServiceExecute(r) +} + +/* +FindInferenceService Get an InferenceServices that matches search parameters. + +Gets the details of a single instance of `InferenceService` that matches search parameters. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiFindInferenceServiceRequest +*/ +func (a *ModelRegistryServiceAPIService) FindInferenceService(ctx context.Context) ApiFindInferenceServiceRequest { + return ApiFindInferenceServiceRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return InferenceService +func (a *ModelRegistryServiceAPIService) FindInferenceServiceExecute(r ApiFindInferenceServiceRequest) (*InferenceService, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *InferenceService + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ModelRegistryServiceAPIService.FindInferenceService") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/api/model_registry/v1alpha1/inference_service" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.name != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "name", r.name, "") + } + if r.externalID != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "externalID", r.externalID, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiFindModelArtifactRequest struct { + ctx context.Context + ApiService *ModelRegistryServiceAPIService + name *string + externalID *string +} + +// Name of entity to search. +func (r ApiFindModelArtifactRequest) Name(name string) ApiFindModelArtifactRequest { + r.name = &name + return r +} + +// External ID of entity to search. +func (r ApiFindModelArtifactRequest) ExternalID(externalID string) ApiFindModelArtifactRequest { + r.externalID = &externalID + return r +} + +func (r ApiFindModelArtifactRequest) Execute() (*ModelArtifact, *http.Response, error) { + return r.ApiService.FindModelArtifactExecute(r) +} + +/* +FindModelArtifact Get a ModelArtifact that matches search parameters. + +Gets the details of a single instance of a `ModelArtifact` that matches search parameters. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiFindModelArtifactRequest +*/ +func (a *ModelRegistryServiceAPIService) FindModelArtifact(ctx context.Context) ApiFindModelArtifactRequest { + return ApiFindModelArtifactRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return ModelArtifact +func (a *ModelRegistryServiceAPIService) FindModelArtifactExecute(r ApiFindModelArtifactRequest) (*ModelArtifact, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ModelArtifact + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ModelRegistryServiceAPIService.FindModelArtifact") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/api/model_registry/v1alpha1/model_artifact" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.name != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "name", r.name, "") + } + if r.externalID != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "externalID", r.externalID, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiFindModelVersionRequest struct { + ctx context.Context + ApiService *ModelRegistryServiceAPIService + name *string + externalID *string +} + +// Name of entity to search. +func (r ApiFindModelVersionRequest) Name(name string) ApiFindModelVersionRequest { + r.name = &name + return r +} + +// External ID of entity to search. +func (r ApiFindModelVersionRequest) ExternalID(externalID string) ApiFindModelVersionRequest { + r.externalID = &externalID + return r +} + +func (r ApiFindModelVersionRequest) Execute() (*ModelVersion, *http.Response, error) { + return r.ApiService.FindModelVersionExecute(r) +} + +/* +FindModelVersion Get a ModelVersion that matches search parameters. + +Gets the details of a single instance of a `ModelVersion` that matches search parameters. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiFindModelVersionRequest +*/ +func (a *ModelRegistryServiceAPIService) FindModelVersion(ctx context.Context) ApiFindModelVersionRequest { + return ApiFindModelVersionRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return ModelVersion +func (a *ModelRegistryServiceAPIService) FindModelVersionExecute(r ApiFindModelVersionRequest) (*ModelVersion, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ModelVersion + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ModelRegistryServiceAPIService.FindModelVersion") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/api/model_registry/v1alpha1/model_version" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.name != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "name", r.name, "") + } + if r.externalID != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "externalID", r.externalID, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiFindRegisteredModelRequest struct { + ctx context.Context + ApiService *ModelRegistryServiceAPIService + name *string + externalID *string +} + +// Name of entity to search. +func (r ApiFindRegisteredModelRequest) Name(name string) ApiFindRegisteredModelRequest { + r.name = &name + return r +} + +// External ID of entity to search. +func (r ApiFindRegisteredModelRequest) ExternalID(externalID string) ApiFindRegisteredModelRequest { + r.externalID = &externalID + return r +} + +func (r ApiFindRegisteredModelRequest) Execute() (*RegisteredModel, *http.Response, error) { + return r.ApiService.FindRegisteredModelExecute(r) +} + +/* +FindRegisteredModel Get a RegisteredModel that matches search parameters. + +Gets the details of a single instance of a `RegisteredModel` that matches search parameters. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiFindRegisteredModelRequest +*/ +func (a *ModelRegistryServiceAPIService) FindRegisteredModel(ctx context.Context) ApiFindRegisteredModelRequest { + return ApiFindRegisteredModelRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return RegisteredModel +func (a *ModelRegistryServiceAPIService) FindRegisteredModelExecute(r ApiFindRegisteredModelRequest) (*RegisteredModel, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RegisteredModel + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ModelRegistryServiceAPIService.FindRegisteredModel") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/api/model_registry/v1alpha1/registered_model" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.name != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "name", r.name, "") + } + if r.externalID != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "externalID", r.externalID, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiFindServingEnvironmentRequest struct { + ctx context.Context + ApiService *ModelRegistryServiceAPIService + name *string + externalID *string +} + +// Name of entity to search. +func (r ApiFindServingEnvironmentRequest) Name(name string) ApiFindServingEnvironmentRequest { + r.name = &name + return r +} + +// External ID of entity to search. +func (r ApiFindServingEnvironmentRequest) ExternalID(externalID string) ApiFindServingEnvironmentRequest { + r.externalID = &externalID + return r +} + +func (r ApiFindServingEnvironmentRequest) Execute() (*ServingEnvironment, *http.Response, error) { + return r.ApiService.FindServingEnvironmentExecute(r) +} + +/* +FindServingEnvironment Find ServingEnvironment + +Finds a `ServingEnvironment` entity that matches query parameters. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiFindServingEnvironmentRequest +*/ +func (a *ModelRegistryServiceAPIService) FindServingEnvironment(ctx context.Context) ApiFindServingEnvironmentRequest { + return ApiFindServingEnvironmentRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return ServingEnvironment +func (a *ModelRegistryServiceAPIService) FindServingEnvironmentExecute(r ApiFindServingEnvironmentRequest) (*ServingEnvironment, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ServingEnvironment + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ModelRegistryServiceAPIService.FindServingEnvironment") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/api/model_registry/v1alpha1/serving_environment" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.name != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "name", r.name, "") + } + if r.externalID != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "externalID", r.externalID, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetEnvironmentInferenceServicesRequest struct { + ctx context.Context + ApiService *ModelRegistryServiceAPIService + servingenvironmentId string + name *string + externalID *string + pageSize *string + orderBy *OrderByField + sortOrder *SortOrder + nextPageToken *string +} + +// Name of entity to search. +func (r ApiGetEnvironmentInferenceServicesRequest) Name(name string) ApiGetEnvironmentInferenceServicesRequest { + r.name = &name + return r +} + +// External ID of entity to search. +func (r ApiGetEnvironmentInferenceServicesRequest) ExternalID(externalID string) ApiGetEnvironmentInferenceServicesRequest { + r.externalID = &externalID + return r +} + +// Number of entities in each page. +func (r ApiGetEnvironmentInferenceServicesRequest) PageSize(pageSize string) ApiGetEnvironmentInferenceServicesRequest { + r.pageSize = &pageSize + return r +} + +// Specifies the order by criteria for listing entities. +func (r ApiGetEnvironmentInferenceServicesRequest) OrderBy(orderBy OrderByField) ApiGetEnvironmentInferenceServicesRequest { + r.orderBy = &orderBy + return r +} + +// Specifies the sort order for listing entities, defaults to ASC. +func (r ApiGetEnvironmentInferenceServicesRequest) SortOrder(sortOrder SortOrder) ApiGetEnvironmentInferenceServicesRequest { + r.sortOrder = &sortOrder + return r +} + +// Token to use to retrieve next page of results. +func (r ApiGetEnvironmentInferenceServicesRequest) NextPageToken(nextPageToken string) ApiGetEnvironmentInferenceServicesRequest { + r.nextPageToken = &nextPageToken + return r +} + +func (r ApiGetEnvironmentInferenceServicesRequest) Execute() (*InferenceServiceList, *http.Response, error) { + return r.ApiService.GetEnvironmentInferenceServicesExecute(r) +} + +/* +GetEnvironmentInferenceServices List All ServingEnvironment's InferenceServices + +Gets a list of all `InferenceService` entities for the `ServingEnvironment`. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param servingenvironmentId A unique identifier for a `ServingEnvironment`. + @return ApiGetEnvironmentInferenceServicesRequest +*/ +func (a *ModelRegistryServiceAPIService) GetEnvironmentInferenceServices(ctx context.Context, servingenvironmentId string) ApiGetEnvironmentInferenceServicesRequest { + return ApiGetEnvironmentInferenceServicesRequest{ + ApiService: a, + ctx: ctx, + servingenvironmentId: servingenvironmentId, + } +} + +// Execute executes the request +// +// @return InferenceServiceList +func (a *ModelRegistryServiceAPIService) GetEnvironmentInferenceServicesExecute(r ApiGetEnvironmentInferenceServicesRequest) (*InferenceServiceList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *InferenceServiceList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ModelRegistryServiceAPIService.GetEnvironmentInferenceServices") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/api/model_registry/v1alpha1/serving_environments/{servingenvironmentId}/inference_services" + localVarPath = strings.Replace(localVarPath, "{"+"servingenvironmentId"+"}", url.PathEscape(parameterValueToString(r.servingenvironmentId, "servingenvironmentId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.name != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "name", r.name, "") + } + if r.externalID != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "externalID", r.externalID, "") + } + if r.pageSize != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageSize", r.pageSize, "") + } + if r.orderBy != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "orderBy", r.orderBy, "") + } + if r.sortOrder != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "sortOrder", r.sortOrder, "") + } + if r.nextPageToken != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "nextPageToken", r.nextPageToken, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetInferenceServiceRequest struct { + ctx context.Context + ApiService *ModelRegistryServiceAPIService + inferenceserviceId string +} + +func (r ApiGetInferenceServiceRequest) Execute() (*InferenceService, *http.Response, error) { + return r.ApiService.GetInferenceServiceExecute(r) +} + +/* +GetInferenceService Get a InferenceService + +Gets the details of a single instance of a `InferenceService`. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param inferenceserviceId A unique identifier for a `InferenceService`. + @return ApiGetInferenceServiceRequest +*/ +func (a *ModelRegistryServiceAPIService) GetInferenceService(ctx context.Context, inferenceserviceId string) ApiGetInferenceServiceRequest { + return ApiGetInferenceServiceRequest{ + ApiService: a, + ctx: ctx, + inferenceserviceId: inferenceserviceId, + } +} + +// Execute executes the request +// +// @return InferenceService +func (a *ModelRegistryServiceAPIService) GetInferenceServiceExecute(r ApiGetInferenceServiceRequest) (*InferenceService, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *InferenceService + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ModelRegistryServiceAPIService.GetInferenceService") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/api/model_registry/v1alpha1/inference_services/{inferenceserviceId}" + localVarPath = strings.Replace(localVarPath, "{"+"inferenceserviceId"+"}", url.PathEscape(parameterValueToString(r.inferenceserviceId, "inferenceserviceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetInferenceServiceModelRequest struct { + ctx context.Context + ApiService *ModelRegistryServiceAPIService + inferenceserviceId string +} + +func (r ApiGetInferenceServiceModelRequest) Execute() (*RegisteredModel, *http.Response, error) { + return r.ApiService.GetInferenceServiceModelExecute(r) +} + +/* +GetInferenceServiceModel Get InferenceService's RegisteredModel + +Gets the `RegisteredModel` entity for the `InferenceService`. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param inferenceserviceId A unique identifier for a `InferenceService`. + @return ApiGetInferenceServiceModelRequest +*/ +func (a *ModelRegistryServiceAPIService) GetInferenceServiceModel(ctx context.Context, inferenceserviceId string) ApiGetInferenceServiceModelRequest { + return ApiGetInferenceServiceModelRequest{ + ApiService: a, + ctx: ctx, + inferenceserviceId: inferenceserviceId, + } +} + +// Execute executes the request +// +// @return RegisteredModel +func (a *ModelRegistryServiceAPIService) GetInferenceServiceModelExecute(r ApiGetInferenceServiceModelRequest) (*RegisteredModel, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RegisteredModel + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ModelRegistryServiceAPIService.GetInferenceServiceModel") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/api/model_registry/v1alpha1/inference_services/{inferenceserviceId}/model" + localVarPath = strings.Replace(localVarPath, "{"+"inferenceserviceId"+"}", url.PathEscape(parameterValueToString(r.inferenceserviceId, "inferenceserviceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetInferenceServiceServesRequest struct { + ctx context.Context + ApiService *ModelRegistryServiceAPIService + inferenceserviceId string + name *string + externalID *string + pageSize *string + orderBy *OrderByField + sortOrder *SortOrder + nextPageToken *string +} + +// Name of entity to search. +func (r ApiGetInferenceServiceServesRequest) Name(name string) ApiGetInferenceServiceServesRequest { + r.name = &name + return r +} + +// External ID of entity to search. +func (r ApiGetInferenceServiceServesRequest) ExternalID(externalID string) ApiGetInferenceServiceServesRequest { + r.externalID = &externalID + return r +} + +// Number of entities in each page. +func (r ApiGetInferenceServiceServesRequest) PageSize(pageSize string) ApiGetInferenceServiceServesRequest { + r.pageSize = &pageSize + return r +} + +// Specifies the order by criteria for listing entities. +func (r ApiGetInferenceServiceServesRequest) OrderBy(orderBy OrderByField) ApiGetInferenceServiceServesRequest { + r.orderBy = &orderBy + return r +} + +// Specifies the sort order for listing entities, defaults to ASC. +func (r ApiGetInferenceServiceServesRequest) SortOrder(sortOrder SortOrder) ApiGetInferenceServiceServesRequest { + r.sortOrder = &sortOrder + return r +} + +// Token to use to retrieve next page of results. +func (r ApiGetInferenceServiceServesRequest) NextPageToken(nextPageToken string) ApiGetInferenceServiceServesRequest { + r.nextPageToken = &nextPageToken + return r +} + +func (r ApiGetInferenceServiceServesRequest) Execute() (*ServeModelList, *http.Response, error) { + return r.ApiService.GetInferenceServiceServesExecute(r) +} + +/* +GetInferenceServiceServes List All InferenceService's ServeModel actions + +Gets a list of all `ServeModel` entities for the `InferenceService`. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param inferenceserviceId A unique identifier for a `InferenceService`. + @return ApiGetInferenceServiceServesRequest +*/ +func (a *ModelRegistryServiceAPIService) GetInferenceServiceServes(ctx context.Context, inferenceserviceId string) ApiGetInferenceServiceServesRequest { + return ApiGetInferenceServiceServesRequest{ + ApiService: a, + ctx: ctx, + inferenceserviceId: inferenceserviceId, + } +} + +// Execute executes the request +// +// @return ServeModelList +func (a *ModelRegistryServiceAPIService) GetInferenceServiceServesExecute(r ApiGetInferenceServiceServesRequest) (*ServeModelList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ServeModelList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ModelRegistryServiceAPIService.GetInferenceServiceServes") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/api/model_registry/v1alpha1/inference_services/{inferenceserviceId}/serves" + localVarPath = strings.Replace(localVarPath, "{"+"inferenceserviceId"+"}", url.PathEscape(parameterValueToString(r.inferenceserviceId, "inferenceserviceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.name != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "name", r.name, "") + } + if r.externalID != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "externalID", r.externalID, "") + } + if r.pageSize != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageSize", r.pageSize, "") + } + if r.orderBy != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "orderBy", r.orderBy, "") + } + if r.sortOrder != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "sortOrder", r.sortOrder, "") + } + if r.nextPageToken != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "nextPageToken", r.nextPageToken, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetInferenceServiceVersionRequest struct { + ctx context.Context + ApiService *ModelRegistryServiceAPIService + inferenceserviceId string +} + +func (r ApiGetInferenceServiceVersionRequest) Execute() (*ModelVersion, *http.Response, error) { + return r.ApiService.GetInferenceServiceVersionExecute(r) +} + +/* +GetInferenceServiceVersion Get InferenceService's ModelVersion + +Gets the `ModelVersion` entity for the `InferenceService`. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param inferenceserviceId A unique identifier for a `InferenceService`. + @return ApiGetInferenceServiceVersionRequest +*/ +func (a *ModelRegistryServiceAPIService) GetInferenceServiceVersion(ctx context.Context, inferenceserviceId string) ApiGetInferenceServiceVersionRequest { + return ApiGetInferenceServiceVersionRequest{ + ApiService: a, + ctx: ctx, + inferenceserviceId: inferenceserviceId, + } +} + +// Execute executes the request +// +// @return ModelVersion +func (a *ModelRegistryServiceAPIService) GetInferenceServiceVersionExecute(r ApiGetInferenceServiceVersionRequest) (*ModelVersion, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ModelVersion + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ModelRegistryServiceAPIService.GetInferenceServiceVersion") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/api/model_registry/v1alpha1/inference_services/{inferenceserviceId}/version" + localVarPath = strings.Replace(localVarPath, "{"+"inferenceserviceId"+"}", url.PathEscape(parameterValueToString(r.inferenceserviceId, "inferenceserviceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetInferenceServicesRequest struct { + ctx context.Context + ApiService *ModelRegistryServiceAPIService + pageSize *string + orderBy *OrderByField + sortOrder *SortOrder + nextPageToken *string +} + +// Number of entities in each page. +func (r ApiGetInferenceServicesRequest) PageSize(pageSize string) ApiGetInferenceServicesRequest { + r.pageSize = &pageSize + return r +} + +// Specifies the order by criteria for listing entities. +func (r ApiGetInferenceServicesRequest) OrderBy(orderBy OrderByField) ApiGetInferenceServicesRequest { + r.orderBy = &orderBy + return r +} + +// Specifies the sort order for listing entities, defaults to ASC. +func (r ApiGetInferenceServicesRequest) SortOrder(sortOrder SortOrder) ApiGetInferenceServicesRequest { + r.sortOrder = &sortOrder + return r +} + +// Token to use to retrieve next page of results. +func (r ApiGetInferenceServicesRequest) NextPageToken(nextPageToken string) ApiGetInferenceServicesRequest { + r.nextPageToken = &nextPageToken + return r +} + +func (r ApiGetInferenceServicesRequest) Execute() (*InferenceServiceList, *http.Response, error) { + return r.ApiService.GetInferenceServicesExecute(r) +} + +/* +GetInferenceServices List All InferenceServices + +Gets a list of all `InferenceService` entities. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiGetInferenceServicesRequest +*/ +func (a *ModelRegistryServiceAPIService) GetInferenceServices(ctx context.Context) ApiGetInferenceServicesRequest { + return ApiGetInferenceServicesRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return InferenceServiceList +func (a *ModelRegistryServiceAPIService) GetInferenceServicesExecute(r ApiGetInferenceServicesRequest) (*InferenceServiceList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *InferenceServiceList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ModelRegistryServiceAPIService.GetInferenceServices") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/api/model_registry/v1alpha1/inference_services" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.pageSize != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageSize", r.pageSize, "") + } + if r.orderBy != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "orderBy", r.orderBy, "") + } + if r.sortOrder != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "sortOrder", r.sortOrder, "") + } + if r.nextPageToken != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "nextPageToken", r.nextPageToken, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetModelArtifactRequest struct { + ctx context.Context + ApiService *ModelRegistryServiceAPIService + modelartifactId string +} + +func (r ApiGetModelArtifactRequest) Execute() (*ModelArtifact, *http.Response, error) { + return r.ApiService.GetModelArtifactExecute(r) +} + +/* +GetModelArtifact Get a ModelArtifact + +Gets the details of a single instance of a `ModelArtifact`. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param modelartifactId A unique identifier for a `ModelArtifact`. + @return ApiGetModelArtifactRequest +*/ +func (a *ModelRegistryServiceAPIService) GetModelArtifact(ctx context.Context, modelartifactId string) ApiGetModelArtifactRequest { + return ApiGetModelArtifactRequest{ + ApiService: a, + ctx: ctx, + modelartifactId: modelartifactId, + } +} + +// Execute executes the request +// +// @return ModelArtifact +func (a *ModelRegistryServiceAPIService) GetModelArtifactExecute(r ApiGetModelArtifactRequest) (*ModelArtifact, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ModelArtifact + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ModelRegistryServiceAPIService.GetModelArtifact") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/api/model_registry/v1alpha1/model_artifacts/{modelartifactId}" + localVarPath = strings.Replace(localVarPath, "{"+"modelartifactId"+"}", url.PathEscape(parameterValueToString(r.modelartifactId, "modelartifactId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetModelArtifactsRequest struct { + ctx context.Context + ApiService *ModelRegistryServiceAPIService + pageSize *string + orderBy *OrderByField + sortOrder *SortOrder + nextPageToken *string +} + +// Number of entities in each page. +func (r ApiGetModelArtifactsRequest) PageSize(pageSize string) ApiGetModelArtifactsRequest { + r.pageSize = &pageSize + return r +} + +// Specifies the order by criteria for listing entities. +func (r ApiGetModelArtifactsRequest) OrderBy(orderBy OrderByField) ApiGetModelArtifactsRequest { + r.orderBy = &orderBy + return r +} + +// Specifies the sort order for listing entities, defaults to ASC. +func (r ApiGetModelArtifactsRequest) SortOrder(sortOrder SortOrder) ApiGetModelArtifactsRequest { + r.sortOrder = &sortOrder + return r +} + +// Token to use to retrieve next page of results. +func (r ApiGetModelArtifactsRequest) NextPageToken(nextPageToken string) ApiGetModelArtifactsRequest { + r.nextPageToken = &nextPageToken + return r +} + +func (r ApiGetModelArtifactsRequest) Execute() (*ModelArtifactList, *http.Response, error) { + return r.ApiService.GetModelArtifactsExecute(r) +} + +/* +GetModelArtifacts List All ModelArtifacts + +Gets a list of all `ModelArtifact` entities. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiGetModelArtifactsRequest +*/ +func (a *ModelRegistryServiceAPIService) GetModelArtifacts(ctx context.Context) ApiGetModelArtifactsRequest { + return ApiGetModelArtifactsRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return ModelArtifactList +func (a *ModelRegistryServiceAPIService) GetModelArtifactsExecute(r ApiGetModelArtifactsRequest) (*ModelArtifactList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ModelArtifactList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ModelRegistryServiceAPIService.GetModelArtifacts") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/api/model_registry/v1alpha1/model_artifacts" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.pageSize != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageSize", r.pageSize, "") + } + if r.orderBy != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "orderBy", r.orderBy, "") + } + if r.sortOrder != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "sortOrder", r.sortOrder, "") + } + if r.nextPageToken != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "nextPageToken", r.nextPageToken, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetModelVersionRequest struct { + ctx context.Context + ApiService *ModelRegistryServiceAPIService + modelversionId string +} + +func (r ApiGetModelVersionRequest) Execute() (*ModelVersion, *http.Response, error) { + return r.ApiService.GetModelVersionExecute(r) +} + +/* +GetModelVersion Get a ModelVersion + +Gets the details of a single instance of a `ModelVersion`. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param modelversionId A unique identifier for a `ModelVersion`. + @return ApiGetModelVersionRequest +*/ +func (a *ModelRegistryServiceAPIService) GetModelVersion(ctx context.Context, modelversionId string) ApiGetModelVersionRequest { + return ApiGetModelVersionRequest{ + ApiService: a, + ctx: ctx, + modelversionId: modelversionId, + } +} + +// Execute executes the request +// +// @return ModelVersion +func (a *ModelRegistryServiceAPIService) GetModelVersionExecute(r ApiGetModelVersionRequest) (*ModelVersion, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ModelVersion + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ModelRegistryServiceAPIService.GetModelVersion") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/api/model_registry/v1alpha1/model_versions/{modelversionId}" + localVarPath = strings.Replace(localVarPath, "{"+"modelversionId"+"}", url.PathEscape(parameterValueToString(r.modelversionId, "modelversionId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetModelVersionArtifactsRequest struct { + ctx context.Context + ApiService *ModelRegistryServiceAPIService + modelversionId string + name *string + externalID *string + pageSize *string + orderBy *OrderByField + sortOrder *SortOrder + nextPageToken *string +} + +// Name of entity to search. +func (r ApiGetModelVersionArtifactsRequest) Name(name string) ApiGetModelVersionArtifactsRequest { + r.name = &name + return r +} + +// External ID of entity to search. +func (r ApiGetModelVersionArtifactsRequest) ExternalID(externalID string) ApiGetModelVersionArtifactsRequest { + r.externalID = &externalID + return r +} + +// Number of entities in each page. +func (r ApiGetModelVersionArtifactsRequest) PageSize(pageSize string) ApiGetModelVersionArtifactsRequest { + r.pageSize = &pageSize + return r +} + +// Specifies the order by criteria for listing entities. +func (r ApiGetModelVersionArtifactsRequest) OrderBy(orderBy OrderByField) ApiGetModelVersionArtifactsRequest { + r.orderBy = &orderBy + return r +} + +// Specifies the sort order for listing entities, defaults to ASC. +func (r ApiGetModelVersionArtifactsRequest) SortOrder(sortOrder SortOrder) ApiGetModelVersionArtifactsRequest { + r.sortOrder = &sortOrder + return r +} + +// Token to use to retrieve next page of results. +func (r ApiGetModelVersionArtifactsRequest) NextPageToken(nextPageToken string) ApiGetModelVersionArtifactsRequest { + r.nextPageToken = &nextPageToken + return r +} + +func (r ApiGetModelVersionArtifactsRequest) Execute() (*ArtifactList, *http.Response, error) { + return r.ApiService.GetModelVersionArtifactsExecute(r) +} + +/* +GetModelVersionArtifacts List All ModelVersion's artifacts + +Gets a list of all `Artifact` entities for the `ModelVersion`. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param modelversionId A unique identifier for a `ModelVersion`. + @return ApiGetModelVersionArtifactsRequest +*/ +func (a *ModelRegistryServiceAPIService) GetModelVersionArtifacts(ctx context.Context, modelversionId string) ApiGetModelVersionArtifactsRequest { + return ApiGetModelVersionArtifactsRequest{ + ApiService: a, + ctx: ctx, + modelversionId: modelversionId, + } +} + +// Execute executes the request +// +// @return ArtifactList +func (a *ModelRegistryServiceAPIService) GetModelVersionArtifactsExecute(r ApiGetModelVersionArtifactsRequest) (*ArtifactList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ArtifactList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ModelRegistryServiceAPIService.GetModelVersionArtifacts") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/api/model_registry/v1alpha1/model_versions/{modelversionId}/artifacts" + localVarPath = strings.Replace(localVarPath, "{"+"modelversionId"+"}", url.PathEscape(parameterValueToString(r.modelversionId, "modelversionId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.name != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "name", r.name, "") + } + if r.externalID != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "externalID", r.externalID, "") + } + if r.pageSize != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageSize", r.pageSize, "") + } + if r.orderBy != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "orderBy", r.orderBy, "") + } + if r.sortOrder != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "sortOrder", r.sortOrder, "") + } + if r.nextPageToken != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "nextPageToken", r.nextPageToken, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetModelVersionsRequest struct { + ctx context.Context + ApiService *ModelRegistryServiceAPIService + pageSize *string + orderBy *OrderByField + sortOrder *SortOrder + nextPageToken *string +} + +// Number of entities in each page. +func (r ApiGetModelVersionsRequest) PageSize(pageSize string) ApiGetModelVersionsRequest { + r.pageSize = &pageSize + return r +} + +// Specifies the order by criteria for listing entities. +func (r ApiGetModelVersionsRequest) OrderBy(orderBy OrderByField) ApiGetModelVersionsRequest { + r.orderBy = &orderBy + return r +} + +// Specifies the sort order for listing entities, defaults to ASC. +func (r ApiGetModelVersionsRequest) SortOrder(sortOrder SortOrder) ApiGetModelVersionsRequest { + r.sortOrder = &sortOrder + return r +} + +// Token to use to retrieve next page of results. +func (r ApiGetModelVersionsRequest) NextPageToken(nextPageToken string) ApiGetModelVersionsRequest { + r.nextPageToken = &nextPageToken + return r +} + +func (r ApiGetModelVersionsRequest) Execute() (*ModelVersionList, *http.Response, error) { + return r.ApiService.GetModelVersionsExecute(r) +} + +/* +GetModelVersions List All ModelVersions + +Gets a list of all `ModelVersion` entities. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiGetModelVersionsRequest +*/ +func (a *ModelRegistryServiceAPIService) GetModelVersions(ctx context.Context) ApiGetModelVersionsRequest { + return ApiGetModelVersionsRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return ModelVersionList +func (a *ModelRegistryServiceAPIService) GetModelVersionsExecute(r ApiGetModelVersionsRequest) (*ModelVersionList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ModelVersionList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ModelRegistryServiceAPIService.GetModelVersions") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/api/model_registry/v1alpha1/model_versions" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.pageSize != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageSize", r.pageSize, "") + } + if r.orderBy != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "orderBy", r.orderBy, "") + } + if r.sortOrder != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "sortOrder", r.sortOrder, "") + } + if r.nextPageToken != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "nextPageToken", r.nextPageToken, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetRegisteredModelRequest struct { + ctx context.Context + ApiService *ModelRegistryServiceAPIService + registeredmodelId string +} + +func (r ApiGetRegisteredModelRequest) Execute() (*RegisteredModel, *http.Response, error) { + return r.ApiService.GetRegisteredModelExecute(r) +} + +/* +GetRegisteredModel Get a RegisteredModel + +Gets the details of a single instance of a `RegisteredModel`. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param registeredmodelId A unique identifier for a `RegisteredModel`. + @return ApiGetRegisteredModelRequest +*/ +func (a *ModelRegistryServiceAPIService) GetRegisteredModel(ctx context.Context, registeredmodelId string) ApiGetRegisteredModelRequest { + return ApiGetRegisteredModelRequest{ + ApiService: a, + ctx: ctx, + registeredmodelId: registeredmodelId, + } +} + +// Execute executes the request +// +// @return RegisteredModel +func (a *ModelRegistryServiceAPIService) GetRegisteredModelExecute(r ApiGetRegisteredModelRequest) (*RegisteredModel, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RegisteredModel + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ModelRegistryServiceAPIService.GetRegisteredModel") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/api/model_registry/v1alpha1/registered_models/{registeredmodelId}" + localVarPath = strings.Replace(localVarPath, "{"+"registeredmodelId"+"}", url.PathEscape(parameterValueToString(r.registeredmodelId, "registeredmodelId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetRegisteredModelVersionsRequest struct { + ctx context.Context + ApiService *ModelRegistryServiceAPIService + registeredmodelId string + name *string + externalID *string + pageSize *string + orderBy *OrderByField + sortOrder *SortOrder + nextPageToken *string +} + +// Name of entity to search. +func (r ApiGetRegisteredModelVersionsRequest) Name(name string) ApiGetRegisteredModelVersionsRequest { + r.name = &name + return r +} + +// External ID of entity to search. +func (r ApiGetRegisteredModelVersionsRequest) ExternalID(externalID string) ApiGetRegisteredModelVersionsRequest { + r.externalID = &externalID + return r +} + +// Number of entities in each page. +func (r ApiGetRegisteredModelVersionsRequest) PageSize(pageSize string) ApiGetRegisteredModelVersionsRequest { + r.pageSize = &pageSize + return r +} + +// Specifies the order by criteria for listing entities. +func (r ApiGetRegisteredModelVersionsRequest) OrderBy(orderBy OrderByField) ApiGetRegisteredModelVersionsRequest { + r.orderBy = &orderBy + return r +} + +// Specifies the sort order for listing entities, defaults to ASC. +func (r ApiGetRegisteredModelVersionsRequest) SortOrder(sortOrder SortOrder) ApiGetRegisteredModelVersionsRequest { + r.sortOrder = &sortOrder + return r +} + +// Token to use to retrieve next page of results. +func (r ApiGetRegisteredModelVersionsRequest) NextPageToken(nextPageToken string) ApiGetRegisteredModelVersionsRequest { + r.nextPageToken = &nextPageToken + return r +} + +func (r ApiGetRegisteredModelVersionsRequest) Execute() (*ModelVersionList, *http.Response, error) { + return r.ApiService.GetRegisteredModelVersionsExecute(r) +} + +/* +GetRegisteredModelVersions List All RegisteredModel's ModelVersions + +Gets a list of all `ModelVersion` entities for the `RegisteredModel`. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param registeredmodelId A unique identifier for a `RegisteredModel`. + @return ApiGetRegisteredModelVersionsRequest +*/ +func (a *ModelRegistryServiceAPIService) GetRegisteredModelVersions(ctx context.Context, registeredmodelId string) ApiGetRegisteredModelVersionsRequest { + return ApiGetRegisteredModelVersionsRequest{ + ApiService: a, + ctx: ctx, + registeredmodelId: registeredmodelId, + } +} + +// Execute executes the request +// +// @return ModelVersionList +func (a *ModelRegistryServiceAPIService) GetRegisteredModelVersionsExecute(r ApiGetRegisteredModelVersionsRequest) (*ModelVersionList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ModelVersionList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ModelRegistryServiceAPIService.GetRegisteredModelVersions") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/api/model_registry/v1alpha1/registered_models/{registeredmodelId}/versions" + localVarPath = strings.Replace(localVarPath, "{"+"registeredmodelId"+"}", url.PathEscape(parameterValueToString(r.registeredmodelId, "registeredmodelId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.name != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "name", r.name, "") + } + if r.externalID != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "externalID", r.externalID, "") + } + if r.pageSize != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageSize", r.pageSize, "") + } + if r.orderBy != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "orderBy", r.orderBy, "") + } + if r.sortOrder != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "sortOrder", r.sortOrder, "") + } + if r.nextPageToken != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "nextPageToken", r.nextPageToken, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetRegisteredModelsRequest struct { + ctx context.Context + ApiService *ModelRegistryServiceAPIService + pageSize *string + orderBy *OrderByField + sortOrder *SortOrder + nextPageToken *string +} + +// Number of entities in each page. +func (r ApiGetRegisteredModelsRequest) PageSize(pageSize string) ApiGetRegisteredModelsRequest { + r.pageSize = &pageSize + return r +} + +// Specifies the order by criteria for listing entities. +func (r ApiGetRegisteredModelsRequest) OrderBy(orderBy OrderByField) ApiGetRegisteredModelsRequest { + r.orderBy = &orderBy + return r +} + +// Specifies the sort order for listing entities, defaults to ASC. +func (r ApiGetRegisteredModelsRequest) SortOrder(sortOrder SortOrder) ApiGetRegisteredModelsRequest { + r.sortOrder = &sortOrder + return r +} + +// Token to use to retrieve next page of results. +func (r ApiGetRegisteredModelsRequest) NextPageToken(nextPageToken string) ApiGetRegisteredModelsRequest { + r.nextPageToken = &nextPageToken + return r +} + +func (r ApiGetRegisteredModelsRequest) Execute() (*RegisteredModelList, *http.Response, error) { + return r.ApiService.GetRegisteredModelsExecute(r) +} + +/* +GetRegisteredModels List All RegisteredModels + +Gets a list of all `RegisteredModel` entities. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiGetRegisteredModelsRequest +*/ +func (a *ModelRegistryServiceAPIService) GetRegisteredModels(ctx context.Context) ApiGetRegisteredModelsRequest { + return ApiGetRegisteredModelsRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return RegisteredModelList +func (a *ModelRegistryServiceAPIService) GetRegisteredModelsExecute(r ApiGetRegisteredModelsRequest) (*RegisteredModelList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RegisteredModelList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ModelRegistryServiceAPIService.GetRegisteredModels") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/api/model_registry/v1alpha1/registered_models" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.pageSize != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageSize", r.pageSize, "") + } + if r.orderBy != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "orderBy", r.orderBy, "") + } + if r.sortOrder != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "sortOrder", r.sortOrder, "") + } + if r.nextPageToken != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "nextPageToken", r.nextPageToken, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetServingEnvironmentRequest struct { + ctx context.Context + ApiService *ModelRegistryServiceAPIService + servingenvironmentId string +} + +func (r ApiGetServingEnvironmentRequest) Execute() (*ServingEnvironment, *http.Response, error) { + return r.ApiService.GetServingEnvironmentExecute(r) +} + +/* +GetServingEnvironment Get a ServingEnvironment + +Gets the details of a single instance of a `ServingEnvironment`. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param servingenvironmentId A unique identifier for a `ServingEnvironment`. + @return ApiGetServingEnvironmentRequest +*/ +func (a *ModelRegistryServiceAPIService) GetServingEnvironment(ctx context.Context, servingenvironmentId string) ApiGetServingEnvironmentRequest { + return ApiGetServingEnvironmentRequest{ + ApiService: a, + ctx: ctx, + servingenvironmentId: servingenvironmentId, + } +} + +// Execute executes the request +// +// @return ServingEnvironment +func (a *ModelRegistryServiceAPIService) GetServingEnvironmentExecute(r ApiGetServingEnvironmentRequest) (*ServingEnvironment, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ServingEnvironment + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ModelRegistryServiceAPIService.GetServingEnvironment") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/api/model_registry/v1alpha1/serving_environments/{servingenvironmentId}" + localVarPath = strings.Replace(localVarPath, "{"+"servingenvironmentId"+"}", url.PathEscape(parameterValueToString(r.servingenvironmentId, "servingenvironmentId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetServingEnvironmentsRequest struct { + ctx context.Context + ApiService *ModelRegistryServiceAPIService + pageSize *string + orderBy *OrderByField + sortOrder *SortOrder + nextPageToken *string +} + +// Number of entities in each page. +func (r ApiGetServingEnvironmentsRequest) PageSize(pageSize string) ApiGetServingEnvironmentsRequest { + r.pageSize = &pageSize + return r +} + +// Specifies the order by criteria for listing entities. +func (r ApiGetServingEnvironmentsRequest) OrderBy(orderBy OrderByField) ApiGetServingEnvironmentsRequest { + r.orderBy = &orderBy + return r +} + +// Specifies the sort order for listing entities, defaults to ASC. +func (r ApiGetServingEnvironmentsRequest) SortOrder(sortOrder SortOrder) ApiGetServingEnvironmentsRequest { + r.sortOrder = &sortOrder + return r +} + +// Token to use to retrieve next page of results. +func (r ApiGetServingEnvironmentsRequest) NextPageToken(nextPageToken string) ApiGetServingEnvironmentsRequest { + r.nextPageToken = &nextPageToken + return r +} + +func (r ApiGetServingEnvironmentsRequest) Execute() (*ServingEnvironmentList, *http.Response, error) { + return r.ApiService.GetServingEnvironmentsExecute(r) +} + +/* +GetServingEnvironments List All ServingEnvironments + +Gets a list of all `ServingEnvironment` entities. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiGetServingEnvironmentsRequest +*/ +func (a *ModelRegistryServiceAPIService) GetServingEnvironments(ctx context.Context) ApiGetServingEnvironmentsRequest { + return ApiGetServingEnvironmentsRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return ServingEnvironmentList +func (a *ModelRegistryServiceAPIService) GetServingEnvironmentsExecute(r ApiGetServingEnvironmentsRequest) (*ServingEnvironmentList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ServingEnvironmentList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ModelRegistryServiceAPIService.GetServingEnvironments") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/api/model_registry/v1alpha1/serving_environments" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.pageSize != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageSize", r.pageSize, "") + } + if r.orderBy != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "orderBy", r.orderBy, "") + } + if r.sortOrder != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "sortOrder", r.sortOrder, "") + } + if r.nextPageToken != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "nextPageToken", r.nextPageToken, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiUpdateInferenceServiceRequest struct { + ctx context.Context + ApiService *ModelRegistryServiceAPIService + inferenceserviceId string + inferenceServiceUpdate *InferenceServiceUpdate +} + +// Updated `InferenceService` information. +func (r ApiUpdateInferenceServiceRequest) InferenceServiceUpdate(inferenceServiceUpdate InferenceServiceUpdate) ApiUpdateInferenceServiceRequest { + r.inferenceServiceUpdate = &inferenceServiceUpdate + return r +} + +func (r ApiUpdateInferenceServiceRequest) Execute() (*InferenceService, *http.Response, error) { + return r.ApiService.UpdateInferenceServiceExecute(r) +} + +/* +UpdateInferenceService Update a InferenceService + +Updates an existing `InferenceService`. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param inferenceserviceId A unique identifier for a `InferenceService`. + @return ApiUpdateInferenceServiceRequest +*/ +func (a *ModelRegistryServiceAPIService) UpdateInferenceService(ctx context.Context, inferenceserviceId string) ApiUpdateInferenceServiceRequest { + return ApiUpdateInferenceServiceRequest{ + ApiService: a, + ctx: ctx, + inferenceserviceId: inferenceserviceId, + } +} + +// Execute executes the request +// +// @return InferenceService +func (a *ModelRegistryServiceAPIService) UpdateInferenceServiceExecute(r ApiUpdateInferenceServiceRequest) (*InferenceService, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *InferenceService + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ModelRegistryServiceAPIService.UpdateInferenceService") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/api/model_registry/v1alpha1/inference_services/{inferenceserviceId}" + localVarPath = strings.Replace(localVarPath, "{"+"inferenceserviceId"+"}", url.PathEscape(parameterValueToString(r.inferenceserviceId, "inferenceserviceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.inferenceServiceUpdate == nil { + return localVarReturnValue, nil, reportError("inferenceServiceUpdate is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.inferenceServiceUpdate + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiUpdateModelArtifactRequest struct { + ctx context.Context + ApiService *ModelRegistryServiceAPIService + modelartifactId string + modelArtifactUpdate *ModelArtifactUpdate +} + +// Updated `ModelArtifact` information. +func (r ApiUpdateModelArtifactRequest) ModelArtifactUpdate(modelArtifactUpdate ModelArtifactUpdate) ApiUpdateModelArtifactRequest { + r.modelArtifactUpdate = &modelArtifactUpdate + return r +} + +func (r ApiUpdateModelArtifactRequest) Execute() (*ModelArtifact, *http.Response, error) { + return r.ApiService.UpdateModelArtifactExecute(r) +} + +/* +UpdateModelArtifact Update a ModelArtifact + +Updates an existing `ModelArtifact`. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param modelartifactId A unique identifier for a `ModelArtifact`. + @return ApiUpdateModelArtifactRequest +*/ +func (a *ModelRegistryServiceAPIService) UpdateModelArtifact(ctx context.Context, modelartifactId string) ApiUpdateModelArtifactRequest { + return ApiUpdateModelArtifactRequest{ + ApiService: a, + ctx: ctx, + modelartifactId: modelartifactId, + } +} + +// Execute executes the request +// +// @return ModelArtifact +func (a *ModelRegistryServiceAPIService) UpdateModelArtifactExecute(r ApiUpdateModelArtifactRequest) (*ModelArtifact, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ModelArtifact + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ModelRegistryServiceAPIService.UpdateModelArtifact") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/api/model_registry/v1alpha1/model_artifacts/{modelartifactId}" + localVarPath = strings.Replace(localVarPath, "{"+"modelartifactId"+"}", url.PathEscape(parameterValueToString(r.modelartifactId, "modelartifactId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.modelArtifactUpdate == nil { + return localVarReturnValue, nil, reportError("modelArtifactUpdate is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.modelArtifactUpdate + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiUpdateModelVersionRequest struct { + ctx context.Context + ApiService *ModelRegistryServiceAPIService + modelversionId string + modelVersion *ModelVersion +} + +// Updated `ModelVersion` information. +func (r ApiUpdateModelVersionRequest) ModelVersion(modelVersion ModelVersion) ApiUpdateModelVersionRequest { + r.modelVersion = &modelVersion + return r +} + +func (r ApiUpdateModelVersionRequest) Execute() (*ModelVersion, *http.Response, error) { + return r.ApiService.UpdateModelVersionExecute(r) +} + +/* +UpdateModelVersion Update a ModelVersion + +Updates an existing `ModelVersion`. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param modelversionId A unique identifier for a `ModelVersion`. + @return ApiUpdateModelVersionRequest +*/ +func (a *ModelRegistryServiceAPIService) UpdateModelVersion(ctx context.Context, modelversionId string) ApiUpdateModelVersionRequest { + return ApiUpdateModelVersionRequest{ + ApiService: a, + ctx: ctx, + modelversionId: modelversionId, + } +} + +// Execute executes the request +// +// @return ModelVersion +func (a *ModelRegistryServiceAPIService) UpdateModelVersionExecute(r ApiUpdateModelVersionRequest) (*ModelVersion, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ModelVersion + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ModelRegistryServiceAPIService.UpdateModelVersion") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/api/model_registry/v1alpha1/model_versions/{modelversionId}" + localVarPath = strings.Replace(localVarPath, "{"+"modelversionId"+"}", url.PathEscape(parameterValueToString(r.modelversionId, "modelversionId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.modelVersion == nil { + return localVarReturnValue, nil, reportError("modelVersion is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.modelVersion + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiUpdateRegisteredModelRequest struct { + ctx context.Context + ApiService *ModelRegistryServiceAPIService + registeredmodelId string + registeredModelUpdate *RegisteredModelUpdate +} + +// Updated `RegisteredModel` information. +func (r ApiUpdateRegisteredModelRequest) RegisteredModelUpdate(registeredModelUpdate RegisteredModelUpdate) ApiUpdateRegisteredModelRequest { + r.registeredModelUpdate = ®isteredModelUpdate + return r +} + +func (r ApiUpdateRegisteredModelRequest) Execute() (*RegisteredModel, *http.Response, error) { + return r.ApiService.UpdateRegisteredModelExecute(r) +} + +/* +UpdateRegisteredModel Update a RegisteredModel + +Updates an existing `RegisteredModel`. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param registeredmodelId A unique identifier for a `RegisteredModel`. + @return ApiUpdateRegisteredModelRequest +*/ +func (a *ModelRegistryServiceAPIService) UpdateRegisteredModel(ctx context.Context, registeredmodelId string) ApiUpdateRegisteredModelRequest { + return ApiUpdateRegisteredModelRequest{ + ApiService: a, + ctx: ctx, + registeredmodelId: registeredmodelId, + } +} + +// Execute executes the request +// +// @return RegisteredModel +func (a *ModelRegistryServiceAPIService) UpdateRegisteredModelExecute(r ApiUpdateRegisteredModelRequest) (*RegisteredModel, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RegisteredModel + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ModelRegistryServiceAPIService.UpdateRegisteredModel") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/api/model_registry/v1alpha1/registered_models/{registeredmodelId}" + localVarPath = strings.Replace(localVarPath, "{"+"registeredmodelId"+"}", url.PathEscape(parameterValueToString(r.registeredmodelId, "registeredmodelId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.registeredModelUpdate == nil { + return localVarReturnValue, nil, reportError("registeredModelUpdate is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.registeredModelUpdate + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiUpdateServingEnvironmentRequest struct { + ctx context.Context + ApiService *ModelRegistryServiceAPIService + servingenvironmentId string + servingEnvironmentUpdate *ServingEnvironmentUpdate +} + +// Updated `ServingEnvironment` information. +func (r ApiUpdateServingEnvironmentRequest) ServingEnvironmentUpdate(servingEnvironmentUpdate ServingEnvironmentUpdate) ApiUpdateServingEnvironmentRequest { + r.servingEnvironmentUpdate = &servingEnvironmentUpdate + return r +} + +func (r ApiUpdateServingEnvironmentRequest) Execute() (*ServingEnvironment, *http.Response, error) { + return r.ApiService.UpdateServingEnvironmentExecute(r) +} + +/* +UpdateServingEnvironment Update a ServingEnvironment + +Updates an existing `ServingEnvironment`. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param servingenvironmentId A unique identifier for a `ServingEnvironment`. + @return ApiUpdateServingEnvironmentRequest +*/ +func (a *ModelRegistryServiceAPIService) UpdateServingEnvironment(ctx context.Context, servingenvironmentId string) ApiUpdateServingEnvironmentRequest { + return ApiUpdateServingEnvironmentRequest{ + ApiService: a, + ctx: ctx, + servingenvironmentId: servingenvironmentId, + } +} + +// Execute executes the request +// +// @return ServingEnvironment +func (a *ModelRegistryServiceAPIService) UpdateServingEnvironmentExecute(r ApiUpdateServingEnvironmentRequest) (*ServingEnvironment, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ServingEnvironment + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ModelRegistryServiceAPIService.UpdateServingEnvironment") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/api/model_registry/v1alpha1/serving_environments/{servingenvironmentId}" + localVarPath = strings.Replace(localVarPath, "{"+"servingenvironmentId"+"}", url.PathEscape(parameterValueToString(r.servingenvironmentId, "servingenvironmentId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.servingEnvironmentUpdate == nil { + return localVarReturnValue, nil, reportError("servingEnvironmentUpdate is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.servingEnvironmentUpdate + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/internal/model/openapi/client.go b/internal/model/openapi/client.go new file mode 100644 index 000000000..2379badff --- /dev/null +++ b/internal/model/openapi/client.go @@ -0,0 +1,666 @@ +/* +Model Registry REST API + +REST API for Model Registry to create and manage ML model metadata + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "bytes" + "context" + "encoding/json" + "encoding/xml" + "errors" + "fmt" + "io" + "log" + "mime/multipart" + "net/http" + "net/http/httputil" + "net/url" + "os" + "path/filepath" + "reflect" + "regexp" + "strconv" + "strings" + "time" + "unicode/utf8" +) + +var ( + jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?json)`) + xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`) + queryParamSplit = regexp.MustCompile(`(^|&)([^&]+)`) + queryDescape = strings.NewReplacer("%5B", "[", "%5D", "]") +) + +// APIClient manages communication with the Model Registry REST API API v1.0.0 +// In most cases there should be only one, shared, APIClient. +type APIClient struct { + cfg *Configuration + common service // Reuse a single struct instead of allocating one for each service on the heap. + + // API Services + + ModelRegistryServiceAPI *ModelRegistryServiceAPIService +} + +type service struct { + client *APIClient +} + +// NewAPIClient creates a new API client. Requires a userAgent string describing your application. +// optionally a custom http.Client to allow for advanced features such as caching. +func NewAPIClient(cfg *Configuration) *APIClient { + if cfg.HTTPClient == nil { + cfg.HTTPClient = http.DefaultClient + } + + c := &APIClient{} + c.cfg = cfg + c.common.client = c + + // API Services + c.ModelRegistryServiceAPI = (*ModelRegistryServiceAPIService)(&c.common) + + return c +} + +func atoi(in string) (int, error) { + return strconv.Atoi(in) +} + +// selectHeaderContentType select a content type from the available list. +func selectHeaderContentType(contentTypes []string) string { + if len(contentTypes) == 0 { + return "" + } + if contains(contentTypes, "application/json") { + return "application/json" + } + return contentTypes[0] // use the first content type specified in 'consumes' +} + +// selectHeaderAccept join all accept types and return +func selectHeaderAccept(accepts []string) string { + if len(accepts) == 0 { + return "" + } + + if contains(accepts, "application/json") { + return "application/json" + } + + return strings.Join(accepts, ",") +} + +// contains is a case insensitive match, finding needle in a haystack +func contains(haystack []string, needle string) bool { + for _, a := range haystack { + if strings.EqualFold(a, needle) { + return true + } + } + return false +} + +// Verify optional parameters are of the correct type. +func typeCheckParameter(obj interface{}, expected string, name string) error { + // Make sure there is an object. + if obj == nil { + return nil + } + + // Check the type is as expected. + if reflect.TypeOf(obj).String() != expected { + return fmt.Errorf("expected %s to be of type %s but received %s", name, expected, reflect.TypeOf(obj).String()) + } + return nil +} + +func parameterValueToString(obj interface{}, key string) string { + if reflect.TypeOf(obj).Kind() != reflect.Ptr { + return fmt.Sprintf("%v", obj) + } + var param, ok = obj.(MappedNullable) + if !ok { + return "" + } + dataMap, err := param.ToMap() + if err != nil { + return "" + } + return fmt.Sprintf("%v", dataMap[key]) +} + +// parameterAddToHeaderOrQuery adds the provided object to the request header or url query +// supporting deep object syntax +func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, collectionType string) { + var v = reflect.ValueOf(obj) + var value = "" + if v == reflect.ValueOf(nil) { + value = "null" + } else { + switch v.Kind() { + case reflect.Invalid: + value = "invalid" + + case reflect.Struct: + if t, ok := obj.(MappedNullable); ok { + dataMap, err := t.ToMap() + if err != nil { + return + } + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, dataMap, collectionType) + return + } + if t, ok := obj.(time.Time); ok { + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, t.Format(time.RFC3339), collectionType) + return + } + value = v.Type().String() + " value" + case reflect.Slice: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + var lenIndValue = indValue.Len() + for i := 0; i < lenIndValue; i++ { + var arrayValue = indValue.Index(i) + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, arrayValue.Interface(), collectionType) + } + return + + case reflect.Map: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + iter := indValue.MapRange() + for iter.Next() { + k, v := iter.Key(), iter.Value() + parameterAddToHeaderOrQuery(headerOrQueryParams, fmt.Sprintf("%s[%s]", keyPrefix, k.String()), v.Interface(), collectionType) + } + return + + case reflect.Interface: + fallthrough + case reflect.Ptr: + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, v.Elem().Interface(), collectionType) + return + + case reflect.Int, reflect.Int8, reflect.Int16, + reflect.Int32, reflect.Int64: + value = strconv.FormatInt(v.Int(), 10) + case reflect.Uint, reflect.Uint8, reflect.Uint16, + reflect.Uint32, reflect.Uint64, reflect.Uintptr: + value = strconv.FormatUint(v.Uint(), 10) + case reflect.Float32, reflect.Float64: + value = strconv.FormatFloat(v.Float(), 'g', -1, 32) + case reflect.Bool: + value = strconv.FormatBool(v.Bool()) + case reflect.String: + value = v.String() + default: + value = v.Type().String() + " value" + } + } + + switch valuesMap := headerOrQueryParams.(type) { + case url.Values: + if collectionType == "csv" && valuesMap.Get(keyPrefix) != "" { + valuesMap.Set(keyPrefix, valuesMap.Get(keyPrefix)+","+value) + } else { + valuesMap.Add(keyPrefix, value) + } + break + case map[string]string: + valuesMap[keyPrefix] = value + break + } +} + +// helper for converting interface{} parameters to json strings +func parameterToJson(obj interface{}) (string, error) { + jsonBuf, err := json.Marshal(obj) + if err != nil { + return "", err + } + return string(jsonBuf), err +} + +// callAPI do the request. +func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { + if c.cfg.Debug { + dump, err := httputil.DumpRequestOut(request, true) + if err != nil { + return nil, err + } + log.Printf("\n%s\n", string(dump)) + } + + resp, err := c.cfg.HTTPClient.Do(request) + if err != nil { + return resp, err + } + + if c.cfg.Debug { + dump, err := httputil.DumpResponse(resp, true) + if err != nil { + return resp, err + } + log.Printf("\n%s\n", string(dump)) + } + return resp, err +} + +// Allow modification of underlying config for alternate implementations and testing +// Caution: modifying the configuration while live can cause data races and potentially unwanted behavior +func (c *APIClient) GetConfig() *Configuration { + return c.cfg +} + +type formFile struct { + fileBytes []byte + fileName string + formFileName string +} + +// prepareRequest build the request +func (c *APIClient) prepareRequest( + ctx context.Context, + path string, method string, + postBody interface{}, + headerParams map[string]string, + queryParams url.Values, + formParams url.Values, + formFiles []formFile) (localVarRequest *http.Request, err error) { + + var body *bytes.Buffer + + // Detect postBody type and post. + if postBody != nil { + contentType := headerParams["Content-Type"] + if contentType == "" { + contentType = detectContentType(postBody) + headerParams["Content-Type"] = contentType + } + + body, err = setBody(postBody, contentType) + if err != nil { + return nil, err + } + } + + // add form parameters and file if available. + if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(formFiles) > 0) { + if body != nil { + return nil, errors.New("Cannot specify postBody and multipart form at the same time.") + } + body = &bytes.Buffer{} + w := multipart.NewWriter(body) + + for k, v := range formParams { + for _, iv := range v { + if strings.HasPrefix(k, "@") { // file + err = addFile(w, k[1:], iv) + if err != nil { + return nil, err + } + } else { // form value + w.WriteField(k, iv) + } + } + } + for _, formFile := range formFiles { + if len(formFile.fileBytes) > 0 && formFile.fileName != "" { + w.Boundary() + part, err := w.CreateFormFile(formFile.formFileName, filepath.Base(formFile.fileName)) + if err != nil { + return nil, err + } + _, err = part.Write(formFile.fileBytes) + if err != nil { + return nil, err + } + } + } + + // Set the Boundary in the Content-Type + headerParams["Content-Type"] = w.FormDataContentType() + + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + w.Close() + } + + if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { + if body != nil { + return nil, errors.New("Cannot specify postBody and x-www-form-urlencoded form at the same time.") + } + body = &bytes.Buffer{} + body.WriteString(formParams.Encode()) + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + } + + // Setup path and query parameters + url, err := url.Parse(path) + if err != nil { + return nil, err + } + + // Override request host, if applicable + if c.cfg.Host != "" { + url.Host = c.cfg.Host + } + + // Override request scheme, if applicable + if c.cfg.Scheme != "" { + url.Scheme = c.cfg.Scheme + } + + // Adding Query Param + query := url.Query() + for k, v := range queryParams { + for _, iv := range v { + query.Add(k, iv) + } + } + + // Encode the parameters. + url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { + pieces := strings.Split(s, "=") + pieces[0] = queryDescape.Replace(pieces[0]) + return strings.Join(pieces, "=") + }) + + // Generate a new request + if body != nil { + localVarRequest, err = http.NewRequest(method, url.String(), body) + } else { + localVarRequest, err = http.NewRequest(method, url.String(), nil) + } + if err != nil { + return nil, err + } + + // add header parameters, if any + if len(headerParams) > 0 { + headers := http.Header{} + for h, v := range headerParams { + headers[h] = []string{v} + } + localVarRequest.Header = headers + } + + // Add the user agent to the request. + localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) + + if ctx != nil { + // add context to the request + localVarRequest = localVarRequest.WithContext(ctx) + + // Walk through any authentication. + + // AccessToken Authentication + if auth, ok := ctx.Value(ContextAccessToken).(string); ok { + localVarRequest.Header.Add("Authorization", "Bearer "+auth) + } + + } + + for header, value := range c.cfg.DefaultHeader { + localVarRequest.Header.Add(header, value) + } + return localVarRequest, nil +} + +func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { + if len(b) == 0 { + return nil + } + if s, ok := v.(*string); ok { + *s = string(b) + return nil + } + if f, ok := v.(*os.File); ok { + f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = f.Write(b) + if err != nil { + return + } + _, err = f.Seek(0, io.SeekStart) + err = os.Remove(f.Name()) + return + } + if f, ok := v.(**os.File); ok { + *f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = (*f).Write(b) + if err != nil { + return + } + _, err = (*f).Seek(0, io.SeekStart) + err = os.Remove((*f).Name()) + return + } + if xmlCheck.MatchString(contentType) { + if err = xml.Unmarshal(b, v); err != nil { + return err + } + return nil + } + if jsonCheck.MatchString(contentType) { + if actualObj, ok := v.(interface{ GetActualInstance() interface{} }); ok { // oneOf, anyOf schemas + if unmarshalObj, ok := actualObj.(interface{ UnmarshalJSON([]byte) error }); ok { // make sure it has UnmarshalJSON defined + if err = unmarshalObj.UnmarshalJSON(b); err != nil { + return err + } + } else { + return errors.New("Unknown type with GetActualInstance but no unmarshalObj.UnmarshalJSON defined") + } + } else if err = json.Unmarshal(b, v); err != nil { // simple model + return err + } + return nil + } + return errors.New("undefined response type") +} + +// Add a file to the multipart request +func addFile(w *multipart.Writer, fieldName, path string) error { + file, err := os.Open(filepath.Clean(path)) + if err != nil { + return err + } + err = file.Close() + if err != nil { + return err + } + + part, err := w.CreateFormFile(fieldName, filepath.Base(path)) + if err != nil { + return err + } + _, err = io.Copy(part, file) + + return err +} + +// Prevent trying to import "fmt" +func reportError(format string, a ...interface{}) error { + return fmt.Errorf(format, a...) +} + +// A wrapper for strict JSON decoding +func newStrictDecoder(data []byte) *json.Decoder { + dec := json.NewDecoder(bytes.NewBuffer(data)) + dec.DisallowUnknownFields() + return dec +} + +// Set request body from an interface{} +func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { + if bodyBuf == nil { + bodyBuf = &bytes.Buffer{} + } + + if reader, ok := body.(io.Reader); ok { + _, err = bodyBuf.ReadFrom(reader) + } else if fp, ok := body.(*os.File); ok { + _, err = bodyBuf.ReadFrom(fp) + } else if b, ok := body.([]byte); ok { + _, err = bodyBuf.Write(b) + } else if s, ok := body.(string); ok { + _, err = bodyBuf.WriteString(s) + } else if s, ok := body.(*string); ok { + _, err = bodyBuf.WriteString(*s) + } else if jsonCheck.MatchString(contentType) { + err = json.NewEncoder(bodyBuf).Encode(body) + } else if xmlCheck.MatchString(contentType) { + var bs []byte + bs, err = xml.Marshal(body) + if err == nil { + bodyBuf.Write(bs) + } + } + + if err != nil { + return nil, err + } + + if bodyBuf.Len() == 0 { + err = fmt.Errorf("invalid body type %s\n", contentType) + return nil, err + } + return bodyBuf, nil +} + +// detectContentType method is used to figure out `Request.Body` content type for request header +func detectContentType(body interface{}) string { + contentType := "text/plain; charset=utf-8" + kind := reflect.TypeOf(body).Kind() + + switch kind { + case reflect.Struct, reflect.Map, reflect.Ptr: + contentType = "application/json; charset=utf-8" + case reflect.String: + contentType = "text/plain; charset=utf-8" + default: + if b, ok := body.([]byte); ok { + contentType = http.DetectContentType(b) + } else if kind == reflect.Slice { + contentType = "application/json; charset=utf-8" + } + } + + return contentType +} + +// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go +type cacheControl map[string]string + +func parseCacheControl(headers http.Header) cacheControl { + cc := cacheControl{} + ccHeader := headers.Get("Cache-Control") + for _, part := range strings.Split(ccHeader, ",") { + part = strings.Trim(part, " ") + if part == "" { + continue + } + if strings.ContainsRune(part, '=') { + keyval := strings.Split(part, "=") + cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",") + } else { + cc[part] = "" + } + } + return cc +} + +// CacheExpires helper function to determine remaining time before repeating a request. +func CacheExpires(r *http.Response) time.Time { + // Figure out when the cache expires. + var expires time.Time + now, err := time.Parse(time.RFC1123, r.Header.Get("date")) + if err != nil { + return time.Now() + } + respCacheControl := parseCacheControl(r.Header) + + if maxAge, ok := respCacheControl["max-age"]; ok { + lifetime, err := time.ParseDuration(maxAge + "s") + if err != nil { + expires = now + } else { + expires = now.Add(lifetime) + } + } else { + expiresHeader := r.Header.Get("Expires") + if expiresHeader != "" { + expires, err = time.Parse(time.RFC1123, expiresHeader) + if err != nil { + expires = now + } + } + } + return expires +} + +func strlen(s string) int { + return utf8.RuneCountInString(s) +} + +// GenericOpenAPIError Provides access to the body, error and model on returned errors. +type GenericOpenAPIError struct { + body []byte + error string + model interface{} +} + +// Error returns non-empty string if there was an error. +func (e GenericOpenAPIError) Error() string { + return e.error +} + +// Body returns the raw bytes of the response +func (e GenericOpenAPIError) Body() []byte { + return e.body +} + +// Model returns the unpacked model of the error +func (e GenericOpenAPIError) Model() interface{} { + return e.model +} + +// format error message using title and detail when model implements rfc7807 +func formatErrorMessage(status string, v interface{}) string { + str := "" + metaValue := reflect.ValueOf(v).Elem() + + if metaValue.Kind() == reflect.Struct { + field := metaValue.FieldByName("Title") + if field != (reflect.Value{}) { + str = fmt.Sprintf("%s", field.Interface()) + } + + field = metaValue.FieldByName("Detail") + if field != (reflect.Value{}) { + str = fmt.Sprintf("%s (%s)", str, field.Interface()) + } + } + + return strings.TrimSpace(fmt.Sprintf("%s %s", status, str)) +} diff --git a/internal/model/openapi/configuration.go b/internal/model/openapi/configuration.go new file mode 100644 index 000000000..28faea4a4 --- /dev/null +++ b/internal/model/openapi/configuration.go @@ -0,0 +1,217 @@ +/* +Model Registry REST API + +REST API for Model Registry to create and manage ML model metadata + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "context" + "fmt" + "net/http" + "strings" +) + +// contextKeys are used to identify the type of value in the context. +// Since these are string, it is possible to get a short description of the +// context key for logging and debugging using key.String(). + +type contextKey string + +func (c contextKey) String() string { + return "auth " + string(c) +} + +var ( + // ContextAccessToken takes a string oauth2 access token as authentication for the request. + ContextAccessToken = contextKey("accesstoken") + + // ContextServerIndex uses a server configuration from the index. + ContextServerIndex = contextKey("serverIndex") + + // ContextOperationServerIndices uses a server configuration from the index mapping. + ContextOperationServerIndices = contextKey("serverOperationIndices") + + // ContextServerVariables overrides a server configuration variables. + ContextServerVariables = contextKey("serverVariables") + + // ContextOperationServerVariables overrides a server configuration variables using operation specific values. + ContextOperationServerVariables = contextKey("serverOperationVariables") +) + +// BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth +type BasicAuth struct { + UserName string `json:"userName,omitempty"` + Password string `json:"password,omitempty"` +} + +// APIKey provides API key based authentication to a request passed via context using ContextAPIKey +type APIKey struct { + Key string + Prefix string +} + +// ServerVariable stores the information about a server variable +type ServerVariable struct { + Description string + DefaultValue string + EnumValues []string +} + +// ServerConfiguration stores the information about a server +type ServerConfiguration struct { + URL string + Description string + Variables map[string]ServerVariable +} + +// ServerConfigurations stores multiple ServerConfiguration items +type ServerConfigurations []ServerConfiguration + +// Configuration stores the configuration of the API client +type Configuration struct { + Host string `json:"host,omitempty"` + Scheme string `json:"scheme,omitempty"` + DefaultHeader map[string]string `json:"defaultHeader,omitempty"` + UserAgent string `json:"userAgent,omitempty"` + Debug bool `json:"debug,omitempty"` + Servers ServerConfigurations + OperationServers map[string]ServerConfigurations + HTTPClient *http.Client +} + +// NewConfiguration returns a new Configuration object +func NewConfiguration() *Configuration { + cfg := &Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Servers: ServerConfigurations{ + { + URL: "https://localhost:8080", + Description: "No description provided", + }, + }, + OperationServers: map[string]ServerConfigurations{}, + } + return cfg +} + +// AddDefaultHeader adds a new HTTP header to the default header in the request +func (c *Configuration) AddDefaultHeader(key string, value string) { + c.DefaultHeader[key] = value +} + +// URL formats template on a index using given variables +func (sc ServerConfigurations) URL(index int, variables map[string]string) (string, error) { + if index < 0 || len(sc) <= index { + return "", fmt.Errorf("index %v out of range %v", index, len(sc)-1) + } + server := sc[index] + url := server.URL + + // go through variables and replace placeholders + for name, variable := range server.Variables { + if value, ok := variables[name]; ok { + found := bool(len(variable.EnumValues) == 0) + for _, enumValue := range variable.EnumValues { + if value == enumValue { + found = true + } + } + if !found { + return "", fmt.Errorf("the variable %s in the server URL has invalid value %v. Must be %v", name, value, variable.EnumValues) + } + url = strings.Replace(url, "{"+name+"}", value, -1) + } else { + url = strings.Replace(url, "{"+name+"}", variable.DefaultValue, -1) + } + } + return url, nil +} + +// ServerURL returns URL based on server settings +func (c *Configuration) ServerURL(index int, variables map[string]string) (string, error) { + return c.Servers.URL(index, variables) +} + +func getServerIndex(ctx context.Context) (int, error) { + si := ctx.Value(ContextServerIndex) + if si != nil { + if index, ok := si.(int); ok { + return index, nil + } + return 0, reportError("Invalid type %T should be int", si) + } + return 0, nil +} + +func getServerOperationIndex(ctx context.Context, endpoint string) (int, error) { + osi := ctx.Value(ContextOperationServerIndices) + if osi != nil { + if operationIndices, ok := osi.(map[string]int); !ok { + return 0, reportError("Invalid type %T should be map[string]int", osi) + } else { + index, ok := operationIndices[endpoint] + if ok { + return index, nil + } + } + } + return getServerIndex(ctx) +} + +func getServerVariables(ctx context.Context) (map[string]string, error) { + sv := ctx.Value(ContextServerVariables) + if sv != nil { + if variables, ok := sv.(map[string]string); ok { + return variables, nil + } + return nil, reportError("ctx value of ContextServerVariables has invalid type %T should be map[string]string", sv) + } + return nil, nil +} + +func getServerOperationVariables(ctx context.Context, endpoint string) (map[string]string, error) { + osv := ctx.Value(ContextOperationServerVariables) + if osv != nil { + if operationVariables, ok := osv.(map[string]map[string]string); !ok { + return nil, reportError("ctx value of ContextOperationServerVariables has invalid type %T should be map[string]map[string]string", osv) + } else { + variables, ok := operationVariables[endpoint] + if ok { + return variables, nil + } + } + } + return getServerVariables(ctx) +} + +// ServerURLWithContext returns a new server URL given an endpoint +func (c *Configuration) ServerURLWithContext(ctx context.Context, endpoint string) (string, error) { + sc, ok := c.OperationServers[endpoint] + if !ok { + sc = c.Servers + } + + if ctx == nil { + return sc.URL(0, nil) + } + + index, err := getServerOperationIndex(ctx, endpoint) + if err != nil { + return "", err + } + + variables, err := getServerOperationVariables(ctx, endpoint) + if err != nil { + return "", err + } + + return sc.URL(index, variables) +} diff --git a/internal/model/openapi/model_artifact.go b/internal/model/openapi/model_artifact.go new file mode 100644 index 000000000..af2f5b890 --- /dev/null +++ b/internal/model/openapi/model_artifact.go @@ -0,0 +1,123 @@ +/* +Model Registry REST API + +REST API for Model Registry to create and manage ML model metadata + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "fmt" +) + +// Artifact - A metadata Artifact Entity. +type Artifact struct { + ModelArtifact *ModelArtifact +} + +// ModelArtifactAsArtifact is a convenience function that returns ModelArtifact wrapped in Artifact +func ModelArtifactAsArtifact(v *ModelArtifact) Artifact { + return Artifact{ + ModelArtifact: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *Artifact) UnmarshalJSON(data []byte) error { + var err error + // use discriminator value to speed up the lookup + var jsonDict map[string]interface{} + err = newStrictDecoder(data).Decode(&jsonDict) + if err != nil { + return fmt.Errorf("failed to unmarshal JSON into map for the discriminator lookup") + } + + // check if the discriminator value is 'ModelArtifact' + if jsonDict["artifactType"] == "ModelArtifact" { + // try to unmarshal JSON data into ModelArtifact + err = json.Unmarshal(data, &dst.ModelArtifact) + if err == nil { + return nil // data stored in dst.ModelArtifact, return on the first match + } else { + dst.ModelArtifact = nil + return fmt.Errorf("failed to unmarshal Artifact as ModelArtifact: %s", err.Error()) + } + } + + // check if the discriminator value is 'model-artifact' + if jsonDict["artifactType"] == "model-artifact" { + // try to unmarshal JSON data into ModelArtifact + err = json.Unmarshal(data, &dst.ModelArtifact) + if err == nil { + return nil // data stored in dst.ModelArtifact, return on the first match + } else { + dst.ModelArtifact = nil + return fmt.Errorf("failed to unmarshal Artifact as ModelArtifact: %s", err.Error()) + } + } + + return nil +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src Artifact) MarshalJSON() ([]byte, error) { + if src.ModelArtifact != nil { + return json.Marshal(&src.ModelArtifact) + } + + return nil, nil // no data in oneOf schemas +} + +// Get the actual instance +func (obj *Artifact) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.ModelArtifact != nil { + return obj.ModelArtifact + } + + // all schemas are nil + return nil +} + +type NullableArtifact struct { + value *Artifact + isSet bool +} + +func (v NullableArtifact) Get() *Artifact { + return v.value +} + +func (v *NullableArtifact) Set(val *Artifact) { + v.value = val + v.isSet = true +} + +func (v NullableArtifact) IsSet() bool { + return v.isSet +} + +func (v *NullableArtifact) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableArtifact(val *Artifact) *NullableArtifact { + return &NullableArtifact{value: val, isSet: true} +} + +func (v NullableArtifact) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableArtifact) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/model/openapi/model_artifact_list.go b/internal/model/openapi/model_artifact_list.go new file mode 100644 index 000000000..6eae5347b --- /dev/null +++ b/internal/model/openapi/model_artifact_list.go @@ -0,0 +1,209 @@ +/* +Model Registry REST API + +REST API for Model Registry to create and manage ML model metadata + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the ArtifactList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ArtifactList{} + +// ArtifactList A list of Artifact entities. +type ArtifactList struct { + // Token to use to retrieve next page of results. + NextPageToken string `json:"nextPageToken"` + // Maximum number of resources to return in the result. + PageSize int32 `json:"pageSize"` + // Number of items in result list. + Size int32 `json:"size"` + // Array of `Artifact` entities. + Items []Artifact `json:"items,omitempty"` +} + +// NewArtifactList instantiates a new ArtifactList object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewArtifactList(nextPageToken string, pageSize int32, size int32) *ArtifactList { + this := ArtifactList{} + this.NextPageToken = nextPageToken + this.PageSize = pageSize + this.Size = size + return &this +} + +// NewArtifactListWithDefaults instantiates a new ArtifactList object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewArtifactListWithDefaults() *ArtifactList { + this := ArtifactList{} + return &this +} + +// GetNextPageToken returns the NextPageToken field value +func (o *ArtifactList) GetNextPageToken() string { + if o == nil { + var ret string + return ret + } + + return o.NextPageToken +} + +// GetNextPageTokenOk returns a tuple with the NextPageToken field value +// and a boolean to check if the value has been set. +func (o *ArtifactList) GetNextPageTokenOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.NextPageToken, true +} + +// SetNextPageToken sets field value +func (o *ArtifactList) SetNextPageToken(v string) { + o.NextPageToken = v +} + +// GetPageSize returns the PageSize field value +func (o *ArtifactList) GetPageSize() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.PageSize +} + +// GetPageSizeOk returns a tuple with the PageSize field value +// and a boolean to check if the value has been set. +func (o *ArtifactList) GetPageSizeOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.PageSize, true +} + +// SetPageSize sets field value +func (o *ArtifactList) SetPageSize(v int32) { + o.PageSize = v +} + +// GetSize returns the Size field value +func (o *ArtifactList) GetSize() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Size +} + +// GetSizeOk returns a tuple with the Size field value +// and a boolean to check if the value has been set. +func (o *ArtifactList) GetSizeOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Size, true +} + +// SetSize sets field value +func (o *ArtifactList) SetSize(v int32) { + o.Size = v +} + +// GetItems returns the Items field value if set, zero value otherwise. +func (o *ArtifactList) GetItems() []Artifact { + if o == nil || IsNil(o.Items) { + var ret []Artifact + return ret + } + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ArtifactList) GetItemsOk() ([]Artifact, bool) { + if o == nil || IsNil(o.Items) { + return nil, false + } + return o.Items, true +} + +// HasItems returns a boolean if a field has been set. +func (o *ArtifactList) HasItems() bool { + if o != nil && !IsNil(o.Items) { + return true + } + + return false +} + +// SetItems gets a reference to the given []Artifact and assigns it to the Items field. +func (o *ArtifactList) SetItems(v []Artifact) { + o.Items = v +} + +func (o ArtifactList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ArtifactList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["nextPageToken"] = o.NextPageToken + toSerialize["pageSize"] = o.PageSize + toSerialize["size"] = o.Size + if !IsNil(o.Items) { + toSerialize["items"] = o.Items + } + return toSerialize, nil +} + +type NullableArtifactList struct { + value *ArtifactList + isSet bool +} + +func (v NullableArtifactList) Get() *ArtifactList { + return v.value +} + +func (v *NullableArtifactList) Set(val *ArtifactList) { + v.value = val + v.isSet = true +} + +func (v NullableArtifactList) IsSet() bool { + return v.isSet +} + +func (v *NullableArtifactList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableArtifactList(val *ArtifactList) *NullableArtifactList { + return &NullableArtifactList{value: val, isSet: true} +} + +func (v NullableArtifactList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableArtifactList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/model/openapi/model_artifact_state.go b/internal/model/openapi/model_artifact_state.go new file mode 100644 index 000000000..d377ac0d7 --- /dev/null +++ b/internal/model/openapi/model_artifact_state.go @@ -0,0 +1,120 @@ +/* +Model Registry REST API + +REST API for Model Registry to create and manage ML model metadata + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "fmt" +) + +// ArtifactState - PENDING: A state indicating that the artifact may exist. - LIVE: A state indicating that the artifact should exist, unless something external to the system deletes it. - MARKED_FOR_DELETION: A state indicating that the artifact should be deleted. - DELETED: A state indicating that the artifact has been deleted. - ABANDONED: A state indicating that the artifact has been abandoned, which may be due to a failed or cancelled execution. - REFERENCE: A state indicating that the artifact is a reference artifact. At execution start time, the orchestrator produces an output artifact for each output key with state PENDING. However, for an intermediate artifact, this first artifact's state will be REFERENCE. Intermediate artifacts emitted during a component's execution will copy the REFERENCE artifact's attributes. At the end of an execution, the artifact state should remain REFERENCE instead of being changed to LIVE. See also: ml-metadata Artifact.State +type ArtifactState string + +// List of ArtifactState +const ( + ARTIFACTSTATE_UNKNOWN ArtifactState = "UNKNOWN" + ARTIFACTSTATE_PENDING ArtifactState = "PENDING" + ARTIFACTSTATE_LIVE ArtifactState = "LIVE" + ARTIFACTSTATE_MARKED_FOR_DELETION ArtifactState = "MARKED_FOR_DELETION" + ARTIFACTSTATE_DELETED ArtifactState = "DELETED" + ARTIFACTSTATE_ABANDONED ArtifactState = "ABANDONED" + ARTIFACTSTATE_REFERENCE ArtifactState = "REFERENCE" +) + +// All allowed values of ArtifactState enum +var AllowedArtifactStateEnumValues = []ArtifactState{ + "UNKNOWN", + "PENDING", + "LIVE", + "MARKED_FOR_DELETION", + "DELETED", + "ABANDONED", + "REFERENCE", +} + +func (v *ArtifactState) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := ArtifactState(value) + for _, existing := range AllowedArtifactStateEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid ArtifactState", value) +} + +// NewArtifactStateFromValue returns a pointer to a valid ArtifactState +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewArtifactStateFromValue(v string) (*ArtifactState, error) { + ev := ArtifactState(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for ArtifactState: valid values are %v", v, AllowedArtifactStateEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v ArtifactState) IsValid() bool { + for _, existing := range AllowedArtifactStateEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to ArtifactState value +func (v ArtifactState) Ptr() *ArtifactState { + return &v +} + +type NullableArtifactState struct { + value *ArtifactState + isSet bool +} + +func (v NullableArtifactState) Get() *ArtifactState { + return v.value +} + +func (v *NullableArtifactState) Set(val *ArtifactState) { + v.value = val + v.isSet = true +} + +func (v NullableArtifactState) IsSet() bool { + return v.isSet +} + +func (v *NullableArtifactState) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableArtifactState(val *ArtifactState) *NullableArtifactState { + return &NullableArtifactState{value: val, isSet: true} +} + +func (v NullableArtifactState) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableArtifactState) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/model/openapi/model_base_artifact.go b/internal/model/openapi/model_base_artifact.go new file mode 100644 index 000000000..3908cc5f2 --- /dev/null +++ b/internal/model/openapi/model_base_artifact.go @@ -0,0 +1,414 @@ +/* +Model Registry REST API + +REST API for Model Registry to create and manage ML model metadata + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the BaseArtifact type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BaseArtifact{} + +// BaseArtifact struct for BaseArtifact +type BaseArtifact struct { + // User provided custom properties which are not defined by its type. + CustomProperties *map[string]MetadataValue `json:"customProperties,omitempty"` + // The external id that come from the clients’ system. This field is optional. If set, it must be unique among all resources within a database instance. + ExternalID *string `json:"externalID,omitempty"` + // The uniform resource identifier of the physical artifact. May be empty if there is no physical artifact. + Uri *string `json:"uri,omitempty"` + State *ArtifactState `json:"state,omitempty"` + // The client provided name of the artifact. This field is optional. If set, it must be unique among all the artifacts of the same artifact type within a database instance and cannot be changed once set. + Name *string `json:"name,omitempty"` + // Output only. The unique server generated id of the resource. + Id *string `json:"id,omitempty"` + // Output only. Create time of the resource in millisecond since epoch. + CreateTimeSinceEpoch *string `json:"createTimeSinceEpoch,omitempty"` + // Output only. Last update time of the resource since epoch in millisecond since epoch. + LastUpdateTimeSinceEpoch *string `json:"lastUpdateTimeSinceEpoch,omitempty"` + ArtifactType string `json:"artifactType"` +} + +// NewBaseArtifact instantiates a new BaseArtifact object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewBaseArtifact(artifactType string) *BaseArtifact { + this := BaseArtifact{} + var state ArtifactState = ARTIFACTSTATE_UNKNOWN + this.State = &state + this.ArtifactType = artifactType + return &this +} + +// NewBaseArtifactWithDefaults instantiates a new BaseArtifact object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewBaseArtifactWithDefaults() *BaseArtifact { + this := BaseArtifact{} + var state ArtifactState = ARTIFACTSTATE_UNKNOWN + this.State = &state + return &this +} + +// GetCustomProperties returns the CustomProperties field value if set, zero value otherwise. +func (o *BaseArtifact) GetCustomProperties() map[string]MetadataValue { + if o == nil || IsNil(o.CustomProperties) { + var ret map[string]MetadataValue + return ret + } + return *o.CustomProperties +} + +// GetCustomPropertiesOk returns a tuple with the CustomProperties field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseArtifact) GetCustomPropertiesOk() (*map[string]MetadataValue, bool) { + if o == nil || IsNil(o.CustomProperties) { + return nil, false + } + return o.CustomProperties, true +} + +// HasCustomProperties returns a boolean if a field has been set. +func (o *BaseArtifact) HasCustomProperties() bool { + if o != nil && !IsNil(o.CustomProperties) { + return true + } + + return false +} + +// SetCustomProperties gets a reference to the given map[string]MetadataValue and assigns it to the CustomProperties field. +func (o *BaseArtifact) SetCustomProperties(v map[string]MetadataValue) { + o.CustomProperties = &v +} + +// GetExternalID returns the ExternalID field value if set, zero value otherwise. +func (o *BaseArtifact) GetExternalID() string { + if o == nil || IsNil(o.ExternalID) { + var ret string + return ret + } + return *o.ExternalID +} + +// GetExternalIDOk returns a tuple with the ExternalID field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseArtifact) GetExternalIDOk() (*string, bool) { + if o == nil || IsNil(o.ExternalID) { + return nil, false + } + return o.ExternalID, true +} + +// HasExternalID returns a boolean if a field has been set. +func (o *BaseArtifact) HasExternalID() bool { + if o != nil && !IsNil(o.ExternalID) { + return true + } + + return false +} + +// SetExternalID gets a reference to the given string and assigns it to the ExternalID field. +func (o *BaseArtifact) SetExternalID(v string) { + o.ExternalID = &v +} + +// GetUri returns the Uri field value if set, zero value otherwise. +func (o *BaseArtifact) GetUri() string { + if o == nil || IsNil(o.Uri) { + var ret string + return ret + } + return *o.Uri +} + +// GetUriOk returns a tuple with the Uri field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseArtifact) GetUriOk() (*string, bool) { + if o == nil || IsNil(o.Uri) { + return nil, false + } + return o.Uri, true +} + +// HasUri returns a boolean if a field has been set. +func (o *BaseArtifact) HasUri() bool { + if o != nil && !IsNil(o.Uri) { + return true + } + + return false +} + +// SetUri gets a reference to the given string and assigns it to the Uri field. +func (o *BaseArtifact) SetUri(v string) { + o.Uri = &v +} + +// GetState returns the State field value if set, zero value otherwise. +func (o *BaseArtifact) GetState() ArtifactState { + if o == nil || IsNil(o.State) { + var ret ArtifactState + return ret + } + return *o.State +} + +// GetStateOk returns a tuple with the State field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseArtifact) GetStateOk() (*ArtifactState, bool) { + if o == nil || IsNil(o.State) { + return nil, false + } + return o.State, true +} + +// HasState returns a boolean if a field has been set. +func (o *BaseArtifact) HasState() bool { + if o != nil && !IsNil(o.State) { + return true + } + + return false +} + +// SetState gets a reference to the given ArtifactState and assigns it to the State field. +func (o *BaseArtifact) SetState(v ArtifactState) { + o.State = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *BaseArtifact) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseArtifact) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *BaseArtifact) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *BaseArtifact) SetName(v string) { + o.Name = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *BaseArtifact) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseArtifact) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *BaseArtifact) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *BaseArtifact) SetId(v string) { + o.Id = &v +} + +// GetCreateTimeSinceEpoch returns the CreateTimeSinceEpoch field value if set, zero value otherwise. +func (o *BaseArtifact) GetCreateTimeSinceEpoch() string { + if o == nil || IsNil(o.CreateTimeSinceEpoch) { + var ret string + return ret + } + return *o.CreateTimeSinceEpoch +} + +// GetCreateTimeSinceEpochOk returns a tuple with the CreateTimeSinceEpoch field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseArtifact) GetCreateTimeSinceEpochOk() (*string, bool) { + if o == nil || IsNil(o.CreateTimeSinceEpoch) { + return nil, false + } + return o.CreateTimeSinceEpoch, true +} + +// HasCreateTimeSinceEpoch returns a boolean if a field has been set. +func (o *BaseArtifact) HasCreateTimeSinceEpoch() bool { + if o != nil && !IsNil(o.CreateTimeSinceEpoch) { + return true + } + + return false +} + +// SetCreateTimeSinceEpoch gets a reference to the given string and assigns it to the CreateTimeSinceEpoch field. +func (o *BaseArtifact) SetCreateTimeSinceEpoch(v string) { + o.CreateTimeSinceEpoch = &v +} + +// GetLastUpdateTimeSinceEpoch returns the LastUpdateTimeSinceEpoch field value if set, zero value otherwise. +func (o *BaseArtifact) GetLastUpdateTimeSinceEpoch() string { + if o == nil || IsNil(o.LastUpdateTimeSinceEpoch) { + var ret string + return ret + } + return *o.LastUpdateTimeSinceEpoch +} + +// GetLastUpdateTimeSinceEpochOk returns a tuple with the LastUpdateTimeSinceEpoch field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseArtifact) GetLastUpdateTimeSinceEpochOk() (*string, bool) { + if o == nil || IsNil(o.LastUpdateTimeSinceEpoch) { + return nil, false + } + return o.LastUpdateTimeSinceEpoch, true +} + +// HasLastUpdateTimeSinceEpoch returns a boolean if a field has been set. +func (o *BaseArtifact) HasLastUpdateTimeSinceEpoch() bool { + if o != nil && !IsNil(o.LastUpdateTimeSinceEpoch) { + return true + } + + return false +} + +// SetLastUpdateTimeSinceEpoch gets a reference to the given string and assigns it to the LastUpdateTimeSinceEpoch field. +func (o *BaseArtifact) SetLastUpdateTimeSinceEpoch(v string) { + o.LastUpdateTimeSinceEpoch = &v +} + +// GetArtifactType returns the ArtifactType field value +func (o *BaseArtifact) GetArtifactType() string { + if o == nil { + var ret string + return ret + } + + return o.ArtifactType +} + +// GetArtifactTypeOk returns a tuple with the ArtifactType field value +// and a boolean to check if the value has been set. +func (o *BaseArtifact) GetArtifactTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ArtifactType, true +} + +// SetArtifactType sets field value +func (o *BaseArtifact) SetArtifactType(v string) { + o.ArtifactType = v +} + +func (o BaseArtifact) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BaseArtifact) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CustomProperties) { + toSerialize["customProperties"] = o.CustomProperties + } + if !IsNil(o.ExternalID) { + toSerialize["externalID"] = o.ExternalID + } + if !IsNil(o.Uri) { + toSerialize["uri"] = o.Uri + } + if !IsNil(o.State) { + toSerialize["state"] = o.State + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.CreateTimeSinceEpoch) { + toSerialize["createTimeSinceEpoch"] = o.CreateTimeSinceEpoch + } + if !IsNil(o.LastUpdateTimeSinceEpoch) { + toSerialize["lastUpdateTimeSinceEpoch"] = o.LastUpdateTimeSinceEpoch + } + toSerialize["artifactType"] = o.ArtifactType + return toSerialize, nil +} + +type NullableBaseArtifact struct { + value *BaseArtifact + isSet bool +} + +func (v NullableBaseArtifact) Get() *BaseArtifact { + return v.value +} + +func (v *NullableBaseArtifact) Set(val *BaseArtifact) { + v.value = val + v.isSet = true +} + +func (v NullableBaseArtifact) IsSet() bool { + return v.isSet +} + +func (v *NullableBaseArtifact) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBaseArtifact(val *BaseArtifact) *NullableBaseArtifact { + return &NullableBaseArtifact{value: val, isSet: true} +} + +func (v NullableBaseArtifact) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBaseArtifact) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/model/openapi/model_base_artifact_create.go b/internal/model/openapi/model_base_artifact_create.go new file mode 100644 index 000000000..aa17d8ea2 --- /dev/null +++ b/internal/model/openapi/model_base_artifact_create.go @@ -0,0 +1,276 @@ +/* +Model Registry REST API + +REST API for Model Registry to create and manage ML model metadata + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the BaseArtifactCreate type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BaseArtifactCreate{} + +// BaseArtifactCreate struct for BaseArtifactCreate +type BaseArtifactCreate struct { + // User provided custom properties which are not defined by its type. + CustomProperties *map[string]MetadataValue `json:"customProperties,omitempty"` + // The external id that come from the clients’ system. This field is optional. If set, it must be unique among all resources within a database instance. + ExternalID *string `json:"externalID,omitempty"` + // The uniform resource identifier of the physical artifact. May be empty if there is no physical artifact. + Uri *string `json:"uri,omitempty"` + State *ArtifactState `json:"state,omitempty"` + // The client provided name of the artifact. This field is optional. If set, it must be unique among all the artifacts of the same artifact type within a database instance and cannot be changed once set. + Name *string `json:"name,omitempty"` +} + +// NewBaseArtifactCreate instantiates a new BaseArtifactCreate object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewBaseArtifactCreate() *BaseArtifactCreate { + this := BaseArtifactCreate{} + var state ArtifactState = ARTIFACTSTATE_UNKNOWN + this.State = &state + return &this +} + +// NewBaseArtifactCreateWithDefaults instantiates a new BaseArtifactCreate object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewBaseArtifactCreateWithDefaults() *BaseArtifactCreate { + this := BaseArtifactCreate{} + var state ArtifactState = ARTIFACTSTATE_UNKNOWN + this.State = &state + return &this +} + +// GetCustomProperties returns the CustomProperties field value if set, zero value otherwise. +func (o *BaseArtifactCreate) GetCustomProperties() map[string]MetadataValue { + if o == nil || IsNil(o.CustomProperties) { + var ret map[string]MetadataValue + return ret + } + return *o.CustomProperties +} + +// GetCustomPropertiesOk returns a tuple with the CustomProperties field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseArtifactCreate) GetCustomPropertiesOk() (*map[string]MetadataValue, bool) { + if o == nil || IsNil(o.CustomProperties) { + return nil, false + } + return o.CustomProperties, true +} + +// HasCustomProperties returns a boolean if a field has been set. +func (o *BaseArtifactCreate) HasCustomProperties() bool { + if o != nil && !IsNil(o.CustomProperties) { + return true + } + + return false +} + +// SetCustomProperties gets a reference to the given map[string]MetadataValue and assigns it to the CustomProperties field. +func (o *BaseArtifactCreate) SetCustomProperties(v map[string]MetadataValue) { + o.CustomProperties = &v +} + +// GetExternalID returns the ExternalID field value if set, zero value otherwise. +func (o *BaseArtifactCreate) GetExternalID() string { + if o == nil || IsNil(o.ExternalID) { + var ret string + return ret + } + return *o.ExternalID +} + +// GetExternalIDOk returns a tuple with the ExternalID field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseArtifactCreate) GetExternalIDOk() (*string, bool) { + if o == nil || IsNil(o.ExternalID) { + return nil, false + } + return o.ExternalID, true +} + +// HasExternalID returns a boolean if a field has been set. +func (o *BaseArtifactCreate) HasExternalID() bool { + if o != nil && !IsNil(o.ExternalID) { + return true + } + + return false +} + +// SetExternalID gets a reference to the given string and assigns it to the ExternalID field. +func (o *BaseArtifactCreate) SetExternalID(v string) { + o.ExternalID = &v +} + +// GetUri returns the Uri field value if set, zero value otherwise. +func (o *BaseArtifactCreate) GetUri() string { + if o == nil || IsNil(o.Uri) { + var ret string + return ret + } + return *o.Uri +} + +// GetUriOk returns a tuple with the Uri field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseArtifactCreate) GetUriOk() (*string, bool) { + if o == nil || IsNil(o.Uri) { + return nil, false + } + return o.Uri, true +} + +// HasUri returns a boolean if a field has been set. +func (o *BaseArtifactCreate) HasUri() bool { + if o != nil && !IsNil(o.Uri) { + return true + } + + return false +} + +// SetUri gets a reference to the given string and assigns it to the Uri field. +func (o *BaseArtifactCreate) SetUri(v string) { + o.Uri = &v +} + +// GetState returns the State field value if set, zero value otherwise. +func (o *BaseArtifactCreate) GetState() ArtifactState { + if o == nil || IsNil(o.State) { + var ret ArtifactState + return ret + } + return *o.State +} + +// GetStateOk returns a tuple with the State field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseArtifactCreate) GetStateOk() (*ArtifactState, bool) { + if o == nil || IsNil(o.State) { + return nil, false + } + return o.State, true +} + +// HasState returns a boolean if a field has been set. +func (o *BaseArtifactCreate) HasState() bool { + if o != nil && !IsNil(o.State) { + return true + } + + return false +} + +// SetState gets a reference to the given ArtifactState and assigns it to the State field. +func (o *BaseArtifactCreate) SetState(v ArtifactState) { + o.State = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *BaseArtifactCreate) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseArtifactCreate) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *BaseArtifactCreate) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *BaseArtifactCreate) SetName(v string) { + o.Name = &v +} + +func (o BaseArtifactCreate) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BaseArtifactCreate) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CustomProperties) { + toSerialize["customProperties"] = o.CustomProperties + } + if !IsNil(o.ExternalID) { + toSerialize["externalID"] = o.ExternalID + } + if !IsNil(o.Uri) { + toSerialize["uri"] = o.Uri + } + if !IsNil(o.State) { + toSerialize["state"] = o.State + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + return toSerialize, nil +} + +type NullableBaseArtifactCreate struct { + value *BaseArtifactCreate + isSet bool +} + +func (v NullableBaseArtifactCreate) Get() *BaseArtifactCreate { + return v.value +} + +func (v *NullableBaseArtifactCreate) Set(val *BaseArtifactCreate) { + v.value = val + v.isSet = true +} + +func (v NullableBaseArtifactCreate) IsSet() bool { + return v.isSet +} + +func (v *NullableBaseArtifactCreate) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBaseArtifactCreate(val *BaseArtifactCreate) *NullableBaseArtifactCreate { + return &NullableBaseArtifactCreate{value: val, isSet: true} +} + +func (v NullableBaseArtifactCreate) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBaseArtifactCreate) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/model/openapi/model_base_artifact_update.go b/internal/model/openapi/model_base_artifact_update.go new file mode 100644 index 000000000..dbea5828c --- /dev/null +++ b/internal/model/openapi/model_base_artifact_update.go @@ -0,0 +1,239 @@ +/* +Model Registry REST API + +REST API for Model Registry to create and manage ML model metadata + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the BaseArtifactUpdate type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BaseArtifactUpdate{} + +// BaseArtifactUpdate struct for BaseArtifactUpdate +type BaseArtifactUpdate struct { + // User provided custom properties which are not defined by its type. + CustomProperties *map[string]MetadataValue `json:"customProperties,omitempty"` + // The external id that come from the clients’ system. This field is optional. If set, it must be unique among all resources within a database instance. + ExternalID *string `json:"externalID,omitempty"` + // The uniform resource identifier of the physical artifact. May be empty if there is no physical artifact. + Uri *string `json:"uri,omitempty"` + State *ArtifactState `json:"state,omitempty"` +} + +// NewBaseArtifactUpdate instantiates a new BaseArtifactUpdate object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewBaseArtifactUpdate() *BaseArtifactUpdate { + this := BaseArtifactUpdate{} + var state ArtifactState = ARTIFACTSTATE_UNKNOWN + this.State = &state + return &this +} + +// NewBaseArtifactUpdateWithDefaults instantiates a new BaseArtifactUpdate object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewBaseArtifactUpdateWithDefaults() *BaseArtifactUpdate { + this := BaseArtifactUpdate{} + var state ArtifactState = ARTIFACTSTATE_UNKNOWN + this.State = &state + return &this +} + +// GetCustomProperties returns the CustomProperties field value if set, zero value otherwise. +func (o *BaseArtifactUpdate) GetCustomProperties() map[string]MetadataValue { + if o == nil || IsNil(o.CustomProperties) { + var ret map[string]MetadataValue + return ret + } + return *o.CustomProperties +} + +// GetCustomPropertiesOk returns a tuple with the CustomProperties field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseArtifactUpdate) GetCustomPropertiesOk() (*map[string]MetadataValue, bool) { + if o == nil || IsNil(o.CustomProperties) { + return nil, false + } + return o.CustomProperties, true +} + +// HasCustomProperties returns a boolean if a field has been set. +func (o *BaseArtifactUpdate) HasCustomProperties() bool { + if o != nil && !IsNil(o.CustomProperties) { + return true + } + + return false +} + +// SetCustomProperties gets a reference to the given map[string]MetadataValue and assigns it to the CustomProperties field. +func (o *BaseArtifactUpdate) SetCustomProperties(v map[string]MetadataValue) { + o.CustomProperties = &v +} + +// GetExternalID returns the ExternalID field value if set, zero value otherwise. +func (o *BaseArtifactUpdate) GetExternalID() string { + if o == nil || IsNil(o.ExternalID) { + var ret string + return ret + } + return *o.ExternalID +} + +// GetExternalIDOk returns a tuple with the ExternalID field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseArtifactUpdate) GetExternalIDOk() (*string, bool) { + if o == nil || IsNil(o.ExternalID) { + return nil, false + } + return o.ExternalID, true +} + +// HasExternalID returns a boolean if a field has been set. +func (o *BaseArtifactUpdate) HasExternalID() bool { + if o != nil && !IsNil(o.ExternalID) { + return true + } + + return false +} + +// SetExternalID gets a reference to the given string and assigns it to the ExternalID field. +func (o *BaseArtifactUpdate) SetExternalID(v string) { + o.ExternalID = &v +} + +// GetUri returns the Uri field value if set, zero value otherwise. +func (o *BaseArtifactUpdate) GetUri() string { + if o == nil || IsNil(o.Uri) { + var ret string + return ret + } + return *o.Uri +} + +// GetUriOk returns a tuple with the Uri field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseArtifactUpdate) GetUriOk() (*string, bool) { + if o == nil || IsNil(o.Uri) { + return nil, false + } + return o.Uri, true +} + +// HasUri returns a boolean if a field has been set. +func (o *BaseArtifactUpdate) HasUri() bool { + if o != nil && !IsNil(o.Uri) { + return true + } + + return false +} + +// SetUri gets a reference to the given string and assigns it to the Uri field. +func (o *BaseArtifactUpdate) SetUri(v string) { + o.Uri = &v +} + +// GetState returns the State field value if set, zero value otherwise. +func (o *BaseArtifactUpdate) GetState() ArtifactState { + if o == nil || IsNil(o.State) { + var ret ArtifactState + return ret + } + return *o.State +} + +// GetStateOk returns a tuple with the State field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseArtifactUpdate) GetStateOk() (*ArtifactState, bool) { + if o == nil || IsNil(o.State) { + return nil, false + } + return o.State, true +} + +// HasState returns a boolean if a field has been set. +func (o *BaseArtifactUpdate) HasState() bool { + if o != nil && !IsNil(o.State) { + return true + } + + return false +} + +// SetState gets a reference to the given ArtifactState and assigns it to the State field. +func (o *BaseArtifactUpdate) SetState(v ArtifactState) { + o.State = &v +} + +func (o BaseArtifactUpdate) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BaseArtifactUpdate) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CustomProperties) { + toSerialize["customProperties"] = o.CustomProperties + } + if !IsNil(o.ExternalID) { + toSerialize["externalID"] = o.ExternalID + } + if !IsNil(o.Uri) { + toSerialize["uri"] = o.Uri + } + if !IsNil(o.State) { + toSerialize["state"] = o.State + } + return toSerialize, nil +} + +type NullableBaseArtifactUpdate struct { + value *BaseArtifactUpdate + isSet bool +} + +func (v NullableBaseArtifactUpdate) Get() *BaseArtifactUpdate { + return v.value +} + +func (v *NullableBaseArtifactUpdate) Set(val *BaseArtifactUpdate) { + v.value = val + v.isSet = true +} + +func (v NullableBaseArtifactUpdate) IsSet() bool { + return v.isSet +} + +func (v *NullableBaseArtifactUpdate) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBaseArtifactUpdate(val *BaseArtifactUpdate) *NullableBaseArtifactUpdate { + return &NullableBaseArtifactUpdate{value: val, isSet: true} +} + +func (v NullableBaseArtifactUpdate) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBaseArtifactUpdate) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/model/openapi/model_base_execution.go b/internal/model/openapi/model_base_execution.go new file mode 100644 index 000000000..24a92fed8 --- /dev/null +++ b/internal/model/openapi/model_base_execution.go @@ -0,0 +1,350 @@ +/* +Model Registry REST API + +REST API for Model Registry to create and manage ML model metadata + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the BaseExecution type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BaseExecution{} + +// BaseExecution struct for BaseExecution +type BaseExecution struct { + LastKnownState *ExecutionState `json:"lastKnownState,omitempty"` + // User provided custom properties which are not defined by its type. + CustomProperties *map[string]MetadataValue `json:"customProperties,omitempty"` + // The external id that come from the clients’ system. This field is optional. If set, it must be unique among all resources within a database instance. + ExternalID *string `json:"externalID,omitempty"` + // The client provided name of the artifact. This field is optional. If set, it must be unique among all the artifacts of the same artifact type within a database instance and cannot be changed once set. + Name *string `json:"name,omitempty"` + // Output only. The unique server generated id of the resource. + Id *string `json:"id,omitempty"` + // Output only. Create time of the resource in millisecond since epoch. + CreateTimeSinceEpoch *string `json:"createTimeSinceEpoch,omitempty"` + // Output only. Last update time of the resource since epoch in millisecond since epoch. + LastUpdateTimeSinceEpoch *string `json:"lastUpdateTimeSinceEpoch,omitempty"` +} + +// NewBaseExecution instantiates a new BaseExecution object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewBaseExecution() *BaseExecution { + this := BaseExecution{} + var lastKnownState ExecutionState = EXECUTIONSTATE_UNKNOWN + this.LastKnownState = &lastKnownState + return &this +} + +// NewBaseExecutionWithDefaults instantiates a new BaseExecution object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewBaseExecutionWithDefaults() *BaseExecution { + this := BaseExecution{} + var lastKnownState ExecutionState = EXECUTIONSTATE_UNKNOWN + this.LastKnownState = &lastKnownState + return &this +} + +// GetLastKnownState returns the LastKnownState field value if set, zero value otherwise. +func (o *BaseExecution) GetLastKnownState() ExecutionState { + if o == nil || IsNil(o.LastKnownState) { + var ret ExecutionState + return ret + } + return *o.LastKnownState +} + +// GetLastKnownStateOk returns a tuple with the LastKnownState field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseExecution) GetLastKnownStateOk() (*ExecutionState, bool) { + if o == nil || IsNil(o.LastKnownState) { + return nil, false + } + return o.LastKnownState, true +} + +// HasLastKnownState returns a boolean if a field has been set. +func (o *BaseExecution) HasLastKnownState() bool { + if o != nil && !IsNil(o.LastKnownState) { + return true + } + + return false +} + +// SetLastKnownState gets a reference to the given ExecutionState and assigns it to the LastKnownState field. +func (o *BaseExecution) SetLastKnownState(v ExecutionState) { + o.LastKnownState = &v +} + +// GetCustomProperties returns the CustomProperties field value if set, zero value otherwise. +func (o *BaseExecution) GetCustomProperties() map[string]MetadataValue { + if o == nil || IsNil(o.CustomProperties) { + var ret map[string]MetadataValue + return ret + } + return *o.CustomProperties +} + +// GetCustomPropertiesOk returns a tuple with the CustomProperties field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseExecution) GetCustomPropertiesOk() (*map[string]MetadataValue, bool) { + if o == nil || IsNil(o.CustomProperties) { + return nil, false + } + return o.CustomProperties, true +} + +// HasCustomProperties returns a boolean if a field has been set. +func (o *BaseExecution) HasCustomProperties() bool { + if o != nil && !IsNil(o.CustomProperties) { + return true + } + + return false +} + +// SetCustomProperties gets a reference to the given map[string]MetadataValue and assigns it to the CustomProperties field. +func (o *BaseExecution) SetCustomProperties(v map[string]MetadataValue) { + o.CustomProperties = &v +} + +// GetExternalID returns the ExternalID field value if set, zero value otherwise. +func (o *BaseExecution) GetExternalID() string { + if o == nil || IsNil(o.ExternalID) { + var ret string + return ret + } + return *o.ExternalID +} + +// GetExternalIDOk returns a tuple with the ExternalID field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseExecution) GetExternalIDOk() (*string, bool) { + if o == nil || IsNil(o.ExternalID) { + return nil, false + } + return o.ExternalID, true +} + +// HasExternalID returns a boolean if a field has been set. +func (o *BaseExecution) HasExternalID() bool { + if o != nil && !IsNil(o.ExternalID) { + return true + } + + return false +} + +// SetExternalID gets a reference to the given string and assigns it to the ExternalID field. +func (o *BaseExecution) SetExternalID(v string) { + o.ExternalID = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *BaseExecution) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseExecution) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *BaseExecution) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *BaseExecution) SetName(v string) { + o.Name = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *BaseExecution) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseExecution) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *BaseExecution) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *BaseExecution) SetId(v string) { + o.Id = &v +} + +// GetCreateTimeSinceEpoch returns the CreateTimeSinceEpoch field value if set, zero value otherwise. +func (o *BaseExecution) GetCreateTimeSinceEpoch() string { + if o == nil || IsNil(o.CreateTimeSinceEpoch) { + var ret string + return ret + } + return *o.CreateTimeSinceEpoch +} + +// GetCreateTimeSinceEpochOk returns a tuple with the CreateTimeSinceEpoch field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseExecution) GetCreateTimeSinceEpochOk() (*string, bool) { + if o == nil || IsNil(o.CreateTimeSinceEpoch) { + return nil, false + } + return o.CreateTimeSinceEpoch, true +} + +// HasCreateTimeSinceEpoch returns a boolean if a field has been set. +func (o *BaseExecution) HasCreateTimeSinceEpoch() bool { + if o != nil && !IsNil(o.CreateTimeSinceEpoch) { + return true + } + + return false +} + +// SetCreateTimeSinceEpoch gets a reference to the given string and assigns it to the CreateTimeSinceEpoch field. +func (o *BaseExecution) SetCreateTimeSinceEpoch(v string) { + o.CreateTimeSinceEpoch = &v +} + +// GetLastUpdateTimeSinceEpoch returns the LastUpdateTimeSinceEpoch field value if set, zero value otherwise. +func (o *BaseExecution) GetLastUpdateTimeSinceEpoch() string { + if o == nil || IsNil(o.LastUpdateTimeSinceEpoch) { + var ret string + return ret + } + return *o.LastUpdateTimeSinceEpoch +} + +// GetLastUpdateTimeSinceEpochOk returns a tuple with the LastUpdateTimeSinceEpoch field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseExecution) GetLastUpdateTimeSinceEpochOk() (*string, bool) { + if o == nil || IsNil(o.LastUpdateTimeSinceEpoch) { + return nil, false + } + return o.LastUpdateTimeSinceEpoch, true +} + +// HasLastUpdateTimeSinceEpoch returns a boolean if a field has been set. +func (o *BaseExecution) HasLastUpdateTimeSinceEpoch() bool { + if o != nil && !IsNil(o.LastUpdateTimeSinceEpoch) { + return true + } + + return false +} + +// SetLastUpdateTimeSinceEpoch gets a reference to the given string and assigns it to the LastUpdateTimeSinceEpoch field. +func (o *BaseExecution) SetLastUpdateTimeSinceEpoch(v string) { + o.LastUpdateTimeSinceEpoch = &v +} + +func (o BaseExecution) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BaseExecution) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.LastKnownState) { + toSerialize["lastKnownState"] = o.LastKnownState + } + if !IsNil(o.CustomProperties) { + toSerialize["customProperties"] = o.CustomProperties + } + if !IsNil(o.ExternalID) { + toSerialize["externalID"] = o.ExternalID + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.CreateTimeSinceEpoch) { + toSerialize["createTimeSinceEpoch"] = o.CreateTimeSinceEpoch + } + if !IsNil(o.LastUpdateTimeSinceEpoch) { + toSerialize["lastUpdateTimeSinceEpoch"] = o.LastUpdateTimeSinceEpoch + } + return toSerialize, nil +} + +type NullableBaseExecution struct { + value *BaseExecution + isSet bool +} + +func (v NullableBaseExecution) Get() *BaseExecution { + return v.value +} + +func (v *NullableBaseExecution) Set(val *BaseExecution) { + v.value = val + v.isSet = true +} + +func (v NullableBaseExecution) IsSet() bool { + return v.isSet +} + +func (v *NullableBaseExecution) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBaseExecution(val *BaseExecution) *NullableBaseExecution { + return &NullableBaseExecution{value: val, isSet: true} +} + +func (v NullableBaseExecution) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBaseExecution) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/model/openapi/model_base_execution_create.go b/internal/model/openapi/model_base_execution_create.go new file mode 100644 index 000000000..51945d995 --- /dev/null +++ b/internal/model/openapi/model_base_execution_create.go @@ -0,0 +1,239 @@ +/* +Model Registry REST API + +REST API for Model Registry to create and manage ML model metadata + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the BaseExecutionCreate type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BaseExecutionCreate{} + +// BaseExecutionCreate struct for BaseExecutionCreate +type BaseExecutionCreate struct { + LastKnownState *ExecutionState `json:"lastKnownState,omitempty"` + // User provided custom properties which are not defined by its type. + CustomProperties *map[string]MetadataValue `json:"customProperties,omitempty"` + // The external id that come from the clients’ system. This field is optional. If set, it must be unique among all resources within a database instance. + ExternalID *string `json:"externalID,omitempty"` + // The client provided name of the artifact. This field is optional. If set, it must be unique among all the artifacts of the same artifact type within a database instance and cannot be changed once set. + Name *string `json:"name,omitempty"` +} + +// NewBaseExecutionCreate instantiates a new BaseExecutionCreate object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewBaseExecutionCreate() *BaseExecutionCreate { + this := BaseExecutionCreate{} + var lastKnownState ExecutionState = EXECUTIONSTATE_UNKNOWN + this.LastKnownState = &lastKnownState + return &this +} + +// NewBaseExecutionCreateWithDefaults instantiates a new BaseExecutionCreate object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewBaseExecutionCreateWithDefaults() *BaseExecutionCreate { + this := BaseExecutionCreate{} + var lastKnownState ExecutionState = EXECUTIONSTATE_UNKNOWN + this.LastKnownState = &lastKnownState + return &this +} + +// GetLastKnownState returns the LastKnownState field value if set, zero value otherwise. +func (o *BaseExecutionCreate) GetLastKnownState() ExecutionState { + if o == nil || IsNil(o.LastKnownState) { + var ret ExecutionState + return ret + } + return *o.LastKnownState +} + +// GetLastKnownStateOk returns a tuple with the LastKnownState field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseExecutionCreate) GetLastKnownStateOk() (*ExecutionState, bool) { + if o == nil || IsNil(o.LastKnownState) { + return nil, false + } + return o.LastKnownState, true +} + +// HasLastKnownState returns a boolean if a field has been set. +func (o *BaseExecutionCreate) HasLastKnownState() bool { + if o != nil && !IsNil(o.LastKnownState) { + return true + } + + return false +} + +// SetLastKnownState gets a reference to the given ExecutionState and assigns it to the LastKnownState field. +func (o *BaseExecutionCreate) SetLastKnownState(v ExecutionState) { + o.LastKnownState = &v +} + +// GetCustomProperties returns the CustomProperties field value if set, zero value otherwise. +func (o *BaseExecutionCreate) GetCustomProperties() map[string]MetadataValue { + if o == nil || IsNil(o.CustomProperties) { + var ret map[string]MetadataValue + return ret + } + return *o.CustomProperties +} + +// GetCustomPropertiesOk returns a tuple with the CustomProperties field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseExecutionCreate) GetCustomPropertiesOk() (*map[string]MetadataValue, bool) { + if o == nil || IsNil(o.CustomProperties) { + return nil, false + } + return o.CustomProperties, true +} + +// HasCustomProperties returns a boolean if a field has been set. +func (o *BaseExecutionCreate) HasCustomProperties() bool { + if o != nil && !IsNil(o.CustomProperties) { + return true + } + + return false +} + +// SetCustomProperties gets a reference to the given map[string]MetadataValue and assigns it to the CustomProperties field. +func (o *BaseExecutionCreate) SetCustomProperties(v map[string]MetadataValue) { + o.CustomProperties = &v +} + +// GetExternalID returns the ExternalID field value if set, zero value otherwise. +func (o *BaseExecutionCreate) GetExternalID() string { + if o == nil || IsNil(o.ExternalID) { + var ret string + return ret + } + return *o.ExternalID +} + +// GetExternalIDOk returns a tuple with the ExternalID field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseExecutionCreate) GetExternalIDOk() (*string, bool) { + if o == nil || IsNil(o.ExternalID) { + return nil, false + } + return o.ExternalID, true +} + +// HasExternalID returns a boolean if a field has been set. +func (o *BaseExecutionCreate) HasExternalID() bool { + if o != nil && !IsNil(o.ExternalID) { + return true + } + + return false +} + +// SetExternalID gets a reference to the given string and assigns it to the ExternalID field. +func (o *BaseExecutionCreate) SetExternalID(v string) { + o.ExternalID = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *BaseExecutionCreate) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseExecutionCreate) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *BaseExecutionCreate) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *BaseExecutionCreate) SetName(v string) { + o.Name = &v +} + +func (o BaseExecutionCreate) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BaseExecutionCreate) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.LastKnownState) { + toSerialize["lastKnownState"] = o.LastKnownState + } + if !IsNil(o.CustomProperties) { + toSerialize["customProperties"] = o.CustomProperties + } + if !IsNil(o.ExternalID) { + toSerialize["externalID"] = o.ExternalID + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + return toSerialize, nil +} + +type NullableBaseExecutionCreate struct { + value *BaseExecutionCreate + isSet bool +} + +func (v NullableBaseExecutionCreate) Get() *BaseExecutionCreate { + return v.value +} + +func (v *NullableBaseExecutionCreate) Set(val *BaseExecutionCreate) { + v.value = val + v.isSet = true +} + +func (v NullableBaseExecutionCreate) IsSet() bool { + return v.isSet +} + +func (v *NullableBaseExecutionCreate) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBaseExecutionCreate(val *BaseExecutionCreate) *NullableBaseExecutionCreate { + return &NullableBaseExecutionCreate{value: val, isSet: true} +} + +func (v NullableBaseExecutionCreate) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBaseExecutionCreate) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/model/openapi/model_base_execution_update.go b/internal/model/openapi/model_base_execution_update.go new file mode 100644 index 000000000..0375043ed --- /dev/null +++ b/internal/model/openapi/model_base_execution_update.go @@ -0,0 +1,202 @@ +/* +Model Registry REST API + +REST API for Model Registry to create and manage ML model metadata + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the BaseExecutionUpdate type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BaseExecutionUpdate{} + +// BaseExecutionUpdate struct for BaseExecutionUpdate +type BaseExecutionUpdate struct { + // User provided custom properties which are not defined by its type. + CustomProperties *map[string]MetadataValue `json:"customProperties,omitempty"` + // The external id that come from the clients’ system. This field is optional. If set, it must be unique among all resources within a database instance. + ExternalID *string `json:"externalID,omitempty"` + LastKnownState *ExecutionState `json:"lastKnownState,omitempty"` +} + +// NewBaseExecutionUpdate instantiates a new BaseExecutionUpdate object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewBaseExecutionUpdate() *BaseExecutionUpdate { + this := BaseExecutionUpdate{} + var lastKnownState ExecutionState = EXECUTIONSTATE_UNKNOWN + this.LastKnownState = &lastKnownState + return &this +} + +// NewBaseExecutionUpdateWithDefaults instantiates a new BaseExecutionUpdate object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewBaseExecutionUpdateWithDefaults() *BaseExecutionUpdate { + this := BaseExecutionUpdate{} + var lastKnownState ExecutionState = EXECUTIONSTATE_UNKNOWN + this.LastKnownState = &lastKnownState + return &this +} + +// GetCustomProperties returns the CustomProperties field value if set, zero value otherwise. +func (o *BaseExecutionUpdate) GetCustomProperties() map[string]MetadataValue { + if o == nil || IsNil(o.CustomProperties) { + var ret map[string]MetadataValue + return ret + } + return *o.CustomProperties +} + +// GetCustomPropertiesOk returns a tuple with the CustomProperties field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseExecutionUpdate) GetCustomPropertiesOk() (*map[string]MetadataValue, bool) { + if o == nil || IsNil(o.CustomProperties) { + return nil, false + } + return o.CustomProperties, true +} + +// HasCustomProperties returns a boolean if a field has been set. +func (o *BaseExecutionUpdate) HasCustomProperties() bool { + if o != nil && !IsNil(o.CustomProperties) { + return true + } + + return false +} + +// SetCustomProperties gets a reference to the given map[string]MetadataValue and assigns it to the CustomProperties field. +func (o *BaseExecutionUpdate) SetCustomProperties(v map[string]MetadataValue) { + o.CustomProperties = &v +} + +// GetExternalID returns the ExternalID field value if set, zero value otherwise. +func (o *BaseExecutionUpdate) GetExternalID() string { + if o == nil || IsNil(o.ExternalID) { + var ret string + return ret + } + return *o.ExternalID +} + +// GetExternalIDOk returns a tuple with the ExternalID field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseExecutionUpdate) GetExternalIDOk() (*string, bool) { + if o == nil || IsNil(o.ExternalID) { + return nil, false + } + return o.ExternalID, true +} + +// HasExternalID returns a boolean if a field has been set. +func (o *BaseExecutionUpdate) HasExternalID() bool { + if o != nil && !IsNil(o.ExternalID) { + return true + } + + return false +} + +// SetExternalID gets a reference to the given string and assigns it to the ExternalID field. +func (o *BaseExecutionUpdate) SetExternalID(v string) { + o.ExternalID = &v +} + +// GetLastKnownState returns the LastKnownState field value if set, zero value otherwise. +func (o *BaseExecutionUpdate) GetLastKnownState() ExecutionState { + if o == nil || IsNil(o.LastKnownState) { + var ret ExecutionState + return ret + } + return *o.LastKnownState +} + +// GetLastKnownStateOk returns a tuple with the LastKnownState field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseExecutionUpdate) GetLastKnownStateOk() (*ExecutionState, bool) { + if o == nil || IsNil(o.LastKnownState) { + return nil, false + } + return o.LastKnownState, true +} + +// HasLastKnownState returns a boolean if a field has been set. +func (o *BaseExecutionUpdate) HasLastKnownState() bool { + if o != nil && !IsNil(o.LastKnownState) { + return true + } + + return false +} + +// SetLastKnownState gets a reference to the given ExecutionState and assigns it to the LastKnownState field. +func (o *BaseExecutionUpdate) SetLastKnownState(v ExecutionState) { + o.LastKnownState = &v +} + +func (o BaseExecutionUpdate) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BaseExecutionUpdate) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CustomProperties) { + toSerialize["customProperties"] = o.CustomProperties + } + if !IsNil(o.ExternalID) { + toSerialize["externalID"] = o.ExternalID + } + if !IsNil(o.LastKnownState) { + toSerialize["lastKnownState"] = o.LastKnownState + } + return toSerialize, nil +} + +type NullableBaseExecutionUpdate struct { + value *BaseExecutionUpdate + isSet bool +} + +func (v NullableBaseExecutionUpdate) Get() *BaseExecutionUpdate { + return v.value +} + +func (v *NullableBaseExecutionUpdate) Set(val *BaseExecutionUpdate) { + v.value = val + v.isSet = true +} + +func (v NullableBaseExecutionUpdate) IsSet() bool { + return v.isSet +} + +func (v *NullableBaseExecutionUpdate) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBaseExecutionUpdate(val *BaseExecutionUpdate) *NullableBaseExecutionUpdate { + return &NullableBaseExecutionUpdate{value: val, isSet: true} +} + +func (v NullableBaseExecutionUpdate) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBaseExecutionUpdate) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/model/openapi/model_base_resource.go b/internal/model/openapi/model_base_resource.go new file mode 100644 index 000000000..aa01540a8 --- /dev/null +++ b/internal/model/openapi/model_base_resource.go @@ -0,0 +1,310 @@ +/* +Model Registry REST API + +REST API for Model Registry to create and manage ML model metadata + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the BaseResource type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BaseResource{} + +// BaseResource struct for BaseResource +type BaseResource struct { + // User provided custom properties which are not defined by its type. + CustomProperties *map[string]MetadataValue `json:"customProperties,omitempty"` + // The external id that come from the clients’ system. This field is optional. If set, it must be unique among all resources within a database instance. + ExternalID *string `json:"externalID,omitempty"` + // The client provided name of the artifact. This field is optional. If set, it must be unique among all the artifacts of the same artifact type within a database instance and cannot be changed once set. + Name *string `json:"name,omitempty"` + // Output only. The unique server generated id of the resource. + Id *string `json:"id,omitempty"` + // Output only. Create time of the resource in millisecond since epoch. + CreateTimeSinceEpoch *string `json:"createTimeSinceEpoch,omitempty"` + // Output only. Last update time of the resource since epoch in millisecond since epoch. + LastUpdateTimeSinceEpoch *string `json:"lastUpdateTimeSinceEpoch,omitempty"` +} + +// NewBaseResource instantiates a new BaseResource object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewBaseResource() *BaseResource { + this := BaseResource{} + return &this +} + +// NewBaseResourceWithDefaults instantiates a new BaseResource object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewBaseResourceWithDefaults() *BaseResource { + this := BaseResource{} + return &this +} + +// GetCustomProperties returns the CustomProperties field value if set, zero value otherwise. +func (o *BaseResource) GetCustomProperties() map[string]MetadataValue { + if o == nil || IsNil(o.CustomProperties) { + var ret map[string]MetadataValue + return ret + } + return *o.CustomProperties +} + +// GetCustomPropertiesOk returns a tuple with the CustomProperties field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseResource) GetCustomPropertiesOk() (*map[string]MetadataValue, bool) { + if o == nil || IsNil(o.CustomProperties) { + return nil, false + } + return o.CustomProperties, true +} + +// HasCustomProperties returns a boolean if a field has been set. +func (o *BaseResource) HasCustomProperties() bool { + if o != nil && !IsNil(o.CustomProperties) { + return true + } + + return false +} + +// SetCustomProperties gets a reference to the given map[string]MetadataValue and assigns it to the CustomProperties field. +func (o *BaseResource) SetCustomProperties(v map[string]MetadataValue) { + o.CustomProperties = &v +} + +// GetExternalID returns the ExternalID field value if set, zero value otherwise. +func (o *BaseResource) GetExternalID() string { + if o == nil || IsNil(o.ExternalID) { + var ret string + return ret + } + return *o.ExternalID +} + +// GetExternalIDOk returns a tuple with the ExternalID field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseResource) GetExternalIDOk() (*string, bool) { + if o == nil || IsNil(o.ExternalID) { + return nil, false + } + return o.ExternalID, true +} + +// HasExternalID returns a boolean if a field has been set. +func (o *BaseResource) HasExternalID() bool { + if o != nil && !IsNil(o.ExternalID) { + return true + } + + return false +} + +// SetExternalID gets a reference to the given string and assigns it to the ExternalID field. +func (o *BaseResource) SetExternalID(v string) { + o.ExternalID = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *BaseResource) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseResource) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *BaseResource) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *BaseResource) SetName(v string) { + o.Name = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *BaseResource) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseResource) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *BaseResource) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *BaseResource) SetId(v string) { + o.Id = &v +} + +// GetCreateTimeSinceEpoch returns the CreateTimeSinceEpoch field value if set, zero value otherwise. +func (o *BaseResource) GetCreateTimeSinceEpoch() string { + if o == nil || IsNil(o.CreateTimeSinceEpoch) { + var ret string + return ret + } + return *o.CreateTimeSinceEpoch +} + +// GetCreateTimeSinceEpochOk returns a tuple with the CreateTimeSinceEpoch field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseResource) GetCreateTimeSinceEpochOk() (*string, bool) { + if o == nil || IsNil(o.CreateTimeSinceEpoch) { + return nil, false + } + return o.CreateTimeSinceEpoch, true +} + +// HasCreateTimeSinceEpoch returns a boolean if a field has been set. +func (o *BaseResource) HasCreateTimeSinceEpoch() bool { + if o != nil && !IsNil(o.CreateTimeSinceEpoch) { + return true + } + + return false +} + +// SetCreateTimeSinceEpoch gets a reference to the given string and assigns it to the CreateTimeSinceEpoch field. +func (o *BaseResource) SetCreateTimeSinceEpoch(v string) { + o.CreateTimeSinceEpoch = &v +} + +// GetLastUpdateTimeSinceEpoch returns the LastUpdateTimeSinceEpoch field value if set, zero value otherwise. +func (o *BaseResource) GetLastUpdateTimeSinceEpoch() string { + if o == nil || IsNil(o.LastUpdateTimeSinceEpoch) { + var ret string + return ret + } + return *o.LastUpdateTimeSinceEpoch +} + +// GetLastUpdateTimeSinceEpochOk returns a tuple with the LastUpdateTimeSinceEpoch field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseResource) GetLastUpdateTimeSinceEpochOk() (*string, bool) { + if o == nil || IsNil(o.LastUpdateTimeSinceEpoch) { + return nil, false + } + return o.LastUpdateTimeSinceEpoch, true +} + +// HasLastUpdateTimeSinceEpoch returns a boolean if a field has been set. +func (o *BaseResource) HasLastUpdateTimeSinceEpoch() bool { + if o != nil && !IsNil(o.LastUpdateTimeSinceEpoch) { + return true + } + + return false +} + +// SetLastUpdateTimeSinceEpoch gets a reference to the given string and assigns it to the LastUpdateTimeSinceEpoch field. +func (o *BaseResource) SetLastUpdateTimeSinceEpoch(v string) { + o.LastUpdateTimeSinceEpoch = &v +} + +func (o BaseResource) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BaseResource) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CustomProperties) { + toSerialize["customProperties"] = o.CustomProperties + } + if !IsNil(o.ExternalID) { + toSerialize["externalID"] = o.ExternalID + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.CreateTimeSinceEpoch) { + toSerialize["createTimeSinceEpoch"] = o.CreateTimeSinceEpoch + } + if !IsNil(o.LastUpdateTimeSinceEpoch) { + toSerialize["lastUpdateTimeSinceEpoch"] = o.LastUpdateTimeSinceEpoch + } + return toSerialize, nil +} + +type NullableBaseResource struct { + value *BaseResource + isSet bool +} + +func (v NullableBaseResource) Get() *BaseResource { + return v.value +} + +func (v *NullableBaseResource) Set(val *BaseResource) { + v.value = val + v.isSet = true +} + +func (v NullableBaseResource) IsSet() bool { + return v.isSet +} + +func (v *NullableBaseResource) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBaseResource(val *BaseResource) *NullableBaseResource { + return &NullableBaseResource{value: val, isSet: true} +} + +func (v NullableBaseResource) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBaseResource) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/model/openapi/model_base_resource_create.go b/internal/model/openapi/model_base_resource_create.go new file mode 100644 index 000000000..493ccd223 --- /dev/null +++ b/internal/model/openapi/model_base_resource_create.go @@ -0,0 +1,199 @@ +/* +Model Registry REST API + +REST API for Model Registry to create and manage ML model metadata + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the BaseResourceCreate type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BaseResourceCreate{} + +// BaseResourceCreate struct for BaseResourceCreate +type BaseResourceCreate struct { + // User provided custom properties which are not defined by its type. + CustomProperties *map[string]MetadataValue `json:"customProperties,omitempty"` + // The external id that come from the clients’ system. This field is optional. If set, it must be unique among all resources within a database instance. + ExternalID *string `json:"externalID,omitempty"` + // The client provided name of the artifact. This field is optional. If set, it must be unique among all the artifacts of the same artifact type within a database instance and cannot be changed once set. + Name *string `json:"name,omitempty"` +} + +// NewBaseResourceCreate instantiates a new BaseResourceCreate object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewBaseResourceCreate() *BaseResourceCreate { + this := BaseResourceCreate{} + return &this +} + +// NewBaseResourceCreateWithDefaults instantiates a new BaseResourceCreate object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewBaseResourceCreateWithDefaults() *BaseResourceCreate { + this := BaseResourceCreate{} + return &this +} + +// GetCustomProperties returns the CustomProperties field value if set, zero value otherwise. +func (o *BaseResourceCreate) GetCustomProperties() map[string]MetadataValue { + if o == nil || IsNil(o.CustomProperties) { + var ret map[string]MetadataValue + return ret + } + return *o.CustomProperties +} + +// GetCustomPropertiesOk returns a tuple with the CustomProperties field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseResourceCreate) GetCustomPropertiesOk() (*map[string]MetadataValue, bool) { + if o == nil || IsNil(o.CustomProperties) { + return nil, false + } + return o.CustomProperties, true +} + +// HasCustomProperties returns a boolean if a field has been set. +func (o *BaseResourceCreate) HasCustomProperties() bool { + if o != nil && !IsNil(o.CustomProperties) { + return true + } + + return false +} + +// SetCustomProperties gets a reference to the given map[string]MetadataValue and assigns it to the CustomProperties field. +func (o *BaseResourceCreate) SetCustomProperties(v map[string]MetadataValue) { + o.CustomProperties = &v +} + +// GetExternalID returns the ExternalID field value if set, zero value otherwise. +func (o *BaseResourceCreate) GetExternalID() string { + if o == nil || IsNil(o.ExternalID) { + var ret string + return ret + } + return *o.ExternalID +} + +// GetExternalIDOk returns a tuple with the ExternalID field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseResourceCreate) GetExternalIDOk() (*string, bool) { + if o == nil || IsNil(o.ExternalID) { + return nil, false + } + return o.ExternalID, true +} + +// HasExternalID returns a boolean if a field has been set. +func (o *BaseResourceCreate) HasExternalID() bool { + if o != nil && !IsNil(o.ExternalID) { + return true + } + + return false +} + +// SetExternalID gets a reference to the given string and assigns it to the ExternalID field. +func (o *BaseResourceCreate) SetExternalID(v string) { + o.ExternalID = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *BaseResourceCreate) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseResourceCreate) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *BaseResourceCreate) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *BaseResourceCreate) SetName(v string) { + o.Name = &v +} + +func (o BaseResourceCreate) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BaseResourceCreate) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CustomProperties) { + toSerialize["customProperties"] = o.CustomProperties + } + if !IsNil(o.ExternalID) { + toSerialize["externalID"] = o.ExternalID + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + return toSerialize, nil +} + +type NullableBaseResourceCreate struct { + value *BaseResourceCreate + isSet bool +} + +func (v NullableBaseResourceCreate) Get() *BaseResourceCreate { + return v.value +} + +func (v *NullableBaseResourceCreate) Set(val *BaseResourceCreate) { + v.value = val + v.isSet = true +} + +func (v NullableBaseResourceCreate) IsSet() bool { + return v.isSet +} + +func (v *NullableBaseResourceCreate) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBaseResourceCreate(val *BaseResourceCreate) *NullableBaseResourceCreate { + return &NullableBaseResourceCreate{value: val, isSet: true} +} + +func (v NullableBaseResourceCreate) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBaseResourceCreate) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/model/openapi/model_base_resource_list.go b/internal/model/openapi/model_base_resource_list.go new file mode 100644 index 000000000..d438b6873 --- /dev/null +++ b/internal/model/openapi/model_base_resource_list.go @@ -0,0 +1,172 @@ +/* +Model Registry REST API + +REST API for Model Registry to create and manage ML model metadata + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the BaseResourceList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BaseResourceList{} + +// BaseResourceList struct for BaseResourceList +type BaseResourceList struct { + // Token to use to retrieve next page of results. + NextPageToken string `json:"nextPageToken"` + // Maximum number of resources to return in the result. + PageSize int32 `json:"pageSize"` + // Number of items in result list. + Size int32 `json:"size"` +} + +// NewBaseResourceList instantiates a new BaseResourceList object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewBaseResourceList(nextPageToken string, pageSize int32, size int32) *BaseResourceList { + this := BaseResourceList{} + this.NextPageToken = nextPageToken + this.PageSize = pageSize + this.Size = size + return &this +} + +// NewBaseResourceListWithDefaults instantiates a new BaseResourceList object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewBaseResourceListWithDefaults() *BaseResourceList { + this := BaseResourceList{} + return &this +} + +// GetNextPageToken returns the NextPageToken field value +func (o *BaseResourceList) GetNextPageToken() string { + if o == nil { + var ret string + return ret + } + + return o.NextPageToken +} + +// GetNextPageTokenOk returns a tuple with the NextPageToken field value +// and a boolean to check if the value has been set. +func (o *BaseResourceList) GetNextPageTokenOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.NextPageToken, true +} + +// SetNextPageToken sets field value +func (o *BaseResourceList) SetNextPageToken(v string) { + o.NextPageToken = v +} + +// GetPageSize returns the PageSize field value +func (o *BaseResourceList) GetPageSize() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.PageSize +} + +// GetPageSizeOk returns a tuple with the PageSize field value +// and a boolean to check if the value has been set. +func (o *BaseResourceList) GetPageSizeOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.PageSize, true +} + +// SetPageSize sets field value +func (o *BaseResourceList) SetPageSize(v int32) { + o.PageSize = v +} + +// GetSize returns the Size field value +func (o *BaseResourceList) GetSize() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Size +} + +// GetSizeOk returns a tuple with the Size field value +// and a boolean to check if the value has been set. +func (o *BaseResourceList) GetSizeOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Size, true +} + +// SetSize sets field value +func (o *BaseResourceList) SetSize(v int32) { + o.Size = v +} + +func (o BaseResourceList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BaseResourceList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["nextPageToken"] = o.NextPageToken + toSerialize["pageSize"] = o.PageSize + toSerialize["size"] = o.Size + return toSerialize, nil +} + +type NullableBaseResourceList struct { + value *BaseResourceList + isSet bool +} + +func (v NullableBaseResourceList) Get() *BaseResourceList { + return v.value +} + +func (v *NullableBaseResourceList) Set(val *BaseResourceList) { + v.value = val + v.isSet = true +} + +func (v NullableBaseResourceList) IsSet() bool { + return v.isSet +} + +func (v *NullableBaseResourceList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBaseResourceList(val *BaseResourceList) *NullableBaseResourceList { + return &NullableBaseResourceList{value: val, isSet: true} +} + +func (v NullableBaseResourceList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBaseResourceList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/model/openapi/model_base_resource_update.go b/internal/model/openapi/model_base_resource_update.go new file mode 100644 index 000000000..1814f4bb3 --- /dev/null +++ b/internal/model/openapi/model_base_resource_update.go @@ -0,0 +1,162 @@ +/* +Model Registry REST API + +REST API for Model Registry to create and manage ML model metadata + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the BaseResourceUpdate type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BaseResourceUpdate{} + +// BaseResourceUpdate struct for BaseResourceUpdate +type BaseResourceUpdate struct { + // User provided custom properties which are not defined by its type. + CustomProperties *map[string]MetadataValue `json:"customProperties,omitempty"` + // The external id that come from the clients’ system. This field is optional. If set, it must be unique among all resources within a database instance. + ExternalID *string `json:"externalID,omitempty"` +} + +// NewBaseResourceUpdate instantiates a new BaseResourceUpdate object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewBaseResourceUpdate() *BaseResourceUpdate { + this := BaseResourceUpdate{} + return &this +} + +// NewBaseResourceUpdateWithDefaults instantiates a new BaseResourceUpdate object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewBaseResourceUpdateWithDefaults() *BaseResourceUpdate { + this := BaseResourceUpdate{} + return &this +} + +// GetCustomProperties returns the CustomProperties field value if set, zero value otherwise. +func (o *BaseResourceUpdate) GetCustomProperties() map[string]MetadataValue { + if o == nil || IsNil(o.CustomProperties) { + var ret map[string]MetadataValue + return ret + } + return *o.CustomProperties +} + +// GetCustomPropertiesOk returns a tuple with the CustomProperties field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseResourceUpdate) GetCustomPropertiesOk() (*map[string]MetadataValue, bool) { + if o == nil || IsNil(o.CustomProperties) { + return nil, false + } + return o.CustomProperties, true +} + +// HasCustomProperties returns a boolean if a field has been set. +func (o *BaseResourceUpdate) HasCustomProperties() bool { + if o != nil && !IsNil(o.CustomProperties) { + return true + } + + return false +} + +// SetCustomProperties gets a reference to the given map[string]MetadataValue and assigns it to the CustomProperties field. +func (o *BaseResourceUpdate) SetCustomProperties(v map[string]MetadataValue) { + o.CustomProperties = &v +} + +// GetExternalID returns the ExternalID field value if set, zero value otherwise. +func (o *BaseResourceUpdate) GetExternalID() string { + if o == nil || IsNil(o.ExternalID) { + var ret string + return ret + } + return *o.ExternalID +} + +// GetExternalIDOk returns a tuple with the ExternalID field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseResourceUpdate) GetExternalIDOk() (*string, bool) { + if o == nil || IsNil(o.ExternalID) { + return nil, false + } + return o.ExternalID, true +} + +// HasExternalID returns a boolean if a field has been set. +func (o *BaseResourceUpdate) HasExternalID() bool { + if o != nil && !IsNil(o.ExternalID) { + return true + } + + return false +} + +// SetExternalID gets a reference to the given string and assigns it to the ExternalID field. +func (o *BaseResourceUpdate) SetExternalID(v string) { + o.ExternalID = &v +} + +func (o BaseResourceUpdate) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BaseResourceUpdate) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CustomProperties) { + toSerialize["customProperties"] = o.CustomProperties + } + if !IsNil(o.ExternalID) { + toSerialize["externalID"] = o.ExternalID + } + return toSerialize, nil +} + +type NullableBaseResourceUpdate struct { + value *BaseResourceUpdate + isSet bool +} + +func (v NullableBaseResourceUpdate) Get() *BaseResourceUpdate { + return v.value +} + +func (v *NullableBaseResourceUpdate) Set(val *BaseResourceUpdate) { + v.value = val + v.isSet = true +} + +func (v NullableBaseResourceUpdate) IsSet() bool { + return v.isSet +} + +func (v *NullableBaseResourceUpdate) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBaseResourceUpdate(val *BaseResourceUpdate) *NullableBaseResourceUpdate { + return &NullableBaseResourceUpdate{value: val, isSet: true} +} + +func (v NullableBaseResourceUpdate) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBaseResourceUpdate) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/model/openapi/model_error.go b/internal/model/openapi/model_error.go new file mode 100644 index 000000000..2ad91eafa --- /dev/null +++ b/internal/model/openapi/model_error.go @@ -0,0 +1,144 @@ +/* +Model Registry REST API + +REST API for Model Registry to create and manage ML model metadata + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the Error type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Error{} + +// Error Error code and message. +type Error struct { + // Error code + Code string `json:"code"` + // Error message + Message string `json:"message"` +} + +// NewError instantiates a new Error object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewError(code string, message string) *Error { + this := Error{} + this.Code = code + this.Message = message + return &this +} + +// NewErrorWithDefaults instantiates a new Error object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewErrorWithDefaults() *Error { + this := Error{} + return &this +} + +// GetCode returns the Code field value +func (o *Error) GetCode() string { + if o == nil { + var ret string + return ret + } + + return o.Code +} + +// GetCodeOk returns a tuple with the Code field value +// and a boolean to check if the value has been set. +func (o *Error) GetCodeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Code, true +} + +// SetCode sets field value +func (o *Error) SetCode(v string) { + o.Code = v +} + +// GetMessage returns the Message field value +func (o *Error) GetMessage() string { + if o == nil { + var ret string + return ret + } + + return o.Message +} + +// GetMessageOk returns a tuple with the Message field value +// and a boolean to check if the value has been set. +func (o *Error) GetMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Message, true +} + +// SetMessage sets field value +func (o *Error) SetMessage(v string) { + o.Message = v +} + +func (o Error) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Error) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["code"] = o.Code + toSerialize["message"] = o.Message + return toSerialize, nil +} + +type NullableError struct { + value *Error + isSet bool +} + +func (v NullableError) Get() *Error { + return v.value +} + +func (v *NullableError) Set(val *Error) { + v.value = val + v.isSet = true +} + +func (v NullableError) IsSet() bool { + return v.isSet +} + +func (v *NullableError) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableError(val *Error) *NullableError { + return &NullableError{value: val, isSet: true} +} + +func (v NullableError) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableError) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/model/openapi/model_execution_state.go b/internal/model/openapi/model_execution_state.go new file mode 100644 index 000000000..3cc5df20e --- /dev/null +++ b/internal/model/openapi/model_execution_state.go @@ -0,0 +1,120 @@ +/* +Model Registry REST API + +REST API for Model Registry to create and manage ML model metadata + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "fmt" +) + +// ExecutionState The state of the Execution. The state transitions are NEW -> RUNNING -> COMPLETE | CACHED | FAILED | CANCELED CACHED means the execution is skipped due to cached results. CANCELED means the execution is skipped due to precondition not met. It is different from CACHED in that a CANCELED execution will not have any event associated with it. It is different from FAILED in that there is no unexpected error happened and it is regarded as a normal state. See also: ml-metadata Execution.State +type ExecutionState string + +// List of ExecutionState +const ( + EXECUTIONSTATE_UNKNOWN ExecutionState = "UNKNOWN" + EXECUTIONSTATE_NEW ExecutionState = "NEW" + EXECUTIONSTATE_RUNNING ExecutionState = "RUNNING" + EXECUTIONSTATE_COMPLETE ExecutionState = "COMPLETE" + EXECUTIONSTATE_FAILED ExecutionState = "FAILED" + EXECUTIONSTATE_CACHED ExecutionState = "CACHED" + EXECUTIONSTATE_CANCELED ExecutionState = "CANCELED" +) + +// All allowed values of ExecutionState enum +var AllowedExecutionStateEnumValues = []ExecutionState{ + "UNKNOWN", + "NEW", + "RUNNING", + "COMPLETE", + "FAILED", + "CACHED", + "CANCELED", +} + +func (v *ExecutionState) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := ExecutionState(value) + for _, existing := range AllowedExecutionStateEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid ExecutionState", value) +} + +// NewExecutionStateFromValue returns a pointer to a valid ExecutionState +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewExecutionStateFromValue(v string) (*ExecutionState, error) { + ev := ExecutionState(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for ExecutionState: valid values are %v", v, AllowedExecutionStateEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v ExecutionState) IsValid() bool { + for _, existing := range AllowedExecutionStateEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to ExecutionState value +func (v ExecutionState) Ptr() *ExecutionState { + return &v +} + +type NullableExecutionState struct { + value *ExecutionState + isSet bool +} + +func (v NullableExecutionState) Get() *ExecutionState { + return v.value +} + +func (v *NullableExecutionState) Set(val *ExecutionState) { + v.value = val + v.isSet = true +} + +func (v NullableExecutionState) IsSet() bool { + return v.isSet +} + +func (v *NullableExecutionState) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableExecutionState(val *ExecutionState) *NullableExecutionState { + return &NullableExecutionState{value: val, isSet: true} +} + +func (v NullableExecutionState) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableExecutionState) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/model/openapi/model_inference_service.go b/internal/model/openapi/model_inference_service.go new file mode 100644 index 000000000..1204f8d3a --- /dev/null +++ b/internal/model/openapi/model_inference_service.go @@ -0,0 +1,403 @@ +/* +Model Registry REST API + +REST API for Model Registry to create and manage ML model metadata + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the InferenceService type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &InferenceService{} + +// InferenceService An `InferenceService` entity in a `ServingEnvironment` represents a deployed `ModelVersion` from a `RegisteredModel` created by Model Serving. +type InferenceService struct { + // User provided custom properties which are not defined by its type. + CustomProperties *map[string]MetadataValue `json:"customProperties,omitempty"` + // The external id that come from the clients’ system. This field is optional. If set, it must be unique among all resources within a database instance. + ExternalID *string `json:"externalID,omitempty"` + // The client provided name of the artifact. This field is optional. If set, it must be unique among all the artifacts of the same artifact type within a database instance and cannot be changed once set. + Name *string `json:"name,omitempty"` + // Output only. The unique server generated id of the resource. + Id *string `json:"id,omitempty"` + // Output only. Create time of the resource in millisecond since epoch. + CreateTimeSinceEpoch *string `json:"createTimeSinceEpoch,omitempty"` + // Output only. Last update time of the resource since epoch in millisecond since epoch. + LastUpdateTimeSinceEpoch *string `json:"lastUpdateTimeSinceEpoch,omitempty"` + // ID of the `ModelVersion` to serve. If it's unspecified, then the latest `ModelVersion` by creation order will be served. + ModelVersionId *string `json:"modelVersionId,omitempty"` + // ID of the `RegisteredModel` to serve. + RegisteredModelId string `json:"registeredModelId"` + // ID of the parent `ServingEnvironment` for this `InferenceService` entity. + ServingEnvironmentId string `json:"servingEnvironmentId"` +} + +// NewInferenceService instantiates a new InferenceService object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewInferenceService(registeredModelId string, servingEnvironmentId string) *InferenceService { + this := InferenceService{} + this.RegisteredModelId = registeredModelId + this.ServingEnvironmentId = servingEnvironmentId + return &this +} + +// NewInferenceServiceWithDefaults instantiates a new InferenceService object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewInferenceServiceWithDefaults() *InferenceService { + this := InferenceService{} + return &this +} + +// GetCustomProperties returns the CustomProperties field value if set, zero value otherwise. +func (o *InferenceService) GetCustomProperties() map[string]MetadataValue { + if o == nil || IsNil(o.CustomProperties) { + var ret map[string]MetadataValue + return ret + } + return *o.CustomProperties +} + +// GetCustomPropertiesOk returns a tuple with the CustomProperties field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InferenceService) GetCustomPropertiesOk() (*map[string]MetadataValue, bool) { + if o == nil || IsNil(o.CustomProperties) { + return nil, false + } + return o.CustomProperties, true +} + +// HasCustomProperties returns a boolean if a field has been set. +func (o *InferenceService) HasCustomProperties() bool { + if o != nil && !IsNil(o.CustomProperties) { + return true + } + + return false +} + +// SetCustomProperties gets a reference to the given map[string]MetadataValue and assigns it to the CustomProperties field. +func (o *InferenceService) SetCustomProperties(v map[string]MetadataValue) { + o.CustomProperties = &v +} + +// GetExternalID returns the ExternalID field value if set, zero value otherwise. +func (o *InferenceService) GetExternalID() string { + if o == nil || IsNil(o.ExternalID) { + var ret string + return ret + } + return *o.ExternalID +} + +// GetExternalIDOk returns a tuple with the ExternalID field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InferenceService) GetExternalIDOk() (*string, bool) { + if o == nil || IsNil(o.ExternalID) { + return nil, false + } + return o.ExternalID, true +} + +// HasExternalID returns a boolean if a field has been set. +func (o *InferenceService) HasExternalID() bool { + if o != nil && !IsNil(o.ExternalID) { + return true + } + + return false +} + +// SetExternalID gets a reference to the given string and assigns it to the ExternalID field. +func (o *InferenceService) SetExternalID(v string) { + o.ExternalID = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *InferenceService) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InferenceService) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *InferenceService) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *InferenceService) SetName(v string) { + o.Name = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *InferenceService) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InferenceService) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *InferenceService) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *InferenceService) SetId(v string) { + o.Id = &v +} + +// GetCreateTimeSinceEpoch returns the CreateTimeSinceEpoch field value if set, zero value otherwise. +func (o *InferenceService) GetCreateTimeSinceEpoch() string { + if o == nil || IsNil(o.CreateTimeSinceEpoch) { + var ret string + return ret + } + return *o.CreateTimeSinceEpoch +} + +// GetCreateTimeSinceEpochOk returns a tuple with the CreateTimeSinceEpoch field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InferenceService) GetCreateTimeSinceEpochOk() (*string, bool) { + if o == nil || IsNil(o.CreateTimeSinceEpoch) { + return nil, false + } + return o.CreateTimeSinceEpoch, true +} + +// HasCreateTimeSinceEpoch returns a boolean if a field has been set. +func (o *InferenceService) HasCreateTimeSinceEpoch() bool { + if o != nil && !IsNil(o.CreateTimeSinceEpoch) { + return true + } + + return false +} + +// SetCreateTimeSinceEpoch gets a reference to the given string and assigns it to the CreateTimeSinceEpoch field. +func (o *InferenceService) SetCreateTimeSinceEpoch(v string) { + o.CreateTimeSinceEpoch = &v +} + +// GetLastUpdateTimeSinceEpoch returns the LastUpdateTimeSinceEpoch field value if set, zero value otherwise. +func (o *InferenceService) GetLastUpdateTimeSinceEpoch() string { + if o == nil || IsNil(o.LastUpdateTimeSinceEpoch) { + var ret string + return ret + } + return *o.LastUpdateTimeSinceEpoch +} + +// GetLastUpdateTimeSinceEpochOk returns a tuple with the LastUpdateTimeSinceEpoch field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InferenceService) GetLastUpdateTimeSinceEpochOk() (*string, bool) { + if o == nil || IsNil(o.LastUpdateTimeSinceEpoch) { + return nil, false + } + return o.LastUpdateTimeSinceEpoch, true +} + +// HasLastUpdateTimeSinceEpoch returns a boolean if a field has been set. +func (o *InferenceService) HasLastUpdateTimeSinceEpoch() bool { + if o != nil && !IsNil(o.LastUpdateTimeSinceEpoch) { + return true + } + + return false +} + +// SetLastUpdateTimeSinceEpoch gets a reference to the given string and assigns it to the LastUpdateTimeSinceEpoch field. +func (o *InferenceService) SetLastUpdateTimeSinceEpoch(v string) { + o.LastUpdateTimeSinceEpoch = &v +} + +// GetModelVersionId returns the ModelVersionId field value if set, zero value otherwise. +func (o *InferenceService) GetModelVersionId() string { + if o == nil || IsNil(o.ModelVersionId) { + var ret string + return ret + } + return *o.ModelVersionId +} + +// GetModelVersionIdOk returns a tuple with the ModelVersionId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InferenceService) GetModelVersionIdOk() (*string, bool) { + if o == nil || IsNil(o.ModelVersionId) { + return nil, false + } + return o.ModelVersionId, true +} + +// HasModelVersionId returns a boolean if a field has been set. +func (o *InferenceService) HasModelVersionId() bool { + if o != nil && !IsNil(o.ModelVersionId) { + return true + } + + return false +} + +// SetModelVersionId gets a reference to the given string and assigns it to the ModelVersionId field. +func (o *InferenceService) SetModelVersionId(v string) { + o.ModelVersionId = &v +} + +// GetRegisteredModelId returns the RegisteredModelId field value +func (o *InferenceService) GetRegisteredModelId() string { + if o == nil { + var ret string + return ret + } + + return o.RegisteredModelId +} + +// GetRegisteredModelIdOk returns a tuple with the RegisteredModelId field value +// and a boolean to check if the value has been set. +func (o *InferenceService) GetRegisteredModelIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.RegisteredModelId, true +} + +// SetRegisteredModelId sets field value +func (o *InferenceService) SetRegisteredModelId(v string) { + o.RegisteredModelId = v +} + +// GetServingEnvironmentId returns the ServingEnvironmentId field value +func (o *InferenceService) GetServingEnvironmentId() string { + if o == nil { + var ret string + return ret + } + + return o.ServingEnvironmentId +} + +// GetServingEnvironmentIdOk returns a tuple with the ServingEnvironmentId field value +// and a boolean to check if the value has been set. +func (o *InferenceService) GetServingEnvironmentIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ServingEnvironmentId, true +} + +// SetServingEnvironmentId sets field value +func (o *InferenceService) SetServingEnvironmentId(v string) { + o.ServingEnvironmentId = v +} + +func (o InferenceService) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o InferenceService) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CustomProperties) { + toSerialize["customProperties"] = o.CustomProperties + } + if !IsNil(o.ExternalID) { + toSerialize["externalID"] = o.ExternalID + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.CreateTimeSinceEpoch) { + toSerialize["createTimeSinceEpoch"] = o.CreateTimeSinceEpoch + } + if !IsNil(o.LastUpdateTimeSinceEpoch) { + toSerialize["lastUpdateTimeSinceEpoch"] = o.LastUpdateTimeSinceEpoch + } + if !IsNil(o.ModelVersionId) { + toSerialize["modelVersionId"] = o.ModelVersionId + } + toSerialize["registeredModelId"] = o.RegisteredModelId + toSerialize["servingEnvironmentId"] = o.ServingEnvironmentId + return toSerialize, nil +} + +type NullableInferenceService struct { + value *InferenceService + isSet bool +} + +func (v NullableInferenceService) Get() *InferenceService { + return v.value +} + +func (v *NullableInferenceService) Set(val *InferenceService) { + v.value = val + v.isSet = true +} + +func (v NullableInferenceService) IsSet() bool { + return v.isSet +} + +func (v *NullableInferenceService) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInferenceService(val *InferenceService) *NullableInferenceService { + return &NullableInferenceService{value: val, isSet: true} +} + +func (v NullableInferenceService) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInferenceService) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/model/openapi/model_inference_service_create.go b/internal/model/openapi/model_inference_service_create.go new file mode 100644 index 000000000..fd25b6976 --- /dev/null +++ b/internal/model/openapi/model_inference_service_create.go @@ -0,0 +1,292 @@ +/* +Model Registry REST API + +REST API for Model Registry to create and manage ML model metadata + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the InferenceServiceCreate type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &InferenceServiceCreate{} + +// InferenceServiceCreate An `InferenceService` entity in a `ServingEnvironment` represents a deployed `ModelVersion` from a `RegisteredModel` created by Model Serving. +type InferenceServiceCreate struct { + // User provided custom properties which are not defined by its type. + CustomProperties *map[string]MetadataValue `json:"customProperties,omitempty"` + // The external id that come from the clients’ system. This field is optional. If set, it must be unique among all resources within a database instance. + ExternalID *string `json:"externalID,omitempty"` + // The client provided name of the artifact. This field is optional. If set, it must be unique among all the artifacts of the same artifact type within a database instance and cannot be changed once set. + Name *string `json:"name,omitempty"` + // ID of the `ModelVersion` to serve. If it's unspecified, then the latest `ModelVersion` by creation order will be served. + ModelVersionId *string `json:"modelVersionId,omitempty"` + // ID of the `RegisteredModel` to serve. + RegisteredModelId string `json:"registeredModelId"` + // ID of the parent `ServingEnvironment` for this `InferenceService` entity. + ServingEnvironmentId string `json:"servingEnvironmentId"` +} + +// NewInferenceServiceCreate instantiates a new InferenceServiceCreate object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewInferenceServiceCreate(registeredModelId string, servingEnvironmentId string) *InferenceServiceCreate { + this := InferenceServiceCreate{} + this.RegisteredModelId = registeredModelId + this.ServingEnvironmentId = servingEnvironmentId + return &this +} + +// NewInferenceServiceCreateWithDefaults instantiates a new InferenceServiceCreate object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewInferenceServiceCreateWithDefaults() *InferenceServiceCreate { + this := InferenceServiceCreate{} + return &this +} + +// GetCustomProperties returns the CustomProperties field value if set, zero value otherwise. +func (o *InferenceServiceCreate) GetCustomProperties() map[string]MetadataValue { + if o == nil || IsNil(o.CustomProperties) { + var ret map[string]MetadataValue + return ret + } + return *o.CustomProperties +} + +// GetCustomPropertiesOk returns a tuple with the CustomProperties field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InferenceServiceCreate) GetCustomPropertiesOk() (*map[string]MetadataValue, bool) { + if o == nil || IsNil(o.CustomProperties) { + return nil, false + } + return o.CustomProperties, true +} + +// HasCustomProperties returns a boolean if a field has been set. +func (o *InferenceServiceCreate) HasCustomProperties() bool { + if o != nil && !IsNil(o.CustomProperties) { + return true + } + + return false +} + +// SetCustomProperties gets a reference to the given map[string]MetadataValue and assigns it to the CustomProperties field. +func (o *InferenceServiceCreate) SetCustomProperties(v map[string]MetadataValue) { + o.CustomProperties = &v +} + +// GetExternalID returns the ExternalID field value if set, zero value otherwise. +func (o *InferenceServiceCreate) GetExternalID() string { + if o == nil || IsNil(o.ExternalID) { + var ret string + return ret + } + return *o.ExternalID +} + +// GetExternalIDOk returns a tuple with the ExternalID field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InferenceServiceCreate) GetExternalIDOk() (*string, bool) { + if o == nil || IsNil(o.ExternalID) { + return nil, false + } + return o.ExternalID, true +} + +// HasExternalID returns a boolean if a field has been set. +func (o *InferenceServiceCreate) HasExternalID() bool { + if o != nil && !IsNil(o.ExternalID) { + return true + } + + return false +} + +// SetExternalID gets a reference to the given string and assigns it to the ExternalID field. +func (o *InferenceServiceCreate) SetExternalID(v string) { + o.ExternalID = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *InferenceServiceCreate) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InferenceServiceCreate) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *InferenceServiceCreate) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *InferenceServiceCreate) SetName(v string) { + o.Name = &v +} + +// GetModelVersionId returns the ModelVersionId field value if set, zero value otherwise. +func (o *InferenceServiceCreate) GetModelVersionId() string { + if o == nil || IsNil(o.ModelVersionId) { + var ret string + return ret + } + return *o.ModelVersionId +} + +// GetModelVersionIdOk returns a tuple with the ModelVersionId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InferenceServiceCreate) GetModelVersionIdOk() (*string, bool) { + if o == nil || IsNil(o.ModelVersionId) { + return nil, false + } + return o.ModelVersionId, true +} + +// HasModelVersionId returns a boolean if a field has been set. +func (o *InferenceServiceCreate) HasModelVersionId() bool { + if o != nil && !IsNil(o.ModelVersionId) { + return true + } + + return false +} + +// SetModelVersionId gets a reference to the given string and assigns it to the ModelVersionId field. +func (o *InferenceServiceCreate) SetModelVersionId(v string) { + o.ModelVersionId = &v +} + +// GetRegisteredModelId returns the RegisteredModelId field value +func (o *InferenceServiceCreate) GetRegisteredModelId() string { + if o == nil { + var ret string + return ret + } + + return o.RegisteredModelId +} + +// GetRegisteredModelIdOk returns a tuple with the RegisteredModelId field value +// and a boolean to check if the value has been set. +func (o *InferenceServiceCreate) GetRegisteredModelIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.RegisteredModelId, true +} + +// SetRegisteredModelId sets field value +func (o *InferenceServiceCreate) SetRegisteredModelId(v string) { + o.RegisteredModelId = v +} + +// GetServingEnvironmentId returns the ServingEnvironmentId field value +func (o *InferenceServiceCreate) GetServingEnvironmentId() string { + if o == nil { + var ret string + return ret + } + + return o.ServingEnvironmentId +} + +// GetServingEnvironmentIdOk returns a tuple with the ServingEnvironmentId field value +// and a boolean to check if the value has been set. +func (o *InferenceServiceCreate) GetServingEnvironmentIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ServingEnvironmentId, true +} + +// SetServingEnvironmentId sets field value +func (o *InferenceServiceCreate) SetServingEnvironmentId(v string) { + o.ServingEnvironmentId = v +} + +func (o InferenceServiceCreate) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o InferenceServiceCreate) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CustomProperties) { + toSerialize["customProperties"] = o.CustomProperties + } + if !IsNil(o.ExternalID) { + toSerialize["externalID"] = o.ExternalID + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.ModelVersionId) { + toSerialize["modelVersionId"] = o.ModelVersionId + } + toSerialize["registeredModelId"] = o.RegisteredModelId + toSerialize["servingEnvironmentId"] = o.ServingEnvironmentId + return toSerialize, nil +} + +type NullableInferenceServiceCreate struct { + value *InferenceServiceCreate + isSet bool +} + +func (v NullableInferenceServiceCreate) Get() *InferenceServiceCreate { + return v.value +} + +func (v *NullableInferenceServiceCreate) Set(val *InferenceServiceCreate) { + v.value = val + v.isSet = true +} + +func (v NullableInferenceServiceCreate) IsSet() bool { + return v.isSet +} + +func (v *NullableInferenceServiceCreate) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInferenceServiceCreate(val *InferenceServiceCreate) *NullableInferenceServiceCreate { + return &NullableInferenceServiceCreate{value: val, isSet: true} +} + +func (v NullableInferenceServiceCreate) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInferenceServiceCreate) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/model/openapi/model_inference_service_list.go b/internal/model/openapi/model_inference_service_list.go new file mode 100644 index 000000000..e016a5f88 --- /dev/null +++ b/internal/model/openapi/model_inference_service_list.go @@ -0,0 +1,209 @@ +/* +Model Registry REST API + +REST API for Model Registry to create and manage ML model metadata + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the InferenceServiceList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &InferenceServiceList{} + +// InferenceServiceList List of InferenceServices. +type InferenceServiceList struct { + // Token to use to retrieve next page of results. + NextPageToken string `json:"nextPageToken"` + // Maximum number of resources to return in the result. + PageSize int32 `json:"pageSize"` + // Number of items in result list. + Size int32 `json:"size"` + // + Items []InferenceService `json:"items,omitempty"` +} + +// NewInferenceServiceList instantiates a new InferenceServiceList object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewInferenceServiceList(nextPageToken string, pageSize int32, size int32) *InferenceServiceList { + this := InferenceServiceList{} + this.NextPageToken = nextPageToken + this.PageSize = pageSize + this.Size = size + return &this +} + +// NewInferenceServiceListWithDefaults instantiates a new InferenceServiceList object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewInferenceServiceListWithDefaults() *InferenceServiceList { + this := InferenceServiceList{} + return &this +} + +// GetNextPageToken returns the NextPageToken field value +func (o *InferenceServiceList) GetNextPageToken() string { + if o == nil { + var ret string + return ret + } + + return o.NextPageToken +} + +// GetNextPageTokenOk returns a tuple with the NextPageToken field value +// and a boolean to check if the value has been set. +func (o *InferenceServiceList) GetNextPageTokenOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.NextPageToken, true +} + +// SetNextPageToken sets field value +func (o *InferenceServiceList) SetNextPageToken(v string) { + o.NextPageToken = v +} + +// GetPageSize returns the PageSize field value +func (o *InferenceServiceList) GetPageSize() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.PageSize +} + +// GetPageSizeOk returns a tuple with the PageSize field value +// and a boolean to check if the value has been set. +func (o *InferenceServiceList) GetPageSizeOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.PageSize, true +} + +// SetPageSize sets field value +func (o *InferenceServiceList) SetPageSize(v int32) { + o.PageSize = v +} + +// GetSize returns the Size field value +func (o *InferenceServiceList) GetSize() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Size +} + +// GetSizeOk returns a tuple with the Size field value +// and a boolean to check if the value has been set. +func (o *InferenceServiceList) GetSizeOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Size, true +} + +// SetSize sets field value +func (o *InferenceServiceList) SetSize(v int32) { + o.Size = v +} + +// GetItems returns the Items field value if set, zero value otherwise. +func (o *InferenceServiceList) GetItems() []InferenceService { + if o == nil || IsNil(o.Items) { + var ret []InferenceService + return ret + } + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InferenceServiceList) GetItemsOk() ([]InferenceService, bool) { + if o == nil || IsNil(o.Items) { + return nil, false + } + return o.Items, true +} + +// HasItems returns a boolean if a field has been set. +func (o *InferenceServiceList) HasItems() bool { + if o != nil && !IsNil(o.Items) { + return true + } + + return false +} + +// SetItems gets a reference to the given []InferenceService and assigns it to the Items field. +func (o *InferenceServiceList) SetItems(v []InferenceService) { + o.Items = v +} + +func (o InferenceServiceList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o InferenceServiceList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["nextPageToken"] = o.NextPageToken + toSerialize["pageSize"] = o.PageSize + toSerialize["size"] = o.Size + if !IsNil(o.Items) { + toSerialize["items"] = o.Items + } + return toSerialize, nil +} + +type NullableInferenceServiceList struct { + value *InferenceServiceList + isSet bool +} + +func (v NullableInferenceServiceList) Get() *InferenceServiceList { + return v.value +} + +func (v *NullableInferenceServiceList) Set(val *InferenceServiceList) { + v.value = val + v.isSet = true +} + +func (v NullableInferenceServiceList) IsSet() bool { + return v.isSet +} + +func (v *NullableInferenceServiceList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInferenceServiceList(val *InferenceServiceList) *NullableInferenceServiceList { + return &NullableInferenceServiceList{value: val, isSet: true} +} + +func (v NullableInferenceServiceList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInferenceServiceList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/model/openapi/model_inference_service_update.go b/internal/model/openapi/model_inference_service_update.go new file mode 100644 index 000000000..31b1d982e --- /dev/null +++ b/internal/model/openapi/model_inference_service_update.go @@ -0,0 +1,199 @@ +/* +Model Registry REST API + +REST API for Model Registry to create and manage ML model metadata + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the InferenceServiceUpdate type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &InferenceServiceUpdate{} + +// InferenceServiceUpdate An `InferenceService` entity in a `ServingEnvironment` represents a deployed `ModelVersion` from a `RegisteredModel` created by Model Serving. +type InferenceServiceUpdate struct { + // User provided custom properties which are not defined by its type. + CustomProperties *map[string]MetadataValue `json:"customProperties,omitempty"` + // The external id that come from the clients’ system. This field is optional. If set, it must be unique among all resources within a database instance. + ExternalID *string `json:"externalID,omitempty"` + // ID of the `ModelVersion` to serve. If it's unspecified, then the latest `ModelVersion` by creation order will be served. + ModelVersionId *string `json:"modelVersionId,omitempty"` +} + +// NewInferenceServiceUpdate instantiates a new InferenceServiceUpdate object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewInferenceServiceUpdate() *InferenceServiceUpdate { + this := InferenceServiceUpdate{} + return &this +} + +// NewInferenceServiceUpdateWithDefaults instantiates a new InferenceServiceUpdate object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewInferenceServiceUpdateWithDefaults() *InferenceServiceUpdate { + this := InferenceServiceUpdate{} + return &this +} + +// GetCustomProperties returns the CustomProperties field value if set, zero value otherwise. +func (o *InferenceServiceUpdate) GetCustomProperties() map[string]MetadataValue { + if o == nil || IsNil(o.CustomProperties) { + var ret map[string]MetadataValue + return ret + } + return *o.CustomProperties +} + +// GetCustomPropertiesOk returns a tuple with the CustomProperties field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InferenceServiceUpdate) GetCustomPropertiesOk() (*map[string]MetadataValue, bool) { + if o == nil || IsNil(o.CustomProperties) { + return nil, false + } + return o.CustomProperties, true +} + +// HasCustomProperties returns a boolean if a field has been set. +func (o *InferenceServiceUpdate) HasCustomProperties() bool { + if o != nil && !IsNil(o.CustomProperties) { + return true + } + + return false +} + +// SetCustomProperties gets a reference to the given map[string]MetadataValue and assigns it to the CustomProperties field. +func (o *InferenceServiceUpdate) SetCustomProperties(v map[string]MetadataValue) { + o.CustomProperties = &v +} + +// GetExternalID returns the ExternalID field value if set, zero value otherwise. +func (o *InferenceServiceUpdate) GetExternalID() string { + if o == nil || IsNil(o.ExternalID) { + var ret string + return ret + } + return *o.ExternalID +} + +// GetExternalIDOk returns a tuple with the ExternalID field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InferenceServiceUpdate) GetExternalIDOk() (*string, bool) { + if o == nil || IsNil(o.ExternalID) { + return nil, false + } + return o.ExternalID, true +} + +// HasExternalID returns a boolean if a field has been set. +func (o *InferenceServiceUpdate) HasExternalID() bool { + if o != nil && !IsNil(o.ExternalID) { + return true + } + + return false +} + +// SetExternalID gets a reference to the given string and assigns it to the ExternalID field. +func (o *InferenceServiceUpdate) SetExternalID(v string) { + o.ExternalID = &v +} + +// GetModelVersionId returns the ModelVersionId field value if set, zero value otherwise. +func (o *InferenceServiceUpdate) GetModelVersionId() string { + if o == nil || IsNil(o.ModelVersionId) { + var ret string + return ret + } + return *o.ModelVersionId +} + +// GetModelVersionIdOk returns a tuple with the ModelVersionId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InferenceServiceUpdate) GetModelVersionIdOk() (*string, bool) { + if o == nil || IsNil(o.ModelVersionId) { + return nil, false + } + return o.ModelVersionId, true +} + +// HasModelVersionId returns a boolean if a field has been set. +func (o *InferenceServiceUpdate) HasModelVersionId() bool { + if o != nil && !IsNil(o.ModelVersionId) { + return true + } + + return false +} + +// SetModelVersionId gets a reference to the given string and assigns it to the ModelVersionId field. +func (o *InferenceServiceUpdate) SetModelVersionId(v string) { + o.ModelVersionId = &v +} + +func (o InferenceServiceUpdate) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o InferenceServiceUpdate) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CustomProperties) { + toSerialize["customProperties"] = o.CustomProperties + } + if !IsNil(o.ExternalID) { + toSerialize["externalID"] = o.ExternalID + } + if !IsNil(o.ModelVersionId) { + toSerialize["modelVersionId"] = o.ModelVersionId + } + return toSerialize, nil +} + +type NullableInferenceServiceUpdate struct { + value *InferenceServiceUpdate + isSet bool +} + +func (v NullableInferenceServiceUpdate) Get() *InferenceServiceUpdate { + return v.value +} + +func (v *NullableInferenceServiceUpdate) Set(val *InferenceServiceUpdate) { + v.value = val + v.isSet = true +} + +func (v NullableInferenceServiceUpdate) IsSet() bool { + return v.isSet +} + +func (v *NullableInferenceServiceUpdate) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInferenceServiceUpdate(val *InferenceServiceUpdate) *NullableInferenceServiceUpdate { + return &NullableInferenceServiceUpdate{value: val, isSet: true} +} + +func (v NullableInferenceServiceUpdate) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInferenceServiceUpdate) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/model/openapi/model_metadata_value.go b/internal/model/openapi/model_metadata_value.go new file mode 100644 index 000000000..e26874691 --- /dev/null +++ b/internal/model/openapi/model_metadata_value.go @@ -0,0 +1,265 @@ +/* +Model Registry REST API + +REST API for Model Registry to create and manage ML model metadata + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "fmt" +) + +// MetadataValue - A value in properties. +type MetadataValue struct { + MetadataValueOneOf *MetadataValueOneOf + MetadataValueOneOf1 *MetadataValueOneOf1 + MetadataValueOneOf2 *MetadataValueOneOf2 + MetadataValueOneOf3 *MetadataValueOneOf3 + MetadataValueOneOf4 *MetadataValueOneOf4 + MetadataValueOneOf5 *MetadataValueOneOf5 +} + +// MetadataValueOneOfAsMetadataValue is a convenience function that returns MetadataValueOneOf wrapped in MetadataValue +func MetadataValueOneOfAsMetadataValue(v *MetadataValueOneOf) MetadataValue { + return MetadataValue{ + MetadataValueOneOf: v, + } +} + +// MetadataValueOneOf1AsMetadataValue is a convenience function that returns MetadataValueOneOf1 wrapped in MetadataValue +func MetadataValueOneOf1AsMetadataValue(v *MetadataValueOneOf1) MetadataValue { + return MetadataValue{ + MetadataValueOneOf1: v, + } +} + +// MetadataValueOneOf2AsMetadataValue is a convenience function that returns MetadataValueOneOf2 wrapped in MetadataValue +func MetadataValueOneOf2AsMetadataValue(v *MetadataValueOneOf2) MetadataValue { + return MetadataValue{ + MetadataValueOneOf2: v, + } +} + +// MetadataValueOneOf3AsMetadataValue is a convenience function that returns MetadataValueOneOf3 wrapped in MetadataValue +func MetadataValueOneOf3AsMetadataValue(v *MetadataValueOneOf3) MetadataValue { + return MetadataValue{ + MetadataValueOneOf3: v, + } +} + +// MetadataValueOneOf4AsMetadataValue is a convenience function that returns MetadataValueOneOf4 wrapped in MetadataValue +func MetadataValueOneOf4AsMetadataValue(v *MetadataValueOneOf4) MetadataValue { + return MetadataValue{ + MetadataValueOneOf4: v, + } +} + +// MetadataValueOneOf5AsMetadataValue is a convenience function that returns MetadataValueOneOf5 wrapped in MetadataValue +func MetadataValueOneOf5AsMetadataValue(v *MetadataValueOneOf5) MetadataValue { + return MetadataValue{ + MetadataValueOneOf5: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *MetadataValue) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into MetadataValueOneOf + err = json.Unmarshal(data, &dst.MetadataValueOneOf) + if err == nil { + jsonMetadataValueOneOf, _ := json.Marshal(dst.MetadataValueOneOf) + if string(jsonMetadataValueOneOf) == "{}" { // empty struct + dst.MetadataValueOneOf = nil + } else { + match++ + } + } else { + dst.MetadataValueOneOf = nil + } + + // try to unmarshal data into MetadataValueOneOf1 + err = json.Unmarshal(data, &dst.MetadataValueOneOf1) + if err == nil { + jsonMetadataValueOneOf1, _ := json.Marshal(dst.MetadataValueOneOf1) + if string(jsonMetadataValueOneOf1) == "{}" { // empty struct + dst.MetadataValueOneOf1 = nil + } else { + match++ + } + } else { + dst.MetadataValueOneOf1 = nil + } + + // try to unmarshal data into MetadataValueOneOf2 + err = json.Unmarshal(data, &dst.MetadataValueOneOf2) + if err == nil { + jsonMetadataValueOneOf2, _ := json.Marshal(dst.MetadataValueOneOf2) + if string(jsonMetadataValueOneOf2) == "{}" { // empty struct + dst.MetadataValueOneOf2 = nil + } else { + match++ + } + } else { + dst.MetadataValueOneOf2 = nil + } + + // try to unmarshal data into MetadataValueOneOf3 + err = json.Unmarshal(data, &dst.MetadataValueOneOf3) + if err == nil { + jsonMetadataValueOneOf3, _ := json.Marshal(dst.MetadataValueOneOf3) + if string(jsonMetadataValueOneOf3) == "{}" { // empty struct + dst.MetadataValueOneOf3 = nil + } else { + match++ + } + } else { + dst.MetadataValueOneOf3 = nil + } + + // try to unmarshal data into MetadataValueOneOf4 + err = json.Unmarshal(data, &dst.MetadataValueOneOf4) + if err == nil { + jsonMetadataValueOneOf4, _ := json.Marshal(dst.MetadataValueOneOf4) + if string(jsonMetadataValueOneOf4) == "{}" { // empty struct + dst.MetadataValueOneOf4 = nil + } else { + match++ + } + } else { + dst.MetadataValueOneOf4 = nil + } + + // try to unmarshal data into MetadataValueOneOf5 + err = json.Unmarshal(data, &dst.MetadataValueOneOf5) + if err == nil { + jsonMetadataValueOneOf5, _ := json.Marshal(dst.MetadataValueOneOf5) + if string(jsonMetadataValueOneOf5) == "{}" { // empty struct + dst.MetadataValueOneOf5 = nil + } else { + match++ + } + } else { + dst.MetadataValueOneOf5 = nil + } + + if match > 1 { // more than 1 match + // reset to nil + dst.MetadataValueOneOf = nil + dst.MetadataValueOneOf1 = nil + dst.MetadataValueOneOf2 = nil + dst.MetadataValueOneOf3 = nil + dst.MetadataValueOneOf4 = nil + dst.MetadataValueOneOf5 = nil + + return fmt.Errorf("data matches more than one schema in oneOf(MetadataValue)") + } else if match == 1 { + return nil // exactly one match + } else { // no match + return fmt.Errorf("data failed to match schemas in oneOf(MetadataValue)") + } +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src MetadataValue) MarshalJSON() ([]byte, error) { + if src.MetadataValueOneOf != nil { + return json.Marshal(&src.MetadataValueOneOf) + } + + if src.MetadataValueOneOf1 != nil { + return json.Marshal(&src.MetadataValueOneOf1) + } + + if src.MetadataValueOneOf2 != nil { + return json.Marshal(&src.MetadataValueOneOf2) + } + + if src.MetadataValueOneOf3 != nil { + return json.Marshal(&src.MetadataValueOneOf3) + } + + if src.MetadataValueOneOf4 != nil { + return json.Marshal(&src.MetadataValueOneOf4) + } + + if src.MetadataValueOneOf5 != nil { + return json.Marshal(&src.MetadataValueOneOf5) + } + + return nil, nil // no data in oneOf schemas +} + +// Get the actual instance +func (obj *MetadataValue) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.MetadataValueOneOf != nil { + return obj.MetadataValueOneOf + } + + if obj.MetadataValueOneOf1 != nil { + return obj.MetadataValueOneOf1 + } + + if obj.MetadataValueOneOf2 != nil { + return obj.MetadataValueOneOf2 + } + + if obj.MetadataValueOneOf3 != nil { + return obj.MetadataValueOneOf3 + } + + if obj.MetadataValueOneOf4 != nil { + return obj.MetadataValueOneOf4 + } + + if obj.MetadataValueOneOf5 != nil { + return obj.MetadataValueOneOf5 + } + + // all schemas are nil + return nil +} + +type NullableMetadataValue struct { + value *MetadataValue + isSet bool +} + +func (v NullableMetadataValue) Get() *MetadataValue { + return v.value +} + +func (v *NullableMetadataValue) Set(val *MetadataValue) { + v.value = val + v.isSet = true +} + +func (v NullableMetadataValue) IsSet() bool { + return v.isSet +} + +func (v *NullableMetadataValue) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableMetadataValue(val *MetadataValue) *NullableMetadataValue { + return &NullableMetadataValue{value: val, isSet: true} +} + +func (v NullableMetadataValue) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableMetadataValue) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/model/openapi/model_metadata_value_one_of.go b/internal/model/openapi/model_metadata_value_one_of.go new file mode 100644 index 000000000..c9b8615c0 --- /dev/null +++ b/internal/model/openapi/model_metadata_value_one_of.go @@ -0,0 +1,124 @@ +/* +Model Registry REST API + +REST API for Model Registry to create and manage ML model metadata + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the MetadataValueOneOf type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &MetadataValueOneOf{} + +// MetadataValueOneOf struct for MetadataValueOneOf +type MetadataValueOneOf struct { + IntValue *string `json:"int_value,omitempty"` +} + +// NewMetadataValueOneOf instantiates a new MetadataValueOneOf object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewMetadataValueOneOf() *MetadataValueOneOf { + this := MetadataValueOneOf{} + return &this +} + +// NewMetadataValueOneOfWithDefaults instantiates a new MetadataValueOneOf object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewMetadataValueOneOfWithDefaults() *MetadataValueOneOf { + this := MetadataValueOneOf{} + return &this +} + +// GetIntValue returns the IntValue field value if set, zero value otherwise. +func (o *MetadataValueOneOf) GetIntValue() string { + if o == nil || IsNil(o.IntValue) { + var ret string + return ret + } + return *o.IntValue +} + +// GetIntValueOk returns a tuple with the IntValue field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetadataValueOneOf) GetIntValueOk() (*string, bool) { + if o == nil || IsNil(o.IntValue) { + return nil, false + } + return o.IntValue, true +} + +// HasIntValue returns a boolean if a field has been set. +func (o *MetadataValueOneOf) HasIntValue() bool { + if o != nil && !IsNil(o.IntValue) { + return true + } + + return false +} + +// SetIntValue gets a reference to the given string and assigns it to the IntValue field. +func (o *MetadataValueOneOf) SetIntValue(v string) { + o.IntValue = &v +} + +func (o MetadataValueOneOf) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o MetadataValueOneOf) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.IntValue) { + toSerialize["int_value"] = o.IntValue + } + return toSerialize, nil +} + +type NullableMetadataValueOneOf struct { + value *MetadataValueOneOf + isSet bool +} + +func (v NullableMetadataValueOneOf) Get() *MetadataValueOneOf { + return v.value +} + +func (v *NullableMetadataValueOneOf) Set(val *MetadataValueOneOf) { + v.value = val + v.isSet = true +} + +func (v NullableMetadataValueOneOf) IsSet() bool { + return v.isSet +} + +func (v *NullableMetadataValueOneOf) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableMetadataValueOneOf(val *MetadataValueOneOf) *NullableMetadataValueOneOf { + return &NullableMetadataValueOneOf{value: val, isSet: true} +} + +func (v NullableMetadataValueOneOf) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableMetadataValueOneOf) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/model/openapi/model_metadata_value_one_of_1.go b/internal/model/openapi/model_metadata_value_one_of_1.go new file mode 100644 index 000000000..60d232bd8 --- /dev/null +++ b/internal/model/openapi/model_metadata_value_one_of_1.go @@ -0,0 +1,124 @@ +/* +Model Registry REST API + +REST API for Model Registry to create and manage ML model metadata + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the MetadataValueOneOf1 type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &MetadataValueOneOf1{} + +// MetadataValueOneOf1 struct for MetadataValueOneOf1 +type MetadataValueOneOf1 struct { + DoubleValue *float64 `json:"double_value,omitempty"` +} + +// NewMetadataValueOneOf1 instantiates a new MetadataValueOneOf1 object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewMetadataValueOneOf1() *MetadataValueOneOf1 { + this := MetadataValueOneOf1{} + return &this +} + +// NewMetadataValueOneOf1WithDefaults instantiates a new MetadataValueOneOf1 object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewMetadataValueOneOf1WithDefaults() *MetadataValueOneOf1 { + this := MetadataValueOneOf1{} + return &this +} + +// GetDoubleValue returns the DoubleValue field value if set, zero value otherwise. +func (o *MetadataValueOneOf1) GetDoubleValue() float64 { + if o == nil || IsNil(o.DoubleValue) { + var ret float64 + return ret + } + return *o.DoubleValue +} + +// GetDoubleValueOk returns a tuple with the DoubleValue field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetadataValueOneOf1) GetDoubleValueOk() (*float64, bool) { + if o == nil || IsNil(o.DoubleValue) { + return nil, false + } + return o.DoubleValue, true +} + +// HasDoubleValue returns a boolean if a field has been set. +func (o *MetadataValueOneOf1) HasDoubleValue() bool { + if o != nil && !IsNil(o.DoubleValue) { + return true + } + + return false +} + +// SetDoubleValue gets a reference to the given float64 and assigns it to the DoubleValue field. +func (o *MetadataValueOneOf1) SetDoubleValue(v float64) { + o.DoubleValue = &v +} + +func (o MetadataValueOneOf1) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o MetadataValueOneOf1) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.DoubleValue) { + toSerialize["double_value"] = o.DoubleValue + } + return toSerialize, nil +} + +type NullableMetadataValueOneOf1 struct { + value *MetadataValueOneOf1 + isSet bool +} + +func (v NullableMetadataValueOneOf1) Get() *MetadataValueOneOf1 { + return v.value +} + +func (v *NullableMetadataValueOneOf1) Set(val *MetadataValueOneOf1) { + v.value = val + v.isSet = true +} + +func (v NullableMetadataValueOneOf1) IsSet() bool { + return v.isSet +} + +func (v *NullableMetadataValueOneOf1) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableMetadataValueOneOf1(val *MetadataValueOneOf1) *NullableMetadataValueOneOf1 { + return &NullableMetadataValueOneOf1{value: val, isSet: true} +} + +func (v NullableMetadataValueOneOf1) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableMetadataValueOneOf1) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/model/openapi/model_metadata_value_one_of_2.go b/internal/model/openapi/model_metadata_value_one_of_2.go new file mode 100644 index 000000000..51a96b9f7 --- /dev/null +++ b/internal/model/openapi/model_metadata_value_one_of_2.go @@ -0,0 +1,124 @@ +/* +Model Registry REST API + +REST API for Model Registry to create and manage ML model metadata + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the MetadataValueOneOf2 type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &MetadataValueOneOf2{} + +// MetadataValueOneOf2 struct for MetadataValueOneOf2 +type MetadataValueOneOf2 struct { + StringValue *string `json:"string_value,omitempty"` +} + +// NewMetadataValueOneOf2 instantiates a new MetadataValueOneOf2 object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewMetadataValueOneOf2() *MetadataValueOneOf2 { + this := MetadataValueOneOf2{} + return &this +} + +// NewMetadataValueOneOf2WithDefaults instantiates a new MetadataValueOneOf2 object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewMetadataValueOneOf2WithDefaults() *MetadataValueOneOf2 { + this := MetadataValueOneOf2{} + return &this +} + +// GetStringValue returns the StringValue field value if set, zero value otherwise. +func (o *MetadataValueOneOf2) GetStringValue() string { + if o == nil || IsNil(o.StringValue) { + var ret string + return ret + } + return *o.StringValue +} + +// GetStringValueOk returns a tuple with the StringValue field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetadataValueOneOf2) GetStringValueOk() (*string, bool) { + if o == nil || IsNil(o.StringValue) { + return nil, false + } + return o.StringValue, true +} + +// HasStringValue returns a boolean if a field has been set. +func (o *MetadataValueOneOf2) HasStringValue() bool { + if o != nil && !IsNil(o.StringValue) { + return true + } + + return false +} + +// SetStringValue gets a reference to the given string and assigns it to the StringValue field. +func (o *MetadataValueOneOf2) SetStringValue(v string) { + o.StringValue = &v +} + +func (o MetadataValueOneOf2) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o MetadataValueOneOf2) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.StringValue) { + toSerialize["string_value"] = o.StringValue + } + return toSerialize, nil +} + +type NullableMetadataValueOneOf2 struct { + value *MetadataValueOneOf2 + isSet bool +} + +func (v NullableMetadataValueOneOf2) Get() *MetadataValueOneOf2 { + return v.value +} + +func (v *NullableMetadataValueOneOf2) Set(val *MetadataValueOneOf2) { + v.value = val + v.isSet = true +} + +func (v NullableMetadataValueOneOf2) IsSet() bool { + return v.isSet +} + +func (v *NullableMetadataValueOneOf2) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableMetadataValueOneOf2(val *MetadataValueOneOf2) *NullableMetadataValueOneOf2 { + return &NullableMetadataValueOneOf2{value: val, isSet: true} +} + +func (v NullableMetadataValueOneOf2) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableMetadataValueOneOf2) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/model/openapi/model_metadata_value_one_of_3.go b/internal/model/openapi/model_metadata_value_one_of_3.go new file mode 100644 index 000000000..c637edd94 --- /dev/null +++ b/internal/model/openapi/model_metadata_value_one_of_3.go @@ -0,0 +1,125 @@ +/* +Model Registry REST API + +REST API for Model Registry to create and manage ML model metadata + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the MetadataValueOneOf3 type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &MetadataValueOneOf3{} + +// MetadataValueOneOf3 struct for MetadataValueOneOf3 +type MetadataValueOneOf3 struct { + // Base64 encoded bytes for struct value + StructValue *string `json:"struct_value,omitempty"` +} + +// NewMetadataValueOneOf3 instantiates a new MetadataValueOneOf3 object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewMetadataValueOneOf3() *MetadataValueOneOf3 { + this := MetadataValueOneOf3{} + return &this +} + +// NewMetadataValueOneOf3WithDefaults instantiates a new MetadataValueOneOf3 object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewMetadataValueOneOf3WithDefaults() *MetadataValueOneOf3 { + this := MetadataValueOneOf3{} + return &this +} + +// GetStructValue returns the StructValue field value if set, zero value otherwise. +func (o *MetadataValueOneOf3) GetStructValue() string { + if o == nil || IsNil(o.StructValue) { + var ret string + return ret + } + return *o.StructValue +} + +// GetStructValueOk returns a tuple with the StructValue field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetadataValueOneOf3) GetStructValueOk() (*string, bool) { + if o == nil || IsNil(o.StructValue) { + return nil, false + } + return o.StructValue, true +} + +// HasStructValue returns a boolean if a field has been set. +func (o *MetadataValueOneOf3) HasStructValue() bool { + if o != nil && !IsNil(o.StructValue) { + return true + } + + return false +} + +// SetStructValue gets a reference to the given string and assigns it to the StructValue field. +func (o *MetadataValueOneOf3) SetStructValue(v string) { + o.StructValue = &v +} + +func (o MetadataValueOneOf3) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o MetadataValueOneOf3) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.StructValue) { + toSerialize["struct_value"] = o.StructValue + } + return toSerialize, nil +} + +type NullableMetadataValueOneOf3 struct { + value *MetadataValueOneOf3 + isSet bool +} + +func (v NullableMetadataValueOneOf3) Get() *MetadataValueOneOf3 { + return v.value +} + +func (v *NullableMetadataValueOneOf3) Set(val *MetadataValueOneOf3) { + v.value = val + v.isSet = true +} + +func (v NullableMetadataValueOneOf3) IsSet() bool { + return v.isSet +} + +func (v *NullableMetadataValueOneOf3) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableMetadataValueOneOf3(val *MetadataValueOneOf3) *NullableMetadataValueOneOf3 { + return &NullableMetadataValueOneOf3{value: val, isSet: true} +} + +func (v NullableMetadataValueOneOf3) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableMetadataValueOneOf3) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/model/openapi/model_metadata_value_one_of_4.go b/internal/model/openapi/model_metadata_value_one_of_4.go new file mode 100644 index 000000000..622f98100 --- /dev/null +++ b/internal/model/openapi/model_metadata_value_one_of_4.go @@ -0,0 +1,162 @@ +/* +Model Registry REST API + +REST API for Model Registry to create and manage ML model metadata + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the MetadataValueOneOf4 type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &MetadataValueOneOf4{} + +// MetadataValueOneOf4 struct for MetadataValueOneOf4 +type MetadataValueOneOf4 struct { + // url describing proto value + Type *string `json:"type,omitempty"` + // Base64 encoded bytes for proto value + ProtoValue *string `json:"proto_value,omitempty"` +} + +// NewMetadataValueOneOf4 instantiates a new MetadataValueOneOf4 object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewMetadataValueOneOf4() *MetadataValueOneOf4 { + this := MetadataValueOneOf4{} + return &this +} + +// NewMetadataValueOneOf4WithDefaults instantiates a new MetadataValueOneOf4 object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewMetadataValueOneOf4WithDefaults() *MetadataValueOneOf4 { + this := MetadataValueOneOf4{} + return &this +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *MetadataValueOneOf4) GetType() string { + if o == nil || IsNil(o.Type) { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetadataValueOneOf4) GetTypeOk() (*string, bool) { + if o == nil || IsNil(o.Type) { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *MetadataValueOneOf4) HasType() bool { + if o != nil && !IsNil(o.Type) { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *MetadataValueOneOf4) SetType(v string) { + o.Type = &v +} + +// GetProtoValue returns the ProtoValue field value if set, zero value otherwise. +func (o *MetadataValueOneOf4) GetProtoValue() string { + if o == nil || IsNil(o.ProtoValue) { + var ret string + return ret + } + return *o.ProtoValue +} + +// GetProtoValueOk returns a tuple with the ProtoValue field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetadataValueOneOf4) GetProtoValueOk() (*string, bool) { + if o == nil || IsNil(o.ProtoValue) { + return nil, false + } + return o.ProtoValue, true +} + +// HasProtoValue returns a boolean if a field has been set. +func (o *MetadataValueOneOf4) HasProtoValue() bool { + if o != nil && !IsNil(o.ProtoValue) { + return true + } + + return false +} + +// SetProtoValue gets a reference to the given string and assigns it to the ProtoValue field. +func (o *MetadataValueOneOf4) SetProtoValue(v string) { + o.ProtoValue = &v +} + +func (o MetadataValueOneOf4) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o MetadataValueOneOf4) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Type) { + toSerialize["type"] = o.Type + } + if !IsNil(o.ProtoValue) { + toSerialize["proto_value"] = o.ProtoValue + } + return toSerialize, nil +} + +type NullableMetadataValueOneOf4 struct { + value *MetadataValueOneOf4 + isSet bool +} + +func (v NullableMetadataValueOneOf4) Get() *MetadataValueOneOf4 { + return v.value +} + +func (v *NullableMetadataValueOneOf4) Set(val *MetadataValueOneOf4) { + v.value = val + v.isSet = true +} + +func (v NullableMetadataValueOneOf4) IsSet() bool { + return v.isSet +} + +func (v *NullableMetadataValueOneOf4) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableMetadataValueOneOf4(val *MetadataValueOneOf4) *NullableMetadataValueOneOf4 { + return &NullableMetadataValueOneOf4{value: val, isSet: true} +} + +func (v NullableMetadataValueOneOf4) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableMetadataValueOneOf4) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/model/openapi/model_metadata_value_one_of_5.go b/internal/model/openapi/model_metadata_value_one_of_5.go new file mode 100644 index 000000000..745320ed2 --- /dev/null +++ b/internal/model/openapi/model_metadata_value_one_of_5.go @@ -0,0 +1,124 @@ +/* +Model Registry REST API + +REST API for Model Registry to create and manage ML model metadata + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the MetadataValueOneOf5 type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &MetadataValueOneOf5{} + +// MetadataValueOneOf5 struct for MetadataValueOneOf5 +type MetadataValueOneOf5 struct { + BoolValue *bool `json:"bool_value,omitempty"` +} + +// NewMetadataValueOneOf5 instantiates a new MetadataValueOneOf5 object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewMetadataValueOneOf5() *MetadataValueOneOf5 { + this := MetadataValueOneOf5{} + return &this +} + +// NewMetadataValueOneOf5WithDefaults instantiates a new MetadataValueOneOf5 object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewMetadataValueOneOf5WithDefaults() *MetadataValueOneOf5 { + this := MetadataValueOneOf5{} + return &this +} + +// GetBoolValue returns the BoolValue field value if set, zero value otherwise. +func (o *MetadataValueOneOf5) GetBoolValue() bool { + if o == nil || IsNil(o.BoolValue) { + var ret bool + return ret + } + return *o.BoolValue +} + +// GetBoolValueOk returns a tuple with the BoolValue field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MetadataValueOneOf5) GetBoolValueOk() (*bool, bool) { + if o == nil || IsNil(o.BoolValue) { + return nil, false + } + return o.BoolValue, true +} + +// HasBoolValue returns a boolean if a field has been set. +func (o *MetadataValueOneOf5) HasBoolValue() bool { + if o != nil && !IsNil(o.BoolValue) { + return true + } + + return false +} + +// SetBoolValue gets a reference to the given bool and assigns it to the BoolValue field. +func (o *MetadataValueOneOf5) SetBoolValue(v bool) { + o.BoolValue = &v +} + +func (o MetadataValueOneOf5) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o MetadataValueOneOf5) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.BoolValue) { + toSerialize["bool_value"] = o.BoolValue + } + return toSerialize, nil +} + +type NullableMetadataValueOneOf5 struct { + value *MetadataValueOneOf5 + isSet bool +} + +func (v NullableMetadataValueOneOf5) Get() *MetadataValueOneOf5 { + return v.value +} + +func (v *NullableMetadataValueOneOf5) Set(val *MetadataValueOneOf5) { + v.value = val + v.isSet = true +} + +func (v NullableMetadataValueOneOf5) IsSet() bool { + return v.isSet +} + +func (v *NullableMetadataValueOneOf5) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableMetadataValueOneOf5(val *MetadataValueOneOf5) *NullableMetadataValueOneOf5 { + return &NullableMetadataValueOneOf5{value: val, isSet: true} +} + +func (v NullableMetadataValueOneOf5) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableMetadataValueOneOf5) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/model/openapi/model_model_artifact.go b/internal/model/openapi/model_model_artifact.go new file mode 100644 index 000000000..3b064d1b5 --- /dev/null +++ b/internal/model/openapi/model_model_artifact.go @@ -0,0 +1,636 @@ +/* +Model Registry REST API + +REST API for Model Registry to create and manage ML model metadata + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the ModelArtifact type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ModelArtifact{} + +// ModelArtifact An ML model artifact. +type ModelArtifact struct { + // User provided custom properties which are not defined by its type. + CustomProperties *map[string]MetadataValue `json:"customProperties,omitempty"` + // The external id that come from the clients’ system. This field is optional. If set, it must be unique among all resources within a database instance. + ExternalID *string `json:"externalID,omitempty"` + // The uniform resource identifier of the physical artifact. May be empty if there is no physical artifact. + Uri *string `json:"uri,omitempty"` + State *ArtifactState `json:"state,omitempty"` + // The client provided name of the artifact. This field is optional. If set, it must be unique among all the artifacts of the same artifact type within a database instance and cannot be changed once set. + Name *string `json:"name,omitempty"` + // Output only. The unique server generated id of the resource. + Id *string `json:"id,omitempty"` + // Output only. Create time of the resource in millisecond since epoch. + CreateTimeSinceEpoch *string `json:"createTimeSinceEpoch,omitempty"` + // Output only. Last update time of the resource since epoch in millisecond since epoch. + LastUpdateTimeSinceEpoch *string `json:"lastUpdateTimeSinceEpoch,omitempty"` + ArtifactType string `json:"artifactType"` + // Name of the model format. + ModelFormatName *string `json:"modelFormatName,omitempty"` + // Model runtime. + Runtime *string `json:"runtime,omitempty"` + // Storage secret name. + StorageKey *string `json:"storageKey,omitempty"` + // Path for model in storage provided by `storageKey`. + StoragePath *string `json:"storagePath,omitempty"` + // Version of the model format. + ModelFormatVersion *string `json:"modelFormatVersion,omitempty"` + // Name of the service account with storage secret. + ServiceAccountName *string `json:"serviceAccountName,omitempty"` +} + +// NewModelArtifact instantiates a new ModelArtifact object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewModelArtifact(artifactType string) *ModelArtifact { + this := ModelArtifact{} + var state ArtifactState = ARTIFACTSTATE_UNKNOWN + this.State = &state + this.ArtifactType = artifactType + return &this +} + +// NewModelArtifactWithDefaults instantiates a new ModelArtifact object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewModelArtifactWithDefaults() *ModelArtifact { + this := ModelArtifact{} + var state ArtifactState = ARTIFACTSTATE_UNKNOWN + this.State = &state + return &this +} + +// GetCustomProperties returns the CustomProperties field value if set, zero value otherwise. +func (o *ModelArtifact) GetCustomProperties() map[string]MetadataValue { + if o == nil || IsNil(o.CustomProperties) { + var ret map[string]MetadataValue + return ret + } + return *o.CustomProperties +} + +// GetCustomPropertiesOk returns a tuple with the CustomProperties field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ModelArtifact) GetCustomPropertiesOk() (*map[string]MetadataValue, bool) { + if o == nil || IsNil(o.CustomProperties) { + return nil, false + } + return o.CustomProperties, true +} + +// HasCustomProperties returns a boolean if a field has been set. +func (o *ModelArtifact) HasCustomProperties() bool { + if o != nil && !IsNil(o.CustomProperties) { + return true + } + + return false +} + +// SetCustomProperties gets a reference to the given map[string]MetadataValue and assigns it to the CustomProperties field. +func (o *ModelArtifact) SetCustomProperties(v map[string]MetadataValue) { + o.CustomProperties = &v +} + +// GetExternalID returns the ExternalID field value if set, zero value otherwise. +func (o *ModelArtifact) GetExternalID() string { + if o == nil || IsNil(o.ExternalID) { + var ret string + return ret + } + return *o.ExternalID +} + +// GetExternalIDOk returns a tuple with the ExternalID field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ModelArtifact) GetExternalIDOk() (*string, bool) { + if o == nil || IsNil(o.ExternalID) { + return nil, false + } + return o.ExternalID, true +} + +// HasExternalID returns a boolean if a field has been set. +func (o *ModelArtifact) HasExternalID() bool { + if o != nil && !IsNil(o.ExternalID) { + return true + } + + return false +} + +// SetExternalID gets a reference to the given string and assigns it to the ExternalID field. +func (o *ModelArtifact) SetExternalID(v string) { + o.ExternalID = &v +} + +// GetUri returns the Uri field value if set, zero value otherwise. +func (o *ModelArtifact) GetUri() string { + if o == nil || IsNil(o.Uri) { + var ret string + return ret + } + return *o.Uri +} + +// GetUriOk returns a tuple with the Uri field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ModelArtifact) GetUriOk() (*string, bool) { + if o == nil || IsNil(o.Uri) { + return nil, false + } + return o.Uri, true +} + +// HasUri returns a boolean if a field has been set. +func (o *ModelArtifact) HasUri() bool { + if o != nil && !IsNil(o.Uri) { + return true + } + + return false +} + +// SetUri gets a reference to the given string and assigns it to the Uri field. +func (o *ModelArtifact) SetUri(v string) { + o.Uri = &v +} + +// GetState returns the State field value if set, zero value otherwise. +func (o *ModelArtifact) GetState() ArtifactState { + if o == nil || IsNil(o.State) { + var ret ArtifactState + return ret + } + return *o.State +} + +// GetStateOk returns a tuple with the State field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ModelArtifact) GetStateOk() (*ArtifactState, bool) { + if o == nil || IsNil(o.State) { + return nil, false + } + return o.State, true +} + +// HasState returns a boolean if a field has been set. +func (o *ModelArtifact) HasState() bool { + if o != nil && !IsNil(o.State) { + return true + } + + return false +} + +// SetState gets a reference to the given ArtifactState and assigns it to the State field. +func (o *ModelArtifact) SetState(v ArtifactState) { + o.State = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *ModelArtifact) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ModelArtifact) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *ModelArtifact) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *ModelArtifact) SetName(v string) { + o.Name = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *ModelArtifact) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ModelArtifact) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *ModelArtifact) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *ModelArtifact) SetId(v string) { + o.Id = &v +} + +// GetCreateTimeSinceEpoch returns the CreateTimeSinceEpoch field value if set, zero value otherwise. +func (o *ModelArtifact) GetCreateTimeSinceEpoch() string { + if o == nil || IsNil(o.CreateTimeSinceEpoch) { + var ret string + return ret + } + return *o.CreateTimeSinceEpoch +} + +// GetCreateTimeSinceEpochOk returns a tuple with the CreateTimeSinceEpoch field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ModelArtifact) GetCreateTimeSinceEpochOk() (*string, bool) { + if o == nil || IsNil(o.CreateTimeSinceEpoch) { + return nil, false + } + return o.CreateTimeSinceEpoch, true +} + +// HasCreateTimeSinceEpoch returns a boolean if a field has been set. +func (o *ModelArtifact) HasCreateTimeSinceEpoch() bool { + if o != nil && !IsNil(o.CreateTimeSinceEpoch) { + return true + } + + return false +} + +// SetCreateTimeSinceEpoch gets a reference to the given string and assigns it to the CreateTimeSinceEpoch field. +func (o *ModelArtifact) SetCreateTimeSinceEpoch(v string) { + o.CreateTimeSinceEpoch = &v +} + +// GetLastUpdateTimeSinceEpoch returns the LastUpdateTimeSinceEpoch field value if set, zero value otherwise. +func (o *ModelArtifact) GetLastUpdateTimeSinceEpoch() string { + if o == nil || IsNil(o.LastUpdateTimeSinceEpoch) { + var ret string + return ret + } + return *o.LastUpdateTimeSinceEpoch +} + +// GetLastUpdateTimeSinceEpochOk returns a tuple with the LastUpdateTimeSinceEpoch field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ModelArtifact) GetLastUpdateTimeSinceEpochOk() (*string, bool) { + if o == nil || IsNil(o.LastUpdateTimeSinceEpoch) { + return nil, false + } + return o.LastUpdateTimeSinceEpoch, true +} + +// HasLastUpdateTimeSinceEpoch returns a boolean if a field has been set. +func (o *ModelArtifact) HasLastUpdateTimeSinceEpoch() bool { + if o != nil && !IsNil(o.LastUpdateTimeSinceEpoch) { + return true + } + + return false +} + +// SetLastUpdateTimeSinceEpoch gets a reference to the given string and assigns it to the LastUpdateTimeSinceEpoch field. +func (o *ModelArtifact) SetLastUpdateTimeSinceEpoch(v string) { + o.LastUpdateTimeSinceEpoch = &v +} + +// GetArtifactType returns the ArtifactType field value +func (o *ModelArtifact) GetArtifactType() string { + if o == nil { + var ret string + return ret + } + + return o.ArtifactType +} + +// GetArtifactTypeOk returns a tuple with the ArtifactType field value +// and a boolean to check if the value has been set. +func (o *ModelArtifact) GetArtifactTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ArtifactType, true +} + +// SetArtifactType sets field value +func (o *ModelArtifact) SetArtifactType(v string) { + o.ArtifactType = v +} + +// GetModelFormatName returns the ModelFormatName field value if set, zero value otherwise. +func (o *ModelArtifact) GetModelFormatName() string { + if o == nil || IsNil(o.ModelFormatName) { + var ret string + return ret + } + return *o.ModelFormatName +} + +// GetModelFormatNameOk returns a tuple with the ModelFormatName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ModelArtifact) GetModelFormatNameOk() (*string, bool) { + if o == nil || IsNil(o.ModelFormatName) { + return nil, false + } + return o.ModelFormatName, true +} + +// HasModelFormatName returns a boolean if a field has been set. +func (o *ModelArtifact) HasModelFormatName() bool { + if o != nil && !IsNil(o.ModelFormatName) { + return true + } + + return false +} + +// SetModelFormatName gets a reference to the given string and assigns it to the ModelFormatName field. +func (o *ModelArtifact) SetModelFormatName(v string) { + o.ModelFormatName = &v +} + +// GetRuntime returns the Runtime field value if set, zero value otherwise. +func (o *ModelArtifact) GetRuntime() string { + if o == nil || IsNil(o.Runtime) { + var ret string + return ret + } + return *o.Runtime +} + +// GetRuntimeOk returns a tuple with the Runtime field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ModelArtifact) GetRuntimeOk() (*string, bool) { + if o == nil || IsNil(o.Runtime) { + return nil, false + } + return o.Runtime, true +} + +// HasRuntime returns a boolean if a field has been set. +func (o *ModelArtifact) HasRuntime() bool { + if o != nil && !IsNil(o.Runtime) { + return true + } + + return false +} + +// SetRuntime gets a reference to the given string and assigns it to the Runtime field. +func (o *ModelArtifact) SetRuntime(v string) { + o.Runtime = &v +} + +// GetStorageKey returns the StorageKey field value if set, zero value otherwise. +func (o *ModelArtifact) GetStorageKey() string { + if o == nil || IsNil(o.StorageKey) { + var ret string + return ret + } + return *o.StorageKey +} + +// GetStorageKeyOk returns a tuple with the StorageKey field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ModelArtifact) GetStorageKeyOk() (*string, bool) { + if o == nil || IsNil(o.StorageKey) { + return nil, false + } + return o.StorageKey, true +} + +// HasStorageKey returns a boolean if a field has been set. +func (o *ModelArtifact) HasStorageKey() bool { + if o != nil && !IsNil(o.StorageKey) { + return true + } + + return false +} + +// SetStorageKey gets a reference to the given string and assigns it to the StorageKey field. +func (o *ModelArtifact) SetStorageKey(v string) { + o.StorageKey = &v +} + +// GetStoragePath returns the StoragePath field value if set, zero value otherwise. +func (o *ModelArtifact) GetStoragePath() string { + if o == nil || IsNil(o.StoragePath) { + var ret string + return ret + } + return *o.StoragePath +} + +// GetStoragePathOk returns a tuple with the StoragePath field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ModelArtifact) GetStoragePathOk() (*string, bool) { + if o == nil || IsNil(o.StoragePath) { + return nil, false + } + return o.StoragePath, true +} + +// HasStoragePath returns a boolean if a field has been set. +func (o *ModelArtifact) HasStoragePath() bool { + if o != nil && !IsNil(o.StoragePath) { + return true + } + + return false +} + +// SetStoragePath gets a reference to the given string and assigns it to the StoragePath field. +func (o *ModelArtifact) SetStoragePath(v string) { + o.StoragePath = &v +} + +// GetModelFormatVersion returns the ModelFormatVersion field value if set, zero value otherwise. +func (o *ModelArtifact) GetModelFormatVersion() string { + if o == nil || IsNil(o.ModelFormatVersion) { + var ret string + return ret + } + return *o.ModelFormatVersion +} + +// GetModelFormatVersionOk returns a tuple with the ModelFormatVersion field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ModelArtifact) GetModelFormatVersionOk() (*string, bool) { + if o == nil || IsNil(o.ModelFormatVersion) { + return nil, false + } + return o.ModelFormatVersion, true +} + +// HasModelFormatVersion returns a boolean if a field has been set. +func (o *ModelArtifact) HasModelFormatVersion() bool { + if o != nil && !IsNil(o.ModelFormatVersion) { + return true + } + + return false +} + +// SetModelFormatVersion gets a reference to the given string and assigns it to the ModelFormatVersion field. +func (o *ModelArtifact) SetModelFormatVersion(v string) { + o.ModelFormatVersion = &v +} + +// GetServiceAccountName returns the ServiceAccountName field value if set, zero value otherwise. +func (o *ModelArtifact) GetServiceAccountName() string { + if o == nil || IsNil(o.ServiceAccountName) { + var ret string + return ret + } + return *o.ServiceAccountName +} + +// GetServiceAccountNameOk returns a tuple with the ServiceAccountName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ModelArtifact) GetServiceAccountNameOk() (*string, bool) { + if o == nil || IsNil(o.ServiceAccountName) { + return nil, false + } + return o.ServiceAccountName, true +} + +// HasServiceAccountName returns a boolean if a field has been set. +func (o *ModelArtifact) HasServiceAccountName() bool { + if o != nil && !IsNil(o.ServiceAccountName) { + return true + } + + return false +} + +// SetServiceAccountName gets a reference to the given string and assigns it to the ServiceAccountName field. +func (o *ModelArtifact) SetServiceAccountName(v string) { + o.ServiceAccountName = &v +} + +func (o ModelArtifact) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ModelArtifact) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CustomProperties) { + toSerialize["customProperties"] = o.CustomProperties + } + if !IsNil(o.ExternalID) { + toSerialize["externalID"] = o.ExternalID + } + if !IsNil(o.Uri) { + toSerialize["uri"] = o.Uri + } + if !IsNil(o.State) { + toSerialize["state"] = o.State + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.CreateTimeSinceEpoch) { + toSerialize["createTimeSinceEpoch"] = o.CreateTimeSinceEpoch + } + if !IsNil(o.LastUpdateTimeSinceEpoch) { + toSerialize["lastUpdateTimeSinceEpoch"] = o.LastUpdateTimeSinceEpoch + } + toSerialize["artifactType"] = o.ArtifactType + if !IsNil(o.ModelFormatName) { + toSerialize["modelFormatName"] = o.ModelFormatName + } + if !IsNil(o.Runtime) { + toSerialize["runtime"] = o.Runtime + } + if !IsNil(o.StorageKey) { + toSerialize["storageKey"] = o.StorageKey + } + if !IsNil(o.StoragePath) { + toSerialize["storagePath"] = o.StoragePath + } + if !IsNil(o.ModelFormatVersion) { + toSerialize["modelFormatVersion"] = o.ModelFormatVersion + } + if !IsNil(o.ServiceAccountName) { + toSerialize["serviceAccountName"] = o.ServiceAccountName + } + return toSerialize, nil +} + +type NullableModelArtifact struct { + value *ModelArtifact + isSet bool +} + +func (v NullableModelArtifact) Get() *ModelArtifact { + return v.value +} + +func (v *NullableModelArtifact) Set(val *ModelArtifact) { + v.value = val + v.isSet = true +} + +func (v NullableModelArtifact) IsSet() bool { + return v.isSet +} + +func (v *NullableModelArtifact) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableModelArtifact(val *ModelArtifact) *NullableModelArtifact { + return &NullableModelArtifact{value: val, isSet: true} +} + +func (v NullableModelArtifact) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableModelArtifact) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/model/openapi/model_model_artifact_create.go b/internal/model/openapi/model_model_artifact_create.go new file mode 100644 index 000000000..cfeb5c0f6 --- /dev/null +++ b/internal/model/openapi/model_model_artifact_create.go @@ -0,0 +1,498 @@ +/* +Model Registry REST API + +REST API for Model Registry to create and manage ML model metadata + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the ModelArtifactCreate type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ModelArtifactCreate{} + +// ModelArtifactCreate An ML model artifact. +type ModelArtifactCreate struct { + // User provided custom properties which are not defined by its type. + CustomProperties *map[string]MetadataValue `json:"customProperties,omitempty"` + // The external id that come from the clients’ system. This field is optional. If set, it must be unique among all resources within a database instance. + ExternalID *string `json:"externalID,omitempty"` + // The uniform resource identifier of the physical artifact. May be empty if there is no physical artifact. + Uri *string `json:"uri,omitempty"` + State *ArtifactState `json:"state,omitempty"` + // The client provided name of the artifact. This field is optional. If set, it must be unique among all the artifacts of the same artifact type within a database instance and cannot be changed once set. + Name *string `json:"name,omitempty"` + // Name of the model format. + ModelFormatName *string `json:"modelFormatName,omitempty"` + // Model runtime. + Runtime *string `json:"runtime,omitempty"` + // Storage secret name. + StorageKey *string `json:"storageKey,omitempty"` + // Path for model in storage provided by `storageKey`. + StoragePath *string `json:"storagePath,omitempty"` + // Version of the model format. + ModelFormatVersion *string `json:"modelFormatVersion,omitempty"` + // Name of the service account with storage secret. + ServiceAccountName *string `json:"serviceAccountName,omitempty"` +} + +// NewModelArtifactCreate instantiates a new ModelArtifactCreate object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewModelArtifactCreate() *ModelArtifactCreate { + this := ModelArtifactCreate{} + var state ArtifactState = ARTIFACTSTATE_UNKNOWN + this.State = &state + return &this +} + +// NewModelArtifactCreateWithDefaults instantiates a new ModelArtifactCreate object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewModelArtifactCreateWithDefaults() *ModelArtifactCreate { + this := ModelArtifactCreate{} + var state ArtifactState = ARTIFACTSTATE_UNKNOWN + this.State = &state + return &this +} + +// GetCustomProperties returns the CustomProperties field value if set, zero value otherwise. +func (o *ModelArtifactCreate) GetCustomProperties() map[string]MetadataValue { + if o == nil || IsNil(o.CustomProperties) { + var ret map[string]MetadataValue + return ret + } + return *o.CustomProperties +} + +// GetCustomPropertiesOk returns a tuple with the CustomProperties field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ModelArtifactCreate) GetCustomPropertiesOk() (*map[string]MetadataValue, bool) { + if o == nil || IsNil(o.CustomProperties) { + return nil, false + } + return o.CustomProperties, true +} + +// HasCustomProperties returns a boolean if a field has been set. +func (o *ModelArtifactCreate) HasCustomProperties() bool { + if o != nil && !IsNil(o.CustomProperties) { + return true + } + + return false +} + +// SetCustomProperties gets a reference to the given map[string]MetadataValue and assigns it to the CustomProperties field. +func (o *ModelArtifactCreate) SetCustomProperties(v map[string]MetadataValue) { + o.CustomProperties = &v +} + +// GetExternalID returns the ExternalID field value if set, zero value otherwise. +func (o *ModelArtifactCreate) GetExternalID() string { + if o == nil || IsNil(o.ExternalID) { + var ret string + return ret + } + return *o.ExternalID +} + +// GetExternalIDOk returns a tuple with the ExternalID field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ModelArtifactCreate) GetExternalIDOk() (*string, bool) { + if o == nil || IsNil(o.ExternalID) { + return nil, false + } + return o.ExternalID, true +} + +// HasExternalID returns a boolean if a field has been set. +func (o *ModelArtifactCreate) HasExternalID() bool { + if o != nil && !IsNil(o.ExternalID) { + return true + } + + return false +} + +// SetExternalID gets a reference to the given string and assigns it to the ExternalID field. +func (o *ModelArtifactCreate) SetExternalID(v string) { + o.ExternalID = &v +} + +// GetUri returns the Uri field value if set, zero value otherwise. +func (o *ModelArtifactCreate) GetUri() string { + if o == nil || IsNil(o.Uri) { + var ret string + return ret + } + return *o.Uri +} + +// GetUriOk returns a tuple with the Uri field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ModelArtifactCreate) GetUriOk() (*string, bool) { + if o == nil || IsNil(o.Uri) { + return nil, false + } + return o.Uri, true +} + +// HasUri returns a boolean if a field has been set. +func (o *ModelArtifactCreate) HasUri() bool { + if o != nil && !IsNil(o.Uri) { + return true + } + + return false +} + +// SetUri gets a reference to the given string and assigns it to the Uri field. +func (o *ModelArtifactCreate) SetUri(v string) { + o.Uri = &v +} + +// GetState returns the State field value if set, zero value otherwise. +func (o *ModelArtifactCreate) GetState() ArtifactState { + if o == nil || IsNil(o.State) { + var ret ArtifactState + return ret + } + return *o.State +} + +// GetStateOk returns a tuple with the State field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ModelArtifactCreate) GetStateOk() (*ArtifactState, bool) { + if o == nil || IsNil(o.State) { + return nil, false + } + return o.State, true +} + +// HasState returns a boolean if a field has been set. +func (o *ModelArtifactCreate) HasState() bool { + if o != nil && !IsNil(o.State) { + return true + } + + return false +} + +// SetState gets a reference to the given ArtifactState and assigns it to the State field. +func (o *ModelArtifactCreate) SetState(v ArtifactState) { + o.State = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *ModelArtifactCreate) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ModelArtifactCreate) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *ModelArtifactCreate) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *ModelArtifactCreate) SetName(v string) { + o.Name = &v +} + +// GetModelFormatName returns the ModelFormatName field value if set, zero value otherwise. +func (o *ModelArtifactCreate) GetModelFormatName() string { + if o == nil || IsNil(o.ModelFormatName) { + var ret string + return ret + } + return *o.ModelFormatName +} + +// GetModelFormatNameOk returns a tuple with the ModelFormatName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ModelArtifactCreate) GetModelFormatNameOk() (*string, bool) { + if o == nil || IsNil(o.ModelFormatName) { + return nil, false + } + return o.ModelFormatName, true +} + +// HasModelFormatName returns a boolean if a field has been set. +func (o *ModelArtifactCreate) HasModelFormatName() bool { + if o != nil && !IsNil(o.ModelFormatName) { + return true + } + + return false +} + +// SetModelFormatName gets a reference to the given string and assigns it to the ModelFormatName field. +func (o *ModelArtifactCreate) SetModelFormatName(v string) { + o.ModelFormatName = &v +} + +// GetRuntime returns the Runtime field value if set, zero value otherwise. +func (o *ModelArtifactCreate) GetRuntime() string { + if o == nil || IsNil(o.Runtime) { + var ret string + return ret + } + return *o.Runtime +} + +// GetRuntimeOk returns a tuple with the Runtime field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ModelArtifactCreate) GetRuntimeOk() (*string, bool) { + if o == nil || IsNil(o.Runtime) { + return nil, false + } + return o.Runtime, true +} + +// HasRuntime returns a boolean if a field has been set. +func (o *ModelArtifactCreate) HasRuntime() bool { + if o != nil && !IsNil(o.Runtime) { + return true + } + + return false +} + +// SetRuntime gets a reference to the given string and assigns it to the Runtime field. +func (o *ModelArtifactCreate) SetRuntime(v string) { + o.Runtime = &v +} + +// GetStorageKey returns the StorageKey field value if set, zero value otherwise. +func (o *ModelArtifactCreate) GetStorageKey() string { + if o == nil || IsNil(o.StorageKey) { + var ret string + return ret + } + return *o.StorageKey +} + +// GetStorageKeyOk returns a tuple with the StorageKey field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ModelArtifactCreate) GetStorageKeyOk() (*string, bool) { + if o == nil || IsNil(o.StorageKey) { + return nil, false + } + return o.StorageKey, true +} + +// HasStorageKey returns a boolean if a field has been set. +func (o *ModelArtifactCreate) HasStorageKey() bool { + if o != nil && !IsNil(o.StorageKey) { + return true + } + + return false +} + +// SetStorageKey gets a reference to the given string and assigns it to the StorageKey field. +func (o *ModelArtifactCreate) SetStorageKey(v string) { + o.StorageKey = &v +} + +// GetStoragePath returns the StoragePath field value if set, zero value otherwise. +func (o *ModelArtifactCreate) GetStoragePath() string { + if o == nil || IsNil(o.StoragePath) { + var ret string + return ret + } + return *o.StoragePath +} + +// GetStoragePathOk returns a tuple with the StoragePath field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ModelArtifactCreate) GetStoragePathOk() (*string, bool) { + if o == nil || IsNil(o.StoragePath) { + return nil, false + } + return o.StoragePath, true +} + +// HasStoragePath returns a boolean if a field has been set. +func (o *ModelArtifactCreate) HasStoragePath() bool { + if o != nil && !IsNil(o.StoragePath) { + return true + } + + return false +} + +// SetStoragePath gets a reference to the given string and assigns it to the StoragePath field. +func (o *ModelArtifactCreate) SetStoragePath(v string) { + o.StoragePath = &v +} + +// GetModelFormatVersion returns the ModelFormatVersion field value if set, zero value otherwise. +func (o *ModelArtifactCreate) GetModelFormatVersion() string { + if o == nil || IsNil(o.ModelFormatVersion) { + var ret string + return ret + } + return *o.ModelFormatVersion +} + +// GetModelFormatVersionOk returns a tuple with the ModelFormatVersion field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ModelArtifactCreate) GetModelFormatVersionOk() (*string, bool) { + if o == nil || IsNil(o.ModelFormatVersion) { + return nil, false + } + return o.ModelFormatVersion, true +} + +// HasModelFormatVersion returns a boolean if a field has been set. +func (o *ModelArtifactCreate) HasModelFormatVersion() bool { + if o != nil && !IsNil(o.ModelFormatVersion) { + return true + } + + return false +} + +// SetModelFormatVersion gets a reference to the given string and assigns it to the ModelFormatVersion field. +func (o *ModelArtifactCreate) SetModelFormatVersion(v string) { + o.ModelFormatVersion = &v +} + +// GetServiceAccountName returns the ServiceAccountName field value if set, zero value otherwise. +func (o *ModelArtifactCreate) GetServiceAccountName() string { + if o == nil || IsNil(o.ServiceAccountName) { + var ret string + return ret + } + return *o.ServiceAccountName +} + +// GetServiceAccountNameOk returns a tuple with the ServiceAccountName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ModelArtifactCreate) GetServiceAccountNameOk() (*string, bool) { + if o == nil || IsNil(o.ServiceAccountName) { + return nil, false + } + return o.ServiceAccountName, true +} + +// HasServiceAccountName returns a boolean if a field has been set. +func (o *ModelArtifactCreate) HasServiceAccountName() bool { + if o != nil && !IsNil(o.ServiceAccountName) { + return true + } + + return false +} + +// SetServiceAccountName gets a reference to the given string and assigns it to the ServiceAccountName field. +func (o *ModelArtifactCreate) SetServiceAccountName(v string) { + o.ServiceAccountName = &v +} + +func (o ModelArtifactCreate) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ModelArtifactCreate) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CustomProperties) { + toSerialize["customProperties"] = o.CustomProperties + } + if !IsNil(o.ExternalID) { + toSerialize["externalID"] = o.ExternalID + } + if !IsNil(o.Uri) { + toSerialize["uri"] = o.Uri + } + if !IsNil(o.State) { + toSerialize["state"] = o.State + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.ModelFormatName) { + toSerialize["modelFormatName"] = o.ModelFormatName + } + if !IsNil(o.Runtime) { + toSerialize["runtime"] = o.Runtime + } + if !IsNil(o.StorageKey) { + toSerialize["storageKey"] = o.StorageKey + } + if !IsNil(o.StoragePath) { + toSerialize["storagePath"] = o.StoragePath + } + if !IsNil(o.ModelFormatVersion) { + toSerialize["modelFormatVersion"] = o.ModelFormatVersion + } + if !IsNil(o.ServiceAccountName) { + toSerialize["serviceAccountName"] = o.ServiceAccountName + } + return toSerialize, nil +} + +type NullableModelArtifactCreate struct { + value *ModelArtifactCreate + isSet bool +} + +func (v NullableModelArtifactCreate) Get() *ModelArtifactCreate { + return v.value +} + +func (v *NullableModelArtifactCreate) Set(val *ModelArtifactCreate) { + v.value = val + v.isSet = true +} + +func (v NullableModelArtifactCreate) IsSet() bool { + return v.isSet +} + +func (v *NullableModelArtifactCreate) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableModelArtifactCreate(val *ModelArtifactCreate) *NullableModelArtifactCreate { + return &NullableModelArtifactCreate{value: val, isSet: true} +} + +func (v NullableModelArtifactCreate) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableModelArtifactCreate) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/model/openapi/model_model_artifact_list.go b/internal/model/openapi/model_model_artifact_list.go new file mode 100644 index 000000000..93da4e4b3 --- /dev/null +++ b/internal/model/openapi/model_model_artifact_list.go @@ -0,0 +1,209 @@ +/* +Model Registry REST API + +REST API for Model Registry to create and manage ML model metadata + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the ModelArtifactList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ModelArtifactList{} + +// ModelArtifactList List of ModelArtifact entities. +type ModelArtifactList struct { + // Token to use to retrieve next page of results. + NextPageToken string `json:"nextPageToken"` + // Maximum number of resources to return in the result. + PageSize int32 `json:"pageSize"` + // Number of items in result list. + Size int32 `json:"size"` + // Array of `ModelArtifact` entities. + Items []ModelArtifact `json:"items,omitempty"` +} + +// NewModelArtifactList instantiates a new ModelArtifactList object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewModelArtifactList(nextPageToken string, pageSize int32, size int32) *ModelArtifactList { + this := ModelArtifactList{} + this.NextPageToken = nextPageToken + this.PageSize = pageSize + this.Size = size + return &this +} + +// NewModelArtifactListWithDefaults instantiates a new ModelArtifactList object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewModelArtifactListWithDefaults() *ModelArtifactList { + this := ModelArtifactList{} + return &this +} + +// GetNextPageToken returns the NextPageToken field value +func (o *ModelArtifactList) GetNextPageToken() string { + if o == nil { + var ret string + return ret + } + + return o.NextPageToken +} + +// GetNextPageTokenOk returns a tuple with the NextPageToken field value +// and a boolean to check if the value has been set. +func (o *ModelArtifactList) GetNextPageTokenOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.NextPageToken, true +} + +// SetNextPageToken sets field value +func (o *ModelArtifactList) SetNextPageToken(v string) { + o.NextPageToken = v +} + +// GetPageSize returns the PageSize field value +func (o *ModelArtifactList) GetPageSize() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.PageSize +} + +// GetPageSizeOk returns a tuple with the PageSize field value +// and a boolean to check if the value has been set. +func (o *ModelArtifactList) GetPageSizeOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.PageSize, true +} + +// SetPageSize sets field value +func (o *ModelArtifactList) SetPageSize(v int32) { + o.PageSize = v +} + +// GetSize returns the Size field value +func (o *ModelArtifactList) GetSize() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Size +} + +// GetSizeOk returns a tuple with the Size field value +// and a boolean to check if the value has been set. +func (o *ModelArtifactList) GetSizeOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Size, true +} + +// SetSize sets field value +func (o *ModelArtifactList) SetSize(v int32) { + o.Size = v +} + +// GetItems returns the Items field value if set, zero value otherwise. +func (o *ModelArtifactList) GetItems() []ModelArtifact { + if o == nil || IsNil(o.Items) { + var ret []ModelArtifact + return ret + } + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ModelArtifactList) GetItemsOk() ([]ModelArtifact, bool) { + if o == nil || IsNil(o.Items) { + return nil, false + } + return o.Items, true +} + +// HasItems returns a boolean if a field has been set. +func (o *ModelArtifactList) HasItems() bool { + if o != nil && !IsNil(o.Items) { + return true + } + + return false +} + +// SetItems gets a reference to the given []ModelArtifact and assigns it to the Items field. +func (o *ModelArtifactList) SetItems(v []ModelArtifact) { + o.Items = v +} + +func (o ModelArtifactList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ModelArtifactList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["nextPageToken"] = o.NextPageToken + toSerialize["pageSize"] = o.PageSize + toSerialize["size"] = o.Size + if !IsNil(o.Items) { + toSerialize["items"] = o.Items + } + return toSerialize, nil +} + +type NullableModelArtifactList struct { + value *ModelArtifactList + isSet bool +} + +func (v NullableModelArtifactList) Get() *ModelArtifactList { + return v.value +} + +func (v *NullableModelArtifactList) Set(val *ModelArtifactList) { + v.value = val + v.isSet = true +} + +func (v NullableModelArtifactList) IsSet() bool { + return v.isSet +} + +func (v *NullableModelArtifactList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableModelArtifactList(val *ModelArtifactList) *NullableModelArtifactList { + return &NullableModelArtifactList{value: val, isSet: true} +} + +func (v NullableModelArtifactList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableModelArtifactList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/model/openapi/model_model_artifact_update.go b/internal/model/openapi/model_model_artifact_update.go new file mode 100644 index 000000000..2cda6724b --- /dev/null +++ b/internal/model/openapi/model_model_artifact_update.go @@ -0,0 +1,461 @@ +/* +Model Registry REST API + +REST API for Model Registry to create and manage ML model metadata + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the ModelArtifactUpdate type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ModelArtifactUpdate{} + +// ModelArtifactUpdate An ML model artifact. +type ModelArtifactUpdate struct { + // User provided custom properties which are not defined by its type. + CustomProperties *map[string]MetadataValue `json:"customProperties,omitempty"` + // The external id that come from the clients’ system. This field is optional. If set, it must be unique among all resources within a database instance. + ExternalID *string `json:"externalID,omitempty"` + // The uniform resource identifier of the physical artifact. May be empty if there is no physical artifact. + Uri *string `json:"uri,omitempty"` + State *ArtifactState `json:"state,omitempty"` + // Name of the model format. + ModelFormatName *string `json:"modelFormatName,omitempty"` + // Model runtime. + Runtime *string `json:"runtime,omitempty"` + // Storage secret name. + StorageKey *string `json:"storageKey,omitempty"` + // Path for model in storage provided by `storageKey`. + StoragePath *string `json:"storagePath,omitempty"` + // Version of the model format. + ModelFormatVersion *string `json:"modelFormatVersion,omitempty"` + // Name of the service account with storage secret. + ServiceAccountName *string `json:"serviceAccountName,omitempty"` +} + +// NewModelArtifactUpdate instantiates a new ModelArtifactUpdate object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewModelArtifactUpdate() *ModelArtifactUpdate { + this := ModelArtifactUpdate{} + var state ArtifactState = ARTIFACTSTATE_UNKNOWN + this.State = &state + return &this +} + +// NewModelArtifactUpdateWithDefaults instantiates a new ModelArtifactUpdate object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewModelArtifactUpdateWithDefaults() *ModelArtifactUpdate { + this := ModelArtifactUpdate{} + var state ArtifactState = ARTIFACTSTATE_UNKNOWN + this.State = &state + return &this +} + +// GetCustomProperties returns the CustomProperties field value if set, zero value otherwise. +func (o *ModelArtifactUpdate) GetCustomProperties() map[string]MetadataValue { + if o == nil || IsNil(o.CustomProperties) { + var ret map[string]MetadataValue + return ret + } + return *o.CustomProperties +} + +// GetCustomPropertiesOk returns a tuple with the CustomProperties field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ModelArtifactUpdate) GetCustomPropertiesOk() (*map[string]MetadataValue, bool) { + if o == nil || IsNil(o.CustomProperties) { + return nil, false + } + return o.CustomProperties, true +} + +// HasCustomProperties returns a boolean if a field has been set. +func (o *ModelArtifactUpdate) HasCustomProperties() bool { + if o != nil && !IsNil(o.CustomProperties) { + return true + } + + return false +} + +// SetCustomProperties gets a reference to the given map[string]MetadataValue and assigns it to the CustomProperties field. +func (o *ModelArtifactUpdate) SetCustomProperties(v map[string]MetadataValue) { + o.CustomProperties = &v +} + +// GetExternalID returns the ExternalID field value if set, zero value otherwise. +func (o *ModelArtifactUpdate) GetExternalID() string { + if o == nil || IsNil(o.ExternalID) { + var ret string + return ret + } + return *o.ExternalID +} + +// GetExternalIDOk returns a tuple with the ExternalID field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ModelArtifactUpdate) GetExternalIDOk() (*string, bool) { + if o == nil || IsNil(o.ExternalID) { + return nil, false + } + return o.ExternalID, true +} + +// HasExternalID returns a boolean if a field has been set. +func (o *ModelArtifactUpdate) HasExternalID() bool { + if o != nil && !IsNil(o.ExternalID) { + return true + } + + return false +} + +// SetExternalID gets a reference to the given string and assigns it to the ExternalID field. +func (o *ModelArtifactUpdate) SetExternalID(v string) { + o.ExternalID = &v +} + +// GetUri returns the Uri field value if set, zero value otherwise. +func (o *ModelArtifactUpdate) GetUri() string { + if o == nil || IsNil(o.Uri) { + var ret string + return ret + } + return *o.Uri +} + +// GetUriOk returns a tuple with the Uri field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ModelArtifactUpdate) GetUriOk() (*string, bool) { + if o == nil || IsNil(o.Uri) { + return nil, false + } + return o.Uri, true +} + +// HasUri returns a boolean if a field has been set. +func (o *ModelArtifactUpdate) HasUri() bool { + if o != nil && !IsNil(o.Uri) { + return true + } + + return false +} + +// SetUri gets a reference to the given string and assigns it to the Uri field. +func (o *ModelArtifactUpdate) SetUri(v string) { + o.Uri = &v +} + +// GetState returns the State field value if set, zero value otherwise. +func (o *ModelArtifactUpdate) GetState() ArtifactState { + if o == nil || IsNil(o.State) { + var ret ArtifactState + return ret + } + return *o.State +} + +// GetStateOk returns a tuple with the State field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ModelArtifactUpdate) GetStateOk() (*ArtifactState, bool) { + if o == nil || IsNil(o.State) { + return nil, false + } + return o.State, true +} + +// HasState returns a boolean if a field has been set. +func (o *ModelArtifactUpdate) HasState() bool { + if o != nil && !IsNil(o.State) { + return true + } + + return false +} + +// SetState gets a reference to the given ArtifactState and assigns it to the State field. +func (o *ModelArtifactUpdate) SetState(v ArtifactState) { + o.State = &v +} + +// GetModelFormatName returns the ModelFormatName field value if set, zero value otherwise. +func (o *ModelArtifactUpdate) GetModelFormatName() string { + if o == nil || IsNil(o.ModelFormatName) { + var ret string + return ret + } + return *o.ModelFormatName +} + +// GetModelFormatNameOk returns a tuple with the ModelFormatName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ModelArtifactUpdate) GetModelFormatNameOk() (*string, bool) { + if o == nil || IsNil(o.ModelFormatName) { + return nil, false + } + return o.ModelFormatName, true +} + +// HasModelFormatName returns a boolean if a field has been set. +func (o *ModelArtifactUpdate) HasModelFormatName() bool { + if o != nil && !IsNil(o.ModelFormatName) { + return true + } + + return false +} + +// SetModelFormatName gets a reference to the given string and assigns it to the ModelFormatName field. +func (o *ModelArtifactUpdate) SetModelFormatName(v string) { + o.ModelFormatName = &v +} + +// GetRuntime returns the Runtime field value if set, zero value otherwise. +func (o *ModelArtifactUpdate) GetRuntime() string { + if o == nil || IsNil(o.Runtime) { + var ret string + return ret + } + return *o.Runtime +} + +// GetRuntimeOk returns a tuple with the Runtime field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ModelArtifactUpdate) GetRuntimeOk() (*string, bool) { + if o == nil || IsNil(o.Runtime) { + return nil, false + } + return o.Runtime, true +} + +// HasRuntime returns a boolean if a field has been set. +func (o *ModelArtifactUpdate) HasRuntime() bool { + if o != nil && !IsNil(o.Runtime) { + return true + } + + return false +} + +// SetRuntime gets a reference to the given string and assigns it to the Runtime field. +func (o *ModelArtifactUpdate) SetRuntime(v string) { + o.Runtime = &v +} + +// GetStorageKey returns the StorageKey field value if set, zero value otherwise. +func (o *ModelArtifactUpdate) GetStorageKey() string { + if o == nil || IsNil(o.StorageKey) { + var ret string + return ret + } + return *o.StorageKey +} + +// GetStorageKeyOk returns a tuple with the StorageKey field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ModelArtifactUpdate) GetStorageKeyOk() (*string, bool) { + if o == nil || IsNil(o.StorageKey) { + return nil, false + } + return o.StorageKey, true +} + +// HasStorageKey returns a boolean if a field has been set. +func (o *ModelArtifactUpdate) HasStorageKey() bool { + if o != nil && !IsNil(o.StorageKey) { + return true + } + + return false +} + +// SetStorageKey gets a reference to the given string and assigns it to the StorageKey field. +func (o *ModelArtifactUpdate) SetStorageKey(v string) { + o.StorageKey = &v +} + +// GetStoragePath returns the StoragePath field value if set, zero value otherwise. +func (o *ModelArtifactUpdate) GetStoragePath() string { + if o == nil || IsNil(o.StoragePath) { + var ret string + return ret + } + return *o.StoragePath +} + +// GetStoragePathOk returns a tuple with the StoragePath field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ModelArtifactUpdate) GetStoragePathOk() (*string, bool) { + if o == nil || IsNil(o.StoragePath) { + return nil, false + } + return o.StoragePath, true +} + +// HasStoragePath returns a boolean if a field has been set. +func (o *ModelArtifactUpdate) HasStoragePath() bool { + if o != nil && !IsNil(o.StoragePath) { + return true + } + + return false +} + +// SetStoragePath gets a reference to the given string and assigns it to the StoragePath field. +func (o *ModelArtifactUpdate) SetStoragePath(v string) { + o.StoragePath = &v +} + +// GetModelFormatVersion returns the ModelFormatVersion field value if set, zero value otherwise. +func (o *ModelArtifactUpdate) GetModelFormatVersion() string { + if o == nil || IsNil(o.ModelFormatVersion) { + var ret string + return ret + } + return *o.ModelFormatVersion +} + +// GetModelFormatVersionOk returns a tuple with the ModelFormatVersion field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ModelArtifactUpdate) GetModelFormatVersionOk() (*string, bool) { + if o == nil || IsNil(o.ModelFormatVersion) { + return nil, false + } + return o.ModelFormatVersion, true +} + +// HasModelFormatVersion returns a boolean if a field has been set. +func (o *ModelArtifactUpdate) HasModelFormatVersion() bool { + if o != nil && !IsNil(o.ModelFormatVersion) { + return true + } + + return false +} + +// SetModelFormatVersion gets a reference to the given string and assigns it to the ModelFormatVersion field. +func (o *ModelArtifactUpdate) SetModelFormatVersion(v string) { + o.ModelFormatVersion = &v +} + +// GetServiceAccountName returns the ServiceAccountName field value if set, zero value otherwise. +func (o *ModelArtifactUpdate) GetServiceAccountName() string { + if o == nil || IsNil(o.ServiceAccountName) { + var ret string + return ret + } + return *o.ServiceAccountName +} + +// GetServiceAccountNameOk returns a tuple with the ServiceAccountName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ModelArtifactUpdate) GetServiceAccountNameOk() (*string, bool) { + if o == nil || IsNil(o.ServiceAccountName) { + return nil, false + } + return o.ServiceAccountName, true +} + +// HasServiceAccountName returns a boolean if a field has been set. +func (o *ModelArtifactUpdate) HasServiceAccountName() bool { + if o != nil && !IsNil(o.ServiceAccountName) { + return true + } + + return false +} + +// SetServiceAccountName gets a reference to the given string and assigns it to the ServiceAccountName field. +func (o *ModelArtifactUpdate) SetServiceAccountName(v string) { + o.ServiceAccountName = &v +} + +func (o ModelArtifactUpdate) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ModelArtifactUpdate) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CustomProperties) { + toSerialize["customProperties"] = o.CustomProperties + } + if !IsNil(o.ExternalID) { + toSerialize["externalID"] = o.ExternalID + } + if !IsNil(o.Uri) { + toSerialize["uri"] = o.Uri + } + if !IsNil(o.State) { + toSerialize["state"] = o.State + } + if !IsNil(o.ModelFormatName) { + toSerialize["modelFormatName"] = o.ModelFormatName + } + if !IsNil(o.Runtime) { + toSerialize["runtime"] = o.Runtime + } + if !IsNil(o.StorageKey) { + toSerialize["storageKey"] = o.StorageKey + } + if !IsNil(o.StoragePath) { + toSerialize["storagePath"] = o.StoragePath + } + if !IsNil(o.ModelFormatVersion) { + toSerialize["modelFormatVersion"] = o.ModelFormatVersion + } + if !IsNil(o.ServiceAccountName) { + toSerialize["serviceAccountName"] = o.ServiceAccountName + } + return toSerialize, nil +} + +type NullableModelArtifactUpdate struct { + value *ModelArtifactUpdate + isSet bool +} + +func (v NullableModelArtifactUpdate) Get() *ModelArtifactUpdate { + return v.value +} + +func (v *NullableModelArtifactUpdate) Set(val *ModelArtifactUpdate) { + v.value = val + v.isSet = true +} + +func (v NullableModelArtifactUpdate) IsSet() bool { + return v.isSet +} + +func (v *NullableModelArtifactUpdate) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableModelArtifactUpdate(val *ModelArtifactUpdate) *NullableModelArtifactUpdate { + return &NullableModelArtifactUpdate{value: val, isSet: true} +} + +func (v NullableModelArtifactUpdate) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableModelArtifactUpdate) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/model/openapi/model_model_version.go b/internal/model/openapi/model_model_version.go new file mode 100644 index 000000000..87604daff --- /dev/null +++ b/internal/model/openapi/model_model_version.go @@ -0,0 +1,310 @@ +/* +Model Registry REST API + +REST API for Model Registry to create and manage ML model metadata + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the ModelVersion type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ModelVersion{} + +// ModelVersion Represents a ModelVersion belonging to a RegisteredModel. +type ModelVersion struct { + // User provided custom properties which are not defined by its type. + CustomProperties *map[string]MetadataValue `json:"customProperties,omitempty"` + // The external id that come from the clients’ system. This field is optional. If set, it must be unique among all resources within a database instance. + ExternalID *string `json:"externalID,omitempty"` + // The client provided name of the artifact. This field is optional. If set, it must be unique among all the artifacts of the same artifact type within a database instance and cannot be changed once set. + Name *string `json:"name,omitempty"` + // Output only. The unique server generated id of the resource. + Id *string `json:"id,omitempty"` + // Output only. Create time of the resource in millisecond since epoch. + CreateTimeSinceEpoch *string `json:"createTimeSinceEpoch,omitempty"` + // Output only. Last update time of the resource since epoch in millisecond since epoch. + LastUpdateTimeSinceEpoch *string `json:"lastUpdateTimeSinceEpoch,omitempty"` +} + +// NewModelVersion instantiates a new ModelVersion object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewModelVersion() *ModelVersion { + this := ModelVersion{} + return &this +} + +// NewModelVersionWithDefaults instantiates a new ModelVersion object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewModelVersionWithDefaults() *ModelVersion { + this := ModelVersion{} + return &this +} + +// GetCustomProperties returns the CustomProperties field value if set, zero value otherwise. +func (o *ModelVersion) GetCustomProperties() map[string]MetadataValue { + if o == nil || IsNil(o.CustomProperties) { + var ret map[string]MetadataValue + return ret + } + return *o.CustomProperties +} + +// GetCustomPropertiesOk returns a tuple with the CustomProperties field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ModelVersion) GetCustomPropertiesOk() (*map[string]MetadataValue, bool) { + if o == nil || IsNil(o.CustomProperties) { + return nil, false + } + return o.CustomProperties, true +} + +// HasCustomProperties returns a boolean if a field has been set. +func (o *ModelVersion) HasCustomProperties() bool { + if o != nil && !IsNil(o.CustomProperties) { + return true + } + + return false +} + +// SetCustomProperties gets a reference to the given map[string]MetadataValue and assigns it to the CustomProperties field. +func (o *ModelVersion) SetCustomProperties(v map[string]MetadataValue) { + o.CustomProperties = &v +} + +// GetExternalID returns the ExternalID field value if set, zero value otherwise. +func (o *ModelVersion) GetExternalID() string { + if o == nil || IsNil(o.ExternalID) { + var ret string + return ret + } + return *o.ExternalID +} + +// GetExternalIDOk returns a tuple with the ExternalID field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ModelVersion) GetExternalIDOk() (*string, bool) { + if o == nil || IsNil(o.ExternalID) { + return nil, false + } + return o.ExternalID, true +} + +// HasExternalID returns a boolean if a field has been set. +func (o *ModelVersion) HasExternalID() bool { + if o != nil && !IsNil(o.ExternalID) { + return true + } + + return false +} + +// SetExternalID gets a reference to the given string and assigns it to the ExternalID field. +func (o *ModelVersion) SetExternalID(v string) { + o.ExternalID = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *ModelVersion) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ModelVersion) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *ModelVersion) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *ModelVersion) SetName(v string) { + o.Name = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *ModelVersion) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ModelVersion) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *ModelVersion) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *ModelVersion) SetId(v string) { + o.Id = &v +} + +// GetCreateTimeSinceEpoch returns the CreateTimeSinceEpoch field value if set, zero value otherwise. +func (o *ModelVersion) GetCreateTimeSinceEpoch() string { + if o == nil || IsNil(o.CreateTimeSinceEpoch) { + var ret string + return ret + } + return *o.CreateTimeSinceEpoch +} + +// GetCreateTimeSinceEpochOk returns a tuple with the CreateTimeSinceEpoch field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ModelVersion) GetCreateTimeSinceEpochOk() (*string, bool) { + if o == nil || IsNil(o.CreateTimeSinceEpoch) { + return nil, false + } + return o.CreateTimeSinceEpoch, true +} + +// HasCreateTimeSinceEpoch returns a boolean if a field has been set. +func (o *ModelVersion) HasCreateTimeSinceEpoch() bool { + if o != nil && !IsNil(o.CreateTimeSinceEpoch) { + return true + } + + return false +} + +// SetCreateTimeSinceEpoch gets a reference to the given string and assigns it to the CreateTimeSinceEpoch field. +func (o *ModelVersion) SetCreateTimeSinceEpoch(v string) { + o.CreateTimeSinceEpoch = &v +} + +// GetLastUpdateTimeSinceEpoch returns the LastUpdateTimeSinceEpoch field value if set, zero value otherwise. +func (o *ModelVersion) GetLastUpdateTimeSinceEpoch() string { + if o == nil || IsNil(o.LastUpdateTimeSinceEpoch) { + var ret string + return ret + } + return *o.LastUpdateTimeSinceEpoch +} + +// GetLastUpdateTimeSinceEpochOk returns a tuple with the LastUpdateTimeSinceEpoch field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ModelVersion) GetLastUpdateTimeSinceEpochOk() (*string, bool) { + if o == nil || IsNil(o.LastUpdateTimeSinceEpoch) { + return nil, false + } + return o.LastUpdateTimeSinceEpoch, true +} + +// HasLastUpdateTimeSinceEpoch returns a boolean if a field has been set. +func (o *ModelVersion) HasLastUpdateTimeSinceEpoch() bool { + if o != nil && !IsNil(o.LastUpdateTimeSinceEpoch) { + return true + } + + return false +} + +// SetLastUpdateTimeSinceEpoch gets a reference to the given string and assigns it to the LastUpdateTimeSinceEpoch field. +func (o *ModelVersion) SetLastUpdateTimeSinceEpoch(v string) { + o.LastUpdateTimeSinceEpoch = &v +} + +func (o ModelVersion) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ModelVersion) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CustomProperties) { + toSerialize["customProperties"] = o.CustomProperties + } + if !IsNil(o.ExternalID) { + toSerialize["externalID"] = o.ExternalID + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.CreateTimeSinceEpoch) { + toSerialize["createTimeSinceEpoch"] = o.CreateTimeSinceEpoch + } + if !IsNil(o.LastUpdateTimeSinceEpoch) { + toSerialize["lastUpdateTimeSinceEpoch"] = o.LastUpdateTimeSinceEpoch + } + return toSerialize, nil +} + +type NullableModelVersion struct { + value *ModelVersion + isSet bool +} + +func (v NullableModelVersion) Get() *ModelVersion { + return v.value +} + +func (v *NullableModelVersion) Set(val *ModelVersion) { + v.value = val + v.isSet = true +} + +func (v NullableModelVersion) IsSet() bool { + return v.isSet +} + +func (v *NullableModelVersion) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableModelVersion(val *ModelVersion) *NullableModelVersion { + return &NullableModelVersion{value: val, isSet: true} +} + +func (v NullableModelVersion) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableModelVersion) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/model/openapi/model_model_version_create.go b/internal/model/openapi/model_model_version_create.go new file mode 100644 index 000000000..c47d9a29a --- /dev/null +++ b/internal/model/openapi/model_model_version_create.go @@ -0,0 +1,226 @@ +/* +Model Registry REST API + +REST API for Model Registry to create and manage ML model metadata + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the ModelVersionCreate type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ModelVersionCreate{} + +// ModelVersionCreate Represents a ModelVersion belonging to a RegisteredModel. +type ModelVersionCreate struct { + // ID of the `RegisteredModel` to which this version belongs. + RegisteredModelID string `json:"registeredModelID"` + // User provided custom properties which are not defined by its type. + CustomProperties *map[string]MetadataValue `json:"customProperties,omitempty"` + // The external id that come from the clients’ system. This field is optional. If set, it must be unique among all resources within a database instance. + ExternalID *string `json:"externalID,omitempty"` + // The client provided name of the artifact. This field is optional. If set, it must be unique among all the artifacts of the same artifact type within a database instance and cannot be changed once set. + Name *string `json:"name,omitempty"` +} + +// NewModelVersionCreate instantiates a new ModelVersionCreate object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewModelVersionCreate(registeredModelID string) *ModelVersionCreate { + this := ModelVersionCreate{} + return &this +} + +// NewModelVersionCreateWithDefaults instantiates a new ModelVersionCreate object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewModelVersionCreateWithDefaults() *ModelVersionCreate { + this := ModelVersionCreate{} + return &this +} + +// GetRegisteredModelID returns the RegisteredModelID field value +func (o *ModelVersionCreate) GetRegisteredModelID() string { + if o == nil { + var ret string + return ret + } + + return o.RegisteredModelID +} + +// GetRegisteredModelIDOk returns a tuple with the RegisteredModelID field value +// and a boolean to check if the value has been set. +func (o *ModelVersionCreate) GetRegisteredModelIDOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.RegisteredModelID, true +} + +// SetRegisteredModelID sets field value +func (o *ModelVersionCreate) SetRegisteredModelID(v string) { + o.RegisteredModelID = v +} + +// GetCustomProperties returns the CustomProperties field value if set, zero value otherwise. +func (o *ModelVersionCreate) GetCustomProperties() map[string]MetadataValue { + if o == nil || IsNil(o.CustomProperties) { + var ret map[string]MetadataValue + return ret + } + return *o.CustomProperties +} + +// GetCustomPropertiesOk returns a tuple with the CustomProperties field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ModelVersionCreate) GetCustomPropertiesOk() (*map[string]MetadataValue, bool) { + if o == nil || IsNil(o.CustomProperties) { + return nil, false + } + return o.CustomProperties, true +} + +// HasCustomProperties returns a boolean if a field has been set. +func (o *ModelVersionCreate) HasCustomProperties() bool { + if o != nil && !IsNil(o.CustomProperties) { + return true + } + + return false +} + +// SetCustomProperties gets a reference to the given map[string]MetadataValue and assigns it to the CustomProperties field. +func (o *ModelVersionCreate) SetCustomProperties(v map[string]MetadataValue) { + o.CustomProperties = &v +} + +// GetExternalID returns the ExternalID field value if set, zero value otherwise. +func (o *ModelVersionCreate) GetExternalID() string { + if o == nil || IsNil(o.ExternalID) { + var ret string + return ret + } + return *o.ExternalID +} + +// GetExternalIDOk returns a tuple with the ExternalID field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ModelVersionCreate) GetExternalIDOk() (*string, bool) { + if o == nil || IsNil(o.ExternalID) { + return nil, false + } + return o.ExternalID, true +} + +// HasExternalID returns a boolean if a field has been set. +func (o *ModelVersionCreate) HasExternalID() bool { + if o != nil && !IsNil(o.ExternalID) { + return true + } + + return false +} + +// SetExternalID gets a reference to the given string and assigns it to the ExternalID field. +func (o *ModelVersionCreate) SetExternalID(v string) { + o.ExternalID = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *ModelVersionCreate) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ModelVersionCreate) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *ModelVersionCreate) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *ModelVersionCreate) SetName(v string) { + o.Name = &v +} + +func (o ModelVersionCreate) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ModelVersionCreate) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["registeredModelID"] = o.RegisteredModelID + if !IsNil(o.CustomProperties) { + toSerialize["customProperties"] = o.CustomProperties + } + if !IsNil(o.ExternalID) { + toSerialize["externalID"] = o.ExternalID + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + return toSerialize, nil +} + +type NullableModelVersionCreate struct { + value *ModelVersionCreate + isSet bool +} + +func (v NullableModelVersionCreate) Get() *ModelVersionCreate { + return v.value +} + +func (v *NullableModelVersionCreate) Set(val *ModelVersionCreate) { + v.value = val + v.isSet = true +} + +func (v NullableModelVersionCreate) IsSet() bool { + return v.isSet +} + +func (v *NullableModelVersionCreate) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableModelVersionCreate(val *ModelVersionCreate) *NullableModelVersionCreate { + return &NullableModelVersionCreate{value: val, isSet: true} +} + +func (v NullableModelVersionCreate) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableModelVersionCreate) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/model/openapi/model_model_version_list.go b/internal/model/openapi/model_model_version_list.go new file mode 100644 index 000000000..3a0a8d034 --- /dev/null +++ b/internal/model/openapi/model_model_version_list.go @@ -0,0 +1,209 @@ +/* +Model Registry REST API + +REST API for Model Registry to create and manage ML model metadata + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the ModelVersionList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ModelVersionList{} + +// ModelVersionList List of ModelVersion entities. +type ModelVersionList struct { + // Token to use to retrieve next page of results. + NextPageToken string `json:"nextPageToken"` + // Maximum number of resources to return in the result. + PageSize int32 `json:"pageSize"` + // Number of items in result list. + Size int32 `json:"size"` + // Array of `ModelVersion` entities. + Items []ModelVersion `json:"items,omitempty"` +} + +// NewModelVersionList instantiates a new ModelVersionList object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewModelVersionList(nextPageToken string, pageSize int32, size int32) *ModelVersionList { + this := ModelVersionList{} + this.NextPageToken = nextPageToken + this.PageSize = pageSize + this.Size = size + return &this +} + +// NewModelVersionListWithDefaults instantiates a new ModelVersionList object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewModelVersionListWithDefaults() *ModelVersionList { + this := ModelVersionList{} + return &this +} + +// GetNextPageToken returns the NextPageToken field value +func (o *ModelVersionList) GetNextPageToken() string { + if o == nil { + var ret string + return ret + } + + return o.NextPageToken +} + +// GetNextPageTokenOk returns a tuple with the NextPageToken field value +// and a boolean to check if the value has been set. +func (o *ModelVersionList) GetNextPageTokenOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.NextPageToken, true +} + +// SetNextPageToken sets field value +func (o *ModelVersionList) SetNextPageToken(v string) { + o.NextPageToken = v +} + +// GetPageSize returns the PageSize field value +func (o *ModelVersionList) GetPageSize() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.PageSize +} + +// GetPageSizeOk returns a tuple with the PageSize field value +// and a boolean to check if the value has been set. +func (o *ModelVersionList) GetPageSizeOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.PageSize, true +} + +// SetPageSize sets field value +func (o *ModelVersionList) SetPageSize(v int32) { + o.PageSize = v +} + +// GetSize returns the Size field value +func (o *ModelVersionList) GetSize() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Size +} + +// GetSizeOk returns a tuple with the Size field value +// and a boolean to check if the value has been set. +func (o *ModelVersionList) GetSizeOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Size, true +} + +// SetSize sets field value +func (o *ModelVersionList) SetSize(v int32) { + o.Size = v +} + +// GetItems returns the Items field value if set, zero value otherwise. +func (o *ModelVersionList) GetItems() []ModelVersion { + if o == nil || IsNil(o.Items) { + var ret []ModelVersion + return ret + } + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ModelVersionList) GetItemsOk() ([]ModelVersion, bool) { + if o == nil || IsNil(o.Items) { + return nil, false + } + return o.Items, true +} + +// HasItems returns a boolean if a field has been set. +func (o *ModelVersionList) HasItems() bool { + if o != nil && !IsNil(o.Items) { + return true + } + + return false +} + +// SetItems gets a reference to the given []ModelVersion and assigns it to the Items field. +func (o *ModelVersionList) SetItems(v []ModelVersion) { + o.Items = v +} + +func (o ModelVersionList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ModelVersionList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["nextPageToken"] = o.NextPageToken + toSerialize["pageSize"] = o.PageSize + toSerialize["size"] = o.Size + if !IsNil(o.Items) { + toSerialize["items"] = o.Items + } + return toSerialize, nil +} + +type NullableModelVersionList struct { + value *ModelVersionList + isSet bool +} + +func (v NullableModelVersionList) Get() *ModelVersionList { + return v.value +} + +func (v *NullableModelVersionList) Set(val *ModelVersionList) { + v.value = val + v.isSet = true +} + +func (v NullableModelVersionList) IsSet() bool { + return v.isSet +} + +func (v *NullableModelVersionList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableModelVersionList(val *ModelVersionList) *NullableModelVersionList { + return &NullableModelVersionList{value: val, isSet: true} +} + +func (v NullableModelVersionList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableModelVersionList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/model/openapi/model_model_version_update.go b/internal/model/openapi/model_model_version_update.go new file mode 100644 index 000000000..d9d5417af --- /dev/null +++ b/internal/model/openapi/model_model_version_update.go @@ -0,0 +1,162 @@ +/* +Model Registry REST API + +REST API for Model Registry to create and manage ML model metadata + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the ModelVersionUpdate type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ModelVersionUpdate{} + +// ModelVersionUpdate Represents a ModelVersion belonging to a RegisteredModel. +type ModelVersionUpdate struct { + // User provided custom properties which are not defined by its type. + CustomProperties *map[string]MetadataValue `json:"customProperties,omitempty"` + // The external id that come from the clients’ system. This field is optional. If set, it must be unique among all resources within a database instance. + ExternalID *string `json:"externalID,omitempty"` +} + +// NewModelVersionUpdate instantiates a new ModelVersionUpdate object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewModelVersionUpdate() *ModelVersionUpdate { + this := ModelVersionUpdate{} + return &this +} + +// NewModelVersionUpdateWithDefaults instantiates a new ModelVersionUpdate object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewModelVersionUpdateWithDefaults() *ModelVersionUpdate { + this := ModelVersionUpdate{} + return &this +} + +// GetCustomProperties returns the CustomProperties field value if set, zero value otherwise. +func (o *ModelVersionUpdate) GetCustomProperties() map[string]MetadataValue { + if o == nil || IsNil(o.CustomProperties) { + var ret map[string]MetadataValue + return ret + } + return *o.CustomProperties +} + +// GetCustomPropertiesOk returns a tuple with the CustomProperties field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ModelVersionUpdate) GetCustomPropertiesOk() (*map[string]MetadataValue, bool) { + if o == nil || IsNil(o.CustomProperties) { + return nil, false + } + return o.CustomProperties, true +} + +// HasCustomProperties returns a boolean if a field has been set. +func (o *ModelVersionUpdate) HasCustomProperties() bool { + if o != nil && !IsNil(o.CustomProperties) { + return true + } + + return false +} + +// SetCustomProperties gets a reference to the given map[string]MetadataValue and assigns it to the CustomProperties field. +func (o *ModelVersionUpdate) SetCustomProperties(v map[string]MetadataValue) { + o.CustomProperties = &v +} + +// GetExternalID returns the ExternalID field value if set, zero value otherwise. +func (o *ModelVersionUpdate) GetExternalID() string { + if o == nil || IsNil(o.ExternalID) { + var ret string + return ret + } + return *o.ExternalID +} + +// GetExternalIDOk returns a tuple with the ExternalID field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ModelVersionUpdate) GetExternalIDOk() (*string, bool) { + if o == nil || IsNil(o.ExternalID) { + return nil, false + } + return o.ExternalID, true +} + +// HasExternalID returns a boolean if a field has been set. +func (o *ModelVersionUpdate) HasExternalID() bool { + if o != nil && !IsNil(o.ExternalID) { + return true + } + + return false +} + +// SetExternalID gets a reference to the given string and assigns it to the ExternalID field. +func (o *ModelVersionUpdate) SetExternalID(v string) { + o.ExternalID = &v +} + +func (o ModelVersionUpdate) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ModelVersionUpdate) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CustomProperties) { + toSerialize["customProperties"] = o.CustomProperties + } + if !IsNil(o.ExternalID) { + toSerialize["externalID"] = o.ExternalID + } + return toSerialize, nil +} + +type NullableModelVersionUpdate struct { + value *ModelVersionUpdate + isSet bool +} + +func (v NullableModelVersionUpdate) Get() *ModelVersionUpdate { + return v.value +} + +func (v *NullableModelVersionUpdate) Set(val *ModelVersionUpdate) { + v.value = val + v.isSet = true +} + +func (v NullableModelVersionUpdate) IsSet() bool { + return v.isSet +} + +func (v *NullableModelVersionUpdate) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableModelVersionUpdate(val *ModelVersionUpdate) *NullableModelVersionUpdate { + return &NullableModelVersionUpdate{value: val, isSet: true} +} + +func (v NullableModelVersionUpdate) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableModelVersionUpdate) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/model/openapi/model_order_by_field.go b/internal/model/openapi/model_order_by_field.go new file mode 100644 index 000000000..6c8c9e566 --- /dev/null +++ b/internal/model/openapi/model_order_by_field.go @@ -0,0 +1,112 @@ +/* +Model Registry REST API + +REST API for Model Registry to create and manage ML model metadata + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "fmt" +) + +// OrderByField Supported fields for ordering result entities. +type OrderByField string + +// List of OrderByField +const ( + ORDERBYFIELD_CREATE_TIME OrderByField = "CREATE_TIME" + ORDERBYFIELD_LAST_UPDATE_TIME OrderByField = "LAST_UPDATE_TIME" + ORDERBYFIELD_ID OrderByField = "ID" +) + +// All allowed values of OrderByField enum +var AllowedOrderByFieldEnumValues = []OrderByField{ + "CREATE_TIME", + "LAST_UPDATE_TIME", + "ID", +} + +func (v *OrderByField) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := OrderByField(value) + for _, existing := range AllowedOrderByFieldEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid OrderByField", value) +} + +// NewOrderByFieldFromValue returns a pointer to a valid OrderByField +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewOrderByFieldFromValue(v string) (*OrderByField, error) { + ev := OrderByField(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for OrderByField: valid values are %v", v, AllowedOrderByFieldEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v OrderByField) IsValid() bool { + for _, existing := range AllowedOrderByFieldEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to OrderByField value +func (v OrderByField) Ptr() *OrderByField { + return &v +} + +type NullableOrderByField struct { + value *OrderByField + isSet bool +} + +func (v NullableOrderByField) Get() *OrderByField { + return v.value +} + +func (v *NullableOrderByField) Set(val *OrderByField) { + v.value = val + v.isSet = true +} + +func (v NullableOrderByField) IsSet() bool { + return v.isSet +} + +func (v *NullableOrderByField) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableOrderByField(val *OrderByField) *NullableOrderByField { + return &NullableOrderByField{value: val, isSet: true} +} + +func (v NullableOrderByField) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableOrderByField) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/model/openapi/model_registered_model.go b/internal/model/openapi/model_registered_model.go new file mode 100644 index 000000000..93a726f59 --- /dev/null +++ b/internal/model/openapi/model_registered_model.go @@ -0,0 +1,310 @@ +/* +Model Registry REST API + +REST API for Model Registry to create and manage ML model metadata + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the RegisteredModel type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RegisteredModel{} + +// RegisteredModel A registered model in model registry. A registered model has ModelVersion children. +type RegisteredModel struct { + // User provided custom properties which are not defined by its type. + CustomProperties *map[string]MetadataValue `json:"customProperties,omitempty"` + // The external id that come from the clients’ system. This field is optional. If set, it must be unique among all resources within a database instance. + ExternalID *string `json:"externalID,omitempty"` + // The client provided name of the artifact. This field is optional. If set, it must be unique among all the artifacts of the same artifact type within a database instance and cannot be changed once set. + Name *string `json:"name,omitempty"` + // Output only. The unique server generated id of the resource. + Id *string `json:"id,omitempty"` + // Output only. Create time of the resource in millisecond since epoch. + CreateTimeSinceEpoch *string `json:"createTimeSinceEpoch,omitempty"` + // Output only. Last update time of the resource since epoch in millisecond since epoch. + LastUpdateTimeSinceEpoch *string `json:"lastUpdateTimeSinceEpoch,omitempty"` +} + +// NewRegisteredModel instantiates a new RegisteredModel object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewRegisteredModel() *RegisteredModel { + this := RegisteredModel{} + return &this +} + +// NewRegisteredModelWithDefaults instantiates a new RegisteredModel object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewRegisteredModelWithDefaults() *RegisteredModel { + this := RegisteredModel{} + return &this +} + +// GetCustomProperties returns the CustomProperties field value if set, zero value otherwise. +func (o *RegisteredModel) GetCustomProperties() map[string]MetadataValue { + if o == nil || IsNil(o.CustomProperties) { + var ret map[string]MetadataValue + return ret + } + return *o.CustomProperties +} + +// GetCustomPropertiesOk returns a tuple with the CustomProperties field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RegisteredModel) GetCustomPropertiesOk() (*map[string]MetadataValue, bool) { + if o == nil || IsNil(o.CustomProperties) { + return nil, false + } + return o.CustomProperties, true +} + +// HasCustomProperties returns a boolean if a field has been set. +func (o *RegisteredModel) HasCustomProperties() bool { + if o != nil && !IsNil(o.CustomProperties) { + return true + } + + return false +} + +// SetCustomProperties gets a reference to the given map[string]MetadataValue and assigns it to the CustomProperties field. +func (o *RegisteredModel) SetCustomProperties(v map[string]MetadataValue) { + o.CustomProperties = &v +} + +// GetExternalID returns the ExternalID field value if set, zero value otherwise. +func (o *RegisteredModel) GetExternalID() string { + if o == nil || IsNil(o.ExternalID) { + var ret string + return ret + } + return *o.ExternalID +} + +// GetExternalIDOk returns a tuple with the ExternalID field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RegisteredModel) GetExternalIDOk() (*string, bool) { + if o == nil || IsNil(o.ExternalID) { + return nil, false + } + return o.ExternalID, true +} + +// HasExternalID returns a boolean if a field has been set. +func (o *RegisteredModel) HasExternalID() bool { + if o != nil && !IsNil(o.ExternalID) { + return true + } + + return false +} + +// SetExternalID gets a reference to the given string and assigns it to the ExternalID field. +func (o *RegisteredModel) SetExternalID(v string) { + o.ExternalID = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *RegisteredModel) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RegisteredModel) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *RegisteredModel) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *RegisteredModel) SetName(v string) { + o.Name = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *RegisteredModel) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RegisteredModel) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *RegisteredModel) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *RegisteredModel) SetId(v string) { + o.Id = &v +} + +// GetCreateTimeSinceEpoch returns the CreateTimeSinceEpoch field value if set, zero value otherwise. +func (o *RegisteredModel) GetCreateTimeSinceEpoch() string { + if o == nil || IsNil(o.CreateTimeSinceEpoch) { + var ret string + return ret + } + return *o.CreateTimeSinceEpoch +} + +// GetCreateTimeSinceEpochOk returns a tuple with the CreateTimeSinceEpoch field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RegisteredModel) GetCreateTimeSinceEpochOk() (*string, bool) { + if o == nil || IsNil(o.CreateTimeSinceEpoch) { + return nil, false + } + return o.CreateTimeSinceEpoch, true +} + +// HasCreateTimeSinceEpoch returns a boolean if a field has been set. +func (o *RegisteredModel) HasCreateTimeSinceEpoch() bool { + if o != nil && !IsNil(o.CreateTimeSinceEpoch) { + return true + } + + return false +} + +// SetCreateTimeSinceEpoch gets a reference to the given string and assigns it to the CreateTimeSinceEpoch field. +func (o *RegisteredModel) SetCreateTimeSinceEpoch(v string) { + o.CreateTimeSinceEpoch = &v +} + +// GetLastUpdateTimeSinceEpoch returns the LastUpdateTimeSinceEpoch field value if set, zero value otherwise. +func (o *RegisteredModel) GetLastUpdateTimeSinceEpoch() string { + if o == nil || IsNil(o.LastUpdateTimeSinceEpoch) { + var ret string + return ret + } + return *o.LastUpdateTimeSinceEpoch +} + +// GetLastUpdateTimeSinceEpochOk returns a tuple with the LastUpdateTimeSinceEpoch field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RegisteredModel) GetLastUpdateTimeSinceEpochOk() (*string, bool) { + if o == nil || IsNil(o.LastUpdateTimeSinceEpoch) { + return nil, false + } + return o.LastUpdateTimeSinceEpoch, true +} + +// HasLastUpdateTimeSinceEpoch returns a boolean if a field has been set. +func (o *RegisteredModel) HasLastUpdateTimeSinceEpoch() bool { + if o != nil && !IsNil(o.LastUpdateTimeSinceEpoch) { + return true + } + + return false +} + +// SetLastUpdateTimeSinceEpoch gets a reference to the given string and assigns it to the LastUpdateTimeSinceEpoch field. +func (o *RegisteredModel) SetLastUpdateTimeSinceEpoch(v string) { + o.LastUpdateTimeSinceEpoch = &v +} + +func (o RegisteredModel) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o RegisteredModel) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CustomProperties) { + toSerialize["customProperties"] = o.CustomProperties + } + if !IsNil(o.ExternalID) { + toSerialize["externalID"] = o.ExternalID + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.CreateTimeSinceEpoch) { + toSerialize["createTimeSinceEpoch"] = o.CreateTimeSinceEpoch + } + if !IsNil(o.LastUpdateTimeSinceEpoch) { + toSerialize["lastUpdateTimeSinceEpoch"] = o.LastUpdateTimeSinceEpoch + } + return toSerialize, nil +} + +type NullableRegisteredModel struct { + value *RegisteredModel + isSet bool +} + +func (v NullableRegisteredModel) Get() *RegisteredModel { + return v.value +} + +func (v *NullableRegisteredModel) Set(val *RegisteredModel) { + v.value = val + v.isSet = true +} + +func (v NullableRegisteredModel) IsSet() bool { + return v.isSet +} + +func (v *NullableRegisteredModel) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRegisteredModel(val *RegisteredModel) *NullableRegisteredModel { + return &NullableRegisteredModel{value: val, isSet: true} +} + +func (v NullableRegisteredModel) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRegisteredModel) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/model/openapi/model_registered_model_create.go b/internal/model/openapi/model_registered_model_create.go new file mode 100644 index 000000000..507cdd9f6 --- /dev/null +++ b/internal/model/openapi/model_registered_model_create.go @@ -0,0 +1,199 @@ +/* +Model Registry REST API + +REST API for Model Registry to create and manage ML model metadata + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the RegisteredModelCreate type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RegisteredModelCreate{} + +// RegisteredModelCreate A registered model in model registry. A registered model has ModelVersion children. +type RegisteredModelCreate struct { + // User provided custom properties which are not defined by its type. + CustomProperties *map[string]MetadataValue `json:"customProperties,omitempty"` + // The external id that come from the clients’ system. This field is optional. If set, it must be unique among all resources within a database instance. + ExternalID *string `json:"externalID,omitempty"` + // The client provided name of the artifact. This field is optional. If set, it must be unique among all the artifacts of the same artifact type within a database instance and cannot be changed once set. + Name *string `json:"name,omitempty"` +} + +// NewRegisteredModelCreate instantiates a new RegisteredModelCreate object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewRegisteredModelCreate() *RegisteredModelCreate { + this := RegisteredModelCreate{} + return &this +} + +// NewRegisteredModelCreateWithDefaults instantiates a new RegisteredModelCreate object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewRegisteredModelCreateWithDefaults() *RegisteredModelCreate { + this := RegisteredModelCreate{} + return &this +} + +// GetCustomProperties returns the CustomProperties field value if set, zero value otherwise. +func (o *RegisteredModelCreate) GetCustomProperties() map[string]MetadataValue { + if o == nil || IsNil(o.CustomProperties) { + var ret map[string]MetadataValue + return ret + } + return *o.CustomProperties +} + +// GetCustomPropertiesOk returns a tuple with the CustomProperties field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RegisteredModelCreate) GetCustomPropertiesOk() (*map[string]MetadataValue, bool) { + if o == nil || IsNil(o.CustomProperties) { + return nil, false + } + return o.CustomProperties, true +} + +// HasCustomProperties returns a boolean if a field has been set. +func (o *RegisteredModelCreate) HasCustomProperties() bool { + if o != nil && !IsNil(o.CustomProperties) { + return true + } + + return false +} + +// SetCustomProperties gets a reference to the given map[string]MetadataValue and assigns it to the CustomProperties field. +func (o *RegisteredModelCreate) SetCustomProperties(v map[string]MetadataValue) { + o.CustomProperties = &v +} + +// GetExternalID returns the ExternalID field value if set, zero value otherwise. +func (o *RegisteredModelCreate) GetExternalID() string { + if o == nil || IsNil(o.ExternalID) { + var ret string + return ret + } + return *o.ExternalID +} + +// GetExternalIDOk returns a tuple with the ExternalID field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RegisteredModelCreate) GetExternalIDOk() (*string, bool) { + if o == nil || IsNil(o.ExternalID) { + return nil, false + } + return o.ExternalID, true +} + +// HasExternalID returns a boolean if a field has been set. +func (o *RegisteredModelCreate) HasExternalID() bool { + if o != nil && !IsNil(o.ExternalID) { + return true + } + + return false +} + +// SetExternalID gets a reference to the given string and assigns it to the ExternalID field. +func (o *RegisteredModelCreate) SetExternalID(v string) { + o.ExternalID = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *RegisteredModelCreate) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RegisteredModelCreate) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *RegisteredModelCreate) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *RegisteredModelCreate) SetName(v string) { + o.Name = &v +} + +func (o RegisteredModelCreate) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o RegisteredModelCreate) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CustomProperties) { + toSerialize["customProperties"] = o.CustomProperties + } + if !IsNil(o.ExternalID) { + toSerialize["externalID"] = o.ExternalID + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + return toSerialize, nil +} + +type NullableRegisteredModelCreate struct { + value *RegisteredModelCreate + isSet bool +} + +func (v NullableRegisteredModelCreate) Get() *RegisteredModelCreate { + return v.value +} + +func (v *NullableRegisteredModelCreate) Set(val *RegisteredModelCreate) { + v.value = val + v.isSet = true +} + +func (v NullableRegisteredModelCreate) IsSet() bool { + return v.isSet +} + +func (v *NullableRegisteredModelCreate) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRegisteredModelCreate(val *RegisteredModelCreate) *NullableRegisteredModelCreate { + return &NullableRegisteredModelCreate{value: val, isSet: true} +} + +func (v NullableRegisteredModelCreate) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRegisteredModelCreate) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/model/openapi/model_registered_model_list.go b/internal/model/openapi/model_registered_model_list.go new file mode 100644 index 000000000..05892f0a2 --- /dev/null +++ b/internal/model/openapi/model_registered_model_list.go @@ -0,0 +1,209 @@ +/* +Model Registry REST API + +REST API for Model Registry to create and manage ML model metadata + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the RegisteredModelList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RegisteredModelList{} + +// RegisteredModelList List of RegisteredModels. +type RegisteredModelList struct { + // Token to use to retrieve next page of results. + NextPageToken string `json:"nextPageToken"` + // Maximum number of resources to return in the result. + PageSize int32 `json:"pageSize"` + // Number of items in result list. + Size int32 `json:"size"` + // + Items []RegisteredModel `json:"items,omitempty"` +} + +// NewRegisteredModelList instantiates a new RegisteredModelList object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewRegisteredModelList(nextPageToken string, pageSize int32, size int32) *RegisteredModelList { + this := RegisteredModelList{} + this.NextPageToken = nextPageToken + this.PageSize = pageSize + this.Size = size + return &this +} + +// NewRegisteredModelListWithDefaults instantiates a new RegisteredModelList object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewRegisteredModelListWithDefaults() *RegisteredModelList { + this := RegisteredModelList{} + return &this +} + +// GetNextPageToken returns the NextPageToken field value +func (o *RegisteredModelList) GetNextPageToken() string { + if o == nil { + var ret string + return ret + } + + return o.NextPageToken +} + +// GetNextPageTokenOk returns a tuple with the NextPageToken field value +// and a boolean to check if the value has been set. +func (o *RegisteredModelList) GetNextPageTokenOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.NextPageToken, true +} + +// SetNextPageToken sets field value +func (o *RegisteredModelList) SetNextPageToken(v string) { + o.NextPageToken = v +} + +// GetPageSize returns the PageSize field value +func (o *RegisteredModelList) GetPageSize() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.PageSize +} + +// GetPageSizeOk returns a tuple with the PageSize field value +// and a boolean to check if the value has been set. +func (o *RegisteredModelList) GetPageSizeOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.PageSize, true +} + +// SetPageSize sets field value +func (o *RegisteredModelList) SetPageSize(v int32) { + o.PageSize = v +} + +// GetSize returns the Size field value +func (o *RegisteredModelList) GetSize() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Size +} + +// GetSizeOk returns a tuple with the Size field value +// and a boolean to check if the value has been set. +func (o *RegisteredModelList) GetSizeOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Size, true +} + +// SetSize sets field value +func (o *RegisteredModelList) SetSize(v int32) { + o.Size = v +} + +// GetItems returns the Items field value if set, zero value otherwise. +func (o *RegisteredModelList) GetItems() []RegisteredModel { + if o == nil || IsNil(o.Items) { + var ret []RegisteredModel + return ret + } + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RegisteredModelList) GetItemsOk() ([]RegisteredModel, bool) { + if o == nil || IsNil(o.Items) { + return nil, false + } + return o.Items, true +} + +// HasItems returns a boolean if a field has been set. +func (o *RegisteredModelList) HasItems() bool { + if o != nil && !IsNil(o.Items) { + return true + } + + return false +} + +// SetItems gets a reference to the given []RegisteredModel and assigns it to the Items field. +func (o *RegisteredModelList) SetItems(v []RegisteredModel) { + o.Items = v +} + +func (o RegisteredModelList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o RegisteredModelList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["nextPageToken"] = o.NextPageToken + toSerialize["pageSize"] = o.PageSize + toSerialize["size"] = o.Size + if !IsNil(o.Items) { + toSerialize["items"] = o.Items + } + return toSerialize, nil +} + +type NullableRegisteredModelList struct { + value *RegisteredModelList + isSet bool +} + +func (v NullableRegisteredModelList) Get() *RegisteredModelList { + return v.value +} + +func (v *NullableRegisteredModelList) Set(val *RegisteredModelList) { + v.value = val + v.isSet = true +} + +func (v NullableRegisteredModelList) IsSet() bool { + return v.isSet +} + +func (v *NullableRegisteredModelList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRegisteredModelList(val *RegisteredModelList) *NullableRegisteredModelList { + return &NullableRegisteredModelList{value: val, isSet: true} +} + +func (v NullableRegisteredModelList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRegisteredModelList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/model/openapi/model_registered_model_update.go b/internal/model/openapi/model_registered_model_update.go new file mode 100644 index 000000000..bf0817f30 --- /dev/null +++ b/internal/model/openapi/model_registered_model_update.go @@ -0,0 +1,162 @@ +/* +Model Registry REST API + +REST API for Model Registry to create and manage ML model metadata + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the RegisteredModelUpdate type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RegisteredModelUpdate{} + +// RegisteredModelUpdate A registered model in model registry. A registered model has ModelVersion children. +type RegisteredModelUpdate struct { + // User provided custom properties which are not defined by its type. + CustomProperties *map[string]MetadataValue `json:"customProperties,omitempty"` + // The external id that come from the clients’ system. This field is optional. If set, it must be unique among all resources within a database instance. + ExternalID *string `json:"externalID,omitempty"` +} + +// NewRegisteredModelUpdate instantiates a new RegisteredModelUpdate object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewRegisteredModelUpdate() *RegisteredModelUpdate { + this := RegisteredModelUpdate{} + return &this +} + +// NewRegisteredModelUpdateWithDefaults instantiates a new RegisteredModelUpdate object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewRegisteredModelUpdateWithDefaults() *RegisteredModelUpdate { + this := RegisteredModelUpdate{} + return &this +} + +// GetCustomProperties returns the CustomProperties field value if set, zero value otherwise. +func (o *RegisteredModelUpdate) GetCustomProperties() map[string]MetadataValue { + if o == nil || IsNil(o.CustomProperties) { + var ret map[string]MetadataValue + return ret + } + return *o.CustomProperties +} + +// GetCustomPropertiesOk returns a tuple with the CustomProperties field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RegisteredModelUpdate) GetCustomPropertiesOk() (*map[string]MetadataValue, bool) { + if o == nil || IsNil(o.CustomProperties) { + return nil, false + } + return o.CustomProperties, true +} + +// HasCustomProperties returns a boolean if a field has been set. +func (o *RegisteredModelUpdate) HasCustomProperties() bool { + if o != nil && !IsNil(o.CustomProperties) { + return true + } + + return false +} + +// SetCustomProperties gets a reference to the given map[string]MetadataValue and assigns it to the CustomProperties field. +func (o *RegisteredModelUpdate) SetCustomProperties(v map[string]MetadataValue) { + o.CustomProperties = &v +} + +// GetExternalID returns the ExternalID field value if set, zero value otherwise. +func (o *RegisteredModelUpdate) GetExternalID() string { + if o == nil || IsNil(o.ExternalID) { + var ret string + return ret + } + return *o.ExternalID +} + +// GetExternalIDOk returns a tuple with the ExternalID field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RegisteredModelUpdate) GetExternalIDOk() (*string, bool) { + if o == nil || IsNil(o.ExternalID) { + return nil, false + } + return o.ExternalID, true +} + +// HasExternalID returns a boolean if a field has been set. +func (o *RegisteredModelUpdate) HasExternalID() bool { + if o != nil && !IsNil(o.ExternalID) { + return true + } + + return false +} + +// SetExternalID gets a reference to the given string and assigns it to the ExternalID field. +func (o *RegisteredModelUpdate) SetExternalID(v string) { + o.ExternalID = &v +} + +func (o RegisteredModelUpdate) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o RegisteredModelUpdate) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CustomProperties) { + toSerialize["customProperties"] = o.CustomProperties + } + if !IsNil(o.ExternalID) { + toSerialize["externalID"] = o.ExternalID + } + return toSerialize, nil +} + +type NullableRegisteredModelUpdate struct { + value *RegisteredModelUpdate + isSet bool +} + +func (v NullableRegisteredModelUpdate) Get() *RegisteredModelUpdate { + return v.value +} + +func (v *NullableRegisteredModelUpdate) Set(val *RegisteredModelUpdate) { + v.value = val + v.isSet = true +} + +func (v NullableRegisteredModelUpdate) IsSet() bool { + return v.isSet +} + +func (v *NullableRegisteredModelUpdate) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRegisteredModelUpdate(val *RegisteredModelUpdate) *NullableRegisteredModelUpdate { + return &NullableRegisteredModelUpdate{value: val, isSet: true} +} + +func (v NullableRegisteredModelUpdate) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRegisteredModelUpdate) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/model/openapi/model_serve_model.go b/internal/model/openapi/model_serve_model.go new file mode 100644 index 000000000..49e2ebf9e --- /dev/null +++ b/internal/model/openapi/model_serve_model.go @@ -0,0 +1,378 @@ +/* +Model Registry REST API + +REST API for Model Registry to create and manage ML model metadata + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the ServeModel type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ServeModel{} + +// ServeModel An ML model serving action. +type ServeModel struct { + LastKnownState *ExecutionState `json:"lastKnownState,omitempty"` + // User provided custom properties which are not defined by its type. + CustomProperties *map[string]MetadataValue `json:"customProperties,omitempty"` + // The external id that come from the clients’ system. This field is optional. If set, it must be unique among all resources within a database instance. + ExternalID *string `json:"externalID,omitempty"` + // The client provided name of the artifact. This field is optional. If set, it must be unique among all the artifacts of the same artifact type within a database instance and cannot be changed once set. + Name *string `json:"name,omitempty"` + // Output only. The unique server generated id of the resource. + Id *string `json:"id,omitempty"` + // Output only. Create time of the resource in millisecond since epoch. + CreateTimeSinceEpoch *string `json:"createTimeSinceEpoch,omitempty"` + // Output only. Last update time of the resource since epoch in millisecond since epoch. + LastUpdateTimeSinceEpoch *string `json:"lastUpdateTimeSinceEpoch,omitempty"` + // ID of the `ModelVersion` that was served in `InferenceService`. + ModelVersionId string `json:"modelVersionId"` +} + +// NewServeModel instantiates a new ServeModel object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewServeModel(modelVersionId string) *ServeModel { + this := ServeModel{} + var lastKnownState ExecutionState = EXECUTIONSTATE_UNKNOWN + this.LastKnownState = &lastKnownState + this.ModelVersionId = modelVersionId + return &this +} + +// NewServeModelWithDefaults instantiates a new ServeModel object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewServeModelWithDefaults() *ServeModel { + this := ServeModel{} + var lastKnownState ExecutionState = EXECUTIONSTATE_UNKNOWN + this.LastKnownState = &lastKnownState + return &this +} + +// GetLastKnownState returns the LastKnownState field value if set, zero value otherwise. +func (o *ServeModel) GetLastKnownState() ExecutionState { + if o == nil || IsNil(o.LastKnownState) { + var ret ExecutionState + return ret + } + return *o.LastKnownState +} + +// GetLastKnownStateOk returns a tuple with the LastKnownState field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServeModel) GetLastKnownStateOk() (*ExecutionState, bool) { + if o == nil || IsNil(o.LastKnownState) { + return nil, false + } + return o.LastKnownState, true +} + +// HasLastKnownState returns a boolean if a field has been set. +func (o *ServeModel) HasLastKnownState() bool { + if o != nil && !IsNil(o.LastKnownState) { + return true + } + + return false +} + +// SetLastKnownState gets a reference to the given ExecutionState and assigns it to the LastKnownState field. +func (o *ServeModel) SetLastKnownState(v ExecutionState) { + o.LastKnownState = &v +} + +// GetCustomProperties returns the CustomProperties field value if set, zero value otherwise. +func (o *ServeModel) GetCustomProperties() map[string]MetadataValue { + if o == nil || IsNil(o.CustomProperties) { + var ret map[string]MetadataValue + return ret + } + return *o.CustomProperties +} + +// GetCustomPropertiesOk returns a tuple with the CustomProperties field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServeModel) GetCustomPropertiesOk() (*map[string]MetadataValue, bool) { + if o == nil || IsNil(o.CustomProperties) { + return nil, false + } + return o.CustomProperties, true +} + +// HasCustomProperties returns a boolean if a field has been set. +func (o *ServeModel) HasCustomProperties() bool { + if o != nil && !IsNil(o.CustomProperties) { + return true + } + + return false +} + +// SetCustomProperties gets a reference to the given map[string]MetadataValue and assigns it to the CustomProperties field. +func (o *ServeModel) SetCustomProperties(v map[string]MetadataValue) { + o.CustomProperties = &v +} + +// GetExternalID returns the ExternalID field value if set, zero value otherwise. +func (o *ServeModel) GetExternalID() string { + if o == nil || IsNil(o.ExternalID) { + var ret string + return ret + } + return *o.ExternalID +} + +// GetExternalIDOk returns a tuple with the ExternalID field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServeModel) GetExternalIDOk() (*string, bool) { + if o == nil || IsNil(o.ExternalID) { + return nil, false + } + return o.ExternalID, true +} + +// HasExternalID returns a boolean if a field has been set. +func (o *ServeModel) HasExternalID() bool { + if o != nil && !IsNil(o.ExternalID) { + return true + } + + return false +} + +// SetExternalID gets a reference to the given string and assigns it to the ExternalID field. +func (o *ServeModel) SetExternalID(v string) { + o.ExternalID = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *ServeModel) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServeModel) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *ServeModel) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *ServeModel) SetName(v string) { + o.Name = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *ServeModel) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServeModel) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *ServeModel) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *ServeModel) SetId(v string) { + o.Id = &v +} + +// GetCreateTimeSinceEpoch returns the CreateTimeSinceEpoch field value if set, zero value otherwise. +func (o *ServeModel) GetCreateTimeSinceEpoch() string { + if o == nil || IsNil(o.CreateTimeSinceEpoch) { + var ret string + return ret + } + return *o.CreateTimeSinceEpoch +} + +// GetCreateTimeSinceEpochOk returns a tuple with the CreateTimeSinceEpoch field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServeModel) GetCreateTimeSinceEpochOk() (*string, bool) { + if o == nil || IsNil(o.CreateTimeSinceEpoch) { + return nil, false + } + return o.CreateTimeSinceEpoch, true +} + +// HasCreateTimeSinceEpoch returns a boolean if a field has been set. +func (o *ServeModel) HasCreateTimeSinceEpoch() bool { + if o != nil && !IsNil(o.CreateTimeSinceEpoch) { + return true + } + + return false +} + +// SetCreateTimeSinceEpoch gets a reference to the given string and assigns it to the CreateTimeSinceEpoch field. +func (o *ServeModel) SetCreateTimeSinceEpoch(v string) { + o.CreateTimeSinceEpoch = &v +} + +// GetLastUpdateTimeSinceEpoch returns the LastUpdateTimeSinceEpoch field value if set, zero value otherwise. +func (o *ServeModel) GetLastUpdateTimeSinceEpoch() string { + if o == nil || IsNil(o.LastUpdateTimeSinceEpoch) { + var ret string + return ret + } + return *o.LastUpdateTimeSinceEpoch +} + +// GetLastUpdateTimeSinceEpochOk returns a tuple with the LastUpdateTimeSinceEpoch field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServeModel) GetLastUpdateTimeSinceEpochOk() (*string, bool) { + if o == nil || IsNil(o.LastUpdateTimeSinceEpoch) { + return nil, false + } + return o.LastUpdateTimeSinceEpoch, true +} + +// HasLastUpdateTimeSinceEpoch returns a boolean if a field has been set. +func (o *ServeModel) HasLastUpdateTimeSinceEpoch() bool { + if o != nil && !IsNil(o.LastUpdateTimeSinceEpoch) { + return true + } + + return false +} + +// SetLastUpdateTimeSinceEpoch gets a reference to the given string and assigns it to the LastUpdateTimeSinceEpoch field. +func (o *ServeModel) SetLastUpdateTimeSinceEpoch(v string) { + o.LastUpdateTimeSinceEpoch = &v +} + +// GetModelVersionId returns the ModelVersionId field value +func (o *ServeModel) GetModelVersionId() string { + if o == nil { + var ret string + return ret + } + + return o.ModelVersionId +} + +// GetModelVersionIdOk returns a tuple with the ModelVersionId field value +// and a boolean to check if the value has been set. +func (o *ServeModel) GetModelVersionIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ModelVersionId, true +} + +// SetModelVersionId sets field value +func (o *ServeModel) SetModelVersionId(v string) { + o.ModelVersionId = v +} + +func (o ServeModel) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ServeModel) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.LastKnownState) { + toSerialize["lastKnownState"] = o.LastKnownState + } + if !IsNil(o.CustomProperties) { + toSerialize["customProperties"] = o.CustomProperties + } + if !IsNil(o.ExternalID) { + toSerialize["externalID"] = o.ExternalID + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.CreateTimeSinceEpoch) { + toSerialize["createTimeSinceEpoch"] = o.CreateTimeSinceEpoch + } + if !IsNil(o.LastUpdateTimeSinceEpoch) { + toSerialize["lastUpdateTimeSinceEpoch"] = o.LastUpdateTimeSinceEpoch + } + toSerialize["modelVersionId"] = o.ModelVersionId + return toSerialize, nil +} + +type NullableServeModel struct { + value *ServeModel + isSet bool +} + +func (v NullableServeModel) Get() *ServeModel { + return v.value +} + +func (v *NullableServeModel) Set(val *ServeModel) { + v.value = val + v.isSet = true +} + +func (v NullableServeModel) IsSet() bool { + return v.isSet +} + +func (v *NullableServeModel) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableServeModel(val *ServeModel) *NullableServeModel { + return &NullableServeModel{value: val, isSet: true} +} + +func (v NullableServeModel) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableServeModel) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/model/openapi/model_serve_model_create.go b/internal/model/openapi/model_serve_model_create.go new file mode 100644 index 000000000..fc7e3c9c7 --- /dev/null +++ b/internal/model/openapi/model_serve_model_create.go @@ -0,0 +1,267 @@ +/* +Model Registry REST API + +REST API for Model Registry to create and manage ML model metadata + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the ServeModelCreate type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ServeModelCreate{} + +// ServeModelCreate An ML model serving action. +type ServeModelCreate struct { + LastKnownState *ExecutionState `json:"lastKnownState,omitempty"` + // User provided custom properties which are not defined by its type. + CustomProperties *map[string]MetadataValue `json:"customProperties,omitempty"` + // The external id that come from the clients’ system. This field is optional. If set, it must be unique among all resources within a database instance. + ExternalID *string `json:"externalID,omitempty"` + // The client provided name of the artifact. This field is optional. If set, it must be unique among all the artifacts of the same artifact type within a database instance and cannot be changed once set. + Name *string `json:"name,omitempty"` + // ID of the `ModelVersion` that was served in `InferenceService`. + ModelVersionId string `json:"modelVersionId"` +} + +// NewServeModelCreate instantiates a new ServeModelCreate object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewServeModelCreate(modelVersionId string) *ServeModelCreate { + this := ServeModelCreate{} + var lastKnownState ExecutionState = EXECUTIONSTATE_UNKNOWN + this.LastKnownState = &lastKnownState + this.ModelVersionId = modelVersionId + return &this +} + +// NewServeModelCreateWithDefaults instantiates a new ServeModelCreate object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewServeModelCreateWithDefaults() *ServeModelCreate { + this := ServeModelCreate{} + var lastKnownState ExecutionState = EXECUTIONSTATE_UNKNOWN + this.LastKnownState = &lastKnownState + return &this +} + +// GetLastKnownState returns the LastKnownState field value if set, zero value otherwise. +func (o *ServeModelCreate) GetLastKnownState() ExecutionState { + if o == nil || IsNil(o.LastKnownState) { + var ret ExecutionState + return ret + } + return *o.LastKnownState +} + +// GetLastKnownStateOk returns a tuple with the LastKnownState field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServeModelCreate) GetLastKnownStateOk() (*ExecutionState, bool) { + if o == nil || IsNil(o.LastKnownState) { + return nil, false + } + return o.LastKnownState, true +} + +// HasLastKnownState returns a boolean if a field has been set. +func (o *ServeModelCreate) HasLastKnownState() bool { + if o != nil && !IsNil(o.LastKnownState) { + return true + } + + return false +} + +// SetLastKnownState gets a reference to the given ExecutionState and assigns it to the LastKnownState field. +func (o *ServeModelCreate) SetLastKnownState(v ExecutionState) { + o.LastKnownState = &v +} + +// GetCustomProperties returns the CustomProperties field value if set, zero value otherwise. +func (o *ServeModelCreate) GetCustomProperties() map[string]MetadataValue { + if o == nil || IsNil(o.CustomProperties) { + var ret map[string]MetadataValue + return ret + } + return *o.CustomProperties +} + +// GetCustomPropertiesOk returns a tuple with the CustomProperties field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServeModelCreate) GetCustomPropertiesOk() (*map[string]MetadataValue, bool) { + if o == nil || IsNil(o.CustomProperties) { + return nil, false + } + return o.CustomProperties, true +} + +// HasCustomProperties returns a boolean if a field has been set. +func (o *ServeModelCreate) HasCustomProperties() bool { + if o != nil && !IsNil(o.CustomProperties) { + return true + } + + return false +} + +// SetCustomProperties gets a reference to the given map[string]MetadataValue and assigns it to the CustomProperties field. +func (o *ServeModelCreate) SetCustomProperties(v map[string]MetadataValue) { + o.CustomProperties = &v +} + +// GetExternalID returns the ExternalID field value if set, zero value otherwise. +func (o *ServeModelCreate) GetExternalID() string { + if o == nil || IsNil(o.ExternalID) { + var ret string + return ret + } + return *o.ExternalID +} + +// GetExternalIDOk returns a tuple with the ExternalID field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServeModelCreate) GetExternalIDOk() (*string, bool) { + if o == nil || IsNil(o.ExternalID) { + return nil, false + } + return o.ExternalID, true +} + +// HasExternalID returns a boolean if a field has been set. +func (o *ServeModelCreate) HasExternalID() bool { + if o != nil && !IsNil(o.ExternalID) { + return true + } + + return false +} + +// SetExternalID gets a reference to the given string and assigns it to the ExternalID field. +func (o *ServeModelCreate) SetExternalID(v string) { + o.ExternalID = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *ServeModelCreate) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServeModelCreate) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *ServeModelCreate) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *ServeModelCreate) SetName(v string) { + o.Name = &v +} + +// GetModelVersionId returns the ModelVersionId field value +func (o *ServeModelCreate) GetModelVersionId() string { + if o == nil { + var ret string + return ret + } + + return o.ModelVersionId +} + +// GetModelVersionIdOk returns a tuple with the ModelVersionId field value +// and a boolean to check if the value has been set. +func (o *ServeModelCreate) GetModelVersionIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ModelVersionId, true +} + +// SetModelVersionId sets field value +func (o *ServeModelCreate) SetModelVersionId(v string) { + o.ModelVersionId = v +} + +func (o ServeModelCreate) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ServeModelCreate) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.LastKnownState) { + toSerialize["lastKnownState"] = o.LastKnownState + } + if !IsNil(o.CustomProperties) { + toSerialize["customProperties"] = o.CustomProperties + } + if !IsNil(o.ExternalID) { + toSerialize["externalID"] = o.ExternalID + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + toSerialize["modelVersionId"] = o.ModelVersionId + return toSerialize, nil +} + +type NullableServeModelCreate struct { + value *ServeModelCreate + isSet bool +} + +func (v NullableServeModelCreate) Get() *ServeModelCreate { + return v.value +} + +func (v *NullableServeModelCreate) Set(val *ServeModelCreate) { + v.value = val + v.isSet = true +} + +func (v NullableServeModelCreate) IsSet() bool { + return v.isSet +} + +func (v *NullableServeModelCreate) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableServeModelCreate(val *ServeModelCreate) *NullableServeModelCreate { + return &NullableServeModelCreate{value: val, isSet: true} +} + +func (v NullableServeModelCreate) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableServeModelCreate) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/model/openapi/model_serve_model_list.go b/internal/model/openapi/model_serve_model_list.go new file mode 100644 index 000000000..2b3285b6d --- /dev/null +++ b/internal/model/openapi/model_serve_model_list.go @@ -0,0 +1,209 @@ +/* +Model Registry REST API + +REST API for Model Registry to create and manage ML model metadata + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the ServeModelList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ServeModelList{} + +// ServeModelList List of ServeModel entities. +type ServeModelList struct { + // Token to use to retrieve next page of results. + NextPageToken string `json:"nextPageToken"` + // Maximum number of resources to return in the result. + PageSize int32 `json:"pageSize"` + // Number of items in result list. + Size int32 `json:"size"` + // Array of `ModelArtifact` entities. + Items []ServeModel `json:"items,omitempty"` +} + +// NewServeModelList instantiates a new ServeModelList object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewServeModelList(nextPageToken string, pageSize int32, size int32) *ServeModelList { + this := ServeModelList{} + this.NextPageToken = nextPageToken + this.PageSize = pageSize + this.Size = size + return &this +} + +// NewServeModelListWithDefaults instantiates a new ServeModelList object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewServeModelListWithDefaults() *ServeModelList { + this := ServeModelList{} + return &this +} + +// GetNextPageToken returns the NextPageToken field value +func (o *ServeModelList) GetNextPageToken() string { + if o == nil { + var ret string + return ret + } + + return o.NextPageToken +} + +// GetNextPageTokenOk returns a tuple with the NextPageToken field value +// and a boolean to check if the value has been set. +func (o *ServeModelList) GetNextPageTokenOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.NextPageToken, true +} + +// SetNextPageToken sets field value +func (o *ServeModelList) SetNextPageToken(v string) { + o.NextPageToken = v +} + +// GetPageSize returns the PageSize field value +func (o *ServeModelList) GetPageSize() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.PageSize +} + +// GetPageSizeOk returns a tuple with the PageSize field value +// and a boolean to check if the value has been set. +func (o *ServeModelList) GetPageSizeOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.PageSize, true +} + +// SetPageSize sets field value +func (o *ServeModelList) SetPageSize(v int32) { + o.PageSize = v +} + +// GetSize returns the Size field value +func (o *ServeModelList) GetSize() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Size +} + +// GetSizeOk returns a tuple with the Size field value +// and a boolean to check if the value has been set. +func (o *ServeModelList) GetSizeOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Size, true +} + +// SetSize sets field value +func (o *ServeModelList) SetSize(v int32) { + o.Size = v +} + +// GetItems returns the Items field value if set, zero value otherwise. +func (o *ServeModelList) GetItems() []ServeModel { + if o == nil || IsNil(o.Items) { + var ret []ServeModel + return ret + } + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServeModelList) GetItemsOk() ([]ServeModel, bool) { + if o == nil || IsNil(o.Items) { + return nil, false + } + return o.Items, true +} + +// HasItems returns a boolean if a field has been set. +func (o *ServeModelList) HasItems() bool { + if o != nil && !IsNil(o.Items) { + return true + } + + return false +} + +// SetItems gets a reference to the given []ServeModel and assigns it to the Items field. +func (o *ServeModelList) SetItems(v []ServeModel) { + o.Items = v +} + +func (o ServeModelList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ServeModelList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["nextPageToken"] = o.NextPageToken + toSerialize["pageSize"] = o.PageSize + toSerialize["size"] = o.Size + if !IsNil(o.Items) { + toSerialize["items"] = o.Items + } + return toSerialize, nil +} + +type NullableServeModelList struct { + value *ServeModelList + isSet bool +} + +func (v NullableServeModelList) Get() *ServeModelList { + return v.value +} + +func (v *NullableServeModelList) Set(val *ServeModelList) { + v.value = val + v.isSet = true +} + +func (v NullableServeModelList) IsSet() bool { + return v.isSet +} + +func (v *NullableServeModelList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableServeModelList(val *ServeModelList) *NullableServeModelList { + return &NullableServeModelList{value: val, isSet: true} +} + +func (v NullableServeModelList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableServeModelList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/model/openapi/model_serve_model_update.go b/internal/model/openapi/model_serve_model_update.go new file mode 100644 index 000000000..3152ae3c5 --- /dev/null +++ b/internal/model/openapi/model_serve_model_update.go @@ -0,0 +1,202 @@ +/* +Model Registry REST API + +REST API for Model Registry to create and manage ML model metadata + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the ServeModelUpdate type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ServeModelUpdate{} + +// ServeModelUpdate An ML model serving action. +type ServeModelUpdate struct { + LastKnownState *ExecutionState `json:"lastKnownState,omitempty"` + // User provided custom properties which are not defined by its type. + CustomProperties *map[string]MetadataValue `json:"customProperties,omitempty"` + // The external id that come from the clients’ system. This field is optional. If set, it must be unique among all resources within a database instance. + ExternalID *string `json:"externalID,omitempty"` +} + +// NewServeModelUpdate instantiates a new ServeModelUpdate object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewServeModelUpdate() *ServeModelUpdate { + this := ServeModelUpdate{} + var lastKnownState ExecutionState = EXECUTIONSTATE_UNKNOWN + this.LastKnownState = &lastKnownState + return &this +} + +// NewServeModelUpdateWithDefaults instantiates a new ServeModelUpdate object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewServeModelUpdateWithDefaults() *ServeModelUpdate { + this := ServeModelUpdate{} + var lastKnownState ExecutionState = EXECUTIONSTATE_UNKNOWN + this.LastKnownState = &lastKnownState + return &this +} + +// GetLastKnownState returns the LastKnownState field value if set, zero value otherwise. +func (o *ServeModelUpdate) GetLastKnownState() ExecutionState { + if o == nil || IsNil(o.LastKnownState) { + var ret ExecutionState + return ret + } + return *o.LastKnownState +} + +// GetLastKnownStateOk returns a tuple with the LastKnownState field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServeModelUpdate) GetLastKnownStateOk() (*ExecutionState, bool) { + if o == nil || IsNil(o.LastKnownState) { + return nil, false + } + return o.LastKnownState, true +} + +// HasLastKnownState returns a boolean if a field has been set. +func (o *ServeModelUpdate) HasLastKnownState() bool { + if o != nil && !IsNil(o.LastKnownState) { + return true + } + + return false +} + +// SetLastKnownState gets a reference to the given ExecutionState and assigns it to the LastKnownState field. +func (o *ServeModelUpdate) SetLastKnownState(v ExecutionState) { + o.LastKnownState = &v +} + +// GetCustomProperties returns the CustomProperties field value if set, zero value otherwise. +func (o *ServeModelUpdate) GetCustomProperties() map[string]MetadataValue { + if o == nil || IsNil(o.CustomProperties) { + var ret map[string]MetadataValue + return ret + } + return *o.CustomProperties +} + +// GetCustomPropertiesOk returns a tuple with the CustomProperties field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServeModelUpdate) GetCustomPropertiesOk() (*map[string]MetadataValue, bool) { + if o == nil || IsNil(o.CustomProperties) { + return nil, false + } + return o.CustomProperties, true +} + +// HasCustomProperties returns a boolean if a field has been set. +func (o *ServeModelUpdate) HasCustomProperties() bool { + if o != nil && !IsNil(o.CustomProperties) { + return true + } + + return false +} + +// SetCustomProperties gets a reference to the given map[string]MetadataValue and assigns it to the CustomProperties field. +func (o *ServeModelUpdate) SetCustomProperties(v map[string]MetadataValue) { + o.CustomProperties = &v +} + +// GetExternalID returns the ExternalID field value if set, zero value otherwise. +func (o *ServeModelUpdate) GetExternalID() string { + if o == nil || IsNil(o.ExternalID) { + var ret string + return ret + } + return *o.ExternalID +} + +// GetExternalIDOk returns a tuple with the ExternalID field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServeModelUpdate) GetExternalIDOk() (*string, bool) { + if o == nil || IsNil(o.ExternalID) { + return nil, false + } + return o.ExternalID, true +} + +// HasExternalID returns a boolean if a field has been set. +func (o *ServeModelUpdate) HasExternalID() bool { + if o != nil && !IsNil(o.ExternalID) { + return true + } + + return false +} + +// SetExternalID gets a reference to the given string and assigns it to the ExternalID field. +func (o *ServeModelUpdate) SetExternalID(v string) { + o.ExternalID = &v +} + +func (o ServeModelUpdate) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ServeModelUpdate) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.LastKnownState) { + toSerialize["lastKnownState"] = o.LastKnownState + } + if !IsNil(o.CustomProperties) { + toSerialize["customProperties"] = o.CustomProperties + } + if !IsNil(o.ExternalID) { + toSerialize["externalID"] = o.ExternalID + } + return toSerialize, nil +} + +type NullableServeModelUpdate struct { + value *ServeModelUpdate + isSet bool +} + +func (v NullableServeModelUpdate) Get() *ServeModelUpdate { + return v.value +} + +func (v *NullableServeModelUpdate) Set(val *ServeModelUpdate) { + v.value = val + v.isSet = true +} + +func (v NullableServeModelUpdate) IsSet() bool { + return v.isSet +} + +func (v *NullableServeModelUpdate) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableServeModelUpdate(val *ServeModelUpdate) *NullableServeModelUpdate { + return &NullableServeModelUpdate{value: val, isSet: true} +} + +func (v NullableServeModelUpdate) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableServeModelUpdate) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/model/openapi/model_serving_environment.go b/internal/model/openapi/model_serving_environment.go new file mode 100644 index 000000000..d842345d3 --- /dev/null +++ b/internal/model/openapi/model_serving_environment.go @@ -0,0 +1,310 @@ +/* +Model Registry REST API + +REST API for Model Registry to create and manage ML model metadata + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the ServingEnvironment type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ServingEnvironment{} + +// ServingEnvironment A Model Serving environment for serving `RegisteredModels`. +type ServingEnvironment struct { + // User provided custom properties which are not defined by its type. + CustomProperties *map[string]MetadataValue `json:"customProperties,omitempty"` + // The external id that come from the clients’ system. This field is optional. If set, it must be unique among all resources within a database instance. + ExternalID *string `json:"externalID,omitempty"` + // The client provided name of the artifact. This field is optional. If set, it must be unique among all the artifacts of the same artifact type within a database instance and cannot be changed once set. + Name *string `json:"name,omitempty"` + // Output only. The unique server generated id of the resource. + Id *string `json:"id,omitempty"` + // Output only. Create time of the resource in millisecond since epoch. + CreateTimeSinceEpoch *string `json:"createTimeSinceEpoch,omitempty"` + // Output only. Last update time of the resource since epoch in millisecond since epoch. + LastUpdateTimeSinceEpoch *string `json:"lastUpdateTimeSinceEpoch,omitempty"` +} + +// NewServingEnvironment instantiates a new ServingEnvironment object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewServingEnvironment() *ServingEnvironment { + this := ServingEnvironment{} + return &this +} + +// NewServingEnvironmentWithDefaults instantiates a new ServingEnvironment object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewServingEnvironmentWithDefaults() *ServingEnvironment { + this := ServingEnvironment{} + return &this +} + +// GetCustomProperties returns the CustomProperties field value if set, zero value otherwise. +func (o *ServingEnvironment) GetCustomProperties() map[string]MetadataValue { + if o == nil || IsNil(o.CustomProperties) { + var ret map[string]MetadataValue + return ret + } + return *o.CustomProperties +} + +// GetCustomPropertiesOk returns a tuple with the CustomProperties field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServingEnvironment) GetCustomPropertiesOk() (*map[string]MetadataValue, bool) { + if o == nil || IsNil(o.CustomProperties) { + return nil, false + } + return o.CustomProperties, true +} + +// HasCustomProperties returns a boolean if a field has been set. +func (o *ServingEnvironment) HasCustomProperties() bool { + if o != nil && !IsNil(o.CustomProperties) { + return true + } + + return false +} + +// SetCustomProperties gets a reference to the given map[string]MetadataValue and assigns it to the CustomProperties field. +func (o *ServingEnvironment) SetCustomProperties(v map[string]MetadataValue) { + o.CustomProperties = &v +} + +// GetExternalID returns the ExternalID field value if set, zero value otherwise. +func (o *ServingEnvironment) GetExternalID() string { + if o == nil || IsNil(o.ExternalID) { + var ret string + return ret + } + return *o.ExternalID +} + +// GetExternalIDOk returns a tuple with the ExternalID field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServingEnvironment) GetExternalIDOk() (*string, bool) { + if o == nil || IsNil(o.ExternalID) { + return nil, false + } + return o.ExternalID, true +} + +// HasExternalID returns a boolean if a field has been set. +func (o *ServingEnvironment) HasExternalID() bool { + if o != nil && !IsNil(o.ExternalID) { + return true + } + + return false +} + +// SetExternalID gets a reference to the given string and assigns it to the ExternalID field. +func (o *ServingEnvironment) SetExternalID(v string) { + o.ExternalID = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *ServingEnvironment) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServingEnvironment) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *ServingEnvironment) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *ServingEnvironment) SetName(v string) { + o.Name = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *ServingEnvironment) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServingEnvironment) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *ServingEnvironment) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *ServingEnvironment) SetId(v string) { + o.Id = &v +} + +// GetCreateTimeSinceEpoch returns the CreateTimeSinceEpoch field value if set, zero value otherwise. +func (o *ServingEnvironment) GetCreateTimeSinceEpoch() string { + if o == nil || IsNil(o.CreateTimeSinceEpoch) { + var ret string + return ret + } + return *o.CreateTimeSinceEpoch +} + +// GetCreateTimeSinceEpochOk returns a tuple with the CreateTimeSinceEpoch field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServingEnvironment) GetCreateTimeSinceEpochOk() (*string, bool) { + if o == nil || IsNil(o.CreateTimeSinceEpoch) { + return nil, false + } + return o.CreateTimeSinceEpoch, true +} + +// HasCreateTimeSinceEpoch returns a boolean if a field has been set. +func (o *ServingEnvironment) HasCreateTimeSinceEpoch() bool { + if o != nil && !IsNil(o.CreateTimeSinceEpoch) { + return true + } + + return false +} + +// SetCreateTimeSinceEpoch gets a reference to the given string and assigns it to the CreateTimeSinceEpoch field. +func (o *ServingEnvironment) SetCreateTimeSinceEpoch(v string) { + o.CreateTimeSinceEpoch = &v +} + +// GetLastUpdateTimeSinceEpoch returns the LastUpdateTimeSinceEpoch field value if set, zero value otherwise. +func (o *ServingEnvironment) GetLastUpdateTimeSinceEpoch() string { + if o == nil || IsNil(o.LastUpdateTimeSinceEpoch) { + var ret string + return ret + } + return *o.LastUpdateTimeSinceEpoch +} + +// GetLastUpdateTimeSinceEpochOk returns a tuple with the LastUpdateTimeSinceEpoch field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServingEnvironment) GetLastUpdateTimeSinceEpochOk() (*string, bool) { + if o == nil || IsNil(o.LastUpdateTimeSinceEpoch) { + return nil, false + } + return o.LastUpdateTimeSinceEpoch, true +} + +// HasLastUpdateTimeSinceEpoch returns a boolean if a field has been set. +func (o *ServingEnvironment) HasLastUpdateTimeSinceEpoch() bool { + if o != nil && !IsNil(o.LastUpdateTimeSinceEpoch) { + return true + } + + return false +} + +// SetLastUpdateTimeSinceEpoch gets a reference to the given string and assigns it to the LastUpdateTimeSinceEpoch field. +func (o *ServingEnvironment) SetLastUpdateTimeSinceEpoch(v string) { + o.LastUpdateTimeSinceEpoch = &v +} + +func (o ServingEnvironment) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ServingEnvironment) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CustomProperties) { + toSerialize["customProperties"] = o.CustomProperties + } + if !IsNil(o.ExternalID) { + toSerialize["externalID"] = o.ExternalID + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.CreateTimeSinceEpoch) { + toSerialize["createTimeSinceEpoch"] = o.CreateTimeSinceEpoch + } + if !IsNil(o.LastUpdateTimeSinceEpoch) { + toSerialize["lastUpdateTimeSinceEpoch"] = o.LastUpdateTimeSinceEpoch + } + return toSerialize, nil +} + +type NullableServingEnvironment struct { + value *ServingEnvironment + isSet bool +} + +func (v NullableServingEnvironment) Get() *ServingEnvironment { + return v.value +} + +func (v *NullableServingEnvironment) Set(val *ServingEnvironment) { + v.value = val + v.isSet = true +} + +func (v NullableServingEnvironment) IsSet() bool { + return v.isSet +} + +func (v *NullableServingEnvironment) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableServingEnvironment(val *ServingEnvironment) *NullableServingEnvironment { + return &NullableServingEnvironment{value: val, isSet: true} +} + +func (v NullableServingEnvironment) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableServingEnvironment) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/model/openapi/model_serving_environment_create.go b/internal/model/openapi/model_serving_environment_create.go new file mode 100644 index 000000000..dbd3d5fdd --- /dev/null +++ b/internal/model/openapi/model_serving_environment_create.go @@ -0,0 +1,199 @@ +/* +Model Registry REST API + +REST API for Model Registry to create and manage ML model metadata + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the ServingEnvironmentCreate type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ServingEnvironmentCreate{} + +// ServingEnvironmentCreate A Model Serving environment for serving `RegisteredModels`. +type ServingEnvironmentCreate struct { + // User provided custom properties which are not defined by its type. + CustomProperties *map[string]MetadataValue `json:"customProperties,omitempty"` + // The external id that come from the clients’ system. This field is optional. If set, it must be unique among all resources within a database instance. + ExternalID *string `json:"externalID,omitempty"` + // The client provided name of the artifact. This field is optional. If set, it must be unique among all the artifacts of the same artifact type within a database instance and cannot be changed once set. + Name *string `json:"name,omitempty"` +} + +// NewServingEnvironmentCreate instantiates a new ServingEnvironmentCreate object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewServingEnvironmentCreate() *ServingEnvironmentCreate { + this := ServingEnvironmentCreate{} + return &this +} + +// NewServingEnvironmentCreateWithDefaults instantiates a new ServingEnvironmentCreate object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewServingEnvironmentCreateWithDefaults() *ServingEnvironmentCreate { + this := ServingEnvironmentCreate{} + return &this +} + +// GetCustomProperties returns the CustomProperties field value if set, zero value otherwise. +func (o *ServingEnvironmentCreate) GetCustomProperties() map[string]MetadataValue { + if o == nil || IsNil(o.CustomProperties) { + var ret map[string]MetadataValue + return ret + } + return *o.CustomProperties +} + +// GetCustomPropertiesOk returns a tuple with the CustomProperties field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServingEnvironmentCreate) GetCustomPropertiesOk() (*map[string]MetadataValue, bool) { + if o == nil || IsNil(o.CustomProperties) { + return nil, false + } + return o.CustomProperties, true +} + +// HasCustomProperties returns a boolean if a field has been set. +func (o *ServingEnvironmentCreate) HasCustomProperties() bool { + if o != nil && !IsNil(o.CustomProperties) { + return true + } + + return false +} + +// SetCustomProperties gets a reference to the given map[string]MetadataValue and assigns it to the CustomProperties field. +func (o *ServingEnvironmentCreate) SetCustomProperties(v map[string]MetadataValue) { + o.CustomProperties = &v +} + +// GetExternalID returns the ExternalID field value if set, zero value otherwise. +func (o *ServingEnvironmentCreate) GetExternalID() string { + if o == nil || IsNil(o.ExternalID) { + var ret string + return ret + } + return *o.ExternalID +} + +// GetExternalIDOk returns a tuple with the ExternalID field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServingEnvironmentCreate) GetExternalIDOk() (*string, bool) { + if o == nil || IsNil(o.ExternalID) { + return nil, false + } + return o.ExternalID, true +} + +// HasExternalID returns a boolean if a field has been set. +func (o *ServingEnvironmentCreate) HasExternalID() bool { + if o != nil && !IsNil(o.ExternalID) { + return true + } + + return false +} + +// SetExternalID gets a reference to the given string and assigns it to the ExternalID field. +func (o *ServingEnvironmentCreate) SetExternalID(v string) { + o.ExternalID = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *ServingEnvironmentCreate) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServingEnvironmentCreate) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *ServingEnvironmentCreate) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *ServingEnvironmentCreate) SetName(v string) { + o.Name = &v +} + +func (o ServingEnvironmentCreate) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ServingEnvironmentCreate) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CustomProperties) { + toSerialize["customProperties"] = o.CustomProperties + } + if !IsNil(o.ExternalID) { + toSerialize["externalID"] = o.ExternalID + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + return toSerialize, nil +} + +type NullableServingEnvironmentCreate struct { + value *ServingEnvironmentCreate + isSet bool +} + +func (v NullableServingEnvironmentCreate) Get() *ServingEnvironmentCreate { + return v.value +} + +func (v *NullableServingEnvironmentCreate) Set(val *ServingEnvironmentCreate) { + v.value = val + v.isSet = true +} + +func (v NullableServingEnvironmentCreate) IsSet() bool { + return v.isSet +} + +func (v *NullableServingEnvironmentCreate) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableServingEnvironmentCreate(val *ServingEnvironmentCreate) *NullableServingEnvironmentCreate { + return &NullableServingEnvironmentCreate{value: val, isSet: true} +} + +func (v NullableServingEnvironmentCreate) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableServingEnvironmentCreate) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/model/openapi/model_serving_environment_list.go b/internal/model/openapi/model_serving_environment_list.go new file mode 100644 index 000000000..51c1c44b7 --- /dev/null +++ b/internal/model/openapi/model_serving_environment_list.go @@ -0,0 +1,209 @@ +/* +Model Registry REST API + +REST API for Model Registry to create and manage ML model metadata + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the ServingEnvironmentList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ServingEnvironmentList{} + +// ServingEnvironmentList List of ServingEnvironments. +type ServingEnvironmentList struct { + // Token to use to retrieve next page of results. + NextPageToken string `json:"nextPageToken"` + // Maximum number of resources to return in the result. + PageSize int32 `json:"pageSize"` + // Number of items in result list. + Size int32 `json:"size"` + // + Items []ServingEnvironment `json:"items,omitempty"` +} + +// NewServingEnvironmentList instantiates a new ServingEnvironmentList object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewServingEnvironmentList(nextPageToken string, pageSize int32, size int32) *ServingEnvironmentList { + this := ServingEnvironmentList{} + this.NextPageToken = nextPageToken + this.PageSize = pageSize + this.Size = size + return &this +} + +// NewServingEnvironmentListWithDefaults instantiates a new ServingEnvironmentList object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewServingEnvironmentListWithDefaults() *ServingEnvironmentList { + this := ServingEnvironmentList{} + return &this +} + +// GetNextPageToken returns the NextPageToken field value +func (o *ServingEnvironmentList) GetNextPageToken() string { + if o == nil { + var ret string + return ret + } + + return o.NextPageToken +} + +// GetNextPageTokenOk returns a tuple with the NextPageToken field value +// and a boolean to check if the value has been set. +func (o *ServingEnvironmentList) GetNextPageTokenOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.NextPageToken, true +} + +// SetNextPageToken sets field value +func (o *ServingEnvironmentList) SetNextPageToken(v string) { + o.NextPageToken = v +} + +// GetPageSize returns the PageSize field value +func (o *ServingEnvironmentList) GetPageSize() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.PageSize +} + +// GetPageSizeOk returns a tuple with the PageSize field value +// and a boolean to check if the value has been set. +func (o *ServingEnvironmentList) GetPageSizeOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.PageSize, true +} + +// SetPageSize sets field value +func (o *ServingEnvironmentList) SetPageSize(v int32) { + o.PageSize = v +} + +// GetSize returns the Size field value +func (o *ServingEnvironmentList) GetSize() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Size +} + +// GetSizeOk returns a tuple with the Size field value +// and a boolean to check if the value has been set. +func (o *ServingEnvironmentList) GetSizeOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Size, true +} + +// SetSize sets field value +func (o *ServingEnvironmentList) SetSize(v int32) { + o.Size = v +} + +// GetItems returns the Items field value if set, zero value otherwise. +func (o *ServingEnvironmentList) GetItems() []ServingEnvironment { + if o == nil || IsNil(o.Items) { + var ret []ServingEnvironment + return ret + } + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServingEnvironmentList) GetItemsOk() ([]ServingEnvironment, bool) { + if o == nil || IsNil(o.Items) { + return nil, false + } + return o.Items, true +} + +// HasItems returns a boolean if a field has been set. +func (o *ServingEnvironmentList) HasItems() bool { + if o != nil && !IsNil(o.Items) { + return true + } + + return false +} + +// SetItems gets a reference to the given []ServingEnvironment and assigns it to the Items field. +func (o *ServingEnvironmentList) SetItems(v []ServingEnvironment) { + o.Items = v +} + +func (o ServingEnvironmentList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ServingEnvironmentList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["nextPageToken"] = o.NextPageToken + toSerialize["pageSize"] = o.PageSize + toSerialize["size"] = o.Size + if !IsNil(o.Items) { + toSerialize["items"] = o.Items + } + return toSerialize, nil +} + +type NullableServingEnvironmentList struct { + value *ServingEnvironmentList + isSet bool +} + +func (v NullableServingEnvironmentList) Get() *ServingEnvironmentList { + return v.value +} + +func (v *NullableServingEnvironmentList) Set(val *ServingEnvironmentList) { + v.value = val + v.isSet = true +} + +func (v NullableServingEnvironmentList) IsSet() bool { + return v.isSet +} + +func (v *NullableServingEnvironmentList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableServingEnvironmentList(val *ServingEnvironmentList) *NullableServingEnvironmentList { + return &NullableServingEnvironmentList{value: val, isSet: true} +} + +func (v NullableServingEnvironmentList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableServingEnvironmentList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/model/openapi/model_serving_environment_update.go b/internal/model/openapi/model_serving_environment_update.go new file mode 100644 index 000000000..4e7a52ba6 --- /dev/null +++ b/internal/model/openapi/model_serving_environment_update.go @@ -0,0 +1,162 @@ +/* +Model Registry REST API + +REST API for Model Registry to create and manage ML model metadata + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the ServingEnvironmentUpdate type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ServingEnvironmentUpdate{} + +// ServingEnvironmentUpdate A Model Serving environment for serving `RegisteredModels`. +type ServingEnvironmentUpdate struct { + // User provided custom properties which are not defined by its type. + CustomProperties *map[string]MetadataValue `json:"customProperties,omitempty"` + // The external id that come from the clients’ system. This field is optional. If set, it must be unique among all resources within a database instance. + ExternalID *string `json:"externalID,omitempty"` +} + +// NewServingEnvironmentUpdate instantiates a new ServingEnvironmentUpdate object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewServingEnvironmentUpdate() *ServingEnvironmentUpdate { + this := ServingEnvironmentUpdate{} + return &this +} + +// NewServingEnvironmentUpdateWithDefaults instantiates a new ServingEnvironmentUpdate object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewServingEnvironmentUpdateWithDefaults() *ServingEnvironmentUpdate { + this := ServingEnvironmentUpdate{} + return &this +} + +// GetCustomProperties returns the CustomProperties field value if set, zero value otherwise. +func (o *ServingEnvironmentUpdate) GetCustomProperties() map[string]MetadataValue { + if o == nil || IsNil(o.CustomProperties) { + var ret map[string]MetadataValue + return ret + } + return *o.CustomProperties +} + +// GetCustomPropertiesOk returns a tuple with the CustomProperties field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServingEnvironmentUpdate) GetCustomPropertiesOk() (*map[string]MetadataValue, bool) { + if o == nil || IsNil(o.CustomProperties) { + return nil, false + } + return o.CustomProperties, true +} + +// HasCustomProperties returns a boolean if a field has been set. +func (o *ServingEnvironmentUpdate) HasCustomProperties() bool { + if o != nil && !IsNil(o.CustomProperties) { + return true + } + + return false +} + +// SetCustomProperties gets a reference to the given map[string]MetadataValue and assigns it to the CustomProperties field. +func (o *ServingEnvironmentUpdate) SetCustomProperties(v map[string]MetadataValue) { + o.CustomProperties = &v +} + +// GetExternalID returns the ExternalID field value if set, zero value otherwise. +func (o *ServingEnvironmentUpdate) GetExternalID() string { + if o == nil || IsNil(o.ExternalID) { + var ret string + return ret + } + return *o.ExternalID +} + +// GetExternalIDOk returns a tuple with the ExternalID field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServingEnvironmentUpdate) GetExternalIDOk() (*string, bool) { + if o == nil || IsNil(o.ExternalID) { + return nil, false + } + return o.ExternalID, true +} + +// HasExternalID returns a boolean if a field has been set. +func (o *ServingEnvironmentUpdate) HasExternalID() bool { + if o != nil && !IsNil(o.ExternalID) { + return true + } + + return false +} + +// SetExternalID gets a reference to the given string and assigns it to the ExternalID field. +func (o *ServingEnvironmentUpdate) SetExternalID(v string) { + o.ExternalID = &v +} + +func (o ServingEnvironmentUpdate) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ServingEnvironmentUpdate) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CustomProperties) { + toSerialize["customProperties"] = o.CustomProperties + } + if !IsNil(o.ExternalID) { + toSerialize["externalID"] = o.ExternalID + } + return toSerialize, nil +} + +type NullableServingEnvironmentUpdate struct { + value *ServingEnvironmentUpdate + isSet bool +} + +func (v NullableServingEnvironmentUpdate) Get() *ServingEnvironmentUpdate { + return v.value +} + +func (v *NullableServingEnvironmentUpdate) Set(val *ServingEnvironmentUpdate) { + v.value = val + v.isSet = true +} + +func (v NullableServingEnvironmentUpdate) IsSet() bool { + return v.isSet +} + +func (v *NullableServingEnvironmentUpdate) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableServingEnvironmentUpdate(val *ServingEnvironmentUpdate) *NullableServingEnvironmentUpdate { + return &NullableServingEnvironmentUpdate{value: val, isSet: true} +} + +func (v NullableServingEnvironmentUpdate) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableServingEnvironmentUpdate) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/model/openapi/model_sort_order.go b/internal/model/openapi/model_sort_order.go new file mode 100644 index 000000000..f2cdd0e32 --- /dev/null +++ b/internal/model/openapi/model_sort_order.go @@ -0,0 +1,110 @@ +/* +Model Registry REST API + +REST API for Model Registry to create and manage ML model metadata + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "fmt" +) + +// SortOrder Supported sort direction for ordering result entities. +type SortOrder string + +// List of SortOrder +const ( + SORTORDER_ASC SortOrder = "ASC" + SORTORDER_DESC SortOrder = "DESC" +) + +// All allowed values of SortOrder enum +var AllowedSortOrderEnumValues = []SortOrder{ + "ASC", + "DESC", +} + +func (v *SortOrder) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := SortOrder(value) + for _, existing := range AllowedSortOrderEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid SortOrder", value) +} + +// NewSortOrderFromValue returns a pointer to a valid SortOrder +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewSortOrderFromValue(v string) (*SortOrder, error) { + ev := SortOrder(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for SortOrder: valid values are %v", v, AllowedSortOrderEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v SortOrder) IsValid() bool { + for _, existing := range AllowedSortOrderEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SortOrder value +func (v SortOrder) Ptr() *SortOrder { + return &v +} + +type NullableSortOrder struct { + value *SortOrder + isSet bool +} + +func (v NullableSortOrder) Get() *SortOrder { + return v.value +} + +func (v *NullableSortOrder) Set(val *SortOrder) { + v.value = val + v.isSet = true +} + +func (v NullableSortOrder) IsSet() bool { + return v.isSet +} + +func (v *NullableSortOrder) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSortOrder(val *SortOrder) *NullableSortOrder { + return &NullableSortOrder{value: val, isSet: true} +} + +func (v NullableSortOrder) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSortOrder) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/model/openapi/response.go b/internal/model/openapi/response.go new file mode 100644 index 000000000..7156934b7 --- /dev/null +++ b/internal/model/openapi/response.go @@ -0,0 +1,47 @@ +/* +Model Registry REST API + +REST API for Model Registry to create and manage ML model metadata + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "net/http" +) + +// APIResponse stores the API response returned by the server. +type APIResponse struct { + *http.Response `json:"-"` + Message string `json:"message,omitempty"` + // Operation is the name of the OpenAPI operation. + Operation string `json:"operation,omitempty"` + // RequestURL is the request URL. This value is always available, even if the + // embedded *http.Response is nil. + RequestURL string `json:"url,omitempty"` + // Method is the HTTP method used for the request. This value is always + // available, even if the embedded *http.Response is nil. + Method string `json:"method,omitempty"` + // Payload holds the contents of the response body (which may be nil or empty). + // This is provided here as the raw response.Body() reader will have already + // been drained. + Payload []byte `json:"-"` +} + +// NewAPIResponse returns a new APIResponse object. +func NewAPIResponse(r *http.Response) *APIResponse { + + response := &APIResponse{Response: r} + return response +} + +// NewAPIResponseWithError returns a new APIResponse object with the provided error message. +func NewAPIResponseWithError(errorMessage string) *APIResponse { + + response := &APIResponse{Message: errorMessage} + return response +} diff --git a/internal/model/openapi/utils.go b/internal/model/openapi/utils.go new file mode 100644 index 000000000..98fec2c75 --- /dev/null +++ b/internal/model/openapi/utils.go @@ -0,0 +1,347 @@ +/* +Model Registry REST API + +REST API for Model Registry to create and manage ML model metadata + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" + "reflect" + "time" +) + +// PtrBool is a helper routine that returns a pointer to given boolean value. +func PtrBool(v bool) *bool { return &v } + +// PtrInt is a helper routine that returns a pointer to given integer value. +func PtrInt(v int) *int { return &v } + +// PtrInt32 is a helper routine that returns a pointer to given integer value. +func PtrInt32(v int32) *int32 { return &v } + +// PtrInt64 is a helper routine that returns a pointer to given integer value. +func PtrInt64(v int64) *int64 { return &v } + +// PtrFloat32 is a helper routine that returns a pointer to given float value. +func PtrFloat32(v float32) *float32 { return &v } + +// PtrFloat64 is a helper routine that returns a pointer to given float value. +func PtrFloat64(v float64) *float64 { return &v } + +// PtrString is a helper routine that returns a pointer to given string value. +func PtrString(v string) *string { return &v } + +// PtrTime is helper routine that returns a pointer to given Time value. +func PtrTime(v time.Time) *time.Time { return &v } + +type NullableBool struct { + value *bool + isSet bool +} + +func (v NullableBool) Get() *bool { + return v.value +} + +func (v *NullableBool) Set(val *bool) { + v.value = val + v.isSet = true +} + +func (v NullableBool) IsSet() bool { + return v.isSet +} + +func (v *NullableBool) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBool(val *bool) *NullableBool { + return &NullableBool{value: val, isSet: true} +} + +func (v NullableBool) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBool) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt struct { + value *int + isSet bool +} + +func (v NullableInt) Get() *int { + return v.value +} + +func (v *NullableInt) Set(val *int) { + v.value = val + v.isSet = true +} + +func (v NullableInt) IsSet() bool { + return v.isSet +} + +func (v *NullableInt) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt(val *int) *NullableInt { + return &NullableInt{value: val, isSet: true} +} + +func (v NullableInt) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt32 struct { + value *int32 + isSet bool +} + +func (v NullableInt32) Get() *int32 { + return v.value +} + +func (v *NullableInt32) Set(val *int32) { + v.value = val + v.isSet = true +} + +func (v NullableInt32) IsSet() bool { + return v.isSet +} + +func (v *NullableInt32) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt32(val *int32) *NullableInt32 { + return &NullableInt32{value: val, isSet: true} +} + +func (v NullableInt32) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt32) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt64 struct { + value *int64 + isSet bool +} + +func (v NullableInt64) Get() *int64 { + return v.value +} + +func (v *NullableInt64) Set(val *int64) { + v.value = val + v.isSet = true +} + +func (v NullableInt64) IsSet() bool { + return v.isSet +} + +func (v *NullableInt64) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt64(val *int64) *NullableInt64 { + return &NullableInt64{value: val, isSet: true} +} + +func (v NullableInt64) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt64) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableFloat32 struct { + value *float32 + isSet bool +} + +func (v NullableFloat32) Get() *float32 { + return v.value +} + +func (v *NullableFloat32) Set(val *float32) { + v.value = val + v.isSet = true +} + +func (v NullableFloat32) IsSet() bool { + return v.isSet +} + +func (v *NullableFloat32) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFloat32(val *float32) *NullableFloat32 { + return &NullableFloat32{value: val, isSet: true} +} + +func (v NullableFloat32) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFloat32) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableFloat64 struct { + value *float64 + isSet bool +} + +func (v NullableFloat64) Get() *float64 { + return v.value +} + +func (v *NullableFloat64) Set(val *float64) { + v.value = val + v.isSet = true +} + +func (v NullableFloat64) IsSet() bool { + return v.isSet +} + +func (v *NullableFloat64) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFloat64(val *float64) *NullableFloat64 { + return &NullableFloat64{value: val, isSet: true} +} + +func (v NullableFloat64) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFloat64) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableString struct { + value *string + isSet bool +} + +func (v NullableString) Get() *string { + return v.value +} + +func (v *NullableString) Set(val *string) { + v.value = val + v.isSet = true +} + +func (v NullableString) IsSet() bool { + return v.isSet +} + +func (v *NullableString) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableString(val *string) *NullableString { + return &NullableString{value: val, isSet: true} +} + +func (v NullableString) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableString) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableTime struct { + value *time.Time + isSet bool +} + +func (v NullableTime) Get() *time.Time { + return v.value +} + +func (v *NullableTime) Set(val *time.Time) { + v.value = val + v.isSet = true +} + +func (v NullableTime) IsSet() bool { + return v.isSet +} + +func (v *NullableTime) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTime(val *time.Time) *NullableTime { + return &NullableTime{value: val, isSet: true} +} + +func (v NullableTime) MarshalJSON() ([]byte, error) { + return v.value.MarshalJSON() +} + +func (v *NullableTime) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +// IsNil checks if an input is nil +func IsNil(i interface{}) bool { + if i == nil { + return true + } + switch reflect.TypeOf(i).Kind() { + case reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr, reflect.UnsafePointer, reflect.Interface, reflect.Slice: + return reflect.ValueOf(i).IsNil() + case reflect.Array: + return reflect.ValueOf(i).IsZero() + } + return false +} + +type MappedNullable interface { + ToMap() (map[string]interface{}, error) +} diff --git a/internal/server/openapi/.openapi-generator/FILES b/internal/server/openapi/.openapi-generator/FILES new file mode 100644 index 000000000..b42c7f76b --- /dev/null +++ b/internal/server/openapi/.openapi-generator/FILES @@ -0,0 +1,55 @@ +api.go +api_model_registry_service.go +error.go +helpers.go +impl.go +logger.go +model_artifact.go +model_artifact_list.go +model_artifact_state.go +model_base_artifact.go +model_base_artifact_create.go +model_base_artifact_update.go +model_base_execution.go +model_base_execution_create.go +model_base_execution_update.go +model_base_resource.go +model_base_resource_create.go +model_base_resource_list.go +model_base_resource_update.go +model_error.go +model_execution_state.go +model_inference_service.go +model_inference_service_create.go +model_inference_service_list.go +model_inference_service_update.go +model_metadata_value.go +model_metadata_value_one_of.go +model_metadata_value_one_of_1.go +model_metadata_value_one_of_2.go +model_metadata_value_one_of_3.go +model_metadata_value_one_of_4.go +model_metadata_value_one_of_5.go +model_model_artifact.go +model_model_artifact_create.go +model_model_artifact_list.go +model_model_artifact_update.go +model_model_version.go +model_model_version_create.go +model_model_version_list.go +model_model_version_update.go +model_order_by_field.go +model_registered_model.go +model_registered_model_create.go +model_registered_model_list.go +model_registered_model_update.go +model_serve_model.go +model_serve_model_create.go +model_serve_model_list.go +model_serve_model_update.go +model_serving_environment.go +model_serving_environment_create.go +model_serving_environment_list.go +model_serving_environment_update.go +model_sort_order.go +routers.go diff --git a/internal/server/openapi/.openapi-generator/VERSION b/internal/server/openapi/.openapi-generator/VERSION new file mode 100644 index 000000000..73a86b197 --- /dev/null +++ b/internal/server/openapi/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.0.1 \ No newline at end of file diff --git a/internal/server/openapi/api.go b/internal/server/openapi/api.go new file mode 100644 index 000000000..51c7ad32e --- /dev/null +++ b/internal/server/openapi/api.go @@ -0,0 +1,99 @@ +/* + * Model Registry REST API + * + * REST API for Model Registry to create and manage ML model metadata + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package openapi + +import ( + "context" + model "github.com/opendatahub-io/model-registry/internal/model/openapi" + "net/http" +) + +// ModelRegistryServiceAPIRouter defines the required methods for binding the api requests to a responses for the ModelRegistryServiceAPI +// The ModelRegistryServiceAPIRouter implementation should parse necessary information from the http request, +// pass the data to a ModelRegistryServiceAPIServicer to perform the required actions, then write the service results to the http response. +type ModelRegistryServiceAPIRouter interface { + CreateEnvironmentInferenceService(http.ResponseWriter, *http.Request) + CreateInferenceService(http.ResponseWriter, *http.Request) + CreateInferenceServiceServe(http.ResponseWriter, *http.Request) + CreateModelArtifact(http.ResponseWriter, *http.Request) + CreateModelVersion(http.ResponseWriter, *http.Request) + CreateModelVersionArtifact(http.ResponseWriter, *http.Request) + CreateRegisteredModel(http.ResponseWriter, *http.Request) + CreateRegisteredModelVersion(http.ResponseWriter, *http.Request) + CreateServingEnvironment(http.ResponseWriter, *http.Request) + FindInferenceService(http.ResponseWriter, *http.Request) + FindModelArtifact(http.ResponseWriter, *http.Request) + FindModelVersion(http.ResponseWriter, *http.Request) + FindRegisteredModel(http.ResponseWriter, *http.Request) + FindServingEnvironment(http.ResponseWriter, *http.Request) + GetEnvironmentInferenceServices(http.ResponseWriter, *http.Request) + GetInferenceService(http.ResponseWriter, *http.Request) + GetInferenceServiceModel(http.ResponseWriter, *http.Request) + GetInferenceServiceServes(http.ResponseWriter, *http.Request) + GetInferenceServiceVersion(http.ResponseWriter, *http.Request) + GetInferenceServices(http.ResponseWriter, *http.Request) + GetModelArtifact(http.ResponseWriter, *http.Request) + GetModelArtifacts(http.ResponseWriter, *http.Request) + GetModelVersion(http.ResponseWriter, *http.Request) + GetModelVersionArtifacts(http.ResponseWriter, *http.Request) + GetModelVersions(http.ResponseWriter, *http.Request) + GetRegisteredModel(http.ResponseWriter, *http.Request) + GetRegisteredModelVersions(http.ResponseWriter, *http.Request) + GetRegisteredModels(http.ResponseWriter, *http.Request) + GetServingEnvironment(http.ResponseWriter, *http.Request) + GetServingEnvironments(http.ResponseWriter, *http.Request) + UpdateInferenceService(http.ResponseWriter, *http.Request) + UpdateModelArtifact(http.ResponseWriter, *http.Request) + UpdateModelVersion(http.ResponseWriter, *http.Request) + UpdateRegisteredModel(http.ResponseWriter, *http.Request) + UpdateServingEnvironment(http.ResponseWriter, *http.Request) +} + +// ModelRegistryServiceAPIServicer defines the api actions for the ModelRegistryServiceAPI service +// This interface intended to stay up to date with the openapi yaml used to generate it, +// while the service implementation can be ignored with the .openapi-generator-ignore file +// and updated with the logic required for the API. +type ModelRegistryServiceAPIServicer interface { + CreateEnvironmentInferenceService(context.Context, string, model.InferenceServiceCreate) (ImplResponse, error) + CreateInferenceService(context.Context, model.InferenceServiceCreate) (ImplResponse, error) + CreateInferenceServiceServe(context.Context, string, model.ServeModelCreate) (ImplResponse, error) + CreateModelArtifact(context.Context, model.ModelArtifactCreate) (ImplResponse, error) + CreateModelVersion(context.Context, model.ModelVersionCreate) (ImplResponse, error) + CreateModelVersionArtifact(context.Context, string, model.Artifact) (ImplResponse, error) + CreateRegisteredModel(context.Context, model.RegisteredModelCreate) (ImplResponse, error) + CreateRegisteredModelVersion(context.Context, string, model.ModelVersion) (ImplResponse, error) + CreateServingEnvironment(context.Context, model.ServingEnvironmentCreate) (ImplResponse, error) + FindInferenceService(context.Context, string, string) (ImplResponse, error) + FindModelArtifact(context.Context, string, string) (ImplResponse, error) + FindModelVersion(context.Context, string, string) (ImplResponse, error) + FindRegisteredModel(context.Context, string, string) (ImplResponse, error) + FindServingEnvironment(context.Context, string, string) (ImplResponse, error) + GetEnvironmentInferenceServices(context.Context, string, string, string, string, model.OrderByField, model.SortOrder, string) (ImplResponse, error) + GetInferenceService(context.Context, string) (ImplResponse, error) + GetInferenceServiceModel(context.Context, string) (ImplResponse, error) + GetInferenceServiceServes(context.Context, string, string, string, string, model.OrderByField, model.SortOrder, string) (ImplResponse, error) + GetInferenceServiceVersion(context.Context, string) (ImplResponse, error) + GetInferenceServices(context.Context, string, model.OrderByField, model.SortOrder, string) (ImplResponse, error) + GetModelArtifact(context.Context, string) (ImplResponse, error) + GetModelArtifacts(context.Context, string, model.OrderByField, model.SortOrder, string) (ImplResponse, error) + GetModelVersion(context.Context, string) (ImplResponse, error) + GetModelVersionArtifacts(context.Context, string, string, string, string, model.OrderByField, model.SortOrder, string) (ImplResponse, error) + GetModelVersions(context.Context, string, model.OrderByField, model.SortOrder, string) (ImplResponse, error) + GetRegisteredModel(context.Context, string) (ImplResponse, error) + GetRegisteredModelVersions(context.Context, string, string, string, string, model.OrderByField, model.SortOrder, string) (ImplResponse, error) + GetRegisteredModels(context.Context, string, model.OrderByField, model.SortOrder, string) (ImplResponse, error) + GetServingEnvironment(context.Context, string) (ImplResponse, error) + GetServingEnvironments(context.Context, string, model.OrderByField, model.SortOrder, string) (ImplResponse, error) + UpdateInferenceService(context.Context, string, model.InferenceServiceUpdate) (ImplResponse, error) + UpdateModelArtifact(context.Context, string, model.ModelArtifactUpdate) (ImplResponse, error) + UpdateModelVersion(context.Context, string, model.ModelVersion) (ImplResponse, error) + UpdateRegisteredModel(context.Context, string, model.RegisteredModelUpdate) (ImplResponse, error) + UpdateServingEnvironment(context.Context, string, model.ServingEnvironmentUpdate) (ImplResponse, error) +} diff --git a/internal/server/openapi/api_model_registry_service.go b/internal/server/openapi/api_model_registry_service.go new file mode 100644 index 000000000..1e2239524 --- /dev/null +++ b/internal/server/openapi/api_model_registry_service.go @@ -0,0 +1,948 @@ +/* + * Model Registry REST API + * + * REST API for Model Registry to create and manage ML model metadata + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package openapi + +import ( + "encoding/json" + "net/http" + "strings" + + "github.com/go-chi/chi/v5" + model "github.com/opendatahub-io/model-registry/internal/model/openapi" +) + +// ModelRegistryServiceAPIController binds http requests to an api service and writes the service results to the http response +type ModelRegistryServiceAPIController struct { + service ModelRegistryServiceAPIServicer + errorHandler ErrorHandler +} + +// ModelRegistryServiceAPIOption for how the controller is set up. +type ModelRegistryServiceAPIOption func(*ModelRegistryServiceAPIController) + +// WithModelRegistryServiceAPIErrorHandler inject ErrorHandler into controller +func WithModelRegistryServiceAPIErrorHandler(h ErrorHandler) ModelRegistryServiceAPIOption { + return func(c *ModelRegistryServiceAPIController) { + c.errorHandler = h + } +} + +// NewModelRegistryServiceAPIController creates a default api controller +func NewModelRegistryServiceAPIController(s ModelRegistryServiceAPIServicer, opts ...ModelRegistryServiceAPIOption) Router { + controller := &ModelRegistryServiceAPIController{ + service: s, + errorHandler: DefaultErrorHandler, + } + + for _, opt := range opts { + opt(controller) + } + + return controller +} + +// Routes returns all the api routes for the ModelRegistryServiceAPIController +func (c *ModelRegistryServiceAPIController) Routes() Routes { + return Routes{ + "CreateEnvironmentInferenceService": Route{ + strings.ToUpper("Post"), + "/api/model_registry/v1alpha1/serving_environments/{servingenvironmentId}/inference_services", + c.CreateEnvironmentInferenceService, + }, + "CreateInferenceService": Route{ + strings.ToUpper("Post"), + "/api/model_registry/v1alpha1/inference_services", + c.CreateInferenceService, + }, + "CreateInferenceServiceServe": Route{ + strings.ToUpper("Post"), + "/api/model_registry/v1alpha1/inference_services/{inferenceserviceId}/serves", + c.CreateInferenceServiceServe, + }, + "CreateModelArtifact": Route{ + strings.ToUpper("Post"), + "/api/model_registry/v1alpha1/model_artifacts", + c.CreateModelArtifact, + }, + "CreateModelVersion": Route{ + strings.ToUpper("Post"), + "/api/model_registry/v1alpha1/model_versions", + c.CreateModelVersion, + }, + "CreateModelVersionArtifact": Route{ + strings.ToUpper("Post"), + "/api/model_registry/v1alpha1/model_versions/{modelversionId}/artifacts", + c.CreateModelVersionArtifact, + }, + "CreateRegisteredModel": Route{ + strings.ToUpper("Post"), + "/api/model_registry/v1alpha1/registered_models", + c.CreateRegisteredModel, + }, + "CreateRegisteredModelVersion": Route{ + strings.ToUpper("Post"), + "/api/model_registry/v1alpha1/registered_models/{registeredmodelId}/versions", + c.CreateRegisteredModelVersion, + }, + "CreateServingEnvironment": Route{ + strings.ToUpper("Post"), + "/api/model_registry/v1alpha1/serving_environments", + c.CreateServingEnvironment, + }, + "FindInferenceService": Route{ + strings.ToUpper("Get"), + "/api/model_registry/v1alpha1/inference_service", + c.FindInferenceService, + }, + "FindModelArtifact": Route{ + strings.ToUpper("Get"), + "/api/model_registry/v1alpha1/model_artifact", + c.FindModelArtifact, + }, + "FindModelVersion": Route{ + strings.ToUpper("Get"), + "/api/model_registry/v1alpha1/model_version", + c.FindModelVersion, + }, + "FindRegisteredModel": Route{ + strings.ToUpper("Get"), + "/api/model_registry/v1alpha1/registered_model", + c.FindRegisteredModel, + }, + "FindServingEnvironment": Route{ + strings.ToUpper("Get"), + "/api/model_registry/v1alpha1/serving_environment", + c.FindServingEnvironment, + }, + "GetEnvironmentInferenceServices": Route{ + strings.ToUpper("Get"), + "/api/model_registry/v1alpha1/serving_environments/{servingenvironmentId}/inference_services", + c.GetEnvironmentInferenceServices, + }, + "GetInferenceService": Route{ + strings.ToUpper("Get"), + "/api/model_registry/v1alpha1/inference_services/{inferenceserviceId}", + c.GetInferenceService, + }, + "GetInferenceServiceModel": Route{ + strings.ToUpper("Get"), + "/api/model_registry/v1alpha1/inference_services/{inferenceserviceId}/model", + c.GetInferenceServiceModel, + }, + "GetInferenceServiceServes": Route{ + strings.ToUpper("Get"), + "/api/model_registry/v1alpha1/inference_services/{inferenceserviceId}/serves", + c.GetInferenceServiceServes, + }, + "GetInferenceServiceVersion": Route{ + strings.ToUpper("Get"), + "/api/model_registry/v1alpha1/inference_services/{inferenceserviceId}/version", + c.GetInferenceServiceVersion, + }, + "GetInferenceServices": Route{ + strings.ToUpper("Get"), + "/api/model_registry/v1alpha1/inference_services", + c.GetInferenceServices, + }, + "GetModelArtifact": Route{ + strings.ToUpper("Get"), + "/api/model_registry/v1alpha1/model_artifacts/{modelartifactId}", + c.GetModelArtifact, + }, + "GetModelArtifacts": Route{ + strings.ToUpper("Get"), + "/api/model_registry/v1alpha1/model_artifacts", + c.GetModelArtifacts, + }, + "GetModelVersion": Route{ + strings.ToUpper("Get"), + "/api/model_registry/v1alpha1/model_versions/{modelversionId}", + c.GetModelVersion, + }, + "GetModelVersionArtifacts": Route{ + strings.ToUpper("Get"), + "/api/model_registry/v1alpha1/model_versions/{modelversionId}/artifacts", + c.GetModelVersionArtifacts, + }, + "GetModelVersions": Route{ + strings.ToUpper("Get"), + "/api/model_registry/v1alpha1/model_versions", + c.GetModelVersions, + }, + "GetRegisteredModel": Route{ + strings.ToUpper("Get"), + "/api/model_registry/v1alpha1/registered_models/{registeredmodelId}", + c.GetRegisteredModel, + }, + "GetRegisteredModelVersions": Route{ + strings.ToUpper("Get"), + "/api/model_registry/v1alpha1/registered_models/{registeredmodelId}/versions", + c.GetRegisteredModelVersions, + }, + "GetRegisteredModels": Route{ + strings.ToUpper("Get"), + "/api/model_registry/v1alpha1/registered_models", + c.GetRegisteredModels, + }, + "GetServingEnvironment": Route{ + strings.ToUpper("Get"), + "/api/model_registry/v1alpha1/serving_environments/{servingenvironmentId}", + c.GetServingEnvironment, + }, + "GetServingEnvironments": Route{ + strings.ToUpper("Get"), + "/api/model_registry/v1alpha1/serving_environments", + c.GetServingEnvironments, + }, + "UpdateInferenceService": Route{ + strings.ToUpper("Patch"), + "/api/model_registry/v1alpha1/inference_services/{inferenceserviceId}", + c.UpdateInferenceService, + }, + "UpdateModelArtifact": Route{ + strings.ToUpper("Patch"), + "/api/model_registry/v1alpha1/model_artifacts/{modelartifactId}", + c.UpdateModelArtifact, + }, + "UpdateModelVersion": Route{ + strings.ToUpper("Patch"), + "/api/model_registry/v1alpha1/model_versions/{modelversionId}", + c.UpdateModelVersion, + }, + "UpdateRegisteredModel": Route{ + strings.ToUpper("Patch"), + "/api/model_registry/v1alpha1/registered_models/{registeredmodelId}", + c.UpdateRegisteredModel, + }, + "UpdateServingEnvironment": Route{ + strings.ToUpper("Patch"), + "/api/model_registry/v1alpha1/serving_environments/{servingenvironmentId}", + c.UpdateServingEnvironment, + }, + } +} + +// CreateEnvironmentInferenceService - Create a InferenceService in ServingEnvironment +func (c *ModelRegistryServiceAPIController) CreateEnvironmentInferenceService(w http.ResponseWriter, r *http.Request) { + servingenvironmentIdParam := chi.URLParam(r, "servingenvironmentId") + inferenceServiceCreateParam := model.InferenceServiceCreate{} + d := json.NewDecoder(r.Body) + d.DisallowUnknownFields() + if err := d.Decode(&inferenceServiceCreateParam); err != nil { + c.errorHandler(w, r, &ParsingError{Err: err}, nil) + return + } + if err := AssertInferenceServiceCreateRequired(inferenceServiceCreateParam); err != nil { + c.errorHandler(w, r, err, nil) + return + } + if err := AssertInferenceServiceCreateConstraints(inferenceServiceCreateParam); err != nil { + c.errorHandler(w, r, err, nil) + return + } + result, err := c.service.CreateEnvironmentInferenceService(r.Context(), servingenvironmentIdParam, inferenceServiceCreateParam) + // If an error occurred, encode the error with the status code + if err != nil { + c.errorHandler(w, r, err, &result) + return + } + // If no error, encode the body and the result code + EncodeJSONResponse(result.Body, &result.Code, w) +} + +// CreateInferenceService - Create a InferenceService +func (c *ModelRegistryServiceAPIController) CreateInferenceService(w http.ResponseWriter, r *http.Request) { + inferenceServiceCreateParam := model.InferenceServiceCreate{} + d := json.NewDecoder(r.Body) + d.DisallowUnknownFields() + if err := d.Decode(&inferenceServiceCreateParam); err != nil { + c.errorHandler(w, r, &ParsingError{Err: err}, nil) + return + } + if err := AssertInferenceServiceCreateRequired(inferenceServiceCreateParam); err != nil { + c.errorHandler(w, r, err, nil) + return + } + if err := AssertInferenceServiceCreateConstraints(inferenceServiceCreateParam); err != nil { + c.errorHandler(w, r, err, nil) + return + } + result, err := c.service.CreateInferenceService(r.Context(), inferenceServiceCreateParam) + // If an error occurred, encode the error with the status code + if err != nil { + c.errorHandler(w, r, err, &result) + return + } + // If no error, encode the body and the result code + EncodeJSONResponse(result.Body, &result.Code, w) +} + +// CreateInferenceServiceServe - Create a ServeModel action in a InferenceService +func (c *ModelRegistryServiceAPIController) CreateInferenceServiceServe(w http.ResponseWriter, r *http.Request) { + inferenceserviceIdParam := chi.URLParam(r, "inferenceserviceId") + serveModelCreateParam := model.ServeModelCreate{} + d := json.NewDecoder(r.Body) + d.DisallowUnknownFields() + if err := d.Decode(&serveModelCreateParam); err != nil { + c.errorHandler(w, r, &ParsingError{Err: err}, nil) + return + } + if err := AssertServeModelCreateRequired(serveModelCreateParam); err != nil { + c.errorHandler(w, r, err, nil) + return + } + if err := AssertServeModelCreateConstraints(serveModelCreateParam); err != nil { + c.errorHandler(w, r, err, nil) + return + } + result, err := c.service.CreateInferenceServiceServe(r.Context(), inferenceserviceIdParam, serveModelCreateParam) + // If an error occurred, encode the error with the status code + if err != nil { + c.errorHandler(w, r, err, &result) + return + } + // If no error, encode the body and the result code + EncodeJSONResponse(result.Body, &result.Code, w) +} + +// CreateModelArtifact - Create a ModelArtifact +func (c *ModelRegistryServiceAPIController) CreateModelArtifact(w http.ResponseWriter, r *http.Request) { + modelArtifactCreateParam := model.ModelArtifactCreate{} + d := json.NewDecoder(r.Body) + d.DisallowUnknownFields() + if err := d.Decode(&modelArtifactCreateParam); err != nil { + c.errorHandler(w, r, &ParsingError{Err: err}, nil) + return + } + if err := AssertModelArtifactCreateRequired(modelArtifactCreateParam); err != nil { + c.errorHandler(w, r, err, nil) + return + } + if err := AssertModelArtifactCreateConstraints(modelArtifactCreateParam); err != nil { + c.errorHandler(w, r, err, nil) + return + } + result, err := c.service.CreateModelArtifact(r.Context(), modelArtifactCreateParam) + // If an error occurred, encode the error with the status code + if err != nil { + c.errorHandler(w, r, err, &result) + return + } + // If no error, encode the body and the result code + EncodeJSONResponse(result.Body, &result.Code, w) +} + +// CreateModelVersion - Create a ModelVersion +func (c *ModelRegistryServiceAPIController) CreateModelVersion(w http.ResponseWriter, r *http.Request) { + modelVersionCreateParam := model.ModelVersionCreate{} + d := json.NewDecoder(r.Body) + d.DisallowUnknownFields() + if err := d.Decode(&modelVersionCreateParam); err != nil { + c.errorHandler(w, r, &ParsingError{Err: err}, nil) + return + } + if err := AssertModelVersionCreateRequired(modelVersionCreateParam); err != nil { + c.errorHandler(w, r, err, nil) + return + } + if err := AssertModelVersionCreateConstraints(modelVersionCreateParam); err != nil { + c.errorHandler(w, r, err, nil) + return + } + result, err := c.service.CreateModelVersion(r.Context(), modelVersionCreateParam) + // If an error occurred, encode the error with the status code + if err != nil { + c.errorHandler(w, r, err, &result) + return + } + // If no error, encode the body and the result code + EncodeJSONResponse(result.Body, &result.Code, w) +} + +// CreateModelVersionArtifact - Create an Artifact in a ModelVersion +func (c *ModelRegistryServiceAPIController) CreateModelVersionArtifact(w http.ResponseWriter, r *http.Request) { + modelversionIdParam := chi.URLParam(r, "modelversionId") + artifactParam := model.Artifact{} + d := json.NewDecoder(r.Body) + d.DisallowUnknownFields() + if err := d.Decode(&artifactParam); err != nil { + c.errorHandler(w, r, &ParsingError{Err: err}, nil) + return + } + if err := AssertArtifactRequired(artifactParam); err != nil { + c.errorHandler(w, r, err, nil) + return + } + if err := AssertArtifactConstraints(artifactParam); err != nil { + c.errorHandler(w, r, err, nil) + return + } + result, err := c.service.CreateModelVersionArtifact(r.Context(), modelversionIdParam, artifactParam) + // If an error occurred, encode the error with the status code + if err != nil { + c.errorHandler(w, r, err, &result) + return + } + // If no error, encode the body and the result code + EncodeJSONResponse(result.Body, &result.Code, w) +} + +// CreateRegisteredModel - Create a RegisteredModel +func (c *ModelRegistryServiceAPIController) CreateRegisteredModel(w http.ResponseWriter, r *http.Request) { + registeredModelCreateParam := model.RegisteredModelCreate{} + d := json.NewDecoder(r.Body) + d.DisallowUnknownFields() + if err := d.Decode(®isteredModelCreateParam); err != nil { + c.errorHandler(w, r, &ParsingError{Err: err}, nil) + return + } + if err := AssertRegisteredModelCreateRequired(registeredModelCreateParam); err != nil { + c.errorHandler(w, r, err, nil) + return + } + if err := AssertRegisteredModelCreateConstraints(registeredModelCreateParam); err != nil { + c.errorHandler(w, r, err, nil) + return + } + result, err := c.service.CreateRegisteredModel(r.Context(), registeredModelCreateParam) + // If an error occurred, encode the error with the status code + if err != nil { + c.errorHandler(w, r, err, &result) + return + } + // If no error, encode the body and the result code + EncodeJSONResponse(result.Body, &result.Code, w) +} + +// CreateRegisteredModelVersion - Create a ModelVersion in RegisteredModel +func (c *ModelRegistryServiceAPIController) CreateRegisteredModelVersion(w http.ResponseWriter, r *http.Request) { + registeredmodelIdParam := chi.URLParam(r, "registeredmodelId") + modelVersionParam := model.ModelVersion{} + d := json.NewDecoder(r.Body) + d.DisallowUnknownFields() + if err := d.Decode(&modelVersionParam); err != nil { + c.errorHandler(w, r, &ParsingError{Err: err}, nil) + return + } + if err := AssertModelVersionRequired(modelVersionParam); err != nil { + c.errorHandler(w, r, err, nil) + return + } + if err := AssertModelVersionConstraints(modelVersionParam); err != nil { + c.errorHandler(w, r, err, nil) + return + } + result, err := c.service.CreateRegisteredModelVersion(r.Context(), registeredmodelIdParam, modelVersionParam) + // If an error occurred, encode the error with the status code + if err != nil { + c.errorHandler(w, r, err, &result) + return + } + // If no error, encode the body and the result code + EncodeJSONResponse(result.Body, &result.Code, w) +} + +// CreateServingEnvironment - Create a ServingEnvironment +func (c *ModelRegistryServiceAPIController) CreateServingEnvironment(w http.ResponseWriter, r *http.Request) { + servingEnvironmentCreateParam := model.ServingEnvironmentCreate{} + d := json.NewDecoder(r.Body) + d.DisallowUnknownFields() + if err := d.Decode(&servingEnvironmentCreateParam); err != nil { + c.errorHandler(w, r, &ParsingError{Err: err}, nil) + return + } + if err := AssertServingEnvironmentCreateRequired(servingEnvironmentCreateParam); err != nil { + c.errorHandler(w, r, err, nil) + return + } + if err := AssertServingEnvironmentCreateConstraints(servingEnvironmentCreateParam); err != nil { + c.errorHandler(w, r, err, nil) + return + } + result, err := c.service.CreateServingEnvironment(r.Context(), servingEnvironmentCreateParam) + // If an error occurred, encode the error with the status code + if err != nil { + c.errorHandler(w, r, err, &result) + return + } + // If no error, encode the body and the result code + EncodeJSONResponse(result.Body, &result.Code, w) +} + +// FindInferenceService - Get an InferenceServices that matches search parameters. +func (c *ModelRegistryServiceAPIController) FindInferenceService(w http.ResponseWriter, r *http.Request) { + query := r.URL.Query() + nameParam := query.Get("name") + externalIDParam := query.Get("externalID") + result, err := c.service.FindInferenceService(r.Context(), nameParam, externalIDParam) + // If an error occurred, encode the error with the status code + if err != nil { + c.errorHandler(w, r, err, &result) + return + } + // If no error, encode the body and the result code + EncodeJSONResponse(result.Body, &result.Code, w) +} + +// FindModelArtifact - Get a ModelArtifact that matches search parameters. +func (c *ModelRegistryServiceAPIController) FindModelArtifact(w http.ResponseWriter, r *http.Request) { + query := r.URL.Query() + nameParam := query.Get("name") + externalIDParam := query.Get("externalID") + result, err := c.service.FindModelArtifact(r.Context(), nameParam, externalIDParam) + // If an error occurred, encode the error with the status code + if err != nil { + c.errorHandler(w, r, err, &result) + return + } + // If no error, encode the body and the result code + EncodeJSONResponse(result.Body, &result.Code, w) +} + +// FindModelVersion - Get a ModelVersion that matches search parameters. +func (c *ModelRegistryServiceAPIController) FindModelVersion(w http.ResponseWriter, r *http.Request) { + query := r.URL.Query() + nameParam := query.Get("name") + externalIDParam := query.Get("externalID") + result, err := c.service.FindModelVersion(r.Context(), nameParam, externalIDParam) + // If an error occurred, encode the error with the status code + if err != nil { + c.errorHandler(w, r, err, &result) + return + } + // If no error, encode the body and the result code + EncodeJSONResponse(result.Body, &result.Code, w) +} + +// FindRegisteredModel - Get a RegisteredModel that matches search parameters. +func (c *ModelRegistryServiceAPIController) FindRegisteredModel(w http.ResponseWriter, r *http.Request) { + query := r.URL.Query() + nameParam := query.Get("name") + externalIDParam := query.Get("externalID") + result, err := c.service.FindRegisteredModel(r.Context(), nameParam, externalIDParam) + // If an error occurred, encode the error with the status code + if err != nil { + c.errorHandler(w, r, err, &result) + return + } + // If no error, encode the body and the result code + EncodeJSONResponse(result.Body, &result.Code, w) +} + +// FindServingEnvironment - Find ServingEnvironment +func (c *ModelRegistryServiceAPIController) FindServingEnvironment(w http.ResponseWriter, r *http.Request) { + query := r.URL.Query() + nameParam := query.Get("name") + externalIDParam := query.Get("externalID") + result, err := c.service.FindServingEnvironment(r.Context(), nameParam, externalIDParam) + // If an error occurred, encode the error with the status code + if err != nil { + c.errorHandler(w, r, err, &result) + return + } + // If no error, encode the body and the result code + EncodeJSONResponse(result.Body, &result.Code, w) +} + +// GetEnvironmentInferenceServices - List All ServingEnvironment's InferenceServices +func (c *ModelRegistryServiceAPIController) GetEnvironmentInferenceServices(w http.ResponseWriter, r *http.Request) { + query := r.URL.Query() + servingenvironmentIdParam := chi.URLParam(r, "servingenvironmentId") + nameParam := query.Get("name") + externalIDParam := query.Get("externalID") + pageSizeParam := query.Get("pageSize") + orderByParam := query.Get("orderBy") + sortOrderParam := query.Get("sortOrder") + nextPageTokenParam := query.Get("nextPageToken") + result, err := c.service.GetEnvironmentInferenceServices(r.Context(), servingenvironmentIdParam, nameParam, externalIDParam, pageSizeParam, model.OrderByField(orderByParam), model.SortOrder(sortOrderParam), nextPageTokenParam) + // If an error occurred, encode the error with the status code + if err != nil { + c.errorHandler(w, r, err, &result) + return + } + // If no error, encode the body and the result code + EncodeJSONResponse(result.Body, &result.Code, w) +} + +// GetInferenceService - Get a InferenceService +func (c *ModelRegistryServiceAPIController) GetInferenceService(w http.ResponseWriter, r *http.Request) { + inferenceserviceIdParam := chi.URLParam(r, "inferenceserviceId") + result, err := c.service.GetInferenceService(r.Context(), inferenceserviceIdParam) + // If an error occurred, encode the error with the status code + if err != nil { + c.errorHandler(w, r, err, &result) + return + } + // If no error, encode the body and the result code + EncodeJSONResponse(result.Body, &result.Code, w) +} + +// GetInferenceServiceModel - Get InferenceService's RegisteredModel +func (c *ModelRegistryServiceAPIController) GetInferenceServiceModel(w http.ResponseWriter, r *http.Request) { + inferenceserviceIdParam := chi.URLParam(r, "inferenceserviceId") + result, err := c.service.GetInferenceServiceModel(r.Context(), inferenceserviceIdParam) + // If an error occurred, encode the error with the status code + if err != nil { + c.errorHandler(w, r, err, &result) + return + } + // If no error, encode the body and the result code + EncodeJSONResponse(result.Body, &result.Code, w) +} + +// GetInferenceServiceServes - List All InferenceService's ServeModel actions +func (c *ModelRegistryServiceAPIController) GetInferenceServiceServes(w http.ResponseWriter, r *http.Request) { + query := r.URL.Query() + inferenceserviceIdParam := chi.URLParam(r, "inferenceserviceId") + nameParam := query.Get("name") + externalIDParam := query.Get("externalID") + pageSizeParam := query.Get("pageSize") + orderByParam := query.Get("orderBy") + sortOrderParam := query.Get("sortOrder") + nextPageTokenParam := query.Get("nextPageToken") + result, err := c.service.GetInferenceServiceServes(r.Context(), inferenceserviceIdParam, nameParam, externalIDParam, pageSizeParam, model.OrderByField(orderByParam), model.SortOrder(sortOrderParam), nextPageTokenParam) + // If an error occurred, encode the error with the status code + if err != nil { + c.errorHandler(w, r, err, &result) + return + } + // If no error, encode the body and the result code + EncodeJSONResponse(result.Body, &result.Code, w) +} + +// GetInferenceServiceVersion - Get InferenceService's ModelVersion +func (c *ModelRegistryServiceAPIController) GetInferenceServiceVersion(w http.ResponseWriter, r *http.Request) { + inferenceserviceIdParam := chi.URLParam(r, "inferenceserviceId") + result, err := c.service.GetInferenceServiceVersion(r.Context(), inferenceserviceIdParam) + // If an error occurred, encode the error with the status code + if err != nil { + c.errorHandler(w, r, err, &result) + return + } + // If no error, encode the body and the result code + EncodeJSONResponse(result.Body, &result.Code, w) +} + +// GetInferenceServices - List All InferenceServices +func (c *ModelRegistryServiceAPIController) GetInferenceServices(w http.ResponseWriter, r *http.Request) { + query := r.URL.Query() + pageSizeParam := query.Get("pageSize") + orderByParam := query.Get("orderBy") + sortOrderParam := query.Get("sortOrder") + nextPageTokenParam := query.Get("nextPageToken") + result, err := c.service.GetInferenceServices(r.Context(), pageSizeParam, model.OrderByField(orderByParam), model.SortOrder(sortOrderParam), nextPageTokenParam) + // If an error occurred, encode the error with the status code + if err != nil { + c.errorHandler(w, r, err, &result) + return + } + // If no error, encode the body and the result code + EncodeJSONResponse(result.Body, &result.Code, w) +} + +// GetModelArtifact - Get a ModelArtifact +func (c *ModelRegistryServiceAPIController) GetModelArtifact(w http.ResponseWriter, r *http.Request) { + modelartifactIdParam := chi.URLParam(r, "modelartifactId") + result, err := c.service.GetModelArtifact(r.Context(), modelartifactIdParam) + // If an error occurred, encode the error with the status code + if err != nil { + c.errorHandler(w, r, err, &result) + return + } + // If no error, encode the body and the result code + EncodeJSONResponse(result.Body, &result.Code, w) +} + +// GetModelArtifacts - List All ModelArtifacts +func (c *ModelRegistryServiceAPIController) GetModelArtifacts(w http.ResponseWriter, r *http.Request) { + query := r.URL.Query() + pageSizeParam := query.Get("pageSize") + orderByParam := query.Get("orderBy") + sortOrderParam := query.Get("sortOrder") + nextPageTokenParam := query.Get("nextPageToken") + result, err := c.service.GetModelArtifacts(r.Context(), pageSizeParam, model.OrderByField(orderByParam), model.SortOrder(sortOrderParam), nextPageTokenParam) + // If an error occurred, encode the error with the status code + if err != nil { + c.errorHandler(w, r, err, &result) + return + } + // If no error, encode the body and the result code + EncodeJSONResponse(result.Body, &result.Code, w) +} + +// GetModelVersion - Get a ModelVersion +func (c *ModelRegistryServiceAPIController) GetModelVersion(w http.ResponseWriter, r *http.Request) { + modelversionIdParam := chi.URLParam(r, "modelversionId") + result, err := c.service.GetModelVersion(r.Context(), modelversionIdParam) + // If an error occurred, encode the error with the status code + if err != nil { + c.errorHandler(w, r, err, &result) + return + } + // If no error, encode the body and the result code + EncodeJSONResponse(result.Body, &result.Code, w) +} + +// GetModelVersionArtifacts - List All ModelVersion's artifacts +func (c *ModelRegistryServiceAPIController) GetModelVersionArtifacts(w http.ResponseWriter, r *http.Request) { + query := r.URL.Query() + modelversionIdParam := chi.URLParam(r, "modelversionId") + nameParam := query.Get("name") + externalIDParam := query.Get("externalID") + pageSizeParam := query.Get("pageSize") + orderByParam := query.Get("orderBy") + sortOrderParam := query.Get("sortOrder") + nextPageTokenParam := query.Get("nextPageToken") + result, err := c.service.GetModelVersionArtifacts(r.Context(), modelversionIdParam, nameParam, externalIDParam, pageSizeParam, model.OrderByField(orderByParam), model.SortOrder(sortOrderParam), nextPageTokenParam) + // If an error occurred, encode the error with the status code + if err != nil { + c.errorHandler(w, r, err, &result) + return + } + // If no error, encode the body and the result code + EncodeJSONResponse(result.Body, &result.Code, w) +} + +// GetModelVersions - List All ModelVersions +func (c *ModelRegistryServiceAPIController) GetModelVersions(w http.ResponseWriter, r *http.Request) { + query := r.URL.Query() + pageSizeParam := query.Get("pageSize") + orderByParam := query.Get("orderBy") + sortOrderParam := query.Get("sortOrder") + nextPageTokenParam := query.Get("nextPageToken") + result, err := c.service.GetModelVersions(r.Context(), pageSizeParam, model.OrderByField(orderByParam), model.SortOrder(sortOrderParam), nextPageTokenParam) + // If an error occurred, encode the error with the status code + if err != nil { + c.errorHandler(w, r, err, &result) + return + } + // If no error, encode the body and the result code + EncodeJSONResponse(result.Body, &result.Code, w) +} + +// GetRegisteredModel - Get a RegisteredModel +func (c *ModelRegistryServiceAPIController) GetRegisteredModel(w http.ResponseWriter, r *http.Request) { + registeredmodelIdParam := chi.URLParam(r, "registeredmodelId") + result, err := c.service.GetRegisteredModel(r.Context(), registeredmodelIdParam) + // If an error occurred, encode the error with the status code + if err != nil { + c.errorHandler(w, r, err, &result) + return + } + // If no error, encode the body and the result code + EncodeJSONResponse(result.Body, &result.Code, w) +} + +// GetRegisteredModelVersions - List All RegisteredModel's ModelVersions +func (c *ModelRegistryServiceAPIController) GetRegisteredModelVersions(w http.ResponseWriter, r *http.Request) { + query := r.URL.Query() + registeredmodelIdParam := chi.URLParam(r, "registeredmodelId") + nameParam := query.Get("name") + externalIDParam := query.Get("externalID") + pageSizeParam := query.Get("pageSize") + orderByParam := query.Get("orderBy") + sortOrderParam := query.Get("sortOrder") + nextPageTokenParam := query.Get("nextPageToken") + result, err := c.service.GetRegisteredModelVersions(r.Context(), registeredmodelIdParam, nameParam, externalIDParam, pageSizeParam, model.OrderByField(orderByParam), model.SortOrder(sortOrderParam), nextPageTokenParam) + // If an error occurred, encode the error with the status code + if err != nil { + c.errorHandler(w, r, err, &result) + return + } + // If no error, encode the body and the result code + EncodeJSONResponse(result.Body, &result.Code, w) +} + +// GetRegisteredModels - List All RegisteredModels +func (c *ModelRegistryServiceAPIController) GetRegisteredModels(w http.ResponseWriter, r *http.Request) { + query := r.URL.Query() + pageSizeParam := query.Get("pageSize") + orderByParam := query.Get("orderBy") + sortOrderParam := query.Get("sortOrder") + nextPageTokenParam := query.Get("nextPageToken") + result, err := c.service.GetRegisteredModels(r.Context(), pageSizeParam, model.OrderByField(orderByParam), model.SortOrder(sortOrderParam), nextPageTokenParam) + // If an error occurred, encode the error with the status code + if err != nil { + c.errorHandler(w, r, err, &result) + return + } + // If no error, encode the body and the result code + EncodeJSONResponse(result.Body, &result.Code, w) +} + +// GetServingEnvironment - Get a ServingEnvironment +func (c *ModelRegistryServiceAPIController) GetServingEnvironment(w http.ResponseWriter, r *http.Request) { + servingenvironmentIdParam := chi.URLParam(r, "servingenvironmentId") + result, err := c.service.GetServingEnvironment(r.Context(), servingenvironmentIdParam) + // If an error occurred, encode the error with the status code + if err != nil { + c.errorHandler(w, r, err, &result) + return + } + // If no error, encode the body and the result code + EncodeJSONResponse(result.Body, &result.Code, w) +} + +// GetServingEnvironments - List All ServingEnvironments +func (c *ModelRegistryServiceAPIController) GetServingEnvironments(w http.ResponseWriter, r *http.Request) { + query := r.URL.Query() + pageSizeParam := query.Get("pageSize") + orderByParam := query.Get("orderBy") + sortOrderParam := query.Get("sortOrder") + nextPageTokenParam := query.Get("nextPageToken") + result, err := c.service.GetServingEnvironments(r.Context(), pageSizeParam, model.OrderByField(orderByParam), model.SortOrder(sortOrderParam), nextPageTokenParam) + // If an error occurred, encode the error with the status code + if err != nil { + c.errorHandler(w, r, err, &result) + return + } + // If no error, encode the body and the result code + EncodeJSONResponse(result.Body, &result.Code, w) +} + +// UpdateInferenceService - Update a InferenceService +func (c *ModelRegistryServiceAPIController) UpdateInferenceService(w http.ResponseWriter, r *http.Request) { + inferenceserviceIdParam := chi.URLParam(r, "inferenceserviceId") + inferenceServiceUpdateParam := model.InferenceServiceUpdate{} + d := json.NewDecoder(r.Body) + d.DisallowUnknownFields() + if err := d.Decode(&inferenceServiceUpdateParam); err != nil { + c.errorHandler(w, r, &ParsingError{Err: err}, nil) + return + } + if err := AssertInferenceServiceUpdateRequired(inferenceServiceUpdateParam); err != nil { + c.errorHandler(w, r, err, nil) + return + } + if err := AssertInferenceServiceUpdateConstraints(inferenceServiceUpdateParam); err != nil { + c.errorHandler(w, r, err, nil) + return + } + result, err := c.service.UpdateInferenceService(r.Context(), inferenceserviceIdParam, inferenceServiceUpdateParam) + // If an error occurred, encode the error with the status code + if err != nil { + c.errorHandler(w, r, err, &result) + return + } + // If no error, encode the body and the result code + EncodeJSONResponse(result.Body, &result.Code, w) +} + +// UpdateModelArtifact - Update a ModelArtifact +func (c *ModelRegistryServiceAPIController) UpdateModelArtifact(w http.ResponseWriter, r *http.Request) { + modelartifactIdParam := chi.URLParam(r, "modelartifactId") + modelArtifactUpdateParam := model.ModelArtifactUpdate{} + d := json.NewDecoder(r.Body) + d.DisallowUnknownFields() + if err := d.Decode(&modelArtifactUpdateParam); err != nil { + c.errorHandler(w, r, &ParsingError{Err: err}, nil) + return + } + if err := AssertModelArtifactUpdateRequired(modelArtifactUpdateParam); err != nil { + c.errorHandler(w, r, err, nil) + return + } + if err := AssertModelArtifactUpdateConstraints(modelArtifactUpdateParam); err != nil { + c.errorHandler(w, r, err, nil) + return + } + result, err := c.service.UpdateModelArtifact(r.Context(), modelartifactIdParam, modelArtifactUpdateParam) + // If an error occurred, encode the error with the status code + if err != nil { + c.errorHandler(w, r, err, &result) + return + } + // If no error, encode the body and the result code + EncodeJSONResponse(result.Body, &result.Code, w) +} + +// UpdateModelVersion - Update a ModelVersion +func (c *ModelRegistryServiceAPIController) UpdateModelVersion(w http.ResponseWriter, r *http.Request) { + modelversionIdParam := chi.URLParam(r, "modelversionId") + modelVersionParam := model.ModelVersion{} + d := json.NewDecoder(r.Body) + d.DisallowUnknownFields() + if err := d.Decode(&modelVersionParam); err != nil { + c.errorHandler(w, r, &ParsingError{Err: err}, nil) + return + } + if err := AssertModelVersionRequired(modelVersionParam); err != nil { + c.errorHandler(w, r, err, nil) + return + } + if err := AssertModelVersionConstraints(modelVersionParam); err != nil { + c.errorHandler(w, r, err, nil) + return + } + result, err := c.service.UpdateModelVersion(r.Context(), modelversionIdParam, modelVersionParam) + // If an error occurred, encode the error with the status code + if err != nil { + c.errorHandler(w, r, err, &result) + return + } + // If no error, encode the body and the result code + EncodeJSONResponse(result.Body, &result.Code, w) +} + +// UpdateRegisteredModel - Update a RegisteredModel +func (c *ModelRegistryServiceAPIController) UpdateRegisteredModel(w http.ResponseWriter, r *http.Request) { + registeredmodelIdParam := chi.URLParam(r, "registeredmodelId") + registeredModelUpdateParam := model.RegisteredModelUpdate{} + d := json.NewDecoder(r.Body) + d.DisallowUnknownFields() + if err := d.Decode(®isteredModelUpdateParam); err != nil { + c.errorHandler(w, r, &ParsingError{Err: err}, nil) + return + } + if err := AssertRegisteredModelUpdateRequired(registeredModelUpdateParam); err != nil { + c.errorHandler(w, r, err, nil) + return + } + if err := AssertRegisteredModelUpdateConstraints(registeredModelUpdateParam); err != nil { + c.errorHandler(w, r, err, nil) + return + } + result, err := c.service.UpdateRegisteredModel(r.Context(), registeredmodelIdParam, registeredModelUpdateParam) + // If an error occurred, encode the error with the status code + if err != nil { + c.errorHandler(w, r, err, &result) + return + } + // If no error, encode the body and the result code + EncodeJSONResponse(result.Body, &result.Code, w) +} + +// UpdateServingEnvironment - Update a ServingEnvironment +func (c *ModelRegistryServiceAPIController) UpdateServingEnvironment(w http.ResponseWriter, r *http.Request) { + servingenvironmentIdParam := chi.URLParam(r, "servingenvironmentId") + servingEnvironmentUpdateParam := model.ServingEnvironmentUpdate{} + d := json.NewDecoder(r.Body) + d.DisallowUnknownFields() + if err := d.Decode(&servingEnvironmentUpdateParam); err != nil { + c.errorHandler(w, r, &ParsingError{Err: err}, nil) + return + } + if err := AssertServingEnvironmentUpdateRequired(servingEnvironmentUpdateParam); err != nil { + c.errorHandler(w, r, err, nil) + return + } + if err := AssertServingEnvironmentUpdateConstraints(servingEnvironmentUpdateParam); err != nil { + c.errorHandler(w, r, err, nil) + return + } + result, err := c.service.UpdateServingEnvironment(r.Context(), servingenvironmentIdParam, servingEnvironmentUpdateParam) + // If an error occurred, encode the error with the status code + if err != nil { + c.errorHandler(w, r, err, &result) + return + } + // If no error, encode the body and the result code + EncodeJSONResponse(result.Body, &result.Code, w) +} diff --git a/internal/server/openapi/api_model_registry_service_service.go b/internal/server/openapi/api_model_registry_service_service.go new file mode 100644 index 000000000..e9cd55092 --- /dev/null +++ b/internal/server/openapi/api_model_registry_service_service.go @@ -0,0 +1,764 @@ +/* + * Model Registry REST API + * + * REST API for Model Registry to create and manage ML model metadata + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package openapi + +import ( + "context" + "errors" + model "github.com/opendatahub-io/model-registry/internal/model/openapi" + "net/http" +) + +// ModelRegistryServiceAPIService is a service that implements the logic for the ModelRegistryServiceAPIServicer +// This service should implement the business logic for every endpoint for the ModelRegistryServiceAPI API. +// Include any external packages or services that will be required by this service. +type ModelRegistryServiceAPIService struct { +} + +// NewModelRegistryServiceAPIService creates a default api service +func NewModelRegistryServiceAPIService() ModelRegistryServiceAPIServicer { + return &ModelRegistryServiceAPIService{} +} + +// CreateEnvironmentInferenceService - Create a InferenceService in ServingEnvironment +func (s *ModelRegistryServiceAPIService) CreateEnvironmentInferenceService(ctx context.Context, servingenvironmentId string, inferenceServiceCreate model.InferenceServiceCreate) (ImplResponse, error) { + // TODO - update CreateEnvironmentInferenceService with the required logic for this service method. + // Add api_model_registry_service_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. + + // TODO: Uncomment the next line to return response Response(201, InferenceService{}) or use other options such as http.Ok ... + // return Response(201, InferenceService{}), nil + + // TODO: Uncomment the next line to return response Response(400, Error{}) or use other options such as http.Ok ... + // return Response(400, Error{}), nil + + // TODO: Uncomment the next line to return response Response(401, Error{}) or use other options such as http.Ok ... + // return Response(401, Error{}), nil + + // TODO: Uncomment the next line to return response Response(404, Error{}) or use other options such as http.Ok ... + // return Response(404, Error{}), nil + + // TODO: Uncomment the next line to return response Response(500, Error{}) or use other options such as http.Ok ... + // return Response(500, Error{}), nil + + return Response(http.StatusNotImplemented, nil), errors.New("CreateEnvironmentInferenceService method not implemented") +} + +// CreateInferenceService - Create a InferenceService +func (s *ModelRegistryServiceAPIService) CreateInferenceService(ctx context.Context, inferenceServiceCreate model.InferenceServiceCreate) (ImplResponse, error) { + // TODO - update CreateInferenceService with the required logic for this service method. + // Add api_model_registry_service_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. + + // TODO: Uncomment the next line to return response Response(200, InferenceService{}) or use other options such as http.Ok ... + // return Response(200, InferenceService{}), nil + + // TODO: Uncomment the next line to return response Response(400, Error{}) or use other options such as http.Ok ... + // return Response(400, Error{}), nil + + // TODO: Uncomment the next line to return response Response(401, Error{}) or use other options such as http.Ok ... + // return Response(401, Error{}), nil + + // TODO: Uncomment the next line to return response Response(500, Error{}) or use other options such as http.Ok ... + // return Response(500, Error{}), nil + + return Response(http.StatusNotImplemented, nil), errors.New("CreateInferenceService method not implemented") +} + +// CreateInferenceServiceServe - Create a ServeModel action in a InferenceService +func (s *ModelRegistryServiceAPIService) CreateInferenceServiceServe(ctx context.Context, inferenceserviceId string, serveModelCreate model.ServeModelCreate) (ImplResponse, error) { + // TODO - update CreateInferenceServiceServe with the required logic for this service method. + // Add api_model_registry_service_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. + + // TODO: Uncomment the next line to return response Response(201, ServeModel{}) or use other options such as http.Ok ... + // return Response(201, ServeModel{}), nil + + // TODO: Uncomment the next line to return response Response(400, Error{}) or use other options such as http.Ok ... + // return Response(400, Error{}), nil + + // TODO: Uncomment the next line to return response Response(401, Error{}) or use other options such as http.Ok ... + // return Response(401, Error{}), nil + + // TODO: Uncomment the next line to return response Response(404, Error{}) or use other options such as http.Ok ... + // return Response(404, Error{}), nil + + // TODO: Uncomment the next line to return response Response(500, Error{}) or use other options such as http.Ok ... + // return Response(500, Error{}), nil + + return Response(http.StatusNotImplemented, nil), errors.New("CreateInferenceServiceServe method not implemented") +} + +// CreateModelArtifact - Create a ModelArtifact +func (s *ModelRegistryServiceAPIService) CreateModelArtifact(ctx context.Context, modelArtifactCreate model.ModelArtifactCreate) (ImplResponse, error) { + // TODO - update CreateModelArtifact with the required logic for this service method. + // Add api_model_registry_service_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. + + // TODO: Uncomment the next line to return response Response(201, ModelArtifact{}) or use other options such as http.Ok ... + // return Response(201, ModelArtifact{}), nil + + // TODO: Uncomment the next line to return response Response(400, Error{}) or use other options such as http.Ok ... + // return Response(400, Error{}), nil + + // TODO: Uncomment the next line to return response Response(401, Error{}) or use other options such as http.Ok ... + // return Response(401, Error{}), nil + + // TODO: Uncomment the next line to return response Response(500, Error{}) or use other options such as http.Ok ... + // return Response(500, Error{}), nil + + return Response(http.StatusNotImplemented, nil), errors.New("CreateModelArtifact method not implemented") +} + +// CreateModelVersion - Create a ModelVersion +func (s *ModelRegistryServiceAPIService) CreateModelVersion(ctx context.Context, modelVersionCreate model.ModelVersionCreate) (ImplResponse, error) { + // TODO - update CreateModelVersion with the required logic for this service method. + // Add api_model_registry_service_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. + + // TODO: Uncomment the next line to return response Response(201, ModelVersion{}) or use other options such as http.Ok ... + // return Response(201, ModelVersion{}), nil + + // TODO: Uncomment the next line to return response Response(400, Error{}) or use other options such as http.Ok ... + // return Response(400, Error{}), nil + + // TODO: Uncomment the next line to return response Response(401, Error{}) or use other options such as http.Ok ... + // return Response(401, Error{}), nil + + // TODO: Uncomment the next line to return response Response(500, Error{}) or use other options such as http.Ok ... + // return Response(500, Error{}), nil + + return Response(http.StatusNotImplemented, nil), errors.New("CreateModelVersion method not implemented") +} + +// CreateModelVersionArtifact - Create an Artifact in a ModelVersion +func (s *ModelRegistryServiceAPIService) CreateModelVersionArtifact(ctx context.Context, modelversionId string, artifact model.Artifact) (ImplResponse, error) { + // TODO - update CreateModelVersionArtifact with the required logic for this service method. + // Add api_model_registry_service_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. + + // TODO: Uncomment the next line to return response Response(200, Artifact{}) or use other options such as http.Ok ... + // return Response(200, Artifact{}), nil + + // TODO: Uncomment the next line to return response Response(201, Artifact{}) or use other options such as http.Ok ... + // return Response(201, Artifact{}), nil + + // TODO: Uncomment the next line to return response Response(400, Error{}) or use other options such as http.Ok ... + // return Response(400, Error{}), nil + + // TODO: Uncomment the next line to return response Response(401, Error{}) or use other options such as http.Ok ... + // return Response(401, Error{}), nil + + // TODO: Uncomment the next line to return response Response(404, Error{}) or use other options such as http.Ok ... + // return Response(404, Error{}), nil + + // TODO: Uncomment the next line to return response Response(500, Error{}) or use other options such as http.Ok ... + // return Response(500, Error{}), nil + + return Response(http.StatusNotImplemented, nil), errors.New("CreateModelVersionArtifact method not implemented") +} + +// CreateRegisteredModel - Create a RegisteredModel +func (s *ModelRegistryServiceAPIService) CreateRegisteredModel(ctx context.Context, registeredModelCreate model.RegisteredModelCreate) (ImplResponse, error) { + // TODO - update CreateRegisteredModel with the required logic for this service method. + // Add api_model_registry_service_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. + + // TODO: Uncomment the next line to return response Response(201, RegisteredModel{}) or use other options such as http.Ok ... + // return Response(201, RegisteredModel{}), nil + + // TODO: Uncomment the next line to return response Response(400, Error{}) or use other options such as http.Ok ... + // return Response(400, Error{}), nil + + // TODO: Uncomment the next line to return response Response(401, Error{}) or use other options such as http.Ok ... + // return Response(401, Error{}), nil + + // TODO: Uncomment the next line to return response Response(500, Error{}) or use other options such as http.Ok ... + // return Response(500, Error{}), nil + + return Response(http.StatusNotImplemented, nil), errors.New("CreateRegisteredModel method not implemented") +} + +// CreateRegisteredModelVersion - Create a ModelVersion in RegisteredModel +func (s *ModelRegistryServiceAPIService) CreateRegisteredModelVersion(ctx context.Context, registeredmodelId string, modelVersion model.ModelVersion) (ImplResponse, error) { + // TODO - update CreateRegisteredModelVersion with the required logic for this service method. + // Add api_model_registry_service_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. + + // TODO: Uncomment the next line to return response Response(201, ModelVersion{}) or use other options such as http.Ok ... + // return Response(201, ModelVersion{}), nil + + // TODO: Uncomment the next line to return response Response(400, Error{}) or use other options such as http.Ok ... + // return Response(400, Error{}), nil + + // TODO: Uncomment the next line to return response Response(401, Error{}) or use other options such as http.Ok ... + // return Response(401, Error{}), nil + + // TODO: Uncomment the next line to return response Response(404, Error{}) or use other options such as http.Ok ... + // return Response(404, Error{}), nil + + // TODO: Uncomment the next line to return response Response(500, Error{}) or use other options such as http.Ok ... + // return Response(500, Error{}), nil + + return Response(http.StatusNotImplemented, nil), errors.New("CreateRegisteredModelVersion method not implemented") +} + +// CreateServingEnvironment - Create a ServingEnvironment +func (s *ModelRegistryServiceAPIService) CreateServingEnvironment(ctx context.Context, servingEnvironmentCreate model.ServingEnvironmentCreate) (ImplResponse, error) { + // TODO - update CreateServingEnvironment with the required logic for this service method. + // Add api_model_registry_service_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. + + // TODO: Uncomment the next line to return response Response(201, ServingEnvironment{}) or use other options such as http.Ok ... + // return Response(201, ServingEnvironment{}), nil + + // TODO: Uncomment the next line to return response Response(400, Error{}) or use other options such as http.Ok ... + // return Response(400, Error{}), nil + + // TODO: Uncomment the next line to return response Response(401, Error{}) or use other options such as http.Ok ... + // return Response(401, Error{}), nil + + // TODO: Uncomment the next line to return response Response(500, Error{}) or use other options such as http.Ok ... + // return Response(500, Error{}), nil + + return Response(http.StatusNotImplemented, nil), errors.New("CreateServingEnvironment method not implemented") +} + +// FindInferenceService - Get an InferenceServices that matches search parameters. +func (s *ModelRegistryServiceAPIService) FindInferenceService(ctx context.Context, name string, externalID string) (ImplResponse, error) { + // TODO - update FindInferenceService with the required logic for this service method. + // Add api_model_registry_service_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. + + // TODO: Uncomment the next line to return response Response(200, InferenceService{}) or use other options such as http.Ok ... + // return Response(200, InferenceService{}), nil + + // TODO: Uncomment the next line to return response Response(400, Error{}) or use other options such as http.Ok ... + // return Response(400, Error{}), nil + + // TODO: Uncomment the next line to return response Response(401, Error{}) or use other options such as http.Ok ... + // return Response(401, Error{}), nil + + // TODO: Uncomment the next line to return response Response(404, Error{}) or use other options such as http.Ok ... + // return Response(404, Error{}), nil + + // TODO: Uncomment the next line to return response Response(500, Error{}) or use other options such as http.Ok ... + // return Response(500, Error{}), nil + + return Response(http.StatusNotImplemented, nil), errors.New("FindInferenceService method not implemented") +} + +// FindModelArtifact - Get a ModelArtifact that matches search parameters. +func (s *ModelRegistryServiceAPIService) FindModelArtifact(ctx context.Context, name string, externalID string) (ImplResponse, error) { + // TODO - update FindModelArtifact with the required logic for this service method. + // Add api_model_registry_service_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. + + // TODO: Uncomment the next line to return response Response(200, ModelArtifact{}) or use other options such as http.Ok ... + // return Response(200, ModelArtifact{}), nil + + // TODO: Uncomment the next line to return response Response(400, Error{}) or use other options such as http.Ok ... + // return Response(400, Error{}), nil + + // TODO: Uncomment the next line to return response Response(401, Error{}) or use other options such as http.Ok ... + // return Response(401, Error{}), nil + + // TODO: Uncomment the next line to return response Response(404, Error{}) or use other options such as http.Ok ... + // return Response(404, Error{}), nil + + // TODO: Uncomment the next line to return response Response(500, Error{}) or use other options such as http.Ok ... + // return Response(500, Error{}), nil + + return Response(http.StatusNotImplemented, nil), errors.New("FindModelArtifact method not implemented") +} + +// FindModelVersion - Get a ModelVersion that matches search parameters. +func (s *ModelRegistryServiceAPIService) FindModelVersion(ctx context.Context, name string, externalID string) (ImplResponse, error) { + // TODO - update FindModelVersion with the required logic for this service method. + // Add api_model_registry_service_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. + + // TODO: Uncomment the next line to return response Response(200, ModelVersion{}) or use other options such as http.Ok ... + // return Response(200, ModelVersion{}), nil + + // TODO: Uncomment the next line to return response Response(400, Error{}) or use other options such as http.Ok ... + // return Response(400, Error{}), nil + + // TODO: Uncomment the next line to return response Response(401, Error{}) or use other options such as http.Ok ... + // return Response(401, Error{}), nil + + // TODO: Uncomment the next line to return response Response(404, Error{}) or use other options such as http.Ok ... + // return Response(404, Error{}), nil + + // TODO: Uncomment the next line to return response Response(500, Error{}) or use other options such as http.Ok ... + // return Response(500, Error{}), nil + + return Response(http.StatusNotImplemented, nil), errors.New("FindModelVersion method not implemented") +} + +// FindRegisteredModel - Get a RegisteredModel that matches search parameters. +func (s *ModelRegistryServiceAPIService) FindRegisteredModel(ctx context.Context, name string, externalID string) (ImplResponse, error) { + // TODO - update FindRegisteredModel with the required logic for this service method. + // Add api_model_registry_service_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. + + // TODO: Uncomment the next line to return response Response(200, RegisteredModel{}) or use other options such as http.Ok ... + // return Response(200, RegisteredModel{}), nil + + // TODO: Uncomment the next line to return response Response(401, Error{}) or use other options such as http.Ok ... + // return Response(401, Error{}), nil + + // TODO: Uncomment the next line to return response Response(404, Error{}) or use other options such as http.Ok ... + // return Response(404, Error{}), nil + + // TODO: Uncomment the next line to return response Response(500, Error{}) or use other options such as http.Ok ... + // return Response(500, Error{}), nil + + return Response(http.StatusNotImplemented, nil), errors.New("FindRegisteredModel method not implemented") +} + +// FindServingEnvironment - Find ServingEnvironment +func (s *ModelRegistryServiceAPIService) FindServingEnvironment(ctx context.Context, name string, externalID string) (ImplResponse, error) { + // TODO - update FindServingEnvironment with the required logic for this service method. + // Add api_model_registry_service_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. + + // TODO: Uncomment the next line to return response Response(200, ServingEnvironment{}) or use other options such as http.Ok ... + // return Response(200, ServingEnvironment{}), nil + + // TODO: Uncomment the next line to return response Response(401, Error{}) or use other options such as http.Ok ... + // return Response(401, Error{}), nil + + // TODO: Uncomment the next line to return response Response(404, Error{}) or use other options such as http.Ok ... + // return Response(404, Error{}), nil + + // TODO: Uncomment the next line to return response Response(500, Error{}) or use other options such as http.Ok ... + // return Response(500, Error{}), nil + + return Response(http.StatusNotImplemented, nil), errors.New("FindServingEnvironment method not implemented") +} + +// GetEnvironmentInferenceServices - List All ServingEnvironment's InferenceServices +func (s *ModelRegistryServiceAPIService) GetEnvironmentInferenceServices(ctx context.Context, servingenvironmentId string, name string, externalID string, pageSize string, orderBy model.OrderByField, sortOrder model.SortOrder, nextPageToken string) (ImplResponse, error) { + // TODO - update GetEnvironmentInferenceServices with the required logic for this service method. + // Add api_model_registry_service_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. + + // TODO: Uncomment the next line to return response Response(200, InferenceServiceList{}) or use other options such as http.Ok ... + // return Response(200, InferenceServiceList{}), nil + + // TODO: Uncomment the next line to return response Response(401, Error{}) or use other options such as http.Ok ... + // return Response(401, Error{}), nil + + // TODO: Uncomment the next line to return response Response(404, Error{}) or use other options such as http.Ok ... + // return Response(404, Error{}), nil + + // TODO: Uncomment the next line to return response Response(500, Error{}) or use other options such as http.Ok ... + // return Response(500, Error{}), nil + + return Response(http.StatusNotImplemented, nil), errors.New("GetEnvironmentInferenceServices method not implemented") +} + +// GetInferenceService - Get a InferenceService +func (s *ModelRegistryServiceAPIService) GetInferenceService(ctx context.Context, inferenceserviceId string) (ImplResponse, error) { + // TODO - update GetInferenceService with the required logic for this service method. + // Add api_model_registry_service_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. + + // TODO: Uncomment the next line to return response Response(200, InferenceService{}) or use other options such as http.Ok ... + // return Response(200, InferenceService{}), nil + + // TODO: Uncomment the next line to return response Response(401, Error{}) or use other options such as http.Ok ... + // return Response(401, Error{}), nil + + // TODO: Uncomment the next line to return response Response(404, Error{}) or use other options such as http.Ok ... + // return Response(404, Error{}), nil + + // TODO: Uncomment the next line to return response Response(500, Error{}) or use other options such as http.Ok ... + // return Response(500, Error{}), nil + + return Response(http.StatusNotImplemented, nil), errors.New("GetInferenceService method not implemented") +} + +// GetInferenceServiceModel - Get InferenceService's RegisteredModel +func (s *ModelRegistryServiceAPIService) GetInferenceServiceModel(ctx context.Context, inferenceserviceId string) (ImplResponse, error) { + // TODO - update GetInferenceServiceModel with the required logic for this service method. + // Add api_model_registry_service_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. + + // TODO: Uncomment the next line to return response Response(200, RegisteredModel{}) or use other options such as http.Ok ... + // return Response(200, RegisteredModel{}), nil + + // TODO: Uncomment the next line to return response Response(401, Error{}) or use other options such as http.Ok ... + // return Response(401, Error{}), nil + + // TODO: Uncomment the next line to return response Response(404, Error{}) or use other options such as http.Ok ... + // return Response(404, Error{}), nil + + // TODO: Uncomment the next line to return response Response(500, Error{}) or use other options such as http.Ok ... + // return Response(500, Error{}), nil + + return Response(http.StatusNotImplemented, nil), errors.New("GetInferenceServiceModel method not implemented") +} + +// GetInferenceServiceServes - List All InferenceService's ServeModel actions +func (s *ModelRegistryServiceAPIService) GetInferenceServiceServes(ctx context.Context, inferenceserviceId string, name string, externalID string, pageSize string, orderBy model.OrderByField, sortOrder model.SortOrder, nextPageToken string) (ImplResponse, error) { + // TODO - update GetInferenceServiceServes with the required logic for this service method. + // Add api_model_registry_service_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. + + // TODO: Uncomment the next line to return response Response(200, ServeModelList{}) or use other options such as http.Ok ... + // return Response(200, ServeModelList{}), nil + + // TODO: Uncomment the next line to return response Response(401, Error{}) or use other options such as http.Ok ... + // return Response(401, Error{}), nil + + // TODO: Uncomment the next line to return response Response(404, Error{}) or use other options such as http.Ok ... + // return Response(404, Error{}), nil + + // TODO: Uncomment the next line to return response Response(500, Error{}) or use other options such as http.Ok ... + // return Response(500, Error{}), nil + + return Response(http.StatusNotImplemented, nil), errors.New("GetInferenceServiceServes method not implemented") +} + +// GetInferenceServiceVersion - Get InferenceService's ModelVersion +func (s *ModelRegistryServiceAPIService) GetInferenceServiceVersion(ctx context.Context, inferenceserviceId string) (ImplResponse, error) { + // TODO - update GetInferenceServiceVersion with the required logic for this service method. + // Add api_model_registry_service_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. + + // TODO: Uncomment the next line to return response Response(200, ModelVersion{}) or use other options such as http.Ok ... + // return Response(200, ModelVersion{}), nil + + // TODO: Uncomment the next line to return response Response(401, Error{}) or use other options such as http.Ok ... + // return Response(401, Error{}), nil + + // TODO: Uncomment the next line to return response Response(404, Error{}) or use other options such as http.Ok ... + // return Response(404, Error{}), nil + + // TODO: Uncomment the next line to return response Response(500, Error{}) or use other options such as http.Ok ... + // return Response(500, Error{}), nil + + return Response(http.StatusNotImplemented, nil), errors.New("GetInferenceServiceVersion method not implemented") +} + +// GetInferenceServices - List All InferenceServices +func (s *ModelRegistryServiceAPIService) GetInferenceServices(ctx context.Context, pageSize string, orderBy model.OrderByField, sortOrder model.SortOrder, nextPageToken string) (ImplResponse, error) { + // TODO - update GetInferenceServices with the required logic for this service method. + // Add api_model_registry_service_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. + + // TODO: Uncomment the next line to return response Response(200, InferenceServiceList{}) or use other options such as http.Ok ... + // return Response(200, InferenceServiceList{}), nil + + // TODO: Uncomment the next line to return response Response(400, Error{}) or use other options such as http.Ok ... + // return Response(400, Error{}), nil + + // TODO: Uncomment the next line to return response Response(401, Error{}) or use other options such as http.Ok ... + // return Response(401, Error{}), nil + + // TODO: Uncomment the next line to return response Response(404, Error{}) or use other options such as http.Ok ... + // return Response(404, Error{}), nil + + // TODO: Uncomment the next line to return response Response(500, Error{}) or use other options such as http.Ok ... + // return Response(500, Error{}), nil + + return Response(http.StatusNotImplemented, nil), errors.New("GetInferenceServices method not implemented") +} + +// GetModelArtifact - Get a ModelArtifact +func (s *ModelRegistryServiceAPIService) GetModelArtifact(ctx context.Context, modelartifactId string) (ImplResponse, error) { + // TODO - update GetModelArtifact with the required logic for this service method. + // Add api_model_registry_service_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. + + // TODO: Uncomment the next line to return response Response(200, ModelArtifact{}) or use other options such as http.Ok ... + // return Response(200, ModelArtifact{}), nil + + // TODO: Uncomment the next line to return response Response(401, Error{}) or use other options such as http.Ok ... + // return Response(401, Error{}), nil + + // TODO: Uncomment the next line to return response Response(404, Error{}) or use other options such as http.Ok ... + // return Response(404, Error{}), nil + + // TODO: Uncomment the next line to return response Response(500, Error{}) or use other options such as http.Ok ... + // return Response(500, Error{}), nil + + return Response(http.StatusNotImplemented, nil), errors.New("GetModelArtifact method not implemented") +} + +// GetModelArtifacts - List All ModelArtifacts +func (s *ModelRegistryServiceAPIService) GetModelArtifacts(ctx context.Context, pageSize string, orderBy model.OrderByField, sortOrder model.SortOrder, nextPageToken string) (ImplResponse, error) { + // TODO - update GetModelArtifacts with the required logic for this service method. + // Add api_model_registry_service_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. + + // TODO: Uncomment the next line to return response Response(200, ModelArtifactList{}) or use other options such as http.Ok ... + // return Response(200, ModelArtifactList{}), nil + + // TODO: Uncomment the next line to return response Response(400, Error{}) or use other options such as http.Ok ... + // return Response(400, Error{}), nil + + // TODO: Uncomment the next line to return response Response(401, Error{}) or use other options such as http.Ok ... + // return Response(401, Error{}), nil + + // TODO: Uncomment the next line to return response Response(404, Error{}) or use other options such as http.Ok ... + // return Response(404, Error{}), nil + + // TODO: Uncomment the next line to return response Response(500, Error{}) or use other options such as http.Ok ... + // return Response(500, Error{}), nil + + return Response(http.StatusNotImplemented, nil), errors.New("GetModelArtifacts method not implemented") +} + +// GetModelVersion - Get a ModelVersion +func (s *ModelRegistryServiceAPIService) GetModelVersion(ctx context.Context, modelversionId string) (ImplResponse, error) { + // TODO - update GetModelVersion with the required logic for this service method. + // Add api_model_registry_service_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. + + // TODO: Uncomment the next line to return response Response(200, ModelVersion{}) or use other options such as http.Ok ... + // return Response(200, ModelVersion{}), nil + + // TODO: Uncomment the next line to return response Response(401, Error{}) or use other options such as http.Ok ... + // return Response(401, Error{}), nil + + // TODO: Uncomment the next line to return response Response(404, Error{}) or use other options such as http.Ok ... + // return Response(404, Error{}), nil + + // TODO: Uncomment the next line to return response Response(500, Error{}) or use other options such as http.Ok ... + // return Response(500, Error{}), nil + + return Response(http.StatusNotImplemented, nil), errors.New("GetModelVersion method not implemented") +} + +// GetModelVersionArtifacts - List All ModelVersion's artifacts +func (s *ModelRegistryServiceAPIService) GetModelVersionArtifacts(ctx context.Context, modelversionId string, name string, externalID string, pageSize string, orderBy model.OrderByField, sortOrder model.SortOrder, nextPageToken string) (ImplResponse, error) { + // TODO - update GetModelVersionArtifacts with the required logic for this service method. + // Add api_model_registry_service_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. + + // TODO: Uncomment the next line to return response Response(200, ArtifactList{}) or use other options such as http.Ok ... + // return Response(200, ArtifactList{}), nil + + // TODO: Uncomment the next line to return response Response(401, Error{}) or use other options such as http.Ok ... + // return Response(401, Error{}), nil + + // TODO: Uncomment the next line to return response Response(404, Error{}) or use other options such as http.Ok ... + // return Response(404, Error{}), nil + + // TODO: Uncomment the next line to return response Response(500, Error{}) or use other options such as http.Ok ... + // return Response(500, Error{}), nil + + return Response(http.StatusNotImplemented, nil), errors.New("GetModelVersionArtifacts method not implemented") +} + +// GetModelVersions - List All ModelVersions +func (s *ModelRegistryServiceAPIService) GetModelVersions(ctx context.Context, pageSize string, orderBy model.OrderByField, sortOrder model.SortOrder, nextPageToken string) (ImplResponse, error) { + // TODO - update GetModelVersions with the required logic for this service method. + // Add api_model_registry_service_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. + + // TODO: Uncomment the next line to return response Response(200, ModelVersionList{}) or use other options such as http.Ok ... + // return Response(200, ModelVersionList{}), nil + + // TODO: Uncomment the next line to return response Response(401, Error{}) or use other options such as http.Ok ... + // return Response(401, Error{}), nil + + // TODO: Uncomment the next line to return response Response(500, Error{}) or use other options such as http.Ok ... + // return Response(500, Error{}), nil + + return Response(http.StatusNotImplemented, nil), errors.New("GetModelVersions method not implemented") +} + +// GetRegisteredModel - Get a RegisteredModel +func (s *ModelRegistryServiceAPIService) GetRegisteredModel(ctx context.Context, registeredmodelId string) (ImplResponse, error) { + // TODO - update GetRegisteredModel with the required logic for this service method. + // Add api_model_registry_service_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. + + // TODO: Uncomment the next line to return response Response(200, RegisteredModel{}) or use other options such as http.Ok ... + // return Response(200, RegisteredModel{}), nil + + // TODO: Uncomment the next line to return response Response(401, Error{}) or use other options such as http.Ok ... + // return Response(401, Error{}), nil + + // TODO: Uncomment the next line to return response Response(404, Error{}) or use other options such as http.Ok ... + // return Response(404, Error{}), nil + + // TODO: Uncomment the next line to return response Response(500, Error{}) or use other options such as http.Ok ... + // return Response(500, Error{}), nil + + return Response(http.StatusNotImplemented, nil), errors.New("GetRegisteredModel method not implemented") +} + +// GetRegisteredModelVersions - List All RegisteredModel's ModelVersions +func (s *ModelRegistryServiceAPIService) GetRegisteredModelVersions(ctx context.Context, registeredmodelId string, name string, externalID string, pageSize string, orderBy model.OrderByField, sortOrder model.SortOrder, nextPageToken string) (ImplResponse, error) { + // TODO - update GetRegisteredModelVersions with the required logic for this service method. + // Add api_model_registry_service_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. + + // TODO: Uncomment the next line to return response Response(200, ModelVersionList{}) or use other options such as http.Ok ... + // return Response(200, ModelVersionList{}), nil + + // TODO: Uncomment the next line to return response Response(401, Error{}) or use other options such as http.Ok ... + // return Response(401, Error{}), nil + + // TODO: Uncomment the next line to return response Response(404, Error{}) or use other options such as http.Ok ... + // return Response(404, Error{}), nil + + // TODO: Uncomment the next line to return response Response(500, Error{}) or use other options such as http.Ok ... + // return Response(500, Error{}), nil + + return Response(http.StatusNotImplemented, nil), errors.New("GetRegisteredModelVersions method not implemented") +} + +// GetRegisteredModels - List All RegisteredModels +func (s *ModelRegistryServiceAPIService) GetRegisteredModels(ctx context.Context, pageSize string, orderBy model.OrderByField, sortOrder model.SortOrder, nextPageToken string) (ImplResponse, error) { + // TODO - update GetRegisteredModels with the required logic for this service method. + // Add api_model_registry_service_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. + + // TODO: Uncomment the next line to return response Response(200, RegisteredModelList{}) or use other options such as http.Ok ... + // return Response(200, RegisteredModelList{}), nil + + // TODO: Uncomment the next line to return response Response(401, Error{}) or use other options such as http.Ok ... + // return Response(401, Error{}), nil + + // TODO: Uncomment the next line to return response Response(500, Error{}) or use other options such as http.Ok ... + // return Response(500, Error{}), nil + + return Response(http.StatusNotImplemented, nil), errors.New("GetRegisteredModels method not implemented") +} + +// GetServingEnvironment - Get a ServingEnvironment +func (s *ModelRegistryServiceAPIService) GetServingEnvironment(ctx context.Context, servingenvironmentId string) (ImplResponse, error) { + // TODO - update GetServingEnvironment with the required logic for this service method. + // Add api_model_registry_service_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. + + // TODO: Uncomment the next line to return response Response(200, ServingEnvironment{}) or use other options such as http.Ok ... + // return Response(200, ServingEnvironment{}), nil + + // TODO: Uncomment the next line to return response Response(401, Error{}) or use other options such as http.Ok ... + // return Response(401, Error{}), nil + + // TODO: Uncomment the next line to return response Response(404, Error{}) or use other options such as http.Ok ... + // return Response(404, Error{}), nil + + // TODO: Uncomment the next line to return response Response(500, Error{}) or use other options such as http.Ok ... + // return Response(500, Error{}), nil + + return Response(http.StatusNotImplemented, nil), errors.New("GetServingEnvironment method not implemented") +} + +// GetServingEnvironments - List All ServingEnvironments +func (s *ModelRegistryServiceAPIService) GetServingEnvironments(ctx context.Context, pageSize string, orderBy model.OrderByField, sortOrder model.SortOrder, nextPageToken string) (ImplResponse, error) { + // TODO - update GetServingEnvironments with the required logic for this service method. + // Add api_model_registry_service_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. + + // TODO: Uncomment the next line to return response Response(200, ServingEnvironmentList{}) or use other options such as http.Ok ... + // return Response(200, ServingEnvironmentList{}), nil + + // TODO: Uncomment the next line to return response Response(401, Error{}) or use other options such as http.Ok ... + // return Response(401, Error{}), nil + + // TODO: Uncomment the next line to return response Response(500, Error{}) or use other options such as http.Ok ... + // return Response(500, Error{}), nil + + return Response(http.StatusNotImplemented, nil), errors.New("GetServingEnvironments method not implemented") +} + +// UpdateInferenceService - Update a InferenceService +func (s *ModelRegistryServiceAPIService) UpdateInferenceService(ctx context.Context, inferenceserviceId string, inferenceServiceUpdate model.InferenceServiceUpdate) (ImplResponse, error) { + // TODO - update UpdateInferenceService with the required logic for this service method. + // Add api_model_registry_service_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. + + // TODO: Uncomment the next line to return response Response(200, InferenceService{}) or use other options such as http.Ok ... + // return Response(200, InferenceService{}), nil + + // TODO: Uncomment the next line to return response Response(400, Error{}) or use other options such as http.Ok ... + // return Response(400, Error{}), nil + + // TODO: Uncomment the next line to return response Response(401, Error{}) or use other options such as http.Ok ... + // return Response(401, Error{}), nil + + // TODO: Uncomment the next line to return response Response(404, Error{}) or use other options such as http.Ok ... + // return Response(404, Error{}), nil + + // TODO: Uncomment the next line to return response Response(500, Error{}) or use other options such as http.Ok ... + // return Response(500, Error{}), nil + + return Response(http.StatusNotImplemented, nil), errors.New("UpdateInferenceService method not implemented") +} + +// UpdateModelArtifact - Update a ModelArtifact +func (s *ModelRegistryServiceAPIService) UpdateModelArtifact(ctx context.Context, modelartifactId string, modelArtifactUpdate model.ModelArtifactUpdate) (ImplResponse, error) { + // TODO - update UpdateModelArtifact with the required logic for this service method. + // Add api_model_registry_service_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. + + // TODO: Uncomment the next line to return response Response(200, ModelArtifact{}) or use other options such as http.Ok ... + // return Response(200, ModelArtifact{}), nil + + // TODO: Uncomment the next line to return response Response(400, Error{}) or use other options such as http.Ok ... + // return Response(400, Error{}), nil + + // TODO: Uncomment the next line to return response Response(401, Error{}) or use other options such as http.Ok ... + // return Response(401, Error{}), nil + + // TODO: Uncomment the next line to return response Response(404, Error{}) or use other options such as http.Ok ... + // return Response(404, Error{}), nil + + // TODO: Uncomment the next line to return response Response(500, Error{}) or use other options such as http.Ok ... + // return Response(500, Error{}), nil + + return Response(http.StatusNotImplemented, nil), errors.New("UpdateModelArtifact method not implemented") +} + +// UpdateModelVersion - Update a ModelVersion +func (s *ModelRegistryServiceAPIService) UpdateModelVersion(ctx context.Context, modelversionId string, modelVersion model.ModelVersion) (ImplResponse, error) { + // TODO - update UpdateModelVersion with the required logic for this service method. + // Add api_model_registry_service_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. + + // TODO: Uncomment the next line to return response Response(200, ModelVersion{}) or use other options such as http.Ok ... + // return Response(200, ModelVersion{}), nil + + // TODO: Uncomment the next line to return response Response(400, Error{}) or use other options such as http.Ok ... + // return Response(400, Error{}), nil + + // TODO: Uncomment the next line to return response Response(401, Error{}) or use other options such as http.Ok ... + // return Response(401, Error{}), nil + + // TODO: Uncomment the next line to return response Response(404, Error{}) or use other options such as http.Ok ... + // return Response(404, Error{}), nil + + // TODO: Uncomment the next line to return response Response(500, Error{}) or use other options such as http.Ok ... + // return Response(500, Error{}), nil + + return Response(http.StatusNotImplemented, nil), errors.New("UpdateModelVersion method not implemented") +} + +// UpdateRegisteredModel - Update a RegisteredModel +func (s *ModelRegistryServiceAPIService) UpdateRegisteredModel(ctx context.Context, registeredmodelId string, registeredModelUpdate model.RegisteredModelUpdate) (ImplResponse, error) { + // TODO - update UpdateRegisteredModel with the required logic for this service method. + // Add api_model_registry_service_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. + + // TODO: Uncomment the next line to return response Response(200, RegisteredModel{}) or use other options such as http.Ok ... + // return Response(200, RegisteredModel{}), nil + + // TODO: Uncomment the next line to return response Response(400, Error{}) or use other options such as http.Ok ... + // return Response(400, Error{}), nil + + // TODO: Uncomment the next line to return response Response(401, Error{}) or use other options such as http.Ok ... + // return Response(401, Error{}), nil + + // TODO: Uncomment the next line to return response Response(404, Error{}) or use other options such as http.Ok ... + // return Response(404, Error{}), nil + + // TODO: Uncomment the next line to return response Response(500, Error{}) or use other options such as http.Ok ... + // return Response(500, Error{}), nil + + return Response(http.StatusNotImplemented, nil), errors.New("UpdateRegisteredModel method not implemented") +} + +// UpdateServingEnvironment - Update a ServingEnvironment +func (s *ModelRegistryServiceAPIService) UpdateServingEnvironment(ctx context.Context, servingenvironmentId string, servingEnvironmentUpdate model.ServingEnvironmentUpdate) (ImplResponse, error) { + // TODO - update UpdateServingEnvironment with the required logic for this service method. + // Add api_model_registry_service_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. + + // TODO: Uncomment the next line to return response Response(200, ServingEnvironment{}) or use other options such as http.Ok ... + // return Response(200, ServingEnvironment{}), nil + + // TODO: Uncomment the next line to return response Response(400, Error{}) or use other options such as http.Ok ... + // return Response(400, Error{}), nil + + // TODO: Uncomment the next line to return response Response(401, Error{}) or use other options such as http.Ok ... + // return Response(401, Error{}), nil + + // TODO: Uncomment the next line to return response Response(404, Error{}) or use other options such as http.Ok ... + // return Response(404, Error{}), nil + + // TODO: Uncomment the next line to return response Response(500, Error{}) or use other options such as http.Ok ... + // return Response(500, Error{}), nil + + return Response(http.StatusNotImplemented, nil), errors.New("UpdateServingEnvironment method not implemented") +} diff --git a/internal/server/openapi/error.go b/internal/server/openapi/error.go new file mode 100644 index 000000000..670c7ca9d --- /dev/null +++ b/internal/server/openapi/error.go @@ -0,0 +1,62 @@ +/* + * Model Registry REST API + * + * REST API for Model Registry to create and manage ML model metadata + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package openapi + +import ( + "errors" + "fmt" + "net/http" +) + +var ( + // ErrTypeAssertionError is thrown when type an interface does not match the asserted type + ErrTypeAssertionError = errors.New("unable to assert type") +) + +// ParsingError indicates that an error has occurred when parsing request parameters +type ParsingError struct { + Err error +} + +func (e *ParsingError) Unwrap() error { + return e.Err +} + +func (e *ParsingError) Error() string { + return e.Err.Error() +} + +// RequiredError indicates that an error has occurred when parsing request parameters +type RequiredError struct { + Field string +} + +func (e *RequiredError) Error() string { + return fmt.Sprintf("required field '%s' is zero value.", e.Field) +} + +// ErrorHandler defines the required method for handling error. You may implement it and inject this into a controller if +// you would like errors to be handled differently from the DefaultErrorHandler +type ErrorHandler func(w http.ResponseWriter, r *http.Request, err error, result *ImplResponse) + +// DefaultErrorHandler defines the default logic on how to handle errors from the controller. Any errors from parsing +// request params will return a StatusBadRequest. Otherwise, the error code originating from the servicer will be used. +func DefaultErrorHandler(w http.ResponseWriter, r *http.Request, err error, result *ImplResponse) { + if _, ok := err.(*ParsingError); ok { + // Handle parsing errors + EncodeJSONResponse(err.Error(), func(i int) *int { return &i }(http.StatusBadRequest), w) + } else if _, ok := err.(*RequiredError); ok { + // Handle missing required errors + EncodeJSONResponse(err.Error(), func(i int) *int { return &i }(http.StatusUnprocessableEntity), w) + } else { + // Handle all other errors + EncodeJSONResponse(err.Error(), &result.Code, w) + } +} diff --git a/internal/server/openapi/helpers.go b/internal/server/openapi/helpers.go new file mode 100644 index 000000000..57e2b44b2 --- /dev/null +++ b/internal/server/openapi/helpers.go @@ -0,0 +1,60 @@ +/* + * Model Registry REST API + * + * REST API for Model Registry to create and manage ML model metadata + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package openapi + +import ( + "reflect" +) + +// Response return a ImplResponse struct filled +func Response(code int, body interface{}) ImplResponse { + return ImplResponse{ + Code: code, + Body: body, + } +} + +// IsZeroValue checks if the val is the zero-ed value. +func IsZeroValue(val interface{}) bool { + return val == nil || reflect.DeepEqual(val, reflect.Zero(reflect.TypeOf(val)).Interface()) +} + +// AssertRecurseInterfaceRequired recursively checks each struct in a slice against the callback. +// This method traverse nested slices in a preorder fashion. +func AssertRecurseInterfaceRequired[T any](obj interface{}, callback func(T) error) error { + return AssertRecurseValueRequired(reflect.ValueOf(obj), callback) +} + +// AssertRecurseValueRequired checks each struct in the nested slice against the callback. +// This method traverse nested slices in a preorder fashion. ErrTypeAssertionError is thrown if +// the underlying struct does not match type T. +func AssertRecurseValueRequired[T any](value reflect.Value, callback func(T) error) error { + switch value.Kind() { + // If it is a struct we check using callback + case reflect.Struct: + obj, ok := value.Interface().(T) + if !ok { + return ErrTypeAssertionError + } + + if err := callback(obj); err != nil { + return err + } + + // If it is a slice we continue recursion + case reflect.Slice: + for i := 0; i < value.Len(); i += 1 { + if err := AssertRecurseValueRequired(value.Index(i), callback); err != nil { + return err + } + } + } + return nil +} diff --git a/internal/server/openapi/impl.go b/internal/server/openapi/impl.go new file mode 100644 index 000000000..0901dc5e0 --- /dev/null +++ b/internal/server/openapi/impl.go @@ -0,0 +1,16 @@ +/* + * Model Registry REST API + * + * REST API for Model Registry to create and manage ML model metadata + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package openapi + +// ImplResponse defines an implementation response with error code and the associated body +type ImplResponse struct { + Code int + Body interface{} +} diff --git a/internal/server/openapi/logger.go b/internal/server/openapi/logger.go new file mode 100644 index 000000000..f8eedd2d6 --- /dev/null +++ b/internal/server/openapi/logger.go @@ -0,0 +1,32 @@ +/* + * Model Registry REST API + * + * REST API for Model Registry to create and manage ML model metadata + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package openapi + +import ( + "log" + "net/http" + "time" +) + +func Logger(inner http.Handler, name string) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + start := time.Now() + + inner.ServeHTTP(w, r) + + log.Printf( + "%s %s %s %s", + r.Method, + r.RequestURI, + name, + time.Since(start), + ) + }) +} diff --git a/internal/server/openapi/routers.go b/internal/server/openapi/routers.go new file mode 100644 index 000000000..04881f7bf --- /dev/null +++ b/internal/server/openapi/routers.go @@ -0,0 +1,297 @@ +/* + * Model Registry REST API + * + * REST API for Model Registry to create and manage ML model metadata + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package openapi + +import ( + "encoding/json" + "errors" + "github.com/go-chi/chi/v5" + "github.com/go-chi/chi/v5/middleware" + "github.com/golang/glog" + "io" + "mime/multipart" + "net/http" + "os" + "strconv" + "strings" +) + +//lint:file-ignore U1000 Ignore all unused code, it's generated + +// A Route defines the parameters for an api endpoint +type Route struct { + Method string + Pattern string + HandlerFunc http.HandlerFunc +} + +// Routes is a map of defined api endpoints +type Routes map[string]Route + +// Router defines the required methods for retrieving api routes +type Router interface { + Routes() Routes +} + +const errMsgRequiredMissing = "required parameter is missing" +const errMsgMinValueConstraint = "provided parameter is not respecting minimum value constraint" +const errMsgMaxValueConstraint = "provided parameter is not respecting maximum value constraint" + +// NewRouter creates a new router for any number of api routers +func NewRouter(routers ...Router) chi.Router { + router := chi.NewRouter() + router.Use(middleware.Logger) + for _, api := range routers { + for _, route := range api.Routes() { + handler := route.HandlerFunc + router.Method(route.Method, route.Pattern, handler) + } + } + + return router +} + +// EncodeJSONResponse uses the json encoder to write an interface to the http response with an optional status code +func EncodeJSONResponse(i interface{}, status *int, w http.ResponseWriter) { + w.Header().Set("Content-Type", "application/json; charset=UTF-8") + if status != nil { + w.WriteHeader(*status) + } else { + w.WriteHeader(http.StatusOK) + } + + if i != nil { + if err := json.NewEncoder(w).Encode(i); err != nil { + // FIXME: is it too late to inform the client of an error at this point?? + glog.Errorf("error encoding JSON response: %v", err) + } + } +} + +// ReadFormFileToTempFile reads file data from a request form and writes it to a temporary file +func ReadFormFileToTempFile(r *http.Request, key string) (*os.File, error) { + _, fileHeader, err := r.FormFile(key) + if err != nil { + return nil, err + } + + return readFileHeaderToTempFile(fileHeader) +} + +// ReadFormFilesToTempFiles reads files array data from a request form and writes it to a temporary files +func ReadFormFilesToTempFiles(r *http.Request, key string) ([]*os.File, error) { + if err := r.ParseMultipartForm(32 << 20); err != nil { + return nil, err + } + + files := make([]*os.File, 0, len(r.MultipartForm.File[key])) + + for _, fileHeader := range r.MultipartForm.File[key] { + file, err := readFileHeaderToTempFile(fileHeader) + if err != nil { + return nil, err + } + + files = append(files, file) + } + + return files, nil +} + +// readFileHeaderToTempFile reads multipart.FileHeader and writes it to a temporary file +func readFileHeaderToTempFile(fileHeader *multipart.FileHeader) (*os.File, error) { + formFile, err := fileHeader.Open() + if err != nil { + return nil, err + } + + defer formFile.Close() + + fileBytes, err := io.ReadAll(formFile) + if err != nil { + return nil, err + } + + file, err := os.CreateTemp("", fileHeader.Filename) + if err != nil { + return nil, err + } + + defer file.Close() + + // FIXME: return values are ignored!!! + _, _ = file.Write(fileBytes) + + return file, nil +} + +type Number interface { + ~int32 | ~int64 | ~float32 | ~float64 +} + +type ParseString[T Number | string | bool] func(v string) (T, error) + +// parseFloat64 parses a string parameter to an float64. +func parseFloat64(param string) (float64, error) { + if param == "" { + return 0, nil + } + + return strconv.ParseFloat(param, 64) +} + +// parseFloat32 parses a string parameter to an float32. +func parseFloat32(param string) (float32, error) { + if param == "" { + return 0, nil + } + + v, err := strconv.ParseFloat(param, 32) + return float32(v), err +} + +// parseInt64 parses a string parameter to an int64. +func parseInt64(param string) (int64, error) { + if param == "" { + return 0, nil + } + + return strconv.ParseInt(param, 10, 64) +} + +// parseInt32 parses a string parameter to an int32. +func parseInt32(param string) (int32, error) { + if param == "" { + return 0, nil + } + + val, err := strconv.ParseInt(param, 10, 32) + return int32(val), err +} + +// parseBool parses a string parameter to an bool. +func parseBool(param string) (bool, error) { + if param == "" { + return false, nil + } + + return strconv.ParseBool(param) +} + +type Operation[T Number | string | bool] func(actual string) (T, bool, error) + +func WithRequire[T Number | string | bool](parse ParseString[T]) Operation[T] { + var empty T + return func(actual string) (T, bool, error) { + if actual == "" { + return empty, false, errors.New(errMsgRequiredMissing) + } + + v, err := parse(actual) + return v, false, err + } +} + +func WithDefaultOrParse[T Number | string | bool](def T, parse ParseString[T]) Operation[T] { + return func(actual string) (T, bool, error) { + if actual == "" { + return def, true, nil + } + + v, err := parse(actual) + return v, false, err + } +} + +func WithParse[T Number | string | bool](parse ParseString[T]) Operation[T] { + return func(actual string) (T, bool, error) { + v, err := parse(actual) + return v, false, err + } +} + +type Constraint[T Number | string | bool] func(actual T) error + +func WithMinimum[T Number](expected T) Constraint[T] { + return func(actual T) error { + if actual < expected { + return errors.New(errMsgMinValueConstraint) + } + + return nil + } +} + +func WithMaximum[T Number](expected T) Constraint[T] { + return func(actual T) error { + if actual > expected { + return errors.New(errMsgMaxValueConstraint) + } + + return nil + } +} + +// parseNumericParameter parses a numeric parameter to its respective type. +func parseNumericParameter[T Number](param string, fn Operation[T], checks ...Constraint[T]) (T, error) { + v, ok, err := fn(param) + if err != nil { + return 0, err + } + + if !ok { + for _, check := range checks { + if err := check(v); err != nil { + return 0, err + } + } + } + + return v, nil +} + +// parseBoolParameter parses a string parameter to a bool +func parseBoolParameter(param string, fn Operation[bool]) (bool, error) { + v, _, err := fn(param) + return v, err +} + +// parseNumericArrayParameter parses a string parameter containing array of values to its respective type. +func parseNumericArrayParameter[T Number](param, delim string, required bool, fn Operation[T], checks ...Constraint[T]) ([]T, error) { + if param == "" { + if required { + return nil, errors.New(errMsgRequiredMissing) + } + + return nil, nil + } + + str := strings.Split(param, delim) + values := make([]T, len(str)) + + for i, s := range str { + v, ok, err := fn(s) + if err != nil { + return nil, err + } + + if !ok { + for _, check := range checks { + if err := check(v); err != nil { + return nil, err + } + } + } + + values[i] = v + } + + return values, nil +} diff --git a/internal/server/openapi/type_asserts.go b/internal/server/openapi/type_asserts.go new file mode 100644 index 000000000..6b8dfc896 --- /dev/null +++ b/internal/server/openapi/type_asserts.go @@ -0,0 +1,652 @@ +/* + * Model Registry REST API + * + * REST API for Model Registry to create and manage ML model metadata + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package openapi + +import ( + model "github.com/opendatahub-io/model-registry/internal/model/openapi" +) + +// AssertArtifactRequired checks if the required fields are not zero-ed +func AssertArtifactRequired(obj model.Artifact) error { + elements := map[string]interface{}{ + "artifactType": obj.ModelArtifact.ArtifactType, + } + for name, el := range elements { + if isZero := IsZeroValue(el); isZero { + return &RequiredError{Field: name} + } + } + + return nil +} + +// AssertArtifactConstraints checks if the values respects the defined constraints +func AssertArtifactConstraints(obj model.Artifact) error { + return nil +} + +// AssertArtifactListRequired checks if the required fields are not zero-ed +func AssertArtifactListRequired(obj model.ArtifactList) error { + elements := map[string]interface{}{ + "nextPageToken": obj.NextPageToken, + "pageSize": obj.PageSize, + "size": obj.Size, + } + for name, el := range elements { + if isZero := IsZeroValue(el); isZero { + return &RequiredError{Field: name} + } + } + + for _, el := range obj.Items { + if err := AssertArtifactRequired(el); err != nil { + return err + } + } + return nil +} + +// AssertArtifactListConstraints checks if the values respects the defined constraints +func AssertArtifactListConstraints(obj model.ArtifactList) error { + return nil +} + + +// AssertArtifactStateRequired checks if the required fields are not zero-ed +func AssertArtifactStateRequired(obj model.ArtifactState) error { + return nil +} + +// AssertArtifactStateConstraints checks if the values respects the defined constraints +func AssertArtifactStateConstraints(obj model.ArtifactState) error { + return nil +} + + +// AssertBaseArtifactCreateRequired checks if the required fields are not zero-ed +func AssertBaseArtifactCreateRequired(obj model.BaseArtifactCreate) error { + return nil +} + +// AssertBaseArtifactCreateConstraints checks if the values respects the defined constraints +func AssertBaseArtifactCreateConstraints(obj model.BaseArtifactCreate) error { + return nil +} + + +// AssertBaseArtifactRequired checks if the required fields are not zero-ed +func AssertBaseArtifactRequired(obj model.BaseArtifact) error { + elements := map[string]interface{}{ + "artifactType": obj.ArtifactType, + } + for name, el := range elements { + if isZero := IsZeroValue(el); isZero { + return &RequiredError{Field: name} + } + } + + return nil +} + +// AssertBaseArtifactConstraints checks if the values respects the defined constraints +func AssertBaseArtifactConstraints(obj model.BaseArtifact) error { + return nil +} + + +// AssertBaseArtifactUpdateRequired checks if the required fields are not zero-ed +func AssertBaseArtifactUpdateRequired(obj model.BaseArtifactUpdate) error { + return nil +} + +// AssertBaseArtifactUpdateConstraints checks if the values respects the defined constraints +func AssertBaseArtifactUpdateConstraints(obj model.BaseArtifactUpdate) error { + return nil +} + + +// AssertBaseExecutionCreateRequired checks if the required fields are not zero-ed +func AssertBaseExecutionCreateRequired(obj model.BaseExecutionCreate) error { + return nil +} + +// AssertBaseExecutionCreateConstraints checks if the values respects the defined constraints +func AssertBaseExecutionCreateConstraints(obj model.BaseExecutionCreate) error { + return nil +} + + +// AssertBaseExecutionRequired checks if the required fields are not zero-ed +func AssertBaseExecutionRequired(obj model.BaseExecution) error { + return nil +} + +// AssertBaseExecutionConstraints checks if the values respects the defined constraints +func AssertBaseExecutionConstraints(obj model.BaseExecution) error { + return nil +} + + +// AssertBaseExecutionUpdateRequired checks if the required fields are not zero-ed +func AssertBaseExecutionUpdateRequired(obj model.BaseExecutionUpdate) error { + return nil +} + +// AssertBaseExecutionUpdateConstraints checks if the values respects the defined constraints +func AssertBaseExecutionUpdateConstraints(obj model.BaseExecutionUpdate) error { + return nil +} + + +// AssertBaseResourceCreateRequired checks if the required fields are not zero-ed +func AssertBaseResourceCreateRequired(obj model.BaseResourceCreate) error { + return nil +} + +// AssertBaseResourceCreateConstraints checks if the values respects the defined constraints +func AssertBaseResourceCreateConstraints(obj model.BaseResourceCreate) error { + return nil +} + + +// AssertBaseResourceRequired checks if the required fields are not zero-ed +func AssertBaseResourceRequired(obj model.BaseResource) error { + return nil +} + +// AssertBaseResourceConstraints checks if the values respects the defined constraints +func AssertBaseResourceConstraints(obj model.BaseResource) error { + return nil +} + + +// AssertBaseResourceListRequired checks if the required fields are not zero-ed +func AssertBaseResourceListRequired(obj model.BaseResourceList) error { + elements := map[string]interface{}{ + "nextPageToken": obj.NextPageToken, + "pageSize": obj.PageSize, + "size": obj.Size, + } + for name, el := range elements { + if isZero := IsZeroValue(el); isZero { + return &RequiredError{Field: name} + } + } + + return nil +} + +// AssertBaseResourceListConstraints checks if the values respects the defined constraints +func AssertBaseResourceListConstraints(obj model.BaseResourceList) error { + return nil +} + + +// AssertBaseResourceUpdateRequired checks if the required fields are not zero-ed +func AssertBaseResourceUpdateRequired(obj model.BaseResourceUpdate) error { + return nil +} + +// AssertBaseResourceUpdateConstraints checks if the values respects the defined constraints +func AssertBaseResourceUpdateConstraints(obj model.BaseResourceUpdate) error { + return nil +} + + +// AssertErrorRequired checks if the required fields are not zero-ed +func AssertErrorRequired(obj model.Error) error { + elements := map[string]interface{}{ + "code": obj.Code, + "message": obj.Message, + } + for name, el := range elements { + if isZero := IsZeroValue(el); isZero { + return &RequiredError{Field: name} + } + } + + return nil +} + +// AssertErrorConstraints checks if the values respects the defined constraints +func AssertErrorConstraints(obj model.Error) error { + return nil +} + + +// AssertExecutionStateRequired checks if the required fields are not zero-ed +func AssertExecutionStateRequired(obj model.ExecutionState) error { + return nil +} + +// AssertExecutionStateConstraints checks if the values respects the defined constraints +func AssertExecutionStateConstraints(obj model.ExecutionState) error { + return nil +} + + +// AssertInferenceServiceCreateRequired checks if the required fields are not zero-ed +func AssertInferenceServiceCreateRequired(obj model.InferenceServiceCreate) error { + elements := map[string]interface{}{ + "registeredModelId": obj.RegisteredModelId, + "servingEnvironmentId": obj.ServingEnvironmentId, + } + for name, el := range elements { + if isZero := IsZeroValue(el); isZero { + return &RequiredError{Field: name} + } + } + + return nil +} + +// AssertInferenceServiceCreateConstraints checks if the values respects the defined constraints +func AssertInferenceServiceCreateConstraints(obj model.InferenceServiceCreate) error { + return nil +} + + +// AssertInferenceServiceRequired checks if the required fields are not zero-ed +func AssertInferenceServiceRequired(obj model.InferenceService) error { + return nil +} + +// AssertInferenceServiceConstraints checks if the values respects the defined constraints +func AssertInferenceServiceConstraints(obj model.InferenceService) error { + return nil +} + + +// AssertInferenceServiceListRequired checks if the required fields are not zero-ed +func AssertInferenceServiceListRequired(obj model.InferenceServiceList) error { + elements := map[string]interface{}{ + "nextPageToken": obj.NextPageToken, + "pageSize": obj.PageSize, + "size": obj.Size, + } + for name, el := range elements { + if isZero := IsZeroValue(el); isZero { + return &RequiredError{Field: name} + } + } + + for _, el := range obj.Items { + if err := AssertInferenceServiceRequired(el); err != nil { + return err + } + } + return nil +} + +// AssertInferenceServiceListConstraints checks if the values respects the defined constraints +func AssertInferenceServiceListConstraints(obj model.InferenceServiceList) error { + return nil +} + + +// AssertInferenceServiceUpdateRequired checks if the required fields are not zero-ed +func AssertInferenceServiceUpdateRequired(obj model.InferenceServiceUpdate) error { + return nil +} + +// AssertInferenceServiceUpdateConstraints checks if the values respects the defined constraints +func AssertInferenceServiceUpdateConstraints(obj model.InferenceServiceUpdate) error { + return nil +} + + +// AssertMetadataValueRequired checks if the required fields are not zero-ed +func AssertMetadataValueRequired(obj model.MetadataValue) error { + return nil +} + +// AssertMetadataValueConstraints checks if the values respects the defined constraints +func AssertMetadataValueConstraints(obj model.MetadataValue) error { + return nil +} + + +// AssertModelArtifactCreateRequired checks if the required fields are not zero-ed +func AssertModelArtifactCreateRequired(obj model.ModelArtifactCreate) error { + return nil +} + +// AssertModelArtifactCreateConstraints checks if the values respects the defined constraints +func AssertModelArtifactCreateConstraints(obj model.ModelArtifactCreate) error { + return nil +} + + +// AssertModelArtifactRequired checks if the required fields are not zero-ed +func AssertModelArtifactRequired(obj model.ModelArtifact) error { + elements := map[string]interface{}{ + "artifactType": obj.ArtifactType, + } + for name, el := range elements { + if isZero := IsZeroValue(el); isZero { + return &RequiredError{Field: name} + } + } + + return nil +} + +// AssertModelArtifactConstraints checks if the values respects the defined constraints +func AssertModelArtifactConstraints(obj model.ModelArtifact) error { + return nil +} + + +// AssertModelArtifactListRequired checks if the required fields are not zero-ed +func AssertModelArtifactListRequired(obj model.ModelArtifactList) error { + elements := map[string]interface{}{ + "nextPageToken": obj.NextPageToken, + "pageSize": obj.PageSize, + "size": obj.Size, + } + for name, el := range elements { + if isZero := IsZeroValue(el); isZero { + return &RequiredError{Field: name} + } + } + + for _, el := range obj.Items { + if err := AssertModelArtifactRequired(el); err != nil { + return err + } + } + return nil +} + +// AssertModelArtifactListConstraints checks if the values respects the defined constraints +func AssertModelArtifactListConstraints(obj model.ModelArtifactList) error { + return nil +} + +// AssertModelArtifactUpdateRequired checks if the required fields are not zero-ed +func AssertModelArtifactUpdateRequired(obj model.ModelArtifactUpdate) error { + return nil +} + +// AssertModelArtifactUpdateConstraints checks if the values respects the defined constraints +func AssertModelArtifactUpdateConstraints(obj model.ModelArtifactUpdate) error { + return nil +} + +// AssertModelVersionCreateRequired checks if the required fields are not zero-ed +func AssertModelVersionCreateRequired(obj model.ModelVersionCreate) error { + elements := map[string]interface{}{ + "registeredModelID": obj.RegisteredModelID, + } + for name, el := range elements { + if isZero := IsZeroValue(el); isZero { + return &RequiredError{Field: name} + } + } + + return nil +} + +// AssertModelVersionCreateConstraints checks if the values respects the defined constraints +func AssertModelVersionCreateConstraints(obj model.ModelVersionCreate) error { + return nil +} + +// AssertModelVersionRequired checks if the required fields are not zero-ed +func AssertModelVersionRequired(obj model.ModelVersion) error { + return nil +} + +// AssertModelVersionConstraints checks if the values respects the defined constraints +func AssertModelVersionConstraints(obj model.ModelVersion) error { + return nil +} + +// AssertModelVersionListRequired checks if the required fields are not zero-ed +func AssertModelVersionListRequired(obj model.ModelVersionList) error { + elements := map[string]interface{}{ + "nextPageToken": obj.NextPageToken, + "pageSize": obj.PageSize, + "size": obj.Size, + } + for name, el := range elements { + if isZero := IsZeroValue(el); isZero { + return &RequiredError{Field: name} + } + } + + for _, el := range obj.Items { + if err := AssertModelVersionRequired(el); err != nil { + return err + } + } + return nil +} + +// AssertModelVersionListConstraints checks if the values respects the defined constraints +func AssertModelVersionListConstraints(obj model.ModelVersionList) error { + return nil +} + +// AssertModelVersionUpdateRequired checks if the required fields are not zero-ed +func AssertModelVersionUpdateRequired(obj model.ModelVersionUpdate) error { + return nil +} + +// AssertModelVersionUpdateConstraints checks if the values respects the defined constraints +func AssertModelVersionUpdateConstraints(obj model.ModelVersionUpdate) error { + return nil +} + +// AssertOrderByFieldRequired checks if the required fields are not zero-ed +func AssertOrderByFieldRequired(obj model.OrderByField) error { + return nil +} + +// AssertOrderByFieldConstraints checks if the values respects the defined constraints +func AssertOrderByFieldConstraints(obj model.OrderByField) error { + return nil +} + +// AssertRegisteredModelCreateRequired checks if the required fields are not zero-ed +func AssertRegisteredModelCreateRequired(obj model.RegisteredModelCreate) error { + return nil +} + +// AssertRegisteredModelCreateConstraints checks if the values respects the defined constraints +func AssertRegisteredModelCreateConstraints(obj model.RegisteredModelCreate) error { + return nil +} + +// AssertRegisteredModelRequired checks if the required fields are not zero-ed +func AssertRegisteredModelRequired(obj model.RegisteredModel) error { + return nil +} + +// AssertRegisteredModelConstraints checks if the values respects the defined constraints +func AssertRegisteredModelConstraints(obj model.RegisteredModel) error { + return nil +} + +// AssertRegisteredModelListRequired checks if the required fields are not zero-ed +func AssertRegisteredModelListRequired(obj model.RegisteredModelList) error { + elements := map[string]interface{}{ + "nextPageToken": obj.NextPageToken, + "pageSize": obj.PageSize, + "size": obj.Size, + } + for name, el := range elements { + if isZero := IsZeroValue(el); isZero { + return &RequiredError{Field: name} + } + } + + for _, el := range obj.Items { + if err := AssertRegisteredModelRequired(el); err != nil { + return err + } + } + return nil +} + +// AssertRegisteredModelListConstraints checks if the values respects the defined constraints +func AssertRegisteredModelListConstraints(obj model.RegisteredModelList) error { + return nil +} + +// AssertRegisteredModelUpdateRequired checks if the required fields are not zero-ed +func AssertRegisteredModelUpdateRequired(obj model.RegisteredModelUpdate) error { + return nil +} + +// AssertRegisteredModelUpdateConstraints checks if the values respects the defined constraints +func AssertRegisteredModelUpdateConstraints(obj model.RegisteredModelUpdate) error { + return nil +} + +// AssertServeModelCreateRequired checks if the required fields are not zero-ed +func AssertServeModelCreateRequired(obj model.ServeModelCreate) error { + elements := map[string]interface{}{ + "modelVersionId": obj.ModelVersionId, + } + for name, el := range elements { + if isZero := IsZeroValue(el); isZero { + return &RequiredError{Field: name} + } + } + + return nil +} + +// AssertServeModelCreateConstraints checks if the values respects the defined constraints +func AssertServeModelCreateConstraints(obj model.ServeModelCreate) error { + return nil +} + +// AssertServeModelRequired checks if the required fields are not zero-ed +func AssertServeModelRequired(obj model.ServeModel) error { + elements := map[string]interface{}{ + "modelVersionId": obj.ModelVersionId, + } + for name, el := range elements { + if isZero := IsZeroValue(el); isZero { + return &RequiredError{Field: name} + } + } + + return nil +} + +// AssertServeModelConstraints checks if the values respects the defined constraints +func AssertServeModelConstraints(obj model.ServeModel) error { + return nil +} + +// AssertServeModelListRequired checks if the required fields are not zero-ed +func AssertServeModelListRequired(obj model.ServeModelList) error { + elements := map[string]interface{}{ + "nextPageToken": obj.NextPageToken, + "pageSize": obj.PageSize, + "size": obj.Size, + } + for name, el := range elements { + if isZero := IsZeroValue(el); isZero { + return &RequiredError{Field: name} + } + } + + for _, el := range obj.Items { + if err := AssertServeModelRequired(el); err != nil { + return err + } + } + return nil +} + +// AssertServeModelListConstraints checks if the values respects the defined constraints +func AssertServeModelListConstraints(obj model.ServeModelList) error { + return nil +} + +// AssertServeModelUpdateRequired checks if the required fields are not zero-ed +func AssertServeModelUpdateRequired(obj model.ServeModelUpdate) error { + return nil +} + +// AssertServeModelUpdateConstraints checks if the values respects the defined constraints +func AssertServeModelUpdateConstraints(obj model.ServeModelUpdate) error { + return nil +} + +// AssertServingEnvironmentCreateRequired checks if the required fields are not zero-ed +func AssertServingEnvironmentCreateRequired(obj model.ServingEnvironmentCreate) error { + return nil +} + +// AssertServingEnvironmentCreateConstraints checks if the values respects the defined constraints +func AssertServingEnvironmentCreateConstraints(obj model.ServingEnvironmentCreate) error { + return nil +} + +// AssertServingEnvironmentRequired checks if the required fields are not zero-ed +func AssertServingEnvironmentRequired(obj model.ServingEnvironment) error { + return nil +} + +// AssertServingEnvironmentConstraints checks if the values respects the defined constraints +func AssertServingEnvironmentConstraints(obj model.ServingEnvironment) error { + return nil +} + +// AssertServingEnvironmentListRequired checks if the required fields are not zero-ed +func AssertServingEnvironmentListRequired(obj model.ServingEnvironmentList) error { + elements := map[string]interface{}{ + "nextPageToken": obj.NextPageToken, + "pageSize": obj.PageSize, + "size": obj.Size, + } + for name, el := range elements { + if isZero := IsZeroValue(el); isZero { + return &RequiredError{Field: name} + } + } + + for _, el := range obj.Items { + if err := AssertServingEnvironmentRequired(el); err != nil { + return err + } + } + return nil +} + +// AssertServingEnvironmentListConstraints checks if the values respects the defined constraints +func AssertServingEnvironmentListConstraints(obj model.ServingEnvironmentList) error { + return nil +} + +// AssertServingEnvironmentUpdateRequired checks if the required fields are not zero-ed +func AssertServingEnvironmentUpdateRequired(obj model.ServingEnvironmentUpdate) error { + return nil +} + +// AssertServingEnvironmentUpdateConstraints checks if the values respects the defined constraints +func AssertServingEnvironmentUpdateConstraints(obj model.ServingEnvironmentUpdate) error { + return nil +} + +// AssertSortOrderRequired checks if the required fields are not zero-ed +func AssertSortOrderRequired(obj model.SortOrder) error { + return nil +} + +// AssertSortOrderConstraints checks if the values respects the defined constraints +func AssertSortOrderConstraints(obj model.SortOrder) error { + return nil +} diff --git a/openapitools.json b/openapitools.json new file mode 100644 index 000000000..4053ae890 --- /dev/null +++ b/openapitools.json @@ -0,0 +1,7 @@ +{ + "$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json", + "spaces": 2, + "generator-cli": { + "version": "7.0.1" + } +}