Skip to content

Commit

Permalink
change DataStream to camelCase
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Groschupp <[email protected]>
  • Loading branch information
cgroschupp committed Apr 5, 2024
1 parent 2973c9f commit 2d1982c
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 22 deletions.
6 changes: 3 additions & 3 deletions opensearch-operator/api/v1/opensearch_index_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import (
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
)

type OpensearchDatastreamTimestampFieldSpec struct {
type OpensearchDataStreamTimestampFieldSpec struct {
// Name of the field that are used for the DataStream
Name string `json:"name"`
}

type OpensearchDatastreamSpec struct {
type OpensearchDataStreamSpec struct {
// TimestampField for dataStream
TimestampField OpensearchDatastreamTimestampFieldSpec `json:"timestamp_field,omitempty"`
TimestampField OpensearchDataStreamTimestampFieldSpec `json:"timestamp_field,omitempty"`
}

// Describes the specs of an index
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ type OpensearchIndexTemplateSpec struct {
IndexPatterns []string `json:"indexPatterns"`

// The dataStream config that should be applied
DataStream *OpensearchDatastreamSpec `json:"dataStream,omitempty"`
DataStream *OpensearchDataStreamSpec `json:"dataStream,omitempty"`

// The template that should be applied
Template OpensearchIndexSpec `json:"template,omitempty"`
Expand Down
18 changes: 9 additions & 9 deletions opensearch-operator/api/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions opensearch-operator/opensearch-gateway/requests/Templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1

type IndexTemplate struct {
IndexPatterns []string `json:"index_patterns"`
DataStream *Datastream `json:"data_stream,omitempty"`
DataStream *DataStream `json:"data_stream,omitempty"`
Template Index `json:"template,omitempty"`
ComposedOf []string `json:"composed_of,omitempty"`
Priority int `json:"priority,omitempty"`
Expand All @@ -24,12 +24,12 @@ type Index struct {
Aliases map[string]IndexAlias `json:"aliases,omitempty"`
}

type DatastreamTimestampFieldSpec struct {
type DataStreamTimestampFieldSpec struct {
Name string `json:"name"`
}

type Datastream struct {
TimestampField *DatastreamTimestampFieldSpec `json:"timestamp_field,omitempty"`
type DataStream struct {
TimestampField *DataStreamTimestampFieldSpec `json:"timestamp_field,omitempty"`
}

type IndexAlias struct {
Expand Down
6 changes: 3 additions & 3 deletions opensearch-operator/pkg/helpers/translate.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ func TranslateComponentTemplateToRequest(spec v1.OpensearchComponentTemplateSpec
}

// TranslateDatastreamToRequest rewrites the CRD format to the gateway format
func TranslateDatastreamToRequest(spec *v1.OpensearchDatastreamSpec) *requests.Datastream {
func TranslateDatastreamToRequest(spec *v1.OpensearchDataStreamSpec) *requests.DataStream {
if spec == nil {
return nil
}
request := requests.Datastream{}
request := requests.DataStream{}
if spec.TimestampField.Name != "" {
request.TimestampField = &requests.DatastreamTimestampFieldSpec{Name: spec.TimestampField.Name}
request.TimestampField = &requests.DataStreamTimestampFieldSpec{Name: spec.TimestampField.Name}
}

return &request
Expand Down
4 changes: 2 additions & 2 deletions opensearch-operator/pkg/reconcilers/indextemplate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ var _ = Describe("indextemplate reconciler", func() {
Priority: 0,
Version: 0,
Meta: &apiextensionsv1.JSON{},
DataStream: &opsterv1.OpensearchDatastreamSpec{TimestampField: opsterv1.OpensearchDatastreamTimestampFieldSpec{Name: "@mytimestamp"}},
DataStream: &opsterv1.OpensearchDataStreamSpec{TimestampField: opsterv1.OpensearchDataStreamTimestampFieldSpec{Name: "@mytimestamp"}},
},
}

Expand Down Expand Up @@ -286,7 +286,7 @@ var _ = Describe("indextemplate reconciler", func() {
Priority: 0,
Version: 0,
Meta: &apiextensionsv1.JSON{},
DataStream: &requests.Datastream{TimestampField: &requests.DatastreamTimestampFieldSpec{Name: "@mytimestamp"}},
DataStream: &requests.DataStream{TimestampField: &requests.DataStreamTimestampFieldSpec{Name: "@mytimestamp"}},
},
}

Expand Down

0 comments on commit 2d1982c

Please sign in to comment.