ansibleplaybook_reference.go 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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 ansible
  15. import (
  16. "yunion.io/x/jsonutils"
  17. "yunion.io/x/onecloud/pkg/mcclient/options"
  18. )
  19. type APRListOptions struct {
  20. options.BaseListOptions
  21. }
  22. func (ao *APRListOptions) Params() (jsonutils.JSONObject, error) {
  23. return options.ListStructToParams(ao)
  24. }
  25. type APROptions struct {
  26. ID string `help:"id or name of ansible playbook reference"`
  27. }
  28. func (ao *APROptions) GetId() string {
  29. return ao.ID
  30. }
  31. func (ao *APROptions) Params() (jsonutils.JSONObject, error) {
  32. return nil, nil
  33. }
  34. type aprRunOptions struct {
  35. ServerName string
  36. ServerIp string
  37. ServerUser string
  38. Args map[string]interface{}
  39. ProxyEndpoingId string
  40. }
  41. type APRRunOptions struct {
  42. APROptions
  43. aprRunOptions
  44. }
  45. func (ao *APRRunOptions) Params() (jsonutils.JSONObject, error) {
  46. return jsonutils.Marshal(ao.aprRunOptions), nil
  47. }
  48. type aprStopOptions struct {
  49. AnsiblePlaybookInstanceId string
  50. }
  51. type APRStopOptions struct {
  52. APROptions
  53. aprStopOptions
  54. }
  55. func (ao *APRStopOptions) Params() (jsonutils.JSONObject, error) {
  56. return jsonutils.Marshal(ao.aprStopOptions), nil
  57. }
  58. type APIListOptions struct {
  59. options.BaseListOptions
  60. AnsiblePlayboookReferenceId string
  61. }
  62. func (ao *APIListOptions) Params() (jsonutils.JSONObject, error) {
  63. return options.ListStructToParams(ao)
  64. }
  65. type APIOptions struct {
  66. ID string
  67. }
  68. func (ao *APIOptions) GetId() string {
  69. return ao.ID
  70. }
  71. func (ao *APIOptions) Params() (jsonutils.JSONObject, error) {
  72. return nil, nil
  73. }