Skip to content

Commit

Permalink
feat: add documentation for the Logger option inside the options array (
Browse files Browse the repository at this point in the history
  • Loading branch information
Hectorhammett authored Dec 5, 2024
1 parent 0d7b5eb commit 4a2bdb1
Show file tree
Hide file tree
Showing 13 changed files with 62 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/Generation/GapicClientV2Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
use Google\Generator\Utils\Type;
use Google\LongRunning\Client\OperationsClient;
use GuzzleHttp\Promise\PromiseInterface;
use Psr\Log\LoggerInterface;

class GapicClientV2Generator
{
Expand Down Expand Up @@ -723,6 +724,17 @@ private function construct(): PhpClassMember
'A callable which returns the client cert as a string. This can be used to provide',
'a certificate and private key to the transport layer for mTLS.'
)
),
PhpDoc::type(
Vector::new([
$ctx->type(Type::false()),
$ctx->type(Type::fromName(LoggerInterface::class))
]),
'logger',
PhpDoc::text(
'A PSR-3 compliant logger. If set to false, logging is disabled,',
'ignoring the \'GOOGLE_SDK_PHP_LOGGING\' environment flag'
)
)
)),
PhpDoc::throws($this->ctx->type(Type::fromName(ValidationException::class))),
Expand Down
6 changes: 6 additions & 0 deletions src/Utils/Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ public static function bool(): Type
return new Type(null, 'bool');
}

/** The build int 'false' value */
public static function false(): Type
{
return new Type(null, 'false');
}

/** The built-in 'callable' type. */
public static function callable(): Type
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
use Google\LongRunning\Client\OperationsClient;
use Google\LongRunning\Operation;
use GuzzleHttp\Promise\PromiseInterface;
use Psr\Log\LoggerInterface;

