Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions internal/cmd/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,8 @@ func init() {
oauth2CreateCmd.Flags().StringVar(&account.Oauth2ClientSpec.Description, "description", "", "Description of the OAuth2 client")
oauth2CreateCmd.Flags().StringVar(&account.Oauth2ClientSpec.Flow, "flow", "AUTHORIZATION_CODE", "OAuth2 flow type (default: AUTHORIZATION_CODE)")
oauth2CreateCmd.Flags().StringVar(&account.Oauth2ClientSpec.Name, "name", "", "Name of the OAuth2 client")
addInitParameterFileFlag(oauth2CreateCmd, assets.MeOpenapiSchema, "/me/api/oauth2/client", "post", account.Oauth2ClientCreateSample, nil)
addParameterFileFlags(oauth2CreateCmd, false, assets.MeOpenapiSchema, "/me/api/oauth2/client", "post", account.Oauth2ClientCreateSample, nil)
addInteractiveEditorFlag(oauth2CreateCmd)
addFromFileFlag(oauth2CreateCmd)
oauth2CreateCmd.MarkFlagsMutuallyExclusive("from-file", "editor")

oauth2ClientCmd.AddCommand(oauth2CreateCmd)
Expand Down
5 changes: 2 additions & 3 deletions internal/cmd/baremetal.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,8 @@ Please note that all parameters are not compatible with all OSes.
Run: baremetal.ReinstallBaremetal,
}

addInitParameterFileFlag(reinstallBaremetalCmd, assets.BaremetalOpenapiSchema, "/dedicated/server/{serviceName}/reinstall", "post", baremetal.BaremetalInstallationExample, nil)
addParameterFileFlags(reinstallBaremetalCmd, false, assets.BaremetalOpenapiSchema, "/dedicated/server/{serviceName}/reinstall", "post", baremetal.BaremetalInstallationExample, nil)
addInteractiveEditorFlag(reinstallBaremetalCmd)
addFromFileFlag(reinstallBaremetalCmd)
reinstallBaremetalCmd.Flags().StringVar(&baremetal.OperatingSystem, "os", "", "Operating system to install")
reinstallBaremetalCmd.Flags().StringVar(&baremetal.Customizations.ConfigDriveUserData, "config-drive-user-data", "", "Config Drive UserData")
reinstallBaremetalCmd.Flags().StringVar(&baremetal.Customizations.EfiBootloaderPath, "efi-bootloader-path", "", "Path of the EFI bootloader from the OS installed on the server")
Expand Down Expand Up @@ -180,7 +179,7 @@ Please note that all parameters are not compatible with all OSes.
}
baremetalBootSetScriptCmd.Flags().StringVar(&baremetal.EditBaremetalParams.BootScript, "script", "", "Boot script to set on the baremetal")
addInteractiveEditorFlag(baremetalBootSetScriptCmd)
addFromFileFlag(baremetalBootSetScriptCmd)
addParameterFileFlags(baremetalBootSetScriptCmd, true, nil, "", "", "", nil)
baremetalBootSetScriptCmd.MarkFlagsOneRequired("script", "from-file", "editor")
baremetalBootSetScriptCmd.MarkFlagsMutuallyExclusive("script", "from-file", "editor")
baremetalBootCmd.AddCommand(baremetalBootSetScriptCmd)
Expand Down
3 changes: 1 addition & 2 deletions internal/cmd/cloud_alerting.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,8 @@ func initCloudAlertingCommand(cloudCmd *cobra.Command) {
alertingCreateCmd.Flags().Int64Var(&cloud.AlertingConfigSpec.MonthlyThreshold, "monthly-threshold", 0, "Monthly threshold value")
alertingCreateCmd.Flags().StringVar(&cloud.AlertingConfigSpec.Name, "name", "", "Alert name")
alertingCreateCmd.Flags().StringVar(&cloud.AlertingConfigSpec.Service, "service", "", "Service of the alert. Allowed: ai_endpoint, all, block_storage, data_platform, instances, instances_gpu, instances_without_gpu, objet_storage, rancher, snapshot")
addInitParameterFileFlag(alertingCreateCmd, assets.CloudOpenapiSchema, "/cloud/project/{serviceName}/alerting", "post", cloud.AlertingConfigCreateExample, nil)
addParameterFileFlags(alertingCreateCmd, false, assets.CloudOpenapiSchema, "/cloud/project/{serviceName}/alerting", "post", cloud.AlertingConfigCreateExample, nil)
addInteractiveEditorFlag(alertingCreateCmd)
addFromFileFlag(alertingCreateCmd)
alertingCreateCmd.MarkFlagsMutuallyExclusive("from-file", "editor")
alertingCmd.AddCommand(alertingCreateCmd)

Expand Down
12 changes: 4 additions & 8 deletions internal/cmd/cloud_container_registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,8 @@ func initContainerRegistryCommand(cloudCmd *cobra.Command) {
createCmd.Flags().StringVar(&cloud.CloudContainerRegistrySpec.Name, "name", "", "Name of the container registry")
createCmd.Flags().StringVar(&cloud.CloudContainerRegistrySpec.PlanID, "plan-id", "", "Plan ID for the container registry. Available plans can be listed with 'ovhcloud cloud reference container-registry list-plans'")
createCmd.Flags().StringVar(&cloud.CloudContainerRegistrySpec.Region, "region", "", "Region for the container registry (e.g., DE, GRA, BHS)")
addInitParameterFileFlag(createCmd, assets.CloudOpenapiSchema, "/cloud/project/{serviceName}/containerRegistry", "post", cloud.CloudContainerRegistryCreateSample, nil)
addParameterFileFlags(createCmd, false, assets.CloudOpenapiSchema, "/cloud/project/{serviceName}/containerRegistry", "post", cloud.CloudContainerRegistryCreateSample, nil)
addInteractiveEditorFlag(createCmd)
addFromFileFlag(createCmd)
createCmd.MarkFlagsMutuallyExclusive("from-file", "editor")
registryCmd.AddCommand(createCmd)

Expand Down Expand Up @@ -101,9 +100,8 @@ func initContainerRegistryUsersCommand(registryCmd *cobra.Command) {
}
createCmd.Flags().StringVar(&cloud.CloudContainerRegistryUserSpec.Email, "email", "", "User email")
createCmd.Flags().StringVar(&cloud.CloudContainerRegistryUserSpec.Login, "login", "", "User login")
addInitParameterFileFlag(createCmd, assets.CloudOpenapiSchema, "/cloud/project/{serviceName}/containerRegistry/{registryId}/users", "post", cloud.CloudContainerRegistryUserCreateSample, nil)
addParameterFileFlags(createCmd, false, assets.CloudOpenapiSchema, "/cloud/project/{serviceName}/containerRegistry/{registryId}/users", "post", cloud.CloudContainerRegistryUserCreateSample, nil)
addInteractiveEditorFlag(createCmd)
addFromFileFlag(createCmd)
createCmd.MarkFlagsMutuallyExclusive("from-file", "editor")
usersCmd.AddCommand(createCmd)

Expand Down Expand Up @@ -137,9 +135,8 @@ func initContainerRegistryIAMCommand(registryCmd *cobra.Command) {
Run: cloud.EnableContainerRegistryIAM,
}
enableCmd.Flags().BoolVar(&cloud.CloudContainerRegistryIamSpec.DeleteUsers, "delete-users", false, "Delete existing container registry users when enabling IAM")
addInitParameterFileFlag(enableCmd, assets.CloudOpenapiSchema, "/cloud/project/{serviceName}/containerRegistry/{registryId}/iam", "post", cloud.CloudContainerRegistryIamEnableSample, nil)
addParameterFileFlags(enableCmd, false, assets.CloudOpenapiSchema, "/cloud/project/{serviceName}/containerRegistry/{registryId}/iam", "post", cloud.CloudContainerRegistryIamEnableSample, nil)
addInteractiveEditorFlag(enableCmd)
addFromFileFlag(enableCmd)
enableCmd.MarkFlagsMutuallyExclusive("from-file", "editor")
iamCmd.AddCommand(enableCmd)

Expand Down Expand Up @@ -277,9 +274,8 @@ func initContainerRegistryOIDCCommand(registryCmd *cobra.Command) {
createCmd.Flags().StringVar(&cloud.CloudContainerRegistryOidcCreateSpec.Provider.UserClaim, "user-claim", "", "OIDC claim containing the username")
createCmd.Flags().BoolVar(&cloud.CloudContainerRegistryOidcCreateSpec.Provider.AutoOnboard, "auto-onboard", false, "Automatically create users on first login")
createCmd.Flags().BoolVar(&cloud.CloudContainerRegistryOidcCreateSpec.Provider.VerifyCert, "verify-cert", false, "Verify the provider TLS certificate")
addInitParameterFileFlag(createCmd, assets.CloudOpenapiSchema, "/cloud/project/{serviceName}/containerRegistry/{registryID}/openIdConnect", "post", cloud.CloudContainerRegistryOidcCreateSample, nil)
addParameterFileFlags(createCmd, false, assets.CloudOpenapiSchema, "/cloud/project/{serviceName}/containerRegistry/{registryID}/openIdConnect", "post", cloud.CloudContainerRegistryOidcCreateSample, nil)
addInteractiveEditorFlag(createCmd)
addFromFileFlag(createCmd)
createCmd.MarkFlagsMutuallyExclusive("from-file", "editor")
oidcCmd.AddCommand(createCmd)

Expand Down
6 changes: 2 additions & 4 deletions internal/cmd/cloud_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,8 @@ There are three ways to define the creation parameters:
instanceCreateCmd.Flags().StringVar(&cloud.InstanceCreationParameters.UserData, "user-data", "", "Configuration information or scripts to use upon launch")

// Common flags for other mean to define parameters
addInitParameterFileFlag(instanceCreateCmd, assets.CloudOpenapiSchema, "/cloud/project/{serviceName}/instance", "post", cloud.CloudInstanceCreationExample, cloud.GetInstanceFlavorAndImageInteractiveSelector)
addParameterFileFlags(instanceCreateCmd, false, assets.CloudOpenapiSchema, "/cloud/project/{serviceName}/instance", "post", cloud.CloudInstanceCreationExample, cloud.GetInstanceFlavorAndImageInteractiveSelector)
addInteractiveEditorFlag(instanceCreateCmd)
addFromFileFlag(instanceCreateCmd)
instanceCreateCmd.Flags().BoolVar(&flags.WaitForTask, "wait", false, "Wait for instance creation to be done before exiting")
if !(runtime.GOARCH == "wasm" && runtime.GOOS == "js") {
instanceCreateCmd.Flags().BoolVar(&cloud.InstanceImageViaInteractiveSelector, "image-selector", false, "Use the interactive image selector")
Expand Down Expand Up @@ -279,9 +278,8 @@ There are three ways to define the installation parameters:
Run: cloud.ReinstallInstance,
Args: cobra.MaximumNArgs(1),
}
addInitParameterFileFlag(reinstallCmd, assets.CloudOpenapiSchema, "/cloud/project/{serviceName}/instance/{instanceId}/reinstall", "post", "", nil)
addParameterFileFlags(reinstallCmd, false, assets.CloudOpenapiSchema, "/cloud/project/{serviceName}/instance/{instanceId}/reinstall", "post", "", nil)
addInteractiveEditorFlag(reinstallCmd)
addFromFileFlag(reinstallCmd)
reinstallCmd.Flags().StringVar(&cloud.InstanceImageID, "image", "", "Image to use for reinstallation")
reinstallCmd.Flags().BoolVar(&flags.WaitForTask, "wait", false, "Wait for reinstall to be done before exiting")
if !(runtime.GOARCH == "wasm" && runtime.GOOS == "js") {
Expand Down
12 changes: 4 additions & 8 deletions internal/cmd/cloud_kube.go
Original file line number Diff line number Diff line change
Expand Up @@ -363,9 +363,8 @@ There are three ways to define the creation parameters:
kubeCreateCmd.Flags().StringVar(&cloud.KubeSpec.Customization.KubeProxy.IPVS.UDPTimeout, "customization.kube-proxy.ipvs.udp-timeout", "", "Timeout value used for IPVS UDP packets in RFC3339 duration format (e.g. 'PT60S')")

// Common flags for other means to define parameters
addInitParameterFileFlag(kubeCreateCmd, assets.CloudOpenapiSchema, "/cloud/project/{serviceName}/kube", "post", cloud.CloudKubeCreationExample, nil)
addParameterFileFlags(kubeCreateCmd, false, assets.CloudOpenapiSchema, "/cloud/project/{serviceName}/kube", "post", cloud.CloudKubeCreationExample, nil)
addInteractiveEditorFlag(kubeCreateCmd)
addFromFileFlag(kubeCreateCmd)
kubeCreateCmd.MarkFlagsMutuallyExclusive("from-file", "editor")

return kubeCreateCmd
Expand Down Expand Up @@ -449,9 +448,8 @@ There are three ways to define the reset parameters:
kubeResetCmd.Flags().StringVar(&cloud.KubeSpec.Customization.KubeProxy.IPVS.UDPTimeout, "customization.kube-proxy.ipvs.udp-timeout", "", "Timeout value used for IPVS UDP packets in RFC3339 duration format (e.g. 'PT60S')")

// Common flags for other means to define parameters
addInitParameterFileFlag(kubeResetCmd, assets.CloudOpenapiSchema, "/cloud/project/{serviceName}/kube/reset", "post", cloud.CloudKubeResetExample, nil)
addParameterFileFlags(kubeResetCmd, false, assets.CloudOpenapiSchema, "/cloud/project/{serviceName}/kube/reset", "post", cloud.CloudKubeResetExample, nil)
addInteractiveEditorFlag(kubeResetCmd)
addFromFileFlag(kubeResetCmd)
kubeResetCmd.MarkFlagsMutuallyExclusive("from-file", "editor")

return kubeResetCmd
Expand Down Expand Up @@ -565,9 +563,8 @@ There are three ways to define the creation parameters:
nodepoolCreateCmd.Flags().BoolVar(&cloud.KubeNodepoolSpec.Template.Spec.Unschedulable, "template-unschedulable", false, "Set the nodes as unschedulable")

// Common flags for other means to define parameters
addInitParameterFileFlag(nodepoolCreateCmd, assets.CloudOpenapiSchema, "/cloud/project/{serviceName}/kube/{kubeId}/nodepool", "post", cloud.CloudKubeNodePoolCreationExample, cloud.GetKubeFlavorInteractiveSelector)
addParameterFileFlags(nodepoolCreateCmd, false, assets.CloudOpenapiSchema, "/cloud/project/{serviceName}/kube/{kubeId}/nodepool", "post", cloud.CloudKubeNodePoolCreationExample, cloud.GetKubeFlavorInteractiveSelector)
addInteractiveEditorFlag(nodepoolCreateCmd)
addFromFileFlag(nodepoolCreateCmd)
if !(runtime.GOARCH == "wasm" && runtime.GOOS == "js") {
nodepoolCreateCmd.Flags().BoolVar(&cloud.InstanceFlavorViaInteractiveSelector, "flavor-selector", false, "Use the interactive flavor selector")
nodepoolCreateCmd.MarkFlagsMutuallyExclusive("from-file", "editor")
Expand Down Expand Up @@ -633,9 +630,8 @@ There are three ways to define the parameters:
createCmd.Flags().StringVar(&cloud.KubeOIDCConfig.UsernamePrefix, "username-prefix", "", "Prefix prepended to username claims")

// Common flags for other means to define parameters
addInitParameterFileFlag(createCmd, assets.CloudOpenapiSchema, "/cloud/project/{serviceName}/kube/{kubeId}/openIdConnect", "post", cloud.CloudKubeOIDCCreationExample, nil)
addParameterFileFlags(createCmd, false, assets.CloudOpenapiSchema, "/cloud/project/{serviceName}/kube/{kubeId}/openIdConnect", "post", cloud.CloudKubeOIDCCreationExample, nil)
addInteractiveEditorFlag(createCmd)
addFromFileFlag(createCmd)
createCmd.MarkFlagsMutuallyExclusive("from-file", "editor")

return createCmd
Expand Down
9 changes: 3 additions & 6 deletions internal/cmd/cloud_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,9 +299,8 @@ There are three ways to define the parameters:
privateNetworkCreateCmd.Flags().StringSliceVar(&cloud.CloudNetworkSpec.Subnet.CliHostRoutes, "subnet-host-routes", nil, "Host routes for the subnet in format destination:nextHop")

// Common flags for other means to define parameters
addInitParameterFileFlag(privateNetworkCreateCmd, assets.CloudOpenapiSchema, "/cloud/project/{serviceName}/region/{regionName}/network", "post", cloud.PrivateNetworkCreationExample, nil)
addParameterFileFlags(privateNetworkCreateCmd, false, assets.CloudOpenapiSchema, "/cloud/project/{serviceName}/region/{regionName}/network", "post", cloud.PrivateNetworkCreationExample, nil)
addInteractiveEditorFlag(privateNetworkCreateCmd)
addFromFileFlag(privateNetworkCreateCmd)
privateNetworkCreateCmd.Flags().BoolVar(&flags.WaitForTask, "wait", false, "Wait for network creation to be done before exiting")
privateNetworkCreateCmd.MarkFlagsMutuallyExclusive("from-file", "editor")

Expand Down Expand Up @@ -361,9 +360,8 @@ There are three ways to define the parameters:
privateNetworkSubnetCreateCmd.Flags().StringVar(&cloud.CloudNetworkSubnetSpec.Region, "region", "", "Region for the subnet")

// Common flags for other means to define parameters
addInitParameterFileFlag(privateNetworkSubnetCreateCmd, assets.CloudOpenapiSchema, "/cloud/project/{serviceName}/network/private/{networkId}/subnet", "post", cloud.PrivateNetworkSubnetCreationExample, nil)
addParameterFileFlags(privateNetworkSubnetCreateCmd, false, assets.CloudOpenapiSchema, "/cloud/project/{serviceName}/network/private/{networkId}/subnet", "post", cloud.PrivateNetworkSubnetCreationExample, nil)
addInteractiveEditorFlag(privateNetworkSubnetCreateCmd)
addFromFileFlag(privateNetworkSubnetCreateCmd)
privateNetworkSubnetCreateCmd.MarkFlagsMutuallyExclusive("from-file", "editor")

return privateNetworkSubnetCreateCmd
Expand Down Expand Up @@ -442,9 +440,8 @@ There are three ways to define the parameters:
gatewayCreateCmd.Flags().StringSliceVar(&cloud.CloudGatewaySpec.Network.Subnet.CliHostRoutes, "subnet-host-routes", nil, "Host routes for the subnet in format destination:nextHop")

// Common flags for other means to define parameters
addInitParameterFileFlag(gatewayCreateCmd, assets.CloudOpenapiSchema, "/cloud/project/{serviceName}/region/{regionName}/gateway", "post", cloud.GatewayCreationExample, nil)
addParameterFileFlags(gatewayCreateCmd, false, assets.CloudOpenapiSchema, "/cloud/project/{serviceName}/region/{regionName}/gateway", "post", cloud.GatewayCreationExample, nil)
addInteractiveEditorFlag(gatewayCreateCmd)
addFromFileFlag(gatewayCreateCmd)
gatewayCreateCmd.Flags().BoolVar(&flags.WaitForTask, "wait", false, "Wait for gateway creation to be done before exiting")
gatewayCreateCmd.MarkFlagsMutuallyExclusive("from-file", "editor")

Expand Down
3 changes: 1 addition & 2 deletions internal/cmd/cloud_rancher.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,8 @@ There are three ways to define the creation parameters:
rancherCreateCmd.Flags().BoolVar(cloud.RancherSpec.TargetSpec.IAMAuthEnabled, "iam-auth-enabled", false, "Allow Rancher to use identities managed by OVHcloud IAM (Identity and Access Management) to control access")

// Common flags for other means to define parameters
addInitParameterFileFlag(rancherCreateCmd, assets.CloudV2OpenapiSchema, "/cloud/project/{serviceName}/rancher", "post", cloud.CloudRancherCreationExample, nil)
addParameterFileFlags(rancherCreateCmd, false, assets.CloudV2OpenapiSchema, "/cloud/project/{serviceName}/rancher", "post", cloud.CloudRancherCreationExample, nil)
addInteractiveEditorFlag(rancherCreateCmd)
addFromFileFlag(rancherCreateCmd)
rancherCreateCmd.MarkFlagsMutuallyExclusive("from-file", "editor")

return rancherCreateCmd
Expand Down
3 changes: 1 addition & 2 deletions internal/cmd/cloud_ssh_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,8 @@ func initCloudSSHKeyCommand(cloudCmd *cobra.Command) {
sshKeyCreateCmd.Flags().StringVar(&cloud.SSHKeyCreationParameters.Name, "name", "", "Name for the SSH key to create")
sshKeyCreateCmd.Flags().StringVar(&cloud.SSHKeyCreationParameters.PublicKey, "public-key", "", "Public key for the SSH key to create")
sshKeyCreateCmd.Flags().StringVar(&cloud.SSHKeyCreationParameters.Region, "region", "", "Region for the SSH key to create (optional)")
addInitParameterFileFlag(sshKeyCreateCmd, assets.CloudOpenapiSchema, "/v1/cloud/project/{serviceName}/sshkey", "post", cloud.SSHKeyCreationExample, nil)
addParameterFileFlags(sshKeyCreateCmd, false, assets.CloudOpenapiSchema, "/v1/cloud/project/{serviceName}/sshkey", "post", cloud.SSHKeyCreationExample, nil)
addInteractiveEditorFlag(sshKeyCreateCmd)
addFromFileFlag(sshKeyCreateCmd)
sshKeyCreateCmd.MarkFlagsMutuallyExclusive("from-file", "editor")
sshKeyCmd.AddCommand(sshKeyCreateCmd)

Expand Down
3 changes: 1 addition & 2 deletions internal/cmd/cloud_storage_block.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,8 @@ func getVolumeCreateCmd() *cobra.Command {
volumeCreateCmd.Flags().StringVar(&cloud.VolumeSpec.SnapshotId, "snapshot-id", "", "Snapshot ID to create the volume from")
volumeCreateCmd.Flags().StringVar(&cloud.VolumeSpec.Type, "type", "", "Volume type (classic, classic-luks, classic-multiattach, high-speed, high-speed-gen2, high-speed-gen2-luks, high-speed-luks)")

addInitParameterFileFlag(volumeCreateCmd, assets.CloudOpenapiSchema, "/cloud/project/{serviceName}/region/{regionName}/volume", "post", cloud.VolumeCreateExample, nil)
addParameterFileFlags(volumeCreateCmd, false, assets.CloudOpenapiSchema, "/cloud/project/{serviceName}/region/{regionName}/volume", "post", cloud.VolumeCreateExample, nil)
addInteractiveEditorFlag(volumeCreateCmd)
addFromFileFlag(volumeCreateCmd)
volumeCreateCmd.Flags().BoolVar(&flags.WaitForTask, "wait", false, "Wait for volume creation to be done before exiting")
volumeCreateCmd.MarkFlagsMutuallyExclusive("from-file", "editor")

Expand Down
Loading