Skip to content

Commit 04405e0

Browse files
feat: [Many APIs] usage deprecation of credentials client option (#8599)
* feat: support ClientOptions in client constructor docs: document universeDomain client option docs: add "generic" phpdocs for OperationResponse and ServerStream fix: Update pagination rules for compute clients deps: Update dependency google/protobuf to v4 PiperOrigin-RevId: 807444648 Source-Link: googleapis/googleapis@6288882 Source-Link: googleapis/googleapis-gen@577eee9 Copy-Tag: eyJwIjoiRGF0YWZsb3cvLk93bEJvdC55YW1sIiwiaCI6IjU3N2VlZTkzMWI3M2U5MTBmZmFlMWIxNzBmNmY5ZjhiZDc5NzVhMzYifQ== Copy-Tag: eyJwIjoiRGF0YWZvcm0vLk93bEJvdC55YW1sIiwiaCI6IjU3N2VlZTkzMWI3M2U5MTBmZmFlMWIxNzBmNmY5ZjhiZDc5NzVhMzYifQ== Copy-Tag: eyJwIjoiRGF0YXBsZXgvLk93bEJvdC55YW1sIiwiaCI6IjU3N2VlZTkzMWI3M2U5MTBmZmFlMWIxNzBmNmY5ZjhiZDc5NzVhMzYifQ== Copy-Tag: eyJwIjoiRGF0YXByb2MvLk93bEJvdC55YW1sIiwiaCI6IjU3N2VlZTkzMWI3M2U5MTBmZmFlMWIxNzBmNmY5ZjhiZDc5NzVhMzYifQ== Copy-Tag: eyJwIjoiRGF0YXByb2NNZXRhc3RvcmUvLk93bEJvdC55YW1sIiwiaCI6IjU3N2VlZTkzMWI3M2U5MTBmZmFlMWIxNzBmNmY5ZjhiZDc5NzVhMzYifQ== Copy-Tag: eyJwIjoiRGF0YXN0b3JlLy5Pd2xCb3QueWFtbCIsImgiOiI1NzdlZWU5MzFiNzNlOTEwZmZhZTFiMTcwZjZmOWY4YmQ3OTc1YTM2In0= Copy-Tag: eyJwIjoiRGF0YXN0b3JlQWRtaW4vLk93bEJvdC55YW1sIiwiaCI6IjU3N2VlZTkzMWI3M2U5MTBmZmFlMWIxNzBmNmY5ZjhiZDc5NzVhMzYifQ== Copy-Tag: eyJwIjoiRGF0YXN0cmVhbS8uT3dsQm90L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LCJoIjoiNTc3ZWVlOTMxYjczZTkxMGZmYWUxYjE3MGY2ZjlmOGJkNzk3NWEzNiJ9 Copy-Tag: eyJwIjoiRG9tYWlucy8uT3dsQm90LnlhbWwiLCJoIjoiNTc3ZWVlOTMxYjczZTkxMGZmYWUxYjE3MGY2ZjlmOGJkNzk3NWEzNiJ9 Copy-Tag: eyJwIjoiRWRnZU5ldHdvcmsvLk93bEJvdC55YW1sIiwiaCI6IjU3N2VlZTkzMWI3M2U5MTBmZmFlMWIxNzBmNmY5ZjhiZDc5NzVhMzYifQ== Copy-Tag: eyJwIjoiRXJyb3JSZXBvcnRpbmcvLk93bEJvdC55YW1sIiwiaCI6IjU3N2VlZTkzMWI3M2U5MTBmZmFlMWIxNzBmNmY5ZjhiZDc5NzVhMzYifQ== * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * docs: usage deprecation of credentials client option PiperOrigin-RevId: 809097824 Source-Link: googleapis/googleapis@e8ed6b4 Source-Link: googleapis/googleapis-gen@96cfee1 Copy-Tag: eyJwIjoiRGF0YWZsb3cvLk93bEJvdC55YW1sIiwiaCI6Ijk2Y2ZlZTE2MzkzNjhlMzRhOGQxZjc2NWNlZGRlY2Y5ZGNhMTE5ZGMifQ== Copy-Tag: eyJwIjoiRGF0YWZvcm0vLk93bEJvdC55YW1sIiwiaCI6Ijk2Y2ZlZTE2MzkzNjhlMzRhOGQxZjc2NWNlZGRlY2Y5ZGNhMTE5ZGMifQ== Copy-Tag: eyJwIjoiRGF0YXBsZXgvLk93bEJvdC55YW1sIiwiaCI6Ijk2Y2ZlZTE2MzkzNjhlMzRhOGQxZjc2NWNlZGRlY2Y5ZGNhMTE5ZGMifQ== Copy-Tag: eyJwIjoiRGF0YXByb2MvLk93bEJvdC55YW1sIiwiaCI6Ijk2Y2ZlZTE2MzkzNjhlMzR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tbCIsImgiOiI5NmNmZWUxNjM5MzY4ZTM0YThkMWY3NjVjZWRkZWNmOWRjYTExOWRjIn0= Copy-Tag: eyJwIjoiRGlzY292ZXJ5RW5naW5lLy5Pd2xCb3QueWFtbCIsImgiOiI5NmNmZWUxNjM5MzY4ZTM0YThkMWY3NjVjZWRkZWNmOWRjYTExOWRjIn0= Copy-Tag: eyJwIjoiRGxwLy5Pd2xCb3QueWFtbCIsImgiOiI5NmNmZWUxNjM5MzY4ZTM0YThkMWY3NjVjZWRkZWNmOWRjYTExOWRjIn0= Copy-Tag: eyJwIjoiRG1zLy5Pd2xCb3QueWFtbCIsImgiOiI5NmNmZWUxNjM5MzY4ZTM0YThkMWY3NjVjZWRkZWNmOWRjYTExOWRjIn0= Copy-Tag: eyJwIjoiRG9jdW1lbnRBaS8uT3dsQm90LnlhbWwiLCJoIjoiOTZjZmVlMTYzOTM2OGUzNGE4ZDFmNzY1Y2VkZGVjZjlkY2ExMTlkYyJ9 Copy-Tag: eyJwIjoiRG9tYWlucy8uT3dsQm90LnlhbWwiLCJoIjoiOTZjZmVlMTYzOTM2OGUzNGE4ZDFmNzY1Y2VkZGVjZjlkY2ExMTlkYyJ9 Copy-Tag: eyJwIjoiRWRnZU5ldHdvcmsvLk93bEJvdC55YW1sIiwiaCI6Ijk2Y2ZlZTE2MzkzNjhlMzRhOGQxZjc2NWNlZGRlY2Y5ZGNhMTE5ZGMifQ== Copy-Tag: eyJwIjoiRXJyb3JSZXBvcnRpbmcvLk93bEJvdC55YW1sIiwiaCI6Ijk2Y2ZlZTE2MzkzNjhlMzRhOGQxZjc2NWNlZGRlY2Y5ZGNhMTE5ZGMifQ== * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent c9c851a commit 04405e0

102 files changed

Lines changed: 3828 additions & 4984 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Dataflow/src/V1beta3/Client/FlexTemplatesServiceClient.php

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
use Google\ApiCore\ApiException;
3030
use Google\ApiCore\CredentialsWrapper;
3131
use Google\ApiCore\GapicClientTrait;
32+
use Google\ApiCore\Options\ClientOptions;
3233
use Google\ApiCore\RetrySettings;
3334
use Google\ApiCore\Transport\TransportInterface;
3435
use Google\ApiCore\ValidationException;
@@ -99,25 +100,28 @@ private static function getClientDefaults()
99100
/**
100101
* Constructor.
101102
*
102-
* @param array $options {
103+
* @param array|ClientOptions $options {
103104
* Optional. Options for configuring the service API wrapper.
104105
*
105106
* @type string $apiEndpoint
106107
* The address of the API remote host. May optionally include the port, formatted
107108
* as "<uri>:<port>". Default 'dataflow.googleapis.com:443'.
108-
* @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials
109-
* The credentials to be used by the client to authorize API calls. This option
110-
* accepts either a path to a credentials file, or a decoded credentials file as a
111-
* PHP array.
112-
* *Advanced usage*: In addition, this option can also accept a pre-constructed
113-
* {@see \Google\Auth\FetchAuthTokenInterface} object or
114-
* {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these
115-
* objects are provided, any settings in $credentialsConfig will be ignored.
116-
* *Important*: If you accept a credential configuration (credential
117-
* JSON/File/Stream) from an external source for authentication to Google Cloud
118-
* Platform, you must validate it before providing it to any Google API or library.
119-
* Providing an unvalidated credential configuration to Google APIs can compromise
120-
* the security of your systems and data. For more information {@see
109+
* @type FetchAuthTokenInterface|CredentialsWrapper $credentials
110+
* This option should only be used with a pre-constructed
111+
* {@see FetchAuthTokenInterface} or {@see CredentialsWrapper} object. Note that
112+
* when one of these objects are provided, any settings in $credentialsConfig will
113+
* be ignored.
114+
* **Important**: If you are providing a path to a credentials file, or a decoded
115+
* credentials file as a PHP array, this usage is now DEPRECATED. Providing an
116+
* unvalidated credential configuration to Google APIs can compromise the security
117+
* of your systems and data. It is recommended to create the credentials explicitly
118+
* ```
119+
* use Google\Auth\Credentials\ServiceAccountCredentials;
120+
* use Google\Cloud\Dataflow\V1beta3\FlexTemplatesServiceClient;
121+
* $creds = new ServiceAccountCredentials($scopes, $json);
122+
* $options = new FlexTemplatesServiceClient(['credentials' => $creds]);
123+
* ```
124+
* {@see
121125
* https://cloud.google.com/docs/authentication/external/externally-sourced-credentials}
122126
* @type array $credentialsConfig
123127
* Options used to configure credentials, including auth token caching, for the
@@ -155,13 +159,15 @@ private static function getClientDefaults()
155159
* @type false|LoggerInterface $logger
156160
* A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the
157161
* 'GOOGLE_SDK_PHP_LOGGING' environment flag
162+
* @type string $universeDomain
163+
* The service domain for the client. Defaults to 'googleapis.com'.
158164
* }
159165
*
160166
* @throws ValidationException
161167
*
162168
* @experimental
163169
*/
164-
public function __construct(array $options = [])
170+
public function __construct(array|ClientOptions $options = [])
165171
{
166172
$clientOptions = $this->buildClientOptions($options);
167173
$this->setClientOptions($clientOptions);
@@ -202,10 +208,8 @@ public function __call($method, $args)
202208
*
203209
* @experimental
204210
*/
205-
public function launchFlexTemplate(
206-
LaunchFlexTemplateRequest $request,
207-
array $callOptions = []
208-
): LaunchFlexTemplateResponse {
211+
public function launchFlexTemplate(LaunchFlexTemplateRequest $request, array $callOptions = []): LaunchFlexTemplateResponse
212+
{
209213
return $this->startApiCall('LaunchFlexTemplate', $request, $callOptions)->wait();
210214
}
211215
}

Dataflow/src/V1beta3/Client/JobsV1Beta3Client.php

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
use Google\ApiCore\ApiException;
3030
use Google\ApiCore\CredentialsWrapper;
3131
use Google\ApiCore\GapicClientTrait;
32+
use Google\ApiCore\Options\ClientOptions;
3233
use Google\ApiCore\PagedListResponse;
3334
use Google\ApiCore\RetrySettings;
3435
use Google\ApiCore\Transport\TransportInterface;
@@ -114,25 +115,28 @@ private static function getClientDefaults()
114115
/**
115116
* Constructor.
116117
*
117-
* @param array $options {
118+
* @param array|ClientOptions $options {
118119
* Optional. Options for configuring the service API wrapper.
119120
*
120121
* @type string $apiEndpoint
121122
* The address of the API remote host. May optionally include the port, formatted
122123
* as "<uri>:<port>". Default 'dataflow.googleapis.com:443'.
123-
* @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials
124-
* The credentials to be used by the client to authorize API calls. This option
125-
* accepts either a path to a credentials file, or a decoded credentials file as a
126-
* PHP array.
127-
* *Advanced usage*: In addition, this option can also accept a pre-constructed
128-
* {@see \Google\Auth\FetchAuthTokenInterface} object or
129-
* {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these
130-
* objects are provided, any settings in $credentialsConfig will be ignored.
131-
* *Important*: If you accept a credential configuration (credential
132-
* JSON/File/Stream) from an external source for authentication to Google Cloud
133-
* Platform, you must validate it before providing it to any Google API or library.
134-
* Providing an unvalidated credential configuration to Google APIs can compromise
135-
* the security of your systems and data. For more information {@see
124+
* @type FetchAuthTokenInterface|CredentialsWrapper $credentials
125+
* This option should only be used with a pre-constructed
126+
* {@see FetchAuthTokenInterface} or {@see CredentialsWrapper} object. Note that
127+
* when one of these objects are provided, any settings in $credentialsConfig will
128+
* be ignored.
129+
* **Important**: If you are providing a path to a credentials file, or a decoded
130+
* credentials file as a PHP array, this usage is now DEPRECATED. Providing an
131+
* unvalidated credential configuration to Google APIs can compromise the security
132+
* of your systems and data. It is recommended to create the credentials explicitly
133+
* ```
134+
* use Google\Auth\Credentials\ServiceAccountCredentials;
135+
* use Google\Cloud\Dataflow\V1beta3\JobsV1Beta3Client;
136+
* $creds = new ServiceAccountCredentials($scopes, $json);
137+
* $options = new JobsV1Beta3Client(['credentials' => $creds]);
138+
* ```
139+
* {@see
136140
* https://cloud.google.com/docs/authentication/external/externally-sourced-credentials}
137141
* @type array $credentialsConfig
138142
* Options used to configure credentials, including auth token caching, for the
@@ -170,13 +174,15 @@ private static function getClientDefaults()
170174
* @type false|LoggerInterface $logger
171175
* A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the
172176
* 'GOOGLE_SDK_PHP_LOGGING' environment flag
177+
* @type string $universeDomain
178+
* The service domain for the client. Defaults to 'googleapis.com'.
173179
* }
174180
*
175181
* @throws ValidationException
176182
*
177183
* @experimental
178184
*/
179-
public function __construct(array $options = [])
185+
public function __construct(array|ClientOptions $options = [])
180186
{
181187
$clientOptions = $this->buildClientOptions($options);
182188
$this->setClientOptions($clientOptions);

Dataflow/src/V1beta3/Client/MessagesV1Beta3Client.php

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
use Google\ApiCore\ApiException;
3030
use Google\ApiCore\CredentialsWrapper;
3131
use Google\ApiCore\GapicClientTrait;
32+
use Google\ApiCore\Options\ClientOptions;
3233
use Google\ApiCore\PagedListResponse;
3334
use Google\ApiCore\RetrySettings;
3435
use Google\ApiCore\Transport\TransportInterface;
@@ -100,25 +101,28 @@ private static function getClientDefaults()
100101
/**
101102
* Constructor.
102103
*
103-
* @param array $options {
104+
* @param array|ClientOptions $options {
104105
* Optional. Options for configuring the service API wrapper.
105106
*
106107
* @type string $apiEndpoint
107108
* The address of the API remote host. May optionally include the port, formatted
108109
* as "<uri>:<port>". Default 'dataflow.googleapis.com:443'.
109-
* @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials
110-
* The credentials to be used by the client to authorize API calls. This option
111-
* accepts either a path to a credentials file, or a decoded credentials file as a
112-
* PHP array.
113-
* *Advanced usage*: In addition, this option can also accept a pre-constructed
114-
* {@see \Google\Auth\FetchAuthTokenInterface} object or
115-
* {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these
116-
* objects are provided, any settings in $credentialsConfig will be ignored.
117-
* *Important*: If you accept a credential configuration (credential
118-
* JSON/File/Stream) from an external source for authentication to Google Cloud
119-
* Platform, you must validate it before providing it to any Google API or library.
120-
* Providing an unvalidated credential configuration to Google APIs can compromise
121-
* the security of your systems and data. For more information {@see
110+
* @type FetchAuthTokenInterface|CredentialsWrapper $credentials
111+
* This option should only be used with a pre-constructed
112+
* {@see FetchAuthTokenInterface} or {@see CredentialsWrapper} object. Note that
113+
* when one of these objects are provided, any settings in $credentialsConfig will
114+
* be ignored.
115+
* **Important**: If you are providing a path to a credentials file, or a decoded
116+
* credentials file as a PHP array, this usage is now DEPRECATED. Providing an
117+
* unvalidated credential configuration to Google APIs can compromise the security
118+
* of your systems and data. It is recommended to create the credentials explicitly
119+
* ```
120+
* use Google\Auth\Credentials\ServiceAccountCredentials;
121+
* use Google\Cloud\Dataflow\V1beta3\MessagesV1Beta3Client;
122+
* $creds = new ServiceAccountCredentials($scopes, $json);
123+
* $options = new MessagesV1Beta3Client(['credentials' => $creds]);
124+
* ```
125+
* {@see
122126
* https://cloud.google.com/docs/authentication/external/externally-sourced-credentials}
123127
* @type array $credentialsConfig
124128
* Options used to configure credentials, including auth token caching, for the
@@ -156,13 +160,15 @@ private static function getClientDefaults()
156160
* @type false|LoggerInterface $logger
157161
* A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the
158162
* 'GOOGLE_SDK_PHP_LOGGING' environment flag
163+
* @type string $universeDomain
164+
* The service domain for the client. Defaults to 'googleapis.com'.
159165
* }
160166
*
161167
* @throws ValidationException
162168
*
163169
* @experimental
164170
*/
165-
public function __construct(array $options = [])
171+
public function __construct(array|ClientOptions $options = [])
166172
{
167173
$clientOptions = $this->buildClientOptions($options);
168174
$this->setClientOptions($clientOptions);

Dataflow/src/V1beta3/Client/MetricsV1Beta3Client.php

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
use Google\ApiCore\ApiException;
3030
use Google\ApiCore\CredentialsWrapper;
3131
use Google\ApiCore\GapicClientTrait;
32+
use Google\ApiCore\Options\ClientOptions;
3233
use Google\ApiCore\PagedListResponse;
3334
use Google\ApiCore\RetrySettings;
3435
use Google\ApiCore\Transport\TransportInterface;
@@ -105,25 +106,28 @@ private static function getClientDefaults()
105106
/**
106107
* Constructor.
107108
*
108-
* @param array $options {
109+
* @param array|ClientOptions $options {
109110
* Optional. Options for configuring the service API wrapper.
110111
*
111112
* @type string $apiEndpoint
112113
* The address of the API remote host. May optionally include the port, formatted
113114
* as "<uri>:<port>". Default 'dataflow.googleapis.com:443'.
114-
* @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials
115-
* The credentials to be used by the client to authorize API calls. This option
116-
* accepts either a path to a credentials file, or a decoded credentials file as a
117-
* PHP array.
118-
* *Advanced usage*: In addition, this option can also accept a pre-constructed
119-
* {@see \Google\Auth\FetchAuthTokenInterface} object or
120-
* {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these
121-
* objects are provided, any settings in $credentialsConfig will be ignored.
122-
* *Important*: If you accept a credential configuration (credential
123-
* JSON/File/Stream) from an external source for authentication to Google Cloud
124-
* Platform, you must validate it before providing it to any Google API or library.
125-
* Providing an unvalidated credential configuration to Google APIs can compromise
126-
* the security of your systems and data. For more information {@see
115+
* @type FetchAuthTokenInterface|CredentialsWrapper $credentials
116+
* This option should only be used with a pre-constructed
117+
* {@see FetchAuthTokenInterface} or {@see CredentialsWrapper} object. Note that
118+
* when one of these objects are provided, any settings in $credentialsConfig will
119+
* be ignored.
120+
* **Important**: If you are providing a path to a credentials file, or a decoded
121+
* credentials file as a PHP array, this usage is now DEPRECATED. Providing an
122+
* unvalidated credential configuration to Google APIs can compromise the security
123+
* of your systems and data. It is recommended to create the credentials explicitly
124+
* ```
125+
* use Google\Auth\Credentials\ServiceAccountCredentials;
126+
* use Google\Cloud\Dataflow\V1beta3\MetricsV1Beta3Client;
127+
* $creds = new ServiceAccountCredentials($scopes, $json);
128+
* $options = new MetricsV1Beta3Client(['credentials' => $creds]);
129+
* ```
130+
* {@see
127131
* https://cloud.google.com/docs/authentication/external/externally-sourced-credentials}
128132
* @type array $credentialsConfig
129133
* Options used to configure credentials, including auth token caching, for the
@@ -161,13 +165,15 @@ private static function getClientDefaults()
161165
* @type false|LoggerInterface $logger
162166
* A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the
163167
* 'GOOGLE_SDK_PHP_LOGGING' environment flag
168+
* @type string $universeDomain
169+
* The service domain for the client. Defaults to 'googleapis.com'.
164170
* }
165171
*
166172
* @throws ValidationException
167173
*
168174
* @experimental
169175
*/
170-
public function __construct(array $options = [])
176+
public function __construct(array|ClientOptions $options = [])
171177
{
172178
$clientOptions = $this->buildClientOptions($options);
173179
$this->setClientOptions($clientOptions);
@@ -210,10 +216,8 @@ public function __call($method, $args)
210216
*
211217
* @experimental
212218
*/
213-
public function getJobExecutionDetails(
214-
GetJobExecutionDetailsRequest $request,
215-
array $callOptions = []
216-
): PagedListResponse {
219+
public function getJobExecutionDetails(GetJobExecutionDetailsRequest $request, array $callOptions = []): PagedListResponse
220+
{
217221
return $this->startApiCall('GetJobExecutionDetails', $request, $callOptions);
218222
}
219223

@@ -278,10 +282,8 @@ public function getJobMetrics(GetJobMetricsRequest $request, array $callOptions
278282
*
279283
* @experimental
280284
*/
281-
public function getStageExecutionDetails(
282-
GetStageExecutionDetailsRequest $request,
283-
array $callOptions = []
284-
): PagedListResponse {
285+
public function getStageExecutionDetails(GetStageExecutionDetailsRequest $request, array $callOptions = []): PagedListResponse
286+
{
285287
return $this->startApiCall('GetStageExecutionDetails', $request, $callOptions);
286288
}
287289
}

0 commit comments

Comments
 (0)