options.go 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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 options
  15. import (
  16. common_options "yunion.io/x/onecloud/pkg/cloudcommon/options"
  17. )
  18. type SCloudIdOptions struct {
  19. common_options.CommonOptions
  20. common_options.DBOptions
  21. CloudaccountSyncIntervalMinutes int `help:"frequency to sync region cloudaccount task" default:"3"`
  22. SAMLProviderSyncIntervalHours int `help:"frequency to sync account saml provider task" default:"3"`
  23. SystemPoliciesSyncIntervalHours int `help:"frequency to sync region cloudaccount task" default:"24"`
  24. CloudIdResourceSyncIntervalHours int `help:"frequency to sync region cloudpolicy task" default:"3"`
  25. CloudroleSyncIntervalHours int `help:"frequency to sync region cloudroles task" default:"12"`
  26. CloudSAMLMetadataPath string `help:"path to store SAML sp metadata file of cloud providers" default:"/opt/yunion/share/saml/sp-metadata"`
  27. }
  28. var (
  29. Options SCloudIdOptions
  30. )
  31. func OnOptionsChange(oldO, newO interface{}) bool {
  32. oldOpts := oldO.(*SCloudIdOptions)
  33. newOpts := newO.(*SCloudIdOptions)
  34. changed := false
  35. if common_options.OnCommonOptionsChange(&oldOpts.CommonOptions, &newOpts.CommonOptions) {
  36. changed = true
  37. }
  38. return changed
  39. }