Skip to content

Commit

Permalink
Implement Get All Measure for DataLakeMeasureApi
Browse files Browse the repository at this point in the history
  • Loading branch information
wyyolo committed Jan 27, 2024
1 parent e065704 commit 80525bc
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 45 deletions.
14 changes: 5 additions & 9 deletions streampipes-client-go/streampipes/examples/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,10 @@ func main() {
fmt.Println(err)
}
measure := StreamPipesClient.DataLakeMeasureApi().All()
fmt.Println(measure)
//for _, v := range measure {
// fmt.Printf("MeasureName:%s,TimestampDiled:%s,EventSchema:%s,EventProperties:%s,pipelineId:%s,pipelineName:%s,pipelineIsRunning:%s,"+
// "schemaVersion:%s,schemaUpdateStrategy:%s,elementId:%s,_rev:%s", v.MeasureName, v.TimestampField, v.EventSchema,
// v.PipelineId, v.PipelineName, v.PipelineIsRunning, v.SchemaVersion, v.SchemaUpdateStrategy, v.ElementId, v.Rev)
//
// //fmt.Println(v.MeasureName, v.TimestampField, v.EventSchema.EventProperties,
// // v.PipelineId, v.PipelineName, v.PipelineIsRunning, v.SchemaVersion, v.SchemaUpdateStrategy, v.ElementId, v.Rev)
//}

for k := range measure {
fmt.Println(measure[k])
fmt.Println(measure[k].GetEventSchema())
}

}
77 changes: 45 additions & 32 deletions streampipes-client-go/streampipes/model/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,7 @@ func RandomLetters(length int) string {
return string(result)
}

type BaseElement struct {
ElementID string `json:"element_id,omitempty"` //When containing the omitempty attribute, converting JSON substrings through encoding/JSON will ignore null values
}

type ValueSpecification struct {
BaseElement
ClassName string `json:"@class,omitempty"`
ElementID string `json:"elementId,omitempty"`
MinValue int `json:"minValue,omitempty"`
Expand All @@ -47,23 +42,41 @@ type ValueSpecification struct {
}

type EventProperty struct {
//ClassName string `alias:"@class" default:"org.apache.streampipes.model.schema.EventPropertyPrimitive"` //ClassName string `json:"@class,omitempty"`
ElementID string `json:"elementId"`
Label string `json:"label,omitempty"`
Description string `json:"description,omitempty"`
RuntimeName string `json:"runtimeName,omitempty"`
Required bool `json:"required,omitempty"`
DomainProperties []string `json:"domainProperties,omitempty"`
PropertyScope string `json:"propertyScope,omitempty"`
Index int `json:"index"`
RuntimeID string `json:"runtimeId,omitempty"`
RuntimeType string `json:"runtimeType"`
MeasurementUnit string `json:"measurementUnit,omitempty"`
ValueSpecification *ValueSpecification `json:"valueSpecification,omitempty"`
ClassName string `alias:"@class" default:"org.apache.streampipes.model.schema.EventPropertyPrimitive"`
ElementID string `json:"elementId"`
Label string `json:"label,omitempty"`
Description string `json:"description,omitempty"`
RuntimeName string `json:"runtimeName,omitempty"`
Required bool `json:"required,omitempty"`
DomainProperties []string `json:"domainProperties,omitempty"`
PropertyScope string `json:"propertyScope,omitempty"`
Index int `json:"index"`
RuntimeID string `json:"runtimeId,omitempty"`
RuntimeType string `json:"runtimeType"`
MeasurementUnit string `json:"measurementUnit,omitempty"`
ValueSpecification ValueSpecification `json:"valueSpecification,omitempty"`
}

type EventProperties struct {
Class string `json:"@class"`
ElementID string `json:"elementId"`
Label string `json:"label"`
Description string `json:"description"`
RuntimeName string `json:"runtimeName"`
Required bool `json:"required"`
DomainProperties []string `json:"domainProperties"`
PropertyScope string `json:"propertyScope"`
Index int `json:"index"`
RuntimeID string `json:"runtimeId"`
RuntimeType string `json:"runtimeType,omitempty"`
MeasurementUnit string `json:"measurementUnit,omitempty"`
ValueSpecification string `json:"valueSpecification,omitempty"`
InEventProperties []EventProperties `json:"eventProperties,omitempty"`
InEventProperty EventProperty `json:"eventProperty,omitempty"`
}

type EventSchema struct {
EventProperties []EventProperty `json:"eventProperties"`
EventProperties []EventProperties `json:"eventProperties"`
}

type ApplicationLink struct {
Expand All @@ -78,44 +91,44 @@ type ApplicationLink struct {

type TopicDefinition struct {
ClassName string `json:"@class,omitempty"`
ActualTopicName string `json:"actual_topic_name"`
ActualTopicName string `json:"actualTopicName"`
}

type TransportProtocol struct {
ClassName string `json:"@class"`
ElementId string `json:"element_id"`
BrokerHostname string `json:"broker_hostname"`
TopicDefinition TopicDefinition `json:"topic_definition"`
ElementId string `json:"elementId"`
BrokerHostname string `json:"brokerHostname"`
TopicDefinition TopicDefinition `json:"topicDefinition"`
Port int `json:"kafkaPort"`
}

type TransportFormat struct {
RdfType []string `json:"rdf_type"`
RdfType []string `json:"rdfType"`
}

type EventGrounding struct {
TransportProtocols []TransportProtocol `json:"transport_protocols"`
TransportFormats []TransportFormat `json:"transport_formats"`
TransportProtocols []TransportProtocol `json:"transportProtocols"`
TransportFormats []TransportFormat `json:"transportFormats"`
}

type MeasurementCapability struct {
Capability string `json:"capability,omitempty"`
ElementId string `json:"element_id,omitempty"`
ElementId string `json:"elementId,omitempty"`
}

type MeasurementObject struct {
ElementId string `json:"element_id,omitempty"`
MeasuresObject string `json:"measures_object,omitempty"`
ElementId string `json:"elementId,omitempty"`
MeasuresObject string `json:"measuresObject,omitempty"`
}

func (e *EventSchema) GetEventProperties() []EventProperty {
func (e *EventSchema) GetEventProperties() []EventProperties {
return e.EventProperties
}

func (e *EventSchema) SetEventProperties(eventProperties []EventProperty) {
func (e *EventSchema) SetEventProperties(eventProperties []EventProperties) {
e.EventProperties = eventProperties
}

func (e *EventSchema) AddEventProperty(eventProperty []EventProperty) {
func (e *EventSchema) AddEventProperty(eventProperty []EventProperties) {
e.EventProperties = append(e.EventProperties, eventProperty...)
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@

package resource

import (
"streampipes-client-go/streampipes/model"
)
import "streampipes-client-go/streampipes/model"

type DataLakeMeasure struct {
ClassName string `alias:"@class" default:"org.apache.streampipes.model.datalake.DataLakeMeasure"`
Expand All @@ -30,7 +28,7 @@ type DataLakeMeasure struct {
PipelineName string `json:"pipelineName,omitempty"`
PipelineIsRunning bool `json:"pipelineIsRunning"`
SchemaVersion string `json:"schemaVersion,omitempty"`
//SchemaUpdateStrategy string
//SchemaUpdateStrategy DataLakeMeasureSchemaUpdateStrategy `json:"schemaUpdateStrategy"`
ElementId string `json:"elementId"`
Rev string `json:"_rev"`
}
Expand Down

0 comments on commit 80525bc

Please sign in to comment.