Skip to content

Commit

Permalink
INTMDB-828: Add Schedule Parameter to Online Archive (#502)
Browse files Browse the repository at this point in the history
  • Loading branch information
andreaangiolillo committed Jun 23, 2023
1 parent 09206e3 commit 94c1f7f
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
12 changes: 12 additions & 0 deletions mongodbatlas/online_archives.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,21 @@ type OnlineArchive struct {
GroupID string `json:"groupId,omitempty"`
PartitionFields []*PartitionFields `json:"partitionFields,omitempty"`
Paused *bool `json:"paused,omitempty"`
Schedule *OnlineArchiveSchedule `json:"schedule,omitempty"`
State string `json:"state,omitempty"`
}

// OnlineArchiveSchedule represents the frequency and duration when archiving process occurs.
type OnlineArchiveSchedule struct {
Type string `json:"type,omitempty"`
DayOfMonth int32 `json:"dayOfMonth,omitempty"`
DayOfWeek int32 `json:"dayOfWeek,omitempty"`
EndHour *int32 `json:"endHour,omitempty"`
EndMinute *int32 `json:"endMinute,omitempty"`
StartHour *int32 `json:"startHour,omitempty"`
StartMinute *int32 `json:"startMinute,omitempty"`
}

// OnlineArchiveCriteria criteria to use for archiving data.
type OnlineArchiveCriteria struct {
DateField string `json:"dateField,omitempty"` // DateField is mandatory when Type is DATE
Expand Down
16 changes: 15 additions & 1 deletion mongodbatlas/online_archives_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,14 @@ func TestOnlineArchiveServiceOp_List(t *testing.T) {
"order": 2
}
],
"paused": false
"paused": false,
"schedule": {
"type": "DAILY",
"endHour": 1,
"endMinute": 1,
"startHour": 1,
"startMinute": 1
}
}
],
"totalCount": 2
Expand Down Expand Up @@ -171,6 +178,13 @@ func TestOnlineArchiveServiceOp_List(t *testing.T) {
},
},
Paused: pointer(false),
Schedule: &OnlineArchiveSchedule{
EndHour: pointer(int32(1)),
EndMinute: pointer(int32(1)),
StartHour: pointer(int32(1)),
StartMinute: pointer(int32(1)),
Type: "DAILY",
},
},
},
TotalCount: 2,
Expand Down

0 comments on commit 94c1f7f

Please sign in to comment.