Skip to content

Commit 9d18fa8

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Share timerestriction object (#2850)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 0476221 commit 9d18fa8

16 files changed

+35
-1443
lines changed

.apigentools-info

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.6",
7-
"regenerated": "2025-05-09 02:41:26.674771",
8-
"spec_repo_commit": "39adb7c0"
7+
"regenerated": "2025-05-09 14:41:37.329090",
8+
"spec_repo_commit": "f0e5e32f"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2025-05-09 02:41:26.695479",
13-
"spec_repo_commit": "39adb7c0"
12+
"regenerated": "2025-05-09 14:41:37.345392",
13+
"spec_repo_commit": "f0e5e32f"
1414
}
1515
}
1616
}

.generator/schemas/v2/openapi.yaml

Lines changed: 3 additions & 173 deletions
Original file line numberDiff line numberDiff line change
@@ -18663,7 +18663,7 @@ components:
1866318663
description: An optional list of time restrictions for when this layer is
1866418664
in effect.
1866518665
items:
18666-
$ref: '#/components/schemas/LayerAttributesRestrictionsItems'
18666+
$ref: '#/components/schemas/TimeRestriction'
1866718667
type: array
1866818668
rotation_start:
1866918669
description: The date/time when the rotation starts (ISO 8601).
@@ -18687,63 +18687,6 @@ components:
1868718687
maximum: 2592000
1868818688
type: integer
1868918689
type: object
18690-
LayerAttributesRestrictionsItems:
18691-
description: 'Represents a time restriction within a layer, specifying the days
18692-
and times
18693-
18694-
when this layer is active or inactive.'
18695-
properties:
18696-
end_day:
18697-
$ref: '#/components/schemas/LayerAttributesRestrictionsItemsEndDay'
18698-
end_time:
18699-
description: The time of day the restriction ends (hh:mm:ss).
18700-
example: '17:00:00'
18701-
type: string
18702-
start_day:
18703-
$ref: '#/components/schemas/LayerAttributesRestrictionsItemsStartDay'
18704-
start_time:
18705-
description: The time of day the restriction begins (hh:mm:ss).
18706-
example: 09:00:00
18707-
type: string
18708-
type: object
18709-
LayerAttributesRestrictionsItemsEndDay:
18710-
description: Defines the end day of the restriction within a Layer.
18711-
enum:
18712-
- monday
18713-
- tuesday
18714-
- wednesday
18715-
- thursday
18716-
- friday
18717-
- saturday
18718-
- sunday
18719-
type: string
18720-
x-enum-varnames:
18721-
- MONDAY
18722-
- TUESDAY
18723-
- WEDNESDAY
18724-
- THURSDAY
18725-
- FRIDAY
18726-
- SATURDAY
18727-
- SUNDAY
18728-
LayerAttributesRestrictionsItemsStartDay:
18729-
description: Defines the start day of the restriction within a Layer.
18730-
enum:
18731-
- monday
18732-
- tuesday
18733-
- wednesday
18734-
- thursday
18735-
- friday
18736-
- saturday
18737-
- sunday
18738-
type: string
18739-
x-enum-varnames:
18740-
- MONDAY
18741-
- TUESDAY
18742-
- WEDNESDAY
18743-
- THURSDAY
18744-
- FRIDAY
18745-
- SATURDAY
18746-
- SUNDAY
1874718690
LayerRelationships:
1874818691
description: Holds references to objects related to the Layer entity, such as
1874918692
its members.
@@ -31120,7 +31063,7 @@ components:
3112031063
description: Zero or more time-based restrictions (for example, only weekdays,
3112131064
during business hours).
3112231065
items:
31123-
$ref: '#/components/schemas/ScheduleCreateRequestDataAttributesLayersItemsRestrictionsItems'
31066+
$ref: '#/components/schemas/TimeRestriction'
3112431067
type: array
3112531068
rotation_start:
3112631069
description: The date/time when the rotation for this layer starts (in ISO
@@ -31169,62 +31112,6 @@ components:
3116931112
example: 00000000-aba1-0000-0000-000000000000
3117031113
type: string
3117131114
type: object
31172-
ScheduleCreateRequestDataAttributesLayersItemsRestrictionsItems:
31173-
description: 'Defines a time restriction for a schedule layer, including which
31174-
day of the week
31175-
31176-
it starts and ends, along with start/end times.'
31177-
properties:
31178-
end_day:
31179-
$ref: '#/components/schemas/ScheduleCreateRequestDataAttributesLayersItemsRestrictionsItemsEndDay'
31180-
end_time:
31181-
description: The time of day when the restriction ends (hh:mm:ss).
31182-
type: string
31183-
start_day:
31184-
$ref: '#/components/schemas/ScheduleCreateRequestDataAttributesLayersItemsRestrictionsItemsStartDay'
31185-
start_time:
31186-
description: The time of day when the restriction begins (hh:mm:ss).
31187-
type: string
31188-
type: object
31189-
ScheduleCreateRequestDataAttributesLayersItemsRestrictionsItemsEndDay:
31190-
description: The weekday when the restriction period ends (Monday through Sunday).
31191-
enum:
31192-
- monday
31193-
- tuesday
31194-
- wednesday
31195-
- thursday
31196-
- friday
31197-
- saturday
31198-
- sunday
31199-
type: string
31200-
x-enum-varnames:
31201-
- MONDAY
31202-
- TUESDAY
31203-
- WEDNESDAY
31204-
- THURSDAY
31205-
- FRIDAY
31206-
- SATURDAY
31207-
- SUNDAY
31208-
ScheduleCreateRequestDataAttributesLayersItemsRestrictionsItemsStartDay:
31209-
description: The weekday when the restriction period starts (Monday through
31210-
Sunday).
31211-
enum:
31212-
- monday
31213-
- tuesday
31214-
- wednesday
31215-
- thursday
31216-
- friday
31217-
- saturday
31218-
- sunday
31219-
type: string
31220-
x-enum-varnames:
31221-
- MONDAY
31222-
- TUESDAY
31223-
- WEDNESDAY
31224-
- THURSDAY
31225-
- FRIDAY
31226-
- SATURDAY
31227-
- SUNDAY
3122831115
ScheduleCreateRequestDataRelationships:
3122931116
description: Gathers relationship objects for the schedule creation request,
3123031117
including the teams to associate.
@@ -31628,7 +31515,7 @@ components:
3162831515
restrictions:
3162931516
description: Any time restrictions that define when this layer is active.
3163031517
items:
31631-
$ref: '#/components/schemas/ScheduleUpdateRequestDataAttributesLayersItemsRestrictionsItems'
31518+
$ref: '#/components/schemas/TimeRestriction'
3163231519
type: array
3163331520
rotation_start:
3163431521
description: The date/time at which the rotation begins (ISO 8601 format).
@@ -31678,63 +31565,6 @@ components:
3167831565
example: 00000000-aba1-0000-0000-000000000000
3167931566
type: string
3168031567
type: object
31681-
ScheduleUpdateRequestDataAttributesLayersItemsRestrictionsItems:
31682-
description: 'Defines a time restriction object for a layer within a schedule
31683-
update, including
31684-
31685-
start and end days, as well as times.'
31686-
properties:
31687-
end_day:
31688-
$ref: '#/components/schemas/ScheduleUpdateRequestDataAttributesLayersItemsRestrictionsItemsEndDay'
31689-
end_time:
31690-
description: The time at which this restriction ends (hh:mm:ss).
31691-
example: '17:00:00'
31692-
type: string
31693-
start_day:
31694-
$ref: '#/components/schemas/ScheduleUpdateRequestDataAttributesLayersItemsRestrictionsItemsStartDay'
31695-
start_time:
31696-
description: The time at which this restriction starts (hh:mm:ss).
31697-
example: 09:00:00
31698-
type: string
31699-
type: object
31700-
ScheduleUpdateRequestDataAttributesLayersItemsRestrictionsItemsEndDay:
31701-
description: Defines the day of the week on which the time restriction ends.
31702-
enum:
31703-
- monday
31704-
- tuesday
31705-
- wednesday
31706-
- thursday
31707-
- friday
31708-
- saturday
31709-
- sunday
31710-
type: string
31711-
x-enum-varnames:
31712-
- MONDAY
31713-
- TUESDAY
31714-
- WEDNESDAY
31715-
- THURSDAY
31716-
- FRIDAY
31717-
- SATURDAY
31718-
- SUNDAY
31719-
ScheduleUpdateRequestDataAttributesLayersItemsRestrictionsItemsStartDay:
31720-
description: Defines the day of the week on which the time restriction starts.
31721-
enum:
31722-
- monday
31723-
- tuesday
31724-
- wednesday
31725-
- thursday
31726-
- friday
31727-
- saturday
31728-
- sunday
31729-
type: string
31730-
x-enum-varnames:
31731-
- MONDAY
31732-
- TUESDAY
31733-
- WEDNESDAY
31734-
- THURSDAY
31735-
- FRIDAY
31736-
- SATURDAY
31737-
- SUNDAY
3173831568
ScheduleUpdateRequestDataRelationships:
3173931569
description: Houses relationships for the schedule update, typically referencing
3174031570
teams.

examples/v2/on-call/CreateOnCallSchedule.java

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,13 @@
1010
import com.datadog.api.client.v2.model.ScheduleCreateRequestDataAttributesLayersItemsInterval;
1111
import com.datadog.api.client.v2.model.ScheduleCreateRequestDataAttributesLayersItemsMembersItems;
1212
import com.datadog.api.client.v2.model.ScheduleCreateRequestDataAttributesLayersItemsMembersItemsUser;
13-
import com.datadog.api.client.v2.model.ScheduleCreateRequestDataAttributesLayersItemsRestrictionsItems;
14-
import com.datadog.api.client.v2.model.ScheduleCreateRequestDataAttributesLayersItemsRestrictionsItemsEndDay;
15-
import com.datadog.api.client.v2.model.ScheduleCreateRequestDataAttributesLayersItemsRestrictionsItemsStartDay;
1613
import com.datadog.api.client.v2.model.ScheduleCreateRequestDataRelationships;
1714
import com.datadog.api.client.v2.model.ScheduleCreateRequestDataRelationshipsTeams;
1815
import com.datadog.api.client.v2.model.ScheduleCreateRequestDataRelationshipsTeamsDataItems;
1916
import com.datadog.api.client.v2.model.ScheduleCreateRequestDataRelationshipsTeamsDataItemsType;
2017
import com.datadog.api.client.v2.model.ScheduleCreateRequestDataType;
18+
import com.datadog.api.client.v2.model.TimeRestriction;
19+
import com.datadog.api.client.v2.model.Weekday;
2120
import java.time.OffsetDateTime;
2221
import java.util.Arrays;
2322
import java.util.Collections;
@@ -56,14 +55,10 @@ public static void main(String[] args) {
5655
.name("Layer 1")
5756
.restrictions(
5857
Collections.singletonList(
59-
new ScheduleCreateRequestDataAttributesLayersItemsRestrictionsItems()
60-
.endDay(
61-
ScheduleCreateRequestDataAttributesLayersItemsRestrictionsItemsEndDay
62-
.FRIDAY)
58+
new TimeRestriction()
59+
.endDay(Weekday.FRIDAY)
6360
.endTime("17:00:00")
64-
.startDay(
65-
ScheduleCreateRequestDataAttributesLayersItemsRestrictionsItemsStartDay
66-
.MONDAY)
61+
.startDay(Weekday.MONDAY)
6762
.startTime("09:00:00")))
6863
.rotationStart(OffsetDateTime.now().plusDays(-5))))
6964
.name("Example-On-Call")

