browser-protocol 0.1.3

Generated Rust types and commands for the Chrome DevTools Protocol (browser-protocol)
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
use serde::{Serialize, Deserialize};
use serde_json::Value as JsonValue;
use std::borrow::Cow;

/// An internal certificate ID value.

pub type CertificateId = i64;

/// A description of mixed content (HTTP resources on HTTPS pages), as defined by
/// https://www.w3.org/TR/mixed-content/#categories

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
pub enum MixedContentType {
    #[default]
    #[serde(rename = "blockable")]
    Blockable,
    #[serde(rename = "optionally-blockable")]
    OptionallyBlockable,
    #[serde(rename = "none")]
    None,
}

/// The security level of a page or resource.

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
pub enum SecurityState {
    #[default]
    #[serde(rename = "unknown")]
    Unknown,
    #[serde(rename = "neutral")]
    Neutral,
    #[serde(rename = "insecure")]
    Insecure,
    #[serde(rename = "secure")]
    Secure,
    #[serde(rename = "info")]
    Info,
    #[serde(rename = "insecure-broken")]
    InsecureBroken,
}

/// Details about the security state of the page certificate.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct CertificateSecurityState<'a> {
    /// Protocol name (e.g. "TLS 1.2" or "QUIC").
    protocol: Cow<'a, str>,
    /// Key Exchange used by the connection, or the empty string if not applicable.
    keyExchange: Cow<'a, str>,
    /// (EC)DH group used by the connection, if applicable.
    #[serde(skip_serializing_if = "Option::is_none")]
    keyExchangeGroup: Option<Cow<'a, str>>,
    /// Cipher name.
    cipher: Cow<'a, str>,
    /// TLS MAC. Note that AEAD ciphers do not have separate MACs.
    #[serde(skip_serializing_if = "Option::is_none")]
    mac: Option<Cow<'a, str>>,
    /// Page certificate.
    certificate: Vec<Cow<'a, str>>,
    /// Certificate subject name.
    subjectName: Cow<'a, str>,
    /// Name of the issuing CA.
    issuer: Cow<'a, str>,
    /// Certificate valid from date.
    validFrom: crate::network::TimeSinceEpoch,
    /// Certificate valid to (expiration) date
    validTo: crate::network::TimeSinceEpoch,
    /// The highest priority network error code, if the certificate has an error.
    #[serde(skip_serializing_if = "Option::is_none")]
    certificateNetworkError: Option<Cow<'a, str>>,
    /// True if the certificate uses a weak signature algorithm.
    certificateHasWeakSignature: bool,
    /// True if the certificate has a SHA1 signature in the chain.
    certificateHasSha1Signature: bool,
    /// True if modern SSL
    modernSSL: bool,
    /// True if the connection is using an obsolete SSL protocol.
    obsoleteSslProtocol: bool,
    /// True if the connection is using an obsolete SSL key exchange.
    obsoleteSslKeyExchange: bool,
    /// True if the connection is using an obsolete SSL cipher.
    obsoleteSslCipher: bool,
    /// True if the connection is using an obsolete SSL signature.
    obsoleteSslSignature: bool,
}

