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_template".to_owned(), false),
165            ("v2.create_incident_todo".to_owned(), false),
166            ("v2.create_incident_type".to_owned(), false),
167            ("v2.delete_incident".to_owned(), false),
168            ("v2.delete_incident_integration".to_owned(), false),
169            ("v2.delete_incident_notification_template".to_owned(), false),
170            ("v2.delete_incident_todo".to_owned(), false),
171            ("v2.delete_incident_type".to_owned(), false),
172            ("v2.get_incident".to_owned(), false),
173            ("v2.get_incident_integration".to_owned(), false),
174            ("v2.get_incident_notification_template".to_owned(), false),
175            ("v2.get_incident_todo".to_owned(), false),
176            ("v2.get_incident_type".to_owned(), false),
177            ("v2.list_incident_attachments".to_owned(), false),
178            ("v2.list_incident_integrations".to_owned(), false),
179            ("v2.list_incident_notification_templates".to_owned(), false),
180            ("v2.list_incidents".to_owned(), false),
181            ("v2.list_incident_todos".to_owned(), false),
182            ("v2.list_incident_types".to_owned(), false),
183            ("v2.search_incidents".to_owned(), false),
184            ("v2.update_incident".to_owned(), false),
185            ("v2.update_incident_attachments".to_owned(), false),
186            ("v2.update_incident_integration".to_owned(), false),
187            ("v2.update_incident_notification_template".to_owned(), false),
188            ("v2.update_incident_todo".to_owned(), false),
189            ("v2.update_incident_type".to_owned(), false),
190            ("v2.create_aws_account".to_owned(), false),
191            ("v2.create_new_aws_external_id".to_owned(), false),
192            ("v2.delete_aws_account".to_owned(), false),
193            ("v2.get_aws_account".to_owned(), false),
194            ("v2.list_aws_accounts".to_owned(), false),
195            ("v2.list_aws_namespaces".to_owned(), false),
196            ("v2.update_aws_account".to_owned(), false),
197            ("v2.list_aws_logs_services".to_owned(), false),
198            ("v2.create_monitor_user_template".to_owned(), false),
199            ("v2.delete_monitor_user_template".to_owned(), false),
200            ("v2.get_monitor_user_template".to_owned(), false),
201            ("v2.list_monitor_user_templates".to_owned(), false),
202            ("v2.update_monitor_user_template".to_owned(), false),
203            (
204                "v2.validate_existing_monitor_user_template".to_owned(),
205                false,
206            ),
207            ("v2.validate_monitor_user_template".to_owned(), false),
208            ("v2.create_pipeline".to_owned(), false),
209            ("v2.delete_pipeline".to_owned(), false),
210            ("v2.get_pipeline".to_owned(), false),
211            ("v2.list_pipelines".to_owned(), false),
212            ("v2.update_pipeline".to_owned(), false),
213            ("v2.validate_pipeline".to_owned(), false),
214            ("v2.create_scorecard_outcomes_batch".to_owned(), false),
215            ("v2.create_scorecard_rule".to_owned(), false),
216            ("v2.delete_scorecard_rule".to_owned(), false),
217            ("v2.list_scorecard_outcomes".to_owned(), false),
218            ("v2.list_scorecard_rules".to_owned(), false),
219            ("v2.update_scorecard_outcomes_async".to_owned(), false),
220            ("v2.update_scorecard_rule".to_owned(), false),
221            ("v2.create_incident_service".to_owned(), false),
222            ("v2.delete_incident_service".to_owned(), false),
223            ("v2.get_incident_service".to_owned(), false),
224            ("v2.list_incident_services".to_owned(), false),
225            ("v2.update_incident_service".to_owned(), false),
226            ("v2.create_slo_report_job".to_owned(), false),
227            ("v2.get_slo_report".to_owned(), false),
228            ("v2.get_slo_report_job_status".to_owned(), false),
229            ("v2.get_spa_recommendations".to_owned(), false),
230            ("v2.add_member_team".to_owned(), false),
231            ("v2.list_member_teams".to_owned(), false),
232            ("v2.remove_member_team".to_owned(), false),
233            ("v2.sync_teams".to_owned(), false),
234            ("v2.create_incident_team".to_owned(), false),
235            ("v2.delete_incident_team".to_owned(), false),
236            ("v2.get_incident_team".to_owned(), false),
237            ("v2.list_incident_teams".to_owned(), false),
238            ("v2.update_incident_team".to_owned(), false),
239        ]);
240        let mut auth_keys: HashMap<String, APIKey> = HashMap::new();
241        auth_keys.insert(
242            "apiKeyAuth".to_owned(),
243            APIKey {
244                key: env::var("DD_API_KEY").unwrap_or_default(),
245                prefix: "".to_owned(),
246            },
247        );
248        auth_keys.insert(
249            "appKeyAuth".to_owned(),
250            APIKey {
251                key: env::var("DD_APP_KEY").unwrap_or_default(),
252                prefix: "".to_owned(),
253            },
254        );
255
256        Self {
257            user_agent: DEFAULT_USER_AGENT.clone(),
258            unstable_operations,
259            auth_keys,
260            server_index: 0,
261            server_variables: HashMap::from([(
262                "site".into(),
263                env::var("DD_SITE").unwrap_or("datadoghq.com".into()),
264            )]),
265            server_operation_index: HashMap::new(),
266            server_operation_variables: HashMap::new(),
267            proxy_url: None,
268            enable_retry: false,
269            max_retries: 3,
270        }
271    }
272}
273
274lazy_static! {
275    pub static ref DEFAULT_USER_AGENT: String = format!(
276        "datadog-api-client-rust/{} (rust {}; os {}; arch {})",
277        option_env!("CARGO_PKG_VERSION").unwrap_or("?"),
278        option_env!("DD_RUSTC_VERSION").unwrap_or("?"),
279        env::consts::OS,
280        env::consts::ARCH,
281    );
282    static ref SERVERS: Vec<ServerConfiguration> = {
283        vec![
284            ServerConfiguration {
285                url: "https://{subdomain}.{site}".into(),
286                description: "No description provided".into(),
287                variables: HashMap::from([
288                    (
289                        "site".into(),
290                        ServerVariable {
291                            description: "The regional site for Datadog customers.".into(),
292                            default_value: "datadoghq.com".into(),
293                            enum_values: vec![
294                                "datadoghq.com".into(),
295                                "us3.datadoghq.com".into(),
296                                "us5.datadoghq.com".into(),
297                                "ap1.datadoghq.com".into(),
298                                "ap2.datadoghq.com".into(),
299                                "datadoghq.eu".into(),
300                                "ddog-gov.com".into(),
301                            ],
302                        },
303                    ),
304                    (
305                        "subdomain".into(),
306                        ServerVariable {
307                            description: "The subdomain where the API is deployed.".into(),
308                            default_value: "api".into(),
309                            enum_values: vec![],
310                        },
311                    ),
312                ]),
313            },
314            ServerConfiguration {
315                url: "{protocol}://{name}".into(),
316                description: "No description provided".into(),
317                variables: HashMap::from([
318                    (
319                        "name".into(),
320                        ServerVariable {
321                            description: "Full site DNS name.".into(),
322                            default_value: "api.datadoghq.com".into(),
323                            enum_values: vec![],
324                        },
325                    ),
326                    (
327                        "protocol".into(),
328                        ServerVariable {
329                            description: "The protocol for accessing the API.".into(),
330                            default_value: "https".into(),
331                            enum_values: vec![],
332                        },
333                    ),
334                ]),
335            },
336            ServerConfiguration {
337                url: "https://{subdomain}.{site}".into(),
338                description: "No description provided".into(),
339                variables: HashMap::from([
340                    (
341                        "site".into(),
342                        ServerVariable {
343                            description: "Any Datadog deployment.".into(),
344                            default_value: "datadoghq.com".into(),
345                            enum_values: vec![],
346                        },
347                    ),
348                    (
349                        "subdomain".into(),
350                        ServerVariable {
351                            description: "The subdomain where the API is deployed.".into(),
352                            default_value: "api".into(),
353                            enum_values: vec![],
354                        },
355                    ),
356                ]),
357            },
358        ]
359    };
360    static ref OPERATION_SERVERS: HashMap<String, Vec<ServerConfiguration>> = {
361        HashMap::from([
362            (
363                "v1.get_ip_ranges".into(),
364                vec![
365                    ServerConfiguration {
366                        url: "https://{subdomain}.{site}".into(),
367                        description: "No description provided".into(),
368                        variables: HashMap::from([
369                            (
370                                "site".into(),
371                                ServerVariable {
372                                    description: "The regional site for Datadog customers.".into(),
373                                    default_value: "datadoghq.com".into(),
374                                    enum_values: vec![
375                                        "datadoghq.com".into(),
376                                        "us3.datadoghq.com".into(),
377                                        "us5.datadoghq.com".into(),
378                                        "ap1.datadoghq.com".into(),
379                                        "ap2.datadoghq.com".into(),
380                                        "datadoghq.eu".into(),
381                                        "ddog-gov.com".into(),
382                                    ],
383                                },
384                            ),
385                            (
386                                "subdomain".into(),
387                                ServerVariable {
388                                    description: "The subdomain where the API is deployed.".into(),
389                                    default_value: "ip-ranges".into(),
390                                    enum_values: vec![],
391                                },
392                            ),
393                        ]),
394                    },
395                    ServerConfiguration {
396                        url: "{protocol}://{name}".into(),
397                        description: "No description provided".into(),
398                        variables: HashMap::from([
399                            (
400                                "name".into(),
401                                ServerVariable {
402                                    description: "Full site DNS name.".into(),
403                                    default_value: "ip-ranges.datadoghq.com".into(),
404                                    enum_values: vec![],
405                                },
406                            ),
407                            (
408                                "protocol".into(),
409                                ServerVariable {
410                                    description: "The protocol for accessing the API.".into(),
411                                    default_value: "https".into(),
412                                    enum_values: vec![],
413                                },
414                            ),
415                        ]),
416                    },
417                    ServerConfiguration {
418                        url: "https://{subdomain}.datadoghq.com".into(),
419                        description: "No description provided".into(),
420                        variables: HashMap::from([(
421                            "subdomain".into(),
422                            ServerVariable {
423                                description: "The subdomain where the API is deployed.".into(),
424                                default_value: "ip-ranges".into(),
425                                enum_values: vec![],
426                            },
427                        )]),
428                    },
429                ],
430            ),
431            (
432                "v1.submit_log".into(),
433                vec![
434                    ServerConfiguration {
435                        url: "https://{subdomain}.{site}".into(),
436                        description: "No description provided".into(),
437                        variables: HashMap::from([
438                            (
439                                "site".into(),
440                                ServerVariable {
441                                    description: "The regional site for Datadog customers.".into(),
442                                    default_value: "datadoghq.com".into(),
443                                    enum_values: vec![
444                                        "datadoghq.com".into(),
445                                        "us3.datadoghq.com".into(),
446                                        "us5.datadoghq.com".into(),
447                                        "ap1.datadoghq.com".into(),
448                                        "ap2.datadoghq.com".into(),
449                                        "datadoghq.eu".into(),
450                                        "ddog-gov.com".into(),
451                                    ],
452                                },
453                            ),
454                            (
455                                "subdomain".into(),
456                                ServerVariable {
457                                    description: "The subdomain where the API is deployed.".into(),
458                                    default_value: "http-intake.logs".into(),
459                                    enum_values: vec![],
460                                },
461                            ),
462                        ]),
463                    },
464                    ServerConfiguration {
465                        url: "{protocol}://{name}".into(),
466                        description: "No description provided".into(),
467                        variables: HashMap::from([
468                            (
469                                "name".into(),
470                                ServerVariable {
471                                    description: "Full site DNS name.".into(),
472                                    default_value: "http-intake.logs.datadoghq.com".into(),
473                                    enum_values: vec![],
474                                },
475                            ),
476                            (
477                                "protocol".into(),
478                                ServerVariable {
479                                    description: "The protocol for accessing the API.".into(),
480                                    default_value: "https".into(),
481                                    enum_values: vec![],
482                                },
483                            ),
484                        ]),
485                    },
486                    ServerConfiguration {
487                        url: "https://{subdomain}.{site}".into(),
488                        description: "No description provided".into(),
489                        variables: HashMap::from([
490                            (
491                                "site".into(),
492                                ServerVariable {
493                                    description: "Any Datadog deployment.".into(),
494                                    default_value: "datadoghq.com".into(),
495                                    enum_values: vec![],
496                                },
497                            ),
498                            (
499                                "subdomain".into(),
500                                ServerVariable {
501                                    description: "The subdomain where the API is deployed.".into(),
502                                    default_value: "http-intake.logs".into(),
503                                    enum_values: vec![],
504                                },
505                            ),
506                        ]),
507                    },
508                ],
509            ),
510            (
511                "v2.create_event".into(),
512                vec![
513                    ServerConfiguration {
514                        url: "https://{subdomain}.{site}".into(),
515                        description: "No description provided".into(),
516                        variables: HashMap::from([
517                            (
518                                "site".into(),
519                                ServerVariable {
520                                    description: "The regional site for customers.".into(),
521                                    default_value: "datadoghq.com".into(),
522                                    enum_values: vec![
523                                        "datadoghq.com".into(),
524                                        "us3.datadoghq.com".into(),
525                                        "us5.datadoghq.com".into(),
526                                        "ap1.datadoghq.com".into(),
527                                        "datadoghq.eu".into(),
528                                        "ddog-gov.com".into(),
529                                    ],
530                                },
531                            ),
532                            (
533                                "subdomain".into(),
534                                ServerVariable {
535                                    description: "The subdomain where the API is deployed.".into(),
536                                    default_value: "event-management-intake".into(),
537                                    enum_values: vec![],
538                                },
539                            ),
540                        ]),
541                    },
542                    ServerConfiguration {
543                        url: "{protocol}://{name}".into(),
544                        description: "No description provided".into(),
545                        variables: HashMap::from([
546                            (
547                                "name".into(),
548                                ServerVariable {
549                                    description: "Full site DNS name.".into(),
550                                    default_value: "event-management-intake.datadoghq.com".into(),
551                                    enum_values: vec![],
552                                },
553                            ),
554                            (
555                                "protocol".into(),
556                                ServerVariable {
557                                    description: "The protocol for accessing the API.".into(),
558                                    default_value: "https".into(),
559                                    enum_values: vec![],
560                                },
561                            ),
562                        ]),
563                    },
564                    ServerConfiguration {
565                        url: "https://{subdomain}.{site}".into(),
566                        description: "No description provided".into(),
567                        variables: HashMap::from([
568                            (
569                                "site".into(),
570                                ServerVariable {
571                                    description: "Any Datadog deployment.".into(),
572                                    default_value: "datadoghq.com".into(),
573                                    enum_values: vec![],
574                                },
575                            ),
576                            (
577                                "subdomain".into(),
578                                ServerVariable {
579                                    description: "The subdomain where the API is deployed.".into(),
580                                    default_value: "event-management-intake".into(),
581                                    enum_values: vec![],
582                                },
583                            ),
584                        ]),
585                    },
586                ],
587            ),
588            (
589                "v2.submit_log".into(),
590                vec![
591                    ServerConfiguration {
592                        url: "https://{subdomain}.{site}".into(),
593                        description: "No description provided".into(),
594                        variables: HashMap::from([
595                            (
596                                "site".into(),
597                                ServerVariable {
598                                    description: "The regional site for customers.".into(),
599                                    default_value: "datadoghq.com".into(),
600                                    enum_values: vec![
601                                        "datadoghq.com".into(),
602                                        "us3.datadoghq.com".into(),
603                                        "us5.datadoghq.com".into(),
604                                        "ap1.datadoghq.com".into(),
605                                        "ap2.datadoghq.com".into(),
606                                        "datadoghq.eu".into(),
607                                        "ddog-gov.com".into(),
608                                    ],
609                                },
610                            ),
611                            (
612                                "subdomain".into(),
613                                ServerVariable {
614                                    description: "The subdomain where the API is deployed.".into(),
615                                    default_value: "http-intake.logs".into(),
616                                    enum_values: vec![],
617                                },
618                            ),
619                        ]),
620                    },
621                    ServerConfiguration {
622                        url: "{protocol}://{name}".into(),
623                        description: "No description provided".into(),
624                        variables: HashMap::from([
625                            (
626                                "name".into(),
627                                ServerVariable {
628                                    description: "Full site DNS name.".into(),
629                                    default_value: "http-intake.logs.datadoghq.com".into(),
630                                    enum_values: vec![],
631                                },
632                            ),
633                            (
634                                "protocol".into(),
635                                ServerVariable {
636                                    description: "The protocol for accessing the API.".into(),
637                                    default_value: "https".into(),
638                                    enum_values: vec![],
639                                },
640                            ),
641                        ]),
642                    },
643                    ServerConfiguration {
644                        url: "https://{subdomain}.{site}".into(),
645                        description: "No description provided".into(),
646                        variables: HashMap::from([
647                            (
648                                "site".into(),
649                                ServerVariable {
650                                    description: "Any Datadog deployment.".into(),
651                                    default_value: "datadoghq.com".into(),
652                                    enum_values: vec![],
653                                },
654                            ),
655                            (
656                                "subdomain".into(),
657                                ServerVariable {
658                                    description: "The subdomain where the API is deployed.".into(),
659                                    default_value: "http-intake.logs".into(),
660                                    enum_values: vec![],
661                                },
662                            ),
663                        ]),
664                    },
665                ],
666            ),
667            (
668                "v2.create_on_call_page".into(),
669                vec![
670                    ServerConfiguration {
671                        url: "https://{site}".into(),
672                        description: "No description provided".into(),
673                        variables: HashMap::from([(
674                            "site".into(),
675                            ServerVariable {
676                                description: "The globally available endpoint for On-Call.".into(),
677                                default_value: "navy.oncall.datadoghq.com".into(),
678                                enum_values: vec![
679                                    "lava.oncall.datadoghq.com".into(),
680                                    "saffron.oncall.datadoghq.com".into(),
681                                    "navy.oncall.datadoghq.com".into(),
682                                    "coral.oncall.datadoghq.com".into(),
683                                    "teal.oncall.datadoghq.com".into(),
684                                    "beige.oncall.datadoghq.eu".into(),
685                                ],
686                            },
687                        )]),
688                    },
689                    ServerConfiguration {
690                        url: "{protocol}://{name}".into(),
691                        description: "No description provided".into(),
692                        variables: HashMap::from([
693                            (
694                                "name".into(),
695                                ServerVariable {
696                                    description: "Full site DNS name.".into(),
697                                    default_value: "api.datadoghq.com".into(),
698                                    enum_values: vec![],
699                                },
700                            ),
701                            (
702                                "protocol".into(),
703                                ServerVariable {
704                                    description: "The protocol for accessing the API.".into(),
705                                    default_value: "https".into(),
706                                    enum_values: vec![],
707                                },
708                            ),
709                        ]),
710                    },
711                    ServerConfiguration {
712                        url: "https://{subdomain}.{site}".into(),
713                        description: "No description provided".into(),
714                        variables: HashMap::from([
715                            (
716                                "site".into(),
717                                ServerVariable {
718                                    description: "Any Datadog deployment.".into(),
719                                    default_value: "datadoghq.com".into(),
720                                    enum_values: vec![],
721                                },
722                            ),
723                            (
724                                "subdomain".into(),
725                                ServerVariable {
726                                    description: "The subdomain where the API is deployed.".into(),
727                                    default_value: "api".into(),
728                                    enum_values: vec![],
729                                },
730                            ),
731                        ]),
732                    },
733                ],
734            ),
735            (
736                "v2.acknowledge_on_call_page".into(),
737                vec![
738                    ServerConfiguration {
739                        url: "https://{site}".into(),
740                        description: "No description provided".into(),
741                        variables: HashMap::from([(
742                            "site".into(),
743                            ServerVariable {
744                                description: "The globally available endpoint for On-Call.".into(),
745                                default_value: "navy.oncall.datadoghq.com".into(),
746                                enum_values: vec![
747                                    "lava.oncall.datadoghq.com".into(),
748                                    "saffron.oncall.datadoghq.com".into(),
749                                    "navy.oncall.datadoghq.com".into(),
750                                    "coral.oncall.datadoghq.com".into(),
751                                    "teal.oncall.datadoghq.com".into(),
752                                    "beige.oncall.datadoghq.eu".into(),
753                                ],
754                            },
755                        )]),
756                    },
757                    ServerConfiguration {
758                        url: "{protocol}://{name}".into(),
759                        description: "No description provided".into(),
760                        variables: HashMap::from([
761                            (
762                                "name".into(),
763                                ServerVariable {
764                                    description: "Full site DNS name.".into(),
765                                    default_value: "api.datadoghq.com".into(),
766                                    enum_values: vec![],
767                                },
768                            ),
769                            (
770                                "protocol".into(),
771                                ServerVariable {
772                                    description: "The protocol for accessing the API.".into(),
773                                    default_value: "https".into(),
774                                    enum_values: vec![],
775                                },
776                            ),
777                        ]),
778                    },
779                    ServerConfiguration {
780                        url: "https://{subdomain}.{site}".into(),
781                        description: "No description provided".into(),
782                        variables: HashMap::from([
783                            (
784                                "site".into(),
785                                ServerVariable {
786                                    description: "Any Datadog deployment.".into(),
787                                    default_value: "datadoghq.com".into(),
788                                    enum_values: vec![],
789                                },
790                            ),
791                            (
792                                "subdomain".into(),
793                                ServerVariable {
794                                    description: "The subdomain where the API is deployed.".into(),
795                                    default_value: "api".into(),
796                                    enum_values: vec![],
797                                },
798                            ),
799                        ]),
800                    },
801                ],
802            ),
803            (
804                "v2.escalate_on_call_page".into(),
805                vec![
806                    ServerConfiguration {
807                        url: "https://{site}".into(),
808                        description: "No description provided".into(),
809                        variables: HashMap::from([(
810                            "site".into(),
811                            ServerVariable {
812                                description: "The globally available endpoint for On-Call.".into(),
813                                default_value: "navy.oncall.datadoghq.com".into(),
814                                enum_values: vec![
815                                    "lava.oncall.datadoghq.com".into(),
816                                    "saffron.oncall.datadoghq.com".into(),
817                                    "navy.oncall.datadoghq.com".into(),
818                                    "coral.oncall.datadoghq.com".into(),
819                                    "teal.oncall.datadoghq.com".into(),
820                                    "beige.oncall.datadoghq.eu".into(),
821                                ],
822                            },
823                        )]),
824                    },
825                    ServerConfiguration {
826                        url: "{protocol}://{name}".into(),
827                        description: "No description provided".into(),
828                        variables: HashMap::from([
829                            (
830                                "name".into(),
831                                ServerVariable {
832                                    description: "Full site DNS name.".into(),
833                                    default_value: "api.datadoghq.com".into(),
834                                    enum_values: vec![],
835                                },
836                            ),
837                            (
838                                "protocol".into(),
839                                ServerVariable {
840                                    description: "The protocol for accessing the API.".into(),
841                                    default_value: "https".into(),
842                                    enum_values: vec![],
843                                },
844                            ),
845                        ]),
846                    },
847                    ServerConfiguration {
848                        url: "https://{subdomain}.{site}".into(),
849                        description: "No description provided".into(),
850                        variables: HashMap::from([
851                            (
852                                "site".into(),
853                                ServerVariable {
854                                    description: "Any Datadog deployment.".into(),
855                                    default_value: "datadoghq.com".into(),
856                                    enum_values: vec![],
857                                },
858                            ),
859                            (
860                                "subdomain".into(),
861                                ServerVariable {
862                                    description: "The subdomain where the API is deployed.".into(),
863                                    default_value: "api".into(),
864                                    enum_values: vec![],
865                                },
866                            ),
867                        ]),
868                    },
869                ],
870            ),
871            (
872                "v2.resolve_on_call_page".into(),
873                vec![
874                    ServerConfiguration {
875                        url: "https://{site}".into(),
876                        description: "No description provided".into(),
877                        variables: HashMap::from([(
878                            "site".into(),
879                            ServerVariable {
880                                description: "The globally available endpoint for On-Call.".into(),
881                                default_value: "navy.oncall.datadoghq.com".into(),
882                                enum_values: vec![
883                                    "lava.oncall.datadoghq.com".into(),
884                                    "saffron.oncall.datadoghq.com".into(),
885                                    "navy.oncall.datadoghq.com".into(),
886                                    "coral.oncall.datadoghq.com".into(),
887                                    "teal.oncall.datadoghq.com".into(),
888                                    "beige.oncall.datadoghq.eu".into(),
889                                ],
890                            },
891                        )]),
892                    },
893                    ServerConfiguration {
894                        url: "{protocol}://{name}".into(),
895                        description: "No description provided".into(),
896                        variables: HashMap::from([
897                            (
898                                "name".into(),
899                                ServerVariable {
900                                    description: "Full site DNS name.".into(),
901                                    default_value: "api.datadoghq.com".into(),
902                                    enum_values: vec![],
903                                },
904                            ),
905                            (
906                                "protocol".into(),
907                                ServerVariable {
908                                    description: "The protocol for accessing the API.".into(),
909                                    default_value: "https".into(),
910                                    enum_values: vec![],
911                                },
912                            ),
913                        ]),
914                    },
915                    ServerConfiguration {
916                        url: "https://{subdomain}.{site}".into(),
917                        description: "No description provided".into(),
918                        variables: HashMap::from([
919                            (
920                                "site".into(),
921                                ServerVariable {
922                                    description: "Any Datadog deployment.".into(),
923                                    default_value: "datadoghq.com".into(),
924                                    enum_values: vec![],
925                                },
926                            ),
927                            (
928                                "subdomain".into(),
929                                ServerVariable {
930                                    description: "The subdomain where the API is deployed.".into(),
931                                    default_value: "api".into(),
932                                    enum_values: vec![],
933                                },
934                            ),
935                        ]),
936                    },
937                ],
938            ),
939        ])
940    };
941}