Skip to content

Commit 8066af6

Browse files
authored
[v18] access_monitoring_rules: Add spec.schedules (#59785)
* Extend access_monitoring_rules API Spec now includes a schedules field * Validate schedules * Update terraform provider * Remove duplicate test case * Comment shift fields * Address feedback - Remove timezone configuration - Use schedule map instead of list
1 parent 976e119 commit 8066af6

File tree

7 files changed

+868
-54
lines changed

7 files changed

+868
-54
lines changed

api/gen/proto/go/teleport/accessmonitoringrules/v1/access_monitoring_rules.pb.go

Lines changed: 241 additions & 54 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/proto/teleport/accessmonitoringrules/v1/access_monitoring_rules.proto

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ message AccessMonitoringRuleSpec {
6767
// subjects, the desired_state may be set to `reviewed` to indicate that the
6868
// Access Request should be automatically reviewed.
6969
string desired_state = 7;
70+
71+
// schedules specifies a map of schedules that can be used to configure the
72+
// access monitoring rule conditions.
73+
map<string, Schedule> schedules = 8;
7074
}
7175

7276
// Notification contains configurations for plugin notification rules.
@@ -87,6 +91,29 @@ message AutomaticReview {
8791
string decision = 2;
8892
}
8993

94+
// Schedule specifies a schedule that can be used to configure rule conditions.
95+
message Schedule {
96+
// TimeSchedule specifies an in-line schedule.
97+
TimeSchedule time = 1;
98+
}
99+
100+
// TimeSchedule specifies an in-line schedule.
101+
message TimeSchedule {
102+
// Shifts contains a set of shifts that make up the schedule.
103+
// Shifts are configured in UTC.
104+
repeated Shift shifts = 1;
105+
106+
// Shift contains the weekday, start time, and end time of a shift.
107+
message Shift {
108+
// Weekday specifies the day of the week, e.g., "Sunday", "Monday", "Tuesday".
109+
string weekday = 1;
110+
// Start specifies the start time in the format HH:MM, e.g., "12:30".
111+
string start = 2;
112+
// End specifies the end time in the format HH:MM, e.g., "12:30".
113+
string end = 3;
114+
}
115+
}
116+
90117
// CreateAccessMonitoringRuleRequest is the request for CreateAccessMonitoringRule.
91118
message CreateAccessMonitoringRuleRequest {
92119
// access_monitoring_rule is the specification of the rule to be created.

docs/pages/reference/infrastructure-as-code/terraform-provider/data-sources/access_monitoring_rule.mdx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ Optional:
4242
- `condition` (String) condition is a predicate expression that operates on the specified subject resources, and determines whether the subject will be moved into desired state.
4343
- `desired_state` (String) desired_state defines the desired state of the subject. For Access Request subjects, the desired_state may be set to `reviewed` to indicate that the Access Request should be automatically reviewed.
4444
- `notification` (Attributes) notification defines the plugin configuration for notifications if rule is triggered. Both notification and automatic_review may be set within the same access_monitoring_rule. If both fields are set, the rule will trigger both notifications and automatic reviews for the same set of access events. Separate plugins may be used if both notifications and automatic_reviews is set. (see [below for nested schema](#nested-schema-for-specnotification))
45+
- `schedules` (Attributes Map) schedules specifies a map of schedules that can be used to configure the access monitoring rule conditions. (see [below for nested schema](#nested-schema-for-specschedules))
4546
- `states` (List of String) states are the desired state which the monitoring rule is attempting to bring the subjects matching the condition to.
4647

4748
### Nested Schema for `spec.automatic_review`
@@ -60,6 +61,29 @@ Optional:
6061
- `recipients` (List of String) recipients is the list of recipients the plugin should notify.
6162

6263

64+
### Nested Schema for `spec.schedules`
65+
66+
Optional:
67+
68+
- `time` (Attributes) TimeSchedule specifies an in-line schedule. (see [below for nested schema](#nested-schema-for-specschedulestime))
69+
70+
### Nested Schema for `spec.schedules.time`
71+
72+
Optional:
73+
74+
- `shifts` (Attributes List) Shifts contains a set of shifts that make up the schedule. Shifts are configured in UTC. (see [below for nested schema](#nested-schema-for-specschedulestimeshifts))
75+
76+
### Nested Schema for `spec.schedules.time.shifts`
77+
78+
Optional:
79+
80+
- `end` (String) End specifies the end time in the format HH:MM, e.g., "12:30".
81+
- `start` (String) Start specifies the start time in the format HH:MM, e.g., "12:30".
82+
- `weekday` (String) Weekday specifies the day of the week, e.g., "Sunday", "Monday", "Tuesday".
83+
84+
85+
86+
6387

6488
### Nested Schema for `metadata`
6589

docs/pages/reference/infrastructure-as-code/terraform-provider/resources/access_monitoring_rule.mdx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ Optional:
6464
- `condition` (String) condition is a predicate expression that operates on the specified subject resources, and determines whether the subject will be moved into desired state.
6565
- `desired_state` (String) desired_state defines the desired state of the subject. For Access Request subjects, the desired_state may be set to `reviewed` to indicate that the Access Request should be automatically reviewed.
6666
- `notification` (Attributes) notification defines the plugin configuration for notifications if rule is triggered. Both notification and automatic_review may be set within the same access_monitoring_rule. If both fields are set, the rule will trigger both notifications and automatic reviews for the same set of access events. Separate plugins may be used if both notifications and automatic_reviews is set. (see [below for nested schema](#nested-schema-for-specnotification))
67+
- `schedules` (Attributes Map) schedules specifies a map of schedules that can be used to configure the access monitoring rule conditions. (see [below for nested schema](#nested-schema-for-specschedules))
6768
- `states` (List of String) states are the desired state which the monitoring rule is attempting to bring the subjects matching the condition to.
6869

6970
### Nested Schema for `spec.automatic_review`
@@ -82,6 +83,29 @@ Optional:
8283
- `recipients` (List of String) recipients is the list of recipients the plugin should notify.
8384

8485

86+
### Nested Schema for `spec.schedules`
87+
88+
Optional:
89+
90+
- `time` (Attributes) TimeSchedule specifies an in-line schedule. (see [below for nested schema](#nested-schema-for-specschedulestime))
91+
92+
### Nested Schema for `spec.schedules.time`
93+
94+
Optional:
95+
96+
- `shifts` (Attributes List) Shifts contains a set of shifts that make up the schedule. Shifts are configured in UTC. (see [below for nested schema](#nested-schema-for-specschedulestimeshifts))
97+
98+
### Nested Schema for `spec.schedules.time.shifts`
99+
100+
Optional:
101+
102+
- `end` (String) End specifies the end time in the format HH:MM, e.g., "12:30".
103+
- `start` (String) Start specifies the start time in the format HH:MM, e.g., "12:30".
104+
- `weekday` (String) Weekday specifies the day of the week, e.g., "Sunday", "Monday", "Tuesday".
105+
106+
107+
108+
85109

86110
### Nested Schema for `metadata`
87111

0 commit comments

Comments
 (0)