dnszone.go 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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. "reflect"
  17. "yunion.io/x/cloudmux/pkg/apis/compute"
  18. "yunion.io/x/jsonutils"
  19. "yunion.io/x/pkg/gotypes"
  20. "yunion.io/x/onecloud/pkg/apis"
  21. )
  22. const (
  23. DNS_ZONE_STATUS_AVAILABLE = compute.DNS_ZONE_STATUS_AVAILABLE // 可用
  24. DNS_ZONE_STATUS_CREATING = "creating" // 创建中
  25. DNS_ZONE_STATUS_CREATE_FAILE = "create_failed" // 创建失败
  26. DNS_ZONE_STATUS_DELETING = "deleting" // 删除中
  27. DNS_ZONE_STATUS_DELETE_FAILED = "delete_failed" // 删除失败
  28. DNS_ZONE_STATUS_UNKNOWN = compute.DNS_ZONE_STATUS_UNKNOWN // 未知
  29. )
  30. type DnsZoneFilterListBase struct {
  31. DnsZoneId string `json:"dns_zone_id"`
  32. ManagedResourceListInput
  33. }
  34. type DnsZoneCreateInput struct {
  35. apis.SharableVirtualResourceCreateInput
  36. CloudproviderResourceInput
  37. // 区域类型
  38. //
  39. //
  40. // | 类型 | 说明 |
  41. // |---------- |---------|
  42. // | PublicZone | 公有 |
  43. // | PrivateZone | 私有 |
  44. ZoneType string `json:"zone_type"`
  45. // 额外参数
  46. // VPC id列表, 仅在zone_type为PrivateZone时生效, vpc列表必须属于同一个账号
  47. VpcIds []string `json:"vpc_ids"`
  48. }
  49. type DnsZoneDetails struct {
  50. apis.SharableVirtualResourceDetails
  51. ManagedResourceInfo
  52. SDnsZone
  53. // Dns记录数量
  54. DnsRecordCount int `json:"dns_record_count"`
  55. // 关联vpc数量
  56. VpcCount int `json:"vpc_count"`
  57. }
  58. type DnsZoneListInput struct {
  59. apis.SharableVirtualResourceListInput
  60. ManagedResourceListInput
  61. // 区域类型
  62. //
  63. //
  64. // | 类型 | 说明 |
  65. // |---------- |---------|
  66. // | PublicZone | 公有 |
  67. // | PrivateZone | 私有 |
  68. ZoneType string `json:"zone_type"`
  69. // Filter dns zone By vpc
  70. VpcId string `json:"vpc_id"`
  71. }
  72. type DnsZoneSyncStatusInput struct {
  73. }
  74. type DnsZoneAddVpcsInput struct {
  75. // VPC id列表
  76. VpcIds []string `json:"vpc_ids"`
  77. }
  78. type DnsZoneRemoveVpcsInput struct {
  79. // VPC id列表
  80. VpcIds []string `json:"vpc_ids"`
  81. }
  82. type DnsZonePurgeInput struct {
  83. }
  84. type SNameServers []string
  85. func (ns SNameServers) String() string {
  86. return jsonutils.Marshal(ns).String()
  87. }
  88. func (ns SNameServers) IsZero() bool {
  89. return len(ns) == 0
  90. }
  91. func init() {
  92. gotypes.RegisterSerializable(reflect.TypeOf(&SNameServers{}), func() gotypes.ISerializable {
  93. return &SNameServers{}
  94. })
  95. }