diff --git a/src/Endpoints/CustomHostnames.php b/src/Endpoints/CustomHostnames.php index 8e6e3d8..7e01cf2 100644 --- a/src/Endpoints/CustomHostnames.php +++ b/src/Endpoints/CustomHostnames.php @@ -129,7 +129,7 @@ class CustomHostnames implements API * @param string $customOriginServer * @return \stdClass */ - public function updateHostname(string $zoneID, string $hostnameID, string $sslMethod = '', string $sslType = '', array $sslSettings = [], string $customOriginServer = ''): \stdClass + public function updateHostname(string $zoneID, string $hostnameID, string $sslMethod = '', string $sslType = '', array $sslSettings = [], string $customOriginServer = '', ?bool $wildcard = null, string $bundleMethod = '', string $customKey = '', string $customCertificate = ''): \stdClass { $query = []; @@ -145,6 +145,22 @@ class CustomHostnames implements API $query['settings'] = $sslSettings; } + if (is_null($wildcard) === false) { + $query['wildcard'] = $wildcard; + } + + if (empty($bundleMethod) === false) { + $query['bundle_method'] = $bundleMethod; + } + + if (empty($customKey) === false) { + $query['custom_key'] = $customKey; + } + + if (empty($customCertificate) === false) { + $query['custom_certificate'] = $customCertificate; + } + if (!empty($query)) { $options = [ 'ssl' => $query diff --git a/tests/Endpoints/CustomHostnamesTest.php b/tests/Endpoints/CustomHostnamesTest.php index 7298d86..d8be09a 100644 --- a/tests/Endpoints/CustomHostnamesTest.php +++ b/tests/Endpoints/CustomHostnamesTest.php @@ -108,6 +108,61 @@ class CustomHostnamesTest extends TestCase $mock = $this->getMockBuilder(\Cloudflare\API\Adapter\Adapter::class)->getMock(); $mock->method('patch')->willReturn($response); + $customKey = <<expects($this->once()) ->method('patch') ->with( @@ -121,7 +176,12 @@ class CustomHostnamesTest extends TestCase 'http2' => 'on', 'http3' => 'on', 'min_tls_version' => '1.2' - ] + ], + 'bundle_method' => 'optimal', + 'custom_key' => $customKey, + 'custom_certificate' => $customCertificate, + 'wildcard' => true, + ] ]) ); @@ -132,7 +192,7 @@ class CustomHostnamesTest extends TestCase 'http3' => 'on', 'min_tls_version' => '1.2' ]; - $result = $zones->updateHostname('023e105f4ecef8ad9ca31a8372d0c353', '0d89c70d-ad9f-4843-b99f-6cc0252067e9', 'http', 'dv', $sslSettings, 'origin.example.com'); + $result = $zones->updateHostname('023e105f4ecef8ad9ca31a8372d0c353', '0d89c70d-ad9f-4843-b99f-6cc0252067e9', 'http', 'dv', $sslSettings, 'origin.example.com', true, 'optimal', $customKey, $customCertificate); $this->assertObjectHasAttribute('id', $result); $this->assertObjectHasAttribute('hostname', $result);