impl<'a> CertificateSecurityState<'a> {
    pub fn builder(protocol: impl Into<Cow<'a, str>>, keyExchange: impl Into<Cow<'a, str>>, cipher: impl Into<Cow<'a, str>>, certificate: Vec<Cow<'a, str>>, subjectName: impl Into<Cow<'a, str>>, issuer: impl Into<Cow<'a, str>>, validFrom: crate::network::TimeSinceEpoch, validTo: crate::network::TimeSinceEpoch, certificateHasWeakSignature: bool, certificateHasSha1Signature: bool, modernSSL: bool, obsoleteSslProtocol: bool, obsoleteSslKeyExchange: bool, obsoleteSslCipher: bool, obsoleteSslSignature: bool) -> CertificateSecurityStateBuilder<'a> {
        CertificateSecurityStateBuilder {
            protocol: protocol.into(),
            keyExchange: keyExchange.into(),
            keyExchangeGroup: None,
            cipher: cipher.into(),
            mac: None,
            certificate: certificate,
            subjectName: subjectName.into(),
            issuer: issuer.into(),
            validFrom: validFrom,
            validTo: validTo,
            certificateNetworkError: None,
            certificateHasWeakSignature: certificateHasWeakSignature,
            certificateHasSha1Signature: certificateHasSha1Signature,
            modernSSL: modernSSL,
            obsoleteSslProtocol: obsoleteSslProtocol,
            obsoleteSslKeyExchange: obsoleteSslKeyExchange,
            obsoleteSslCipher: obsoleteSslCipher,
            obsoleteSslSignature: obsoleteSslSignature,
        }
    }
    pub fn protocol(&self) -> &str { self.protocol.as_ref() }
    pub fn keyExchange(&self) -> &str { self.keyExchange.as_ref() }
    pub fn keyExchangeGroup(&self) -> Option<&str> { self.keyExchangeGroup.as_deref() }
    pub fn cipher(&self) -> &str { self.cipher.as_ref() }
    pub fn mac(&self) -> Option<&str> { self.mac.as_deref() }
    pub fn certificate(&self) -> &[Cow<'a, str>] { &self.certificate }
    pub fn subjectName(&self) -> &str { self.subjectName.as_ref() }
    pub fn issuer(&self) -> &str { self.issuer.as_ref() }
    pub fn validFrom(&self) -> &crate::network::TimeSinceEpoch { &self.validFrom }
    pub fn validTo(&self) -> &crate::network::TimeSinceEpoch { &self.validTo }
    pub fn certificateNetworkError(&self) -> Option<&str> { self.certificateNetworkError.as_deref() }
    pub fn certificateHasWeakSignature(&self) -> bool { self.certificateHasWeakSignature }
    pub fn certificateHasSha1Signature(&self) -> bool { self.certificateHasSha1Signature }
    pub fn modernSSL(&self) -> bool { self.modernSSL }
    pub fn obsoleteSslProtocol(&self) -> bool { self.obsoleteSslProtocol }
    pub fn obsoleteSslKeyExchange(&self) -> bool { self.obsoleteSslKeyExchange }
    pub fn obsoleteSslCipher(&self) -> bool { self.obsoleteSslCipher }
    pub fn obsoleteSslSignature(&self) -> bool { self.obsoleteSslSignature }
}


pub struct CertificateSecurityStateBuilder<'a> {
    protocol: Cow<'a, str>,
    keyExchange: Cow<'a, str>,
    keyExchangeGroup: Option<Cow<'a, str>>,
    cipher: Cow<'a, str>,
    mac: Option<Cow<'a, str>>,
    certificate: Vec<Cow<'a, str>>,
    subjectName: Cow<'a, str>,
    issuer: Cow<'a, str>,
    validFrom: crate::network::TimeSinceEpoch,
    validTo: crate::network::TimeSinceEpoch,
    certificateNetworkError: Option<Cow<'a, str>>,
    certificateHasWeakSignature: bool,
    certificateHasSha1Signature: bool,
    modernSSL: bool,
    obsoleteSslProtocol: bool,
    obsoleteSslKeyExchange: bool,
    obsoleteSslCipher: bool,
    obsoleteSslSignature: bool,
}

