MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / parse_create_webhook_check_options

Method parse_create_webhook_check_options

src/sql-parser/src/parser.rs:3421–3474  ·  view source on GitHub ↗
(
        &mut self,
    )

Source from the content-addressed store, hash-verified

3419 }
3420
3421 fn parse_create_webhook_check_options(
3422 &mut self,
3423 ) -> Result<CreateWebhookSourceCheckOptions<Raw>, ParserError> {
3424 let mut secrets = vec![];
3425 let mut headers = vec![];
3426 let mut bodies = vec![];
3427
3428 fn parse_alias(parser: &mut Parser<'_>) -> Result<Option<Ident>, ParserError> {
3429 parser
3430 .parse_keyword(AS)
3431 .then(|| parser.parse_identifier())
3432 .transpose()
3433 }
3434
3435 self.parse_comma_separated(|f| {
3436 match f.expect_one_of_keywords(&[SECRET, HEADERS, BODY])? {
3437 SECRET => {
3438 let secret = f.parse_raw_name()?;
3439 let alias = parse_alias(f)?;
3440 let use_bytes = f.parse_keyword(Keyword::Bytes);
3441
3442 secrets.push(CreateWebhookSourceSecret {
3443 secret,
3444 alias,
3445 use_bytes,
3446 });
3447
3448 Ok(())
3449 }
3450 HEADERS => {
3451 // TODO(parkmycar): Support filtering down to specific headers.
3452 let alias = parse_alias(f)?;
3453 let use_bytes = f.parse_keyword(Keyword::Bytes);
3454 headers.push(CreateWebhookSourceHeader { alias, use_bytes });
3455
3456 Ok(())
3457 }
3458 BODY => {
3459 let alias = parse_alias(f)?;
3460 let use_bytes = f.parse_keyword(Keyword::Bytes);
3461 bodies.push(CreateWebhookSourceBody { alias, use_bytes });
3462
3463 Ok(())
3464 }
3465 k => unreachable!("Unexpected keyword! {k}"),
3466 }
3467 })?;
3468
3469 Ok(CreateWebhookSourceCheckOptions {
3470 secrets,
3471 headers,
3472 bodies,
3473 })
3474 }
3475
3476 fn parse_create_iceberg_sink(
3477 &mut self,

Callers 1

Calls 5

parse_comma_separatedMethod · 0.80
parse_raw_nameMethod · 0.80
parse_keywordMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected