cmd

package
v0.28.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 26, 2026 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation ¶

Index ¶

Constants ¶

View Source
const (
	API_KEY_ROLE_ADMIN = "Admin"
	API_KEY_ROLE_DEV   = "Dev"
	API_KEY_ROLE_EXT   = "Ext"
)
View Source
const GitHubRepo = "codesphere-cloud/oms"

Variables ¶

This section is empty.

Functions ¶

func AddApiKeyUpdateCmd ¶ added in v0.12.0

func AddApiKeyUpdateCmd(parentCmd *cobra.Command)

func AddBetaCmd ¶ added in v0.10.0

func AddBetaCmd(rootCmd *cobra.Command, opts *GlobalOptions)

func AddBootstrapGcpCmd ¶ added in v0.24.0

func AddBootstrapGcpCmd(root *cobra.Command, opts *GlobalOptions)

func AddBuildCmd ¶ added in v0.15.0

func AddBuildCmd(rootCmd *cobra.Command, opts *GlobalOptions)

func AddBuildImageCmd ¶ added in v0.15.0

func AddBuildImageCmd(parentCmd *cobra.Command, opts *GlobalOptions)

func AddBuildImagesCmd ¶ added in v0.15.0

func AddBuildImagesCmd(build *cobra.Command, opts *GlobalOptions)

func AddDownloadCmd ¶

func AddDownloadCmd(rootCmd *cobra.Command, opts *GlobalOptions)

func AddDownloadK0sCmd ¶ added in v0.17.0

func AddDownloadK0sCmd(download *cobra.Command, opts *GlobalOptions)

func AddDownloadPackageCmd ¶

func AddDownloadPackageCmd(download *cobra.Command, opts *GlobalOptions)

func AddExtendBaseimageCmd ¶ added in v0.10.0

func AddExtendBaseimageCmd(extend *cobra.Command, opts *GlobalOptions)

func AddExtendCmd ¶ added in v0.10.0

func AddExtendCmd(rootCmd *cobra.Command, opts *GlobalOptions)

func AddInitCmd ¶ added in v0.17.0

func AddInitCmd(rootCmd *cobra.Command, opts *GlobalOptions)

func AddInitInstallConfigCmd ¶ added in v0.17.0

func AddInitInstallConfigCmd(init *cobra.Command, opts *GlobalOptions)

func AddInstallCephCmd ¶

func AddInstallCephCmd(install *cobra.Command)

func AddInstallCmd ¶

func AddInstallCmd(rootCmd *cobra.Command, opts *GlobalOptions)

func AddInstallCodesphereCmd ¶

func AddInstallCodesphereCmd(install *cobra.Command, opts *GlobalOptions)

func AddInstallK0sCmd ¶ added in v0.17.0

func AddInstallK0sCmd(install *cobra.Command, opts *GlobalOptions)

func AddLicensesCmd ¶ added in v0.14.0

func AddLicensesCmd(rootCmd *cobra.Command)

func AddListAPIKeysCmd ¶ added in v0.11.0

func AddListAPIKeysCmd(list *cobra.Command, opts *GlobalOptions)

func AddListCmd ¶

func AddListCmd(rootCmd *cobra.Command, opts *GlobalOptions)

func AddListPackagesCmd ¶

func AddListPackagesCmd(list *cobra.Command, opts *GlobalOptions)

func AddOmsUpdateCmd ¶ added in v0.12.0

func AddOmsUpdateCmd(parentCmd *cobra.Command)

func AddRegisterCmd ¶

func AddRegisterCmd(list *cobra.Command, opts *GlobalOptions)

func AddRevokeAPIKeyCmd ¶ added in v0.9.0

func AddRevokeAPIKeyCmd(list *cobra.Command, opts *GlobalOptions)

func AddRevokeCmd ¶

func AddRevokeCmd(rootCmd *cobra.Command, opts *GlobalOptions)

func AddUpdateCmd ¶

func AddUpdateCmd(rootCmd *cobra.Command, opts *GlobalOptions)

func AddUpdateDockerfileCmd ¶ added in v0.15.0

func AddUpdateDockerfileCmd(parentCmd *cobra.Command, opts *GlobalOptions)

