001package gudusoft.gsqlparser.nodes;
002
003import gudusoft.gsqlparser.TSourceToken;
004import gudusoft.gsqlparser.nodes.flink.TFlinkTableProperty;
005
006/**
007 * AST node for StarRocks CREATE REPOSITORY statement.
008 *
009 * Syntax:
010 * CREATE [READ ONLY] REPOSITORY <repository_name>
011 * WITH BROKER
012 * ON LOCATION "<repository_location>"
013 * PROPERTIES ("key"="value", ...)
014 *
015 * Example:
016 * CREATE REPOSITORY hdfs_repo
017 * WITH BROKER
018 * ON LOCATION "hdfs://x.x.x.x:yyyy/repo_dir/backup"
019 * PROPERTIES(
020 *     "username" = "xxxxxxxx",
021 *     "password" = "yyyyyyyy"
022 * );
023 *
024 * CREATE READ ONLY REPOSITORY s3_repo
025 * WITH BROKER
026 * ON LOCATION "s3a://bucket_s3/backup"
027 * PROPERTIES(
028 *     "aws.s3.access_key" = "XXXXXXXXXXXXXXXXX",
029 *     "aws.s3.secret_key" = "yyyyyyyyyyyyyyyyy",
030 *     "aws.s3.region" = "us-east-1"
031 * );
032 */
033public class TCreateRepositorySqlNode extends TParseTreeNode {
034    // Repository name
035    private TObjectName repositoryName;
036
037    // READ ONLY flag
038    private boolean readOnly;
039
040    // Location path (ON LOCATION clause)
041    private TSourceToken repositoryLocation;
042
043    // PROPERTIES clause
044    private TParseTreeNode properties;
045
046    // Getters and setters
047    public TObjectName getRepositoryName() {
048        return repositoryName;
049    }
050
051    public void setRepositoryName(TObjectName repositoryName) {
052        this.repositoryName = repositoryName;
053    }
054
055    public boolean isReadOnly() {
056        return readOnly;
057    }
058
059    public void setReadOnly(boolean readOnly) {
060        this.readOnly = readOnly;
061    }
062
063    public TSourceToken getRepositoryLocation() {
064        return repositoryLocation;
065    }
066
067    public void setRepositoryLocation(TSourceToken repositoryLocation) {
068        this.repositoryLocation = repositoryLocation;
069    }
070
071    @SuppressWarnings("unchecked")
072    public TPTNodeList<TFlinkTableProperty> getProperties() {
073        return (TPTNodeList<TFlinkTableProperty>) properties;
074    }
075
076    public void setProperties(TParseTreeNode properties) {
077        this.properties = properties;
078    }
079
080    public void init(Object arg1) {
081        this.repositoryName = (TObjectName) arg1;
082    }
083}