diff --git a/server/@types/pingdom.d.ts b/server/@types/pingdom.d.ts new file mode 100644 index 00000000..8291e33b --- /dev/null +++ b/server/@types/pingdom.d.ts @@ -0,0 +1,4205 @@ +/** + * This file was auto-generated by openapi-typescript. + * Do not make direct changes to the file. + */ + +/** WithRequired type helpers */ +type WithRequired = T & { [P in K]-?: T[P] } + +/** OneOf type helpers */ +type Without = { [P in Exclude]?: never } +type XOR = T | U extends object ? (Without & U) | (Without & T) : T | U +type OneOf[]> = T extends [infer Only] + ? Only + : T extends [infer A, infer B, ...infer Rest] + ? OneOf<[XOR, ...Rest]> + : never + +export interface paths { + '/actions': { + /** + * Returns a list of actions alerts. + * @description Returns a list of actions (alerts) that have been generated for your account. + */ + get: { + parameters: { + query?: { + /** @description Only include actions generated later than this timestamp. Format is UNIX time. */ + from?: components['schemas']['actions_from'] + /** @description Only include actions generated prior to this timestamp. Format is UNIX time. */ + to?: components['schemas']['actions_to'] + /** @description Limits the number of returned results to the specified quantity. */ + limit?: components['schemas']['actions_limit'] + /** @description Offset for listing. */ + offset?: components['schemas']['actions_offset'] + /** @description Comma-separated list of check identifiers. Limit results to actions generated from these checks. Default: all checks. */ + checkids?: components['schemas']['actions_checkids'] + /** @description Comma-separated list of user identifiers. Limit results to actions sent to these users. Default: all users. */ + userids?: components['schemas']['actions_userids'] + /** @description Comma-separated list of statuses. Limit results to actions with these statuses. Default: all statuses. */ + status?: components['schemas']['actions_status'] + /** @description Comma-separated list of via mediums. Limit results to actions with these mediums. Default: all mediums. */ + via?: components['schemas']['actions_via'] + } + } + responses: { + /** @description Successful HTTP Response */ + 200: { + content: { + 'application/json': components['schemas']['actions_alerts_entry'] + } + } + } + } + } + '/analysis/{checkid}': { + /** + * Returns a list of the latest root cause analysis + * @description Returns a list of the latest root cause analysis results for a specified check. + */ + get: { + parameters: { + query?: { + /** @description Limits the number of returned results to the specified quantity. */ + limit?: components['schemas']['analysis_limit'] + /** @description Offset for listing. (Requires limit.) */ + offset?: components['schemas']['analysis_offset'] + /** @description Return only results with timestamp of first test greater or equal to this value. Format is UNIX timestamp. */ + from?: components['schemas']['analysis_from'] + /** @description Return only results with timestamp of first test less or equal to this value. Format is UNIX timestamp. Default: current timestamp */ + to?: components['schemas']['analysis_to'] + } + path: { + checkid: components['schemas']['analysis_checkid'] + } + } + responses: { + /** @description Successful HTTP Response */ + 200: { + content: { + 'application/json': components['schemas']['analysis_resp_attrs'] + } + } + } + } + } + '/analysis/{checkid}/{analysisid}': { + /** + * Returns the raw result for a specified analysis. + * @description Returns the raw result for a specified error analysis. This data is primarily intended for internal use, but you might be interested in it as well. However, there is no real documentation for this data at the moment. In the future, we may add a new API method that provides a more user-friendly format. + */ + get: { + parameters: { + path: { + checkid: components['schemas']['analysis_checkid'] + analysisid: components['schemas']['analysis_analysisid'] + } + } + responses: { + /** @description Successful HTTP Response */ + 200: { + content: never + } + } + } + } + '/checks': { + /** @description Returns a list overview of all checks. */ + get: { + parameters: { + query?: { + /** + * @description Limits the number of returned probes to the specified quantity. (Max value is 25000) + * @example 3 + */ + limit?: number + /** + * @description Offset for listing. (Requires limit.) + * @example 0 + */ + offset?: number + /** + * @description If set, show encryption setting for each check + * @example false + */ + showencryption?: boolean + /** + * @description Include tag list for each check. Tags can be marked as "a" or "u", for auto tagged or user tagged. + * @example false + */ + include_tags?: boolean + /** + * @description Include severity level for each check. + * @example false + */ + include_severity?: boolean + /** + * @description Tag list separated by commas. As an example "nginx,apache" would filter out all responses except those tagged nginx or apache + * @example nginx,apache,ssh + */ + tags?: string + } + } + responses: { + /** @description Successful operation */ + 200: { + content: { + 'application/json': components['schemas']['Checks'] + } + } + } + } + /** + * Pause or change resolution for multiple checks. + * @description Pause or change resolution for multiple checks in one bulk call. + */ + put: { + requestBody: { + content: { + /** + * @example { + * "paused": true, + * "resolution": 1 + * } + */ + 'application/json': { + /** @description Use value: true to pause the check(s) and value: false to unpause it(them). */ + paused?: boolean + /** @enum {integer} */ + resolution?: 1 | 5 | 15 | 30 | 60 + /** @description Comma-separated list of identifiers for checks to be modified. Invalid check identifiers will be ignored. Default: all checks */ + checkids?: string + } + /** + * @example { + * "paused": true, + * "resolution": 1 + * } + */ + 'application/x-www-form-urlencoded': { + /** @description Use value: true to pause the check(s) and value: false to unpause it(them). */ + paused?: boolean + /** @enum {integer} */ + resolution?: 1 | 5 | 15 | 30 | 60 + /** @description Comma-separated list of identifiers for checks to be modified. Invalid check identifiers will be ignored. Default: all checks */ + checkids?: string + } + } + } + responses: { + /** @description Successful operation */ + 200: { + content: { + 'application/json': { + /** @example Modification of 4 checks was successful! */ + message?: string + } + } + } + } + } + /** + * Creates a new check. + * @description Creates a new check with settings specified by provided parameters. + */ + post: { + requestBody: { + content: { + /** + * @example { + * "name": "check_google", + * "host": "www.google.com", + * "type": "http" + * } + */ + 'application/json': components['schemas']['CreateCheck'] + /** + * @example { + * "name": "check_google", + * "host": "www.google.com", + * "type": "http" + * } + */ + 'application/x-www-form-urlencoded': components['schemas']['CreateCheck'] + } + } + responses: { + /** @description Successful operation */ + 200: { + content: { + 'application/json': { + check?: { + /** + * @description Created check ID. + * @example 138631 + */ + id?: number + /** + * @description Created check name. + * @example My new HTTP check + */ + name?: string + } + } + } + } + } + } + /** + * Deletes a list of checks. + * @description Deletes a list of checks. THIS METHOD IS IRREVERSIBLE! You will lose all collected data. Be careful! + */ + delete: { + parameters: { + query: { + /** + * @description Comma-separated list of identifiers for checks to be deleted. + * @example [ + * 1, + * 2, + * 3 + * ] + */ + delcheckids: number[] + } + } + requestBody: { + content: { + /** + * @example { + * "delcheckids": "1,2,3" + * } + */ + 'application/json': string + } + } + responses: { + /** @description Successful operation */ + 200: { + content: { + 'application/json': { + /** @example Deletion of checks was successful! */ + message?: string + } + } + } + } + } + } + '/checks/{checkid}': { + /** + * Returns a detailed description of a check. + * @description Returns a detailed description of a specified check. + */ + get: { + parameters: { + query?: { + /** @description Include team connections for check. */ + include_teams?: boolean + } + path: { + /** @description Identifier of check to be retrieved */ + checkid: number + } + } + responses: { + /** @description Successful operation */ + 200: { + content: { + 'application/json': components['schemas']['DetailedCheck'] + } + } + } + } + /** + * Modify settings for a check. + * @description Modify settings for a check. The provided settings will overwrite previous values. Settings not provided will stay the same as before the update. To clear an existing value, provide an empty value. Please note that you cannot change the type of a check once it has been created. + */ + put: { + parameters: { + path: { + /** @description Identifier of check to be updated */ + checkid: number + } + } + requestBody: { + content: { + /** + * @example { + * "name": "google_check", + * "host": "www.google.com", + * "paused": false + * } + */ + 'application/json': components['schemas']['ModifyCheckSettings'] + /** + * @example { + * "name": "google_check", + * "host": "www.google.com", + * "paused": false + * } + */ + 'application/x-www-form-urlencoded': components['schemas']['ModifyCheckSettings'] + } + } + responses: { + /** @description Successful operation */ + 200: { + content: { + 'application/json': { + /** @example Modification of check was successful! */ + message?: string + } + } + } + } + } + /** + * Deletes a check. + * @description Deletes a check. THIS METHOD IS IRREVERSIBLE! You will lose all collected data. Be careful! + */ + delete: { + parameters: { + path: { + /** @description Identifier of check to be deleted */ + checkid: number + } + } + responses: { + /** @description Successful operation */ + 200: { + content: { + 'application/json': { + /** @example Deletion of check was successful! */ + message?: string + } + } + } + } + } + } + '/credits': { + /** + * Returns information about remaining credits + * @description Returns information about remaining checks, SMS credits and SMS auto-refill status. + */ + get: { + responses: { + /** @description Successful HTTP Response */ + 200: { + content: { + 'application/json': components['schemas']['credits_resp_attrs'] + } + } + } + } + } + '/maintenance': { + /** @description Returns a list of user's maintenance windows. */ + get: { + parameters: { + query?: { + /** @description Count of items to list. */ + limit?: components['schemas']['maintenance_limit'] + /** @description Offset of the list. */ + offset?: components['schemas']['maintenance_offset'] + /** @description Order by the specific property of the maintenance window. */ + orderby?: components['schemas']['maintenance_orderby'] + /** @description Order a-z for asc z-a for desc. Works only if orderby is specified. */ + order?: components['schemas']['maintenance_order'] + } + } + responses: { + /** @description Successful HTTP Response */ + 200: { + content: { + 'application/json': components['schemas']['maintenance_resp_attrs'] + } + } + } + } + /** @description Create new maintenance window. */ + post: { + /** @description Description */ + requestBody: { + content: { + /** + * @example { + * "description": "Some description of the maintenance window", + * "from": 1569580215, + * "to": 1569583815 + * } + */ + 'application/json': components['schemas']['maintenance_post'] + /** + * @example { + * "description": "Some description of the maintenance window", + * "from": 1569580215, + * "to": 1569583815 + * } + */ + 'application/x-www-form-urlencoded': components['schemas']['maintenance_post'] + } + } + responses: { + /** @description Successful HTTP Response */ + 200: { + content: { + 'application/json': components['schemas']['maintenance_post_resp_attrs'] + } + } + } + } + /** + * Delete multiple maintenance windows. + * @description Delete multiple maintenance windows. Note that only future maintenance windows can be deleted. + */ + delete: { + parameters: { + query: { + /** + * @description Comma-separated list of identifiers of maintenance windows to be deleted. + * @example [ + * 1, + * 2, + * 3, + * 4, + * 5 + * ] + */ + maintenanceids: number[] + } + } + responses: { + /** @description Successful HTTP Response */ + 200: { + content: { + 'application/json': components['schemas']['maintenance_delete_resp_attrs'] + } + } + } + } + } + '/maintenance/{id}': { + /** @description Returns the maintenance window specified by its id. */ + get: { + parameters: { + path: { + /** + * @description id of maintenance window + * @example 3 + */ + id: components['schemas']['maintenance_id'] + } + } + responses: { + /** @description Successful HTTP Response */ + 200: { + content: { + 'application/json': components['schemas']['maintenance_id_resp_attrs'] + } + } + } + } + /** @description Modify the maintenance window. */ + put: { + parameters: { + path: { + /** + * @description id of maintenance window + * @example 3 + */ + id: components['schemas']['maintenance_id'] + } + } + /** @description Description */ + requestBody: { + content: { + /** + * @example { + * "description": "Modified maintenance window", + * "from": 1569580215, + * "to": 1569583815 + * } + */ + 'application/json': components['schemas']['maintenance_id_put'] + /** + * @example { + * "description": "Modified maintenance window", + * "from": 1569580215, + * "to": 1569583815 + * } + */ + 'application/x-www-form-urlencoded': components['schemas']['maintenance_id_put'] + } + } + responses: { + /** @description Successful HTTP Response */ + 200: { + content: { + 'application/json': components['schemas']['maintenance_id_put_resp_attrs'] + } + } + } + } + /** + * Delete the maintenance window. + * @description Delete the maintenance window. Note that only future maintenance window can be deleted. + */ + delete: { + parameters: { + path: { + /** + * @description id of maintenance window + * @example 3 + */ + id: components['schemas']['maintenance_id'] + } + } + responses: { + /** @description Successful HTTP Response */ + 200: { + content: { + 'application/json': components['schemas']['maintenance_id_delete_resp_attrs'] + } + } + } + } + } + '/maintenance.occurrences/{id}': { + /** + * Gets a maintenance occurrence details + * @description Gets a maintenance occurrence details specified by its identifier. + */ + get: { + parameters: { + path: { + id: components['schemas']['maintenance.occurrences_id'] + } + } + responses: { + /** @description Successful HTTP Response */ + 200: { + content: { + 'application/json': components['schemas']['maintenance.occurrences_id_resp_attrs'] + } + } + } + } + /** + * Modifies a maintenance occurrence + * @description Modifies a maintenance occurrence specified by its identifier. + */ + put: { + parameters: { + path: { + id: components['schemas']['maintenance.occurrences_id'] + } + } + requestBody: { + content: { + /** + * @example { + * "from": 1569580215, + * "to": 1569583815 + * } + */ + 'application/json': components['schemas']['maintenance.occurrences_id_put'] + /** + * @example { + * "from": 1569580215, + * "to": 1569583815 + * } + */ + 'application/x-www-form-urlencoded': components['schemas']['maintenance.occurrences_id_put'] + } + } + responses: { + /** @description Successful HTTP Response */ + 200: { + content: { + 'application/json': components['schemas']['maintenance.occurrences_id_put_resp_attrs'] + } + } + } + } + /** + * Deletes the maintenance occurrence + * @description Deletes the maintenance occurrence specified by its identifier. Note that only future occurrences can be deleted. + */ + delete: { + parameters: { + path: { + id: components['schemas']['maintenance.occurrences_id'] + } + } + responses: { + /** @description Successful HTTP Response */ + 200: { + content: { + 'application/json': components['schemas']['maintenance.occurrences_id_delete_resp_attrs'] + } + } + } + } + } + '/maintenance.occurrences': { + /** + * Returns a list of maintenance occurrences. + * @description Returns a list of maintenance occurrences. + */ + get: { + parameters: { + query?: { + /** @description Maintenance window identifier. (List only occurrences of a specific maintenance window.) */ + maintenanceid?: components['schemas']['maintenance.occurrences_maintenanceid'] + /** @description Effective from (unix timestamp). (List occurrences which are effective from the specified unix timestamp. If not specified, current timestamp is used.) */ + from?: components['schemas']['maintenance.occurrences_from'] + /** @description Effective to (unix timestamp). (List occurrences which are effective to the specified unix timestamp.) */ + to?: components['schemas']['maintenance.occurrences_to'] + } + } + responses: { + /** @description Successful HTTP Response */ + 200: { + content: { + 'application/json': components['schemas']['maintenance.occurrences_resp_attrs'] + } + } + } + } + /** + * Deletes multiple maintenance occurrences + * @description Deletes multiple maintenance occurrences specified by their identifiers. Note that only future occurrences can be deleted. + */ + delete: { + parameters: { + query: { + /** + * @example [ + * 1, + * 2, + * 3, + * 4, + * 5 + * ] + */ + occurenceids: components['schemas']['maintenance.occurrences_delete'] + } + } + responses: { + /** @description Successful HTTP Response */ + 200: { + content: { + 'application/json': components['schemas']['maintenance.occurrences_delete_resp_attrs'] + } + } + } + } + } + '/probes': { + /** + * Returns a list of Pingdom probe servers + * @description Returns a list of all Pingdom probe servers for Uptime and Transaction checks. + */ + get: { + parameters: { + query?: { + /** + * @description Limits the number of returned probes to the specified quantity. + * @example 3 + */ + limit?: number + /** + * @description Offset for listing. (Requires limit.) + * @example 0 + */ + offset?: number + /** + * @description Return only active probes. + * @example false + */ + onlyactive?: boolean + /** + * @description Include old probes that are no longer in use. + * @example false + */ + includedeleted?: boolean + } + } + responses: { + /** @description Successful operation */ + 200: { + content: { + 'application/json': components['schemas']['Probes'] + } + } + } + } + } + '/reference': { + /** + * Get regions, timezone and date/time/number references + * @description Get a reference of regions, timezones and date/time/number formats and their identifiers. + */ + get: { + responses: { + /** @description Successful operation */ + 200: { + content: { + 'application/json': components['schemas']['References'] + } + } + } + } + } + '/results/{checkid}': { + /** + * Return a list of raw test results + * @description Return a list of raw test results for a specified check + */ + get: { + parameters: { + query?: { + /** @description End of period. Format is UNIX timestamp. Default value is current timestamp. */ + to?: components['schemas']['results_to'] + /** @description Start of period. Format is UNIX timestamp. Default value is 1 day prior to `to`. */ + from?: components['schemas']['results_from'] + /** @description Filter to only show results from a list of probes. Format is a comma separated list of probe identifiers */ + probes?: components['schemas']['results_probes'] + /** @description Filter to only show results with specified statuses. Format is a comma separated list of (`down`, `up`, `unconfirmed`, `unknown`) */ + status?: components['schemas']['results_status'] + /** @description Number of results to show (Will be set to 1000 if the provided value is greater than 1000) */ + limit?: components['schemas']['results_limit'] + /** @description Number of results to skip (Max value is `43200`) */ + offset?: components['schemas']['results_offset'] + /** @description Attach available root cause analysis identifiers to corresponding results */ + includeanalysis?: components['schemas']['results_includeanalysis'] + /** @description Maximum response time (ms). If set, specified interval must not be larger than 31 days. */ + maxresponse?: components['schemas']['results_maxresponse'] + /** @description Minimum response time (ms). If set, specified interval must not be larger than 31 days. */ + minresponse?: components['schemas']['results_minresponse'] + } + path: { + checkid: components['schemas']['results_checkid'] + } + } + responses: { + /** @description Successful HTTP Response */ + 200: { + content: { + 'application/json': components['schemas']['results_resp_attrs'] + } + } + } + } + } + '/single': { + /** + * Performs a single check. + * @description Performs a single test using a specified Pingdom probe against a specified target. Please note that this method is meant to be used sparingly, not to set up your own monitoring solution. + */ + get: { + parameters: { + query?: { + /** @description Query Parameters to chose */ + 'Query Parameters'?: + | components['schemas']['HTTP'] + | components['schemas']['HTTP-Custom'] + | components['schemas']['TCP'] + | components['schemas']['DNS'] + | components['schemas']['UDP'] + | components['schemas']['SMTP'] + | components['schemas']['POP3'] + | components['schemas']['IMAP'] + } + } + responses: { + /** @description Successful operation */ + 200: { + content: { + 'application/json': components['schemas']['single_resp'] + } + } + } + } + } + '/summary.average/{checkid}': { + /** + * Get the average time/uptime value for a specified + * @description Get the average time / uptime value for a specified check and time period. + */ + get: { + parameters: { + query?: { + /** @description Start time of period. Format is UNIX timestamp */ + from?: components['schemas']['summary.average_from'] + /** @description End time of period. Format is UNIX timestamp. Default is the current time */ + to?: components['schemas']['summary.average_to'] + /** @description Filter to only use results from a list of probes. Format is a comma separated list of probe identifiers. By default result from all probes are shown. */ + probes?: components['schemas']['summary.average_probes'] + /** @description Include uptime information */ + includeuptime?: components['schemas']['summary.average_includeuptime'] + /** @description Split response times into country groups */ + bycountry?: components['schemas']['summary.average_bycountry'] + /** @description Split response times into probe groups */ + byprobe?: components['schemas']['summary.average_byprobe'] + } + path: { + checkid: components['schemas']['summary.average_checkid'] + } + } + responses: { + /** @description Successful HTTP Response */ + 200: { + content: { + 'application/json': components['schemas']['summary_resp_attrs'] + } + } + } + } + } + '/summary.hoursofday/{checkid}': { + /** + * Returns the average response time for each hour. + * @description Returns the average response time for each hour of the day (0-23) for a specific check over a selected time period. I.e. it shows you what an average day looks like during that time period. + */ + get: { + parameters: { + query?: { + /** @description Start time of period. Format is UNIX timestamp. Default value is one week eariler than `to`. */ + from?: components['schemas']['summary.hoursofday_from'] + /** @description End time of period. Format is UNIX timestamp. Default value is current time. */ + to?: components['schemas']['summary.hoursofday_to'] + /** @description Filter to only use results from a list of probes. Format is a comma separated list of probe identifiers. By default all probes results are returned. */ + probes?: components['schemas']['summary.hoursofday_probes'] + /** @description If true, use the user's local time zone for results (from and to parameters should still be specified in UTC). If false, use UTC for results. */ + uselocaltime?: components['schemas']['summary.hoursofday_uselocaltime'] + } + path: { + checkid: components['schemas']['summary.hoursofday_checkid'] + } + } + responses: { + /** @description Successful HTTP Response */ + 200: { + content: { + 'application/json': components['schemas']['summary.hoursofday_resp_attrs'] + } + } + } + } + } + '/summary.outage/{checkid}': { + /** + * Get a list of status changes for a specified check + * @description Get a list of status changes for a specified check and time period. If order is speficied to descending, the list is ordered by newest first. (Default is ordered by oldest first.) + */ + get: { + parameters: { + query?: { + /** @description Start time of period. Format is UNIX timestamp. Default value is one week earlier than `to`. */ + from?: components['schemas']['summary.outage_from'] + /** @description End time of period. Format is UNIX timestamp. Default value is the current time. */ + to?: components['schemas']['summary.outage_to'] + /** @description Sorting order of outages. Ascending or descending. */ + order?: components['schemas']['summary.outage_order'] + } + path: { + checkid: components['schemas']['summary.outage_checkid'] + } + } + responses: { + /** @description Successful HTTP Response */ + 200: { + content: { + 'application/json': components['schemas']['summary.outage_resp_attrs'] + } + } + } + } + } + '/summary.performance/{checkid}': { + /** + * For a given interval return a list of subintervals + * @description For a given interval in time, return a list of sub intervals with the given resolution. Useful for generating graphs. A sub interval may be a week, a day or an hour depending on the choosen resolution. + */ + get: { + parameters: { + query?: { + /** @description Start time of period. Format is UNIX timestamp. Default value is 10 intervals earlier than `to`. */ + from?: components['schemas']['summary.performance_from'] + /** @description End time of period. Format is UNIX timestamp. Default value is the current time. */ + to?: components['schemas']['summary.performance_to'] + /** @description Interval size */ + resolution?: components['schemas']['summary.performance_resolution'] + /** @description Include uptime information. */ + includeuptime?: components['schemas']['summary.performance_includeuptime'] + /** @description Filter to only use results from a list of probes. Format is a comma separated list of probe identifiers. Can not be used if includeuptime is set to true. Also note that this can cause intervals to be omitted, since there may be no results from the desired probes in them. By deafult results from all probes are returned. */ + probes?: components['schemas']['summary.performance_probes'] + /** @description Sorting order of sub intervals. Ascending or descending. */ + order?: components['schemas']['summary.performance_order'] + } + path: { + checkid: components['schemas']['summary.performance_checkid'] + } + } + responses: { + /** @description Successful HTTP Response */ + 200: { + content: { + 'application/json': components['schemas']['summary.performance_resp_attrs'] + } + } + } + } + } + '/summary.probes/{checkid}': { + /** + * Get a list of probes that performed tests + * @description Get a list of probes that performed tests for a specified check during a specified period. + */ + get: { + parameters: { + query: { + /** @description Start time of period. Format is UNIX timestamp */ + from: components['schemas']['summary.probes_from'] + /** @description End time of period. Format is UNIX timestamp. The defualt value is current time. */ + to?: components['schemas']['summary.probes_to'] + } + path: { + checkid: components['schemas']['summary.probes_checkid'] + } + } + responses: { + /** @description Successful HTTP Response */ + 200: { + content: { + 'application/json': components['schemas']['summary.probes_resp_attrs'] + } + } + } + } + } + '/alerting/teams': { + /** @description Returns a list of all teams and their members */ + get: { + responses: { + /** @description Successful operation */ + 200: { + content: { + 'application/json': components['schemas']['Teams'] + } + } + } + } + /** + * Creates a new team + * @description Creates a new team with or without members + */ + post: { + requestBody: { + content: { + 'application/json': components['schemas']['CreateTeam'] + } + } + responses: { + /** @description Successful operation */ + 200: { + content: { + 'application/json': { + team?: { + /** + * @description ID of the created team + * @example 12345678 + */ + id?: string + } + } + } + } + } + } + } + '/alerting/teams/{teamid}': { + /** @description Returns a team with its members */ + get: { + parameters: { + path: { + /** @description ID of the team to be retrieved */ + teamid: number + } + } + responses: { + /** @description Successful operation */ + 200: { + content: { + 'application/json': components['schemas']['Team_ID'] + } + } + } + } + /** @description Updates a team */ + put: { + parameters: { + path: { + /** @description ID of the team to be retrieved */ + teamid: number + } + } + requestBody: { + content: { + 'application/json': components['schemas']['UpdateTeam'] + } + } + responses: { + /** @description Successful operation */ + 200: { + content: { + 'application/json': components['schemas']['Team_ID'] + } + } + } + } + /** @description Deletes a team */ + delete: { + parameters: { + path: { + /** @description ID of the team to be deleted */ + teamid: number + } + } + responses: { + /** @description Message indicating a successful deletion */ + 200: { + content: { + 'application/json': { + /** @example Deletion of team 12345 was successful. */ + message?: string + } + } + } + } + } + } + '/alerting/contacts': { + /** + * Returns a list of all contacts + * @description Returns a list of all contacts with their contact methods (notification targets) + */ + get: { + responses: { + /** @description Successful operation */ + 200: { + content: { + 'application/json': components['schemas']['ContactsList'] + } + } + } + } + /** + * Creates a new contact + * @description Creates a new contact with at least one contact method (notification target) + */ + post: { + requestBody: { + content: { + 'application/json': components['schemas']['CreateContact'] + } + } + responses: { + /** @description Successful operation */ + 200: { + content: { + 'application/json': { + contact?: { + /** + * @description ID of the created contact + * @example 12345678 + */ + id?: string + } + } + } + } + } + } + } + '/alerting/contacts/{contactid}': { + /** + * Returns a contact with its contact methods + * @description Returns a contact with its contact methods (notification targets) + */ + get: { + parameters: { + path: { + /** @description ID of contact to be retrieved */ + contactid: number + } + } + responses: { + /** @description Successful operation */ + 200: { + content: { + 'application/json': components['schemas']['Contact'] + } + } + } + } + /** + * Update a contact + * @description Update a contact with at least one contact method (notification target) + */ + put: { + parameters: { + path: { + /** @description ID of contact to be updated */ + contactid: number + } + } + requestBody: { + content: { + 'application/json': components['schemas']['UpdateContact'] + } + } + responses: { + /** @description Successful operation */ + 200: { + content: { + 'application/json': components['schemas']['Contact'] + } + } + } + } + /** + * Deletes a contact with its contact methods + * @description Deletes a contact with its contact methods (notification targets) + */ + delete: { + parameters: { + path: { + /** @description ID of contact to be deleted */ + contactid: number + } + } + responses: { + /** @description Successful operation */ + 200: { + content: { + 'application/json': { + /** @example Deletion of contact 12345 was successful */ + message?: string + } + } + } + } + } + } + '/traceroute': { + /** + * Perform a traceroute + * @description Perform a traceroute to a specified target from a specified Pingdom probe. + */ + get: { + parameters: { + query: { + /** + * @description Target host. + * @example pingdom.com + */ + host: string + /** + * @description Probe identifier. + * @example 23 + */ + probeid?: number + } + } + responses: { + /** @description Successful operation */ + 200: { + content: { + 'application/json': components['schemas']['Traceroute'] + } + } + } + } + } + '/tms/check': { + /** Returns a list overview of all transaction checks. */ + get: operations['getAllChecks'] + /** Creates a new transaction check. */ + post: operations['addCheck'] + } + '/tms/check/{cid}': { + /** Returns a single transaction check. */ + get: operations['getCheck'] + /** Modify settings for transaction check. */ + put: operations['modifyCheck'] + /** Deletes a transaction check. */ + delete: operations['deleteCheck'] + } + '/tms/check/{check_id}/report/status': { + /** + * Returns a status change report for a single transaction check + * @description Get a list of status changes for a specified check and time period. If order is speficied to descending, the list is ordered by newest first. (The default is ordered by oldest first.) It can be used to display a detailed view of a check. + */ + get: operations['getCheckReportStatus'] + } + '/tms/check/report/status': { + /** + * Returns a status change report for all transaction checks in the current organization + * @description Get a list of status changes for all transaction check in the current organization from the requested time period. If order is speficied to descending, the list of statuses within each check is ordered by newest first. (The default is ordered by oldest first.) It can be used to display a list view of all checks and their current status. + */ + get: operations['getCheckReportStatusAll'] + } + '/tms/check/{check_id}/report/performance': { + /** + * Returns a performance report for a single transaction check + * @description For a given period of time, return a list of time intervals with the given resolution. An interval may be a week, a day or an hour depending on the chosen resolution. It can be used to display a detailed view of a check with information about its steps and generate graphs. + */ + get: operations['getCheckReportPerformance'] + } +} + +export type webhooks = Record + +export interface components { + schemas: { + actions_from: number + actions_to: number + /** @default 100 */ + actions_limit: number + /** @default 0 */ + actions_offset: number + actions_checkids: string + actions_userids: string + actions_status: string + actions_via: string + actions_alerts_entry: { + actions?: { + /** @description Alert entry */ + alerts?: { + /** + * @description Name of alerted user + * @example John Doe + */ + username?: string + /** + * @description Identifier of alerted user + * @example 111250 + */ + userid?: string + /** + * @description Identifier of alerted user + * @example 241688 + */ + checkid?: string + /** + * @description Time of alert generation. Format UNIX time + * @example 1292248276 + */ + time?: string + /** + * @description Alert medium. apns - iphone, agcm - android + * @example sms + * @enum {string} + */ + via?: 'email' | 'sms' | 'twitter' | 'apns' | 'agcm' + /** + * @description Alert status + * @example delivered + * @enum {string} + */ + status?: 'sent' | 'delivered' | 'error' | 'notdelivered' | 'nocredits' + /** + * @description Short description of message + * @example up + */ + messageshort?: string + /** + * @description Full message body + * @example PingdomAlert UP: MyCheck (example.com) is UP again at 2010-12-13 14:50:54. Downtime: 12m. + */ + messagefull?: string + /** + * @description Target address, phone number etc + * @example 46-555555 + */ + sentto?: string + /** + * @description True if your account was charged for this message + * @example true + */ + charged?: string + }[] + } + } + analysis_checkid: number + analysis_analysisid: number + /** @default 100 */ + analysis_limit: number + /** @default 0 */ + analysis_offset: number + /** @default 0 */ + analysis_from: number + analysis_to: number + analysis_resp_attrs: { + analysis?: { + /** + * @description Analysis id + * @example 28739021 + */ + id?: number + /** + * @description Time of test that initiated the confirmation test + * @example 1290441826 + */ + timefirsttest?: number + /** + * @description Time of the confirmation test that performed the error analysis + * @example 1290441865 + */ + timeconfirmtest?: number + }[] + } + Tag: { + /** @example apache */ + name?: string + /** @example a */ + type?: string + /** @example 2 */ + count?: number + } + Check: { + /** @example 100 */ + id?: number + /** @example mycheck */ + name?: string + /** + * @description Timestamp of last error (if any). Format is UNIX timestamp + * @example 1297446423 + */ + lasterrortime?: number + /** + * @description Timestamp of last test (if any). Format is UNIX timestamp + * @example 1300977363 + */ + lasttesttime?: number + /** + * @description Response time (in milliseconds) of last test. + * @example 355 + */ + lastresponsetime?: number + /** + * @description Timestamp of start of last check down (if any). Format is UNIX timestamp. + * @example 1300977363 + */ + lastdownstart?: number + /** + * @description Timestamp of end of last check down (if any). Format is UNIX timestamp. During a downtime it will be lasttesttime. + * @example 1300977463 + */ + lastdownend?: number + /** @enum {string} */ + status?: 'up' | 'down' | 'unconfirmed_down' | 'unknown' | 'paused' + /** @description How often should the check be tested? (minutes) */ + resolution?: number + /** @description Target host */ + hostname?: string + /** @description Creating time. Format is UNIX timestamp */ + created?: number + /** @description List of tags for check */ + tags?: components['schemas']['Tag'][] + /** @description Use ipv6 instead of ipv4 */ + ipv6?: boolean + } + CheckWithStringType: { + /** @example http */ + type?: string + } & components['schemas']['Check'] + Counts: { + /** + * @description Total number of checks + * @example 55 + */ + total?: number + /** + * @description Number of checks after tags filter was applied + * @example 3 + */ + limited?: number + /** + * @description Number of checks after limit was applied + * @example 5 + */ + filtered?: number + } + Checks: { + checks?: components['schemas']['CheckWithStringType'][] + counts?: components['schemas']['Counts'] + } + HttpCertificateAttributes: { + /** + * @description Treat target site as down if an invalid/unverifiable certificate is found. + * @default true + */ + verify_certificate?: boolean + /** + * @description Treat the target site as down if a certificate expires within the given number of days. This parameter will be ignored if `verify_certificate` is set to `false`. + * @default 0 + */ + ssl_down_days_before?: number + } + HttpAttributesBase: { + /** + * @description Path to target on server + * @example my.pingdom.com + */ + url?: string + /** + * @description Connection encryption + * @example true + */ + encryption?: boolean + /** + * @description Target port + * @example 443 + */ + port?: number + /** + * @description Target site should contain this string. Note! This parameter cannot be used together with the parameter “shouldnotcontain”, use only one of them in your request. + * @example Expected string + */ + shouldcontain?: string + /** + * @description Target site should NOT contain this string. Note! This parameter cannot be used together with the parameter “shouldcontain”, use only one of them in your request. + * @example This should not appear on checked site + */ + shouldnotcontain?: string + /** + * @description Data that should be posted to the web page, for example submission data for a sign-up or login form. The data needs to be formatted in the same way as a web browser would send it to the web server + * @example Data to be send to server + */ + postdata?: string + /** @description Custom HTTP header. The entry value should contain a one-element string array. The element should contain `headerName` and `headerValue` colon-separated. To add more than one header send other parameters named `requestheaders{number}`. */ + requestheaders?: string[] + /** + * @description Treat target site as down if an invalid/unverifiable certificate is found. + * @default true + */ + verify_certificate?: boolean + /** + * @description Treat the target site as down if a certificate expires within the given number of days. This parameter will be ignored if `verify_certificate` is set to `false`. It will appear provided `verify_certificate` is true and `ssl_down_days_before` value is greater than or equals 1. + * @default 0 + */ + ssl_down_days_before?: number + } + HttpAttributesSet: { + /** + * @description Username and password, colon separated. + * @example User:e4gh51! + */ + auth?: string + } & components['schemas']['HttpAttributesBase'] + HttpAttributesGet: { + /** + * @description Username for target HTTP authentication + * @example User + */ + username?: string + /** + * @description Password for target HTTP authentication + * @example e4gh51! + */ + password?: string + } & components['schemas']['HttpAttributesBase'] + DetailedHttpAttributes: { + type?: { + http?: components['schemas']['HttpAttributesGet'] + } + } + HttpCustomAttributes: WithRequired< + { + /** + * @description Path to target on server + * @example /phpMyAdmin.conf + */ + url: string + /** + * @description Connection encryption + * @example false + */ + encryption?: boolean + /** + * @description Target port + * @example 80 + */ + port?: number + /** @description Full URL (including hostname) to target additional XML file */ + additionalurls?: string + } & components['schemas']['HttpCertificateAttributes'], + 'url' + > + DetailedHttpCustomAttributes: { + type?: { + httpcustom?: components['schemas']['HttpCustomAttributes'] + } + } + TcpAttributes: { + /** + * @description Target port + * @example 22 + */ + port: number + /** + * @description String to send + * @example Raw data to be send + */ + stringtosend?: string + /** + * @description String to expect in response + * @example Raw data expected to be received + */ + stringtoexpect?: string + } + DetailedTcpAttributes: { + type?: { + tcp?: components['schemas']['TcpAttributes'] + } + } + DnsAttributes: { + /** + * @description DNS server to use + * @example 8.8.8.8 + */ + nameserver: string + /** + * @description Expected IP + * @example 104.20.90.241 + */ + expectedip: string + } + DetailedDnsAttributes: { + type?: { + dns?: components['schemas']['DnsAttributes'] + } + } + UdpAttributes: { + /** + * @description Target port + * @example 53 + */ + port: number + /** + * @description String to send + * @example Raw data to be send + */ + stringtosend: string + /** + * @description String to expect in response + * @example Raw data expected to be received + */ + stringtoexpect: string + } + DetailedUdpAttributes: { + type?: { + udp?: components['schemas']['UdpAttributes'] + } + } + SmtpAttributesBase: { + /** + * @description Target port + * @example 25 + */ + port?: number + /** + * @description Connection encryption + * @example true + */ + encryption?: boolean + /** @description String to expect in response */ + stringtoexpect?: string + } + SmtpAttributesSet: { + /** + * @description Username and password colon separated for target SMTP authentication + * @example User:e4gh51! + */ + auth?: string + } & components['schemas']['SmtpAttributesBase'] + SmtpAttributesGet: { + /** + * @description Username for target SMTP authentication + * @example User + */ + username?: string + /** + * @description Password for target SMTP authentication + * @example e4gh51! + */ + password?: string + } & components['schemas']['SmtpAttributesBase'] + DetailedSmtpAttributes: { + type?: { + smtp?: components['schemas']['SmtpAttributesGet'] + } + } + Pop3Attributes: { + /** + * @description Target port + * @example 110 + */ + port?: number + /** + * @description String to expect in response + * @example Raw data expected to be received + */ + stringtoexpect?: string + } + DetailedPop3Attributes: { + type?: { + pop3?: components['schemas']['Pop3Attributes'] + } + } + ImapAttributes: { + /** + * @description Target port + * @example 143 + */ + port?: number + /** + * @description String to expect in response + * @example Raw data expected to be received + */ + stringtoexpect?: string + } + DetailedImapAttributes: { + type?: { + imap?: components['schemas']['ImapAttributes'] + } + } + DetailedCheckAttributes: { + /** + * @description Filters used for probe selections + * @example [ + * "region: EU" + * ] + */ + probe_filters?: string[] + /** @example 6 */ + sendnotificationwhendown?: number + /** @example 5 */ + notifyagainevery?: number + /** @example true */ + notifywhenbackup?: boolean + /** @example 30000 */ + responsetime_threshold?: boolean + /** @example Important check is down! */ + custom_message?: string + /** + * @example [ + * 74356, + * 74358 + * ] + */ + integrationids?: number[] + } & components['schemas']['Check'] + DetailedCheckHttp: { + check?: components['schemas']['DetailedHttpAttributes'] & components['schemas']['DetailedCheckAttributes'] + } + DetailedCheckHttpCustom: { + check?: components['schemas']['DetailedHttpCustomAttributes'] & + components['schemas']['DetailedCheckAttributes'] & + components['schemas']['HttpCertificateAttributes'] + } + DetailedCheckTcp: { + check?: components['schemas']['DetailedTcpAttributes'] & components['schemas']['DetailedCheckAttributes'] + } + DetailedCheckDns: { + check?: components['schemas']['DetailedDnsAttributes'] & components['schemas']['DetailedCheckAttributes'] + } + DetailedCheckUdp: { + check?: components['schemas']['DetailedUdpAttributes'] & components['schemas']['DetailedCheckAttributes'] + } + DetailedCheckSmtp: { + check?: components['schemas']['DetailedSmtpAttributes'] & components['schemas']['DetailedCheckAttributes'] + } + DetailedCheckPop3: { + check?: components['schemas']['DetailedPop3Attributes'] & components['schemas']['DetailedCheckAttributes'] + } + DetailedCheckImap: { + check?: components['schemas']['DetailedImapAttributes'] & components['schemas']['DetailedCheckAttributes'] + } + DetailedCheck: + | components['schemas']['DetailedCheckHttp'] + | components['schemas']['DetailedCheckHttpCustom'] + | components['schemas']['DetailedCheckTcp'] + | components['schemas']['DetailedCheckDns'] + | components['schemas']['DetailedCheckUdp'] + | components['schemas']['DetailedCheckSmtp'] + | components['schemas']['DetailedCheckPop3'] + | components['schemas']['DetailedCheckImap'] + CreateCheck: { + /** + * @description Check name + * @example mycheck + */ + name: string + /** + * @description Target host + * @example www.example.com + */ + host: string + /** + * @description Type of check + * @example http + * @enum {string} + */ + type: 'http' | 'httpcustom' | 'tcp' | 'ping' | 'dns' | 'udp' | 'smtp' | 'pop3' | 'imap' + /** @default false */ + paused?: boolean + /** + * @description How often should the check be tested? (minutes) + * @default 5 + * @example 5 + * @enum {integer} + */ + resolution?: 1 | 5 | 15 | 30 | 60 + /** @description User identifiers. For example userids=154325,465231,765871 */ + userids?: string + /** + * @description Send notification when down X times + * @default 2 + * @example 2 + */ + sendnotificationwhendown?: number + /** + * @description Notify again every n result. 0 means that no extra notifications will be sent. + * @default 0 + */ + notifyagainevery?: number + /** + * @description Notify when back up again + * @default true + * @example true + */ + notifywhenbackup?: boolean + /** @description List of tags for check. The maximum length of a tag is 64 characters. */ + tags?: string[] + /** @description Filters used for probe selections. Overwrites previous filters for check. To remove all filters from a check, use an empty value. Comma separated key:value pairs. Currently only region is supported. Possible values are 'EU', 'NA', 'APAC' and 'LATAM'. For example, "region: NA". */ + probe_filters?: string[] + /** + * @description Use ipv6 instead of ipv4, if an IP address is provided as host this will be overrided by the IP address version + * @default false + */ + ipv6?: boolean + /** + * @description Triggers a down alert if the response time exceeds threshold specified in ms (Not available for Starter and Free plans.) + * @default 30000 + * @example 30000 + */ + responsetime_threshold?: number + /** @description Integration identifiers. For example integrationids:[1,2,3]. */ + integrationids?: number[] + /** @description Teams to alert. Comma separated Integers. */ + teamids?: string + /** @description Custom message that will be added to email and webhook alerts. */ + custom_message?: string + } & ( + | components['schemas']['HttpAttributesSet'] + | components['schemas']['HttpCustomAttributes'] + | components['schemas']['TcpAttributes'] + | components['schemas']['DnsAttributes'] + | components['schemas']['UdpAttributes'] + | components['schemas']['SmtpAttributesSet'] + | components['schemas']['Pop3Attributes'] + | components['schemas']['ImapAttributes'] + ) + ModifyCheckSettings: { + /** + * @description Check name + * @example mycheck + */ + name?: string + /** + * @description Target host + * @example www.example.com + */ + host?: string + /** @default false */ + paused?: boolean + /** + * @description How often should the check be tested? (minutes) + * @default 5 + * @example 5 + * @enum {integer} + */ + resolution?: 1 | 5 | 15 | 30 | 60 + /** @description User identifiers. For example userids=154325,465231,765871 */ + userids?: string + /** + * @description Send notification when down X times + * @default 2 + * @example 2 + */ + sendnotificationwhendown?: number + /** + * @description Notify again every n result. 0 means that no extra notifications will be sent. + * @default 0 + */ + notifyagainevery?: number + /** + * @description Notify when back up again + * @default true + * @example true + */ + notifywhenbackup?: boolean + /** + * @description Identifiers of checks to modify in bulk. For example checkids=1234,5678 + * @example 123,456 + */ + checkids?: string + /** @description List of tags for check. The maximum length of a tag is 64 characters. */ + tags?: string[] + /** @description Check tags to add in addition to current check tags */ + addtags?: string[] + /** @description Filters used for probe selections. Overwrites previous filters for check. To remove all filters from a check, use an empty value. Comma separated key:value pairs. Currently only region is supported. Possible values are 'EU', 'NA', 'APAC' and 'LATAM'. For example, "region: NA". */ + probe_filters?: string[] + /** @description Use ipv6 instead of ipv4, if an IP address is provided as host this will be overrided by the IP address version */ + ipv6?: boolean + /** + * @description Triggers a down alert if the response time exceeds threshold specified in ms (Not available for Starter and Free plans.) + * @default 30000 + * @example 30000 + */ + responsetime_threshold?: number + /** @description Integration identifiers. For example integrationids:[1,2,3]. */ + integrationids?: number[] + /** @description Teams to alert. Comma separated Integers. */ + teamids?: string + /** @description Custom message that will be added to email and webhook alerts. */ + custom_message?: string + } & ( + | components['schemas']['HttpAttributesSet'] + | components['schemas']['HttpCustomAttributes'] + | components['schemas']['TcpAttributes'] + | components['schemas']['DnsAttributes'] + | components['schemas']['UdpAttributes'] + | components['schemas']['SmtpAttributesSet'] + | components['schemas']['Pop3Attributes'] + | components['schemas']['ImapAttributes'] + ) + credits_resp_attrs: { + credits?: { + /** + * @description Total number of check slots on this account + * @example 18 + */ + checklimit?: number + /** + * @description Free check slots available for new checks + * @example 5 + */ + availablechecks?: number + /** + * @description Total number of default check slots + * @example 6 + */ + useddefault?: number + /** + * @description Total number of transaction check slots + * @example 7 + */ + usedtransaction?: number + /** + * @description SMS credits remaining on this account + * @example 20 + */ + availablesms?: number + /** + * @description SMS provider tests remaining on this account + * @example 7 + */ + availablesmstests?: number + /** + * @description Auto fill SMS + * @example false + */ + autofillsms?: boolean + /** + * @description The amount of sms to purchase when "autofillsms_when_left" is triggered + * @example 0 + */ + autofillsms_amount?: number + /** + * @description The amount of sms left that is going to trigger purchase of sms + * @example 0 + */ + autofillsms_when_left?: number + /** + * @description The amount of overage SMSes that may be used, or null if SMS overage is not enabled. + * @example 0 + */ + max_sms_overage?: number + /** + * @description Open RUM site slots available + * @example 4 + */ + availablerumsites?: number + /** + * @description Number of used RUM sites + * @example 1 + */ + usedrumsites?: number + /** + * @description Number of maximum rum filters + * @example 10 + */ + maxrumfilters?: number + /** + * @description Number of maximum pageviews per month + * @example 100000 + */ + maxrumpageviews?: number + } + } + maintenance_id: number + maintenance_limit: number + maintenance_offset: number + /** @enum {string} */ + maintenance_orderby: 'description' | 'from' | 'to' | 'effectiveto' + /** + * @default asc + * @enum {string} + */ + maintenance_order: 'asc' | 'desc' + maintenance_resp_attrs: { + /** @description A list of maintenance windows */ + maintenance?: { + /** + * @description Maintenance window identifier + * @example 1 + */ + id?: number + /** + * @description Description + * @example Maintenance window from DB + */ + description?: string + /** + * @description Initial maintenance window start. Format UNIX time. + * @example 1497520800 + */ + from?: number + /** + * @description Initial maintenance window end. Format UNIX time. + * @example 1497574800 + */ + to?: number + /** + * @description Type of recurrence. + * @example week + * @enum {string} + */ + recurrencetype?: 'none' | 'day' | 'week' | 'month' + /** + * @description Repeat every n-th day/week/month + * @example 0 + */ + repeatevery?: number + /** + * @description Recurrence end. Format UNIX time. + * @example 1497574800 + */ + effectiveto?: number + /** @description Connected checks */ + checks?: { + /** + * @description List of connected Uptime checks + * @example [ + * 506206, + * 506233, + * 222 + * ] + */ + uptime?: number[] + /** + * @description List of connected Transaction checks + * @example [ + * 123, + * 111 + * ] + */ + tms?: number[] + } + }[] + } + maintenance_id_resp_attrs: { + maintenance?: { + /** + * @description Maintenance window identifier + * @example 456 + */ + id?: number + /** + * @description Description + * @example Particular maintenance window + */ + description?: string + /** + * @description Initial maintenance window start. Format UNIX time. + * @example 1497520800 + */ + from?: number + /** + * @description Initial maintenance window end. Format UNIX time. + * @example 1497574800 + */ + to?: number + /** + * @description Type of recurrence. + * @example none + */ + recurrencetype?: string + /** + * @description Repeat every n-th day/week/month + * @example 0 + */ + repeatevery?: number + /** + * @description Recurrence end. Format UNIX time. + * @example 1497574800 + */ + effectiveto?: number + /** @description Connected checks */ + checks?: { + /** + * @description Id of connected Uptime check + * @example [ + * 506206, + * 506233, + * 222 + * ] + */ + uptime?: number[] + /** + * @description Id of connected TMS check + * @example [ + * 123, + * 111 + * ] + */ + tms?: number[] + } + } + } + maintenance_post: { + /** + * @description Description + * @example New maintenance window. + */ + description: string + /** + * @description Initial maintenance window start. Format UNIX time. (Only future allowed. Use 1 for the current timestamp.) + * @example 1500471702 + */ + from: number + /** + * @description Initial maintenance window end. Format UNIX time. (Only future allowed. Use 1 for the current timestamp.) + * @example 1500475302 + */ + to: number + /** + * @description Type of recurrence. + * @default none + * @example week + * @enum {string} + */ + recurrencetype?: 'none' | 'day' | 'week' | 'month' + /** + * @description Repeat every n-th day/week/month + * @default 0 + */ + repeatevery?: number + /** + * @description Recurrence end. Format UNIX time. Default: equal to `to`. (Only future allowed. Use 1 for the current timestamp.) + * @example 1500475302 + */ + effectiveto?: number + /** + * @description Identifiers of uptime checks to assign to the maintenance window - Comma separated Integers + * @example [ + * 1234567, + * 3456789 + * ] + */ + uptimeids?: number[] + /** + * @description Identifiers of transaction checks to assign to the maintenance window - Comma separated Integers + * @example [ + * 1234567, + * 3456789 + * ] + */ + tmsids?: number[] + } + maintenance_post_resp_attrs: { + maintenance?: { + /** + * @description Unique id of the new maintenance window + * @example 777 + */ + id?: number + } + } + maintenance_id_put: { + /** + * @description Description + * @example Modified maintenance window + */ + description?: string + /** + * @description Initial maintenance window start. Format UNIX time. (Only future allowed. Use 1 for the current timestamp.) + * @example 1500471702 + */ + from?: number + /** + * @description Initial maintenance window end. Format UNIX time. (Only future allowed. Use 1 for the current timestamp.) + * @example 1500475302 + */ + to?: number + /** + * @description Type of recurrence + * @example week + * @enum {string} + */ + recurrencetype?: 'none' | 'day' | 'week' | 'month' + /** + * @description Repeat every n-th day/week/month + * @default 0 + */ + repeatevery?: number + /** + * @description Recurrence end. Format UNIX time. Default: equal to `to`. (Only future allowed. Use 1 for the current timestamp.) + * @example 1500475302 + */ + effectiveto?: number + /** + * @description Identifiers of uptime checks to assign to the maintenance window - Comma separated Integers + * @example [ + * 1234567, + * 3456789 + * ] + */ + uptimeids?: number[] + /** + * @description Identifiers of transaction checks to assign to the maintenance window - Comma separated Integers + * @example [ + * 1234567, + * 3456789 + * ] + */ + tmsids?: number[] + } + maintenance_id_put_resp_attrs: { + /** + * @description Modification result description + * @example Maintenance window successfully modified! + */ + message?: string + } + maintenance_id_delete_resp_attrs: { + /** + * @description Result description + * @example Maintenance window successfully deleted! + */ + message?: string + } + maintenance_delete: { + /** + * @description Comma-separated list of identifiers of maintenance windows to be deleted. + * @example [ + * 1, + * 2, + * 3, + * 4, + * 5 + * ] + */ + maintenanceids: number[] + } + maintenance_delete_resp_attrs: { + /** + * @description Result description + * @example 5 maintenance windows successfully deleted. + */ + message?: string + } + 'maintenance.occurrences_id': number + 'maintenance.occurrences_id_put': { + /** + * @description Beginning of the maintenance occurrence. Format UNIX time. (Only future allowed. Use 1 for the current timestamp.) + * @example 1500471702 + */ + from?: number + /** + * @description End of the maintenance occurrence. Format UNIX time. (Only future allowed. Use 1 for the current timestamp.) + * @example 1500475302 + */ + to?: number + } + 'maintenance.occurrences_id_resp_attrs': { + occurrence?: { + /** + * @description Identifier of an occurence. + * @example 57 + */ + id?: number + /** + * @description Identifier of the related maintenance window. + * @example 44 + */ + maintenanceid?: number + /** + * @description Beginning of the occurrence. Format UNIX timestamp. + * @example 1501714800 + */ + from?: number + /** + * @description The end of the occurrence. Format UNIX timestamp. + * @example 1501719300 + */ + to?: number + } + } + 'maintenance.occurrences_maintenanceid': number + 'maintenance.occurrences_from': number + 'maintenance.occurrences_to': number + 'maintenance.occurrences_resp_attrs': { + /** @description A list of maintenance occurrences. */ + occurrences?: { + /** + * @description Identifier of an occurence. + * @example 455 + */ + id?: number + /** + * @description Identifier of the related maintenance window. + * @example 44 + */ + maintenanceid?: number + /** + * @description Beginning of the occurrence. Format UNIX timestamp. + * @example 1501628400 + */ + from?: number + /** + * @description The end of the occurrence. Format UNIX timestamp. + * @example 1501632900 + */ + to?: number + }[] + } + 'maintenance.occurrences_id_put_resp_attrs': { + /** + * @description Modification result description + * @example Occurrence successfully modified! + */ + message?: string + } + 'maintenance.occurrences_id_delete_resp_attrs': { + /** + * @description Result description + * @example Occurrence successfully deleted! + */ + message?: string + } + 'maintenance.occurrences_delete': { + /** @description Comma-separated list of identifiers of maintenance occurrences to delete. */ + occurrenceids: number[] + } + 'maintenance.occurrences_delete_resp_attrs': { + /** + * @description Result description + * @example 5 occurrences successfully deleted. + */ + message?: string + } + Probe: { + /** @example 2 */ + id?: number + /** @example United States */ + country?: string + /** @example New York */ + city?: string + /** @example New York, NY */ + name?: string + /** + * @description Is the probe currently active? + * @example true + */ + active?: boolean + /** + * @description DNS name + * @example s413.pingdom.com + */ + hostname?: string + /** + * @description IPv4 address + * @example 70.32.40.2 + */ + ip?: string + /** + * @description IPv6 address (not all probes have this) + * @example 2001:0db8:85a3:0000:0000:8a2e:0370:7334 + */ + ipv6?: string + /** + * @description Country ISO code + * @example US + */ + countryiso?: string + } + Probes: { + probes?: components['schemas']['Probe'][] + } + Region: { + /** @description Region identifier */ + id?: number + /** @description Region description */ + description?: string + /** @description Corresponding country identifier */ + countryid?: number + /** @description Corresponding datetimeformat identifier */ + datetimeformatid?: number + /** @description Corresponding numberformat identifier */ + numberformatid?: number + /** @description Corresponding timezon identifier */ + timezoneid?: number + } + Timezone: { + /** @description Time zone identifier */ + id?: number + /** @description Time zone description */ + description?: string + } + DateTimeFormat: { + /** @description Date/time identifier */ + id?: number + /** @description Date/time description */ + description?: string + } + NumberFormat: { + /** @description Number format identifier */ + id?: number + /** @description Number format description */ + description?: string + } + Country: { + /** @description Country id */ + id?: number + /** @description Country ISO code */ + iso?: string + /** @description Country name */ + name?: string + } + PhoneCode: { + /** @description Country id (Can be mapped against countries.id) */ + countryid?: number + /** @description Country name */ + name?: string + /** @description Area phone code */ + phonecode?: string + } + References: { + /** + * @example [ + * { + * "id": 2, + * "description": "United State (Alaska)" + * } + * ] + */ + regions?: components['schemas']['Region'][] + /** + * @example [ + * { + * "id": 4, + * "description": "(GMT -9:00) Alaska" + * } + * ] + */ + timezones?: components['schemas']['Timezone'][] + /** + * @example [ + * { + * "id": 3, + * "description": "31/07/2006 14:45:05" + * } + * ] + */ + datetimeformats?: components['schemas']['DateTimeFormat'][] + /** + * @example [ + * { + * "id": 5, + * "description": "123 456 789,00" + * } + * ] + */ + numberformats?: components['schemas']['NumberFormat'][] + countries?: components['schemas']['Country'][] + /** + * @example { + * "countryid": 295, + * "name": "Zimbabwe", + * "phonecode": 263, + * "iso": "ZW" + * } + */ + phonecodes?: components['schemas']['PhoneCode'][] + } + results_checkid: number + results_to: number + results_from: number + /** @description Default: all probes */ + results_probes: string + /** @description Default: all statuses */ + results_status: string + /** @default 1000 */ + results_limit: number + /** @default 0 */ + results_offset: number + /** @default false */ + results_includeanalysis: boolean + results_maxresponse: number + results_minresponse: number + results_resp_attrs: { + results?: { + /** + * @description Probe identifier + * @example 33 + */ + probeid?: number + /** + * @description Time when test was performed. Format is UNIX timestamp + * @example 1294235764 + */ + time?: number + /** + * @description Result status + * @example up + * @enum {string} + */ + status?: 'up' | 'down' | 'unconfirmed' | 'unknown' + /** + * @description Response time (in milliseconds) (Will be 0 if no response was received) + * @example 91 + */ + responsetime?: number + /** + * @description Short status description + * @example OK + */ + statusdesc?: string + /** + * @description Long status description + * @example OK + */ + statusdesclong?: string + }[] + /** @description For your convenience, a list of used probes that produced the showed results */ + activeprobes?: number[] + } + HTTP: { + /** + * @description Target host + * @example pingdom.com + */ + host: string + /** @enum {string} */ + type: 'http' + /** + * @description Probe identifier + * @example 17 + */ + probeid?: number + /** @description Filters used for probe selections. Comma separated key:value pairs. Currently only region is supported. Possible values are 'EU', 'NA', 'APAC' and 'LATAM'. */ + probe_filters?: number + /** @description Use ipv6 instead of ipv4 */ + ipv6?: boolean + /** + * @description Triggers a down alert if the response time exceeds threshold specified in ms (Not available for Starter and Free plans.) + * @default 30000 + */ + responsetime_threshold?: number + /** + * @description (http specific) Target path on server + * @default / + */ + url?: string + /** + * @description (http specific) Connection encryption + * @default false + */ + encryption?: boolean + /** + * @description (http specific) Target port + * @default 80 + */ + port?: number + /** + * @description (http specific) Username and password for target HTTP authentication. + * @example auth=user:password + */ + auth?: string + /** @description (http specific) Target site should contain this string */ + shouldcontain?: string + /** @description (http specific) Target site should NOT contain this string */ + shouldnotcontain?: string + /** @description (http specific) Data that should be posted to the web page, for example submission data for a sign-up or login form. The data needs to be formatted in the same way as a web browser would send it to the web server */ + postdata?: string + /** + * @description (http specific) Custom HTTP header name. Replace {X} with a number unique for each header argument. + * @example requestheader1=My-Header:CoolValue + */ + 'requestheader{X}'?: string + /** + * @description (http specific) Treat target site as down if an invalid/unverifiable certificate is found. + * @default true + */ + verify_certificate?: boolean + /** + * @description (http specific) Treat the target site as down if a certificate expires within the given number of days. This parameter will be ignored if `verify_certificate` is set to `false`. + * @default 0 + */ + ssl_down_days_before?: number + } + 'HTTP-Custom': { + /** + * @description Target host + * @example pingdom.com + */ + host: string + /** @enum {string} */ + type: 'httpcustom' + /** + * @description Probe identifier + * @example 17 + */ + probeid?: number + /** @description Filters used for probe selections. Comma separated key:value pairs. Currently only region is supported. Possible values are 'EU', 'NA', 'APAC' and 'LATAM'. */ + probe_filters?: number + /** @description Use ipv6 instead of ipv4 */ + ipv6?: boolean + /** + * @description Triggers a down alert if the response time exceeds threshold specified in ms (Not available for Starter and Free plans.) + * @default 30000 + */ + responsetime_threshold?: number + /** @description (httpcustom specific) Target path to XML file on server */ + url: string + /** + * @description (httpcustom specific) Connection encryption + * @default false + */ + encryption?: boolean + /** + * @description (httpcustom specific) Target port + * @default 80 + */ + port?: number + /** + * @description (httpcustom specific) Username and password for target HTTP authentication. + * @example auth=user:password + */ + auth?: string + /** + * @description (httpcustom specific) ;-separated list of addidional URLs with hostname included. + * @example additionalurls=www.mysite.com;www.myothersite.com + */ + additionalurls?: string + } + TCP: { + /** + * @description Target host + * @example pingdom.com + */ + host: string + /** @enum {string} */ + type: 'tcp' + /** + * @description Probe identifier + * @example 17 + */ + probeid?: number + /** @description Filters used for probe selections. Comma separated key:value pairs. Currently only region is supported. Possible values are 'EU', 'NA', 'APAC' and 'LATAM'. */ + probe_filters?: number + /** @description Use ipv6 instead of ipv4 */ + ipv6?: boolean + /** + * @description Triggers a down alert if the response time exceeds threshold specified in ms (Not available for Starter and Free plans.) + * @default 30000 + */ + responsetime_threshold?: number + /** @description (tcp specific) Target port */ + port: number + /** @description (tcp specific) String to send */ + stringtosend?: string + /** @description (tcp specific) String to expect in response */ + stringtoexpect?: string + } + DNS: { + /** + * @description Target host + * @example pingdom.com + */ + host: string + /** @enum {string} */ + type: 'dns' + /** + * @description Probe identifier + * @example 17 + */ + probeid?: number + /** @description Filters used for probe selections. Comma separated key:value pairs. Currently only region is supported. Possible values are 'EU', 'NA', 'APAC' and 'LATAM'. For example, "region: NA". */ + probe_filters?: number + /** @description Use ipv6 instead of ipv4 */ + ipv6?: boolean + /** + * @description Triggers a down alert if the response time exceeds threshold specified in ms (Not available for Starter and Free plans.) + * @default 30000 + */ + responsetime_threshold?: number + /** @description (dns specific) Expected ip */ + expectedip: string + /** @description (dns specific) Nameserver */ + nameserver: string + } + UDP: { + /** + * @description Target host + * @example pingdom.com + */ + host: string + /** @enum {string} */ + type: 'udp' + /** + * @description Probe identifier + * @example 17 + */ + probeid?: number + /** @description Filters used for probe selections. Comma separated key:value pairs. Currently only region is supported. Possible values are 'EU', 'NA', 'APAC' and 'LATAM'. */ + probe_filters?: number + /** @description Use ipv6 instead of ipv4 */ + ipv6?: boolean + /** + * @description Triggers a down alert if the response time exceeds threshold specified in ms (Not available for Starter and Free plans.) + * @default 30000 + */ + responsetime_threshold?: number + /** @description (udp specific) Target port */ + port: number + /** @description (udp specific) String to send */ + stringtosend?: string + /** @description (udp specific) String to expect in response */ + stringtoexpect?: string + } + SMTP: { + /** + * @description Target host + * @example pingdom.com + */ + host: string + /** @enum {string} */ + type: 'smtp' + /** + * @description Probe identifier + * @example 17 + */ + probeid?: number + /** @description Filters used for probe selections. Comma separated key:value pairs. Currently only region is supported. Possible values are 'EU', 'NA', 'APAC' and 'LATAM'. */ + probe_filters?: number + /** @description Use ipv6 instead of ipv4 */ + ipv6?: boolean + /** + * @description Triggers a down alert if the response time exceeds threshold specified in ms (Not available for Starter and Free plans.) + * @default 30000 + */ + responsetime_threshold?: number + /** + * @description (smtp specific) Target port + * @default 25 + */ + port?: number + /** + * @description (smtp specific) Username and password for target HTTP authentication. + * @example auth=user:password + */ + auth?: string + /** @description (smtp specific) String to expect in response */ + stringtoexpect?: string + /** + * @description (smtp specific) Connection encryption + * @default false + */ + encryption?: boolean + } + POP3: { + /** + * @description Target host + * @example pingdom.com + */ + host: string + /** @enum {string} */ + type: 'pop3' + /** + * @description Probe identifier + * @example 17 + */ + probeid?: number + /** @description Filters used for probe selections. Comma separated key:value pairs. Currently only region is supported. Possible values are 'EU', 'NA', 'APAC' and 'LATAM'. */ + probe_filters?: number + /** @description Use ipv6 instead of ipv4 */ + ipv6?: boolean + /** + * @description Triggers a down alert if the response time exceeds threshold specified in ms (Not available for Starter and Free plans.) + * @default 30000 + */ + responsetime_threshold?: number + /** + * @description (pop3 specific) Target port + * @default 110 + */ + port?: number + /** @description (pop3 specific) String to expect in response */ + stringtoexpect?: string + /** + * @description (pop3 specific) Connection encryption + * @default false + */ + encryption?: boolean + } + IMAP: { + /** + * @description Target host + * @example pingdom.com + */ + host: string + /** @enum {string} */ + type: 'imap' + /** + * @description Probe identifier + * @example 17 + */ + probeid?: number + /** @description Filters used for probe selections. Comma separated key:value pairs. Currently only region is supported. Possible values are 'EU', 'NA', 'APAC' and 'LATAM'. */ + probe_filters?: number + /** @description Use ipv6 instead of ipv4 */ + ipv6?: boolean + /** + * @description Triggers a down alert if the response time exceeds threshold specified in ms (Not available for Starter and Free plans.) + * @default 30000 + */ + responsetime_threshold?: number + /** + * @description (imap specific) Target port + * @default 143 + */ + port?: number + /** @description (imap specific) String to expect in response */ + stringtoexpect?: string + /** + * @description (imap specific) Connection encryption + * @default false + */ + encryption?: boolean + } + single_resp: { + result?: { + /** + * @description Test result status (up, down) + * @example up + */ + status?: string + /** + * @description Response time in milliseconds + * @example 73 + */ + responsetime?: number + /** + * @description Short status description + * @example OK + */ + statusdesc?: string + /** + * @description Long status description + * @example OK + */ + statusdesclong?: string + /** + * @description Probe identifier + * @example 17 + */ + probeid?: number + /** + * @description Probe description + * @example Stockholm, Sweden + */ + probedesc?: string + } + } + 'summary.average_checkid': number + /** @default 0 */ + 'summary.average_from': number + 'summary.average_to': number + 'summary.average_probes': string + /** @default false */ + 'summary.average_includeuptime': boolean + /** @default false */ + 'summary.average_bycountry': boolean + /** @default false */ + 'summary.average_byprobe': boolean + summary_resp_attrs: { + summary?: { + responsetime?: { + /** + * @description Start time of period + * @example 0 + */ + from?: number + /** + * @description End time of period + * @example 1294245226 + */ + to?: number + avgresponse?: OneOf< + [ + number, + { + /** + * @description Country group ISO code + * @example SE + */ + countryiso?: string + /** + * @description Probe group probe identifier + * @example 123 + */ + probeid?: number + /** + * @description Group average response time in milliseconds + * @example 250 + */ + avgresponse?: number + }[], + ] + > + } + status?: { + /** + * @description Total uptime in seconds (Please note that the accuracy of this value is depending on your check resolution). + * @example 53072286 + */ + totalup?: number + /** + * @description Total downtime in seconds (Please note that the accuracy of this value is depending on your check resolution). + * @example 771879 + */ + totaldown?: number + /** + * @description Total unknown/unmonitored/paused in seconds (Please note that the accuracy of this value is depending on your check resolution. Also note that time before the check was created counts as unknown). + * @example 1240401138 + */ + totalunknown?: number + } + } + } + 'summary.hoursofday_checkid': number + 'summary.hoursofday_from': number + 'summary.hoursofday_to': number + 'summary.hoursofday_probes': string + /** @default false */ + 'summary.hoursofday_uselocaltime': boolean + 'summary.hoursofday_resp_attrs': { + hoursofday?: { + /** + * @description Hour of day (0-23). Please note that if data is missing for an individual hour, it's entry will not be included in the result. + * @example 1 + */ + hour?: number + /** + * @description Average response time (in milliseconds) for this hour of the day + * @example 299 + */ + avgresponse?: number + }[] + } + 'summary.outage_checkid': number + 'summary.outage_from': number + 'summary.outage_to': number + /** + * @default asc + * @enum {string} + */ + 'summary.outage_order': 'asc' | 'desc' + 'summary.outage_resp_attrs': { + summary?: { + states?: { + /** + * @description Interval status + * @example up + * @enum {string} + */ + status?: 'up' | 'down' | 'unknown' + /** + * @description Interval start. Format UNIX timestamp + * @example 1293143523 + */ + timefrom?: number + /** + * @description Interval end. Format UNIX timestamp + * @example 1294180263 + */ + timeto?: number + }[] + } + } + 'summary.performance_checkid': number + 'summary.performance_from': number + 'summary.performance_to': number + /** + * @default hour + * @enum {string} + */ + 'summary.performance_resolution': 'hour' | 'day' | 'week' + /** @default false */ + 'summary.performance_includeuptime': boolean + 'summary.performance_probes': string + /** + * @default asc + * @enum {string} + */ + 'summary.performance_order': 'asc' | 'desc' + Weeks: { + weeks?: components['schemas']['summary.performance_results'] + } + Days: { + days?: components['schemas']['summary.performance_results'] + } + Hours: { + hours?: components['schemas']['summary.performance_results'] + } + 'summary.performance_results': { + /** + * @description Interval start. Format UNIX timestamp + * @example 1287957600 + */ + starttime?: number + /** + * @description Average response time for this interval in milliseconds + * @example 468 + */ + avgresponse?: number + /** + * @description Total uptime for this interval in seconds + * @example 608400 + */ + uptime?: number + /** + * @description Total downtime for this interval in seconds + * @example 0 + */ + downtime?: number + /** + * @description Total unmonitored time for this interval in seconds + * @example 0 + */ + unmonitored?: number + }[] + 'summary.performance_resp_attrs': { + summary?: components['schemas']['Weeks'] | components['schemas']['Days'] | components['schemas']['Hours'] + } + 'summary.probes_checkid': number + 'summary.probes_from': number + 'summary.probes_to': number + 'summary.probes_resp_attrs': { + /** + * @example [ + * 43, + * 42, + * 41, + * 40, + * 39, + * 37, + * 36, + * 35, + * 34, + * 33, + * 32, + * 31, + * 30, + * 29, + * 28, + * 27, + * 24, + * 23, + * 22, + * 21 + * ] + */ + probes?: number[] + } + Members: { + /** @description Contact identifier */ + id?: number + /** @description The team member’s name */ + name?: string + /** + * @description Type defines whether the member is a user (login user) or a contact only + * @enum {string} + */ + type?: 'user' | 'contact' + } + /** + * @example { + * "teams": [ + * { + * "id": 1, + * "name": "Team Rocket", + * "members": [ + * { + * "id": 1, + * "name": "John Doe", + * "type": "user" + * } + * ] + * }, + * { + * "id": 2, + * "name": "The A-Team", + * "members": [ + * { + * "id": 2, + * "name": "John 'Hannibal' Smith", + * "type": "user" + * }, + * { + * "id": 3, + * "name": "Templeton 'Faceman' Peck", + * "type": "contact" + * } + * ] + * } + * ] + * } + */ + Teams: { + teams?: components['schemas']['AlertingTeams'][] + } + AlertingTeams: { + /** @description Team identifier */ + id?: number + /** @description Team name */ + name?: string + members?: components['schemas']['Members'][] + } + Team_ID: { + team?: components['schemas']['AlertingTeam_ID'] + } + /** + * @example { + * "id": 1, + * "name": "Team Rocket", + * "members": [ + * { + * "id": 1, + * "name": "John Doe", + * "type": "user" + * }, + * { + * "id": 4, + * "name": "Sidekick Jimmy", + * "type": "contact" + * } + * ] + * } + */ + AlertingTeam_ID: { + /** @description Team identifier */ + id?: number + /** @description Team name */ + name?: string + members?: components['schemas']['Members'][] + } + /** + * @example { + * "name": "Team Rocket", + * "member_ids": [ + * 1, + * 4 + * ] + * } + */ + UpdateTeam: { + /** @description Team name */ + name: string + /** @description IDs of contacts to be the members of this team */ + member_ids: number[] + } + /** + * @example { + * "name": "API Team", + * "member_ids": [ + * 12345, + * 54321 + * ] + * } + */ + CreateTeam: { + /** @description Team name */ + name: string + /** @description Contact ids */ + member_ids: number[] + } + SMSes: { + /** @description Contact target's severity level */ + severity?: string + /** @description Country code */ + country_code?: string + /** @description Phone number */ + number?: string + /** @description Provider */ + provider?: string + }[] + Emails: { + /** @description Contact target's severity level */ + severity?: string + /** @description Email address */ + address?: string + }[] + APNS: { + /** @description Contact target's severity level */ + severity?: string + /** @description Contact targets's device name */ + device_name?: string + /** @description Contact target's apns */ + apns_device?: string + }[] + AGCM: { + /** @description Contact target's severity level */ + severity?: string + /** @description Contact target's agcm id */ + agcm_id?: string + }[] + ContactTargets: { + /** @description Contact ID */ + id?: number + /** @description Contact name */ + name?: string + /** + * @description Describes whether alerts are paused for this contact + * @enum {boolean} + */ + paused?: true | false + /** + * @description Type defines whether this is a user (login user) or a contact only + * @enum {string} + */ + type?: 'user' | 'contact' + /** + * @description Indicates whether the contact is the owner of the organization + * @enum {boolean} + */ + owner?: true | false + notification_targets?: + | components['schemas']['SMSes'] + | components['schemas']['Emails'] + | components['schemas']['APNS'] + | components['schemas']['AGCM'] + teams?: { + /** @description Team ID */ + id?: number + /** @description Name of the team */ + name?: string + }[] + } + /** + * @example { + * "contact": { + * "id": 123456, + * "name": "John Doe", + * "paused": false, + * "type": "user", + * "owner": true, + * "notification_targets": { + * "email": [ + * { + * "severity": "HIGH", + * "address": "johndoe@teamrocket.com" + * } + * ], + * "sms": [ + * { + * "severity": "HIGH", + * "country_code": "00", + * "number": "111111111", + * "provider": "provider's name" + * } + * ] + * }, + * "teams": [ + * { + * "id": 123456, + * "name": "The Dream Team" + * } + * ] + * } + * } + */ + Contact: { + contact?: components['schemas']['ContactTargets'] + } + /** + * @example { + * "name": "John Doe", + * "notification_targets": { + * "email": [ + * { + * "severity": "HIGH", + * "address": "johndoe@teamrocket.com" + * } + * ], + * "sms": [ + * { + * "severity": "HIGH", + * "country_code": "93", + * "number": "111111111", + * "provider": "provider's name" + * } + * ] + * } + * } + */ + CreateContact: { + /** @description Contact name */ + name: string + /** + * @description Pause contact + * @default false + * @enum {boolean} + */ + paused?: true | false + notification_targets: components['schemas']['SMSes'] | components['schemas']['Emails'] + } + /** + * @example { + * "contacts": [ + * { + * "id": 1, + * "name": "John Doe", + * "paused": false, + * "type": "user", + * "owner": true, + * "notification_targets": { + * "email": [ + * { + * "severity": "HIGH", + * "address": "johndoe@teamrocket.com" + * } + * ], + * "sms": [ + * { + * "severity": "HIGH", + * "country_code": "00", + * "number": "111111111", + * "provider": "provider's name" + * } + * ] + * }, + * "teams": [ + * { + * "id": 123456, + * "name": "The Dream Team" + * } + * ] + * }, + * { + * "id": 2, + * "name": "John \"Hannibal\" Smith", + * "paused": true, + * "type": "user", + * "notification_targets": { + * "email": [ + * { + * "severity": "HIGH", + * "address": "hannibal@ateam.org" + * } + * ], + * "sms": [ + * { + * "severity": "HIGH", + * "country_code": "00", + * "number": "222222222", + * "provider": "provider's name" + * } + * ] + * }, + * "teams": [] + * } + * ] + * } + */ + ContactsList: { + /** @description List of all contacts targets */ + contacts?: components['schemas']['ContactTargets'][] + } + /** + * @example { + * "name": "John Doe", + * "paused": false, + * "notification_targets": { + * "email": [ + * { + * "severity": "HIGH", + * "address": "johndoe@teamrocket.com" + * } + * ], + * "sms": [ + * { + * "severity": "HIGH", + * "country_code": "93", + * "number": "111111111", + * "provider": "provider's name" + * } + * ] + * } + * } + */ + UpdateContact: { + /** @description Contact name */ + name: string + /** + * @description Pause contact + * @enum {boolean} + */ + paused: true | false + notification_targets: components['schemas']['SMSes'] | components['schemas']['Emails'] + } + Traceroute: { + traceroute?: components['schemas']['TracerouteData'] + } + TracerouteData: { + /** + * @description Traceroute output + * @example traceroute to pingdom.com (83.140.19.136), 30 hops max, 40 byte packets ... + */ + result?: string + /** + * @description Probe identifier + * @example 23 + */ + probeid?: number + /** + * @description Probe description + * @example Dallas 4, TX + */ + probedescription?: string + } + CheckGeneral: { + /** + * @description Check status: active or inactive + * @example true + */ + active?: boolean + /** + * Format: int64 + * @description Timestamp when the check was created + * @example 1553070682 + */ + created_at?: number + /** + * Format: int64 + * @description Id of the check + * @example 3 + */ + id?: number + /** + * Format: int64 + * @description TMS test intervals in minutes. Allowed intervals: 5,10,20,60,720,1440. The interval you're allowed to set may vary depending on your current plan. + * @example 10 + */ + interval?: number + /** + * Format: int64 + * @description Timestamp when the check was modified + * @example 1553070968 + */ + modified_at?: number + /** + * Format: int64 + * @description Timestamp when the last downtime started. This field is optional + * @example 1553081100 + */ + last_downtime_start?: number + /** + * Format: int64 + * @description Timestamp when the last downtime ended. This field is optional + * @example 1553089000 + */ + last_downtime_end?: number + /** + * @description Name of the check + * @example My awesome check + */ + name?: string + /** + * @description Name of the region where the check is executed. Supported regions: us-east, us-west, eu, au + * @example us-west + */ + region?: string + /** + * @description Whether the check is passing or failing at the moment (successful, failing, unknown) + * @example successful + */ + status?: string + /** + * @description List of tags for a check. The tag name may contain the characters 'A-Z', 'a-z', '0-9', '_' and '-'. The maximum length of a tag is 64 characters. + * @example [ + * "tag1", + * "tag2" + * ] + */ + tags?: string[] + /** + * @description Type of transaction check: "script" for regular TMS checks and "recording" for checks made using the Transaction Recorder + * @example [ + * "script" + * ] + * @enum {string} + */ + type?: 'script' | 'recording' + } + CheckSimple: { + /** + * Format: int64 + * @description Id of the check + * @example 3 + */ + id?: number + /** + * @description Name of the check + * @example My awesome check + */ + name?: string + } + /** @description CheckWithoutID is a struct describing a TMS check data common for creating a check */ + CheckWithoutID: { + /** + * @description Check status: active or inactive + * @default true + * @example false + */ + active?: boolean + /** + * @description Contacts to alert + * @example [ + * 12345678, + * 19876654 + * ] + */ + contact_ids?: number[] + /** + * @description Custom message that is part of the email and webhook alerts + * @example My custom message + */ + custom_message?: string + /** + * Format: int64 + * @description TMS test intervals in minutes. Allowed intervals: 5,10,20,60,720,1440. The interval you're allowed to set may vary depending on your current plan. + * @default 10 + * @example 20 + */ + interval?: number + /** + * @description Name of the check + * @example My awesome check + */ + name: string + /** + * @description Name of the region where the check is executed. Supported regions: us-east, us-west, eu, au + * @default us-east + * @example us-west + */ + region?: string + /** + * Format: int64 + * @description Send notification when down X times + * @default 1 + * @example 0 + */ + send_notification_when_down?: number + /** + * @description Check importance- how important are the alerts when the check fails. Allowed values: low, high + * @default high + * @example low + */ + severity_level?: string + /** @description steps to be executed as part of the check */ + steps: components['schemas']['Step'][] + /** + * @description Teams to alert + * @example [ + * 12345678, + * 135790 + * ] + */ + team_ids?: number[] + /** + * @description Integration identifiers. + * @example [ + * 1234, + * 1359 + * ] + */ + integration_ids?: number[] + metadata?: components['schemas']['Metadata'] + /** + * @description List of tags for a check. The tag name may contain the characters 'A-Z', 'a-z', '0-9', '_' and '-'. The maximum length of a tag is 64 characters. + * @example [ + * "tag1", + * "tag2" + * ] + */ + tags?: string[] + } + /** @description CheckWithoutIDPUT is a struct describing a TMS check data common for updating a check */ + CheckWithoutIDPUT: { + /** + * @description Check status: active or inactive + * @example true + */ + active?: boolean + /** + * @description Contacts to alert + * @example [ + * 12345678, + * 19876654 + * ] + */ + contact_ids?: number[] + /** + * @description Custom message that is part of the email and webhook alerts + * @example My custom message + */ + custom_message?: string + /** + * Format: int64 + * @description TMS test intervals in minutes. Allowed intervals: 5,10,20,60,720,1440. The interval you're allowed to set may vary depending on your current plan. + * @example 10 + */ + interval?: number + /** + * @description Name of the check + * @example My awesome check + */ + name?: string + /** + * @description Name of the region where the check is executed. Supported regions: us-east, us-west, eu, au + * @example us-west + */ + region?: string + /** + * Format: int64 + * @description Send notification when down X times + * @example 1 + */ + send_notification_when_down?: number + /** + * @description Check importance- how important are the alerts when the check fails. Allowed values: low, high + * @example low + */ + severity_level?: string + /** @description steps to be executed as part of the check */ + steps?: components['schemas']['Step'][] + /** + * @description Teams to alert + * @example [ + * 12345678, + * 135790 + * ] + */ + team_ids?: number[] + metadata?: components['schemas']['Metadata'] + /** + * @description List of tags for a check. The tag name may contain the characters 'A-Z', 'a-z', '0-9', '_' and '-'. The maximum length of a tag is 64 characters. + * @example [ + * "tag1", + * "tag2" + * ] + */ + tags?: string[] + /** + * @description Integration identifiers as a list of integers. + * @example [ + * 12345, + * 98765 + * ] + */ + integration_ids?: number[] + } + /** @description CheckWithoutIDGET is a struct describing a TMS check data common for displaying a check */ + CheckWithoutIDGET: { + /** + * @description Check status - active or inactive + * @example true + */ + active?: boolean + /** + * @description Contacts to alert + * @example [ + * 12345678, + * 19876654 + * ] + */ + contact_ids?: number[] + /** + * Format: int64 + * @description Timestamp when the check was created + * @example 1553070682 + */ + created_at?: number + /** + * Format: int64 + * @description Timestamp when the check was modified + * @example 1553070968 + */ + modified_at?: number + /** + * Format: int64 + * @description Timestamp when the last downtime started. This field is optional + * @example 1553081100 + */ + last_downtime_start?: number + /** + * Format: int64 + * @description Timestamp when the last downtime ended. This field is optional + * @example 1553089000 + */ + last_downtime_end?: number + /** + * @description Custom message that is part of the email and webhook alerts + * @example My custom message + */ + custom_message?: string + /** + * Format: int64 + * @description TMS test intervals in minutes. Allowed intervals: 5,10,20,60,720,1440. The interval you're allowed to set may vary depending on your current plan. + * @example 10 + */ + interval?: number + /** + * @description Name of the check + * @example My awesome check + */ + name?: string + /** + * @description Name of the region where the check is executed. Supported regions: us-east, us-west, eu, au + * @example us-west + */ + region?: string + /** + * Format: int64 + * @description Send notification when down X times + * @example 1 + */ + send_notification_when_down?: number + /** + * @description Check importance- how important are the alerts when the check fails. Allowed values: low, high + * @example low + */ + severity_level?: string + /** + * @description Whether the check is passing or failing at the moment (successful, failing, unknown) + * @example successful + */ + status?: string + /** @description steps to be executed as part of the check */ + steps?: components['schemas']['Step'][] + /** + * @description Teams to alert + * @example [ + * 12345678, + * 135790 + * ] + */ + team_ids?: number[] + /** + * @description Integration identifiers. + * @example [ + * 1234, + * 1359 + * ] + */ + integration_ids?: number[] + metadata?: components['schemas']['MetadataGET'] + /** + * @description List of tags for a check. The tag name may contain the characters 'A-Z', 'a-z', '0-9', '_' and '-'. The maximum length of a tag is 64 characters. + * @example [ + * "tag1", + * "tag2" + * ] + */ + tags?: string[] + /** + * @description Type of transaction check: "script" for regular TMS checks and "recording" for checks made using the Transaction Recorder + * @example [ + * "script" + * ] + * @enum {string} + */ + type?: 'script' | 'recording' + } + ChecksAll: { + checks?: components['schemas']['CheckGeneral'][] + /** + * Format: uint64 + * @example 1000 + */ + limit?: number + /** + * Format: uint64 + * @example 0 + */ + offset?: number + } + /** @description Step is a struct describing a single step of a TMS check */ + Step: { + /** + * @description Parameters for the operation + * The actual parameters required depend on the chosen operation + */ + args?: { + checkbox?: string + element?: string + form?: string + input?: string + option?: string + password?: string + radio?: string + seconds?: string + select?: string + /** @example http://www.google.com */ + url?: string + username?: string + value?: string + } + /** + * @description Operation to be done + * @example go_to + */ + fn?: string + } + HttpAuthentications: { + /** @description Basic Authentication credentials to use on host */ + credentials?: { + /** + * @description Basic Authentication password + * @example secret + */ + password?: string + /** + * @description Basic Authentication Username + * @example admin + */ + userName?: string + } + /** @example https://example.com/auth */ + host?: string + } + /** @description Recording related metadata. Used for recordings only. Modify with caution! */ + MetadataGET: { + /** + * @description Width of the browser window + * @example 1950 + */ + width?: number + /** + * @description Height of the browser window + * @example 1080 + */ + height?: number + /** @description Setting this field to false will disable the same-origin policy during check execution */ + disableWebSecurity?: boolean + /** @description Allowed values are either an empty JSON object (no authentication) or Basic Authentication */ + authentications?: { + /** @description HTTP (browser-level) authentications. Currently, only Basic Authentication is supported */ + httpAuthentications?: components['schemas']['HttpAuthentications'][] + } + } + /** @description Recording related metadata. Used for recordings only. Modify with caution! */ + Metadata: { + /** + * @description Width of the browser window + * @example 1950 + */ + width: number + /** + * @description Height of the browser window + * @example 1080 + */ + height: number + /** @description Setting this field to false will disable the same-origin policy during check execution */ + disableWebSecurity: boolean + /** @description Allowed values are either an empty JSON object (no authentication) or Basic Authentication */ + authentications: { + /** @description HTTP (browser-level) authentications. Currently, only Basic Authentication is supported */ + httpAuthentications?: components['schemas']['HttpAuthentications'][] + } + } + State: { + /** + * @description Interval status + * @example down + * @enum {string} + */ + status?: 'up' | 'down' | 'unknown' + from?: components['schemas']['PropertyFrom'] + /** + * Format: date-time + * @description Interval end. The format is `RFC 3339` + * @example 2020-07-14T07:25:15.000Z + */ + to?: string + /** + * @description Number of step in which an error has occured (only if `status` is `down`) + * @example 2 + */ + error_in_step?: number + /** + * @description Error message for the step that is failing (only if `status` is `down`) + * @example URL should be 'http://www.example12345.com/' but is 'http://www.example.com/'. + */ + message?: string + } + CheckStatus: { + check_id?: components['schemas']['PropertyCheckID'] + name?: components['schemas']['PropertyCheckName'] + /** @description Intervals when the check had a specific status (`up`/`down`). */ + states?: components['schemas']['State'][] + } + ReportStatusSingle: { + report?: components['schemas']['CheckStatus'] + } + ReportStatusAll: { + report?: components['schemas']['CheckStatus'][] + } + /** + * Format: int64 + * @description Average response times in milliseconds + * @example 123 + */ + AverageResponse: number + /** + * Format: int64 + * @description Amount of time when the check was down within given interval (only with the `include_uptime` flag) + * @example 10 + */ + Downtime: number + /** + * Format: int64 + * @description Amount of time when the check was up within given interval (only with the `include_uptime` flag) + * @example 230 + */ + Uptime: number + /** + * Format: int64 + * @description Amount of time when there is no specific data about check status (up/down) within given interval (only with the `include_uptime` flag) + * @example 50 + */ + Unmonitored: number + /** + * Format: date-time + * @description Interval start. The format is `RFC 3339` + * @example 2020-07-10T10:51:55.000Z + */ + PropertyFrom: string + /** + * Format: int64 + * @description ID of the check + * @example 123 + */ + PropertyCheckID: number + /** + * @description Name of the check + * @example My awesome check + */ + PropertyCheckName: string + ReportPerformance: { + report?: { + check_id?: components['schemas']['PropertyCheckID'] + name?: components['schemas']['PropertyCheckName'] + /** + * @description Size of a time bucket for which the results are calculated + * @example day + * @enum {string} + */ + resolution?: 'hour' | 'day' | 'week' + /** @description Intervals for which the measurements were performed. */ + intervals?: { + average_response?: components['schemas']['AverageResponse'] + from?: components['schemas']['PropertyFrom'] + downtime?: components['schemas']['Downtime'] + uptime?: components['schemas']['Uptime'] + unmonitored?: components['schemas']['Unmonitored'] + steps?: { + step?: components['schemas']['Step'] + average_response?: components['schemas']['AverageResponse'] + }[] + }[] + } + } + } + responses: { + /** @description Simplified description of an added check. */ + checkAddedResponse: { + content: { + 'application/json': components['schemas']['CheckSimple'] + } + } + /** @description Message indicating a successful modification */ + checkDeletedResponse: { + content: { + 'application/json': { + /** @example Deletion of check 1234567 was successful */ + message?: string + } + } + } + /** @description Detailed description of specified check. */ + checkDetailed: { + content: { + 'application/json': components['schemas']['CheckWithoutIDGET'] + } + } + /** @description Detailed description of a modified check. */ + checkModifiedResponse: { + content: { + 'application/json': components['schemas']['CheckWithoutIDGET'] + } + } + /** @description Description of all checks for a user. */ + checksAll: { + content: { + 'application/json': components['schemas']['ChecksAll'] + } + } + /** @description Status change report for a single transaction check */ + reportStatusSingle: { + content: { + 'application/json': components['schemas']['ReportStatusSingle'] + } + } + /** @description Status change report for all transaction check in the current organization */ + reportStatusAll: { + content: { + 'application/json': components['schemas']['ReportStatusAll'] + } + } + /** @description Performance report for a single transaction check */ + reportPerformance: { + content: { + 'application/json': components['schemas']['ReportPerformance'] + } + } + } + parameters: never + requestBodies: never + headers: never + pathItems: never +} + +export type $defs = Record + +export type external = Record + +export interface operations { + /** Returns a list overview of all transaction checks. */ + getAllChecks: { + parameters: { + query?: { + /** @description Specifies whether to return an extended tags representation in the response (with type and count). */ + extended_tags?: boolean + /** + * @description Tag list separated by commas. As an example "nginx,apache" would filter out all responses except those tagged nginx or apache + * @example [ + * "nginx", + * "apache" + * ] + */ + tags?: string[] + /** @description Filter to return only checks of a given type (a TMS `script` or a WPM `recording`). If not provided, all checks are returned. */ + type?: 'script' | 'recording' + /** @description Limit of returned checks */ + limit?: string + /** @description Offset of returned checks */ + offset?: string + } + } + responses: { + 200: components['responses']['checksAll'] + } + } + /** Creates a new transaction check. */ + addCheck: { + /** @description Specifies the check to be added */ + requestBody: { + content: { + 'application/json': components['schemas']['CheckWithoutID'] + } + } + responses: { + 200: components['responses']['checkAddedResponse'] + } + } + /** Returns a single transaction check. */ + getCheck: { + parameters: { + query?: { + /** @description Specifies whether to return an extended tags representation in the response (with type and count). */ + extended_tags?: boolean + } + path: { + /** @description Specifies the id of the check to be fetched */ + cid: number + } + } + responses: { + 200: components['responses']['checkDetailed'] + } + } + /** Modify settings for transaction check. */ + modifyCheck: { + parameters: { + path: { + /** @description Specifies the id of the check to be modified */ + cid: number + } + } + /** @description Specifies the data to be modified for the check */ + requestBody: { + content: { + 'application/json': components['schemas']['CheckWithoutIDPUT'] + } + } + responses: { + 200: components['responses']['checkModifiedResponse'] + } + } + /** Deletes a transaction check. */ + deleteCheck: { + parameters: { + path: { + /** @description Specifies the id of the check to be deleted */ + cid: number + } + } + responses: { + 200: components['responses']['checkDeletedResponse'] + } + } + /** + * Returns a status change report for a single transaction check + * @description Get a list of status changes for a specified check and time period. If order is speficied to descending, the list is ordered by newest first. (The default is ordered by oldest first.) It can be used to display a detailed view of a check. + */ + getCheckReportStatus: { + parameters: { + query?: { + /** @description Start time of period. The format is `RFC 3339` (properly URL-encoded!). The default value is one week earlier than `to` */ + from?: string + /** @description End time of period. The format is `RFC 3339` (properly URL-encoded!). The default value is the current time */ + to?: string + /** + * @description Sorting order of outages. Ascending or descending + * @example [ + * "desc" + * ] + */ + order?: 'asc' | 'desc' + } + path: { + /** @description Specifies the id of the check for which the status change report will be fetched */ + check_id: number + } + } + responses: { + 200: components['responses']['reportStatusSingle'] + } + } + /** + * Returns a status change report for all transaction checks in the current organization + * @description Get a list of status changes for all transaction check in the current organization from the requested time period. If order is speficied to descending, the list of statuses within each check is ordered by newest first. (The default is ordered by oldest first.) It can be used to display a list view of all checks and their current status. + */ + getCheckReportStatusAll: { + parameters: { + query?: { + /** @description Start time of period. The format is `RFC 3339` (properly URL-encoded!). The default value is one week earlier than `to` */ + from?: string + /** @description End time of period. The format is `RFC 3339` (properly URL-encoded!). The default value is the current time */ + to?: string + /** + * @description Sorting order of outages. Ascending or descending + * @example [ + * "desc" + * ] + */ + order?: 'asc' | 'desc' + /** @description Limit of returned checks */ + limit?: string + /** @description Offset of returned checks */ + offset?: string + /** @description Omits checks without any results within specified time */ + omit_empty?: boolean + } + } + responses: { + 200: components['responses']['reportStatusAll'] + } + } + /** + * Returns a performance report for a single transaction check + * @description For a given period of time, return a list of time intervals with the given resolution. An interval may be a week, a day or an hour depending on the chosen resolution. It can be used to display a detailed view of a check with information about its steps and generate graphs. + */ + getCheckReportPerformance: { + parameters: { + query?: { + /** @description Start time of period. The format is `RFC 3339` (properly URL-encoded!). The default value is 10 times the resolution (10 hours, 10 day, 10 weeks) earlier than `to`. The value is extended to the nearest hour, day or week, depending on the 'resolution' parameter and configured time zone of the account. */ + from?: string + /** @description End time of period. The format is `RFC 3339` (properly URL-encoded!). The default value is the current time. The value is extended to the nearest hour, day or week, depending on the 'resolution' parameter and configured time zone of the account. */ + to?: string + /** + * @description Sorting order of outages. Ascending or descending + * @example [ + * "desc" + * ] + */ + order?: 'asc' | 'desc' + /** + * @description Size of an interval for which the results are calculated. For the `hour` resolution, the max allowed period is one week and 1 day. For the `day` resolution, the max allowed period is 6 months and 1 day. + * @example day + */ + resolution?: 'hour' | 'day' | 'week' + /** @description Include uptime information. Adds field downtime, uptime, and unmonitored to the interval array objects. */ + include_uptime?: boolean + } + path: { + /** @description Specifies the id of the check for which the performance report will be fetched */ + check_id: number + } + } + responses: { + 200: components['responses']['reportPerformance'] + } + } +} diff --git a/server/app.ts b/server/app.ts index 0888ea2a..44d5da50 100755 --- a/server/app.ts +++ b/server/app.ts @@ -23,6 +23,7 @@ import serviceAreaRoutes from './routes/serviceAreas' import monitorRoutes from './routes/monitor' import dependencyRoutes from './routes/dependencies' import driftRadiatorRoutes from './routes/driftRadiator' +import pingdom from './routes/pingdom' import teamHealthRoutes from './routes/teamHealth' import missingFromCatalogueRoutes from './routes/missingFromCatalogue' import namespacesRoutes from './routes/namespaces' @@ -54,6 +55,7 @@ export default function createApp(services: Services): express.Application { app.use('/monitor', monitorRoutes(services)) app.use('/dependencies', dependencyRoutes(services)) app.use('/drift-radiator', driftRadiatorRoutes(services)) + app.use('/pingdom', pingdom(services)) app.use('/team-health', teamHealthRoutes(services)) app.use('/product-dependencies', productDependencyRoutes(services)) app.use('/missing-from-catalogue', missingFromCatalogueRoutes(services)) diff --git a/server/config.ts b/server/config.ts index 79f3600c..75e1b3f0 100755 --- a/server/config.ts +++ b/server/config.ts @@ -27,6 +27,7 @@ export interface ApiConfig { deadline: number } agent: AgentConfig + token: string } export default { @@ -57,6 +58,15 @@ export default { }, agent: new AgentConfig(Number(get('SERVICE_CATALOGUE_TIMEOUT_RESPONSE', 5000))), }, + pingdom: { + url: get('PINGDOM_API', 'https://api.pingdom.com/api/3.1/', requiredInProduction), + timeout: { + response: Number(get('PINGDOM_API_TIMEOUT_RESPONSE', 5000)), + deadline: Number(get('PINGDOM_API_TIMEOUT_DEADLINE', 5000)), + }, + agent: new AgentConfig(Number(get('PINGDOM_API_TIMEOUT_RESPONSE', 5000))), + token: get('PINGDOM_TOKEN', '', requiredInProduction), + }, }, domain: get('INGRESS_URL', 'http://localhost:3000', requiredInProduction), } diff --git a/server/data/index.ts b/server/data/index.ts index 16e46b3e..9c9d3eac 100644 --- a/server/data/index.ts +++ b/server/data/index.ts @@ -12,13 +12,16 @@ buildAppInsightsClient(applicationInfo) import StrapiApiClient from './strapiApiClient' +import PingdomApiClient from './pingdomApiClient' + type RestClientBuilder = (token: string) => T export const dataAccess = () => ({ applicationInfo, strapiApiClientBuilder: (() => new StrapiApiClient()) as RestClientBuilder, + pingdomApiClientBuilder: (() => new PingdomApiClient()) as RestClientBuilder, }) export type DataAccess = ReturnType -export { StrapiApiClient, RestClientBuilder } +export { PingdomApiClient, StrapiApiClient, RestClientBuilder } diff --git a/server/data/pingdomApiClient.ts b/server/data/pingdomApiClient.ts new file mode 100644 index 00000000..381f1735 --- /dev/null +++ b/server/data/pingdomApiClient.ts @@ -0,0 +1,17 @@ +import RestClient from './restClient' +import config, { ApiConfig } from '../config' +import { Checks } from './pingdomApiTypes' + +export default class PingdomApiClient { + private restClient: RestClient + + constructor() { + this.restClient = new RestClient('pingdomApiClient', config.apis.pingdom as ApiConfig) + } + + async getChecks(): Promise { + return this.restClient.get({ + path: '/checks', + }) + } +} diff --git a/server/data/pingdomApiTypes.ts b/server/data/pingdomApiTypes.ts new file mode 100644 index 00000000..6f156342 --- /dev/null +++ b/server/data/pingdomApiTypes.ts @@ -0,0 +1,4 @@ +import { components } from '../@types/pingdom' + +export type Check = components['schemas']['Check'] +export type Checks = components['schemas']['Checks'] diff --git a/server/data/restClient.ts b/server/data/restClient.ts index c7e6d9e6..9b1f570d 100644 --- a/server/data/restClient.ts +++ b/server/data/restClient.ts @@ -35,7 +35,6 @@ export default class RestClient { constructor( private readonly name: string, private readonly config: ApiConfig, - private readonly token: string, ) { this.agent = config.url.startsWith('https') ? new HttpsAgent(config.agent) : new Agent(config.agent) } @@ -48,6 +47,10 @@ export default class RestClient { return this.config.timeout } + private token() { + return this.config.token + } + async get({ path = null, query = '', headers = {}, responseType = '', raw = false }: GetRequest): Promise { logger.info(`Get calling ${this.name}: ${path} ${query}`) try { @@ -59,7 +62,7 @@ export default class RestClient { return undefined // retry handler only for logging retries, not to influence retry logic }) .query(query) - .auth(this.token, { type: 'bearer' }) + .auth(this.token(), { type: 'bearer' }) .set(headers) .responseType(responseType) .timeout(this.timeoutConfig()) @@ -89,7 +92,7 @@ export default class RestClient { if (err) logger.info(`Retry handler found API error with ${err.code} ${err.message}`) return undefined // retry handler only for logging retries, not to influence retry logic }) - .auth(this.token, { type: 'bearer' }) + .auth(this.token(), { type: 'bearer' }) .set(headers) .responseType(responseType) .timeout(this.timeoutConfig()) @@ -108,7 +111,7 @@ export default class RestClient { superagent .get(`${this.apiUrl()}${path}`) .agent(this.agent) - .auth(this.token, { type: 'bearer' }) + .auth(this.token(), { type: 'bearer' }) .retry(2, (err, res) => { if (err) logger.info(`Retry handler found API error with ${err.code} ${err.message}`) return undefined // retry handler only for logging retries, not to influence retry logic diff --git a/server/data/strapiApiClient.ts b/server/data/strapiApiClient.ts index 07b4a8a4..b1fede42 100644 --- a/server/data/strapiApiClient.ts +++ b/server/data/strapiApiClient.ts @@ -21,7 +21,7 @@ export default class StrapiApiClient { private restClient: RestClient constructor() { - this.restClient = new RestClient('strapiApiClient', config.apis.serviceCatalogue as ApiConfig, '') + this.restClient = new RestClient('strapiApiClient', config.apis.serviceCatalogue as ApiConfig) } async getProducts({ diff --git a/server/routes/pingdom.ts b/server/routes/pingdom.ts new file mode 100644 index 00000000..4c08e222 --- /dev/null +++ b/server/routes/pingdom.ts @@ -0,0 +1,17 @@ +import { type RequestHandler, Router } from 'express' +import asyncMiddleware from '../middleware/asyncMiddleware' +import type { Services } from '../services' + +export default function routes({ pingdomService }: Services): Router { + const router = Router() + + const get = (path: string, handler: RequestHandler) => router.get(path, asyncMiddleware(handler)) + + get('/', async (req, res) => { + const pingdomChecks = await pingdomService.getChecks() + + return res.render('pages/pingdom', { checks: pingdomChecks }) + }) + + return router +} diff --git a/server/services/index.ts b/server/services/index.ts index 58829eb3..f1a5adef 100644 --- a/server/services/index.ts +++ b/server/services/index.ts @@ -1,5 +1,6 @@ import { dataAccess } from '../data' import ServiceCatalogueService from './serviceCatalogueService' +import PingdomService from './pingdomService' import ProductDependenciesService from './productDependenciesService' import RedisService from './redisService' import { createRedisClient } from '../data/redisClient' @@ -9,11 +10,12 @@ import DataFilterService from './dataFilterService' import TeamHealthService from './teamHealthService' export const services = () => { - const { strapiApiClientBuilder, applicationInfo } = dataAccess() + const { pingdomApiClientBuilder, strapiApiClientBuilder, applicationInfo } = dataAccess() const client = createRedisClient() client.connect().catch((err: Error) => logger.error(`Error connecting to Redis`, err)) const serviceCatalogueService = new ServiceCatalogueService(strapiApiClientBuilder) + const pingdomService = new PingdomService(pingdomApiClientBuilder) const componentNameService = new ComponentNameService(strapiApiClientBuilder) const redisService = new RedisService(client) const productDependenciesService = new ProductDependenciesService(strapiApiClientBuilder, redisService) @@ -23,6 +25,7 @@ export const services = () => { return { applicationInfo, serviceCatalogueService, + pingdomService, componentNameService, redisService, dataFilterService, diff --git a/server/services/pingdomService.ts b/server/services/pingdomService.ts new file mode 100644 index 00000000..21275165 --- /dev/null +++ b/server/services/pingdomService.ts @@ -0,0 +1,13 @@ +import type { PingdomApiClient, RestClientBuilder } from '../data' +import { Checks } from '../data/pingdomApiTypes' + +export default class PingdomService { + constructor(private readonly pingdomApiClientFactory: RestClientBuilder) {} + + async getChecks(): Promise { + const pingdomApiClient = this.pingdomApiClientFactory('') + const checks = await pingdomApiClient.getChecks() + + return checks + } +} diff --git a/server/views/pages/pingdom.njk b/server/views/pages/pingdom.njk new file mode 100644 index 00000000..05685acd --- /dev/null +++ b/server/views/pages/pingdom.njk @@ -0,0 +1,18 @@ +{% extends "../partials/layout.njk" %} + +{% set pageTitle = applicationName %} +{% set mainClasses = "app-container govuk-body" %} + +{% block content %} + +

Pingdom

+ +{{ checks | dump | safe }} + +{% endblock %} + +{% block bodyEnd %} + + + +{% endblock %}