func AddUpdateInstallConfigCmd ¶ added in v0.21.0

func AddUpdateInstallConfigCmd(update *cobra.Command, opts *GlobalOptions)

func AddUpgradeCephCmd ¶

func AddUpgradeCephCmd(upgrade *cobra.Command)

func AddUpgradeCmd ¶

func AddUpgradeCmd(rootCmd *cobra.Command)

func AddUpgradeCodesphereCmd ¶

func AddUpgradeCodesphereCmd(upgrade *cobra.Command)

func AddVersionCmd ¶

func AddVersionCmd(rootCmd *cobra.Command)

func Execute ¶

func Execute()

Execute executes the root command. This is called by main.main(). It only needs to happen once to the rootCmd.

func GetRootCmd ¶

func GetRootCmd() *cobra.Command

GetRootCmd adds all child commands to the root command and sets flags appropriately.

Types ¶

type BetaCmd ¶ added in v0.10.0

type BetaCmd struct {
	// contains filtered or unexported fields
}

type BootstrapGcpCmd ¶ added in v0.24.0

type BootstrapGcpCmd struct {
	Opts          *GlobalOptions
	Env           env.Env
	CodesphereEnv *bootstrap.CodesphereEnvironment

	InputRegistryType string
	// contains filtered or unexported fields
}

func (*BootstrapGcpCmd) BootstrapGcp ¶ added in v0.24.0

func (c *BootstrapGcpCmd) BootstrapGcp() error

func (*BootstrapGcpCmd) RunE ¶ added in v0.24.0

func (c *BootstrapGcpCmd) RunE(_ *cobra.Command, args []string) error

type BuildCmd ¶ added in v0.15.0

type BuildCmd struct {
	// contains filtered or unexported fields
}

BuildCmd represents the build command

type BuildImageCmd ¶ added in v0.15.0

type BuildImageCmd struct {
	Opts BuildImageOpts
	Env  env.Env
	// contains filtered or unexported fields
}

BuildImageCmd represents the build image command

func (*BuildImageCmd) BuildImage ¶ added in v0.15.0

AddBuildImageCmd adds the build image command to the parent command

func (*BuildImageCmd) RunE ¶ added in v0.15.0

func (c *BuildImageCmd) RunE(cmd *cobra.Command, args []string) error

type BuildImageOpts ¶ added in v0.15.0

type BuildImageOpts struct {
	*GlobalOptions
	Dockerfile string
	Package    string
	Registry   string
	Force      bool
}

type BuildImagesCmd ¶ added in v0.15.0

type BuildImagesCmd struct {
	Opts *BuildImagesOpts
	Env  env.Env
	// contains filtered or unexported fields
}

BuildImagesCmd represents the build images command

func (*BuildImagesCmd) BuildAndPushImages ¶ added in v0.15.0

func (*BuildImagesCmd) RunE ¶ added in v0.15.0

func (c *BuildImagesCmd) RunE(_ *cobra.Command, args []string) error

type BuildImagesOpts ¶ added in v0.15.0

type BuildImagesOpts struct {
	*GlobalOptions
	Config string
	Force  bool
}

type DownloadCmd ¶

type DownloadCmd struct {
	// contains filtered or unexported fields
}

DownloadCmd represents the download command

type DownloadK0sCmd ¶ added in v0.17.0

type DownloadK0sCmd struct {
	Opts       DownloadK0sOpts
	Env        env.Env
	FileWriter util.FileIO
	// contains filtered or unexported fields
}

DownloadK0sCmd represents the k0s download command

func (*DownloadK0sCmd) DownloadK0s ¶ added in v0.17.0

func (c *DownloadK0sCmd) DownloadK0s(k0s installer.K0sManager) error

func (*DownloadK0sCmd) RunE ¶ added in v0.17.0

func (c *DownloadK0sCmd) RunE(_ *cobra.Command, args []string) error

type DownloadK0sOpts ¶ added in v0.17.0

type DownloadK0sOpts struct {
	*GlobalOptions
	Version string
	Force   bool
	Quiet   bool
}

type DownloadPackageCmd ¶

type DownloadPackageCmd struct {
	Opts       DownloadPackageOpts
	FileWriter util.FileIO
	// contains filtered or unexported fields
}

