Skip to content

Commit 80aa5a2

Browse files
fix(webhooks): remove unnecessary code on webhook
1 parent 479f259 commit 80aa5a2

File tree

2 files changed

+8
-132
lines changed

2 files changed

+8
-132
lines changed

src/Instances/Webhook.php

-126
Original file line numberDiff line numberDiff line change
@@ -4,38 +4,6 @@
44

55
class Webhook extends Instance
66
{
7-
/**
8-
* Get the webhook name.
9-
*
10-
* @return string
11-
*/
12-
public function getName(): string
13-
{
14-
return $this->getAttribute('name');
15-
}
16-
17-
/**
18-
* Set the webhook name.
19-
*
20-
* @param string $name
21-
* @return $this
22-
*/
23-
public function setName(string $name): self
24-
{
25-
return $this->setAttribute('name', $name);
26-
}
27-
28-
/**
29-
* Set the webhook rules.
30-
*
31-
* @param array $rules
32-
* @return $this
33-
*/
34-
public function setRules(array $rules = [])
35-
{
36-
return $this->setAttribute('rules', $rules);
37-
}
38-
397
/**
408
* Add a new rule to the webook.
419
*
@@ -61,98 +29,4 @@ public function addRules(array $rules)
6129

6230
return $this;
6331
}
64-
65-
/**
66-
* Get the webhook rules.
67-
*
68-
* @return array
69-
*/
70-
public function getRules(): array
71-
{
72-
return $this->getAttribute('rules', []);
73-
}
74-
75-
/**
76-
* Get the webhook client config rules.
77-
*
78-
* @return array
79-
*/
80-
public function getClientConfig(): array
81-
{
82-
return $this->getAttribute('clientConfig');
83-
}
84-
85-
/**
86-
* Set the webhook client config rules.
87-
*
88-
* @param array $clientConfig
89-
* @return $this
90-
*/
91-
public function setClientConfig(array $clientConfig): self
92-
{
93-
return $this->setAttribute('clientConfig', $clientConfig);
94-
}
95-
96-
/**
97-
* Get the webhook admission review versions.
98-
*
99-
* @return array
100-
*/
101-
public function getAdmissionReviewVersions(): array
102-
{
103-
return $this->getAttribute('admissionReviewVersions');
104-
}
105-
106-
/**
107-
* Set the webhook admission review versions.
108-
*
109-
* @param array $admissionReviewVersions
110-
* @return $this
111-
*/
112-
public function setAdmissionReviewVersions(array $admissionReviewVersions): self
113-
{
114-
return $this->setAttribute('admissionReviewVersions', $admissionReviewVersions);
115-
}
116-
117-
/**
118-
* Get the webhook side effects.
119-
*
120-
* @return string
121-
*/
122-
public function getSideEffects(): string
123-
{
124-
return $this->getAttribute('sideEffects');
125-
}
126-
127-
/**
128-
* Set the webhook side effects.
129-
*
130-
* @param string $sideEffects
131-
* @return $this
132-
*/
133-
public function setSideEffects(string $sideEffects): self
134-
{
135-
return $this->setAttribute('sideEffects', $sideEffects);
136-
}
137-
138-
/**
139-
* Set the webhook timeout seconds.
140-
*
141-
* @return int
142-
*/
143-
public function getTimeoutSeconds(): int
144-
{
145-
return $this->getAttribute('timeoutSeconds');
146-
}
147-
148-
/**
149-
* Set the webhook timeout seconds.
150-
*
151-
* @param int $timeoutSeconds
152-
* @return $this
153-
*/
154-
public function setTimeoutSeconds(int $timeoutSeconds): self
155-
{
156-
return $this->setAttribute('timeoutSeconds', $timeoutSeconds);
157-
}
15832
}

tests/ValidatingWebhookConfigurationTest.php

+8-6
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,14 @@ public function runCreationTests()
6464
{
6565
$webhook = K8s::webhook()
6666
->setName('v1.webhook.com')
67-
->addRule([
68-
'apiGroups' => [''],
69-
'apiVersions' => ['v1'],
70-
'operations' => ['CREATE'],
71-
'resources' => ['pods'],
72-
'scope' => 'Namespaced',
67+
->addRules([
68+
[
69+
'apiGroups' => [''],
70+
'apiVersions' => ['v1'],
71+
'operations' => ['CREATE'],
72+
'resources' => ['pods'],
73+
'scope' => 'Namespaced',
74+
]
7375
])
7476
->setClientConfig(['url' => 'https://my-webhook.example.com:9443/my-webhook-path'])
7577
->setAdmissionReviewVersions(['v1', 'v1beta'])

0 commit comments

Comments
 (0)