This is done by inspecting the current hostname to determine if tenancy is enabled. The attestation commands also accepts a --hostname parameter, that is used to pick the current host, similar to how the GH_HOST variable can be used. Signed-off-by: Fredrik Skogman <kommendorkapten@github.com>
37 lines
803 B
Go
37 lines
803 B
Go
package download
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/cli/cli/v2/pkg/cmd/attestation/api"
|
|
"github.com/cli/cli/v2/pkg/cmd/attestation/artifact/oci"
|
|
"github.com/cli/cli/v2/pkg/cmd/attestation/io"
|
|
)
|
|
|
|
const (
|
|
minLimit = 1
|
|
maxLimit = 1000
|
|
)
|
|
|
|
type Options struct {
|
|
APIClient api.Client
|
|
ArtifactPath string
|
|
DigestAlgorithm string
|
|
Logger *io.Handler
|
|
Limit int
|
|
Store MetadataStore
|
|
OCIClient oci.Client
|
|
Owner string
|
|
PredicateType string
|
|
Repo string
|
|
Hostname string
|
|
}
|
|
|
|
func (opts *Options) AreFlagsValid() error {
|
|
// Check that limit is between 1 and 1000
|
|
if opts.Limit < minLimit || opts.Limit > maxLimit {
|
|
return fmt.Errorf("limit %d not allowed, must be between %d and %d", opts.Limit, minLimit, maxLimit)
|
|
}
|
|
|
|
return nil
|
|
}
|