DownloadPackageCmd represents the package command

func (*DownloadPackageCmd) DownloadBuild ¶

func (c *DownloadPackageCmd) DownloadBuild(p portal.Portal, build portal.Build, filename string) error

func (*DownloadPackageCmd) RunE ¶

func (c *DownloadPackageCmd) RunE(_ *cobra.Command, args []string) error

type DownloadPackageOpts ¶

type DownloadPackageOpts struct {
	*GlobalOptions
	Version  string
	Hash     string
	Filename string
	Quiet    bool
}

type ExtendBaseimageCmd ¶ added in v0.10.0

type ExtendBaseimageCmd struct {
	Opts *ExtendBaseimageOpts
	Env  env.Env
	// contains filtered or unexported fields
}

ExtendBaseimageCmd represents the baseimage command

func (*ExtendBaseimageCmd) ExtendBaseimage ¶ added in v0.10.0

func (*ExtendBaseimageCmd) RunE ¶ added in v0.10.0

func (c *ExtendBaseimageCmd) RunE(_ *cobra.Command, args []string) error

type ExtendBaseimageOpts ¶ added in v0.10.0

type ExtendBaseimageOpts struct {
	*GlobalOptions
	Package    string
	Dockerfile string
	Baseimage  string
	Force      bool
}

type ExtendCmd ¶ added in v0.10.0

type ExtendCmd struct {
	// contains filtered or unexported fields
}

ExtendCmd represents the extend command

type GlobalOptions ¶

type GlobalOptions struct {
	OmsPortalApiKey string
}

type InitCmd ¶ added in v0.17.0

type InitCmd struct {
	// contains filtered or unexported fields
}

type InitInstallConfigCmd ¶ added in v0.17.0

type InitInstallConfigCmd struct {
	Opts       *InitInstallConfigOpts
	FileWriter util.FileIO
	// contains filtered or unexported fields
}

func (*InitInstallConfigCmd) InitInstallConfig ¶ added in v0.17.0

func (c *InitInstallConfigCmd) InitInstallConfig(icg installer.InstallConfigManager) error

func (*InitInstallConfigCmd) RunE ¶ added in v0.17.0

func (c *InitInstallConfigCmd) RunE(_ *cobra.Command, args []string) error

type InitInstallConfigOpts ¶ added in v0.17.0

type InitInstallConfigOpts struct {
	*GlobalOptions

	ConfigFile string
	VaultFile  string

	Profile        string
	ValidateOnly   bool
	WithComments   bool
	Interactive    bool
	GenerateKeys   bool
	SecretsBaseDir string

	DatacenterID          int
	DatacenterName        string
	DatacenterCity        string
	DatacenterCountryCode string

	RegistryServer              string
	RegistryReplaceImagesInBom  bool
	RegistryLoadContainerImages bool

	PostgresMode            string
	PostgresPrimaryIP       string
	PostgresPrimaryHostname string
	PostgresReplicaIP       string
	PostgresReplicaName     string
	PostgresServerAddress   string

	CephNodesSubnet string
	CephHosts       []files.CephHostConfig

	KubernetesManagedByCodesphere bool
	KubernetesAPIServerHost       string
	KubernetesControlPlanes       []string
	KubernetesWorkers             []string
	KubernetesPodCIDR             string
	KubernetesServiceCIDR         string

	ClusterGatewayServiceType       string
	ClusterGatewayIPAddresses       []string
	ClusterPublicGatewayServiceType string
	ClusterPublicGatewayIPAddresses []string

	MetalLBEnabled bool
	MetalLBPools   []files.MetalLBPool

	CodesphereDomain                       string
	CodespherePublicIP                     string
	CodesphereWorkspaceHostingBaseDomain   string
	CodesphereCustomDomainsCNameBaseDomain string
	CodesphereDNSServers                   []string
	CodesphereWorkspaceImageBomRef         string
	CodesphereHostingPlanCPUTenth          int
	CodesphereHostingPlanMemoryMb          int
	CodesphereHostingPlanStorageMb         int
	CodesphereHostingPlanTempStorageMb     int
	CodesphereWorkspacePlanName            string
	CodesphereWorkspacePlanMaxReplicas     int
}

