/
nifidataflow_types.go
158 lines (140 loc) · 6.1 KB
/
nifidataflow_types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
/*
Copyright 2020.
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 v1alpha1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
// NifiDataflowSpec defines the desired state of NifiDataflow
type NifiDataflowSpec struct {
// the UUID of the parent process group where you want to deploy your dataflow, if not set deploy at root level.
ParentProcessGroupID string `json:"parentProcessGroupID,omitempty"`
// the UUID of the Bucket containing the flow.
BucketId string `json:"bucketId"`
// the UUID of the flow to run.
FlowId string `json:"flowId"`
// the version of the flow to run, if not present or equals to -1, then the latest version of flow will be used.
FlowVersion *int32 `json:"flowVersion,omitempty"`
// contains the reference to the ParameterContext with the one the dataflow is linked.
ParameterContextRef *ParameterContextReference `json:"parameterContextRef,omitempty"`
// if the flow will be ran once or continuously checked
RunOnce *bool `json:"runOnce,omitempty"`
// whether the flow is considered as ran if some controller services are still invalid or not.
SkipInvalidControllerService bool `json:"skipInvalidControllerService,omitempty"`
// whether the flow is considered as ran if some components are still invalid or not.
SkipInvalidComponent bool `json:"skipInvalidComponent,omitempty"`
// contains the reference to the NifiCluster with the one the dataflow is linked.
ClusterRef ClusterReference `json:"clusterRef,omitempty"`
// contains the reference to the NifiRegistry with the one the dataflow is linked.
RegistryClientRef *RegistryClientReference `json:"registryClientRef,omitempty"`
// describes the way the operator will deal with data when a dataflow will be updated : drop or drain
// +kubebuilder:validation:Enum={"drop","drain"}
UpdateStrategy DataflowUpdateStrategy `json:"updateStrategy"`
}
type UpdateRequest struct {
// defines the type of versioned flow update request.
Type DataflowUpdateRequestType `json:"type"`
// the id of the update request.
Id string `json:"id"`
// the uri for this request.
Uri string `json:"uri"`
// the last time this request was updated.
LastUpdated string `json:"lastUpdated"`
// whether or not this request has completed.
Complete bool `json:"complete"`
// an explication of why the request failed, or null if this request has not failed.
FailureReason string `json:"failureReason"`
// the percentage complete of the request, between 0 and 100.
PercentCompleted int32 `json:"percentCompleted"`
// the state of the request
State string `json:"state"`
}
type DropRequest struct {
// the connection id.
ConnectionId string `json:"connectionId"`
// the id for this drop request.
Id string `json:"id"`
// the uri for this request.
Uri string `json:"uri"`
// the last time this request was updated.
LastUpdated string `json:"lastUpdated"`
// whether the request has finished.
Finished bool `json:"finished"`
// an explication of why the request failed, or null if this request has not failed.
FailureReason string `json:"failureReason"`
// the percentage complete of the request, between 0 and 100.
PercentCompleted int32 `json:"percentCompleted"`
// the number of flow files currently queued.
CurrentCount int32 `json:"currentCount"`
// the size of flow files currently queued in bytes.
CurrentSize int64 `json:"currentSize"`
// the count and size of flow files currently queued.
Current string `json:"current"`
// the number of flow files to be dropped as a result of this request.
OriginalCount int32 `json:"originalCount"`
// the size of flow files to be dropped as a result of this request in bytes.
OriginalSize int64 `json:"originalSize"`
// the count and size of flow files to be dropped as a result of this request.
Original string `json:"original"`
// the number of flow files that have been dropped thus far.
DroppedCount int32 `json:"droppedCount"`
// the size of flow files currently queued in bytes.
DroppedSize int64 `json:"droppedSize"`
// the count and size of flow files that have been dropped thus far.
Dropped string `json:"dropped"`
// the state of the request
State string `json:"state"`
}
// NifiDataflowStatus defines the observed state of NifiDataflow
type NifiDataflowStatus struct {
// process Group ID
ProcessGroupID string `json:"processGroupID"`
// the dataflow current state.
State DataflowState `json:"state"`
// the latest version update request sent.
LatestUpdateRequest *UpdateRequest `json:"latestUpdateRequest,omitempty"`
// the latest queue drop request sent.
LatestDropRequest *DropRequest `json:"latestDropRequest,omitempty"`
}
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// NifiDataflow is the Schema for the nifidataflows API
type NifiDataflow struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec NifiDataflowSpec `json:"spec,omitempty"`
Status NifiDataflowStatus `json:"status,omitempty"`
}
// +kubebuilder:object:root=true
// NifiDataflowList contains a list of NifiDataflow
type NifiDataflowList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []NifiDataflow `json:"items"`
}
func init() {
SchemeBuilder.Register(&NifiDataflow{}, &NifiDataflowList{})
}
func (d *NifiDataflowSpec) GetRunOnce() bool {
if d.RunOnce != nil {
return *d.RunOnce
}
return true
}
func (d *NifiDataflowSpec) GetParentProcessGroupID(cluster *NifiCluster) string {
if d.ParentProcessGroupID == "" {
return cluster.Status.RootProcessGroupId
}
return d.ParentProcessGroupID
}