Skip to content

Commit

Permalink
chore: migrate samples to new surface (#6931)
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 595432418
Source-Link: googleapis/googleapis@4795a45
Source-Link: https://github.com/googleapis/googleapis-gen/commit/743615e580bab1815edba43a02c561face631c5f
Copy-Tag: eyJwIjoiRGVidWdnZXIvLk93bEJvdC55YW1sIiwiaCI6Ijc0MzYxNWU1ODBiYWIxODE1ZWRiYTQzYTAyYzU2MWZhY2U2MzFjNWYifQ==
Copy-Tag: eyJwIjoiRGlhbG9nZmxvdy8uT3dsQm90LnlhbWwiLCJoIjoiNzQzNjE1ZTU4MGJhYjE4MTVlZGJhNDNhMDJjNTYxZmFjZTYzMWM1ZiJ9
Copy-Tag: eyJwIjoiRGxwLy5Pd2xCb3QueWFtbCIsImgiOiI3NDM2MTVlNTgwYmFiMTgxNWVkYmE0M2EwMmM1NjFmYWNlNjMxYzVmIn0=
Copy-Tag: eyJwIjoiRG1zLy5Pd2xCb3QueWFtbCIsImgiOiI3NDM2MTVlNTgwYmFiMTgxNWVkYmE0M2EwMmM1NjFmYWNlNjMxYzVmIn0=
Copy-Tag: eyJwIjoiRG9jdW1lbnRBaS8uT3dsQm90LnlhbWwiLCJoIjoiNzQzNjE1ZTU4MGJhYjE4MTVlZGJhNDNhMDJjNTYxZmFjZTYzMWM1ZiJ9
Copy-Tag: eyJwIjoiRXZlbnRhcmMvLk93bEJvdC55YW1sIiwiaCI6Ijc0MzYxNWU1ODBiYWIxODE1ZWRiYTQzYTAyYzU2MWZhY2U2MzFjNWYifQ==
Copy-Tag: eyJwIjoiRmlsZXN0b3JlLy5Pd2xCb3QueWFtbCIsImgiOiI3NDM2MTVlNTgwYmFiMTgxNWVkYmE0M2EwMmM1NjFmYWNlNjMxYzVmIn0=
Copy-Tag: eyJwIjoiRmlyZXN0b3JlLy5Pd2xCb3QueWFtbCIsImgiOiI3NDM2MTVlNTgwYmFiMTgxNWVkYmE0M2EwMmM1NjFmYWNlNjMxYz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V0d29ya0Nvbm5lY3Rpdml0eS8uT3dsQm90LnlhbWwiLCJoIjoiNzQzNjE1ZTU4MGJhYjE4MTVlZGJhNDNhMDJjNTYxZmFjZTYzMWM1ZiJ9
Copy-Tag: eyJwIjoiTmV0d29ya01hbmFnZW1lbnQvLk93bEJvdC55YW1sIiwiaCI6Ijc0MzYxNWU1ODBiYWIxODE1ZWRiYTQzYTAyYzU2MWZhY2U2MzFjNWYifQ==
Copy-Tag: eyJwIjoiT3JjaGVzdHJhdGlvbkFpcmZsb3cvLk93bEJvdC55YW1sIiwiaCI6Ijc0MzYxNWU1ODBiYWIxODE1ZWRiYTQzYTAyYzU2MWZhY2U2MzFjNWYifQ==
  • Loading branch information
gcf-owl-bot[bot] authored Jan 4, 2024
1 parent 8eaba4c commit e06c061
Show file tree
Hide file tree
Showing 18 changed files with 210 additions and 19 deletions.
9 changes: 7 additions & 2 deletions samples/V2/Controller2Client/list_active_breakpoints.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@

// [START clouddebugger_v2_generated_Controller2_ListActiveBreakpoints_sync]
use Google\ApiCore\ApiException;
use Google\Cloud\Debugger\V2\Controller2Client;
use Google\Cloud\Debugger\V2\Client\Controller2Client;
use Google\Cloud\Debugger\V2\ListActiveBreakpointsRequest;
use Google\Cloud\Debugger\V2\ListActiveBreakpointsResponse;

/**
Expand All @@ -49,10 +50,14 @@ function list_active_breakpoints_sample(string $debuggeeId): void
// Create a client.
$controller2Client = new Controller2Client();

// Prepare the request message.
$request = (new ListActiveBreakpointsRequest())
->setDebuggeeId($debuggeeId);

// Call the API and handle any network failures.
try {
/** @var ListActiveBreakpointsResponse $response */
$response = $controller2Client->listActiveBreakpoints($debuggeeId);
$response = $controller2Client->listActiveBreakpoints($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
Expand Down
9 changes: 6 additions & 3 deletions samples/V2/Controller2Client/register_debuggee.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@

// [START clouddebugger_v2_generated_Controller2_RegisterDebuggee_sync]
use Google\ApiCore\ApiException;
use Google\Cloud\Debugger\V2\Controller2Client;
use Google\Cloud\Debugger\V2\Client\Controller2Client;
use Google\Cloud\Debugger\V2\Debuggee;
use Google\Cloud\Debugger\V2\RegisterDebuggeeRequest;
use Google\Cloud\Debugger\V2\RegisterDebuggeeResponse;

/**
Expand All @@ -51,13 +52,15 @@ function register_debuggee_sample(): void
// Create a client.
$controller2Client = new Controller2Client();

// Prepare any non-scalar elements to be passed along with the request.
// Prepare the request message.
$debuggee = new Debuggee();
$request = (new RegisterDebuggeeRequest())
->setDebuggee($debuggee);

// Call the API and handle any network failures.
try {
/** @var RegisterDebuggeeResponse $response */
$response = $controller2Client->registerDebuggee($debuggee);
$response = $controller2Client->registerDebuggee($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
Expand Down
10 changes: 7 additions & 3 deletions samples/V2/Controller2Client/update_active_breakpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
// [START clouddebugger_v2_generated_Controller2_UpdateActiveBreakpoint_sync]
use Google\ApiCore\ApiException;
use Google\Cloud\Debugger\V2\Breakpoint;
use Google\Cloud\Debugger\V2\Controller2Client;
use Google\Cloud\Debugger\V2\Client\Controller2Client;
use Google\Cloud\Debugger\V2\UpdateActiveBreakpointRequest;
use Google\Cloud\Debugger\V2\UpdateActiveBreakpointResponse;

/**
Expand All @@ -45,13 +46,16 @@ function update_active_breakpoint_sample(string $debuggeeId): void
// Create a client.
$controller2Client = new Controller2Client();

// Prepare any non-scalar elements to be passed along with the request.
// Prepare the request message.
$breakpoint = new Breakpoint();
$request = (new UpdateActiveBreakpointRequest())
->setDebuggeeId($debuggeeId)
->setBreakpoint($breakpoint);

// Call the API and handle any network failures.
try {
/** @var UpdateActiveBreakpointResponse $response */
$response = $controller2Client->updateActiveBreakpoint($debuggeeId, $breakpoint);
$response = $controller2Client->updateActiveBreakpoint($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
Expand Down
11 changes: 9 additions & 2 deletions samples/V2/Debugger2Client/delete_breakpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@

// [START clouddebugger_v2_generated_Debugger2_DeleteBreakpoint_sync]
use Google\ApiCore\ApiException;
use Google\Cloud\Debugger\V2\Debugger2Client;
use Google\Cloud\Debugger\V2\Client\Debugger2Client;
use Google\Cloud\Debugger\V2\DeleteBreakpointRequest;

/**
* Deletes the breakpoint from the debuggee.
Expand All @@ -42,9 +43,15 @@ function delete_breakpoint_sample(
// Create a client.
$debugger2Client = new Debugger2Client();

// Prepare the request message.
$request = (new DeleteBreakpointRequest())
->setDebuggeeId($debuggeeId)
->setBreakpointId($breakpointId)
->setClientVersion($clientVersion);

// Call the API and handle any network failures.
try {
$debugger2Client->deleteBreakpoint($debuggeeId, $breakpointId, $clientVersion);
$debugger2Client->deleteBreakpoint($request);
printf('Call completed successfully.' . PHP_EOL);
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
Expand Down
11 changes: 9 additions & 2 deletions samples/V2/Debugger2Client/get_breakpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@

// [START clouddebugger_v2_generated_Debugger2_GetBreakpoint_sync]
use Google\ApiCore\ApiException;
use Google\Cloud\Debugger\V2\Debugger2Client;
use Google\Cloud\Debugger\V2\Client\Debugger2Client;
use Google\Cloud\Debugger\V2\GetBreakpointRequest;
use Google\Cloud\Debugger\V2\GetBreakpointResponse;

/**
Expand All @@ -43,10 +44,16 @@ function get_breakpoint_sample(
// Create a client.
$debugger2Client = new Debugger2Client();

// Prepare the request message.
$request = (new GetBreakpointRequest())
->setDebuggeeId($debuggeeId)
->setBreakpointId($breakpointId)
->setClientVersion($clientVersion);

// Call the API and handle any network failures.
try {
/** @var GetBreakpointResponse $response */
$response = $debugger2Client->getBreakpoint($debuggeeId, $breakpointId, $clientVersion);
$response = $debugger2Client->getBreakpoint($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
Expand Down
10 changes: 8 additions & 2 deletions samples/V2/Debugger2Client/list_breakpoints.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@

// [START clouddebugger_v2_generated_Debugger2_ListBreakpoints_sync]
use Google\ApiCore\ApiException;
use Google\Cloud\Debugger\V2\Debugger2Client;
use Google\Cloud\Debugger\V2\Client\Debugger2Client;
use Google\Cloud\Debugger\V2\ListBreakpointsRequest;
use Google\Cloud\Debugger\V2\ListBreakpointsResponse;

/**
Expand All @@ -39,10 +40,15 @@ function list_breakpoints_sample(string $debuggeeId, string $clientVersion): voi
// Create a client.
$debugger2Client = new Debugger2Client();

// Prepare the request message.
$request = (new ListBreakpointsRequest())
->setDebuggeeId($debuggeeId)
->setClientVersion($clientVersion);

// Call the API and handle any network failures.
try {
/** @var ListBreakpointsResponse $response */
$response = $debugger2Client->listBreakpoints($debuggeeId, $clientVersion);
$response = $debugger2Client->listBreakpoints($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
Expand Down
10 changes: 8 additions & 2 deletions samples/V2/Debugger2Client/list_debuggees.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@

// [START clouddebugger_v2_generated_Debugger2_ListDebuggees_sync]
use Google\ApiCore\ApiException;
use Google\Cloud\Debugger\V2\Debugger2Client;
use Google\Cloud\Debugger\V2\Client\Debugger2Client;
use Google\Cloud\Debugger\V2\ListDebuggeesRequest;
use Google\Cloud\Debugger\V2\ListDebuggeesResponse;

/**
Expand All @@ -39,10 +40,15 @@ function list_debuggees_sample(string $project, string $clientVersion): void
// Create a client.
$debugger2Client = new Debugger2Client();

// Prepare the request message.
$request = (new ListDebuggeesRequest())
->setProject($project)
->setClientVersion($clientVersion);

// Call the API and handle any network failures.
try {
/** @var ListDebuggeesResponse $response */
$response = $debugger2Client->listDebuggees($project, $clientVersion);
$response = $debugger2Client->listDebuggees($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
Expand Down
11 changes: 8 additions & 3 deletions samples/V2/Debugger2Client/set_breakpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
// [START clouddebugger_v2_generated_Debugger2_SetBreakpoint_sync]
use Google\ApiCore\ApiException;
use Google\Cloud\Debugger\V2\Breakpoint;
use Google\Cloud\Debugger\V2\Debugger2Client;
use Google\Cloud\Debugger\V2\Client\Debugger2Client;
use Google\Cloud\Debugger\V2\SetBreakpointRequest;
use Google\Cloud\Debugger\V2\SetBreakpointResponse;

/**
Expand All @@ -40,13 +41,17 @@ function set_breakpoint_sample(string $debuggeeId, string $clientVersion): void
// Create a client.
$debugger2Client = new Debugger2Client();

// Prepare any non-scalar elements to be passed along with the request.
// Prepare the request message.
$breakpoint = new Breakpoint();
$request = (new SetBreakpointRequest())
->setDebuggeeId($debuggeeId)
->setBreakpoint($breakpoint)
->setClientVersion($clientVersion);

// Call the API and handle any network failures.
try {
/** @var SetBreakpointResponse $response */
$response = $debugger2Client->setBreakpoint($debuggeeId, $breakpoint, $clientVersion);
$response = $debugger2Client->setBreakpoint($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
Expand Down
6 changes: 6 additions & 0 deletions src/V2/Client/Controller2Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ public function __call($method, $args)
*
* The async variant is {@see Controller2Client::listActiveBreakpointsAsync()} .
*
* @example samples/V2/Controller2Client/list_active_breakpoints.php
*
* @param ListActiveBreakpointsRequest $request A request to house fields associated with the call.
* @param array $callOptions {
* Optional.
Expand Down Expand Up @@ -237,6 +239,8 @@ public function listActiveBreakpoints(ListActiveBreakpointsRequest $request, arr
*
* The async variant is {@see Controller2Client::registerDebuggeeAsync()} .
*
* @example samples/V2/Controller2Client/register_debuggee.php
*
* @param RegisterDebuggeeRequest $request A request to house fields associated with the call.
* @param array $callOptions {
* Optional.
Expand Down Expand Up @@ -268,6 +272,8 @@ public function registerDebuggee(RegisterDebuggeeRequest $request, array $callOp
*
* The async variant is {@see Controller2Client::updateActiveBreakpointAsync()} .
*
* @example samples/V2/Controller2Client/update_active_breakpoint.php
*
* @param UpdateActiveBreakpointRequest $request A request to house fields associated with the call.
* @param array $callOptions {
* Optional.
Expand Down
10 changes: 10 additions & 0 deletions src/V2/Client/Debugger2Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ public function __call($method, $args)
*
* The async variant is {@see Debugger2Client::deleteBreakpointAsync()} .
*
* @example samples/V2/Debugger2Client/delete_breakpoint.php
*
* @param DeleteBreakpointRequest $request A request to house fields associated with the call.
* @param array $callOptions {
* Optional.
Expand All @@ -211,6 +213,8 @@ public function deleteBreakpoint(DeleteBreakpointRequest $request, array $callOp
*
* The async variant is {@see Debugger2Client::getBreakpointAsync()} .
*
* @example samples/V2/Debugger2Client/get_breakpoint.php
*
* @param GetBreakpointRequest $request A request to house fields associated with the call.
* @param array $callOptions {
* Optional.
Expand All @@ -235,6 +239,8 @@ public function getBreakpoint(GetBreakpointRequest $request, array $callOptions
*
* The async variant is {@see Debugger2Client::listBreakpointsAsync()} .
*
* @example samples/V2/Debugger2Client/list_breakpoints.php
*
* @param ListBreakpointsRequest $request A request to house fields associated with the call.
* @param array $callOptions {
* Optional.
Expand All @@ -259,6 +265,8 @@ public function listBreakpoints(ListBreakpointsRequest $request, array $callOpti
*
* The async variant is {@see Debugger2Client::listDebuggeesAsync()} .
*
* @example samples/V2/Debugger2Client/list_debuggees.php
*
* @param ListDebuggeesRequest $request A request to house fields associated with the call.
* @param array $callOptions {
* Optional.
Expand All @@ -283,6 +291,8 @@ public function listDebuggees(ListDebuggeesRequest $request, array $callOptions
*
* The async variant is {@see Debugger2Client::setBreakpointAsync()} .
*
* @example samples/V2/Debugger2Client/set_breakpoint.php
*
* @param SetBreakpointRequest $request A request to house fields associated with the call.
* @param array $callOptions {
* Optional.
Expand Down
18 changes: 18 additions & 0 deletions src/V2/DeleteBreakpointRequest.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions src/V2/GetBreakpointRequest.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions src/V2/ListActiveBreakpointsRequest.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions src/V2/ListBreakpointsRequest.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit e06c061

Please sign in to comment.