Skip to content

Commit 5aa94b8

Browse files
feat: add new client surface to preview clients (#6202)
chore: update the gapic generator to 1.7.4 PiperOrigin-RevId: 530731364 Source-Link: googleapis/googleapis@cbddac7 Source-Link: googleapis/googleapis-gen@539cbcf Copy-Tag: eyJwIjoiQXBpS2V5cy8uT3dsQm90LnlhbWwiLCJoIjoiNTM5Y2JjZjRiNDFlODg2ZDUyYTNlMmQ4MmFiOWZkYzQ0NmJhMGUwNCJ9 Copy-Tag: eyJwIjoiQXBpZ2VlUmVnaXN0cnkvLk93bEJvdC55YW1sIiwiaCI6IjUzOWNiY2Y0YjQxZTg4NmQ1MmEzZTJkODJhYjlmZGM0NDZiYTBlMDQifQ== Copy-Tag: eyJwIjoiQmFyZU1ldGFsU29sdXRpb24vLk93bEJvdC55YW1sIiwiaCI6IjUzOWNiY2Y0YjQxZTg4NmQ1MmEzZTJkODJhYjlmZGM0NDZiYTBlMDQifQ== Copy-Tag: eyJwIjoiQmF0Y2gvLk93bEJvdC55YW1sIiwiaCI6IjUzOWNiY2Y0YjQxZTg4NmQ1MmEzZTJkODJhYjlmZGM0NDZiYTBlMDQifQ== Copy-Tag: eyJwIjoiQmV5b25kQ29ycEFwcENvbm5lY3Rpb25zLy5Pd2xCb3QueWFtbCIsImgiOiI1MzljYmNmNGI0MWU4ODZkNTJhM2UyZDgyYWI5ZmRjNDQ2YmEwZTA0In0= Copy-Tag: eyJwIjoiQmV5b25kQ29ycEFwcENvbm5lY3RvcnMvLk93bEJvdC55YW1sIiwiaCI6IjUzOWNiY2Y0YjQxZTg4NmQ1MmEzZTJkODJhYjlmZGM0NDZiYTBlMDQifQ== Copy-Tag: eyJwIjoiQmV5b25kQ29ycEFwcEdhdGV3YXlzLy5Pd2xCb3QueWFtbCIsImgiOiI1MzljYmNmNGI0MWU4ODZkNTJhM2UyZDgyYWI5ZmRjNDQ2YmEwZTA0In0= Copy-Tag: eyJwIjoiQmV5b25kQ29ycENsaWVudENvbm5lY3RvclNlcnZpY2VzLy5Pd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JhM2UyZDgyYWI5ZmRjNDQ2YmEwZTA0In0= Copy-Tag: eyJwIjoiRGF0YUNhdGFsb2dMaW5lYWdlLy5Pd2xCb3QueWFtbCIsImgiOiI1MzljYmNmNGI0MWU4ODZkNTJhM2UyZDgyYWI5ZmRjNDQ2YmEwZTA0In0= Copy-Tag: eyJwIjoiRGF0YUZ1c2lvbi8uT3dsQm90LnlhbWwiLCJoIjoiNTM5Y2JjZjRiNDFlODg2ZDUyYTNlMmQ4MmFiOWZkYzQ0NmJhMGUwNCJ9 Copy-Tag: eyJwIjoiRGF0YUxhYmVsaW5nLy5Pd2xCb3QueWFtbCIsImgiOiI1MzljYmNmNGI0MWU4ODZkNTJhM2UyZDgyYWI5ZmRjNDQ2YmEwZTA0In0= Copy-Tag: eyJwIjoiRGF0YWZsb3cvLk93bEJvdC55YW1sIiwiaCI6IjUzOWNiY2Y0YjQxZTg4NmQ1MmEzZTJkODJhYjlmZGM0NDZiYTBlMDQifQ==
1 parent a301ea0 commit 5aa94b8

633 files changed

Lines changed: 54719 additions & 841 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.

ApiKeys/samples/V2/ApiKeysClient/create_key.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
// [START apikeys_v2_generated_ApiKeys_CreateKey_sync]
2626
use Google\ApiCore\ApiException;
2727
use Google\ApiCore\OperationResponse;
28-
use Google\Cloud\ApiKeys\V2\ApiKeysClient;
28+
use Google\Cloud\ApiKeys\V2\Client\ApiKeysClient;
29+
use Google\Cloud\ApiKeys\V2\CreateKeyRequest;
2930
use Google\Cloud\ApiKeys\V2\Key;
3031
use Google\Rpc\Status;
3132

@@ -43,13 +44,16 @@ function create_key_sample(string $formattedParent): void
4344
// Create a client.
4445
$apiKeysClient = new ApiKeysClient();
4546

46-
// Prepare any non-scalar elements to be passed along with the request.
47+
// Prepare the request message.
4748
$key = new Key();
49+
$request = (new CreateKeyRequest())
50+
->setParent($formattedParent)
51+
->setKey($key);
4852

4953
// Call the API and handle any network failures.
5054
try {
5155
/** @var OperationResponse $response */
52-
$response = $apiKeysClient->createKey($formattedParent, $key);
56+
$response = $apiKeysClient->createKey($request);
5357
$response->pollUntilComplete();
5458

5559
if ($response->operationSucceeded()) {

ApiKeys/samples/V2/ApiKeysClient/delete_key.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
// [START apikeys_v2_generated_ApiKeys_DeleteKey_sync]
2626
use Google\ApiCore\ApiException;
2727
use Google\ApiCore\OperationResponse;
28-
use Google\Cloud\ApiKeys\V2\ApiKeysClient;
28+
use Google\Cloud\ApiKeys\V2\Client\ApiKeysClient;
29+
use Google\Cloud\ApiKeys\V2\DeleteKeyRequest;
2930
use Google\Cloud\ApiKeys\V2\Key;
3031
use Google\Rpc\Status;
3132

@@ -44,10 +45,14 @@ function delete_key_sample(string $formattedName): void
4445
// Create a client.
4546
$apiKeysClient = new ApiKeysClient();
4647

48+
// Prepare the request message.
49+
$request = (new DeleteKeyRequest())
50+
->setName($formattedName);
51+
4752
// Call the API and handle any network failures.
4853
try {
4954
/** @var OperationResponse $response */
50-
$response = $apiKeysClient->deleteKey($formattedName);
55+
$response = $apiKeysClient->deleteKey($request);
5156
$response->pollUntilComplete();
5257

5358
if ($response->operationSucceeded()) {

ApiKeys/samples/V2/ApiKeysClient/get_key.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424

2525
// [START apikeys_v2_generated_ApiKeys_GetKey_sync]
2626
use Google\ApiCore\ApiException;
27-
use Google\Cloud\ApiKeys\V2\ApiKeysClient;
27+
use Google\Cloud\ApiKeys\V2\Client\ApiKeysClient;
28+
use Google\Cloud\ApiKeys\V2\GetKeyRequest;
2829
use Google\Cloud\ApiKeys\V2\Key;
2930

3031
/**
@@ -42,10 +43,14 @@ function get_key_sample(string $formattedName): void
4243
// Create a client.
4344
$apiKeysClient = new ApiKeysClient();
4445

46+
// Prepare the request message.
47+
$request = (new GetKeyRequest())
48+
->setName($formattedName);
49+
4550
// Call the API and handle any network failures.
4651
try {
4752
/** @var Key $response */
48-
$response = $apiKeysClient->getKey($formattedName);
53+
$response = $apiKeysClient->getKey($request);
4954
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
5055
} catch (ApiException $ex) {
5156
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());

ApiKeys/samples/V2/ApiKeysClient/get_key_string.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424

2525
// [START apikeys_v2_generated_ApiKeys_GetKeyString_sync]
2626
use Google\ApiCore\ApiException;
27-
use Google\Cloud\ApiKeys\V2\ApiKeysClient;
27+
use Google\Cloud\ApiKeys\V2\Client\ApiKeysClient;
28+
use Google\Cloud\ApiKeys\V2\GetKeyStringRequest;
2829
use Google\Cloud\ApiKeys\V2\GetKeyStringResponse;
2930

3031
/**
@@ -41,10 +42,14 @@ function get_key_string_sample(string $formattedName): void
4142
// Create a client.
4243
$apiKeysClient = new ApiKeysClient();
4344

45+
// Prepare the request message.
46+
$request = (new GetKeyStringRequest())
47+
->setName($formattedName);
48+
4449
// Call the API and handle any network failures.
4550
try {
4651
/** @var GetKeyStringResponse $response */
47-
$response = $apiKeysClient->getKeyString($formattedName);
52+
$response = $apiKeysClient->getKeyString($request);
4853
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
4954
} catch (ApiException $ex) {
5055
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());

ApiKeys/samples/V2/ApiKeysClient/list_keys.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@
2525
// [START apikeys_v2_generated_ApiKeys_ListKeys_sync]
2626
use Google\ApiCore\ApiException;
2727
use Google\ApiCore\PagedListResponse;
28-
use Google\Cloud\ApiKeys\V2\ApiKeysClient;
28+
use Google\Cloud\ApiKeys\V2\Client\ApiKeysClient;
2929
use Google\Cloud\ApiKeys\V2\Key;
30+
use Google\Cloud\ApiKeys\V2\ListKeysRequest;
3031

3132
/**
3233
* Lists the API keys owned by a project. The key string of the API key
@@ -43,10 +44,14 @@ function list_keys_sample(string $formattedParent): void
4344
// Create a client.
4445
$apiKeysClient = new ApiKeysClient();
4546

47+
// Prepare the request message.
48+
$request = (new ListKeysRequest())
49+
->setParent($formattedParent);
50+
4651
// Call the API and handle any network failures.
4752
try {
4853
/** @var PagedListResponse $response */
49-
$response = $apiKeysClient->listKeys($formattedParent);
54+
$response = $apiKeysClient->listKeys($request);
5055

5156
/** @var Key $element */
5257
foreach ($response as $element) {

ApiKeys/samples/V2/ApiKeysClient/lookup_key.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424

2525
// [START apikeys_v2_generated_ApiKeys_LookupKey_sync]
2626
use Google\ApiCore\ApiException;
27-
use Google\Cloud\ApiKeys\V2\ApiKeysClient;
27+
use Google\Cloud\ApiKeys\V2\Client\ApiKeysClient;
28+
use Google\Cloud\ApiKeys\V2\LookupKeyRequest;
2829
use Google\Cloud\ApiKeys\V2\LookupKeyResponse;
2930

3031
/**
@@ -41,10 +42,14 @@ function lookup_key_sample(string $keyString): void
4142
// Create a client.
4243
$apiKeysClient = new ApiKeysClient();
4344

45+
// Prepare the request message.
46+
$request = (new LookupKeyRequest())
47+
->setKeyString($keyString);
48+
4449
// Call the API and handle any network failures.
4550
try {
4651
/** @var LookupKeyResponse $response */
47-
$response = $apiKeysClient->lookupKey($keyString);
52+
$response = $apiKeysClient->lookupKey($request);
4853
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
4954
} catch (ApiException $ex) {
5055
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());

ApiKeys/samples/V2/ApiKeysClient/undelete_key.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@
2525
// [START apikeys_v2_generated_ApiKeys_UndeleteKey_sync]
2626
use Google\ApiCore\ApiException;
2727
use Google\ApiCore\OperationResponse;
28-
use Google\Cloud\ApiKeys\V2\ApiKeysClient;
28+
use Google\Cloud\ApiKeys\V2\Client\ApiKeysClient;
2929
use Google\Cloud\ApiKeys\V2\Key;
30+
use Google\Cloud\ApiKeys\V2\UndeleteKeyRequest;
3031
use Google\Rpc\Status;
3132

3233
/**
@@ -43,10 +44,14 @@ function undelete_key_sample(string $formattedName): void
4344
// Create a client.
4445
$apiKeysClient = new ApiKeysClient();
4546

47+
// Prepare the request message.
48+
$request = (new UndeleteKeyRequest())
49+
->setName($formattedName);
50+
4651
// Call the API and handle any network failures.
4752
try {
4853
/** @var OperationResponse $response */
49-
$response = $apiKeysClient->undeleteKey($formattedName);
54+
$response = $apiKeysClient->undeleteKey($request);
5055
$response->pollUntilComplete();
5156

5257
if ($response->operationSucceeded()) {

ApiKeys/samples/V2/ApiKeysClient/update_key.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@
2525
// [START apikeys_v2_generated_ApiKeys_UpdateKey_sync]
2626
use Google\ApiCore\ApiException;
2727
use Google\ApiCore\OperationResponse;
28-
use Google\Cloud\ApiKeys\V2\ApiKeysClient;
28+
use Google\Cloud\ApiKeys\V2\Client\ApiKeysClient;
2929
use Google\Cloud\ApiKeys\V2\Key;
30+
use Google\Cloud\ApiKeys\V2\UpdateKeyRequest;
3031
use Google\Rpc\Status;
3132

3233
/**
@@ -47,13 +48,15 @@ function update_key_sample(): void
4748
// Create a client.
4849
$apiKeysClient = new ApiKeysClient();
4950

50-
// Prepare any non-scalar elements to be passed along with the request.
51+
// Prepare the request message.
5152
$key = new Key();
53+
$request = (new UpdateKeyRequest())
54+
->setKey($key);
5255

5356
// Call the API and handle any network failures.
5457
try {
5558
/** @var OperationResponse $response */
56-
$response = $apiKeysClient->updateKey($key);
59+
$response = $apiKeysClient->updateKey($request);
5760
$response->pollUntilComplete();
5861

5962
if ($response->operationSucceeded()) {
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
/*
3+
* Copyright 2023 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* https://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
/*
19+
* GENERATED CODE WARNING
20+
* Generated by gapic-generator-php from the file
21+
* https://github.com/googleapis/googleapis/blob/master/google/api/apikeys/v2/apikeys.proto
22+
* Updates to the above are reflected here through a refresh process.
23+
*/
24+
25+
namespace Google\Cloud\ApiKeys\V2\Client;
26+
27+
use Google\Cloud\ApiKeys\V2\Client\BaseClient\ApiKeysBaseClient;
28+
29+
/**
30+
* {@inheritdoc}
31+
*
32+
* This class is currently experimental and may be subject to changes.
33+
*
34+
* @experimental
35+
*/
36+
final class ApiKeysClient extends ApiKeysBaseClient
37+
{
38+
// This class is intentionally empty, and is intended to hold manual additions to
39+
// the generated {@see ApiKeysBaseClient} class.
40+
}

0 commit comments

Comments
 (0)