Expose mtls certificate config params in python and php configuration templates (#22229)

* Expose mtls config params in python template

* Expose certFile and keyFile configuration items to support mtls in php generated client

* Regenerate of examples
This commit is contained in:
Eddie Sholl
2025-10-28 15:33:05 +11:00
committed by GitHub
parent 31e462dc3e
commit 68b0dfe6d1
18 changed files with 277 additions and 14 deletions

View File

@@ -115,6 +115,20 @@ class Configuration
*/ */
protected $tempFolderPath; protected $tempFolderPath;
/**
* Path to a certificate file, for mTLS
*
* @var string
*/
protected $certFile;
/**
* Path to a key file, for mTLS
*
* @var string
*/
protected $keyFile;
/** /**
* Constructor * Constructor
*/ */
@@ -388,6 +402,49 @@ class Configuration
return $this->tempFolderPath; return $this->tempFolderPath;
} }
/**
* Sets the certificate file path, for mTLS
*
* @return $this
*/
public function setCertFile($certFile)
{
$this->certFile = $certFile;
return $this;
}
/**
* Gets the certificate file path, for mTLS
*
* @return string Certificate file path
*/
public function getCertFile()
{
return $this->certFile;
}
/**
* Sets the certificate key path, for mTLS
*
* @return $this
*/
public function setKeyFile($keyFile)
{
$this->keyFile = $keyFile;
return $this;
}
/**
* Gets the certificate key path, for mTLS
*
* @return string Certificate key path
*/
public function getKeyFile()
{
return $this->keyFile;
}
/** /**
* Gets the default configuration instance * Gets the default configuration instance
* *

View File

@@ -832,6 +832,14 @@ use {{invokerPackage}}\ObjectSerializer;
} }
} }
if ($this->config->getCertFile()) {
$options[RequestOptions::CERT] = $this->config->getCertFile();
}
if ($this->config->getKeyFile()) {
$options[RequestOptions::SSL_KEY] = $this->config->getKeyFile();
}
return $options; return $options;
} }

View File

@@ -186,6 +186,8 @@ class Configuration:
:param retries: Number of retries for API requests. :param retries: Number of retries for API requests.
:param ca_cert_data: verify the peer using concatenated CA certificate data :param ca_cert_data: verify the peer using concatenated CA certificate data
in PEM (str) or DER (bytes) format. in PEM (str) or DER (bytes) format.
:param cert_file: the path to a client certificate file, for mTLS.
:param key_file: the path to a client key file, for mTLS.
{{#hasAuthMethods}} {{#hasAuthMethods}}
:Example: :Example:
@@ -293,6 +295,8 @@ conf = {{{packageName}}}.Configuration(
ssl_ca_cert: Optional[str]=None, ssl_ca_cert: Optional[str]=None,
retries: Optional[int] = None, retries: Optional[int] = None,
ca_cert_data: Optional[Union[str, bytes]] = None, ca_cert_data: Optional[Union[str, bytes]] = None,
cert_file: Optional[str]=None,
key_file: Optional[str]=None,
*, *,
debug: Optional[bool] = None, debug: Optional[bool] = None,
) -> None: ) -> None:
@@ -381,10 +385,10 @@ conf = {{{packageName}}}.Configuration(
"""Set this to verify the peer using PEM (str) or DER (bytes) """Set this to verify the peer using PEM (str) or DER (bytes)
certificate data. certificate data.
""" """
self.cert_file = None self.cert_file = cert_file
"""client certificate file """client certificate file
""" """
self.key_file = None self.key_file = key_file
"""client key file """client key file
""" """
self.assert_hostname = None self.assert_hostname = None

View File

@@ -165,6 +165,8 @@ class Configuration:
:param retries: Number of retries for API requests. :param retries: Number of retries for API requests.
:param ca_cert_data: verify the peer using concatenated CA certificate data :param ca_cert_data: verify the peer using concatenated CA certificate data
in PEM (str) or DER (bytes) format. in PEM (str) or DER (bytes) format.
:param cert_file: the path to a client certificate file, for mTLS.
:param key_file: the path to a client key file, for mTLS.
:Example: :Example:
@@ -203,6 +205,8 @@ conf = openapi_client.Configuration(
ssl_ca_cert: Optional[str]=None, ssl_ca_cert: Optional[str]=None,
retries: Optional[int] = None, retries: Optional[int] = None,
ca_cert_data: Optional[Union[str, bytes]] = None, ca_cert_data: Optional[Union[str, bytes]] = None,
cert_file: Optional[str]=None,
key_file: Optional[str]=None,
*, *,
debug: Optional[bool] = None, debug: Optional[bool] = None,
) -> None: ) -> None:
@@ -284,10 +288,10 @@ conf = openapi_client.Configuration(
"""Set this to verify the peer using PEM (str) or DER (bytes) """Set this to verify the peer using PEM (str) or DER (bytes)
certificate data. certificate data.
""" """
self.cert_file = None self.cert_file = cert_file
"""client certificate file """client certificate file
""" """
self.key_file = None self.key_file = key_file
"""client key file """client key file
""" """
self.assert_hostname = None self.assert_hostname = None

View File

@@ -165,6 +165,8 @@ class Configuration:
:param retries: Number of retries for API requests. :param retries: Number of retries for API requests.
:param ca_cert_data: verify the peer using concatenated CA certificate data :param ca_cert_data: verify the peer using concatenated CA certificate data
in PEM (str) or DER (bytes) format. in PEM (str) or DER (bytes) format.
:param cert_file: the path to a client certificate file, for mTLS.
:param key_file: the path to a client key file, for mTLS.
:Example: :Example:
@@ -203,6 +205,8 @@ conf = openapi_client.Configuration(
ssl_ca_cert: Optional[str]=None, ssl_ca_cert: Optional[str]=None,
retries: Optional[int] = None, retries: Optional[int] = None,
ca_cert_data: Optional[Union[str, bytes]] = None, ca_cert_data: Optional[Union[str, bytes]] = None,
cert_file: Optional[str]=None,
key_file: Optional[str]=None,
*, *,
debug: Optional[bool] = None, debug: Optional[bool] = None,
) -> None: ) -> None:
@@ -284,10 +288,10 @@ conf = openapi_client.Configuration(
"""Set this to verify the peer using PEM (str) or DER (bytes) """Set this to verify the peer using PEM (str) or DER (bytes)
certificate data. certificate data.
""" """
self.cert_file = None self.cert_file = cert_file
"""client certificate file """client certificate file
""" """
self.key_file = None self.key_file = key_file
"""client key file """client key file
""" """
self.assert_hostname = None self.assert_hostname = None

View File

@@ -408,6 +408,14 @@ class AnotherFakeApi
} }
} }
if ($this->config->getCertFile()) {
$options[RequestOptions::CERT] = $this->config->getCertFile();
}
if ($this->config->getKeyFile()) {
$options[RequestOptions::SSL_KEY] = $this->config->getKeyFile();
}
return $options; return $options;
} }

View File

@@ -381,6 +381,14 @@ class DefaultApi
} }
} }
if ($this->config->getCertFile()) {
$options[RequestOptions::CERT] = $this->config->getCertFile();
}
if ($this->config->getKeyFile()) {
$options[RequestOptions::SSL_KEY] = $this->config->getKeyFile();
}
return $options; return $options;
} }

View File

@@ -7578,6 +7578,14 @@ class FakeApi
} }
} }
if ($this->config->getCertFile()) {
$options[RequestOptions::CERT] = $this->config->getCertFile();
}
if ($this->config->getKeyFile()) {
$options[RequestOptions::SSL_KEY] = $this->config->getKeyFile();
}
return $options; return $options;
} }

View File

@@ -413,6 +413,14 @@ class FakeClassnameTags123Api
} }
} }
if ($this->config->getCertFile()) {
$options[RequestOptions::CERT] = $this->config->getCertFile();
}
if ($this->config->getKeyFile()) {
$options[RequestOptions::SSL_KEY] = $this->config->getKeyFile();
}
return $options; return $options;
} }

View File

@@ -3450,6 +3450,14 @@ class PetApi
} }
} }
if ($this->config->getCertFile()) {
$options[RequestOptions::CERT] = $this->config->getCertFile();
}
if ($this->config->getKeyFile()) {
$options[RequestOptions::SSL_KEY] = $this->config->getKeyFile();
}
return $options; return $options;
} }

View File

@@ -1162,6 +1162,14 @@ class StoreApi
} }
} }
if ($this->config->getCertFile()) {
$options[RequestOptions::CERT] = $this->config->getCertFile();
}
if ($this->config->getKeyFile()) {
$options[RequestOptions::SSL_KEY] = $this->config->getKeyFile();
}
return $options; return $options;
} }

View File

@@ -2024,6 +2024,14 @@ class UserApi
} }
} }
if ($this->config->getCertFile()) {
$options[RequestOptions::CERT] = $this->config->getCertFile();
}
if ($this->config->getKeyFile()) {
$options[RequestOptions::SSL_KEY] = $this->config->getKeyFile();
}
return $options; return $options;
} }

View File

@@ -123,6 +123,20 @@ class Configuration
*/ */
protected $tempFolderPath; protected $tempFolderPath;
/**
* Path to a certificate file, for mTLS
*
* @var string
*/
protected $certFile;
/**
* Path to a key file, for mTLS
*
* @var string
*/
protected $keyFile;
/** /**
* Constructor * Constructor
*/ */
@@ -396,6 +410,49 @@ class Configuration
return $this->tempFolderPath; return $this->tempFolderPath;
} }
/**
* Sets the certificate file path, for mTLS
*
* @return $this
*/
public function setCertFile($certFile)
{
$this->certFile = $certFile;
return $this;
}
/**
* Gets the certificate file path, for mTLS
*
* @return string Certificate file path
*/
public function getCertFile()
{
return $this->certFile;
}
/**
* Sets the certificate key path, for mTLS
*
* @return $this
*/
public function setKeyFile($keyFile)
{
$this->keyFile = $keyFile;
return $this;
}
/**
* Gets the certificate key path, for mTLS
*
* @return string Certificate key path
*/
public function getKeyFile()
{
return $this->keyFile;
}
/** /**
* Gets the default configuration instance * Gets the default configuration instance
* *

View File

@@ -123,6 +123,20 @@ class Configuration
*/ */
protected $tempFolderPath; protected $tempFolderPath;
/**
* Path to a certificate file, for mTLS
*
* @var string
*/
protected $certFile;
/**
* Path to a key file, for mTLS
*
* @var string
*/
protected $keyFile;
/** /**
* Constructor * Constructor
*/ */
@@ -396,6 +410,49 @@ class Configuration
return $this->tempFolderPath; return $this->tempFolderPath;
} }
/**
* Sets the certificate file path, for mTLS
*
* @return $this
*/
public function setCertFile($certFile)
{
$this->certFile = $certFile;
return $this;
}
/**
* Gets the certificate file path, for mTLS
*
* @return string Certificate file path
*/
public function getCertFile()
{
return $this->certFile;
}
/**
* Sets the certificate key path, for mTLS
*
* @return $this
*/
public function setKeyFile($keyFile)
{
$this->keyFile = $keyFile;
return $this;
}
/**
* Gets the certificate key path, for mTLS
*
* @return string Certificate key path
*/
public function getKeyFile()
{
return $this->keyFile;
}
/** /**
* Gets the default configuration instance * Gets the default configuration instance
* *

View File

@@ -170,6 +170,8 @@ class Configuration:
:param retries: Number of retries for API requests. :param retries: Number of retries for API requests.
:param ca_cert_data: verify the peer using concatenated CA certificate data :param ca_cert_data: verify the peer using concatenated CA certificate data
in PEM (str) or DER (bytes) format. in PEM (str) or DER (bytes) format.
:param cert_file: the path to a client certificate file, for mTLS.
:param key_file: the path to a client key file, for mTLS.
:Example: :Example:
@@ -267,6 +269,8 @@ conf = petstore_api.Configuration(
ssl_ca_cert: Optional[str]=None, ssl_ca_cert: Optional[str]=None,
retries: Optional[int] = None, retries: Optional[int] = None,
ca_cert_data: Optional[Union[str, bytes]] = None, ca_cert_data: Optional[Union[str, bytes]] = None,
cert_file: Optional[str]=None,
key_file: Optional[str]=None,
*, *,
debug: Optional[bool] = None, debug: Optional[bool] = None,
) -> None: ) -> None:
@@ -353,10 +357,10 @@ conf = petstore_api.Configuration(
"""Set this to verify the peer using PEM (str) or DER (bytes) """Set this to verify the peer using PEM (str) or DER (bytes)
certificate data. certificate data.
""" """
self.cert_file = None self.cert_file = cert_file
"""client certificate file """client certificate file
""" """
self.key_file = None self.key_file = key_file
"""client key file """client key file
""" """
self.assert_hostname = None self.assert_hostname = None

View File

@@ -170,6 +170,8 @@ class Configuration:
:param retries: Number of retries for API requests. :param retries: Number of retries for API requests.
:param ca_cert_data: verify the peer using concatenated CA certificate data :param ca_cert_data: verify the peer using concatenated CA certificate data
in PEM (str) or DER (bytes) format. in PEM (str) or DER (bytes) format.
:param cert_file: the path to a client certificate file, for mTLS.
:param key_file: the path to a client key file, for mTLS.
:Example: :Example:
@@ -267,6 +269,8 @@ conf = petstore_api.Configuration(
ssl_ca_cert: Optional[str]=None, ssl_ca_cert: Optional[str]=None,
retries: Optional[int] = None, retries: Optional[int] = None,
ca_cert_data: Optional[Union[str, bytes]] = None, ca_cert_data: Optional[Union[str, bytes]] = None,
cert_file: Optional[str]=None,
key_file: Optional[str]=None,
*, *,
debug: Optional[bool] = None, debug: Optional[bool] = None,
) -> None: ) -> None:
@@ -353,10 +357,10 @@ conf = petstore_api.Configuration(
"""Set this to verify the peer using PEM (str) or DER (bytes) """Set this to verify the peer using PEM (str) or DER (bytes)
certificate data. certificate data.
""" """
self.cert_file = None self.cert_file = cert_file
"""client certificate file """client certificate file
""" """
self.key_file = None self.key_file = key_file
"""client key file """client key file
""" """
self.assert_hostname = None self.assert_hostname = None

View File

@@ -171,6 +171,8 @@ class Configuration:
:param retries: Number of retries for API requests. :param retries: Number of retries for API requests.
:param ca_cert_data: verify the peer using concatenated CA certificate data :param ca_cert_data: verify the peer using concatenated CA certificate data
in PEM (str) or DER (bytes) format. in PEM (str) or DER (bytes) format.
:param cert_file: the path to a client certificate file, for mTLS.
:param key_file: the path to a client key file, for mTLS.
:Example: :Example:
@@ -268,6 +270,8 @@ conf = petstore_api.Configuration(
ssl_ca_cert: Optional[str]=None, ssl_ca_cert: Optional[str]=None,
retries: Optional[int] = None, retries: Optional[int] = None,
ca_cert_data: Optional[Union[str, bytes]] = None, ca_cert_data: Optional[Union[str, bytes]] = None,
cert_file: Optional[str]=None,
key_file: Optional[str]=None,
*, *,
debug: Optional[bool] = None, debug: Optional[bool] = None,
) -> None: ) -> None:
@@ -354,10 +358,10 @@ conf = petstore_api.Configuration(
"""Set this to verify the peer using PEM (str) or DER (bytes) """Set this to verify the peer using PEM (str) or DER (bytes)
certificate data. certificate data.
""" """
self.cert_file = None self.cert_file = cert_file
"""client certificate file """client certificate file
""" """
self.key_file = None self.key_file = key_file
"""client key file """client key file
""" """
self.assert_hostname = None self.assert_hostname = None

View File

@@ -171,6 +171,8 @@ class Configuration:
:param retries: Number of retries for API requests. :param retries: Number of retries for API requests.
:param ca_cert_data: verify the peer using concatenated CA certificate data :param ca_cert_data: verify the peer using concatenated CA certificate data
in PEM (str) or DER (bytes) format. in PEM (str) or DER (bytes) format.
:param cert_file: the path to a client certificate file, for mTLS.
:param key_file: the path to a client key file, for mTLS.
:Example: :Example:
@@ -268,6 +270,8 @@ conf = petstore_api.Configuration(
ssl_ca_cert: Optional[str]=None, ssl_ca_cert: Optional[str]=None,
retries: Optional[int] = None, retries: Optional[int] = None,
ca_cert_data: Optional[Union[str, bytes]] = None, ca_cert_data: Optional[Union[str, bytes]] = None,
cert_file: Optional[str]=None,
key_file: Optional[str]=None,
*, *,
debug: Optional[bool] = None, debug: Optional[bool] = None,
) -> None: ) -> None:
@@ -354,10 +358,10 @@ conf = petstore_api.Configuration(
"""Set this to verify the peer using PEM (str) or DER (bytes) """Set this to verify the peer using PEM (str) or DER (bytes)
certificate data. certificate data.
""" """
self.cert_file = None self.cert_file = cert_file
"""client certificate file """client certificate file
""" """
self.key_file = None self.key_file = key_file
"""client key file """client key file
""" """
self.assert_hostname = None self.assert_hostname = None