-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathcloud_project.go
More file actions
127 lines (110 loc) · 4.17 KB
/
Copy pathcloud_project.go
File metadata and controls
127 lines (110 loc) · 4.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
// SPDX-FileCopyrightText: 2025 OVH SAS <opensource@ovh.net>
//
// SPDX-License-Identifier: Apache-2.0
package cmd
import (
"github.com/ovh/ovhcloud-cli/internal/services/cloud"
"github.com/spf13/cobra"
"github.com/ovh/ovhcloud-cli/internal/completion"
)
func init() {
cloudCmd := &cobra.Command{
Use: "cloud",
Short: "Manage your projects and services in the Public Cloud universe (MKS, MPR, MRS, Object Storage...)",
}
cloudprojectCmd := &cobra.Command{
Use: "project",
Short: "Retrieve information and manage your CloudProject services",
}
cloudprojectCmd.PersistentFlags().StringVar(&cloud.CloudProject, "cloud-project", "", "Cloud project ID")
cloudprojectCmd.RegisterFlagCompletionFunc("cloud-project", completion.CloudProjects) //nolint:errcheck
// Command to list CloudProject services
cloudprojectCmd.AddCommand(withFilterFlag(&cobra.Command{
Use: "list",
Aliases: []string{"ls"},
Short: "List your cloud projects",
Run: cloud.ListCloudProject,
}))
// Command to get a single CloudProject
cloudprojectCmd.AddCommand(&cobra.Command{
Use: "get <project_id>",
Short: "Retrieve information of a specific cloud project",
Args: cobra.ExactArgs(1),
Run: cloud.GetCloudProject,
})
editCloudProjectCmd := &cobra.Command{
Use: "edit <project_id>",
Short: "Edit the given cloud project",
Args: cobra.ExactArgs(1),
Run: cloud.EditCloudProject,
}
editCloudProjectCmd.Flags().StringVar(&cloud.CloudProjectSpec.Description, "description", "", "Description of the project")
editCloudProjectCmd.Flags().BoolVar(&cloud.CloudProjectSpec.ManualQuota, "manual-quota", false, "Prevent automatic quota upgrade")
addInteractiveEditorFlag(editCloudProjectCmd)
cloudprojectCmd.AddCommand(editCloudProjectCmd)
// Project management commands
cloudprojectCmd.AddCommand(&cobra.Command{
Use: "service-info",
Short: "Get service information for the project",
Run: cloud.GetServiceInfo,
})
changeContactCmd := &cobra.Command{
Use: "change-contact",
Short: "Change project contacts",
Run: cloud.ChangeContact,
}
changeContactCmd.Flags().StringVar(&cloud.ChangeContactSpec.ContactAdmin, "contact-admin", "", "Admin contact NIC handle")
changeContactCmd.Flags().StringVar(&cloud.ChangeContactSpec.ContactBilling, "contact-billing", "", "Billing contact NIC handle")
changeContactCmd.Flags().StringVar(&cloud.ChangeContactSpec.ContactTech, "contact-tech", "", "Technical contact NIC handle")
cloudprojectCmd.AddCommand(changeContactCmd)
// Termination commands
terminationCmd := &cobra.Command{
Use: "termination",
Short: "Manage project termination lifecycle",
}
terminationCmd.AddCommand(&cobra.Command{
Use: "init",
Short: "Initiate project termination",
Long: "Initiate project termination. A termination token will be returned to confirm the operation.",
Run: cloud.TerminateProject,
})
confirmTerminateCmd := &cobra.Command{
Use: "confirm",
Short: "Confirm project termination with token",
Run: cloud.ConfirmTermination,
}
confirmTerminateCmd.Flags().String("token", "", "Termination token received from init command")
confirmTerminateCmd.MarkFlagRequired("token")
terminationCmd.AddCommand(confirmTerminateCmd)
terminationCmd.AddCommand(&cobra.Command{
Use: "cancel",
Short: "Cancel a project scheduled for termination",
Run: cloud.RetainProject,
})
cloudprojectCmd.AddCommand(terminationCmd)
cloudprojectCmd.AddCommand(&cobra.Command{
Use: "unleash",
Short: "Unleash a project",
Run: cloud.UnleashProject,
})
initKubeCommand(cloudCmd)
initContainerRegistryCommand(cloudCmd)
initManagedDatabaseCommand(cloudCmd)
initManagedAnalyticsCommand(cloudCmd)
initInstanceCommand(cloudCmd)
initCloudLoadbalancerCommand(cloudCmd)
initCloudNetworkCommand(cloudCmd)
initCloudOperationCommand(cloudCmd)
initCloudQuotaCommand(cloudCmd)
initCloudRegionCommand(cloudCmd)
initCloudSSHKeyCommand(cloudCmd)
initCloudUserCommand(cloudCmd)
initCloudStorageCommand(cloudCmd)
initCloudRancherCommand(cloudCmd)
initCloudReferenceCmd(cloudCmd)
initCloudSavingsPlanCommand(cloudCmd)
initCloudIPCommand(cloudCmd)
initCloudAlertingCommand(cloudCmd)
cloudCmd.AddCommand(cloudprojectCmd)
rootCmd.AddCommand(cloudCmd)
}