diff --git a/.apigentools-info b/.apigentools-info index 87c7f7327b65..792a8851b5e6 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2025-04-10 18:01:24.451821", - "spec_repo_commit": "c0a45137" + "regenerated": "2025-04-11 12:58:58.679153", + "spec_repo_commit": "7307da21" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2025-04-10 18:01:24.467888", - "spec_repo_commit": "c0a45137" + "regenerated": "2025-04-11 12:58:58.695743", + "spec_repo_commit": "7307da21" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index d2075b54e4c5..7004492f437b 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -17557,6 +17557,164 @@ components: - index - caseIndex type: object + Layer: + description: Encapsulates a layer resource, holding attributes like rotation + details, plus relationships to the members covering that layer. + properties: + attributes: + $ref: '#/components/schemas/LayerAttributes' + id: + description: A unique identifier for this layer. + type: string + relationships: + $ref: '#/components/schemas/LayerRelationships' + type: + $ref: '#/components/schemas/LayerType' + type: object + LayerAttributes: + description: Describes key properties of a Layer, including rotation details, + name, start/end times, and any restrictions. + properties: + effective_date: + description: When the layer becomes active (ISO 8601). + format: date-time + type: string + end_date: + description: When the layer ceases to be active (ISO 8601). + format: date-time + type: string + interval: + $ref: '#/components/schemas/LayerAttributesInterval' + name: + description: The name of this layer. + example: Weekend Layer + type: string + restrictions: + description: An optional list of time restrictions for when this layer is + in effect. + items: + $ref: '#/components/schemas/LayerAttributesRestrictionsItems' + type: array + rotation_start: + description: The date/time when the rotation starts (ISO 8601). + format: date-time + type: string + type: object + LayerAttributesInterval: + description: Defines how often the rotation repeats, using a combination of + days and optional seconds. + properties: + days: + description: The number of days in each rotation cycle. + format: int32 + maximum: 400 + type: integer + seconds: + description: Any additional seconds for the rotation cycle (up to 30 days). + format: int64 + maximum: 2592000 + type: integer + type: object + LayerAttributesRestrictionsItems: + description: 'Represents a time restriction within a layer, specifying the days + and times + + when this layer is active or inactive.' + properties: + end_day: + $ref: '#/components/schemas/LayerAttributesRestrictionsItemsEndDay' + end_time: + description: The time of day the restriction ends (hh:mm:ss). + type: string + start_day: + $ref: '#/components/schemas/LayerAttributesRestrictionsItemsStartDay' + start_time: + description: The time of day the restriction begins (hh:mm:ss). + type: string + type: object + LayerAttributesRestrictionsItemsEndDay: + description: Defines the end day of the restriction within a Layer. + enum: + - monday + - tuesday + - wednesday + - thursday + - friday + - saturday + - sunday + type: string + x-enum-varnames: + - MONDAY + - TUESDAY + - WEDNESDAY + - THURSDAY + - FRIDAY + - SATURDAY + - SUNDAY + LayerAttributesRestrictionsItemsStartDay: + description: Defines the start day of the restriction within a Layer. + enum: + - monday + - tuesday + - wednesday + - thursday + - friday + - saturday + - sunday + type: string + x-enum-varnames: + - MONDAY + - TUESDAY + - WEDNESDAY + - THURSDAY + - FRIDAY + - SATURDAY + - SUNDAY + LayerRelationships: + description: Holds references to objects related to the Layer entity, such as + its members. + properties: + members: + $ref: '#/components/schemas/LayerRelationshipsMembers' + type: object + LayerRelationshipsMembers: + description: Holds an array of references to the members of a Layer, each containing + member IDs. + properties: + data: + description: The list of members who belong to this layer. + items: + $ref: '#/components/schemas/LayerRelationshipsMembersDataItems' + type: array + type: object + LayerRelationshipsMembersDataItems: + description: 'Represents a single member object in a layer''s `members` array, + referencing + + a unique Datadog user ID.' + properties: + id: + description: The unique user ID of the layer member. + type: string + type: + $ref: '#/components/schemas/LayerRelationshipsMembersDataItemsType' + type: object + LayerRelationshipsMembersDataItemsType: + default: members + description: Members resource type. + enum: + - members + type: string + x-enum-varnames: + - MEMBERS + LayerType: + default: layers + description: Layers resource type. + enum: + - layers + type: string + x-enum-varnames: + - LAYERS LeakedKey: description: The definition of LeakedKey object. properties: @@ -26877,6 +27035,500 @@ components: type: $ref: '#/components/schemas/ScalarFormulaResponseType' type: object + Schedule: + description: Top-level container for a schedule object, including both the `data` + payload and any related `included` resources (such as teams, layers, or members). + example: + data: + attributes: + name: On-Call Schedule + tags: + - tag1 + - tag2 + time_zone: America/New_York + id: 3653d3c6-0c75-11ea-ad28-fb5701eabc7d + relationships: + layers: + data: + - id: 00000000-0000-0000-0000-000000000001 + type: layers + teams: + data: + - id: 00000000-da3a-0000-0000-000000000000 + type: teams + type: schedules + included: + - attributes: + avatar: '' + description: Team 1 description + handle: team1 + name: Team 1 + id: 00000000-da3a-0000-0000-000000000000 + type: teams + - attributes: + effective_date: '2025-02-03T05:00:00Z' + end_date: '2025-12-31T00:00:00Z' + interval: + days: 1 + name: Layer 1 + restrictions: + - end_day: friday + end_time: '17:00:00' + start_day: monday + start_time: 09:00:00 + rotation_start: '2025-02-01T00:00:00Z' + id: 00000000-0000-0000-0000-000000000001 + relationships: + members: + data: + - id: 00000000-0000-0000-0000-000000000002 + type: members + type: layers + - id: 00000000-0000-0000-0000-000000000002 + relationships: + user: + data: + id: 00000000-aba1-0000-0000-000000000000 + type: users + type: members + - attributes: + email: foo@bar.com + name: User 1 + id: 00000000-aba1-0000-0000-000000000000 + type: users + properties: + data: + $ref: '#/components/schemas/ScheduleData' + included: + description: Any additional resources related to this schedule, such as + teams and layers. + items: + $ref: '#/components/schemas/ScheduleDataIncludedItem' + type: array + type: object + ScheduleCreateRequest: + description: The top-level request body for schedule creation, wrapping a `data` + object. + example: + data: + attributes: + layers: + - effective_date: '2025-02-03T05:00:00Z' + end_date: '2025-12-31T00:00:00Z' + interval: + days: 1 + members: + - user: + id: 00000000-aba1-0000-0000-000000000000 + name: Layer 1 + restrictions: + - end_day: friday + end_time: '17:00:00' + start_day: monday + start_time: 09:00:00 + rotation_start: '2025-02-01T00:00:00Z' + name: On-Call Schedule + tags: + - tag1 + - tag2 + time_zone: America/New_York + relationships: + teams: + data: + - id: 00000000-da3a-0000-0000-000000000000 + type: teams + type: schedules + properties: + data: + $ref: '#/components/schemas/ScheduleCreateRequestData' + required: + - data + type: object + ScheduleCreateRequestData: + description: The core data wrapper for creating a schedule, encompassing attributes, + relationships, and the resource type. + properties: + attributes: + $ref: '#/components/schemas/ScheduleCreateRequestDataAttributes' + relationships: + $ref: '#/components/schemas/ScheduleCreateRequestDataRelationships' + type: + $ref: '#/components/schemas/ScheduleCreateRequestDataType' + required: + - attributes + - type + type: object + ScheduleCreateRequestDataAttributes: + description: Describes the main attributes for creating a new schedule, including + name, layers, time zone, and tags. + properties: + layers: + description: The layers of on-call coverage that define rotation intervals + and restrictions. + items: + $ref: '#/components/schemas/ScheduleCreateRequestDataAttributesLayersItems' + type: array + name: + description: A human-readable name for the new schedule. + example: Team A On-Call + type: string + tags: + description: A list of tags for categorizing or filtering the schedule. + items: + type: string + type: array + time_zone: + description: The time zone in which the schedule is defined. + example: America/New_York + type: string + required: + - name + - time_zone + - layers + type: object + ScheduleCreateRequestDataAttributesLayersItems: + description: Describes a schedule layer, including rotation intervals, members, + restrictions, and timeline settings. + properties: + effective_date: + description: The date/time when this layer becomes active (in ISO 8601). + example: '2025-01-01T00:00:00Z' + format: date-time + type: string + end_date: + description: The date/time after which this layer no longer applies (in + ISO 8601). + format: date-time + type: string + interval: + $ref: '#/components/schemas/ScheduleCreateRequestDataAttributesLayersItemsInterval' + members: + description: A list of members who participate in this layer's rotation. + items: + $ref: '#/components/schemas/ScheduleCreateRequestDataAttributesLayersItemsMembersItems' + type: array + name: + description: The name of this layer. + example: Primary On-Call Layer + type: string + restrictions: + description: Zero or more time-based restrictions (for example, only weekdays, + during business hours). + items: + $ref: '#/components/schemas/ScheduleCreateRequestDataAttributesLayersItemsRestrictionsItems' + type: array + rotation_start: + description: The date/time when the rotation for this layer starts (in ISO + 8601). + example: '2025-01-01T00:00:00Z' + format: date-time + type: string + required: + - name + - interval + - rotation_start + - effective_date + - members + type: object + ScheduleCreateRequestDataAttributesLayersItemsInterval: + description: Defines how frequently the rotation repeats, using days and/or + seconds (up to certain limits). + properties: + days: + description: The number of full days in each rotation period. + format: int32 + maximum: 400 + type: integer + seconds: + description: Extra seconds that may be added to extend the rotation beyond + whole days. + format: int64 + maximum: 2592000 + type: integer + type: object + ScheduleCreateRequestDataAttributesLayersItemsMembersItems: + description: Defines a single member within a schedule layer, including the + reference to the underlying user. + properties: + user: + $ref: '#/components/schemas/ScheduleCreateRequestDataAttributesLayersItemsMembersItemsUser' + type: object + ScheduleCreateRequestDataAttributesLayersItemsMembersItemsUser: + description: Identifies the user participating in this layer as a single object + with an `id`. + properties: + id: + description: The user's ID. + type: string + type: object + ScheduleCreateRequestDataAttributesLayersItemsRestrictionsItems: + description: 'Defines a time restriction for a schedule layer, including which + day of the week + + it starts and ends, along with start/end times.' + properties: + end_day: + $ref: '#/components/schemas/ScheduleCreateRequestDataAttributesLayersItemsRestrictionsItemsEndDay' + end_time: + description: The time of day when the restriction ends (hh:mm:ss). + type: string + start_day: + $ref: '#/components/schemas/ScheduleCreateRequestDataAttributesLayersItemsRestrictionsItemsStartDay' + start_time: + description: The time of day when the restriction begins (hh:mm:ss). + type: string + type: object + ScheduleCreateRequestDataAttributesLayersItemsRestrictionsItemsEndDay: + description: The weekday when the restriction period ends (Monday through Sunday). + enum: + - monday + - tuesday + - wednesday + - thursday + - friday + - saturday + - sunday + type: string + x-enum-varnames: + - MONDAY + - TUESDAY + - WEDNESDAY + - THURSDAY + - FRIDAY + - SATURDAY + - SUNDAY + ScheduleCreateRequestDataAttributesLayersItemsRestrictionsItemsStartDay: + description: The weekday when the restriction period starts (Monday through + Sunday). + enum: + - monday + - tuesday + - wednesday + - thursday + - friday + - saturday + - sunday + type: string + x-enum-varnames: + - MONDAY + - TUESDAY + - WEDNESDAY + - THURSDAY + - FRIDAY + - SATURDAY + - SUNDAY + ScheduleCreateRequestDataRelationships: + description: Gathers relationship objects for the schedule creation request, + including the teams to associate. + properties: + teams: + $ref: '#/components/schemas/ScheduleCreateRequestDataRelationshipsTeams' + type: object + ScheduleCreateRequestDataRelationshipsTeams: + description: Associates the new schedule with one or more teams. + properties: + data: + description: An array of team references for this schedule. + items: + $ref: '#/components/schemas/ScheduleCreateRequestDataRelationshipsTeamsDataItems' + type: array + type: object + ScheduleCreateRequestDataRelationshipsTeamsDataItems: + description: 'Holds the relationship data linking this schedule to a particular + team, + + identified by `id` and `type`.' + properties: + id: + description: A unique identifier for the team. + type: string + type: + $ref: '#/components/schemas/ScheduleCreateRequestDataRelationshipsTeamsDataItemsType' + type: object + ScheduleCreateRequestDataRelationshipsTeamsDataItemsType: + default: teams + description: Teams resource type. + enum: + - teams + type: string + x-enum-varnames: + - TEAMS + ScheduleCreateRequestDataType: + default: schedules + description: Schedules resource type. + enum: + - schedules + example: schedules + type: string + x-enum-varnames: + - SCHEDULES + ScheduleData: + description: Represents the primary data object for a schedule, linking attributes + and relationships. + properties: + attributes: + $ref: '#/components/schemas/ScheduleDataAttributes' + id: + description: The schedule's unique identifier. + example: 3653d3c6-0c75-11ea-ad28-fb5701eabc7d + type: string + relationships: + $ref: '#/components/schemas/ScheduleDataRelationships' + type: + $ref: '#/components/schemas/ScheduleDataType' + type: object + ScheduleDataAttributes: + description: Provides core properties of a schedule object, such as its name, + time zone, and tags. + properties: + name: + description: A short name for the schedule. + example: Primary On-Call + type: string + tags: + description: A list of tags associated with this schedule. + items: + type: string + type: array + time_zone: + description: The time zone in which this schedule operates. + example: America/New_York + type: string + type: object + ScheduleDataIncludedItem: + description: Any additional resources related to this schedule, such as teams + and layers. + oneOf: + - $ref: '#/components/schemas/TeamReference' + - $ref: '#/components/schemas/Layer' + - $ref: '#/components/schemas/ScheduleMember' + - $ref: '#/components/schemas/ScheduleUser' + ScheduleDataRelationships: + description: Groups the relationships for a schedule object, referencing layers + and teams. + properties: + layers: + $ref: '#/components/schemas/ScheduleDataRelationshipsLayers' + teams: + $ref: '#/components/schemas/ScheduleDataRelationshipsTeams' + type: object + ScheduleDataRelationshipsLayers: + description: Associates layers with this schedule in a data structure. + properties: + data: + description: An array of layer references for this schedule. + items: + $ref: '#/components/schemas/ScheduleDataRelationshipsLayersDataItems' + type: array + type: object + ScheduleDataRelationshipsLayersDataItems: + description: Relates a layer to this schedule, identified by `id` and `type` + (must be `layers`). + properties: + id: + description: The unique identifier of the layer in this relationship. + example: 67963b57-d67c-dfa7-b180-62ee9301d2f5 + type: string + type: + $ref: '#/components/schemas/ScheduleDataRelationshipsLayersDataItemsType' + type: object + ScheduleDataRelationshipsLayersDataItemsType: + default: layers + description: Layers resource type. + enum: + - layers + example: layers + type: string + x-enum-varnames: + - LAYERS + ScheduleDataRelationshipsTeams: + description: Associates teams with this schedule in a data structure. + properties: + data: + description: An array of team references for this schedule. + items: + $ref: '#/components/schemas/ScheduleDataRelationshipsTeamsDataItems' + type: array + type: object + ScheduleDataRelationshipsTeamsDataItems: + description: Relates a team to this schedule, identified by `id` and `type` + (must be `teams`). + properties: + id: + description: The unique identifier of the team in this relationship. + example: 00000000-da3a-0000-0000-000000000000 + type: string + type: + $ref: '#/components/schemas/ScheduleDataRelationshipsTeamsDataItemsType' + type: object + ScheduleDataRelationshipsTeamsDataItemsType: + default: teams + description: Teams resource type. + enum: + - teams + example: teams + type: string + x-enum-varnames: + - TEAMS + ScheduleDataType: + default: schedules + description: Schedules resource type. + enum: + - schedules + type: string + x-enum-varnames: + - SCHEDULES + ScheduleMember: + description: Represents a single member entry in a schedule, referencing a specific + user. + properties: + id: + description: The unique identifier for this schedule member. + type: string + relationships: + $ref: '#/components/schemas/ScheduleMemberRelationships' + type: + $ref: '#/components/schemas/ScheduleMemberType' + type: object + ScheduleMemberRelationships: + description: Defines relationships for a schedule member, primarily referencing + a single user. + properties: + user: + $ref: '#/components/schemas/ScheduleMemberRelationshipsUser' + type: object + ScheduleMemberRelationshipsUser: + description: Wraps the user data reference for a schedule member. + properties: + data: + $ref: '#/components/schemas/ScheduleMemberRelationshipsUserData' + type: object + ScheduleMemberRelationshipsUserData: + description: Points to the user data associated with this schedule member, including + an ID and type. + properties: + id: + description: The user's unique identifier. + type: string + type: + $ref: '#/components/schemas/ScheduleMemberRelationshipsUserDataType' + type: object + ScheduleMemberRelationshipsUserDataType: + default: users + description: Users resource type. + enum: + - users + type: string + x-enum-varnames: + - USERS + ScheduleMemberType: + default: members + description: Schedule Members resource type. + enum: + - members + type: string + x-enum-varnames: + - MEMBERS ScheduleTrigger: description: Trigger a workflow from a Schedule. The workflow must be published. properties: @@ -26897,6 +27549,296 @@ components: required: - scheduleTrigger type: object + ScheduleUpdateRequest: + description: A top-level wrapper for a schedule update request, referring to + the `data` object with the new details. + example: + data: + attributes: + layers: + - effective_date: '2025-02-03T05:00:00Z' + end_date: '2025-12-31T00:00:00Z' + interval: + seconds: 300 + members: + - user: + id: 00000000-aba1-0000-0000-000000000000 + name: Layer 1 + restrictions: + - end_day: friday + end_time: '17:00:00' + start_day: monday + start_time: 09:00:00 + rotation_start: '2025-02-01T00:00:00Z' + name: On-Call Schedule Updated + tags: + - tag1 + - tag2 + - tag3 + time_zone: America/New_York + id: 3653d3c6-0c75-11ea-ad28-fb5701eabc7d + relationships: + teams: + data: + - id: 00000000-da3a-0000-0000-000000000000 + type: teams + type: schedules + properties: + data: + $ref: '#/components/schemas/ScheduleUpdateRequestData' + required: + - data + type: object + ScheduleUpdateRequestData: + description: Contains all data needed to update an existing schedule, including + its attributes (such as name, layers, or tags) and any relationships to teams. + properties: + attributes: + $ref: '#/components/schemas/ScheduleUpdateRequestDataAttributes' + id: + description: The ID of the schedule to be updated. + example: 3653d3c6-0c75-11ea-ad28-fb5701eabc7d + type: string + relationships: + $ref: '#/components/schemas/ScheduleUpdateRequestDataRelationships' + type: + $ref: '#/components/schemas/ScheduleUpdateRequestDataType' + required: + - attributes + - type + - id + type: object + ScheduleUpdateRequestDataAttributes: + description: Defines the updatable attributes for a schedule, such as name, + time zone, tags, and layers. + properties: + layers: + description: The updated list of layers (rotations) for this schedule. + items: + $ref: '#/components/schemas/ScheduleUpdateRequestDataAttributesLayersItems' + type: array + name: + description: A short name for the schedule. + example: Primary On-Call + type: string + tags: + description: A list of tags that you can associate with this schedule. + example: + - front-end + - team-a + items: + type: string + type: array + time_zone: + description: The time zone used when interpreting rotation times. + example: America/New_York + type: string + required: + - name + - time_zone + - layers + type: object + ScheduleUpdateRequestDataAttributesLayersItems: + description: 'Represents a layer within a schedule update, including rotation + details, members, + + and optional restrictions.' + properties: + effective_date: + description: When this updated layer takes effect (ISO 8601 format). + format: date-time + type: string + end_date: + description: When this updated layer should stop being active (ISO 8601 + format). + format: date-time + type: string + id: + description: A unique identifier for the layer being updated. + type: string + interval: + $ref: '#/components/schemas/ScheduleUpdateRequestDataAttributesLayersItemsInterval' + members: + description: The members assigned to this layer. + items: + $ref: '#/components/schemas/ScheduleUpdateRequestDataAttributesLayersItemsMembersItems' + type: array + name: + description: "The name for this layer (for example, \u201CSecondary Coverage\u201D)." + type: string + restrictions: + description: Any time restrictions that define when this layer is active. + items: + $ref: '#/components/schemas/ScheduleUpdateRequestDataAttributesLayersItemsRestrictionsItems' + type: array + rotation_start: + description: The date/time at which the rotation begins (ISO 8601 format). + format: date-time + type: string + type: object + ScheduleUpdateRequestDataAttributesLayersItemsInterval: + description: 'Specifies how the rotation repeats: number of days, plus optional + seconds, up to the given maximums.' + properties: + days: + description: How many days each rotation cycle should span. + format: int32 + maximum: 400 + type: integer + seconds: + description: Additional seconds to add to the rotation cycle (for example, + partial days). + format: int64 + maximum: 2592000 + type: integer + type: object + ScheduleUpdateRequestDataAttributesLayersItemsMembersItems: + description: 'Defines a single member within a layer during an update request, + referring + + to a specific user.' + properties: + user: + $ref: '#/components/schemas/ScheduleUpdateRequestDataAttributesLayersItemsMembersItemsUser' + type: object + ScheduleUpdateRequestDataAttributesLayersItemsMembersItemsUser: + description: Identifies the user who is assigned to this member object. Only + `id` is required. + properties: + id: + description: The user's ID. + type: string + type: object + ScheduleUpdateRequestDataAttributesLayersItemsRestrictionsItems: + description: 'Defines a time restriction object for a layer within a schedule + update, including + + start and end days, as well as times.' + properties: + end_day: + $ref: '#/components/schemas/ScheduleUpdateRequestDataAttributesLayersItemsRestrictionsItemsEndDay' + end_time: + description: The time at which this restriction ends (hh:mm:ss). + type: string + start_day: + $ref: '#/components/schemas/ScheduleUpdateRequestDataAttributesLayersItemsRestrictionsItemsStartDay' + start_time: + description: The time at which this restriction starts (hh:mm:ss). + type: string + type: object + ScheduleUpdateRequestDataAttributesLayersItemsRestrictionsItemsEndDay: + description: Defines the day of the week on which the time restriction ends. + enum: + - monday + - tuesday + - wednesday + - thursday + - friday + - saturday + - sunday + type: string + x-enum-varnames: + - MONDAY + - TUESDAY + - WEDNESDAY + - THURSDAY + - FRIDAY + - SATURDAY + - SUNDAY + ScheduleUpdateRequestDataAttributesLayersItemsRestrictionsItemsStartDay: + description: Defines the day of the week on which the time restriction starts. + enum: + - monday + - tuesday + - wednesday + - thursday + - friday + - saturday + - sunday + type: string + x-enum-varnames: + - MONDAY + - TUESDAY + - WEDNESDAY + - THURSDAY + - FRIDAY + - SATURDAY + - SUNDAY + ScheduleUpdateRequestDataRelationships: + description: Houses relationships for the schedule update, typically referencing + teams. + properties: + teams: + $ref: '#/components/schemas/ScheduleUpdateRequestDataRelationshipsTeams' + type: object + ScheduleUpdateRequestDataRelationshipsTeams: + description: Defines the teams that this schedule update is associated with. + properties: + data: + description: An array of team references. + items: + $ref: '#/components/schemas/ScheduleUpdateRequestDataRelationshipsTeamsDataItems' + type: array + type: object + ScheduleUpdateRequestDataRelationshipsTeamsDataItems: + description: Links the schedule to a team within an update request, identified + by `id` and `type`. + properties: + id: + description: The unique team identifier. + type: string + type: + $ref: '#/components/schemas/ScheduleUpdateRequestDataRelationshipsTeamsDataItemsType' + type: object + ScheduleUpdateRequestDataRelationshipsTeamsDataItemsType: + default: teams + description: Teams resource type. + enum: + - teams + type: string + x-enum-varnames: + - TEAMS + ScheduleUpdateRequestDataType: + default: schedules + description: Schedules resource type. + enum: + - schedules + example: schedules + type: string + x-enum-varnames: + - SCHEDULES + ScheduleUser: + description: Represents a user object in the context of a schedule, including + their `id`, type, and basic attributes. + properties: + attributes: + $ref: '#/components/schemas/ScheduleUserAttributes' + id: + description: The unique user identifier. + type: string + type: + $ref: '#/components/schemas/ScheduleUserType' + type: object + ScheduleUserAttributes: + description: Provides basic user information for a schedule, including a name + and email address. + properties: + email: + description: The user's email address. + type: string + name: + description: The user's name. + example: Jane Doe + type: string + type: object + ScheduleUserType: + default: users + description: Users resource type. + enum: + - users + type: string + x-enum-varnames: + - USERS ScorecardType: default: scorecard description: The JSON:API type for scorecard. @@ -32573,6 +33515,79 @@ components: $ref: '#/components/schemas/TeamPermissionSetting' type: array type: object + TeamReference: + description: Provides a reference to a team, including ID, type, and basic attributes/relationships. + properties: + attributes: + $ref: '#/components/schemas/TeamReferenceAttributes' + id: + description: The team's unique identifier. + type: string + relationships: + $ref: '#/components/schemas/TeamReferenceRelationships' + type: + $ref: '#/components/schemas/TeamReferenceType' + type: object + TeamReferenceAttributes: + description: Encapsulates the basic attributes of a Team reference, such as + name, handle, and an optional avatar or description. + properties: + avatar: + description: URL or reference for the team's avatar (if available). + type: string + description: + description: A short text describing the team. + type: string + handle: + description: A unique handle/slug for the team. + type: string + name: + description: The full, human-readable name of the team. + type: string + type: object + TeamReferenceRelationships: + description: Collects the key relationship fields for a team reference, specifically + on-call users. + properties: + oncall_users: + $ref: '#/components/schemas/TeamReferenceRelationshipsOncallUsers' + type: object + TeamReferenceRelationshipsOncallUsers: + description: Defines which users are on-call within a team, stored as an array + of references. + properties: + data: + description: The list of user references who are on-call for this team. + items: + $ref: '#/components/schemas/TeamReferenceRelationshipsOncallUsersDataItems' + type: array + type: object + TeamReferenceRelationshipsOncallUsersDataItems: + description: References a user who is on-call within this team, identified by + `id` and `type`. + properties: + id: + description: The unique identifier of the user. + type: string + type: + $ref: '#/components/schemas/TeamReferenceRelationshipsOncallUsersDataItemsType' + type: object + TeamReferenceRelationshipsOncallUsersDataItemsType: + default: users + description: Users resource type. + enum: + - users + type: string + x-enum-varnames: + - USERS + TeamReferenceType: + default: teams + description: Teams resource type. + enum: + - teams + type: string + x-enum-varnames: + - TEAMS TeamRelationships: description: Resources related to a team properties: @@ -45194,6 +46209,161 @@ paths: x-unstable: '**Note**: This endpoint is in Preview. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/v2/on-call/schedules: + post: + description: Create a new on-call schedule + operationId: CreateOnCallSchedule + parameters: + - description: 'Comma-separated list of included relationships to be returned. + Allowed values: `teams`, `layers`, `layers.members`, `layers.members.user`.' + in: query + name: include + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ScheduleCreateRequest' + required: true + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/Schedule' + description: Created + '400': + $ref: '#/components/responses/BadRequestResponse' + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Create on-call schedule + tags: + - On-Call + /api/v2/on-call/schedules/{schedule_id}: + delete: + description: Delete an on-call schedule + operationId: DeleteOnCallSchedule + parameters: + - description: The ID of the schedule + in: path + name: schedule_id + required: true + schema: + example: 3653d3c6-0c75-11ea-ad28-fb5701eabc7d + type: string + responses: + '204': + description: No Content + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Delete on-call schedule + tags: + - On-Call + get: + description: Get an on-call schedule + operationId: GetOnCallSchedule + parameters: + - description: 'Comma-separated list of included relationships to be returned. + Allowed values: `teams`, `layers`, `layers.members`, `layers.members.user`.' + in: query + name: include + schema: + type: string + - description: The ID of the schedule + in: path + name: schedule_id + required: true + schema: + example: 3653d3c6-0c75-11ea-ad28-fb5701eabc7d + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Schedule' + description: OK + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Get on-call schedule + tags: + - On-Call + put: + description: Update a new on-call schedule + operationId: UpdateOnCallSchedule + parameters: + - description: 'Comma-separated list of included relationships to be returned. + Allowed values: `teams`, `layers`, `layers.members`, `layers.members.user`.' + in: query + name: include + schema: + type: string + - description: The ID of the schedule + in: path + name: schedule_id + required: true + schema: + example: 3653d3c6-0c75-11ea-ad28-fb5701eabc7d + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ScheduleUpdateRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Schedule' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Update on-call schedule + tags: + - On-Call /api/v2/org_configs: get: description: Returns all Org Configs (name, description, and value). @@ -54896,6 +56066,12 @@ tags: - description: Configure your [Datadog Okta integration](https://docs.datadoghq.com/integrations/okta/) directly through the Datadog API. name: Okta Integration +- description: 'Configure your [Datadog On-Call](https://docs.datadoghq.com/service_management/on-call/) + + directly through the Datadog API.' + externalDocs: + url: https://docs.datadoghq.com/service_management/on-call/ + name: On-Call - description: 'Configure your [Datadog Opsgenie integration](https://docs.datadoghq.com/integrations/opsgenie/) directly through the Datadog API.' diff --git a/.generator/src/generator/cli.py b/.generator/src/generator/cli.py index 8e18e1e05fb5..91f6d216994c 100644 --- a/.generator/src/generator/cli.py +++ b/.generator/src/generator/cli.py @@ -40,7 +40,7 @@ def cli(specs, output): env.filters["return_type"] = openapi.return_type env.filters["snake_case"] = formatter.snake_case env.filters["attribute_path"] = formatter.attribute_path - + env.filters["class_name"] = formatter.class_name env.globals["gem_name"] = GEM_NAME env.globals["module_name"] = MODULE_NAME env.globals["enumerate"] = enumerate diff --git a/.generator/src/generator/formatter.py b/.generator/src/generator/formatter.py index 776bfd706200..890b2761dc52 100644 --- a/.generator/src/generator/formatter.py +++ b/.generator/src/generator/formatter.py @@ -342,6 +342,9 @@ def format_data_with_schema_dict( return parameters +def class_name(value): + value = re.sub(r'[^a-zA-Z0-9]', '', value) + return value + "API" def attribute_path(attribute): return ".".join(attribute_name(a) for a in attribute.split(".")) diff --git a/.generator/src/generator/templates/api.j2 b/.generator/src/generator/templates/api.j2 index 246723345f3c..555ca5aa2f84 100644 --- a/.generator/src/generator/templates/api.j2 +++ b/.generator/src/generator/templates/api.j2 @@ -5,7 +5,7 @@ require 'cgi' module {{ module_name }}::{{ version|upper }} -{%- set classname = name.replace(" ", "") + "API" %} +{%- set classname = name|class_name %} class {{ classname }} attr_accessor :api_client diff --git a/.generator/src/generator/templates/inflector.j2 b/.generator/src/generator/templates/inflector.j2 index 6693e2048190..04f38b604b58 100644 --- a/.generator/src/generator/templates/inflector.j2 +++ b/.generator/src/generator/templates/inflector.j2 @@ -18,7 +18,7 @@ module {{ module_name }} # APIs {%- for version, apis in all_apis.items() %} {%- for api in apis|sort %} - {%- set name = api.replace(" ", "") + "API" %} + {%- set name = api|class_name %} "{{ version }}.{{ api|snake_case }}_api" => "{{ name }}"{%-if not loop.last %},{% endif %} {%- endfor %}{%-if not loop.last %},{% endif %} {%- endfor %} diff --git a/cassettes/features/v2/on-call/Create-on-call-schedule-returns-Created-response.frozen b/cassettes/features/v2/on-call/Create-on-call-schedule-returns-Created-response.frozen new file mode 100644 index 000000000000..b34ddca840e7 --- /dev/null +++ b/cassettes/features/v2/on-call/Create-on-call-schedule-returns-Created-response.frozen @@ -0,0 +1 @@ +2025-04-07T02:59:16.973Z \ No newline at end of file diff --git a/cassettes/features/v2/on-call/Create-on-call-schedule-returns-Created-response.yml b/cassettes/features/v2/on-call/Create-on-call-schedule-returns-Created-response.yml new file mode 100644 index 000000000000..e87d412ae3ab --- /dev/null +++ b/cassettes/features/v2/on-call/Create-on-call-schedule-returns-Created-response.yml @@ -0,0 +1,125 @@ +http_interactions: +- recorded_at: Mon, 07 Apr 2025 02:59:16 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"email":"Test-Create_on_call_schedule_returns_Created_response-1743994756@datadoghq.com","title":"user + title"},"type":"users"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/users + response: + body: + encoding: UTF-8 + string: '{"data":{"type":"users","id":"4bc206fa-135c-11f0-9459-42e8e154a89e","attributes":{"name":null,"handle":"test-create_on_call_schedule_returns_created_response-1743994756@datadoghq.com","created_at":"2025-04-07T02:59:17.741162+00:00","modified_at":"2025-04-07T02:59:17.741162+00:00","email":"test-create_on_call_schedule_returns_created_response-1743994756@datadoghq.com","icon":"https://secure.gravatar.com/avatar/5fc9aee35e4a0e1e0d7a278ccee14b90?s=48&d=retro","title":"user + title","verified":false,"service_account":false,"disabled":false,"allowed_login_methods":[],"status":"Pending"},"relationships":{"roles":{"data":[]},"org":{"data":{"type":"orgs","id":"4dee724d-00cc-11ea-a77b-570c9d03c6c5"}}}}} + + ' + headers: + Content-Type: + - application/json + status: + code: 201 + message: Created +- recorded_at: Mon, 07 Apr 2025 02:59:16 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"name":"Test-Create_on_call_schedule_returns_Created_response-1743994756"},"type":"teams"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/teams + response: + body: + encoding: UTF-8 + string: '{"data":{"type":"teams","id":"c520d001-9324-5025-aa51-803fd459d7d2","attributes":{"name":"Test-Create_on_call_schedule_returns_Created_response-1743994756","created":"2025-04-07T02:59:18.413985+00:00","modified":"2025-04-07T02:59:18.413985+00:00"},"relationships":{"last_modified_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}},"created_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}}}},"included":[{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"name":"frog","handle":"frog@datadoghq.com","created_at":"2019-10-02T08:15:39.795051+00:00","modified_at":"2025-03-28T02:01:08.410658+00:00","email":"frog@datadoghq.com","icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro","title":null,"verified":true,"service_account":false,"disabled":false,"allowed_login_methods":[],"status":"Active"},"relationships":{"org":{"data":{"type":"orgs","id":"4dee724d-00cc-11ea-a77b-570c9d03c6c5"}}}}]} + + ' + headers: + Content-Type: + - application/json + status: + code: 201 + message: Created +- recorded_at: Mon, 07 Apr 2025 02:59:16 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"layers":[{"effective_date":"2025-03-28T02:59:16.973Z","end_date":"2025-04-17T02:59:16.973Z","interval":{"days":1},"members":[{"user":{"id":"4bc206fa-135c-11f0-9459-42e8e154a89e"}}],"name":"Layer + 1","restrictions":[{"end_day":"friday","end_time":"17:00:00","start_day":"monday","start_time":"09:00:00"}],"rotation_start":"2025-04-02T02:59:16.973Z"}],"name":"Test-Create_on_call_schedule_returns_Created_response-1743994756","tags":["tag1","tag2"],"time_zone":"America/New_York"},"relationships":{"teams":{"data":[{"id":"c520d001-9324-5025-aa51-803fd459d7d2","type":"teams"}]}},"type":"schedules"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/on-call/schedules + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"5528e710-1704-455c-a872-4986774cad7f","type":"schedules","attributes":{"name":"Test-Create_on_call_schedule_returns_Created_response-1743994756","tags":["tag1","tag2"],"time_zone":"America/New_York"},"relationships":{"layers":{"data":[{"id":"9448d443-2122-41c8-90cc-20e27875d44c","type":"layers"}]},"teams":{"data":[{"id":"c520d001-9324-5025-aa51-803fd459d7d2","type":"teams"}]}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 201 + message: Created +- recorded_at: Mon, 07 Apr 2025 02:59:16 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/on-call/schedules/5528e710-1704-455c-a872-4986774cad7f + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +- recorded_at: Mon, 07 Apr 2025 02:59:16 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/teams/c520d001-9324-5025-aa51-803fd459d7d2 + response: + body: + encoding: UTF-8 + string: '' + headers: + Content-Type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +- recorded_at: Mon, 07 Apr 2025 02:59:16 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/users/4bc206fa-135c-11f0-9459-42e8e154a89e + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/on-call/Delete-on-call-schedule-returns-No-Content-response.frozen b/cassettes/features/v2/on-call/Delete-on-call-schedule-returns-No-Content-response.frozen new file mode 100644 index 000000000000..3162c9f345fd --- /dev/null +++ b/cassettes/features/v2/on-call/Delete-on-call-schedule-returns-No-Content-response.frozen @@ -0,0 +1 @@ +2025-04-07T03:17:06.571Z \ No newline at end of file diff --git a/cassettes/features/v2/on-call/Delete-on-call-schedule-returns-No-Content-response.yml b/cassettes/features/v2/on-call/Delete-on-call-schedule-returns-No-Content-response.yml new file mode 100644 index 000000000000..298a9a3d8c7f --- /dev/null +++ b/cassettes/features/v2/on-call/Delete-on-call-schedule-returns-No-Content-response.yml @@ -0,0 +1,60 @@ +http_interactions: +- recorded_at: Mon, 07 Apr 2025 03:17:06 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"layers":[{"effective_date":"2025-03-28T03:17:06.571Z","end_date":"2025-04-17T03:17:06.571Z","interval":{"days":1},"members":[{"user":{"id":"890f29d4-0b7a-11f0-aeb2-760fcae4f596"}}],"name":"Layer + 1","restrictions":[{"end_day":"friday","end_time":"17:00:00","start_day":"monday","start_time":"09:00:00"}],"rotation_start":"2025-04-02T03:17:06.571Z"}],"name":"Test-Delete_on_call_schedule_returns_No_Content_response-1743995826","tags":["tag1","tag2"],"time_zone":"America/New_York"},"relationships":{"teams":{"data":[{"id":"65aea9d0-941c-4607-bf8a-14fc0dac2820","type":"teams"}]}},"type":"schedules"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/on-call/schedules + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"b19a9712-e8f9-43a4-b38b-d5277608e001","type":"schedules","attributes":{"name":"Test-Delete_on_call_schedule_returns_No_Content_response-1743995826","tags":["tag1","tag2"],"time_zone":"America/New_York"},"relationships":{"layers":{"data":[{"id":"e82fe752-2c1a-4e05-a8a6-fe4ae5e0c889","type":"layers"}]},"teams":{"data":[{"id":"65aea9d0-941c-4607-bf8a-14fc0dac2820","type":"teams"}]}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 201 + message: Created +- recorded_at: Mon, 07 Apr 2025 03:17:06 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/on-call/schedules/b19a9712-e8f9-43a4-b38b-d5277608e001 + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +- recorded_at: Mon, 07 Apr 2025 03:17:06 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/on-call/schedules/b19a9712-e8f9-43a4-b38b-d5277608e001 + response: + body: + encoding: UTF-8 + string: '{"errors":[{"title":"Generic Error","detail":"schedule[b19a9712-e8f9-43a4-b38b-d5277608e001] + not found"}]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 404 + message: Not Found +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/on-call/Get-on-call-schedule-returns-OK-response.frozen b/cassettes/features/v2/on-call/Get-on-call-schedule-returns-OK-response.frozen new file mode 100644 index 000000000000..ec5f4c0611cb --- /dev/null +++ b/cassettes/features/v2/on-call/Get-on-call-schedule-returns-OK-response.frozen @@ -0,0 +1 @@ +2025-04-07T03:17:07.923Z \ No newline at end of file diff --git a/cassettes/features/v2/on-call/Get-on-call-schedule-returns-OK-response.yml b/cassettes/features/v2/on-call/Get-on-call-schedule-returns-OK-response.yml new file mode 100644 index 000000000000..3dd70cbe3b21 --- /dev/null +++ b/cassettes/features/v2/on-call/Get-on-call-schedule-returns-OK-response.yml @@ -0,0 +1,59 @@ +http_interactions: +- recorded_at: Mon, 07 Apr 2025 03:17:07 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"layers":[{"effective_date":"2025-03-28T03:17:07.923Z","end_date":"2025-04-17T03:17:07.923Z","interval":{"days":1},"members":[{"user":{"id":"890f29d4-0b7a-11f0-aeb2-760fcae4f596"}}],"name":"Layer + 1","restrictions":[{"end_day":"friday","end_time":"17:00:00","start_day":"monday","start_time":"09:00:00"}],"rotation_start":"2025-04-02T03:17:07.923Z"}],"name":"Test-Get_on_call_schedule_returns_OK_response-1743995827","tags":["tag1","tag2"],"time_zone":"America/New_York"},"relationships":{"teams":{"data":[{"id":"65aea9d0-941c-4607-bf8a-14fc0dac2820","type":"teams"}]}},"type":"schedules"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/on-call/schedules + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"e1168897-a10f-490d-a790-9b81aa6c3417","type":"schedules","attributes":{"name":"Test-Get_on_call_schedule_returns_OK_response-1743995827","tags":["tag1","tag2"],"time_zone":"America/New_York"},"relationships":{"layers":{"data":[{"id":"cc6bfcfb-a227-4ac5-aa27-b64bca857e02","type":"layers"}]},"teams":{"data":[{"id":"65aea9d0-941c-4607-bf8a-14fc0dac2820","type":"teams"}]}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 201 + message: Created +- recorded_at: Mon, 07 Apr 2025 03:17:07 GMT + request: + body: null + headers: + Accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/on-call/schedules/e1168897-a10f-490d-a790-9b81aa6c3417 + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"e1168897-a10f-490d-a790-9b81aa6c3417","type":"schedules","attributes":{"name":"Test-Get_on_call_schedule_returns_OK_response-1743995827","tags":["tag1","tag2"],"time_zone":"America/New_York"},"relationships":{"layers":{"data":[{"id":"cc6bfcfb-a227-4ac5-aa27-b64bca857e02","type":"layers"}]},"teams":{"data":[{"id":"65aea9d0-941c-4607-bf8a-14fc0dac2820","type":"teams"}]}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +- recorded_at: Mon, 07 Apr 2025 03:17:07 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/on-call/schedules/e1168897-a10f-490d-a790-9b81aa6c3417 + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/on-call/Update-on-call-schedule-returns-OK-response.frozen b/cassettes/features/v2/on-call/Update-on-call-schedule-returns-OK-response.frozen new file mode 100644 index 000000000000..c4d9e06a5802 --- /dev/null +++ b/cassettes/features/v2/on-call/Update-on-call-schedule-returns-OK-response.frozen @@ -0,0 +1 @@ +2025-04-07T03:17:09.085Z \ No newline at end of file diff --git a/cassettes/features/v2/on-call/Update-on-call-schedule-returns-OK-response.yml b/cassettes/features/v2/on-call/Update-on-call-schedule-returns-OK-response.yml new file mode 100644 index 000000000000..900b6fbfa1bd --- /dev/null +++ b/cassettes/features/v2/on-call/Update-on-call-schedule-returns-OK-response.yml @@ -0,0 +1,149 @@ +http_interactions: +- recorded_at: Mon, 07 Apr 2025 03:17:09 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"layers":[{"effective_date":"2025-03-28T03:17:09.085Z","end_date":"2025-04-17T03:17:09.085Z","interval":{"days":1},"members":[{"user":{"id":"890f29d4-0b7a-11f0-aeb2-760fcae4f596"}}],"name":"Layer + 1","restrictions":[{"end_day":"friday","end_time":"17:00:00","start_day":"monday","start_time":"09:00:00"}],"rotation_start":"2025-04-02T03:17:09.085Z"}],"name":"Test-Update_on_call_schedule_returns_OK_response-1743995829","tags":["tag1","tag2"],"time_zone":"America/New_York"},"relationships":{"teams":{"data":[{"id":"65aea9d0-941c-4607-bf8a-14fc0dac2820","type":"teams"}]}},"type":"schedules"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/on-call/schedules + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"191778c4-9051-4c9d-b09f-14885fcbc680","type":"schedules","attributes":{"name":"Test-Update_on_call_schedule_returns_OK_response-1743995829","tags":["tag1","tag2"],"time_zone":"America/New_York"},"relationships":{"layers":{"data":[{"id":"f095f9ef-6372-4a49-8d70-7553f5d047cc","type":"layers"}]},"teams":{"data":[{"id":"65aea9d0-941c-4607-bf8a-14fc0dac2820","type":"teams"}]}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 201 + message: Created +- recorded_at: Mon, 07 Apr 2025 03:17:09 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"name":"Test-Update_on_call_schedule_returns_OK_response-1743995829"},"type":"teams"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/teams + response: + body: + encoding: UTF-8 + string: '{"data":{"type":"teams","id":"15da5494-6da3-5c57-b5e4-38c4e44077e8","attributes":{"name":"Test-Update_on_call_schedule_returns_OK_response-1743995829","created":"2025-04-07T03:17:09.733170+00:00","modified":"2025-04-07T03:17:09.733170+00:00"},"relationships":{"last_modified_by":{"data":{"type":"users","id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"}},"created_by":{"data":{"type":"users","id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"}}}},"included":[{"type":"users","id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","attributes":{"name":"CI + Account","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","created_at":"2020-12-29T22:58:44.733921+00:00","modified_at":"2021-04-27T13:54:01.547888+00:00","email":"team-intg-tools-libs-spam@datadoghq.com","icon":"https://secure.gravatar.com/avatar/b7c189b5b4c2c429d7c1e0bc3749330e?s=48&d=retro","title":null,"verified":true,"service_account":true,"disabled":false,"allowed_login_methods":[],"status":"Active"},"relationships":{"org":{"data":{"type":"orgs","id":"4dee724d-00cc-11ea-a77b-570c9d03c6c5"}}}}]} + + ' + headers: + Content-Type: + - application/json + status: + code: 201 + message: Created +- recorded_at: Mon, 07 Apr 2025 03:17:09 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"email":"Test-Update_on_call_schedule_returns_OK_response-1743995829@datadoghq.com","title":"user + title"},"type":"users"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/users + response: + body: + encoding: UTF-8 + string: '{"data":{"type":"users","id":"caf2d527-135e-11f0-ab67-9afbb444f569","attributes":{"name":null,"handle":"test-update_on_call_schedule_returns_ok_response-1743995829@datadoghq.com","created_at":"2025-04-07T03:17:10.125124+00:00","modified_at":"2025-04-07T03:17:10.125124+00:00","email":"test-update_on_call_schedule_returns_ok_response-1743995829@datadoghq.com","icon":"https://secure.gravatar.com/avatar/8ff13bebf0ad3938e62b638f1ea5691f?s=48&d=retro","title":"user + title","verified":false,"service_account":false,"disabled":false,"allowed_login_methods":[],"status":"Pending"},"relationships":{"roles":{"data":[]},"org":{"data":{"type":"orgs","id":"4dee724d-00cc-11ea-a77b-570c9d03c6c5"}}}}} + + ' + headers: + Content-Type: + - application/json + status: + code: 201 + message: Created +- recorded_at: Mon, 07 Apr 2025 03:17:09 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"layers":[{"effective_date":"2025-03-28T03:17:09.085Z","end_date":"2025-04-17T03:17:09.085Z","id":"f095f9ef-6372-4a49-8d70-7553f5d047cc","interval":{"seconds":300},"members":[{"user":{"id":"caf2d527-135e-11f0-ab67-9afbb444f569"}}],"name":"Layer + 1","restrictions":[{"end_day":"friday","end_time":"17:00:00","start_day":"monday","start_time":"09:00:00"}],"rotation_start":"2025-04-02T03:17:09.085Z"}],"name":"Test-Update_on_call_schedule_returns_OK_response-1743995829","tags":["tag1","tag2","tag3"],"time_zone":"America/New_York"},"id":"191778c4-9051-4c9d-b09f-14885fcbc680","relationships":{"teams":{"data":[{"id":"15da5494-6da3-5c57-b5e4-38c4e44077e8","type":"teams"}]}},"type":"schedules"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: PUT + uri: https://api.datadoghq.com/api/v2/on-call/schedules/191778c4-9051-4c9d-b09f-14885fcbc680 + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"191778c4-9051-4c9d-b09f-14885fcbc680","type":"schedules","attributes":{"name":"Test-Update_on_call_schedule_returns_OK_response-1743995829","tags":["tag1","tag2","tag3"],"time_zone":"America/New_York"},"relationships":{"layers":{"data":[{"id":"f095f9ef-6372-4a49-8d70-7553f5d047cc","type":"layers"}]},"teams":{"data":[{"id":"15da5494-6da3-5c57-b5e4-38c4e44077e8","type":"teams"}]}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +- recorded_at: Mon, 07 Apr 2025 03:17:09 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/users/caf2d527-135e-11f0-ab67-9afbb444f569 + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +- recorded_at: Mon, 07 Apr 2025 03:17:09 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/teams/15da5494-6da3-5c57-b5e4-38c4e44077e8 + response: + body: + encoding: UTF-8 + string: '' + headers: + Content-Type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +- recorded_at: Mon, 07 Apr 2025 03:17:09 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/on-call/schedules/191778c4-9051-4c9d-b09f-14885fcbc680 + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/examples/v2/on-call/CreateOnCallSchedule.rb b/examples/v2/on-call/CreateOnCallSchedule.rb new file mode 100644 index 000000000000..2d80095f7ca1 --- /dev/null +++ b/examples/v2/on-call/CreateOnCallSchedule.rb @@ -0,0 +1,61 @@ +# Create on-call schedule returns "Created" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::On - CallAPI.new + +# there is a valid "user" in the system +USER_DATA_ID = ENV["USER_DATA_ID"] + +# there is a valid "team" in the system +TEAM_DATA_ID = ENV["TEAM_DATA_ID"] + +body = DatadogAPIClient::V2::ScheduleCreateRequest.new({ + data: DatadogAPIClient::V2::ScheduleCreateRequestData.new({ + attributes: DatadogAPIClient::V2::ScheduleCreateRequestDataAttributes.new({ + layers: [ + DatadogAPIClient::V2::ScheduleCreateRequestDataAttributesLayersItems.new({ + effective_date: (Time.now + -10 * 86400), + end_date: (Time.now + 10 * 86400), + interval: DatadogAPIClient::V2::ScheduleCreateRequestDataAttributesLayersItemsInterval.new({ + days: 1, + }), + members: [ + DatadogAPIClient::V2::ScheduleCreateRequestDataAttributesLayersItemsMembersItems.new({ + user: DatadogAPIClient::V2::ScheduleCreateRequestDataAttributesLayersItemsMembersItemsUser.new({ + id: USER_DATA_ID, + }), + }), + ], + name: "Layer 1", + restrictions: [ + DatadogAPIClient::V2::ScheduleCreateRequestDataAttributesLayersItemsRestrictionsItems.new({ + end_day: DatadogAPIClient::V2::ScheduleCreateRequestDataAttributesLayersItemsRestrictionsItemsEndDay::FRIDAY, + end_time: "17:00:00", + start_day: DatadogAPIClient::V2::ScheduleCreateRequestDataAttributesLayersItemsRestrictionsItemsStartDay::MONDAY, + start_time: "09:00:00", + }), + ], + rotation_start: (Time.now + -5 * 86400), + }), + ], + name: "Example-On-Call", + tags: [ + "tag1", + "tag2", + ], + time_zone: "America/New_York", + }), + relationships: DatadogAPIClient::V2::ScheduleCreateRequestDataRelationships.new({ + teams: DatadogAPIClient::V2::ScheduleCreateRequestDataRelationshipsTeams.new({ + data: [ + DatadogAPIClient::V2::ScheduleCreateRequestDataRelationshipsTeamsDataItems.new({ + id: TEAM_DATA_ID, + type: DatadogAPIClient::V2::ScheduleCreateRequestDataRelationshipsTeamsDataItemsType::TEAMS, + }), + ], + }), + }), + type: DatadogAPIClient::V2::ScheduleCreateRequestDataType::SCHEDULES, + }), +}) +p api_instance.create_on_call_schedule(body) diff --git a/examples/v2/on-call/DeleteOnCallSchedule.rb b/examples/v2/on-call/DeleteOnCallSchedule.rb new file mode 100644 index 000000000000..0300867d45c7 --- /dev/null +++ b/examples/v2/on-call/DeleteOnCallSchedule.rb @@ -0,0 +1,8 @@ +# Delete on-call schedule returns "No Content" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::On - CallAPI.new + +# there is a valid "schedule" in the system +SCHEDULE_DATA_ID = ENV["SCHEDULE_DATA_ID"] +api_instance.delete_on_call_schedule(SCHEDULE_DATA_ID) diff --git a/examples/v2/on-call/GetOnCallSchedule.rb b/examples/v2/on-call/GetOnCallSchedule.rb new file mode 100644 index 000000000000..ab6ca331b35f --- /dev/null +++ b/examples/v2/on-call/GetOnCallSchedule.rb @@ -0,0 +1,8 @@ +# Get on-call schedule returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::On - CallAPI.new + +# there is a valid "schedule" in the system +SCHEDULE_DATA_ID = ENV["SCHEDULE_DATA_ID"] +p api_instance.get_on_call_schedule(SCHEDULE_DATA_ID) diff --git a/examples/v2/on-call/UpdateOnCallSchedule.rb b/examples/v2/on-call/UpdateOnCallSchedule.rb new file mode 100644 index 000000000000..a62ba579deb5 --- /dev/null +++ b/examples/v2/on-call/UpdateOnCallSchedule.rb @@ -0,0 +1,68 @@ +# Update on-call schedule returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::On - CallAPI.new + +# there is a valid "schedule" in the system +SCHEDULE_DATA_ID = ENV["SCHEDULE_DATA_ID"] +SCHEDULE_DATA_RELATIONSHIPS_LAYERS_DATA_0_ID = ENV["SCHEDULE_DATA_RELATIONSHIPS_LAYERS_DATA_0_ID"] + +# there is a valid "user" in the system +USER_DATA_ID = ENV["USER_DATA_ID"] + +# there is a valid "team" in the system +TEAM_DATA_ID = ENV["TEAM_DATA_ID"] + +body = DatadogAPIClient::V2::ScheduleUpdateRequest.new({ + data: DatadogAPIClient::V2::ScheduleUpdateRequestData.new({ + id: SCHEDULE_DATA_ID, + attributes: DatadogAPIClient::V2::ScheduleUpdateRequestDataAttributes.new({ + layers: [ + DatadogAPIClient::V2::ScheduleUpdateRequestDataAttributesLayersItems.new({ + id: SCHEDULE_DATA_RELATIONSHIPS_LAYERS_DATA_0_ID, + effective_date: (Time.now + -10 * 86400), + end_date: (Time.now + 10 * 86400), + interval: DatadogAPIClient::V2::ScheduleUpdateRequestDataAttributesLayersItemsInterval.new({ + seconds: 300, + }), + members: [ + DatadogAPIClient::V2::ScheduleUpdateRequestDataAttributesLayersItemsMembersItems.new({ + user: DatadogAPIClient::V2::ScheduleUpdateRequestDataAttributesLayersItemsMembersItemsUser.new({ + id: USER_DATA_ID, + }), + }), + ], + name: "Layer 1", + restrictions: [ + DatadogAPIClient::V2::ScheduleUpdateRequestDataAttributesLayersItemsRestrictionsItems.new({ + end_day: DatadogAPIClient::V2::ScheduleUpdateRequestDataAttributesLayersItemsRestrictionsItemsEndDay::FRIDAY, + end_time: "17:00:00", + start_day: DatadogAPIClient::V2::ScheduleUpdateRequestDataAttributesLayersItemsRestrictionsItemsStartDay::MONDAY, + start_time: "09:00:00", + }), + ], + rotation_start: (Time.now + -5 * 86400), + }), + ], + name: "Example-On-Call", + tags: [ + "tag1", + "tag2", + "tag3", + ], + time_zone: "America/New_York", + }), + relationships: DatadogAPIClient::V2::ScheduleUpdateRequestDataRelationships.new({ + teams: DatadogAPIClient::V2::ScheduleUpdateRequestDataRelationshipsTeams.new({ + data: [ + DatadogAPIClient::V2::ScheduleUpdateRequestDataRelationshipsTeamsDataItems.new({ + id: TEAM_DATA_ID, + type: DatadogAPIClient::V2::ScheduleUpdateRequestDataRelationshipsTeamsDataItemsType::TEAMS, + }), + ], + }), + }), + type: DatadogAPIClient::V2::ScheduleUpdateRequestDataType::SCHEDULES, + }), +}) +p api_instance.update_on_call_schedule(SCHEDULE_DATA_ID, body) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index 9d6bd42a5b2b..dbc02bca84af 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -1772,6 +1772,22 @@ "tags" => "String", "limit" => "Integer", }, + "v2.CreateOnCallSchedule" => { + "include" => "String", + "body" => "ScheduleCreateRequest", + }, + "v2.DeleteOnCallSchedule" => { + "schedule_id" => "String", + }, + "v2.GetOnCallSchedule" => { + "include" => "String", + "schedule_id" => "String", + }, + "v2.UpdateOnCallSchedule" => { + "include" => "String", + "schedule_id" => "String", + "body" => "ScheduleUpdateRequest", + }, "v2.GetOrgConfig" => { "org_config_name" => "String", }, diff --git a/features/step_definitions/request.rb b/features/step_definitions/request.rb index e911dbe0dfaf..cd2b9ba15dad 100644 --- a/features/step_definitions/request.rb +++ b/features/step_definitions/request.rb @@ -123,6 +123,14 @@ def undo_operations @undo_operations end + # Takes a tag name and converts it into an API class name by removing spaces and dashes, then appending "API" + # For example: "Logs-Archive" -> "LogsArchiveAPI" + # @param name [String] The tag name to convert + # @return [String] The API class name + def build_api_name(name) + name.gsub(/[\s-]/, '') + "API" + end + def build_undo_for(version, operation_id, api_instance = nil) operation = undo_operations raise "missing x-undo for #{version}" unless operation.key? version @@ -134,13 +142,14 @@ def build_undo_for(version, operation_id, api_instance = nil) return if operation["type"] != "unsafe" if operation["tag"] != nil - undo_tag = operation["tag"].gsub(/\s/, '') + undo_tag = operation["tag"] + api_name = build_api_name(undo_tag) undo_api = Object.const_get("DatadogAPIClient") undo_configuration = from_env(undo_api::Configuration.new) undo_configuration.api_key = ENV["DD_TEST_CLIENT_API_KEY"] undo_configuration.application_key = ENV["DD_TEST_CLIENT_APP_KEY"] undo_api_client = undo_api::APIClient.new undo_configuration - api_instance = undo_api.const_get("V#{version}").const_get("#{undo_tag}API").new undo_api_client + api_instance = undo_api.const_get("V#{version}").const_get(api_name).new undo_api_client end api_instance ||= @api_instance @@ -171,7 +180,7 @@ def build_undo_for(version, operation_id, api_instance = nil) end def build_given(api_version, operation) - api_name = operation["tag"].gsub(/\s/, '') + api_name = build_api_name(operation["tag"]) operation_name = operation["operationId"].snakecase # make sure we have a fresh instance of API client and configuration @@ -180,7 +189,7 @@ def build_given(api_version, operation) given_configuration.api_key = ENV["DD_TEST_CLIENT_API_KEY"] given_configuration.application_key = ENV["DD_TEST_CLIENT_APP_KEY"] given_api_client = given_api::APIClient.new given_configuration - given_api_instance = given_api.const_get("V#{api_version}").const_get("#{api_name}API").new given_api_client + given_api_instance = given_api.const_get("V#{api_version}").const_get(api_name).new given_api_client method = given_api_instance.method("#{operation_name}_with_http_info".to_sym) # find undo method @@ -240,7 +249,8 @@ def model_builder(param, obj) end Given(/^an instance of "([^"]+)" API$/) do |api_name| - @api_instance = api.const_get("V#{@api_version}").const_get("#{api_name}API").new api_client + name = build_api_name(api_name) + @api_instance = api.const_get("V#{@api_version}").const_get(name).new api_client end Given('operation {string} enabled') do |name| diff --git a/features/v2/given.json b/features/v2/given.json index 3a41fda169b0..96c49b616686 100644 --- a/features/v2/given.json +++ b/features/v2/given.json @@ -448,6 +448,18 @@ "tag": "Monitors", "operationId": "CreateMonitorConfigPolicy" }, + { + "parameters": [ + { + "name": "body", + "value": "{\n \"data\": {\n \"attributes\": {\n \"layers\": [\n {\n \"effective_date\": \"{{ timeISO('now - 10d') }}\",\n \"end_date\": \"{{ timeISO('now + 10d') }}\",\n \"interval\": {\n \"days\": 1\n },\n \"members\": [\n {\n \"user\": {\n \"id\": \"890f29d4-0b7a-11f0-aeb2-760fcae4f596\"\n }\n }\n ],\n \"name\": \"Layer 1\",\n \"restrictions\": [\n {\n \"end_day\": \"friday\",\n \"end_time\": \"17:00:00\",\n \"start_day\": \"monday\",\n \"start_time\": \"09:00:00\"\n }\n ],\n \"rotation_start\": \"{{ timeISO('now - 5d') }}\"\n }\n ],\n \"name\": \"{{ unique }}\",\n \"tags\": [\n \"tag1\",\n \"tag2\"\n ],\n \"time_zone\": \"America/New_York\"\n },\n \"relationships\": {\n \"teams\": {\n \"data\": [\n {\n \"id\": \"65aea9d0-941c-4607-bf8a-14fc0dac2820\",\n \"type\": \"teams\"\n }\n ]\n }\n },\n \"type\": \"schedules\"\n }\n}" + } + ], + "step": "there is a valid \"schedule\" in the system", + "key": "schedule", + "tag": "On-Call", + "operationId": "CreateOnCallSchedule" + }, { "source": "data[4]", "step": "there is a valid \"permission\" in the system", diff --git a/features/v2/on-call.feature b/features/v2/on-call.feature new file mode 100644 index 000000000000..f0b6df1decc2 --- /dev/null +++ b/features/v2/on-call.feature @@ -0,0 +1,83 @@ +@endpoint(on-call) @endpoint(on-call-v2) +Feature: On-Call + Configure your [Datadog On- + Call](https://docs.datadoghq.com/service_management/on-call/) directly + through the Datadog API. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "On-Call" API + + @generated @skip @team:DataDog/bugle + Scenario: Create on-call schedule returns "Bad Request" response + Given new "CreateOnCallSchedule" request + And body with value {"data": {"attributes": {"layers": [{"effective_date": "2025-02-03T05:00:00Z", "end_date": "2025-12-31T00:00:00Z", "interval": {"days": 1}, "members": [{"user": {"id": "00000000-aba1-0000-0000-000000000000"}}], "name": "Layer 1", "restrictions": [{"end_day": "friday", "end_time": "17:00:00", "start_day": "monday", "start_time": "09:00:00"}], "rotation_start": "2025-02-01T00:00:00Z"}], "name": "On-Call Schedule", "tags": ["tag1", "tag2"], "time_zone": "America/New_York"}, "relationships": {"teams": {"data": [{"id": "00000000-da3a-0000-0000-000000000000", "type": "teams"}]}}, "type": "schedules"}} + When the request is sent + Then the response status is 400 Bad Request + + @skip-python @team:DataDog/bugle + Scenario: Create on-call schedule returns "Created" response + Given new "CreateOnCallSchedule" request + And there is a valid "user" in the system + And there is a valid "team" in the system + And body with value {"data": {"attributes": {"layers": [{"effective_date": "{{ timeISO('now - 10d') }}", "end_date": "{{ timeISO('now + 10d') }}", "interval": {"days": 1}, "members": [{"user": {"id": "{{user.data.id}}"}}], "name": "Layer 1", "restrictions": [{"end_day": "friday", "end_time": "17:00:00", "start_day": "monday", "start_time": "09:00:00"}], "rotation_start": "{{ timeISO('now - 5d') }}"}], "name": "{{ unique }}", "tags": ["tag1", "tag2"], "time_zone": "America/New_York"}, "relationships": {"teams": {"data": [{"id": "{{team.data.id}}", "type": "teams"}]}}, "type": "schedules"}} + When the request is sent + Then the response status is 201 Created + + @team:DataDog/bugle + Scenario: Delete on-call schedule returns "No Content" response + Given new "DeleteOnCallSchedule" request + And there is a valid "schedule" in the system + And request contains "schedule_id" parameter from "schedule.data.id" + When the request is sent + Then the response status is 204 No Content + + @generated @skip @team:DataDog/bugle + Scenario: Delete on-call schedule returns "Not Found" response + Given new "DeleteOnCallSchedule" request + And request contains "schedule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/bugle + Scenario: Get on-call schedule returns "Not Found" response + Given new "GetOnCallSchedule" request + And request contains "schedule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/bugle + Scenario: Get on-call schedule returns "OK" response + Given new "GetOnCallSchedule" request + And there is a valid "schedule" in the system + And request contains "schedule_id" parameter from "schedule.data.id" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/bugle + Scenario: Update on-call schedule returns "Bad Request" response + Given new "UpdateOnCallSchedule" request + And request contains "schedule_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"layers": [{"effective_date": "2025-02-03T05:00:00Z", "end_date": "2025-12-31T00:00:00Z", "interval": {"seconds": 300}, "members": [{"user": {"id": "00000000-aba1-0000-0000-000000000000"}}], "name": "Layer 1", "restrictions": [{"end_day": "friday", "end_time": "17:00:00", "start_day": "monday", "start_time": "09:00:00"}], "rotation_start": "2025-02-01T00:00:00Z"}], "name": "On-Call Schedule Updated", "tags": ["tag1", "tag2", "tag3"], "time_zone": "America/New_York"}, "id": "3653d3c6-0c75-11ea-ad28-fb5701eabc7d", "relationships": {"teams": {"data": [{"id": "00000000-da3a-0000-0000-000000000000", "type": "teams"}]}}, "type": "schedules"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/bugle + Scenario: Update on-call schedule returns "Not Found" response + Given new "UpdateOnCallSchedule" request + And request contains "schedule_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"layers": [{"effective_date": "2025-02-03T05:00:00Z", "end_date": "2025-12-31T00:00:00Z", "interval": {"seconds": 300}, "members": [{"user": {"id": "00000000-aba1-0000-0000-000000000000"}}], "name": "Layer 1", "restrictions": [{"end_day": "friday", "end_time": "17:00:00", "start_day": "monday", "start_time": "09:00:00"}], "rotation_start": "2025-02-01T00:00:00Z"}], "name": "On-Call Schedule Updated", "tags": ["tag1", "tag2", "tag3"], "time_zone": "America/New_York"}, "id": "3653d3c6-0c75-11ea-ad28-fb5701eabc7d", "relationships": {"teams": {"data": [{"id": "00000000-da3a-0000-0000-000000000000", "type": "teams"}]}}, "type": "schedules"}} + When the request is sent + Then the response status is 404 Not Found + + @skip-python @team:DataDog/bugle + Scenario: Update on-call schedule returns "OK" response + Given new "UpdateOnCallSchedule" request + And there is a valid "schedule" in the system + And there is a valid "team" in the system + And there is a valid "user" in the system + And request contains "schedule_id" parameter from "schedule.data.id" + And body with value {"data": { "id": "{{ schedule.data.id }}", "attributes": {"layers": [{"id": "{{ schedule.data.relationships.layers.data[0].id }}" , "effective_date": "{{ timeISO('now - 10d') }}", "end_date": "{{ timeISO('now + 10d') }}", "interval": {"seconds": 300}, "members": [{"user": {"id": "{{user.data.id}}"}}], "name": "Layer 1", "restrictions": [{"end_day": "friday", "end_time": "17:00:00", "start_day": "monday", "start_time": "09:00:00"}], "rotation_start": "{{ timeISO('now - 5d') }}"}], "name": "{{ unique }}", "tags": ["tag1", "tag2", "tag3"], "time_zone": "America/New_York"}, "relationships": {"teams": {"data": [{"id": "{{team.data.id}}", "type": "teams"}]}}, "type": "schedules"}} + When the request is sent + Then the response status is 200 OK diff --git a/features/v2/undo.json b/features/v2/undo.json index 72669c55babe..333884a2f322 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -1750,6 +1750,37 @@ "type": "safe" } }, + "CreateOnCallSchedule": { + "tag": "On-Call", + "undo": { + "operationId": "DeleteOnCallSchedule", + "parameters": [ + { + "name": "schedule_id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "DeleteOnCallSchedule": { + "tag": "On-Call", + "undo": { + "type": "idempotent" + } + }, + "GetOnCallSchedule": { + "tag": "On-Call", + "undo": { + "type": "safe" + } + }, + "UpdateOnCallSchedule": { + "tag": "On-Call", + "undo": { + "type": "idempotent" + } + }, "ListOrgConfigs": { "tag": "Organizations", "undo": { diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index f4eebc318605..187804fe93db 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -1962,6 +1962,17 @@ def overrides "v2.jsonapi_error_item" => "JSONAPIErrorItem", "v2.jsonapi_error_item_source" => "JSONAPIErrorItemSource", "v2.jsonapi_error_response" => "JSONAPIErrorResponse", + "v2.layer" => "Layer", + "v2.layer_attributes" => "LayerAttributes", + "v2.layer_attributes_interval" => "LayerAttributesInterval", + "v2.layer_attributes_restrictions_items" => "LayerAttributesRestrictionsItems", + "v2.layer_attributes_restrictions_items_end_day" => "LayerAttributesRestrictionsItemsEndDay", + "v2.layer_attributes_restrictions_items_start_day" => "LayerAttributesRestrictionsItemsStartDay", + "v2.layer_relationships" => "LayerRelationships", + "v2.layer_relationships_members" => "LayerRelationshipsMembers", + "v2.layer_relationships_members_data_items" => "LayerRelationshipsMembersDataItems", + "v2.layer_relationships_members_data_items_type" => "LayerRelationshipsMembersDataItemsType", + "v2.layer_type" => "LayerType", "v2.leaked_key" => "LeakedKey", "v2.leaked_key_attributes" => "LeakedKeyAttributes", "v2.leaked_key_type" => "LeakedKeyType", @@ -2596,8 +2607,59 @@ def overrides "v2.scalar_meta" => "ScalarMeta", "v2.scalar_query" => "ScalarQuery", "v2.scalar_response" => "ScalarResponse", + "v2.schedule" => "Schedule", + "v2.schedule_create_request" => "ScheduleCreateRequest", + "v2.schedule_create_request_data" => "ScheduleCreateRequestData", + "v2.schedule_create_request_data_attributes" => "ScheduleCreateRequestDataAttributes", + "v2.schedule_create_request_data_attributes_layers_items" => "ScheduleCreateRequestDataAttributesLayersItems", + "v2.schedule_create_request_data_attributes_layers_items_interval" => "ScheduleCreateRequestDataAttributesLayersItemsInterval", + "v2.schedule_create_request_data_attributes_layers_items_members_items" => "ScheduleCreateRequestDataAttributesLayersItemsMembersItems", + "v2.schedule_create_request_data_attributes_layers_items_members_items_user" => "ScheduleCreateRequestDataAttributesLayersItemsMembersItemsUser", + "v2.schedule_create_request_data_attributes_layers_items_restrictions_items" => "ScheduleCreateRequestDataAttributesLayersItemsRestrictionsItems", + "v2.schedule_create_request_data_attributes_layers_items_restrictions_items_end_day" => "ScheduleCreateRequestDataAttributesLayersItemsRestrictionsItemsEndDay", + "v2.schedule_create_request_data_attributes_layers_items_restrictions_items_start_day" => "ScheduleCreateRequestDataAttributesLayersItemsRestrictionsItemsStartDay", + "v2.schedule_create_request_data_relationships" => "ScheduleCreateRequestDataRelationships", + "v2.schedule_create_request_data_relationships_teams" => "ScheduleCreateRequestDataRelationshipsTeams", + "v2.schedule_create_request_data_relationships_teams_data_items" => "ScheduleCreateRequestDataRelationshipsTeamsDataItems", + "v2.schedule_create_request_data_relationships_teams_data_items_type" => "ScheduleCreateRequestDataRelationshipsTeamsDataItemsType", + "v2.schedule_create_request_data_type" => "ScheduleCreateRequestDataType", + "v2.schedule_data" => "ScheduleData", + "v2.schedule_data_attributes" => "ScheduleDataAttributes", + "v2.schedule_data_included_item" => "ScheduleDataIncludedItem", + "v2.schedule_data_relationships" => "ScheduleDataRelationships", + "v2.schedule_data_relationships_layers" => "ScheduleDataRelationshipsLayers", + "v2.schedule_data_relationships_layers_data_items" => "ScheduleDataRelationshipsLayersDataItems", + "v2.schedule_data_relationships_layers_data_items_type" => "ScheduleDataRelationshipsLayersDataItemsType", + "v2.schedule_data_relationships_teams" => "ScheduleDataRelationshipsTeams", + "v2.schedule_data_relationships_teams_data_items" => "ScheduleDataRelationshipsTeamsDataItems", + "v2.schedule_data_relationships_teams_data_items_type" => "ScheduleDataRelationshipsTeamsDataItemsType", + "v2.schedule_data_type" => "ScheduleDataType", + "v2.schedule_member" => "ScheduleMember", + "v2.schedule_member_relationships" => "ScheduleMemberRelationships", + "v2.schedule_member_relationships_user" => "ScheduleMemberRelationshipsUser", + "v2.schedule_member_relationships_user_data" => "ScheduleMemberRelationshipsUserData", + "v2.schedule_member_relationships_user_data_type" => "ScheduleMemberRelationshipsUserDataType", + "v2.schedule_member_type" => "ScheduleMemberType", "v2.schedule_trigger" => "ScheduleTrigger", "v2.schedule_trigger_wrapper" => "ScheduleTriggerWrapper", + "v2.schedule_update_request" => "ScheduleUpdateRequest", + "v2.schedule_update_request_data" => "ScheduleUpdateRequestData", + "v2.schedule_update_request_data_attributes" => "ScheduleUpdateRequestDataAttributes", + "v2.schedule_update_request_data_attributes_layers_items" => "ScheduleUpdateRequestDataAttributesLayersItems", + "v2.schedule_update_request_data_attributes_layers_items_interval" => "ScheduleUpdateRequestDataAttributesLayersItemsInterval", + "v2.schedule_update_request_data_attributes_layers_items_members_items" => "ScheduleUpdateRequestDataAttributesLayersItemsMembersItems", + "v2.schedule_update_request_data_attributes_layers_items_members_items_user" => "ScheduleUpdateRequestDataAttributesLayersItemsMembersItemsUser", + "v2.schedule_update_request_data_attributes_layers_items_restrictions_items" => "ScheduleUpdateRequestDataAttributesLayersItemsRestrictionsItems", + "v2.schedule_update_request_data_attributes_layers_items_restrictions_items_end_day" => "ScheduleUpdateRequestDataAttributesLayersItemsRestrictionsItemsEndDay", + "v2.schedule_update_request_data_attributes_layers_items_restrictions_items_start_day" => "ScheduleUpdateRequestDataAttributesLayersItemsRestrictionsItemsStartDay", + "v2.schedule_update_request_data_relationships" => "ScheduleUpdateRequestDataRelationships", + "v2.schedule_update_request_data_relationships_teams" => "ScheduleUpdateRequestDataRelationshipsTeams", + "v2.schedule_update_request_data_relationships_teams_data_items" => "ScheduleUpdateRequestDataRelationshipsTeamsDataItems", + "v2.schedule_update_request_data_relationships_teams_data_items_type" => "ScheduleUpdateRequestDataRelationshipsTeamsDataItemsType", + "v2.schedule_update_request_data_type" => "ScheduleUpdateRequestDataType", + "v2.schedule_user" => "ScheduleUser", + "v2.schedule_user_attributes" => "ScheduleUserAttributes", + "v2.schedule_user_type" => "ScheduleUserType", "v2.scorecard_type" => "ScorecardType", "v2.security_filter" => "SecurityFilter", "v2.security_filter_attributes" => "SecurityFilterAttributes", @@ -2940,6 +3002,13 @@ def overrides "v2.team_permission_setting_update_attributes" => "TeamPermissionSettingUpdateAttributes", "v2.team_permission_setting_update_request" => "TeamPermissionSettingUpdateRequest", "v2.team_permission_setting_value" => "TeamPermissionSettingValue", + "v2.team_reference" => "TeamReference", + "v2.team_reference_attributes" => "TeamReferenceAttributes", + "v2.team_reference_relationships" => "TeamReferenceRelationships", + "v2.team_reference_relationships_oncall_users" => "TeamReferenceRelationshipsOncallUsers", + "v2.team_reference_relationships_oncall_users_data_items" => "TeamReferenceRelationshipsOncallUsersDataItems", + "v2.team_reference_relationships_oncall_users_data_items_type" => "TeamReferenceRelationshipsOncallUsersDataItemsType", + "v2.team_reference_type" => "TeamReferenceType", "v2.team_relationships" => "TeamRelationships", "v2.team_relationships_links" => "TeamRelationshipsLinks", "v2.team_response" => "TeamResponse", @@ -3158,6 +3227,7 @@ def overrides "v2.network_device_monitoring_api" => "NetworkDeviceMonitoringAPI", "v2.observability_pipelines_api" => "ObservabilityPipelinesAPI", "v2.okta_integration_api" => "OktaIntegrationAPI", + "v2.on_call_api" => "OnCallAPI", "v2.opsgenie_integration_api" => "OpsgenieIntegrationAPI", "v2.organizations_api" => "OrganizationsAPI", "v2.powerpack_api" => "PowerpackAPI", diff --git a/lib/datadog_api_client/v2/api/on_call_api.rb b/lib/datadog_api_client/v2/api/on_call_api.rb new file mode 100644 index 000000000000..9536715e92d6 --- /dev/null +++ b/lib/datadog_api_client/v2/api/on_call_api.rb @@ -0,0 +1,301 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'cgi' + +module DatadogAPIClient::V2 + class OnCallAPI + attr_accessor :api_client + + def initialize(api_client = DatadogAPIClient::APIClient.default) + @api_client = api_client + end + + # Create on-call schedule. + # + # @see #create_on_call_schedule_with_http_info + def create_on_call_schedule(body, opts = {}) + data, _status_code, _headers = create_on_call_schedule_with_http_info(body, opts) + data + end + + # Create on-call schedule. + # + # Create a new on-call schedule + # + # @param body [ScheduleCreateRequest] + # @param opts [Hash] the optional parameters + # @option opts [String] :include Comma-separated list of included relationships to be returned. Allowed values: `teams`, `layers`, `layers.members`, `layers.members.user`. + # @return [Array<(Schedule, Integer, Hash)>] Schedule data, response status code and response headers + def create_on_call_schedule_with_http_info(body, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: OnCallAPI.create_on_call_schedule ...' + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling OnCallAPI.create_on_call_schedule" + end + # resource path + local_var_path = '/api/v2/on-call/schedules' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'include'] = opts[:'include'] if !opts[:'include'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'Schedule' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :create_on_call_schedule, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: OnCallAPI#create_on_call_schedule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Delete on-call schedule. + # + # @see #delete_on_call_schedule_with_http_info + def delete_on_call_schedule(schedule_id, opts = {}) + delete_on_call_schedule_with_http_info(schedule_id, opts) + nil + end + + # Delete on-call schedule. + # + # Delete an on-call schedule + # + # @param schedule_id [String] The ID of the schedule + # @param opts [Hash] the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def delete_on_call_schedule_with_http_info(schedule_id, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: OnCallAPI.delete_on_call_schedule ...' + end + # verify the required parameter 'schedule_id' is set + if @api_client.config.client_side_validation && schedule_id.nil? + fail ArgumentError, "Missing the required parameter 'schedule_id' when calling OnCallAPI.delete_on_call_schedule" + end + # resource path + local_var_path = '/api/v2/on-call/schedules/{schedule_id}'.sub('{schedule_id}', CGI.escape(schedule_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['*/*']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :delete_on_call_schedule, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Delete, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: OnCallAPI#delete_on_call_schedule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get on-call schedule. + # + # @see #get_on_call_schedule_with_http_info + def get_on_call_schedule(schedule_id, opts = {}) + data, _status_code, _headers = get_on_call_schedule_with_http_info(schedule_id, opts) + data + end + + # Get on-call schedule. + # + # Get an on-call schedule + # + # @param schedule_id [String] The ID of the schedule + # @param opts [Hash] the optional parameters + # @option opts [String] :include Comma-separated list of included relationships to be returned. Allowed values: `teams`, `layers`, `layers.members`, `layers.members.user`. + # @return [Array<(Schedule, Integer, Hash)>] Schedule data, response status code and response headers + def get_on_call_schedule_with_http_info(schedule_id, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: OnCallAPI.get_on_call_schedule ...' + end + # verify the required parameter 'schedule_id' is set + if @api_client.config.client_side_validation && schedule_id.nil? + fail ArgumentError, "Missing the required parameter 'schedule_id' when calling OnCallAPI.get_on_call_schedule" + end + # resource path + local_var_path = '/api/v2/on-call/schedules/{schedule_id}'.sub('{schedule_id}', CGI.escape(schedule_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'include'] = opts[:'include'] if !opts[:'include'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'Schedule' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :get_on_call_schedule, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: OnCallAPI#get_on_call_schedule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Update on-call schedule. + # + # @see #update_on_call_schedule_with_http_info + def update_on_call_schedule(schedule_id, body, opts = {}) + data, _status_code, _headers = update_on_call_schedule_with_http_info(schedule_id, body, opts) + data + end + + # Update on-call schedule. + # + # Update a new on-call schedule + # + # @param schedule_id [String] The ID of the schedule + # @param body [ScheduleUpdateRequest] + # @param opts [Hash] the optional parameters + # @option opts [String] :include Comma-separated list of included relationships to be returned. Allowed values: `teams`, `layers`, `layers.members`, `layers.members.user`. + # @return [Array<(Schedule, Integer, Hash)>] Schedule data, response status code and response headers + def update_on_call_schedule_with_http_info(schedule_id, body, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: OnCallAPI.update_on_call_schedule ...' + end + # verify the required parameter 'schedule_id' is set + if @api_client.config.client_side_validation && schedule_id.nil? + fail ArgumentError, "Missing the required parameter 'schedule_id' when calling OnCallAPI.update_on_call_schedule" + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling OnCallAPI.update_on_call_schedule" + end + # resource path + local_var_path = '/api/v2/on-call/schedules/{schedule_id}'.sub('{schedule_id}', CGI.escape(schedule_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'include'] = opts[:'include'] if !opts[:'include'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'Schedule' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :update_on_call_schedule, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Put, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: OnCallAPI#update_on_call_schedule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/datadog_api_client/v2/models/layer.rb b/lib/datadog_api_client/v2/models/layer.rb new file mode 100644 index 000000000000..2b593ffb9e9f --- /dev/null +++ b/lib/datadog_api_client/v2/models/layer.rb @@ -0,0 +1,135 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Encapsulates a layer resource, holding attributes like rotation details, plus relationships to the members covering that layer. + class Layer + include BaseGenericModel + + # Describes key properties of a Layer, including rotation details, name, start/end times, and any restrictions. + attr_accessor :attributes + + # A unique identifier for this layer. + attr_accessor :id + + # Holds references to objects related to the Layer entity, such as its members. + attr_accessor :relationships + + # Layers resource type. + attr_accessor :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'relationships' => :'relationships', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'LayerAttributes', + :'id' => :'String', + :'relationships' => :'LayerRelationships', + :'type' => :'LayerType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::Layer` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'relationships') + self.relationships = attributes[:'relationships'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + relationships == o.relationships && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, relationships, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/layer_attributes.rb b/lib/datadog_api_client/v2/models/layer_attributes.rb new file mode 100644 index 000000000000..9307a37ede39 --- /dev/null +++ b/lib/datadog_api_client/v2/models/layer_attributes.rb @@ -0,0 +1,157 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Describes key properties of a Layer, including rotation details, name, start/end times, and any restrictions. + class LayerAttributes + include BaseGenericModel + + # When the layer becomes active (ISO 8601). + attr_accessor :effective_date + + # When the layer ceases to be active (ISO 8601). + attr_accessor :end_date + + # Defines how often the rotation repeats, using a combination of days and optional seconds. + attr_accessor :interval + + # The name of this layer. + attr_accessor :name + + # An optional list of time restrictions for when this layer is in effect. + attr_accessor :restrictions + + # The date/time when the rotation starts (ISO 8601). + attr_accessor :rotation_start + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'effective_date' => :'effective_date', + :'end_date' => :'end_date', + :'interval' => :'interval', + :'name' => :'name', + :'restrictions' => :'restrictions', + :'rotation_start' => :'rotation_start' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'effective_date' => :'Time', + :'end_date' => :'Time', + :'interval' => :'LayerAttributesInterval', + :'name' => :'String', + :'restrictions' => :'Array', + :'rotation_start' => :'Time' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::LayerAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'effective_date') + self.effective_date = attributes[:'effective_date'] + end + + if attributes.key?(:'end_date') + self.end_date = attributes[:'end_date'] + end + + if attributes.key?(:'interval') + self.interval = attributes[:'interval'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'restrictions') + if (value = attributes[:'restrictions']).is_a?(Array) + self.restrictions = value + end + end + + if attributes.key?(:'rotation_start') + self.rotation_start = attributes[:'rotation_start'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + effective_date == o.effective_date && + end_date == o.end_date && + interval == o.interval && + name == o.name && + restrictions == o.restrictions && + rotation_start == o.rotation_start && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [effective_date, end_date, interval, name, restrictions, rotation_start, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/layer_attributes_interval.rb b/lib/datadog_api_client/v2/models/layer_attributes_interval.rb new file mode 100644 index 000000000000..bdac64d6f13d --- /dev/null +++ b/lib/datadog_api_client/v2/models/layer_attributes_interval.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Defines how often the rotation repeats, using a combination of days and optional seconds. + class LayerAttributesInterval + include BaseGenericModel + + # The number of days in each rotation cycle. + attr_reader :days + + # Any additional seconds for the rotation cycle (up to 30 days). + attr_reader :seconds + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'days' => :'days', + :'seconds' => :'seconds' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'days' => :'Integer', + :'seconds' => :'Integer' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::LayerAttributesInterval` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'days') + self.days = attributes[:'days'] + end + + if attributes.key?(:'seconds') + self.seconds = attributes[:'seconds'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if !@days.nil? && @days > 400 + return false if !@seconds.nil? && @seconds > 2592000 + true + end + + # Custom attribute writer method with validation + # @param days [Object] Object to be assigned + # @!visibility private + def days=(days) + if !days.nil? && days > 400 + fail ArgumentError, 'invalid value for "days", must be smaller than or equal to 400.' + end + @days = days + end + + # Custom attribute writer method with validation + # @param seconds [Object] Object to be assigned + # @!visibility private + def seconds=(seconds) + if !seconds.nil? && seconds > 2592000 + fail ArgumentError, 'invalid value for "seconds", must be smaller than or equal to 2592000.' + end + @seconds = seconds + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + days == o.days && + seconds == o.seconds && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [days, seconds, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/layer_attributes_restrictions_items.rb b/lib/datadog_api_client/v2/models/layer_attributes_restrictions_items.rb new file mode 100644 index 000000000000..73eaec3f6f6c --- /dev/null +++ b/lib/datadog_api_client/v2/models/layer_attributes_restrictions_items.rb @@ -0,0 +1,136 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Represents a time restriction within a layer, specifying the days and times + # when this layer is active or inactive. + class LayerAttributesRestrictionsItems + include BaseGenericModel + + # Defines the end day of the restriction within a Layer. + attr_accessor :end_day + + # The time of day the restriction ends (hh:mm:ss). + attr_accessor :end_time + + # Defines the start day of the restriction within a Layer. + attr_accessor :start_day + + # The time of day the restriction begins (hh:mm:ss). + attr_accessor :start_time + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'end_day' => :'end_day', + :'end_time' => :'end_time', + :'start_day' => :'start_day', + :'start_time' => :'start_time' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'end_day' => :'LayerAttributesRestrictionsItemsEndDay', + :'end_time' => :'String', + :'start_day' => :'LayerAttributesRestrictionsItemsStartDay', + :'start_time' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::LayerAttributesRestrictionsItems` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'end_day') + self.end_day = attributes[:'end_day'] + end + + if attributes.key?(:'end_time') + self.end_time = attributes[:'end_time'] + end + + if attributes.key?(:'start_day') + self.start_day = attributes[:'start_day'] + end + + if attributes.key?(:'start_time') + self.start_time = attributes[:'start_time'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + end_day == o.end_day && + end_time == o.end_time && + start_day == o.start_day && + start_time == o.start_time && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [end_day, end_time, start_day, start_time, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/layer_attributes_restrictions_items_end_day.rb b/lib/datadog_api_client/v2/models/layer_attributes_restrictions_items_end_day.rb new file mode 100644 index 000000000000..fe45b9877126 --- /dev/null +++ b/lib/datadog_api_client/v2/models/layer_attributes_restrictions_items_end_day.rb @@ -0,0 +1,32 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Defines the end day of the restriction within a Layer. + class LayerAttributesRestrictionsItemsEndDay + include BaseEnumModel + + MONDAY = "monday".freeze + TUESDAY = "tuesday".freeze + WEDNESDAY = "wednesday".freeze + THURSDAY = "thursday".freeze + FRIDAY = "friday".freeze + SATURDAY = "saturday".freeze + SUNDAY = "sunday".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/layer_attributes_restrictions_items_start_day.rb b/lib/datadog_api_client/v2/models/layer_attributes_restrictions_items_start_day.rb new file mode 100644 index 000000000000..bc59f33a9bfa --- /dev/null +++ b/lib/datadog_api_client/v2/models/layer_attributes_restrictions_items_start_day.rb @@ -0,0 +1,32 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Defines the start day of the restriction within a Layer. + class LayerAttributesRestrictionsItemsStartDay + include BaseEnumModel + + MONDAY = "monday".freeze + TUESDAY = "tuesday".freeze + WEDNESDAY = "wednesday".freeze + THURSDAY = "thursday".freeze + FRIDAY = "friday".freeze + SATURDAY = "saturday".freeze + SUNDAY = "sunday".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/layer_relationships.rb b/lib/datadog_api_client/v2/models/layer_relationships.rb new file mode 100644 index 000000000000..5e5accf8e0e0 --- /dev/null +++ b/lib/datadog_api_client/v2/models/layer_relationships.rb @@ -0,0 +1,105 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Holds references to objects related to the Layer entity, such as its members. + class LayerRelationships + include BaseGenericModel + + # Holds an array of references to the members of a Layer, each containing member IDs. + attr_accessor :members + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'members' => :'members' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'members' => :'LayerRelationshipsMembers' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::LayerRelationships` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'members') + self.members = attributes[:'members'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + members == o.members && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [members, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/layer_relationships_members.rb b/lib/datadog_api_client/v2/models/layer_relationships_members.rb new file mode 100644 index 000000000000..1fb46fd713c0 --- /dev/null +++ b/lib/datadog_api_client/v2/models/layer_relationships_members.rb @@ -0,0 +1,107 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Holds an array of references to the members of a Layer, each containing member IDs. + class LayerRelationshipsMembers + include BaseGenericModel + + # The list of members who belong to this layer. + attr_accessor :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::LayerRelationshipsMembers` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/layer_relationships_members_data_items.rb b/lib/datadog_api_client/v2/models/layer_relationships_members_data_items.rb new file mode 100644 index 000000000000..a9389176dc20 --- /dev/null +++ b/lib/datadog_api_client/v2/models/layer_relationships_members_data_items.rb @@ -0,0 +1,116 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Represents a single member object in a layer's `members` array, referencing + # a unique Datadog user ID. + class LayerRelationshipsMembersDataItems + include BaseGenericModel + + # The unique user ID of the layer member. + attr_accessor :id + + # Members resource type. + attr_accessor :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'id' => :'String', + :'type' => :'LayerRelationshipsMembersDataItemsType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::LayerRelationshipsMembersDataItems` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/layer_relationships_members_data_items_type.rb b/lib/datadog_api_client/v2/models/layer_relationships_members_data_items_type.rb new file mode 100644 index 000000000000..dcf108ba3429 --- /dev/null +++ b/lib/datadog_api_client/v2/models/layer_relationships_members_data_items_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Members resource type. + class LayerRelationshipsMembersDataItemsType + include BaseEnumModel + + MEMBERS = "members".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/layer_type.rb b/lib/datadog_api_client/v2/models/layer_type.rb new file mode 100644 index 000000000000..b621f5ab96fb --- /dev/null +++ b/lib/datadog_api_client/v2/models/layer_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Layers resource type. + class LayerType + include BaseEnumModel + + LAYERS = "layers".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/schedule.rb b/lib/datadog_api_client/v2/models/schedule.rb new file mode 100644 index 000000000000..134bd24d830f --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule.rb @@ -0,0 +1,117 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Top-level container for a schedule object, including both the `data` payload and any related `included` resources (such as teams, layers, or members). + class Schedule + include BaseGenericModel + + # Represents the primary data object for a schedule, linking attributes and relationships. + attr_accessor :data + + # Any additional resources related to this schedule, such as teams and layers. + attr_accessor :included + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data', + :'included' => :'included' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'ScheduleData', + :'included' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::Schedule` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + + if attributes.key?(:'included') + if (value = attributes[:'included']).is_a?(Array) + self.included = value + end + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + included == o.included && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, included, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/schedule_create_request.rb b/lib/datadog_api_client/v2/models/schedule_create_request.rb new file mode 100644 index 000000000000..c20dc4673f78 --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule_create_request.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The top-level request body for schedule creation, wrapping a `data` object. + class ScheduleCreateRequest + include BaseGenericModel + + # The core data wrapper for creating a schedule, encompassing attributes, relationships, and the resource type. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'ScheduleCreateRequestData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ScheduleCreateRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/schedule_create_request_data.rb b/lib/datadog_api_client/v2/models/schedule_create_request_data.rb new file mode 100644 index 000000000000..5f496738c742 --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule_create_request_data.rb @@ -0,0 +1,154 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The core data wrapper for creating a schedule, encompassing attributes, relationships, and the resource type. + class ScheduleCreateRequestData + include BaseGenericModel + + # Describes the main attributes for creating a new schedule, including name, layers, time zone, and tags. + attr_reader :attributes + + # Gathers relationship objects for the schedule creation request, including the teams to associate. + attr_accessor :relationships + + # Schedules resource type. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'relationships' => :'relationships', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'ScheduleCreateRequestDataAttributes', + :'relationships' => :'ScheduleCreateRequestDataRelationships', + :'type' => :'ScheduleCreateRequestDataType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ScheduleCreateRequestData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'relationships') + self.relationships = attributes[:'relationships'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + relationships == o.relationships && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, relationships, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/schedule_create_request_data_attributes.rb b/lib/datadog_api_client/v2/models/schedule_create_request_data_attributes.rb new file mode 100644 index 000000000000..1dbb8bc7ca99 --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule_create_request_data_attributes.rb @@ -0,0 +1,179 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Describes the main attributes for creating a new schedule, including name, layers, time zone, and tags. + class ScheduleCreateRequestDataAttributes + include BaseGenericModel + + # The layers of on-call coverage that define rotation intervals and restrictions. + attr_reader :layers + + # A human-readable name for the new schedule. + attr_reader :name + + # A list of tags for categorizing or filtering the schedule. + attr_accessor :tags + + # The time zone in which the schedule is defined. + attr_reader :time_zone + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'layers' => :'layers', + :'name' => :'name', + :'tags' => :'tags', + :'time_zone' => :'time_zone' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'layers' => :'Array', + :'name' => :'String', + :'tags' => :'Array', + :'time_zone' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ScheduleCreateRequestDataAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'layers') + if (value = attributes[:'layers']).is_a?(Array) + self.layers = value + end + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'tags') + if (value = attributes[:'tags']).is_a?(Array) + self.tags = value + end + end + + if attributes.key?(:'time_zone') + self.time_zone = attributes[:'time_zone'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @layers.nil? + return false if @name.nil? + return false if @time_zone.nil? + true + end + + # Custom attribute writer method with validation + # @param layers [Object] Object to be assigned + # @!visibility private + def layers=(layers) + if layers.nil? + fail ArgumentError, 'invalid value for "layers", layers cannot be nil.' + end + @layers = layers + end + + # Custom attribute writer method with validation + # @param name [Object] Object to be assigned + # @!visibility private + def name=(name) + if name.nil? + fail ArgumentError, 'invalid value for "name", name cannot be nil.' + end + @name = name + end + + # Custom attribute writer method with validation + # @param time_zone [Object] Object to be assigned + # @!visibility private + def time_zone=(time_zone) + if time_zone.nil? + fail ArgumentError, 'invalid value for "time_zone", time_zone cannot be nil.' + end + @time_zone = time_zone + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + layers == o.layers && + name == o.name && + tags == o.tags && + time_zone == o.time_zone && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [layers, name, tags, time_zone, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/schedule_create_request_data_attributes_layers_items.rb b/lib/datadog_api_client/v2/models/schedule_create_request_data_attributes_layers_items.rb new file mode 100644 index 000000000000..82812ba1fe7f --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule_create_request_data_attributes_layers_items.rb @@ -0,0 +1,231 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Describes a schedule layer, including rotation intervals, members, restrictions, and timeline settings. + class ScheduleCreateRequestDataAttributesLayersItems + include BaseGenericModel + + # The date/time when this layer becomes active (in ISO 8601). + attr_reader :effective_date + + # The date/time after which this layer no longer applies (in ISO 8601). + attr_accessor :end_date + + # Defines how frequently the rotation repeats, using days and/or seconds (up to certain limits). + attr_reader :interval + + # A list of members who participate in this layer's rotation. + attr_reader :members + + # The name of this layer. + attr_reader :name + + # Zero or more time-based restrictions (for example, only weekdays, during business hours). + attr_accessor :restrictions + + # The date/time when the rotation for this layer starts (in ISO 8601). + attr_reader :rotation_start + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'effective_date' => :'effective_date', + :'end_date' => :'end_date', + :'interval' => :'interval', + :'members' => :'members', + :'name' => :'name', + :'restrictions' => :'restrictions', + :'rotation_start' => :'rotation_start' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'effective_date' => :'Time', + :'end_date' => :'Time', + :'interval' => :'ScheduleCreateRequestDataAttributesLayersItemsInterval', + :'members' => :'Array', + :'name' => :'String', + :'restrictions' => :'Array', + :'rotation_start' => :'Time' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ScheduleCreateRequestDataAttributesLayersItems` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'effective_date') + self.effective_date = attributes[:'effective_date'] + end + + if attributes.key?(:'end_date') + self.end_date = attributes[:'end_date'] + end + + if attributes.key?(:'interval') + self.interval = attributes[:'interval'] + end + + if attributes.key?(:'members') + if (value = attributes[:'members']).is_a?(Array) + self.members = value + end + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'restrictions') + if (value = attributes[:'restrictions']).is_a?(Array) + self.restrictions = value + end + end + + if attributes.key?(:'rotation_start') + self.rotation_start = attributes[:'rotation_start'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @effective_date.nil? + return false if @interval.nil? + return false if @members.nil? + return false if @name.nil? + return false if @rotation_start.nil? + true + end + + # Custom attribute writer method with validation + # @param effective_date [Object] Object to be assigned + # @!visibility private + def effective_date=(effective_date) + if effective_date.nil? + fail ArgumentError, 'invalid value for "effective_date", effective_date cannot be nil.' + end + @effective_date = effective_date + end + + # Custom attribute writer method with validation + # @param interval [Object] Object to be assigned + # @!visibility private + def interval=(interval) + if interval.nil? + fail ArgumentError, 'invalid value for "interval", interval cannot be nil.' + end + @interval = interval + end + + # Custom attribute writer method with validation + # @param members [Object] Object to be assigned + # @!visibility private + def members=(members) + if members.nil? + fail ArgumentError, 'invalid value for "members", members cannot be nil.' + end + @members = members + end + + # Custom attribute writer method with validation + # @param name [Object] Object to be assigned + # @!visibility private + def name=(name) + if name.nil? + fail ArgumentError, 'invalid value for "name", name cannot be nil.' + end + @name = name + end + + # Custom attribute writer method with validation + # @param rotation_start [Object] Object to be assigned + # @!visibility private + def rotation_start=(rotation_start) + if rotation_start.nil? + fail ArgumentError, 'invalid value for "rotation_start", rotation_start cannot be nil.' + end + @rotation_start = rotation_start + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + effective_date == o.effective_date && + end_date == o.end_date && + interval == o.interval && + members == o.members && + name == o.name && + restrictions == o.restrictions && + rotation_start == o.rotation_start && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [effective_date, end_date, interval, members, name, restrictions, rotation_start, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/schedule_create_request_data_attributes_layers_items_interval.rb b/lib/datadog_api_client/v2/models/schedule_create_request_data_attributes_layers_items_interval.rb new file mode 100644 index 000000000000..d4ecaa63945b --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule_create_request_data_attributes_layers_items_interval.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Defines how frequently the rotation repeats, using days and/or seconds (up to certain limits). + class ScheduleCreateRequestDataAttributesLayersItemsInterval + include BaseGenericModel + + # The number of full days in each rotation period. + attr_reader :days + + # Extra seconds that may be added to extend the rotation beyond whole days. + attr_reader :seconds + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'days' => :'days', + :'seconds' => :'seconds' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'days' => :'Integer', + :'seconds' => :'Integer' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ScheduleCreateRequestDataAttributesLayersItemsInterval` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'days') + self.days = attributes[:'days'] + end + + if attributes.key?(:'seconds') + self.seconds = attributes[:'seconds'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if !@days.nil? && @days > 400 + return false if !@seconds.nil? && @seconds > 2592000 + true + end + + # Custom attribute writer method with validation + # @param days [Object] Object to be assigned + # @!visibility private + def days=(days) + if !days.nil? && days > 400 + fail ArgumentError, 'invalid value for "days", must be smaller than or equal to 400.' + end + @days = days + end + + # Custom attribute writer method with validation + # @param seconds [Object] Object to be assigned + # @!visibility private + def seconds=(seconds) + if !seconds.nil? && seconds > 2592000 + fail ArgumentError, 'invalid value for "seconds", must be smaller than or equal to 2592000.' + end + @seconds = seconds + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + days == o.days && + seconds == o.seconds && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [days, seconds, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/schedule_create_request_data_attributes_layers_items_members_items.rb b/lib/datadog_api_client/v2/models/schedule_create_request_data_attributes_layers_items_members_items.rb new file mode 100644 index 000000000000..503df92e34c0 --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule_create_request_data_attributes_layers_items_members_items.rb @@ -0,0 +1,105 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Defines a single member within a schedule layer, including the reference to the underlying user. + class ScheduleCreateRequestDataAttributesLayersItemsMembersItems + include BaseGenericModel + + # Identifies the user participating in this layer as a single object with an `id`. + attr_accessor :user + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'user' => :'user' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'user' => :'ScheduleCreateRequestDataAttributesLayersItemsMembersItemsUser' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ScheduleCreateRequestDataAttributesLayersItemsMembersItems` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'user') + self.user = attributes[:'user'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + user == o.user && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [user, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/schedule_create_request_data_attributes_layers_items_members_items_user.rb b/lib/datadog_api_client/v2/models/schedule_create_request_data_attributes_layers_items_members_items_user.rb new file mode 100644 index 000000000000..0cde9c44639b --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule_create_request_data_attributes_layers_items_members_items_user.rb @@ -0,0 +1,105 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Identifies the user participating in this layer as a single object with an `id`. + class ScheduleCreateRequestDataAttributesLayersItemsMembersItemsUser + include BaseGenericModel + + # The user's ID. + attr_accessor :id + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'id' => :'id' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'id' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ScheduleCreateRequestDataAttributesLayersItemsMembersItemsUser` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [id, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/schedule_create_request_data_attributes_layers_items_restrictions_items.rb b/lib/datadog_api_client/v2/models/schedule_create_request_data_attributes_layers_items_restrictions_items.rb new file mode 100644 index 000000000000..d6d152709562 --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule_create_request_data_attributes_layers_items_restrictions_items.rb @@ -0,0 +1,136 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Defines a time restriction for a schedule layer, including which day of the week + # it starts and ends, along with start/end times. + class ScheduleCreateRequestDataAttributesLayersItemsRestrictionsItems + include BaseGenericModel + + # The weekday when the restriction period ends (Monday through Sunday). + attr_accessor :end_day + + # The time of day when the restriction ends (hh:mm:ss). + attr_accessor :end_time + + # The weekday when the restriction period starts (Monday through Sunday). + attr_accessor :start_day + + # The time of day when the restriction begins (hh:mm:ss). + attr_accessor :start_time + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'end_day' => :'end_day', + :'end_time' => :'end_time', + :'start_day' => :'start_day', + :'start_time' => :'start_time' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'end_day' => :'ScheduleCreateRequestDataAttributesLayersItemsRestrictionsItemsEndDay', + :'end_time' => :'String', + :'start_day' => :'ScheduleCreateRequestDataAttributesLayersItemsRestrictionsItemsStartDay', + :'start_time' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ScheduleCreateRequestDataAttributesLayersItemsRestrictionsItems` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'end_day') + self.end_day = attributes[:'end_day'] + end + + if attributes.key?(:'end_time') + self.end_time = attributes[:'end_time'] + end + + if attributes.key?(:'start_day') + self.start_day = attributes[:'start_day'] + end + + if attributes.key?(:'start_time') + self.start_time = attributes[:'start_time'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + end_day == o.end_day && + end_time == o.end_time && + start_day == o.start_day && + start_time == o.start_time && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [end_day, end_time, start_day, start_time, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/schedule_create_request_data_attributes_layers_items_restrictions_items_end_day.rb b/lib/datadog_api_client/v2/models/schedule_create_request_data_attributes_layers_items_restrictions_items_end_day.rb new file mode 100644 index 000000000000..fad02adac7fa --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule_create_request_data_attributes_layers_items_restrictions_items_end_day.rb @@ -0,0 +1,32 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The weekday when the restriction period ends (Monday through Sunday). + class ScheduleCreateRequestDataAttributesLayersItemsRestrictionsItemsEndDay + include BaseEnumModel + + MONDAY = "monday".freeze + TUESDAY = "tuesday".freeze + WEDNESDAY = "wednesday".freeze + THURSDAY = "thursday".freeze + FRIDAY = "friday".freeze + SATURDAY = "saturday".freeze + SUNDAY = "sunday".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/schedule_create_request_data_attributes_layers_items_restrictions_items_start_day.rb b/lib/datadog_api_client/v2/models/schedule_create_request_data_attributes_layers_items_restrictions_items_start_day.rb new file mode 100644 index 000000000000..ca5f925017d4 --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule_create_request_data_attributes_layers_items_restrictions_items_start_day.rb @@ -0,0 +1,32 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The weekday when the restriction period starts (Monday through Sunday). + class ScheduleCreateRequestDataAttributesLayersItemsRestrictionsItemsStartDay + include BaseEnumModel + + MONDAY = "monday".freeze + TUESDAY = "tuesday".freeze + WEDNESDAY = "wednesday".freeze + THURSDAY = "thursday".freeze + FRIDAY = "friday".freeze + SATURDAY = "saturday".freeze + SUNDAY = "sunday".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/schedule_create_request_data_relationships.rb b/lib/datadog_api_client/v2/models/schedule_create_request_data_relationships.rb new file mode 100644 index 000000000000..f5f0613de7ae --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule_create_request_data_relationships.rb @@ -0,0 +1,105 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Gathers relationship objects for the schedule creation request, including the teams to associate. + class ScheduleCreateRequestDataRelationships + include BaseGenericModel + + # Associates the new schedule with one or more teams. + attr_accessor :teams + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'teams' => :'teams' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'teams' => :'ScheduleCreateRequestDataRelationshipsTeams' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ScheduleCreateRequestDataRelationships` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'teams') + self.teams = attributes[:'teams'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + teams == o.teams && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [teams, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/schedule_create_request_data_relationships_teams.rb b/lib/datadog_api_client/v2/models/schedule_create_request_data_relationships_teams.rb new file mode 100644 index 000000000000..694688cfd637 --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule_create_request_data_relationships_teams.rb @@ -0,0 +1,107 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Associates the new schedule with one or more teams. + class ScheduleCreateRequestDataRelationshipsTeams + include BaseGenericModel + + # An array of team references for this schedule. + attr_accessor :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ScheduleCreateRequestDataRelationshipsTeams` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/schedule_create_request_data_relationships_teams_data_items.rb b/lib/datadog_api_client/v2/models/schedule_create_request_data_relationships_teams_data_items.rb new file mode 100644 index 000000000000..460c8186cb57 --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule_create_request_data_relationships_teams_data_items.rb @@ -0,0 +1,116 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Holds the relationship data linking this schedule to a particular team, + # identified by `id` and `type`. + class ScheduleCreateRequestDataRelationshipsTeamsDataItems + include BaseGenericModel + + # A unique identifier for the team. + attr_accessor :id + + # Teams resource type. + attr_accessor :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'id' => :'String', + :'type' => :'ScheduleCreateRequestDataRelationshipsTeamsDataItemsType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ScheduleCreateRequestDataRelationshipsTeamsDataItems` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/schedule_create_request_data_relationships_teams_data_items_type.rb b/lib/datadog_api_client/v2/models/schedule_create_request_data_relationships_teams_data_items_type.rb new file mode 100644 index 000000000000..ead9157da432 --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule_create_request_data_relationships_teams_data_items_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Teams resource type. + class ScheduleCreateRequestDataRelationshipsTeamsDataItemsType + include BaseEnumModel + + TEAMS = "teams".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/schedule_create_request_data_type.rb b/lib/datadog_api_client/v2/models/schedule_create_request_data_type.rb new file mode 100644 index 000000000000..7f17c23b57ca --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule_create_request_data_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Schedules resource type. + class ScheduleCreateRequestDataType + include BaseEnumModel + + SCHEDULES = "schedules".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/schedule_data.rb b/lib/datadog_api_client/v2/models/schedule_data.rb new file mode 100644 index 000000000000..3695740aca83 --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule_data.rb @@ -0,0 +1,135 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Represents the primary data object for a schedule, linking attributes and relationships. + class ScheduleData + include BaseGenericModel + + # Provides core properties of a schedule object, such as its name, time zone, and tags. + attr_accessor :attributes + + # The schedule's unique identifier. + attr_accessor :id + + # Groups the relationships for a schedule object, referencing layers and teams. + attr_accessor :relationships + + # Schedules resource type. + attr_accessor :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'relationships' => :'relationships', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'ScheduleDataAttributes', + :'id' => :'String', + :'relationships' => :'ScheduleDataRelationships', + :'type' => :'ScheduleDataType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ScheduleData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'relationships') + self.relationships = attributes[:'relationships'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + relationships == o.relationships && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, relationships, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/schedule_data_attributes.rb b/lib/datadog_api_client/v2/models/schedule_data_attributes.rb new file mode 100644 index 000000000000..13224ffc6df8 --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule_data_attributes.rb @@ -0,0 +1,127 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Provides core properties of a schedule object, such as its name, time zone, and tags. + class ScheduleDataAttributes + include BaseGenericModel + + # A short name for the schedule. + attr_accessor :name + + # A list of tags associated with this schedule. + attr_accessor :tags + + # The time zone in which this schedule operates. + attr_accessor :time_zone + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'name' => :'name', + :'tags' => :'tags', + :'time_zone' => :'time_zone' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'name' => :'String', + :'tags' => :'Array', + :'time_zone' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ScheduleDataAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'tags') + if (value = attributes[:'tags']).is_a?(Array) + self.tags = value + end + end + + if attributes.key?(:'time_zone') + self.time_zone = attributes[:'time_zone'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + name == o.name && + tags == o.tags && + time_zone == o.time_zone && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [name, tags, time_zone, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/schedule_data_included_item.rb b/lib/datadog_api_client/v2/models/schedule_data_included_item.rb new file mode 100644 index 000000000000..543f12b343d3 --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule_data_included_item.rb @@ -0,0 +1,65 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Any additional resources related to this schedule, such as teams and layers. + module ScheduleDataIncludedItem + class << self + include BaseOneOfModel + include BaseOneOfModelNoDiscriminator + + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'TeamReference', + :'Layer', + :'ScheduleMember', + :'ScheduleUser' + ] + end + # Builds the object + # @param data [Mixed] Data to be matched against the list of oneOf items + # @return [Object] Returns the model or the data itself + def build(data) + # Go through the list of oneOf items and attempt to identify the appropriate one. + # Note: + # - We do not attempt to check whether exactly one item matches. + # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) + # due to the way the deserialization is made in the base_object template (it just casts without verifying). + # - TODO: scalar values are de facto behaving as if they were nullable. + # - TODO: logging when debugging is set. + openapi_one_of.each do |klass| + begin + next if klass == :AnyType # "nullable: true" + typed_data = find_and_cast_into_type(klass, data) + next if typed_data.respond_to?(:_unparsed) && typed_data._unparsed + return typed_data if typed_data + rescue # rescue all errors so we keep iterating even if the current item lookup raises + end + end + + if openapi_one_of.include?(:AnyType) + data + else + self._unparsed = true + DatadogAPIClient::UnparsedObject.new(data) + end + end + end + end +end diff --git a/lib/datadog_api_client/v2/models/schedule_data_relationships.rb b/lib/datadog_api_client/v2/models/schedule_data_relationships.rb new file mode 100644 index 000000000000..42b5df6eca71 --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule_data_relationships.rb @@ -0,0 +1,115 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Groups the relationships for a schedule object, referencing layers and teams. + class ScheduleDataRelationships + include BaseGenericModel + + # Associates layers with this schedule in a data structure. + attr_accessor :layers + + # Associates teams with this schedule in a data structure. + attr_accessor :teams + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'layers' => :'layers', + :'teams' => :'teams' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'layers' => :'ScheduleDataRelationshipsLayers', + :'teams' => :'ScheduleDataRelationshipsTeams' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ScheduleDataRelationships` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'layers') + self.layers = attributes[:'layers'] + end + + if attributes.key?(:'teams') + self.teams = attributes[:'teams'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + layers == o.layers && + teams == o.teams && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [layers, teams, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/schedule_data_relationships_layers.rb b/lib/datadog_api_client/v2/models/schedule_data_relationships_layers.rb new file mode 100644 index 000000000000..36d24f7707d1 --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule_data_relationships_layers.rb @@ -0,0 +1,107 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Associates layers with this schedule in a data structure. + class ScheduleDataRelationshipsLayers + include BaseGenericModel + + # An array of layer references for this schedule. + attr_accessor :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ScheduleDataRelationshipsLayers` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/schedule_data_relationships_layers_data_items.rb b/lib/datadog_api_client/v2/models/schedule_data_relationships_layers_data_items.rb new file mode 100644 index 000000000000..3e53f82943a6 --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule_data_relationships_layers_data_items.rb @@ -0,0 +1,115 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Relates a layer to this schedule, identified by `id` and `type` (must be `layers`). + class ScheduleDataRelationshipsLayersDataItems + include BaseGenericModel + + # The unique identifier of the layer in this relationship. + attr_accessor :id + + # Layers resource type. + attr_accessor :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'id' => :'String', + :'type' => :'ScheduleDataRelationshipsLayersDataItemsType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ScheduleDataRelationshipsLayersDataItems` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/schedule_data_relationships_layers_data_items_type.rb b/lib/datadog_api_client/v2/models/schedule_data_relationships_layers_data_items_type.rb new file mode 100644 index 000000000000..f50398f4c2c7 --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule_data_relationships_layers_data_items_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Layers resource type. + class ScheduleDataRelationshipsLayersDataItemsType + include BaseEnumModel + + LAYERS = "layers".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/schedule_data_relationships_teams.rb b/lib/datadog_api_client/v2/models/schedule_data_relationships_teams.rb new file mode 100644 index 000000000000..0af02e7c22ed --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule_data_relationships_teams.rb @@ -0,0 +1,107 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Associates teams with this schedule in a data structure. + class ScheduleDataRelationshipsTeams + include BaseGenericModel + + # An array of team references for this schedule. + attr_accessor :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ScheduleDataRelationshipsTeams` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/schedule_data_relationships_teams_data_items.rb b/lib/datadog_api_client/v2/models/schedule_data_relationships_teams_data_items.rb new file mode 100644 index 000000000000..53234234f510 --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule_data_relationships_teams_data_items.rb @@ -0,0 +1,115 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Relates a team to this schedule, identified by `id` and `type` (must be `teams`). + class ScheduleDataRelationshipsTeamsDataItems + include BaseGenericModel + + # The unique identifier of the team in this relationship. + attr_accessor :id + + # Teams resource type. + attr_accessor :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'id' => :'String', + :'type' => :'ScheduleDataRelationshipsTeamsDataItemsType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ScheduleDataRelationshipsTeamsDataItems` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/schedule_data_relationships_teams_data_items_type.rb b/lib/datadog_api_client/v2/models/schedule_data_relationships_teams_data_items_type.rb new file mode 100644 index 000000000000..285ea7def642 --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule_data_relationships_teams_data_items_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Teams resource type. + class ScheduleDataRelationshipsTeamsDataItemsType + include BaseEnumModel + + TEAMS = "teams".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/schedule_data_type.rb b/lib/datadog_api_client/v2/models/schedule_data_type.rb new file mode 100644 index 000000000000..7738112b8f7a --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule_data_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Schedules resource type. + class ScheduleDataType + include BaseEnumModel + + SCHEDULES = "schedules".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/schedule_member.rb b/lib/datadog_api_client/v2/models/schedule_member.rb new file mode 100644 index 000000000000..30170eb55942 --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule_member.rb @@ -0,0 +1,125 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Represents a single member entry in a schedule, referencing a specific user. + class ScheduleMember + include BaseGenericModel + + # The unique identifier for this schedule member. + attr_accessor :id + + # Defines relationships for a schedule member, primarily referencing a single user. + attr_accessor :relationships + + # Schedule Members resource type. + attr_accessor :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'id' => :'id', + :'relationships' => :'relationships', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'id' => :'String', + :'relationships' => :'ScheduleMemberRelationships', + :'type' => :'ScheduleMemberType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ScheduleMember` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'relationships') + self.relationships = attributes[:'relationships'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + relationships == o.relationships && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [id, relationships, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/schedule_member_relationships.rb b/lib/datadog_api_client/v2/models/schedule_member_relationships.rb new file mode 100644 index 000000000000..979be1df93ae --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule_member_relationships.rb @@ -0,0 +1,105 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Defines relationships for a schedule member, primarily referencing a single user. + class ScheduleMemberRelationships + include BaseGenericModel + + # Wraps the user data reference for a schedule member. + attr_accessor :user + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'user' => :'user' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'user' => :'ScheduleMemberRelationshipsUser' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ScheduleMemberRelationships` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'user') + self.user = attributes[:'user'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + user == o.user && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [user, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/schedule_member_relationships_user.rb b/lib/datadog_api_client/v2/models/schedule_member_relationships_user.rb new file mode 100644 index 000000000000..a68203aed5d0 --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule_member_relationships_user.rb @@ -0,0 +1,105 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Wraps the user data reference for a schedule member. + class ScheduleMemberRelationshipsUser + include BaseGenericModel + + # Points to the user data associated with this schedule member, including an ID and type. + attr_accessor :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'ScheduleMemberRelationshipsUserData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ScheduleMemberRelationshipsUser` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/schedule_member_relationships_user_data.rb b/lib/datadog_api_client/v2/models/schedule_member_relationships_user_data.rb new file mode 100644 index 000000000000..ee184178778a --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule_member_relationships_user_data.rb @@ -0,0 +1,115 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Points to the user data associated with this schedule member, including an ID and type. + class ScheduleMemberRelationshipsUserData + include BaseGenericModel + + # The user's unique identifier. + attr_accessor :id + + # Users resource type. + attr_accessor :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'id' => :'String', + :'type' => :'ScheduleMemberRelationshipsUserDataType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ScheduleMemberRelationshipsUserData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/schedule_member_relationships_user_data_type.rb b/lib/datadog_api_client/v2/models/schedule_member_relationships_user_data_type.rb new file mode 100644 index 000000000000..939a8644cd2d --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule_member_relationships_user_data_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Users resource type. + class ScheduleMemberRelationshipsUserDataType + include BaseEnumModel + + USERS = "users".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/schedule_member_type.rb b/lib/datadog_api_client/v2/models/schedule_member_type.rb new file mode 100644 index 000000000000..fd8bd9eef1c5 --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule_member_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Schedule Members resource type. + class ScheduleMemberType + include BaseEnumModel + + MEMBERS = "members".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/schedule_update_request.rb b/lib/datadog_api_client/v2/models/schedule_update_request.rb new file mode 100644 index 000000000000..e4f04a148ec1 --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule_update_request.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A top-level wrapper for a schedule update request, referring to the `data` object with the new details. + class ScheduleUpdateRequest + include BaseGenericModel + + # Contains all data needed to update an existing schedule, including its attributes (such as name, layers, or tags) and any relationships to teams. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'ScheduleUpdateRequestData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ScheduleUpdateRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/schedule_update_request_data.rb b/lib/datadog_api_client/v2/models/schedule_update_request_data.rb new file mode 100644 index 000000000000..fb42f0f1218d --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule_update_request_data.rb @@ -0,0 +1,175 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Contains all data needed to update an existing schedule, including its attributes (such as name, layers, or tags) and any relationships to teams. + class ScheduleUpdateRequestData + include BaseGenericModel + + # Defines the updatable attributes for a schedule, such as name, time zone, tags, and layers. + attr_reader :attributes + + # The ID of the schedule to be updated. + attr_reader :id + + # Houses relationships for the schedule update, typically referencing teams. + attr_accessor :relationships + + # Schedules resource type. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'relationships' => :'relationships', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'ScheduleUpdateRequestDataAttributes', + :'id' => :'String', + :'relationships' => :'ScheduleUpdateRequestDataRelationships', + :'type' => :'ScheduleUpdateRequestDataType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ScheduleUpdateRequestData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'relationships') + self.relationships = attributes[:'relationships'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + relationships == o.relationships && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, relationships, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/schedule_update_request_data_attributes.rb b/lib/datadog_api_client/v2/models/schedule_update_request_data_attributes.rb new file mode 100644 index 000000000000..448536d10f2e --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule_update_request_data_attributes.rb @@ -0,0 +1,179 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Defines the updatable attributes for a schedule, such as name, time zone, tags, and layers. + class ScheduleUpdateRequestDataAttributes + include BaseGenericModel + + # The updated list of layers (rotations) for this schedule. + attr_reader :layers + + # A short name for the schedule. + attr_reader :name + + # A list of tags that you can associate with this schedule. + attr_accessor :tags + + # The time zone used when interpreting rotation times. + attr_reader :time_zone + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'layers' => :'layers', + :'name' => :'name', + :'tags' => :'tags', + :'time_zone' => :'time_zone' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'layers' => :'Array', + :'name' => :'String', + :'tags' => :'Array', + :'time_zone' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ScheduleUpdateRequestDataAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'layers') + if (value = attributes[:'layers']).is_a?(Array) + self.layers = value + end + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'tags') + if (value = attributes[:'tags']).is_a?(Array) + self.tags = value + end + end + + if attributes.key?(:'time_zone') + self.time_zone = attributes[:'time_zone'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @layers.nil? + return false if @name.nil? + return false if @time_zone.nil? + true + end + + # Custom attribute writer method with validation + # @param layers [Object] Object to be assigned + # @!visibility private + def layers=(layers) + if layers.nil? + fail ArgumentError, 'invalid value for "layers", layers cannot be nil.' + end + @layers = layers + end + + # Custom attribute writer method with validation + # @param name [Object] Object to be assigned + # @!visibility private + def name=(name) + if name.nil? + fail ArgumentError, 'invalid value for "name", name cannot be nil.' + end + @name = name + end + + # Custom attribute writer method with validation + # @param time_zone [Object] Object to be assigned + # @!visibility private + def time_zone=(time_zone) + if time_zone.nil? + fail ArgumentError, 'invalid value for "time_zone", time_zone cannot be nil.' + end + @time_zone = time_zone + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + layers == o.layers && + name == o.name && + tags == o.tags && + time_zone == o.time_zone && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [layers, name, tags, time_zone, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/schedule_update_request_data_attributes_layers_items.rb b/lib/datadog_api_client/v2/models/schedule_update_request_data_attributes_layers_items.rb new file mode 100644 index 000000000000..401fe50cbca0 --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule_update_request_data_attributes_layers_items.rb @@ -0,0 +1,180 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Represents a layer within a schedule update, including rotation details, members, + # and optional restrictions. + class ScheduleUpdateRequestDataAttributesLayersItems + include BaseGenericModel + + # When this updated layer takes effect (ISO 8601 format). + attr_accessor :effective_date + + # When this updated layer should stop being active (ISO 8601 format). + attr_accessor :end_date + + # A unique identifier for the layer being updated. + attr_accessor :id + + # Specifies how the rotation repeats: number of days, plus optional seconds, up to the given maximums. + attr_accessor :interval + + # The members assigned to this layer. + attr_accessor :members + + # The name for this layer (for example, “Secondary Coverage”). + attr_accessor :name + + # Any time restrictions that define when this layer is active. + attr_accessor :restrictions + + # The date/time at which the rotation begins (ISO 8601 format). + attr_accessor :rotation_start + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'effective_date' => :'effective_date', + :'end_date' => :'end_date', + :'id' => :'id', + :'interval' => :'interval', + :'members' => :'members', + :'name' => :'name', + :'restrictions' => :'restrictions', + :'rotation_start' => :'rotation_start' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'effective_date' => :'Time', + :'end_date' => :'Time', + :'id' => :'String', + :'interval' => :'ScheduleUpdateRequestDataAttributesLayersItemsInterval', + :'members' => :'Array', + :'name' => :'String', + :'restrictions' => :'Array', + :'rotation_start' => :'Time' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ScheduleUpdateRequestDataAttributesLayersItems` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'effective_date') + self.effective_date = attributes[:'effective_date'] + end + + if attributes.key?(:'end_date') + self.end_date = attributes[:'end_date'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'interval') + self.interval = attributes[:'interval'] + end + + if attributes.key?(:'members') + if (value = attributes[:'members']).is_a?(Array) + self.members = value + end + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'restrictions') + if (value = attributes[:'restrictions']).is_a?(Array) + self.restrictions = value + end + end + + if attributes.key?(:'rotation_start') + self.rotation_start = attributes[:'rotation_start'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + effective_date == o.effective_date && + end_date == o.end_date && + id == o.id && + interval == o.interval && + members == o.members && + name == o.name && + restrictions == o.restrictions && + rotation_start == o.rotation_start && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [effective_date, end_date, id, interval, members, name, restrictions, rotation_start, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/schedule_update_request_data_attributes_layers_items_interval.rb b/lib/datadog_api_client/v2/models/schedule_update_request_data_attributes_layers_items_interval.rb new file mode 100644 index 000000000000..8b370d5f746b --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule_update_request_data_attributes_layers_items_interval.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Specifies how the rotation repeats: number of days, plus optional seconds, up to the given maximums. + class ScheduleUpdateRequestDataAttributesLayersItemsInterval + include BaseGenericModel + + # How many days each rotation cycle should span. + attr_reader :days + + # Additional seconds to add to the rotation cycle (for example, partial days). + attr_reader :seconds + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'days' => :'days', + :'seconds' => :'seconds' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'days' => :'Integer', + :'seconds' => :'Integer' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ScheduleUpdateRequestDataAttributesLayersItemsInterval` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'days') + self.days = attributes[:'days'] + end + + if attributes.key?(:'seconds') + self.seconds = attributes[:'seconds'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if !@days.nil? && @days > 400 + return false if !@seconds.nil? && @seconds > 2592000 + true + end + + # Custom attribute writer method with validation + # @param days [Object] Object to be assigned + # @!visibility private + def days=(days) + if !days.nil? && days > 400 + fail ArgumentError, 'invalid value for "days", must be smaller than or equal to 400.' + end + @days = days + end + + # Custom attribute writer method with validation + # @param seconds [Object] Object to be assigned + # @!visibility private + def seconds=(seconds) + if !seconds.nil? && seconds > 2592000 + fail ArgumentError, 'invalid value for "seconds", must be smaller than or equal to 2592000.' + end + @seconds = seconds + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + days == o.days && + seconds == o.seconds && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [days, seconds, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/schedule_update_request_data_attributes_layers_items_members_items.rb b/lib/datadog_api_client/v2/models/schedule_update_request_data_attributes_layers_items_members_items.rb new file mode 100644 index 000000000000..98a535f09425 --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule_update_request_data_attributes_layers_items_members_items.rb @@ -0,0 +1,106 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Defines a single member within a layer during an update request, referring + # to a specific user. + class ScheduleUpdateRequestDataAttributesLayersItemsMembersItems + include BaseGenericModel + + # Identifies the user who is assigned to this member object. Only `id` is required. + attr_accessor :user + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'user' => :'user' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'user' => :'ScheduleUpdateRequestDataAttributesLayersItemsMembersItemsUser' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ScheduleUpdateRequestDataAttributesLayersItemsMembersItems` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'user') + self.user = attributes[:'user'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + user == o.user && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [user, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/schedule_update_request_data_attributes_layers_items_members_items_user.rb b/lib/datadog_api_client/v2/models/schedule_update_request_data_attributes_layers_items_members_items_user.rb new file mode 100644 index 000000000000..e58f7915150a --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule_update_request_data_attributes_layers_items_members_items_user.rb @@ -0,0 +1,105 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Identifies the user who is assigned to this member object. Only `id` is required. + class ScheduleUpdateRequestDataAttributesLayersItemsMembersItemsUser + include BaseGenericModel + + # The user's ID. + attr_accessor :id + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'id' => :'id' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'id' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ScheduleUpdateRequestDataAttributesLayersItemsMembersItemsUser` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [id, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/schedule_update_request_data_attributes_layers_items_restrictions_items.rb b/lib/datadog_api_client/v2/models/schedule_update_request_data_attributes_layers_items_restrictions_items.rb new file mode 100644 index 000000000000..ed89cf37ef1c --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule_update_request_data_attributes_layers_items_restrictions_items.rb @@ -0,0 +1,136 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Defines a time restriction object for a layer within a schedule update, including + # start and end days, as well as times. + class ScheduleUpdateRequestDataAttributesLayersItemsRestrictionsItems + include BaseGenericModel + + # Defines the day of the week on which the time restriction ends. + attr_accessor :end_day + + # The time at which this restriction ends (hh:mm:ss). + attr_accessor :end_time + + # Defines the day of the week on which the time restriction starts. + attr_accessor :start_day + + # The time at which this restriction starts (hh:mm:ss). + attr_accessor :start_time + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'end_day' => :'end_day', + :'end_time' => :'end_time', + :'start_day' => :'start_day', + :'start_time' => :'start_time' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'end_day' => :'ScheduleUpdateRequestDataAttributesLayersItemsRestrictionsItemsEndDay', + :'end_time' => :'String', + :'start_day' => :'ScheduleUpdateRequestDataAttributesLayersItemsRestrictionsItemsStartDay', + :'start_time' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ScheduleUpdateRequestDataAttributesLayersItemsRestrictionsItems` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'end_day') + self.end_day = attributes[:'end_day'] + end + + if attributes.key?(:'end_time') + self.end_time = attributes[:'end_time'] + end + + if attributes.key?(:'start_day') + self.start_day = attributes[:'start_day'] + end + + if attributes.key?(:'start_time') + self.start_time = attributes[:'start_time'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + end_day == o.end_day && + end_time == o.end_time && + start_day == o.start_day && + start_time == o.start_time && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [end_day, end_time, start_day, start_time, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/schedule_update_request_data_attributes_layers_items_restrictions_items_end_day.rb b/lib/datadog_api_client/v2/models/schedule_update_request_data_attributes_layers_items_restrictions_items_end_day.rb new file mode 100644 index 000000000000..8ccb04da9e91 --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule_update_request_data_attributes_layers_items_restrictions_items_end_day.rb @@ -0,0 +1,32 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Defines the day of the week on which the time restriction ends. + class ScheduleUpdateRequestDataAttributesLayersItemsRestrictionsItemsEndDay + include BaseEnumModel + + MONDAY = "monday".freeze + TUESDAY = "tuesday".freeze + WEDNESDAY = "wednesday".freeze + THURSDAY = "thursday".freeze + FRIDAY = "friday".freeze + SATURDAY = "saturday".freeze + SUNDAY = "sunday".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/schedule_update_request_data_attributes_layers_items_restrictions_items_start_day.rb b/lib/datadog_api_client/v2/models/schedule_update_request_data_attributes_layers_items_restrictions_items_start_day.rb new file mode 100644 index 000000000000..3bcb5dedc442 --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule_update_request_data_attributes_layers_items_restrictions_items_start_day.rb @@ -0,0 +1,32 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Defines the day of the week on which the time restriction starts. + class ScheduleUpdateRequestDataAttributesLayersItemsRestrictionsItemsStartDay + include BaseEnumModel + + MONDAY = "monday".freeze + TUESDAY = "tuesday".freeze + WEDNESDAY = "wednesday".freeze + THURSDAY = "thursday".freeze + FRIDAY = "friday".freeze + SATURDAY = "saturday".freeze + SUNDAY = "sunday".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/schedule_update_request_data_relationships.rb b/lib/datadog_api_client/v2/models/schedule_update_request_data_relationships.rb new file mode 100644 index 000000000000..3a636aca4500 --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule_update_request_data_relationships.rb @@ -0,0 +1,105 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Houses relationships for the schedule update, typically referencing teams. + class ScheduleUpdateRequestDataRelationships + include BaseGenericModel + + # Defines the teams that this schedule update is associated with. + attr_accessor :teams + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'teams' => :'teams' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'teams' => :'ScheduleUpdateRequestDataRelationshipsTeams' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ScheduleUpdateRequestDataRelationships` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'teams') + self.teams = attributes[:'teams'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + teams == o.teams && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [teams, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/schedule_update_request_data_relationships_teams.rb b/lib/datadog_api_client/v2/models/schedule_update_request_data_relationships_teams.rb new file mode 100644 index 000000000000..7f10881051c7 --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule_update_request_data_relationships_teams.rb @@ -0,0 +1,107 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Defines the teams that this schedule update is associated with. + class ScheduleUpdateRequestDataRelationshipsTeams + include BaseGenericModel + + # An array of team references. + attr_accessor :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ScheduleUpdateRequestDataRelationshipsTeams` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/schedule_update_request_data_relationships_teams_data_items.rb b/lib/datadog_api_client/v2/models/schedule_update_request_data_relationships_teams_data_items.rb new file mode 100644 index 000000000000..7ea058f462fe --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule_update_request_data_relationships_teams_data_items.rb @@ -0,0 +1,115 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Links the schedule to a team within an update request, identified by `id` and `type`. + class ScheduleUpdateRequestDataRelationshipsTeamsDataItems + include BaseGenericModel + + # The unique team identifier. + attr_accessor :id + + # Teams resource type. + attr_accessor :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'id' => :'String', + :'type' => :'ScheduleUpdateRequestDataRelationshipsTeamsDataItemsType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ScheduleUpdateRequestDataRelationshipsTeamsDataItems` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/schedule_update_request_data_relationships_teams_data_items_type.rb b/lib/datadog_api_client/v2/models/schedule_update_request_data_relationships_teams_data_items_type.rb new file mode 100644 index 000000000000..8aff0456de44 --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule_update_request_data_relationships_teams_data_items_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Teams resource type. + class ScheduleUpdateRequestDataRelationshipsTeamsDataItemsType + include BaseEnumModel + + TEAMS = "teams".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/schedule_update_request_data_type.rb b/lib/datadog_api_client/v2/models/schedule_update_request_data_type.rb new file mode 100644 index 000000000000..3243c575257b --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule_update_request_data_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Schedules resource type. + class ScheduleUpdateRequestDataType + include BaseEnumModel + + SCHEDULES = "schedules".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/schedule_user.rb b/lib/datadog_api_client/v2/models/schedule_user.rb new file mode 100644 index 000000000000..8e8270266ac2 --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule_user.rb @@ -0,0 +1,125 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Represents a user object in the context of a schedule, including their `id`, type, and basic attributes. + class ScheduleUser + include BaseGenericModel + + # Provides basic user information for a schedule, including a name and email address. + attr_accessor :attributes + + # The unique user identifier. + attr_accessor :id + + # Users resource type. + attr_accessor :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'ScheduleUserAttributes', + :'id' => :'String', + :'type' => :'ScheduleUserType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ScheduleUser` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/schedule_user_attributes.rb b/lib/datadog_api_client/v2/models/schedule_user_attributes.rb new file mode 100644 index 000000000000..9790772ffac0 --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule_user_attributes.rb @@ -0,0 +1,115 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Provides basic user information for a schedule, including a name and email address. + class ScheduleUserAttributes + include BaseGenericModel + + # The user's email address. + attr_accessor :email + + # The user's name. + attr_accessor :name + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'email' => :'email', + :'name' => :'name' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'email' => :'String', + :'name' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ScheduleUserAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'email') + self.email = attributes[:'email'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + email == o.email && + name == o.name && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [email, name, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/schedule_user_type.rb b/lib/datadog_api_client/v2/models/schedule_user_type.rb new file mode 100644 index 000000000000..9799c14f1f49 --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule_user_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Users resource type. + class ScheduleUserType + include BaseEnumModel + + USERS = "users".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/team_reference.rb b/lib/datadog_api_client/v2/models/team_reference.rb new file mode 100644 index 000000000000..c72e160b16f6 --- /dev/null +++ b/lib/datadog_api_client/v2/models/team_reference.rb @@ -0,0 +1,135 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Provides a reference to a team, including ID, type, and basic attributes/relationships. + class TeamReference + include BaseGenericModel + + # Encapsulates the basic attributes of a Team reference, such as name, handle, and an optional avatar or description. + attr_accessor :attributes + + # The team's unique identifier. + attr_accessor :id + + # Collects the key relationship fields for a team reference, specifically on-call users. + attr_accessor :relationships + + # Teams resource type. + attr_accessor :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'relationships' => :'relationships', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'TeamReferenceAttributes', + :'id' => :'String', + :'relationships' => :'TeamReferenceRelationships', + :'type' => :'TeamReferenceType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::TeamReference` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'relationships') + self.relationships = attributes[:'relationships'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + relationships == o.relationships && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, relationships, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/team_reference_attributes.rb b/lib/datadog_api_client/v2/models/team_reference_attributes.rb new file mode 100644 index 000000000000..0eda5f3658a7 --- /dev/null +++ b/lib/datadog_api_client/v2/models/team_reference_attributes.rb @@ -0,0 +1,135 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Encapsulates the basic attributes of a Team reference, such as name, handle, and an optional avatar or description. + class TeamReferenceAttributes + include BaseGenericModel + + # URL or reference for the team's avatar (if available). + attr_accessor :avatar + + # A short text describing the team. + attr_accessor :description + + # A unique handle/slug for the team. + attr_accessor :handle + + # The full, human-readable name of the team. + attr_accessor :name + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'avatar' => :'avatar', + :'description' => :'description', + :'handle' => :'handle', + :'name' => :'name' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'avatar' => :'String', + :'description' => :'String', + :'handle' => :'String', + :'name' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::TeamReferenceAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'avatar') + self.avatar = attributes[:'avatar'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'handle') + self.handle = attributes[:'handle'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + avatar == o.avatar && + description == o.description && + handle == o.handle && + name == o.name && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [avatar, description, handle, name, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/team_reference_relationships.rb b/lib/datadog_api_client/v2/models/team_reference_relationships.rb new file mode 100644 index 000000000000..3208c71897bd --- /dev/null +++ b/lib/datadog_api_client/v2/models/team_reference_relationships.rb @@ -0,0 +1,105 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Collects the key relationship fields for a team reference, specifically on-call users. + class TeamReferenceRelationships + include BaseGenericModel + + # Defines which users are on-call within a team, stored as an array of references. + attr_accessor :oncall_users + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'oncall_users' => :'oncall_users' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'oncall_users' => :'TeamReferenceRelationshipsOncallUsers' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::TeamReferenceRelationships` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'oncall_users') + self.oncall_users = attributes[:'oncall_users'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + oncall_users == o.oncall_users && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [oncall_users, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/team_reference_relationships_oncall_users.rb b/lib/datadog_api_client/v2/models/team_reference_relationships_oncall_users.rb new file mode 100644 index 000000000000..4fd0e556729d --- /dev/null +++ b/lib/datadog_api_client/v2/models/team_reference_relationships_oncall_users.rb @@ -0,0 +1,107 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Defines which users are on-call within a team, stored as an array of references. + class TeamReferenceRelationshipsOncallUsers + include BaseGenericModel + + # The list of user references who are on-call for this team. + attr_accessor :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::TeamReferenceRelationshipsOncallUsers` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/team_reference_relationships_oncall_users_data_items.rb b/lib/datadog_api_client/v2/models/team_reference_relationships_oncall_users_data_items.rb new file mode 100644 index 000000000000..81457636b0cb --- /dev/null +++ b/lib/datadog_api_client/v2/models/team_reference_relationships_oncall_users_data_items.rb @@ -0,0 +1,115 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # References a user who is on-call within this team, identified by `id` and `type`. + class TeamReferenceRelationshipsOncallUsersDataItems + include BaseGenericModel + + # The unique identifier of the user. + attr_accessor :id + + # Users resource type. + attr_accessor :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'id' => :'String', + :'type' => :'TeamReferenceRelationshipsOncallUsersDataItemsType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::TeamReferenceRelationshipsOncallUsersDataItems` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/team_reference_relationships_oncall_users_data_items_type.rb b/lib/datadog_api_client/v2/models/team_reference_relationships_oncall_users_data_items_type.rb new file mode 100644 index 000000000000..3597c3d3aedd --- /dev/null +++ b/lib/datadog_api_client/v2/models/team_reference_relationships_oncall_users_data_items_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Users resource type. + class TeamReferenceRelationshipsOncallUsersDataItemsType + include BaseEnumModel + + USERS = "users".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/team_reference_type.rb b/lib/datadog_api_client/v2/models/team_reference_type.rb new file mode 100644 index 000000000000..781b74f53007 --- /dev/null +++ b/lib/datadog_api_client/v2/models/team_reference_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Teams resource type. + class TeamReferenceType + include BaseEnumModel + + TEAMS = "teams".freeze + end +end