impl<'a> CertificateSecurityStateBuilder<'a> {
    /// (EC)DH group used by the connection, if applicable.
    pub fn keyExchangeGroup(mut self, keyExchangeGroup: impl Into<Cow<'a, str>>) -> Self { self.keyExchangeGroup = Some(keyExchangeGroup.into()); self }
    /// TLS MAC. Note that AEAD ciphers do not have separate MACs.
    pub fn mac(mut self, mac: impl Into<Cow<'a, str>>) -> Self { self.mac = Some(mac.into()); self }
    /// The highest priority network error code, if the certificate has an error.
    pub fn certificateNetworkError(mut self, certificateNetworkError: impl Into<Cow<'a, str>>) -> Self { self.certificateNetworkError = Some(certificateNetworkError.into()); self }
    pub fn build(self) -> CertificateSecurityState<'a> {
        CertificateSecurityState {
            protocol: self.protocol,
            keyExchange: self.keyExchange,
            keyExchangeGroup: self.keyExchangeGroup,
            cipher: self.cipher,
            mac: self.mac,
            certificate: self.certificate,
            subjectName: self.subjectName,
            issuer: self.issuer,
            validFrom: self.validFrom,
            validTo: self.validTo,
            certificateNetworkError: self.certificateNetworkError,
            certificateHasWeakSignature: self.certificateHasWeakSignature,
            certificateHasSha1Signature: self.certificateHasSha1Signature,
            modernSSL: self.modernSSL,
            obsoleteSslProtocol: self.obsoleteSslProtocol,
            obsoleteSslKeyExchange: self.obsoleteSslKeyExchange,
            obsoleteSslCipher: self.obsoleteSslCipher,
            obsoleteSslSignature: self.obsoleteSslSignature,
        }
    }
}


#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
pub enum SafetyTipStatus {
    #[default]
    #[serde(rename = "badReputation")]
    BadReputation,
    #[serde(rename = "lookalike")]
    Lookalike,
}


#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct SafetyTipInfo<'a> {
    /// Describes whether the page triggers any safety tips or reputation warnings. Default is unknown.
    safetyTipStatus: SafetyTipStatus,
    /// The URL the safety tip suggested ("Did you mean?"). Only filled in for lookalike matches.
    #[serde(skip_serializing_if = "Option::is_none")]
    safeUrl: Option<Cow<'a, str>>,
}

impl<'a> SafetyTipInfo<'a> {
    pub fn builder(safetyTipStatus: SafetyTipStatus) -> SafetyTipInfoBuilder<'a> {
        SafetyTipInfoBuilder {
            safetyTipStatus: safetyTipStatus,
            safeUrl: None,
        }
    }
    pub fn safetyTipStatus(&self) -> &SafetyTipStatus { &self.safetyTipStatus }
    pub fn safeUrl(&self) -> Option<&str> { self.safeUrl.as_deref() }
}


pub struct SafetyTipInfoBuilder<'a> {
    safetyTipStatus: SafetyTipStatus,
    safeUrl: Option<Cow<'a, str>>,
}

impl<'a> SafetyTipInfoBuilder<'a> {
    /// The URL the safety tip suggested ("Did you mean?"). Only filled in for lookalike matches.
    pub fn safeUrl(mut self, safeUrl: impl Into<Cow<'a, str>>) -> Self { self.safeUrl = Some(safeUrl.into()); self }
    pub fn build(self) -> SafetyTipInfo<'a> {
        SafetyTipInfo {
            safetyTipStatus: self.safetyTipStatus,
            safeUrl: self.safeUrl,
        }
    }
}

/// Security state information about the page.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct VisibleSecurityState<'a> {
    /// The security level of the page.
    securityState: SecurityState,
    /// Security state details about the page certificate.
    #[serde(skip_serializing_if = "Option::is_none")]
    certificateSecurityState: Option<CertificateSecurityState<'a>>,
    /// The type of Safety Tip triggered on the page. Note that this field will be set even if the Safety Tip UI was not actually shown.
    #[serde(skip_serializing_if = "Option::is_none")]
    safetyTipInfo: Option<SafetyTipInfo<'a>>,
    /// Array of security state issues ids.
    securityStateIssueIds: Vec<Cow<'a, str>>,
}

