/
snapshot_schedule.go
326 lines (282 loc) · 13.6 KB
/
snapshot_schedule.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
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
// Copyright (c) 2016, 2018, 2024, 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.
// File Storage API
//
// Use the File Storage service API to manage file systems, mount targets, and snapshots.
// For more information, see Overview of File Storage (https://docs.cloud.oracle.com/iaas/Content/File/Concepts/filestorageoverview.htm).
//
package filestorage
import (
"fmt"
"github.com/oracle/oci-go-sdk/v65/common"
"strings"
)
// SnapshotSchedule The snapshot schedule is a structure within a parent file system snapshot policy. It contains data about
// the frequency of snapshot creation and the retention time of the taken snapshots.
type SnapshotSchedule struct {
// The frequency of scheduled snapshots.
Period SnapshotSchedulePeriodEnum `mandatory:"true" json:"period"`
// Time zone used for scheduling the snapshot.
TimeZone SnapshotScheduleTimeZoneEnum `mandatory:"true" json:"timeZone"`
// A name prefix to be applied to snapshots created by this schedule.
// Example: `compliance1`
SchedulePrefix *string `mandatory:"false" json:"schedulePrefix"`
// The starting point used to begin the scheduling of the snapshots based upon recurrence string
// in RFC 3339 (https://tools.ietf.org/rfc/rfc3339) timestamp format.
// If no `timeScheduleStart` is provided, the value will be set to the time when the schedule was created.
TimeScheduleStart *common.SDKTime `mandatory:"false" json:"timeScheduleStart"`
// The number of seconds to retain snapshots created with this schedule.
// Snapshot expiration time will not be set if this value is empty.
RetentionDurationInSeconds *int64 `mandatory:"false" json:"retentionDurationInSeconds"`
// The hour of the day to create a DAILY, WEEKLY, MONTHLY, or YEARLY snapshot.
// If not set, a value will be chosen at creation time.
HourOfDay *int `mandatory:"false" json:"hourOfDay"`
// The day of the week to create a scheduled snapshot.
// Used for WEEKLY snapshot schedules.
DayOfWeek SnapshotScheduleDayOfWeekEnum `mandatory:"false" json:"dayOfWeek,omitempty"`
// The day of the month to create a scheduled snapshot.
// If the day does not exist for the month, snapshot creation will be skipped.
// Used for MONTHLY and YEARLY snapshot schedules.
DayOfMonth *int `mandatory:"false" json:"dayOfMonth"`
// The month to create a scheduled snapshot.
// Used only for YEARLY snapshot schedules.
Month SnapshotScheduleMonthEnum `mandatory:"false" json:"month,omitempty"`
}
func (m SnapshotSchedule) 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 SnapshotSchedule) ValidateEnumValue() (bool, error) {
errMessage := []string{}
if _, ok := GetMappingSnapshotSchedulePeriodEnum(string(m.Period)); !ok && m.Period != "" {
errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for Period: %s. Supported values are: %s.", m.Period, strings.Join(GetSnapshotSchedulePeriodEnumStringValues(), ",")))
}
if _, ok := GetMappingSnapshotScheduleTimeZoneEnum(string(m.TimeZone)); !ok && m.TimeZone != "" {
errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for TimeZone: %s. Supported values are: %s.", m.TimeZone, strings.Join(GetSnapshotScheduleTimeZoneEnumStringValues(), ",")))
}
if _, ok := GetMappingSnapshotScheduleDayOfWeekEnum(string(m.DayOfWeek)); !ok && m.DayOfWeek != "" {
errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for DayOfWeek: %s. Supported values are: %s.", m.DayOfWeek, strings.Join(GetSnapshotScheduleDayOfWeekEnumStringValues(), ",")))
}
if _, ok := GetMappingSnapshotScheduleMonthEnum(string(m.Month)); !ok && m.Month != "" {
errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for Month: %s. Supported values are: %s.", m.Month, strings.Join(GetSnapshotScheduleMonthEnumStringValues(), ",")))
}
if len(errMessage) > 0 {
return true, fmt.Errorf(strings.Join(errMessage, "\n"))
}
return false, nil
}
// SnapshotSchedulePeriodEnum Enum with underlying type: string
type SnapshotSchedulePeriodEnum string
// Set of constants representing the allowable values for SnapshotSchedulePeriodEnum
const (
SnapshotSchedulePeriodHourly SnapshotSchedulePeriodEnum = "HOURLY"
SnapshotSchedulePeriodDaily SnapshotSchedulePeriodEnum = "DAILY"
SnapshotSchedulePeriodWeekly SnapshotSchedulePeriodEnum = "WEEKLY"
SnapshotSchedulePeriodMonthly SnapshotSchedulePeriodEnum = "MONTHLY"
SnapshotSchedulePeriodYearly SnapshotSchedulePeriodEnum = "YEARLY"
)
var mappingSnapshotSchedulePeriodEnum = map[string]SnapshotSchedulePeriodEnum{
"HOURLY": SnapshotSchedulePeriodHourly,
"DAILY": SnapshotSchedulePeriodDaily,
"WEEKLY": SnapshotSchedulePeriodWeekly,
"MONTHLY": SnapshotSchedulePeriodMonthly,
"YEARLY": SnapshotSchedulePeriodYearly,
}
var mappingSnapshotSchedulePeriodEnumLowerCase = map[string]SnapshotSchedulePeriodEnum{
"hourly": SnapshotSchedulePeriodHourly,
"daily": SnapshotSchedulePeriodDaily,
"weekly": SnapshotSchedulePeriodWeekly,
"monthly": SnapshotSchedulePeriodMonthly,
"yearly": SnapshotSchedulePeriodYearly,
}
// GetSnapshotSchedulePeriodEnumValues Enumerates the set of values for SnapshotSchedulePeriodEnum
func GetSnapshotSchedulePeriodEnumValues() []SnapshotSchedulePeriodEnum {
values := make([]SnapshotSchedulePeriodEnum, 0)
for _, v := range mappingSnapshotSchedulePeriodEnum {
values = append(values, v)
}
return values
}
// GetSnapshotSchedulePeriodEnumStringValues Enumerates the set of values in String for SnapshotSchedulePeriodEnum
func GetSnapshotSchedulePeriodEnumStringValues() []string {
return []string{
"HOURLY",
"DAILY",
"WEEKLY",
"MONTHLY",
"YEARLY",
}
}
// GetMappingSnapshotSchedulePeriodEnum performs case Insensitive comparison on enum value and return the desired enum
func GetMappingSnapshotSchedulePeriodEnum(val string) (SnapshotSchedulePeriodEnum, bool) {
enum, ok := mappingSnapshotSchedulePeriodEnumLowerCase[strings.ToLower(val)]
return enum, ok
}
// SnapshotScheduleTimeZoneEnum Enum with underlying type: string
type SnapshotScheduleTimeZoneEnum string
// Set of constants representing the allowable values for SnapshotScheduleTimeZoneEnum
const (
SnapshotScheduleTimeZoneUtc SnapshotScheduleTimeZoneEnum = "UTC"
SnapshotScheduleTimeZoneRegionalDataCenterTime SnapshotScheduleTimeZoneEnum = "REGIONAL_DATA_CENTER_TIME"
)
var mappingSnapshotScheduleTimeZoneEnum = map[string]SnapshotScheduleTimeZoneEnum{
"UTC": SnapshotScheduleTimeZoneUtc,
"REGIONAL_DATA_CENTER_TIME": SnapshotScheduleTimeZoneRegionalDataCenterTime,
}
var mappingSnapshotScheduleTimeZoneEnumLowerCase = map[string]SnapshotScheduleTimeZoneEnum{
"utc": SnapshotScheduleTimeZoneUtc,
"regional_data_center_time": SnapshotScheduleTimeZoneRegionalDataCenterTime,
}
// GetSnapshotScheduleTimeZoneEnumValues Enumerates the set of values for SnapshotScheduleTimeZoneEnum
func GetSnapshotScheduleTimeZoneEnumValues() []SnapshotScheduleTimeZoneEnum {
values := make([]SnapshotScheduleTimeZoneEnum, 0)
for _, v := range mappingSnapshotScheduleTimeZoneEnum {
values = append(values, v)
}
return values
}
// GetSnapshotScheduleTimeZoneEnumStringValues Enumerates the set of values in String for SnapshotScheduleTimeZoneEnum
func GetSnapshotScheduleTimeZoneEnumStringValues() []string {
return []string{
"UTC",
"REGIONAL_DATA_CENTER_TIME",
}
}
// GetMappingSnapshotScheduleTimeZoneEnum performs case Insensitive comparison on enum value and return the desired enum
func GetMappingSnapshotScheduleTimeZoneEnum(val string) (SnapshotScheduleTimeZoneEnum, bool) {
enum, ok := mappingSnapshotScheduleTimeZoneEnumLowerCase[strings.ToLower(val)]
return enum, ok
}
// SnapshotScheduleDayOfWeekEnum Enum with underlying type: string
type SnapshotScheduleDayOfWeekEnum string
// Set of constants representing the allowable values for SnapshotScheduleDayOfWeekEnum
const (
SnapshotScheduleDayOfWeekMonday SnapshotScheduleDayOfWeekEnum = "MONDAY"
SnapshotScheduleDayOfWeekTuesday SnapshotScheduleDayOfWeekEnum = "TUESDAY"
SnapshotScheduleDayOfWeekWednesday SnapshotScheduleDayOfWeekEnum = "WEDNESDAY"
SnapshotScheduleDayOfWeekThursday SnapshotScheduleDayOfWeekEnum = "THURSDAY"
SnapshotScheduleDayOfWeekFriday SnapshotScheduleDayOfWeekEnum = "FRIDAY"
SnapshotScheduleDayOfWeekSaturday SnapshotScheduleDayOfWeekEnum = "SATURDAY"
SnapshotScheduleDayOfWeekSunday SnapshotScheduleDayOfWeekEnum = "SUNDAY"
)
var mappingSnapshotScheduleDayOfWeekEnum = map[string]SnapshotScheduleDayOfWeekEnum{
"MONDAY": SnapshotScheduleDayOfWeekMonday,
"TUESDAY": SnapshotScheduleDayOfWeekTuesday,
"WEDNESDAY": SnapshotScheduleDayOfWeekWednesday,
"THURSDAY": SnapshotScheduleDayOfWeekThursday,
"FRIDAY": SnapshotScheduleDayOfWeekFriday,
"SATURDAY": SnapshotScheduleDayOfWeekSaturday,
"SUNDAY": SnapshotScheduleDayOfWeekSunday,
}
var mappingSnapshotScheduleDayOfWeekEnumLowerCase = map[string]SnapshotScheduleDayOfWeekEnum{
"monday": SnapshotScheduleDayOfWeekMonday,
"tuesday": SnapshotScheduleDayOfWeekTuesday,
"wednesday": SnapshotScheduleDayOfWeekWednesday,
"thursday": SnapshotScheduleDayOfWeekThursday,
"friday": SnapshotScheduleDayOfWeekFriday,
"saturday": SnapshotScheduleDayOfWeekSaturday,
"sunday": SnapshotScheduleDayOfWeekSunday,
}
// GetSnapshotScheduleDayOfWeekEnumValues Enumerates the set of values for SnapshotScheduleDayOfWeekEnum
func GetSnapshotScheduleDayOfWeekEnumValues() []SnapshotScheduleDayOfWeekEnum {
values := make([]SnapshotScheduleDayOfWeekEnum, 0)
for _, v := range mappingSnapshotScheduleDayOfWeekEnum {
values = append(values, v)
}
return values
}
// GetSnapshotScheduleDayOfWeekEnumStringValues Enumerates the set of values in String for SnapshotScheduleDayOfWeekEnum
func GetSnapshotScheduleDayOfWeekEnumStringValues() []string {
return []string{
"MONDAY",
"TUESDAY",
"WEDNESDAY",
"THURSDAY",
"FRIDAY",
"SATURDAY",
"SUNDAY",
}
}
// GetMappingSnapshotScheduleDayOfWeekEnum performs case Insensitive comparison on enum value and return the desired enum
func GetMappingSnapshotScheduleDayOfWeekEnum(val string) (SnapshotScheduleDayOfWeekEnum, bool) {
enum, ok := mappingSnapshotScheduleDayOfWeekEnumLowerCase[strings.ToLower(val)]
return enum, ok
}
// SnapshotScheduleMonthEnum Enum with underlying type: string
type SnapshotScheduleMonthEnum string
// Set of constants representing the allowable values for SnapshotScheduleMonthEnum
const (
SnapshotScheduleMonthJanuary SnapshotScheduleMonthEnum = "JANUARY"
SnapshotScheduleMonthFebruary SnapshotScheduleMonthEnum = "FEBRUARY"
SnapshotScheduleMonthMarch SnapshotScheduleMonthEnum = "MARCH"
SnapshotScheduleMonthApril SnapshotScheduleMonthEnum = "APRIL"
SnapshotScheduleMonthMay SnapshotScheduleMonthEnum = "MAY"
SnapshotScheduleMonthJune SnapshotScheduleMonthEnum = "JUNE"
SnapshotScheduleMonthJuly SnapshotScheduleMonthEnum = "JULY"
SnapshotScheduleMonthAugust SnapshotScheduleMonthEnum = "AUGUST"
SnapshotScheduleMonthSeptember SnapshotScheduleMonthEnum = "SEPTEMBER"
SnapshotScheduleMonthOctober SnapshotScheduleMonthEnum = "OCTOBER"
SnapshotScheduleMonthNovember SnapshotScheduleMonthEnum = "NOVEMBER"
SnapshotScheduleMonthDecember SnapshotScheduleMonthEnum = "DECEMBER"
)
var mappingSnapshotScheduleMonthEnum = map[string]SnapshotScheduleMonthEnum{
"JANUARY": SnapshotScheduleMonthJanuary,
"FEBRUARY": SnapshotScheduleMonthFebruary,
"MARCH": SnapshotScheduleMonthMarch,
"APRIL": SnapshotScheduleMonthApril,
"MAY": SnapshotScheduleMonthMay,
"JUNE": SnapshotScheduleMonthJune,
"JULY": SnapshotScheduleMonthJuly,
"AUGUST": SnapshotScheduleMonthAugust,
"SEPTEMBER": SnapshotScheduleMonthSeptember,
"OCTOBER": SnapshotScheduleMonthOctober,
"NOVEMBER": SnapshotScheduleMonthNovember,
"DECEMBER": SnapshotScheduleMonthDecember,
}
var mappingSnapshotScheduleMonthEnumLowerCase = map[string]SnapshotScheduleMonthEnum{
"january": SnapshotScheduleMonthJanuary,
"february": SnapshotScheduleMonthFebruary,
"march": SnapshotScheduleMonthMarch,
"april": SnapshotScheduleMonthApril,
"may": SnapshotScheduleMonthMay,
"june": SnapshotScheduleMonthJune,
"july": SnapshotScheduleMonthJuly,
"august": SnapshotScheduleMonthAugust,
"september": SnapshotScheduleMonthSeptember,
"october": SnapshotScheduleMonthOctober,
"november": SnapshotScheduleMonthNovember,
"december": SnapshotScheduleMonthDecember,
}
// GetSnapshotScheduleMonthEnumValues Enumerates the set of values for SnapshotScheduleMonthEnum
func GetSnapshotScheduleMonthEnumValues() []SnapshotScheduleMonthEnum {
values := make([]SnapshotScheduleMonthEnum, 0)
for _, v := range mappingSnapshotScheduleMonthEnum {
values = append(values, v)
}
return values
}
// GetSnapshotScheduleMonthEnumStringValues Enumerates the set of values in String for SnapshotScheduleMonthEnum
func GetSnapshotScheduleMonthEnumStringValues() []string {
return []string{
"JANUARY",
"FEBRUARY",
"MARCH",
"APRIL",
"MAY",
"JUNE",
"JULY",
"AUGUST",
"SEPTEMBER",
"OCTOBER",
"NOVEMBER",
"DECEMBER",
}
}
// GetMappingSnapshotScheduleMonthEnum performs case Insensitive comparison on enum value and return the desired enum
func GetMappingSnapshotScheduleMonthEnum(val string) (SnapshotScheduleMonthEnum, bool) {
enum, ok := mappingSnapshotScheduleMonthEnumLowerCase[strings.ToLower(val)]
return enum, ok
}