cloudaccounts.go 53 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631
  1. // Copyright 2019 Yunion
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. package compute
  15. import (
  16. "fmt"
  17. "os"
  18. "yunion.io/x/cloudmux/pkg/cloudprovider"
  19. "yunion.io/x/jsonutils"
  20. api "yunion.io/x/onecloud/pkg/apis/compute"
  21. baseoptions "yunion.io/x/onecloud/pkg/mcclient/options"
  22. )
  23. type CloudaccountListOptions struct {
  24. baseoptions.BaseListOptions
  25. Capability []string `help:"capability filter" choices:"project|compute|network|loadbalancer|objectstore|rds|cache|event|tablestore"`
  26. ReadOnly *bool `help:"filter read only account" negative:"no-read-only"`
  27. //DistinctField string `help:"distinct field"`
  28. ProxySetting string `help:"Proxy setting id or name"`
  29. // 按宿主机数量排序
  30. OrderByHostCount string
  31. // 按虚拟机数量排序
  32. OrderByGuestCount string
  33. }
  34. func (opts *CloudaccountListOptions) Params() (jsonutils.JSONObject, error) {
  35. return baseoptions.ListStructToParams(opts)
  36. }
  37. type SUserPasswordCredential struct {
  38. Username string `help:"Username" positional:"true"`
  39. Password string `help:"Password" positional:"true"`
  40. }
  41. type SVMwareCredentialWithEnvironment struct {
  42. SUserPasswordCredential
  43. Host string `help:"VMware VCenter/ESXi host" positional:"true"`
  44. Port string `help:"VMware VCenter/ESXi host port" default:"443"`
  45. Zone string `help:"zone for this account"`
  46. }
  47. type SNutanixCredentialWithEnvironment struct {
  48. SUserPasswordCredential
  49. Host string `help:"Nutanix host" positional:"true"`
  50. Port string `help:"Nutanix host port" default:"9440"`
  51. }
  52. type SProxmoxCredentialWithEnvironment struct {
  53. SUserPasswordCredential
  54. Host string `help:"Proxmox host" positional:"true"`
  55. Port string `help:"Proxmox host port" default:"8006"`
  56. }
  57. type SAzureCredential struct {
  58. ClientID string `help:"Azure client_id" positional:"true"`
  59. ClientSecret string `help:"Azure clinet_secret" positional:"true"`
  60. }
  61. type SAzureCredentialWithEnvironment struct {
  62. DirectoryID string `help:"Azure directory_id" positional:"true"`
  63. SAzureCredential
  64. Environment string `help:"Cloud environment" choices:"AzureGermanCloud|AzureChinaCloud|AzurePublicCloud" default:"AzureChinaCloud"`
  65. }
  66. type SQcloudCredential struct {
  67. AppID string `help:"Qcloud appid" positional:"true"`
  68. SecretID string `help:"Qcloud secret_id" positional:"true"`
  69. SecretKey string `help:"Qcloud secret_key" positional:"true"`
  70. }
  71. type SOpenStackCredential struct {
  72. ProjectName string `help:"OpenStack project_name" positional:"true"`
  73. SUserPasswordCredential
  74. DomainName string `help:"OpenStack domain name"`
  75. }
  76. type SOpenStackCredentialWithAuthURL struct {
  77. SOpenStackCredential
  78. AuthURL string `help:"OpenStack auth_url" positional:"true" json:"auth_url"`
  79. }
  80. type SAccessKeyCredential struct {
  81. AccessKeyID string `help:"Access_key_id" positional:"true"`
  82. AccessKeySecret string `help:"Access_key_secret" positional:"true"`
  83. }
  84. type SAccessKeyCredentialWithEnvironment struct {
  85. SAccessKeyCredential
  86. Environment string `help:"Cloud environment" choices:"InternationalCloud|ChinaCloud" default:"ChinaCloud"`
  87. }
  88. /// create options
  89. type SCloudAccountCreateBaseOptions struct {
  90. Name string `help:"Name of cloud account" positional:"true"`
  91. // PROVIDER string `help:"Driver for cloud account" choices:"VMware|Aliyun|Azure|Qcloud|OpenStack|Huawei|Aws"`
  92. Desc string `help:"Description" token:"desc" json:"description"`
  93. Brand string `help:"Brand of cloud account"`
  94. AutoCreateProject bool `help:"Enable the account with same name project"`
  95. AutoCreateProjectForProvider bool `help:"Is Auto Create Project For Provider"`
  96. EnableAutoSync bool `help:"Enable automatically synchronize resources of this account"`
  97. SyncIntervalSeconds int `help:"Interval to synchronize if auto sync is enable" metavar:"SECONDS"`
  98. Project string `help:"project for this account"`
  99. ProjectDomain string `help:"domain for this account"`
  100. Disabled *bool `help:"create cloud account with disabled status"`
  101. SkipDuplicateAccountCheck bool `help:"skip check duplicate account"`
  102. SamlAuth string `help:"Enable or disable saml auth" choices:"true|false"`
  103. ProxySetting string `help:"proxy setting id or name" json:"proxy_setting"`
  104. DryRun bool `help:"test create cloudaccount params"`
  105. ShowSubAccounts bool `help:"test and show subaccount info"`
  106. ReadOnly bool `help:"Read only account"`
  107. RegionId string
  108. ProjectMappingId string
  109. EnableProjectSync bool
  110. EnableResourceSync bool
  111. SkipSyncResources []string `help:"Skip sync resource, etc snapshot"`
  112. Currency string `choices:"CNY|USD"`
  113. }
  114. type SVMwareCloudAccountCreateOptions struct {
  115. SCloudAccountCreateBaseOptions
  116. SVMwareCredentialWithEnvironment
  117. }
  118. type SAliyunAccessKeyCredentialWithEnvironment struct {
  119. SAccessKeyCredential
  120. Environment string `help:"Cloud environment" choices:"InternationalCloud|FinanceCloud" default:"InternationalCloud"`
  121. }
  122. func (opts *SVMwareCloudAccountCreateOptions) Params() (jsonutils.JSONObject, error) {
  123. params := jsonutils.Marshal(opts)
  124. params.(*jsonutils.JSONDict).Add(jsonutils.NewString("VMware"), "provider")
  125. return params, nil
  126. }
  127. type SAliyunCloudAccountCreateOptions struct {
  128. SCloudAccountCreateBaseOptions
  129. SAliyunAccessKeyCredentialWithEnvironment
  130. OptionsBillingReportBucket string `help:"bucket that stores billing report" json:"-"`
  131. OptionsBillingBucketAccount string `help:"id of account that can access bucket, blank if this account can access" json:"-"`
  132. OptionsBillingFilePrefix string `help:"prefix of billing file name" json:"-"`
  133. }
  134. func (opts *SAliyunCloudAccountCreateOptions) Params() (jsonutils.JSONObject, error) {
  135. params := jsonutils.Marshal(opts)
  136. params.(*jsonutils.JSONDict).Add(jsonutils.NewString("Aliyun"), "provider")
  137. options := jsonutils.NewDict()
  138. if len(opts.OptionsBillingReportBucket) > 0 {
  139. options.Add(jsonutils.NewString(opts.OptionsBillingReportBucket), "billing_report_bucket")
  140. }
  141. if len(opts.OptionsBillingBucketAccount) > 0 {
  142. options.Add(jsonutils.NewString(opts.OptionsBillingBucketAccount), "billing_bucket_account")
  143. }
  144. if len(opts.OptionsBillingFilePrefix) > 0 {
  145. options.Add(jsonutils.NewString(opts.OptionsBillingFilePrefix), "billing_file_prefix")
  146. }
  147. if options.Size() > 0 {
  148. params.(*jsonutils.JSONDict).Add(options, "options")
  149. }
  150. return params, nil
  151. }
  152. type SAzureCloudAccountCreateOptions struct {
  153. SCloudAccountCreateBaseOptions
  154. SAzureCredentialWithEnvironment
  155. }
  156. func (opts *SAzureCloudAccountCreateOptions) Params() (jsonutils.JSONObject, error) {
  157. params := jsonutils.Marshal(opts)
  158. params.(*jsonutils.JSONDict).Add(jsonutils.NewString("Azure"), "provider")
  159. return params, nil
  160. }
  161. type SQcloudCloudAccountCreateOptions struct {
  162. SCloudAccountCreateBaseOptions
  163. SQcloudCredential
  164. OptionsBillingReportBucket string `help:"bucket that stores billing report" json:"-"`
  165. }
  166. func (opts *SQcloudCloudAccountCreateOptions) Params() (jsonutils.JSONObject, error) {
  167. params := jsonutils.Marshal(opts).(*jsonutils.JSONDict)
  168. params.Add(jsonutils.NewString("Qcloud"), "provider")
  169. options := jsonutils.NewDict()
  170. if len(opts.OptionsBillingReportBucket) > 0 {
  171. options.Set("billing_report_bucket", jsonutils.NewString(opts.OptionsBillingReportBucket))
  172. }
  173. if options.Length() > 0 {
  174. params.Set("options", options)
  175. }
  176. return params, nil
  177. }
  178. type SGoogleCloudAccountCreateOptions struct {
  179. SCloudAccountCreateBaseOptions
  180. GoogleJsonFile string `help:"Google auth json file" positional:"true"`
  181. }
  182. func parseGcpCredential(filename string) (jsonutils.JSONObject, error) {
  183. data, err := os.ReadFile(filename)
  184. if err != nil {
  185. return nil, err
  186. }
  187. authParams, err := jsonutils.Parse(data)
  188. if err != nil {
  189. return nil, err
  190. }
  191. ret := jsonutils.NewDict()
  192. for _, k := range []string{
  193. "client_email",
  194. "project_id",
  195. "private_key_id",
  196. "private_key",
  197. } {
  198. v, _ := authParams.Get(k)
  199. ret.Add(v, fmt.Sprintf("gcp_%s", k))
  200. }
  201. return ret, nil
  202. }
  203. func (opts *SGoogleCloudAccountCreateOptions) Params() (jsonutils.JSONObject, error) {
  204. params := jsonutils.Marshal(opts)
  205. params.(*jsonutils.JSONDict).Add(jsonutils.NewString("Google"), "provider")
  206. authParams, err := parseGcpCredential(opts.GoogleJsonFile)
  207. if err != nil {
  208. return nil, err
  209. }
  210. err = jsonutils.Update(params, authParams)
  211. if err != nil {
  212. return nil, err
  213. }
  214. return params, nil
  215. }
  216. type SAWSCloudAccountCreateOptions struct {
  217. SCloudAccountCreateBaseOptions
  218. SAccessKeyCredentialWithEnvironment
  219. OptionsBillingReportBucket string `help:"bucket that stores billing report" json:"-"`
  220. OptionsBillingBucketAccount string `help:"id of account that can access bucket, blank if this account can access" json:"-"`
  221. OptionsBillingFilePrefix string `help:"prefix of billing file name" json:"-"`
  222. OptionsAssumeRoleName string `help:"assume role name" json:"-"`
  223. }
  224. func (opts *SAWSCloudAccountCreateOptions) Params() (jsonutils.JSONObject, error) {
  225. params := jsonutils.Marshal(opts).(*jsonutils.JSONDict)
  226. options := jsonutils.NewDict()
  227. if len(opts.OptionsBillingReportBucket) > 0 {
  228. options.Add(jsonutils.NewString(opts.OptionsBillingReportBucket), "billing_report_bucket")
  229. }
  230. if len(opts.OptionsBillingBucketAccount) > 0 {
  231. options.Add(jsonutils.NewString(opts.OptionsBillingBucketAccount), "billing_bucket_account")
  232. }
  233. if len(opts.OptionsBillingFilePrefix) > 0 {
  234. options.Add(jsonutils.NewString(opts.OptionsBillingFilePrefix), "billing_file_prefix")
  235. }
  236. if len(opts.OptionsAssumeRoleName) > 0 {
  237. options.Add(jsonutils.NewString(opts.OptionsAssumeRoleName), "aws_assume_role_name")
  238. }
  239. if options.Size() > 0 {
  240. params.Add(options, "options")
  241. }
  242. params.Add(jsonutils.NewString("Aws"), "provider")
  243. return params, nil
  244. }
  245. type SOpenStackCloudAccountCreateOptions struct {
  246. SCloudAccountCreateBaseOptions
  247. SOpenStackCredentialWithAuthURL
  248. }
  249. func (opts *SOpenStackCloudAccountCreateOptions) Params() (jsonutils.JSONObject, error) {
  250. params := jsonutils.Marshal(opts)
  251. params.(*jsonutils.JSONDict).Add(jsonutils.NewString("OpenStack"), "provider")
  252. return params, nil
  253. }
  254. type SHuaweiCloudAccountCreateOptions struct {
  255. SCloudAccountCreateBaseOptions
  256. SAccessKeyCredential
  257. }
  258. func (opts *SHuaweiCloudAccountCreateOptions) Params() (jsonutils.JSONObject, error) {
  259. params := jsonutils.Marshal(opts)
  260. params.(*jsonutils.JSONDict).Add(jsonutils.NewString("Huawei"), "provider")
  261. return params, nil
  262. }
  263. type SHCSOAccountCreateOptions struct {
  264. SCloudAccountCreateBaseOptions
  265. cloudprovider.SHCSOEndpoints
  266. SAccessKeyCredential
  267. }
  268. func (opts *SHCSOAccountCreateOptions) Params() (jsonutils.JSONObject, error) {
  269. params := jsonutils.Marshal(opts)
  270. params.(*jsonutils.JSONDict).Add(jsonutils.NewString("HCSO"), "provider")
  271. return params, nil
  272. }
  273. type SHCSAccountCreateOptions struct {
  274. SCloudAccountCreateBaseOptions
  275. AuthURL string `help:"Hcs auth_url" positional:"true" json:"auth_url"`
  276. SAccessKeyCredential
  277. }
  278. func (opts *SHCSAccountCreateOptions) Params() (jsonutils.JSONObject, error) {
  279. params := jsonutils.Marshal(opts)
  280. params.(*jsonutils.JSONDict).Add(jsonutils.NewString("HCS"), "provider")
  281. return params, nil
  282. }
  283. type SUcloudCloudAccountCreateOptions struct {
  284. SCloudAccountCreateBaseOptions
  285. SAccessKeyCredential
  286. }
  287. func (opts *SUcloudCloudAccountCreateOptions) Params() (jsonutils.JSONObject, error) {
  288. params := jsonutils.Marshal(opts)
  289. params.(*jsonutils.JSONDict).Add(jsonutils.NewString("Ucloud"), "provider")
  290. return params, nil
  291. }
  292. type SVolcengineCloudAccountCreateOptions struct {
  293. SCloudAccountCreateBaseOptions
  294. SAccessKeyCredential
  295. OptionsBillingReportBucket string `help:"update Aliyun S3 bucket that stores account billing report" json:"-"`
  296. }
  297. func (opts *SVolcengineCloudAccountCreateOptions) Params() (jsonutils.JSONObject, error) {
  298. params := jsonutils.Marshal(opts).(*jsonutils.JSONDict)
  299. params.Add(jsonutils.NewString("VolcEngine"), "provider")
  300. options := jsonutils.NewDict()
  301. if len(opts.OptionsBillingReportBucket) > 0 {
  302. options.Set("billing_report_bucket", jsonutils.NewString(opts.OptionsBillingReportBucket))
  303. }
  304. if options.Length() > 0 {
  305. params.Set("options", options)
  306. }
  307. return params, nil
  308. }
  309. type SZStackCloudAccountCreateOptions struct {
  310. SCloudAccountCreateBaseOptions
  311. SUserPasswordCredential
  312. AuthURL string `help:"ZStack auth_url" positional:"true" json:"auth_url"`
  313. }
  314. func (opts *SZStackCloudAccountCreateOptions) Params() (jsonutils.JSONObject, error) {
  315. params := jsonutils.Marshal(opts)
  316. params.(*jsonutils.JSONDict).Add(jsonutils.NewString("ZStack"), "provider")
  317. return params, nil
  318. }
  319. type SHcsOpCloudAccountCreateOptions struct {
  320. SCloudAccountCreateBaseOptions
  321. SUserPasswordCredential
  322. AuthURL string `help:"HcsOp auth_url" positional:"true" json:"auth_url"`
  323. }
  324. func (opts *SHcsOpCloudAccountCreateOptions) Params() (jsonutils.JSONObject, error) {
  325. params := jsonutils.Marshal(opts)
  326. params.(*jsonutils.JSONDict).Add(jsonutils.NewString("HCSOP"), "provider")
  327. return params, nil
  328. }
  329. type SS3CloudAccountCreateOptions struct {
  330. SCloudAccountCreateBaseOptions
  331. SAccessKeyCredential
  332. Endpoint string `help:"S3 endpoint" required:"true" positional:"true" json:"endpoint"`
  333. OptionSignVer string `help:"signing algorithm version" choices:"v2|v4"`
  334. }
  335. func (opts *SS3CloudAccountCreateOptions) Params() (jsonutils.JSONObject, error) {
  336. params := jsonutils.Marshal(opts)
  337. params.(*jsonutils.JSONDict).Add(jsonutils.NewString("S3"), "provider")
  338. options := jsonutils.NewDict()
  339. if len(opts.OptionSignVer) > 0 {
  340. options.Add(jsonutils.NewString(opts.OptionSignVer), "sign_ver")
  341. }
  342. return params, nil
  343. }
  344. type SCephCloudAccountCreateOptions struct {
  345. SS3CloudAccountCreateOptions
  346. }
  347. func (opts *SCephCloudAccountCreateOptions) Params() (jsonutils.JSONObject, error) {
  348. params := jsonutils.Marshal(opts)
  349. params.(*jsonutils.JSONDict).Add(jsonutils.NewString("Ceph"), "provider")
  350. return params, nil
  351. }
  352. type SXskyCloudAccountCreateOptions struct {
  353. SS3CloudAccountCreateOptions
  354. }
  355. func (opts *SXskyCloudAccountCreateOptions) Params() (jsonutils.JSONObject, error) {
  356. params := jsonutils.Marshal(opts)
  357. params.(*jsonutils.JSONDict).Add(jsonutils.NewString("Xsky"), "provider")
  358. return params, nil
  359. }
  360. type SCtyunCloudAccountCreateOptions struct {
  361. SCloudAccountCreateBaseOptions
  362. SAccessKeyCredentialWithEnvironment
  363. }
  364. func (opts *SCtyunCloudAccountCreateOptions) Params() (jsonutils.JSONObject, error) {
  365. params := jsonutils.Marshal(opts)
  366. params.(*jsonutils.JSONDict).Add(jsonutils.NewString("Ctyun"), "provider")
  367. return params, nil
  368. }
  369. type SEcloudCloudAccountCreateOptions struct {
  370. SCloudAccountCreateBaseOptions
  371. SAccessKeyCredentialWithEnvironment
  372. }
  373. func (opts *SEcloudCloudAccountCreateOptions) Params() (jsonutils.JSONObject, error) {
  374. params := jsonutils.Marshal(opts)
  375. params.(*jsonutils.JSONDict).Add(jsonutils.NewString("Ecloud"), "provider")
  376. return params, nil
  377. }
  378. type SJDcloudCloudAccountCreateOptions struct {
  379. SCloudAccountCreateBaseOptions
  380. SAccessKeyCredential
  381. }
  382. func (opts *SJDcloudCloudAccountCreateOptions) Params() (jsonutils.JSONObject, error) {
  383. params := jsonutils.Marshal(opts)
  384. params.(*jsonutils.JSONDict).Add(jsonutils.NewString("JDcloud"), "provider")
  385. return params, nil
  386. }
  387. type SCloudpodsCloudAccountCreateOptions struct {
  388. SCloudAccountCreateBaseOptions
  389. SAccessKeyCredential
  390. AuthURL string `help:"Cloudpods auth_url" positional:"true" json:"auth_url"`
  391. }
  392. func (opts *SCloudpodsCloudAccountCreateOptions) Params() (jsonutils.JSONObject, error) {
  393. params := jsonutils.Marshal(opts)
  394. params.(*jsonutils.JSONDict).Add(jsonutils.NewString("Cloudpods"), "provider")
  395. return params, nil
  396. }
  397. // update credential options
  398. type SCloudAccountIdOptions struct {
  399. ID string `help:"ID or Name of cloud account" json:"-"`
  400. }
  401. func (opts *SCloudAccountIdOptions) GetId() string {
  402. return opts.ID
  403. }
  404. func (opts *SCloudAccountIdOptions) Params() (jsonutils.JSONObject, error) {
  405. return nil, nil
  406. }
  407. type SVMwareCloudAccountUpdateCredentialOptions struct {
  408. SCloudAccountIdOptions
  409. SUserPasswordCredential
  410. Host string `help:"VMware VCenter/ESXi host"`
  411. Port string `help:"VMware VCenter/ESXi host port" default:"443"`
  412. }
  413. func (opts *SVMwareCloudAccountUpdateCredentialOptions) Params() (jsonutils.JSONObject, error) {
  414. return jsonutils.Marshal(opts), nil
  415. }
  416. type SAliyunCloudAccountUpdateCredentialOptions struct {
  417. SCloudAccountIdOptions
  418. SAccessKeyCredential
  419. }
  420. func (opts *SAliyunCloudAccountUpdateCredentialOptions) Params() (jsonutils.JSONObject, error) {
  421. return jsonutils.Marshal(opts), nil
  422. }
  423. type SApsaraCloudAccountUpdateCredentialOptions struct {
  424. SCloudAccountIdOptions
  425. SAccessKeyCredential
  426. OrganizationId int
  427. }
  428. func (opts *SApsaraCloudAccountUpdateCredentialOptions) Params() (jsonutils.JSONObject, error) {
  429. return jsonutils.Marshal(opts), nil
  430. }
  431. type SAzureCloudAccountUpdateCredentialOptions struct {
  432. SCloudAccountIdOptions
  433. SAzureCredential
  434. }
  435. func (opts *SAzureCloudAccountUpdateCredentialOptions) Params() (jsonutils.JSONObject, error) {
  436. return jsonutils.Marshal(opts), nil
  437. }
  438. type SQcloudCloudAccountUpdateCredentialOptions struct {
  439. SCloudAccountIdOptions
  440. SQcloudCredential
  441. }
  442. func (opts *SQcloudCloudAccountUpdateCredentialOptions) Params() (jsonutils.JSONObject, error) {
  443. return jsonutils.Marshal(opts), nil
  444. }
  445. type SAWSCloudAccountUpdateCredentialOptions struct {
  446. SCloudAccountIdOptions
  447. SAccessKeyCredential
  448. }
  449. func (opts *SAWSCloudAccountUpdateCredentialOptions) Params() (jsonutils.JSONObject, error) {
  450. return jsonutils.Marshal(opts), nil
  451. }
  452. type SOpenStackCloudAccountUpdateCredentialOptions struct {
  453. SCloudAccountIdOptions
  454. SOpenStackCredential
  455. }
  456. func (opts *SOpenStackCloudAccountUpdateCredentialOptions) Params() (jsonutils.JSONObject, error) {
  457. return jsonutils.Marshal(opts), nil
  458. }
  459. type SHuaweiCloudAccountUpdateCredentialOptions struct {
  460. SCloudAccountIdOptions
  461. SAccessKeyCredential
  462. }
  463. func (opts *SHuaweiCloudAccountUpdateCredentialOptions) Params() (jsonutils.JSONObject, error) {
  464. return jsonutils.Marshal(opts), nil
  465. }
  466. type SHCSOAccountUpdateCredentialOptions struct {
  467. SCloudAccountIdOptions
  468. cloudprovider.SHCSOEndpoints
  469. SAccessKeyCredential
  470. }
  471. func (opts *SHCSOAccountUpdateCredentialOptions) Params() (jsonutils.JSONObject, error) {
  472. return jsonutils.Marshal(opts), nil
  473. }
  474. type SHCSAccountUpdateCredentialOptions struct {
  475. SCloudAccountIdOptions
  476. SAccessKeyCredential
  477. }
  478. func (opts *SHCSAccountUpdateCredentialOptions) Params() (jsonutils.JSONObject, error) {
  479. return jsonutils.Marshal(opts), nil
  480. }
  481. type SUcloudCloudAccountUpdateCredentialOptions struct {
  482. SCloudAccountIdOptions
  483. SAccessKeyCredential
  484. }
  485. func (opts *SUcloudCloudAccountUpdateCredentialOptions) Params() (jsonutils.JSONObject, error) {
  486. return jsonutils.Marshal(opts), nil
  487. }
  488. type SVolcengineCloudAccountUpdateCredentialOptions struct {
  489. SCloudAccountIdOptions
  490. SUserPasswordCredential
  491. }
  492. func (opts *SVolcengineCloudAccountUpdateCredentialOptions) Params() (jsonutils.JSONObject, error) {
  493. return jsonutils.Marshal(opts), nil
  494. }
  495. type SZStackCloudAccountUpdateCredentialOptions struct {
  496. SCloudAccountIdOptions
  497. SUserPasswordCredential
  498. }
  499. func (opts *SZStackCloudAccountUpdateCredentialOptions) Params() (jsonutils.JSONObject, error) {
  500. return jsonutils.Marshal(opts), nil
  501. }
  502. type SS3CloudAccountUpdateCredentialOptions struct {
  503. SCloudAccountIdOptions
  504. SAccessKeyCredential
  505. }
  506. func (opts *SS3CloudAccountUpdateCredentialOptions) Params() (jsonutils.JSONObject, error) {
  507. return jsonutils.Marshal(opts), nil
  508. }
  509. type SCtyunCloudAccountUpdateCredentialOptions struct {
  510. SCloudAccountIdOptions
  511. SAccessKeyCredential
  512. }
  513. func (opts *SCtyunCloudAccountUpdateCredentialOptions) Params() (jsonutils.JSONObject, error) {
  514. return jsonutils.Marshal(opts), nil
  515. }
  516. type SJDcloudCloudAccountUpdateCredentialOptions struct {
  517. SCloudAccountIdOptions
  518. SAccessKeyCredential
  519. }
  520. func (opts *SJDcloudCloudAccountUpdateCredentialOptions) Params() (jsonutils.JSONObject, error) {
  521. return jsonutils.Marshal(opts), nil
  522. }
  523. type SCloudpodsCloudAccountUpdateCredentialOptions struct {
  524. SCloudAccountIdOptions
  525. SAccessKeyCredential
  526. }
  527. func (opts *SCloudpodsCloudAccountUpdateCredentialOptions) Params() (jsonutils.JSONObject, error) {
  528. return jsonutils.Marshal(opts.SAccessKeyCredential), nil
  529. }
  530. type SGoogleCloudAccountUpdateCredentialOptions struct {
  531. SCloudAccountIdOptions
  532. GoogleJsonFile string `help:"Google auth json file" positional:"true"`
  533. }
  534. func (opts *SGoogleCloudAccountUpdateCredentialOptions) Params() (jsonutils.JSONObject, error) {
  535. return parseGcpCredential(opts.GoogleJsonFile)
  536. }
  537. // update
  538. type SCloudAccountUpdateBaseOptions struct {
  539. SCloudAccountIdOptions
  540. Name string `help:"New name to update"`
  541. SyncIntervalSeconds *int `help:"auto synchornize interval in seconds"`
  542. AutoCreateProject *bool `help:"automatically create local project for new remote project" negative:"no_auto_create_project"`
  543. EnableAutoSyncResource *bool `help:"automatically sync resources" negative:"disable_auto_sync_resource"`
  544. ProxySetting string `help:"proxy setting name or id" json:"proxy_setting"`
  545. SamlAuth string `help:"Enable or disable saml auth" choices:"true|false"`
  546. ReadOnly *bool `help:"is account read only" negative:"no_read_only"`
  547. CleanLakeOfPermissions bool `help:"clean lake of permissions"`
  548. SkipSyncResources []string
  549. AddSkipSyncResources []string
  550. RemoveSkipSyncResources []string
  551. Desc string `help:"Description" json:"description" token:"desc"`
  552. Currency string `choices:"CNY|USD"`
  553. }
  554. func (opts *SCloudAccountUpdateBaseOptions) Params() (jsonutils.JSONObject, error) {
  555. return nil, fmt.Errorf("obsolete, please try cloud-account-update-xxx, where xxx is vmware, aliyun, azure, qcloud, aws, openstack, huawei etc.")
  556. }
  557. type SVMwareCloudAccountUpdateOptions struct {
  558. SCloudAccountUpdateBaseOptions
  559. }
  560. func (opts *SVMwareCloudAccountUpdateOptions) Params() (jsonutils.JSONObject, error) {
  561. return jsonutils.Marshal(opts), nil
  562. }
  563. type SAliyunCloudAccountUpdateOptions struct {
  564. SCloudAccountUpdateBaseOptions
  565. OptionsBillingReportBucket string `help:"update Aliyun S3 bucket that stores account billing report" json:"-"`
  566. RemoveOptionsBillingReportBucket bool `help:"remove Aliyun S3 bucket that stores account billing report" json:"-"`
  567. OptionsBillingBucketAccount string `help:"update id of account that can access bucket, blank if this account can access" json:"-"`
  568. RemoveOptionsBillingBucketAccount bool `help:"remove id of account that can access bucket, blank if this account can access" json:"-"`
  569. OptionsBillingFilePrefix string `help:"update prefix of billing file name" json:"-"`
  570. RemoveOptionsBillingFilePrefix bool `help:"remove prefix of billing file name" json:"-"`
  571. OptionsBillingScope string `help:"update billing scope" choices:"all|managed" json:"-"`
  572. RemoveOptionsBillingScope bool `help:"remove billing scope" json:"-"`
  573. }
  574. func (opts *SAliyunCloudAccountUpdateOptions) Params() (jsonutils.JSONObject, error) {
  575. params := jsonutils.Marshal(opts).(*jsonutils.JSONDict)
  576. options := jsonutils.NewDict()
  577. if len(opts.OptionsBillingReportBucket) > 0 {
  578. options.Add(jsonutils.NewString(opts.OptionsBillingReportBucket), "billing_report_bucket")
  579. }
  580. if len(opts.OptionsBillingBucketAccount) > 0 {
  581. options.Add(jsonutils.NewString(opts.OptionsBillingBucketAccount), "billing_bucket_account")
  582. }
  583. if len(opts.OptionsBillingFilePrefix) > 0 {
  584. options.Add(jsonutils.NewString(opts.OptionsBillingFilePrefix), "billing_file_prefix")
  585. }
  586. if len(opts.OptionsBillingScope) > 0 {
  587. options.Add(jsonutils.NewString(opts.OptionsBillingScope), "billing_scope")
  588. }
  589. if options.Size() > 0 {
  590. params.Add(options, "options")
  591. }
  592. removeOptions := make([]string, 0)
  593. if opts.RemoveOptionsBillingReportBucket {
  594. removeOptions = append(removeOptions, "billing_report_bucket")
  595. }
  596. if opts.RemoveOptionsBillingBucketAccount {
  597. removeOptions = append(removeOptions, "billing_bucket_account")
  598. }
  599. if opts.RemoveOptionsBillingFilePrefix {
  600. removeOptions = append(removeOptions, "billing_file_prefix")
  601. }
  602. if opts.RemoveOptionsBillingScope {
  603. removeOptions = append(removeOptions, "billing_scope")
  604. }
  605. if len(removeOptions) > 0 {
  606. params.Add(jsonutils.NewStringArray(removeOptions), "remove_options")
  607. }
  608. return params, nil
  609. }
  610. type SAzureCloudAccountUpdateOptions struct {
  611. SCloudAccountUpdateBaseOptions
  612. OptionsBalanceKey string `help:"update cloud balance account key, such as Azure EA key" json:"-"`
  613. RemoveOptionsBalanceKey bool `help:"remove cloud blance account key" json:"-"`
  614. RemoveOptionsBillingScope bool
  615. OptionsBillingReportBucket string `help:"update Azure bucket that stores account billing report" json:"-"`
  616. OptionsBillingScope string `help:"update billing scope" choices:"all|managed" json:"-"`
  617. RemoveOptionsBillingReportBucket bool `help:"remove Azure bucket that stores account billing report" json:"-"`
  618. }
  619. func (opts *SAzureCloudAccountUpdateOptions) Params() (jsonutils.JSONObject, error) {
  620. params := jsonutils.Marshal(opts).(*jsonutils.JSONDict)
  621. options := jsonutils.NewDict()
  622. if len(opts.OptionsBalanceKey) > 0 {
  623. options.Add(jsonutils.NewString(opts.OptionsBalanceKey), "balance_key")
  624. }
  625. if len(opts.OptionsBillingReportBucket) > 0 {
  626. options.Add(jsonutils.NewString(opts.OptionsBillingReportBucket), "billing_report_bucket")
  627. }
  628. if len(opts.OptionsBillingScope) > 0 {
  629. options.Add(jsonutils.NewString(opts.OptionsBillingScope), "billing_scope")
  630. }
  631. if options.Size() > 0 {
  632. params.Add(options, "options")
  633. }
  634. removeOptions := make([]string, 0)
  635. if opts.RemoveOptionsBalanceKey {
  636. removeOptions = append(removeOptions, "balance_key")
  637. removeOptions = append(removeOptions, "enrollment_number")
  638. }
  639. if opts.RemoveOptionsBillingScope {
  640. removeOptions = append(removeOptions, "billing_scope")
  641. }
  642. if opts.RemoveOptionsBillingReportBucket {
  643. removeOptions = append(removeOptions, "billing_report_bucket")
  644. }
  645. if len(removeOptions) > 0 {
  646. params.Add(jsonutils.NewStringArray(removeOptions), "remove_options")
  647. }
  648. return params, nil
  649. }
  650. type SQcloudCloudAccountUpdateOptions struct {
  651. SCloudAccountUpdateBaseOptions
  652. OptionsBillingReportBucket string `help:"update TencentCloud S3 bucket that stores account billing report" json:"-"`
  653. RemoveOptionsBillingReportBucket bool `help:"remove TencentCloud S3 bucket that stores account billing report" json:"-"`
  654. }
  655. func (opts *SQcloudCloudAccountUpdateOptions) Params() (jsonutils.JSONObject, error) {
  656. params := jsonutils.Marshal(opts).(*jsonutils.JSONDict)
  657. options := jsonutils.NewDict()
  658. if len(opts.OptionsBillingReportBucket) > 0 {
  659. options.Add(jsonutils.NewString(opts.OptionsBillingReportBucket), "billing_report_bucket")
  660. }
  661. if options.Size() > 0 {
  662. params.Add(options, "options")
  663. }
  664. removeOptions := make([]string, 0)
  665. if opts.RemoveOptionsBillingReportBucket {
  666. removeOptions = append(removeOptions, "billing_report_bucket")
  667. }
  668. if len(removeOptions) > 0 {
  669. params.Add(jsonutils.NewStringArray(removeOptions), "remove_options")
  670. }
  671. return params, nil
  672. }
  673. type SGoogleCloudAccountUpdateOptions struct {
  674. SCloudAccountUpdateBaseOptions
  675. OptionsBillingReportBigqueryTable string `help:"update Google big query table that stores account billing report" json:"-"`
  676. OptionsBillingReportBigqueryAccount string `help:"update Google account for big query table" json:"-"`
  677. OptionsBillingReportBucket string `help:"update Google S3 bucket that stores account billing report" json:"-"`
  678. RemoveOptionsBillingReportBucket bool `help:"remove Google S3 bucket that stores account billing report" json:"-"`
  679. OptionsBillingBucketAccount string `help:"update id of account that can access bucket, blank if this account can access" json:"-"`
  680. RemoveOptionsBillingBucketAccount bool `help:"remove id of account that can access bucket, blank if this account can access" json:"-"`
  681. OptionsBillingFilePrefix string `help:"update prefix of billing file name" json:"-"`
  682. RemoveOptionsBillingFilePrefix bool `help:"remove prefix of billing file name" json:"-"`
  683. OptionsUsageReportBucket string `help:"update Google S3 bucket that stores account usage report" json:"-"`
  684. RemoveOptionsUsageReportBucket bool `help:"remove Google S3 bucket that stores account usage report" json:"-"`
  685. OptionsUsageFilePrefix string `help:"update prefix of usage file name" json:"-"`
  686. RemoveOptionsUsageFilePrefix bool `help:"remove prefix of usage file name" json:"-"`
  687. }
  688. func (opts *SGoogleCloudAccountUpdateOptions) Params() (jsonutils.JSONObject, error) {
  689. params := jsonutils.Marshal(opts).(*jsonutils.JSONDict)
  690. options := jsonutils.NewDict()
  691. if len(opts.OptionsBillingReportBigqueryTable) > 0 {
  692. options.Add(jsonutils.NewString(opts.OptionsBillingReportBigqueryTable), "billing_bigquery_table")
  693. }
  694. if len(opts.OptionsBillingReportBigqueryAccount) > 0 {
  695. options.Add(jsonutils.NewString(opts.OptionsBillingReportBigqueryAccount), "billing_bigquery_account")
  696. }
  697. if len(opts.OptionsBillingReportBucket) > 0 {
  698. options.Add(jsonutils.NewString(opts.OptionsBillingReportBucket), "billing_report_bucket")
  699. }
  700. if len(opts.OptionsBillingBucketAccount) > 0 {
  701. options.Add(jsonutils.NewString(opts.OptionsBillingBucketAccount), "billing_bucket_account")
  702. }
  703. if len(opts.OptionsBillingFilePrefix) > 0 {
  704. options.Add(jsonutils.NewString(opts.OptionsBillingFilePrefix), "billing_file_prefix")
  705. }
  706. if len(opts.OptionsUsageReportBucket) > 0 {
  707. options.Add(jsonutils.NewString(opts.OptionsUsageReportBucket), "usage_report_bucket")
  708. }
  709. if len(opts.OptionsUsageFilePrefix) > 0 {
  710. options.Add(jsonutils.NewString(opts.OptionsUsageFilePrefix), "usage_file_prefix")
  711. }
  712. if options.Size() > 0 {
  713. params.Add(options, "options")
  714. }
  715. removeOptions := make([]string, 0)
  716. if opts.RemoveOptionsBillingReportBucket {
  717. removeOptions = append(removeOptions, "billing_report_bucket")
  718. }
  719. if opts.RemoveOptionsBillingBucketAccount {
  720. removeOptions = append(removeOptions, "billing_bucket_account")
  721. }
  722. if opts.RemoveOptionsBillingFilePrefix {
  723. removeOptions = append(removeOptions, "billing_file_prefix")
  724. }
  725. if opts.RemoveOptionsUsageReportBucket {
  726. removeOptions = append(removeOptions, "usage_report_bucket")
  727. }
  728. if opts.RemoveOptionsUsageFilePrefix {
  729. removeOptions = append(removeOptions, "usage_file_prefix")
  730. }
  731. if len(removeOptions) > 0 {
  732. params.Add(jsonutils.NewStringArray(removeOptions), "remove_options")
  733. }
  734. return params, nil
  735. }
  736. type SAWSCloudAccountUpdateOptions struct {
  737. SCloudAccountUpdateBaseOptions
  738. OptionsBillingReportBucket string `help:"update AWS S3 bucket that stores account billing report" json:"-"`
  739. RemoveOptionsBillingReportBucket bool `help:"remove AWS S3 bucket that stores account billing report" json:"-"`
  740. OptionsBillingBucketAccount string `help:"update id of account that can access bucket, blank if this account can access" json:"-"`
  741. RemoveOptionsBillingBucketAccount bool `help:"remove id of account that can access bucket, blank if this account can access" json:"-"`
  742. OptionsBillingFilePrefix string `help:"update prefix of billing file name" json:"-"`
  743. RemoveOptionsBillingFilePrefix bool `help:"remove prefix of billing file name" json:"-"`
  744. OptionsAssumeRoleName string `help:"name of assume role" json:"-"`
  745. RemoveOptionsAssumeRoleName bool `help:"remove option of aws_assume_role_name"`
  746. }
  747. func (opts *SAWSCloudAccountUpdateOptions) Params() (jsonutils.JSONObject, error) {
  748. params := jsonutils.Marshal(opts).(*jsonutils.JSONDict)
  749. options := jsonutils.NewDict()
  750. if len(opts.OptionsBillingReportBucket) > 0 {
  751. options.Add(jsonutils.NewString(opts.OptionsBillingReportBucket), "billing_report_bucket")
  752. }
  753. if len(opts.OptionsBillingBucketAccount) > 0 {
  754. options.Add(jsonutils.NewString(opts.OptionsBillingBucketAccount), "billing_bucket_account")
  755. }
  756. if len(opts.OptionsBillingFilePrefix) > 0 {
  757. options.Add(jsonutils.NewString(opts.OptionsBillingFilePrefix), "billing_file_prefix")
  758. }
  759. if len(opts.OptionsAssumeRoleName) > 0 {
  760. options.Add(jsonutils.NewString(opts.OptionsAssumeRoleName), "aws_assume_role_name")
  761. }
  762. if options.Size() > 0 {
  763. params.Add(options, "options")
  764. }
  765. removeOptions := make([]string, 0)
  766. if opts.RemoveOptionsBillingReportBucket {
  767. removeOptions = append(removeOptions, "billing_report_bucket")
  768. }
  769. if opts.RemoveOptionsBillingBucketAccount {
  770. removeOptions = append(removeOptions, "billing_bucket_account")
  771. }
  772. if opts.RemoveOptionsBillingFilePrefix {
  773. removeOptions = append(removeOptions, "billing_file_prefix")
  774. }
  775. if opts.RemoveOptionsAssumeRoleName {
  776. removeOptions = append(removeOptions, "aws_assume_role_name")
  777. }
  778. if len(removeOptions) > 0 {
  779. params.Add(jsonutils.NewStringArray(removeOptions), "remove_options")
  780. }
  781. return params, nil
  782. }
  783. type SOpenStackCloudAccountUpdateOptions struct {
  784. SCloudAccountUpdateBaseOptions
  785. }
  786. func (opts *SOpenStackCloudAccountUpdateOptions) Params() (jsonutils.JSONObject, error) {
  787. return jsonutils.Marshal(opts), nil
  788. }
  789. type SHuaweiCloudAccountUpdateOptions struct {
  790. SCloudAccountUpdateBaseOptions
  791. OptionsBillingReportBucket string `help:"update Huawei S3 bucket that stores account billing report" json:"-"`
  792. RemoveOptionsBillingReportBucket bool `help:"remove Huawei S3 bucket that stores account billing report" json:"-"`
  793. OptionsBillingBucketAccount string `help:"update id of account that can access bucket, blank if this account can access" json:"-"`
  794. RemoveOptionsBillingBucketAccount bool `help:"remove id of account that can access bucket, blank if this account can access" json:"-"`
  795. OptionsBillingFilePrefix string `help:"update prefix of billing file name" json:"-"`
  796. RemoveOptionsBillingFilePrefix bool `help:"remove prefix of billing file name" json:"-"`
  797. }
  798. func (opts *SHuaweiCloudAccountUpdateOptions) Params() (jsonutils.JSONObject, error) {
  799. params := jsonutils.Marshal(opts).(*jsonutils.JSONDict)
  800. options := jsonutils.NewDict()
  801. if len(opts.OptionsBillingReportBucket) > 0 {
  802. options.Add(jsonutils.NewString(opts.OptionsBillingReportBucket), "billing_report_bucket")
  803. }
  804. if len(opts.OptionsBillingBucketAccount) > 0 {
  805. options.Add(jsonutils.NewString(opts.OptionsBillingBucketAccount), "billing_bucket_account")
  806. }
  807. if len(opts.OptionsBillingFilePrefix) > 0 {
  808. options.Add(jsonutils.NewString(opts.OptionsBillingFilePrefix), "billing_file_prefix")
  809. }
  810. if options.Size() > 0 {
  811. params.Add(options, "options")
  812. }
  813. removeOptions := make([]string, 0)
  814. if opts.RemoveOptionsBillingReportBucket {
  815. removeOptions = append(removeOptions, "billing_report_bucket")
  816. }
  817. if opts.RemoveOptionsBillingBucketAccount {
  818. removeOptions = append(removeOptions, "billing_bucket_account")
  819. }
  820. if opts.RemoveOptionsBillingFilePrefix {
  821. removeOptions = append(removeOptions, "billing_file_prefix")
  822. }
  823. if len(removeOptions) > 0 {
  824. params.Add(jsonutils.NewStringArray(removeOptions), "remove_options")
  825. }
  826. return params, nil
  827. }
  828. type SHCSOAccountUpdateOptions struct {
  829. SCloudAccountUpdateBaseOptions
  830. }
  831. func (opts *SHCSOAccountUpdateOptions) Params() (jsonutils.JSONObject, error) {
  832. return jsonutils.Marshal(opts), nil
  833. }
  834. type SHCSAccountUpdateOptions struct {
  835. SCloudAccountUpdateBaseOptions
  836. Account string
  837. Password string
  838. }
  839. func (opts *SHCSAccountUpdateOptions) Params() (jsonutils.JSONObject, error) {
  840. params := jsonutils.Marshal(opts.SCloudAccountUpdateBaseOptions).(*jsonutils.JSONDict)
  841. options := jsonutils.NewDict()
  842. if len(opts.Account) > 0 {
  843. options.Set("account", jsonutils.NewString(opts.Account))
  844. }
  845. if len(opts.Password) > 0 {
  846. options.Set("password", jsonutils.NewString(opts.Password))
  847. }
  848. if options.Length() > 0 {
  849. params.Set("options", options)
  850. }
  851. return params, nil
  852. }
  853. type SUcloudCloudAccountUpdateOptions struct {
  854. SCloudAccountUpdateBaseOptions
  855. }
  856. func (opts *SUcloudCloudAccountUpdateOptions) Params() (jsonutils.JSONObject, error) {
  857. return jsonutils.Marshal(opts), nil
  858. }
  859. type SVolcengineCloudAccountUpdateOptions struct {
  860. SCloudAccountUpdateBaseOptions
  861. OptionsBillingReportBucket string `help:"update VolcEngine S3 bucket that stores account billing report" json:"-"`
  862. RemoveOptionsBillingReportBucket bool `help:"remove VolcEngine S3 bucket that stores account billing report" json:"-"`
  863. }
  864. func (opts *SVolcengineCloudAccountUpdateOptions) Params() (jsonutils.JSONObject, error) {
  865. params := jsonutils.Marshal(opts).(*jsonutils.JSONDict)
  866. options := jsonutils.NewDict()
  867. if len(opts.OptionsBillingReportBucket) > 0 {
  868. options.Add(jsonutils.NewString(opts.OptionsBillingReportBucket), "billing_report_bucket")
  869. }
  870. if options.Size() > 0 {
  871. params.Add(options, "options")
  872. }
  873. removeOptions := make([]string, 0)
  874. if opts.RemoveOptionsBillingReportBucket {
  875. removeOptions = append(removeOptions, "billing_report_bucket")
  876. }
  877. if len(removeOptions) > 0 {
  878. params.Add(jsonutils.NewStringArray(removeOptions), "remove_options")
  879. }
  880. return params, nil
  881. }
  882. type SZStackCloudAccountUpdateOptions struct {
  883. SCloudAccountUpdateBaseOptions
  884. }
  885. func (opts *SZStackCloudAccountUpdateOptions) Params() (jsonutils.JSONObject, error) {
  886. return jsonutils.Marshal(opts), nil
  887. }
  888. type SS3CloudAccountUpdateOptions struct {
  889. SCloudAccountUpdateBaseOptions
  890. }
  891. func (opts *SS3CloudAccountUpdateOptions) Params() (jsonutils.JSONObject, error) {
  892. return jsonutils.Marshal(opts), nil
  893. }
  894. type SCtyunCloudAccountUpdateOptions struct {
  895. SCloudAccountUpdateBaseOptions
  896. }
  897. func (opts *SCtyunCloudAccountUpdateOptions) Params() (jsonutils.JSONObject, error) {
  898. params := jsonutils.Marshal(opts).(*jsonutils.JSONDict)
  899. options := jsonutils.NewDict()
  900. if options.Size() > 0 {
  901. params.Add(options, "options")
  902. }
  903. return params, nil
  904. }
  905. type SJDcloudCloudAccountUpdateOptions struct {
  906. SCloudAccountUpdateBaseOptions
  907. }
  908. func (opts *SJDcloudCloudAccountUpdateOptions) Params() (jsonutils.JSONObject, error) {
  909. return jsonutils.Marshal(opts), nil
  910. }
  911. type SCloudpodsCloudAccountUpdateOptions struct {
  912. SCloudAccountUpdateBaseOptions
  913. }
  914. func (opts *SCloudpodsCloudAccountUpdateOptions) Params() (jsonutils.JSONObject, error) {
  915. return jsonutils.Marshal(opts), nil
  916. }
  917. /*type SVMwareCloudAccountPrepareNetsOptions struct {
  918. SVMwareCredentialWithEnvironment
  919. Zone string `help:"zone for this account"`
  920. Project string `help:"project for this account"`
  921. ProjectDomain string `help:"domain for this account"`
  922. WireLevel string `help:"wire level for this account" choices:"vcenter|datacenter|cluster" json:"wire_level_for_vmware"`
  923. Dvs bool `help:"whether to enable dvs corresponding wire"`
  924. NAME string `help:"name for this account"`
  925. }
  926. func (opts *SVMwareCloudAccountPrepareNetsOptions) Params() (jsonutils.JSONObject, error) {
  927. params := jsonutils.Marshal(opts)
  928. params.(*jsonutils.JSONDict).Add(jsonutils.NewString("VMware"), "provider")
  929. return params, nil
  930. }*/
  931. type SApsaraCloudAccountCreateOptions struct {
  932. SCloudAccountCreateBaseOptions
  933. Endpoint string
  934. SAccessKeyCredential
  935. }
  936. func (opts *SApsaraCloudAccountCreateOptions) Params() (jsonutils.JSONObject, error) {
  937. params := jsonutils.Marshal(opts)
  938. params.(*jsonutils.JSONDict).Add(jsonutils.NewString("Apsara"), "provider")
  939. return params, nil
  940. }
  941. type CloudaccountUpdateCredentialOptions struct {
  942. SCloudAccountIdOptions
  943. AccessKeyID string `help:"Aiyun|HuaWei|Aws access_key_id"`
  944. AccessKeySecret string `help:"Aiyun|HuaWei|Aws access_key_secret"`
  945. AppID string `help:"Qcloud appid"`
  946. SecretID string `help:"Qcloud secret_id"`
  947. SecretKey string `help:"Qcloud secret_key"`
  948. ProjectName string `help:"OpenStack project_name"`
  949. Username string `help:"OpenStack|VMware username"`
  950. Password string `help:"OpenStack|VMware password"`
  951. EndpointType string `help:"OpenStack endpointType"`
  952. ClientID string `help:"Azure tenant_id"`
  953. ClientSecret string `help:"Azure clinet_secret"`
  954. }
  955. func (opts *CloudaccountUpdateCredentialOptions) Params() (jsonutils.JSONObject, error) {
  956. return nil, fmt.Errorf("obsolete command, please try cloud-account-update-credential-xxx, where xxx is vmware, aliyun, azure, qcloud, aws, openstack, huawei, etc.")
  957. }
  958. type CloudaccountSyncOptions struct {
  959. SCloudAccountIdOptions
  960. api.SyncRangeInput
  961. }
  962. func (opts *CloudaccountSyncOptions) Params() (jsonutils.JSONObject, error) {
  963. return jsonutils.Marshal(opts), nil
  964. }
  965. type CloudaccountEnableAutoSyncOptions struct {
  966. SCloudAccountIdOptions
  967. SyncIntervalSeconds int `help:"new sync interval in seconds"`
  968. }
  969. func (opts *CloudaccountEnableAutoSyncOptions) Params() (jsonutils.JSONObject, error) {
  970. return baseoptions.StructToParams(opts)
  971. }
  972. type CloudaccountPublicOptions struct {
  973. SCloudAccountIdOptions
  974. Scope string `help:"public_sccope" choices:"domain|system" json:"scope"`
  975. SharedDomains []string `help:"shared domains" json:"shared_domains"`
  976. ShareMode string `help:"share_mode" choices:"account_domain|provider_domain|system"`
  977. }
  978. func (opts *CloudaccountPublicOptions) Params() (jsonutils.JSONObject, error) {
  979. return jsonutils.Marshal(opts), nil
  980. }
  981. type CloudaccountShareModeOptions struct {
  982. SCloudAccountIdOptions
  983. MODE string `help:"cloud account share mode" choices:"account_domain|system|provider_domain"`
  984. }
  985. func (opts *CloudaccountShareModeOptions) Params() (jsonutils.JSONObject, error) {
  986. return jsonutils.Marshal(map[string]string{"share_mode": opts.MODE}), nil
  987. }
  988. type CloudaccountSyncSkusOptions struct {
  989. SCloudAccountIdOptions
  990. RESOURCE string `help:"Resource of skus" choices:"serversku|elasticcachesku|dbinstance_sku|nat_sku|nas_sku"`
  991. Force bool `help:"Force sync no matter what"`
  992. Cloudprovider string `help:"provider to sync"`
  993. Region string `help:"region to sync"`
  994. }
  995. func (opts *CloudaccountSyncSkusOptions) Params() (jsonutils.JSONObject, error) {
  996. params := jsonutils.NewDict()
  997. params.Set("resource", jsonutils.NewString(opts.RESOURCE))
  998. if opts.Force {
  999. params.Add(jsonutils.JSONTrue, "force")
  1000. }
  1001. if len(opts.Cloudprovider) > 0 {
  1002. params.Add(jsonutils.NewString(opts.Cloudprovider), "cloudprovider")
  1003. }
  1004. if len(opts.Region) > 0 {
  1005. params.Add(jsonutils.NewString(opts.Region), "cloudregion")
  1006. }
  1007. return params, nil
  1008. }
  1009. type ClouaccountChangeOwnerOptions struct {
  1010. SCloudAccountIdOptions
  1011. ProjectDomain string `json:"project_domain" help:"target domain"`
  1012. }
  1013. func (opts *ClouaccountChangeOwnerOptions) Params() (jsonutils.JSONObject, error) {
  1014. if len(opts.ProjectDomain) == 0 {
  1015. return nil, fmt.Errorf("empty project_domain")
  1016. }
  1017. return jsonutils.Marshal(opts), nil
  1018. }
  1019. type ClouaccountChangeProjectOptions struct {
  1020. SCloudAccountIdOptions
  1021. PROJECT string `json:"project" help:"target domain"`
  1022. }
  1023. func (opts *ClouaccountChangeProjectOptions) Params() (jsonutils.JSONObject, error) {
  1024. return jsonutils.Marshal(opts), nil
  1025. }
  1026. type SubscriptionCreateOptions struct {
  1027. SCloudAccountIdOptions
  1028. NAME string
  1029. ENROLLMENTACCOUNT string
  1030. OfferType string `choices:"MS-AZR-0148P|MS-AZR-0017P" default:"MS-AZR-0017P"`
  1031. }
  1032. func (opts *SubscriptionCreateOptions) Params() (jsonutils.JSONObject, error) {
  1033. return jsonutils.Marshal(map[string]string{
  1034. "name": opts.NAME,
  1035. "offer_type": opts.OfferType,
  1036. "enrollment_account_id": opts.ENROLLMENTACCOUNT,
  1037. }), nil
  1038. }
  1039. type ClouaccountProjectMappingOptions struct {
  1040. SCloudAccountIdOptions
  1041. ProjectId string `json:"project_id" help:"default project id"`
  1042. AutoCreateProject bool `help:"auto create project"`
  1043. ProjectMappingId string `json:"project_mapping_id" help:"project mapping id"`
  1044. EnableProjectSync bool
  1045. EnableResourceSync bool
  1046. }
  1047. func (opts *ClouaccountProjectMappingOptions) Params() (jsonutils.JSONObject, error) {
  1048. return jsonutils.Marshal(opts), nil
  1049. }
  1050. type SNutanixCloudAccountCreateOptions struct {
  1051. SCloudAccountCreateBaseOptions
  1052. SNutanixCredentialWithEnvironment
  1053. }
  1054. func (opts *SNutanixCloudAccountCreateOptions) Params() (jsonutils.JSONObject, error) {
  1055. params := jsonutils.Marshal(opts)
  1056. params.(*jsonutils.JSONDict).Add(jsonutils.NewString("Nutanix"), "provider")
  1057. return params, nil
  1058. }
  1059. type SNutanixCloudAccountUpdateCredentialOptions struct {
  1060. SCloudAccountIdOptions
  1061. SUserPasswordCredential
  1062. }
  1063. func (opts *SNutanixCloudAccountUpdateCredentialOptions) Params() (jsonutils.JSONObject, error) {
  1064. return jsonutils.Marshal(opts.SUserPasswordCredential), nil
  1065. }
  1066. type SNutanixCloudAccountUpdateOptions struct {
  1067. SCloudAccountUpdateBaseOptions
  1068. }
  1069. func (opts *SNutanixCloudAccountUpdateOptions) Params() (jsonutils.JSONObject, error) {
  1070. return jsonutils.Marshal(opts), nil
  1071. }
  1072. type SBingoCloudAccountCreateOptions struct {
  1073. SCloudAccountCreateBaseOptions
  1074. Endpoint string
  1075. SAccessKeyCredential
  1076. }
  1077. func (opts *SBingoCloudAccountCreateOptions) Params() (jsonutils.JSONObject, error) {
  1078. params := jsonutils.Marshal(opts)
  1079. params.(*jsonutils.JSONDict).Add(jsonutils.NewString("BingoCloud"), "provider")
  1080. return params, nil
  1081. }
  1082. type SBingoCloudAccountUpdateOptions struct {
  1083. SCloudAccountUpdateBaseOptions
  1084. }
  1085. func (opts *SBingoCloudAccountUpdateOptions) Params() (jsonutils.JSONObject, error) {
  1086. return jsonutils.Marshal(opts), nil
  1087. }
  1088. type SBingoCloudAccountUpdateCredentialOptions struct {
  1089. SCloudAccountIdOptions
  1090. SAccessKeyCredential
  1091. }
  1092. func (opts *SBingoCloudAccountUpdateCredentialOptions) Params() (jsonutils.JSONObject, error) {
  1093. return jsonutils.Marshal(opts.SAccessKeyCredential), nil
  1094. }
  1095. type SInCloudSphereAccountCreateOptions struct {
  1096. SCloudAccountCreateBaseOptions
  1097. HOST string
  1098. SAccessKeyCredential
  1099. }
  1100. func (opts *SInCloudSphereAccountCreateOptions) Params() (jsonutils.JSONObject, error) {
  1101. params := jsonutils.Marshal(opts)
  1102. params.(*jsonutils.JSONDict).Add(jsonutils.NewString(api.CLOUD_PROVIDER_INCLOUD_SPHERE), "provider")
  1103. return params, nil
  1104. }
  1105. type SInCloudSphereAccountUpdateOptions struct {
  1106. SCloudAccountUpdateBaseOptions
  1107. }
  1108. func (opts *SInCloudSphereAccountUpdateOptions) Params() (jsonutils.JSONObject, error) {
  1109. return jsonutils.Marshal(opts), nil
  1110. }
  1111. type SInCloudSphereAccountUpdateCredentialOptions struct {
  1112. SCloudAccountIdOptions
  1113. SAccessKeyCredential
  1114. }
  1115. func (opts *SInCloudSphereAccountUpdateCredentialOptions) Params() (jsonutils.JSONObject, error) {
  1116. return jsonutils.Marshal(opts.SAccessKeyCredential), nil
  1117. }
  1118. type SProxmoxAccountCreateOptions struct {
  1119. SCloudAccountCreateBaseOptions
  1120. SProxmoxCredentialWithEnvironment
  1121. }
  1122. func (opts *SProxmoxAccountCreateOptions) Params() (jsonutils.JSONObject, error) {
  1123. params := jsonutils.Marshal(opts)
  1124. params.(*jsonutils.JSONDict).Add(jsonutils.NewString(api.CLOUD_PROVIDER_PROXMOX), "provider")
  1125. return params, nil
  1126. }
  1127. type SProxmoxAccountUpdateOptions struct {
  1128. SCloudAccountUpdateBaseOptions
  1129. }
  1130. func (opts *SProxmoxAccountUpdateOptions) Params() (jsonutils.JSONObject, error) {
  1131. return jsonutils.Marshal(opts), nil
  1132. }
  1133. type SProxmoxAccountUpdateCredentialOptions struct {
  1134. SCloudAccountIdOptions
  1135. SUserPasswordCredential
  1136. }
  1137. func (opts *SProxmoxAccountUpdateCredentialOptions) Params() (jsonutils.JSONObject, error) {
  1138. return jsonutils.Marshal(opts.SUserPasswordCredential), nil
  1139. }
  1140. type SRemoteFileAccountCreateOptions struct {
  1141. SCloudAccountCreateBaseOptions
  1142. AuthURL string
  1143. }
  1144. func (opts *SRemoteFileAccountCreateOptions) Params() (jsonutils.JSONObject, error) {
  1145. params := jsonutils.Marshal(opts)
  1146. params.(*jsonutils.JSONDict).Add(jsonutils.NewString(api.CLOUD_PROVIDER_REMOTEFILE), "provider")
  1147. return params, nil
  1148. }
  1149. type SKsyunCloudAccountCreateOptions struct {
  1150. SCloudAccountCreateBaseOptions
  1151. SAccessKeyCredential
  1152. OptionsBillingReportBucket string `help:"update Ksyun S3 bucket that stores account billing report" json:"-"`
  1153. }
  1154. func (opts *SKsyunCloudAccountCreateOptions) Params() (jsonutils.JSONObject, error) {
  1155. params := jsonutils.Marshal(opts)
  1156. options := params.(*jsonutils.JSONDict)
  1157. options.Add(jsonutils.NewString("Ksyun"), "provider")
  1158. if len(opts.OptionsBillingReportBucket) > 0 {
  1159. options.Set("billing_report_bucket", jsonutils.NewString(opts.OptionsBillingReportBucket))
  1160. }
  1161. return options, nil
  1162. }
  1163. type SKsyunCloudAccountUpdateOptions struct {
  1164. SCloudAccountUpdateBaseOptions
  1165. OptionsBillingReportBucket string `help:"update VolcEngine S3 bucket that stores account billing report" json:"-"`
  1166. RemoveOptionsBillingReportBucket bool `help:"remove VolcEngine S3 bucket that stores account billing report" json:"-"`
  1167. }
  1168. func (opts *SKsyunCloudAccountUpdateOptions) Params() (jsonutils.JSONObject, error) {
  1169. params := jsonutils.Marshal(opts).(*jsonutils.JSONDict)
  1170. options := jsonutils.NewDict()
  1171. if len(opts.OptionsBillingReportBucket) > 0 {
  1172. options.Add(jsonutils.NewString(opts.OptionsBillingReportBucket), "billing_report_bucket")
  1173. }
  1174. if options.Size() > 0 {
  1175. params.Add(options, "options")
  1176. }
  1177. removeOptions := make([]string, 0)
  1178. if opts.RemoveOptionsBillingReportBucket {
  1179. removeOptions = append(removeOptions, "billing_report_bucket")
  1180. }
  1181. if len(removeOptions) > 0 {
  1182. params.Add(jsonutils.NewStringArray(removeOptions), "remove_options")
  1183. }
  1184. return params, nil
  1185. }
  1186. type SKsyunCloudAccountUpdateCredentialOptions struct {
  1187. SCloudAccountIdOptions
  1188. SAccessKeyCredential
  1189. }
  1190. func (opts *SKsyunCloudAccountUpdateCredentialOptions) Params() (jsonutils.JSONObject, error) {
  1191. return jsonutils.Marshal(opts), nil
  1192. }
  1193. type SBaiduCloudAccountCreateOptions struct {
  1194. SCloudAccountCreateBaseOptions
  1195. SAccessKeyCredential
  1196. }
  1197. func (opts *SBaiduCloudAccountCreateOptions) Params() (jsonutils.JSONObject, error) {
  1198. params := jsonutils.Marshal(opts)
  1199. params.(*jsonutils.JSONDict).Add(jsonutils.NewString("Baidu"), "provider")
  1200. return params, nil
  1201. }
  1202. type SBaiduCloudAccountUpdateOptions struct {
  1203. SCloudAccountUpdateBaseOptions
  1204. }
  1205. func (opts *SBaiduCloudAccountUpdateOptions) Params() (jsonutils.JSONObject, error) {
  1206. params := jsonutils.Marshal(opts).(*jsonutils.JSONDict)
  1207. return params, nil
  1208. }
  1209. type SBaiduCloudAccountUpdateCredentialOptions struct {
  1210. SCloudAccountIdOptions
  1211. SAccessKeyCredential
  1212. }
  1213. func (opts *SBaiduCloudAccountUpdateCredentialOptions) Params() (jsonutils.JSONObject, error) {
  1214. return jsonutils.Marshal(opts), nil
  1215. }
  1216. type SCucloudCloudAccountCreateOptions struct {
  1217. SCloudAccountCreateBaseOptions
  1218. SAccessKeyCredential
  1219. }
  1220. func (opts *SCucloudCloudAccountCreateOptions) Params() (jsonutils.JSONObject, error) {
  1221. params := jsonutils.Marshal(opts)
  1222. params.(*jsonutils.JSONDict).Add(jsonutils.NewString("ChinaUnion"), "provider")
  1223. return params, nil
  1224. }
  1225. type SCucloudCloudAccountUpdateOptions struct {
  1226. SCloudAccountUpdateBaseOptions
  1227. }
  1228. func (opts *SCucloudCloudAccountUpdateOptions) Params() (jsonutils.JSONObject, error) {
  1229. params := jsonutils.Marshal(opts).(*jsonutils.JSONDict)
  1230. return params, nil
  1231. }
  1232. type SCucloudCloudAccountUpdateCredentialOptions struct {
  1233. SCloudAccountIdOptions
  1234. SAccessKeyCredential
  1235. }
  1236. func (opts *SCucloudCloudAccountUpdateCredentialOptions) Params() (jsonutils.JSONObject, error) {
  1237. return jsonutils.Marshal(opts), nil
  1238. }
  1239. type SQingCloudCloudAccountCreateOptions struct {
  1240. SCloudAccountCreateBaseOptions
  1241. SAccessKeyCredential
  1242. }
  1243. func (opts *SQingCloudCloudAccountCreateOptions) Params() (jsonutils.JSONObject, error) {
  1244. params := jsonutils.Marshal(opts)
  1245. params.(*jsonutils.JSONDict).Add(jsonutils.NewString("QingCloud"), "provider")
  1246. return params, nil
  1247. }
  1248. type SQingCloudCloudAccountUpdateOptions struct {
  1249. SCloudAccountUpdateBaseOptions
  1250. }
  1251. func (opts *SQingCloudCloudAccountUpdateOptions) Params() (jsonutils.JSONObject, error) {
  1252. params := jsonutils.Marshal(opts).(*jsonutils.JSONDict)
  1253. return params, nil
  1254. }
  1255. type SQingCloudCloudAccountUpdateCredentialOptions struct {
  1256. SCloudAccountIdOptions
  1257. SAccessKeyCredential
  1258. }
  1259. func (opts *SQingCloudCloudAccountUpdateCredentialOptions) Params() (jsonutils.JSONObject, error) {
  1260. return jsonutils.Marshal(opts), nil
  1261. }
  1262. type SOracleCloudAccountCreateOptions struct {
  1263. SCloudAccountCreateBaseOptions
  1264. OraclePrivateKeyFile string `help:"Oracle private key" positional:"true"`
  1265. OracleTenancyOCID string
  1266. OracleUserOCID string
  1267. }
  1268. func (opts *SOracleCloudAccountCreateOptions) Params() (jsonutils.JSONObject, error) {
  1269. params := jsonutils.Marshal(opts).(*jsonutils.JSONDict)
  1270. params.Add(jsonutils.NewString("OracleCloud"), "provider")
  1271. data, err := os.ReadFile(opts.OraclePrivateKeyFile)
  1272. if err != nil {
  1273. return nil, err
  1274. }
  1275. params.Set("oracle_private_key", jsonutils.NewString(string(data)))
  1276. return params, nil
  1277. }
  1278. type SCephFSCredentialWithEnvironment struct {
  1279. SUserPasswordCredential
  1280. Host string `help:"CephFS host" positional:"true"`
  1281. Port string `help:"CephFS host port" default:"8443"`
  1282. }
  1283. type SCephFSCloudAccountCreateOptions struct {
  1284. SCloudAccountCreateBaseOptions
  1285. SCephFSCredentialWithEnvironment
  1286. }
  1287. func (opts *SCephFSCloudAccountCreateOptions) Params() (jsonutils.JSONObject, error) {
  1288. params := jsonutils.Marshal(opts)
  1289. params.(*jsonutils.JSONDict).Add(jsonutils.NewString("CephFS"), "provider")
  1290. return params, nil
  1291. }
  1292. type SCNwareCloudAccountCreateOptions struct {
  1293. SCloudAccountCreateBaseOptions
  1294. SUserPasswordCredential
  1295. AuthURL string `help:"CNware auth_url" positional:"true" json:"auth_url"`
  1296. }
  1297. func (opts *SCNwareCloudAccountCreateOptions) Params() (jsonutils.JSONObject, error) {
  1298. params := jsonutils.Marshal(opts)
  1299. params.(*jsonutils.JSONDict).Add(jsonutils.NewString("CNware"), "provider")
  1300. return params, nil
  1301. }
  1302. type SCNwareCloudAccountUpdateCredentialOptions struct {
  1303. SCloudAccountIdOptions
  1304. SUserPasswordCredential
  1305. }
  1306. func (opts *SCNwareCloudAccountUpdateCredentialOptions) Params() (jsonutils.JSONObject, error) {
  1307. return jsonutils.Marshal(opts), nil
  1308. }
  1309. type SCNwareCloudAccountUpdateOptions struct {
  1310. SCloudAccountUpdateBaseOptions
  1311. }
  1312. func (opts *SCNwareCloudAccountUpdateOptions) Params() (jsonutils.JSONObject, error) {
  1313. return jsonutils.Marshal(opts), nil
  1314. }
  1315. type SOceanbaseCloudAccountCreateOptions struct {
  1316. SCloudAccountCreateBaseOptions
  1317. SAccessKeyCredential
  1318. }
  1319. func (opts *SOceanbaseCloudAccountCreateOptions) Params() (jsonutils.JSONObject, error) {
  1320. params := jsonutils.Marshal(opts)
  1321. params.(*jsonutils.JSONDict).Add(jsonutils.NewString("OceanBase"), "provider")
  1322. return params, nil
  1323. }
  1324. type SOceanbaseCloudAccountUpdateOptions struct {
  1325. SCloudAccountUpdateBaseOptions
  1326. }
  1327. func (opts *SOceanbaseCloudAccountUpdateOptions) Params() (jsonutils.JSONObject, error) {
  1328. params := jsonutils.Marshal(opts).(*jsonutils.JSONDict)
  1329. return params, nil
  1330. }
  1331. type SOceanbaseCloudAccountUpdateCredentialOptions struct {
  1332. SCloudAccountIdOptions
  1333. SAccessKeyCredential
  1334. }
  1335. func (opts *SOceanbaseCloudAccountUpdateCredentialOptions) Params() (jsonutils.JSONObject, error) {
  1336. return jsonutils.Marshal(opts), nil
  1337. }