type InstallCephCmd ¶

type InstallCephCmd struct {
	// contains filtered or unexported fields
}

InstallCephCmd represents the ceph command

type InstallCmd ¶

type InstallCmd struct {
	// contains filtered or unexported fields
}

InstallCmd represents the install command

type InstallCodesphereCmd ¶

type InstallCodesphereCmd struct {
	Opts *InstallCodesphereOpts
	Env  env.Env
	// contains filtered or unexported fields
}

InstallCodesphereCmd represents the codesphere command

func (*InstallCodesphereCmd) ExtractAndInstall ¶ added in v0.14.0

func (*InstallCodesphereCmd) ExtractRootImageName ¶ added in v0.15.0

func (c *InstallCodesphereCmd) ExtractRootImageName(bomRef string) string

ExtractRootImageName extracts the root image name from a bomRef string.

func (*InstallCodesphereCmd) ListPackageContents ¶ added in v0.14.0

func (c *InstallCodesphereCmd) ListPackageContents(pm installer.PackageManager) ([]string, error)

func (*InstallCodesphereCmd) RunE ¶

func (c *InstallCodesphereCmd) RunE(_ *cobra.Command, args []string) error

type InstallCodesphereOpts ¶ added in v0.14.0

type InstallCodesphereOpts struct {
	*GlobalOptions
	Package   string
	Force     bool
	Config    string
	PrivKey   string
	SkipSteps []string
}

type InstallK0sCmd ¶ added in v0.17.0

type InstallK0sCmd struct {
	Opts       InstallK0sOpts
	Env        env.Env
	FileWriter util.FileIO
	// contains filtered or unexported fields
}

InstallK0sCmd represents the k0s download command

func (*InstallK0sCmd) InstallK0s ¶ added in v0.17.0

func (*InstallK0sCmd) RunE ¶ added in v0.17.0

func (c *InstallK0sCmd) RunE(_ *cobra.Command, args []string) error

type InstallK0sOpts ¶ added in v0.17.0

type InstallK0sOpts struct {
	*GlobalOptions
	Version string
	Package string
	Config  string
	Force   bool
}

type LicensesCmd ¶ added in v0.14.0

type LicensesCmd struct {
	// contains filtered or unexported fields
}

func (*LicensesCmd) RunE ¶ added in v0.14.0

func (c *LicensesCmd) RunE(_ *cobra.Command, args []string) error

type ListAPIKeysCmd ¶ added in v0.11.0

type ListAPIKeysCmd struct {
	TableWriter util.TableWriter
	// contains filtered or unexported fields
}

func (*ListAPIKeysCmd) PrintKeysTable ¶ added in v0.11.0

func (c *ListAPIKeysCmd) PrintKeysTable(keys []portal.ApiKey)

func (*ListAPIKeysCmd) RunE ¶ added in v0.11.0

func (c *ListAPIKeysCmd) RunE(_ *cobra.Command, args []string) error

type ListBuildsCmd ¶

type ListBuildsCmd struct {
	Opts        ListBuildsOpts
	TableWriter util.TableWriter
	// contains filtered or unexported fields
}

func (*ListBuildsCmd) PrintPackagesTable ¶

func (c *ListBuildsCmd) PrintPackagesTable(packages portal.Builds)

func (*ListBuildsCmd) RunE ¶

func (c *ListBuildsCmd) RunE(_ *cobra.Command, args []string) error

type ListBuildsOpts ¶

type ListBuildsOpts struct {
	*GlobalOptions
	Internal bool
}

type ListCmd ¶

type ListCmd struct {
	// contains filtered or unexported fields
}

type MockOMSUpdater ¶ added in v0.12.0

type MockOMSUpdater struct {
	mock.Mock
}

MockOMSUpdater is an autogenerated mock type for the OMSUpdater type

func NewMockOMSUpdater ¶ added in v0.12.0

func NewMockOMSUpdater(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockOMSUpdater

NewMockOMSUpdater creates a new instance of MockOMSUpdater. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockOMSUpdater) EXPECT ¶ added in v0.12.0

func (*MockOMSUpdater) Update ¶ added in v0.13.0

