• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

SAP / sap-btp-service-operator / 25664426865

11 May 2026 10:22AM UTC coverage: 77.719% (-0.6%) from 78.279%
25664426865

push

github

web-flow
[INFRA] update dependencies (#633)

* [INFRA] update dependencies

* fix lint

---------

Co-authored-by: I501080 <keren.lahav@sap.com>

0 of 20 new or added lines in 2 files covered. (0.0%)

4 existing lines in 3 files now uncovered.

2815 of 3622 relevant lines covered (77.72%)

0.88 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

81.48
/api/v1/serviceinstance_types.go
1
/*
2

3

4
Licensed under the Apache License, Version 2.0 (the "License");
5
you may not use this file except in compliance with the License.
6
You may obtain a copy of the License at
7

8
    http://www.apache.org/licenses/LICENSE-2.0
9

10
Unless required by applicable law or agreed to in writing, software
11
distributed under the License is distributed on an "AS IS" BASIS,
12
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
See the License for the specific language governing permissions and
14
limitations under the License.
15
*/
16

17
package v1
18

19
import (
20
        "crypto/sha256"
21
        "encoding/hex"
22
        "encoding/json"
23

24
        "github.com/SAP/sap-btp-service-operator/api/common"
25
        "github.com/SAP/sap-btp-service-operator/client/sm/types"
26
        v1 "k8s.io/api/authentication/v1"
27
        metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
28
        "k8s.io/apimachinery/pkg/runtime"
29
        "k8s.io/utils/ptr"
30
)
31

32
// EDIT THIS FILE!  THIS IS SCAFFOLDING FOR YOU TO OWN!
33
// NOTE: json tags are required.  Any new fields you add must have json tags for the fields to be serialized.
34

35
// ServiceInstanceSpec defines the desired state of ServiceInstance
36
type ServiceInstanceSpec struct {
37
        // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
38
        // Important: Run "make" to regenerate code after modifying this file
39

40
        // The name of the service offering
41
        // +kubebuilder:validation:MinLength=1
42
        ServiceOfferingName string `json:"serviceOfferingName"`
43

44
        // The name of the service plan
45
        // +kubebuilder:validation:MinLength=1
46
        ServicePlanName string `json:"servicePlanName"`
47

48
        // The dataCenter in case service offering and plan name exist in other data center and not on main
49
        // +optional
50
        DataCenter string `json:"dataCenter,omitempty"`
51

52
        // The plan ID in case service offering and plan name are ambiguous
53
        // +optional
54
        ServicePlanID string `json:"servicePlanID,omitempty"`
55

56
        // The name of the instance in Service Manager
57
        ExternalName string `json:"externalName,omitempty"`
58

59
        // Indicates the desired shared state
60
        // +optional
61
        Shared *bool `json:"shared,omitempty"`
62

63
        // Provisioning parameters for the instance.
64
        //
65
        // The Parameters field is NOT secret or secured in any way and should
66
        // NEVER be used to hold sensitive information. To set parameters that
67
        // contain secret information, you should ALWAYS store that information
68
        // in a Secret and use the ParametersFrom field.
69
        // +optional
70
        // +kubebuilder:pruning:PreserveUnknownFields
71
        Parameters *runtime.RawExtension `json:"parameters,omitempty"`
72

73
        // List of sources to populate parameters.
74
        // If a top-level parameter name exists in multiples sources among
75
        // `Parameters` and `ParametersFrom` fields, it is
76
        // considered to be a user error in the specification
77
        // +optional
78
        ParametersFrom []ParametersFromSource `json:"parametersFrom,omitempty"`
79

80
        // indicate instance will update on secrets from parametersFrom change
81
        // +optional
82
        WatchParametersFromChanges *bool `json:"watchParametersFromChanges,omitempty"`
83

84
        // List of custom tags describing the ServiceInstance, will be copied to `ServiceBinding` secret in the key called `tags`.
85
        // +optional
86
        CustomTags []string `json:"customTags,omitempty"`
87

88
        // UserInfo contains information about the user that last modified this
89
        // instance. This field is set by the API server and not settable by the
90
        // end-user. User-provided values for this field are not saved.
91
        // +optional
92
        UserInfo *v1.UserInfo `json:"userInfo,omitempty"`
93

94
        // The name of the btp access credentials secret
95
        BTPAccessCredentialsSecret string `json:"btpAccessCredentialsSecret,omitempty"`
96
}
97

98
// ServiceInstanceStatus defines the observed state of ServiceInstance
99
type ServiceInstanceStatus struct {
100
        // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
101
        // Important: Run "make" to regenerate code after modifying this file
102

103
        // The generated ID of the instance, will be automatically filled once the instance is created
104
        // +optional
105
        InstanceID string `json:"instanceID,omitempty"`
106

107
        // Tags describing the ServiceInstance as provided in service catalog, will be copied to `ServiceBinding` secret in the key called `tags`.
108
        Tags []string `json:"tags,omitempty"`
109

110
        // URL of ongoing operation for the service instance
111
        OperationURL string `json:"operationURL,omitempty"`
112

113
        // The operation type (CREATE/UPDATE/DELETE) for ongoing operation
114
        OperationType types.OperationCategory `json:"operationType,omitempty"`
115

116
        // Service instance conditions
117
        Conditions []metav1.Condition `json:"conditions"`
118

119
        // Indicates whether instance is ready for usage
120
        Ready metav1.ConditionStatus `json:"ready,omitempty"`
121

122
        // HashedSpec is the hashed spec without the shared property
123
        HashedSpec string `json:"hashedSpec,omitempty"`
124

125
        // The subaccount id of the service instance
126
        SubaccountID string `json:"subaccountID,omitempty"`
127

128
        // if true need to update instance
129
        ForceReconcile bool `json:"forceReconcile,omitempty"`
130

131
        // Last generation that was acted on
132
        ObservedGeneration int64 `json:"observedGeneration,omitempty"`
133

134
        AsyncProvisionFailed *bool `json:"asyncProvisionFailed,omitempty"`
135
}
136

137
// +kubebuilder:object:root=true
138
// +kubebuilder:subresource:status
139
// +kubebuilder:storageversion
140
// +kubebuilder:printcolumn:JSONPath=".spec.serviceOfferingName",name="Offering",type=string
141
// +kubebuilder:printcolumn:JSONPath=".spec.servicePlanName",name="Plan",type=string
142
// +kubebuilder:printcolumn:JSONPath=".spec.shared",name="shared",type=boolean
143
// +kubebuilder:printcolumn:JSONPath=".spec.dataCenter",name="dataCenter",type=string
144
// +kubebuilder:printcolumn:JSONPath=".status.conditions[0].reason",name="Status",type=string
145
// +kubebuilder:printcolumn:JSONPath=".status.ready",name="Ready",type=string
146
// +kubebuilder:printcolumn:JSONPath=".metadata.creationTimestamp",name="Age",type=date
147
// +kubebuilder:printcolumn:JSONPath=".status.instanceID",name="ID",type=string,priority=1
148
// +kubebuilder:printcolumn:JSONPath=".status.conditions[0].message",name="Message",type=string,priority=1
149

150
// ServiceInstance is the Schema for the serviceinstances API
151
type ServiceInstance struct {
152
        metav1.TypeMeta   `json:",inline"`
153
        metav1.ObjectMeta `json:"metadata,omitempty"`
154
        Spec              ServiceInstanceSpec   `json:"spec,omitempty"`
155
        Status            ServiceInstanceStatus `json:"status,omitempty"`
156
}
157

158
func (si *ServiceInstance) IsAsyncProvisionFailed() bool {
×
159
        return si.Status.AsyncProvisionFailed != nil && *si.Status.AsyncProvisionFailed
×
160
}
×
161

162
func (si *ServiceInstance) GetConditions() []metav1.Condition {
1✔
163
        return si.Status.Conditions
1✔
164
}
1✔
165

166
func (si *ServiceInstance) SetConditions(conditions []metav1.Condition) {
1✔
167
        si.Status.Conditions = conditions
1✔
168
}
1✔
169

170
func (si *ServiceInstance) GetControllerName() common.ControllerName {
1✔
171
        return common.ServiceInstanceController
1✔
172
}
1✔
173

174
func (si *ServiceInstance) GetParameters() *runtime.RawExtension {
1✔
175
        return si.Spec.Parameters
1✔
176
}
1✔
177

178
func (si *ServiceInstance) GetStatus() interface{} {
1✔
179
        return si.Status
1✔
180
}
1✔
181

182
func (si *ServiceInstance) SetStatus(status interface{}) {
1✔
183
        si.Status = status.(ServiceInstanceStatus)
1✔
184
}
1✔
185

186
func (si *ServiceInstance) DeepClone() common.SAPBTPResource {
1✔
187
        return si.DeepCopy()
1✔
188
}
1✔
189

190
func (si *ServiceInstance) GetReady() metav1.ConditionStatus {
1✔
191
        return si.Status.Ready
1✔
192
}
1✔
193

194
func (si *ServiceInstance) SetReady(ready metav1.ConditionStatus) {
1✔
195
        si.Status.Ready = ready
1✔
196
}
1✔
197
func (si *ServiceInstance) GetAnnotations() map[string]string {
1✔
198
        return si.ObjectMeta.Annotations
1✔
199
}
1✔
200

201
func (si *ServiceInstance) SetAnnotations(annotations map[string]string) {
1✔
202
        si.ObjectMeta.Annotations = annotations
1✔
203
}
1✔
204

205
func (si *ServiceInstance) SetObservedGeneration(newObserved int64) {
×
206
        si.Status.ObservedGeneration = newObserved
×
207
}
×
208

209
// +kubebuilder:object:root=true
210

211
// ServiceInstanceList contains a list of ServiceInstance
212
type ServiceInstanceList struct {
213
        metav1.TypeMeta `json:",inline"`
214
        metav1.ListMeta `json:"metadata,omitempty"`
215
        Items           []ServiceInstance `json:"items"`
216
}
217

UNCOV
218
func (si *ServiceInstance) Hub() {}
×
219

220
func (si *ServiceInstance) GetShared() bool {
×
221
        return si.Spec.Shared != nil && *si.Spec.Shared
×
222
}
×
223

224
func (si *ServiceInstance) IsSubscribedToParamSecretsChanges() bool {
1✔
225
        return si.Spec.WatchParametersFromChanges != nil && *si.Spec.WatchParametersFromChanges
1✔
226
}
1✔
227

228
func (si *ServiceInstance) GetSpecHash() string {
1✔
229
        spec := si.Spec
1✔
230
        spec.Shared = ptr.To(false)
1✔
231
        specBytes, _ := json.Marshal(spec)
1✔
232
        s := string(specBytes)
1✔
233
        hash := sha256.Sum256([]byte(s))
1✔
234
        return hex.EncodeToString(hash[:])
1✔
235
}
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc