dnsvpcs.go 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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 models
  15. import (
  16. "context"
  17. "yunion.io/x/onecloud/pkg/cloudcommon/db"
  18. "yunion.io/x/onecloud/pkg/mcclient"
  19. )
  20. // +onecloud:swagger-gen-ignore
  21. type SDnsZoneVpcManager struct {
  22. db.SJointResourceBaseManager
  23. }
  24. var DnsZoneVpcManager *SDnsZoneVpcManager
  25. func init() {
  26. db.InitManager(func() {
  27. DnsZoneVpcManager = &SDnsZoneVpcManager{
  28. SJointResourceBaseManager: db.NewJointResourceBaseManager(
  29. SDnsZoneVpc{},
  30. "dnszonevpcs_tbl",
  31. "dns_zonevpc",
  32. "dns_zonevpcs",
  33. DnsZoneManager,
  34. VpcManager,
  35. ),
  36. }
  37. DnsZoneVpcManager.SetVirtualObject(DnsZoneVpcManager)
  38. })
  39. }
  40. // +onecloud:swagger-gen-ignore
  41. type SDnsZoneVpc struct {
  42. db.SJointResourceBase
  43. SDnsZoneResourceBase
  44. VpcId string `width:"36" charset:"ascii" nullable:"false" list:"user"`
  45. }
  46. func (manager *SDnsZoneVpcManager) GetMasterFieldName() string {
  47. return "dns_zone_id"
  48. }
  49. func (manager *SDnsZoneVpcManager) GetSlaveFieldName() string {
  50. return "vpc_id"
  51. }
  52. func (self *SDnsZoneVpc) Detach(ctx context.Context, userCred mcclient.TokenCredential) error {
  53. return db.DetachJoint(ctx, userCred, self)
  54. }