Skip to content

Commit

Permalink
feat(operator): add Analytics module placeholder
Browse files Browse the repository at this point in the history
  • Loading branch information
gfyrag committed Jul 16, 2024
1 parent edbf248 commit e5bc727
Show file tree
Hide file tree
Showing 20 changed files with 786 additions and 5 deletions.
5 changes: 3 additions & 2 deletions components/fctl/cmd/ledger/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ package ledger

import (
"fmt"

fctl "github.com/formancehq/fctl/pkg"
"github.com/formancehq/formance-sdk-go/v2/pkg/models/operations"
"github.com/formancehq/stack/libs/go-libs/pointer"
"github.com/pterm/pterm"
"github.com/spf13/cobra"
)

type ImportStore struct {}
type ImportStore struct{}
type ImportController struct {
store *ImportStore
inputFileFlag string
Expand Down Expand Up @@ -46,7 +47,7 @@ func (c *ImportController) Run(cmd *cobra.Command, args []string) (fctl.Renderab
store := fctl.GetStackStore(cmd.Context())

_, err := store.Client().Ledger.V2ImportLogs(cmd.Context(), operations.V2ImportLogsRequest{
Ledger: args[0],
Ledger: args[0],
RequestBody: pointer.For(fmt.Sprintf("file:%s", args[1])),
})

Expand Down
1 change: 0 additions & 1 deletion components/operator/BREAKING_CHANGES

This file was deleted.

6 changes: 6 additions & 0 deletions components/operator/PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -184,4 +184,10 @@ resources:
kind: Broker
path: github.com/formancehq/operator/api/formance.com/v1beta1
version: v1beta1
- api:
crdVersion: v1
group: formance.com
kind: Analytics
path: github.com/formancehq/operator/api/formance.com/v1beta1
version: v1beta1
version: "3"
2 changes: 0 additions & 2 deletions components/operator/TODO

This file was deleted.

107 changes: 107 additions & 0 deletions components/operator/api/formance.com/v1beta1/analytics_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
/*
Copyright 2023.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package v1beta1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// AnalyticsSpec defines the desired state of Analytics
type AnalyticsSpec struct {
ModuleProperties `json:",inline"`
StackDependency `json:",inline"`
}

// AnalyticsStatus defines the observed state of Analytics
type AnalyticsStatus struct {
Status `json:",inline"`
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:resource:scope=Cluster
//+kubebuilder:printcolumn:name="Stack",type=string,JSONPath=".spec.stack",description="Stack"
//+kubebuilder:printcolumn:name="Ready",type=string,JSONPath=".status.ready",description="Is ready"
//+kubebuilder:printcolumn:name="Info",type=string,JSONPath=".status.info",description="Info"
//+kubebuilder:metadata:labels=formance.com/kind=module
//+kubebuilder:metadata:labels=formance.com/is-ee=true

// Analytics is the Schema for the analytics API
type Analytics struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec AnalyticsSpec `json:"spec,omitempty"`
Status AnalyticsStatus `json:"status,omitempty"`
}

func (in *Analytics) SetReady(b bool) {
in.Status.SetReady(b)
}

func (in *Analytics) IsReady() bool {
//TODO implement me

return in.Status.Ready
}

func (in *Analytics) SetError(s string) {
in.Status.SetError(s)
}

func (in *Analytics) GetConditions() *Conditions {
return &in.Status.Conditions
}

func (in *Analytics) GetStack() string {
//TODO implement me

return in.Spec.Stack
}

func (in *Analytics) GetVersion() string {
//TODO implement me
return in.Spec.Version
}

func (in *Analytics) IsDebug() bool {
//TODO implement me
return in.Spec.Debug
}

func (in *Analytics) IsDev() bool {
//TODO implement me
return in.Spec.Dev
}

func (in *Analytics) IsEE() bool {
//TODO implement me
return true
}

//+kubebuilder:object:root=true

// AnalyticsList contains a list of Analytics
type AnalyticsList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []Analytics `json:"items"`
}

func init() {
SchemeBuilder.Register(&Analytics{}, &AnalyticsList{})
}

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

Loading

0 comments on commit e5bc727

Please sign in to comment.