datadog_api_client/datadog/
configuration.rs

1// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
2// This product includes software developed at Datadog (https://www.datadoghq.com/).
3// Copyright 2019-Present Datadog, Inc.
4use lazy_static::lazy_static;
5use log::warn;
6use std::collections::HashMap;
7use std::env;
8
9#[derive(Debug, Clone)]
10pub struct ServerVariable {
11    pub description: String,
12    pub default_value: String,
13    pub enum_values: Vec<String>,
14}
15
16#[derive(Debug, Clone)]
17pub struct ServerConfiguration {
18    pub url: String,
19    pub description: String,
20    pub variables: HashMap<String, ServerVariable>,
21}
22
23impl ServerConfiguration {
24    pub fn get_url(&self, variables: &HashMap<String, String>) -> String {
25        let mut url = self.url.clone();
26        for (name, variable) in &self.variables {
27            let value = variables.get(name).unwrap_or(&variable.default_value);
28            if !variable.enum_values.contains(value) && !variable.enum_values.is_empty() {
29                panic!("Value {value} for variable {name} is not in the enum values");
30            }
31            url = url.replace(&format!("{{{name}}}"), &value);
32        }
33        url
34    }
35}
36
37#[derive(Debug, Clone)]
38pub struct APIKey {
39    pub key: String,
40    pub prefix: String,
41}
42
43#[non_exhaustive]
44#[derive(Debug, Clone)]
45pub struct Configuration {
46    pub(crate) user_agent: String,
47    pub(crate) unstable_operations: HashMap<String, bool>,
48    pub(crate) auth_keys: HashMap<String, APIKey>,
49    pub server_index: usize,
50    pub server_variables: HashMap<String, String>,
51    pub server_operation_index: HashMap<String, usize>,
52    pub server_operation_variables: HashMap<String, HashMap<String, String>>,
53    pub proxy_url: Option<String>,
54    pub enable_retry: bool,
55    pub max_retries: u32,
56}
57
58impl Configuration {
59    pub fn new() -> Self {
60        Self::default()
61    }
62
63    pub fn get_operation_host(&self, operation_str: &str) -> String {
64        let operation = operation_str.to_string();
65        let server_index = self
66            .server_operation_index
67            .get(&operation)
68            .unwrap_or(&self.server_index);
69        let server_variables = self
70            .server_operation_variables
71            .get(&operation)
72            .unwrap_or(&self.server_variables);
73        let servers = OPERATION_SERVERS.get(&operation).unwrap_or(&SERVERS);
74        servers
75            .get(*server_index)
76            .expect(&format!("Server index for operation {operation} not found"))
77            .get_url(&server_variables)
78    }
79
80    pub fn set_unstable_operation_enabled(&mut self, operation: &str, enabled: bool) -> bool {
81        if self.unstable_operations.contains_key(operation) {
82            self.unstable_operations
83                .insert(operation.to_string(), enabled);
84            return true;
85        }
86
87        warn!("Operation {operation} is not an unstable operation, can't enable/disable");
88        false
89    }
90
91    pub fn is_unstable_operation_enabled(&self, operation: &str) -> bool {
92        if self.unstable_operations.contains_key(operation) {
93            return self.unstable_operations.get(operation).unwrap().clone();
94        }
95
96        warn!("Operation {operation} is not an unstable operation, is always enabled");
97        false
98    }
99
100    pub fn is_unstable_operation(&self, operation: &str) -> bool {
101        if self.unstable_operations.contains_key(operation) {
102            return true;
103        }
104
105        false
106    }
107
108    pub fn set_auth_key(&mut self, operation_str: &str, api_key: APIKey) {
109        self.auth_keys.insert(operation_str.to_string(), api_key);
110    }
111
112    pub fn set_proxy_url(&mut self, proxy_url: Option<String>) {
113        self.proxy_url = proxy_url;
114    }
115
116    pub fn set_retry(&mut self, enable_retry: bool, max_retries: u32) {
117        self.enable_retry = enable_retry;
118        self.max_retries = max_retries;
119    }
120}
121
122impl Default for Configuration {
123    fn default() -> Self {
124        let unstable_operations = HashMap::from([
125            ("v2.create_open_api".to_owned(), false),
126            ("v2.delete_open_api".to_owned(), false),
127            ("v2.get_open_api".to_owned(), false),
128            ("v2.list_apis".to_owned(), false),
129            ("v2.update_open_api".to_owned(), false),
130            ("v2.cancel_historical_job".to_owned(), false),
131            ("v2.convert_job_result_to_signal".to_owned(), false),
132            ("v2.delete_historical_job".to_owned(), false),
133            ("v2.get_finding".to_owned(), false),
134            ("v2.get_historical_job".to_owned(), false),
135            ("v2.get_rule_version_history".to_owned(), false),
136            ("v2.get_sbom".to_owned(), false),
137            ("v2.get_security_monitoring_histsignal".to_owned(), false),
138            (
139                "v2.get_security_monitoring_histsignals_by_job_id".to_owned(),
140                false,
141            ),
142            ("v2.list_assets_sbo_ms".to_owned(), false),
143            ("v2.list_findings".to_owned(), false),
144            ("v2.list_historical_jobs".to_owned(), false),
145            ("v2.list_security_monitoring_histsignals".to_owned(), false),
146            ("v2.list_vulnerabilities".to_owned(), false),
147            ("v2.list_vulnerable_assets".to_owned(), false),
148            ("v2.mute_findings".to_owned(), false),
149            ("v2.run_historical_job".to_owned(), false),
150            (
151                "v2.search_security_monitoring_histsignals".to_owned(),
152                false,
153            ),
154            ("v2.create_dataset".to_owned(), false),
155            ("v2.delete_dataset".to_owned(), false),
156            ("v2.get_all_datasets".to_owned(), false),
157            ("v2.get_dataset".to_owned(), false),
158            ("v2.update_dataset".to_owned(), false),
159            ("v2.cancel_data_deletion_request".to_owned(), false),
160            ("v2.create_data_deletion_request".to_owned(), false),
161            ("v2.get_data_deletion_requests".to_owned(), false),
162            ("v2.create_incident".to_owned(), false),
163            ("v2.create_incident_integration".to_owned(), false),
164            ("v2.create_incident_notification_rule".to_owned(), false),
165            ("v2.create_incident_notification_template".to_owned(), false),
166            ("v2.create_incident_todo".to_owned(), false),
167            ("v2.create_incident_type".to_owned(), false),
168            ("v2.delete_incident".to_owned(), false),
169            ("v2.delete_incident_integration".to_owned(), false),
170            ("v2.delete_incident_notification_rule".to_owned(), false),
171            ("v2.delete_incident_notification_template".to_owned(), false),
172            ("v2.delete_incident_todo".to_owned(), false),
173            ("v2.delete_incident_type".to_owned(), false),
174            ("v2.get_incident".to_owned(), false),
175            ("v2.get_incident_integration".to_owned(), false),
176            ("v2.get_incident_notification_rule".to_owned(), false),
177            ("v2.get_incident_notification_template".to_owned(), false),
178            ("v2.get_incident_todo".to_owned(), false),
179            ("v2.get_incident_type".to_owned(), false),
180            ("v2.list_incident_attachments".to_owned(), false),
181            ("v2.list_incident_integrations".to_owned(), false),
182            ("v2.list_incident_notification_rules".to_owned(), false),
183            ("v2.list_incident_notification_templates".to_owned(), false),
184            ("v2.list_incidents".to_owned(), false),
185            ("v2.list_incident_todos".to_owned(), false),
186            ("v2.list_incident_types".to_owned(), false),
187            ("v2.search_incidents".to_owned(), false),
188            ("v2.update_incident".to_owned(), false),
189            ("v2.update_incident_attachments".to_owned(), false),
190            ("v2.update_incident_integration".to_owned(), false),
191            ("v2.update_incident_notification_rule".to_owned(), false),
192            ("v2.update_incident_notification_template".to_owned(), false),
193            ("v2.update_incident_todo".to_owned(), false),
194            ("v2.update_incident_type".to_owned(), false),
195            ("v2.create_monitor_user_template".to_owned(), false),
196            ("v2.delete_monitor_user_template".to_owned(), false),
197            ("v2.get_monitor_user_template".to_owned(), false),
198            ("v2.list_monitor_user_templates".to_owned(), false),
199            ("v2.update_monitor_user_template".to_owned(), false),
200            (
201                "v2.validate_existing_monitor_user_template".to_owned(),
202                false,
203            ),
204            ("v2.validate_monitor_user_template".to_owned(), false),
205            ("v2.create_pipeline".to_owned(), false),
206            ("v2.delete_pipeline".to_owned(), false),
207            ("v2.get_pipeline".to_owned(), false),
208            ("v2.list_pipelines".to_owned(), false),
209            ("v2.update_pipeline".to_owned(), false),
210            ("v2.validate_pipeline".to_owned(), false),
211            ("v2.create_scorecard_outcomes_batch".to_owned(), false),
212            ("v2.create_scorecard_rule".to_owned(), false),
213            ("v2.delete_scorecard_rule".to_owned(), false),
214            ("v2.list_scorecard_outcomes".to_owned(), false),
215            ("v2.list_scorecard_rules".to_owned(), false),
216            ("v2.update_scorecard_outcomes_async".to_owned(), false),
217            ("v2.update_scorecard_rule".to_owned(), false),
218            ("v2.create_incident_service".to_owned(), false),
219            ("v2.delete_incident_service".to_owned(), false),
220            ("v2.get_incident_service".to_owned(), false),
221            ("v2.list_incident_services".to_owned(), false),
222            ("v2.update_incident_service".to_owned(), false),
223            ("v2.create_slo_report_job".to_owned(), false),
224            ("v2.get_slo_report".to_owned(), false),
225            ("v2.get_slo_report_job_status".to_owned(), false),
226            ("v2.get_spa_recommendations".to_owned(), false),
227            ("v2.add_member_team".to_owned(), false),
228            ("v2.list_member_teams".to_owned(), false),
229            ("v2.remove_member_team".to_owned(), false),
230            ("v2.sync_teams".to_owned(), false),
231            ("v2.create_incident_team".to_owned(), false),
232            ("v2.delete_incident_team".to_owned(), false),
233            ("v2.get_incident_team".to_owned(), false),
234            ("v2.list_incident_teams".to_owned(), false),
235            ("v2.update_incident_team".to_owned(), false),
236        ]);
237        let mut auth_keys: HashMap<String, APIKey> = HashMap::new();
238        auth_keys.insert(
239            "apiKeyAuth".to_owned(),
240            APIKey {
241                key: env::var("DD_API_KEY").unwrap_or_default(),
242                prefix: "".to_owned(),
243            },
244        );
245        auth_keys.insert(
246            "appKeyAuth".to_owned(),
247            APIKey {
248                key: env::var("DD_APP_KEY").unwrap_or_default(),
249                prefix: "".to_owned(),
250            },
251        );
252
253        Self {
254            user_agent: DEFAULT_USER_AGENT.clone(),
255            unstable_operations,
256            auth_keys,
257            server_index: 0,
258            server_variables: HashMap::from([(
259                "site".into(),
260                env::var("DD_SITE").unwrap_or("datadoghq.com".into()),
261            )]),
262            server_operation_index: HashMap::new(),
263            server_operation_variables: HashMap::new(),
264            proxy_url: None,
265            enable_retry: false,
266            max_retries: 3,
267        }
268    }
269}
270
271lazy_static! {
272    pub static ref DEFAULT_USER_AGENT: String = format!(
273        "datadog-api-client-rust/{} (rust {}; os {}; arch {})",
274        option_env!("CARGO_PKG_VERSION").unwrap_or("?"),
275        option_env!("DD_RUSTC_VERSION").unwrap_or("?"),
276        env::consts::OS,
277        env::consts::ARCH,
278    );
279    static ref SERVERS: Vec<ServerConfiguration> = {
280        vec![
281            ServerConfiguration {
282                url: "https://{subdomain}.{site}".into(),
283                description: "No description provided".into(),
284                variables: HashMap::from([
285                    (
286                        "site".into(),
287                        ServerVariable {
288                            description: "The regional site for Datadog customers.".into(),
289                            default_value: "datadoghq.com".into(),
290                            enum_values: vec![
291                                "datadoghq.com".into(),
292                                "us3.datadoghq.com".into(),
293                                "us5.datadoghq.com".into(),
294                                "ap1.datadoghq.com".into(),
295                                "ap2.datadoghq.com".into(),
296                                "datadoghq.eu".into(),
297                                "ddog-gov.com".into(),
298                            ],
299                        },
300                    ),
301                    (
302                        "subdomain".into(),
303                        ServerVariable {
304                            description: "The subdomain where the API is deployed.".into(),
305                            default_value: "api".into(),
306                            enum_values: vec![],
307                        },
308                    ),
309                ]),
310            },
311            ServerConfiguration {
312                url: "{protocol}://{name}".into(),
313                description: "No description provided".into(),
314                variables: HashMap::from([
315                    (
316                        "name".into(),
317                        ServerVariable {
318                            description: "Full site DNS name.".into(),
319                            default_value: "api.datadoghq.com".into(),
320                            enum_values: vec![],
321                        },
322                    ),
323                    (
324                        "protocol".into(),
325                        ServerVariable {
326                            description: "The protocol for accessing the API.".into(),
327                            default_value: "https".into(),
328                            enum_values: vec![],
329                        },
330                    ),
331                ]),
332            },
333            ServerConfiguration {
334                url: "https://{subdomain}.{site}".into(),
335                description: "No description provided".into(),
336                variables: HashMap::from([
337                    (
338                        "site".into(),
339                        ServerVariable {
340                            description: "Any Datadog deployment.".into(),
341                            default_value: "datadoghq.com".into(),
342                            enum_values: vec![],
343                        },
344                    ),
345                    (
346                        "subdomain".into(),
347                        ServerVariable {
348                            description: "The subdomain where the API is deployed.".into(),
349                            default_value: "api".into(),
350                            enum_values: vec![],
351                        },
352                    ),
353                ]),
354            },
355        ]
356    };
357    static ref OPERATION_SERVERS: HashMap<String, Vec<ServerConfiguration>> = {
358        HashMap::from([
359            (
360                "v1.get_ip_ranges".into(),
361                vec![
362                    ServerConfiguration {
363                        url: "https://{subdomain}.{site}".into(),
364                        description: "No description provided".into(),
365                        variables: HashMap::from([
366                            (
367                                "site".into(),
368                                ServerVariable {
369                                    description: "The regional site for Datadog customers.".into(),
370                                    default_value: "datadoghq.com".into(),
371                                    enum_values: vec![
372                                        "datadoghq.com".into(),
373                                        "us3.datadoghq.com".into(),
374                                        "us5.datadoghq.com".into(),
375                                        "ap1.datadoghq.com".into(),
376                                        "ap2.datadoghq.com".into(),
377                                        "datadoghq.eu".into(),
378                                        "ddog-gov.com".into(),
379                                    ],
380                                },
381                            ),
382                            (
383                                "subdomain".into(),
384                                ServerVariable {
385                                    description: "The subdomain where the API is deployed.".into(),
386                                    default_value: "ip-ranges".into(),
387                                    enum_values: vec![],
388                                },
389                            ),
390                        ]),
391                    },
392                    ServerConfiguration {
393                        url: "{protocol}://{name}".into(),
394                        description: "No description provided".into(),
395                        variables: HashMap::from([
396                            (
397                                "name".into(),
398                                ServerVariable {
399                                    description: "Full site DNS name.".into(),
400                                    default_value: "ip-ranges.datadoghq.com".into(),
401                                    enum_values: vec![],
402                                },
403                            ),
404                            (
405                                "protocol".into(),
406                                ServerVariable {
407                                    description: "The protocol for accessing the API.".into(),
408                                    default_value: "https".into(),
409                                    enum_values: vec![],
410                                },
411                            ),
412                        ]),
413                    },
414                    ServerConfiguration {
415                        url: "https://{subdomain}.datadoghq.com".into(),
416                        description: "No description provided".into(),
417                        variables: HashMap::from([(
418                            "subdomain".into(),
419                            ServerVariable {
420                                description: "The subdomain where the API is deployed.".into(),
421                                default_value: "ip-ranges".into(),
422                                enum_values: vec![],
423                            },
424                        )]),
425                    },
426                ],
427            ),
428            (
429                "v1.submit_log".into(),
430                vec![
431                    ServerConfiguration {
432                        url: "https://{subdomain}.{site}".into(),
433                        description: "No description provided".into(),
434                        variables: HashMap::from([
435                            (
436                                "site".into(),
437                                ServerVariable {
438                                    description: "The regional site for Datadog customers.".into(),
439                                    default_value: "datadoghq.com".into(),
440                                    enum_values: vec![
441                                        "datadoghq.com".into(),
442                                        "us3.datadoghq.com".into(),
443                                        "us5.datadoghq.com".into(),
444                                        "ap1.datadoghq.com".into(),
445                                        "ap2.datadoghq.com".into(),
446                                        "datadoghq.eu".into(),
447                                        "ddog-gov.com".into(),
448                                    ],
449                                },
450                            ),
451                            (
452                                "subdomain".into(),
453                                ServerVariable {
454                                    description: "The subdomain where the API is deployed.".into(),
455                                    default_value: "http-intake.logs".into(),
456                                    enum_values: vec![],
457                                },
458                            ),
459                        ]),
460                    },
461                    ServerConfiguration {
462                        url: "{protocol}://{name}".into(),
463                        description: "No description provided".into(),
464                        variables: HashMap::from([
465                            (
466                                "name".into(),
467                                ServerVariable {
468                                    description: "Full site DNS name.".into(),
469                                    default_value: "http-intake.logs.datadoghq.com".into(),
470                                    enum_values: vec![],
471                                },
472                            ),
473                            (
474                                "protocol".into(),
475                                ServerVariable {
476                                    description: "The protocol for accessing the API.".into(),
477                                    default_value: "https".into(),
478                                    enum_values: vec![],
479                                },
480                            ),
481                        ]),
482                    },
483                    ServerConfiguration {
484                        url: "https://{subdomain}.{site}".into(),
485                        description: "No description provided".into(),
486                        variables: HashMap::from([
487                            (
488                                "site".into(),
489                                ServerVariable {
490                                    description: "Any Datadog deployment.".into(),
491                                    default_value: "datadoghq.com".into(),
492                                    enum_values: vec![],
493                                },
494                            ),
495                            (
496                                "subdomain".into(),
497                                ServerVariable {
498                                    description: "The subdomain where the API is deployed.".into(),
499                                    default_value: "http-intake.logs".into(),
500                                    enum_values: vec![],
501                                },
502                            ),
503                        ]),
504                    },
505                ],
506            ),
507            (
508                "v2.create_event".into(),
509                vec![
510                    ServerConfiguration {
511                        url: "https://{subdomain}.{site}".into(),
512                        description: "No description provided".into(),
513                        variables: HashMap::from([
514                            (
515                                "site".into(),
516                                ServerVariable {
517                                    description: "The regional site for customers.".into(),
518                                    default_value: "datadoghq.com".into(),
519                                    enum_values: vec![
520                                        "datadoghq.com".into(),
521                                        "us3.datadoghq.com".into(),
522                                        "us5.datadoghq.com".into(),
523                                        "ap1.datadoghq.com".into(),
524                                        "datadoghq.eu".into(),
525                                        "ddog-gov.com".into(),
526                                    ],
527                                },
528                            ),
529                            (
530                                "subdomain".into(),
531                                ServerVariable {
532                                    description: "The subdomain where the API is deployed.".into(),
533                                    default_value: "event-management-intake".into(),
534                                    enum_values: vec![],
535                                },
536                            ),
537                        ]),
538                    },
539                    ServerConfiguration {
540                        url: "{protocol}://{name}".into(),
541                        description: "No description provided".into(),
542                        variables: HashMap::from([
543                            (
544                                "name".into(),
545                                ServerVariable {
546                                    description: "Full site DNS name.".into(),
547                                    default_value: "event-management-intake.datadoghq.com".into(),
548                                    enum_values: vec![],
549                                },
550                            ),
551                            (
552                                "protocol".into(),
553                                ServerVariable {
554                                    description: "The protocol for accessing the API.".into(),
555                                    default_value: "https".into(),
556                                    enum_values: vec![],
557                                },
558                            ),
559                        ]),
560                    },
561                    ServerConfiguration {
562                        url: "https://{subdomain}.{site}".into(),
563                        description: "No description provided".into(),
564                        variables: HashMap::from([
565                            (
566                                "site".into(),
567                                ServerVariable {
568                                    description: "Any Datadog deployment.".into(),
569                                    default_value: "datadoghq.com".into(),
570                                    enum_values: vec![],
571                                },
572                            ),
573                            (
574                                "subdomain".into(),
575                                ServerVariable {
576                                    description: "The subdomain where the API is deployed.".into(),
577                                    default_value: "event-management-intake".into(),
578                                    enum_values: vec![],
579                                },
580                            ),
581                        ]),
582                    },
583                ],
584            ),
585            (
586                "v2.submit_log".into(),
587                vec![
588                    ServerConfiguration {
589                        url: "https://{subdomain}.{site}".into(),
590                        description: "No description provided".into(),
591                        variables: HashMap::from([
592                            (
593                                "site".into(),
594                                ServerVariable {
595                                    description: "The regional site for customers.".into(),
596                                    default_value: "datadoghq.com".into(),
597                                    enum_values: vec![
598                                        "datadoghq.com".into(),
599                                        "us3.datadoghq.com".into(),
600                                        "us5.datadoghq.com".into(),
601                                        "ap1.datadoghq.com".into(),
602                                        "ap2.datadoghq.com".into(),
603                                        "datadoghq.eu".into(),
604                                        "ddog-gov.com".into(),
605                                    ],
606                                },
607                            ),
608                            (
609                                "subdomain".into(),
610                                ServerVariable {
611                                    description: "The subdomain where the API is deployed.".into(),
612                                    default_value: "http-intake.logs".into(),
613                                    enum_values: vec![],
614                                },
615                            ),
616                        ]),
617                    },
618                    ServerConfiguration {
619                        url: "{protocol}://{name}".into(),
620                        description: "No description provided".into(),
621                        variables: HashMap::from([
622                            (
623                                "name".into(),
624                                ServerVariable {
625                                    description: "Full site DNS name.".into(),
626                                    default_value: "http-intake.logs.datadoghq.com".into(),
627                                    enum_values: vec![],
628                                },
629                            ),
630                            (
631                                "protocol".into(),
632                                ServerVariable {
633                                    description: "The protocol for accessing the API.".into(),
634                                    default_value: "https".into(),
635                                    enum_values: vec![],
636                                },
637                            ),
638                        ]),
639                    },
640                    ServerConfiguration {
641                        url: "https://{subdomain}.{site}".into(),
642                        description: "No description provided".into(),
643                        variables: HashMap::from([
644                            (
645                                "site".into(),
646                                ServerVariable {
647                                    description: "Any Datadog deployment.".into(),
648                                    default_value: "datadoghq.com".into(),
649                                    enum_values: vec![],
650                                },
651                            ),
652                            (
653                                "subdomain".into(),
654                                ServerVariable {
655                                    description: "The subdomain where the API is deployed.".into(),
656                                    default_value: "http-intake.logs".into(),
657                                    enum_values: vec![],
658                                },
659                            ),
660                        ]),
661                    },
662                ],
663            ),
664            (
665                "v2.create_on_call_page".into(),
666                vec![
667                    ServerConfiguration {
668                        url: "https://{site}".into(),
669                        description: "No description provided".into(),
670                        variables: HashMap::from([(
671                            "site".into(),
672                            ServerVariable {
673                                description: "The globally available endpoint for On-Call.".into(),
674                                default_value: "navy.oncall.datadoghq.com".into(),
675                                enum_values: vec![
676                                    "lava.oncall.datadoghq.com".into(),
677                                    "saffron.oncall.datadoghq.com".into(),
678                                    "navy.oncall.datadoghq.com".into(),
679                                    "coral.oncall.datadoghq.com".into(),
680                                    "teal.oncall.datadoghq.com".into(),
681                                    "beige.oncall.datadoghq.eu".into(),
682                                ],
683                            },
684                        )]),
685                    },
686                    ServerConfiguration {
687                        url: "{protocol}://{name}".into(),
688                        description: "No description provided".into(),
689                        variables: HashMap::from([
690                            (
691                                "name".into(),
692                                ServerVariable {
693                                    description: "Full site DNS name.".into(),
694                                    default_value: "api.datadoghq.com".into(),
695                                    enum_values: vec![],
696                                },
697                            ),
698                            (
699                                "protocol".into(),
700                                ServerVariable {
701                                    description: "The protocol for accessing the API.".into(),
702                                    default_value: "https".into(),
703                                    enum_values: vec![],
704                                },
705                            ),
706                        ]),
707                    },
708                    ServerConfiguration {
709                        url: "https://{subdomain}.{site}".into(),
710                        description: "No description provided".into(),
711                        variables: HashMap::from([
712                            (
713                                "site".into(),
714                                ServerVariable {
715                                    description: "Any Datadog deployment.".into(),
716                                    default_value: "datadoghq.com".into(),
717                                    enum_values: vec![],
718                                },
719                            ),
720                            (
721                                "subdomain".into(),
722                                ServerVariable {
723                                    description: "The subdomain where the API is deployed.".into(),
724                                    default_value: "api".into(),
725                                    enum_values: vec![],
726                                },
727                            ),
728                        ]),
729                    },
730                ],
731            ),
732            (
733                "v2.acknowledge_on_call_page".into(),
734                vec![
735                    ServerConfiguration {
736                        url: "https://{site}".into(),
737                        description: "No description provided".into(),
738                        variables: HashMap::from([(
739                            "site".into(),
740                            ServerVariable {
741                                description: "The globally available endpoint for On-Call.".into(),
742                                default_value: "navy.oncall.datadoghq.com".into(),
743                                enum_values: vec![
744                                    "lava.oncall.datadoghq.com".into(),
745                                    "saffron.oncall.datadoghq.com".into(),
746                                    "navy.oncall.datadoghq.com".into(),
747                                    "coral.oncall.datadoghq.com".into(),
748                                    "teal.oncall.datadoghq.com".into(),
749                                    "beige.oncall.datadoghq.eu".into(),
750                                ],
751                            },
752                        )]),
753                    },
754                    ServerConfiguration {
755                        url: "{protocol}://{name}".into(),
756                        description: "No description provided".into(),
757                        variables: HashMap::from([
758                            (
759                                "name".into(),
760                                ServerVariable {
761                                    description: "Full site DNS name.".into(),
762                                    default_value: "api.datadoghq.com".into(),
763                                    enum_values: vec![],
764                                },
765                            ),
766                            (
767                                "protocol".into(),
768                                ServerVariable {
769                                    description: "The protocol for accessing the API.".into(),
770                                    default_value: "https".into(),
771                                    enum_values: vec![],
772                                },
773                            ),
774                        ]),
775                    },
776                    ServerConfiguration {
777                        url: "https://{subdomain}.{site}".into(),
778                        description: "No description provided".into(),
779                        variables: HashMap::from([
780                            (
781                                "site".into(),
782                                ServerVariable {
783                                    description: "Any Datadog deployment.".into(),
784                                    default_value: "datadoghq.com".into(),
785                                    enum_values: vec![],
786                                },
787                            ),
788                            (
789                                "subdomain".into(),
790                                ServerVariable {
791                                    description: "The subdomain where the API is deployed.".into(),
792                                    default_value: "api".into(),
793                                    enum_values: vec![],
794                                },
795                            ),
796                        ]),
797                    },
798                ],
799            ),
800            (
801                "v2.escalate_on_call_page".into(),
802                vec![
803                    ServerConfiguration {
804                        url: "https://{site}".into(),
805                        description: "No description provided".into(),
806                        variables: HashMap::from([(
807                            "site".into(),
808                            ServerVariable {
809                                description: "The globally available endpoint for On-Call.".into(),
810                                default_value: "navy.oncall.datadoghq.com".into(),
811                                enum_values: vec![
812                                    "lava.oncall.datadoghq.com".into(),
813                                    "saffron.oncall.datadoghq.com".into(),
814                                    "navy.oncall.datadoghq.com".into(),
815                                    "coral.oncall.datadoghq.com".into(),
816                                    "teal.oncall.datadoghq.com".into(),
817                                    "beige.oncall.datadoghq.eu".into(),
818                                ],
819                            },
820                        )]),
821                    },
822                    ServerConfiguration {
823                        url: "{protocol}://{name}".into(),
824                        description: "No description provided".into(),
825                        variables: HashMap::from([
826                            (
827                                "name".into(),
828                                ServerVariable {
829                                    description: "Full site DNS name.".into(),
830                                    default_value: "api.datadoghq.com".into(),
831                                    enum_values: vec![],
832                                },
833                            ),
834                            (
835                                "protocol".into(),
836                                ServerVariable {
837                                    description: "The protocol for accessing the API.".into(),
838                                    default_value: "https".into(),
839                                    enum_values: vec![],
840                                },
841                            ),
842                        ]),
843                    },
844                    ServerConfiguration {
845                        url: "https://{subdomain}.{site}".into(),
846                        description: "No description provided".into(),
847                        variables: HashMap::from([
848                            (
849                                "site".into(),
850                                ServerVariable {
851                                    description: "Any Datadog deployment.".into(),
852                                    default_value: "datadoghq.com".into(),
853                                    enum_values: vec![],
854                                },
855                            ),
856                            (
857                                "subdomain".into(),
858                                ServerVariable {
859                                    description: "The subdomain where the API is deployed.".into(),
860                                    default_value: "api".into(),
861                                    enum_values: vec![],
862                                },
863                            ),
864                        ]),
865                    },
866                ],
867            ),
868            (
869                "v2.resolve_on_call_page".into(),
870                vec![
871                    ServerConfiguration {
872                        url: "https://{site}".into(),
873                        description: "No description provided".into(),
874                        variables: HashMap::from([(
875                            "site".into(),
876                            ServerVariable {
877                                description: "The globally available endpoint for On-Call.".into(),
878                                default_value: "navy.oncall.datadoghq.com".into(),
879                                enum_values: vec![
880                                    "lava.oncall.datadoghq.com".into(),
881                                    "saffron.oncall.datadoghq.com".into(),
882                                    "navy.oncall.datadoghq.com".into(),
883                                    "coral.oncall.datadoghq.com".into(),
884                                    "teal.oncall.datadoghq.com".into(),
885                                    "beige.oncall.datadoghq.eu".into(),
886                                ],
887                            },
888                        )]),
889                    },
890                    ServerConfiguration {
891                        url: "{protocol}://{name}".into(),
892                        description: "No description provided".into(),
893                        variables: HashMap::from([
894                            (
895                                "name".into(),
896                                ServerVariable {
897                                    description: "Full site DNS name.".into(),
898                                    default_value: "api.datadoghq.com".into(),
899                                    enum_values: vec![],
900                                },
901                            ),
902                            (
903                                "protocol".into(),
904                                ServerVariable {
905                                    description: "The protocol for accessing the API.".into(),
906                                    default_value: "https".into(),
907                                    enum_values: vec![],
908                                },
909                            ),
910                        ]),
911                    },
912                    ServerConfiguration {
913                        url: "https://{subdomain}.{site}".into(),
914                        description: "No description provided".into(),
915                        variables: HashMap::from([
916                            (
917                                "site".into(),
918                                ServerVariable {
919                                    description: "Any Datadog deployment.".into(),
920                                    default_value: "datadoghq.com".into(),
921                                    enum_values: vec![],
922                                },
923                            ),
924                            (
925                                "subdomain".into(),
926                                ServerVariable {
927                                    description: "The subdomain where the API is deployed.".into(),
928                                    default_value: "api".into(),
929                                    enum_values: vec![],
930                                },
931                            ),
932                        ]),
933                    },
934                ],
935            ),
936        ])
937    };
938}