From 4cf6b4a0e0b9e2a4cb57600a5221f1a3670e8836 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Fri, 10 Jul 2026 10:54:35 +0000 Subject: [PATCH] Regenerate client from commit b59f68b of spec repo --- .generator/schemas/v2/openapi.yaml | 318 ++++++++++++++++++ ...-for-a-schedule-returns-OK-response.frozen | 1 + ...ers-for-a-schedule-returns-OK-response.yml | 101 ++++++ .../v2/on-call/GetScheduleOnCallResponders.rb | 8 + features/scenarios_model_mapping.rb | 6 + features/v2/on-call.feature | 23 ++ features/v2/undo.json | 6 + lib/datadog_api_client/inflector.rb | 18 + lib/datadog_api_client/v2/api/on_call_api.rb | 71 ++++ .../v2/models/schedule_data_attributes.rb | 14 +- .../models/schedule_on_call_responder_data.rb | 153 +++++++++ ...le_on_call_responder_data_relationships.rb | 105 ++++++ ...all_responder_data_relationships_shifts.rb | 107 ++++++ ...er_data_relationships_shifts_data_items.rb | 144 ++++++++ ...ta_relationships_shifts_data_items_type.rb | 26 ++ .../schedule_on_call_responder_data_type.rb | 26 ++ .../v2/models/schedule_on_call_responders.rb | 117 +++++++ .../schedule_on_call_responders_data.rb | 153 +++++++++ ...dule_on_call_responders_data_attributes.rb | 105 ++++++ ...e_on_call_responders_data_relationships.rb | 115 +++++++ ...esponders_data_relationships_responders.rb | 107 ++++++ ...ata_relationships_responders_data_items.rb | 144 ++++++++ ...elationships_responders_data_items_type.rb | 26 ++ ..._responders_data_relationships_schedule.rb | 105 ++++++ ...onders_data_relationships_schedule_data.rb | 144 ++++++++ ...s_data_relationships_schedule_data_type.rb | 26 ++ .../schedule_on_call_responders_data_type.rb | 26 ++ .../schedule_on_call_responders_included.rb | 65 ++++ 28 files changed, 2259 insertions(+), 1 deletion(-) create mode 100644 cassettes/features/v2/on-call/Get-on-call-responders-for-a-schedule-returns-OK-response.frozen create mode 100644 cassettes/features/v2/on-call/Get-on-call-responders-for-a-schedule-returns-OK-response.yml create mode 100644 examples/v2/on-call/GetScheduleOnCallResponders.rb create mode 100644 lib/datadog_api_client/v2/models/schedule_on_call_responder_data.rb create mode 100644 lib/datadog_api_client/v2/models/schedule_on_call_responder_data_relationships.rb create mode 100644 lib/datadog_api_client/v2/models/schedule_on_call_responder_data_relationships_shifts.rb create mode 100644 lib/datadog_api_client/v2/models/schedule_on_call_responder_data_relationships_shifts_data_items.rb create mode 100644 lib/datadog_api_client/v2/models/schedule_on_call_responder_data_relationships_shifts_data_items_type.rb create mode 100644 lib/datadog_api_client/v2/models/schedule_on_call_responder_data_type.rb create mode 100644 lib/datadog_api_client/v2/models/schedule_on_call_responders.rb create mode 100644 lib/datadog_api_client/v2/models/schedule_on_call_responders_data.rb create mode 100644 lib/datadog_api_client/v2/models/schedule_on_call_responders_data_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/schedule_on_call_responders_data_relationships.rb create mode 100644 lib/datadog_api_client/v2/models/schedule_on_call_responders_data_relationships_responders.rb create mode 100644 lib/datadog_api_client/v2/models/schedule_on_call_responders_data_relationships_responders_data_items.rb create mode 100644 lib/datadog_api_client/v2/models/schedule_on_call_responders_data_relationships_responders_data_items_type.rb create mode 100644 lib/datadog_api_client/v2/models/schedule_on_call_responders_data_relationships_schedule.rb create mode 100644 lib/datadog_api_client/v2/models/schedule_on_call_responders_data_relationships_schedule_data.rb create mode 100644 lib/datadog_api_client/v2/models/schedule_on_call_responders_data_relationships_schedule_data_type.rb create mode 100644 lib/datadog_api_client/v2/models/schedule_on_call_responders_data_type.rb create mode 100644 lib/datadog_api_client/v2/models/schedule_on_call_responders_included.rb diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index c2aa6fb6864f..186a36cefe30 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -85180,6 +85180,11 @@ components: description: A short name for the schedule. example: Primary On-Call type: string + tags: + description: A list of tags associated with the schedule. + items: + type: string + type: array time_zone: description: The time zone in which this schedule operates. example: America/New_York @@ -85303,6 +85308,225 @@ components: type: string x-enum-varnames: - MEMBERS + ScheduleOnCallResponderData: + description: Represents one position's (previous, current, or next) group of on-call responder shifts. Positions with no matching shift are omitted entirely from the response. + properties: + attributes: + $ref: "#/components/schemas/EscalationPolicyStepTargetConfigSchedule" + id: + description: Unique identifier of this responder group. + type: string + relationships: + $ref: "#/components/schemas/ScheduleOnCallResponderDataRelationships" + type: + $ref: "#/components/schemas/ScheduleOnCallResponderDataType" + required: + - type + type: object + ScheduleOnCallResponderDataRelationships: + description: Relationships for a single position's (previous, current, or next) responder group. + properties: + shifts: + $ref: "#/components/schemas/ScheduleOnCallResponderDataRelationshipsShifts" + type: object + ScheduleOnCallResponderDataRelationshipsShifts: + description: Defines the list of shifts satisfying this responder group's position. Multiple shifts occur when a schedule has concurrent on-call users at that position (additive schedules). + properties: + data: + description: Array of references to the shifts included in the response. + items: + $ref: "#/components/schemas/ScheduleOnCallResponderDataRelationshipsShiftsDataItems" + type: array + type: object + ScheduleOnCallResponderDataRelationshipsShiftsDataItems: + description: Represents a reference to one of the shifts satisfying this responder group's position. + properties: + id: + description: Unique identifier of the shift. + example: "00000000-0000-0000-0000-000000000000" + type: string + type: + $ref: "#/components/schemas/ScheduleOnCallResponderDataRelationshipsShiftsDataItemsType" + required: + - type + - id + type: object + ScheduleOnCallResponderDataRelationshipsShiftsDataItemsType: + default: shifts + description: "Indicates that the related resource is of type 'shifts'." + enum: + - shifts + example: shifts + type: string + x-enum-varnames: + - SHIFTS + ScheduleOnCallResponderDataType: + default: schedule_oncall_responder + description: Represents the resource type for a single position's (previous, current, or next) group of on-call responder shifts. + enum: + - schedule_oncall_responder + example: schedule_oncall_responder + type: string + x-enum-varnames: + - SCHEDULE_ONCALL_RESPONDER + ScheduleOnCallResponders: + description: Root object representing a schedule's on-call responders, grouped by position (previous, current, next), for a given point in time. + example: + data: + attributes: + scheduled_at: "2024-05-07T02:53:01.000000000Z" + id: "3653d3c6-0c75-11ea-ad28-fb5701eabc7d-1715054400" + relationships: + responders: + data: + - id: "3653d3c6-0c75-11ea-ad28-fb5701eabc7d-1715054400-current" + type: schedule_oncall_responder + schedule: + data: + id: 3653d3c6-0c75-11ea-ad28-fb5701eabc7d + type: schedules + type: schedule_oncall_responders + included: + - attributes: + position: current + id: "3653d3c6-0c75-11ea-ad28-fb5701eabc7d-1715054400-current" + relationships: + shifts: + data: + - id: 00000000-0000-0000-0000-000000000000 + type: shifts + type: schedule_oncall_responder + - attributes: + end: "2024-05-08T02:53:01.000000000Z" + start: "2024-05-07T02:53:01.000000000Z" + id: 00000000-0000-0000-0000-000000000000 + relationships: + user: + data: + id: 00000000-aba1-0000-0000-000000000000 + type: users + type: shifts + - attributes: + email: test@test.com + name: Test User + status: active + id: 00000000-aba1-0000-0000-000000000000 + type: users + properties: + data: + $ref: "#/components/schemas/ScheduleOnCallRespondersData" + included: + description: The `ScheduleOnCallResponders` `included`. + items: + $ref: "#/components/schemas/ScheduleOnCallRespondersIncluded" + type: array + type: object + ScheduleOnCallRespondersData: + description: The main data object representing a schedule's on-call responders lookup, including relationships and metadata. + properties: + attributes: + $ref: "#/components/schemas/ScheduleOnCallRespondersDataAttributes" + id: + description: Unique identifier of this on-call responders lookup. + type: string + relationships: + $ref: "#/components/schemas/ScheduleOnCallRespondersDataRelationships" + type: + $ref: "#/components/schemas/ScheduleOnCallRespondersDataType" + required: + - type + type: object + ScheduleOnCallRespondersDataAttributes: + description: Attributes for a schedule's on-call responders lookup. + properties: + scheduled_at: + description: The timestamp the responders were resolved at. + format: date-time + type: string + type: object + ScheduleOnCallRespondersDataRelationships: + description: Relationships for a schedule's on-call responders lookup, including the schedule and its responder groups. + properties: + responders: + $ref: "#/components/schemas/ScheduleOnCallRespondersDataRelationshipsResponders" + schedule: + $ref: "#/components/schemas/ScheduleOnCallRespondersDataRelationshipsSchedule" + type: object + ScheduleOnCallRespondersDataRelationshipsResponders: + description: Defines the list of per-position (previous, current, next) responder groups for the schedule. + properties: + data: + description: Array of references to the responder groups included in the response. + items: + $ref: "#/components/schemas/ScheduleOnCallRespondersDataRelationshipsRespondersDataItems" + type: array + type: object + ScheduleOnCallRespondersDataRelationshipsRespondersDataItems: + description: Represents a reference to one position's (previous, current, or next) responder group. + properties: + id: + description: Unique identifier of the responder group. + example: "" + type: string + type: + $ref: "#/components/schemas/ScheduleOnCallRespondersDataRelationshipsRespondersDataItemsType" + required: + - type + - id + type: object + ScheduleOnCallRespondersDataRelationshipsRespondersDataItemsType: + default: schedule_oncall_responder + description: Identifies the resource type for a responder group linked to a schedule's on-call responders lookup. + enum: + - schedule_oncall_responder + example: schedule_oncall_responder + type: string + x-enum-varnames: + - SCHEDULE_ONCALL_RESPONDER + ScheduleOnCallRespondersDataRelationshipsSchedule: + description: Defines the relationship to the schedule this on-call responders lookup was performed for. + properties: + data: + $ref: "#/components/schemas/ScheduleOnCallRespondersDataRelationshipsScheduleData" + type: object + ScheduleOnCallRespondersDataRelationshipsScheduleData: + description: Represents a reference to the schedule this on-call responders lookup was performed for. + properties: + id: + description: Unique identifier of the schedule. + example: "3653d3c6-0c75-11ea-ad28-fb5701eabc7d" + type: string + type: + $ref: "#/components/schemas/ScheduleOnCallRespondersDataRelationshipsScheduleDataType" + required: + - type + - id + type: object + ScheduleOnCallRespondersDataRelationshipsScheduleDataType: + default: schedules + description: Identifies the resource type for the schedule associated with this on-call responders lookup. + enum: + - schedules + example: schedules + type: string + x-enum-varnames: + - SCHEDULES + ScheduleOnCallRespondersDataType: + default: schedule_oncall_responders + description: Represents the resource type for a schedule's grouped on-call responders across the previous, current, and next positions. + enum: + - schedule_oncall_responders + example: schedule_oncall_responders + type: string + x-enum-varnames: + - SCHEDULE_ONCALL_RESPONDERS + ScheduleOnCallRespondersIncluded: + description: Represents a union of related resources included in the response, such as responder groups, shifts, schedules, and users. + oneOf: + - $ref: "#/components/schemas/ScheduleOnCallResponderData" + - $ref: "#/components/schemas/ShiftData" + - $ref: "#/components/schemas/ScheduleData" + - $ref: "#/components/schemas/User" ScheduleRequestDataAttributesLayersItemsMembersItems: description: |- Defines a single member within a schedule layer, including the reference to the underlying user. @@ -160309,6 +160533,100 @@ paths: operator: AND permissions: - on_call_read + /api/v2/on-call/schedules/{schedule_id}/responders: + get: + description: "Retrieves the on-call responders for the specified schedule, grouped by position (previous, current, next), at a given time. Unlike `GetScheduleOnCallUser`, this endpoint supports schedules with multiple concurrent on-call users at a position (additive schedules) by returning a list of shifts per position." + operationId: GetScheduleOnCallResponders + parameters: + - description: "Comma-separated list of included relationships to be returned. Allowed values: `schedule`, `responders`, `responders.shifts`, `responders.shifts.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 + - description: "Comma-separated list of positions to retrieve. Allowed values: `previous`, `current`, `next`. Defaults to `current` if omitted." + in: query + name: filter[position] + schema: + example: previous,current,next + type: string + - description: "Retrieves the on-call responders at the given timestamp in RFC3339 format (for example, `2025-05-07T02:53:01Z` or `2025-05-07T02:53:01+00:00`). When using timezone offsets with `+` or `-`, ensure proper URL encoding (`+` should be encoded as `%2B`). Defaults to the current time if omitted." + in: query + name: filter[at_ts] + schema: + example: "2025-05-07T02:53:01Z" + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + scheduled_at: "2024-05-07T02:53:01.000000000Z" + id: "3653d3c6-0c75-11ea-ad28-fb5701eabc7d-1715054400" + relationships: + responders: + data: + - id: "3653d3c6-0c75-11ea-ad28-fb5701eabc7d-1715054400-current" + type: schedule_oncall_responder + schedule: + data: + id: 3653d3c6-0c75-11ea-ad28-fb5701eabc7d + type: schedules + type: schedule_oncall_responders + included: + - attributes: + position: current + id: "3653d3c6-0c75-11ea-ad28-fb5701eabc7d-1715054400-current" + relationships: + shifts: + data: + - id: 00000000-0000-0000-0000-000000000000 + type: shifts + type: schedule_oncall_responder + - attributes: + end: "2024-05-08T02:53:01.000000000Z" + start: "2024-05-07T02:53:01.000000000Z" + id: 00000000-0000-0000-0000-000000000000 + relationships: + user: + data: + id: 00000000-aba1-0000-0000-000000000000 + type: users + type: shifts + schema: + $ref: "#/components/schemas/ScheduleOnCallResponders" + 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: Get on-call responders for a schedule + tags: + - On-Call + "x-permission": + operator: AND + permissions: + - on_call_read /api/v2/on-call/teams/{team_id}/on-call: get: description: Get a team's on-call users at a given time diff --git a/cassettes/features/v2/on-call/Get-on-call-responders-for-a-schedule-returns-OK-response.frozen b/cassettes/features/v2/on-call/Get-on-call-responders-for-a-schedule-returns-OK-response.frozen new file mode 100644 index 000000000000..474884360ebe --- /dev/null +++ b/cassettes/features/v2/on-call/Get-on-call-responders-for-a-schedule-returns-OK-response.frozen @@ -0,0 +1 @@ +2026-07-10T09:31:37.503Z \ No newline at end of file diff --git a/cassettes/features/v2/on-call/Get-on-call-responders-for-a-schedule-returns-OK-response.yml b/cassettes/features/v2/on-call/Get-on-call-responders-for-a-schedule-returns-OK-response.yml new file mode 100644 index 000000000000..b59343177c5b --- /dev/null +++ b/cassettes/features/v2/on-call/Get-on-call-responders-for-a-schedule-returns-OK-response.yml @@ -0,0 +1,101 @@ +http_interactions: +- recorded_at: Fri, 10 Jul 2026 09:31:37 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"email":"Test-Get_on_call_responders_for_a_schedule_returns_OK_response-1783675897@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":"7f1b523e-fe13-4917-8519-6dd314ef17c0","attributes":{"uuid":"7f1b523e-fe13-4917-8519-6dd314ef17c0","name":null,"handle":"test-get_on_call_responders_for_a_schedule_returns_ok_response-1783675897@datadoghq.com","created_at":"2026-07-10T09:31:38.042683+00:00","modified_at":"2026-07-10T09:31:38.042683+00:00","email":"test-get_on_call_responders_for_a_schedule_returns_ok_response-1783675897@datadoghq.com","icon":"https://secure.gravatar.com/avatar/22b76633087bc3ee4427cc67e8466d5e?s=48&d=retro","title":"user + title","verified":false,"service_account":false,"disabled":false,"allowed_login_methods":[],"status":"Pending","last_login_time":null},"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: Fri, 10 Jul 2026 09:31:37 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"layers":[{"effective_date":"2026-06-30T09:31:37.503Z","end_date":"2026-07-20T09:31:37.503Z","interval":{"days":1},"members":[{"user":{"id":"7f1b523e-fe13-4917-8519-6dd314ef17c0"}}],"name":"Layer + 1","restrictions":[{"end_day":"friday","end_time":"17:00:00","start_day":"monday","start_time":"09:00:00"}],"rotation_start":"2026-07-05T09:31:37.503Z"}],"name":"Test-Get_on_call_responders_for_a_schedule_returns_OK_response-1783675897","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":"23545b48-fa23-4ea9-a331-3a38f81195cd","type":"schedules","attributes":{"name":"Test-Get_on_call_responders_for_a_schedule_returns_OK_response-1783675897","tags":[],"time_zone":"America/New_York"},"relationships":{"layers":{"data":[{"id":"03edf431-b1a6-418a-965e-9df50275dc7e","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: Fri, 10 Jul 2026 09:31:37 GMT + request: + body: null + headers: + Accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/on-call/schedules/23545b48-fa23-4ea9-a331-3a38f81195cd/responders + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"23545b48-fa23-4ea9-a331-3a38f81195cd-1783675898","type":"schedule_oncall_responders","attributes":{"scheduled_at":"2026-07-10T09:31:38.803561233Z"},"relationships":{"responders":{"data":[{"id":"23545b48-fa23-4ea9-a331-3a38f81195cd-1783675898-current","type":"schedule_oncall_responder"}]},"schedule":{"data":{"id":"23545b48-fa23-4ea9-a331-3a38f81195cd","type":"schedules"}}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +- recorded_at: Fri, 10 Jul 2026 09:31:37 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/on-call/schedules/23545b48-fa23-4ea9-a331-3a38f81195cd + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +- recorded_at: Fri, 10 Jul 2026 09:31:37 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/users/7f1b523e-fe13-4917-8519-6dd314ef17c0 + 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/GetScheduleOnCallResponders.rb b/examples/v2/on-call/GetScheduleOnCallResponders.rb new file mode 100644 index 000000000000..1c59713b2ded --- /dev/null +++ b/examples/v2/on-call/GetScheduleOnCallResponders.rb @@ -0,0 +1,8 @@ +# Get on-call responders for a schedule returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::OnCallAPI.new + +# there is a valid "schedule" in the system +SCHEDULE_DATA_ID = ENV["SCHEDULE_DATA_ID"] +p api_instance.get_schedule_on_call_responders(SCHEDULE_DATA_ID) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index f4cb633ab3a6..6f57d8c59053 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -4484,6 +4484,12 @@ "schedule_id" => "String", "filter_at_ts" => "String", }, + "v2.GetScheduleOnCallResponders" => { + "include" => "String", + "schedule_id" => "String", + "filter_position" => "String", + "filter_at_ts" => "String", + }, "v2.GetTeamOnCallUsers" => { "include" => "String", "team_id" => "String", diff --git a/features/v2/on-call.feature b/features/v2/on-call.feature index a4ea9a7c4f08..208eca3cb951 100644 --- a/features/v2/on-call.feature +++ b/features/v2/on-call.feature @@ -290,6 +290,29 @@ Feature: On-Call And the response "data.attributes.category" is equal to "high_urgency" And the response "included" has length 1 + @generated @skip @team:DataDog/on-call + Scenario: Get on-call responders for a schedule returns "Bad Request" response + Given new "GetScheduleOnCallResponders" request + And request contains "schedule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/on-call + Scenario: Get on-call responders for a schedule returns "Not Found" response + Given new "GetScheduleOnCallResponders" 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/on-call + Scenario: Get on-call responders for a schedule returns "OK" response + Given new "GetScheduleOnCallResponders" request + And there is a valid "user" in the system + 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/on-call Scenario: Get scheduled on-call user returns "Bad Request" response Given new "GetScheduleOnCallUser" request diff --git a/features/v2/undo.json b/features/v2/undo.json index 1eaba52ee9bf..85b578278703 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -5600,6 +5600,12 @@ "type": "safe" } }, + "GetScheduleOnCallResponders": { + "tag": "On-Call", + "undo": { + "type": "safe" + } + }, "GetTeamOnCallUsers": { "tag": "On-Call", "undo": { diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index bb489f2e6b16..eda9f09e7cae 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -6323,6 +6323,24 @@ def overrides "v2.schedule_member_relationships_user_data" => "ScheduleMemberRelationshipsUserData", "v2.schedule_member_relationships_user_data_type" => "ScheduleMemberRelationshipsUserDataType", "v2.schedule_member_type" => "ScheduleMemberType", + "v2.schedule_on_call_responder_data" => "ScheduleOnCallResponderData", + "v2.schedule_on_call_responder_data_relationships" => "ScheduleOnCallResponderDataRelationships", + "v2.schedule_on_call_responder_data_relationships_shifts" => "ScheduleOnCallResponderDataRelationshipsShifts", + "v2.schedule_on_call_responder_data_relationships_shifts_data_items" => "ScheduleOnCallResponderDataRelationshipsShiftsDataItems", + "v2.schedule_on_call_responder_data_relationships_shifts_data_items_type" => "ScheduleOnCallResponderDataRelationshipsShiftsDataItemsType", + "v2.schedule_on_call_responder_data_type" => "ScheduleOnCallResponderDataType", + "v2.schedule_on_call_responders" => "ScheduleOnCallResponders", + "v2.schedule_on_call_responders_data" => "ScheduleOnCallRespondersData", + "v2.schedule_on_call_responders_data_attributes" => "ScheduleOnCallRespondersDataAttributes", + "v2.schedule_on_call_responders_data_relationships" => "ScheduleOnCallRespondersDataRelationships", + "v2.schedule_on_call_responders_data_relationships_responders" => "ScheduleOnCallRespondersDataRelationshipsResponders", + "v2.schedule_on_call_responders_data_relationships_responders_data_items" => "ScheduleOnCallRespondersDataRelationshipsRespondersDataItems", + "v2.schedule_on_call_responders_data_relationships_responders_data_items_type" => "ScheduleOnCallRespondersDataRelationshipsRespondersDataItemsType", + "v2.schedule_on_call_responders_data_relationships_schedule" => "ScheduleOnCallRespondersDataRelationshipsSchedule", + "v2.schedule_on_call_responders_data_relationships_schedule_data" => "ScheduleOnCallRespondersDataRelationshipsScheduleData", + "v2.schedule_on_call_responders_data_relationships_schedule_data_type" => "ScheduleOnCallRespondersDataRelationshipsScheduleDataType", + "v2.schedule_on_call_responders_data_type" => "ScheduleOnCallRespondersDataType", + "v2.schedule_on_call_responders_included" => "ScheduleOnCallRespondersIncluded", "v2.schedule_request_data_attributes_layers_items_members_items" => "ScheduleRequestDataAttributesLayersItemsMembersItems", "v2.schedule_request_data_attributes_layers_items_members_items_user" => "ScheduleRequestDataAttributesLayersItemsMembersItemsUser", "v2.schedule_target" => "ScheduleTarget", diff --git a/lib/datadog_api_client/v2/api/on_call_api.rb b/lib/datadog_api_client/v2/api/on_call_api.rb index 2cc14e5581b1..adfc5fd87e65 100644 --- a/lib/datadog_api_client/v2/api/on_call_api.rb +++ b/lib/datadog_api_client/v2/api/on_call_api.rb @@ -776,6 +776,77 @@ def get_on_call_team_routing_rules_with_http_info(team_id, opts = {}) return data, status_code, headers end + # Get on-call responders for a schedule. + # + # @see #get_schedule_on_call_responders_with_http_info + def get_schedule_on_call_responders(schedule_id, opts = {}) + data, _status_code, _headers = get_schedule_on_call_responders_with_http_info(schedule_id, opts) + data + end + + # Get on-call responders for a schedule. + # + # Retrieves the on-call responders for the specified schedule, grouped by position (previous, current, next), at a given time. Unlike `GetScheduleOnCallUser`, this endpoint supports schedules with multiple concurrent on-call users at a position (additive schedules) by returning a list of shifts per position. + # + # @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: `schedule`, `responders`, `responders.shifts`, `responders.shifts.user`. + # @option opts [String] :filter_position Comma-separated list of positions to retrieve. Allowed values: `previous`, `current`, `next`. Defaults to `current` if omitted. + # @option opts [String] :filter_at_ts Retrieves the on-call responders at the given timestamp in RFC3339 format (for example, `2025-05-07T02:53:01Z` or `2025-05-07T02:53:01+00:00`). When using timezone offsets with `+` or `-`, ensure proper URL encoding (`+` should be encoded as `%2B`). Defaults to the current time if omitted. + # @return [Array<(ScheduleOnCallResponders, Integer, Hash)>] ScheduleOnCallResponders data, response status code and response headers + def get_schedule_on_call_responders_with_http_info(schedule_id, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: OnCallAPI.get_schedule_on_call_responders ...' + 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_schedule_on_call_responders" + end + # resource path + local_var_path = '/api/v2/on-call/schedules/{schedule_id}/responders'.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? + query_params[:'filter[position]'] = opts[:'filter_position'] if !opts[:'filter_position'].nil? + query_params[:'filter[at_ts]'] = opts[:'filter_at_ts'] if !opts[:'filter_at_ts'].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] || 'ScheduleOnCallResponders' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :get_schedule_on_call_responders, + :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_schedule_on_call_responders\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Get scheduled on-call user. # # @see #get_schedule_on_call_user_with_http_info diff --git a/lib/datadog_api_client/v2/models/schedule_data_attributes.rb b/lib/datadog_api_client/v2/models/schedule_data_attributes.rb index 77cf13e1d423..f2a9c5a5053e 100644 --- a/lib/datadog_api_client/v2/models/schedule_data_attributes.rb +++ b/lib/datadog_api_client/v2/models/schedule_data_attributes.rb @@ -24,6 +24,9 @@ class ScheduleDataAttributes # A short name for the schedule. attr_accessor :name + # A list of tags associated with the schedule. + attr_accessor :tags + # The time zone in which this schedule operates. attr_accessor :time_zone @@ -34,6 +37,7 @@ class ScheduleDataAttributes def self.attribute_map { :'name' => :'name', + :'tags' => :'tags', :'time_zone' => :'time_zone' } end @@ -43,6 +47,7 @@ def self.attribute_map def self.openapi_types { :'name' => :'String', + :'tags' => :'Array', :'time_zone' => :'String' } end @@ -69,6 +74,12 @@ def initialize(attributes = {}) 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 @@ -101,6 +112,7 @@ 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 @@ -109,7 +121,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [name, time_zone, additional_properties].hash + [name, tags, time_zone, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v2/models/schedule_on_call_responder_data.rb b/lib/datadog_api_client/v2/models/schedule_on_call_responder_data.rb new file mode 100644 index 000000000000..0d4c961733bf --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule_on_call_responder_data.rb @@ -0,0 +1,153 @@ +=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 one position's (previous, current, or next) group of on-call responder shifts. Positions with no matching shift are omitted entirely from the response. + class ScheduleOnCallResponderData + include BaseGenericModel + + # Schedule-specific configuration for an escalation target. + attr_accessor :attributes + + # Unique identifier of this responder group. + attr_accessor :id + + # Relationships for a single position's (previous, current, or next) responder group. + attr_accessor :relationships + + # Represents the resource type for a single position's (previous, current, or next) group of on-call responder shifts. + 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' => :'EscalationPolicyStepTargetConfigSchedule', + :'id' => :'String', + :'relationships' => :'ScheduleOnCallResponderDataRelationships', + :'type' => :'ScheduleOnCallResponderDataType' + } + 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::ScheduleOnCallResponderData` 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 @type.nil? + true + 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_on_call_responder_data_relationships.rb b/lib/datadog_api_client/v2/models/schedule_on_call_responder_data_relationships.rb new file mode 100644 index 000000000000..dbfaa40be655 --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule_on_call_responder_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 + # Relationships for a single position's (previous, current, or next) responder group. + class ScheduleOnCallResponderDataRelationships + include BaseGenericModel + + # Defines the list of shifts satisfying this responder group's position. Multiple shifts occur when a schedule has concurrent on-call users at that position (additive schedules). + attr_accessor :shifts + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'shifts' => :'shifts' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'shifts' => :'ScheduleOnCallResponderDataRelationshipsShifts' + } + 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::ScheduleOnCallResponderDataRelationships` 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?(:'shifts') + self.shifts = attributes[:'shifts'] + 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 && + shifts == o.shifts && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [shifts, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/schedule_on_call_responder_data_relationships_shifts.rb b/lib/datadog_api_client/v2/models/schedule_on_call_responder_data_relationships_shifts.rb new file mode 100644 index 000000000000..5224b8ca5532 --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule_on_call_responder_data_relationships_shifts.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 list of shifts satisfying this responder group's position. Multiple shifts occur when a schedule has concurrent on-call users at that position (additive schedules). + class ScheduleOnCallResponderDataRelationshipsShifts + include BaseGenericModel + + # Array of references to the shifts included in the response. + 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::ScheduleOnCallResponderDataRelationshipsShifts` 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_on_call_responder_data_relationships_shifts_data_items.rb b/lib/datadog_api_client/v2/models/schedule_on_call_responder_data_relationships_shifts_data_items.rb new file mode 100644 index 000000000000..a32b9b85e16d --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule_on_call_responder_data_relationships_shifts_data_items.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 + # Represents a reference to one of the shifts satisfying this responder group's position. + class ScheduleOnCallResponderDataRelationshipsShiftsDataItems + include BaseGenericModel + + # Unique identifier of the shift. + attr_reader :id + + # Indicates that the related resource is of type 'shifts'. + attr_reader :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' => :'ScheduleOnCallResponderDataRelationshipsShiftsDataItemsType' + } + 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::ScheduleOnCallResponderDataRelationshipsShiftsDataItems` 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 + + # 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 @id.nil? + return false if @type.nil? + true + 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 && + 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_on_call_responder_data_relationships_shifts_data_items_type.rb b/lib/datadog_api_client/v2/models/schedule_on_call_responder_data_relationships_shifts_data_items_type.rb new file mode 100644 index 000000000000..ffd75fdcb2f1 --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule_on_call_responder_data_relationships_shifts_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 + # Indicates that the related resource is of type 'shifts'. + class ScheduleOnCallResponderDataRelationshipsShiftsDataItemsType + include BaseEnumModel + + SHIFTS = "shifts".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/schedule_on_call_responder_data_type.rb b/lib/datadog_api_client/v2/models/schedule_on_call_responder_data_type.rb new file mode 100644 index 000000000000..45f0a47f5f8e --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule_on_call_responder_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 + # Represents the resource type for a single position's (previous, current, or next) group of on-call responder shifts. + class ScheduleOnCallResponderDataType + include BaseEnumModel + + SCHEDULE_ONCALL_RESPONDER = "schedule_oncall_responder".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/schedule_on_call_responders.rb b/lib/datadog_api_client/v2/models/schedule_on_call_responders.rb new file mode 100644 index 000000000000..12186f085f2b --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule_on_call_responders.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 + # Root object representing a schedule's on-call responders, grouped by position (previous, current, next), for a given point in time. + class ScheduleOnCallResponders + include BaseGenericModel + + # The main data object representing a schedule's on-call responders lookup, including relationships and metadata. + attr_accessor :data + + # The `ScheduleOnCallResponders` `included`. + 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' => :'ScheduleOnCallRespondersData', + :'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::ScheduleOnCallResponders` 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_on_call_responders_data.rb b/lib/datadog_api_client/v2/models/schedule_on_call_responders_data.rb new file mode 100644 index 000000000000..77d6ae67450f --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule_on_call_responders_data.rb @@ -0,0 +1,153 @@ +=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 main data object representing a schedule's on-call responders lookup, including relationships and metadata. + class ScheduleOnCallRespondersData + include BaseGenericModel + + # Attributes for a schedule's on-call responders lookup. + attr_accessor :attributes + + # Unique identifier of this on-call responders lookup. + attr_accessor :id + + # Relationships for a schedule's on-call responders lookup, including the schedule and its responder groups. + attr_accessor :relationships + + # Represents the resource type for a schedule's grouped on-call responders across the previous, current, and next positions. + 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' => :'ScheduleOnCallRespondersDataAttributes', + :'id' => :'String', + :'relationships' => :'ScheduleOnCallRespondersDataRelationships', + :'type' => :'ScheduleOnCallRespondersDataType' + } + 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::ScheduleOnCallRespondersData` 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 @type.nil? + true + 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_on_call_responders_data_attributes.rb b/lib/datadog_api_client/v2/models/schedule_on_call_responders_data_attributes.rb new file mode 100644 index 000000000000..ad4632234605 --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule_on_call_responders_data_attributes.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 + # Attributes for a schedule's on-call responders lookup. + class ScheduleOnCallRespondersDataAttributes + include BaseGenericModel + + # The timestamp the responders were resolved at. + attr_accessor :scheduled_at + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'scheduled_at' => :'scheduled_at' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'scheduled_at' => :'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::ScheduleOnCallRespondersDataAttributes` 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?(:'scheduled_at') + self.scheduled_at = attributes[:'scheduled_at'] + 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 && + scheduled_at == o.scheduled_at && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [scheduled_at, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/schedule_on_call_responders_data_relationships.rb b/lib/datadog_api_client/v2/models/schedule_on_call_responders_data_relationships.rb new file mode 100644 index 000000000000..e16da1846d46 --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule_on_call_responders_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 + # Relationships for a schedule's on-call responders lookup, including the schedule and its responder groups. + class ScheduleOnCallRespondersDataRelationships + include BaseGenericModel + + # Defines the list of per-position (previous, current, next) responder groups for the schedule. + attr_accessor :responders + + # Defines the relationship to the schedule this on-call responders lookup was performed for. + attr_accessor :schedule + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'responders' => :'responders', + :'schedule' => :'schedule' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'responders' => :'ScheduleOnCallRespondersDataRelationshipsResponders', + :'schedule' => :'ScheduleOnCallRespondersDataRelationshipsSchedule' + } + 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::ScheduleOnCallRespondersDataRelationships` 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?(:'responders') + self.responders = attributes[:'responders'] + end + + if attributes.key?(:'schedule') + self.schedule = attributes[:'schedule'] + 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 && + responders == o.responders && + schedule == o.schedule && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [responders, schedule, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/schedule_on_call_responders_data_relationships_responders.rb b/lib/datadog_api_client/v2/models/schedule_on_call_responders_data_relationships_responders.rb new file mode 100644 index 000000000000..9bd57172852e --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule_on_call_responders_data_relationships_responders.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 list of per-position (previous, current, next) responder groups for the schedule. + class ScheduleOnCallRespondersDataRelationshipsResponders + include BaseGenericModel + + # Array of references to the responder groups included in the response. + 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::ScheduleOnCallRespondersDataRelationshipsResponders` 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_on_call_responders_data_relationships_responders_data_items.rb b/lib/datadog_api_client/v2/models/schedule_on_call_responders_data_relationships_responders_data_items.rb new file mode 100644 index 000000000000..d697006d98be --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule_on_call_responders_data_relationships_responders_data_items.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 + # Represents a reference to one position's (previous, current, or next) responder group. + class ScheduleOnCallRespondersDataRelationshipsRespondersDataItems + include BaseGenericModel + + # Unique identifier of the responder group. + attr_reader :id + + # Identifies the resource type for a responder group linked to a schedule's on-call responders lookup. + attr_reader :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' => :'ScheduleOnCallRespondersDataRelationshipsRespondersDataItemsType' + } + 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::ScheduleOnCallRespondersDataRelationshipsRespondersDataItems` 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 + + # 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 @id.nil? + return false if @type.nil? + true + 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 && + 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_on_call_responders_data_relationships_responders_data_items_type.rb b/lib/datadog_api_client/v2/models/schedule_on_call_responders_data_relationships_responders_data_items_type.rb new file mode 100644 index 000000000000..11310e3d386e --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule_on_call_responders_data_relationships_responders_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 + # Identifies the resource type for a responder group linked to a schedule's on-call responders lookup. + class ScheduleOnCallRespondersDataRelationshipsRespondersDataItemsType + include BaseEnumModel + + SCHEDULE_ONCALL_RESPONDER = "schedule_oncall_responder".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/schedule_on_call_responders_data_relationships_schedule.rb b/lib/datadog_api_client/v2/models/schedule_on_call_responders_data_relationships_schedule.rb new file mode 100644 index 000000000000..27dec42dd53b --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule_on_call_responders_data_relationships_schedule.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 the relationship to the schedule this on-call responders lookup was performed for. + class ScheduleOnCallRespondersDataRelationshipsSchedule + include BaseGenericModel + + # Represents a reference to the schedule this on-call responders lookup was performed for. + 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' => :'ScheduleOnCallRespondersDataRelationshipsScheduleData' + } + 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::ScheduleOnCallRespondersDataRelationshipsSchedule` 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_on_call_responders_data_relationships_schedule_data.rb b/lib/datadog_api_client/v2/models/schedule_on_call_responders_data_relationships_schedule_data.rb new file mode 100644 index 000000000000..2020a1771b38 --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule_on_call_responders_data_relationships_schedule_data.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 + # Represents a reference to the schedule this on-call responders lookup was performed for. + class ScheduleOnCallRespondersDataRelationshipsScheduleData + include BaseGenericModel + + # Unique identifier of the schedule. + attr_reader :id + + # Identifies the resource type for the schedule associated with this on-call responders lookup. + attr_reader :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' => :'ScheduleOnCallRespondersDataRelationshipsScheduleDataType' + } + 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::ScheduleOnCallRespondersDataRelationshipsScheduleData` 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 + + # 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 @id.nil? + return false if @type.nil? + true + 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 && + 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_on_call_responders_data_relationships_schedule_data_type.rb b/lib/datadog_api_client/v2/models/schedule_on_call_responders_data_relationships_schedule_data_type.rb new file mode 100644 index 000000000000..e32fc7b90552 --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule_on_call_responders_data_relationships_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 + # Identifies the resource type for the schedule associated with this on-call responders lookup. + class ScheduleOnCallRespondersDataRelationshipsScheduleDataType + include BaseEnumModel + + SCHEDULES = "schedules".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/schedule_on_call_responders_data_type.rb b/lib/datadog_api_client/v2/models/schedule_on_call_responders_data_type.rb new file mode 100644 index 000000000000..aba340e675a4 --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule_on_call_responders_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 + # Represents the resource type for a schedule's grouped on-call responders across the previous, current, and next positions. + class ScheduleOnCallRespondersDataType + include BaseEnumModel + + SCHEDULE_ONCALL_RESPONDERS = "schedule_oncall_responders".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/schedule_on_call_responders_included.rb b/lib/datadog_api_client/v2/models/schedule_on_call_responders_included.rb new file mode 100644 index 000000000000..b1c195cba41f --- /dev/null +++ b/lib/datadog_api_client/v2/models/schedule_on_call_responders_included.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 + # Represents a union of related resources included in the response, such as responder groups, shifts, schedules, and users. + module ScheduleOnCallRespondersIncluded + class << self + include BaseOneOfModel + include BaseOneOfModelNoDiscriminator + + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'ScheduleOnCallResponderData', + :'ShiftData', + :'ScheduleData', + :'User' + ] + 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