impl<'a> VisibleSecurityState<'a> {
    pub fn builder(securityState: SecurityState, securityStateIssueIds: Vec<Cow<'a, str>>) -> VisibleSecurityStateBuilder<'a> {
        VisibleSecurityStateBuilder {
            securityState: securityState,
            certificateSecurityState: None,
            safetyTipInfo: None,
            securityStateIssueIds: securityStateIssueIds,
        }
    }
    pub fn securityState(&self) -> &SecurityState { &self.securityState }
    pub fn certificateSecurityState(&self) -> Option<&CertificateSecurityState<'a>> { self.certificateSecurityState.as_ref() }
    pub fn safetyTipInfo(&self) -> Option<&SafetyTipInfo<'a>> { self.safetyTipInfo.as_ref() }
    pub fn securityStateIssueIds(&self) -> &[Cow<'a, str>] { &self.securityStateIssueIds }
}


pub struct VisibleSecurityStateBuilder<'a> {
    securityState: SecurityState,
    certificateSecurityState: Option<CertificateSecurityState<'a>>,
    safetyTipInfo: Option<SafetyTipInfo<'a>>,
    securityStateIssueIds: Vec<Cow<'a, str>>,
}

impl<'a> VisibleSecurityStateBuilder<'a> {
    /// Security state details about the page certificate.
    pub fn certificateSecurityState(mut self, certificateSecurityState: CertificateSecurityState<'a>) -> Self { self.certificateSecurityState = Some(certificateSecurityState); self }
    /// The type of Safety Tip triggered on the page. Note that this field will be set even if the Safety Tip UI was not actually shown.
    pub fn safetyTipInfo(mut self, safetyTipInfo: SafetyTipInfo<'a>) -> Self { self.safetyTipInfo = Some(safetyTipInfo); self }
    pub fn build(self) -> VisibleSecurityState<'a> {
        VisibleSecurityState {
            securityState: self.securityState,
            certificateSecurityState: self.certificateSecurityState,
            safetyTipInfo: self.safetyTipInfo,
            securityStateIssueIds: self.securityStateIssueIds,
        }
    }
}

/// An explanation of an factor contributing to the security state.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct SecurityStateExplanation<'a> {
    /// Security state representing the severity of the factor being explained.
    securityState: SecurityState,
    /// Title describing the type of factor.
    title: Cow<'a, str>,
    /// Short phrase describing the type of factor.
    summary: Cow<'a, str>,
    /// Full text explanation of the factor.
    description: Cow<'a, str>,
    /// The type of mixed content described by the explanation.
    mixedContentType: MixedContentType,
    /// Page certificate.
    certificate: Vec<Cow<'a, str>>,
    /// Recommendations to fix any issues.
    #[serde(skip_serializing_if = "Option::is_none")]
    recommendations: Option<Vec<Cow<'a, str>>>,
}

impl<'a> SecurityStateExplanation<'a> {
    pub fn builder(securityState: SecurityState, title: impl Into<Cow<'a, str>>, summary: impl Into<Cow<'a, str>>, description: impl Into<Cow<'a, str>>, mixedContentType: MixedContentType, certificate: Vec<Cow<'a, str>>) -> SecurityStateExplanationBuilder<'a> {
        SecurityStateExplanationBuilder {
            securityState: securityState,
            title: title.into(),
            summary: summary.into(),
            description: description.into(),
            mixedContentType: mixedContentType,
            certificate: certificate,
            recommendations: None,
        }
    }
    pub fn securityState(&self) -> &SecurityState { &self.securityState }
    pub fn title(&self) -> &str { self.title.as_ref() }
    pub fn summary(&self) -> &str { self.summary.as_ref() }
    pub fn description(&self) -> &str { self.description.as_ref() }
    pub fn mixedContentType(&self) -> &MixedContentType { &self.mixedContentType }
    pub fn certificate(&self) -> &[Cow<'a, str>] { &self.certificate }
    pub fn recommendations(&self) -> Option<&[Cow<'a, str>]> { self.recommendations.as_deref() }
}


pub struct SecurityStateExplanationBuilder<'a> {
    securityState: SecurityState,
    title: Cow<'a, str>,
    summary: Cow<'a, str>,
    description: Cow<'a, str>,
    mixedContentType: MixedContentType,
    certificate: Vec<Cow<'a, str>>,
    recommendations: Option<Vec<Cow<'a, str>>>,
}

impl<'a> SecurityStateExplanationBuilder<'a> {
    /// Recommendations to fix any issues.
    pub fn recommendations(mut self, recommendations: Vec<Cow<'a, str>>) -> Self { self.recommendations = Some(recommendations); self }
    pub fn build(self) -> SecurityStateExplanation<'a> {
        SecurityStateExplanation {
            securityState: self.securityState,
            title: self.title,
            summary: self.summary,
            description: self.description,
            mixedContentType: self.mixedContentType,
            certificate: self.certificate,
            recommendations: self.recommendations,
        }
    }
}

/// Information about insecure content on the page.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct InsecureContentStatus {
    /// Always false.
    ranMixedContent: bool,
    /// Always false.
    displayedMixedContent: bool,
    /// Always false.
    containedMixedForm: bool,
    /// Always false.
    ranContentWithCertErrors: bool,
    /// Always false.
    displayedContentWithCertErrors: bool,
    /// Always set to unknown.
    ranInsecureContentStyle: SecurityState,
    /// Always set to unknown.
    displayedInsecureContentStyle: SecurityState,
}