/**
* Service Description: A service that application uses to manipulate triggers and functions.
Expand Down Expand Up @@ -329,6 +330,9 @@ public static function parseName(string $formattedName, ?string $template = null
* @type callable $clientCertSource
* A callable which returns the client cert as a string. This can be used to
* provide a certificate and private key to the transport layer for mTLS.
* @type false|LoggerInterface $logger
* A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the
* 'GOOGLE_SDK_PHP_LOGGING' environment flag
* }
*
* @throws ValidationException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
use Google\LongRunning\Client\OperationsClient;
use Google\LongRunning\Operation;
use GuzzleHttp\Promise\PromiseInterface;
use Psr\Log\LoggerInterface;

/**
* Service Description: Configures and manages Cloud Memorystore for Redis instances
Expand Down Expand Up @@ -303,6 +304,9 @@ public static function parseName(string $formattedName, ?string $template = null
* @type callable $clientCertSource
* A callable which returns the client cert as a string. This can be used to
* provide a certificate and private key to the transport layer for mTLS.
* @type false|LoggerInterface $logger
* A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the
* 'GOOGLE_SDK_PHP_LOGGING' environment flag
* }
*
* @throws ValidationException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
use Google\Cloud\SecurityCenter\V1\UpdateSourceRequest;
use Google\LongRunning\Operation;
use GuzzleHttp\Promise\PromiseInterface;
use Psr\Log\LoggerInterface;

/**
* Service Description: V1 APIs for Security Center service.
Expand Down Expand Up @@ -1295,6 +1296,9 @@ public static function parseName(string $formattedName, ?string $template = null
* @type callable $clientCertSource
* A callable which returns the client cert as a string. This can be used to
* provide a certificate and private key to the transport layer for mTLS.
* @type false|LoggerInterface $logger
* A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the
* 'GOOGLE_SDK_PHP_LOGGING' environment flag
* }
*
* @throws ValidationException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
use Google\LongRunning\Operation;
use Grpc\ChannelCredentials;
use GuzzleHttp\Promise\PromiseInterface;
use Psr\Log\LoggerInterface;

/**
* Service Description: Cloud Spanner Database Admin API
Expand Down Expand Up @@ -370,6 +371,9 @@ public static function parseName(string $formattedName, ?string $template = null
* @type callable $clientCertSource
* A callable which returns the client cert as a string. This can be used to
* provide a certificate and private key to the transport layer for mTLS.
* @type false|LoggerInterface $logger
* A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the
* 'GOOGLE_SDK_PHP_LOGGING' environment flag
* }
*
* @throws ValidationException
Expand Down
4 changes: 4 additions & 0 deletions tests/Unit/ProtoTests/Basic/out/src/Client/BasicClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
use Google\Auth\FetchAuthTokenInterface;
use Grpc\ChannelCredentials;
use GuzzleHttp\Promise\PromiseInterface;
use Psr\Log\LoggerInterface;
use Testing\Basic\Request;
use Testing\Basic\RequestWithArgs;
use Testing\Basic\Response;
Expand Down Expand Up @@ -145,6 +146,9 @@ private static function getClientDefaults()
* @type callable $clientCertSource
* A callable which returns the client cert as a string. This can be used to
* provide a certificate and private key to the transport layer for mTLS.
* @type false|LoggerInterface $logger
* A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the
* 'GOOGLE_SDK_PHP_LOGGING' environment flag
* }
*
* @throws ValidationException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
use Google\ApiCore\Transport\TransportInterface;
use Google\ApiCore\ValidationException;
use Google\Auth\FetchAuthTokenInterface;
use Psr\Log\LoggerInterface;

/**
* Service Description: This is a basicGrpcOnly service.
Expand Down Expand Up @@ -125,6 +126,9 @@ private static function supportedTransports()
* @type callable $clientCertSource
* A callable which returns the client cert as a string. This can be used to
* provide a certificate and private key to the transport layer for mTLS.
* @type false|LoggerInterface $logger
* A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the
* 'GOOGLE_SDK_PHP_LOGGING' environment flag
* }
*
* @throws ValidationException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
use Google\ApiCore\ValidationException;
use Google\Auth\FetchAuthTokenInterface;
use GuzzleHttp\Promise\PromiseInterface;
use Psr\Log\LoggerInterface;
use Testing\BasicOneofNew\Request;
use Testing\BasicOneofNew\Response;

Expand Down Expand Up @@ -134,6 +135,9 @@ private static function getClientDefaults()
* @type callable $clientCertSource
* A callable which returns the client cert as a string. This can be used to
* provide a certificate and private key to the transport layer for mTLS.
* @type false|LoggerInterface $logger
* A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the
* 'GOOGLE_SDK_PHP_LOGGING' environment flag
* }
*
* @throws ValidationException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
use Google\ApiCore\ValidationException;
use Google\Auth\FetchAuthTokenInterface;
use GuzzleHttp\Promise\PromiseInterface;
use Psr\Log\LoggerInterface;
use Testing\CustomLroNew\CreateFooRequest;

/**
Expand Down Expand Up @@ -218,6 +219,9 @@ private function createOperationsClient(array $options)
* @type callable $clientCertSource
* A callable which returns the client cert as a string. This can be used to
* provide a certificate and private key to the transport layer for mTLS.
* @type false|LoggerInterface $logger
* A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the
* 'GOOGLE_SDK_PHP_LOGGING' environment flag
* }
*
* @throws ValidationException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
use Google\ApiCore\ValidationException;
use Google\Auth\FetchAuthTokenInterface;
use GuzzleHttp\Promise\PromiseInterface;
use Psr\Log\LoggerInterface;
use Testing\CustomLroNew\CancelOperationRequest;
use Testing\CustomLroNew\CustomOperationResponse;
use Testing\CustomLroNew\DeleteOperationRequest;
Expand Down Expand Up @@ -149,6 +150,9 @@ private static function supportedTransports()
* @type callable $clientCertSource
* A callable which returns the client cert as a string. This can be used to
* provide a certificate and private key to the transport layer for mTLS.
* @type false|LoggerInterface $logger
* A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the
* 'GOOGLE_SDK_PHP_LOGGING' environment flag
* }
*
* @throws ValidationException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
use Google\ApiCore\ValidationException;
use Google\Auth\FetchAuthTokenInterface;
use GuzzleHttp\Promise\PromiseInterface;
use Psr\Log\LoggerInterface;
use Testing\ResourceNames\FileLevelChildTypeRefRequest;
use Testing\ResourceNames\FileLevelTypeRefRequest;
use Testing\ResourceNames\MultiPatternRequest;
Expand Down Expand Up @@ -483,6 +484,9 @@ public static function parseName(string $formattedName, ?string $template = null
* @type callable $clientCertSource
* A callable which returns the client cert as a string. This can be used to
* provide a certificate and private key to the transport layer for mTLS.
* @type false|LoggerInterface $logger
* A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the
* 'GOOGLE_SDK_PHP_LOGGING' environment flag
* }
*
* @throws ValidationException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
use Google\ApiCore\ValidationException;
use Google\Auth\FetchAuthTokenInterface;
use GuzzleHttp\Promise\PromiseInterface;
use Psr\Log\LoggerInterface;
use Testing\RoutingHeaders\NestedRequest;
use Testing\RoutingHeaders\OrderRequest;
use Testing\RoutingHeaders\Response;
Expand Down Expand Up @@ -144,6 +145,9 @@ private static function getClientDefaults()
* @type callable $clientCertSource
* A callable which returns the client cert as a string. This can be used to
* provide a certificate and private key to the transport layer for mTLS.
* @type false|LoggerInterface $logger
* A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the
* 'GOOGLE_SDK_PHP_LOGGING' environment flag
* }
*
* @throws ValidationException
Expand Down

0 comments on commit 4a2bdb1

Please sign in to comment.