Commit 5ddc7f7d authored by Maksim Khadkevich's avatar Maksim Khadkevich Committed by GitHub
Browse files

feat: moved compoundAI operator, APIserver, and examples (#10)

parent 14ce7e03
/*
* SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package schemasv1
import "github.com/dynemo-ai/dynemo/deploy/compoundai/operator/api/compoundai/modelschemas"
type DeploymentTargetTypeSchema struct {
Type modelschemas.DeploymentTargetType `json:"type" enum:"stable,canary"`
}
type DeploymentTargetSchema struct {
ResourceSchema
DeploymentTargetTypeSchema
Creator *UserSchema `json:"creator"`
Bento *BentoFullSchema `json:"bento"`
CanaryRules *modelschemas.DeploymentTargetCanaryRules `json:"canary_rules"`
Config *modelschemas.DeploymentTargetConfig `json:"config"`
}
type DeploymentTargetListSchema struct {
BaseListSchema
Items []*DeploymentTargetSchema `json:"items"`
}
type CreateDeploymentTargetSchema struct {
DeploymentTargetTypeSchema
BentoRepository string `json:"bento_repository"`
Bento string `json:"bento"`
CanaryRules *modelschemas.DeploymentTargetCanaryRules `json:"canary_rules"`
Config *modelschemas.DeploymentTargetConfig `json:"config"`
}
/*
* SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package schemasv1
import (
"time"
"github.com/dynemo-ai/dynemo/deploy/compoundai/operator/api/compoundai/modelschemas"
)
type EventSchema struct {
BaseSchema
Resource interface{} `json:"resource,omitempty"`
Name string `json:"name,omitempty"`
Status modelschemas.EventStatus `json:"status,omitempty"`
OperationName string `json:"operation_name,omitempty"`
ApiTokenName string `json:"api_token_name,omitempty"`
Creator *UserSchema `json:"creator,omitempty"`
CreatedAt time.Time `json:"created_at,omitempty"`
ResourceDeleted bool `json:"resource_deleted,omitempty"`
}
type EventListSchema struct {
BaseListSchema
Items []*EventSchema `json:"items"`
}
/*
* SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package schemasv1
import (
apiv1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/dynemo-ai/dynemo/deploy/compoundai/operator/api/compoundai/modelschemas"
)
type KubePodStatusSchema struct {
Phase apiv1.PodPhase `json:"phase"`
Ready bool `json:"ready"`
StartTime *metav1.Time `json:"start_time"`
IsOld bool `json:"is_old"`
IsCanary bool `json:"is_canary"`
HostIp string `json:"host_ip"`
}
type KubePodSchema struct {
Name string `json:"name"`
Namespace string `json:"namespace"`
Annotations map[string]string `json:"annotations"`
Labels map[string]string `json:"labels"`
NodeName string `json:"node_name"`
RunnerName *string `json:"runner_name"`
DeploymentTarget *DeploymentTargetSchema `json:"deployment_target"`
CommitId string `json:"commit_id"`
Status KubePodStatusSchema `json:"status"`
RawStatus apiv1.PodStatus `json:"raw_status"`
PodStatus modelschemas.KubePodStatus `json:"pod_status"`
Warnings []apiv1.Event `json:"warnings"`
}
/*
* SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package schemasv1
type KubeResourceSchema struct {
APIVersion string `json:"api_version"`
Kind string `json:"kind"`
Name string `json:"name"`
Namespace string `json:"namespace"`
MatchLabels map[string]string `json:"match_labels"`
}
/*
* SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package schemasv1
import "github.com/dynemo-ai/dynemo/deploy/compoundai/operator/api/compoundai/modelschemas"
type LabelSchema struct {
ResourceSchema
Organization *OrganizationSchema `json:"organization"`
Creator *UserSchema `json:"creator"`
ResourceType modelschemas.ResourceType `json:"resource_type"`
ResourceUid string `json:"resource_uid"`
Key string `json:"key"`
Value string `json:"value"`
}
type LabelListSchema struct {
BaseListSchema
Items []*LabelSchema `json:"labels"`
}
type LabelWithValuesSchema struct {
Key string `json:"key"`
Values []string `json:"values"`
}
type CreateLabelSchema struct {
Key string `json:"key"`
Value string `json:"value"`
}
type UpdateLabelSchema struct {
Value string `json:"value"`
}
/*
* SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package schemasv1
type BaseListSchema struct {
Total uint `json:"total"`
Start uint `json:"start"`
Count uint `json:"count"`
}
type ListQuerySchema struct {
Start uint `query:"start"`
Count uint `query:"count"`
Search *string `query:"search"`
Q Q `query:"q"`
}
/*
* SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package schemasv1
import "github.com/dynemo-ai/dynemo/deploy/compoundai/operator/api/compoundai/modelschemas"
type CreateMembersSchema struct {
Usernames []string `json:"usernames"`
Role modelschemas.MemberRole `json:"role" enum:"guest,developer,admin"`
}
type DeleteMemberSchema struct {
Username string `json:"username"`
}
/*
* SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package schemasv1
import (
"time"
"github.com/dynemo-ai/dynemo/deploy/compoundai/operator/api/compoundai/modelschemas"
)
type ModelSchema struct {
ResourceSchema
ModelUid string `json:"model_uid"`
Creator *UserSchema `json:"creator"`
Version string `json:"version"`
Description string `json:"description"`
ImageBuildStatus modelschemas.ImageBuildStatus `json:"image_build_status"`
UploadStatus modelschemas.ModelUploadStatus `json:"upload_status"`
UploadStartedAt *time.Time `json:"upload_started_at"`
UploadFinishedAt *time.Time `json:"upload_finished_at"`
UploadFinishedReason string `json:"upload_finished_reason"`
PresignedUploadUrl string `json:"presigned_upload_url"`
PresignedDownloadUrl string `json:"presigned_download_url"`
PresignedUrlsDeprecated bool `json:"presigned_urls_deprecated"`
TransmissionStrategy *modelschemas.TransmissionStrategy `json:"transmission_strategy"`
UploadId string `json:"upload_id"`
Manifest *modelschemas.ModelManifestSchema `json:"manifest"`
BuildAt time.Time `json:"build_at"`
}
type ModelListSchema struct {
BaseListSchema
Items []*ModelSchema `json:"items"`
}
type ModelWithRepositorySchema struct {
ModelSchema
Repository *ModelRepositorySchema `json:"repository"`
}
type ModelWithRepositoryListSchema struct {
BaseListSchema
Items []*ModelWithRepositorySchema `json:"items"`
}
type ModelFullSchema struct {
ModelWithRepositorySchema
Bentos []*BentoSchema `json:"bentos"`
}
type CreateModelSchema struct {
Version string `json:"version"`
Description string `json:"description"`
Manifest *modelschemas.ModelManifestSchema `json:"manifest"`
BuildAt string `json:"build_at"`
Labels modelschemas.LabelItemsSchema `json:"labels"`
}
type UpdateModelSchema struct {
Description string `json:"description,omitempty"`
Manifest *modelschemas.ModelManifestSchema `json:"manifest"`
BuildAt string `json:"build_at"`
Labels *modelschemas.LabelItemsSchema `json:"labels,omitempty"`
}
type FinishUploadModelSchema struct {
Status *modelschemas.ModelUploadStatus `json:"status"`
Reason *string `json:"reason"`
}
/*
* SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package schemasv1
import "github.com/dynemo-ai/dynemo/deploy/compoundai/operator/api/compoundai/modelschemas"
type ModelRepositorySchema struct {
ResourceSchema
Creator *UserSchema `json:"creator"`
Organization *OrganizationSchema `json:"organization"`
LatestModel *ModelSchema `json:"latest_model"`
Description string `json:"description"`
}
type ModelRepositoryListSchema struct {
BaseListSchema
Items []*ModelRepositorySchema `json:"items"`
}
type CreateModelRepositorySchema struct {
Name string `json:"name"`
Description string `json:"description"`
Labels modelschemas.LabelItemsSchema `json:"labels"`
}
type UpdateModelRepositorySchema struct {
Description *string `json:"description"`
Labels *modelschemas.LabelItemsSchema `json:"labels,omitempty"`
}
/*
* SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package schemasv1
type MsgSchema struct {
Message string `json:"message"`
}
type WsMsgSchema struct {
Type string `json:"type"`
Message string `json:"message"`
}
/*
* SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package schemasv1
import "github.com/dynemo-ai/dynemo/deploy/compoundai/operator/api/compoundai/modelschemas"
type OrganizationSchema struct {
ResourceSchema
Creator *UserSchema `json:"creator"`
Description string `json:"description"`
}
type OrganizationFullSchema struct {
OrganizationSchema
Config **modelschemas.OrganizationConfigSchema `json:"config"`
}
type OrganizationListSchema struct {
BaseListSchema
Items []*OrganizationSchema `json:"items"`
}
type UpdateOrganizationSchema struct {
Description *string `json:"description"`
Config **modelschemas.OrganizationConfigSchema `json:"config"`
}
type CreateOrganizationSchema struct {
Name string `json:"name"`
Description string `json:"description"`
Config *modelschemas.OrganizationConfigSchema `json:"config"`
}
/*
* SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package schemasv1
import "github.com/dynemo-ai/dynemo/deploy/compoundai/operator/api/compoundai/modelschemas"
type OrganizationMemberSchema struct {
BaseSchema
Role modelschemas.MemberRole `json:"role"`
Creator *UserSchema `json:"creator"`
User UserSchema `json:"user"`
Organization OrganizationSchema `json:"organization"`
}
/*
* SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package schemasv1
import (
"strings"
"github.com/huandu/xstrings"
)
const ValueQMe = "@me"
const KeyQKeywords = "__keywords"
const KeyQIn = "in"
type Q string
func (q Q) ToMap() map[string]interface{} {
res := map[string]interface{}{}
for _, piece := range strings.Split(string(q), " ") {
piece = strings.TrimSpace(piece)
if piece == "" {
continue
}
var k string
var v string
if !strings.Contains(piece, ":") {
k = KeyQKeywords
v = piece
} else {
k, _, v = xstrings.Partition(piece, ":")
if v == "" {
continue
}
if k == "is" {
res[v] = true
continue
}
if k == "not" {
res[v] = false
continue
}
}
v_, ok := res[k]
if !ok {
v_ = make([]string, 0)
}
v_ = append(v_.([]string), v)
res[k] = v_
}
return res
}
/*
* SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package schemasv1
import "github.com/dynemo-ai/dynemo/deploy/compoundai/operator/api/compoundai/modelschemas"
type IResourceSchema interface {
GetType() modelschemas.ResourceType
GetName() string
}
type ResourceSchema struct {
BaseSchema
Name string `json:"name"`
ResourceType modelschemas.ResourceType `json:"resource_type" enum:"user,organization,cluster,bento_repository,bento,deployment,deployment_revision,model_repository,model,api_token"`
Labels modelschemas.LabelItemsSchema `json:"labels"`
}
func (r ResourceSchema) GetType() modelschemas.ResourceType {
return r.ResourceType
}
func (r ResourceSchema) GetName() string {
return r.Name
}
func (s *ResourceSchema) TypeName() string {
return string(s.ResourceType)
}
/*
* SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package schemasv1
import "github.com/dynemo-ai/dynemo/deploy/compoundai/operator/api/compoundai/modelschemas"
type SubscriptionAction string
const (
SubscriptionActionSubscribe SubscriptionAction = "subscribe"
SubscriptionActionUnsubscribe SubscriptionAction = "unsubscribe"
)
type SubscriptionRespSchema struct {
ResourceType modelschemas.ResourceType `json:"resource_type"`
Payload interface{} `json:"payload"`
}
type SubscriptionReqSchema struct {
WsReqSchema
Payload *struct {
Action SubscriptionAction `json:"action"`
ResourceType modelschemas.ResourceType `json:"resource_type"`
ResourceUids []string `json:"resource_uids"`
} `json:"payload"`
}
/*
* SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package schemasv1
type TerminalRecordSchema struct {
ResourceSchema
Creator *UserSchema `json:"creator"`
Organization *OrganizationSchema `json:"organization"`
Cluster *ClusterSchema `json:"cluster"`
Deployment *DeploymentSchema `json:"deployment"`
Resource *ResourceSchema `json:"resource"`
PodName string `json:"pod_name"`
ContainerName string `json:"container_name"`
}
type TerminalRecordListSchema struct {
BaseListSchema
Items []*TerminalRecordSchema `json:"items"`
}
/*
* SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package schemasv1
type CompletePartSchema struct {
PartNumber int `json:"part_number" binding:"required"`
ETag string `json:"etag" binding:"required"`
}
type PreSignMultipartUploadSchema struct {
UploadId string `json:"upload_id" binding:"required"`
PartNumber int `json:"part_number" binding:"required"`
}
type CompleteMultipartUploadSchema struct {
UploadId string `json:"upload_id" binding:"required"`
Parts []CompletePartSchema `json:"parts" binding:"required"`
}
/*
* SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package schemasv1
import "github.com/dynemo-ai/dynemo/deploy/compoundai/operator/api/compoundai/modelschemas"
type UserSchema struct {
ResourceSchema
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
Email string `json:"email"`
AvatarUrl string `json:"avatar_url"`
IsSuperAdmin bool `json:"is_super_admin"`
}
type UserListSchema struct {
BaseListSchema
Items []*UserSchema `json:"items"`
}
type RegisterUserSchema struct {
Name string `json:"name" validate:"required"`
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
Email string `json:"email" validate:"required"`
Password string `json:"password" validate:"required"`
}
type LoginUserSchema struct {
NameOrEmail string `json:"name_or_email" validate:"required"`
Password string `json:"password" validate:"required"`
}
type UpdateUserSchema struct {
FirstName string `json:"first_name" validate:"required"`
LastName string `json:"last_name" validate:"required"`
}
type ResetPasswordSchema struct {
CurrentPassword string `json:"current_password"`
NewPassword string `json:"new_password"`
}
type CreateUserSchema struct {
Name string `json:"name" validate:"required"`
Email string `json:"email" validate:"required"`
Password string `json:"password" validate:"required"`
Role modelschemas.MemberRole `json:"role" enum:"guest,developer,admin"`
}
/*
* SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package schemasv1
type VersionSchema struct {
Version string `json:"version"`
GitCommit string `json:"git_commit"`
BuildDate string `json:"build_date"`
}
/*
* SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package schemasv1
type WsReqType string
const (
WsReqTypeData WsReqType = "data"
WsReqTypeHeartbeat WsReqType = "heartbeat"
)
type WsReqSchema struct {
Type WsReqType `json:"type"`
Payload interface{} `json:"payload"`
}
type WsRespType string
const (
WsRespTypeSuccess WsRespType = "success"
WsRespTypeError WsRespType = "error"
)
type WsRespSchema struct {
Type WsRespType `json:"type"`
Message string `json:"message"`
Payload interface{} `json:"payload"`
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment