From 87a97abd5e3e8ff0509c10795f1f6b05d5f33278 Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Wed, 29 Apr 2026 15:33:12 -0700 Subject: [PATCH 1/5] feat: add interfaces for service clients --- src/Ast/AST.php | 17 ++++- src/Ast/PhpFile.php | 6 +- src/Ast/PhpInterface.php | 89 +++++++++++++++++++++++ src/Ast/PhpMethod.php | 14 +++- src/CodeGenerator.php | 10 ++- src/Generation/GapicClientV2Generator.php | 65 ++++++++++++++++- tests/Unit/ProtoTests/ProtoTest.php | 2 + 7 files changed, 187 insertions(+), 16 deletions(-) create mode 100644 src/Ast/PhpInterface.php diff --git a/src/Ast/AST.php b/src/Ast/AST.php index 885fff243..bf629e2a5 100644 --- a/src/Ast/AST.php +++ b/src/Ast/AST.php @@ -154,11 +154,11 @@ protected function clone(callable $fnOnClone) /** * Create a PHP file. * - * @param ?PhpClass $class The class to be contained within this file. + * @param PhpClass|PhpInterface|null $class The class to be contained within this file. * * @return PhpFile */ - public static function file(?PhpClass $class): PhpFile + public static function file(PhpClass|PhpInterface|null $class): PhpFile { return new PhpFile($class); } @@ -182,6 +182,19 @@ public static function class( return new PhpClass($type, $extends, $final, $abstract); } + /** + * Create an interface. + * + * @param Type $type The type of the class to create. + * @param ?ResolvedType $extends + * + * @return PhpInterface + */ + public static function interface(Type $type, ?ResolvedType $extends = null): PhpInterface + { + return new PhpInterface($type, $extends); + } + /** * Create a class constant. * diff --git a/src/Ast/PhpFile.php b/src/Ast/PhpFile.php index 29c00d3be..e8cdbe06a 100644 --- a/src/Ast/PhpFile.php +++ b/src/Ast/PhpFile.php @@ -23,14 +23,14 @@ final class PhpFile extends AST { - public function __construct(?PhpClass $class) + public function __construct(PhpClass|PhpInterface|null $classOrInterface) { - $this->class = $class; + $this->class = $classOrInterface; $this->uses = Set::new(); $this->headerLines = Vector::new(); } - public ?PhpClass $class; + public PhpClass|PhpInterface|null $class; private ?AST $block; private Set $uses; private Vector $headerLines; diff --git a/src/Ast/PhpInterface.php b/src/Ast/PhpInterface.php new file mode 100644 index 000000000..32b0e97c1 --- /dev/null +++ b/src/Ast/PhpInterface.php @@ -0,0 +1,89 @@ +members = Vector::new(); + } + + /** @var Vector *Readonly* Vector of PhpClassMember; all members of this class. */ + public Vector $members; + + /** + * Create a class with an additional member. + * + * @param ?PhpClassMember $member The member to add. Ignored if null. + * + * @return PhpInterface + */ + public function withMember(?PhpClassMember $member): PhpInterface + { + return is_null($member) ? $this : + $this->clone(fn ($clone) => $clone->members = $clone->members->append($member)); + } + + /** + * Create a class with additional members. + * + * @param Vector $members Vector of PhpClassMember; the members to add. + * + * @return PhpInterface + */ + public function withMembers(Vector $members): PhpInterface + { + $members = $members->filter(fn ($x) => !is_null($x)); + + return count($members) === 0 ? $this : + $this->clone(fn ($clone) => $clone->members = $clone->members->concat($members)); + } + + /** + * Generates PHP code of the class. + * + * @throws RuntimeException When $abstract and $final both are set. + */ + public function toCode(): string + { + $extends = is_null($this->extends) ? '' : " extends {$this->extends->toCode()}"; + + return + $this->phpDocToCode() . + "interface {$this->type->name}{$extends}\n" . + "{\n" . + $this->members->map(fn ($x) => $x->toCode() . "\n")->join() . + "}\n"; + } +} diff --git a/src/Ast/PhpMethod.php b/src/Ast/PhpMethod.php index c358ee8ef..517a718c9 100644 --- a/src/Ast/PhpMethod.php +++ b/src/Ast/PhpMethod.php @@ -34,6 +34,7 @@ public function __construct(string $name) public string $name; private Vector $params; protected mixed $body; + private bool $forInterface = false; /** @var string The return type of the function. */ private ?ResolvedType $returnType = null; @@ -75,6 +76,11 @@ public function withReturnType(ResolvedType $returnType): PhpMethod return $this->clone(fn ($clone) => $clone->returnType = $returnType); } + public function forInterface(): PhpMethod + { + return $this->clone(fn ($clone) => $clone->forInterface = true); + } + public function getName(): string { return $this->name; @@ -90,8 +96,10 @@ public function toCode(): string $this->phpDocToCode() . $this->accessToCode() . $fnSignatureDeclaration . - '{' . PHP_EOL . - static::toPhp($this->body) . - PHP_EOL . '}' . PHP_EOL; + ($this->forInterface ? ';' : + '{' . PHP_EOL . + static::toPhp($this->body) . + PHP_EOL . '}' . PHP_EOL + ); } } diff --git a/src/CodeGenerator.php b/src/CodeGenerator.php index 39966392d..e0d7292c0 100644 --- a/src/CodeGenerator.php +++ b/src/CodeGenerator.php @@ -357,10 +357,12 @@ private static function generateServices( // [Start V2 GAPIC surface generation] if ($migrationMode != MigrationMode::PRE_MIGRATION_SURFACE_ONLY) { $ctx = new SourceFileContext($service->gapicClientType->getNamespace(), $licenseYear); - $file = GapicClientV2Generator::generate($ctx, $service, $generateSnippets); - $code = $file->toCode(); - $code = Formatter::format($code); - yield ["src/{$version}Client/{$service->gapicClientV2Type->name}.php", $code]; + [$classFile, $interfaceFile] = GapicClientV2Generator::generate($ctx, $service, $generateSnippets); + foreach ([$classFile, $interfaceFile] as $file) { + $code = $file->toCode(); + $code = Formatter::format($code); + yield ["src/{$version}Client/{$file->class->type->name}.php", $code]; + } // Unit tests. $ctx = new SourceFileContext($service->unitTestsV2Type->getNamespace(), $licenseYear); diff --git a/src/Generation/GapicClientV2Generator.php b/src/Generation/GapicClientV2Generator.php index 1a478dfe0..35c9973c2 100644 --- a/src/Generation/GapicClientV2Generator.php +++ b/src/Generation/GapicClientV2Generator.php @@ -35,6 +35,8 @@ use Google\Generator\Ast\PhpClassMember; use Google\Generator\Ast\PhpDoc; use Google\Generator\Ast\PhpFile; +use Google\Generator\Ast\PhpInterface; +use Google\Generator\Ast\PhpMethod; use Google\Generator\Collections\Map; use Google\Generator\Collections\Vector; use Google\Generator\Utils\Helpers; @@ -50,7 +52,10 @@ class GapicClientV2Generator { private const CALL_OPTIONS_VAR = 'callOptions'; - public static function generate(SourceFileContext $ctx, ServiceDetails $serviceDetails, bool $generateSnippets): PhpFile + /** + * @return array + */ + public static function generate(SourceFileContext $ctx, ServiceDetails $serviceDetails, bool $generateSnippets): array { return (new GapicClientV2Generator($ctx, $serviceDetails, $generateSnippets))->generateImpl(); } @@ -67,7 +72,10 @@ private function __construct(SourceFileContext $ctx, ServiceDetails $serviceDeta $this->generateSnippets = $generateSnippets; } - private function generateImpl(): PhpFile + /** + * @return array + */ + private function generateImpl(): array { // TODO(vNext): Remove the forced addition of these `use` clauses. $this->ctx->type(Type::fromName(\Google\ApiCore\PathTemplate::class)); @@ -92,15 +100,27 @@ private function generateImpl(): PhpFile } } // Generate file content - $file = AST::file($this->generateClass()) + $classFile = AST::file($class = $this->generateClass()) ->withApacheLicense($this->ctx->licenseYear) // TODO(vNext): Consider if this header is sensible, as it ties this generator to Google cloud. ->withGeneratedFromProtoCodeWarning( $this->serviceDetails->filePath, $this->serviceDetails->isGa() ); + // Generate service interface + $interfaceFile = AST::file($this->generateInterface($class)) + ->withApacheLicense($this->ctx->licenseYear) + // TODO(vNext): Consider if this header is sensible, as it ties this generator to Google cloud. + ->withGeneratedFromProtoCodeWarning( + $this->serviceDetails->filePath, + $this->serviceDetails->isGa() + ); + // Finalize as required by the source-context; e.g. add top-level 'use' statements. - return $this->ctx->finalize($file); + return [ + $this->ctx->finalize($classFile), + $this->ctx->finalize($interfaceFile), + ]; } private function generateClass(): PhpClass @@ -161,6 +181,43 @@ private function generateClass(): PhpClass ->withMember(EmulatorSupportGenerator::generateEmulatorSupport($this->serviceDetails, $this->ctx)); } + private function generateInterface(PhpClass $class): PhpInterface + { + return AST::interface(Type::fromName($this->serviceDetails->gapicClientV2Type->getFullname() . 'Interface')) + ->withPhpDoc(PhpDoc::block( + PhpDoc::preFormattedText( + $this->serviceDetails->docLines->skip(1) + ->prepend( + 'Service Description: ' . ($this->serviceDetails->docLines->firstOrNull() ?? '') + ) + ), + !is_null($this->serviceDetails->apiVersion) + ? PhpDoc::text( + 'This client uses ' . $this->serviceDetails->shortName . ' version ' . $this->serviceDetails->apiVersion . '.' + ) + : null, + PhpDoc::preFormattedText( + Vector::new([ + 'This interface defines the methods available for calling the backing service API', + ]) + ), + $this->serviceDetails->isGa() ? null : PhpDoc::experimental(), + !$this->serviceDetails->isDeprecated ? null : PhpDoc::deprecated(ServiceDetails::DEPRECATED_MSG), + $this->serviceDetails->streamingOnly ? null : $this->magicAsyncDocs(), + )) + ->withMembers( + $class->members + // omit constants and properties from the interface + ->filter(fn ($x) => $x instanceof PhpMethod) + // omit private, protected, and static methods + ->filter(fn ($x) => $x->access->join() === Access::PUBLIC) + // omit "__call" and "__construct" + ->filter(fn ($x) => 0 !== strpos($x->name, '__')) + // ensure the members are rendered without their method body + ->map(fn ($x) => $x->forInterface()) + ); + } + private function serviceName(): PhpClassMember { return AST::constant('SERVICE_NAME') diff --git a/tests/Unit/ProtoTests/ProtoTest.php b/tests/Unit/ProtoTests/ProtoTest.php index 9d1d89777..73cde3426 100644 --- a/tests/Unit/ProtoTests/ProtoTest.php +++ b/tests/Unit/ProtoTests/ProtoTest.php @@ -54,6 +54,8 @@ private function runProtoTest( $filename = __DIR__ . '/' . dirname($protoPath) . '/out/' . $relativeFilename; // Check "expected-code" file exists, then compare generated code against expected code. // TODO: Add ability to check partial files. + @mkdir(dirname(__DIR__ . '/codegen/' . $relativeFilename), recursive: true); + file_put_contents(__DIR__ . '/codegen/' . $relativeFilename, $code); $this->assertTrue(file_exists($filename), "Expected code file missing: '{$filename}'"); $expectedCode = file_get_contents($filename); if (trim($expectedCode) !== 'IGNORE' && trim($expectedCode) !== ' Date: Wed, 29 Apr 2026 15:34:14 -0700 Subject: [PATCH 2/5] fix phpdoc --- src/Ast/PhpInterface.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Ast/PhpInterface.php b/src/Ast/PhpInterface.php index 32b0e97c1..07c6155ec 100644 --- a/src/Ast/PhpInterface.php +++ b/src/Ast/PhpInterface.php @@ -23,7 +23,7 @@ use Google\Generator\Utils\Type; use RuntimeException; -/** A class definition. */ +/** An interface definition. */ final class PhpInterface extends AST { use HasPhpDoc; From 0e25cf2a19b00c573def0566ad2f4d9bdcb388c3 Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Thu, 30 Apr 2026 11:02:36 -0700 Subject: [PATCH 3/5] implement interface in classes, update tests --- composer.json | 2 +- src/Ast/PhpClass.php | 28 +- src/Ast/PhpMethod.php | 9 +- src/Generation/GapicClientV2Generator.php | 20 +- src/Generation/ServiceDetails.php | 4 + src/Utils/Type.php | 2 +- .../Basic/out/src/Client/BasicClient.php | 2 +- .../out/src/Client/BasicClientInterface.php | 90 +++++ .../Client/BasicExplicitPaginatedClient.php | 2 +- .../BasicExplicitPaginatedClientInterface.php | 64 ++++ .../out/src/Client/BasicGrpcOnlyClient.php | 2 +- .../Client/BasicGrpcOnlyClientInterface.php | 35 ++ .../out/src/Client/BasicOneofNewClient.php | 2 +- .../Client/BasicOneofNewClientInterface.php | 65 ++++ .../src/Client/BasicServerStreamingClient.php | 2 +- .../BasicServerStreamingClientInterface.php | 74 +++++ tests/Unit/ProtoTests/ClientTest.php | 2 +- .../out/src/Client/CustomLroClient.php | 2 +- .../src/Client/CustomLroClientInterface.php | 83 +++++ .../src/Client/CustomLroOperationsClient.php | 2 +- .../CustomLroOperationsClientInterface.php | 105 ++++++ .../HeuristicPaginationClientClient.php | 2 +- ...uristicPaginationClientClientInterface.php | 145 ++++++++ tests/Unit/ProtoTests/ProtoTest.php | 2 - .../out/src/Client/ResourceNamesClient.php | 2 +- .../Client/ResourceNamesClientInterface.php | 232 +++++++++++++ .../out/src/Client/RoutingHeadersClient.php | 2 +- .../Client/RoutingHeadersClientInterface.php | 310 ++++++++++++++++++ .../codegen/samples/BasicClient/a_method.php | 57 ++++ .../samples/BasicClient/method_with_args.php | 76 +++++ .../codegen/src/Client/BasicClient.php | 261 +++++++++++++++ 31 files changed, 1654 insertions(+), 32 deletions(-) create mode 100644 tests/Unit/ProtoTests/Basic/out/src/Client/BasicClientInterface.php create mode 100644 tests/Unit/ProtoTests/BasicExplicitPaginated/out/src/Client/BasicExplicitPaginatedClientInterface.php create mode 100644 tests/Unit/ProtoTests/BasicGrpcOnly/out/src/Client/BasicGrpcOnlyClientInterface.php create mode 100644 tests/Unit/ProtoTests/BasicOneofNew/out/src/Client/BasicOneofNewClientInterface.php create mode 100644 tests/Unit/ProtoTests/BasicServerStreaming/out/src/Client/BasicServerStreamingClientInterface.php create mode 100644 tests/Unit/ProtoTests/CustomLroNew/out/src/Client/CustomLroClientInterface.php create mode 100644 tests/Unit/ProtoTests/CustomLroNew/out/src/Client/CustomLroOperationsClientInterface.php create mode 100644 tests/Unit/ProtoTests/DiregapicPaginated/out/src/Client/HeuristicPaginationClientClientInterface.php create mode 100644 tests/Unit/ProtoTests/ResourceNames/out/src/Client/ResourceNamesClientInterface.php create mode 100644 tests/Unit/ProtoTests/RoutingHeaders/out/src/Client/RoutingHeadersClientInterface.php create mode 100644 tests/Unit/ProtoTests/codegen/samples/BasicClient/a_method.php create mode 100644 tests/Unit/ProtoTests/codegen/samples/BasicClient/method_with_args.php create mode 100644 tests/Unit/ProtoTests/codegen/src/Client/BasicClient.php diff --git a/composer.json b/composer.json index d9e0ca646..5842fbd17 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ "Testing\\BasicBidiStreaming\\": "tests/Unit/ProtoTests/BasicBidiStreaming/out/src", "Testing\\BasicClientStreaming\\": "tests/Unit/ProtoTests/BasicClientStreaming/out/src", "Testing\\BasicDiregapic\\": "tests/Unit/ProtoTests/BasicDiregapic/out/src", - "Testing\\BasicGrpcOnly\\": "tests/Unit/ProtoTests/BasicGrpcOnly/out/src", + "Testing\\Basicgrpconly\\": "tests/Unit/ProtoTests/BasicGrpcOnly/out/src", "Testing\\BasicLro\\": "tests/Unit/ProtoTests/BasicLro/out/src", "Testing\\BasicOneof\\": "tests/Unit/ProtoTests/BasicOneof/out/src", "Testing\\BasicOneofNew\\": "tests/Unit/ProtoTests/BasicOneofNew/out/src", diff --git a/src/Ast/PhpClass.php b/src/Ast/PhpClass.php index 1b6b8b8a0..c0de1f5b4 100644 --- a/src/Ast/PhpClass.php +++ b/src/Ast/PhpClass.php @@ -43,12 +43,16 @@ public function __construct( public bool $abstract ) { $this->traits = Set::new(); + $this->interfaces = Set::new(); $this->members = Vector::new(); } /** @var Set *Readonly* Set of ResolvedType; the traits used by this class. */ public Set $traits; + /** @var Set *Readonly* Set of ResolvedType; the interfaces implemented by this class. */ + public Set $interfaces; + /** @var Vector *Readonly* Vector of PhpClassMember; all members of this class. */ public Vector $members; @@ -70,6 +74,24 @@ public function withTrait(?ResolvedType $trait): PhpClass } return $this->clone(fn ($clone) => $clone->traits = $clone->traits->add($trait)); } + /** + * Create a class with an additional interface. + * + * @param ?ResolvedType $interface Interface to add. Must be a type which is an interface. + * + * @return PhpClass + */ + public function withInterface(?ResolvedType $interface): PhpClass + { + // No-op, just return the same class. + if (is_null($interface)) { + return $this; + } + if (!$interface->type->isClass()) { + throw new Exception('Only classes (interfaces) may be used as an interface.'); + } + return $this->clone(fn ($clone) => $clone->interfaces = $clone->interfaces->add($interface)); + } /** * Create a class with an additional member. @@ -120,8 +142,10 @@ public function toCode(): string return $this->phpDocToCode() . - "{$class} {$this->type->name}{$extends}\n" . - "{\n" . + "{$class} {$this->type->name}{$extends}" . + (count($this->interfaces) >= 1 ? ' implements ' : '') . + $this->interfaces->toVector()->map(fn ($x) => "{$x->toCode()}")->join(', ') . + "\n{\n" . $this->traits->toVector()->map(fn ($x) => "use {$x->toCode()};\n")->join() . (count($this->traits) >= 1 ? "\n" : '') . $this->members->map(fn ($x) => $x->toCode() . "\n")->join() . diff --git a/src/Ast/PhpMethod.php b/src/Ast/PhpMethod.php index 517a718c9..077c9b916 100644 --- a/src/Ast/PhpMethod.php +++ b/src/Ast/PhpMethod.php @@ -34,7 +34,7 @@ public function __construct(string $name) public string $name; private Vector $params; protected mixed $body; - private bool $forInterface = false; + private bool $declarationOnly = false; /** @var string The return type of the function. */ private ?ResolvedType $returnType = null; @@ -76,9 +76,9 @@ public function withReturnType(ResolvedType $returnType): PhpMethod return $this->clone(fn ($clone) => $clone->returnType = $returnType); } - public function forInterface(): PhpMethod + public function declarationOnly(): PhpMethod { - return $this->clone(fn ($clone) => $clone->forInterface = true); + return $this->clone(fn ($clone) => $clone->declarationOnly = true); } public function getName(): string @@ -96,7 +96,8 @@ public function toCode(): string $this->phpDocToCode() . $this->accessToCode() . $fnSignatureDeclaration . - ($this->forInterface ? ';' : + ( + $this->declarationOnly ? ';' : '{' . PHP_EOL . static::toPhp($this->body) . PHP_EOL . '}' . PHP_EOL diff --git a/src/Generation/GapicClientV2Generator.php b/src/Generation/GapicClientV2Generator.php index 35c9973c2..6cad4c4a1 100644 --- a/src/Generation/GapicClientV2Generator.php +++ b/src/Generation/GapicClientV2Generator.php @@ -162,6 +162,7 @@ private function generateClass(): PhpClass ->withTrait( $this->serviceDetails->hasResources ? $this->ctx->type(Type::fromName(\Google\ApiCore\ResourceHelperTrait::class)): null ) + ->withInterface($this->ctx->type($this->serviceDetails->gapicClientInterfaceType)) ->withMember($this->serviceName()) ->withMember($this->serviceAddress()) ->withMember($this->hasServiceAddressTemplate() ? $this->serviceAddressTemplate() : null) @@ -183,7 +184,7 @@ private function generateClass(): PhpClass private function generateInterface(PhpClass $class): PhpInterface { - return AST::interface(Type::fromName($this->serviceDetails->gapicClientV2Type->getFullname() . 'Interface')) + return AST::interface($this->serviceDetails->gapicClientInterfaceType) ->withPhpDoc(PhpDoc::block( PhpDoc::preFormattedText( $this->serviceDetails->docLines->skip(1) @@ -191,15 +192,12 @@ private function generateInterface(PhpClass $class): PhpInterface 'Service Description: ' . ($this->serviceDetails->docLines->firstOrNull() ?? '') ) ), - !is_null($this->serviceDetails->apiVersion) - ? PhpDoc::text( - 'This client uses ' . $this->serviceDetails->shortName . ' version ' . $this->serviceDetails->apiVersion . '.' - ) - : null, - PhpDoc::preFormattedText( - Vector::new([ - 'This interface defines the methods available for calling the backing service API', - ]) + PhpDoc::text( + 'This interface defines the methods available for calling ' . + (is_null($this->serviceDetails->apiVersion) + ? 'the backing service API' + : $this->serviceDetails->shortName . ' version ' . $this->serviceDetails->apiVersion + ) . '.' ), $this->serviceDetails->isGa() ? null : PhpDoc::experimental(), !$this->serviceDetails->isDeprecated ? null : PhpDoc::deprecated(ServiceDetails::DEPRECATED_MSG), @@ -214,7 +212,7 @@ private function generateInterface(PhpClass $class): PhpInterface // omit "__call" and "__construct" ->filter(fn ($x) => 0 !== strpos($x->name, '__')) // ensure the members are rendered without their method body - ->map(fn ($x) => $x->forInterface()) + ->map(fn ($x) => $x->declarationOnly()) ); } diff --git a/src/Generation/ServiceDetails.php b/src/Generation/ServiceDetails.php index 7dfc76ad2..b2dbb1cee 100644 --- a/src/Generation/ServiceDetails.php +++ b/src/Generation/ServiceDetails.php @@ -55,6 +55,9 @@ class ServiceDetails /** @var Type *Readonly* The type of the service client V2 class. */ public Type $gapicClientV2Type; + /** @var Type *Readonly* The type of the service client interface. */ + public Type $gapicClientInterfaceType; + /** @var Type *Readonly* The type of the empty client class. */ public Type $emptyClientType; @@ -179,6 +182,7 @@ public function __construct( $this->gapicClientType = Type::fromName("{$namespace}\\Gapic\\{$desc->getName()}GapicClient"); $this->emptyClientType = Type::fromName("{$namespace}\\{$desc->getName()}Client"); $this->gapicClientV2Type = Type::fromName("{$namespace}\\Client\\{$desc->getName()}Client"); + $this->gapicClientInterfaceType = Type::fromName("{$namespace}\\Client\\{$desc->getName()}ClientInterface"); $this->grpcClientType = Type::fromName("{$namespace}\\{$desc->getName()}GrpcClient"); $nsVersionAndSuffix = Helpers::nsVersionAndSuffixPath($namespace); $unitTestNs = $nsVersionAndSuffix === '' ? diff --git a/src/Utils/Type.php b/src/Utils/Type.php index e2a14c971..fead27860 100644 --- a/src/Utils/Type.php +++ b/src/Utils/Type.php @@ -220,7 +220,7 @@ private function __construct(?Vector $namespaceParts, string $name) public string $name; /** - * Does this Type represent a class? + * Does this Type represent a class, trait, or interface? * * @return bool */ diff --git a/tests/Unit/ProtoTests/Basic/out/src/Client/BasicClient.php b/tests/Unit/ProtoTests/Basic/out/src/Client/BasicClient.php index a98590ba1..c717b1d8b 100644 --- a/tests/Unit/ProtoTests/Basic/out/src/Client/BasicClient.php +++ b/tests/Unit/ProtoTests/Basic/out/src/Client/BasicClient.php @@ -51,7 +51,7 @@ * @method PromiseInterface aMethodAsync(Request $request, array $optionalArgs = []) * @method PromiseInterface methodWithArgsAsync(RequestWithArgs $request, array $optionalArgs = []) */ -final class BasicClient +final class BasicClient implements BasicClientInterface { use GapicClientTrait; diff --git a/tests/Unit/ProtoTests/Basic/out/src/Client/BasicClientInterface.php b/tests/Unit/ProtoTests/Basic/out/src/Client/BasicClientInterface.php new file mode 100644 index 000000000..60dd3d0c3 --- /dev/null +++ b/tests/Unit/ProtoTests/Basic/out/src/Client/BasicClientInterface.php @@ -0,0 +1,90 @@ + aMethodAsync(Request $request, array $optionalArgs = []) + * @method PromiseInterface methodWithArgsAsync(RequestWithArgs $request, array $optionalArgs = []) + */ +interface BasicClientInterface +{ + /** + * Test summary text for AMethod + * + * The async variant is {@see BasicClient::aMethodAsync()} . + * + * @example samples/BasicClient/a_method.php + * + * @param Request $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Response + * + * @throws ApiException Thrown if the API call fails. + */ + public function aMethod(Request $request, array $callOptions = []): Response; + + /** + * Test including method args. + * + * The async variant is {@see BasicClient::methodWithArgsAsync()} . + * + * @example samples/BasicClient/method_with_args.php + * + * @param RequestWithArgs $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Response + * + * @throws ApiException Thrown if the API call fails. + */ + public function methodWithArgs(RequestWithArgs $request, array $callOptions = []): Response; +} diff --git a/tests/Unit/ProtoTests/BasicExplicitPaginated/out/src/Client/BasicExplicitPaginatedClient.php b/tests/Unit/ProtoTests/BasicExplicitPaginated/out/src/Client/BasicExplicitPaginatedClient.php index 56debe82c..70e31fff9 100644 --- a/tests/Unit/ProtoTests/BasicExplicitPaginated/out/src/Client/BasicExplicitPaginatedClient.php +++ b/tests/Unit/ProtoTests/BasicExplicitPaginated/out/src/Client/BasicExplicitPaginatedClient.php @@ -45,7 +45,7 @@ * * @method PromiseInterface methodExplicitPaginatedAsync(ExplicitRequest $request, array $optionalArgs = []) */ -final class BasicExplicitPaginatedClient +final class BasicExplicitPaginatedClient implements BasicExplicitPaginatedClientInterface { use GapicClientTrait; diff --git a/tests/Unit/ProtoTests/BasicExplicitPaginated/out/src/Client/BasicExplicitPaginatedClientInterface.php b/tests/Unit/ProtoTests/BasicExplicitPaginated/out/src/Client/BasicExplicitPaginatedClientInterface.php new file mode 100644 index 000000000..693271072 --- /dev/null +++ b/tests/Unit/ProtoTests/BasicExplicitPaginated/out/src/Client/BasicExplicitPaginatedClientInterface.php @@ -0,0 +1,64 @@ + methodExplicitPaginatedAsync(ExplicitRequest $request, array $optionalArgs = []) + */ +interface BasicExplicitPaginatedClientInterface +{ + /** + * The async variant is + * {@see BasicExplicitPaginatedClient::methodExplicitPaginatedAsync()} . + * + * @example samples/BasicExplicitPaginatedClient/method_explicit_paginated.php + * + * @param ExplicitRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function methodExplicitPaginated(ExplicitRequest $request, array $callOptions = []): PagedListResponse; +} diff --git a/tests/Unit/ProtoTests/BasicGrpcOnly/out/src/Client/BasicGrpcOnlyClient.php b/tests/Unit/ProtoTests/BasicGrpcOnly/out/src/Client/BasicGrpcOnlyClient.php index 8cd48ad49..ed437150e 100644 --- a/tests/Unit/ProtoTests/BasicGrpcOnly/out/src/Client/BasicGrpcOnlyClient.php +++ b/tests/Unit/ProtoTests/BasicGrpcOnly/out/src/Client/BasicGrpcOnlyClient.php @@ -38,7 +38,7 @@ * This class provides the ability to make remote calls to the backing service through method * calls that map to API methods. */ -final class BasicGrpcOnlyClient +final class BasicGrpcOnlyClient implements BasicGrpcOnlyClientInterface { use GapicClientTrait; diff --git a/tests/Unit/ProtoTests/BasicGrpcOnly/out/src/Client/BasicGrpcOnlyClientInterface.php b/tests/Unit/ProtoTests/BasicGrpcOnly/out/src/Client/BasicGrpcOnlyClientInterface.php new file mode 100644 index 000000000..6f7755bf4 --- /dev/null +++ b/tests/Unit/ProtoTests/BasicGrpcOnly/out/src/Client/BasicGrpcOnlyClientInterface.php @@ -0,0 +1,35 @@ + aMethodAsync(Request $request, array $optionalArgs = []) */ -final class BasicOneofNewClient +final class BasicOneofNewClient implements BasicOneofNewClientInterface { use GapicClientTrait; diff --git a/tests/Unit/ProtoTests/BasicOneofNew/out/src/Client/BasicOneofNewClientInterface.php b/tests/Unit/ProtoTests/BasicOneofNew/out/src/Client/BasicOneofNewClientInterface.php new file mode 100644 index 000000000..0d1fabbbb --- /dev/null +++ b/tests/Unit/ProtoTests/BasicOneofNew/out/src/Client/BasicOneofNewClientInterface.php @@ -0,0 +1,65 @@ + aMethodAsync(Request $request, array $optionalArgs = []) + */ +interface BasicOneofNewClientInterface +{ + /** + * Test including method args with required oneofs. + * + * The async variant is {@see BasicOneofNewClient::aMethodAsync()} . + * + * @example samples/BasicOneofNewClient/a_method.php + * + * @param Request $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Response + * + * @throws ApiException Thrown if the API call fails. + */ + public function aMethod(Request $request, array $callOptions = []): Response; +} diff --git a/tests/Unit/ProtoTests/BasicServerStreaming/out/src/Client/BasicServerStreamingClient.php b/tests/Unit/ProtoTests/BasicServerStreaming/out/src/Client/BasicServerStreamingClient.php index f91c5e723..94751d722 100644 --- a/tests/Unit/ProtoTests/BasicServerStreaming/out/src/Client/BasicServerStreamingClient.php +++ b/tests/Unit/ProtoTests/BasicServerStreaming/out/src/Client/BasicServerStreamingClient.php @@ -43,7 +43,7 @@ * This class provides the ability to make remote calls to the backing service through method * calls that map to API methods. */ -final class BasicServerStreamingClient +final class BasicServerStreamingClient implements BasicServerStreamingClientInterface { use GapicClientTrait; diff --git a/tests/Unit/ProtoTests/BasicServerStreaming/out/src/Client/BasicServerStreamingClientInterface.php b/tests/Unit/ProtoTests/BasicServerStreaming/out/src/Client/BasicServerStreamingClientInterface.php new file mode 100644 index 000000000..d0bb615b9 --- /dev/null +++ b/tests/Unit/ProtoTests/BasicServerStreaming/out/src/Client/BasicServerStreamingClientInterface.php @@ -0,0 +1,74 @@ + + * + * @throws ApiException Thrown if the API call fails. + */ + public function methodEmpty(EmptyRequest $request, array $callOptions = []): ServerStream; + + /** + * @example samples/BasicServerStreamingClient/method_server.php + * + * @param Request $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type int $timeoutMillis + * Timeout to use for this call. + * } + * + * @return ServerStream + * + * @throws ApiException Thrown if the API call fails. + */ + public function methodServer(Request $request, array $callOptions = []): ServerStream; +} diff --git a/tests/Unit/ProtoTests/ClientTest.php b/tests/Unit/ProtoTests/ClientTest.php index d2a54f319..502354351 100644 --- a/tests/Unit/ProtoTests/ClientTest.php +++ b/tests/Unit/ProtoTests/ClientTest.php @@ -22,7 +22,7 @@ use Testing\BasicDiregapic\LibraryClient; use Google\ApiCore\InsecureCredentialsWrapper; use Google\ApiCore\ValidationException; -use Testing\BasicGrpcOnly\Client\BasicGrpcOnlyClient; +use Testing\Basicgrpconly\Client\BasicGrpcOnlyClient; final class ClientTest extends TestCase { diff --git a/tests/Unit/ProtoTests/CustomLroNew/out/src/Client/CustomLroClient.php b/tests/Unit/ProtoTests/CustomLroNew/out/src/Client/CustomLroClient.php index 4edf80ddd..57a314821 100644 --- a/tests/Unit/ProtoTests/CustomLroNew/out/src/Client/CustomLroClient.php +++ b/tests/Unit/ProtoTests/CustomLroNew/out/src/Client/CustomLroClient.php @@ -45,7 +45,7 @@ * * @method PromiseInterface createFooAsync(CreateFooRequest $request, array $optionalArgs = []) */ -final class CustomLroClient +final class CustomLroClient implements CustomLroClientInterface { use GapicClientTrait; diff --git a/tests/Unit/ProtoTests/CustomLroNew/out/src/Client/CustomLroClientInterface.php b/tests/Unit/ProtoTests/CustomLroNew/out/src/Client/CustomLroClientInterface.php new file mode 100644 index 000000000..54c173dfb --- /dev/null +++ b/tests/Unit/ProtoTests/CustomLroNew/out/src/Client/CustomLroClientInterface.php @@ -0,0 +1,83 @@ + createFooAsync(CreateFooRequest $request, array $optionalArgs = []) + */ +interface CustomLroClientInterface +{ + /** + * Return an CustomLroOperationsClient object with the same endpoint as $this. + * + * @return CustomLroOperationsClient + */ + public function getOperationsClient(); + + /** + * Resume an existing long running operation that was previously started by a long + * running API method. If $methodName is not provided, or does not match a long + * running API method, then the operation can still be resumed, but the + * OperationResponse object will not deserialize the final response. + * + * @param string $operationName The name of the long running operation + * @param string $methodName The name of the method used to start the operation + * + * @return OperationResponse + */ + public function resumeOperation($operationName, $methodName = null); + + /** + * The async variant is {@see CustomLroClient::createFooAsync()} . + * + * @example samples/CustomLroClient/create_foo.php + * + * @param CreateFooRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function createFoo(CreateFooRequest $request, array $callOptions = []): OperationResponse; +} diff --git a/tests/Unit/ProtoTests/CustomLroNew/out/src/Client/CustomLroOperationsClient.php b/tests/Unit/ProtoTests/CustomLroNew/out/src/Client/CustomLroOperationsClient.php index dc0cb04c0..2f42d3274 100644 --- a/tests/Unit/ProtoTests/CustomLroNew/out/src/Client/CustomLroOperationsClient.php +++ b/tests/Unit/ProtoTests/CustomLroNew/out/src/Client/CustomLroOperationsClient.php @@ -49,7 +49,7 @@ * @method PromiseInterface deleteAsync(DeleteOperationRequest $request, array $optionalArgs = []) * @method PromiseInterface getAsync(GetOperationRequest $request, array $optionalArgs = []) */ -final class CustomLroOperationsClient +final class CustomLroOperationsClient implements CustomLroOperationsClientInterface { use GapicClientTrait; diff --git a/tests/Unit/ProtoTests/CustomLroNew/out/src/Client/CustomLroOperationsClientInterface.php b/tests/Unit/ProtoTests/CustomLroNew/out/src/Client/CustomLroOperationsClientInterface.php new file mode 100644 index 000000000..4e266bc89 --- /dev/null +++ b/tests/Unit/ProtoTests/CustomLroNew/out/src/Client/CustomLroOperationsClientInterface.php @@ -0,0 +1,105 @@ + cancelAsync(CancelOperationRequest $request, array $optionalArgs = []) + * @method PromiseInterface deleteAsync(DeleteOperationRequest $request, array $optionalArgs = []) + * @method PromiseInterface getAsync(GetOperationRequest $request, array $optionalArgs = []) + */ +interface CustomLroOperationsClientInterface +{ + /** + * The async variant is {@see CustomLroOperationsClient::cancelAsync()} . + * + * @example samples/CustomLroOperationsClient/cancel.php + * + * @param CancelOperationRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function cancel(CancelOperationRequest $request, array $callOptions = []): void; + + /** + * The async variant is {@see CustomLroOperationsClient::deleteAsync()} . + * + * @example samples/CustomLroOperationsClient/delete.php + * + * @param DeleteOperationRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function delete(DeleteOperationRequest $request, array $callOptions = []): void; + + /** + * The async variant is {@see CustomLroOperationsClient::getAsync()} . + * + * @example samples/CustomLroOperationsClient/get.php + * + * @param GetOperationRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return CustomOperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function get(GetOperationRequest $request, array $callOptions = []): CustomOperationResponse; +} diff --git a/tests/Unit/ProtoTests/DiregapicPaginated/out/src/Client/HeuristicPaginationClientClient.php b/tests/Unit/ProtoTests/DiregapicPaginated/out/src/Client/HeuristicPaginationClientClient.php index 32db5538c..29019f238 100644 --- a/tests/Unit/ProtoTests/DiregapicPaginated/out/src/Client/HeuristicPaginationClientClient.php +++ b/tests/Unit/ProtoTests/DiregapicPaginated/out/src/Client/HeuristicPaginationClientClient.php @@ -54,7 +54,7 @@ * @method PromiseInterface multipleListMethodAsync(Request $request, array $optionalArgs = []) * @method PromiseInterface nonPaginatedMethodAsync(Request $request, array $optionalArgs = []) */ -final class HeuristicPaginationClientClient +final class HeuristicPaginationClientClient implements HeuristicPaginationClientClientInterface { use GapicClientTrait; diff --git a/tests/Unit/ProtoTests/DiregapicPaginated/out/src/Client/HeuristicPaginationClientClientInterface.php b/tests/Unit/ProtoTests/DiregapicPaginated/out/src/Client/HeuristicPaginationClientClientInterface.php new file mode 100644 index 000000000..bde2c8888 --- /dev/null +++ b/tests/Unit/ProtoTests/DiregapicPaginated/out/src/Client/HeuristicPaginationClientClientInterface.php @@ -0,0 +1,145 @@ + listMethodAsync(Request $request, array $optionalArgs = []) + * @method PromiseInterface mapMethodAsync(Request $request, array $optionalArgs = []) + * @method PromiseInterface multipleListMethodAsync(Request $request, array $optionalArgs = []) + * @method PromiseInterface nonPaginatedMethodAsync(Request $request, array $optionalArgs = []) + */ +interface HeuristicPaginationClientClientInterface +{ + /** + * Tests heuristic 2 + * + * The async variant is {@see HeuristicPaginationClientClient::listMethodAsync()} . + * + * @example samples/HeuristicPaginationClientClient/list_method.php + * + * @param Request $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listMethod(Request $request, array $callOptions = []): PagedListResponse; + + /** + * Tests heuristic #1 + * + * The async variant is {@see HeuristicPaginationClientClient::mapMethodAsync()} . + * + * @example samples/HeuristicPaginationClientClient/map_method.php + * + * @param Request $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function mapMethod(Request $request, array $callOptions = []): PagedListResponse; + + /** + * Tests heuristic 3 + * + * The async variant is + * {@see HeuristicPaginationClientClient::multipleListMethodAsync()} . + * + * @example samples/HeuristicPaginationClientClient/multiple_list_method.php + * + * @param Request $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function multipleListMethod(Request $request, array $callOptions = []): PagedListResponse; + + /** + * Tests Heuristic 4 + * + * The async variant is + * {@see HeuristicPaginationClientClient::nonPaginatedMethodAsync()} . + * + * @example samples/HeuristicPaginationClientClient/non_paginated_method.php + * + * @param Request $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return NonPaginatedResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function nonPaginatedMethod(Request $request, array $callOptions = []): NonPaginatedResponse; +} diff --git a/tests/Unit/ProtoTests/ProtoTest.php b/tests/Unit/ProtoTests/ProtoTest.php index 73cde3426..9d1d89777 100644 --- a/tests/Unit/ProtoTests/ProtoTest.php +++ b/tests/Unit/ProtoTests/ProtoTest.php @@ -54,8 +54,6 @@ private function runProtoTest( $filename = __DIR__ . '/' . dirname($protoPath) . '/out/' . $relativeFilename; // Check "expected-code" file exists, then compare generated code against expected code. // TODO: Add ability to check partial files. - @mkdir(dirname(__DIR__ . '/codegen/' . $relativeFilename), recursive: true); - file_put_contents(__DIR__ . '/codegen/' . $relativeFilename, $code); $this->assertTrue(file_exists($filename), "Expected code file missing: '{$filename}'"); $expectedCode = file_get_contents($filename); if (trim($expectedCode) !== 'IGNORE' && trim($expectedCode) !== ' wildcardMultiMethodAsync(WildcardMultiPatternRequest $request, array $optionalArgs = []) * @method PromiseInterface wildcardReferenceMethodAsync(WildcardReferenceRequest $request, array $optionalArgs = []) */ -final class ResourceNamesClient +final class ResourceNamesClient implements ResourceNamesClientInterface { use GapicClientTrait; use ResourceHelperTrait; diff --git a/tests/Unit/ProtoTests/ResourceNames/out/src/Client/ResourceNamesClientInterface.php b/tests/Unit/ProtoTests/ResourceNames/out/src/Client/ResourceNamesClientInterface.php new file mode 100644 index 000000000..ab6b9238f --- /dev/null +++ b/tests/Unit/ProtoTests/ResourceNames/out/src/Client/ResourceNamesClientInterface.php @@ -0,0 +1,232 @@ + fileLevelChildTypeRefMethodAsync(FileLevelChildTypeRefRequest $request, array $optionalArgs = []) + * @method PromiseInterface fileLevelTypeRefMethodAsync(FileLevelTypeRefRequest $request, array $optionalArgs = []) + * @method PromiseInterface multiPatternMethodAsync(MultiPatternRequest $request, array $optionalArgs = []) + * @method PromiseInterface nestedReferenceMethodAsync(NestedReferenceRequest $request, array $optionalArgs = []) + * @method PromiseInterface singlePatternMethodAsync(SinglePatternRequest $request, array $optionalArgs = []) + * @method PromiseInterface wildcardChildReferenceMethodAsync(WildcardChildReferenceRequest $request, array $optionalArgs = []) + * @method PromiseInterface wildcardMethodAsync(WildcardPatternRequest $request, array $optionalArgs = []) + * @method PromiseInterface wildcardMultiMethodAsync(WildcardMultiPatternRequest $request, array $optionalArgs = []) + * @method PromiseInterface wildcardReferenceMethodAsync(WildcardReferenceRequest $request, array $optionalArgs = []) + */ +interface ResourceNamesClientInterface +{ + /** + * The async variant is + * {@see ResourceNamesClient::fileLevelChildTypeRefMethodAsync()} . + * + * @param FileLevelChildTypeRefRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PlaceholderResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function fileLevelChildTypeRefMethod(FileLevelChildTypeRefRequest $request, array $callOptions = []): PlaceholderResponse; + + /** + * The async variant is {@see ResourceNamesClient::fileLevelTypeRefMethodAsync()} . + * + * @param FileLevelTypeRefRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PlaceholderResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function fileLevelTypeRefMethod(FileLevelTypeRefRequest $request, array $callOptions = []): PlaceholderResponse; + + /** + * The async variant is {@see ResourceNamesClient::multiPatternMethodAsync()} . + * + * @param MultiPatternRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PlaceholderResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function multiPatternMethod(MultiPatternRequest $request, array $callOptions = []): PlaceholderResponse; + + /** + * The async variant is {@see ResourceNamesClient::nestedReferenceMethodAsync()} . + * + * @param NestedReferenceRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PlaceholderResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function nestedReferenceMethod(NestedReferenceRequest $request, array $callOptions = []): PlaceholderResponse; + + /** + * The async variant is {@see ResourceNamesClient::singlePatternMethodAsync()} . + * + * @param SinglePatternRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PlaceholderResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function singlePatternMethod(SinglePatternRequest $request, array $callOptions = []): PlaceholderResponse; + + /** + * The async variant is + * {@see ResourceNamesClient::wildcardChildReferenceMethodAsync()} . + * + * @param WildcardChildReferenceRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PlaceholderResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function wildcardChildReferenceMethod(WildcardChildReferenceRequest $request, array $callOptions = []): PlaceholderResponse; + + /** + * The async variant is {@see ResourceNamesClient::wildcardMethodAsync()} . + * + * @param WildcardPatternRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PlaceholderResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function wildcardMethod(WildcardPatternRequest $request, array $callOptions = []): PlaceholderResponse; + + /** + * The async variant is {@see ResourceNamesClient::wildcardMultiMethodAsync()} . + * + * @param WildcardMultiPatternRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PlaceholderResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function wildcardMultiMethod(WildcardMultiPatternRequest $request, array $callOptions = []): PlaceholderResponse; + + /** + * The async variant is {@see ResourceNamesClient::wildcardReferenceMethodAsync()} + * . + * + * @param WildcardReferenceRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PlaceholderResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function wildcardReferenceMethod(WildcardReferenceRequest $request, array $callOptions = []): PlaceholderResponse; +} diff --git a/tests/Unit/ProtoTests/RoutingHeaders/out/src/Client/RoutingHeadersClient.php b/tests/Unit/ProtoTests/RoutingHeaders/out/src/Client/RoutingHeadersClient.php index 61b129485..6a244b8b4 100644 --- a/tests/Unit/ProtoTests/RoutingHeaders/out/src/Client/RoutingHeadersClient.php +++ b/tests/Unit/ProtoTests/RoutingHeaders/out/src/Client/RoutingHeadersClient.php @@ -58,7 +58,7 @@ * @method PromiseInterface routingRuleWithOutParametersAsync(NestedRequest $request, array $optionalArgs = []) * @method PromiseInterface routingRuleWithParametersAsync(NestedRequest $request, array $optionalArgs = []) */ -final class RoutingHeadersClient +final class RoutingHeadersClient implements RoutingHeadersClientInterface { use GapicClientTrait; diff --git a/tests/Unit/ProtoTests/RoutingHeaders/out/src/Client/RoutingHeadersClientInterface.php b/tests/Unit/ProtoTests/RoutingHeaders/out/src/Client/RoutingHeadersClientInterface.php new file mode 100644 index 000000000..2d83ba61c --- /dev/null +++ b/tests/Unit/ProtoTests/RoutingHeaders/out/src/Client/RoutingHeadersClientInterface.php @@ -0,0 +1,310 @@ + deleteMethodAsync(SimpleRequest $request, array $optionalArgs = []) + * @method PromiseInterface getMethodAsync(SimpleRequest $request, array $optionalArgs = []) + * @method PromiseInterface getNoPlaceholdersMethodAsync(SimpleRequest $request, array $optionalArgs = []) + * @method PromiseInterface getNoTemplateMethodAsync(SimpleRequest $request, array $optionalArgs = []) + * @method PromiseInterface nestedMethodAsync(NestedRequest $request, array $optionalArgs = []) + * @method PromiseInterface nestedMultiMethodAsync(NestedRequest $request, array $optionalArgs = []) + * @method PromiseInterface orderingMethodAsync(OrderRequest $request, array $optionalArgs = []) + * @method PromiseInterface patchMethodAsync(SimpleRequest $request, array $optionalArgs = []) + * @method PromiseInterface postMethodAsync(SimpleRequest $request, array $optionalArgs = []) + * @method PromiseInterface putMethodAsync(SimpleRequest $request, array $optionalArgs = []) + * @method PromiseInterface routingRuleWithOutParametersAsync(NestedRequest $request, array $optionalArgs = []) + * @method PromiseInterface routingRuleWithParametersAsync(NestedRequest $request, array $optionalArgs = []) + */ +interface RoutingHeadersClientInterface +{ + /** + * The async variant is {@see RoutingHeadersClient::deleteMethodAsync()} . + * + * @example samples/RoutingHeadersClient/delete_method.php + * + * @param SimpleRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Response + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteMethod(SimpleRequest $request, array $callOptions = []): Response; + + /** + * The async variant is {@see RoutingHeadersClient::getMethodAsync()} . + * + * @example samples/RoutingHeadersClient/get_method.php + * + * @param SimpleRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Response + * + * @throws ApiException Thrown if the API call fails. + */ + public function getMethod(SimpleRequest $request, array $callOptions = []): Response; + + /** + * The async variant is {@see RoutingHeadersClient::getNoPlaceholdersMethodAsync()} + * . + * + * @example samples/RoutingHeadersClient/get_no_placeholders_method.php + * + * @param SimpleRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Response + * + * @throws ApiException Thrown if the API call fails. + */ + public function getNoPlaceholdersMethod(SimpleRequest $request, array $callOptions = []): Response; + + /** + * The async variant is {@see RoutingHeadersClient::getNoTemplateMethodAsync()} . + * + * @example samples/RoutingHeadersClient/get_no_template_method.php + * + * @param SimpleRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Response + * + * @throws ApiException Thrown if the API call fails. + */ + public function getNoTemplateMethod(SimpleRequest $request, array $callOptions = []): Response; + + /** + * The async variant is {@see RoutingHeadersClient::nestedMethodAsync()} . + * + * @example samples/RoutingHeadersClient/nested_method.php + * + * @param NestedRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Response + * + * @throws ApiException Thrown if the API call fails. + */ + public function nestedMethod(NestedRequest $request, array $callOptions = []): Response; + + /** + * The async variant is {@see RoutingHeadersClient::nestedMultiMethodAsync()} . + * + * @example samples/RoutingHeadersClient/nested_multi_method.php + * + * @param NestedRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Response + * + * @throws ApiException Thrown if the API call fails. + */ + public function nestedMultiMethod(NestedRequest $request, array $callOptions = []): Response; + + /** + * The async variant is {@see RoutingHeadersClient::orderingMethodAsync()} . + * + * @example samples/RoutingHeadersClient/ordering_method.php + * + * @param OrderRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Response + * + * @throws ApiException Thrown if the API call fails. + */ + public function orderingMethod(OrderRequest $request, array $callOptions = []): Response; + + /** + * The async variant is {@see RoutingHeadersClient::patchMethodAsync()} . + * + * @example samples/RoutingHeadersClient/patch_method.php + * + * @param SimpleRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Response + * + * @throws ApiException Thrown if the API call fails. + */ + public function patchMethod(SimpleRequest $request, array $callOptions = []): Response; + + /** + * The async variant is {@see RoutingHeadersClient::postMethodAsync()} . + * + * @example samples/RoutingHeadersClient/post_method.php + * + * @param SimpleRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Response + * + * @throws ApiException Thrown if the API call fails. + */ + public function postMethod(SimpleRequest $request, array $callOptions = []): Response; + + /** + * The async variant is {@see RoutingHeadersClient::putMethodAsync()} . + * + * @example samples/RoutingHeadersClient/put_method.php + * + * @param SimpleRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Response + * + * @throws ApiException Thrown if the API call fails. + */ + public function putMethod(SimpleRequest $request, array $callOptions = []): Response; + + /** + * The async variant is + * {@see RoutingHeadersClient::routingRuleWithOutParametersAsync()} . + * + * @example samples/RoutingHeadersClient/routing_rule_with_out_parameters.php + * + * @param NestedRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Response + * + * @throws ApiException Thrown if the API call fails. + */ + public function routingRuleWithOutParameters(NestedRequest $request, array $callOptions = []): Response; + + /** + * The async variant is + * {@see RoutingHeadersClient::routingRuleWithParametersAsync()} . + * + * @example samples/RoutingHeadersClient/routing_rule_with_parameters.php + * + * @param NestedRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Response + * + * @throws ApiException Thrown if the API call fails. + */ + public function routingRuleWithParameters(NestedRequest $request, array $callOptions = []): Response; +} diff --git a/tests/Unit/ProtoTests/codegen/samples/BasicClient/a_method.php b/tests/Unit/ProtoTests/codegen/samples/BasicClient/a_method.php new file mode 100644 index 000000000..6c78c3e55 --- /dev/null +++ b/tests/Unit/ProtoTests/codegen/samples/BasicClient/a_method.php @@ -0,0 +1,57 @@ +aMethod($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END basic_generated_Basic_AMethod_sync] diff --git a/tests/Unit/ProtoTests/codegen/samples/BasicClient/method_with_args.php b/tests/Unit/ProtoTests/codegen/samples/BasicClient/method_with_args.php new file mode 100644 index 000000000..994f02c6b --- /dev/null +++ b/tests/Unit/ProtoTests/codegen/samples/BasicClient/method_with_args.php @@ -0,0 +1,76 @@ +setAString($aString) + ->setPartOfRequestA($partOfRequestA) + ->setStatus($status); + + // Call the API and handle any network failures. + try { + /** @var Response $response */ + $response = $basicClient->methodWithArgs($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $aString = '[A_STRING]'; + $status = 0; + + method_with_args_sample($aString, $status); +} +// [END basic_generated_Basic_MethodWithArgs_sync] diff --git a/tests/Unit/ProtoTests/codegen/src/Client/BasicClient.php b/tests/Unit/ProtoTests/codegen/src/Client/BasicClient.php new file mode 100644 index 000000000..c717b1d8b --- /dev/null +++ b/tests/Unit/ProtoTests/codegen/src/Client/BasicClient.php @@ -0,0 +1,261 @@ + aMethodAsync(Request $request, array $optionalArgs = []) + * @method PromiseInterface methodWithArgsAsync(RequestWithArgs $request, array $optionalArgs = []) + */ +final class BasicClient implements BasicClientInterface +{ + use GapicClientTrait; + + /** The name of the service. */ + private const SERVICE_NAME = 'testing.basic.Basic'; + + /** The default address of the service. */ + private const SERVICE_ADDRESS = 'basic.example.com'; + + /** The default port of the service. */ + private const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + private const CODEGEN_NAME = 'gapic'; + + /** The api version of the service */ + private string $apiVersion = 'v1_20240418'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'scope1', + 'scope2', + ]; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/basic_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/basic_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/basic_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/basic_rest_client_config.php', + ], + ], + ]; + } + + /** + * Constructor. + * + * Setting the "BASIC_EMULATOR_HOST" environment variable will automatically set + * the API Endpoint to the value specified in the variable, as well as ensure that + * empty credentials are used in the transport layer. + * + * @param array|ClientOptions $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'basic.example.com:443'. + * @type FetchAuthTokenInterface|CredentialsWrapper $credentials + * This option should only be used with a pre-constructed + * {@see FetchAuthTokenInterface} or {@see CredentialsWrapper} object. Note that + * when one of these objects are provided, any settings in $credentialsConfig will + * be ignored. + * **Important**: If you are providing a path to a credentials file, or a decoded + * credentials file as a PHP array, this usage is now DEPRECATED. Providing an + * unvalidated credential configuration to Google APIs can compromise the security + * of your systems and data. It is recommended to create the credentials explicitly + * ``` + * use Google\Auth\Credentials\ServiceAccountCredentials; + * use Testing\Basic\BasicClient; + * $creds = new ServiceAccountCredentials($scopes, $json); + * $options = new BasicClient(['credentials' => $creds]); + * ``` + * {@see + * https://cloud.google.com/docs/authentication/external/externally-sourced-credentials} + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported 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 + * @type string $universeDomain + * The service domain for the client. Defaults to 'googleapis.com'. + * } + * + * @throws ValidationException + */ + public function __construct(array|ClientOptions $options = []) + { + $options = $this->setDefaultEmulatorConfig($options); + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + } + + /** Handles execution of the async variants for each documented method. */ + public function __call($method, $args) + { + if (substr($method, -5) !== 'Async') { + trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); + } + + array_unshift($args, substr($method, 0, -5)); + return call_user_func_array([$this, 'startAsyncCall'], $args); + } + + /** + * Test summary text for AMethod + * + * The async variant is {@see BasicClient::aMethodAsync()} . + * + * @example samples/BasicClient/a_method.php + * + * @param Request $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Response + * + * @throws ApiException Thrown if the API call fails. + */ + public function aMethod(Request $request, array $callOptions = []): Response + { + return $this->startApiCall('AMethod', $request, $callOptions)->wait(); + } + + /** + * Test including method args. + * + * The async variant is {@see BasicClient::methodWithArgsAsync()} . + * + * @example samples/BasicClient/method_with_args.php + * + * @param RequestWithArgs $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Response + * + * @throws ApiException Thrown if the API call fails. + */ + public function methodWithArgs(RequestWithArgs $request, array $callOptions = []): Response + { + return $this->startApiCall('MethodWithArgs', $request, $callOptions)->wait(); + } + + /** Configure the gapic configuration to use a service emulator. */ + private function setDefaultEmulatorConfig(array $options): array + { + $emulatorHost = getenv('BASIC_EMULATOR_HOST'); + if (empty($emulatorHost)) { + return $options; + } + + if ($scheme = parse_url($emulatorHost, PHP_URL_SCHEME)) { + $search = $scheme . '://'; + $emulatorHost = str_replace($search, '', $emulatorHost); + } + + $options['apiEndpoint'] ??= $emulatorHost; + if (class_exists(ChannelCredentials::class)) { + $options['transportConfig']['grpc']['stubOpts']['credentials'] ??= ChannelCredentials::createInsecure(); + } + + $options['credentials'] ??= new InsecureCredentialsWrapper(); + return $options; + } +} From 2b5e53604a71e0cc10888a6ad7d29d288be0585b Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Thu, 30 Apr 2026 18:10:59 +0000 Subject: [PATCH 4/5] update integration tests --- .../V1/Client/CloudFunctionsServiceClient.php | 2 +- .../CloudFunctionsServiceClientInterface.php | 388 ++++ .../redis/src/V1/Client/CloudRedisClient.php | 2 +- .../V1/Client/CloudRedisClientInterface.php | 446 +++++ .../src/V1/Client/SecurityCenterClient.php | 2 +- .../Client/SecurityCenterClientInterface.php | 1747 +++++++++++++++++ .../src/V1/Client/DatabaseAdminClient.php | 2 +- .../Client/DatabaseAdminClientInterface.php | 891 +++++++++ 8 files changed, 3476 insertions(+), 4 deletions(-) create mode 100644 tests/Integration/goldens/functions/src/V1/Client/CloudFunctionsServiceClientInterface.php create mode 100644 tests/Integration/goldens/redis/src/V1/Client/CloudRedisClientInterface.php create mode 100644 tests/Integration/goldens/securitycenter/src/V1/Client/SecurityCenterClientInterface.php create mode 100644 tests/Integration/goldens/spanner/src/V1/Client/DatabaseAdminClientInterface.php diff --git a/tests/Integration/goldens/functions/src/V1/Client/CloudFunctionsServiceClient.php b/tests/Integration/goldens/functions/src/V1/Client/CloudFunctionsServiceClient.php index f94692d36..e4d7bafcf 100644 --- a/tests/Integration/goldens/functions/src/V1/Client/CloudFunctionsServiceClient.php +++ b/tests/Integration/goldens/functions/src/V1/Client/CloudFunctionsServiceClient.php @@ -80,7 +80,7 @@ * @method PromiseInterface testIamPermissionsAsync(TestIamPermissionsRequest $request, array $optionalArgs = []) * @method PromiseInterface updateFunctionAsync(UpdateFunctionRequest $request, array $optionalArgs = []) */ -final class CloudFunctionsServiceClient +final class CloudFunctionsServiceClient implements CloudFunctionsServiceClientInterface { use GapicClientTrait; use ResourceHelperTrait; diff --git a/tests/Integration/goldens/functions/src/V1/Client/CloudFunctionsServiceClientInterface.php b/tests/Integration/goldens/functions/src/V1/Client/CloudFunctionsServiceClientInterface.php new file mode 100644 index 000000000..dd9b62e22 --- /dev/null +++ b/tests/Integration/goldens/functions/src/V1/Client/CloudFunctionsServiceClientInterface.php @@ -0,0 +1,388 @@ + callFunctionAsync(CallFunctionRequest $request, array $optionalArgs = []) + * @method PromiseInterface createFunctionAsync(CreateFunctionRequest $request, array $optionalArgs = []) + * @method PromiseInterface deleteFunctionAsync(DeleteFunctionRequest $request, array $optionalArgs = []) + * @method PromiseInterface generateDownloadUrlAsync(GenerateDownloadUrlRequest $request, array $optionalArgs = []) + * @method PromiseInterface generateUploadUrlAsync(GenerateUploadUrlRequest $request, array $optionalArgs = []) + * @method PromiseInterface getFunctionAsync(GetFunctionRequest $request, array $optionalArgs = []) + * @method PromiseInterface getIamPolicyAsync(GetIamPolicyRequest $request, array $optionalArgs = []) + * @method PromiseInterface listFunctionsAsync(ListFunctionsRequest $request, array $optionalArgs = []) + * @method PromiseInterface setIamPolicyAsync(SetIamPolicyRequest $request, array $optionalArgs = []) + * @method PromiseInterface testIamPermissionsAsync(TestIamPermissionsRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateFunctionAsync(UpdateFunctionRequest $request, array $optionalArgs = []) + */ +interface CloudFunctionsServiceClientInterface +{ + /** + * Return an OperationsClient object with the same endpoint as $this. + * + * @return OperationsClient + */ + public function getOperationsClient(); + + /** + * Resume an existing long running operation that was previously started by a long + * running API method. If $methodName is not provided, or does not match a long + * running API method, then the operation can still be resumed, but the + * OperationResponse object will not deserialize the final response. + * + * @param string $operationName The name of the long running operation + * @param string $methodName The name of the method used to start the operation + * + * @return OperationResponse + */ + public function resumeOperation($operationName, $methodName = null); + + /** + * Synchronously invokes a deployed Cloud Function. To be used for testing + * purposes as very limited traffic is allowed. For more information on + * the actual limits, refer to + * [Rate Limits](https://cloud.google.com/functions/quotas#rate_limits). + * + * The async variant is {@see CloudFunctionsServiceClient::callFunctionAsync()} . + * + * @example samples/V1/CloudFunctionsServiceClient/call_function.php + * + * @param CallFunctionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return CallFunctionResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function callFunction(CallFunctionRequest $request, array $callOptions = []): CallFunctionResponse; + + /** + * Creates a new function. If a function with the given name already exists in + * the specified project, the long running operation will return + * `ALREADY_EXISTS` error. + * + * The async variant is {@see CloudFunctionsServiceClient::createFunctionAsync()} . + * + * @example samples/V1/CloudFunctionsServiceClient/create_function.php + * + * @param CreateFunctionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function createFunction(CreateFunctionRequest $request, array $callOptions = []): OperationResponse; + + /** + * Deletes a function with the given name from the specified project. If the + * given function is used by some trigger, the trigger will be updated to + * remove this function. + * + * The async variant is {@see CloudFunctionsServiceClient::deleteFunctionAsync()} . + * + * @example samples/V1/CloudFunctionsServiceClient/delete_function.php + * + * @param DeleteFunctionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteFunction(DeleteFunctionRequest $request, array $callOptions = []): OperationResponse; + + /** + * Returns a signed URL for downloading deployed function source code. + * The URL is only valid for a limited period and should be used within + * minutes after generation. + * For more information about the signed URL usage see: + * https://cloud.google.com/storage/docs/access-control/signed-urls + * + * The async variant is + * {@see CloudFunctionsServiceClient::generateDownloadUrlAsync()} . + * + * @example samples/V1/CloudFunctionsServiceClient/generate_download_url.php + * + * @param GenerateDownloadUrlRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return GenerateDownloadUrlResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function generateDownloadUrl(GenerateDownloadUrlRequest $request, array $callOptions = []): GenerateDownloadUrlResponse; + + /** + * Returns a signed URL for uploading a function source code. + * For more information about the signed URL usage see: + * https://cloud.google.com/storage/docs/access-control/signed-urls. + * Once the function source code upload is complete, the used signed + * URL should be provided in CreateFunction or UpdateFunction request + * as a reference to the function source code. + * + * When uploading source code to the generated signed URL, please follow + * these restrictions: + * + * * Source file type should be a zip file. + * * Source file size should not exceed 100MB limit. + * * No credentials should be attached - the signed URLs provide access to the + * target bucket using internal service identity; if credentials were + * attached, the identity from the credentials would be used, but that + * identity does not have permissions to upload files to the URL. + * + * When making a HTTP PUT request, these two headers need to be specified: + * + * * `content-type: application/zip` + * * `x-goog-content-length-range: 0,104857600` + * + * And this header SHOULD NOT be specified: + * + * * `Authorization: Bearer YOUR_TOKEN` + * + * The async variant is + * {@see CloudFunctionsServiceClient::generateUploadUrlAsync()} . + * + * @example samples/V1/CloudFunctionsServiceClient/generate_upload_url.php + * + * @param GenerateUploadUrlRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return GenerateUploadUrlResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function generateUploadUrl(GenerateUploadUrlRequest $request, array $callOptions = []): GenerateUploadUrlResponse; + + /** + * Returns a function with the given name from the requested project. + * + * The async variant is {@see CloudFunctionsServiceClient::getFunctionAsync()} . + * + * @example samples/V1/CloudFunctionsServiceClient/get_function.php + * + * @param GetFunctionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return CloudFunction + * + * @throws ApiException Thrown if the API call fails. + */ + public function getFunction(GetFunctionRequest $request, array $callOptions = []): CloudFunction; + + /** + * Gets the IAM access control policy for a function. + * Returns an empty policy if the function exists and does not have a policy + * set. + * + * The async variant is {@see CloudFunctionsServiceClient::getIamPolicyAsync()} . + * + * @example samples/V1/CloudFunctionsServiceClient/get_iam_policy.php + * + * @param GetIamPolicyRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Policy + * + * @throws ApiException Thrown if the API call fails. + */ + public function getIamPolicy(GetIamPolicyRequest $request, array $callOptions = []): Policy; + + /** + * Returns a list of functions that belong to the requested project. + * + * The async variant is {@see CloudFunctionsServiceClient::listFunctionsAsync()} . + * + * @example samples/V1/CloudFunctionsServiceClient/list_functions.php + * + * @param ListFunctionsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listFunctions(ListFunctionsRequest $request, array $callOptions = []): PagedListResponse; + + /** + * Sets the IAM access control policy on the specified function. + * Replaces any existing policy. + * + * The async variant is {@see CloudFunctionsServiceClient::setIamPolicyAsync()} . + * + * @example samples/V1/CloudFunctionsServiceClient/set_iam_policy.php + * + * @param SetIamPolicyRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Policy + * + * @throws ApiException Thrown if the API call fails. + */ + public function setIamPolicy(SetIamPolicyRequest $request, array $callOptions = []): Policy; + + /** + * Tests the specified permissions against the IAM access control policy + * for a function. + * If the function does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * The async variant is + * {@see CloudFunctionsServiceClient::testIamPermissionsAsync()} . + * + * @example samples/V1/CloudFunctionsServiceClient/test_iam_permissions.php + * + * @param TestIamPermissionsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return TestIamPermissionsResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function testIamPermissions(TestIamPermissionsRequest $request, array $callOptions = []): TestIamPermissionsResponse; + + /** + * Updates existing function. + * + * The async variant is {@see CloudFunctionsServiceClient::updateFunctionAsync()} . + * + * @example samples/V1/CloudFunctionsServiceClient/update_function.php + * + * @param UpdateFunctionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateFunction(UpdateFunctionRequest $request, array $callOptions = []): OperationResponse; +} diff --git a/tests/Integration/goldens/redis/src/V1/Client/CloudRedisClient.php b/tests/Integration/goldens/redis/src/V1/Client/CloudRedisClient.php index 4f261f889..3d577cc9d 100644 --- a/tests/Integration/goldens/redis/src/V1/Client/CloudRedisClient.php +++ b/tests/Integration/goldens/redis/src/V1/Client/CloudRedisClient.php @@ -95,7 +95,7 @@ * @method PromiseInterface getLocationAsync(GetLocationRequest $request, array $optionalArgs = []) * @method PromiseInterface listLocationsAsync(ListLocationsRequest $request, array $optionalArgs = []) */ -final class CloudRedisClient +final class CloudRedisClient implements CloudRedisClientInterface { use GapicClientTrait; use ResourceHelperTrait; diff --git a/tests/Integration/goldens/redis/src/V1/Client/CloudRedisClientInterface.php b/tests/Integration/goldens/redis/src/V1/Client/CloudRedisClientInterface.php new file mode 100644 index 000000000..ef6ad31e0 --- /dev/null +++ b/tests/Integration/goldens/redis/src/V1/Client/CloudRedisClientInterface.php @@ -0,0 +1,446 @@ + createInstanceAsync(CreateInstanceRequest $request, array $optionalArgs = []) + * @method PromiseInterface deleteInstanceAsync(DeleteInstanceRequest $request, array $optionalArgs = []) + * @method PromiseInterface exportInstanceAsync(ExportInstanceRequest $request, array $optionalArgs = []) + * @method PromiseInterface failoverInstanceAsync(FailoverInstanceRequest $request, array $optionalArgs = []) + * @method PromiseInterface getInstanceAsync(GetInstanceRequest $request, array $optionalArgs = []) + * @method PromiseInterface getInstanceAuthStringAsync(GetInstanceAuthStringRequest $request, array $optionalArgs = []) + * @method PromiseInterface importInstanceAsync(ImportInstanceRequest $request, array $optionalArgs = []) + * @method PromiseInterface listInstancesAsync(ListInstancesRequest $request, array $optionalArgs = []) + * @method PromiseInterface rescheduleMaintenanceAsync(RescheduleMaintenanceRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateInstanceAsync(UpdateInstanceRequest $request, array $optionalArgs = []) + * @method PromiseInterface upgradeInstanceAsync(UpgradeInstanceRequest $request, array $optionalArgs = []) + * @method PromiseInterface getLocationAsync(GetLocationRequest $request, array $optionalArgs = []) + * @method PromiseInterface listLocationsAsync(ListLocationsRequest $request, array $optionalArgs = []) + */ +interface CloudRedisClientInterface +{ + /** + * Return an OperationsClient object with the same endpoint as $this. + * + * @return OperationsClient + */ + public function getOperationsClient(); + + /** + * Resume an existing long running operation that was previously started by a long + * running API method. If $methodName is not provided, or does not match a long + * running API method, then the operation can still be resumed, but the + * OperationResponse object will not deserialize the final response. + * + * @param string $operationName The name of the long running operation + * @param string $methodName The name of the method used to start the operation + * + * @return OperationResponse + */ + public function resumeOperation($operationName, $methodName = null); + + /** + * Creates a Redis instance based on the specified tier and memory size. + * + * By default, the instance is accessible from the project's + * [default network](https://cloud.google.com/vpc/docs/vpc). + * + * The creation is executed asynchronously and callers may check the returned + * operation to track its progress. Once the operation is completed the Redis + * instance will be fully functional. Completed longrunning.Operation will + * contain the new instance object in the response field. + * + * The returned operation is automatically deleted after a few hours, so there + * is no need to call DeleteOperation. + * + * The async variant is {@see CloudRedisClient::createInstanceAsync()} . + * + * @example samples/V1/CloudRedisClient/create_instance.php + * + * @param CreateInstanceRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function createInstance(CreateInstanceRequest $request, array $callOptions = []): OperationResponse; + + /** + * Deletes a specific Redis instance. Instance stops serving and data is + * deleted. + * + * The async variant is {@see CloudRedisClient::deleteInstanceAsync()} . + * + * @example samples/V1/CloudRedisClient/delete_instance.php + * + * @param DeleteInstanceRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteInstance(DeleteInstanceRequest $request, array $callOptions = []): OperationResponse; + + /** + * Export Redis instance data into a Redis RDB format file in Cloud Storage. + * + * Redis will continue serving during this operation. + * + * The returned operation is automatically deleted after a few hours, so + * there is no need to call DeleteOperation. + * + * The async variant is {@see CloudRedisClient::exportInstanceAsync()} . + * + * @example samples/V1/CloudRedisClient/export_instance.php + * + * @param ExportInstanceRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function exportInstance(ExportInstanceRequest $request, array $callOptions = []): OperationResponse; + + /** + * Initiates a failover of the primary node to current replica node for a + * specific STANDARD tier Cloud Memorystore for Redis instance. + * + * The async variant is {@see CloudRedisClient::failoverInstanceAsync()} . + * + * @example samples/V1/CloudRedisClient/failover_instance.php + * + * @param FailoverInstanceRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function failoverInstance(FailoverInstanceRequest $request, array $callOptions = []): OperationResponse; + + /** + * Gets the details of a specific Redis instance. + * + * The async variant is {@see CloudRedisClient::getInstanceAsync()} . + * + * @example samples/V1/CloudRedisClient/get_instance.php + * + * @param GetInstanceRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Instance + * + * @throws ApiException Thrown if the API call fails. + */ + public function getInstance(GetInstanceRequest $request, array $callOptions = []): Instance; + + /** + * Gets the AUTH string for a Redis instance. If AUTH is not enabled for the + * instance the response will be empty. This information is not included in + * the details returned to GetInstance. + * + * The async variant is {@see CloudRedisClient::getInstanceAuthStringAsync()} . + * + * @example samples/V1/CloudRedisClient/get_instance_auth_string.php + * + * @param GetInstanceAuthStringRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return InstanceAuthString + * + * @throws ApiException Thrown if the API call fails. + */ + public function getInstanceAuthString(GetInstanceAuthStringRequest $request, array $callOptions = []): InstanceAuthString; + + /** + * Import a Redis RDB snapshot file from Cloud Storage into a Redis instance. + * + * Redis may stop serving during this operation. Instance state will be + * IMPORTING for entire operation. When complete, the instance will contain + * only data from the imported file. + * + * The returned operation is automatically deleted after a few hours, so + * there is no need to call DeleteOperation. + * + * The async variant is {@see CloudRedisClient::importInstanceAsync()} . + * + * @example samples/V1/CloudRedisClient/import_instance.php + * + * @param ImportInstanceRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function importInstance(ImportInstanceRequest $request, array $callOptions = []): OperationResponse; + + /** + * Lists all Redis instances owned by a project in either the specified + * location (region) or all locations. + * + * The location should have the following format: + * + * * `projects/{project_id}/locations/{location_id}` + * + * If `location_id` is specified as `-` (wildcard), then all regions + * available to the project are queried, and the results are aggregated. + * + * The async variant is {@see CloudRedisClient::listInstancesAsync()} . + * + * @example samples/V1/CloudRedisClient/list_instances.php + * + * @param ListInstancesRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listInstances(ListInstancesRequest $request, array $callOptions = []): PagedListResponse; + + /** + * Reschedule maintenance for a given instance in a given project and + * location. + * + * The async variant is {@see CloudRedisClient::rescheduleMaintenanceAsync()} . + * + * @example samples/V1/CloudRedisClient/reschedule_maintenance.php + * + * @param RescheduleMaintenanceRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function rescheduleMaintenance(RescheduleMaintenanceRequest $request, array $callOptions = []): OperationResponse; + + /** + * Updates the metadata and configuration of a specific Redis instance. + * + * Completed longrunning.Operation will contain the new instance object + * in the response field. The returned operation is automatically deleted + * after a few hours, so there is no need to call DeleteOperation. + * + * The async variant is {@see CloudRedisClient::updateInstanceAsync()} . + * + * @example samples/V1/CloudRedisClient/update_instance.php + * + * @param UpdateInstanceRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateInstance(UpdateInstanceRequest $request, array $callOptions = []): OperationResponse; + + /** + * Upgrades Redis instance to the newer Redis version specified in the + * request. + * + * The async variant is {@see CloudRedisClient::upgradeInstanceAsync()} . + * + * @example samples/V1/CloudRedisClient/upgrade_instance.php + * + * @param UpgradeInstanceRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function upgradeInstance(UpgradeInstanceRequest $request, array $callOptions = []): OperationResponse; + + /** + * Gets information about a location. + * + * The async variant is {@see CloudRedisClient::getLocationAsync()} . + * + * @example samples/V1/CloudRedisClient/get_location.php + * + * @param GetLocationRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Location + * + * @throws ApiException Thrown if the API call fails. + */ + public function getLocation(GetLocationRequest $request, array $callOptions = []): Location; + + /** + * Lists information about the supported locations for this service. + * + * The async variant is {@see CloudRedisClient::listLocationsAsync()} . + * + * @example samples/V1/CloudRedisClient/list_locations.php + * + * @param ListLocationsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listLocations(ListLocationsRequest $request, array $callOptions = []): PagedListResponse; +} diff --git a/tests/Integration/goldens/securitycenter/src/V1/Client/SecurityCenterClient.php b/tests/Integration/goldens/securitycenter/src/V1/Client/SecurityCenterClient.php index fb978966e..a77f8b55a 100644 --- a/tests/Integration/goldens/securitycenter/src/V1/Client/SecurityCenterClient.php +++ b/tests/Integration/goldens/securitycenter/src/V1/Client/SecurityCenterClient.php @@ -200,7 +200,7 @@ * @method PromiseInterface updateSourceAsync(UpdateSourceRequest $request, array $optionalArgs = []) * @method PromiseInterface validateEventThreatDetectionCustomModuleAsync(ValidateEventThreatDetectionCustomModuleRequest $request, array $optionalArgs = []) */ -final class SecurityCenterClient +final class SecurityCenterClient implements SecurityCenterClientInterface { use GapicClientTrait; use ResourceHelperTrait; diff --git a/tests/Integration/goldens/securitycenter/src/V1/Client/SecurityCenterClientInterface.php b/tests/Integration/goldens/securitycenter/src/V1/Client/SecurityCenterClientInterface.php new file mode 100644 index 000000000..dc899eee4 --- /dev/null +++ b/tests/Integration/goldens/securitycenter/src/V1/Client/SecurityCenterClientInterface.php @@ -0,0 +1,1747 @@ + batchCreateResourceValueConfigsAsync(BatchCreateResourceValueConfigsRequest $request, array $optionalArgs = []) + * @method PromiseInterface bulkMuteFindingsAsync(BulkMuteFindingsRequest $request, array $optionalArgs = []) + * @method PromiseInterface createBigQueryExportAsync(CreateBigQueryExportRequest $request, array $optionalArgs = []) + * @method PromiseInterface createEventThreatDetectionCustomModuleAsync(CreateEventThreatDetectionCustomModuleRequest $request, array $optionalArgs = []) + * @method PromiseInterface createFindingAsync(CreateFindingRequest $request, array $optionalArgs = []) + * @method PromiseInterface createMuteConfigAsync(CreateMuteConfigRequest $request, array $optionalArgs = []) + * @method PromiseInterface createNotificationConfigAsync(CreateNotificationConfigRequest $request, array $optionalArgs = []) + * @method PromiseInterface createSecurityHealthAnalyticsCustomModuleAsync(CreateSecurityHealthAnalyticsCustomModuleRequest $request, array $optionalArgs = []) + * @method PromiseInterface createSourceAsync(CreateSourceRequest $request, array $optionalArgs = []) + * @method PromiseInterface deleteBigQueryExportAsync(DeleteBigQueryExportRequest $request, array $optionalArgs = []) + * @method PromiseInterface deleteEventThreatDetectionCustomModuleAsync(DeleteEventThreatDetectionCustomModuleRequest $request, array $optionalArgs = []) + * @method PromiseInterface deleteMuteConfigAsync(DeleteMuteConfigRequest $request, array $optionalArgs = []) + * @method PromiseInterface deleteNotificationConfigAsync(DeleteNotificationConfigRequest $request, array $optionalArgs = []) + * @method PromiseInterface deleteResourceValueConfigAsync(DeleteResourceValueConfigRequest $request, array $optionalArgs = []) + * @method PromiseInterface deleteSecurityHealthAnalyticsCustomModuleAsync(DeleteSecurityHealthAnalyticsCustomModuleRequest $request, array $optionalArgs = []) + * @method PromiseInterface getBigQueryExportAsync(GetBigQueryExportRequest $request, array $optionalArgs = []) + * @method PromiseInterface getEffectiveEventThreatDetectionCustomModuleAsync(GetEffectiveEventThreatDetectionCustomModuleRequest $request, array $optionalArgs = []) + * @method PromiseInterface getEffectiveSecurityHealthAnalyticsCustomModuleAsync(GetEffectiveSecurityHealthAnalyticsCustomModuleRequest $request, array $optionalArgs = []) + * @method PromiseInterface getEventThreatDetectionCustomModuleAsync(GetEventThreatDetectionCustomModuleRequest $request, array $optionalArgs = []) + * @method PromiseInterface getIamPolicyAsync(GetIamPolicyRequest $request, array $optionalArgs = []) + * @method PromiseInterface getMuteConfigAsync(GetMuteConfigRequest $request, array $optionalArgs = []) + * @method PromiseInterface getNotificationConfigAsync(GetNotificationConfigRequest $request, array $optionalArgs = []) + * @method PromiseInterface getOrganizationSettingsAsync(GetOrganizationSettingsRequest $request, array $optionalArgs = []) + * @method PromiseInterface getResourceValueConfigAsync(GetResourceValueConfigRequest $request, array $optionalArgs = []) + * @method PromiseInterface getSecurityHealthAnalyticsCustomModuleAsync(GetSecurityHealthAnalyticsCustomModuleRequest $request, array $optionalArgs = []) + * @method PromiseInterface getSimulationAsync(GetSimulationRequest $request, array $optionalArgs = []) + * @method PromiseInterface getSourceAsync(GetSourceRequest $request, array $optionalArgs = []) + * @method PromiseInterface getValuedResourceAsync(GetValuedResourceRequest $request, array $optionalArgs = []) + * @method PromiseInterface groupAssetsAsync(GroupAssetsRequest $request, array $optionalArgs = []) + * @method PromiseInterface groupFindingsAsync(GroupFindingsRequest $request, array $optionalArgs = []) + * @method PromiseInterface listAssetsAsync(ListAssetsRequest $request, array $optionalArgs = []) + * @method PromiseInterface listAttackPathsAsync(ListAttackPathsRequest $request, array $optionalArgs = []) + * @method PromiseInterface listBigQueryExportsAsync(ListBigQueryExportsRequest $request, array $optionalArgs = []) + * @method PromiseInterface listDescendantEventThreatDetectionCustomModulesAsync(ListDescendantEventThreatDetectionCustomModulesRequest $request, array $optionalArgs = []) + * @method PromiseInterface listDescendantSecurityHealthAnalyticsCustomModulesAsync(ListDescendantSecurityHealthAnalyticsCustomModulesRequest $request, array $optionalArgs = []) + * @method PromiseInterface listEffectiveEventThreatDetectionCustomModulesAsync(ListEffectiveEventThreatDetectionCustomModulesRequest $request, array $optionalArgs = []) + * @method PromiseInterface listEffectiveSecurityHealthAnalyticsCustomModulesAsync(ListEffectiveSecurityHealthAnalyticsCustomModulesRequest $request, array $optionalArgs = []) + * @method PromiseInterface listEventThreatDetectionCustomModulesAsync(ListEventThreatDetectionCustomModulesRequest $request, array $optionalArgs = []) + * @method PromiseInterface listFindingsAsync(ListFindingsRequest $request, array $optionalArgs = []) + * @method PromiseInterface listMuteConfigsAsync(ListMuteConfigsRequest $request, array $optionalArgs = []) + * @method PromiseInterface listNotificationConfigsAsync(ListNotificationConfigsRequest $request, array $optionalArgs = []) + * @method PromiseInterface listResourceValueConfigsAsync(ListResourceValueConfigsRequest $request, array $optionalArgs = []) + * @method PromiseInterface listSecurityHealthAnalyticsCustomModulesAsync(ListSecurityHealthAnalyticsCustomModulesRequest $request, array $optionalArgs = []) + * @method PromiseInterface listSourcesAsync(ListSourcesRequest $request, array $optionalArgs = []) + * @method PromiseInterface listValuedResourcesAsync(ListValuedResourcesRequest $request, array $optionalArgs = []) + * @method PromiseInterface runAssetDiscoveryAsync(RunAssetDiscoveryRequest $request, array $optionalArgs = []) + * @method PromiseInterface setFindingStateAsync(SetFindingStateRequest $request, array $optionalArgs = []) + * @method PromiseInterface setIamPolicyAsync(SetIamPolicyRequest $request, array $optionalArgs = []) + * @method PromiseInterface setMuteAsync(SetMuteRequest $request, array $optionalArgs = []) + * @method PromiseInterface simulateSecurityHealthAnalyticsCustomModuleAsync(SimulateSecurityHealthAnalyticsCustomModuleRequest $request, array $optionalArgs = []) + * @method PromiseInterface testIamPermissionsAsync(TestIamPermissionsRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateBigQueryExportAsync(UpdateBigQueryExportRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateEventThreatDetectionCustomModuleAsync(UpdateEventThreatDetectionCustomModuleRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateExternalSystemAsync(UpdateExternalSystemRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateFindingAsync(UpdateFindingRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateMuteConfigAsync(UpdateMuteConfigRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateNotificationConfigAsync(UpdateNotificationConfigRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateOrganizationSettingsAsync(UpdateOrganizationSettingsRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateResourceValueConfigAsync(UpdateResourceValueConfigRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateSecurityHealthAnalyticsCustomModuleAsync(UpdateSecurityHealthAnalyticsCustomModuleRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateSecurityMarksAsync(UpdateSecurityMarksRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateSourceAsync(UpdateSourceRequest $request, array $optionalArgs = []) + * @method PromiseInterface validateEventThreatDetectionCustomModuleAsync(ValidateEventThreatDetectionCustomModuleRequest $request, array $optionalArgs = []) + */ +interface SecurityCenterClientInterface +{ + /** + * Return an OperationsClient object with the same endpoint as $this. + * + * @return OperationsClient + */ + public function getOperationsClient(); + + /** + * Resume an existing long running operation that was previously started by a long + * running API method. If $methodName is not provided, or does not match a long + * running API method, then the operation can still be resumed, but the + * OperationResponse object will not deserialize the final response. + * + * @param string $operationName The name of the long running operation + * @param string $methodName The name of the method used to start the operation + * + * @return OperationResponse + */ + public function resumeOperation($operationName, $methodName = null); + + /** + * Creates a ResourceValueConfig for an organization. Maps user's tags to + * difference resource values for use by the attack path simulation. + * + * The async variant is + * {@see SecurityCenterClient::batchCreateResourceValueConfigsAsync()} . + * + * @example samples/V1/SecurityCenterClient/batch_create_resource_value_configs.php + * + * @param BatchCreateResourceValueConfigsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return BatchCreateResourceValueConfigsResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function batchCreateResourceValueConfigs(BatchCreateResourceValueConfigsRequest $request, array $callOptions = []): BatchCreateResourceValueConfigsResponse; + + /** + * Kicks off an LRO to bulk mute findings for a parent based on a filter. The + * parent can be either an organization, folder or project. The findings + * matched by the filter will be muted after the LRO is done. + * + * The async variant is {@see SecurityCenterClient::bulkMuteFindingsAsync()} . + * + * @example samples/V1/SecurityCenterClient/bulk_mute_findings.php + * + * @param BulkMuteFindingsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function bulkMuteFindings(BulkMuteFindingsRequest $request, array $callOptions = []): OperationResponse; + + /** + * Creates a BigQuery export. + * + * The async variant is {@see SecurityCenterClient::createBigQueryExportAsync()} . + * + * @example samples/V1/SecurityCenterClient/create_big_query_export.php + * + * @param CreateBigQueryExportRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return BigQueryExport + * + * @throws ApiException Thrown if the API call fails. + */ + public function createBigQueryExport(CreateBigQueryExportRequest $request, array $callOptions = []): BigQueryExport; + + /** + * Creates a resident Event Threat Detection custom module at the scope of the + * given Resource Manager parent, and also creates inherited custom modules + * for all descendants of the given parent. These modules are enabled by + * default. + * + * The async variant is + * {@see SecurityCenterClient::createEventThreatDetectionCustomModuleAsync()} . + * + * @example samples/V1/SecurityCenterClient/create_event_threat_detection_custom_module.php + * + * @param CreateEventThreatDetectionCustomModuleRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return EventThreatDetectionCustomModule + * + * @throws ApiException Thrown if the API call fails. + */ + public function createEventThreatDetectionCustomModule(CreateEventThreatDetectionCustomModuleRequest $request, array $callOptions = []): EventThreatDetectionCustomModule; + + /** + * Creates a finding. The corresponding source must exist for finding creation + * to succeed. + * + * The async variant is {@see SecurityCenterClient::createFindingAsync()} . + * + * @example samples/V1/SecurityCenterClient/create_finding.php + * + * @param CreateFindingRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Finding + * + * @throws ApiException Thrown if the API call fails. + */ + public function createFinding(CreateFindingRequest $request, array $callOptions = []): Finding; + + /** + * Creates a mute config. + * + * The async variant is {@see SecurityCenterClient::createMuteConfigAsync()} . + * + * @example samples/V1/SecurityCenterClient/create_mute_config.php + * + * @param CreateMuteConfigRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return MuteConfig + * + * @throws ApiException Thrown if the API call fails. + */ + public function createMuteConfig(CreateMuteConfigRequest $request, array $callOptions = []): MuteConfig; + + /** + * Creates a notification config. + * + * The async variant is + * {@see SecurityCenterClient::createNotificationConfigAsync()} . + * + * @example samples/V1/SecurityCenterClient/create_notification_config.php + * + * @param CreateNotificationConfigRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return NotificationConfig + * + * @throws ApiException Thrown if the API call fails. + */ + public function createNotificationConfig(CreateNotificationConfigRequest $request, array $callOptions = []): NotificationConfig; + + /** + * Creates a resident SecurityHealthAnalyticsCustomModule at the scope of the + * given CRM parent, and also creates inherited + * SecurityHealthAnalyticsCustomModules for all CRM descendants of the given + * parent. These modules are enabled by default. + * + * The async variant is + * {@see SecurityCenterClient::createSecurityHealthAnalyticsCustomModuleAsync()} . + * + * @example samples/V1/SecurityCenterClient/create_security_health_analytics_custom_module.php + * + * @param CreateSecurityHealthAnalyticsCustomModuleRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return SecurityHealthAnalyticsCustomModule + * + * @throws ApiException Thrown if the API call fails. + */ + public function createSecurityHealthAnalyticsCustomModule(CreateSecurityHealthAnalyticsCustomModuleRequest $request, array $callOptions = []): SecurityHealthAnalyticsCustomModule; + + /** + * Creates a source. + * + * The async variant is {@see SecurityCenterClient::createSourceAsync()} . + * + * @example samples/V1/SecurityCenterClient/create_source.php + * + * @param CreateSourceRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Source + * + * @throws ApiException Thrown if the API call fails. + */ + public function createSource(CreateSourceRequest $request, array $callOptions = []): Source; + + /** + * Deletes an existing BigQuery export. + * + * The async variant is {@see SecurityCenterClient::deleteBigQueryExportAsync()} . + * + * @example samples/V1/SecurityCenterClient/delete_big_query_export.php + * + * @param DeleteBigQueryExportRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteBigQueryExport(DeleteBigQueryExportRequest $request, array $callOptions = []): void; + + /** + * Deletes the specified Event Threat Detection custom module and all of its + * descendants in the Resource Manager hierarchy. This method is only + * supported for resident custom modules. + * + * The async variant is + * {@see SecurityCenterClient::deleteEventThreatDetectionCustomModuleAsync()} . + * + * @example samples/V1/SecurityCenterClient/delete_event_threat_detection_custom_module.php + * + * @param DeleteEventThreatDetectionCustomModuleRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteEventThreatDetectionCustomModule(DeleteEventThreatDetectionCustomModuleRequest $request, array $callOptions = []): void; + + /** + * Deletes an existing mute config. + * + * The async variant is {@see SecurityCenterClient::deleteMuteConfigAsync()} . + * + * @example samples/V1/SecurityCenterClient/delete_mute_config.php + * + * @param DeleteMuteConfigRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteMuteConfig(DeleteMuteConfigRequest $request, array $callOptions = []): void; + + /** + * Deletes a notification config. + * + * The async variant is + * {@see SecurityCenterClient::deleteNotificationConfigAsync()} . + * + * @example samples/V1/SecurityCenterClient/delete_notification_config.php + * + * @param DeleteNotificationConfigRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteNotificationConfig(DeleteNotificationConfigRequest $request, array $callOptions = []): void; + + /** + * Deletes a ResourceValueConfig. + * + * The async variant is + * {@see SecurityCenterClient::deleteResourceValueConfigAsync()} . + * + * @example samples/V1/SecurityCenterClient/delete_resource_value_config.php + * + * @param DeleteResourceValueConfigRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteResourceValueConfig(DeleteResourceValueConfigRequest $request, array $callOptions = []): void; + + /** + * Deletes the specified SecurityHealthAnalyticsCustomModule and all of its + * descendants in the CRM hierarchy. This method is only supported for + * resident custom modules. + * + * The async variant is + * {@see SecurityCenterClient::deleteSecurityHealthAnalyticsCustomModuleAsync()} . + * + * @example samples/V1/SecurityCenterClient/delete_security_health_analytics_custom_module.php + * + * @param DeleteSecurityHealthAnalyticsCustomModuleRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteSecurityHealthAnalyticsCustomModule(DeleteSecurityHealthAnalyticsCustomModuleRequest $request, array $callOptions = []): void; + + /** + * Gets a BigQuery export. + * + * The async variant is {@see SecurityCenterClient::getBigQueryExportAsync()} . + * + * @example samples/V1/SecurityCenterClient/get_big_query_export.php + * + * @param GetBigQueryExportRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return BigQueryExport + * + * @throws ApiException Thrown if the API call fails. + */ + public function getBigQueryExport(GetBigQueryExportRequest $request, array $callOptions = []): BigQueryExport; + + /** + * Gets an effective Event Threat Detection custom module at the given level. + * + * The async variant is + * {@see SecurityCenterClient::getEffectiveEventThreatDetectionCustomModuleAsync()} + * . + * + * @example samples/V1/SecurityCenterClient/get_effective_event_threat_detection_custom_module.php + * + * @param GetEffectiveEventThreatDetectionCustomModuleRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return EffectiveEventThreatDetectionCustomModule + * + * @throws ApiException Thrown if the API call fails. + */ + public function getEffectiveEventThreatDetectionCustomModule(GetEffectiveEventThreatDetectionCustomModuleRequest $request, array $callOptions = []): EffectiveEventThreatDetectionCustomModule; + + /** + * Retrieves an EffectiveSecurityHealthAnalyticsCustomModule. + * + * The async variant is + * {@see SecurityCenterClient::getEffectiveSecurityHealthAnalyticsCustomModuleAsync()} + * . + * + * @example samples/V1/SecurityCenterClient/get_effective_security_health_analytics_custom_module.php + * + * @param GetEffectiveSecurityHealthAnalyticsCustomModuleRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return EffectiveSecurityHealthAnalyticsCustomModule + * + * @throws ApiException Thrown if the API call fails. + */ + public function getEffectiveSecurityHealthAnalyticsCustomModule(GetEffectiveSecurityHealthAnalyticsCustomModuleRequest $request, array $callOptions = []): EffectiveSecurityHealthAnalyticsCustomModule; + + /** + * Gets an Event Threat Detection custom module. + * + * The async variant is + * {@see SecurityCenterClient::getEventThreatDetectionCustomModuleAsync()} . + * + * @example samples/V1/SecurityCenterClient/get_event_threat_detection_custom_module.php + * + * @param GetEventThreatDetectionCustomModuleRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return EventThreatDetectionCustomModule + * + * @throws ApiException Thrown if the API call fails. + */ + public function getEventThreatDetectionCustomModule(GetEventThreatDetectionCustomModuleRequest $request, array $callOptions = []): EventThreatDetectionCustomModule; + + /** + * Gets the access control policy on the specified Source. + * + * The async variant is {@see SecurityCenterClient::getIamPolicyAsync()} . + * + * @example samples/V1/SecurityCenterClient/get_iam_policy.php + * + * @param GetIamPolicyRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Policy + * + * @throws ApiException Thrown if the API call fails. + */ + public function getIamPolicy(GetIamPolicyRequest $request, array $callOptions = []): Policy; + + /** + * Gets a mute config. + * + * The async variant is {@see SecurityCenterClient::getMuteConfigAsync()} . + * + * @example samples/V1/SecurityCenterClient/get_mute_config.php + * + * @param GetMuteConfigRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return MuteConfig + * + * @throws ApiException Thrown if the API call fails. + */ + public function getMuteConfig(GetMuteConfigRequest $request, array $callOptions = []): MuteConfig; + + /** + * Gets a notification config. + * + * The async variant is {@see SecurityCenterClient::getNotificationConfigAsync()} . + * + * @example samples/V1/SecurityCenterClient/get_notification_config.php + * + * @param GetNotificationConfigRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return NotificationConfig + * + * @throws ApiException Thrown if the API call fails. + */ + public function getNotificationConfig(GetNotificationConfigRequest $request, array $callOptions = []): NotificationConfig; + + /** + * Gets the settings for an organization. + * + * The async variant is {@see SecurityCenterClient::getOrganizationSettingsAsync()} + * . + * + * @example samples/V1/SecurityCenterClient/get_organization_settings.php + * + * @param GetOrganizationSettingsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OrganizationSettings + * + * @throws ApiException Thrown if the API call fails. + */ + public function getOrganizationSettings(GetOrganizationSettingsRequest $request, array $callOptions = []): OrganizationSettings; + + /** + * Gets a ResourceValueConfig. + * + * The async variant is {@see SecurityCenterClient::getResourceValueConfigAsync()} + * . + * + * @example samples/V1/SecurityCenterClient/get_resource_value_config.php + * + * @param GetResourceValueConfigRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return ResourceValueConfig + * + * @throws ApiException Thrown if the API call fails. + */ + public function getResourceValueConfig(GetResourceValueConfigRequest $request, array $callOptions = []): ResourceValueConfig; + + /** + * Retrieves a SecurityHealthAnalyticsCustomModule. + * + * The async variant is + * {@see SecurityCenterClient::getSecurityHealthAnalyticsCustomModuleAsync()} . + * + * @example samples/V1/SecurityCenterClient/get_security_health_analytics_custom_module.php + * + * @param GetSecurityHealthAnalyticsCustomModuleRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return SecurityHealthAnalyticsCustomModule + * + * @throws ApiException Thrown if the API call fails. + */ + public function getSecurityHealthAnalyticsCustomModule(GetSecurityHealthAnalyticsCustomModuleRequest $request, array $callOptions = []): SecurityHealthAnalyticsCustomModule; + + /** + * Get the simulation by name or the latest simulation for the given + * organization. + * + * The async variant is {@see SecurityCenterClient::getSimulationAsync()} . + * + * @example samples/V1/SecurityCenterClient/get_simulation.php + * + * @param GetSimulationRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Simulation + * + * @throws ApiException Thrown if the API call fails. + */ + public function getSimulation(GetSimulationRequest $request, array $callOptions = []): Simulation; + + /** + * Gets a source. + * + * The async variant is {@see SecurityCenterClient::getSourceAsync()} . + * + * @example samples/V1/SecurityCenterClient/get_source.php + * + * @param GetSourceRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Source + * + * @throws ApiException Thrown if the API call fails. + */ + public function getSource(GetSourceRequest $request, array $callOptions = []): Source; + + /** + * Get the valued resource by name + * + * The async variant is {@see SecurityCenterClient::getValuedResourceAsync()} . + * + * @example samples/V1/SecurityCenterClient/get_valued_resource.php + * + * @param GetValuedResourceRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return ValuedResource + * + * @throws ApiException Thrown if the API call fails. + */ + public function getValuedResource(GetValuedResourceRequest $request, array $callOptions = []): ValuedResource; + + /** + * Filters an organization's assets and groups them by their specified + * properties. + * + * The async variant is {@see SecurityCenterClient::groupAssetsAsync()} . + * + * @example samples/V1/SecurityCenterClient/group_assets.php + * + * @param GroupAssetsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + * + * @deprecated This method will be removed in the next major version update. + */ + public function groupAssets(GroupAssetsRequest $request, array $callOptions = []): PagedListResponse; + + /** + * Filters an organization or source's findings and groups them by their + * specified properties. + * + * To group across all sources provide a `-` as the source id. + * Example: /v1/organizations/{organization_id}/sources/-/findings, + * /v1/folders/{folder_id}/sources/-/findings, + * /v1/projects/{project_id}/sources/-/findings + * + * The async variant is {@see SecurityCenterClient::groupFindingsAsync()} . + * + * @example samples/V1/SecurityCenterClient/group_findings.php + * + * @param GroupFindingsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function groupFindings(GroupFindingsRequest $request, array $callOptions = []): PagedListResponse; + + /** + * Lists an organization's assets. + * + * The async variant is {@see SecurityCenterClient::listAssetsAsync()} . + * + * @example samples/V1/SecurityCenterClient/list_assets.php + * + * @param ListAssetsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + * + * @deprecated This method will be removed in the next major version update. + */ + public function listAssets(ListAssetsRequest $request, array $callOptions = []): PagedListResponse; + + /** + * Lists the attack paths for a set of simulation results or valued resources + * and filter. + * + * The async variant is {@see SecurityCenterClient::listAttackPathsAsync()} . + * + * @example samples/V1/SecurityCenterClient/list_attack_paths.php + * + * @param ListAttackPathsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listAttackPaths(ListAttackPathsRequest $request, array $callOptions = []): PagedListResponse; + + /** + * Lists BigQuery exports. Note that when requesting BigQuery exports at a + * given level all exports under that level are also returned e.g. if + * requesting BigQuery exports under a folder, then all BigQuery exports + * immediately under the folder plus the ones created under the projects + * within the folder are returned. + * + * The async variant is {@see SecurityCenterClient::listBigQueryExportsAsync()} . + * + * @example samples/V1/SecurityCenterClient/list_big_query_exports.php + * + * @param ListBigQueryExportsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listBigQueryExports(ListBigQueryExportsRequest $request, array $callOptions = []): PagedListResponse; + + /** + * Lists all resident Event Threat Detection custom modules under the + * given Resource Manager parent and its descendants. + * + * The async variant is + * {@see SecurityCenterClient::listDescendantEventThreatDetectionCustomModulesAsync()} + * . + * + * @example samples/V1/SecurityCenterClient/list_descendant_event_threat_detection_custom_modules.php + * + * @param ListDescendantEventThreatDetectionCustomModulesRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listDescendantEventThreatDetectionCustomModules(ListDescendantEventThreatDetectionCustomModulesRequest $request, array $callOptions = []): PagedListResponse; + + /** + * Returns a list of all resident SecurityHealthAnalyticsCustomModules under + * the given CRM parent and all of the parent’s CRM descendants. + * + * The async variant is + * {@see SecurityCenterClient::listDescendantSecurityHealthAnalyticsCustomModulesAsync()} + * . + * + * @example samples/V1/SecurityCenterClient/list_descendant_security_health_analytics_custom_modules.php + * + * @param ListDescendantSecurityHealthAnalyticsCustomModulesRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listDescendantSecurityHealthAnalyticsCustomModules(ListDescendantSecurityHealthAnalyticsCustomModulesRequest $request, array $callOptions = []): PagedListResponse; + + /** + * Lists all effective Event Threat Detection custom modules for the + * given parent. This includes resident modules defined at the scope of the + * parent along with modules inherited from its ancestors. + * + * The async variant is + * {@see SecurityCenterClient::listEffectiveEventThreatDetectionCustomModulesAsync()} + * . + * + * @example samples/V1/SecurityCenterClient/list_effective_event_threat_detection_custom_modules.php + * + * @param ListEffectiveEventThreatDetectionCustomModulesRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listEffectiveEventThreatDetectionCustomModules(ListEffectiveEventThreatDetectionCustomModulesRequest $request, array $callOptions = []): PagedListResponse; + + /** + * Returns a list of all EffectiveSecurityHealthAnalyticsCustomModules for the + * given parent. This includes resident modules defined at the scope of the + * parent, and inherited modules, inherited from CRM ancestors. + * + * The async variant is + * {@see SecurityCenterClient::listEffectiveSecurityHealthAnalyticsCustomModulesAsync()} + * . + * + * @example samples/V1/SecurityCenterClient/list_effective_security_health_analytics_custom_modules.php + * + * @param ListEffectiveSecurityHealthAnalyticsCustomModulesRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listEffectiveSecurityHealthAnalyticsCustomModules(ListEffectiveSecurityHealthAnalyticsCustomModulesRequest $request, array $callOptions = []): PagedListResponse; + + /** + * Lists all Event Threat Detection custom modules for the given + * Resource Manager parent. This includes resident modules defined at the + * scope of the parent along with modules inherited from ancestors. + * + * The async variant is + * {@see SecurityCenterClient::listEventThreatDetectionCustomModulesAsync()} . + * + * @example samples/V1/SecurityCenterClient/list_event_threat_detection_custom_modules.php + * + * @param ListEventThreatDetectionCustomModulesRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listEventThreatDetectionCustomModules(ListEventThreatDetectionCustomModulesRequest $request, array $callOptions = []): PagedListResponse; + + /** + * Lists an organization or source's findings. + * + * To list across all sources provide a `-` as the source id. + * Example: /v1/organizations/{organization_id}/sources/-/findings + * + * The async variant is {@see SecurityCenterClient::listFindingsAsync()} . + * + * @example samples/V1/SecurityCenterClient/list_findings.php + * + * @param ListFindingsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listFindings(ListFindingsRequest $request, array $callOptions = []): PagedListResponse; + + /** + * Lists mute configs. + * + * The async variant is {@see SecurityCenterClient::listMuteConfigsAsync()} . + * + * @example samples/V1/SecurityCenterClient/list_mute_configs.php + * + * @param ListMuteConfigsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listMuteConfigs(ListMuteConfigsRequest $request, array $callOptions = []): PagedListResponse; + + /** + * Lists notification configs. + * + * The async variant is {@see SecurityCenterClient::listNotificationConfigsAsync()} + * . + * + * @example samples/V1/SecurityCenterClient/list_notification_configs.php + * + * @param ListNotificationConfigsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listNotificationConfigs(ListNotificationConfigsRequest $request, array $callOptions = []): PagedListResponse; + + /** + * Lists all ResourceValueConfigs. + * + * The async variant is + * {@see SecurityCenterClient::listResourceValueConfigsAsync()} . + * + * @example samples/V1/SecurityCenterClient/list_resource_value_configs.php + * + * @param ListResourceValueConfigsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listResourceValueConfigs(ListResourceValueConfigsRequest $request, array $callOptions = []): PagedListResponse; + + /** + * Returns a list of all SecurityHealthAnalyticsCustomModules for the given + * parent. This includes resident modules defined at the scope of the parent, + * and inherited modules, inherited from CRM ancestors. + * + * The async variant is + * {@see SecurityCenterClient::listSecurityHealthAnalyticsCustomModulesAsync()} . + * + * @example samples/V1/SecurityCenterClient/list_security_health_analytics_custom_modules.php + * + * @param ListSecurityHealthAnalyticsCustomModulesRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listSecurityHealthAnalyticsCustomModules(ListSecurityHealthAnalyticsCustomModulesRequest $request, array $callOptions = []): PagedListResponse; + + /** + * Lists all sources belonging to an organization. + * + * The async variant is {@see SecurityCenterClient::listSourcesAsync()} . + * + * @example samples/V1/SecurityCenterClient/list_sources.php + * + * @param ListSourcesRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listSources(ListSourcesRequest $request, array $callOptions = []): PagedListResponse; + + /** + * Lists the valued resources for a set of simulation results and filter. + * + * The async variant is {@see SecurityCenterClient::listValuedResourcesAsync()} . + * + * @example samples/V1/SecurityCenterClient/list_valued_resources.php + * + * @param ListValuedResourcesRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listValuedResources(ListValuedResourcesRequest $request, array $callOptions = []): PagedListResponse; + + /** + * Runs asset discovery. The discovery is tracked with a long-running + * operation. + * + * This API can only be called with limited frequency for an organization. If + * it is called too frequently the caller will receive a TOO_MANY_REQUESTS + * error. + * + * The async variant is {@see SecurityCenterClient::runAssetDiscoveryAsync()} . + * + * @example samples/V1/SecurityCenterClient/run_asset_discovery.php + * + * @param RunAssetDiscoveryRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + * + * @deprecated This method will be removed in the next major version update. + */ + public function runAssetDiscovery(RunAssetDiscoveryRequest $request, array $callOptions = []): OperationResponse; + + /** + * Updates the state of a finding. + * + * The async variant is {@see SecurityCenterClient::setFindingStateAsync()} . + * + * @example samples/V1/SecurityCenterClient/set_finding_state.php + * + * @param SetFindingStateRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Finding + * + * @throws ApiException Thrown if the API call fails. + */ + public function setFindingState(SetFindingStateRequest $request, array $callOptions = []): Finding; + + /** + * Sets the access control policy on the specified Source. + * + * The async variant is {@see SecurityCenterClient::setIamPolicyAsync()} . + * + * @example samples/V1/SecurityCenterClient/set_iam_policy.php + * + * @param SetIamPolicyRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Policy + * + * @throws ApiException Thrown if the API call fails. + */ + public function setIamPolicy(SetIamPolicyRequest $request, array $callOptions = []): Policy; + + /** + * Updates the mute state of a finding. + * + * The async variant is {@see SecurityCenterClient::setMuteAsync()} . + * + * @example samples/V1/SecurityCenterClient/set_mute.php + * + * @param SetMuteRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Finding + * + * @throws ApiException Thrown if the API call fails. + */ + public function setMute(SetMuteRequest $request, array $callOptions = []): Finding; + + /** + * Simulates a given SecurityHealthAnalyticsCustomModule and Resource. + * + * The async variant is + * {@see SecurityCenterClient::simulateSecurityHealthAnalyticsCustomModuleAsync()} + * . + * + * @example samples/V1/SecurityCenterClient/simulate_security_health_analytics_custom_module.php + * + * @param SimulateSecurityHealthAnalyticsCustomModuleRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return SimulateSecurityHealthAnalyticsCustomModuleResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function simulateSecurityHealthAnalyticsCustomModule(SimulateSecurityHealthAnalyticsCustomModuleRequest $request, array $callOptions = []): SimulateSecurityHealthAnalyticsCustomModuleResponse; + + /** + * Returns the permissions that a caller has on the specified source. + * + * The async variant is {@see SecurityCenterClient::testIamPermissionsAsync()} . + * + * @example samples/V1/SecurityCenterClient/test_iam_permissions.php + * + * @param TestIamPermissionsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return TestIamPermissionsResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function testIamPermissions(TestIamPermissionsRequest $request, array $callOptions = []): TestIamPermissionsResponse; + + /** + * Updates a BigQuery export. + * + * The async variant is {@see SecurityCenterClient::updateBigQueryExportAsync()} . + * + * @example samples/V1/SecurityCenterClient/update_big_query_export.php + * + * @param UpdateBigQueryExportRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return BigQueryExport + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateBigQueryExport(UpdateBigQueryExportRequest $request, array $callOptions = []): BigQueryExport; + + /** + * Updates the Event Threat Detection custom module with the given name based + * on the given update mask. Updating the enablement state is supported for + * both resident and inherited modules (though resident modules cannot have an + * enablement state of "inherited"). Updating the display name or + * configuration of a module is supported for resident modules only. The type + * of a module cannot be changed. + * + * The async variant is + * {@see SecurityCenterClient::updateEventThreatDetectionCustomModuleAsync()} . + * + * @example samples/V1/SecurityCenterClient/update_event_threat_detection_custom_module.php + * + * @param UpdateEventThreatDetectionCustomModuleRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return EventThreatDetectionCustomModule + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateEventThreatDetectionCustomModule(UpdateEventThreatDetectionCustomModuleRequest $request, array $callOptions = []): EventThreatDetectionCustomModule; + + /** + * Updates external system. This is for a given finding. + * + * The async variant is {@see SecurityCenterClient::updateExternalSystemAsync()} . + * + * @example samples/V1/SecurityCenterClient/update_external_system.php + * + * @param UpdateExternalSystemRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return ExternalSystem + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateExternalSystem(UpdateExternalSystemRequest $request, array $callOptions = []): ExternalSystem; + + /** + * Creates or updates a finding. The corresponding source must exist for a + * finding creation to succeed. + * + * The async variant is {@see SecurityCenterClient::updateFindingAsync()} . + * + * @example samples/V1/SecurityCenterClient/update_finding.php + * + * @param UpdateFindingRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Finding + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateFinding(UpdateFindingRequest $request, array $callOptions = []): Finding; + + /** + * Updates a mute config. + * + * The async variant is {@see SecurityCenterClient::updateMuteConfigAsync()} . + * + * @example samples/V1/SecurityCenterClient/update_mute_config.php + * + * @param UpdateMuteConfigRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return MuteConfig + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateMuteConfig(UpdateMuteConfigRequest $request, array $callOptions = []): MuteConfig; + + /** + * + * Updates a notification config. The following update + * fields are allowed: description, pubsub_topic, streaming_config.filter + * + * The async variant is + * {@see SecurityCenterClient::updateNotificationConfigAsync()} . + * + * @example samples/V1/SecurityCenterClient/update_notification_config.php + * + * @param UpdateNotificationConfigRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return NotificationConfig + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateNotificationConfig(UpdateNotificationConfigRequest $request, array $callOptions = []): NotificationConfig; + + /** + * Updates an organization's settings. + * + * The async variant is + * {@see SecurityCenterClient::updateOrganizationSettingsAsync()} . + * + * @example samples/V1/SecurityCenterClient/update_organization_settings.php + * + * @param UpdateOrganizationSettingsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OrganizationSettings + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateOrganizationSettings(UpdateOrganizationSettingsRequest $request, array $callOptions = []): OrganizationSettings; + + /** + * Updates an existing ResourceValueConfigs with new rules. + * + * The async variant is + * {@see SecurityCenterClient::updateResourceValueConfigAsync()} . + * + * @example samples/V1/SecurityCenterClient/update_resource_value_config.php + * + * @param UpdateResourceValueConfigRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return ResourceValueConfig + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateResourceValueConfig(UpdateResourceValueConfigRequest $request, array $callOptions = []): ResourceValueConfig; + + /** + * Updates the SecurityHealthAnalyticsCustomModule under the given name based + * on the given update mask. Updating the enablement state is supported on + * both resident and inherited modules (though resident modules cannot have an + * enablement state of "inherited"). Updating the display name and custom + * config of a module is supported on resident modules only. + * + * The async variant is + * {@see SecurityCenterClient::updateSecurityHealthAnalyticsCustomModuleAsync()} . + * + * @example samples/V1/SecurityCenterClient/update_security_health_analytics_custom_module.php + * + * @param UpdateSecurityHealthAnalyticsCustomModuleRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return SecurityHealthAnalyticsCustomModule + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateSecurityHealthAnalyticsCustomModule(UpdateSecurityHealthAnalyticsCustomModuleRequest $request, array $callOptions = []): SecurityHealthAnalyticsCustomModule; + + /** + * Updates security marks. + * + * The async variant is {@see SecurityCenterClient::updateSecurityMarksAsync()} . + * + * @example samples/V1/SecurityCenterClient/update_security_marks.php + * + * @param UpdateSecurityMarksRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return SecurityMarks + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateSecurityMarks(UpdateSecurityMarksRequest $request, array $callOptions = []): SecurityMarks; + + /** + * Updates a source. + * + * The async variant is {@see SecurityCenterClient::updateSourceAsync()} . + * + * @example samples/V1/SecurityCenterClient/update_source.php + * + * @param UpdateSourceRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Source + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateSource(UpdateSourceRequest $request, array $callOptions = []): Source; + + /** + * Validates the given Event Threat Detection custom module. + * + * The async variant is + * {@see SecurityCenterClient::validateEventThreatDetectionCustomModuleAsync()} . + * + * @example samples/V1/SecurityCenterClient/validate_event_threat_detection_custom_module.php + * + * @param ValidateEventThreatDetectionCustomModuleRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return ValidateEventThreatDetectionCustomModuleResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function validateEventThreatDetectionCustomModule(ValidateEventThreatDetectionCustomModuleRequest $request, array $callOptions = []): ValidateEventThreatDetectionCustomModuleResponse; +} diff --git a/tests/Integration/goldens/spanner/src/V1/Client/DatabaseAdminClient.php b/tests/Integration/goldens/spanner/src/V1/Client/DatabaseAdminClient.php index 09933924e..853bf34fe 100644 --- a/tests/Integration/goldens/spanner/src/V1/Client/DatabaseAdminClient.php +++ b/tests/Integration/goldens/spanner/src/V1/Client/DatabaseAdminClient.php @@ -128,7 +128,7 @@ * @method PromiseInterface updateDatabaseAsync(UpdateDatabaseRequest $request, array $optionalArgs = []) * @method PromiseInterface updateDatabaseDdlAsync(UpdateDatabaseDdlRequest $request, array $optionalArgs = []) */ -final class DatabaseAdminClient +final class DatabaseAdminClient implements DatabaseAdminClientInterface { use GapicClientTrait; use ResourceHelperTrait; diff --git a/tests/Integration/goldens/spanner/src/V1/Client/DatabaseAdminClientInterface.php b/tests/Integration/goldens/spanner/src/V1/Client/DatabaseAdminClientInterface.php new file mode 100644 index 000000000..097d26dde --- /dev/null +++ b/tests/Integration/goldens/spanner/src/V1/Client/DatabaseAdminClientInterface.php @@ -0,0 +1,891 @@ + addSplitPointsAsync(AddSplitPointsRequest $request, array $optionalArgs = []) + * @method PromiseInterface copyBackupAsync(CopyBackupRequest $request, array $optionalArgs = []) + * @method PromiseInterface createBackupAsync(CreateBackupRequest $request, array $optionalArgs = []) + * @method PromiseInterface createBackupScheduleAsync(CreateBackupScheduleRequest $request, array $optionalArgs = []) + * @method PromiseInterface createDatabaseAsync(CreateDatabaseRequest $request, array $optionalArgs = []) + * @method PromiseInterface deleteBackupAsync(DeleteBackupRequest $request, array $optionalArgs = []) + * @method PromiseInterface deleteBackupScheduleAsync(DeleteBackupScheduleRequest $request, array $optionalArgs = []) + * @method PromiseInterface dropDatabaseAsync(DropDatabaseRequest $request, array $optionalArgs = []) + * @method PromiseInterface getBackupAsync(GetBackupRequest $request, array $optionalArgs = []) + * @method PromiseInterface getBackupScheduleAsync(GetBackupScheduleRequest $request, array $optionalArgs = []) + * @method PromiseInterface getDatabaseAsync(GetDatabaseRequest $request, array $optionalArgs = []) + * @method PromiseInterface getDatabaseDdlAsync(GetDatabaseDdlRequest $request, array $optionalArgs = []) + * @method PromiseInterface getIamPolicyAsync(GetIamPolicyRequest $request, array $optionalArgs = []) + * @method PromiseInterface internalUpdateGraphOperationAsync(InternalUpdateGraphOperationRequest $request, array $optionalArgs = []) + * @method PromiseInterface listBackupOperationsAsync(ListBackupOperationsRequest $request, array $optionalArgs = []) + * @method PromiseInterface listBackupSchedulesAsync(ListBackupSchedulesRequest $request, array $optionalArgs = []) + * @method PromiseInterface listBackupsAsync(ListBackupsRequest $request, array $optionalArgs = []) + * @method PromiseInterface listDatabaseOperationsAsync(ListDatabaseOperationsRequest $request, array $optionalArgs = []) + * @method PromiseInterface listDatabaseRolesAsync(ListDatabaseRolesRequest $request, array $optionalArgs = []) + * @method PromiseInterface listDatabasesAsync(ListDatabasesRequest $request, array $optionalArgs = []) + * @method PromiseInterface restoreDatabaseAsync(RestoreDatabaseRequest $request, array $optionalArgs = []) + * @method PromiseInterface setIamPolicyAsync(SetIamPolicyRequest $request, array $optionalArgs = []) + * @method PromiseInterface testIamPermissionsAsync(TestIamPermissionsRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateBackupAsync(UpdateBackupRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateBackupScheduleAsync(UpdateBackupScheduleRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateDatabaseAsync(UpdateDatabaseRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateDatabaseDdlAsync(UpdateDatabaseDdlRequest $request, array $optionalArgs = []) + */ +interface DatabaseAdminClientInterface +{ + /** + * Return an OperationsClient object with the same endpoint as $this. + * + * @return OperationsClient + */ + public function getOperationsClient(); + + /** + * Resume an existing long running operation that was previously started by a long + * running API method. If $methodName is not provided, or does not match a long + * running API method, then the operation can still be resumed, but the + * OperationResponse object will not deserialize the final response. + * + * @param string $operationName The name of the long running operation + * @param string $methodName The name of the method used to start the operation + * + * @return OperationResponse + */ + public function resumeOperation($operationName, $methodName = null); + + /** + * Adds split points to specified tables, indexes of a database. + * + * The async variant is {@see DatabaseAdminClient::addSplitPointsAsync()} . + * + * @example samples/V1/DatabaseAdminClient/add_split_points.php + * + * @param AddSplitPointsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return AddSplitPointsResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function addSplitPoints(AddSplitPointsRequest $request, array $callOptions = []): AddSplitPointsResponse; + + /** + * Starts copying a Cloud Spanner Backup. + * The returned backup [long-running operation][google.longrunning.Operation] + * will have a name of the format + * `projects//instances//backups//operations/` + * and can be used to track copying of the backup. The operation is associated + * with the destination backup. + * The [metadata][google.longrunning.Operation.metadata] field type is + * [CopyBackupMetadata][google.spanner.admin.database.v1.CopyBackupMetadata]. + * The [response][google.longrunning.Operation.response] field type is + * [Backup][google.spanner.admin.database.v1.Backup], if successful. + * Cancelling the returned operation will stop the copying and delete the + * destination backup. Concurrent CopyBackup requests can run on the same + * source backup. + * + * The async variant is {@see DatabaseAdminClient::copyBackupAsync()} . + * + * @example samples/V1/DatabaseAdminClient/copy_backup.php + * + * @param CopyBackupRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function copyBackup(CopyBackupRequest $request, array $callOptions = []): OperationResponse; + + /** + * Starts creating a new Cloud Spanner Backup. + * The returned backup [long-running operation][google.longrunning.Operation] + * will have a name of the format + * `projects//instances//backups//operations/` + * and can be used to track creation of the backup. The + * [metadata][google.longrunning.Operation.metadata] field type is + * [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata]. + * The [response][google.longrunning.Operation.response] field type is + * [Backup][google.spanner.admin.database.v1.Backup], if successful. + * Cancelling the returned operation will stop the creation and delete the + * backup. There can be only one pending backup creation per database. Backup + * creation of different databases can run concurrently. + * + * The async variant is {@see DatabaseAdminClient::createBackupAsync()} . + * + * @example samples/V1/DatabaseAdminClient/create_backup.php + * + * @param CreateBackupRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function createBackup(CreateBackupRequest $request, array $callOptions = []): OperationResponse; + + /** + * Creates a new backup schedule. + * + * The async variant is {@see DatabaseAdminClient::createBackupScheduleAsync()} . + * + * @example samples/V1/DatabaseAdminClient/create_backup_schedule.php + * + * @param CreateBackupScheduleRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return BackupSchedule + * + * @throws ApiException Thrown if the API call fails. + */ + public function createBackupSchedule(CreateBackupScheduleRequest $request, array $callOptions = []): BackupSchedule; + + /** + * Creates a new Cloud Spanner database and starts to prepare it for serving. + * The returned [long-running operation][google.longrunning.Operation] will + * have a name of the format `/operations/` and + * can be used to track preparation of the database. The + * [metadata][google.longrunning.Operation.metadata] field type is + * [CreateDatabaseMetadata][google.spanner.admin.database.v1.CreateDatabaseMetadata]. + * The [response][google.longrunning.Operation.response] field type is + * [Database][google.spanner.admin.database.v1.Database], if successful. + * + * The async variant is {@see DatabaseAdminClient::createDatabaseAsync()} . + * + * @example samples/V1/DatabaseAdminClient/create_database.php + * + * @param CreateDatabaseRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function createDatabase(CreateDatabaseRequest $request, array $callOptions = []): OperationResponse; + + /** + * Deletes a pending or completed + * [Backup][google.spanner.admin.database.v1.Backup]. + * + * The async variant is {@see DatabaseAdminClient::deleteBackupAsync()} . + * + * @example samples/V1/DatabaseAdminClient/delete_backup.php + * + * @param DeleteBackupRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteBackup(DeleteBackupRequest $request, array $callOptions = []): void; + + /** + * Deletes a backup schedule. + * + * The async variant is {@see DatabaseAdminClient::deleteBackupScheduleAsync()} . + * + * @example samples/V1/DatabaseAdminClient/delete_backup_schedule.php + * + * @param DeleteBackupScheduleRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteBackupSchedule(DeleteBackupScheduleRequest $request, array $callOptions = []): void; + + /** + * Drops (aka deletes) a Cloud Spanner database. + * Completed backups for the database will be retained according to their + * `expire_time`. + * Note: Cloud Spanner might continue to accept requests for a few seconds + * after the database has been deleted. + * + * The async variant is {@see DatabaseAdminClient::dropDatabaseAsync()} . + * + * @example samples/V1/DatabaseAdminClient/drop_database.php + * + * @param DropDatabaseRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function dropDatabase(DropDatabaseRequest $request, array $callOptions = []): void; + + /** + * Gets metadata on a pending or completed + * [Backup][google.spanner.admin.database.v1.Backup]. + * + * The async variant is {@see DatabaseAdminClient::getBackupAsync()} . + * + * @example samples/V1/DatabaseAdminClient/get_backup.php + * + * @param GetBackupRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Backup + * + * @throws ApiException Thrown if the API call fails. + */ + public function getBackup(GetBackupRequest $request, array $callOptions = []): Backup; + + /** + * Gets backup schedule for the input schedule name. + * + * The async variant is {@see DatabaseAdminClient::getBackupScheduleAsync()} . + * + * @example samples/V1/DatabaseAdminClient/get_backup_schedule.php + * + * @param GetBackupScheduleRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return BackupSchedule + * + * @throws ApiException Thrown if the API call fails. + */ + public function getBackupSchedule(GetBackupScheduleRequest $request, array $callOptions = []): BackupSchedule; + + /** + * Gets the state of a Cloud Spanner database. + * + * The async variant is {@see DatabaseAdminClient::getDatabaseAsync()} . + * + * @example samples/V1/DatabaseAdminClient/get_database.php + * + * @param GetDatabaseRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Database + * + * @throws ApiException Thrown if the API call fails. + */ + public function getDatabase(GetDatabaseRequest $request, array $callOptions = []): Database; + + /** + * Returns the schema of a Cloud Spanner database as a list of formatted + * DDL statements. This method does not show pending schema updates, those may + * be queried using the [Operations][google.longrunning.Operations] API. + * + * The async variant is {@see DatabaseAdminClient::getDatabaseDdlAsync()} . + * + * @example samples/V1/DatabaseAdminClient/get_database_ddl.php + * + * @param GetDatabaseDdlRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return GetDatabaseDdlResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function getDatabaseDdl(GetDatabaseDdlRequest $request, array $callOptions = []): GetDatabaseDdlResponse; + + /** + * Gets the access control policy for a database or backup resource. + * Returns an empty policy if a database or backup exists but does not have a + * policy set. + * + * Authorization requires `spanner.databases.getIamPolicy` permission on + * [resource][google.iam.v1.GetIamPolicyRequest.resource]. + * For backups, authorization requires `spanner.backups.getIamPolicy` + * permission on [resource][google.iam.v1.GetIamPolicyRequest.resource]. + * + * The async variant is {@see DatabaseAdminClient::getIamPolicyAsync()} . + * + * @example samples/V1/DatabaseAdminClient/get_iam_policy.php + * + * @param GetIamPolicyRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Policy + * + * @throws ApiException Thrown if the API call fails. + */ + public function getIamPolicy(GetIamPolicyRequest $request, array $callOptions = []): Policy; + + /** + * This is an internal API called by Spanner Graph jobs. You should never need + * to call this API directly. + * + * The async variant is + * {@see DatabaseAdminClient::internalUpdateGraphOperationAsync()} . + * + * @example samples/V1/DatabaseAdminClient/internal_update_graph_operation.php + * + * @param InternalUpdateGraphOperationRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return InternalUpdateGraphOperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function internalUpdateGraphOperation(InternalUpdateGraphOperationRequest $request, array $callOptions = []): InternalUpdateGraphOperationResponse; + + /** + * Lists the backup [long-running operations][google.longrunning.Operation] in + * the given instance. A backup operation has a name of the form + * `projects//instances//backups//operations/`. + * The long-running operation + * [metadata][google.longrunning.Operation.metadata] field type + * `metadata.type_url` describes the type of the metadata. Operations returned + * include those that have completed/failed/canceled within the last 7 days, + * and pending operations. Operations returned are ordered by + * `operation.metadata.value.progress.start_time` in descending order starting + * from the most recently started operation. + * + * The async variant is {@see DatabaseAdminClient::listBackupOperationsAsync()} . + * + * @example samples/V1/DatabaseAdminClient/list_backup_operations.php + * + * @param ListBackupOperationsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listBackupOperations(ListBackupOperationsRequest $request, array $callOptions = []): PagedListResponse; + + /** + * Lists all the backup schedules for the database. + * + * The async variant is {@see DatabaseAdminClient::listBackupSchedulesAsync()} . + * + * @example samples/V1/DatabaseAdminClient/list_backup_schedules.php + * + * @param ListBackupSchedulesRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listBackupSchedules(ListBackupSchedulesRequest $request, array $callOptions = []): PagedListResponse; + + /** + * Lists completed and pending backups. + * Backups returned are ordered by `create_time` in descending order, + * starting from the most recent `create_time`. + * + * The async variant is {@see DatabaseAdminClient::listBackupsAsync()} . + * + * @example samples/V1/DatabaseAdminClient/list_backups.php + * + * @param ListBackupsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listBackups(ListBackupsRequest $request, array $callOptions = []): PagedListResponse; + + /** + * Lists database [longrunning-operations][google.longrunning.Operation]. + * A database operation has a name of the form + * `projects//instances//databases//operations/`. + * The long-running operation + * [metadata][google.longrunning.Operation.metadata] field type + * `metadata.type_url` describes the type of the metadata. Operations returned + * include those that have completed/failed/canceled within the last 7 days, + * and pending operations. + * + * The async variant is {@see DatabaseAdminClient::listDatabaseOperationsAsync()} . + * + * @example samples/V1/DatabaseAdminClient/list_database_operations.php + * + * @param ListDatabaseOperationsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listDatabaseOperations(ListDatabaseOperationsRequest $request, array $callOptions = []): PagedListResponse; + + /** + * Lists Cloud Spanner database roles. + * + * The async variant is {@see DatabaseAdminClient::listDatabaseRolesAsync()} . + * + * @example samples/V1/DatabaseAdminClient/list_database_roles.php + * + * @param ListDatabaseRolesRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listDatabaseRoles(ListDatabaseRolesRequest $request, array $callOptions = []): PagedListResponse; + + /** + * Lists Cloud Spanner databases. + * + * The async variant is {@see DatabaseAdminClient::listDatabasesAsync()} . + * + * @example samples/V1/DatabaseAdminClient/list_databases.php + * + * @param ListDatabasesRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listDatabases(ListDatabasesRequest $request, array $callOptions = []): PagedListResponse; + + /** + * Create a new database by restoring from a completed backup. The new + * database must be in the same project and in an instance with the same + * instance configuration as the instance containing + * the backup. The returned database [long-running + * operation][google.longrunning.Operation] has a name of the format + * `projects//instances//databases//operations/`, + * and can be used to track the progress of the operation, and to cancel it. + * The [metadata][google.longrunning.Operation.metadata] field type is + * [RestoreDatabaseMetadata][google.spanner.admin.database.v1.RestoreDatabaseMetadata]. + * The [response][google.longrunning.Operation.response] type + * is [Database][google.spanner.admin.database.v1.Database], if + * successful. Cancelling the returned operation will stop the restore and + * delete the database. + * There can be only one database being restored into an instance at a time. + * Once the restore operation completes, a new restore operation can be + * initiated, without waiting for the optimize operation associated with the + * first restore to complete. + * + * The async variant is {@see DatabaseAdminClient::restoreDatabaseAsync()} . + * + * @example samples/V1/DatabaseAdminClient/restore_database.php + * + * @param RestoreDatabaseRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function restoreDatabase(RestoreDatabaseRequest $request, array $callOptions = []): OperationResponse; + + /** + * Sets the access control policy on a database or backup resource. + * Replaces any existing policy. + * + * Authorization requires `spanner.databases.setIamPolicy` + * permission on [resource][google.iam.v1.SetIamPolicyRequest.resource]. + * For backups, authorization requires `spanner.backups.setIamPolicy` + * permission on [resource][google.iam.v1.SetIamPolicyRequest.resource]. + * + * The async variant is {@see DatabaseAdminClient::setIamPolicyAsync()} . + * + * @example samples/V1/DatabaseAdminClient/set_iam_policy.php + * + * @param SetIamPolicyRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Policy + * + * @throws ApiException Thrown if the API call fails. + */ + public function setIamPolicy(SetIamPolicyRequest $request, array $callOptions = []): Policy; + + /** + * Returns permissions that the caller has on the specified database or backup + * resource. + * + * Attempting this RPC on a non-existent Cloud Spanner database will + * result in a NOT_FOUND error if the user has + * `spanner.databases.list` permission on the containing Cloud + * Spanner instance. Otherwise returns an empty set of permissions. + * Calling this method on a backup that does not exist will + * result in a NOT_FOUND error if the user has + * `spanner.backups.list` permission on the containing instance. + * + * The async variant is {@see DatabaseAdminClient::testIamPermissionsAsync()} . + * + * @example samples/V1/DatabaseAdminClient/test_iam_permissions.php + * + * @param TestIamPermissionsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return TestIamPermissionsResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function testIamPermissions(TestIamPermissionsRequest $request, array $callOptions = []): TestIamPermissionsResponse; + + /** + * Updates a pending or completed + * [Backup][google.spanner.admin.database.v1.Backup]. + * + * The async variant is {@see DatabaseAdminClient::updateBackupAsync()} . + * + * @example samples/V1/DatabaseAdminClient/update_backup.php + * + * @param UpdateBackupRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Backup + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateBackup(UpdateBackupRequest $request, array $callOptions = []): Backup; + + /** + * Updates a backup schedule. + * + * The async variant is {@see DatabaseAdminClient::updateBackupScheduleAsync()} . + * + * @example samples/V1/DatabaseAdminClient/update_backup_schedule.php + * + * @param UpdateBackupScheduleRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return BackupSchedule + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateBackupSchedule(UpdateBackupScheduleRequest $request, array $callOptions = []): BackupSchedule; + + /** + * Updates a Cloud Spanner database. The returned + * [long-running operation][google.longrunning.Operation] can be used to track + * the progress of updating the database. If the named database does not + * exist, returns `NOT_FOUND`. + * + * While the operation is pending: + * + * * The database's + * [reconciling][google.spanner.admin.database.v1.Database.reconciling] + * field is set to true. + * * Cancelling the operation is best-effort. If the cancellation succeeds, + * the operation metadata's + * [cancel_time][google.spanner.admin.database.v1.UpdateDatabaseMetadata.cancel_time] + * is set, the updates are reverted, and the operation terminates with a + * `CANCELLED` status. + * * New UpdateDatabase requests will return a `FAILED_PRECONDITION` error + * until the pending operation is done (returns successfully or with + * error). + * * Reading the database via the API continues to give the pre-request + * values. + * + * Upon completion of the returned operation: + * + * * The new values are in effect and readable via the API. + * * The database's + * [reconciling][google.spanner.admin.database.v1.Database.reconciling] + * field becomes false. + * + * The returned [long-running operation][google.longrunning.Operation] will + * have a name of the format + * `projects//instances//databases//operations/` + * and can be used to track the database modification. The + * [metadata][google.longrunning.Operation.metadata] field type is + * [UpdateDatabaseMetadata][google.spanner.admin.database.v1.UpdateDatabaseMetadata]. + * The [response][google.longrunning.Operation.response] field type is + * [Database][google.spanner.admin.database.v1.Database], if successful. + * + * The async variant is {@see DatabaseAdminClient::updateDatabaseAsync()} . + * + * @example samples/V1/DatabaseAdminClient/update_database.php + * + * @param UpdateDatabaseRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateDatabase(UpdateDatabaseRequest $request, array $callOptions = []): OperationResponse; + + /** + * Updates the schema of a Cloud Spanner database by + * creating/altering/dropping tables, columns, indexes, etc. The returned + * [long-running operation][google.longrunning.Operation] will have a name of + * the format `/operations/` and can be used to + * track execution of the schema change(s). The + * [metadata][google.longrunning.Operation.metadata] field type is + * [UpdateDatabaseDdlMetadata][google.spanner.admin.database.v1.UpdateDatabaseDdlMetadata]. + * The operation has no response. + * + * The async variant is {@see DatabaseAdminClient::updateDatabaseDdlAsync()} . + * + * @example samples/V1/DatabaseAdminClient/update_database_ddl.php + * + * @param UpdateDatabaseDdlRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateDatabaseDdl(UpdateDatabaseDdlRequest $request, array $callOptions = []): OperationResponse; +} From 9fa3acf3a40e0837842c731dbe6f449b5a736bff Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Thu, 30 Apr 2026 11:12:50 -0700 Subject: [PATCH 5/5] fix cs --- src/Generation/GapicClientV2Generator.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Generation/GapicClientV2Generator.php b/src/Generation/GapicClientV2Generator.php index 6cad4c4a1..0c6df9208 100644 --- a/src/Generation/GapicClientV2Generator.php +++ b/src/Generation/GapicClientV2Generator.php @@ -194,7 +194,8 @@ private function generateInterface(PhpClass $class): PhpInterface ), PhpDoc::text( 'This interface defines the methods available for calling ' . - (is_null($this->serviceDetails->apiVersion) + ( + is_null($this->serviceDetails->apiVersion) ? 'the backing service API' : $this->serviceDetails->shortName . ' version ' . $this->serviceDetails->apiVersion ) . '.'