impl InsecureContentStatus {
    pub fn builder(ranMixedContent: bool, displayedMixedContent: bool, containedMixedForm: bool, ranContentWithCertErrors: bool, displayedContentWithCertErrors: bool, ranInsecureContentStyle: SecurityState, displayedInsecureContentStyle: SecurityState) -> InsecureContentStatusBuilder {
        InsecureContentStatusBuilder {
            ranMixedContent: ranMixedContent,
            displayedMixedContent: displayedMixedContent,
            containedMixedForm: containedMixedForm,
            ranContentWithCertErrors: ranContentWithCertErrors,
            displayedContentWithCertErrors: displayedContentWithCertErrors,
            ranInsecureContentStyle: ranInsecureContentStyle,
            displayedInsecureContentStyle: displayedInsecureContentStyle,
        }
    }
    pub fn ranMixedContent(&self) -> bool { self.ranMixedContent }
    pub fn displayedMixedContent(&self) -> bool { self.displayedMixedContent }
    pub fn containedMixedForm(&self) -> bool { self.containedMixedForm }
    pub fn ranContentWithCertErrors(&self) -> bool { self.ranContentWithCertErrors }
    pub fn displayedContentWithCertErrors(&self) -> bool { self.displayedContentWithCertErrors }
    pub fn ranInsecureContentStyle(&self) -> &SecurityState { &self.ranInsecureContentStyle }
    pub fn displayedInsecureContentStyle(&self) -> &SecurityState { &self.displayedInsecureContentStyle }
}


pub struct InsecureContentStatusBuilder {
    ranMixedContent: bool,
    displayedMixedContent: bool,
    containedMixedForm: bool,
    ranContentWithCertErrors: bool,
    displayedContentWithCertErrors: bool,
    ranInsecureContentStyle: SecurityState,
    displayedInsecureContentStyle: SecurityState,
}

impl InsecureContentStatusBuilder {
    pub fn build(self) -> InsecureContentStatus {
        InsecureContentStatus {
            ranMixedContent: self.ranMixedContent,
            displayedMixedContent: self.displayedMixedContent,
            containedMixedForm: self.containedMixedForm,
            ranContentWithCertErrors: self.ranContentWithCertErrors,
            displayedContentWithCertErrors: self.displayedContentWithCertErrors,
            ranInsecureContentStyle: self.ranInsecureContentStyle,
            displayedInsecureContentStyle: self.displayedInsecureContentStyle,
        }
    }
}

/// The action to take when a certificate error occurs. continue will continue processing the
/// request and cancel will cancel the request.

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
pub enum CertificateErrorAction {
    #[default]
    #[serde(rename = "continue")]
    Continue,
    #[serde(rename = "cancel")]
    Cancel,
}

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct DisableParams {}

