Skip to content

Commit 99ba7fe

Browse files
kyleconroyclaude
andcommitted
Add AUTHORIZATION clause and IP range support for endpoints
- Add Owner field to CreateEndpointStatement - Add AUTHORIZATION clause parsing for CREATE ENDPOINT - Add colon-separated IP range support (IPv4PartTwo) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent acbbdd5 commit 99ba7fe

4 files changed

Lines changed: 20 additions & 0 deletions

File tree

ast/create_simple_statements.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ func (r *RouteOption) node() {}
211211

212212
// CreateEndpointStatement represents a CREATE ENDPOINT statement.
213213
type CreateEndpointStatement struct {
214+
Owner *Identifier
214215
Name *Identifier
215216
State string
216217
Affinity *EndpointAffinity

parser/marshal.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18796,6 +18796,9 @@ func createEndpointStatementToJSON(s *ast.CreateEndpointStatement) jsonNode {
1879618796
node := jsonNode{
1879718797
"$type": "CreateEndpointStatement",
1879818798
}
18799+
if s.Owner != nil {
18800+
node["Owner"] = identifierToJSON(s.Owner)
18801+
}
1879918802
if s.Name != nil {
1880018803
node["Name"] = identifierToJSON(s.Name)
1880118804
}

parser/parse_ddl.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8082,6 +8082,11 @@ func (p *Parser) parseAlterEndpointStatement() (*ast.AlterEndpointStatement, err
80828082
} else if p.curTok.Type == TokenLParen {
80838083
p.nextToken() // consume (
80848084
ipOpt.IPv4PartOne = p.parseIPv4Address()
8085+
// Check for colon-separated second IP address
8086+
if p.curTok.Type == TokenColon {
8087+
p.nextToken() // consume :
8088+
ipOpt.IPv4PartTwo = p.parseIPv4Address()
8089+
}
80858090
if p.curTok.Type == TokenRParen {
80868091
p.nextToken() // consume )
80878092
}

parser/parse_statements.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12808,6 +12808,12 @@ func (p *Parser) parseCreateEndpointStatement() (*ast.CreateEndpointStatement, e
1280812808
}
1280912809
hasOptions := false
1281012810

12811+
// Check for AUTHORIZATION immediately after name
12812+
if p.curTok.Type == TokenAuthorization {
12813+
p.nextToken() // consume AUTHORIZATION
12814+
stmt.Owner = p.parseIdentifier()
12815+
}
12816+
1281112817
// Parse endpoint options (STATE, AFFINITY, AS, FOR)
1281212818
for p.curTok.Type != TokenEOF && p.curTok.Type != TokenSemicolon {
1281312819
upper := strings.ToUpper(p.curTok.Literal)
@@ -12887,6 +12893,11 @@ func (p *Parser) parseCreateEndpointStatement() (*ast.CreateEndpointStatement, e
1288712893
} else if p.curTok.Type == TokenLParen {
1288812894
p.nextToken() // consume (
1288912895
ipOpt.IPv4PartOne = p.parseIPv4Address()
12896+
// Check for colon-separated second IP address
12897+
if p.curTok.Type == TokenColon {
12898+
p.nextToken() // consume :
12899+
ipOpt.IPv4PartTwo = p.parseIPv4Address()
12900+
}
1289012901
if p.curTok.Type == TokenRParen {
1289112902
p.nextToken() // consume )
1289212903
}

0 commit comments

Comments
 (0)