func (_mock *MockOMSUpdater) Update(ctx context.Context, current string, repo selfupdate.Repository) (string, string, error)

Update provides a mock function for the type MockOMSUpdater

type MockOMSUpdater_Expecter ¶ added in v0.12.0

type MockOMSUpdater_Expecter struct {
	// contains filtered or unexported fields
}

func (*MockOMSUpdater_Expecter) Update ¶ added in v0.13.0

func (_e *MockOMSUpdater_Expecter) Update(ctx interface{}, current interface{}, repo interface{}) *MockOMSUpdater_Update_Call

Update is a helper method to define mock.On call

  • ctx context.Context
  • current string
  • repo selfupdate.Repository

type MockOMSUpdater_Update_Call ¶ added in v0.13.0

type MockOMSUpdater_Update_Call struct {
	*mock.Call
}

MockOMSUpdater_Update_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Update'

func (*MockOMSUpdater_Update_Call) Return ¶ added in v0.13.0

func (*MockOMSUpdater_Update_Call) Run ¶ added in v0.13.0

func (*MockOMSUpdater_Update_Call) RunAndReturn ¶ added in v0.13.0

type OMSSelfUpdater ¶ added in v0.12.0

type OMSSelfUpdater struct{}

func (*OMSSelfUpdater) Update ¶ added in v0.13.0

func (s *OMSSelfUpdater) Update(ctx context.Context, current string, repo selfupdate.Repository) (string, string, error)

type OMSUpdater ¶ added in v0.12.0

type OMSUpdater interface {
	Update(ctx context.Context, current string, repo selfupdate.Repository) (string, string, error)
}

type RegisterCmd ¶

type RegisterCmd struct {
	Opts RegisterOpts
	// contains filtered or unexported fields
}

func (*RegisterCmd) Register ¶

func (c *RegisterCmd) Register(p portal.Portal) (*portal.ApiKey, error)

func (*RegisterCmd) RunE ¶

func (c *RegisterCmd) RunE(_ *cobra.Command, args []string) error

type RegisterOpts ¶

type RegisterOpts struct {
	*GlobalOptions
	Owner        string
	Organization string
	Role         string
	ExpiresAt    string
}

type RevokeAPIKeyCmd ¶ added in v0.9.0

type RevokeAPIKeyCmd struct {
	Opts RevokeAPIKeyOpts
	// contains filtered or unexported fields
}

func (*RevokeAPIKeyCmd) Revoke ¶ added in v0.9.0

func (c *RevokeAPIKeyCmd) Revoke(p portal.Portal) error

func (*RevokeAPIKeyCmd) RunE ¶ added in v0.9.0

func (c *RevokeAPIKeyCmd) RunE(_ *cobra.Command, args []string) error

type RevokeAPIKeyOpts ¶ added in v0.9.0

type RevokeAPIKeyOpts struct {
	*GlobalOptions
	ID string
}

type RevokeCmd ¶

type RevokeCmd struct {
	// contains filtered or unexported fields
}

type SecretDependencyTracker ¶ added in v0.21.0

type SecretDependencyTracker struct {
	// contains filtered or unexported fields
}

func NewSecretDependencyTracker ¶ added in v0.21.0

func NewSecretDependencyTracker() *SecretDependencyTracker

func (*SecretDependencyTracker) HasChanges ¶ added in v0.21.0

func (t *SecretDependencyTracker) HasChanges() bool

func (*SecretDependencyTracker) MarkPostgresPrimaryCertNeedsRegen ¶ added in v0.21.0

func (t *SecretDependencyTracker) MarkPostgresPrimaryCertNeedsRegen()

func (*SecretDependencyTracker) MarkPostgresReplicaCertNeedsRegen ¶ added in v0.21.0

func (t *SecretDependencyTracker) MarkPostgresReplicaCertNeedsRegen()

func (*SecretDependencyTracker) NeedsPostgresPrimaryCertRegen ¶ added in v0.21.0

func (t *SecretDependencyTracker) NeedsPostgresPrimaryCertRegen() bool

func (*SecretDependencyTracker) NeedsPostgresReplicaCertRegen ¶ added in v0.21.0

func (t *SecretDependencyTracker) NeedsPostgresReplicaCertRegen() bool

type UpdateAPIKeyCmd ¶ added in v0.12.0

type UpdateAPIKeyCmd struct {
	Opts UpdateAPIKeyOpts
}

func (*UpdateAPIKeyCmd) UpdateAPIKey ¶ added in v0.12.0

func (c *UpdateAPIKeyCmd) UpdateAPIKey(p portal.Portal) error

type UpdateAPIKeyOpts ¶ added in v0.12.0

type UpdateAPIKeyOpts struct {
	*GlobalOptions
	APIKeyID     string
	ExpiresAtStr string
}

type UpdateCmd ¶

type UpdateCmd struct {
	// contains filtered or unexported fields
}

type UpdateDockerfileCmd ¶ added in v0.15.0

type UpdateDockerfileCmd struct {
	Opts UpdateDockerfileOpts
	Env  env.Env
	// contains filtered or unexported fields
}

func (*UpdateDockerfileCmd) RunE ¶ added in v0.15.0

func (c *UpdateDockerfileCmd) RunE(_ *cobra.Command, args []string) error

func (*UpdateDockerfileCmd) UpdateDockerfile ¶ added in v0.15.0

func (c *UpdateDockerfileCmd) UpdateDockerfile(pm installer.PackageManager, im system.ImageManager, args []string) error

type UpdateDockerfileOpts ¶ added in v0.15.0

type UpdateDockerfileOpts struct {
	*GlobalOptions
	Package    string
	Dockerfile string
	Baseimage  string
	Force      bool
}

type UpdateInstallConfigCmd ¶ added in v0.21.0

type UpdateInstallConfigCmd struct {
	Opts       *UpdateInstallConfigOpts
	FileWriter util.FileIO
	// contains filtered or unexported fields
}

func (*UpdateInstallConfigCmd) RunE ¶ added in v0.21.0

func (c *UpdateInstallConfigCmd) RunE(_ *cobra.Command, args []string) error

func (*UpdateInstallConfigCmd) UpdateInstallConfig ¶ added in v0.21.0

func (c *UpdateInstallConfigCmd) UpdateInstallConfig(icg installer.InstallConfigManager) error

type UpdateInstallConfigOpts ¶ added in v0.21.0

type UpdateInstallConfigOpts struct {
	*GlobalOptions

	ConfigFile string
	VaultFile  string

	WithComments bool

	// Fields that can be updated
	PostgresPrimaryIP       string
	PostgresPrimaryHostname string
	PostgresReplicaIP       string
	PostgresReplicaName     string
	PostgresServerAddress   string

	CephNodesSubnet string

	KubernetesAPIServerHost string
	KubernetesPodCIDR       string
	KubernetesServiceCIDR   string

	ClusterGatewayServiceType       string
	ClusterGatewayIPAddresses       []string
	ClusterPublicGatewayServiceType string
	ClusterPublicGatewayIPAddresses []string

	CodesphereDomain                       string
	CodespherePublicIP                     string
	CodesphereWorkspaceHostingBaseDomain   string
	CodesphereCustomDomainsCNameBaseDomain string
	CodesphereDNSServers                   []string
}

type UpdateOmsCmd ¶ added in v0.12.0

type UpdateOmsCmd struct {
	Version version.Version
	Updater OMSUpdater
}

func (*UpdateOmsCmd) SelfUpdate ¶ added in v0.12.0

func (c *UpdateOmsCmd) SelfUpdate() error

type UpgradeCephCmd ¶

type UpgradeCephCmd struct {
	// contains filtered or unexported fields
}

UpgradeCephCmd represents the ceph command

type UpgradeCmd ¶

type UpgradeCmd struct {
	// contains filtered or unexported fields
}

UpgradeCmd represents the upgrade command

type UpgradeCodesphereCmd ¶

type UpgradeCodesphereCmd struct {
	// contains filtered or unexported fields
}

UpgradeCodesphereCmd represents the codesphere command

type VersionCmd ¶

type VersionCmd struct {
	// contains filtered or unexported fields
}

func (*VersionCmd) RunE ¶

func (c *VersionCmd) RunE(_ *cobra.Command, args []string) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL