|
| 1 | +/** |
| 2 | + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. |
| 3 | + * This product includes software developed at Datadog (https://www.datadoghq.com/). |
| 4 | + * Copyright 2020-Present Datadog, Inc. |
| 5 | + * |
| 6 | + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). |
| 7 | + * https://openapi-generator.tech |
| 8 | + * Do not edit the class manually. |
| 9 | + */ |
| 10 | + |
| 11 | +import { DowntimeRecurrence } from './DowntimeRecurrence'; |
| 12 | +import { HttpFile } from '../http/http'; |
| 13 | +import { ObjectSerializer } from './ObjectSerializer'; |
| 14 | + |
| 15 | +/** |
| 16 | +* The downtime object definition of the active child for the original parent recurring downtime. This field will only exist on recurring downtimes. |
| 17 | +*/ |
| 18 | + |
| 19 | +export class DowntimeChild { |
| 20 | + /** |
| 21 | + * If a scheduled downtime currently exists. |
| 22 | + */ |
| 23 | + 'active'?: boolean; |
| 24 | + /** |
| 25 | + * If a scheduled downtime is canceled. |
| 26 | + */ |
| 27 | + 'canceled'?: number; |
| 28 | + /** |
| 29 | + * User ID of the downtime creator. |
| 30 | + */ |
| 31 | + 'creatorId'?: number; |
| 32 | + /** |
| 33 | + * If a downtime has been disabled. |
| 34 | + */ |
| 35 | + 'disabled'?: boolean; |
| 36 | + /** |
| 37 | + * `0` for a downtime applied on `*` or all, `1` when the downtime is only scoped to hosts, or `2` when the downtime is scoped to anything but hosts. |
| 38 | + */ |
| 39 | + 'downtimeType'?: number; |
| 40 | + /** |
| 41 | + * POSIX timestamp to end the downtime. If not provided, the downtime is in effect indefinitely until you cancel it. |
| 42 | + */ |
| 43 | + 'end'?: number; |
| 44 | + /** |
| 45 | + * The downtime ID. |
| 46 | + */ |
| 47 | + 'id'?: number; |
| 48 | + /** |
| 49 | + * A message to include with notifications for this downtime. Email notifications can be sent to specific users by using the same `@username` notation as events. |
| 50 | + */ |
| 51 | + 'message'?: string; |
| 52 | + /** |
| 53 | + * A single monitor to which the downtime applies. If not provided, the downtime applies to all monitors. |
| 54 | + */ |
| 55 | + 'monitorId'?: number; |
| 56 | + /** |
| 57 | + * A comma-separated list of monitor tags. For example, tags that are applied directly to monitors, not tags that are used in monitor queries (which are filtered by the scope parameter), to which the downtime applies. The resulting downtime applies to monitors that match ALL provided monitor tags. For example, `service:postgres` **AND** `team:frontend`. |
| 58 | + */ |
| 59 | + 'monitorTags'?: Array<string>; |
| 60 | + /** |
| 61 | + * ID of the parent Downtime. |
| 62 | + */ |
| 63 | + 'parentId'?: number; |
| 64 | + 'recurrence'?: DowntimeRecurrence; |
| 65 | + /** |
| 66 | + * The scope(s) to which the downtime applies. For example, `host:app2`. Provide multiple scopes as a comma-separated list like `env:dev,env:prod`. The resulting downtime applies to sources that matches ALL provided scopes (`env:dev` **AND** `env:prod`). |
| 67 | + */ |
| 68 | + 'scope'?: Array<string>; |
| 69 | + /** |
| 70 | + * POSIX timestamp to start the downtime. If not provided, the downtime starts the moment it is created. |
| 71 | + */ |
| 72 | + 'start'?: number; |
| 73 | + /** |
| 74 | + * The timezone in which to display the downtime's start and end times in Datadog applications. |
| 75 | + */ |
| 76 | + 'timezone'?: string; |
| 77 | + /** |
| 78 | + * ID of the last user that updated the downtime. |
| 79 | + */ |
| 80 | + 'updaterId'?: number; |
| 81 | + |
| 82 | + static readonly discriminator: string | undefined = undefined; |
| 83 | + |
| 84 | + static readonly attributeTypeMap: {[key: string]: {baseName: string, type: string, format: string}} = { |
| 85 | + "active": { |
| 86 | + "baseName": "active", |
| 87 | + "type": "boolean", |
| 88 | + "format": "" |
| 89 | + }, |
| 90 | + "canceled": { |
| 91 | + "baseName": "canceled", |
| 92 | + "type": "number", |
| 93 | + "format": "int64" |
| 94 | + }, |
| 95 | + "creatorId": { |
| 96 | + "baseName": "creator_id", |
| 97 | + "type": "number", |
| 98 | + "format": "int32" |
| 99 | + }, |
| 100 | + "disabled": { |
| 101 | + "baseName": "disabled", |
| 102 | + "type": "boolean", |
| 103 | + "format": "" |
| 104 | + }, |
| 105 | + "downtimeType": { |
| 106 | + "baseName": "downtime_type", |
| 107 | + "type": "number", |
| 108 | + "format": "int32" |
| 109 | + }, |
| 110 | + "end": { |
| 111 | + "baseName": "end", |
| 112 | + "type": "number", |
| 113 | + "format": "int64" |
| 114 | + }, |
| 115 | + "id": { |
| 116 | + "baseName": "id", |
| 117 | + "type": "number", |
| 118 | + "format": "int64" |
| 119 | + }, |
| 120 | + "message": { |
| 121 | + "baseName": "message", |
| 122 | + "type": "string", |
| 123 | + "format": "" |
| 124 | + }, |
| 125 | + "monitorId": { |
| 126 | + "baseName": "monitor_id", |
| 127 | + "type": "number", |
| 128 | + "format": "int64" |
| 129 | + }, |
| 130 | + "monitorTags": { |
| 131 | + "baseName": "monitor_tags", |
| 132 | + "type": "Array<string>", |
| 133 | + "format": "" |
| 134 | + }, |
| 135 | + "parentId": { |
| 136 | + "baseName": "parent_id", |
| 137 | + "type": "number", |
| 138 | + "format": "int64" |
| 139 | + }, |
| 140 | + "recurrence": { |
| 141 | + "baseName": "recurrence", |
| 142 | + "type": "DowntimeRecurrence", |
| 143 | + "format": "" |
| 144 | + }, |
| 145 | + "scope": { |
| 146 | + "baseName": "scope", |
| 147 | + "type": "Array<string>", |
| 148 | + "format": "" |
| 149 | + }, |
| 150 | + "start": { |
| 151 | + "baseName": "start", |
| 152 | + "type": "number", |
| 153 | + "format": "int64" |
| 154 | + }, |
| 155 | + "timezone": { |
| 156 | + "baseName": "timezone", |
| 157 | + "type": "string", |
| 158 | + "format": "" |
| 159 | + }, |
| 160 | + "updaterId": { |
| 161 | + "baseName": "updater_id", |
| 162 | + "type": "number", |
| 163 | + "format": "int32" |
| 164 | + } }; |
| 165 | + |
| 166 | + static getAttributeTypeMap() { |
| 167 | + return DowntimeChild.attributeTypeMap; |
| 168 | + } |
| 169 | + |
| 170 | + static deserialize(data: {[key: string]: any}): DowntimeChild { |
| 171 | + let res = new DowntimeChild(); |
| 172 | + |
| 173 | + res.active = ObjectSerializer.deserialize(data.active, "boolean", "") |
| 174 | + |
| 175 | + res.canceled = ObjectSerializer.deserialize(data.canceled, "number", "int64") |
| 176 | + |
| 177 | + res.creatorId = ObjectSerializer.deserialize(data.creator_id, "number", "int32") |
| 178 | + |
| 179 | + res.disabled = ObjectSerializer.deserialize(data.disabled, "boolean", "") |
| 180 | + |
| 181 | + res.downtimeType = ObjectSerializer.deserialize(data.downtime_type, "number", "int32") |
| 182 | + |
| 183 | + res.end = ObjectSerializer.deserialize(data.end, "number", "int64") |
| 184 | + |
| 185 | + res.id = ObjectSerializer.deserialize(data.id, "number", "int64") |
| 186 | + |
| 187 | + res.message = ObjectSerializer.deserialize(data.message, "string", "") |
| 188 | + |
| 189 | + res.monitorId = ObjectSerializer.deserialize(data.monitor_id, "number", "int64") |
| 190 | + |
| 191 | + res.monitorTags = ObjectSerializer.deserialize(data.monitor_tags, "Array<string>", "") |
| 192 | + |
| 193 | + res.parentId = ObjectSerializer.deserialize(data.parent_id, "number", "int64") |
| 194 | + |
| 195 | + res.recurrence = ObjectSerializer.deserialize(data.recurrence, "DowntimeRecurrence", "") |
| 196 | + |
| 197 | + res.scope = ObjectSerializer.deserialize(data.scope, "Array<string>", "") |
| 198 | + |
| 199 | + res.start = ObjectSerializer.deserialize(data.start, "number", "int64") |
| 200 | + |
| 201 | + res.timezone = ObjectSerializer.deserialize(data.timezone, "string", "") |
| 202 | + |
| 203 | + res.updaterId = ObjectSerializer.deserialize(data.updater_id, "number", "int32") |
| 204 | + |
| 205 | + |
| 206 | + return res; |
| 207 | + } |
| 208 | + |
| 209 | + static serialize(data: DowntimeChild): {[key: string]: any} { |
| 210 | + let attributeTypes = DowntimeChild.getAttributeTypeMap(); |
| 211 | + let res: {[index: string]: any} = {}; |
| 212 | + for (let [key, value] of Object.entries(data)) { |
| 213 | + if (!(key in attributeTypes)) { |
| 214 | + throw new TypeError(`${key} attribute not in schema`); |
| 215 | + } |
| 216 | + } |
| 217 | + res.active = ObjectSerializer.serialize(data.active, "boolean", "") |
| 218 | + |
| 219 | + res.canceled = ObjectSerializer.serialize(data.canceled, "number", "int64") |
| 220 | + |
| 221 | + res.creator_id = ObjectSerializer.serialize(data.creatorId, "number", "int32") |
| 222 | + |
| 223 | + res.disabled = ObjectSerializer.serialize(data.disabled, "boolean", "") |
| 224 | + |
| 225 | + res.downtime_type = ObjectSerializer.serialize(data.downtimeType, "number", "int32") |
| 226 | + |
| 227 | + res.end = ObjectSerializer.serialize(data.end, "number", "int64") |
| 228 | + |
| 229 | + res.id = ObjectSerializer.serialize(data.id, "number", "int64") |
| 230 | + |
| 231 | + res.message = ObjectSerializer.serialize(data.message, "string", "") |
| 232 | + |
| 233 | + res.monitor_id = ObjectSerializer.serialize(data.monitorId, "number", "int64") |
| 234 | + |
| 235 | + res.monitor_tags = ObjectSerializer.serialize(data.monitorTags, "Array<string>", "") |
| 236 | + |
| 237 | + res.parent_id = ObjectSerializer.serialize(data.parentId, "number", "int64") |
| 238 | + |
| 239 | + res.recurrence = ObjectSerializer.serialize(data.recurrence, "DowntimeRecurrence", "") |
| 240 | + |
| 241 | + res.scope = ObjectSerializer.serialize(data.scope, "Array<string>", "") |
| 242 | + |
| 243 | + res.start = ObjectSerializer.serialize(data.start, "number", "int64") |
| 244 | + |
| 245 | + res.timezone = ObjectSerializer.serialize(data.timezone, "string", "") |
| 246 | + |
| 247 | + res.updater_id = ObjectSerializer.serialize(data.updaterId, "number", "int32") |
| 248 | + |
| 249 | + return res |
| 250 | + } |
| 251 | + |
| 252 | + public constructor() { |
| 253 | + } |
| 254 | +} |
| 255 | + |
| 256 | + |
| 257 | + |
0 commit comments