impl DisableParams { pub const METHOD: &'static str = "Security.disable"; }

impl<'a> crate::CdpCommand<'a> for DisableParams {
    const METHOD: &'static str = "Security.disable";
    type Response = crate::EmptyReturns;
}

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct EnableParams {}

impl EnableParams { pub const METHOD: &'static str = "Security.enable"; }

impl<'a> crate::CdpCommand<'a> for EnableParams {
    const METHOD: &'static str = "Security.enable";
    type Response = crate::EmptyReturns;
}

/// Enable/disable whether all certificate errors should be ignored.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct SetIgnoreCertificateErrorsParams {
    /// If true, all certificate errors will be ignored.
    ignore: bool,
}

impl SetIgnoreCertificateErrorsParams {
    pub fn builder(ignore: bool) -> SetIgnoreCertificateErrorsParamsBuilder {
        SetIgnoreCertificateErrorsParamsBuilder {
            ignore: ignore,
        }
    }
    pub fn ignore(&self) -> bool { self.ignore }
}


pub struct SetIgnoreCertificateErrorsParamsBuilder {
    ignore: bool,
}

impl SetIgnoreCertificateErrorsParamsBuilder {
    pub fn build(self) -> SetIgnoreCertificateErrorsParams {
        SetIgnoreCertificateErrorsParams {
            ignore: self.ignore,
        }
    }
}

impl SetIgnoreCertificateErrorsParams { pub const METHOD: &'static str = "Security.setIgnoreCertificateErrors"; }

impl<'a> crate::CdpCommand<'a> for SetIgnoreCertificateErrorsParams {
    const METHOD: &'static str = "Security.setIgnoreCertificateErrors";
    type Response = crate::EmptyReturns;
}

/// Handles a certificate error that fired a certificateError event.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct HandleCertificateErrorParams {
    /// The ID of the event.
    eventId: u64,
    /// The action to take on the certificate error.
    action: CertificateErrorAction,
}

impl HandleCertificateErrorParams {
    pub fn builder(eventId: u64, action: CertificateErrorAction) -> HandleCertificateErrorParamsBuilder {
        HandleCertificateErrorParamsBuilder {
            eventId: eventId,
            action: action,
        }
    }
    pub fn eventId(&self) -> u64 { self.eventId }
    pub fn action(&self) -> &CertificateErrorAction { &self.action }
}


pub struct HandleCertificateErrorParamsBuilder {
    eventId: u64,
    action: CertificateErrorAction,
}

impl HandleCertificateErrorParamsBuilder {
    pub fn build(self) -> HandleCertificateErrorParams {
        HandleCertificateErrorParams {
            eventId: self.eventId,
            action: self.action,
        }
    }
}

impl HandleCertificateErrorParams { pub const METHOD: &'static str = "Security.handleCertificateError"; }

impl<'a> crate::CdpCommand<'a> for HandleCertificateErrorParams {
    const METHOD: &'static str = "Security.handleCertificateError";
    type Response = crate::EmptyReturns;
}

/// Enable/disable overriding certificate errors. If enabled, all certificate error events need to
/// be handled by the DevTools client and should be answered with 'handleCertificateError' commands.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct SetOverrideCertificateErrorsParams {
    /// If true, certificate errors will be overridden.
    #[serde(rename = "override")]
    override_: bool,
}

impl SetOverrideCertificateErrorsParams {
    pub fn builder(override_: bool) -> SetOverrideCertificateErrorsParamsBuilder {
        SetOverrideCertificateErrorsParamsBuilder {
            override_: override_,
        }
    }
    pub fn override_(&self) -> bool { self.override_ }
}


pub struct SetOverrideCertificateErrorsParamsBuilder {
    override_: bool,
}

impl SetOverrideCertificateErrorsParamsBuilder {
    pub fn build(self) -> SetOverrideCertificateErrorsParams {
        SetOverrideCertificateErrorsParams {
            override_: self.override_,
        }
    }
}

impl SetOverrideCertificateErrorsParams { pub const METHOD: &'static str = "Security.setOverrideCertificateErrors"; }

impl<'a> crate::CdpCommand<'a> for SetOverrideCertificateErrorsParams {
    const METHOD: &'static str = "Security.setOverrideCertificateErrors";
    type Response = crate::EmptyReturns;
}