-
Notifications
You must be signed in to change notification settings - Fork 82
/
datafile.go
295 lines (245 loc) · 11.6 KB
/
datafile.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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
// Copyright (c) 2016, 2018, 2023, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
// Database Management API
//
// Use the Database Management API to perform tasks such as obtaining performance and resource usage metrics
// for a fleet of Managed Databases or a specific Managed Database, creating Managed Database Groups, and
// running a SQL job on a Managed Database or Managed Database Group.
//
package databasemanagement
import (
"fmt"
"github.com/oracle/oci-go-sdk/v65/common"
"strings"
)
// Datafile The details of a data file.
type Datafile struct {
// The filename (including the path) of the data file or temp file.
Name *string `mandatory:"true" json:"name"`
// The status of the file. INVALID status is used when the file number is not in use, for example, a file in a tablespace that was removed.
Status DatafileStatusEnum `mandatory:"false" json:"status,omitempty"`
// The online status of the file.
OnlineStatus DatafileOnlineStatusEnum `mandatory:"false" json:"onlineStatus,omitempty"`
// Indicates whether the data file is auto-extensible.
IsAutoExtensible *bool `mandatory:"false" json:"isAutoExtensible"`
// The lost write protection status of the file.
LostWriteProtect DatafileLostWriteProtectEnum `mandatory:"false" json:"lostWriteProtect,omitempty"`
// Type of tablespace this file belongs to. If it's for a shared tablespace, for a local temporary tablespace for RIM (read-only) instances, or for local temporary tablespace for all instance types.
Shared DatafileSharedEnum `mandatory:"false" json:"shared,omitempty"`
// Instance ID of the instance to which the temp file belongs. This column has a NULL value for temp files that belong to shared tablespaces.
InstanceId *float32 `mandatory:"false" json:"instanceId"`
// The maximum file size in KB.
MaxSizeKB *float32 `mandatory:"false" json:"maxSizeKB"`
// The allocated file size in KB.
AllocatedSizeKB *float32 `mandatory:"false" json:"allocatedSizeKB"`
// The size of the file available for user data in KB. The actual size of the file minus the USER_BYTES value is used to store file-related metadata.
UserSizeKB *float32 `mandatory:"false" json:"userSizeKB"`
// The number of blocks used as auto-extension increment.
IncrementBy *float32 `mandatory:"false" json:"incrementBy"`
// The free space available in the data file in KB.
FreeSpaceKB *float32 `mandatory:"false" json:"freeSpaceKB"`
// The total space used in the data file in KB.
UsedSpaceKB *float32 `mandatory:"false" json:"usedSpaceKB"`
// The percentage of used space out of the maximum available space in the file.
UsedPercentAvailable *float64 `mandatory:"false" json:"usedPercentAvailable"`
// The percentage of used space out of the total allocated space in the file.
UsedPercentAllocated *float64 `mandatory:"false" json:"usedPercentAllocated"`
}
func (m Datafile) String() string {
return common.PointerString(m)
}
// ValidateEnumValue returns an error when providing an unsupported enum value
// This function is being called during constructing API request process
// Not recommended for calling this function directly
func (m Datafile) ValidateEnumValue() (bool, error) {
errMessage := []string{}
if _, ok := GetMappingDatafileStatusEnum(string(m.Status)); !ok && m.Status != "" {
errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for Status: %s. Supported values are: %s.", m.Status, strings.Join(GetDatafileStatusEnumStringValues(), ",")))
}
if _, ok := GetMappingDatafileOnlineStatusEnum(string(m.OnlineStatus)); !ok && m.OnlineStatus != "" {
errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for OnlineStatus: %s. Supported values are: %s.", m.OnlineStatus, strings.Join(GetDatafileOnlineStatusEnumStringValues(), ",")))
}
if _, ok := GetMappingDatafileLostWriteProtectEnum(string(m.LostWriteProtect)); !ok && m.LostWriteProtect != "" {
errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for LostWriteProtect: %s. Supported values are: %s.", m.LostWriteProtect, strings.Join(GetDatafileLostWriteProtectEnumStringValues(), ",")))
}
if _, ok := GetMappingDatafileSharedEnum(string(m.Shared)); !ok && m.Shared != "" {
errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for Shared: %s. Supported values are: %s.", m.Shared, strings.Join(GetDatafileSharedEnumStringValues(), ",")))
}
if len(errMessage) > 0 {
return true, fmt.Errorf(strings.Join(errMessage, "\n"))
}
return false, nil
}
// DatafileStatusEnum Enum with underlying type: string
type DatafileStatusEnum string
// Set of constants representing the allowable values for DatafileStatusEnum
const (
DatafileStatusAvailable DatafileStatusEnum = "AVAILABLE"
DatafileStatusInvalid DatafileStatusEnum = "INVALID"
DatafileStatusOffline DatafileStatusEnum = "OFFLINE"
DatafileStatusOnline DatafileStatusEnum = "ONLINE"
DatafileStatusUnknown DatafileStatusEnum = "UNKNOWN"
)
var mappingDatafileStatusEnum = map[string]DatafileStatusEnum{
"AVAILABLE": DatafileStatusAvailable,
"INVALID": DatafileStatusInvalid,
"OFFLINE": DatafileStatusOffline,
"ONLINE": DatafileStatusOnline,
"UNKNOWN": DatafileStatusUnknown,
}
var mappingDatafileStatusEnumLowerCase = map[string]DatafileStatusEnum{
"available": DatafileStatusAvailable,
"invalid": DatafileStatusInvalid,
"offline": DatafileStatusOffline,
"online": DatafileStatusOnline,
"unknown": DatafileStatusUnknown,
}
// GetDatafileStatusEnumValues Enumerates the set of values for DatafileStatusEnum
func GetDatafileStatusEnumValues() []DatafileStatusEnum {
values := make([]DatafileStatusEnum, 0)
for _, v := range mappingDatafileStatusEnum {
values = append(values, v)
}
return values
}
// GetDatafileStatusEnumStringValues Enumerates the set of values in String for DatafileStatusEnum
func GetDatafileStatusEnumStringValues() []string {
return []string{
"AVAILABLE",
"INVALID",
"OFFLINE",
"ONLINE",
"UNKNOWN",
}
}
// GetMappingDatafileStatusEnum performs case Insensitive comparison on enum value and return the desired enum
func GetMappingDatafileStatusEnum(val string) (DatafileStatusEnum, bool) {
enum, ok := mappingDatafileStatusEnumLowerCase[strings.ToLower(val)]
return enum, ok
}
// DatafileOnlineStatusEnum Enum with underlying type: string
type DatafileOnlineStatusEnum string
// Set of constants representing the allowable values for DatafileOnlineStatusEnum
const (
DatafileOnlineStatusSysoff DatafileOnlineStatusEnum = "SYSOFF"
DatafileOnlineStatusSystem DatafileOnlineStatusEnum = "SYSTEM"
DatafileOnlineStatusOffline DatafileOnlineStatusEnum = "OFFLINE"
DatafileOnlineStatusOnline DatafileOnlineStatusEnum = "ONLINE"
DatafileOnlineStatusRecover DatafileOnlineStatusEnum = "RECOVER"
)
var mappingDatafileOnlineStatusEnum = map[string]DatafileOnlineStatusEnum{
"SYSOFF": DatafileOnlineStatusSysoff,
"SYSTEM": DatafileOnlineStatusSystem,
"OFFLINE": DatafileOnlineStatusOffline,
"ONLINE": DatafileOnlineStatusOnline,
"RECOVER": DatafileOnlineStatusRecover,
}
var mappingDatafileOnlineStatusEnumLowerCase = map[string]DatafileOnlineStatusEnum{
"sysoff": DatafileOnlineStatusSysoff,
"system": DatafileOnlineStatusSystem,
"offline": DatafileOnlineStatusOffline,
"online": DatafileOnlineStatusOnline,
"recover": DatafileOnlineStatusRecover,
}
// GetDatafileOnlineStatusEnumValues Enumerates the set of values for DatafileOnlineStatusEnum
func GetDatafileOnlineStatusEnumValues() []DatafileOnlineStatusEnum {
values := make([]DatafileOnlineStatusEnum, 0)
for _, v := range mappingDatafileOnlineStatusEnum {
values = append(values, v)
}
return values
}
// GetDatafileOnlineStatusEnumStringValues Enumerates the set of values in String for DatafileOnlineStatusEnum
func GetDatafileOnlineStatusEnumStringValues() []string {
return []string{
"SYSOFF",
"SYSTEM",
"OFFLINE",
"ONLINE",
"RECOVER",
}
}
// GetMappingDatafileOnlineStatusEnum performs case Insensitive comparison on enum value and return the desired enum
func GetMappingDatafileOnlineStatusEnum(val string) (DatafileOnlineStatusEnum, bool) {
enum, ok := mappingDatafileOnlineStatusEnumLowerCase[strings.ToLower(val)]
return enum, ok
}
// DatafileLostWriteProtectEnum Enum with underlying type: string
type DatafileLostWriteProtectEnum string
// Set of constants representing the allowable values for DatafileLostWriteProtectEnum
const (
DatafileLostWriteProtectEnabled DatafileLostWriteProtectEnum = "ENABLED"
DatafileLostWriteProtectProtectOff DatafileLostWriteProtectEnum = "PROTECT_OFF"
DatafileLostWriteProtectSuspend DatafileLostWriteProtectEnum = "SUSPEND"
)
var mappingDatafileLostWriteProtectEnum = map[string]DatafileLostWriteProtectEnum{
"ENABLED": DatafileLostWriteProtectEnabled,
"PROTECT_OFF": DatafileLostWriteProtectProtectOff,
"SUSPEND": DatafileLostWriteProtectSuspend,
}
var mappingDatafileLostWriteProtectEnumLowerCase = map[string]DatafileLostWriteProtectEnum{
"enabled": DatafileLostWriteProtectEnabled,
"protect_off": DatafileLostWriteProtectProtectOff,
"suspend": DatafileLostWriteProtectSuspend,
}
// GetDatafileLostWriteProtectEnumValues Enumerates the set of values for DatafileLostWriteProtectEnum
func GetDatafileLostWriteProtectEnumValues() []DatafileLostWriteProtectEnum {
values := make([]DatafileLostWriteProtectEnum, 0)
for _, v := range mappingDatafileLostWriteProtectEnum {
values = append(values, v)
}
return values
}
// GetDatafileLostWriteProtectEnumStringValues Enumerates the set of values in String for DatafileLostWriteProtectEnum
func GetDatafileLostWriteProtectEnumStringValues() []string {
return []string{
"ENABLED",
"PROTECT_OFF",
"SUSPEND",
}
}
// GetMappingDatafileLostWriteProtectEnum performs case Insensitive comparison on enum value and return the desired enum
func GetMappingDatafileLostWriteProtectEnum(val string) (DatafileLostWriteProtectEnum, bool) {
enum, ok := mappingDatafileLostWriteProtectEnumLowerCase[strings.ToLower(val)]
return enum, ok
}
// DatafileSharedEnum Enum with underlying type: string
type DatafileSharedEnum string
// Set of constants representing the allowable values for DatafileSharedEnum
const (
DatafileSharedShared DatafileSharedEnum = "SHARED"
DatafileSharedLocalForRim DatafileSharedEnum = "LOCAL_FOR_RIM"
DatafileSharedLocalForAll DatafileSharedEnum = "LOCAL_FOR_ALL"
)
var mappingDatafileSharedEnum = map[string]DatafileSharedEnum{
"SHARED": DatafileSharedShared,
"LOCAL_FOR_RIM": DatafileSharedLocalForRim,
"LOCAL_FOR_ALL": DatafileSharedLocalForAll,
}
var mappingDatafileSharedEnumLowerCase = map[string]DatafileSharedEnum{
"shared": DatafileSharedShared,
"local_for_rim": DatafileSharedLocalForRim,
"local_for_all": DatafileSharedLocalForAll,
}
// GetDatafileSharedEnumValues Enumerates the set of values for DatafileSharedEnum
func GetDatafileSharedEnumValues() []DatafileSharedEnum {
values := make([]DatafileSharedEnum, 0)
for _, v := range mappingDatafileSharedEnum {
values = append(values, v)
}
return values
}
// GetDatafileSharedEnumStringValues Enumerates the set of values in String for DatafileSharedEnum
func GetDatafileSharedEnumStringValues() []string {
return []string{
"SHARED",
"LOCAL_FOR_RIM",
"LOCAL_FOR_ALL",
}
}
// GetMappingDatafileSharedEnum performs case Insensitive comparison on enum value and return the desired enum
func GetMappingDatafileSharedEnum(val string) (DatafileSharedEnum, bool) {
enum, ok := mappingDatafileSharedEnumLowerCase[strings.ToLower(val)]
return enum, ok
}