/
geo_input.go
138 lines (112 loc) · 3.29 KB
/
geo_input.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
// Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package compute
import (
"yunion.io/x/onecloud/pkg/apis"
)
type CloudregionResourceInput struct {
// 区域名称或ID
Cloudregion string `json:"cloudregion"`
// swagger:ignore
// Deprecated
// description: this param will be deprecate at 3.0
CloudregionId string `json:"cloudregion_id" "yunion:deprecated-by":"cloudregion"`
// swagger:ignore
// Deprecated
// description: this param will be deprecate at 3.0
Region string `json:"region" "yunion:deprecated-by":"cloudregion"`
// swagger:ignore
// Deprecated
// description: this param will be deprecate at 3.0
RegionId string `json:"region_id" "yunion:deprecated-by":"cloudregion"`
}
type RegionalFilterListInput struct {
// 过滤位于指定城市区域的资源
City string `json:"city"`
CloudregionResourceInput
// 按区域名称过滤
OrderByRegion string `json:"order_by_region"`
// 按城市过滤
OrderByCity string `json:"order_by_city"`
}
type ZonalFilterListInput struct {
RegionalFilterListInput
ZonalFilterListBase
}
type ZonalFilterListBase struct {
ZoneResourceInput
// 过滤处于多个指定可用区内的资源
Zones []string `json:"zones"`
// 按可用区名称排序
// pattern:asc|desc
OrderByZone string `json:"order_by_zone"`
}
func (input ZonalFilterListBase) ZoneList() []string {
zoneStr := input.Zone
if len(zoneStr) > 0 {
input.Zones = append(input.Zones, zoneStr)
}
return input.Zones
}
func (input ZonalFilterListBase) FirstZone() string {
if len(input.Zone) > 0 {
return input.Zone
}
if len(input.Zones) > 0 {
return input.Zones[0]
}
return ""
}
func (input ZonalFilterListInput) ZoneList() []string {
zoneStr := input.Zone
if len(zoneStr) > 0 {
input.Zones = append(input.Zones, zoneStr)
}
return input.Zones
}
type CloudregionListInput struct {
apis.EnabledStatusStandaloneResourceListInput
apis.ExternalizedResourceBaseListInput
apis.DomainizedResourceListInput
ManagedResourceListInput
UsableResourceListInput
UsableVpcResourceListInput
CapabilityListInput
// 过滤位于指定城市的区域
City string `json:"city"`
// 过滤提供特定服务的区域
Service string `json:"service"`
// 云环境
Environment []string `json:"environment"`
}
type ZoneListInput struct {
apis.StatusStandaloneResourceListInput
apis.ExternalizedResourceBaseListInput
ManagedResourceListInput
RegionalFilterListInput
UsableResourceListInput
UsableVpcResourceListInput
// 过滤提供特定服务的可用区
Service string `json:"service"`
Location []string `json:"location"`
Contacts []string `json:"contacts"`
}
type ZoneResourceInput struct {
// 可用区ID或名称
// example:zone1
Zone string `json:"zone"`
// swagger:ignore
// Deprecated
ZoneId string `json:"zone_id" "yunion:deprecated-by":"zone"`
}