mirror of
https://github.com/NVIDIA/OpenShell.git
synced 2026-10-19 05:50:41 +08:00
* refactor(persistence): adopt continuation-token pagination Signed-off-by: Drew Newberry <anewberry@nvidia.com> * fix(pagination): address continuation review findings Signed-off-by: Drew Newberry <anewberry@nvidia.com> * fix(tui): recover completed list refreshes Signed-off-by: Drew Newberry <anewberry@nvidia.com> * fix(pagination): address review scalability findings Signed-off-by: Drew Newberry <anewberry@nvidia.com> * fix(pagination): repair branch validation Signed-off-by: Drew Newberry <anewberry@nvidia.com> * docs(go): use page size in template example Signed-off-by: Drew Newberry <anewberry@nvidia.com> --------- Signed-off-by: Drew Newberry <anewberry@nvidia.com>
39 lines
1.0 KiB
Go
39 lines
1.0 KiB
Go
// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package v1
|
|
|
|
import (
|
|
"math"
|
|
|
|
"github.com/NVIDIA/OpenShell/sdk/go/openshell/v1/types"
|
|
)
|
|
|
|
// CreateOptions configures resource creation.
|
|
type CreateOptions = types.CreateOptions
|
|
|
|
// ListOptions configures resource listing with pagination and filtering.
|
|
type ListOptions = types.ListOptions
|
|
|
|
// WatchOptions configures watch behavior.
|
|
type WatchOptions = types.WatchOptions
|
|
|
|
// WaitOptions configures wait behavior. Use context for timeout control.
|
|
type WaitOptions = types.WaitOptions
|
|
|
|
// ExecOptions configures command execution.
|
|
type ExecOptions = types.ExecOptions
|
|
|
|
func listPageSize(opts []ListOptions) (int32, error) {
|
|
if len(opts) == 0 {
|
|
return 0, nil
|
|
}
|
|
if opts[0].PageSize < 0 {
|
|
return 0, &StatusError{Code: ErrorInvalidArgument, Message: "page size must not be negative"}
|
|
}
|
|
if opts[0].PageSize > math.MaxInt32 {
|
|
return math.MaxInt32, nil
|
|
}
|
|
return int32(opts[0].PageSize), nil
|
|
}
|