diff options
Diffstat (limited to 'vnfs/DAaaS/microservices/GoApps/src/go-hdfs-writer/pkg/utils')
4 files changed, 19 insertions, 107 deletions
diff --git a/vnfs/DAaaS/microservices/GoApps/src/go-hdfs-writer/pkg/utils/hdfs-config.go b/vnfs/DAaaS/microservices/GoApps/src/go-hdfs-writer/pkg/utils/hdfs-config.go deleted file mode 100644 index ac33bc6a..00000000 --- a/vnfs/DAaaS/microservices/GoApps/src/go-hdfs-writer/pkg/utils/hdfs-config.go +++ /dev/null @@ -1,37 +0,0 @@ -package utils - -import ( - "os" -) - -// SetHdfsParametersByObjectMap set the value of the hdfs config parameters -// and return HdfsConfig object -func SetHdfsParametersByObjectMap(m map[string]interface{}) HdfsConfig{ - - hc := HdfsConfig{} - hc.hdfsURL = m["hdfs_url"].(string) - return hc - -} - -// SetHdfsParametersByEnvVariables sets the hdfs parameters -func SetHdfsParametersByEnvVariables() HdfsConfig { - - slogger := GetLoggerInstance() - hdfsConfigObject := HdfsConfig{ - hdfsURL: os.Getenv("HDFS_URL"), - } - slogger.Infof("::hdfsURL:: %s", hdfsConfigObject.hdfsURL) - return hdfsConfigObject - -} - -// HdfsConfig contains hdfs related config items -type HdfsConfig struct { - hdfsURL string -} - -// GetHdfsURL returns HdfsURL -func (h HdfsConfig) GetHdfsURL() string { - return h.hdfsURL -}
\ No newline at end of file diff --git a/vnfs/DAaaS/microservices/GoApps/src/go-hdfs-writer/pkg/utils/hdfsUtils.go b/vnfs/DAaaS/microservices/GoApps/src/go-hdfs-writer/pkg/utils/hdfsUtils.go index 1a93a5ad..8edcec19 100644 --- a/vnfs/DAaaS/microservices/GoApps/src/go-hdfs-writer/pkg/utils/hdfsUtils.go +++ b/vnfs/DAaaS/microservices/GoApps/src/go-hdfs-writer/pkg/utils/hdfsUtils.go @@ -3,24 +3,9 @@ package utils import ( "fmt" "github.com/colinmarc/hdfs" - //"sync" - //"go.uber.org/zap" ) -//var clientOnce sync.Once -//var hdfsClient *hdfs.Client -//var slogger *zap.SugaredLogger - - -//GetHdfsClientInstance returns a singleton hdfsClient instance -// func GetHdfsClientInstance(hdfsURL string) (*hdfs.Client){ -// clientOnce.Do(func(){ -// hdfsClient = createHdfsClient(hdfsURL) -// }) -// return hdfsClient -// } - //CreateHdfsClient creates a hdfs client and returns hdfs client func CreateHdfsClient(hdfsURL string) (*hdfs.Client){ slogger := GetLoggerInstance() diff --git a/vnfs/DAaaS/microservices/GoApps/src/go-hdfs-writer/pkg/utils/kafka-config.go b/vnfs/DAaaS/microservices/GoApps/src/go-hdfs-writer/pkg/utils/kafka-config.go deleted file mode 100644 index 080bfd4b..00000000 --- a/vnfs/DAaaS/microservices/GoApps/src/go-hdfs-writer/pkg/utils/kafka-config.go +++ /dev/null @@ -1,55 +0,0 @@ -package utils - - -import ( - "os" -) - -// SetKafkaParametersByObjectMap sets the value of the kafka parameters -// and sets the KafkaConfig object -func SetKafkaParametersByObjectMap(m map[string]interface{}) KafkaConfig { - kc := KafkaConfig{} - kc.broker = m["broker"].(string) - kc.group = m["group"].(string) - kc.topic = m["topic"].(string) - - return kc -} - -// SetKafkaParametersByEnvVariables sets the kafka parameters -func SetKafkaParametersByEnvVariables() KafkaConfig { - slogger := GetLoggerInstance() - - kafkaConfigObject := KafkaConfig{ - broker: os.Getenv("BROKER"), - group: os.Getenv("GROUP"), - topic: os.Getenv("TOPIC"), - } - slogger.Infof("::broker:: %s", kafkaConfigObject.broker) - slogger.Infof("::group:: %s", kafkaConfigObject.group) - slogger.Infof("::topic:: %s", kafkaConfigObject.topic) - - return kafkaConfigObject -} - -// KafkaConfig contains all the config parameters needed for kafka. This can be extended over time -type KafkaConfig struct { - broker string - group string - topic string -} - -// GetBroker returns kafka broker configured -func (k KafkaConfig) GetBroker() string { - return k.broker -} - -// GetGroup returns kafka group configured -func (k KafkaConfig) GetGroup() string { - return k.group -} - -// GetTopic returns kafka topic configured -func (k KafkaConfig) GetTopic() string { - return k.topic -}
\ No newline at end of file diff --git a/vnfs/DAaaS/microservices/GoApps/src/go-hdfs-writer/pkg/utils/types.go b/vnfs/DAaaS/microservices/GoApps/src/go-hdfs-writer/pkg/utils/types.go new file mode 100644 index 00000000..3db3e420 --- /dev/null +++ b/vnfs/DAaaS/microservices/GoApps/src/go-hdfs-writer/pkg/utils/types.go @@ -0,0 +1,19 @@ +package utils + +// Pipeline type represents a stucture of a general pipeline +type Pipeline struct{ + KafkaConfiguration KafkaConfig `json:"kafkaConfig"` + HdfsConfiguration HdfsConfig `json:"hdfsConfig"` +} + +// HdfsConfig type represents the config items of HDFS +type HdfsConfig struct { + HdfsURL string `json:"hdfs_url"` +} + +// KafkaConfig type represents the config items of Kafka +type KafkaConfig struct { + Broker string `json:"broker"` + Group string `json:"group"` + Topic string `json:"topic"` +}
\ No newline at end of file |