examples/v2/on-call/UpdateOnCallSchedule.java

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,13 @@
1010
import com.datadog.api.client.v2.model.ScheduleUpdateRequestDataAttributesLayersItemsInterval;
1111
import com.datadog.api.client.v2.model.ScheduleUpdateRequestDataAttributesLayersItemsMembersItems;
1212
import com.datadog.api.client.v2.model.ScheduleUpdateRequestDataAttributesLayersItemsMembersItemsUser;
13-
import com.datadog.api.client.v2.model.ScheduleUpdateRequestDataAttributesLayersItemsRestrictionsItems;
14-
import com.datadog.api.client.v2.model.ScheduleUpdateRequestDataAttributesLayersItemsRestrictionsItemsEndDay;
15-
import com.datadog.api.client.v2.model.ScheduleUpdateRequestDataAttributesLayersItemsRestrictionsItemsStartDay;
1613
import com.datadog.api.client.v2.model.ScheduleUpdateRequestDataRelationships;
1714
import com.datadog.api.client.v2.model.ScheduleUpdateRequestDataRelationshipsTeams;
1815
import com.datadog.api.client.v2.model.ScheduleUpdateRequestDataRelationshipsTeamsDataItems;
1916
import com.datadog.api.client.v2.model.ScheduleUpdateRequestDataRelationshipsTeamsDataItemsType;
2017
import com.datadog.api.client.v2.model.ScheduleUpdateRequestDataType;
18+
import com.datadog.api.client.v2.model.TimeRestriction;
19+
import com.datadog.api.client.v2.model.Weekday;
2120
import java.time.OffsetDateTime;
2221
import java.util.Arrays;
2322
import java.util.Collections;
@@ -63,14 +62,10 @@ public static void main(String[] args) {
6362
.name("Layer 1")
6463
.restrictions(
6564
Collections.singletonList(
66-
new ScheduleUpdateRequestDataAttributesLayersItemsRestrictionsItems()
67-
.endDay(
68-
ScheduleUpdateRequestDataAttributesLayersItemsRestrictionsItemsEndDay
69-
.FRIDAY)
65+
new TimeRestriction()
66+
.endDay(Weekday.FRIDAY)
7067
.endTime("17:00:00")
71-
.startDay(
72-
ScheduleUpdateRequestDataAttributesLayersItemsRestrictionsItemsStartDay
73-
.MONDAY)
68+
.startDay(Weekday.MONDAY)
7469
.startTime("09:00:00")))
7570
.rotationStart(OffsetDateTime.now().plusDays(-5))))
7671
.name("Example-On-Call")

src/main/java/com/datadog/api/client/v2/model/LayerAttributes.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public class LayerAttributes {
4848
private String name;
4949

5050
public static final String JSON_PROPERTY_RESTRICTIONS = "restrictions";
51-
private List<LayerAttributesRestrictionsItems> restrictions = null;
51+
private List<TimeRestriction> restrictions = null;
5252

5353
public static final String JSON_PROPERTY_ROTATION_START = "rotation_start";
5454
private OffsetDateTime rotationStart;
@@ -138,15 +138,15 @@ public void setName(String name) {
138138
this.name = name;
139139
}
140140

141-
public LayerAttributes restrictions(List<LayerAttributesRestrictionsItems> restrictions) {
141+
public LayerAttributes restrictions(List<TimeRestriction> restrictions) {
142142
this.restrictions = restrictions;
143-
for (LayerAttributesRestrictionsItems item : restrictions) {
143+
for (TimeRestriction item : restrictions) {
144144
this.unparsed |= item.unparsed;
145145
}
146146
return this;
147147
}
148148

149-
public LayerAttributes addRestrictionsItem(LayerAttributesRestrictionsItems restrictionsItem) {
149+
public LayerAttributes addRestrictionsItem(TimeRestriction restrictionsItem) {
150150
if (this.restrictions == null) {
151151
this.restrictions = new ArrayList<>();
152152
}
@@ -163,11 +163,11 @@ public LayerAttributes addRestrictionsItem(LayerAttributesRestrictionsItems rest
163163
@jakarta.annotation.Nullable
164164
@JsonProperty(JSON_PROPERTY_RESTRICTIONS)
165165
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
166-
public List<LayerAttributesRestrictionsItems> getRestrictions() {
166+
public List<TimeRestriction> getRestrictions() {
167167
return restrictions;
168168
}
169169

170-
public void setRestrictions(List<LayerAttributesRestrictionsItems> restrictions) {
170+
public void setRestrictions(List<TimeRestriction> restrictions) {
171171
this.restrictions = restrictions;
172172
}
173173

0 commit comments

Comments
 (0)