Skip to content
This repository was archived by the owner on Apr 19, 2025. It is now read-only.

Commit 78f0329

Browse files
committed
chore(monitor): friendlyName -> name, httpMethod -> method
1 parent 41d1809 commit 78f0329

File tree

5 files changed

+25
-26
lines changed

5 files changed

+25
-26
lines changed

api/v1/monitor_types.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ type Monitor struct {
7979
//+kubebuilder:validation:XValidation:rule="self.type != 'Port' || has(self.port)", message="Port config is required if type is Port"
8080

8181
type MonitorValues struct {
82-
// FriendlyName sets the name that is shown in Uptime Robot.
83-
FriendlyName string `json:"friendlyName"`
82+
// Name sets the name that is shown in Uptime Robot.
83+
Name string `json:"name"`
8484

8585
// URL is the URL or IP to monitor, including the scheme.
8686
URL string `json:"url"`
@@ -101,9 +101,9 @@ type MonitorValues struct {
101101
//+kubebuilder:default:="30s"
102102
Timeout *metav1.Duration `json:"timeout,omitempty"`
103103

104-
// HTTPMethod defines the HTTP verb to use.
104+
// Method defines the HTTP verb to use.
105105
//+kubebuilder:default:="HEAD"
106-
HTTPMethod urtypes.HTTPMethod `json:"httpMethod,omitempty"`
106+
Method urtypes.HTTPMethod `json:"method,omitempty"`
107107

108108
// POST configures POST, PUT, PATCH, DELETE, and OPTIONS requests.
109109
POST *MonitorPOST `json:"post,omitempty"`

config/crd/bases/uptime-robot.clevyr.com_monitors.yaml

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -119,22 +119,6 @@ spec:
119119
required:
120120
- type
121121
type: object
122-
friendlyName:
123-
description: FriendlyName sets the name that is shown in Uptime
124-
Robot.
125-
type: string
126-
httpMethod:
127-
default: HEAD
128-
description: HTTPMethod defines the HTTP verb to use.
129-
enum:
130-
- HEAD
131-
- GET
132-
- POST
133-
- PUT
134-
- PATCH
135-
- DELETE
136-
- OPTIONS
137-
type: string
138122
interval:
139123
default: 60s
140124
description: Interval is the monitoring interval.
@@ -157,6 +141,21 @@ spec:
157141
- type
158142
- value
159143
type: object
144+
method:
145+
default: HEAD
146+
description: Method defines the HTTP verb to use.
147+
enum:
148+
- HEAD
149+
- GET
150+
- POST
151+
- PUT
152+
- PATCH
153+
- DELETE
154+
- OPTIONS
155+
type: string
156+
name:
157+
description: Name sets the name that is shown in Uptime Robot.
158+
type: string
160159
port:
161160
description: Port provides configuration for the Port monitor
162161
type.
@@ -228,7 +227,7 @@ spec:
228227
description: URL is the URL or IP to monitor, including the scheme.
229228
type: string
230229
required:
231-
- friendlyName
230+
- name
232231
- url
233232
type: object
234233
x-kubernetes-validations:

config/samples/uptime-robot_v1_monitor.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ spec:
99
interval: 24h
1010
prune: true
1111
monitor:
12-
friendlyName: Example
12+
name: Example
1313
url: https://example.com
1414
interval: 5m

internal/controller/ingress_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ func (r *IngressReconciler) getMatchingAnnotations(ingress *networkingv1.Ingress
201201
}
202202

203203
func (r *IngressReconciler) updateValues(ingress *networkingv1.Ingress, monitor *uptimerobotv1.Monitor, annotations map[string]string) error {
204-
monitor.Spec.Monitor.FriendlyName = ingress.Name
204+
monitor.Spec.Monitor.Name = ingress.Name
205205
if _, ok := annotations["monitor.url"]; !ok {
206206
if len(ingress.Spec.Rules) != 0 {
207207
var u url.URL

internal/uptimerobot/client.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,14 @@ func (c Client) Do(ctx context.Context, endpoint string, form url.Values) (*http
7070
}
7171

7272
func (c Client) MonitorValues(monitor uptimerobotv1.MonitorValues, form url.Values, contacts uptimerobotv1.MonitorContacts) url.Values {
73-
form.Set("friendly_name", monitor.FriendlyName)
73+
form.Set("friendly_name", monitor.Name)
7474
form.Set("url", monitor.URL)
7575
form.Set("type", strconv.Itoa(int(monitor.Type)))
7676
form.Set("interval", strconv.Itoa(int(monitor.Interval.Seconds())))
7777
form.Set("timeout", strconv.Itoa(int(monitor.Timeout.Seconds())))
7878
form.Set("alert_contacts", contacts.String())
79-
form.Set("http_method", strconv.Itoa(int(monitor.HTTPMethod)))
80-
switch monitor.HTTPMethod {
79+
form.Set("http_method", strconv.Itoa(int(monitor.Method)))
80+
switch monitor.Method {
8181
case urtypes.MethodHEAD, urtypes.MethodGET:
8282
default:
8383
if monitor.POST != nil {

0 commit comments

Comments
 (0)